فهرست منبع

Standardaze ._x_ property camelCasing

Caleb Porzio 4 سال پیش
والد
کامیت
4d319afbfe

+ 1 - 1
packages/alpinejs/src/directives.js

@@ -76,7 +76,7 @@ export function getDirectiveHandler(el, directive) {
     onAttributeRemoved(el, directive.original, doCleanup)
 
     let fullHandler = () => {
-        if (el._x_ignore || el._x_ignore_self) return
+        if (el._x_ignore || el._x_ignoreSelf) return
 
         handler.inline && handler.inline(el, directive, utilities)
 

+ 1 - 1
packages/alpinejs/src/directives/x-bind.js

@@ -39,5 +39,5 @@ function applyBindingsObject(el, expression, original, effect) {
 }
 
 function storeKeyForXFor(el, expression) {
-    el._x_key_expression = expression
+    el._x_keyExpression = expression
 }

+ 5 - 5
packages/alpinejs/src/directives/x-for.js

@@ -12,10 +12,10 @@ directive('for', (el, { expression }, { effect, cleanup }) => {
     let evaluateItems = evaluateLater(el, iteratorNames.items)
     let evaluateKey = evaluateLater(el,
         // the x-bind:key expression is stored for our use instead of evaluated.
-        el._x_key_expression || 'index'
+        el._x_keyExpression || 'index'
     )
 
-    el._x_prev_keys = []
+    el._x_prevKeys = []
     el._x_lookup = {}
 
     effect(() => loop(el, iteratorNames, evaluateItems, evaluateKey))
@@ -23,7 +23,7 @@ directive('for', (el, { expression }, { effect, cleanup }) => {
     cleanup(() => {
         Object.values(el._x_lookup).forEach(el => el.remove())
 
-        delete el._x_prev_keys
+        delete el._x_prevKeys
         delete el._x_lookup
     })
 })
@@ -45,7 +45,7 @@ function loop(el, iteratorNames, evaluateItems, evaluateKey) {
         }
 
         let lookup = el._x_lookup
-        let prevKeys = el._x_prev_keys
+        let prevKeys = el._x_prevKeys
         let scopes = []
         let keys = []
 
@@ -190,7 +190,7 @@ function loop(el, iteratorNames, evaluateItems, evaluateKey) {
 
         // Now we'll log the keys (and the order they're in) for comparing
         // against next time.
-        templateEl._x_prev_keys = keys
+        templateEl._x_prevKeys = keys
     })
 }
 

+ 2 - 2
packages/alpinejs/src/directives/x-ignore.js

@@ -4,12 +4,12 @@ let handler = () => {}
 
 handler.inline = (el, { modifiers }, { cleanup }) => {
     modifiers.includes('self')
-        ? el._x_ignore_self = true
+        ? el._x_ignoreSelf = true
         : el._x_ignore = true
 
     cleanup(() => {
         modifiers.includes('self')
-            ? delete el._x_ignore_self
+            ? delete el._x_ignoreSelf
             : delete el._x_ignore
     })
 }

+ 2 - 2
packages/alpinejs/src/directives/x-show.js

@@ -9,7 +9,7 @@ directive('show', (el, { modifiers, expression }, { effect }) => {
     let hide = () => mutateDom(() => {
         el.style.display = 'none'
 
-        el._x_is_shown = false
+        el._x_isShown = false
     })
 
     let show = () => mutateDom(() => {
@@ -19,7 +19,7 @@ directive('show', (el, { modifiers, expression }, { effect }) => {
             el.style.removeProperty('display')
         }
 
-        el._x_is_shown = true
+        el._x_isShown = true
     })
 
     // We are wrapping this function in a setTimeout here to prevent

+ 9 - 8
packages/alpinejs/src/directives/x-transition.js

@@ -133,7 +133,8 @@ window.Element.prototype._x_toggleAndCascadeWithTransitions = function (el, valu
         return
     }
 
-    el._x_hide_promise = el._x_transition
+    // Livewire depends on el._x_hidePromise.
+    el._x_hidePromise = el._x_transition
         ? new Promise((resolve, reject) => {
             el._x_transition.out(() => {}, () => resolve(hide))
 
@@ -145,19 +146,19 @@ window.Element.prototype._x_toggleAndCascadeWithTransitions = function (el, valu
         let closest = closestHide(el)
 
         if (closest) {
-            if (! closest._x_hide_children) closest._x_hide_children = []
+            if (! closest._x_hideChildren) closest._x_hideChildren = []
 
-            closest._x_hide_children.push(el)
+            closest._x_hideChildren.push(el)
         } else {
             queueMicrotask(() => {
                 let hideAfterChildren = el => {
                     let carry = Promise.all([
-                        el._x_hide_promise,
-                        ...(el._x_hide_children || []).map(hideAfterChildren)
+                        el._x_hidePromise,
+                        ...(el._x_hideChildren || []).map(hideAfterChildren)
                     ]).then(([i]) => i())
 
-                    delete el._x_hide_promise
-                    delete el._x_hide_children
+                    delete el._x_hidePromise
+                    delete el._x_hideChildren
 
                     return carry
                 }
@@ -175,7 +176,7 @@ function closestHide(el) {
 
     if (! parent) return
 
-    return parent._x_hide_promise ? parent : closestHide(parent)
+    return parent._x_hidePromise ? parent : closestHide(parent)
 }
 
 export function transition(el, setFunction, { during, start, end, entering } = {}, before = () => {}, after = () => {}) {

+ 2 - 2
packages/alpinejs/src/interceptor.js

@@ -11,7 +11,7 @@ export function initInterceptors(data) {
             if (typeof value === 'object' && value !== null && value._x_interceptor) {
                 obj[key] = value.initialize(data, path, key)
             } else {
-                if (isObject(value) && value !== obj) {
+                if (isObject(value) && value !== obj && ! (value instanceof Element)) {
                     recurse(value, path)
                 }
             }
@@ -35,7 +35,7 @@ export function interceptor(callback, mutateObj = () => {}) {
     mutateObj(obj)
 
     return initialValue => {
-        if (typeof initialValue === 'object' && value !== null && initialValue._x_interceptor) {
+        if (typeof initialValue === 'object' && initialValue !== null && initialValue._x_interceptor) {
             // Support nesting interceptors.
             let initialize = obj.initialize.bind(obj)
 

+ 1 - 0
packages/alpinejs/src/reactivity.js

@@ -36,6 +36,7 @@ export function elementBoundEffect(el) {
         if (! el._x_effects) {
             el._x_effects = new Set
 
+            // Livewire depends on el._x_runEffects.
             el._x_runEffects = () => { el._x_effects.forEach(i => i()) }
         }
 

+ 6 - 6
packages/morph/src/morph.js

@@ -94,11 +94,11 @@ function patchNodeValue(dom, to) {
 }
 
 function patchAttributes(dom, to) {
-    if (dom._x_is_shown && ! to._x_is_shown) {
+    if (dom._x_isShown && ! to._x_isShown) {
         return
         // dom._x_hide()
     }
-    if (! dom._x_is_shown && to._x_is_shown) {
+    if (! dom._x_isShown && to._x_isShown) {
         return
         // dom._x_show()
     }
@@ -301,11 +301,11 @@ function initializeAlpineOnTo(from, to, childrenOnly) {
 }
 
 function isHiding(from, to) {
-    return from._x_is_shown && ! to._x_is_shown
+    return from._x_isShown && ! to._x_isShown
 }
 
 function isShowing(from, to) {
-    return ! from._x_is_shown && to._x_is_shown
+    return ! from._x_isShown && to._x_isShown
 }
 
 
@@ -352,7 +352,7 @@ function isShowing(from, to) {
 //         return from.style.display === '' && to.style.display === 'none'
 //     }
 
-//     return from.__x_is_shown && ! to.__x_is_shown
+//     return from._x_isShown && ! to._x_isShown
 // }
 
 // function isShowing(from, to) {
@@ -360,7 +360,7 @@ function isShowing(from, to) {
 //         return from.style.display === 'none' && to.style.display === ''
 //     }
 
-//     return ! from.__x_is_shown && to.__x_is_shown
+//     return ! from._x_isShown && to._x_isShown
 // }
 
 // function beforeAlpineTwoPointSevenPointThree() {