From 7f94b7df32540be7a207732aeedb7c0e02d4c22d Mon Sep 17 00:00:00 2001 From: snipe Date: Thu, 23 Nov 2023 15:01:24 +0000 Subject: [PATCH 01/10] Removed refresh from asset view table Signed-off-by: snipe --- resources/views/account/view-assets.blade.php | 1 - 1 file changed, 1 deletion(-) diff --git a/resources/views/account/view-assets.blade.php b/resources/views/account/view-assets.blade.php index 500937de43ac..3ced14c11d90 100755 --- a/resources/views/account/view-assets.blade.php +++ b/resources/views/account/view-assets.blade.php @@ -390,7 +390,6 @@ data-show-columns="true" data-show-export="true" data-show-footer="true" - data-show-refresh="false" data-sort-order="asc" id="userAssets" class="table table-striped snipe-table" From ad6b286e10f75f0bf48244e884a652473d602bec Mon Sep 17 00:00:00 2001 From: snipe Date: Thu, 23 Nov 2023 15:01:39 +0000 Subject: [PATCH 02/10] Added default location to view-assets view Signed-off-by: snipe --- resources/views/account/view-assets.blade.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/resources/views/account/view-assets.blade.php b/resources/views/account/view-assets.blade.php index 3ced14c11d90..7481e64c4bbd 100755 --- a/resources/views/account/view-assets.blade.php +++ b/resources/views/account/view-assets.blade.php @@ -406,6 +406,7 @@ class="table table-striped snipe-table" {{ trans('general.name') }} {{ trans('admin/hardware/table.asset_model') }} {{ trans('admin/hardware/table.serial') }} + {{ trans('admin/hardware/form.default_location') }} @can('self.view_purchase_cost') {{ trans('general.purchase_cost') }} @endcan @@ -443,7 +444,7 @@ class="table table-striped snipe-table" @endif {{ $asset->serial }} - + {{ ($asset->defaultLoc) ? $asset->defaultLoc->name : '' }} @can('self.view_purchase_cost') {!! Helper::formatCurrencyOutput($asset->purchase_cost) !!} From d4bdaf16e70fd61d1f3d3e3ea70eba8776afaadd Mon Sep 17 00:00:00 2001 From: snipe Date: Thu, 23 Nov 2023 15:13:13 +0000 Subject: [PATCH 03/10] Upgraded webpack to 5.89.0 Signed-off-by: snipe --- package-lock.json | 48 +++++++++++++++++++++++------------------------ package.json | 2 +- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/package-lock.json b/package-lock.json index b6254682a67c..fe6ee29a47a8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1565,27 +1565,27 @@ } }, "@types/eslint": { - "version": "8.44.2", - "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.44.2.tgz", - "integrity": "sha512-sdPRb9K6iL5XZOmBubg8yiFp5yS/JdUDQsq5e6h95km91MCYMuvp7mh1fjPEYUhvHepKpZOjnEaMBR4PxjWDzg==", + "version": "8.44.7", + "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.44.7.tgz", + "integrity": "sha512-f5ORu2hcBbKei97U73mf+l9t4zTGl74IqZ0GQk4oVea/VS8tQZYkUveSYojk+frraAVYId0V2WC9O4PTNru2FQ==", "requires": { "@types/estree": "*", "@types/json-schema": "*" } }, "@types/eslint-scope": { - "version": "3.7.4", - "resolved": "https://registry.npmjs.org/@types/eslint-scope/-/eslint-scope-3.7.4.tgz", - "integrity": "sha512-9K4zoImiZc3HlIp6AVUDE4CWYx22a+lhSZMYNpbjW04+YF0KWj4pJXnEMjdnFTiQibFFmElcsasJXDbdI/EPhA==", + "version": "3.7.7", + "resolved": "https://registry.npmjs.org/@types/eslint-scope/-/eslint-scope-3.7.7.tgz", + "integrity": "sha512-MzMFlSLBqNF2gcHWO0G1vP/YQyfvrxZ0bF+u7mzUdZ1/xK4A4sru+nraZz5i3iEIk1l1uyicaDVTB4QbbEkAYg==", "requires": { "@types/eslint": "*", "@types/estree": "*" } }, "@types/estree": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.1.tgz", - "integrity": "sha512-LG4opVs2ANWZ1TJoKc937iMmNstM/d0ae1vNbnBvBhqCSezgVUOzcLCqbI5elV8Vy6WKwKjaqR+zO9VKirBBCA==" + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz", + "integrity": "sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==" }, "@types/express": { "version": "4.17.13", @@ -4885,9 +4885,9 @@ } }, "es-module-lexer": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.3.0.tgz", - "integrity": "sha512-vZK7T0N2CBmBOixhmjdqx2gWVbFZ4DXZ/NyRMZVlJXPa7CyFS+/a4QQsDGDQy9ZfEzxFuNEsMLeQJnKP2p5/JA==" + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.4.1.tgz", + "integrity": "sha512-cXLGjP0c4T3flZJKQSuziYoq7MlT+rnvfZjfp7h+I7K9BNX54kP9nyWvdbwjQ4u1iWbOL4u96fgeZLToQlZC7w==" }, "es-to-primitive": { "version": "1.2.1", @@ -19644,9 +19644,9 @@ } }, "webpack": { - "version": "5.88.2", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.88.2.tgz", - "integrity": "sha512-JmcgNZ1iKj+aiR0OvTYtWQqJwq37Pf683dY9bVORwVbUrDhLhdn/PlO2sHsFHPkj7sHNQF3JwaAkp49V+Sq1tQ==", + "version": "5.89.0", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.89.0.tgz", + "integrity": "sha512-qyfIC10pOr70V+jkmud8tMfajraGCZMBWJtrmuBymQKCrLTRejBI8STDp1MCyZu/QTdZSeacCQYpYNQVOzX5kw==", "requires": { "@types/eslint-scope": "^3.7.3", "@types/estree": "^1.0.0", @@ -19685,18 +19685,18 @@ "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==" }, "@jridgewell/trace-mapping": { - "version": "0.3.19", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.19.tgz", - "integrity": "sha512-kf37QtfW+Hwx/buWGMPcR60iF9ziHa6r/CZJIHbmcm4+0qrXiVdxegAH0F6yddEVQ7zdkjcGCgCzUu+BcbhQxw==", + "version": "0.3.20", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.20.tgz", + "integrity": "sha512-R8LcPeWZol2zR8mmH3JeKQ6QRCFb7XgUhV9ZlGhHLGyg4wpPiPZNQOOWhFZhxKw8u//yTbNGI42Bx/3paXEQ+Q==", "requires": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" } }, "@types/json-schema": { - "version": "7.0.12", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.12.tgz", - "integrity": "sha512-Hr5Jfhc9eYOQNPYO5WLDq/n4jqijdHNlDXjuAQkkt+mWdQR+XJToOHrsD4cPaMXpn6KO7y2+wM8AZEs8VpBLVA==" + "version": "7.0.15", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==" }, "commander": { "version": "2.20.3", @@ -19727,9 +19727,9 @@ } }, "terser": { - "version": "5.19.2", - "resolved": "https://registry.npmjs.org/terser/-/terser-5.19.2.tgz", - "integrity": "sha512-qC5+dmecKJA4cpYxRa5aVkKehYsQKc+AHeKl0Oe62aYjBL8ZA33tTljktDHJSaxxMnbI5ZYw+o/S2DxxLu8OfA==", + "version": "5.24.0", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.24.0.tgz", + "integrity": "sha512-ZpGR4Hy3+wBEzVEnHvstMvqpD/nABNelQn/z2r0fjVWGQsN3bpOLzQlqDxmb4CDZnXq5lpjnQ+mHQLAOpfM5iw==", "requires": { "@jridgewell/source-map": "^0.3.3", "acorn": "^8.8.2", diff --git a/package.json b/package.json index 2e220c597a86..fff31ab98904 100644 --- a/package.json +++ b/package.json @@ -56,6 +56,6 @@ "tableexport.jquery.plugin": "1.28.0", "tether": "^1.4.0", "vue-resource": "^1.5.2", - "webpack": "^5.88.2" + "webpack": "^5.89.0" } } From 81cf08adf55ac47ec1720e26d192f5613089e077 Mon Sep 17 00:00:00 2001 From: snipe Date: Thu, 23 Nov 2023 15:16:40 +0000 Subject: [PATCH 04/10] Updated acorn to 8.11.2 Signed-off-by: snipe --- package-lock.json | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index fe6ee29a47a8..31f62b0e4fab 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2078,9 +2078,9 @@ } }, "acorn": { - "version": "8.10.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz", - "integrity": "sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==" + "version": "8.11.2", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.2.tgz", + "integrity": "sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w==" }, "acorn-import-assertions": { "version": "1.9.0", diff --git a/package.json b/package.json index fff31ab98904..00e3b774d0cd 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ }, "dependencies": { "@fortawesome/fontawesome-free": "^6.4.2", - "acorn": "^8.9.0", + "acorn": "^8.11.2", "acorn-import-assertions": "^1.9.0", "admin-lte": "^2.4.18", "ajv": "^6.12.6", From 8e3657d62e4afaf0e894e83a013a0c27b70d7171 Mon Sep 17 00:00:00 2001 From: snipe Date: Thu, 23 Nov 2023 15:19:59 +0000 Subject: [PATCH 05/10] Upgrade alpinejs from 3.12.3 to 3.13.2 #13936 Signed-off-by: snipe --- package-lock.json | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 31f62b0e4fab..8cd6ecd4ad47 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2201,9 +2201,9 @@ "integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==" }, "alpinejs": { - "version": "3.13.0", - "resolved": "https://registry.npmjs.org/alpinejs/-/alpinejs-3.13.0.tgz", - "integrity": "sha512-7FYR1Yz3evIjlJD1mZ3SYWSw+jlOmQGeQ1QiSufSQ6J84XMQFkzxm6OobiZ928SfqhGdoIp2SsABNsS4rXMMJw==", + "version": "3.13.3", + "resolved": "https://registry.npmjs.org/alpinejs/-/alpinejs-3.13.3.tgz", + "integrity": "sha512-WZ6WQjkAOl+WdW/jukzNHq9zHFDNKmkk/x6WF7WdyNDD6woinrfXCVsZXm0galjbco+pEpYmJLtwlZwcOfIVdg==", "requires": { "@vue/reactivity": "~3.1.1" } diff --git a/package.json b/package.json index 00e3b774d0cd..8dec243296e2 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "acorn-import-assertions": "^1.9.0", "admin-lte": "^2.4.18", "ajv": "^6.12.6", - "alpinejs": "^3.10.5", + "alpinejs": "^3.13.2", "blueimp-file-upload": "^9.34.0", "bootstrap": "^3.4.1", "bootstrap-colorpicker": "^2.5.3", From e0e11845bb9dfc8ff092bcc9d16e6a6bacb412a4 Mon Sep 17 00:00:00 2001 From: snipe Date: Thu, 23 Nov 2023 15:23:13 +0000 Subject: [PATCH 06/10] Upgrade jspdf-autotable from 3.5.31 to 3.7.1 #13937 Signed-off-by: snipe --- package-lock.json | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 8cd6ecd4ad47..d17ec73df4d9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15972,9 +15972,9 @@ } }, "jspdf-autotable": { - "version": "3.5.31", - "resolved": "https://registry.npmjs.org/jspdf-autotable/-/jspdf-autotable-3.5.31.tgz", - "integrity": "sha512-Lc1KuLGDQWW/5t57Z/+c2E94XQV3jV2QVU3xMRiwvcm/nMx79aCkpPCsxLzJZVFneZvz4XoA8+egQR1QajYiWw==" + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/jspdf-autotable/-/jspdf-autotable-3.7.1.tgz", + "integrity": "sha512-5fgjqE8nIwUoNz5l/i/aD/uONKofE4yp/kJ097EKBllPVTPGnGV5OWHld30db3+CvNrgzrRl8gmTnKF6vag05g==" }, "junk": { "version": "3.1.0", diff --git a/package.json b/package.json index 8dec243296e2..4c53d04ebab9 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ "jquery-ui": "^1.13.2", "jquery-ui-bundle": "^1.12.1", "jquery.iframe-transport": "^1.0.0", - "jspdf-autotable": "^3.5.30", + "jspdf-autotable": "^3.7.1", "less": "^4.2.0", "less-loader": "^5.0", "list.js": "^1.5.0", From 88cc234cbd62faecca623c957331f597ed7adfc6 Mon Sep 17 00:00:00 2001 From: snipe Date: Thu, 23 Nov 2023 15:28:43 +0000 Subject: [PATCH 07/10] Higher contrast for green dark skin Applies #13915 to develop Signed-off-by: snipe --- public/css/dist/skins/skin-green-dark.css | 2 +- public/css/dist/skins/skin-green-dark.min.css | 2 +- public/js/dist/all-defer.js | 272 +++++++++++------- public/mix-manifest.json | 6 +- .../assets/less/skins/skin-green-dark.less | 2 +- 5 files changed, 173 insertions(+), 111 deletions(-) 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