app/assets/build/coco/book.js in coveragebook_components-0.8.5 vs app/assets/build/coco/book.js in coveragebook_components-0.8.6
- old
+ new
@@ -3846,14 +3846,14 @@
func = undefined2;
}
return result2;
};
}
- var bind4 = baseRest(function(func, thisArg, partials) {
+ var bind3 = baseRest(function(func, thisArg, partials) {
var bitmask = WRAP_BIND_FLAG;
if (partials.length) {
- var holders = replaceHolders(partials, getHolder(bind4));
+ var holders = replaceHolders(partials, getHolder(bind3));
bitmask |= WRAP_PARTIAL_FLAG;
}
return createWrap(func, bitmask, thisArg, partials, holders);
});
var bindKey = baseRest(function(object, key, partials) {
@@ -4856,11 +4856,11 @@
}
});
var bindAll = flatRest(function(object, methodNames) {
arrayEach(methodNames, function(key) {
key = toKey(key);
- baseAssignValue(object, key, bind4(object[key], object));
+ baseAssignValue(object, key, bind3(object[key], object));
});
return object;
});
function cond(pairs) {
var length = pairs == null ? 0 : pairs.length, toIteratee = getIteratee();
@@ -5053,11 +5053,11 @@
lodash.assignIn = assignIn;
lodash.assignInWith = assignInWith;
lodash.assignWith = assignWith;
lodash.at = at2;
lodash.before = before;
- lodash.bind = bind4;
+ lodash.bind = bind3;
lodash.bindAll = bindAll;
lodash.bindKey = bindKey;
lodash.castArray = castArray;
lodash.chain = chain;
lodash.chunk = chunk;
@@ -7119,10 +7119,116 @@
};
return [wrappedEffect, () => {
cleanup2();
}];
}
+ function dispatch(el, name, detail = {}) {
+ el.dispatchEvent(
+ new CustomEvent(name, {
+ detail,
+ bubbles: true,
+ // Allows events to pass the shadow DOM barrier.
+ composed: true,
+ cancelable: true
+ })
+ );
+ }
+ function walk(el, callback) {
+ if (typeof ShadowRoot === "function" && el instanceof ShadowRoot) {
+ Array.from(el.children).forEach((el2) => walk(el2, callback));
+ return;
+ }
+ let skip = false;
+ callback(el, () => skip = true);
+ if (skip)
+ return;
+ let node = el.firstElementChild;
+ while (node) {
+ walk(node, callback, false);
+ node = node.nextElementSibling;
+ }
+ }
+ function warn(message, ...args) {
+ console.warn(`Alpine Warning: ${message}`, ...args);
+ }
+ var started = false;
+ function start() {
+ if (started)
+ warn("Alpine has already been initialized on this page. Calling Alpine.start() more than once can cause problems.");
+ started = true;
+ if (!document.body)
+ warn("Unable to initialize. Trying to load Alpine before `<body>` is available. Did you forget to add `defer` in Alpine's `<script>` tag?");
+ dispatch(document, "alpine:init");
+ dispatch(document, "alpine:initializing");
+ startObservingMutations();
+ onElAdded((el) => initTree(el, walk));
+ onElRemoved((el) => destroyTree(el));
+ onAttributesAdded((el, attrs) => {
+ directives(el, attrs).forEach((handle) => handle());
+ });
+ let outNestedComponents = (el) => !closestRoot(el.parentElement, true);
+ Array.from(document.querySelectorAll(allSelectors())).filter(outNestedComponents).forEach((el) => {
+ initTree(el);
+ });
+ dispatch(document, "alpine:initialized");
+ }
+ var rootSelectorCallbacks = [];
+ var initSelectorCallbacks = [];
+ function rootSelectors() {
+ return rootSelectorCallbacks.map((fn3) => fn3());
+ }
+ function allSelectors() {
+ return rootSelectorCallbacks.concat(initSelectorCallbacks).map((fn3) => fn3());
+ }
+ function addRootSelector(selectorCallback) {
+ rootSelectorCallbacks.push(selectorCallback);
+ }
+ function addInitSelector(selectorCallback) {
+ initSelectorCallbacks.push(selectorCallback);
+ }
+ function closestRoot(el, includeInitSelectors = false) {
+ return findClosest(el, (element) => {
+ const selectors = includeInitSelectors ? allSelectors() : rootSelectors();
+ if (selectors.some((selector) => element.matches(selector)))
+ return true;
+ });
+ }
+ function findClosest(el, callback) {
+ if (!el)
+ return;
+ if (callback(el))
+ return el;
+ if (el._x_teleportBack)
+ el = el._x_teleportBack;
+ if (!el.parentElement)
+ return;
+ return findClosest(el.parentElement, callback);
+ }
+ function isRoot(el) {
+ return rootSelectors().some((selector) => el.matches(selector));
+ }
+ var initInterceptors = [];
+ function interceptInit(callback) {
+ initInterceptors.push(callback);
+ }
+ function initTree(el, walker = walk, intercept = () => {
+ }) {
+ deferHandlingDirectives(() => {
+ walker(el, (el2, skip) => {
+ intercept(el2, skip);
+ initInterceptors.forEach((i2) => i2(el2, skip));
+ directives(el2, el2.attributes).forEach((handle) => handle());
+ el2._x_ignore && skip();
+ });
+ });
+ }
+ function destroyTree(root) {
+ walk(root, (el) => {
+ cleanupAttributes(el);
+ cleanupElement(el);
+ });
+ }
var onAttributeAddeds = [];
var onElRemoveds = [];
var onElAddeds = [];
function onElAdded(callback) {
onElAddeds.push(callback);
@@ -7155,10 +7261,16 @@
value.forEach((i2) => i2());
delete el._x_attributeCleanups[name];
}
});
}
+ function cleanupElement(el) {
+ if (el._x_cleanups) {
+ while (el._x_cleanups.length)
+ el._x_cleanups.pop()();
+ }
+ }
var observer = new MutationObserver(onMutate);
var currentlyObserving = false;
function startObservingMutations() {
observer.observe(document, { subtree: true, childList: true, attributes: true, attributeOldValue: true });
currentlyObserving = true;
@@ -7250,14 +7362,11 @@
});
for (let node of removedNodes) {
if (addedNodes.includes(node))
continue;
onElRemoveds.forEach((i2) => i2(node));
- if (node._x_cleanups) {
- while (node._x_cleanups.length)
- node._x_cleanups.pop()();
- }
+ destroyTree(node);
}
addedNodes.forEach((node) => {
node._x_ignoreSelf = true;
node._x_ignore = true;
});
@@ -7300,57 +7409,54 @@
return [];
}
return closestDataStack(node.parentNode);
}
function mergeProxies(objects) {
- let thisProxy = new Proxy({}, {
- ownKeys: () => {
- return Array.from(new Set(objects.flatMap((i2) => Object.keys(i2))));
- },
- 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, __spreadProps(__spreadValues({}, 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);
}
- function initInterceptors(data2) {
+ var mergeProxyTrap = {
+ ownKeys({ objects }) {
+ return Array.from(
+ new Set(objects.flatMap((i2) => Object.keys(i2)))
+ );
+ },
+ 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 == null ? void 0 : descriptor.set) && (descriptor == null ? void 0 : 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;
+ }, {});
+ }
+ function initInterceptors2(data2) {
let isObject22 = (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;
@@ -7453,12 +7559,13 @@
}
var shouldAutoEvaluateFunctions = true;
function dontAutoEvaluateFunctions(callback) {
let cache = shouldAutoEvaluateFunctions;
shouldAutoEvaluateFunctions = false;
- callback();
+ let result = callback();
shouldAutoEvaluateFunctions = cache;
+ return result;
}
function evaluate(el, expression, extras = {}) {
let result;
evaluateLater(el, expression)((value) => result = value, extras);
return result;
@@ -7489,14 +7596,21 @@
if (evaluatorMemo[expression]) {
return evaluatorMemo[expression];
}
let AsyncFunction = Object.getPrototypeOf(async function() {
}).constructor;
- let rightSideSafeExpression = /^[\n\s]*if.*\(.*\)/.test(expression) || /^(let|const)\s/.test(expression) ? `(async()=>{ ${expression} })()` : expression;
+ 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();
}
};
@@ -7549,11 +7663,13 @@
function directive(name, callback) {
directiveHandlers[name] = callback;
return {
before(directive2) {
if (!directiveHandlers[directive2]) {
- console.warn("Cannot find directive `${directive}`. `${name}` will use the default order of execution");
+ console.warn(
+ "Cannot find directive `${directive}`. `${name}` will use the default order of execution"
+ );
return;
}
const pos = directiveOrder.indexOf(directive2);
directiveOrder.splice(pos >= 0 ? pos : directiveOrder.indexOf("DEFAULT"), 0, name);
}
@@ -7620,19 +7736,19 @@
return [utilities, doCleanup];
}
function getDirectiveHandler(el, directive2) {
let noop = () => {
};
- let handler3 = directiveHandlers[directive2.type] || noop;
+ let handler4 = directiveHandlers[directive2.type] || noop;
let [utilities, cleanup2] = getElementBoundUtilities(el);
onAttributeRemoved(el, directive2.original, cleanup2);
let fullHandler = () => {
if (el._x_ignore || el._x_ignoreSelf)
return;
- handler3.inline && handler3.inline(el, directive2, utilities);
- handler3 = handler3.bind(handler3, el, directive2, utilities);
- isDeferringHandlers ? directiveHandlerStacks.get(currentHandlerStackKey).push(handler3) : handler3();
+ handler4.inline && handler4.inline(el, directive2, utilities);
+ handler4 = handler4.bind(handler4, el, directive2, utilities);
+ isDeferringHandlers ? directiveHandlerStacks.get(currentHandlerStackKey).push(handler4) : handler4();
};
fullHandler.runCleanups = cleanup2;
return fullHandler;
}
var startingWith = (subject, replacement) => ({ name, value }) => {
@@ -7661,11 +7777,11 @@
}
var alpineAttributeRegex = () => new RegExp(`^${prefixAsString}([^:^.]+)\\b`);
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 {
type: typeMatch ? typeMatch[1] : null,
value: valueMatch ? valueMatch[1] : null,
@@ -7695,110 +7811,10 @@
function byPriority(a2, b2) {
let typeA = directiveOrder.indexOf(a2.type) === -1 ? DEFAULT : a2.type;
let typeB = directiveOrder.indexOf(b2.type) === -1 ? DEFAULT : b2.type;
return directiveOrder.indexOf(typeA) - directiveOrder.indexOf(typeB);
}
- function dispatch(el, name, detail = {}) {
- el.dispatchEvent(new CustomEvent(name, {
- detail,
- bubbles: true,
- composed: true,
- cancelable: true
- }));
- }
- function walk(el, callback) {
- if (typeof ShadowRoot === "function" && el instanceof ShadowRoot) {
- Array.from(el.children).forEach((el2) => walk(el2, callback));
- return;
- }
- let skip = false;
- callback(el, () => skip = true);
- if (skip)
- return;
- let node = el.firstElementChild;
- while (node) {
- walk(node, callback, false);
- node = node.nextElementSibling;
- }
- }
- function warn(message, ...args) {
- console.warn(`Alpine Warning: ${message}`, ...args);
- }
- var started = false;
- function start() {
- if (started)
- warn("Alpine has already been initialized on this page. Calling Alpine.start() more than once can cause problems.");
- started = true;
- if (!document.body)
- warn("Unable to initialize. Trying to load Alpine before `<body>` is available. Did you forget to add `defer` in Alpine's `<script>` tag?");
- dispatch(document, "alpine:init");
- dispatch(document, "alpine:initializing");
- startObservingMutations();
- onElAdded((el) => initTree(el, walk));
- onElRemoved((el) => destroyTree(el));
- onAttributesAdded((el, attrs) => {
- directives(el, attrs).forEach((handle) => handle());
- });
- let outNestedComponents = (el) => !closestRoot(el.parentElement, true);
- Array.from(document.querySelectorAll(allSelectors())).filter(outNestedComponents).forEach((el) => {
- initTree(el);
- });
- dispatch(document, "alpine:initialized");
- }
- var rootSelectorCallbacks = [];
- var initSelectorCallbacks = [];
- function rootSelectors() {
- return rootSelectorCallbacks.map((fn3) => fn3());
- }
- function allSelectors() {
- return rootSelectorCallbacks.concat(initSelectorCallbacks).map((fn3) => fn3());
- }
- function addRootSelector(selectorCallback) {
- rootSelectorCallbacks.push(selectorCallback);
- }
- function addInitSelector(selectorCallback) {
- initSelectorCallbacks.push(selectorCallback);
- }
- function closestRoot(el, includeInitSelectors = false) {
- return findClosest(el, (element) => {
- const selectors = includeInitSelectors ? allSelectors() : rootSelectors();
- if (selectors.some((selector) => element.matches(selector)))
- return true;
- });
- }
- function findClosest(el, callback) {
- if (!el)
- return;
- if (callback(el))
- return el;
- if (el._x_teleportBack)
- el = el._x_teleportBack;
- if (!el.parentElement)
- return;
- return findClosest(el.parentElement, callback);
- }
- function isRoot(el) {
- return rootSelectors().some((selector) => el.matches(selector));
- }
- var initInterceptors2 = [];
- function interceptInit(callback) {
- initInterceptors2.push(callback);
- }
- function initTree(el, walker = walk, intercept = () => {
- }) {
- deferHandlingDirectives(() => {
- walker(el, (el2, skip) => {
- intercept(el2, skip);
- initInterceptors2.forEach((i2) => i2(el2, skip));
- directives(el2, el2.attributes).forEach((handle) => handle());
- el2._x_ignore && skip();
- });
- });
- }
- function destroyTree(root) {
- walk(root, (el) => cleanupAttributes(el));
- }
var tickStack = [];
var isHolding = false;
function nextTick(callback = () => {
}) {
queueMicrotask(() => {
@@ -7924,20 +7940,20 @@
}
});
function registerTransitionsFromClassString(el, classString, stage) {
registerTransitionObject(el, setClasses, "");
let directiveStorageMap = {
- enter: (classes) => {
+ "enter": (classes) => {
el._x_transition.enter.during = classes;
},
"enter-start": (classes) => {
el._x_transition.enter.start = classes;
},
"enter-end": (classes) => {
el._x_transition.enter.end = classes;
},
- leave: (classes) => {
+ "leave": (classes) => {
el._x_transition.leave.during = classes;
},
"leave-start": (classes) => {
el._x_transition.leave.start = classes;
},
@@ -8193,18 +8209,35 @@
return (...args) => isCloning ? fallback(...args) : callback(...args);
}
function onlyDuringClone(callback) {
return (...args) => isCloning && callback(...args);
}
+ function cloneNode(from, to) {
+ if (from._x_dataStack) {
+ to._x_dataStack = from._x_dataStack;
+ to.setAttribute("data-has-alpine-state", true);
+ }
+ isCloning = true;
+ dontRegisterReactiveSideEffects(() => {
+ initTree(to, (el, callback) => {
+ callback(el, () => {
+ });
+ });
+ });
+ isCloning = false;
+ }
+ var isCloningLegacy = false;
function clone(oldEl, newEl) {
if (!newEl._x_dataStack)
newEl._x_dataStack = oldEl._x_dataStack;
isCloning = true;
+ isCloningLegacy = true;
dontRegisterReactiveSideEffects(() => {
cloneTree(newEl);
});
isCloning = false;
+ isCloningLegacy = false;
}
function cloneTree(el) {
let hasRunThroughFirstEl = false;
let shallowWalker = (el2, callback) => {
walk(el2, (el3, skip) => {
@@ -8225,10 +8258,17 @@
};
});
callback();
overrideEffect(cache);
}
+ function shouldSkipRegisteringDataDuringClone(el) {
+ if (!isCloning)
+ return false;
+ if (isCloningLegacy)
+ return true;
+ return el.hasAttribute("data-has-alpine-state");
+ }
function bind(el, name, value, modifiers = []) {
if (!el._x_bindings)
el._x_bindings = reactive({});
el._x_bindings[name] = value;
name = modifiers.includes("camel") ? camelCase(name) : name;
@@ -8260,11 +8300,11 @@
el.checked = checkedAttrLooseCompare(el.value, value);
}
} else if (el.type === "checkbox") {
if (Number.isInteger(value)) {
el.value = value;
- } else if (!Number.isInteger(value) && !Array.isArray(value) && typeof value !== "boolean" && ![null, void 0].includes(value)) {
+ } else if (!Array.isArray(value) && typeof value !== "boolean" && ![null, void 0].includes(value)) {
el.value = String(value);
} else {
if (Array.isArray(value)) {
el.checked = value.some((val) => checkedAttrLooseCompare(val, el.value));
} else {
@@ -8274,11 +8314,11 @@
} else if (el.tagName === "SELECT") {
updateSelect(el, value);
} else {
if (el.value === value)
return;
- el.value = value;
+ el.value = value === void 0 ? "" : value;
}
}
function bindClasses(el, value) {
if (el._x_undoAddedClasses)
el._x_undoAddedClasses();
@@ -8360,10 +8400,25 @@
return !["aria-pressed", "aria-checked", "aria-expanded", "aria-selected"].includes(name);
}
function getBinding(el, name, fallback) {
if (el._x_bindings && el._x_bindings[name] !== void 0)
return el._x_bindings[name];
+ return getAttributeBinding(el, name, fallback);
+ }
+ function extractProp(el, name, fallback, extract = true) {
+ if (el._x_bindings && el._x_bindings[name] !== void 0)
+ return el._x_bindings[name];
+ if (el._x_inlineBindings && el._x_inlineBindings[name] !== void 0) {
+ let binding = el._x_inlineBindings[name];
+ binding.extract = extract;
+ return dontAutoEvaluateFunctions(() => {
+ return evaluate(el, binding.expression);
+ });
+ }
+ return getAttributeBinding(el, name, fallback);
+ }
+ function getAttributeBinding(el, name, fallback) {
let attr = el.getAttribute(name);
if (attr === null)
return typeof fallback === "function" ? fallback() : fallback;
if (attr === "")
return true;
@@ -8393,10 +8448,40 @@
inThrottle = true;
setTimeout(() => inThrottle = false, limit);
}
};
}
+ function entangle({ get: outerGet, set: outerSet }, { get: innerGet, set: innerSet }) {
+ let firstRun = true;
+ let outerHash;
+ let reference2 = effect(() => {
+ const outer = outerGet();
+ const inner = innerGet();
+ if (firstRun) {
+ innerSet(cloneIfObject(outer));
+ firstRun = false;
+ outerHash = JSON.stringify(outer);
+ } else {
+ const outerHashLatest = JSON.stringify(outer);
+ if (outerHashLatest !== outerHash) {
+ innerSet(cloneIfObject(outer));
+ outerHash = outerHashLatest;
+ } else {
+ outerSet(cloneIfObject(inner));
+ outerHash = JSON.stringify(inner);
+ }
+ }
+ JSON.stringify(innerGet());
+ JSON.stringify(outerGet());
+ });
+ return () => {
+ release(reference2);
+ };
+ }
+ function cloneIfObject(value) {
+ return typeof value === "object" ? JSON.parse(JSON.stringify(value)) : value;
+ }
function plugin(callback) {
let callbacks = Array.isArray(callback) ? callback : [callback];
callbacks.forEach((i2) => i2(alpine_default));
}
var stores = {};
@@ -8411,23 +8496,25 @@
}
stores[name] = value;
if (typeof value === "object" && value !== null && value.hasOwnProperty("init") && typeof value.init === "function") {
stores[name].init();
}
- initInterceptors(stores[name]);
+ initInterceptors2(stores[name]);
}
function getStores() {
return stores;
}
var binds = {};
function bind2(name, bindings) {
let getBindings = typeof bindings !== "function" ? () => bindings : bindings;
if (name instanceof Element) {
- applyBindingsObject(name, getBindings());
+ return applyBindingsObject(name, getBindings());
} else {
binds[name] = getBindings;
}
+ return () => {
+ };
}
function injectBindingProviders(obj) {
Object.entries(binds).forEach(([name, callback]) => {
Object.defineProperty(obj, name, {
get() {
@@ -8456,10 +8543,14 @@
});
directives(el, attributes, original).map((handle) => {
cleanupRunners.push(handle.runCleanups);
handle();
});
+ return () => {
+ while (cleanupRunners.length)
+ cleanupRunners.pop()();
+ };
}
var datas = {};
function data(name, callback) {
datas[name] = callback;
}
@@ -8487,17 +8578,19 @@
return effect;
},
get raw() {
return raw;
},
- version: "3.12.2",
+ version: "3.13.2",
flushAndStopDeferringMutations,
dontAutoEvaluateFunctions,
disableEffectScheduling,
startObservingMutations,
stopObservingMutations,
setReactivityEngine,
+ onAttributeRemoved,
+ onAttributesAdded,
closestDataStack,
skipDuringClone,
onlyDuringClone,
addRootSelector,
addInitSelector,
@@ -8506,18 +8599,24 @@
mapAttributes,
evaluateLater,
interceptInit,
setEvaluator,
mergeProxies,
+ extractProp,
findClosest,
+ onElRemoved,
closestRoot,
destroyTree,
interceptor,
+ // INTERNAL: not public API and is subject to change without major release.
transition,
+ // INTERNAL
setStyles,
+ // INTERNAL
mutateDom,
directive,
+ entangle,
throttle,
debounce,
evaluate,
initTree,
nextTick,
@@ -8526,10 +8625,13 @@
plugin,
magic,
store,
start,
clone,
+ // INTERNAL
+ cloneNode,
+ // INTERNAL
bound: getBinding,
$data: scope,
walk,
data,
bind: bind2
@@ -8545,11 +8647,10 @@
}
var specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
var isBooleanAttr2 = /* @__PURE__ */ makeMap(specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`);
var EMPTY_OBJ = true ? Object.freeze({}) : {};
var EMPTY_ARR = true ? Object.freeze([]) : [];
- var extend = Object.assign;
var hasOwnProperty = Object.prototype.hasOwnProperty;
var hasOwn = (val, key) => hasOwnProperty.call(val, key);
var isArray = Array.isArray;
var isMap = (val) => toTypeString(val) === "[object Map]";
var isString = (val) => typeof val === "string";
@@ -8755,38 +8856,38 @@
effects.forEach(run);
}
var isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`);
var builtInSymbols = new Set(Object.getOwnPropertyNames(Symbol).map((key) => Symbol[key]).filter(isSymbol));
var get2 = /* @__PURE__ */ createGetter();
- var shallowGet = /* @__PURE__ */ createGetter(false, true);
var readonlyGet = /* @__PURE__ */ createGetter(true);
- var shallowReadonlyGet = /* @__PURE__ */ createGetter(true, true);
- var arrayInstrumentations = {};
- ["includes", "indexOf", "lastIndexOf"].forEach((key) => {
- const method = Array.prototype[key];
- arrayInstrumentations[key] = function(...args) {
- const arr = toRaw(this);
- for (let i2 = 0, l2 = this.length; i2 < l2; i2++) {
- track(arr, "get", i2 + "");
- }
- const res = method.apply(arr, args);
- if (res === -1 || res === false) {
- return method.apply(arr, args.map(toRaw));
- } else {
+ var arrayInstrumentations = /* @__PURE__ */ createArrayInstrumentations();
+ function createArrayInstrumentations() {
+ const instrumentations = {};
+ ["includes", "indexOf", "lastIndexOf"].forEach((key) => {
+ instrumentations[key] = function(...args) {
+ const arr = toRaw(this);
+ for (let i2 = 0, l2 = this.length; i2 < l2; i2++) {
+ track(arr, "get", i2 + "");
+ }
+ const res = arr[key](...args);
+ if (res === -1 || res === false) {
+ return arr[key](...args.map(toRaw));
+ } else {
+ return res;
+ }
+ };
+ });
+ ["push", "pop", "shift", "unshift", "splice"].forEach((key) => {
+ instrumentations[key] = function(...args) {
+ pauseTracking();
+ const res = toRaw(this)[key].apply(this, args);
+ resetTracking();
return res;
- }
- };
- });
- ["push", "pop", "shift", "unshift", "splice"].forEach((key) => {
- const method = Array.prototype[key];
- arrayInstrumentations[key] = function(...args) {
- pauseTracking();
- const res = method.apply(this, args);
- resetTracking();
- return res;
- };
- });
+ };
+ });
+ return instrumentations;
+ }
function createGetter(isReadonly = false, shallow = false) {
return function get3(target, key, receiver) {
if (key === "__v_isReactive") {
return !isReadonly;
} else if (key === "__v_isReadonly") {
@@ -8817,11 +8918,10 @@
}
return res;
};
}
var set2 = /* @__PURE__ */ createSetter();
- var shallowSet = /* @__PURE__ */ createSetter(true);
function createSetter(shallow = false) {
return function set3(target, key, value, receiver) {
let oldValue = target[key];
if (!shallow) {
value = toRaw(value);
@@ -8883,23 +8983,19 @@
console.warn(`Delete operation on key "${String(key)}" failed: target is readonly.`, target);
}
return true;
}
};
- var shallowReactiveHandlers = extend({}, mutableHandlers, {
- get: shallowGet,
- set: shallowSet
- });
- var shallowReadonlyHandlers = extend({}, readonlyHandlers, {
- get: shallowReadonlyGet
- });
var toReactive = (value) => isObject(value) ? reactive2(value) : value;
var toReadonly = (value) => isObject(value) ? readonly(value) : value;
var toShallow = (value) => value;
var getProto = (v2) => Reflect.getPrototypeOf(v2);
function get$1(target, key, isReadonly = false, isShallow = false) {
- target = target["__v_raw"];
+ target = target[
+ "__v_raw"
+ /* RAW */
+ ];
const rawTarget = toRaw(target);
const rawKey = toRaw(key);
if (key !== rawKey) {
!isReadonly && track(rawTarget, "get", key);
}
@@ -8913,21 +9009,27 @@
} else if (target !== rawTarget) {
target.get(key);
}
}
function has$1(key, isReadonly = false) {
- const target = this["__v_raw"];
+ const target = this[
+ "__v_raw"
+ /* RAW */
+ ];
const rawTarget = toRaw(target);
const rawKey = toRaw(key);
if (key !== rawKey) {
!isReadonly && track(rawTarget, "has", key);
}
!isReadonly && track(rawTarget, "has", rawKey);
return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey);
}
function size(target, isReadonly = false) {
- target = target["__v_raw"];
+ target = target[
+ "__v_raw"
+ /* RAW */
+ ];
!isReadonly && track(toRaw(target), "iterate", ITERATE_KEY);
return Reflect.get(target, "size", target);
}
function add(value) {
value = toRaw(value);
@@ -8988,37 +9090,45 @@
return result;
}
function createForEach(isReadonly, isShallow) {
return function forEach(callback, thisArg) {
const observed = this;
- const target = observed["__v_raw"];
+ const target = observed[
+ "__v_raw"
+ /* RAW */
+ ];
const rawTarget = toRaw(target);
const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
!isReadonly && track(rawTarget, "iterate", ITERATE_KEY);
return target.forEach((value, key) => {
return callback.call(thisArg, wrap(value), wrap(key), observed);
});
};
}
function createIterableMethod(method, isReadonly, isShallow) {
return function(...args) {
- const target = this["__v_raw"];
+ const target = this[
+ "__v_raw"
+ /* RAW */
+ ];
const rawTarget = toRaw(target);
const targetIsMap = isMap(rawTarget);
const isPair = method === "entries" || method === Symbol.iterator && targetIsMap;
const isKeyOnly = method === "keys" && targetIsMap;
const innerIterator = target[method](...args);
const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
!isReadonly && track(rawTarget, "iterate", isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY);
return {
+ // iterator protocol
next() {
const { value, done } = innerIterator.next();
return done ? { value, done } : {
value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),
done
};
},
+ // iterable protocol
[Symbol.iterator]() {
return this;
}
};
};
@@ -9030,77 +9140,110 @@
console.warn(`${capitalize(type)} operation ${key}failed: target is readonly.`, toRaw(this));
}
return type === "delete" ? false : this;
};
}
- var mutableInstrumentations = {
- get(key) {
- return get$1(this, key);
- },
- get size() {
- return size(this);
- },
- has: has$1,
- add,
- set: set$1,
- delete: deleteEntry,
- clear,
- forEach: createForEach(false, false)
- };
- var shallowInstrumentations = {
- get(key) {
- return get$1(this, key, false, true);
- },
- get size() {
- return size(this);
- },
- has: has$1,
- add,
- set: set$1,
- delete: deleteEntry,
- clear,
- forEach: createForEach(false, true)
- };
- var readonlyInstrumentations = {
- get(key) {
- return get$1(this, key, true);
- },
- get size() {
- return size(this, true);
- },
- has(key) {
- return has$1.call(this, key, true);
- },
- add: createReadonlyMethod("add"),
- set: createReadonlyMethod("set"),
- delete: createReadonlyMethod("delete"),
- clear: createReadonlyMethod("clear"),
- forEach: createForEach(true, false)
- };
- var shallowReadonlyInstrumentations = {
- get(key) {
- return get$1(this, key, true, true);
- },
- get size() {
- return size(this, true);
- },
- has(key) {
- return has$1.call(this, key, true);
- },
- add: createReadonlyMethod("add"),
- set: createReadonlyMethod("set"),
- delete: createReadonlyMethod("delete"),
- clear: createReadonlyMethod("clear"),
- forEach: createForEach(true, true)
- };
- var iteratorMethods = ["keys", "values", "entries", Symbol.iterator];
- iteratorMethods.forEach((method) => {
- mutableInstrumentations[method] = createIterableMethod(method, false, false);
- readonlyInstrumentations[method] = createIterableMethod(method, true, false);
- shallowInstrumentations[method] = createIterableMethod(method, false, true);
- shallowReadonlyInstrumentations[method] = createIterableMethod(method, true, true);
- });
+ function createInstrumentations() {
+ const mutableInstrumentations2 = {
+ get(key) {
+ return get$1(this, key);
+ },
+ get size() {
+ return size(this);
+ },
+ has: has$1,
+ add,
+ set: set$1,
+ delete: deleteEntry,
+ clear,
+ forEach: createForEach(false, false)
+ };
+ const shallowInstrumentations2 = {
+ get(key) {
+ return get$1(this, key, false, true);
+ },
+ get size() {
+ return size(this);
+ },
+ has: has$1,
+ add,
+ set: set$1,
+ delete: deleteEntry,
+ clear,
+ forEach: createForEach(false, true)
+ };
+ const readonlyInstrumentations2 = {
+ get(key) {
+ return get$1(this, key, true);
+ },
+ get size() {
+ return size(this, true);
+ },
+ has(key) {
+ return has$1.call(this, key, true);
+ },
+ add: createReadonlyMethod(
+ "add"
+ /* ADD */
+ ),
+ set: createReadonlyMethod(
+ "set"
+ /* SET */
+ ),
+ delete: createReadonlyMethod(
+ "delete"
+ /* DELETE */
+ ),
+ clear: createReadonlyMethod(
+ "clear"
+ /* CLEAR */
+ ),
+ forEach: createForEach(true, false)
+ };
+ const shallowReadonlyInstrumentations2 = {
+ get(key) {
+ return get$1(this, key, true, true);
+ },
+ get size() {
+ return size(this, true);
+ },
+ has(key) {
+ return has$1.call(this, key, true);
+ },
+ add: createReadonlyMethod(
+ "add"
+ /* ADD */
+ ),
+ set: createReadonlyMethod(
+ "set"
+ /* SET */
+ ),
+ delete: createReadonlyMethod(
+ "delete"
+ /* DELETE */
+ ),
+ clear: createReadonlyMethod(
+ "clear"
+ /* CLEAR */
+ ),
+ forEach: createForEach(true, true)
+ };
+ const iteratorMethods = ["keys", "values", "entries", Symbol.iterator];
+ iteratorMethods.forEach((method) => {
+ mutableInstrumentations2[method] = createIterableMethod(method, false, false);
+ readonlyInstrumentations2[method] = createIterableMethod(method, true, false);
+ shallowInstrumentations2[method] = createIterableMethod(method, false, true);
+ shallowReadonlyInstrumentations2[method] = createIterableMethod(method, true, true);
+ });
+ return [
+ mutableInstrumentations2,
+ readonlyInstrumentations2,
+ shallowInstrumentations2,
+ shallowReadonlyInstrumentations2
+ ];
+ }
+ var [mutableInstrumentations, readonlyInstrumentations, shallowInstrumentations, shallowReadonlyInstrumentations] = /* @__PURE__ */ createInstrumentations();
function createInstrumentationGetter(isReadonly, shallow) {
const instrumentations = shallow ? isReadonly ? shallowReadonlyInstrumentations : shallowInstrumentations : isReadonly ? readonlyInstrumentations : mutableInstrumentations;
return (target, key, receiver) => {
if (key === "__v_isReactive") {
return !isReadonly;
@@ -9111,21 +9254,15 @@
}
return Reflect.get(hasOwn(instrumentations, key) && key in target ? instrumentations : target, key, receiver);
};
}
var mutableCollectionHandlers = {
- get: createInstrumentationGetter(false, false)
+ get: /* @__PURE__ */ createInstrumentationGetter(false, false)
};
- var shallowCollectionHandlers = {
- get: createInstrumentationGetter(false, true)
- };
var readonlyCollectionHandlers = {
- get: createInstrumentationGetter(true, false)
+ get: /* @__PURE__ */ createInstrumentationGetter(true, false)
};
- var shallowReadonlyCollectionHandlers = {
- get: createInstrumentationGetter(true, true)
- };
function checkIdentityKeys(target, has2, key) {
const rawKey = toRaw(key);
if (rawKey !== key && has2.call(target, rawKey)) {
const type = toRawType(target);
console.warn(`Reactive ${type} contains both the raw and reactive versions of the same object${type === `Map` ? ` as keys` : ``}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.`);
@@ -9148,14 +9285,20 @@
default:
return 0;
}
}
function getTargetType(value) {
- return value["__v_skip"] || !Object.isExtensible(value) ? 0 : targetTypeMap(toRawType(value));
+ return value[
+ "__v_skip"
+ /* SKIP */
+ ] || !Object.isExtensible(value) ? 0 : targetTypeMap(toRawType(value));
}
function reactive2(target) {
- if (target && target["__v_isReadonly"]) {
+ if (target && target[
+ "__v_isReadonly"
+ /* IS_READONLY */
+ ]) {
return target;
}
return createReactiveObject(target, false, mutableHandlers, mutableCollectionHandlers, reactiveMap);
}
function readonly(target) {
@@ -9166,11 +9309,17 @@
if (true) {
console.warn(`value cannot be made reactive: ${String(target)}`);
}
return target;
}
- if (target["__v_raw"] && !(isReadonly && target["__v_isReactive"])) {
+ if (target[
+ "__v_raw"
+ /* RAW */
+ ] && !(isReadonly && target[
+ "__v_isReactive"
+ /* IS_REACTIVE */
+ ])) {
return target;
}
const existingProxy = proxyMap.get(target);
if (existingProxy) {
return existingProxy;
@@ -9182,11 +9331,14 @@
const proxy = new Proxy(target, targetType === 2 ? collectionHandlers : baseHandlers);
proxyMap.set(target, proxy);
return proxy;
}
function toRaw(observed) {
- return observed && toRaw(observed["__v_raw"]) || observed;
+ return observed && toRaw(observed[
+ "__v_raw"
+ /* RAW */
+ ]) || observed;
}
function isRef(r2) {
return Boolean(r2 && r2.__v_isRef === true);
}
magic("nextTick", () => nextTick);
@@ -9253,115 +9405,102 @@
});
magic("el", (el) => 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));
}
- function entangle({ get: outerGet, set: outerSet }, { get: innerGet, set: innerSet }) {
- let firstRun = true;
- let outerHash, innerHash, outerHashLatest, innerHashLatest;
- let reference2 = effect(() => {
- let outer, inner;
- if (firstRun) {
- outer = outerGet();
- innerSet(outer);
- inner = innerGet();
- firstRun = false;
- } else {
- outer = outerGet();
- inner = innerGet();
- outerHashLatest = JSON.stringify(outer);
- innerHashLatest = JSON.stringify(inner);
- if (outerHashLatest !== outerHash) {
- inner = innerGet();
- innerSet(outer);
- inner = outer;
- } else {
- outerSet(inner);
- outer = inner;
- }
- }
- outerHash = JSON.stringify(outer);
- innerHash = JSON.stringify(inner);
- });
- return () => {
- release(reference2);
- };
- }
directive("modelable", (el, { expression }, { effect: effect32, evaluateLater: evaluateLater2, cleanup: cleanup2 }) => {
let func = evaluateLater2(expression);
let innerGet = () => {
let result;
func((i2) => result = i2);
return result;
};
let evaluateInnerSet = evaluateLater2(`${expression} = __placeholder`);
let innerSet = (val) => evaluateInnerSet(() => {
- }, { scope: { __placeholder: val } });
+ }, { scope: { "__placeholder": val } });
let initialValue = innerGet();
innerSet(initialValue);
queueMicrotask(() => {
if (!el._x_model)
return;
el._x_removeModelListeners["default"]();
let outerGet = el._x_model.get;
let outerSet = el._x_model.set;
- let releaseEntanglement = entangle({
- get() {
- return outerGet();
+ let releaseEntanglement = entangle(
+ {
+ get() {
+ return outerGet();
+ },
+ set(value) {
+ outerSet(value);
+ }
},
- set(value) {
- outerSet(value);
+ {
+ get() {
+ return innerGet();
+ },
+ set(value) {
+ innerSet(value);
+ }
}
- }, {
- get() {
- return innerGet();
- },
- set(value) {
- innerSet(value);
- }
- });
+ );
cleanup2(releaseEntanglement);
});
});
- 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 <template> tag", el);
- let target = skipDuringClone(() => {
- return document.querySelector(expression);
- }, () => {
- return teleportContainerDuringClone;
- })();
- if (!target)
- warn(`Cannot find x-teleport element for selector: "${expression}"`);
+ let target = getTarget(expression);
let clone2 = el.content.cloneNode(true).firstElementChild;
el._x_teleport = clone2;
clone2._x_teleportBack = el;
+ el.setAttribute("data-teleport-template", true);
+ clone2.setAttribute("data-teleport-target", true);
if (el._x_forwardEvents) {
el._x_forwardEvents.forEach((eventName) => {
clone2.addEventListener(eventName, (e2) => {
e2.stopPropagation();
el.dispatchEvent(new e2.constructor(e2.type, e2));
});
});
}
addScopeToNode(clone2, {}, el);
- mutateDom(() => {
- if (modifiers.includes("prepend")) {
- target.parentNode.insertBefore(clone2, target);
- } else if (modifiers.includes("append")) {
- target.parentNode.insertBefore(clone2, target.nextSibling);
+ let placeInDom = (clone3, target2, modifiers2) => {
+ if (modifiers2.includes("prepend")) {
+ target2.parentNode.insertBefore(clone3, target2);
+ } else if (modifiers2.includes("append")) {
+ target2.parentNode.insertBefore(clone3, target2.nextSibling);
} else {
- target.appendChild(clone2);
+ target2.appendChild(clone3);
}
+ };
+ mutateDom(() => {
+ placeInDom(clone2, target, modifiers);
initTree(clone2);
clone2._x_ignore = true;
});
+ el._x_teleportPutBack = () => {
+ let target2 = getTarget(expression);
+ mutateDom(() => {
+ placeInDom(el._x_teleport, target2, modifiers);
+ });
+ };
cleanup2(() => clone2.remove());
});
+ var teleportContainerDuringClone = document.createElement("div");
+ function getTarget(expression) {
+ let target = skipDuringClone(() => {
+ return document.querySelector(expression);
+ }, () => {
+ return teleportContainerDuringClone;
+ })();
+ if (!target)
+ warn(`Cannot find x-teleport element for selector: "${expression}"`);
+ return target;
+ }
var handler = () => {
};
handler.inline = (el, { modifiers }, { cleanup: cleanup2 }) => {
modifiers.includes("self") ? el._x_ignoreSelf = true : el._x_ignore = true;
cleanup2(() => {
@@ -9370,11 +9509,11 @@
};
directive("ignore", handler);
directive("effect", (el, { expression }, { effect: effect32 }) => effect32(evaluateLater(el, expression)));
function on(el, event, modifiers, callback) {
let listenerTarget = el;
- let handler3 = (e2) => callback(e2);
+ let handler4 = (e2) => callback(e2);
let options = {};
let wrapHandler = (callback2, wrapper) => (e2) => wrapper(callback2, e2);
if (modifiers.includes("dot"))
event = dotSyntax(event);
if (modifiers.includes("camel"))
@@ -9388,34 +9527,34 @@
if (modifiers.includes("document"))
listenerTarget = document;
if (modifiers.includes("debounce")) {
let nextModifier = modifiers[modifiers.indexOf("debounce") + 1] || "invalid-wait";
let wait = isNumeric(nextModifier.split("ms")[0]) ? Number(nextModifier.split("ms")[0]) : 250;
- handler3 = debounce(handler3, wait);
+ handler4 = debounce(handler4, wait);
}
if (modifiers.includes("throttle")) {
let nextModifier = modifiers[modifiers.indexOf("throttle") + 1] || "invalid-wait";
let wait = isNumeric(nextModifier.split("ms")[0]) ? Number(nextModifier.split("ms")[0]) : 250;
- handler3 = throttle(handler3, wait);
+ handler4 = throttle(handler4, wait);
}
if (modifiers.includes("prevent"))
- handler3 = wrapHandler(handler3, (next, e2) => {
+ handler4 = wrapHandler(handler4, (next, e2) => {
e2.preventDefault();
next(e2);
});
if (modifiers.includes("stop"))
- handler3 = wrapHandler(handler3, (next, e2) => {
+ handler4 = wrapHandler(handler4, (next, e2) => {
e2.stopPropagation();
next(e2);
});
if (modifiers.includes("self"))
- handler3 = wrapHandler(handler3, (next, e2) => {
+ handler4 = wrapHandler(handler4, (next, e2) => {
e2.target === el && next(e2);
});
if (modifiers.includes("away") || modifiers.includes("outside")) {
listenerTarget = document;
- handler3 = wrapHandler(handler3, (next, e2) => {
+ handler4 = wrapHandler(handler4, (next, e2) => {
if (el.contains(e2.target))
return;
if (e2.target.isConnected === false)
return;
if (el.offsetWidth < 1 && el.offsetHeight < 1)
@@ -9424,26 +9563,26 @@
return;
next(e2);
});
}
if (modifiers.includes("once")) {
- handler3 = wrapHandler(handler3, (next, e2) => {
+ handler4 = wrapHandler(handler4, (next, e2) => {
next(e2);
- listenerTarget.removeEventListener(event, handler3, options);
+ listenerTarget.removeEventListener(event, handler4, options);
});
}
- handler3 = wrapHandler(handler3, (next, e2) => {
+ handler4 = wrapHandler(handler4, (next, e2) => {
if (isKeyEvent(event)) {
if (isListeningForASpecificKeyThatHasntBeenPressed(e2, modifiers)) {
return;
}
}
next(e2);
});
- listenerTarget.addEventListener(event, handler3, options);
+ listenerTarget.addEventListener(event, handler4, options);
return () => {
- listenerTarget.removeEventListener(event, handler3, options);
+ listenerTarget.removeEventListener(event, handler4, options);
};
}
function dotSyntax(subject) {
return subject.replace(/-/g, ".");
}
@@ -9452,11 +9591,13 @@
}
function isNumeric(subject) {
return !Array.isArray(subject) && !isNaN(subject);
}
function kebabCase2(subject) {
- if ([" ", "_"].includes(subject))
+ if ([" ", "_"].includes(
+ subject
+ ))
return subject;
return subject.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[_\s]/, "-").toLowerCase();
}
function isKeyEvent(event) {
return ["keydown", "keyup"].includes(event);
@@ -9496,24 +9637,24 @@
function keyToModifiers(key) {
if (!key)
return [];
key = kebabCase2(key);
let modifierToKeyMap = {
- ctrl: "control",
- slash: "/",
- space: " ",
- spacebar: " ",
- cmd: "meta",
- esc: "escape",
- up: "arrow-up",
- down: "arrow-down",
- left: "arrow-left",
- right: "arrow-right",
- period: ".",
- equal: "=",
- minus: "-",
- underscore: "_"
+ "ctrl": "control",
+ "slash": "/",
+ "space": " ",
+ "spacebar": " ",
+ "cmd": "meta",
+ "esc": "escape",
+ "up": "arrow-up",
+ "down": "arrow-down",
+ "left": "arrow-left",
+ "right": "arrow-right",
+ "period": ".",
+ "equal": "=",
+ "minus": "-",
+ "underscore": "_"
};
modifierToKeyMap[key] = key;
return Object.keys(modifierToKeyMap).map((modifier) => {
if (modifierToKeyMap[modifier] === key)
return modifier;
@@ -9545,11 +9686,11 @@
if (isGetterSetter(result)) {
result.set(value);
} else {
evaluateSet(() => {
}, {
- scope: { __placeholder: value }
+ scope: { "__placeholder": value }
});
}
};
if (typeof expression === "string" && el.type === "radio") {
mutateDom(() => {
@@ -9560,12 +9701,14 @@
var event = el.tagName.toLowerCase() === "select" || ["checkbox", "radio"].includes(el.type) || modifiers.includes("lazy") ? "change" : "input";
let removeListener = isCloning ? () => {
} : on(el, event, modifiers, (e2) => {
setValue(getInputValue(el, modifiers, e2, getValue()));
});
- if (modifiers.includes("fill") && [null, ""].includes(getValue())) {
- el.dispatchEvent(new Event(event, {}));
+ if (modifiers.includes("fill")) {
+ if ([null, ""].includes(getValue()) || el.type === "checkbox" && Array.isArray(getValue())) {
+ el.dispatchEvent(new Event(event, {}));
+ }
}
if (!el._x_removeModelListeners)
el._x_removeModelListeners = {};
el._x_removeModelListeners["default"] = removeListener;
cleanup2(() => el._x_removeModelListeners["default"]());
@@ -9582,11 +9725,10 @@
set(value) {
setValue(value);
}
};
el._x_forceModelUpdate = (value) => {
- value = value === void 0 ? getValue() : value;
if (value === void 0 && typeof expression === "string" && expression.match(/\./))
value = "";
window.fromModel = true;
mutateDom(() => bind(el, "value", value));
delete window.fromModel;
@@ -9598,13 +9740,12 @@
el._x_forceModelUpdate(value);
});
});
function getInputValue(el, modifiers, event, currentValue) {
return mutateDom(() => {
- var _a;
if (event instanceof CustomEvent && event.detail !== void 0)
- return (_a = event.detail) != null ? _a : event.target.value;
+ return event.detail !== null && event.detail !== void 0 ? event.detail : event.target.value;
else if (el.type === "checkbox") {
if (Array.isArray(currentValue)) {
let newValue = modifiers.includes("number") ? safeParseNumber(event.target.value) : event.target.value;
return event.target.checked ? currentValue.concat([newValue]) : currentValue.filter((el2) => !checkedAttrLooseCompare2(el2, newValue));
} else {
@@ -9666,11 +9807,11 @@
});
});
});
});
mapAttributes(startingWith(":", into(prefix("bind:"))));
- directive("bind", (el, { value, modifiers, expression, original }, { effect: effect32 }) => {
+ var handler2 = (el, { value, modifiers, expression, original }, { effect: effect32 }) => {
if (!value) {
let bindingProviders = {};
injectBindingProviders(bindingProviders);
let getBindings = evaluateLater(el, expression);
getBindings((bindings) => {
@@ -9678,41 +9819,54 @@
}, { scope: bindingProviders });
return;
}
if (value === "key")
return storeKeyForXFor(el, expression);
+ if (el._x_inlineBindings && el._x_inlineBindings[value] && el._x_inlineBindings[value].extract) {
+ return;
+ }
let evaluate2 = evaluateLater(el, expression);
effect32(() => evaluate2((result) => {
if (result === void 0 && typeof expression === "string" && expression.match(/\./)) {
result = "";
}
mutateDom(() => bind(el, value, result, modifiers));
}));
- });
+ };
+ handler2.inline = (el, { value, modifiers, expression }) => {
+ if (!value)
+ return;
+ if (!el._x_inlineBindings)
+ el._x_inlineBindings = {};
+ el._x_inlineBindings[value] = { expression, extract: false };
+ };
+ directive("bind", handler2);
function storeKeyForXFor(el, expression) {
el._x_keyExpression = expression;
}
addRootSelector(() => `[${prefix("data")}]`);
- directive("data", skipDuringClone((el, { expression }, { cleanup: cleanup2 }) => {
+ directive("data", (el, { expression }, { cleanup: cleanup2 }) => {
+ if (shouldSkipRegisteringDataDuringClone(el))
+ return;
expression = expression === "" ? "{}" : expression;
let magicContext = {};
injectMagics(magicContext, el);
let dataProviderContext = {};
injectDataProviders(dataProviderContext, magicContext);
let data2 = evaluate(el, expression, { scope: dataProviderContext });
if (data2 === void 0 || data2 === true)
data2 = {};
injectMagics(data2, el);
let reactiveData = reactive(data2);
- initInterceptors(reactiveData);
+ initInterceptors2(reactiveData);
let undo = addScopeToNode(el, reactiveData);
reactiveData["init"] && evaluate(el, reactiveData["init"]);
cleanup2(() => {
reactiveData["destroy"] && evaluate(el, reactiveData["destroy"]);
undo();
});
- }));
+ });
directive("show", (el, { modifiers, expression }, { effect: effect32 }) => {
let evaluate2 = evaluateLater(el, expression);
if (!el._x_doHide)
el._x_doHide = () => {
mutateDom(() => {
@@ -9736,17 +9890,20 @@
let show = () => {
el._x_doShow();
el._x_isShown = true;
};
let clickAwayCompatibleShow = () => setTimeout(show);
- let toggle = once((value) => value ? show() : hide2(), (value) => {
- if (typeof el._x_toggleAndCascadeWithTransitions === "function") {
- el._x_toggleAndCascadeWithTransitions(el, value, show, hide2);
- } else {
- value ? clickAwayCompatibleShow() : hide2();
+ let toggle = once(
+ (value) => value ? show() : hide2(),
+ (value) => {
+ if (typeof el._x_toggleAndCascadeWithTransitions === "function") {
+ el._x_toggleAndCascadeWithTransitions(el, value, show, hide2);
+ } else {
+ value ? clickAwayCompatibleShow() : hide2();
+ }
}
- });
+ );
let oldValue;
let firstTime = true;
effect32(() => evaluate2((value) => {
if (!firstTime && value === oldValue)
return;
@@ -9758,11 +9915,15 @@
}));
});
directive("for", (el, { expression }, { effect: effect32, cleanup: cleanup2 }) => {
let iteratorNames = parseForExpression(expression);
let evaluateItems = evaluateLater(el, iteratorNames.items);
- let evaluateKey = evaluateLater(el, el._x_keyExpression || "index");
+ let evaluateKey = evaluateLater(
+ el,
+ // the x-bind:key expression is stored for our use instead of evaluated.
+ el._x_keyExpression || "index"
+ );
el._x_prevKeys = [];
el._x_lookup = {};
effect32(() => loop(el, iteratorNames, evaluateItems, evaluateKey));
cleanup2(() => {
Object.values(el._x_lookup).forEach((el2) => el2.remove());
@@ -9924,21 +10085,23 @@
return scopeVariables;
}
function isNumeric3(subject) {
return !Array.isArray(subject) && !isNaN(subject);
}
- function handler2() {
+ function handler3() {
}
- handler2.inline = (el, { expression }, { cleanup: cleanup2 }) => {
+ handler3.inline = (el, { expression }, { cleanup: cleanup2 }) => {
let root = closestRoot(el);
if (!root._x_refs)
root._x_refs = {};
root._x_refs[expression] = el;
cleanup2(() => delete root._x_refs[expression]);
};
- directive("ref", handler2);
+ directive("ref", handler3);
directive("if", (el, { expression }, { effect: effect32, cleanup: cleanup2 }) => {
+ if (el.tagName.toLowerCase() !== "template")
+ warn("x-if can only be used on a <template> tag", el);
let evaluate2 = evaluateLater(el, expression);
let show = () => {
if (el._x_currentIfEl)
return el._x_currentIfEl;
let clone2 = el.content.cloneNode(true).firstElementChild;
@@ -9984,93 +10147,27 @@
if (!el._x_forwardEvents.includes(value))
el._x_forwardEvents.push(value);
}
let removeListener = on(el, value, modifiers, (e2) => {
evaluate2(() => {
- }, { scope: { $event: e2 }, params: [e2] });
+ }, { scope: { "$event": e2 }, params: [e2] });
});
cleanup2(() => removeListener());
}));
warnMissingPluginDirective("Collapse", "collapse", "collapse");
warnMissingPluginDirective("Intersect", "intersect", "intersect");
warnMissingPluginDirective("Focus", "trap", "focus");
warnMissingPluginDirective("Mask", "mask", "mask");
- function warnMissingPluginDirective(name, directiveName2, slug) {
- directive(directiveName2, (el) => warn(`You can't use [x-${directiveName2}] without first installing the "${name}" plugin here: https://alpinejs.dev/plugins/${slug}`, el));
+ function warnMissingPluginDirective(name, directiveName, slug) {
+ directive(directiveName, (el) => warn(`You can't use [x-${directiveName}] without first installing the "${name}" plugin here: https://alpinejs.dev/plugins/${slug}`, el));
}
alpine_default.setEvaluator(normalEvaluator);
alpine_default.setReactivityEngine({ reactive: reactive2, effect: effect2, release: stop, raw: toRaw });
var src_default = alpine_default;
var module_default = src_default;
// ../../../node_modules/@alpinejs/morph/dist/module.esm.js
- function createElement(html) {
- const template = document.createElement("template");
- template.innerHTML = html;
- return template.content.firstElementChild;
- }
- function textOrComment(el) {
- return el.nodeType === 3 || el.nodeType === 8;
- }
- var dom = {
- replace(children, old, replacement) {
- let index = children.indexOf(old);
- if (index === -1)
- throw "Cant find element in children";
- old.replaceWith(replacement);
- children[index] = replacement;
- return children;
- },
- before(children, reference2, subject) {
- let index = children.indexOf(reference2);
- if (index === -1)
- throw "Cant find element in children";
- reference2.before(subject);
- children.splice(index, 0, subject);
- return children;
- },
- append(children, subject, appendFn) {
- let last = children[children.length - 1];
- appendFn(subject);
- children.push(subject);
- return children;
- },
- remove(children, subject) {
- let index = children.indexOf(subject);
- if (index === -1)
- throw "Cant find element in children";
- subject.remove();
- return children.filter((i2) => i2 !== subject);
- },
- first(children) {
- return this.teleportTo(children[0]);
- },
- next(children, reference2) {
- let index = children.indexOf(reference2);
- if (index === -1)
- return;
- return this.teleportTo(this.teleportBack(children[index + 1]));
- },
- teleportTo(el) {
- if (!el)
- return el;
- if (el._x_teleport)
- return el._x_teleport;
- return el;
- },
- teleportBack(el) {
- if (!el)
- return el;
- if (el._x_teleportBack)
- return el._x_teleportBack;
- return el;
- }
- };
- var resolveStep = () => {
- };
- var logger = () => {
- };
function morph(from, toHtml, options) {
monkeyPatchDomSetAttributeToAllowAtSymbols();
let fromEl;
let toEl;
let key, lookahead, updating, updated, removing, removed, adding, added;
@@ -10087,49 +10184,51 @@
key = options2.key || defaultGetKey;
lookahead = options2.lookahead || false;
}
function patch(from2, to) {
if (differentElementNamesTypesOrKeys(from2, to)) {
- return patchElement(from2, to);
+ return swapElements(from2, to);
}
let updateChildrenOnly = false;
if (shouldSkip(updating, from2, to, () => updateChildrenOnly = true))
return;
- window.Alpine && initializeAlpineOnTo(from2, to, () => updateChildrenOnly = true);
+ if (from2.nodeType === 1 && window.Alpine) {
+ window.Alpine.cloneNode(from2, to);
+ }
if (textOrComment(to)) {
patchNodeValue(from2, to);
updated(from2, to);
return;
}
if (!updateChildrenOnly) {
patchAttributes(from2, to);
}
updated(from2, to);
- patchChildren(Array.from(from2.childNodes), Array.from(to.childNodes), (toAppend) => {
- from2.appendChild(toAppend);
- });
+ patchChildren(from2, to);
}
function differentElementNamesTypesOrKeys(from2, to) {
return from2.nodeType != to.nodeType || from2.nodeName != to.nodeName || getKey(from2) != getKey(to);
}
- function patchElement(from2, to) {
+ function swapElements(from2, to) {
if (shouldSkip(removing, from2))
return;
let toCloned = to.cloneNode(true);
if (shouldSkip(adding, toCloned))
return;
- dom.replace([from2], from2, toCloned);
+ from2.replaceWith(toCloned);
removed(from2);
added(toCloned);
}
function patchNodeValue(from2, to) {
let value = to.nodeValue;
if (from2.nodeValue !== value) {
from2.nodeValue = value;
}
}
function patchAttributes(from2, to) {
+ if (from2._x_transitioning)
+ return;
if (from2._x_isShown && !to._x_isShown) {
return;
}
if (!from2._x_isShown && to._x_isShown) {
return;
@@ -10148,124 +10247,124 @@
if (from2.getAttribute(name) !== value) {
from2.setAttribute(name, value);
}
}
}
- function patchChildren(fromChildren, toChildren, appendFn) {
- let fromKeyDomNodeMap = {};
+ function patchChildren(from2, to) {
+ let fromKeys = keyToMap(from2.children);
let fromKeyHoldovers = {};
- let currentTo = dom.first(toChildren);
- let currentFrom = dom.first(fromChildren);
+ let currentTo = getFirstNode(to);
+ let currentFrom = getFirstNode(from2);
while (currentTo) {
let toKey = getKey(currentTo);
let fromKey = getKey(currentFrom);
if (!currentFrom) {
if (toKey && fromKeyHoldovers[toKey]) {
let holdover = fromKeyHoldovers[toKey];
- fromChildren = dom.append(fromChildren, holdover, appendFn);
+ from2.appendChild(holdover);
currentFrom = holdover;
} else {
if (!shouldSkip(adding, currentTo)) {
let clone2 = currentTo.cloneNode(true);
- fromChildren = dom.append(fromChildren, clone2, appendFn);
+ from2.appendChild(clone2);
added(clone2);
}
- currentTo = dom.next(toChildren, currentTo);
+ currentTo = getNextSibling(to, currentTo);
continue;
}
}
- let isIf = (node) => node.nodeType === 8 && node.textContent === " __BLOCK__ ";
- let isEnd = (node) => node.nodeType === 8 && node.textContent === " __ENDBLOCK__ ";
+ let isIf = (node) => node && node.nodeType === 8 && node.textContent === "[if BLOCK]><![endif]";
+ let isEnd = (node) => node && node.nodeType === 8 && node.textContent === "[if ENDBLOCK]><![endif]";
if (isIf(currentTo) && isIf(currentFrom)) {
- let newFromChildren = [];
- let appendPoint;
let nestedIfCount = 0;
+ let fromBlockStart = currentFrom;
while (currentFrom) {
- let next = dom.next(fromChildren, currentFrom);
+ let next = getNextSibling(from2, currentFrom);
if (isIf(next)) {
nestedIfCount++;
} else if (isEnd(next) && nestedIfCount > 0) {
nestedIfCount--;
} else if (isEnd(next) && nestedIfCount === 0) {
- currentFrom = dom.next(fromChildren, next);
- appendPoint = next;
+ currentFrom = next;
break;
}
- newFromChildren.push(next);
currentFrom = next;
}
- let newToChildren = [];
+ let fromBlockEnd = currentFrom;
nestedIfCount = 0;
+ let toBlockStart = currentTo;
while (currentTo) {
- let next = dom.next(toChildren, currentTo);
+ let next = getNextSibling(to, currentTo);
if (isIf(next)) {
nestedIfCount++;
} else if (isEnd(next) && nestedIfCount > 0) {
nestedIfCount--;
} else if (isEnd(next) && nestedIfCount === 0) {
- currentTo = dom.next(toChildren, next);
+ currentTo = next;
break;
}
- newToChildren.push(next);
currentTo = next;
}
- patchChildren(newFromChildren, newToChildren, (node) => appendPoint.before(node));
+ let toBlockEnd = currentTo;
+ let fromBlock = new Block(fromBlockStart, fromBlockEnd);
+ let toBlock = new Block(toBlockStart, toBlockEnd);
+ patchChildren(fromBlock, toBlock);
continue;
}
- if (currentFrom.nodeType === 1 && lookahead) {
- let nextToElementSibling = dom.next(toChildren, currentTo);
+ if (currentFrom.nodeType === 1 && lookahead && !currentFrom.isEqualNode(currentTo)) {
+ let nextToElementSibling = getNextSibling(to, currentTo);
let found = false;
while (!found && nextToElementSibling) {
- if (currentFrom.isEqualNode(nextToElementSibling)) {
+ if (nextToElementSibling.nodeType === 1 && currentFrom.isEqualNode(nextToElementSibling)) {
found = true;
- [fromChildren, currentFrom] = addNodeBefore(fromChildren, currentTo, currentFrom);
+ currentFrom = addNodeBefore(from2, currentTo, currentFrom);
fromKey = getKey(currentFrom);
}
- nextToElementSibling = dom.next(toChildren, nextToElementSibling);
+ nextToElementSibling = getNextSibling(to, nextToElementSibling);
}
}
if (toKey !== fromKey) {
if (!toKey && fromKey) {
fromKeyHoldovers[fromKey] = currentFrom;
- [fromChildren, currentFrom] = addNodeBefore(fromChildren, currentTo, currentFrom);
- fromChildren = dom.remove(fromChildren, fromKeyHoldovers[fromKey]);
- currentFrom = dom.next(fromChildren, currentFrom);
- currentTo = dom.next(toChildren, currentTo);
+ currentFrom = addNodeBefore(from2, currentTo, currentFrom);
+ fromKeyHoldovers[fromKey].remove();
+ currentFrom = getNextSibling(from2, currentFrom);
+ currentTo = getNextSibling(to, currentTo);
continue;
}
if (toKey && !fromKey) {
- if (fromKeyDomNodeMap[toKey]) {
- fromChildren = dom.replace(fromChildren, currentFrom, fromKeyDomNodeMap[toKey]);
- currentFrom = fromKeyDomNodeMap[toKey];
+ if (fromKeys[toKey]) {
+ currentFrom.replaceWith(fromKeys[toKey]);
+ currentFrom = fromKeys[toKey];
}
}
if (toKey && fromKey) {
- let fromKeyNode = fromKeyDomNodeMap[toKey];
+ let fromKeyNode = fromKeys[toKey];
if (fromKeyNode) {
fromKeyHoldovers[fromKey] = currentFrom;
- fromChildren = dom.replace(fromChildren, currentFrom, fromKeyNode);
+ currentFrom.replaceWith(fromKeyNode);
currentFrom = fromKeyNode;
} else {
fromKeyHoldovers[fromKey] = currentFrom;
- [fromChildren, currentFrom] = addNodeBefore(fromChildren, currentTo, currentFrom);
- fromChildren = dom.remove(fromChildren, fromKeyHoldovers[fromKey]);
- currentFrom = dom.next(fromChildren, currentFrom);
- currentTo = dom.next(toChildren, currentTo);
+ currentFrom = addNodeBefore(from2, currentTo, currentFrom);
+ fromKeyHoldovers[fromKey].remove();
+ currentFrom = getNextSibling(from2, currentFrom);
+ currentTo = getNextSibling(to, currentTo);
continue;
}
}
}
- let currentFromNext = currentFrom && dom.next(fromChildren, currentFrom);
+ let currentFromNext = currentFrom && getNextSibling(from2, currentFrom);
patch(currentFrom, currentTo);
- currentTo = currentTo && dom.next(toChildren, currentTo);
+ currentTo = currentTo && getNextSibling(to, currentTo);
currentFrom = currentFromNext;
}
let removals = [];
while (currentFrom) {
if (!shouldSkip(removing, currentFrom))
removals.push(currentFrom);
- currentFrom = dom.next(fromChildren, currentFrom);
+ currentFrom = getNextSibling(from2, currentFrom);
}
while (removals.length) {
let domForRemoval = removals.shift();
domForRemoval.remove();
removed(domForRemoval);
@@ -10274,56 +10373,106 @@
function getKey(el) {
return el && el.nodeType === 1 && key(el);
}
function keyToMap(els) {
let map = {};
- els.forEach((el) => {
+ for (let el of els) {
let theKey = getKey(el);
if (theKey) {
map[theKey] = el;
}
- });
+ }
return map;
}
- function addNodeBefore(children, node, beforeMe) {
+ function addNodeBefore(parent, node, beforeMe) {
if (!shouldSkip(adding, node)) {
let clone2 = node.cloneNode(true);
- children = dom.before(children, beforeMe, clone2);
+ parent.insertBefore(clone2, beforeMe);
added(clone2);
- return [children, clone2];
+ return clone2;
}
- return [children, node];
+ return node;
}
assignOptions(options);
fromEl = from;
toEl = typeof toHtml === "string" ? createElement(toHtml) : toHtml;
if (window.Alpine && window.Alpine.closestDataStack && !from._x_dataStack) {
toEl._x_dataStack = window.Alpine.closestDataStack(from);
- toEl._x_dataStack && window.Alpine.clone(from, toEl);
+ toEl._x_dataStack && window.Alpine.cloneNode(from, toEl);
}
patch(from, toEl);
fromEl = void 0;
toEl = void 0;
return from;
}
- morph.step = () => resolveStep();
- morph.log = (theLogger) => {
- logger = theLogger;
+ morph.step = () => {
};
+ morph.log = () => {
+ };
function shouldSkip(hook, ...args) {
let skip = false;
hook(...args, () => skip = true);
return skip;
}
- function initializeAlpineOnTo(from, to, childrenOnly) {
- if (from.nodeType !== 1)
- return;
- if (from._x_dataStack) {
- window.Alpine.clone(from, to);
+ var patched = false;
+ function createElement(html) {
+ const template = document.createElement("template");
+ template.innerHTML = html;
+ return template.content.firstElementChild;
+ }
+ function textOrComment(el) {
+ return el.nodeType === 3 || el.nodeType === 8;
+ }
+ var Block = class {
+ constructor(start3, end2) {
+ this.startComment = start3;
+ this.endComment = end2;
}
+ get children() {
+ let children = [];
+ let currentNode = this.startComment.nextSibling;
+ while (currentNode && currentNode !== this.endComment) {
+ children.push(currentNode);
+ currentNode = currentNode.nextSibling;
+ }
+ return children;
+ }
+ appendChild(child) {
+ this.endComment.before(child);
+ }
+ get firstChild() {
+ let first = this.startComment.nextSibling;
+ if (first === this.endComment)
+ return;
+ return first;
+ }
+ nextNode(reference2) {
+ let next = reference2.nextSibling;
+ if (next === this.endComment)
+ return;
+ return next;
+ }
+ insertBefore(newNode, reference2) {
+ reference2.before(newNode);
+ return newNode;
+ }
+ };
+ function getFirstNode(parent) {
+ return parent.firstChild;
}
- var patched = false;
+ function getNextSibling(parent, reference2) {
+ if (reference2._x_teleport) {
+ return reference2._x_teleport;
+ }
+ let next;
+ if (parent instanceof Block) {
+ next = parent.nextNode(reference2);
+ } else {
+ next = reference2.nextSibling;
+ }
+ return next;
+ }
function monkeyPatchDomSetAttributeToAllowAtSymbols() {
if (patched)
return;
patched = true;
let original = Element.prototype.setAttribute;
@@ -10441,11 +10590,11 @@
function src_default4(Alpine3) {
Alpine3.directive("intersect", (el, { value, expression, modifiers }, { evaluateLater: evaluateLater2, cleanup: cleanup2 }) => {
let evaluate2 = evaluateLater2(expression);
let options = {
rootMargin: getRootMargin(modifiers),
- threshold: getThreshhold(modifiers)
+ threshold: getThreshold(modifiers)
};
let observer2 = new IntersectionObserver((entries) => {
entries.forEach((entry) => {
if (entry.isIntersecting === (value === "leave"))
return;
@@ -10457,11 +10606,11 @@
cleanup2(() => {
observer2.disconnect();
});
});
}
- function getThreshhold(modifiers) {
+ function getThreshold(modifiers) {
if (modifiers.includes("full"))
return 0.99;
if (modifiers.includes("half"))
return 0.5;
if (!modifiers.includes("threshold"))
@@ -10619,11 +10768,13 @@
function formatMoney(input, delimiter = ".", thousands, precision = 2) {
if (input === "-")
return "-";
if (/^\D+$/.test(input))
return "9";
- thousands = thousands != null ? thousands : delimiter === "," ? "." : ",";
+ if (thousands === null || thousands === void 0) {
+ thousands = delimiter === "," ? "." : ",";
+ }
let addThousands = (input2, thousands2) => {
let output = "";
let counter = 0;
for (let i2 = input2.length - 1; i2 >= 0; i2--) {
if (input2[i2] === thousands2)
@@ -10653,11 +10804,11 @@
});
return template;
}
var module_default5 = src_default5;
- // ../../../node_modules/tabbable/dist/index.esm.js
+ // ../../../node_modules/@alpinejs/focus/dist/module.esm.js
var candidateSelectors = ["input", "select", "textarea", "a[href]", "button", "[tabindex]:not(slot)", "audio[controls]", "video[controls]", '[contenteditable]:not([contenteditable="false"])', "details>summary:first-of-type", "details"];
var candidateSelector = /* @__PURE__ */ candidateSelectors.join(",");
var NoElement = typeof Element === "undefined";
var matches = NoElement ? function() {
} : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
@@ -10927,12 +11078,10 @@
if (matches.call(node, focusableCandidateSelector) === false) {
return false;
}
return isNodeMatchingSelectorFocusable(options, node);
};
-
- // ../../../node_modules/focus-trap/dist/focus-trap.esm.js
function ownKeys2(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
enumerableOnly && (symbols = symbols.filter(function(sym) {
@@ -11450,12 +11599,10 @@
}
};
trap.updateContainerElements(elements);
return trap;
};
-
- // ../../../node_modules/@alpinejs/focus/dist/module.esm.js
function src_default6(Alpine3) {
let lastFocused;
let currentFocused;
window.addEventListener("focusin", () => {
lastFocused = currentFocused;
@@ -14076,21 +14223,21 @@
}
updateTransitionEndListener(box, "remove", currentTransitionEndListener);
updateTransitionEndListener(box, "add", listener);
currentTransitionEndListener = listener;
}
- function on2(eventType, handler3, options) {
+ function on2(eventType, handler4, options) {
if (options === void 0) {
options = false;
}
var nodes = normalizeToArray(instance.props.triggerTarget || reference2);
nodes.forEach(function(node) {
- node.addEventListener(eventType, handler3, options);
+ node.addEventListener(eventType, handler4, options);
listeners.push({
node,
eventType,
- handler: handler3,
+ handler: handler4,
options
});
});
}
function addListeners() {
@@ -14120,12 +14267,12 @@
}
});
}
function removeListeners() {
listeners.forEach(function(_ref) {
- var node = _ref.node, eventType = _ref.eventType, handler3 = _ref.handler, options = _ref.options;
- node.removeEventListener(eventType, handler3, options);
+ var node = _ref.node, eventType = _ref.eventType, handler4 = _ref.handler, options = _ref.options;
+ node.removeEventListener(eventType, handler4, options);
});
listeners = [];
}
function onTrigger2(event) {
var _lastTriggerEvent;
@@ -15541,12 +15688,76 @@
":class": "{loaded}"
}
};
});
+ // ../../components/coco/base/poll_controller/poll_controller.js
+ var poll_controller_exports = {};
+ __export(poll_controller_exports, {
+ default: () => poll_controller_default
+ });
+ var poll_controller_default = CocoComponent("pollController", () => {
+ return {
+ polling: false,
+ frame: null,
+ pollTimer: null,
+ get interval() {
+ return parseInt(this.$root.dataset.interval || 0, 10);
+ },
+ init() {
+ this.frame = document.getElementById("polling-controller-frame");
+ this.observer = new MutationObserver(() => this.onUpdate());
+ this.observer.observe(this.$el, { attributes: true });
+ },
+ startPolling() {
+ if (this.interval > 0 && !this.polling) {
+ this.polling = true;
+ this.queuePollRequest(500);
+ }
+ },
+ onUpdate() {
+ this.$nextTick(() => {
+ this.$dispatch("dom-updates:complete", { html: document });
+ });
+ this.queuePollRequest();
+ },
+ queuePollRequest(wait) {
+ if (this.pollTimer)
+ clearTimeout(this.pollTimer);
+ if (this.interval > 0 && this.polling) {
+ this.pollTimer = setTimeout(
+ () => this.reloadFrame(),
+ wait || this.interval
+ );
+ }
+ },
+ reloadFrame() {
+ this.frame.addEventListener(
+ "turbo:before-fetch-request",
+ addStreamHeaders,
+ { once: true }
+ );
+ window.Turbo.visit(location.href, {
+ frame: this.frame.id,
+ action: "replace"
+ });
+ },
+ destroy() {
+ this.observer.disconnect();
+ this.polling = false;
+ }
+ };
+ });
+ function addStreamHeaders(event) {
+ const { headers } = event.detail.fetchOptions || {};
+ if (headers) {
+ headers.Accept = ["text/vnd.turbo-stream.html", headers.Accept].join(", ");
+ }
+ }
+
// import-glob:/Users/mark/Code/coveragebook/coco/app/assets/js/base|@baseComponents/**/*.js
- var modules = [button_exports, dropdown_exports, icon_exports, image_uploader_exports, modal_exports, modal_dialog_exports, modal_lightbox_exports];
+ var modules = [button_exports, dropdown_exports, icon_exports, image_uploader_exports, modal_exports, modal_dialog_exports, modal_lightbox_exports, poll_controller_exports];
var __default = modules;
// base/components.js
var components_default = registerComponents(__default);
@@ -15570,17 +15781,21 @@
* Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
*)
-tabbable/dist/index.esm.js:
- (*!
- * tabbable 5.3.3
- * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
- *)
-
-focus-trap/dist/focus-trap.esm.js:
- (*!
- * focus-trap 6.9.4
- * @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
+@alpinejs/focus/dist/module.esm.js:
+ (*! Bundled license information:
+
+ tabbable/dist/index.esm.js:
+ (*!
+ * tabbable 5.3.3
+ * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
+ *)
+
+ focus-trap/dist/focus-trap.esm.js:
+ (*!
+ * focus-trap 6.9.4
+ * @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
+ *)
*)
*/