alpinejs
Version:
Alpine.js offers you the reactive and declarative nature of big frameworks like Vue or React at a much lower cost.
1 lines • 30.3 kB
Source Map (JSON)
{"version":3,"file":"alpine.mjs","sources":["../src/utils.js","../src/component.js","../src/index.js"],"sourcesContent":["\n// Thanks @stimulus:\n// https://github.com/stimulusjs/stimulus/blob/master/packages/%40stimulus/core/src/application.ts\nexport function domReady() {\n return new Promise(resolve => {\n if (document.readyState == \"loading\") {\n document.addEventListener(\"DOMContentLoaded\", resolve)\n } else {\n resolve()\n }\n })\n}\n\nexport function isTesting() {\n return navigator.userAgent, navigator.userAgent.includes(\"Node.js\")\n || navigator.userAgent.includes(\"jsdom\")\n}\n\nexport function kebabCase(subject) {\n return subject.replace(/([a-z])([A-Z])/g, '$1-$2').replace(/[_\\s]/, '-').toLowerCase()\n}\n\nexport function walkSkippingNestedComponents(el, callback, isRoot = true) {\n if (el.hasAttribute('x-data') && ! isRoot) return\n\n callback(el)\n\n let node = el.firstElementChild\n\n while (node) {\n walkSkippingNestedComponents(node, callback, false)\n\n node = node.nextElementSibling\n }\n}\n\nexport function debounce(func, wait, immediate) {\n var timeout;\n return function () {\n var context = this, args = arguments;\n var later = function () {\n timeout = null;\n if (!immediate) func.apply(context, args);\n };\n var callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow) func.apply(context, args);\n };\n};\n\nexport function onlyUnique(value, index, self) {\n return self.indexOf(value) === index;\n}\n\nexport function saferEval(expression, dataContext, additionalHelperVariables = {}) {\n return (new Function(['$data', ...Object.keys(additionalHelperVariables)], `var result; with($data) { result = ${expression} }; return result`))(\n dataContext, ...Object.values(additionalHelperVariables)\n )\n}\n\nexport function saferEvalNoReturn(expression, dataContext, additionalHelperVariables = {}) {\n return (new Function(['$data', ...Object.keys(additionalHelperVariables)], `with($data) { ${expression} }`))(\n dataContext, ...Object.values(additionalHelperVariables)\n )\n}\n\nexport function isXAttr(attr) {\n const xAttrRE = /x-(on|bind|data|text|model|if|show|cloak|ref)/\n\n return xAttrRE.test(attr.name)\n}\n\nexport function getXAttrs(el, type) {\n return Array.from(el.attributes)\n .filter(isXAttr)\n .map(attr => {\n const typeMatch = attr.name.match(/x-(on|bind|data|text|model|if|show|cloak|ref)/)\n const valueMatch = attr.name.match(/:([a-zA-Z\\-]+)/)\n const modifiers = attr.name.match(/\\.[^.\\]]+(?=[^\\]]*$)/g) || []\n\n return {\n type: typeMatch ? typeMatch[1] : null,\n value: valueMatch ? valueMatch[1] : null,\n modifiers: modifiers.map(i => i.replace('.', '')),\n expression: attr.value,\n }\n })\n .filter(i => {\n // If no type is passed in for filtering, bypassfilter\n if (! type) return true\n\n return i.type === name\n })\n}\n","import { walkSkippingNestedComponents, kebabCase, saferEval, saferEvalNoReturn, getXAttrs, debounce } from './utils'\n\nexport default class Component {\n constructor(el) {\n this.el = el\n\n const rawData = saferEval(this.el.getAttribute('x-data'), {})\n\n this.data = this.wrapDataInObservable(rawData)\n\n this.initialize()\n\n this.listenForNewElementsToInitialize()\n }\n\n wrapDataInObservable(data) {\n this.concernedData = []\n\n var self = this\n\n const proxyHandler = keyPrefix => ({\n set(obj, property, value) {\n const propertyName = keyPrefix ? `${keyPrefix}.${property}` : property\n\n const setWasSuccessful = Reflect.set(obj, property, value)\n\n if (self.concernedData.indexOf(propertyName) === -1) {\n self.concernedData.push(propertyName)\n }\n\n self.refresh()\n\n return setWasSuccessful\n },\n get(target, key) {\n if (typeof target[key] === 'object' && target[key] !== null) {\n const propertyName = keyPrefix ? `${keyPrefix}.${key}` : key\n\n return new Proxy(target[key], proxyHandler(propertyName))\n }\n\n return target[key]\n }\n })\n\n return new Proxy(data, proxyHandler())\n }\n\n initialize() {\n walkSkippingNestedComponents(this.el, el => {\n this.initializeElement(el)\n })\n }\n\n initializeElement(el) {\n getXAttrs(el).forEach(({ type, value, modifiers, expression }) => {\n switch (type) {\n case 'on':\n var event = value\n this.registerListener(el, event, modifiers, expression)\n break;\n\n case 'model':\n // If the element we are binding to is a select, a radio, or checkbox\n // we'll listen for the change event instead of the \"input\" event.\n var event = (el.tagName.toLowerCase() === 'select')\n || ['checkbox', 'radio'].includes(el.type)\n || modifiers.includes('lazy')\n ? 'change' : 'input'\n\n const listenerExpression = this.generateExpressionForXModelListener(el, modifiers, expression)\n\n this.registerListener(el, event, modifiers, listenerExpression)\n\n var attrName = 'value'\n var { output } = this.evaluateReturnExpression(expression)\n this.updateAttributeValue(el, attrName, output)\n break;\n\n case 'bind':\n var attrName = value\n var { output } = this.evaluateReturnExpression(expression)\n this.updateAttributeValue(el, attrName, output)\n break;\n\n case 'text':\n var { output } = this.evaluateReturnExpression(expression)\n this.updateTextValue(el, output)\n break;\n\n case 'show':\n var { output } = this.evaluateReturnExpression(expression)\n this.updateVisibility(el, output)\n break;\n\n case 'if':\n var { output } = this.evaluateReturnExpression(expression)\n this.updatePresence(el, output)\n break;\n\n case 'cloak':\n el.removeAttribute('x-cloak')\n break;\n\n default:\n break;\n }\n })\n }\n\n listenForNewElementsToInitialize() {\n const targetNode = this.el\n\n const observerOptions = {\n childList: true,\n attributes: true,\n subtree: true,\n }\n\n const observer = new MutationObserver((mutations) => {\n for (let i=0; i < mutations.length; i++){\n // Filter out mutations triggered from child components.\n if (! mutations[i].target.closest('[x-data]').isSameNode(this.el)) return\n\n if (mutations[i].type === 'attributes' && mutations[i].attributeName === 'x-data') {\n const rawData = saferEval(mutations[i].target.getAttribute('x-data'), {})\n\n Object.keys(rawData).forEach(key => {\n if (this.data[key] !== rawData[key]) {\n this.data[key] = rawData[key]\n }\n })\n }\n\n if (mutations[i].addedNodes.length > 0) {\n mutations[i].addedNodes.forEach(node => {\n if (node.nodeType !== 1) return\n\n if (node.matches('[x-data]')) return\n\n if (getXAttrs(node).length > 0) {\n this.initializeElement(node)\n }\n })\n }\n }\n })\n\n observer.observe(targetNode, observerOptions);\n }\n\n refresh() {\n var self = this\n\n const actionByDirectiveType = {\n 'model': ({el, output}) => { self.updateAttributeValue(el, 'value', output) },\n 'bind': ({el, attrName, output}) => { self.updateAttributeValue(el, attrName, output) },\n 'text': ({el, output}) => { self.updateTextValue(el, output) },\n 'show': ({el, output}) => { self.updateVisibility(el, output) },\n 'if': ({el, output}) => { self.updatePresence(el, output) },\n }\n\n const walkThenClearDependancyTracker = (rootEl, callback) => {\n walkSkippingNestedComponents(rootEl, callback)\n\n self.concernedData = []\n }\n\n debounce(walkThenClearDependancyTracker, 5)(this.el, function (el) {\n getXAttrs(el).forEach(({ type, value, expression }) => {\n if (! actionByDirectiveType[type]) return\n\n var { output, deps } = self.evaluateReturnExpression(expression)\n\n if (self.concernedData.filter(i => deps.includes(i)).length > 0) {\n (actionByDirectiveType[type])({ el, attrName: value, output })\n }\n })\n })\n }\n\n generateExpressionForXModelListener(el, modifiers, dataKey) {\n var rightSideOfExpression = ''\n if (el.type === 'checkbox') {\n // If the data we are binding to is an array, toggle it's value inside the array.\n if (Array.isArray(this.data[dataKey])) {\n rightSideOfExpression = `$event.target.checked ? ${dataKey}.concat([$event.target.value]) : ${dataKey}.filter(i => i !== $event.target.value)`\n } else {\n rightSideOfExpression = `$event.target.checked`\n }\n } else if (el.tagName.toLowerCase() === 'select' && el.multiple) {\n rightSideOfExpression = modifiers.includes('number')\n ? 'Array.from($event.target.selectedOptions).map(option => { return parseFloat(option.value || option.text) })'\n : 'Array.from($event.target.selectedOptions).map(option => { return option.value || option.text })'\n } else {\n rightSideOfExpression = modifiers.includes('number')\n ? 'parseFloat($event.target.value)'\n : (modifiers.includes('trim') ? '$event.target.value.trim()' : '$event.target.value')\n }\n\n if (el.type === 'radio') {\n // Radio buttons only work properly when they share a name attribute.\n // People might assume we take care of that for them, because\n // they already set a shared \"x-model\" attribute.\n if (! el.hasAttribute('name')) el.setAttribute('name', dataKey)\n }\n\n return `${dataKey} = ${rightSideOfExpression}`\n }\n\n registerListener(el, event, modifiers, expression) {\n if (modifiers.includes('away')) {\n const handler = e => {\n // Don't do anything if the click came form the element or within it.\n if (el.contains(e.target)) return\n\n // Don't do anything if this element isn't currently visible.\n if (el.offsetWidth < 1 && el.offsetHeight < 1) return\n\n // Now that we are sure the element is visible, AND the click\n // is from outside it, let's run the expression.\n this.runListenerHandler(expression, e)\n\n if (modifiers.includes('once')) {\n document.removeEventListener(event, handler)\n }\n }\n\n // Listen for this event at the root level.\n document.addEventListener(event, handler)\n } else {\n const listenerTarget = modifiers.includes('window') ? window : el\n\n const handler = e => {\n const modifiersWithoutWindow = modifiers.filter(i => i !== 'window')\n\n if (event === 'keydown' && modifiersWithoutWindow.length > 0 && ! modifiersWithoutWindow.includes(kebabCase(e.key))) return\n\n if (modifiers.includes('prevent')) e.preventDefault()\n if (modifiers.includes('stop')) e.stopPropagation()\n\n this.runListenerHandler(expression, e)\n\n if (modifiers.includes('once')) {\n listenerTarget.removeEventListener(event, handler)\n }\n }\n\n listenerTarget.addEventListener(event, handler)\n }\n }\n\n runListenerHandler(expression, e) {\n this.evaluateCommandExpression(expression, {\n '$event': e,\n '$refs': this.getRefsProxy(),\n })\n }\n\n evaluateReturnExpression(expression) {\n var affectedDataKeys = []\n\n const proxyHandler = prefix => ({\n get(object, prop) {\n // Sometimes non-proxyable values are accessed. These are of type \"symbol\".\n // We can ignore them.\n if (typeof prop === 'symbol') return\n\n const propertyName = prefix ? `${prefix}.${prop}` : prop\n\n // If we are accessing an object prop, we'll make this proxy recursive to build\n // a nested dependancy key.\n if (typeof object[prop] === 'object' && object[prop] !== null && ! Array.isArray(object[prop])) {\n return new Proxy(object[prop], proxyHandler(propertyName))\n }\n\n affectedDataKeys.push(propertyName)\n\n return object[prop]\n }\n })\n\n const proxiedData = new Proxy(this.data, proxyHandler())\n\n const result = saferEval(expression, proxiedData)\n\n return {\n output: result,\n deps: affectedDataKeys\n }\n }\n\n evaluateCommandExpression(expression, extraData) {\n saferEvalNoReturn(expression, this.data, extraData)\n }\n\n updateTextValue(el, value) {\n el.innerText = value\n }\n\n updateVisibility(el, value) {\n if (! value) {\n el.style.display = 'none'\n } else {\n if (el.style.length === 1 && el.style.display !== '') {\n el.removeAttribute('style')\n } else {\n el.style.removeProperty('display')\n }\n }\n }\n\n updatePresence(el, expressionResult) {\n if (el.nodeName.toLowerCase() !== 'template') console.warn(`Alpine: [x-if] directive should only be added to <template> tags.`)\n\n const elementHasAlreadyBeenAdded = el.nextElementSibling && el.nextElementSibling.__x_inserted_me === true\n\n if (expressionResult && ! elementHasAlreadyBeenAdded) {\n const clone = document.importNode(el.content, true);\n\n el.parentElement.insertBefore(clone, el.nextElementSibling)\n\n el.nextElementSibling.__x_inserted_me = true\n } else if (! expressionResult && elementHasAlreadyBeenAdded) {\n el.nextElementSibling.remove()\n }\n }\n\n updateAttributeValue(el, attrName, value) {\n if (attrName === 'value') {\n if (el.type === 'radio') {\n el.checked = el.value == value\n } else if (el.type === 'checkbox') {\n if (Array.isArray(value)) {\n // I'm purposely not using Array.includes here because it's\n // strict, and because of Numeric/String mis-casting, I\n // want the \"includes\" to be \"fuzzy\".\n let valueFound = false\n value.forEach(val => {\n if (val == el.value) {\n valueFound = true\n }\n })\n\n el.checked = valueFound\n } else {\n el.checked = !! value\n }\n } else if (el.tagName === 'SELECT') {\n this.updateSelect(el, value)\n } else {\n el.value = value\n }\n } else if (attrName === 'class') {\n if (Array.isArray(value)) {\n el.setAttribute('class', value.join(' '))\n } else {\n // Use the class object syntax that vue uses to toggle them.\n Object.keys(value).forEach(classNames => {\n if (value[classNames]) {\n classNames.split(' ').forEach(className => el.classList.add(className))\n } else {\n classNames.split(' ').forEach(className => el.classList.remove(className))\n }\n })\n }\n } else if (['disabled', 'readonly', 'required', 'checked', 'hidden'].includes(attrName)) {\n // Boolean attributes have to be explicitly added and removed, not just set.\n if (!! value) {\n el.setAttribute(attrName, '')\n } else {\n el.removeAttribute(attrName)\n }\n } else {\n el.setAttribute(attrName, value)\n }\n }\n\n updateSelect(el, value) {\n const arrayWrappedValue = [].concat(value).map(value => { return value + '' })\n\n Array.from(el.options).forEach(option => {\n option.selected = arrayWrappedValue.includes(option.value || option.text)\n })\n }\n\n getRefsProxy() {\n var self = this\n\n // One of the goals of this is to not hold elements in memory, but rather re-evaluate\n // the DOM when the system needs something from it. This way, the framework is flexible and\n // friendly to outside DOM changes from libraries like Vue/Livewire.\n // For this reason, I'm using an \"on-demand\" proxy to fake a \"$refs\" object.\n return new Proxy({}, {\n get(object, property) {\n var ref\n\n // We can't just query the DOM because it's hard to filter out refs in\n // nested components.\n walkSkippingNestedComponents(self.el, el => {\n if (el.hasAttribute('x-ref') && el.getAttribute('x-ref') === property) {\n ref = el\n }\n })\n\n return ref\n }\n })\n }\n}\n","import Component from './component'\nimport { domReady, isTesting } from './utils'\n\nconst Alpine = {\n start: async function () {\n if (! isTesting()) {\n await domReady()\n }\n\n this.discoverComponents(el => {\n this.initializeComponent(el)\n })\n\n // It's easier and more performant to just support Turbolinks than listen\n // to MutationOberserver mutations at the document level.\n document.addEventListener(\"turbolinks:load\", () => {\n this.discoverUninitializedComponents(el => {\n this.initializeComponent(el)\n })\n })\n\n this.listenForNewUninitializedComponentsAtRunTime(el => {\n this.initializeComponent(el)\n })\n },\n\n discoverComponents: function (callback) {\n const rootEls = document.querySelectorAll('[x-data]');\n\n rootEls.forEach(rootEl => {\n callback(rootEl)\n })\n },\n\n discoverUninitializedComponents: function (callback) {\n const rootEls = document.querySelectorAll('[x-data]');\n\n Array.from(rootEls)\n .filter(el => el.__x === undefined)\n .forEach(rootEl => {\n callback(rootEl)\n })\n },\n\n listenForNewUninitializedComponentsAtRunTime: function (callback) {\n const targetNode = document.querySelector('body');\n\n const observerOptions = {\n childList: true,\n attributes: true,\n subtree: true,\n }\n\n const observer = new MutationObserver((mutations) => {\n for (let i=0; i < mutations.length; i++){\n if (mutations[i].addedNodes.length > 0) {\n mutations[i].addedNodes.forEach(node => {\n if (node.nodeType !== 1) return\n\n if (node.matches('[x-data]')) callback(node)\n })\n }\n }\n })\n\n observer.observe(targetNode, observerOptions)\n },\n\n initializeComponent: function (el) {\n el.__x = new Component(el)\n }\n}\n\nif (! isTesting()) {\n window.Alpine = Alpine\n window.Alpine.start()\n}\n\nexport default Alpine\n"],"names":["isTesting","navigator","userAgent","includes","walkSkippingNestedComponents","el","callback","isRoot","hasAttribute","node","firstElementChild","nextElementSibling","saferEval","expression","dataContext","additionalHelperVariables","Function","Object","keys","values","isXAttr","attr","test","name","getXAttrs","type","Array","from","attributes","filter","map","typeMatch","match","valueMatch","modifiers","value","i","replace","Component","constructor","rawData","this","getAttribute","data","wrapDataInObservable","initialize","listenForNewElementsToInitialize","concernedData","self","proxyHandler","keyPrefix","set","obj","property","propertyName","setWasSuccessful","Reflect","indexOf","push","refresh","get","target","key","Proxy","initializeElement","forEach","ref","registerListener","event","tagName","toLowerCase","listenerExpression","generateExpressionForXModelListener","attrName","evaluateReturnExpression","updateAttributeValue","updateTextValue","updateVisibility","updatePresence","removeAttribute","targetNode","MutationObserver","mutations","let","length","closest","isSameNode","attributeName","addedNodes","nodeType","matches","observe","func","timeout","actionByDirectiveType","rootEl","context","args","arguments","clearTimeout","setTimeout","apply","deps","output","dataKey","rightSideOfExpression","isArray","multiple","setAttribute","handler","e","contains","offsetWidth","offsetHeight","runListenerHandler","removeEventListener","addEventListener","listenerTarget","window","modifiersWithoutWindow","preventDefault","stopPropagation","evaluateCommandExpression","getRefsProxy","affectedDataKeys","prefix","object","prop","extraData","innerText","style","display","removeProperty","expressionResult","nodeName","console","warn","elementHasAlreadyBeenAdded","__x_inserted_me","clone","document","importNode","content","parentElement","insertBefore","remove","checked","valueFound","val","updateSelect","join","classNames","split","className","classList","add","arrayWrappedValue","concat","options","option","selected","text","const","Alpine","start","discoverComponents","initializeComponent","discoverUninitializedComponents","listenForNewUninitializedComponentsAtRunTime","Promise","resolve","readyState","querySelectorAll","rootEls","undefined","__x","querySelector","childList","subtree"],"mappings":"AAaA,SAAgBA,WACLC,UAA+BC,UAAUC,SAAS,YAClDF,UAAUC,UAAUC,SAAS,SAOxC,SAAgBC,EAA6BC,EAAIC,EAAUC,sBAAS,IAC5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