sigmx 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +54 -43
- package/dist/cli.js +3 -1
- package/dist/cli.js.map +2 -2
- package/dist/kernel/compile.d.ts +8 -9
- package/dist/kernel/compile.js +102 -67
- package/dist/kernel/compile.js.map +2 -2
- package/dist/kernel/contracts.d.ts +12 -13
- package/dist/kernel/index.d.ts +11 -12
- package/dist/kernel/index.js +14 -12
- package/dist/kernel/index.js.map +3 -3
- package/dist/kernel/precompile.d.ts +8 -12
- package/dist/kernel/precompile.js +33 -76
- package/dist/kernel/precompile.js.map +2 -2
- package/dist/kernel/precompiled.d.ts +7 -4
- package/dist/kernel/precompiled.js +5 -5
- package/dist/kernel/precompiled.js.map +2 -2
- package/dist/kernel/reactive.d.ts +13 -11
- package/dist/kernel/reactive.js +96 -71
- package/dist/kernel/reactive.js.map +3 -3
- package/dist/kernel/runtime.js +85 -63
- package/dist/kernel/runtime.js.map +3 -3
- package/dist/kernel/scan.d.ts +2 -11
- package/dist/kernel/scan.js +26 -9
- package/dist/kernel/scan.js.map +2 -2
- package/dist/kernel/state.d.ts +5 -8
- package/dist/kernel/state.js +114 -76
- package/dist/kernel/state.js.map +2 -2
- package/dist/kernel/strict-csp.d.ts +0 -5
- package/dist/kernel/strict-csp.js +2 -2
- package/dist/kernel/strict-csp.js.map +2 -2
- package/dist/lib/casing.d.ts +4 -1
- package/dist/lib/casing.js +8 -1
- package/dist/lib/casing.js.map +2 -2
- package/dist/lib/objects.d.ts +5 -4
- package/dist/lib/objects.js +13 -5
- package/dist/lib/objects.js.map +2 -2
- package/dist/lib/schedule.d.ts +3 -5
- package/dist/lib/schedule.js +12 -10
- package/dist/lib/schedule.js.map +2 -2
- package/dist/lib/sse.d.ts +10 -1
- package/dist/lib/sse.js +32 -28
- package/dist/lib/sse.js.map +2 -2
- package/dist/plugins/def.d.ts +5 -0
- package/dist/plugins/def.js +22 -0
- package/dist/plugins/def.js.map +7 -0
- package/dist/plugins/directives/attribute-sync.js +8 -12
- package/dist/plugins/directives/attribute-sync.js.map +2 -2
- package/dist/plugins/directives/boost.d.ts +1 -1
- package/dist/plugins/directives/boost.js +34 -30
- package/dist/plugins/directives/boost.js.map +2 -2
- package/dist/plugins/directives/busy-flag.js +13 -16
- package/dist/plugins/directives/busy-flag.js.map +2 -2
- package/dist/plugins/directives/class-toggle.js +17 -16
- package/dist/plugins/directives/class-toggle.js.map +2 -2
- package/dist/plugins/directives/cloak.js +2 -7
- package/dist/plugins/directives/cloak.js.map +2 -2
- package/dist/plugins/directives/collapse.js +36 -37
- package/dist/plugins/directives/collapse.js.map +2 -2
- package/dist/plugins/directives/declare.js +5 -8
- package/dist/plugins/directives/declare.js.map +2 -2
- package/dist/plugins/directives/derive.js +9 -15
- package/dist/plugins/directives/derive.js.map +2 -2
- package/dist/plugins/directives/element-ref.js +8 -8
- package/dist/plugins/directives/element-ref.js.map +2 -2
- package/dist/plugins/directives/event-listener.js +18 -23
- package/dist/plugins/directives/event-listener.js.map +2 -2
- package/dist/plugins/directives/frame-loop.js +9 -14
- package/dist/plugins/directives/frame-loop.js.map +2 -2
- package/dist/plugins/directives/html.js +6 -7
- package/dist/plugins/directives/html.js.map +2 -2
- package/dist/plugins/directives/inline-style.js +17 -20
- package/dist/plugins/directives/inline-style.js.map +2 -2
- package/dist/plugins/directives/mask.js +19 -23
- package/dist/plugins/directives/mask.js.map +2 -2
- package/dist/plugins/directives/media-query.d.ts +4 -1
- package/dist/plugins/directives/media-query.js +13 -12
- package/dist/plugins/directives/media-query.js.map +2 -2
- package/dist/plugins/directives/on-mount.js +4 -9
- package/dist/plugins/directives/on-mount.js.map +2 -2
- package/dist/plugins/directives/patch-listener.js +24 -19
- package/dist/plugins/directives/patch-listener.js.map +2 -2
- package/dist/plugins/directives/remove-me.js +7 -8
- package/dist/plugins/directives/remove-me.js.map +2 -2
- package/dist/plugins/directives/scroll-to.d.ts +4 -1
- package/dist/plugins/directives/scroll-to.js +8 -14
- package/dist/plugins/directives/scroll-to.js.map +2 -2
- package/dist/plugins/directives/size-watch.js +7 -12
- package/dist/plugins/directives/size-watch.js.map +2 -2
- package/dist/plugins/directives/state-dump.js +6 -10
- package/dist/plugins/directives/state-dump.js.map +2 -2
- package/dist/plugins/directives/storage-sync.js +13 -9
- package/dist/plugins/directives/storage-sync.js.map +2 -2
- package/dist/plugins/directives/teleport.js +8 -14
- package/dist/plugins/directives/teleport.js.map +2 -2
- package/dist/plugins/directives/text-content.js +6 -7
- package/dist/plugins/directives/text-content.js.map +2 -2
- package/dist/plugins/directives/timer.js +7 -13
- package/dist/plugins/directives/timer.js.map +2 -2
- package/dist/plugins/directives/transition.d.ts +1 -2
- package/dist/plugins/directives/transition.js +32 -34
- package/dist/plugins/directives/transition.js.map +2 -2
- package/dist/plugins/directives/tween.d.ts +2 -2
- package/dist/plugins/directives/tween.js +34 -50
- package/dist/plugins/directives/tween.js.map +2 -2
- package/dist/plugins/directives/two-way-bind.d.ts +1 -1
- package/dist/plugins/directives/two-way-bind.js +70 -67
- package/dist/plugins/directives/two-way-bind.js.map +2 -2
- package/dist/plugins/directives/url-params.js +36 -59
- package/dist/plugins/directives/url-params.js.map +3 -3
- package/dist/plugins/directives/url-replace.js +6 -7
- package/dist/plugins/directives/url-replace.js.map +2 -2
- package/dist/plugins/directives/validity.js +6 -9
- package/dist/plugins/directives/validity.js.map +2 -2
- package/dist/plugins/directives/viewport.js +18 -23
- package/dist/plugins/directives/viewport.js.map +2 -2
- package/dist/plugins/directives/visibility.js +9 -14
- package/dist/plugins/directives/visibility.js.map +2 -2
- package/dist/plugins/directives/watch.d.ts +0 -1
- package/dist/plugins/directives/watch.js +2 -8
- package/dist/plugins/directives/watch.js.map +2 -2
- package/dist/plugins/functions/bulk-set.js +10 -7
- package/dist/plugins/functions/bulk-set.js.map +2 -2
- package/dist/plugins/functions/bulk-toggle.js +10 -7
- package/dist/plugins/functions/bulk-toggle.js.map +2 -2
- package/dist/plugins/functions/confirm.js +2 -2
- package/dist/plugins/functions/confirm.js.map +2 -2
- package/dist/plugins/functions/copy-text.js +5 -5
- package/dist/plugins/functions/copy-text.js.map +2 -2
- package/dist/plugins/functions/dispatch.js +5 -5
- package/dist/plugins/functions/dispatch.js.map +2 -2
- package/dist/plugins/functions/locale-format.d.ts +4 -1
- package/dist/plugins/functions/locale-format.js +9 -16
- package/dist/plugins/functions/locale-format.js.map +2 -2
- package/dist/plugins/functions/range-map.js +6 -6
- package/dist/plugins/functions/range-map.js.map +2 -2
- package/dist/plugins/functions/request.d.ts +7 -3
- package/dist/plugins/functions/request.js +85 -80
- package/dist/plugins/functions/request.js.map +2 -2
- package/dist/plugins/functions/untracked-read.js +3 -2
- package/dist/plugins/functions/untracked-read.js.map +2 -2
- package/dist/plugins/functions/websocket.d.ts +3 -3
- package/dist/plugins/functions/websocket.js +18 -25
- package/dist/plugins/functions/websocket.js.map +2 -2
- package/dist/plugins/index.d.ts +34 -36
- package/dist/plugins/index.js +31 -35
- package/dist/plugins/index.js.map +2 -2
- package/dist/plugins/server-events/apply-elements.d.ts +1 -1
- package/dist/plugins/server-events/apply-elements.js +41 -40
- package/dist/plugins/server-events/apply-elements.js.map +2 -2
- package/dist/plugins/server-events/apply-state.js +9 -12
- package/dist/plugins/server-events/apply-state.js.map +2 -2
- package/dist/plugins/server-events/morph.d.ts +0 -2
- package/dist/plugins/server-events/morph.js +58 -55
- package/dist/plugins/server-events/morph.js.map +3 -3
- package/dist/presets/all.d.ts +0 -1
- package/dist/presets/all.js +22 -26
- package/dist/presets/all.js.map +2 -2
- package/dist/presets/essentials.d.ts +0 -1
- package/dist/presets/essentials.js +27 -9
- package/dist/presets/essentials.js.map +2 -2
- package/dist/presets/minimal.d.ts +0 -1
- package/dist/presets/minimal.js +2 -2
- package/dist/presets/minimal.js.map +2 -2
- package/dist/server.d.ts +108 -0
- package/dist/server.js +218 -0
- package/dist/server.js.map +7 -0
- package/dist/sigmx.standalone.js +1 -1
- package/dist/standalone.js.map +2 -2
- package/dist/vite.d.ts +2 -2
- package/dist/vite.js +48 -15
- package/dist/vite.js.map +2 -2
- package/package.json +21 -2
- package/dist/auto.d.ts +0 -1
- package/dist/auto.js +0 -7
- package/dist/auto.js.map +0 -7
- package/dist/core/csp.d.ts +0 -7
- package/dist/core/csp.js +0 -20
- package/dist/core/csp.js.map +0 -7
- package/dist/core/engine.d.ts +0 -10
- package/dist/core/engine.js +0 -200
- package/dist/core/engine.js.map +0 -7
- package/dist/core/expr.d.ts +0 -12
- package/dist/core/expr.js +0 -94
- package/dist/core/expr.js.map +0 -7
- package/dist/core/index.d.ts +0 -16
- package/dist/core/index.js +0 -46
- package/dist/core/index.js.map +0 -7
- package/dist/core/signals.d.ts +0 -42
- package/dist/core/signals.js +0 -195
- package/dist/core/signals.js.map +0 -7
- package/dist/core/store.d.ts +0 -32
- package/dist/core/store.js +0 -185
- package/dist/core/store.js.map +0 -7
- package/dist/core/types.d.ts +0 -101
- package/dist/core/types.js +0 -1
- package/dist/core/types.js.map +0 -7
- package/dist/plugins/actions/clipboard.d.ts +0 -2
- package/dist/plugins/actions/clipboard.js +0 -11
- package/dist/plugins/actions/clipboard.js.map +0 -7
- package/dist/plugins/actions/fit.d.ts +0 -2
- package/dist/plugins/actions/fit.js +0 -14
- package/dist/plugins/actions/fit.js.map +0 -7
- package/dist/plugins/actions/intl.d.ts +0 -2
- package/dist/plugins/actions/intl.js +0 -21
- package/dist/plugins/actions/intl.js.map +0 -7
- package/dist/plugins/actions/peek.d.ts +0 -2
- package/dist/plugins/actions/peek.js +0 -6
- package/dist/plugins/actions/peek.js.map +0 -7
- package/dist/plugins/actions/setAll.d.ts +0 -2
- package/dist/plugins/actions/setAll.js +0 -11
- package/dist/plugins/actions/setAll.js.map +0 -7
- package/dist/plugins/actions/toggleAll.d.ts +0 -2
- package/dist/plugins/actions/toggleAll.js +0 -11
- package/dist/plugins/actions/toggleAll.js.map +0 -7
- package/dist/plugins/attributes/attr.d.ts +0 -2
- package/dist/plugins/attributes/attr.js +0 -20
- package/dist/plugins/attributes/attr.js.map +0 -7
- package/dist/plugins/attributes/bind.d.ts +0 -6
- package/dist/plugins/attributes/bind.js +0 -81
- package/dist/plugins/attributes/bind.js.map +0 -7
- package/dist/plugins/attributes/class.d.ts +0 -2
- package/dist/plugins/attributes/class.js +0 -22
- package/dist/plugins/attributes/class.js.map +0 -7
- package/dist/plugins/attributes/computed.d.ts +0 -2
- package/dist/plugins/attributes/computed.js +0 -20
- package/dist/plugins/attributes/computed.js.map +0 -7
- package/dist/plugins/attributes/customValidity.d.ts +0 -2
- package/dist/plugins/attributes/customValidity.js +0 -14
- package/dist/plugins/attributes/customValidity.js.map +0 -7
- package/dist/plugins/attributes/effect.d.ts +0 -2
- package/dist/plugins/attributes/effect.js +0 -12
- package/dist/plugins/attributes/effect.js.map +0 -7
- package/dist/plugins/attributes/indicator.d.ts +0 -2
- package/dist/plugins/attributes/indicator.js +0 -20
- package/dist/plugins/attributes/indicator.js.map +0 -7
- package/dist/plugins/attributes/init.d.ts +0 -2
- package/dist/plugins/attributes/init.js +0 -14
- package/dist/plugins/attributes/init.js.map +0 -7
- package/dist/plugins/attributes/jsonSignals.d.ts +0 -2
- package/dist/plugins/attributes/jsonSignals.js +0 -15
- package/dist/plugins/attributes/jsonSignals.js.map +0 -7
- package/dist/plugins/attributes/matchMedia.d.ts +0 -2
- package/dist/plugins/attributes/matchMedia.js +0 -19
- package/dist/plugins/attributes/matchMedia.js.map +0 -7
- package/dist/plugins/attributes/on.d.ts +0 -5
- package/dist/plugins/attributes/on.js +0 -28
- package/dist/plugins/attributes/on.js.map +0 -7
- package/dist/plugins/attributes/onIntersect.d.ts +0 -2
- package/dist/plugins/attributes/onIntersect.js +0 -28
- package/dist/plugins/attributes/onIntersect.js.map +0 -7
- package/dist/plugins/attributes/onInterval.d.ts +0 -2
- package/dist/plugins/attributes/onInterval.js +0 -18
- package/dist/plugins/attributes/onInterval.js.map +0 -7
- package/dist/plugins/attributes/onRaf.d.ts +0 -1
- package/dist/plugins/attributes/onRaf.js +0 -19
- package/dist/plugins/attributes/onRaf.js.map +0 -7
- package/dist/plugins/attributes/onResize.d.ts +0 -1
- package/dist/plugins/attributes/onResize.js +0 -17
- package/dist/plugins/attributes/onResize.js.map +0 -7
- package/dist/plugins/attributes/onSignalPatch.d.ts +0 -5
- package/dist/plugins/attributes/onSignalPatch.js +0 -35
- package/dist/plugins/attributes/onSignalPatch.js.map +0 -7
- package/dist/plugins/attributes/persist.d.ts +0 -6
- package/dist/plugins/attributes/persist.js +0 -16
- package/dist/plugins/attributes/persist.js.map +0 -7
- package/dist/plugins/attributes/queryString.d.ts +0 -5
- package/dist/plugins/attributes/queryString.js +0 -54
- package/dist/plugins/attributes/queryString.js.map +0 -7
- package/dist/plugins/attributes/ref.d.ts +0 -2
- package/dist/plugins/attributes/ref.js +0 -13
- package/dist/plugins/attributes/ref.js.map +0 -7
- package/dist/plugins/attributes/replaceUrl.d.ts +0 -1
- package/dist/plugins/attributes/replaceUrl.js +0 -11
- package/dist/plugins/attributes/replaceUrl.js.map +0 -7
- package/dist/plugins/attributes/scrollIntoView.d.ts +0 -2
- package/dist/plugins/attributes/scrollIntoView.js +0 -19
- package/dist/plugins/attributes/scrollIntoView.js.map +0 -7
- package/dist/plugins/attributes/show.d.ts +0 -2
- package/dist/plugins/attributes/show.js +0 -19
- package/dist/plugins/attributes/show.js.map +0 -7
- package/dist/plugins/attributes/signals.d.ts +0 -2
- package/dist/plugins/attributes/signals.js +0 -13
- package/dist/plugins/attributes/signals.js.map +0 -7
- package/dist/plugins/attributes/style.d.ts +0 -2
- package/dist/plugins/attributes/style.js +0 -25
- package/dist/plugins/attributes/style.js.map +0 -7
- package/dist/plugins/attributes/text.d.ts +0 -1
- package/dist/plugins/attributes/text.js +0 -13
- package/dist/plugins/attributes/text.js.map +0 -7
- package/dist/plugins/attributes/viewTransition.d.ts +0 -1
- package/dist/plugins/attributes/viewTransition.js +0 -11
- package/dist/plugins/attributes/viewTransition.js.map +0 -7
- package/dist/plugins/directives/transition-name.d.ts +0 -1
- package/dist/plugins/directives/transition-name.js +0 -11
- package/dist/plugins/directives/transition-name.js.map +0 -7
- package/dist/plugins/directives/trap.d.ts +0 -5
- package/dist/plugins/directives/trap.js +0 -48
- package/dist/plugins/directives/trap.js.map +0 -7
- package/dist/sigmx.auto.js +0 -5
- package/dist/utils/object.d.ts +0 -9
- package/dist/utils/object.js +0 -26
- package/dist/utils/object.js.map +0 -7
- package/dist/utils/text.d.ts +0 -7
- package/dist/utils/text.js +0 -15
- package/dist/utils/text.js.map +0 -7
- package/dist/utils/timing.d.ts +0 -14
- package/dist/utils/timing.js +0 -58
- package/dist/utils/timing.js.map +0 -7
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { attribute } from "../../core/index.js";
|
|
2
|
-
const persist = attribute({
|
|
3
|
-
name: "persist",
|
|
4
|
-
mount({ key, value, mods, evaluate, store, effect }) {
|
|
5
|
-
const storage = mods.has("session") ? sessionStorage : localStorage;
|
|
6
|
-
const name = key || "sigmx";
|
|
7
|
-
const filter = value ? evaluate() : void 0;
|
|
8
|
-
const saved = storage.getItem(name);
|
|
9
|
-
if (saved) store.merge(JSON.parse(saved));
|
|
10
|
-
effect(() => storage.setItem(name, JSON.stringify(store.snapshot(filter, { computed: false }))));
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
export {
|
|
14
|
-
persist
|
|
15
|
-
};
|
|
16
|
-
//# sourceMappingURL=persist.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/plugins/attributes/persist.ts"],
|
|
4
|
-
"sourcesContent": ["import { attribute } from '../../core/index.js'\n\n/**\n * Saves matching signals to localStorage (`__session` for sessionStorage) and restores them on\n * mount. `persist:key` sets the storage key; the value is an optional `{ include, exclude }` filter.\n * Declare defaults with `signals:x__ifmissing` so restored values are not overwritten.\n */\nexport const persist = attribute({\n name: 'persist',\n mount({ key, value, mods, evaluate, store, effect }) {\n const storage = mods.has('session') ? sessionStorage : localStorage\n const name = key || 'sigmx'\n const filter = value ? evaluate() : undefined\n const saved = storage.getItem(name)\n if (saved) store.merge(JSON.parse(saved))\n effect(() => storage.setItem(name, JSON.stringify(store.snapshot(filter, { computed: false }))))\n },\n})\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,iBAAiB;AAOnB,MAAM,UAAU,UAAU;AAAA,EAC/B,MAAM;AAAA,EACN,MAAM,EAAE,KAAK,OAAO,MAAM,UAAU,OAAO,OAAO,GAAG;AACnD,UAAM,UAAU,KAAK,IAAI,SAAS,IAAI,iBAAiB;AACvD,UAAM,OAAO,OAAO;AACpB,UAAM,SAAS,QAAQ,SAAS,IAAI;AACpC,UAAM,QAAQ,QAAQ,QAAQ,IAAI;AAClC,QAAI,MAAO,OAAM,MAAM,KAAK,MAAM,KAAK,CAAC;AACxC,WAAO,MAAM,QAAQ,QAAQ,MAAM,KAAK,UAAU,MAAM,SAAS,QAAQ,EAAE,UAAU,MAAM,CAAC,CAAC,CAAC,CAAC;AAAA,EACjG;AACF,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Two-way sync between matching signals and the URL query string. `__history` pushes an entry per
|
|
3
|
-
* change and restores on back/forward; `__filter` drops empty values from the URL.
|
|
4
|
-
*/
|
|
5
|
-
export declare const queryString: import("../../core/types.js").AttributePlugin;
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { attribute, expand } from "../../core/index.js";
|
|
2
|
-
const parse = (s) => {
|
|
3
|
-
try {
|
|
4
|
-
return JSON.parse(s);
|
|
5
|
-
} catch {
|
|
6
|
-
return s;
|
|
7
|
-
}
|
|
8
|
-
};
|
|
9
|
-
const queryString = attribute({
|
|
10
|
-
name: "query-string",
|
|
11
|
-
key: "forbidden",
|
|
12
|
-
mount({ value, mods, evaluate, store, listen, effect }) {
|
|
13
|
-
const filter = value ? evaluate() : void 0;
|
|
14
|
-
const history = mods.has("history");
|
|
15
|
-
const fromUrl = () => {
|
|
16
|
-
const patch = {};
|
|
17
|
-
for (const [k, v] of new URLSearchParams(location.search)) expand(patch, k, parse(v));
|
|
18
|
-
store.merge(store.snapshot(filter, { computed: false }) && patch);
|
|
19
|
-
};
|
|
20
|
-
let syncing = false;
|
|
21
|
-
fromUrl();
|
|
22
|
-
effect(() => {
|
|
23
|
-
const snap = store.snapshot(filter, { computed: false });
|
|
24
|
-
if (syncing) return;
|
|
25
|
-
const q = new URLSearchParams(location.search);
|
|
26
|
-
const walk = (obj, prefix) => {
|
|
27
|
-
for (const k in obj) {
|
|
28
|
-
const p = prefix ? `${prefix}.${k}` : k;
|
|
29
|
-
const v = obj[k];
|
|
30
|
-
if (v && typeof v === "object" && !Array.isArray(v)) walk(v, p);
|
|
31
|
-
else if (mods.has("filter") && (v === "" || v == null)) q.delete(p);
|
|
32
|
-
else q.set(p, typeof v === "string" ? v : JSON.stringify(v));
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
walk(snap, "");
|
|
36
|
-
const url = `${location.pathname}${q.size ? `?${q}` : ""}${location.hash}`;
|
|
37
|
-
if (url === location.pathname + location.search + location.hash) return;
|
|
38
|
-
history ? window.history.pushState(null, "", url) : window.history.replaceState(null, "", url);
|
|
39
|
-
});
|
|
40
|
-
if (history)
|
|
41
|
-
listen(window, "popstate", () => {
|
|
42
|
-
syncing = true;
|
|
43
|
-
try {
|
|
44
|
-
fromUrl();
|
|
45
|
-
} finally {
|
|
46
|
-
syncing = false;
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
export {
|
|
52
|
-
queryString
|
|
53
|
-
};
|
|
54
|
-
//# sourceMappingURL=queryString.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/plugins/attributes/queryString.ts"],
|
|
4
|
-
"sourcesContent": ["import { attribute, expand } from '../../core/index.js'\n\nconst parse = (s: string): unknown => {\n try {\n return JSON.parse(s)\n } catch {\n return s\n }\n}\n\n/**\n * Two-way sync between matching signals and the URL query string. `__history` pushes an entry per\n * change and restores on back/forward; `__filter` drops empty values from the URL.\n */\nexport const queryString = attribute({\n name: 'query-string',\n key: 'forbidden',\n mount({ value, mods, evaluate, store, listen, effect }) {\n const filter = value ? evaluate() : undefined\n const history = mods.has('history')\n const fromUrl = () => {\n const patch = {}\n for (const [k, v] of new URLSearchParams(location.search)) expand(patch, k, parse(v))\n store.merge(store.snapshot(filter, { computed: false }) && patch)\n }\n let syncing = false\n fromUrl()\n effect(() => {\n const snap = store.snapshot(filter, { computed: false })\n if (syncing) return\n const q = new URLSearchParams(location.search)\n const walk = (obj: Record<string, any>, prefix: string) => {\n for (const k in obj) {\n const p = prefix ? `${prefix}.${k}` : k\n const v = obj[k]\n if (v && typeof v === 'object' && !Array.isArray(v)) walk(v, p)\n else if (mods.has('filter') && (v === '' || v == null)) q.delete(p)\n else q.set(p, typeof v === 'string' ? v : JSON.stringify(v))\n }\n }\n walk(snap, '')\n const url = `${location.pathname}${q.size ? `?${q}` : ''}${location.hash}`\n if (url === location.pathname + location.search + location.hash) return\n history ? window.history.pushState(null, '', url) : window.history.replaceState(null, '', url)\n })\n if (history)\n listen(window, 'popstate', () => {\n syncing = true\n try {\n fromUrl()\n } finally {\n syncing = false\n }\n })\n },\n})\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,WAAW,cAAc;AAElC,MAAM,QAAQ,CAAC,MAAuB;AACpC,MAAI;AACF,WAAO,KAAK,MAAM,CAAC;AAAA,EACrB,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAMO,MAAM,cAAc,UAAU;AAAA,EACnC,MAAM;AAAA,EACN,KAAK;AAAA,EACL,MAAM,EAAE,OAAO,MAAM,UAAU,OAAO,QAAQ,OAAO,GAAG;AACtD,UAAM,SAAS,QAAQ,SAAS,IAAI;AACpC,UAAM,UAAU,KAAK,IAAI,SAAS;AAClC,UAAM,UAAU,MAAM;AACpB,YAAM,QAAQ,CAAC;AACf,iBAAW,CAAC,GAAG,CAAC,KAAK,IAAI,gBAAgB,SAAS,MAAM,EAAG,QAAO,OAAO,GAAG,MAAM,CAAC,CAAC;AACpF,YAAM,MAAM,MAAM,SAAS,QAAQ,EAAE,UAAU,MAAM,CAAC,KAAK,KAAK;AAAA,IAClE;AACA,QAAI,UAAU;AACd,YAAQ;AACR,WAAO,MAAM;AACX,YAAM,OAAO,MAAM,SAAS,QAAQ,EAAE,UAAU,MAAM,CAAC;AACvD,UAAI,QAAS;AACb,YAAM,IAAI,IAAI,gBAAgB,SAAS,MAAM;AAC7C,YAAM,OAAO,CAAC,KAA0B,WAAmB;AACzD,mBAAW,KAAK,KAAK;AACnB,gBAAM,IAAI,SAAS,GAAG,MAAM,IAAI,CAAC,KAAK;AACtC,gBAAM,IAAI,IAAI,CAAC;AACf,cAAI,KAAK,OAAO,MAAM,YAAY,CAAC,MAAM,QAAQ,CAAC,EAAG,MAAK,GAAG,CAAC;AAAA,mBACrD,KAAK,IAAI,QAAQ,MAAM,MAAM,MAAM,KAAK,MAAO,GAAE,OAAO,CAAC;AAAA,cAC7D,GAAE,IAAI,GAAG,OAAO,MAAM,WAAW,IAAI,KAAK,UAAU,CAAC,CAAC;AAAA,QAC7D;AAAA,MACF;AACA,WAAK,MAAM,EAAE;AACb,YAAM,MAAM,GAAG,SAAS,QAAQ,GAAG,EAAE,OAAO,IAAI,CAAC,KAAK,EAAE,GAAG,SAAS,IAAI;AACxE,UAAI,QAAQ,SAAS,WAAW,SAAS,SAAS,SAAS,KAAM;AACjE,gBAAU,OAAO,QAAQ,UAAU,MAAM,IAAI,GAAG,IAAI,OAAO,QAAQ,aAAa,MAAM,IAAI,GAAG;AAAA,IAC/F,CAAC;AACD,QAAI;AACF,aAAO,QAAQ,YAAY,MAAM;AAC/B,kBAAU;AACV,YAAI;AACF,kBAAQ;AAAA,QACV,UAAE;AACA,oBAAU;AAAA,QACZ;AAAA,MACF,CAAC;AAAA,EACL;AACF,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { attribute } from "../../core/index.js";
|
|
2
|
-
const ref = attribute({
|
|
3
|
-
name: "ref",
|
|
4
|
-
mount({ el, key, value, cased, store }) {
|
|
5
|
-
const path = key ? cased() : value.trim();
|
|
6
|
-
store.set(path, el);
|
|
7
|
-
return () => store.remove(path);
|
|
8
|
-
}
|
|
9
|
-
});
|
|
10
|
-
export {
|
|
11
|
-
ref
|
|
12
|
-
};
|
|
13
|
-
//# sourceMappingURL=ref.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/plugins/attributes/ref.ts"],
|
|
4
|
-
"sourcesContent": ["import { attribute } from '../../core/index.js'\n\n/** Stores the element in a signal: `ref:dialog` or `ref=\"dialog\"`. */\nexport const ref = attribute({\n name: 'ref',\n mount({ el, key, value, cased, store }) {\n const path = key ? cased() : value.trim()\n store.set(path, el)\n return () => store.remove(path)\n },\n})\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,iBAAiB;AAGnB,MAAM,MAAM,UAAU;AAAA,EAC3B,MAAM;AAAA,EACN,MAAM,EAAE,IAAI,KAAK,OAAO,OAAO,MAAM,GAAG;AACtC,UAAM,OAAO,MAAM,MAAM,IAAI,MAAM,KAAK;AACxC,UAAM,IAAI,MAAM,EAAE;AAClB,WAAO,MAAM,MAAM,OAAO,IAAI;AAAA,EAChC;AACF,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const replaceUrl: import("../../core/types.js").AttributePlugin;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { attribute } from "../../core/index.js";
|
|
2
|
-
const replaceUrl = attribute({
|
|
3
|
-
name: "replace-url",
|
|
4
|
-
key: "forbidden",
|
|
5
|
-
value: "required",
|
|
6
|
-
mount: ({ evaluate, effect }) => effect(() => history.replaceState(history.state, "", new URL(String(evaluate()), location.href)))
|
|
7
|
-
});
|
|
8
|
-
export {
|
|
9
|
-
replaceUrl
|
|
10
|
-
};
|
|
11
|
-
//# sourceMappingURL=replaceUrl.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/plugins/attributes/replaceUrl.ts"],
|
|
4
|
-
"sourcesContent": ["import { attribute } from '../../core/index.js'\n\nexport const replaceUrl = attribute({\n name: 'replace-url',\n key: 'forbidden',\n value: 'required',\n mount: ({ evaluate, effect }) =>\n effect(() => history.replaceState(history.state, '', new URL(String(evaluate()), location.href))),\n})\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,iBAAiB;AAEnB,MAAM,aAAa,UAAU;AAAA,EAClC,MAAM;AAAA,EACN,KAAK;AAAA,EACL,OAAO;AAAA,EACP,OAAO,CAAC,EAAE,UAAU,OAAO,MACzB,OAAO,MAAM,QAAQ,aAAa,QAAQ,OAAO,IAAI,IAAI,IAAI,OAAO,SAAS,CAAC,GAAG,SAAS,IAAI,CAAC,CAAC;AACpG,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { attribute } from "../../core/index.js";
|
|
2
|
-
const pick = (mods, names, fallback) => names.find((n) => mods.has(n)) ?? fallback;
|
|
3
|
-
const scrollIntoView = attribute({
|
|
4
|
-
name: "scroll-into-view",
|
|
5
|
-
key: "forbidden",
|
|
6
|
-
value: "forbidden",
|
|
7
|
-
mount({ el, mods }) {
|
|
8
|
-
el.scrollIntoView({
|
|
9
|
-
behavior: pick(mods, ["smooth", "instant", "auto"], "smooth"),
|
|
10
|
-
block: pick(mods, ["vstart", "vcenter", "vend", "vnearest"], "vcenter").slice(1),
|
|
11
|
-
inline: pick(mods, ["hstart", "hcenter", "hend", "hnearest"], "hcenter").slice(1)
|
|
12
|
-
});
|
|
13
|
-
if (mods.has("focus")) el.focus?.();
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
export {
|
|
17
|
-
scrollIntoView
|
|
18
|
-
};
|
|
19
|
-
//# sourceMappingURL=scrollIntoView.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/plugins/attributes/scrollIntoView.ts"],
|
|
4
|
-
"sourcesContent": ["import { attribute } from '../../core/index.js'\n\nconst pick = (mods: Map<string, string[]>, names: string[], fallback: string) =>\n names.find((n) => mods.has(n)) ?? fallback\n\n/** Scrolls the element into view on mount. Modifiers: smooth/instant/auto, vstart..vnearest, hstart..hnearest, focus. */\nexport const scrollIntoView = attribute({\n name: 'scroll-into-view',\n key: 'forbidden',\n value: 'forbidden',\n mount({ el, mods }) {\n el.scrollIntoView({\n behavior: pick(mods, ['smooth', 'instant', 'auto'], 'smooth') as ScrollBehavior,\n block: pick(mods, ['vstart', 'vcenter', 'vend', 'vnearest'], 'vcenter').slice(1) as ScrollLogicalPosition,\n inline: pick(mods, ['hstart', 'hcenter', 'hend', 'hnearest'], 'hcenter').slice(1) as ScrollLogicalPosition,\n })\n if (mods.has('focus')) (el as HTMLElement).focus?.()\n },\n})\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,iBAAiB;AAE1B,MAAM,OAAO,CAAC,MAA6B,OAAiB,aAC1D,MAAM,KAAK,CAAC,MAAM,KAAK,IAAI,CAAC,CAAC,KAAK;AAG7B,MAAM,iBAAiB,UAAU;AAAA,EACtC,MAAM;AAAA,EACN,KAAK;AAAA,EACL,OAAO;AAAA,EACP,MAAM,EAAE,IAAI,KAAK,GAAG;AAClB,OAAG,eAAe;AAAA,MAChB,UAAU,KAAK,MAAM,CAAC,UAAU,WAAW,MAAM,GAAG,QAAQ;AAAA,MAC5D,OAAO,KAAK,MAAM,CAAC,UAAU,WAAW,QAAQ,UAAU,GAAG,SAAS,EAAE,MAAM,CAAC;AAAA,MAC/E,QAAQ,KAAK,MAAM,CAAC,UAAU,WAAW,QAAQ,UAAU,GAAG,SAAS,EAAE,MAAM,CAAC;AAAA,IAClF,CAAC;AACD,QAAI,KAAK,IAAI,OAAO,EAAG,CAAC,GAAmB,QAAQ;AAAA,EACrD;AACF,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { attribute } from "../../core/index.js";
|
|
2
|
-
const show = attribute({
|
|
3
|
-
name: "show",
|
|
4
|
-
key: "forbidden",
|
|
5
|
-
value: "required",
|
|
6
|
-
mount({ el, evaluate, effect }) {
|
|
7
|
-
const initial = el.style.display === "none" ? "" : el.style.display;
|
|
8
|
-
effect(() => {
|
|
9
|
-
el.style.display = evaluate() ? initial : "none";
|
|
10
|
-
});
|
|
11
|
-
return () => {
|
|
12
|
-
el.style.display = initial;
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
export {
|
|
17
|
-
show
|
|
18
|
-
};
|
|
19
|
-
//# sourceMappingURL=show.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/plugins/attributes/show.ts"],
|
|
4
|
-
"sourcesContent": ["import { attribute } from '../../core/index.js'\n\n/** Toggles `display: none`, restoring whatever inline display the element had. */\nexport const show = attribute({\n name: 'show',\n key: 'forbidden',\n value: 'required',\n mount({ el, evaluate, effect }) {\n const initial = el.style.display === 'none' ? '' : el.style.display\n effect(() => {\n el.style.display = evaluate() ? initial : 'none'\n })\n return () => {\n el.style.display = initial\n }\n },\n})\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,iBAAiB;AAGnB,MAAM,OAAO,UAAU;AAAA,EAC5B,MAAM;AAAA,EACN,KAAK;AAAA,EACL,OAAO;AAAA,EACP,MAAM,EAAE,IAAI,UAAU,OAAO,GAAG;AAC9B,UAAM,UAAU,GAAG,MAAM,YAAY,SAAS,KAAK,GAAG,MAAM;AAC5D,WAAO,MAAM;AACX,SAAG,MAAM,UAAU,SAAS,IAAI,UAAU;AAAA,IAC5C,CAAC;AACD,WAAO,MAAM;AACX,SAAG,MAAM,UAAU;AAAA,IACrB;AAAA,EACF;AACF,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { attribute, expand } from "../../core/index.js";
|
|
2
|
-
const signals = attribute({
|
|
3
|
-
name: "signals",
|
|
4
|
-
value: "required",
|
|
5
|
-
mount({ key, cased, evaluate, store, mods }) {
|
|
6
|
-
const v = evaluate();
|
|
7
|
-
store.merge(key ? expand({}, cased(), v) : v, { ifMissing: mods.has("ifmissing") });
|
|
8
|
-
}
|
|
9
|
-
});
|
|
10
|
-
export {
|
|
11
|
-
signals
|
|
12
|
-
};
|
|
13
|
-
//# sourceMappingURL=signals.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/plugins/attributes/signals.ts"],
|
|
4
|
-
"sourcesContent": ["import { attribute, expand } from '../../core/index.js'\n\n/** `signals:name=\"expr\"` or `signals=\"{ ... }\"`. `__ifmissing` keeps existing values. */\nexport const signals = attribute({\n name: 'signals',\n value: 'required',\n mount({ key, cased, evaluate, store, mods }) {\n const v = evaluate()\n store.merge(key ? expand({}, cased(), v) : v, { ifMissing: mods.has('ifmissing') })\n },\n})\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,WAAW,cAAc;AAG3B,MAAM,UAAU,UAAU;AAAA,EAC/B,MAAM;AAAA,EACN,OAAO;AAAA,EACP,MAAM,EAAE,KAAK,OAAO,UAAU,OAAO,KAAK,GAAG;AAC3C,UAAM,IAAI,SAAS;AACnB,UAAM,MAAM,MAAM,OAAO,CAAC,GAAG,MAAM,GAAG,CAAC,IAAI,GAAG,EAAE,WAAW,KAAK,IAAI,WAAW,EAAE,CAAC;AAAA,EACpF;AACF,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { attribute, kebab } from "../../core/index.js";
|
|
2
|
-
const style = attribute({
|
|
3
|
-
name: "style",
|
|
4
|
-
value: "required",
|
|
5
|
-
mount({ el, key, cased, evaluate, effect }) {
|
|
6
|
-
const original = /* @__PURE__ */ new Map();
|
|
7
|
-
const put = (prop, v) => {
|
|
8
|
-
if (!original.has(prop)) original.set(prop, el.style.getPropertyValue(prop));
|
|
9
|
-
if (v || v === 0) el.style.setProperty(prop, String(v));
|
|
10
|
-
else el.style.setProperty(prop, original.get(prop));
|
|
11
|
-
};
|
|
12
|
-
effect(() => {
|
|
13
|
-
const map = key ? { [cased("kebab")]: evaluate() } : evaluate();
|
|
14
|
-
for (const prop of original.keys()) if (!(prop in map)) put(prop, "");
|
|
15
|
-
for (const prop in map) put(kebab(prop), map[prop]);
|
|
16
|
-
});
|
|
17
|
-
return () => {
|
|
18
|
-
for (const [prop, v] of original) el.style.setProperty(prop, v);
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
export {
|
|
23
|
-
style
|
|
24
|
-
};
|
|
25
|
-
//# sourceMappingURL=style.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/plugins/attributes/style.ts"],
|
|
4
|
-
"sourcesContent": ["import { attribute, kebab } from '../../core/index.js'\n\n/** `style:color=\"expr\"` or `style=\"{ color: expr }\"`. Falsy values (except 0) restore the original. */\nexport const style = attribute({\n name: 'style',\n value: 'required',\n mount({ el, key, cased, evaluate, effect }) {\n const original = new Map<string, string>()\n const put = (prop: string, v: unknown) => {\n if (!original.has(prop)) original.set(prop, el.style.getPropertyValue(prop))\n if (v || v === 0) el.style.setProperty(prop, String(v))\n else el.style.setProperty(prop, original.get(prop)!)\n }\n effect(() => {\n const map: Record<string, unknown> = key ? { [cased('kebab')]: evaluate() } : evaluate()\n for (const prop of original.keys()) if (!(prop in map)) put(prop, '')\n for (const prop in map) put(kebab(prop), map[prop])\n })\n return () => {\n for (const [prop, v] of original) el.style.setProperty(prop, v)\n }\n },\n})\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,WAAW,aAAa;AAG1B,MAAM,QAAQ,UAAU;AAAA,EAC7B,MAAM;AAAA,EACN,OAAO;AAAA,EACP,MAAM,EAAE,IAAI,KAAK,OAAO,UAAU,OAAO,GAAG;AAC1C,UAAM,WAAW,oBAAI,IAAoB;AACzC,UAAM,MAAM,CAAC,MAAc,MAAe;AACxC,UAAI,CAAC,SAAS,IAAI,IAAI,EAAG,UAAS,IAAI,MAAM,GAAG,MAAM,iBAAiB,IAAI,CAAC;AAC3E,UAAI,KAAK,MAAM,EAAG,IAAG,MAAM,YAAY,MAAM,OAAO,CAAC,CAAC;AAAA,UACjD,IAAG,MAAM,YAAY,MAAM,SAAS,IAAI,IAAI,CAAE;AAAA,IACrD;AACA,WAAO,MAAM;AACX,YAAM,MAA+B,MAAM,EAAE,CAAC,MAAM,OAAO,CAAC,GAAG,SAAS,EAAE,IAAI,SAAS;AACvF,iBAAW,QAAQ,SAAS,KAAK,EAAG,KAAI,EAAE,QAAQ,KAAM,KAAI,MAAM,EAAE;AACpE,iBAAW,QAAQ,IAAK,KAAI,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC;AAAA,IACpD,CAAC;AACD,WAAO,MAAM;AACX,iBAAW,CAAC,MAAM,CAAC,KAAK,SAAU,IAAG,MAAM,YAAY,MAAM,CAAC;AAAA,IAChE;AAAA,EACF;AACF,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const text: import("../../core/types.js").AttributePlugin;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { attribute } from "../../core/index.js";
|
|
2
|
-
const text = attribute({
|
|
3
|
-
name: "text",
|
|
4
|
-
key: "forbidden",
|
|
5
|
-
value: "required",
|
|
6
|
-
mount: ({ el, evaluate, effect }) => effect(() => {
|
|
7
|
-
el.textContent = String(evaluate() ?? "");
|
|
8
|
-
})
|
|
9
|
-
});
|
|
10
|
-
export {
|
|
11
|
-
text
|
|
12
|
-
};
|
|
13
|
-
//# sourceMappingURL=text.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/plugins/attributes/text.ts"],
|
|
4
|
-
"sourcesContent": ["import { attribute } from '../../core/index.js'\n\nexport const text = attribute({\n name: 'text',\n key: 'forbidden',\n value: 'required',\n mount: ({ el, evaluate, effect }) =>\n effect(() => {\n el.textContent = String(evaluate() ?? '')\n }),\n})\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,iBAAiB;AAEnB,MAAM,OAAO,UAAU;AAAA,EAC5B,MAAM;AAAA,EACN,KAAK;AAAA,EACL,OAAO;AAAA,EACP,OAAO,CAAC,EAAE,IAAI,UAAU,OAAO,MAC7B,OAAO,MAAM;AACX,OAAG,cAAc,OAAO,SAAS,KAAK,EAAE;AAAA,EAC1C,CAAC;AACL,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const viewTransition: import("../../core/types.js").AttributePlugin;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { attribute } from "../../core/index.js";
|
|
2
|
-
const viewTransition = attribute({
|
|
3
|
-
name: "view-transition",
|
|
4
|
-
key: "forbidden",
|
|
5
|
-
value: "required",
|
|
6
|
-
mount: ({ el, evaluate, effect }) => effect(() => el.style.setProperty("view-transition-name", String(evaluate())))
|
|
7
|
-
});
|
|
8
|
-
export {
|
|
9
|
-
viewTransition
|
|
10
|
-
};
|
|
11
|
-
//# sourceMappingURL=viewTransition.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/plugins/attributes/viewTransition.ts"],
|
|
4
|
-
"sourcesContent": ["import { attribute } from '../../core/index.js'\n\nexport const viewTransition = attribute({\n name: 'view-transition',\n key: 'forbidden',\n value: 'required',\n mount: ({ el, evaluate, effect }) => effect(() => el.style.setProperty('view-transition-name', String(evaluate()))),\n})\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,iBAAiB;AAEnB,MAAM,iBAAiB,UAAU;AAAA,EACtC,MAAM;AAAA,EACN,KAAK;AAAA,EACL,OAAO;AAAA,EACP,OAAO,CAAC,EAAE,IAAI,UAAU,OAAO,MAAM,OAAO,MAAM,GAAG,MAAM,YAAY,wBAAwB,OAAO,SAAS,CAAC,CAAC,CAAC;AACpH,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const viewTransition: import("../../kernel/contracts.js").AttributePlugin;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { attribute } from "../../kernel/index.js";
|
|
2
|
-
const viewTransition = attribute({
|
|
3
|
-
name: "view-transition",
|
|
4
|
-
key: "forbidden",
|
|
5
|
-
value: "required",
|
|
6
|
-
mount: ({ el, evaluate, effect }) => effect(() => el.style.setProperty("view-transition-name", String(evaluate())))
|
|
7
|
-
});
|
|
8
|
-
export {
|
|
9
|
-
viewTransition
|
|
10
|
-
};
|
|
11
|
-
//# sourceMappingURL=transition-name.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/plugins/directives/transition-name.ts"],
|
|
4
|
-
"sourcesContent": ["import { attribute } from '../../kernel/index.js'\n\nexport const viewTransition = attribute({\n name: 'view-transition',\n key: 'forbidden',\n value: 'required',\n mount: ({ el, evaluate, effect }) => effect(() => el.style.setProperty('view-transition-name', String(evaluate()))),\n})\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,iBAAiB;AAEnB,MAAM,iBAAiB,UAAU;AAAA,EACtC,MAAM;AAAA,EACN,KAAK;AAAA,EACL,OAAO;AAAA,EACP,OAAO,CAAC,EAAE,IAAI,UAAU,OAAO,MAAM,OAAO,MAAM,GAAG,MAAM,YAAY,wBAAwB,OAAO,SAAS,CAAC,CAAC,CAAC;AACpH,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Keeps keyboard focus inside the element while the expression is true and restores the previously
|
|
3
|
-
* focused element when it turns false: `trap="$open"`. `__inert` also makes the rest of the page inert.
|
|
4
|
-
*/
|
|
5
|
-
export declare const trap: import("../../kernel/contracts.js").AttributePlugin;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { attribute } from "../../kernel/index.js";
|
|
2
|
-
const FOCUSABLE = 'a[href],button:not([disabled]),input:not([disabled]):not([type=hidden]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"]),[contenteditable]';
|
|
3
|
-
const trap = attribute({
|
|
4
|
-
name: "trap",
|
|
5
|
-
key: "forbidden",
|
|
6
|
-
value: "required",
|
|
7
|
-
mount({ el, mods, evaluate, effect, listen, cleanup }) {
|
|
8
|
-
let previous = null;
|
|
9
|
-
let active = false;
|
|
10
|
-
const inerted = [];
|
|
11
|
-
const focusables = () => [...el.querySelectorAll(FOCUSABLE)].filter((e) => e.offsetParent !== null || e === document.activeElement);
|
|
12
|
-
const release = () => {
|
|
13
|
-
if (!active) return;
|
|
14
|
-
active = false;
|
|
15
|
-
for (const e of inerted.splice(0)) e.removeAttribute("inert");
|
|
16
|
-
previous?.focus?.();
|
|
17
|
-
};
|
|
18
|
-
listen(document, "keydown", (e) => {
|
|
19
|
-
if (!active || e.key !== "Tab") return;
|
|
20
|
-
const items = focusables();
|
|
21
|
-
if (!items.length) return e.preventDefault();
|
|
22
|
-
const i = items.indexOf(document.activeElement);
|
|
23
|
-
const next = e.shiftKey ? i <= 0 ? items.length - 1 : i - 1 : i === items.length - 1 ? 0 : i + 1;
|
|
24
|
-
if (i < 0 || next !== i + (e.shiftKey ? -1 : 1)) {
|
|
25
|
-
e.preventDefault();
|
|
26
|
-
items[next].focus();
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
effect(() => {
|
|
30
|
-
if (evaluate()) {
|
|
31
|
-
if (active) return;
|
|
32
|
-
active = true;
|
|
33
|
-
previous = document.activeElement;
|
|
34
|
-
if (mods.has("inert")) {
|
|
35
|
-
for (let n = el; n && n !== document.body; n = n.parentElement) {
|
|
36
|
-
for (const sib of n.parentElement?.children ?? []) if (sib !== n && !sib.hasAttribute("inert")) sib.setAttribute("inert", ""), inerted.push(sib);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
queueMicrotask(() => (focusables()[0] ?? el).focus?.());
|
|
40
|
-
} else release();
|
|
41
|
-
});
|
|
42
|
-
cleanup(release);
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
export {
|
|
46
|
-
trap
|
|
47
|
-
};
|
|
48
|
-
//# sourceMappingURL=trap.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/plugins/directives/trap.ts"],
|
|
4
|
-
"sourcesContent": ["import { attribute } from '../../kernel/index.js'\n\nconst FOCUSABLE = 'a[href],button:not([disabled]),input:not([disabled]):not([type=hidden]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex=\"-1\"]),[contenteditable]'\n\n/**\n * Keeps keyboard focus inside the element while the expression is true and restores the previously\n * focused element when it turns false: `trap=\"$open\"`. `__inert` also makes the rest of the page inert.\n */\nexport const trap = attribute({\n name: 'trap',\n key: 'forbidden',\n value: 'required',\n mount({ el, mods, evaluate, effect, listen, cleanup }) {\n let previous: Element | null = null\n let active = false\n const inerted: Element[] = []\n const focusables = () => [...el.querySelectorAll<HTMLElement>(FOCUSABLE)].filter((e) => e.offsetParent !== null || e === document.activeElement)\n const release = () => {\n if (!active) return\n active = false\n for (const e of inerted.splice(0)) e.removeAttribute('inert')\n ;(previous as HTMLElement | null)?.focus?.()\n }\n listen(document, 'keydown', (e: KeyboardEvent) => {\n if (!active || e.key !== 'Tab') return\n const items = focusables()\n if (!items.length) return e.preventDefault()\n const i = items.indexOf(document.activeElement as HTMLElement)\n const next = e.shiftKey ? (i <= 0 ? items.length - 1 : i - 1) : i === items.length - 1 ? 0 : i + 1\n if (i < 0 || next !== i + (e.shiftKey ? -1 : 1)) {\n e.preventDefault()\n items[next].focus()\n }\n })\n effect(() => {\n if (evaluate()) {\n if (active) return\n active = true\n previous = document.activeElement\n if (mods.has('inert')) {\n for (let n: Element | null = el; n && n !== document.body; n = n.parentElement) {\n for (const sib of n.parentElement?.children ?? []) if (sib !== n && !sib.hasAttribute('inert')) (sib.setAttribute('inert', ''), inerted.push(sib))\n }\n }\n queueMicrotask(() => (focusables()[0] ?? (el as HTMLElement)).focus?.())\n } else release()\n })\n cleanup(release)\n },\n})\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,iBAAiB;AAE1B,MAAM,YAAY;AAMX,MAAM,OAAO,UAAU;AAAA,EAC5B,MAAM;AAAA,EACN,KAAK;AAAA,EACL,OAAO;AAAA,EACP,MAAM,EAAE,IAAI,MAAM,UAAU,QAAQ,QAAQ,QAAQ,GAAG;AACrD,QAAI,WAA2B;AAC/B,QAAI,SAAS;AACb,UAAM,UAAqB,CAAC;AAC5B,UAAM,aAAa,MAAM,CAAC,GAAG,GAAG,iBAA8B,SAAS,CAAC,EAAE,OAAO,CAAC,MAAM,EAAE,iBAAiB,QAAQ,MAAM,SAAS,aAAa;AAC/I,UAAM,UAAU,MAAM;AACpB,UAAI,CAAC,OAAQ;AACb,eAAS;AACT,iBAAW,KAAK,QAAQ,OAAO,CAAC,EAAG,GAAE,gBAAgB,OAAO;AAC3D,MAAC,UAAiC,QAAQ;AAAA,IAC7C;AACA,WAAO,UAAU,WAAW,CAAC,MAAqB;AAChD,UAAI,CAAC,UAAU,EAAE,QAAQ,MAAO;AAChC,YAAM,QAAQ,WAAW;AACzB,UAAI,CAAC,MAAM,OAAQ,QAAO,EAAE,eAAe;AAC3C,YAAM,IAAI,MAAM,QAAQ,SAAS,aAA4B;AAC7D,YAAM,OAAO,EAAE,WAAY,KAAK,IAAI,MAAM,SAAS,IAAI,IAAI,IAAK,MAAM,MAAM,SAAS,IAAI,IAAI,IAAI;AACjG,UAAI,IAAI,KAAK,SAAS,KAAK,EAAE,WAAW,KAAK,IAAI;AAC/C,UAAE,eAAe;AACjB,cAAM,IAAI,EAAE,MAAM;AAAA,MACpB;AAAA,IACF,CAAC;AACD,WAAO,MAAM;AACX,UAAI,SAAS,GAAG;AACd,YAAI,OAAQ;AACZ,iBAAS;AACT,mBAAW,SAAS;AACpB,YAAI,KAAK,IAAI,OAAO,GAAG;AACrB,mBAAS,IAAoB,IAAI,KAAK,MAAM,SAAS,MAAM,IAAI,EAAE,eAAe;AAC9E,uBAAW,OAAO,EAAE,eAAe,YAAY,CAAC,EAAG,KAAI,QAAQ,KAAK,CAAC,IAAI,aAAa,OAAO,EAAG,CAAC,IAAI,aAAa,SAAS,EAAE,GAAG,QAAQ,KAAK,GAAG;AAAA,UAClJ;AAAA,QACF;AACA,uBAAe,OAAO,WAAW,EAAE,CAAC,KAAM,IAAoB,QAAQ,CAAC;AAAA,MACzE,MAAO,SAAQ;AAAA,IACjB,CAAC;AACD,YAAQ,OAAO;AAAA,EACjB;AACF,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/dist/sigmx.auto.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
var Ae=Object.defineProperty;var Re=(t,e)=>{for(var n in e)Ae(t,n,{get:e[n],enumerable:!0})};var Pt=(t,e)=>Function(...t,e),Tt=new Map,Me=t=>/[A-Za-z0-9_$]/.test(t),Et=(t,e)=>{let n=0,r=t.length;for(;n<r;){let o=t[n],i=t[n+1];if(o==='"'||o==="'"||o==="`"){let s=n+1;for(;s<r&&t[s]!==o;)s+=t[s]==="\\"?2:1;e(t.slice(n,s+1),n),n=s+1}else if(o==="/"&&i==="/"){let s=t.indexOf(`
|
|
2
|
-
`,n);n=s<0?r:s}else if(o==="/"&&i==="*"){let s=t.indexOf("*/",n+2);n=s<0?r:s+2}else{let s=e(o,n);n+=s||1}}},je=t=>{let e="";return Et(t,(n,r)=>{if(n==="@"){let o=r+1;for(;o<t.length&&Me(t[o]);)o++;let i=o;for(;i<t.length&&/\s/.test(t[i]);)i++;if(o>r+1&&t[i]==="(")return e+=`__a.${t.slice(r+1,o)}(`,i+1-r}e+=n}),e},$e=t=>{let e=[],n=0,r=0;return Et(t,(o,i)=>{o.length>1||("([{".includes(o)?n++:")]}".includes(o)?n--:o===";"&&!n&&(e.push(t.slice(r,i)),r=i+1))}),e.push(t.slice(r)),e.filter(o=>o.trim())},At=(t,e,n,r)=>{let o=`${+r}|${n.join()}|${e}`,i=Tt.get(o);if(i)return i;let s=je(e.trim()),f=g=>t(["$","__a",...n],`with($){${g}
|
|
3
|
-
}`),l;if(!r)l=f(s);else try{l=f(`return(${s}
|
|
4
|
-
)`)}catch{let g=$e(s),w=g.pop()??"";try{l=f(`${g.join(";")};return(${w}
|
|
5
|
-
)`)}catch{l=f(s)}}return Tt.set(o,l),l};var I,tt,U=0,ft=!1,Y=new Set,pt=new Set,D=class{constructor(e){this.o=0;this.i=new Set;this.t=e}get value(){return I&&(I.e.set(this,this.o),this.i.add(I)),this.t}set value(e){Object.is(e,this.t)||(this.t=e,this.bump())}peek(){return this.t}bump(){this.o++;for(let e of[...this.i])e.a();U||nt()}},Rt=t=>{for(let e of t.e.keys())e.i.delete(t);t.e.clear()},Mt=t=>{for(let[e,n]of t.e)if(e instanceof L&&e.c(),e.o!==n)return!0;return!1},jt=(t,e)=>{Rt(t);let n=I;I=t;try{return e()}finally{I=n}},L=class extends D{constructor(n){super(void 0);this.e=new Map;this.s=!0;this.n=n}c(){if(!this.s||(this.s=!1,this.e.size&&!Mt(this)))return;let n=jt(this,this.n);Object.is(n,this.t)||(this.t=n,this.o++)}get value(){return this.c(),super.value}set value(n){throw new Error("computed signals are read-only")}peek(){return this.c(),this.t}a(){if(!this.s){this.s=!0;for(let n of this.i)n.a()}}},dt=class{constructor(e,n){this.e=new Map;this.l=!1;this.u=!1;this.r=new Set;this.n=e,this.f=n}a(){!this.u&&!this.l&&(this.l=!0,Y.add(this))}d(){if(this.l=!1,this.u||this.e.size&&!Mt(this))return;for(let n of this.r)n.p();this.r.clear();let e=tt;tt=this,U++;try{jt(this,this.n)}catch(n){if(!this.f)throw n;this.f(n)}finally{U--,tt=e}}p(){this.u=!0,Rt(this);for(let e of this.r)e.p();this.r.clear(),Y.delete(this)}};var et=t=>new L(t),mt=(t,e)=>{let n=new dt(t,e);return tt?.r.add(n),n.d(),U||nt(),()=>n.p()},C=t=>{U++;try{return t()}finally{--U||nt()}},J=t=>{let e=I;I=void 0;try{return t()}finally{I=e}},gt=t=>(pt.add(t),()=>pt.delete(t)),nt=()=>{if(!(ft||U)){ft=!0;try{let t=0;for(;Y.size;){if(++t>1e5)throw new Error("effect loop: a signal is written by an effect that reads it");let e=Y.values().next().value;Y.delete(e),e.d()}}finally{ft=!1}for(let t of pt)t()}};var B=t=>{if(t===null||typeof t!="object")return!1;let e=Object.getPrototypeOf(t);return e===Object.prototype||e===null},_=(t,e,n)=>{let r=e.split("."),o=r.pop(),i=t;for(let s of r)i=B(i[s])?i[s]:i[s]={};return i[o]=n,t},$t=(t,e)=>t===void 0?e:typeof t=="string"?new RegExp(t.replace(/^\/|\/$/g,"")):t,rt=t=>{if(typeof t=="function")return t;let e=$t(t?.include,/(?:)/),n=$t(t?.exclude,/(?!)/);return r=>e.test(r)&&!n.test(r)};var ot=t=>t.slice(0,Math.max(0,t.lastIndexOf("."))),it=t=>t.slice(t.lastIndexOf(".")+1),V=(t,e)=>t?`${t}.${e}`:e,Ot=(t,e)=>!e||t===e||t.startsWith(`${e}.`),Ft=()=>{let t=new Map,e=new Map([["",new Set]]),n=new D(0),r=new Map,o=new Set,i=new Map,s=new WeakMap,f=a=>{let u=e.get(a);return u||(t.has(a)&&l(a),e.set(a,u=new Set),f(ot(a)).add(it(a)),n.bump()),u},l=a=>{let u=t.get(a);u&&(t.delete(a),e.get(ot(a))?.delete(it(a)),r.set(a,null),u.bump(),n.bump())},g=a=>{let u=e.get(a);if(u){for(let x of[...u])w(V(a,x));a&&(e.delete(a),e.get(ot(a))?.delete(it(a)),i.delete(a)),n.bump()}},w=a=>C(()=>{l(a),g(a)}),b=(a,u)=>C(()=>{e.has(a)&&g(a);let x=t.get(a);t.set(a,u),f(ot(a)).add(it(a)),x?.bump(),n.bump()}),R=(a,u)=>C(()=>{if(u==null)return w(a);if(B(u)){let S=f(a);for(let m of[...S])m in u||w(V(a,m));for(let m in u)R(V(a,m),u[m]);return}e.has(a)&&g(a);let x=t.get(a);if(x instanceof L)throw new Error(`"${a}" is a computed signal and cannot be assigned`);if(x){if(Object.is(x.peek(),u))return;x.value=u}else b(a,new D(u));r.set(a,u)}),j=(a,{at:u="",ifMissing:x=!1}={})=>C(()=>{if(B(a)){f(u);for(let S in a){let m=V(u,S),E=a[S];E===null?x||w(m):B(E)?j(E,{at:m,ifMissing:x}):!(x&&(t.has(m)||e.has(m)))&&!(t.get(m)instanceof L)&&R(m,E)}}}),h=(a,u,x)=>{let S=s.get(a);if(!S){let m=()=>{r.set(x,a),u.bump()};S=new Proxy(a,{set:(E,c,d)=>(E[c]=d,m(),!0),deleteProperty:(E,c)=>(delete E[c],m(),!0)}),s.set(a,S)}return S},v=a=>{let u=t.get(a);if(u){let x=u.value;return Array.isArray(x)?h(x,u,a):x}if(e.has(a))return P(a);n.value},P=a=>{let u=i.get(a);if(!u){let x=()=>(n.value,e.get(a));u=new Proxy(Object.create(null),{get:(S,m)=>typeof m!="string"?void 0:m==="toJSON"?()=>K(void 0,{at:a}):v(V(a,m)),set:(S,m,E)=>(typeof m=="string"&&R(V(a,m),E),!0),deleteProperty:(S,m)=>(typeof m=="string"&&w(V(a,m)),!0),has:(S,m)=>typeof m=="string"&&!!x()?.has(m),ownKeys:()=>[...x()??[]],getOwnPropertyDescriptor:(S,m)=>typeof m=="string"&&x()?.has(m)?{enumerable:!0,configurable:!0,writable:!0,value:v(V(a,m))}:void 0}),i.set(a,u)}return u},q=new Proxy(Object.create(null),{has:(a,u)=>typeof u=="string"&&u[0]==="$",get:(a,u)=>typeof u!="string"?void 0:u==="$"?P(""):v(u.slice(1)),set:(a,u,x)=>(typeof u=="string"&&(u==="$"?j(x):R(u.slice(1),x)),!0)}),M=a=>{n.value;let u=rt(a);return[...t.keys()].filter(u)},K=(a,{at:u="",computed:x=!0}={})=>{n.value;let S=rt(a),m={},E=c=>u?c.slice(u.length+1):c;for(let[c,d]of t)!Ot(c,u)||!S(c)||!x&&d instanceof L||_(m,E(c),d.value);for(let c of e.keys())c&&c!==u&&Ot(c,u)&&S(c)&&!e.get(c).size&&_(m,E(c),{});return m};return gt(()=>{if(!r.size)return;let a={};for(let[u,x]of r)_(a,u,x);r.clear();for(let u of o)u(a)}),{get:v,set:R,merge:j,remove:w,has:a=>t.has(a)||e.has(a),define:b,paths:M,snapshot:K,onPatch:a=>(o.add(a),()=>o.delete(a)),get $(){return P("")},scope:q}};var st=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").split(/[^A-Za-z0-9]+|\s+/).filter(Boolean).map(e=>e.toLowerCase()),qt=t=>t[0].toUpperCase()+t.slice(1),at=t=>st(t).join("-"),Ct=t=>st(t).join("_"),It=t=>st(t).map((e,n)=>n?qt(e):e).join(""),Lt=t=>st(t).map(qt).join(""),ht=(t,e)=>t.split(".").map(n=>({camel:It,kebab:at,snake:Ct,pascal:Lt})[e](n)).join(".");var ct=t=>t instanceof HTMLElement||t instanceof SVGElement||t instanceof MathMLElement,_t=new Map,Nt=t=>{let e=_t.get(t);if(!e){let[n,...r]=t.split("__"),o=n.indexOf(":"),i=new Map;for(let s of r){let[f,...l]=s.split(".");i.set(f,l)}e={plugin:o<0?n:n.slice(0,o),key:o<0?void 0:n.slice(o+1),mods:i},_t.set(t,e)}return e},Oe=(t,e)=>Object.assign(new Error(t),{info:e}),yt=(t={})=>{let e=[].concat(t.prefix??"data-"),n=t.store??Ft(),r=t.compile??Pt,o=t.onError??((c,d)=>console.error(c,d)),i=Object.create(null),s=Object.create(null),f=Object.create(null),l={prefixes:e,attr:c=>e[0]+c,store:n,compiler:r,emit:(c,d)=>document.dispatchEvent(new CustomEvent(`sigmx-${c}`,{detail:d})),call:(c,d,y)=>{let T=s[c];if(!T)throw d.error(`unknown action @${c}`);return T.call(d,...y)},attributes:i,actions:s,handlers:f},g=new Map,w=new Set,b=e.map(c=>`[${c}ignore__self]`).join(),R=e.map(c=>`[${c}ignore]`).join(),j=c=>c.matches(b)||!!c.closest(R),h=c=>{for(let d of e)if(c.startsWith(d))return c.slice(d.length)},v=c=>{for(let d of c){let y=g.get(d);if(y&&g.delete(d))for(let T of y.values())T()}},P=(c,d)=>{let y=g.get(c);y?.get(d)?.(),y?.delete(d)},q=(c,d,y)=>{let T={el:c,evt:d,store:n,runtime:l,error:y};return new Proxy(Object.create(null),{get:(H,O)=>(...A)=>l.call(O,T,A)})},M=(c,d,y,T,H)=>{let{plugin:O,key:A,mods:Q}=Nt(y),z=i[O];if(!z||H&&!H.has(O))return;P(c,d);let X=[],vt={plugin:O,el:c,attr:d},W=(k,Z)=>Oe(`${e[0]}${O}: ${k}`,{...vt,...Z}),lt=k=>o(k,vt),wt,Se={el:c,plugin:O,attr:d,key:A,value:T,mods:Q,cased:(k="camel")=>ht(A??"",Q.get("case")?.[0]||k),evaluate:(k,...Z)=>(wt??=At(r,T,["el","evt",...z.args??[]],z.returns??!0),wt(n.scope,q(c,k,W),c,k,...Z)),effect:k=>X.push(mt(k,lt)),listen:(k,Z,Te,kt)=>{let St=Pe=>{try{Te(Pe)}catch(Ee){lt(Ee)}};k.addEventListener(Z,St,kt),X.push(()=>k.removeEventListener(Z,St,kt))},cleanup:k=>X.push(k),error:W,store:n,runtime:l},ut=g.get(c);ut||g.set(c,ut=new Map),ut.set(d,()=>{for(let k of X.splice(0))k()});try{if(z.key==="required"&&!A)throw W("needs a key, e.g. :name");if(z.key==="forbidden"&&A)throw W("does not take a key");if(z.value==="required"&&!T)throw W("needs a value");if(z.value==="forbidden"&&T)throw W("does not take a value");let k=z.mount(Se);typeof k=="function"&&X.push(k)}catch(k){lt(k)}},K=(c,d)=>{for(let y of c)if(!j(y))for(let{name:T,value:H}of[...y.attributes]){let O=h(T);O&&M(y,T,O,H,d)}},a=new MutationObserver(c=>{for(let{type:d,target:y,attributeName:T,addedNodes:H,removedNodes:O}of c)if(d==="childList"){for(let A of O)ct(A)&&v([A,...A.querySelectorAll("*")]);for(let A of H)ct(A)&&K([A,...A.querySelectorAll("*")])}else if(T&&ct(y)&&!j(y)){let A=h(T);if(!A)continue;let Q=y.getAttribute(T);Q===null?P(y,T):M(y,T,A,Q)}}),u=!1,x=(c=document.documentElement,d=!0,y)=>{K([...ct(c)?[c]:[],...c.querySelectorAll("*")],y),d&&!w.has(c)&&(a.observe(c,{subtree:!0,childList:!0,attributes:!0}),w.add(c)),!u&&w.has(document.documentElement)&&(u=!0,l.emit("ready"))},S=(...c)=>{let d=new Set;for(let y of c)y.type==="attribute"?(i[y.name]=y,d.add(y.name)):y.type==="action"?s[y.name]=y:f[y.name]=y;if(d.size)for(let y of w)x(y,!1,d)},m=n.onPatch(c=>l.emit("signal-patch",c));S(...t.plugins??[]);let E={runtime:l,store:n,get $(){return n.$},apply:(c,d)=>x(c,d),use:S,destroy:()=>{a.disconnect(),m(),v([...g.keys()]),w.clear()}};return(t.autoStart??!0)&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>E.apply(),{once:!0}):E.apply()),E};var G=(t,e=0)=>{for(let n of t??[]){let r=/^(\d+(?:\.\d+)?)(ms|s)?$/.exec(n);if(r)return+r[1]*(r[2]==="s"?1e3:1)}return e},zt=(t,e)=>(...n)=>{setTimeout(t,e,...n)},Vt=(t,e,n=!1,r=!0)=>{let o,i;return(...s)=>{o?clearTimeout(o):n&&t(...s),i=s,o=setTimeout(()=>{o=void 0,r&&i&&t(...i),i=void 0},e)}},Ht=(t,e,n=!0,r=!1)=>{let o,i;return(...s)=>{if(o){i=s;return}n?t(...s):i=s,o=setTimeout(()=>{o=void 0,r&&i&&t(...i),i=void 0},e)}},$=(t,e)=>{let n=e.get("delay");n&&(t=zt(t,G(n)));let r=e.get("debounce");r&&(t=Vt(t,G(r,300),r.includes("leading"),!r.includes("notrailing")));let o=e.get("throttle");return o&&(t=Ht(t,G(o,300),!o.includes("noleading"),o.includes("trailing"))),t},N=(t,e)=>e.has("viewtransition")&&"startViewTransition"in document?(...n)=>{document.startViewTransition(()=>t(...n))}:t;var p=t=>({type:"attribute",...t}),F=t=>({type:"action",...t});var bt={};Re(bt,{attr:()=>Dt,bind:()=>Jt,className:()=>Wt,clipboard:()=>he,computed:()=>Zt,customValidity:()=>Bt,effect:()=>Gt,fit:()=>ye,indicator:()=>Kt,init:()=>Qt,intl:()=>xe,jsonSignals:()=>Xt,matchMedia:()=>Yt,on:()=>te,onIntersect:()=>ee,onInterval:()=>ne,onRaf:()=>re,onResize:()=>oe,onSignalPatch:()=>ie,peek:()=>be,persist:()=>se,queryString:()=>ae,ref:()=>ce,replaceUrl:()=>le,scrollIntoView:()=>ue,setAll:()=>ve,show:()=>fe,signals:()=>pe,style:()=>de,text:()=>me,toggleAll:()=>we,viewTransition:()=>ge});var Ut=(t,e,n)=>{n===!1||n==null?t.removeAttribute(e):t.setAttribute(e,n===!0?"":typeof n=="object"?JSON.stringify(n):String(n))},Dt=p({name:"attr",value:"required",mount({el:t,key:e,cased:n,evaluate:r,effect:o}){o(()=>{if(e)return Ut(t,n("kebab"),r());let i=r();for(let s in i)Ut(t,s,i[s])})}});var Fe=t=>Promise.all([...t.files??[]].map(e=>new Promise(n=>{let r=new FileReader;r.onloadend=()=>n({name:e.name,type:e.type,size:e.size,contents:String(r.result).split(",")[1]??""}),r.readAsDataURL(e)}))),Jt=p({name:"bind",mount({el:t,key:e,value:n,cased:r,mods:o,store:i,listen:s,effect:f}){let l=e?r():n.trim(),g=()=>i.get(l),w=h=>typeof g()=="number"?+h:h,b,R=o.get("prop")?.[0];if(R)b={read:()=>t[R],write:h=>t[R]=h,events:["input","change"]};else if(t instanceof HTMLInputElement){let h=t.type;if(h==="checkbox"){let v=t.hasAttribute("value")&&t.value!=="on";b={read:()=>{let P=g();if(Array.isArray(P)){let q=new Set(P);return t.checked?q.add(t.value):q.delete(t.value),[...q]}return v?t.checked?t.value:"":t.checked},write:P=>{t.checked=Array.isArray(P)?P.includes(t.value):v?P===t.value:!!P},events:["input"]}}else if(h==="radio")t.name||(t.name=l),b={read:()=>t.checked?w(t.value):g(),write:v=>t.checked=String(v)===t.value,events:["input"]};else if(h==="file"){s(t,"change",()=>Fe(t).then(v=>i.set(l,v)));return}else h==="number"||h==="range"?b={read:()=>t.value===""?"":+t.value,write:v=>t.value=String(v??""),events:["input"]}:b={read:()=>t.value,write:v=>t.value=String(v??""),events:["input"]}}else t instanceof HTMLSelectElement?b={read:()=>t.multiple?[...t.selectedOptions].map(h=>w(h.value)):w(t.value),write:h=>{if(t.multiple)for(let v of t.options)v.selected=Array.isArray(h)&&h.map(String).includes(v.value);else t.value=String(h??"")},events:["change"]}:t instanceof HTMLTextAreaElement||"value"in t?b={read:()=>t.value,write:h=>t.value=String(h??""),events:["input","change"]}:b={read:()=>t.getAttribute("value"),write:h=>t.setAttribute("value",String(h??"")),events:["change"]};if(!i.has(l)){let h=b.read();h!==void 0&&h!==""&&i.set(l,h)}let j=()=>i.set(l,b.read());for(let h of o.get("event")??b.events)s(t,h,j);s(t,"sigmx-prop-change",j),f(()=>{let h=g();h!==void 0&&b.write(h)})}});var Wt=p({name:"class",value:"required",mount({el:t,key:e,cased:n,evaluate:r,effect:o}){let i=new Set;return o(()=>{let s=e?{[n("kebab")]:r()}:r();for(let f in s)for(let l of f.split(/\s+/).filter(Boolean))t.classList.toggle(l,!!s[f]),s[f]?i.add(l):i.delete(l)}),()=>t.classList.remove(...i)}});var Zt=p({name:"computed",value:"required",mount({key:t,cased:e,evaluate:n,store:r,error:o}){if(t){r.define(e(),et(()=>n()));return}let i=n();for(let s in i){if(typeof i[s]!="function")throw o(`"${s}" must be a function`);r.define(s,et(i[s]))}}});var Bt=p({name:"custom-validity",key:"forbidden",value:"required",mount({el:t,evaluate:e,effect:n,error:r}){if(!("setCustomValidity"in t))throw r("only works on form fields");n(()=>t.setCustomValidity(String(e()??"")))}});var Gt=p({name:"effect",key:"forbidden",value:"required",returns:!1,mount:t=>t.effect(()=>t.evaluate())});var Kt=p({name:"indicator",mount({el:t,key:e,value:n,cased:r,store:o,listen:i}){let s=e?r():n.trim(),f=0;return o.set(s,!1),i(document,"sigmx-fetch",l=>{l.detail.el===t&&(l.detail.type==="started"?f++:l.detail.type==="finished"&&(f=Math.max(0,f-1)),o.set(s,f>0))}),()=>o.set(s,!1)}});var Qt=p({name:"init",key:"forbidden",value:"required",returns:!1,mount({mods:t,evaluate:e}){$(N(()=>e(),t),t)()}});var Xt=p({name:"json-signals",key:"forbidden",mount({el:t,value:e,mods:n,evaluate:r,effect:o,store:i}){let s=e?r():void 0;o(()=>{t.textContent=JSON.stringify(i.snapshot(s),null,n.has("terse")?0:2)})}});var Yt=p({name:"match-media",key:"required",value:"required",mount({cased:t,evaluate:e,store:n,listen:r}){let o=String(e()).trim();(!/^[(a-z]/.test(o)||!o.startsWith("(")&&o.includes(":")&&!/^(not|only|all|screen|print)\b/.test(o))&&(o=`(${o})`);let i=window.matchMedia(o),s=t(),f=()=>n.set(s,i.matches);f(),r(i,"change",f)}});var te=p({name:"on",key:"required",value:"required",returns:!1,mount({el:t,mods:e,cased:n,evaluate:r,listen:o}){let i=n("kebab"),s=e.has("outside"),f=e.has("window")?window:e.has("document")||s||i.startsWith("sigmx-")?document:t,l=$(N(g=>r(g),e),e);o(f,i,g=>{s&&t.contains(g.target)||((e.has("prevent")||i==="submit"&&t instanceof HTMLFormElement)&&g.preventDefault(),e.has("stop")&&g.stopPropagation(),l(g))},{capture:e.has("capture"),passive:e.has("passive"),once:e.has("once")})}});var ee=p({name:"on-intersect",key:"forbidden",value:"required",returns:!1,mount({el:t,mods:e,evaluate:n}){let r=e.get("threshold")?.[0],o=e.has("full")?1:e.has("half")?.5:r?Math.min(100,Math.max(0,+r))/100:0,i=$(N(()=>n(),e),e),s=new IntersectionObserver(f=>{for(let l of f)l.isIntersecting!==e.has("exit")&&(i(),e.has("once")&&s.disconnect())},{threshold:o});return s.observe(t),()=>s.disconnect()}});var ne=p({name:"on-interval",key:"forbidden",value:"required",returns:!1,mount({mods:t,evaluate:e}){let n=t.get("duration"),r=N(()=>e(),t);n?.includes("leading")&&r();let o=setInterval(r,G(n,1e3));return()=>clearInterval(o)}});var re=p({name:"on-raf",key:"forbidden",value:"required",returns:!1,mount({mods:t,evaluate:e}){let n=$(()=>e(),t),r=requestAnimationFrame(function o(){n(),r=requestAnimationFrame(o)});return()=>cancelAnimationFrame(r)}});var oe=p({name:"on-resize",key:"forbidden",value:"required",returns:!1,mount({el:t,mods:e,evaluate:n}){let r=$(()=>n(),e),o=new ResizeObserver(()=>r());return o.observe(t),()=>o.disconnect()}});var qe=(t,e)=>{let n=t;for(let r of e.split(".")){if(n==null||typeof n!="object"||!(r in n))return!1;n=n[r]}return!0},ie=p({name:"on-signal-patch",value:"required",returns:!1,args:["patch"],mount({key:t,cased:e,mods:n,evaluate:r,listen:o}){let i=t?e():"",s=!1,f=$(l=>{if(!s){s=!0;try{r(void 0,l)}finally{s=!1}}},n);o(document,"sigmx-signal-patch",l=>{(!i||qe(l.detail,i))&&f(l.detail)})}});var se=p({name:"persist",mount({key:t,value:e,mods:n,evaluate:r,store:o,effect:i}){let s=n.has("session")?sessionStorage:localStorage,f=t||"sigmx",l=e?r():void 0,g=s.getItem(f);g&&o.merge(JSON.parse(g)),i(()=>s.setItem(f,JSON.stringify(o.snapshot(l,{computed:!1}))))}});var Ce=t=>{try{return JSON.parse(t)}catch{return t}},ae=p({name:"query-string",key:"forbidden",mount({value:t,mods:e,evaluate:n,store:r,listen:o,effect:i}){let s=t?n():void 0,f=e.has("history"),l=()=>{let w={};for(let[b,R]of new URLSearchParams(location.search))_(w,b,Ce(R));r.merge(r.snapshot(s,{computed:!1})&&w)},g=!1;l(),i(()=>{let w=r.snapshot(s,{computed:!1});if(g)return;let b=new URLSearchParams(location.search),R=(h,v)=>{for(let P in h){let q=v?`${v}.${P}`:P,M=h[P];M&&typeof M=="object"&&!Array.isArray(M)?R(M,q):e.has("filter")&&(M===""||M==null)?b.delete(q):b.set(q,typeof M=="string"?M:JSON.stringify(M))}};R(w,"");let j=`${location.pathname}${b.size?`?${b}`:""}${location.hash}`;j!==location.pathname+location.search+location.hash&&(f?window.history.pushState(null,"",j):window.history.replaceState(null,"",j))}),f&&o(window,"popstate",()=>{g=!0;try{l()}finally{g=!1}})}});var ce=p({name:"ref",mount({el:t,key:e,value:n,cased:r,store:o}){let i=e?r():n.trim();return o.set(i,t),()=>o.remove(i)}});var le=p({name:"replace-url",key:"forbidden",value:"required",mount:({evaluate:t,effect:e})=>e(()=>history.replaceState(history.state,"",new URL(String(t()),location.href)))});var xt=(t,e,n)=>e.find(r=>t.has(r))??n,ue=p({name:"scroll-into-view",key:"forbidden",value:"forbidden",mount({el:t,mods:e}){t.scrollIntoView({behavior:xt(e,["smooth","instant","auto"],"smooth"),block:xt(e,["vstart","vcenter","vend","vnearest"],"vcenter").slice(1),inline:xt(e,["hstart","hcenter","hend","hnearest"],"hcenter").slice(1)}),e.has("focus")&&t.focus?.()}});var fe=p({name:"show",key:"forbidden",value:"required",mount({el:t,evaluate:e,effect:n}){let r=t.style.display==="none"?"":t.style.display;return n(()=>{t.style.display=e()?r:"none"}),()=>{t.style.display=r}}});var pe=p({name:"signals",value:"required",mount({key:t,cased:e,evaluate:n,store:r,mods:o}){let i=n();r.merge(t?_({},e(),i):i,{ifMissing:o.has("ifmissing")})}});var de=p({name:"style",value:"required",mount({el:t,key:e,cased:n,evaluate:r,effect:o}){let i=new Map,s=(f,l)=>{i.has(f)||i.set(f,t.style.getPropertyValue(f)),l||l===0?t.style.setProperty(f,String(l)):t.style.setProperty(f,i.get(f))};return o(()=>{let f=e?{[n("kebab")]:r()}:r();for(let l of i.keys())l in f||s(l,"");for(let l in f)s(at(l),f[l])}),()=>{for(let[f,l]of i)t.style.setProperty(f,l)}}});var me=p({name:"text",key:"forbidden",value:"required",mount:({el:t,evaluate:e,effect:n})=>n(()=>{t.textContent=String(e()??"")})});var ge=p({name:"view-transition",key:"forbidden",value:"required",mount:({el:t,evaluate:e,effect:n})=>n(()=>t.style.setProperty("view-transition-name",String(e())))});var he=F({name:"clipboard",call:(t,e,n=!1)=>navigator.clipboard.writeText(n?new TextDecoder().decode(Uint8Array.from(atob(e),r=>r.charCodeAt(0))):e)});var ye=F({name:"fit",call:(t,e,n,r,o,i,s=!1,f=!1)=>{let l=(e-n)/(r-n);s&&(l=Math.min(1,Math.max(0,l)));let g=o+l*(i-o);return f?Math.round(g):g}});var Ie={number:(t,e,n)=>new Intl.NumberFormat(t,n).format(e),datetime:(t,e,n)=>new Intl.DateTimeFormat(t,n).format(e),pluralRules:(t,e,n)=>new Intl.PluralRules(t,n).select(e),relativeTime:(t,e,n)=>new Intl.RelativeTimeFormat(t,n).format(e[0],e[1]),list:(t,e,n)=>new Intl.ListFormat(t,n).format(e),displayNames:(t,e,n)=>new Intl.DisplayNames(t,n).of(e)??""},xe=F({name:"intl",call:({error:t},e,n,r,o)=>{let i=Ie[e];if(!i)throw t(`unknown @intl type "${e}"`);return i(o,n,r)}});var be=F({name:"peek",call:(t,e)=>J(e)});var ve=F({name:"setAll",call:({store:t},e,n)=>C(()=>J(()=>{for(let r of t.paths(n))t.set(r,e)}))});var we=F({name:"toggleAll",call:({store:t},e)=>C(()=>J(()=>{for(let n of t.paths(e))t.set(n,!t.get(n))}))});var ke=Object.values(bt);var Kr=yt({plugins:ke});export{Kr as sigmx};
|
package/dist/utils/object.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export declare const isPlain: (v: unknown) => v is Record<string, any>;
|
|
2
|
-
/** Write `value` at a dotted path inside `out`, creating intermediate objects. */
|
|
3
|
-
export declare const expand: (out: Record<string, any>, path: string, value: any) => Record<string, any>;
|
|
4
|
-
export type Filter = {
|
|
5
|
-
include?: RegExp | string;
|
|
6
|
-
exclude?: RegExp | string;
|
|
7
|
-
} | ((path: string) => boolean);
|
|
8
|
-
/** Turn `{ include, exclude }` (regex or string) or a predicate into a path predicate. */
|
|
9
|
-
export declare const toPredicate: (f?: Filter) => ((path: string) => boolean);
|
package/dist/utils/object.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
const isPlain = (v) => {
|
|
2
|
-
if (v === null || typeof v !== "object") return false;
|
|
3
|
-
const proto = Object.getPrototypeOf(v);
|
|
4
|
-
return proto === Object.prototype || proto === null;
|
|
5
|
-
};
|
|
6
|
-
const expand = (out, path, value) => {
|
|
7
|
-
const keys = path.split(".");
|
|
8
|
-
const last = keys.pop();
|
|
9
|
-
let cur = out;
|
|
10
|
-
for (const k of keys) cur = isPlain(cur[k]) ? cur[k] : cur[k] = {};
|
|
11
|
-
cur[last] = value;
|
|
12
|
-
return out;
|
|
13
|
-
};
|
|
14
|
-
const re = (v, fallback) => v === void 0 ? fallback : typeof v === "string" ? new RegExp(v.replace(/^\/|\/$/g, "")) : v;
|
|
15
|
-
const toPredicate = (f) => {
|
|
16
|
-
if (typeof f === "function") return f;
|
|
17
|
-
const inc = re(f?.include, /(?:)/);
|
|
18
|
-
const exc = re(f?.exclude, /(?!)/);
|
|
19
|
-
return (p) => inc.test(p) && !exc.test(p);
|
|
20
|
-
};
|
|
21
|
-
export {
|
|
22
|
-
expand,
|
|
23
|
-
isPlain,
|
|
24
|
-
toPredicate
|
|
25
|
-
};
|
|
26
|
-
//# sourceMappingURL=object.js.map
|
package/dist/utils/object.js.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/utils/object.ts"],
|
|
4
|
-
"sourcesContent": ["export const isPlain = (v: unknown): v is Record<string, any> => {\n if (v === null || typeof v !== 'object') return false\n const proto = Object.getPrototypeOf(v)\n return proto === Object.prototype || proto === null\n}\n\n/** Write `value` at a dotted path inside `out`, creating intermediate objects. */\nexport const expand = (out: Record<string, any>, path: string, value: any): Record<string, any> => {\n const keys = path.split('.')\n const last = keys.pop()!\n let cur = out\n for (const k of keys) cur = isPlain(cur[k]) ? cur[k] : (cur[k] = {})\n cur[last] = value\n return out\n}\n\nexport type Filter = { include?: RegExp | string; exclude?: RegExp | string } | ((path: string) => boolean)\n\nconst re = (v: RegExp | string | undefined, fallback: RegExp): RegExp =>\n v === undefined ? fallback : typeof v === 'string' ? new RegExp(v.replace(/^\\/|\\/$/g, '')) : v\n\n/** Turn `{ include, exclude }` (regex or string) or a predicate into a path predicate. */\nexport const toPredicate = (f?: Filter): ((path: string) => boolean) => {\n if (typeof f === 'function') return f\n const inc = re(f?.include, /(?:)/)\n const exc = re(f?.exclude, /(?!)/)\n return (p) => inc.test(p) && !exc.test(p)\n}\n"],
|
|
5
|
-
"mappings": "AAAO,MAAM,UAAU,CAAC,MAAyC;AAC/D,MAAI,MAAM,QAAQ,OAAO,MAAM,SAAU,QAAO;AAChD,QAAM,QAAQ,OAAO,eAAe,CAAC;AACrC,SAAO,UAAU,OAAO,aAAa,UAAU;AACjD;AAGO,MAAM,SAAS,CAAC,KAA0B,MAAc,UAAoC;AACjG,QAAM,OAAO,KAAK,MAAM,GAAG;AAC3B,QAAM,OAAO,KAAK,IAAI;AACtB,MAAI,MAAM;AACV,aAAW,KAAK,KAAM,OAAM,QAAQ,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,IAAK,IAAI,CAAC,IAAI,CAAC;AAClE,MAAI,IAAI,IAAI;AACZ,SAAO;AACT;AAIA,MAAM,KAAK,CAAC,GAAgC,aAC1C,MAAM,SAAY,WAAW,OAAO,MAAM,WAAW,IAAI,OAAO,EAAE,QAAQ,YAAY,EAAE,CAAC,IAAI;AAGxF,MAAM,cAAc,CAAC,MAA4C;AACtE,MAAI,OAAO,MAAM,WAAY,QAAO;AACpC,QAAM,MAAM,GAAG,GAAG,SAAS,MAAM;AACjC,QAAM,MAAM,GAAG,GAAG,SAAS,MAAM;AACjC,SAAO,CAAC,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC;AAC1C;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/dist/utils/text.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export type CaseStyle = 'camel' | 'kebab' | 'snake' | 'pascal';
|
|
2
|
-
export declare const kebab: (s: string) => string;
|
|
3
|
-
export declare const snake: (s: string) => string;
|
|
4
|
-
export declare const camel: (s: string) => string;
|
|
5
|
-
export declare const pascal: (s: string) => string;
|
|
6
|
-
/** Recase a dotted path segment by segment so `user.first-name` becomes `user.firstName`. */
|
|
7
|
-
export declare const recase: (path: string, style: CaseStyle) => string;
|
package/dist/utils/text.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
const words = (s) => s.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2").split(/[^A-Za-z0-9]+|\s+/).filter(Boolean).map((w) => w.toLowerCase());
|
|
2
|
-
const cap = (w) => w[0].toUpperCase() + w.slice(1);
|
|
3
|
-
const kebab = (s) => words(s).join("-");
|
|
4
|
-
const snake = (s) => words(s).join("_");
|
|
5
|
-
const camel = (s) => words(s).map((w, i) => i ? cap(w) : w).join("");
|
|
6
|
-
const pascal = (s) => words(s).map(cap).join("");
|
|
7
|
-
const recase = (path, style) => path.split(".").map((seg) => ({ camel, kebab, snake, pascal })[style](seg)).join(".");
|
|
8
|
-
export {
|
|
9
|
-
camel,
|
|
10
|
-
kebab,
|
|
11
|
-
pascal,
|
|
12
|
-
recase,
|
|
13
|
-
snake
|
|
14
|
-
};
|
|
15
|
-
//# sourceMappingURL=text.js.map
|
package/dist/utils/text.js.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/utils/text.ts"],
|
|
4
|
-
"sourcesContent": ["export type CaseStyle = 'camel' | 'kebab' | 'snake' | 'pascal'\n\n/** Split an identifier in any common casing into lowercase words. */\nconst words = (s: string): string[] =>\n s\n .replace(/([a-z0-9])([A-Z])/g, '$1 $2')\n .replace(/([A-Z]+)([A-Z][a-z])/g, '$1 $2')\n .split(/[^A-Za-z0-9]+|\\s+/)\n .filter(Boolean)\n .map((w) => w.toLowerCase())\n\nconst cap = (w: string): string => w[0].toUpperCase() + w.slice(1)\n\nexport const kebab = (s: string): string => words(s).join('-')\nexport const snake = (s: string): string => words(s).join('_')\nexport const camel = (s: string): string => words(s).map((w, i) => (i ? cap(w) : w)).join('')\nexport const pascal = (s: string): string => words(s).map(cap).join('')\n\n/** Recase a dotted path segment by segment so `user.first-name` becomes `user.firstName`. */\nexport const recase = (path: string, style: CaseStyle): string =>\n path\n .split('.')\n .map((seg) => ({ camel, kebab, snake, pascal })[style](seg))\n .join('.')\n"],
|
|
5
|
-
"mappings": "AAGA,MAAM,QAAQ,CAAC,MACb,EACG,QAAQ,sBAAsB,OAAO,EACrC,QAAQ,yBAAyB,OAAO,EACxC,MAAM,mBAAmB,EACzB,OAAO,OAAO,EACd,IAAI,CAAC,MAAM,EAAE,YAAY,CAAC;AAE/B,MAAM,MAAM,CAAC,MAAsB,EAAE,CAAC,EAAE,YAAY,IAAI,EAAE,MAAM,CAAC;AAE1D,MAAM,QAAQ,CAAC,MAAsB,MAAM,CAAC,EAAE,KAAK,GAAG;AACtD,MAAM,QAAQ,CAAC,MAAsB,MAAM,CAAC,EAAE,KAAK,GAAG;AACtD,MAAM,QAAQ,CAAC,MAAsB,MAAM,CAAC,EAAE,IAAI,CAAC,GAAG,MAAO,IAAI,IAAI,CAAC,IAAI,CAAE,EAAE,KAAK,EAAE;AACrF,MAAM,SAAS,CAAC,MAAsB,MAAM,CAAC,EAAE,IAAI,GAAG,EAAE,KAAK,EAAE;AAG/D,MAAM,SAAS,CAAC,MAAc,UACnC,KACG,MAAM,GAAG,EACT,IAAI,CAAC,SAAS,EAAE,OAAO,OAAO,OAAO,OAAO,GAAG,KAAK,EAAE,GAAG,CAAC,EAC1D,KAAK,GAAG;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/dist/utils/timing.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export type Mods = Map<string, string[]>;
|
|
2
|
-
type Fn = (...args: any[]) => void;
|
|
3
|
-
/** '300ms' → 300, '2s' → 2000, '150' → 150. */
|
|
4
|
-
export declare const toMs: (args: string[] | undefined, fallback?: number) => number;
|
|
5
|
-
export declare const delay: (fn: Fn, ms: number) => Fn;
|
|
6
|
-
/** Debounce: wait for a quiet period. `leading` fires on the first call, `trailing` on the last. */
|
|
7
|
-
export declare const debounce: (fn: Fn, ms: number, leading?: boolean, trailing?: boolean) => Fn;
|
|
8
|
-
/** Throttle: at most one call per window. `leading` fires immediately, `trailing` fires once at the end. */
|
|
9
|
-
export declare const throttle: (fn: Fn, ms: number, leading?: boolean, trailing?: boolean) => Fn;
|
|
10
|
-
/** Apply `__delay`, `__debounce` and `__throttle` modifiers to a callback. */
|
|
11
|
-
export declare const withTiming: (fn: Fn, mods: Mods) => Fn;
|
|
12
|
-
/** Wrap a callback in `document.startViewTransition` when `__viewtransition` is present and supported. */
|
|
13
|
-
export declare const withViewTransition: (fn: Fn, mods: Mods) => Fn;
|
|
14
|
-
export {};
|