diff --git a/public/css/dist/skins/skin-green-dark.css b/public/css/dist/skins/skin-green-dark.css index 8e5430e5cd17..e024040c4e36 100644 --- a/public/css/dist/skins/skin-green-dark.css +++ b/public/css/dist/skins/skin-green-dark.css @@ -448,7 +448,7 @@ input[type=search] { background-color: var(--back-sub); } .table-striped > tbody > tr:nth-of-type(even) { - background-color: var(--back-sub-alt); + background-color: var(--back-sub); } #webui > div > div > div > div > div > table > tbody > tr > td > a > i.fa, .box-body, diff --git a/public/css/dist/skins/skin-green-dark.min.css b/public/css/dist/skins/skin-green-dark.min.css index 8e5430e5cd17..e024040c4e36 100644 --- a/public/css/dist/skins/skin-green-dark.min.css +++ b/public/css/dist/skins/skin-green-dark.min.css @@ -448,7 +448,7 @@ input[type=search] { background-color: var(--back-sub); } .table-striped > tbody > tr:nth-of-type(even) { - background-color: var(--back-sub-alt); + background-color: var(--back-sub); } #webui > div > div > div > div > div > table > tbody > tr > td > a > i.fa, .box-body, diff --git a/public/js/dist/all-defer.js b/public/js/dist/all-defer.js index e81b6e8766b7..53e56a8a6721 100644 --- a/public/js/dist/all-defer.js +++ b/public/js/dist/all-defer.js @@ -138,7 +138,7 @@ directives(el, attrs).forEach((handle) => handle()); }); let outNestedComponents = (el) => !closestRoot(el.parentElement, true); - Array.from(document.querySelectorAll(allSelectors())).filter(outNestedComponents).forEach((el) => { + Array.from(document.querySelectorAll(allSelectors().join(","))).filter(outNestedComponents).forEach((el) => { initTree(el); }); dispatch(document, "alpine:initialized"); @@ -387,52 +387,48 @@ return closestDataStack(node.parentNode); } function mergeProxies(objects) { - let thisProxy = new Proxy({}, { - ownKeys: () => { - return Array.from(new Set(objects.flatMap((i) => Object.keys(i)))); - }, - has: (target, name) => { - return objects.some((obj) => obj.hasOwnProperty(name)); - }, - get: (target, name) => { - return (objects.find((obj) => { - if (obj.hasOwnProperty(name)) { - let descriptor = Object.getOwnPropertyDescriptor(obj, name); - if (descriptor.get && descriptor.get._x_alreadyBound || descriptor.set && descriptor.set._x_alreadyBound) { - return true; - } - if ((descriptor.get || descriptor.set) && descriptor.enumerable) { - let getter = descriptor.get; - let setter = descriptor.set; - let property = descriptor; - getter = getter && getter.bind(thisProxy); - setter = setter && setter.bind(thisProxy); - if (getter) - getter._x_alreadyBound = true; - if (setter) - setter._x_alreadyBound = true; - Object.defineProperty(obj, name, { - ...property, - get: getter, - set: setter - }); - } - return true; - } - return false; - }) || {})[name]; - }, - set: (target, name, value) => { - let closestObjectWithKey = objects.find((obj) => obj.hasOwnProperty(name)); - if (closestObjectWithKey) { - closestObjectWithKey[name] = value; - } else { - objects[objects.length - 1][name] = value; - } - return true; - } - }); - return thisProxy; + return new Proxy({ objects }, mergeProxyTrap); + } + var mergeProxyTrap = { + ownKeys({ objects }) { + return Array.from( + new Set(objects.flatMap((i) => Object.keys(i))) + ); + }, + has({ objects }, name) { + if (name == Symbol.unscopables) + return false; + return objects.some( + (obj) => Object.prototype.hasOwnProperty.call(obj, name) + ); + }, + get({ objects }, name, thisProxy) { + if (name == "toJSON") + return collapseProxies; + return Reflect.get( + objects.find( + (obj) => Object.prototype.hasOwnProperty.call(obj, name) + ) || {}, + name, + thisProxy + ); + }, + set({ objects }, name, value, thisProxy) { + const target = objects.find( + (obj) => Object.prototype.hasOwnProperty.call(obj, name) + ) || objects[objects.length - 1]; + const descriptor = Object.getOwnPropertyDescriptor(target, name); + if (descriptor?.set && descriptor?.get) + return Reflect.set(target, name, value, thisProxy); + return Reflect.set(target, name, value); + } + }; + function collapseProxies() { + let keys = Reflect.ownKeys(this); + return keys.reduce((acc, key) => { + acc[key] = Reflect.get(this, key); + return acc; + }, {}); } // packages/alpinejs/src/interceptor.js @@ -589,7 +585,14 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); let rightSideSafeExpression = /^[\n\s]*if.*\(.*\)/.test(expression.trim()) || /^(let|const)\s/.test(expression.trim()) ? `(async()=>{ ${expression} })()` : expression; const safeAsyncFunction = () => { try { - return new AsyncFunction(["__self", "scope"], `with (scope) { __self.result = ${rightSideSafeExpression} }; __self.finished = true; return __self.result;`); + let func2 = new AsyncFunction( + ["__self", "scope"], + `with (scope) { __self.result = ${rightSideSafeExpression} }; __self.finished = true; return __self.result;` + ); + Object.defineProperty(func2, "name", { + value: `[Alpine] ${expression}` + }); + return func2; } catch (error2) { handleError(error2, el, expression); return Promise.resolve(); @@ -762,7 +765,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); function toParsedDirectives(transformedAttributeMap, originalAttributeOverride) { return ({ name, value }) => { let typeMatch = name.match(alpineAttributeRegex()); - let valueMatch = name.match(/:([a-zA-Z0-9\-:]+)/); + let valueMatch = name.match(/:([a-zA-Z0-9\-_:]+)/); let modifiers = name.match(/\.[^.\]]+(?=[^\]]*$)/g) || []; let original = originalAttributeOverride || transformedAttributeMap[name] || name; return { @@ -780,6 +783,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); "ref", "data", "id", + "anchor", "bind", "init", "for", @@ -1052,7 +1056,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); el._x_hidePromise = el._x_transition ? new Promise((resolve, reject) => { el._x_transition.out(() => { }, () => resolve(hide)); - el._x_transitioning.beforeCancel(() => reject({ isFromCancelledTransition: true })); + el._x_transitioning && el._x_transitioning.beforeCancel(() => reject({ isFromCancelledTransition: true })); }) : Promise.resolve(hide); queueMicrotask(() => { let closest = closestHide(el); @@ -1206,11 +1210,12 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); function onlyDuringClone(callback) { return (...args) => isCloning && callback(...args); } + var interceptors = []; + function interceptClone(callback) { + interceptors.push(callback); + } function cloneNode(from, to) { - if (from._x_dataStack) { - to._x_dataStack = from._x_dataStack; - to.setAttribute("data-has-alpine-state", true); - } + interceptors.forEach((i) => i(from, to)); isCloning = true; dontRegisterReactiveSideEffects(() => { initTree(to, (el, callback) => { @@ -1255,13 +1260,6 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); callback(); overrideEffect(cache); } - function shouldSkipRegisteringDataDuringClone(el) { - if (!isCloning) - return false; - if (isCloningLegacy) - return true; - return el.hasAttribute("data-has-alpine-state"); - } // packages/alpinejs/src/utils/bind.js function bind(el, name, value, modifiers = []) { @@ -1294,7 +1292,11 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); el.value = value; } if (window.fromModel) { - el.checked = checkedAttrLooseCompare(el.value, value); + if (typeof value === "boolean") { + el.checked = safeParseBoolean(el.value) === value; + } else { + el.checked = checkedAttrLooseCompare(el.value, value); + } } } else if (el.type === "checkbox") { if (Number.isInteger(value)) { @@ -1363,6 +1365,15 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); function checkedAttrLooseCompare(valueA, valueB) { return valueA == valueB; } + function safeParseBoolean(rawValue) { + if ([1, "1", "true", "on", "yes", true].includes(rawValue)) { + return true; + } + if ([0, "0", "false", "off", "no", false].includes(rawValue)) { + return false; + } + return rawValue ? Boolean(rawValue) : null; + } function isBooleanAttr(attrName) { const booleanAttributes = [ "disabled", @@ -1455,35 +1466,34 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); // packages/alpinejs/src/entangle.js function entangle({ get: outerGet, set: outerSet }, { get: innerGet, set: innerSet }) { let firstRun = true; - let outerHash, innerHash, outerHashLatest, innerHashLatest; + let outerHash; let reference = effect(() => { - let outer, inner; + const outer = outerGet(); + const inner = innerGet(); if (firstRun) { - outer = outerGet(); - innerSet(JSON.parse(JSON.stringify(outer))); - inner = innerGet(); + innerSet(cloneIfObject(outer)); firstRun = false; + outerHash = JSON.stringify(outer); } else { - outer = outerGet(); - inner = innerGet(); - outerHashLatest = JSON.stringify(outer); - innerHashLatest = JSON.stringify(inner); + const outerHashLatest = JSON.stringify(outer); if (outerHashLatest !== outerHash) { - inner = innerGet(); - innerSet(outer); - inner = outer; + innerSet(cloneIfObject(outer)); + outerHash = outerHashLatest; } else { - outerSet(JSON.parse(innerHashLatest ?? null)); - outer = inner; + outerSet(cloneIfObject(inner)); + outerHash = JSON.stringify(inner); } } - outerHash = JSON.stringify(outer); - innerHash = JSON.stringify(inner); + JSON.stringify(innerGet()); + JSON.stringify(outerGet()); }); return () => { release(reference); }; } + function cloneIfObject(value) { + return typeof value === "object" ? JSON.parse(JSON.stringify(value)) : value; + } // packages/alpinejs/src/plugin.js function plugin(callback) { @@ -1594,7 +1604,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); get raw() { return raw; }, - version: "3.13.0", + version: "3.13.3", flushAndStopDeferringMutations, dontAutoEvaluateFunctions, disableEffectScheduling, @@ -1608,6 +1618,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); onlyDuringClone, addRootSelector, addInitSelector, + interceptClone, addScopeToNode, deferMutations, mapAttributes, @@ -2447,7 +2458,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); warnMissingPluginMagic("Focus", "focus", "focus"); warnMissingPluginMagic("Persist", "persist", "persist"); function warnMissingPluginMagic(name, magicName, slug) { - magic(magicName, (el) => warn(`You can't use [$${directiveName}] without first installing the "${name}" plugin here: https://alpinejs.dev/plugins/${slug}`, el)); + magic(magicName, (el) => warn(`You can't use [$${magicName}] without first installing the "${name}" plugin here: https://alpinejs.dev/plugins/${slug}`, el)); } // packages/alpinejs/src/directives/x-modelable.js @@ -2492,20 +2503,15 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); }); // packages/alpinejs/src/directives/x-teleport.js - var teleportContainerDuringClone = document.createElement("div"); directive("teleport", (el, { modifiers, expression }, { cleanup: cleanup2 }) => { if (el.tagName.toLowerCase() !== "template") warn("x-teleport can only be used on a