public/lookbook-assets/app.js in lookbook-0.3.0.beta.1 vs public/lookbook-assets/app.js in lookbook-0.3.0.beta.2
- old
+ new
@@ -18,14 +18,11 @@
__defNormalProp(a, prop, b[prop]);
}
return a;
};
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
- var __require = typeof require !== "undefined" ? require : (x) => {
- throw new Error('Dynamic require of "' + x + '" is not supported');
- };
- var __commonJS = (cb, mod) => function __require2() {
+ var __commonJS = (cb, mod) => function __require() {
return mod || (0, cb[Object.keys(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __reExport = (target, module, desc) => {
if (module && typeof module === "object" || typeof module === "function") {
for (let key of __getOwnPropNames(module))
@@ -2220,11 +2217,11 @@
});
}
function closestDataStack(node) {
if (node._x_dataStack)
return node._x_dataStack;
- if (typeof ShadowRoot === "function" && node instanceof ShadowRoot) {
+ if (node instanceof ShadowRoot) {
return closestDataStack(node.host);
}
if (!node.parentNode) {
return [];
}
@@ -2426,13 +2423,10 @@
let directives2 = Array.from(attributes).map(toTransformedAttributes((newName, oldName) => transformedAttributeMap[newName] = oldName)).filter(outNonAlpineAttributes).map(toParsedDirectives(transformedAttributeMap, originalAttributeOverride)).sort(byPriority);
return directives2.map((directive2) => {
return getDirectiveHandler(el, directive2);
});
}
- function attributesOnly(attributes) {
- return Array.from(attributes).map(toTransformedAttributes()).filter((attr) => !outNonAlpineAttributes(attr));
- }
var isDeferringHandlers = false;
var directiveHandlerStacks = new Map();
var currentHandlerStackKey = Symbol();
function deferHandlingDirectives(callback) {
isDeferringHandlers = true;
@@ -2482,12 +2476,11 @@
if (name.startsWith(subject))
name = name.replace(subject, replacement);
return { name, value };
};
var into = (i) => i;
- function toTransformedAttributes(callback = () => {
- }) {
+ function toTransformedAttributes(callback) {
return ({ name, value }) => {
let { name: newName, value: newValue } = attributeTransformers.reduce((carry, transform) => {
return transform(carry);
}, { name, value });
if (newName !== name)
@@ -2563,11 +2556,11 @@
}
function holdNextTicks() {
isHolding = true;
}
function walk(el, callback) {
- if (typeof ShadowRoot === "function" && el instanceof ShadowRoot) {
+ if (el instanceof ShadowRoot) {
Array.from(el.children).forEach((el2) => walk(el2, callback));
return;
}
let skip = false;
callback(el, () => skip = true);
@@ -2591,11 +2584,11 @@
onElAdded((el) => initTree(el, walk));
onElRemoved((el) => nextTick(() => destroyTree(el)));
onAttributesAdded((el, attrs) => {
directives(el, attrs).forEach((handle) => handle());
});
- let outNestedComponents = (el) => !closestRoot(el.parentElement, true);
+ let outNestedComponents = (el) => !closestRoot(el.parentElement);
Array.from(document.querySelectorAll(allSelectors())).filter(outNestedComponents).forEach((el) => {
initTree(el);
});
dispatch(document, "alpine:initialized");
}
@@ -2611,19 +2604,18 @@
rootSelectorCallbacks.push(selectorCallback);
}
function addInitSelector(selectorCallback) {
initSelectorCallbacks.push(selectorCallback);
}
- function closestRoot(el, includeInitSelectors = false) {
+ function closestRoot(el) {
if (!el)
return;
- const selectors = includeInitSelectors ? allSelectors() : rootSelectors();
- if (selectors.some((selector) => el.matches(selector)))
+ if (rootSelectors().some((selector) => el.matches(selector)))
return el;
if (!el.parentElement)
return;
- return closestRoot(el.parentElement, includeInitSelectors);
+ return closestRoot(el.parentElement);
}
function isRoot(el) {
return rootSelectors().some((selector) => el.matches(selector));
}
function initTree(el, walker = walk) {
@@ -2635,33 +2627,10 @@
});
}
function destroyTree(root) {
walk(root, (el) => cleanupAttributes(el));
}
- function debounce(func, wait) {
- var timeout;
- return function() {
- var context = this, args = arguments;
- var later = function() {
- timeout = null;
- func.apply(context, args);
- };
- clearTimeout(timeout);
- timeout = setTimeout(later, wait);
- };
- }
- function throttle(func, limit) {
- let inThrottle;
- return function() {
- let context = this, args = arguments;
- if (!inThrottle) {
- func.apply(context, args);
- inThrottle = true;
- setTimeout(() => inThrottle = false, limit);
- }
- };
- }
function plugin(callback) {
callback(alpine_default);
}
var stores = {};
var isReactive = false;
@@ -2744,23 +2713,21 @@
return effect;
},
get raw() {
return raw;
},
- version: "3.4.0",
+ version: "3.2.4",
disableEffectScheduling,
setReactivityEngine,
addRootSelector,
mapAttributes,
evaluateLater,
setEvaluator,
closestRoot,
interceptor,
mutateDom,
directive,
- throttle,
- debounce,
evaluate,
initTree,
nextTick,
prefix: setPrefix,
plugin,
@@ -2791,27 +2758,11 @@
}
firstTime = false;
}));
});
magic("store", getStores);
- magic("root", (el) => closestRoot(el));
- magic("refs", (el) => {
- if (el._x_refs_proxy)
- return el._x_refs_proxy;
- 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;
- }
- return refObjects;
- }
+ magic("refs", (el) => closestRoot(el)._x_refs || {});
magic("el", (el) => el);
function setClasses(el, value) {
if (Array.isArray(value)) {
return setClassesFromString(el, value.join(" "));
} else if (typeof value === "object" && value !== null) {
@@ -3015,13 +2966,11 @@
}, before, after);
}
};
}
window.Element.prototype._x_toggleAndCascadeWithTransitions = function(el, value, show, hide) {
- let clickAwayCompatibleShow = () => {
- document.visibilityState === "visible" ? requestAnimationFrame(show) : setTimeout(show);
- };
+ let clickAwayCompatibleShow = () => requestAnimationFrame(show);
if (value) {
el._x_transition ? el._x_transition.in(show) : clickAwayCompatibleShow();
return;
}
el._x_hidePromise = el._x_transition ? new Promise((resolve, reject) => {
@@ -3297,11 +3246,11 @@
"nomodule"
];
return booleanAttributes.includes(attrName);
}
function attributeShouldntBePreservedIfFalsy(name) {
- return !["aria-pressed", "aria-checked", "aria-expanded"].includes(name);
+ return !["aria-pressed", "aria-checked"].includes(name);
}
function on(el, event, modifiers, callback) {
let listenerTarget = el;
let handler3 = (e) => callback(e);
let options = {};
@@ -3349,16 +3298,16 @@
next(e);
});
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);
+ handler3 = debounce(handler3, wait, this);
}
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);
+ handler3 = throttle(handler3, wait, this);
}
if (modifiers.includes("once")) {
handler3 = wrapHandler(handler3, (next, e) => {
next(e);
listenerTarget.removeEventListener(event, handler3, options);
@@ -3373,10 +3322,33 @@
return subject.replace(/-/g, ".");
}
function camelCase2(subject) {
return subject.toLowerCase().replace(/-(\w)/g, (match, char) => char.toUpperCase());
}
+ function debounce(func, wait) {
+ var timeout;
+ return function() {
+ var context = this, args = arguments;
+ var later = function() {
+ timeout = null;
+ func.apply(context, args);
+ };
+ clearTimeout(timeout);
+ timeout = setTimeout(later, wait);
+ };
+ }
+ function throttle(func, limit) {
+ let inThrottle;
+ return function() {
+ let context = this, args = arguments;
+ if (!inThrottle) {
+ func.apply(context, args);
+ inThrottle = true;
+ setTimeout(() => inThrottle = false, limit);
+ }
+ };
+ }
function isNumeric(subject) {
return !Array.isArray(subject) && !isNaN(subject);
}
function kebabCase2(subject) {
return subject.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[_\s]/, "-").toLowerCase();
@@ -3424,13 +3396,11 @@
cmd: "meta",
esc: "escape",
up: "arrow-up",
down: "arrow-down",
left: "arrow-left",
- right: "arrow-right",
- period: ".",
- equal: "="
+ right: "arrow-right"
};
modifierToKeyMap[key] = key;
return Object.keys(modifierToKeyMap).map((modifier) => {
if (modifierToKeyMap[modifier] === key)
return modifier;
@@ -3507,16 +3477,11 @@
function isNumeric2(subject) {
return !Array.isArray(subject) && !isNaN(subject);
}
directive("cloak", (el) => queueMicrotask(() => mutateDom(() => el.removeAttribute(prefix("cloak")))));
addInitSelector(() => `[${prefix("init")}]`);
- directive("init", skipDuringClone((el, { expression }) => {
- if (typeof expression === "string") {
- return !!expression.trim() && evaluate(el, expression, {}, false);
- }
- return evaluate(el, expression, {}, false);
- }));
+ directive("init", skipDuringClone((el, { expression }) => evaluate(el, expression, {}, false)));
directive("text", (el, { expression }, { effect: effect3, evaluateLater: evaluateLater2 }) => {
let evaluate2 = evaluateLater2(expression);
effect3(() => {
evaluate2((value) => {
mutateDom(() => {
@@ -3552,16 +3517,10 @@
effect3(() => {
while (cleanupRunners.length)
cleanupRunners.pop()();
getBindings((bindings) => {
let attributes = Object.entries(bindings).map(([name, value]) => ({ name, value }));
- attributesOnly(attributes).forEach(({ name, value }, index2) => {
- attributes[index2] = {
- name: `x-bind:${name}`,
- value: `"${value}"`
- };
- });
directives(el, attributes, original).map((handle) => {
cleanupRunners.push(handle.runCleanups);
handle();
});
});
@@ -3757,15 +3716,10 @@
if (/^\[.*\]$/.test(iteratorNames.item) && Array.isArray(item)) {
let names = iteratorNames.item.replace("[", "").replace("]", "").split(",").map((i) => i.trim());
names.forEach((name, i) => {
scopeVariables[name] = item[i];
});
- } else if (/^\{.*\}$/.test(iteratorNames.item) && !Array.isArray(item) && typeof item === "object") {
- let names = iteratorNames.item.replace("{", "").replace("}", "").split(",").map((i) => i.trim());
- names.forEach((name) => {
- scopeVariables[name] = item[name];
- });
} else {
scopeVariables[iteratorNames.item] = item;
}
if (iteratorNames.index)
scopeVariables[iteratorNames.index] = index2;
@@ -8418,11 +8372,14 @@
Promise.resolve().then(() => {
this.$refs.shim.style.height = "auto";
this.$dispatch("nav:updated");
});
},
- navigate($event) {
- history.pushState({}, null, $event.currentTarget.href);
+ navigate(path) {
+ if (path instanceof Event) {
+ path = path.currentTarget.href;
+ }
+ history.pushState({}, null, path);
this.$dispatch("popstate");
},
focusFilter() {
this.currentFocus = this.$refs.filter;
setTimeout(() => this.$refs.filter.focus(), 0);