Updated dev assets

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2024-05-15 20:01:04 +01:00
parent 30f738646e
commit 8e35a56386
2 changed files with 203 additions and 152 deletions

View file

@ -104,120 +104,6 @@
return () => release(effectReference);
}
// packages/alpinejs/src/utils/dispatch.js
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
})
);
}
// packages/alpinejs/src/utils/walk.js
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;
}
}
// packages/alpinejs/src/utils/warn.js
function warn(message, ...args) {
console.warn(`Alpine Warning: ${message}`, ...args);
}
// packages/alpinejs/src/lifecycle.js
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().join(","))).filter(outNestedComponents).forEach((el) => {
initTree(el);
});
dispatch(document, "alpine:initialized");
}
var rootSelectorCallbacks = [];
var initSelectorCallbacks = [];
function rootSelectors() {
return rootSelectorCallbacks.map((fn) => fn());
}
function allSelectors() {
return rootSelectorCallbacks.concat(initSelectorCallbacks).map((fn) => fn());
}
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((i) => i(el2, skip));
directives(el2, el2.attributes).forEach((handle) => handle());
el2._x_ignore && skip();
});
});
}
function destroyTree(root) {
walk(root, (el) => {
cleanupAttributes(el);
cleanupElement(el);
});
}
// packages/alpinejs/src/mutation.js
var onAttributeAddeds = [];
var onElRemoveds = [];
@ -352,7 +238,6 @@
if (addedNodes.has(node))
continue;
onElRemoveds.forEach((i) => i(node));
destroyTree(node);
}
addedNodes.forEach((node) => {
node._x_ignoreSelf = true;
@ -413,7 +298,7 @@
if (name == Symbol.unscopables)
return false;
return objects.some(
(obj) => Object.prototype.hasOwnProperty.call(obj, name)
(obj) => Object.prototype.hasOwnProperty.call(obj, name) || Reflect.has(obj, name)
);
},
get({ objects }, name, thisProxy) {
@ -421,7 +306,7 @@
return collapseProxies;
return Reflect.get(
objects.find(
(obj) => Object.prototype.hasOwnProperty.call(obj, name)
(obj) => Reflect.has(obj, name)
) || {},
name,
thisProxy
@ -446,12 +331,14 @@
}
// packages/alpinejs/src/interceptor.js
function initInterceptors2(data2) {
function initInterceptors(data2) {
let isObject2 = (val) => typeof val === "object" && !Array.isArray(val) && val !== null;
let recurse = (obj, basePath = "") => {
Object.entries(Object.getOwnPropertyDescriptors(obj)).forEach(([key, { value, enumerable }]) => {
if (enumerable === false || value === void 0)
return;
if (typeof value === "object" && value !== null && value.__v_skip)
return;
let path = basePath === "" ? key : `${basePath}.${key}`;
if (typeof value === "object" && value !== null && value._x_interceptor) {
obj[key] = value.initialize(data2, path, key);
@ -676,6 +563,9 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
}
};
}
function directiveExists(name) {
return Object.keys(directiveHandlers).includes(name);
}
function directives(el, attributes, originalAttributeOverride) {
attributes = Array.from(attributes);
if (el._x_virtualDirectives) {
@ -816,6 +706,140 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
return directiveOrder.indexOf(typeA) - directiveOrder.indexOf(typeB);
}
// packages/alpinejs/src/utils/dispatch.js
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
})
);
}
// packages/alpinejs/src/utils/walk.js
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;
}
}
// packages/alpinejs/src/utils/warn.js
function warn(message, ...args) {
console.warn(`Alpine Warning: ${message}`, ...args);
}
// packages/alpinejs/src/lifecycle.js
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().join(","))).filter(outNestedComponents).forEach((el) => {
initTree(el);
});
dispatch(document, "alpine:initialized");
setTimeout(() => {
warnAboutMissingPlugins();
});
}
var rootSelectorCallbacks = [];
var initSelectorCallbacks = [];
function rootSelectors() {
return rootSelectorCallbacks.map((fn) => fn());
}
function allSelectors() {
return rootSelectorCallbacks.concat(initSelectorCallbacks).map((fn) => fn());
}
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((i) => i(el2, skip));
directives(el2, el2.attributes).forEach((handle) => handle());
el2._x_ignore && skip();
});
});
}
function destroyTree(root, walker = walk) {
walker(root, (el) => {
cleanupAttributes(el);
cleanupElement(el);
});
}
function warnAboutMissingPlugins() {
let pluginDirectives = [
["ui", "dialog", ["[x-dialog], [x-popover]"]],
["anchor", "anchor", ["[x-anchor]"]],
["sort", "sort", ["[x-sort]"]]
];
pluginDirectives.forEach(([plugin2, directive2, selectors]) => {
if (directiveExists(directive2))
return;
selectors.some((selector) => {
if (document.querySelector(selector)) {
warn(`found "${selector}", but missing ${plugin2} plugin`);
return true;
}
});
});
}
// packages/alpinejs/src/nextTick.js
var tickStack = [];
var isHolding = false;
@ -1395,7 +1419,6 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
"checked",
"required",
"readonly",
"hidden",
"open",
"selected",
"autofocus",
@ -1531,7 +1554,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
if (typeof value === "object" && value !== null && value.hasOwnProperty("init") && typeof value.init === "function") {
stores[name].init();
}
initInterceptors2(stores[name]);
initInterceptors(stores[name]);
}
function getStores() {
return stores;
@ -1619,7 +1642,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
get raw() {
return raw;
},
version: "3.13.5",
version: "3.13.10",
flushAndStopDeferringMutations,
dontAutoEvaluateFunctions,
disableEffectScheduling,
@ -2423,12 +2446,10 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
});
function getArrayOfRefObject(el) {
let refObjects = [];
let currentEl = el;
while (currentEl) {
if (currentEl._x_refs)
refObjects.push(currentEl._x_refs);
currentEl = currentEl.parentNode;
}
findClosest(el, (i) => {
if (i._x_refs)
refObjects.push(i._x_refs);
});
return refObjects;
}
@ -2560,8 +2581,10 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
};
mutateDom(() => {
placeInDom(clone2, target, modifiers);
initTree(clone2);
clone2._x_ignore = true;
skipDuringClone(() => {
initTree(clone2);
clone2._x_ignore = true;
})();
});
el._x_teleportPutBack = () => {
let target2 = getTarget(expression);
@ -2637,10 +2660,12 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
e.stopPropagation();
next(e);
});
if (modifiers.includes("self"))
if (modifiers.includes("once")) {
handler4 = wrapHandler(handler4, (next, e) => {
e.target === el && next(e);
next(e);
listenerTarget.removeEventListener(event, handler4, options);
});
}
if (modifiers.includes("away") || modifiers.includes("outside")) {
listenerTarget = document;
handler4 = wrapHandler(handler4, (next, e) => {
@ -2655,12 +2680,10 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
next(e);
});
}
if (modifiers.includes("once")) {
if (modifiers.includes("self"))
handler4 = wrapHandler(handler4, (next, e) => {
next(e);
listenerTarget.removeEventListener(event, handler4, options);
e.target === el && next(e);
});
}
handler4 = wrapHandler(handler4, (next, e) => {
if (isKeyEvent(event)) {
if (isListeningForASpecificKeyThatHasntBeenPressed(e, modifiers)) {
@ -2741,6 +2764,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
"left": "arrow-left",
"right": "arrow-right",
"period": ".",
"comma": ",",
"equal": "=",
"minus": "-",
"underscore": "_"
@ -2797,8 +2821,10 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
setValue(getInputValue(el, modifiers, e, getValue()));
});
if (modifiers.includes("fill")) {
if ([void 0, null, ""].includes(getValue()) || el.type === "checkbox" && Array.isArray(getValue())) {
el.dispatchEvent(new Event(event, {}));
if ([void 0, null, ""].includes(getValue()) || el.type === "checkbox" && Array.isArray(getValue()) || el.tagName.toLowerCase() === "select" && el.multiple) {
setValue(
getInputValue(el, modifiers, { target: el }, getValue())
);
}
}
if (!el._x_removeModelListeners)
@ -2807,7 +2833,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
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));
nextTick(() => el._x_model && el._x_model.set(getInputValue(el, modifiers, { target: el }, getValue())));
});
cleanup2(() => removeResetListener());
}
@ -2847,7 +2873,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
} else {
newValue = event.target.value;
}
return event.target.checked ? currentValue.concat([newValue]) : currentValue.filter((el2) => !checkedAttrLooseCompare2(el2, newValue));
return event.target.checked ? currentValue.includes(newValue) ? currentValue : currentValue.concat([newValue]) : currentValue.filter((el2) => !checkedAttrLooseCompare2(el2, newValue));
} else {
return event.target.checked;
}
@ -2867,12 +2893,25 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
return option.value || option.text;
});
} else {
if (modifiers.includes("number")) {
return safeParseNumber(event.target.value);
} else if (modifiers.includes("boolean")) {
return safeParseBoolean(event.target.value);
let newValue;
if (el.type === "radio") {
if (event.target.checked) {
newValue = event.target.value;
} else {
newValue = currentValue;
}
} else {
newValue = event.target.value;
}
if (modifiers.includes("number")) {
return safeParseNumber(newValue);
} else if (modifiers.includes("boolean")) {
return safeParseBoolean(newValue);
} else if (modifiers.includes("trim")) {
return newValue.trim();
} else {
return newValue;
}
return modifiers.includes("trim") ? event.target.value.trim() : event.target.value;
}
});
}
@ -2931,7 +2970,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
// packages/alpinejs/src/directives/x-bind.js
mapAttributes(startingWith(":", into(prefix("bind:"))));
var handler2 = (el, { value, modifiers, expression, original }, { effect: effect3 }) => {
var handler2 = (el, { value, modifiers, expression, original }, { effect: effect3, cleanup: cleanup2 }) => {
if (!value) {
let bindingProviders = {};
injectBindingProviders(bindingProviders);
@ -2953,6 +2992,10 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
}
mutateDom(() => bind(el, value, result, modifiers));
}));
cleanup2(() => {
el._x_undoAddedClasses && el._x_undoAddedClasses();
el._x_undoAddedStyles && el._x_undoAddedStyles();
});
};
handler2.inline = (el, { value, modifiers, expression }) => {
if (!value)
@ -2981,7 +3024,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
data2 = {};
injectMagics(data2, el);
let reactiveData = reactive(data2);
initInterceptors2(reactiveData);
initInterceptors(reactiveData);
let undo = addScopeToNode(el, reactiveData);
reactiveData["init"] && evaluate(el, reactiveData["init"]);
cleanup2(() => {
@ -3088,13 +3131,21 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
if (isObject2(items)) {
items = Object.entries(items).map(([key, value]) => {
let scope2 = getIterationScopeVariables(iteratorNames, value, key, items);
evaluateKey((value2) => keys.push(value2), { scope: { index: key, ...scope2 } });
evaluateKey((value2) => {
if (keys.includes(value2))
warn("Duplicate key on x-for", el);
keys.push(value2);
}, { scope: { index: key, ...scope2 } });
scopes.push(scope2);
});
} else {
for (let i = 0; i < items.length; i++) {
let scope2 = getIterationScopeVariables(iteratorNames, items[i], i, items);
evaluateKey((value) => keys.push(value), { scope: { index: i, ...scope2 } });
evaluateKey((value) => {
if (keys.includes(value))
warn("Duplicate key on x-for", el);
keys.push(value);
}, { scope: { index: i, ...scope2 } });
scopes.push(scope2);
}
}
@ -3142,7 +3193,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
let marker = document.createElement("div");
mutateDom(() => {
if (!elForSpot)
warn(`x-for ":key" is undefined or invalid`, templateEl);
warn(`x-for ":key" is undefined or invalid`, templateEl, keyForSpot, lookup);
elForSpot.after(marker);
elInSpot.after(elForSpot);
elForSpot._x_currentIfEl && elForSpot.after(elForSpot._x_currentIfEl);
@ -3169,7 +3220,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
};
mutateDom(() => {
lastEl.after(clone2);
initTree(clone2);
skipDuringClone(() => initTree(clone2))();
});
if (typeof key === "object") {
warn("x-for key cannot be an object, it must be a string or an integer", templateEl);
@ -3253,7 +3304,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
addScopeToNode(clone2, {}, el);
mutateDom(() => {
el.after(clone2);
initTree(clone2);
skipDuringClone(() => initTree(clone2))();
});
el._x_currentIfEl = clone2;
el._x_undoIf = () => {

View file

@ -33,7 +33,7 @@
"/js/build/vendor.js": "/js/build/vendor.js?id=a2b971da417306a63385c8098acfe4af",
"/js/dist/bootstrap-table.js": "/js/dist/bootstrap-table.js?id=e3bde6c62806c5ae510c964de17cd610",
"/js/dist/all.js": "/js/dist/all.js?id=13bdb521e0c745d7f81dae3fb110b650",
"/js/dist/all-defer.js": "/js/dist/all-defer.js?id=19ccc62a8f1ea103dede4808837384d4",
"/js/dist/all-defer.js": "/js/dist/all-defer.js?id=75d841799f917cbcacf6b87698379726",
"/css/dist/skins/skin-green.min.css": "/css/dist/skins/skin-green.min.css?id=0a82a6ae6bb4e58fe62d162c4fb50397",
"/css/dist/skins/skin-green-dark.min.css": "/css/dist/skins/skin-green-dark.min.css?id=ec0a01609bec55e90f0692d86cb81625",
"/css/dist/skins/skin-black.min.css": "/css/dist/skins/skin-black.min.css?id=76482123f6c70e866d6b971ba91de7bb",