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,81 +0,0 @@
|
|
|
1
|
-
import { attribute } from "../../core/index.js";
|
|
2
|
-
const readFiles = (input) => Promise.all(
|
|
3
|
-
[...input.files ?? []].map(
|
|
4
|
-
(f) => new Promise((resolve) => {
|
|
5
|
-
const r = new FileReader();
|
|
6
|
-
r.onloadend = () => resolve({ name: f.name, type: f.type, size: f.size, contents: String(r.result).split(",")[1] ?? "" });
|
|
7
|
-
r.readAsDataURL(f);
|
|
8
|
-
})
|
|
9
|
-
)
|
|
10
|
-
);
|
|
11
|
-
const bind = attribute({
|
|
12
|
-
name: "bind",
|
|
13
|
-
mount({ el, key, value, cased, mods, store, listen, effect }) {
|
|
14
|
-
const path = key ? cased() : value.trim();
|
|
15
|
-
const current = () => store.get(path);
|
|
16
|
-
const asNumber = (s) => typeof current() === "number" ? +s : s;
|
|
17
|
-
let a;
|
|
18
|
-
const prop = mods.get("prop")?.[0];
|
|
19
|
-
if (prop) {
|
|
20
|
-
a = { read: () => el[prop], write: (v) => el[prop] = v, events: ["input", "change"] };
|
|
21
|
-
} else if (el instanceof HTMLInputElement) {
|
|
22
|
-
const t = el.type;
|
|
23
|
-
if (t === "checkbox") {
|
|
24
|
-
const own = el.hasAttribute("value") && el.value !== "on";
|
|
25
|
-
a = {
|
|
26
|
-
read: () => {
|
|
27
|
-
const cur = current();
|
|
28
|
-
if (Array.isArray(cur)) {
|
|
29
|
-
const set = new Set(cur);
|
|
30
|
-
el.checked ? set.add(el.value) : set.delete(el.value);
|
|
31
|
-
return [...set];
|
|
32
|
-
}
|
|
33
|
-
return own ? el.checked ? el.value : "" : el.checked;
|
|
34
|
-
},
|
|
35
|
-
write: (v) => {
|
|
36
|
-
el.checked = Array.isArray(v) ? v.includes(el.value) : own ? v === el.value : !!v;
|
|
37
|
-
},
|
|
38
|
-
events: ["input"]
|
|
39
|
-
};
|
|
40
|
-
} else if (t === "radio") {
|
|
41
|
-
if (!el.name) el.name = path;
|
|
42
|
-
a = { read: () => el.checked ? asNumber(el.value) : current(), write: (v) => el.checked = String(v) === el.value, events: ["input"] };
|
|
43
|
-
} else if (t === "file") {
|
|
44
|
-
listen(el, "change", () => readFiles(el).then((files) => store.set(path, files)));
|
|
45
|
-
return;
|
|
46
|
-
} else if (t === "number" || t === "range") {
|
|
47
|
-
a = { read: () => el.value === "" ? "" : +el.value, write: (v) => el.value = String(v ?? ""), events: ["input"] };
|
|
48
|
-
} else {
|
|
49
|
-
a = { read: () => el.value, write: (v) => el.value = String(v ?? ""), events: ["input"] };
|
|
50
|
-
}
|
|
51
|
-
} else if (el instanceof HTMLSelectElement) {
|
|
52
|
-
a = {
|
|
53
|
-
read: () => el.multiple ? [...el.selectedOptions].map((o) => asNumber(o.value)) : asNumber(el.value),
|
|
54
|
-
write: (v) => {
|
|
55
|
-
if (el.multiple) for (const o of el.options) o.selected = Array.isArray(v) && v.map(String).includes(o.value);
|
|
56
|
-
else el.value = String(v ?? "");
|
|
57
|
-
},
|
|
58
|
-
events: ["change"]
|
|
59
|
-
};
|
|
60
|
-
} else if (el instanceof HTMLTextAreaElement || "value" in el) {
|
|
61
|
-
a = { read: () => el.value, write: (v) => el.value = String(v ?? ""), events: ["input", "change"] };
|
|
62
|
-
} else {
|
|
63
|
-
a = { read: () => el.getAttribute("value"), write: (v) => el.setAttribute("value", String(v ?? "")), events: ["change"] };
|
|
64
|
-
}
|
|
65
|
-
if (!store.has(path)) {
|
|
66
|
-
const initial = a.read();
|
|
67
|
-
if (initial !== void 0 && initial !== "") store.set(path, initial);
|
|
68
|
-
}
|
|
69
|
-
const sync = () => store.set(path, a.read());
|
|
70
|
-
for (const type of mods.get("event") ?? a.events) listen(el, type, sync);
|
|
71
|
-
listen(el, "sigmx-prop-change", sync);
|
|
72
|
-
effect(() => {
|
|
73
|
-
const v = current();
|
|
74
|
-
if (v !== void 0) a.write(v);
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
export {
|
|
79
|
-
bind
|
|
80
|
-
};
|
|
81
|
-
//# sourceMappingURL=bind.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/plugins/attributes/bind.ts"],
|
|
4
|
-
"sourcesContent": ["import { attribute } from '../../core/index.js'\n\ntype Adapter = { read(): unknown; write(v: unknown): void; events: string[] }\n\nconst readFiles = (input: HTMLInputElement) =>\n Promise.all(\n [...(input.files ?? [])].map(\n (f) =>\n new Promise<{ name: string; type: string; size: number; contents: string }>((resolve) => {\n const r = new FileReader()\n r.onloadend = () =>\n resolve({ name: f.name, type: f.type, size: f.size, contents: String(r.result).split(',')[1] ?? '' })\n r.readAsDataURL(f)\n }),\n ),\n )\n\n/**\n * Two-way binding: `bind:name` or `bind=\"name\"`. Creates the signal from the element when missing.\n * Checkbox groups bind to arrays, radios to the checked value, `select multiple` to arrays.\n * `__prop.value` binds a custom element property; `__event.change` picks the events to listen for.\n */\nexport const bind = attribute({\n name: 'bind',\n mount({ el, key, value, cased, mods, store, listen, effect }) {\n const path = key ? cased() : value.trim()\n const current = () => store.get(path)\n const asNumber = (s: string) => (typeof current() === 'number' ? +s : s)\n let a: Adapter\n const prop = mods.get('prop')?.[0]\n\n if (prop) {\n a = { read: () => (el as any)[prop], write: (v) => ((el as any)[prop] = v), events: ['input', 'change'] }\n } else if (el instanceof HTMLInputElement) {\n const t = el.type\n if (t === 'checkbox') {\n const own = el.hasAttribute('value') && el.value !== 'on'\n a = {\n read: () => {\n const cur = current()\n if (Array.isArray(cur)) {\n const set = new Set(cur)\n el.checked ? set.add(el.value) : set.delete(el.value)\n return [...set]\n }\n return own ? (el.checked ? el.value : '') : el.checked\n },\n write: (v) => {\n el.checked = Array.isArray(v) ? v.includes(el.value) : own ? v === el.value : !!v\n },\n events: ['input'],\n }\n } else if (t === 'radio') {\n if (!el.name) el.name = path\n a = { read: () => (el.checked ? asNumber(el.value) : current()), write: (v) => (el.checked = String(v) === el.value), events: ['input'] }\n } else if (t === 'file') {\n listen(el, 'change', () => readFiles(el).then((files) => store.set(path, files)))\n return\n } else if (t === 'number' || t === 'range') {\n a = { read: () => (el.value === '' ? '' : +el.value), write: (v) => (el.value = String(v ?? '')), events: ['input'] }\n } else {\n a = { read: () => el.value, write: (v) => (el.value = String(v ?? '')), events: ['input'] }\n }\n } else if (el instanceof HTMLSelectElement) {\n a = {\n read: () => (el.multiple ? [...el.selectedOptions].map((o) => asNumber(o.value)) : asNumber(el.value)),\n write: (v) => {\n if (el.multiple) for (const o of el.options) o.selected = Array.isArray(v) && v.map(String).includes(o.value)\n else el.value = String(v ?? '')\n },\n events: ['change'],\n }\n } else if (el instanceof HTMLTextAreaElement || 'value' in el) {\n a = { read: () => (el as any).value, write: (v) => ((el as any).value = String(v ?? '')), events: ['input', 'change'] }\n } else {\n a = { read: () => el.getAttribute('value'), write: (v) => el.setAttribute('value', String(v ?? '')), events: ['change'] }\n }\n\n if (!store.has(path)) {\n const initial = a.read()\n if (initial !== undefined && initial !== '') store.set(path, initial)\n }\n const sync = () => store.set(path, a.read())\n for (const type of mods.get('event') ?? a.events) listen(el, type, sync)\n listen(el, 'sigmx-prop-change', sync)\n effect(() => {\n const v = current()\n if (v !== undefined) a.write(v)\n })\n },\n})\n"],
|
|
5
|
-
"mappings": "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",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { attribute } from "../../core/index.js";
|
|
2
|
-
const className = attribute({
|
|
3
|
-
name: "class",
|
|
4
|
-
value: "required",
|
|
5
|
-
mount({ el, key, cased, evaluate, effect }) {
|
|
6
|
-
const applied = /* @__PURE__ */ new Set();
|
|
7
|
-
effect(() => {
|
|
8
|
-
const map = key ? { [cased("kebab")]: evaluate() } : evaluate();
|
|
9
|
-
for (const k in map) {
|
|
10
|
-
for (const name of k.split(/\s+/).filter(Boolean)) {
|
|
11
|
-
el.classList.toggle(name, !!map[k]);
|
|
12
|
-
map[k] ? applied.add(name) : applied.delete(name);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
return () => el.classList.remove(...applied);
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
export {
|
|
20
|
-
className
|
|
21
|
-
};
|
|
22
|
-
//# sourceMappingURL=class.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/plugins/attributes/class.ts"],
|
|
4
|
-
"sourcesContent": ["import { attribute } from '../../core/index.js'\n\n/** `class:active=\"expr\"` or `class=\"{ active: expr, 'a b': expr }\"`. */\nexport const className = attribute({\n name: 'class',\n value: 'required',\n mount({ el, key, cased, evaluate, effect }) {\n const applied = new Set<string>()\n effect(() => {\n const map: Record<string, unknown> = key ? { [cased('kebab')]: evaluate() } : evaluate()\n for (const k in map) {\n for (const name of k.split(/\\s+/).filter(Boolean)) {\n el.classList.toggle(name, !!map[k])\n map[k] ? applied.add(name) : applied.delete(name)\n }\n }\n })\n return () => el.classList.remove(...applied)\n },\n})\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,iBAAiB;AAGnB,MAAM,YAAY,UAAU;AAAA,EACjC,MAAM;AAAA,EACN,OAAO;AAAA,EACP,MAAM,EAAE,IAAI,KAAK,OAAO,UAAU,OAAO,GAAG;AAC1C,UAAM,UAAU,oBAAI,IAAY;AAChC,WAAO,MAAM;AACX,YAAM,MAA+B,MAAM,EAAE,CAAC,MAAM,OAAO,CAAC,GAAG,SAAS,EAAE,IAAI,SAAS;AACvF,iBAAW,KAAK,KAAK;AACnB,mBAAW,QAAQ,EAAE,MAAM,KAAK,EAAE,OAAO,OAAO,GAAG;AACjD,aAAG,UAAU,OAAO,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC;AAClC,cAAI,CAAC,IAAI,QAAQ,IAAI,IAAI,IAAI,QAAQ,OAAO,IAAI;AAAA,QAClD;AAAA,MACF;AAAA,IACF,CAAC;AACD,WAAO,MAAM,GAAG,UAAU,OAAO,GAAG,OAAO;AAAA,EAC7C;AACF,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { attribute, computed as makeComputed } from "../../core/index.js";
|
|
2
|
-
const computed = attribute({
|
|
3
|
-
name: "computed",
|
|
4
|
-
value: "required",
|
|
5
|
-
mount({ key, cased, evaluate, store, error }) {
|
|
6
|
-
if (key) {
|
|
7
|
-
store.define(cased(), makeComputed(() => evaluate()));
|
|
8
|
-
return;
|
|
9
|
-
}
|
|
10
|
-
const obj = evaluate();
|
|
11
|
-
for (const k in obj) {
|
|
12
|
-
if (typeof obj[k] !== "function") throw error(`"${k}" must be a function`);
|
|
13
|
-
store.define(k, makeComputed(obj[k]));
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
export {
|
|
18
|
-
computed
|
|
19
|
-
};
|
|
20
|
-
//# sourceMappingURL=computed.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/plugins/attributes/computed.ts"],
|
|
4
|
-
"sourcesContent": ["import { attribute, computed as makeComputed } from '../../core/index.js'\n\n/** `computed:name=\"expr\"` or `computed=\"{ name: () => expr }\"`. */\nexport const computed = attribute({\n name: 'computed',\n value: 'required',\n mount({ key, cased, evaluate, store, error }) {\n if (key) {\n store.define(cased(), makeComputed(() => evaluate()))\n return\n }\n const obj = evaluate()\n for (const k in obj) {\n if (typeof obj[k] !== 'function') throw error(`\"${k}\" must be a function`)\n store.define(k, makeComputed(obj[k]))\n }\n },\n})\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,WAAW,YAAY,oBAAoB;AAG7C,MAAM,WAAW,UAAU;AAAA,EAChC,MAAM;AAAA,EACN,OAAO;AAAA,EACP,MAAM,EAAE,KAAK,OAAO,UAAU,OAAO,MAAM,GAAG;AAC5C,QAAI,KAAK;AACP,YAAM,OAAO,MAAM,GAAG,aAAa,MAAM,SAAS,CAAC,CAAC;AACpD;AAAA,IACF;AACA,UAAM,MAAM,SAAS;AACrB,eAAW,KAAK,KAAK;AACnB,UAAI,OAAO,IAAI,CAAC,MAAM,WAAY,OAAM,MAAM,IAAI,CAAC,sBAAsB;AACzE,YAAM,OAAO,GAAG,aAAa,IAAI,CAAC,CAAC,CAAC;AAAA,IACtC;AAAA,EACF;AACF,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { attribute } from "../../core/index.js";
|
|
2
|
-
const customValidity = attribute({
|
|
3
|
-
name: "custom-validity",
|
|
4
|
-
key: "forbidden",
|
|
5
|
-
value: "required",
|
|
6
|
-
mount({ el, evaluate, effect, error }) {
|
|
7
|
-
if (!("setCustomValidity" in el)) throw error("only works on form fields");
|
|
8
|
-
effect(() => el.setCustomValidity(String(evaluate() ?? "")));
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
export {
|
|
12
|
-
customValidity
|
|
13
|
-
};
|
|
14
|
-
//# sourceMappingURL=customValidity.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/plugins/attributes/customValidity.ts"],
|
|
4
|
-
"sourcesContent": ["import { attribute } from '../../core/index.js'\n\n/** The expression's string becomes the field's validity message; '' means valid. */\nexport const customValidity = attribute({\n name: 'custom-validity',\n key: 'forbidden',\n value: 'required',\n mount({ el, evaluate, effect, error }) {\n if (!('setCustomValidity' in el)) throw error('only works on form fields')\n effect(() => (el as HTMLInputElement).setCustomValidity(String(evaluate() ?? '')))\n },\n})\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,iBAAiB;AAGnB,MAAM,iBAAiB,UAAU;AAAA,EACtC,MAAM;AAAA,EACN,KAAK;AAAA,EACL,OAAO;AAAA,EACP,MAAM,EAAE,IAAI,UAAU,QAAQ,MAAM,GAAG;AACrC,QAAI,EAAE,uBAAuB,IAAK,OAAM,MAAM,2BAA2B;AACzE,WAAO,MAAO,GAAwB,kBAAkB,OAAO,SAAS,KAAK,EAAE,CAAC,CAAC;AAAA,EACnF;AACF,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { attribute } from "../../core/index.js";
|
|
2
|
-
const effect = attribute({
|
|
3
|
-
name: "effect",
|
|
4
|
-
key: "forbidden",
|
|
5
|
-
value: "required",
|
|
6
|
-
returns: false,
|
|
7
|
-
mount: (ctx) => ctx.effect(() => ctx.evaluate())
|
|
8
|
-
});
|
|
9
|
-
export {
|
|
10
|
-
effect
|
|
11
|
-
};
|
|
12
|
-
//# sourceMappingURL=effect.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/plugins/attributes/effect.ts"],
|
|
4
|
-
"sourcesContent": ["import { attribute } from '../../core/index.js'\n\n/** Runs the expression now and whenever a signal it read changes. */\nexport const effect = attribute({\n name: 'effect',\n key: 'forbidden',\n value: 'required',\n returns: false,\n mount: (ctx) => ctx.effect(() => ctx.evaluate()),\n})\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,iBAAiB;AAGnB,MAAM,SAAS,UAAU;AAAA,EAC9B,MAAM;AAAA,EACN,KAAK;AAAA,EACL,OAAO;AAAA,EACP,SAAS;AAAA,EACT,OAAO,CAAC,QAAQ,IAAI,OAAO,MAAM,IAAI,SAAS,CAAC;AACjD,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { attribute } from "../../core/index.js";
|
|
2
|
-
const indicator = attribute({
|
|
3
|
-
name: "indicator",
|
|
4
|
-
mount({ el, key, value, cased, store, listen }) {
|
|
5
|
-
const path = key ? cased() : value.trim();
|
|
6
|
-
let active = 0;
|
|
7
|
-
store.set(path, false);
|
|
8
|
-
listen(document, "sigmx-fetch", (e) => {
|
|
9
|
-
if (e.detail.el !== el) return;
|
|
10
|
-
if (e.detail.type === "started") active++;
|
|
11
|
-
else if (e.detail.type === "finished") active = Math.max(0, active - 1);
|
|
12
|
-
store.set(path, active > 0);
|
|
13
|
-
});
|
|
14
|
-
return () => store.set(path, false);
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
export {
|
|
18
|
-
indicator
|
|
19
|
-
};
|
|
20
|
-
//# sourceMappingURL=indicator.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/plugins/attributes/indicator.ts"],
|
|
4
|
-
"sourcesContent": ["import { attribute } from '../../core/index.js'\n\n/** A boolean signal that is true while a request started from this element is in flight. */\nexport const indicator = attribute({\n name: 'indicator',\n mount({ el, key, value, cased, store, listen }) {\n const path = key ? cased() : value.trim()\n let active = 0\n store.set(path, false)\n listen(document, 'sigmx-fetch', (e: CustomEvent<{ el: Element; type: string }>) => {\n if (e.detail.el !== el) return\n if (e.detail.type === 'started') active++\n else if (e.detail.type === 'finished') active = Math.max(0, active - 1)\n store.set(path, active > 0)\n })\n return () => store.set(path, false)\n },\n})\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,iBAAiB;AAGnB,MAAM,YAAY,UAAU;AAAA,EACjC,MAAM;AAAA,EACN,MAAM,EAAE,IAAI,KAAK,OAAO,OAAO,OAAO,OAAO,GAAG;AAC9C,UAAM,OAAO,MAAM,MAAM,IAAI,MAAM,KAAK;AACxC,QAAI,SAAS;AACb,UAAM,IAAI,MAAM,KAAK;AACrB,WAAO,UAAU,eAAe,CAAC,MAAkD;AACjF,UAAI,EAAE,OAAO,OAAO,GAAI;AACxB,UAAI,EAAE,OAAO,SAAS,UAAW;AAAA,eACxB,EAAE,OAAO,SAAS,WAAY,UAAS,KAAK,IAAI,GAAG,SAAS,CAAC;AACtE,YAAM,IAAI,MAAM,SAAS,CAAC;AAAA,IAC5B,CAAC;AACD,WAAO,MAAM,MAAM,IAAI,MAAM,KAAK;AAAA,EACpC;AACF,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { attribute, withTiming, withViewTransition } from "../../core/index.js";
|
|
2
|
-
const init = attribute({
|
|
3
|
-
name: "init",
|
|
4
|
-
key: "forbidden",
|
|
5
|
-
value: "required",
|
|
6
|
-
returns: false,
|
|
7
|
-
mount({ mods, evaluate }) {
|
|
8
|
-
withTiming(withViewTransition(() => evaluate(), mods), mods)();
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
export {
|
|
12
|
-
init
|
|
13
|
-
};
|
|
14
|
-
//# sourceMappingURL=init.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/plugins/attributes/init.ts"],
|
|
4
|
-
"sourcesContent": ["import { attribute, withTiming, withViewTransition } from '../../core/index.js'\n\n/** Runs once when the element is mounted. Supports `__delay.500ms` and `__viewtransition`. */\nexport const init = attribute({\n name: 'init',\n key: 'forbidden',\n value: 'required',\n returns: false,\n mount({ mods, evaluate }) {\n withTiming(withViewTransition(() => evaluate(), mods), mods)()\n },\n})\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,WAAW,YAAY,0BAA0B;AAGnD,MAAM,OAAO,UAAU;AAAA,EAC5B,MAAM;AAAA,EACN,KAAK;AAAA,EACL,OAAO;AAAA,EACP,SAAS;AAAA,EACT,MAAM,EAAE,MAAM,SAAS,GAAG;AACxB,eAAW,mBAAmB,MAAM,SAAS,GAAG,IAAI,GAAG,IAAI,EAAE;AAAA,EAC/D;AACF,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { attribute } from "../../core/index.js";
|
|
2
|
-
const jsonSignals = attribute({
|
|
3
|
-
name: "json-signals",
|
|
4
|
-
key: "forbidden",
|
|
5
|
-
mount({ el, value, mods, evaluate, effect, store }) {
|
|
6
|
-
const filter = value ? evaluate() : void 0;
|
|
7
|
-
effect(() => {
|
|
8
|
-
el.textContent = JSON.stringify(store.snapshot(filter), null, mods.has("terse") ? 0 : 2);
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
export {
|
|
13
|
-
jsonSignals
|
|
14
|
-
};
|
|
15
|
-
//# sourceMappingURL=jsonSignals.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/plugins/attributes/jsonSignals.ts"],
|
|
4
|
-
"sourcesContent": ["import { attribute } from '../../core/index.js'\n\n/** Renders the store (or a filtered part) as JSON. `__terse` for single-line output. */\nexport const jsonSignals = attribute({\n name: 'json-signals',\n key: 'forbidden',\n mount({ el, value, mods, evaluate, effect, store }) {\n const filter = value ? evaluate() : undefined\n effect(() => {\n el.textContent = JSON.stringify(store.snapshot(filter), null, mods.has('terse') ? 0 : 2)\n })\n },\n})\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,iBAAiB;AAGnB,MAAM,cAAc,UAAU;AAAA,EACnC,MAAM;AAAA,EACN,KAAK;AAAA,EACL,MAAM,EAAE,IAAI,OAAO,MAAM,UAAU,QAAQ,MAAM,GAAG;AAClD,UAAM,SAAS,QAAQ,SAAS,IAAI;AACpC,WAAO,MAAM;AACX,SAAG,cAAc,KAAK,UAAU,MAAM,SAAS,MAAM,GAAG,MAAM,KAAK,IAAI,OAAO,IAAI,IAAI,CAAC;AAAA,IACzF,CAAC;AAAA,EACH;AACF,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { attribute } from "../../core/index.js";
|
|
2
|
-
const matchMedia = attribute({
|
|
3
|
-
name: "match-media",
|
|
4
|
-
key: "required",
|
|
5
|
-
value: "required",
|
|
6
|
-
mount({ cased, evaluate, store, listen }) {
|
|
7
|
-
let q = String(evaluate()).trim();
|
|
8
|
-
if (!/^[(a-z]/.test(q) || !q.startsWith("(") && q.includes(":") && !/^(not|only|all|screen|print)\b/.test(q)) q = `(${q})`;
|
|
9
|
-
const mql = window.matchMedia(q);
|
|
10
|
-
const path = cased();
|
|
11
|
-
const sync = () => store.set(path, mql.matches);
|
|
12
|
-
sync();
|
|
13
|
-
listen(mql, "change", sync);
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
export {
|
|
17
|
-
matchMedia
|
|
18
|
-
};
|
|
19
|
-
//# sourceMappingURL=matchMedia.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/plugins/attributes/matchMedia.ts"],
|
|
4
|
-
"sourcesContent": ["import { attribute } from '../../core/index.js'\n\n/** `match-media:is-dark=\"'prefers-color-scheme: dark'\"` keeps a boolean signal in sync. */\nexport const matchMedia = attribute({\n name: 'match-media',\n key: 'required',\n value: 'required',\n mount({ cased, evaluate, store, listen }) {\n let q = String(evaluate()).trim()\n if (!/^[(a-z]/.test(q) || (!q.startsWith('(') && q.includes(':') && !/^(not|only|all|screen|print)\\b/.test(q))) q = `(${q})`\n const mql = window.matchMedia(q)\n const path = cased()\n const sync = () => store.set(path, mql.matches)\n sync()\n listen(mql, 'change', sync)\n },\n})\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,iBAAiB;AAGnB,MAAM,aAAa,UAAU;AAAA,EAClC,MAAM;AAAA,EACN,KAAK;AAAA,EACL,OAAO;AAAA,EACP,MAAM,EAAE,OAAO,UAAU,OAAO,OAAO,GAAG;AACxC,QAAI,IAAI,OAAO,SAAS,CAAC,EAAE,KAAK;AAChC,QAAI,CAAC,UAAU,KAAK,CAAC,KAAM,CAAC,EAAE,WAAW,GAAG,KAAK,EAAE,SAAS,GAAG,KAAK,CAAC,iCAAiC,KAAK,CAAC,EAAI,KAAI,IAAI,CAAC;AACzH,UAAM,MAAM,OAAO,WAAW,CAAC;AAC/B,UAAM,OAAO,MAAM;AACnB,UAAM,OAAO,MAAM,MAAM,IAAI,MAAM,IAAI,OAAO;AAC9C,SAAK;AACL,WAAO,KAAK,UAAU,IAAI;AAAA,EAC5B;AACF,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { attribute, withTiming, withViewTransition } from "../../core/index.js";
|
|
2
|
-
const on = attribute({
|
|
3
|
-
name: "on",
|
|
4
|
-
key: "required",
|
|
5
|
-
value: "required",
|
|
6
|
-
returns: false,
|
|
7
|
-
mount({ el, mods, cased, evaluate, listen }) {
|
|
8
|
-
const type = cased("kebab");
|
|
9
|
-
const outside = mods.has("outside");
|
|
10
|
-
const target = mods.has("window") ? window : mods.has("document") || outside || type.startsWith("sigmx-") ? document : el;
|
|
11
|
-
const run = withTiming(withViewTransition((e) => evaluate(e), mods), mods);
|
|
12
|
-
listen(
|
|
13
|
-
target,
|
|
14
|
-
type,
|
|
15
|
-
(e) => {
|
|
16
|
-
if (outside && el.contains(e.target)) return;
|
|
17
|
-
if (mods.has("prevent") || type === "submit" && el instanceof HTMLFormElement) e.preventDefault();
|
|
18
|
-
if (mods.has("stop")) e.stopPropagation();
|
|
19
|
-
run(e);
|
|
20
|
-
},
|
|
21
|
-
{ capture: mods.has("capture"), passive: mods.has("passive"), once: mods.has("once") }
|
|
22
|
-
);
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
export {
|
|
26
|
-
on
|
|
27
|
-
};
|
|
28
|
-
//# sourceMappingURL=on.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/plugins/attributes/on.ts"],
|
|
4
|
-
"sourcesContent": ["import { attribute, withTiming, withViewTransition } from '../../core/index.js'\n\n/**\n * `on:click=\"expr\"`. Modifiers: window, document, outside, prevent, stop, capture, passive, once,\n * delay/debounce/throttle, viewtransition, case.\n */\nexport const on = attribute({\n name: 'on',\n key: 'required',\n value: 'required',\n returns: false,\n mount({ el, mods, cased, evaluate, listen }) {\n const type = cased('kebab')\n const outside = mods.has('outside')\n const target: EventTarget =\n mods.has('window') ? window : mods.has('document') || outside || type.startsWith('sigmx-') ? document : el\n const run = withTiming(withViewTransition((e: Event) => evaluate(e), mods), mods)\n listen(\n target,\n type,\n (e: Event) => {\n if (outside && el.contains(e.target as Node)) return\n if (mods.has('prevent') || (type === 'submit' && el instanceof HTMLFormElement)) e.preventDefault()\n if (mods.has('stop')) e.stopPropagation()\n run(e)\n },\n { capture: mods.has('capture'), passive: mods.has('passive'), once: mods.has('once') },\n )\n },\n})\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,WAAW,YAAY,0BAA0B;AAMnD,MAAM,KAAK,UAAU;AAAA,EAC1B,MAAM;AAAA,EACN,KAAK;AAAA,EACL,OAAO;AAAA,EACP,SAAS;AAAA,EACT,MAAM,EAAE,IAAI,MAAM,OAAO,UAAU,OAAO,GAAG;AAC3C,UAAM,OAAO,MAAM,OAAO;AAC1B,UAAM,UAAU,KAAK,IAAI,SAAS;AAClC,UAAM,SACJ,KAAK,IAAI,QAAQ,IAAI,SAAS,KAAK,IAAI,UAAU,KAAK,WAAW,KAAK,WAAW,QAAQ,IAAI,WAAW;AAC1G,UAAM,MAAM,WAAW,mBAAmB,CAAC,MAAa,SAAS,CAAC,GAAG,IAAI,GAAG,IAAI;AAChF;AAAA,MACE;AAAA,MACA;AAAA,MACA,CAAC,MAAa;AACZ,YAAI,WAAW,GAAG,SAAS,EAAE,MAAc,EAAG;AAC9C,YAAI,KAAK,IAAI,SAAS,KAAM,SAAS,YAAY,cAAc,gBAAkB,GAAE,eAAe;AAClG,YAAI,KAAK,IAAI,MAAM,EAAG,GAAE,gBAAgB;AACxC,YAAI,CAAC;AAAA,MACP;AAAA,MACA,EAAE,SAAS,KAAK,IAAI,SAAS,GAAG,SAAS,KAAK,IAAI,SAAS,GAAG,MAAM,KAAK,IAAI,MAAM,EAAE;AAAA,IACvF;AAAA,EACF;AACF,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { attribute, withTiming, withViewTransition } from "../../core/index.js";
|
|
2
|
-
const onIntersect = attribute({
|
|
3
|
-
name: "on-intersect",
|
|
4
|
-
key: "forbidden",
|
|
5
|
-
value: "required",
|
|
6
|
-
returns: false,
|
|
7
|
-
mount({ el, mods, evaluate }) {
|
|
8
|
-
const t = mods.get("threshold")?.[0];
|
|
9
|
-
const threshold = mods.has("full") ? 1 : mods.has("half") ? 0.5 : t ? Math.min(100, Math.max(0, +t)) / 100 : 0;
|
|
10
|
-
const run = withTiming(withViewTransition(() => evaluate(), mods), mods);
|
|
11
|
-
const io = new IntersectionObserver(
|
|
12
|
-
(entries) => {
|
|
13
|
-
for (const e of entries) {
|
|
14
|
-
if (e.isIntersecting === mods.has("exit")) continue;
|
|
15
|
-
run();
|
|
16
|
-
if (mods.has("once")) io.disconnect();
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
{ threshold }
|
|
20
|
-
);
|
|
21
|
-
io.observe(el);
|
|
22
|
-
return () => io.disconnect();
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
export {
|
|
26
|
-
onIntersect
|
|
27
|
-
};
|
|
28
|
-
//# sourceMappingURL=onIntersect.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/plugins/attributes/onIntersect.ts"],
|
|
4
|
-
"sourcesContent": ["import { attribute, withTiming, withViewTransition } from '../../core/index.js'\n\n/** Runs when the element enters the viewport. Modifiers: once, exit, full, half, threshold.N. */\nexport const onIntersect = attribute({\n name: 'on-intersect',\n key: 'forbidden',\n value: 'required',\n returns: false,\n mount({ el, mods, evaluate }) {\n const t = mods.get('threshold')?.[0]\n const threshold = mods.has('full') ? 1 : mods.has('half') ? 0.5 : t ? Math.min(100, Math.max(0, +t)) / 100 : 0\n const run = withTiming(withViewTransition(() => evaluate(), mods), mods)\n const io = new IntersectionObserver(\n (entries) => {\n for (const e of entries) {\n if (e.isIntersecting === mods.has('exit')) continue\n run()\n if (mods.has('once')) io.disconnect()\n }\n },\n { threshold },\n )\n io.observe(el)\n return () => io.disconnect()\n },\n})\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,WAAW,YAAY,0BAA0B;AAGnD,MAAM,cAAc,UAAU;AAAA,EACnC,MAAM;AAAA,EACN,KAAK;AAAA,EACL,OAAO;AAAA,EACP,SAAS;AAAA,EACT,MAAM,EAAE,IAAI,MAAM,SAAS,GAAG;AAC5B,UAAM,IAAI,KAAK,IAAI,WAAW,IAAI,CAAC;AACnC,UAAM,YAAY,KAAK,IAAI,MAAM,IAAI,IAAI,KAAK,IAAI,MAAM,IAAI,MAAM,IAAI,KAAK,IAAI,KAAK,KAAK,IAAI,GAAG,CAAC,CAAC,CAAC,IAAI,MAAM;AAC7G,UAAM,MAAM,WAAW,mBAAmB,MAAM,SAAS,GAAG,IAAI,GAAG,IAAI;AACvE,UAAM,KAAK,IAAI;AAAA,MACb,CAAC,YAAY;AACX,mBAAW,KAAK,SAAS;AACvB,cAAI,EAAE,mBAAmB,KAAK,IAAI,MAAM,EAAG;AAC3C,cAAI;AACJ,cAAI,KAAK,IAAI,MAAM,EAAG,IAAG,WAAW;AAAA,QACtC;AAAA,MACF;AAAA,MACA,EAAE,UAAU;AAAA,IACd;AACA,OAAG,QAAQ,EAAE;AACb,WAAO,MAAM,GAAG,WAAW;AAAA,EAC7B;AACF,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { attribute, toMs, withViewTransition } from "../../core/index.js";
|
|
2
|
-
const onInterval = attribute({
|
|
3
|
-
name: "on-interval",
|
|
4
|
-
key: "forbidden",
|
|
5
|
-
value: "required",
|
|
6
|
-
returns: false,
|
|
7
|
-
mount({ mods, evaluate }) {
|
|
8
|
-
const d = mods.get("duration");
|
|
9
|
-
const run = withViewTransition(() => evaluate(), mods);
|
|
10
|
-
if (d?.includes("leading")) run();
|
|
11
|
-
const id = setInterval(run, toMs(d, 1e3));
|
|
12
|
-
return () => clearInterval(id);
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
export {
|
|
16
|
-
onInterval
|
|
17
|
-
};
|
|
18
|
-
//# sourceMappingURL=onInterval.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/plugins/attributes/onInterval.ts"],
|
|
4
|
-
"sourcesContent": ["import { attribute, toMs, withViewTransition } from '../../core/index.js'\n\n/** `on-interval__duration.5s.leading=\"expr\"`. Default one second. */\nexport const onInterval = attribute({\n name: 'on-interval',\n key: 'forbidden',\n value: 'required',\n returns: false,\n mount({ mods, evaluate }) {\n const d = mods.get('duration')\n const run = withViewTransition(() => evaluate(), mods)\n if (d?.includes('leading')) run()\n const id = setInterval(run, toMs(d, 1000))\n return () => clearInterval(id)\n },\n})\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,WAAW,MAAM,0BAA0B;AAG7C,MAAM,aAAa,UAAU;AAAA,EAClC,MAAM;AAAA,EACN,KAAK;AAAA,EACL,OAAO;AAAA,EACP,SAAS;AAAA,EACT,MAAM,EAAE,MAAM,SAAS,GAAG;AACxB,UAAM,IAAI,KAAK,IAAI,UAAU;AAC7B,UAAM,MAAM,mBAAmB,MAAM,SAAS,GAAG,IAAI;AACrD,QAAI,GAAG,SAAS,SAAS,EAAG,KAAI;AAChC,UAAM,KAAK,YAAY,KAAK,KAAK,GAAG,GAAI,CAAC;AACzC,WAAO,MAAM,cAAc,EAAE;AAAA,EAC/B;AACF,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const onRaf: import("../../core/types.js").AttributePlugin;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { attribute, withTiming } from "../../core/index.js";
|
|
2
|
-
const onRaf = attribute({
|
|
3
|
-
name: "on-raf",
|
|
4
|
-
key: "forbidden",
|
|
5
|
-
value: "required",
|
|
6
|
-
returns: false,
|
|
7
|
-
mount({ mods, evaluate }) {
|
|
8
|
-
const run = withTiming(() => evaluate(), mods);
|
|
9
|
-
let id = requestAnimationFrame(function tick() {
|
|
10
|
-
run();
|
|
11
|
-
id = requestAnimationFrame(tick);
|
|
12
|
-
});
|
|
13
|
-
return () => cancelAnimationFrame(id);
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
export {
|
|
17
|
-
onRaf
|
|
18
|
-
};
|
|
19
|
-
//# sourceMappingURL=onRaf.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/plugins/attributes/onRaf.ts"],
|
|
4
|
-
"sourcesContent": ["import { attribute, withTiming } from '../../core/index.js'\n\nexport const onRaf = attribute({\n name: 'on-raf',\n key: 'forbidden',\n value: 'required',\n returns: false,\n mount({ mods, evaluate }) {\n const run = withTiming(() => evaluate(), mods)\n let id = requestAnimationFrame(function tick() {\n run()\n id = requestAnimationFrame(tick)\n })\n return () => cancelAnimationFrame(id)\n },\n})\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,WAAW,kBAAkB;AAE/B,MAAM,QAAQ,UAAU;AAAA,EAC7B,MAAM;AAAA,EACN,KAAK;AAAA,EACL,OAAO;AAAA,EACP,SAAS;AAAA,EACT,MAAM,EAAE,MAAM,SAAS,GAAG;AACxB,UAAM,MAAM,WAAW,MAAM,SAAS,GAAG,IAAI;AAC7C,QAAI,KAAK,sBAAsB,SAAS,OAAO;AAC7C,UAAI;AACJ,WAAK,sBAAsB,IAAI;AAAA,IACjC,CAAC;AACD,WAAO,MAAM,qBAAqB,EAAE;AAAA,EACtC;AACF,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const onResize: import("../../core/types.js").AttributePlugin;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { attribute, withTiming } from "../../core/index.js";
|
|
2
|
-
const onResize = attribute({
|
|
3
|
-
name: "on-resize",
|
|
4
|
-
key: "forbidden",
|
|
5
|
-
value: "required",
|
|
6
|
-
returns: false,
|
|
7
|
-
mount({ el, mods, evaluate }) {
|
|
8
|
-
const run = withTiming(() => evaluate(), mods);
|
|
9
|
-
const ro = new ResizeObserver(() => run());
|
|
10
|
-
ro.observe(el);
|
|
11
|
-
return () => ro.disconnect();
|
|
12
|
-
}
|
|
13
|
-
});
|
|
14
|
-
export {
|
|
15
|
-
onResize
|
|
16
|
-
};
|
|
17
|
-
//# sourceMappingURL=onResize.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/plugins/attributes/onResize.ts"],
|
|
4
|
-
"sourcesContent": ["import { attribute, withTiming } from '../../core/index.js'\n\nexport const onResize = attribute({\n name: 'on-resize',\n key: 'forbidden',\n value: 'required',\n returns: false,\n mount({ el, mods, evaluate }) {\n const run = withTiming(() => evaluate(), mods)\n const ro = new ResizeObserver(() => run())\n ro.observe(el)\n return () => ro.disconnect()\n },\n})\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,WAAW,kBAAkB;AAE/B,MAAM,WAAW,UAAU;AAAA,EAChC,MAAM;AAAA,EACN,KAAK;AAAA,EACL,OAAO;AAAA,EACP,SAAS;AAAA,EACT,MAAM,EAAE,IAAI,MAAM,SAAS,GAAG;AAC5B,UAAM,MAAM,WAAW,MAAM,SAAS,GAAG,IAAI;AAC7C,UAAM,KAAK,IAAI,eAAe,MAAM,IAAI,CAAC;AACzC,OAAG,QAAQ,EAAE;AACb,WAAO,MAAM,GAAG,WAAW;AAAA,EAC7B;AACF,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { attribute, withTiming } from "../../core/index.js";
|
|
2
|
-
const touches = (patch, path) => {
|
|
3
|
-
let cur = patch;
|
|
4
|
-
for (const k of path.split(".")) {
|
|
5
|
-
if (cur == null || typeof cur !== "object" || !(k in cur)) return false;
|
|
6
|
-
cur = cur[k];
|
|
7
|
-
}
|
|
8
|
-
return true;
|
|
9
|
-
};
|
|
10
|
-
const onSignalPatch = attribute({
|
|
11
|
-
name: "on-signal-patch",
|
|
12
|
-
value: "required",
|
|
13
|
-
returns: false,
|
|
14
|
-
args: ["patch"],
|
|
15
|
-
mount({ key, cased, mods, evaluate, listen }) {
|
|
16
|
-
const path = key ? cased() : "";
|
|
17
|
-
let running = false;
|
|
18
|
-
const run = withTiming((patch) => {
|
|
19
|
-
if (running) return;
|
|
20
|
-
running = true;
|
|
21
|
-
try {
|
|
22
|
-
evaluate(void 0, patch);
|
|
23
|
-
} finally {
|
|
24
|
-
running = false;
|
|
25
|
-
}
|
|
26
|
-
}, mods);
|
|
27
|
-
listen(document, "sigmx-signal-patch", (e) => {
|
|
28
|
-
if (!path || touches(e.detail, path)) run(e.detail);
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
export {
|
|
33
|
-
onSignalPatch
|
|
34
|
-
};
|
|
35
|
-
//# sourceMappingURL=onSignalPatch.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/plugins/attributes/onSignalPatch.ts"],
|
|
4
|
-
"sourcesContent": ["import { attribute, withTiming } from '../../core/index.js'\n\nconst touches = (patch: Record<string, any>, path: string): boolean => {\n let cur: any = patch\n for (const k of path.split('.')) {\n if (cur == null || typeof cur !== 'object' || !(k in cur)) return false\n cur = cur[k]\n }\n return true\n}\n\n/**\n * Runs after signals change, with the patch as `patch`. A key narrows it to one path:\n * `on-signal-patch:user.name=\"...\"`.\n */\nexport const onSignalPatch = attribute({\n name: 'on-signal-patch',\n value: 'required',\n returns: false,\n args: ['patch'],\n mount({ key, cased, mods, evaluate, listen }) {\n const path = key ? cased() : ''\n let running = false\n const run = withTiming((patch: Record<string, any>) => {\n if (running) return\n running = true\n try {\n evaluate(undefined, patch)\n } finally {\n running = false\n }\n }, mods)\n listen(document, 'sigmx-signal-patch', (e: CustomEvent) => {\n if (!path || touches(e.detail, path)) run(e.detail)\n })\n },\n})\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,WAAW,kBAAkB;AAEtC,MAAM,UAAU,CAAC,OAA4B,SAA0B;AACrE,MAAI,MAAW;AACf,aAAW,KAAK,KAAK,MAAM,GAAG,GAAG;AAC/B,QAAI,OAAO,QAAQ,OAAO,QAAQ,YAAY,EAAE,KAAK,KAAM,QAAO;AAClE,UAAM,IAAI,CAAC;AAAA,EACb;AACA,SAAO;AACT;AAMO,MAAM,gBAAgB,UAAU;AAAA,EACrC,MAAM;AAAA,EACN,OAAO;AAAA,EACP,SAAS;AAAA,EACT,MAAM,CAAC,OAAO;AAAA,EACd,MAAM,EAAE,KAAK,OAAO,MAAM,UAAU,OAAO,GAAG;AAC5C,UAAM,OAAO,MAAM,MAAM,IAAI;AAC7B,QAAI,UAAU;AACd,UAAM,MAAM,WAAW,CAAC,UAA+B;AACrD,UAAI,QAAS;AACb,gBAAU;AACV,UAAI;AACF,iBAAS,QAAW,KAAK;AAAA,MAC3B,UAAE;AACA,kBAAU;AAAA,MACZ;AAAA,IACF,GAAG,IAAI;AACP,WAAO,UAAU,sBAAsB,CAAC,MAAmB;AACzD,UAAI,CAAC,QAAQ,QAAQ,EAAE,QAAQ,IAAI,EAAG,KAAI,EAAE,MAAM;AAAA,IACpD,CAAC;AAAA,EACH;AACF,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Saves matching signals to localStorage (`__session` for sessionStorage) and restores them on
|
|
3
|
-
* mount. `persist:key` sets the storage key; the value is an optional `{ include, exclude }` filter.
|
|
4
|
-
* Declare defaults with `signals:x__ifmissing` so restored values are not overwritten.
|
|
5
|
-
*/
|
|
6
|
-
export declare const persist: import("../../core/types.js").AttributePlugin;
|