upt
This commit is contained in:
57
docs/sigpro-ui.min.js
vendored
57
docs/sigpro-ui.min.js
vendored
@@ -73,15 +73,14 @@
|
||||
Autocomplete: () => Autocomplete,
|
||||
Alert: () => Alert,
|
||||
Accordion: () => Accordion,
|
||||
$$: () => $$,
|
||||
$: () => $2
|
||||
});
|
||||
|
||||
// src/sigpro.js
|
||||
var doc = typeof document !== "undefined" ? document : null;
|
||||
var isArr = Array.isArray;
|
||||
var isFunc = (f) => typeof f === "function";
|
||||
var isObj = (o) => o && typeof o === "object";
|
||||
var isArr = Array.isArray;
|
||||
var doc = typeof document !== "undefined" ? document : null;
|
||||
var ensureNode = (n) => n?._isRuntime ? n.container : n instanceof Node ? n : doc.createTextNode(n == null ? "" : String(n));
|
||||
var activeEffect = null;
|
||||
var activeOwner = null;
|
||||
@@ -123,7 +122,8 @@
|
||||
effect._cleanups.forEach((cl) => cl());
|
||||
effect._cleanups.clear();
|
||||
}
|
||||
const prevEffect = activeEffect, prevOwner = activeOwner;
|
||||
const prevEffect = activeEffect;
|
||||
const prevOwner = activeOwner;
|
||||
activeEffect = activeOwner = effect;
|
||||
try {
|
||||
const res = isComputed ? fn() : (fn(), undefined);
|
||||
@@ -251,29 +251,6 @@
|
||||
return val;
|
||||
};
|
||||
};
|
||||
var $$ = (obj, cache = new WeakMap) => {
|
||||
if (!isObj(obj))
|
||||
return obj;
|
||||
if (cache.has(obj))
|
||||
return cache.get(obj);
|
||||
const subs = {};
|
||||
const proxy = new Proxy(obj, {
|
||||
get: (t, k) => {
|
||||
trackUpdate(subs[k] ??= new Set);
|
||||
return isObj(t[k]) ? $$(t[k], cache) : t[k];
|
||||
},
|
||||
set: (t, k, v) => {
|
||||
if (!Object.is(t[k], v)) {
|
||||
t[k] = v;
|
||||
if (subs[k])
|
||||
trackUpdate(subs[k], true);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
cache.set(obj, proxy);
|
||||
return proxy;
|
||||
};
|
||||
var Watch2 = (sources, cb) => {
|
||||
if (cb === undefined) {
|
||||
const effect2 = createEffect(sources);
|
||||
@@ -319,7 +296,10 @@
|
||||
if (isFunc(tag)) {
|
||||
const ctx = { _mounts: [], _cleanups: new Set };
|
||||
const effect = createEffect(() => {
|
||||
const result2 = tag(props, { children, emit: (ev, ...args) => props[`on${ev[0].toUpperCase()}${ev.slice(1)}`]?.(...args) });
|
||||
const result2 = tag(props, {
|
||||
children,
|
||||
emit: (ev, ...args) => props[`on${ev[0].toUpperCase()}${ev.slice(1)}`]?.(...args)
|
||||
});
|
||||
effect._result = result2;
|
||||
return result2;
|
||||
});
|
||||
@@ -429,6 +409,7 @@
|
||||
const previousOwner = activeOwner;
|
||||
const container = doc.createElement("div");
|
||||
container.style.display = "contents";
|
||||
container.setAttribute("role", "presentation");
|
||||
activeOwner = { _cleanups: cleanups, _mounts: mounts };
|
||||
const processResult = (result) => {
|
||||
if (!result)
|
||||
@@ -461,7 +442,9 @@
|
||||
var If2 = (cond, ifYes, ifNot = null, trans = null) => {
|
||||
const anchor = doc.createTextNode("");
|
||||
const root = Tag2("div", { style: "display:contents" }, [anchor]);
|
||||
let currentView = null, last = null;
|
||||
let currentView = null;
|
||||
let last = null;
|
||||
let exitPromise = null;
|
||||
Watch2(() => !!(isFunc(cond) ? cond() : cond), (show) => {
|
||||
if (show === last)
|
||||
return;
|
||||
@@ -472,10 +455,18 @@
|
||||
currentView = null;
|
||||
}
|
||||
};
|
||||
if (currentView && !show && trans?.out)
|
||||
trans.out(currentView.container, disposeView);
|
||||
else
|
||||
if (currentView && !show && trans?.out) {
|
||||
if (exitPromise && exitPromise.cancel)
|
||||
exitPromise.cancel();
|
||||
const anim = trans.out(currentView.container, disposeView);
|
||||
exitPromise = anim;
|
||||
if (anim && anim.finished)
|
||||
anim.finished.then(disposeView);
|
||||
else
|
||||
disposeView();
|
||||
} else {
|
||||
disposeView();
|
||||
}
|
||||
const content = show ? ifYes : ifNot;
|
||||
if (content) {
|
||||
currentView = Render(() => isFunc(content) ? content() : content);
|
||||
@@ -562,7 +553,7 @@
|
||||
MOUNTED_NODES.set(t, inst);
|
||||
return inst;
|
||||
};
|
||||
var SigPro = Object.freeze({ $: $2, $$, Watch: Watch2, Tag: Tag2, Render, If: If2, For: For2, Router, Mount: Mount2, onMount, onUnmount });
|
||||
var SigPro = Object.freeze({ $: $2, Watch: Watch2, Tag: Tag2, Render, If: If2, For: For2, Router, Mount: Mount2, onMount, onUnmount });
|
||||
if (typeof window !== "undefined") {
|
||||
Object.assign(window, SigPro);
|
||||
"div span p h1 h2 h3 h4 h5 h6 br hr section article aside nav main header footer ul ol li a em strong pre code form label input textarea select button img svg".split(" ").forEach((t) => window[t[0].toUpperCase() + t.slice(1)] = (p, c) => SigPro.Tag(t, p, c));
|
||||
|
||||
Reference in New Issue
Block a user