Posts
News
diff --git a/public/js/alpine.js b/public/js/alpine.js
index 7068674..097ce6a 100644
--- a/public/js/alpine.js
+++ b/public/js/alpine.js
@@ -452,7 +452,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
}
let AsyncFunction = Object.getPrototypeOf(async function() {
}).constructor;
- let rightSideSafeExpression = /^[\n\s]*if.*\(.*\)/.test(expression) || /^(let|const)\s/.test(expression) ? `(() => { ${expression} })()` : expression;
+ let rightSideSafeExpression = /^[\n\s]*if.*\(.*\)/.test(expression) || /^(let|const)\s/.test(expression) ? `(async()=>{ ${expression} })()` : expression;
const safeAsyncFunction = () => {
try {
return new AsyncFunction(["__self", "scope"], `with (scope) { __self.result = ${rightSideSafeExpression} }; __self.finished = true; return __self.result;`);
@@ -493,6 +493,8 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
} else {
receiver(result);
}
+ } else if (typeof value === "object" && value instanceof Promise) {
+ value.then((i) => receiver(i));
} else {
receiver(value);
}
@@ -507,6 +509,18 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
var directiveHandlers = {};
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");
+ return;
+ }
+ const pos = directiveOrder.indexOf(directive2) ?? directiveOrder.indexOf("DEFAULT");
+ if (pos >= 0) {
+ directiveOrder.splice(pos, 0, name);
+ }
+ }
+ };
}
function directives(el, attributes, originalAttributeOverride) {
attributes = Array.from(attributes);
@@ -636,8 +650,6 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
"disclosure",
"menu",
"listbox",
- "list",
- "item",
"combobox",
"bind",
"init",
@@ -664,30 +676,6 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
cancelable: true
}));
}
- var tickStack = [];
- var isHolding = false;
- function nextTick(callback = () => {
- }) {
- queueMicrotask(() => {
- isHolding || setTimeout(() => {
- releaseNextTicks();
- });
- });
- return new Promise((res) => {
- tickStack.push(() => {
- callback();
- res();
- });
- });
- }
- function releaseNextTicks() {
- isHolding = false;
- while (tickStack.length)
- tickStack.shift()();
- }
- function holdNextTicks() {
- isHolding = true;
- }
function walk(el, callback) {
if (typeof ShadowRoot === "function" && el instanceof ShadowRoot) {
Array.from(el.children).forEach((el2) => walk(el2, callback));
@@ -758,9 +746,16 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
function isRoot(el) {
return rootSelectors().some((selector) => el.matches(selector));
}
- function initTree(el, walker = walk) {
+ var initInterceptors2 = [];
+ function interceptInit(callback) {
+ initInterceptors2.push(callback);
+ }
+ function initTree(el, walker = walk, intercept = () => {
+ }) {
deferHandlingDirectives(() => {
walker(el, (el2, skip) => {
+ intercept(el2, skip);
+ initInterceptors2.forEach((i) => i(el2, skip));
directives(el2, el2.attributes).forEach((handle) => handle());
el2._x_ignore && skip();
});
@@ -769,6 +764,30 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
function destroyTree(root) {
walk(root, (el) => cleanupAttributes(el));
}
+ var tickStack = [];
+ var isHolding = false;
+ function nextTick(callback = () => {
+ }) {
+ queueMicrotask(() => {
+ isHolding || setTimeout(() => {
+ releaseNextTicks();
+ });
+ });
+ return new Promise((res) => {
+ tickStack.push(() => {
+ callback();
+ res();
+ });
+ });
+ }
+ function releaseNextTicks() {
+ isHolding = false;
+ while (tickStack.length)
+ tickStack.shift()();
+ }
+ function holdNextTicks() {
+ isHolding = true;
+ }
function setClasses(el, value) {
if (Array.isArray(value)) {
return setClassesFromString(el, value.join(" "));
@@ -1138,6 +1157,9 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
}) {
return (...args) => isCloning ? fallback(...args) : callback(...args);
}
+ function onlyDuringClone(callback) {
+ return (...args) => isCloning && callback(...args);
+ }
function clone(oldEl, newEl) {
if (!newEl._x_dataStack)
newEl._x_dataStack = oldEl._x_dataStack;
@@ -1418,23 +1440,28 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
get raw() {
return raw;
},
- version: "3.10.5",
+ version: "3.11.1",
flushAndStopDeferringMutations,
dontAutoEvaluateFunctions,
disableEffectScheduling,
+ startObservingMutations,
+ stopObservingMutations,
setReactivityEngine,
closestDataStack,
skipDuringClone,
+ onlyDuringClone,
addRootSelector,
addInitSelector,
addScopeToNode,
deferMutations,
mapAttributes,
evaluateLater,
+ interceptInit,
setEvaluator,
mergeProxies,
findClosest,
closestRoot,
+ destroyTree,
interceptor,
transition,
setStyles,
@@ -1454,6 +1481,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
clone,
bound: getBinding,
$data: scope,
+ walk,
data,
bind: bind2
};
@@ -2180,7 +2208,38 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
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));
}
- directive("modelable", (el, { expression }, { effect: effect3, evaluateLater: evaluateLater2 }) => {
+ function entangle({ get: outerGet, set: outerSet }, { get: innerGet, set: innerSet }) {
+ let firstRun = true;
+ let outerHash, innerHash, outerHashLatest, innerHashLatest;
+ let reference = 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(reference);
+ };
+ }
+ directive("modelable", (el, { expression }, { effect: effect3, evaluateLater: evaluateLater2, cleanup: cleanup2 }) => {
let func = evaluateLater2(expression);
let innerGet = () => {
let result;
@@ -2198,14 +2257,33 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
el._x_removeModelListeners["default"]();
let outerGet = el._x_model.get;
let outerSet = el._x_model.set;
- effect3(() => innerSet(outerGet()));
- effect3(() => outerSet(innerGet()));
+ let releaseEntanglement = entangle({
+ get() {
+ return outerGet();
+ },
+ set(value) {
+ outerSet(value);
+ }
+ }, {
+ get() {
+ return innerGet();
+ },
+ set(value) {
+ innerSet(value);
+ }
+ });
+ cleanup2(releaseEntanglement);
});
});
- directive("teleport", (el, { expression }, { cleanup: cleanup2 }) => {
+ 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
tag", el);
- let target = document.querySelector(expression);
+ let target = skipDuringClone(() => {
+ return document.querySelector(expression);
+ }, () => {
+ return teleportContainerDuringClone;
+ })();
if (!target)
warn(`Cannot find x-teleport element for selector: "${expression}"`);
let clone2 = el.content.cloneNode(true).firstElementChild;
@@ -2221,7 +2299,13 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
}
addScopeToNode(clone2, {}, el);
mutateDom(() => {
- target.appendChild(clone2);
+ if (modifiers.includes("prepend")) {
+ target.parentNode.insertBefore(clone2, target);
+ } else if (modifiers.includes("append")) {
+ target.parentNode.insertBefore(clone2, target.nextSibling);
+ } else {
+ target.appendChild(clone2);
+ }
initTree(clone2);
clone2._x_ignore = true;
});
@@ -2321,6 +2405,8 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
return !Array.isArray(subject) && !isNaN(subject);
}
function kebabCase2(subject) {
+ if ([" ", "_"].includes(subject))
+ return subject;
return subject.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[_\s]/, "-").toLowerCase();
}
function isKeyEvent(event) {
@@ -2334,6 +2420,10 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
let debounceIndex = keyModifiers.indexOf("debounce");
keyModifiers.splice(debounceIndex, isNumeric((keyModifiers[debounceIndex + 1] || "invalid-wait").split("ms")[0]) ? 2 : 1);
}
+ if (keyModifiers.includes("throttle")) {
+ let debounceIndex = keyModifiers.indexOf("throttle");
+ keyModifiers.splice(debounceIndex, isNumeric((keyModifiers[debounceIndex + 1] || "invalid-wait").split("ms")[0]) ? 2 : 1);
+ }
if (keyModifiers.length === 0)
return false;
if (keyModifiers.length === 1 && keyToModifiers(e.key).includes(keyModifiers[0]))
@@ -2361,8 +2451,8 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
let modifierToKeyMap = {
ctrl: "control",
slash: "/",
- space: "-",
- spacebar: "-",
+ space: " ",
+ spacebar: " ",
cmd: "meta",
esc: "escape",
up: "arrow-up",
@@ -2370,7 +2460,9 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
left: "arrow-left",
right: "arrow-right",
period: ".",
- equal: "="
+ equal: "=",
+ minus: "-",
+ underscore: "_"
};
modifierToKeyMap[key] = key;
return Object.keys(modifierToKeyMap).map((modifier) => {
@@ -2379,80 +2471,103 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
}).filter((modifier) => modifier);
}
directive("model", (el, { modifiers, expression }, { effect: effect3, cleanup: cleanup2 }) => {
- let evaluate2 = evaluateLater(el, expression);
- let assignmentExpression = `${expression} = rightSideOfExpression($event, ${expression})`;
- let evaluateAssignment = evaluateLater(el, assignmentExpression);
- var event = el.tagName.toLowerCase() === "select" || ["checkbox", "radio"].includes(el.type) || modifiers.includes("lazy") ? "change" : "input";
- let assigmentFunction = generateAssignmentFunction(el, modifiers, expression);
- let removeListener = on(el, event, modifiers, (e) => {
- evaluateAssignment(() => {
- }, { scope: {
- $event: e,
- rightSideOfExpression: assigmentFunction
- } });
- });
- if (!el._x_removeModelListeners)
- el._x_removeModelListeners = {};
- el._x_removeModelListeners["default"] = removeListener;
- cleanup2(() => el._x_removeModelListeners["default"]());
- let evaluateSetModel = evaluateLater(el, `${expression} = __placeholder`);
- el._x_model = {
- get() {
- let result;
- evaluate2((value) => result = value);
- return result;
- },
- set(value) {
- evaluateSetModel(() => {
- }, { scope: { __placeholder: value } });
+ let scopeTarget = el;
+ if (modifiers.includes("parent")) {
+ scopeTarget = el.parentNode;
+ }
+ let evaluateGet = evaluateLater(scopeTarget, expression);
+ let evaluateSet;
+ if (typeof expression === "string") {
+ evaluateSet = evaluateLater(scopeTarget, `${expression} = __placeholder`);
+ } else if (typeof expression === "function" && typeof expression() === "string") {
+ evaluateSet = evaluateLater(scopeTarget, `${expression()} = __placeholder`);
+ } else {
+ evaluateSet = () => {
+ };
+ }
+ let getValue = () => {
+ let result;
+ evaluateGet((value) => result = value);
+ return isGetterSetter(result) ? result.get() : result;
+ };
+ let setValue = (value) => {
+ let result;
+ evaluateGet((value2) => result = value2);
+ if (isGetterSetter(result)) {
+ result.set(value);
+ } else {
+ evaluateSet(() => {
+ }, {
+ scope: { __placeholder: value }
+ });
}
};
- el._x_forceModelUpdate = () => {
- evaluate2((value) => {
- if (value === void 0 && expression.match(/\./))
- value = "";
- window.fromModel = true;
- mutateDom(() => bind(el, "value", value));
- delete window.fromModel;
- });
- };
- effect3(() => {
- if (modifiers.includes("unintrusive") && document.activeElement.isSameNode(el))
- return;
- el._x_forceModelUpdate();
- });
- });
- function generateAssignmentFunction(el, modifiers, expression) {
- if (el.type === "radio") {
+ if (typeof expression === "string" && el.type === "radio") {
mutateDom(() => {
if (!el.hasAttribute("name"))
el.setAttribute("name", expression);
});
}
- return (event, currentValue) => {
- return mutateDom(() => {
- if (event instanceof CustomEvent && event.detail !== void 0) {
- return 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 {
- return event.target.checked;
- }
- } else if (el.tagName.toLowerCase() === "select" && el.multiple) {
- return modifiers.includes("number") ? Array.from(event.target.selectedOptions).map((option) => {
- let rawValue = option.value || option.text;
- return safeParseNumber(rawValue);
- }) : Array.from(event.target.selectedOptions).map((option) => {
- return option.value || option.text;
- });
- } else {
- let rawValue = event.target.value;
- return modifiers.includes("number") ? safeParseNumber(rawValue) : modifiers.includes("trim") ? rawValue.trim() : rawValue;
- }
+ var event = el.tagName.toLowerCase() === "select" || ["checkbox", "radio"].includes(el.type) || modifiers.includes("lazy") ? "change" : "input";
+ let removeListener = on(el, event, modifiers, (e) => {
+ setValue(getInputValue(el, modifiers, e, getValue()));
+ });
+ if (!el._x_removeModelListeners)
+ el._x_removeModelListeners = {};
+ el._x_removeModelListeners["default"] = removeListener;
+ cleanup2(() => el._x_removeModelListeners["default"]());
+ if (el.form) {
+ let removeResetListener = on(el.form, "reset", [], (e) => {
+ nextTick(() => el._x_model && el._x_model.set(el.value));
});
+ cleanup2(() => removeResetListener());
+ }
+ el._x_model = {
+ get() {
+ return getValue();
+ },
+ 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;
+ };
+ effect3(() => {
+ let value = getValue();
+ if (modifiers.includes("unintrusive") && document.activeElement.isSameNode(el))
+ return;
+ el._x_forceModelUpdate(value);
+ });
+ });
+ function getInputValue(el, modifiers, event, currentValue) {
+ return mutateDom(() => {
+ if (event instanceof CustomEvent && event.detail !== void 0) {
+ return typeof event.detail != "undefined" ? 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 {
+ return event.target.checked;
+ }
+ } else if (el.tagName.toLowerCase() === "select" && el.multiple) {
+ return modifiers.includes("number") ? Array.from(event.target.selectedOptions).map((option) => {
+ let rawValue = option.value || option.text;
+ return safeParseNumber(rawValue);
+ }) : Array.from(event.target.selectedOptions).map((option) => {
+ return option.value || option.text;
+ });
+ } else {
+ let rawValue = event.target.value;
+ return modifiers.includes("number") ? safeParseNumber(rawValue) : modifiers.includes("trim") ? rawValue.trim() : rawValue;
+ }
+ });
}
function safeParseNumber(rawValue) {
let number = rawValue ? parseFloat(rawValue) : null;
@@ -2464,6 +2579,9 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
function isNumeric2(subject) {
return !Array.isArray(subject) && !isNaN(subject);
}
+ function isGetterSetter(value) {
+ return value !== null && typeof value === "object" && typeof value.get === "function" && typeof value.set === "function";
+ }
directive("cloak", (el) => queueMicrotask(() => mutateDom(() => el.removeAttribute(prefix("cloak")))));
addInitSelector(() => `[${prefix("init")}]`);
directive("init", skipDuringClone((el, { expression }, { evaluate: evaluate2 }) => {
diff --git a/public/page/2/index.html b/public/page/2/index.html
index 10798f0..30a440e 100644
--- a/public/page/2/index.html
+++ b/public/page/2/index.html
@@ -1,4 +1,4 @@
-TailBliss is Hugo Starter | TailBliss