app/assets/build/coco/coco.js in coveragebook_components-0.17.5 vs app/assets/build/coco/coco.js in coveragebook_components-0.17.6

- old
+ new

@@ -7379,12 +7379,12 @@ directives(el2, el2.attributes).forEach((handle) => handle()); el2._x_ignore && skip(); }); }); } - function destroyTree(root) { - walk(root, (el) => { + function destroyTree(root, walker = walk) { + walker(root, (el) => { cleanupAttributes(el); cleanupElement(el); }); } var onAttributeAddeds = []; @@ -7577,19 +7577,19 @@ }, has({ objects }, name) { if (name == Symbol.unscopables) return false; return objects.some( - (obj) => Object.prototype.hasOwnProperty.call(obj, name) + (obj) => Object.prototype.hasOwnProperty.call(obj, name) || Reflect.has(obj, name) ); }, get({ objects }, name, thisProxy) { if (name == "toJSON") return collapseProxies; return Reflect.get( objects.find( - (obj) => Object.prototype.hasOwnProperty.call(obj, name) + (obj) => Reflect.has(obj, name) ) || {}, name, thisProxy ); }, @@ -7614,10 +7614,12 @@ let isObject2 = (val) => typeof val === "object" && !Array.isArray(val) && val !== null; let recurse = (obj, basePath = "") => { Object.entries(Object.getOwnPropertyDescriptors(obj)).forEach(([key, { value, enumerable }]) => { if (enumerable === false || value === void 0) return; + if (typeof value === "object" && value !== null && value.__v_skip) + return; let path = basePath === "" ? key : `${basePath}.${key}`; if (typeof value === "object" && value !== null && value._x_interceptor) { obj[key] = value.initialize(data2, path, key); } else { if (isObject2(value) && value !== obj && !(value instanceof Element)) { @@ -8535,11 +8537,10 @@ const booleanAttributes = [ "disabled", "checked", "required", "readonly", - "hidden", "open", "selected", "autofocus", "itemscope", "multiple", @@ -8743,11 +8744,11 @@ return effect; }, get raw() { return raw; }, - version: "3.13.5", + version: "3.13.8", flushAndStopDeferringMutations, dontAutoEvaluateFunctions, disableEffectScheduling, startObservingMutations, stopObservingMutations, @@ -8826,16 +8827,14 @@ el._x_refs_proxy = mergeProxies(getArrayOfRefObject(el)); return el._x_refs_proxy; }); function getArrayOfRefObject(el) { let refObjects = []; - let currentEl = el; - while (currentEl) { - if (currentEl._x_refs) - refObjects.push(currentEl._x_refs); - currentEl = currentEl.parentNode; - } + findClosest(el, (i2) => { + if (i2._x_refs) + refObjects.push(i2._x_refs); + }); return refObjects; } var globalIdMemo = {}; function findAndIncrementId(name) { if (!globalIdMemo[name]) @@ -9181,11 +9180,13 @@ } : on(el, event, modifiers, (e2) => { setValue(getInputValue(el, modifiers, e2, getValue())); }); if (modifiers.includes("fill")) { if ([void 0, null, ""].includes(getValue()) || el.type === "checkbox" && Array.isArray(getValue())) { - el.dispatchEvent(new Event(event, {})); + setValue( + getInputValue(el, modifiers, { target: el }, getValue()) + ); } } if (!el._x_removeModelListeners) el._x_removeModelListeners = {}; el._x_removeModelListeners["default"] = removeListener; @@ -9250,16 +9251,29 @@ } return Array.from(event.target.selectedOptions).map((option) => { return option.value || option.text; }); } else { + let newValue; + if (el.type === "radio") { + if (event.target.checked) { + newValue = event.target.value; + } else { + newValue = currentValue; + } + } else { + newValue = event.target.value; + } if (modifiers.includes("number")) { - return safeParseNumber(event.target.value); + return safeParseNumber(newValue); } else if (modifiers.includes("boolean")) { - return safeParseBoolean(event.target.value); + return safeParseBoolean(newValue); + } else if (modifiers.includes("trim")) { + return newValue.trim(); + } else { + return newValue; } - return modifiers.includes("trim") ? event.target.value.trim() : event.target.value; } }); } function safeParseNumber(rawValue) { let number = rawValue ? parseFloat(rawValue) : null; @@ -9304,11 +9318,11 @@ }); }); }); }); mapAttributes(startingWith(":", into(prefix("bind:")))); - var handler2 = (el, { value, modifiers, expression, original }, { effect: effect3 }) => { + var handler2 = (el, { value, modifiers, expression, original }, { effect: effect3, cleanup }) => { if (!value) { let bindingProviders = {}; injectBindingProviders(bindingProviders); let getBindings = evaluateLater(el, expression); getBindings((bindings) => { @@ -9326,10 +9340,14 @@ if (result === void 0 && typeof expression === "string" && expression.match(/\./)) { result = ""; } mutateDom(() => bind(el, value, result, modifiers)); })); + cleanup(() => { + el._x_undoAddedClasses && el._x_undoAddedClasses(); + el._x_undoAddedStyles && el._x_undoAddedStyles(); + }); }; handler2.inline = (el, { value, modifiers, expression }) => { if (!value) return; if (!el._x_inlineBindings) @@ -9455,17 +9473,25 @@ let scopes = []; let keys = []; if (isObject2(items)) { items = Object.entries(items).map(([key, value]) => { let scope2 = getIterationScopeVariables(iteratorNames, value, key, items); - evaluateKey((value2) => keys.push(value2), { scope: { index: key, ...scope2 } }); + evaluateKey((value2) => { + if (keys.includes(value2)) + warn("Duplicate key on x-for", el); + keys.push(value2); + }, { scope: { index: key, ...scope2 } }); scopes.push(scope2); }); } else { for (let i2 = 0; i2 < items.length; i2++) { let scope2 = getIterationScopeVariables(iteratorNames, items[i2], i2, items); - evaluateKey((value) => keys.push(value), { scope: { index: i2, ...scope2 } }); + evaluateKey((value) => { + if (keys.includes(value)) + warn("Duplicate key on x-for", el); + keys.push(value); + }, { scope: { index: i2, ...scope2 } }); scopes.push(scope2); } } let adds = []; let moves = []; @@ -9509,11 +9535,11 @@ let elInSpot = lookup[keyInSpot]; let elForSpot = lookup[keyForSpot]; let marker = document.createElement("div"); mutateDom(() => { if (!elForSpot) - warn(`x-for ":key" is undefined or invalid`, templateEl); + warn(`x-for ":key" is undefined or invalid`, templateEl, keyForSpot, lookup); elForSpot.after(marker); elInSpot.after(elForSpot); elForSpot._x_currentIfEl && elForSpot.after(elForSpot._x_currentIfEl); marker.before(elInSpot); elInSpot._x_currentIfEl && elInSpot.after(elInSpot._x_currentIfEl); @@ -9536,11 +9562,11 @@ reactiveScope[key2] = value; }); }; mutateDom(() => { lastEl.after(clone2); - initTree(clone2); + skipDuringClone(() => initTree(clone2))(); }); if (typeof key === "object") { warn("x-for key cannot be an object, it must be a string or an integer", templateEl); } lookup[key] = clone2; @@ -9616,11 +9642,11 @@ return el._x_currentIfEl; let clone2 = el.content.cloneNode(true).firstElementChild; addScopeToNode(clone2, {}, el); mutateDom(() => { el.after(clone2); - initTree(clone2); + skipDuringClone(() => initTree(clone2))(); }); el._x_currentIfEl = clone2; el._x_undoIf = () => { walk(clone2, (node) => { if (!!node._x_effects) { @@ -15413,11 +15439,11 @@ var alpine_default = import_alpinejs.default; // ../../../package.json var package_default = { name: "coveragebook-components", - version: "0.17.5", + version: "0.17.6", repository: "git@github.com:coveragebook/coco.git", license: "NO LICENSE", author: "Mark Perkins <mark@coveragebook.com>", main: "app/assets/build/coco/coco.js", engines: { @@ -15462,32 +15488,32 @@ "@jaames/iro": "^5.5.2", "@percy/cli": "^1.27.3", "@tailwindcss/container-queries": "^0.1.0", "@tailwindcss/forms": "^0.5.6", "alias-hq": "^6.2.2", - alpinejs: "^3.13.5", + alpinejs: "^3.13.8", autoprefixer: "^10.4.16", "container-query-polyfill": "^1.0.2", del: "^7.1.0", esbuild: "^0.19.11", "esbuild-plugin-copy": "^2.0.2", "fast-glob": "^3.3.1", "fast-sort": "^3.2.1", - husky: "^8.0.3", + husky: "^9.0.11", "js-cookie": "^3.0.5", "lint-staged": "^15.2.2", "lodash.camelcase": "^4.3.0", "lodash.kebabcase": "^4.1.1", "lodash.keyby": "^4.6.0", "lodash.mapvalues": "^4.6.0", "lucide-static": "^0.303.0", postcss: "^8.4.31", "postcss-cli": "^11.0.0", "postcss-value-parser": "^4.2.0", - prettier: "^3.1.1", + prettier: "^3.2.5", "release-it": "^17.0.1", svgo: "^3.0.2", - tailwindcss: "^3.4.0", + tailwindcss: "^3.4.3", "tippy.js": "^6.3.7" }, "release-it": { github: { release: true