sigmx 0.1.1 → 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 +10 -10
- 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 +11 -5
- package/dist/kernel/index.d.ts +2 -2
- package/dist/kernel/index.js +5 -6
- package/dist/kernel/index.js.map +2 -2
- package/dist/kernel/precompile.d.ts +8 -10
- package/dist/kernel/precompile.js +25 -75
- 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 +8 -2
- package/dist/kernel/reactive.js +91 -62
- package/dist/kernel/reactive.js.map +3 -3
- package/dist/kernel/runtime.js +78 -68
- package/dist/kernel/runtime.js.map +3 -3
- package/dist/kernel/scan.d.ts +1 -1
- package/dist/kernel/scan.js +3 -3
- package/dist/kernel/scan.js.map +2 -2
- package/dist/kernel/state.d.ts +4 -3
- package/dist/kernel/state.js +91 -80
- 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 -3
- package/dist/lib/objects.js +10 -5
- package/dist/lib/objects.js.map +2 -2
- package/dist/lib/schedule.d.ts +3 -3
- package/dist/lib/schedule.js +12 -10
- package/dist/lib/schedule.js.map +2 -2
- package/dist/lib/sse.d.ts +10 -0
- package/dist/lib/sse.js +32 -29
- 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 -31
- 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 -18
- 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 -26
- 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 -13
- package/dist/plugins/directives/media-query.js.map +2 -2
- package/dist/plugins/directives/on-mount.js +4 -12
- 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 -97
- package/dist/plugins/directives/two-way-bind.js.map +2 -2
- package/dist/plugins/directives/url-params.js +35 -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 -26
- 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.js +2 -8
- package/dist/plugins/directives/watch.js.map +2 -2
- package/dist/plugins/functions/bulk-set.js +7 -6
- package/dist/plugins/functions/bulk-set.js.map +2 -2
- package/dist/plugins/functions/bulk-toggle.js +7 -6
- 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 +77 -86
- 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 +13 -24
- package/dist/plugins/functions/websocket.js.map +2 -2
- package/dist/plugins/index.d.ts +0 -2
- package/dist/plugins/index.js +0 -4
- 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 -43
- 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.js +46 -66
- package/dist/plugins/server-events/morph.js.map +3 -3
- package/dist/presets/all.js +0 -4
- package/dist/presets/all.js.map +2 -2
- package/dist/server.d.ts +10 -4
- package/dist/server.js +42 -14
- package/dist/server.js.map +2 -2
- package/dist/sigmx.standalone.js +1 -1
- package/dist/vite.js +17 -7
- package/dist/vite.js.map +2 -2
- package/package.json +4 -2
- 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 -54
- package/dist/plugins/directives/trap.js.map +0 -7
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
const
|
|
3
|
-
a: _read,
|
|
4
|
-
b: _write,
|
|
5
|
-
c: _events
|
|
6
|
-
});
|
|
1
|
+
import { dir } from "../def.js";
|
|
2
|
+
const str = (v) => String(v ?? "");
|
|
7
3
|
const readFiles = (input) => Promise.all(
|
|
8
4
|
[...input.files ?? []].map(
|
|
9
5
|
(f) => new Promise((resolve) => {
|
|
@@ -13,98 +9,75 @@ const readFiles = (input) => Promise.all(
|
|
|
13
9
|
})
|
|
14
10
|
)
|
|
15
11
|
);
|
|
16
|
-
const bind =
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
};
|
|
82
|
-
} else if (el instanceof HTMLTextAreaElement || "value" in el) {
|
|
83
|
-
a = adapter(
|
|
84
|
-
() => el.value,
|
|
85
|
-
(v) => el.value = String(v ?? ""),
|
|
86
|
-
"input",
|
|
87
|
-
"change"
|
|
88
|
-
);
|
|
89
|
-
} else {
|
|
90
|
-
a = adapter(
|
|
91
|
-
() => el.getAttribute("value"),
|
|
92
|
-
(v) => el.setAttribute("value", String(v ?? "")),
|
|
93
|
-
"change"
|
|
94
|
-
);
|
|
95
|
-
}
|
|
96
|
-
if (!store.has(path)) {
|
|
97
|
-
const initial = a.a();
|
|
98
|
-
if (initial !== void 0 && initial !== "") store.set(path, initial);
|
|
99
|
-
}
|
|
100
|
-
const sync = () => store.set(path, a.a());
|
|
101
|
-
for (const type of mods.get("event") ?? a.c) listen(el, type, sync);
|
|
102
|
-
listen(el, "sigmx-prop-change", sync);
|
|
103
|
-
effect(() => {
|
|
104
|
-
const v = current();
|
|
105
|
-
if (v !== void 0) a.b(v);
|
|
106
|
-
});
|
|
12
|
+
const bind = dir("bind", 0, ({ el, key, value, cased, mods, store, listen, effect }) => {
|
|
13
|
+
const path = key ? cased() : value.trim();
|
|
14
|
+
const current = () => store.get(path);
|
|
15
|
+
const asNumber = (s) => typeof current() === "number" ? +s : s;
|
|
16
|
+
const input = el;
|
|
17
|
+
const type = el instanceof HTMLInputElement ? input.type : "";
|
|
18
|
+
const valued = (_read, ..._events) => ({
|
|
19
|
+
a: _read,
|
|
20
|
+
b: (v) => {
|
|
21
|
+
if (str(v) !== input.value && !input.validity?.badInput) input.value = str(v);
|
|
22
|
+
},
|
|
23
|
+
c: _events
|
|
24
|
+
});
|
|
25
|
+
let a;
|
|
26
|
+
if (type === "checkbox") {
|
|
27
|
+
const own = el.hasAttribute("value") && input.value !== "on";
|
|
28
|
+
a = {
|
|
29
|
+
a: () => {
|
|
30
|
+
const cur = current();
|
|
31
|
+
if (Array.isArray(cur)) {
|
|
32
|
+
const set = new Set(cur);
|
|
33
|
+
input.checked ? set.add(input.value) : set.delete(input.value);
|
|
34
|
+
return [...set];
|
|
35
|
+
}
|
|
36
|
+
return own ? input.checked ? input.value : "" : input.checked;
|
|
37
|
+
},
|
|
38
|
+
b: (v) => {
|
|
39
|
+
input.checked = Array.isArray(v) ? v.includes(input.value) : own ? v === input.value : !!v;
|
|
40
|
+
},
|
|
41
|
+
c: ["input"]
|
|
42
|
+
};
|
|
43
|
+
} else if (type === "radio") {
|
|
44
|
+
input.name ||= path;
|
|
45
|
+
a = {
|
|
46
|
+
a: () => input.checked ? asNumber(input.value) : current(),
|
|
47
|
+
b: (v) => input.checked = String(v) === input.value,
|
|
48
|
+
c: ["input"]
|
|
49
|
+
};
|
|
50
|
+
} else if (type === "file") {
|
|
51
|
+
listen(el, "change", () => readFiles(input).then((files) => store.set(path, files)));
|
|
52
|
+
return;
|
|
53
|
+
} else if (type) {
|
|
54
|
+
const numeric = type === "number" || type === "range";
|
|
55
|
+
a = valued(() => numeric && input.value !== "" ? +input.value : input.value, "input");
|
|
56
|
+
} else if (el instanceof HTMLSelectElement) {
|
|
57
|
+
a = {
|
|
58
|
+
a: () => el.multiple ? [...el.selectedOptions].map((o) => asNumber(o.value)) : asNumber(el.value),
|
|
59
|
+
b: (v) => {
|
|
60
|
+
if (el.multiple) for (const o of el.options) o.selected = Array.isArray(v) && v.map(String).includes(o.value);
|
|
61
|
+
else el.value = str(v);
|
|
62
|
+
},
|
|
63
|
+
c: ["change"]
|
|
64
|
+
};
|
|
65
|
+
} else if ("value" in el) {
|
|
66
|
+
a = valued(() => input.value, "input", "change");
|
|
67
|
+
} else {
|
|
68
|
+
a = {
|
|
69
|
+
a: () => el.getAttribute("value"),
|
|
70
|
+
b: (v) => el.setAttribute("value", str(v)),
|
|
71
|
+
c: ["change"]
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
if (!store.has(path)) {
|
|
75
|
+
const initial = a.a();
|
|
76
|
+
if (initial !== void 0 && initial !== "") store.set(path, initial);
|
|
107
77
|
}
|
|
78
|
+
const sync = () => store.set(path, a.a());
|
|
79
|
+
for (const t of [...mods.get("event") ?? a.c, "sigmx-prop-change"]) listen(el, t, sync);
|
|
80
|
+
effect(() => a.b(current()));
|
|
108
81
|
});
|
|
109
82
|
export {
|
|
110
83
|
bind
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/plugins/directives/two-way-bind.ts"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": "AAAA,SAAS,
|
|
4
|
+
"sourcesContent": ["import { dir } from '../def.js';\n\ntype Adapter = { _read(): unknown; _write(v: unknown): void; _events: string[] };\n\nconst str = (v: unknown) => String(v ?? '');\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 * `__event.change` picks the events to listen for.\n */\nexport const bind = dir('bind', 0, ({ 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 const input = el as HTMLInputElement;\n const type = el instanceof HTMLInputElement ? input.type : '';\n /** Adapter writing `el.value`. */\n const valued = (_read: () => unknown, ..._events: string[]): Adapter => ({\n _read,\n _write: (v) => {\n // A number field mid-entry ('-', '1e') reads as '' with badInput; do not wipe what the user is typing.\n if (str(v) !== input.value && !input.validity?.badInput) input.value = str(v);\n },\n _events,\n });\n let a: Adapter;\n\n if (type === 'checkbox') {\n const own = el.hasAttribute('value') && input.value !== 'on';\n a = {\n _read: () => {\n const cur = current();\n if (Array.isArray(cur)) {\n const set = new Set(cur);\n input.checked ? set.add(input.value) : set.delete(input.value);\n return [...set];\n }\n return own ? (input.checked ? input.value : '') : input.checked;\n },\n _write: (v) => {\n input.checked = Array.isArray(v) ? v.includes(input.value) : own ? v === input.value : !!v;\n },\n _events: ['input'],\n };\n } else if (type === 'radio') {\n input.name ||= path;\n a = {\n _read: () => (input.checked ? asNumber(input.value) : current()),\n _write: (v) => (input.checked = String(v) === input.value),\n _events: ['input'],\n };\n } else if (type === 'file') {\n listen(el, 'change', () => readFiles(input).then((files) => store.set(path, files)));\n return;\n } else if (type) {\n const numeric = type === 'number' || type === 'range';\n a = valued(() => (numeric && input.value !== '' ? +input.value : input.value), 'input');\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 = str(v);\n },\n _events: ['change'],\n };\n } else if ('value' in el) {\n a = valued(() => input.value, 'input', 'change');\n } else {\n a = {\n _read: () => el.getAttribute('value'),\n _write: (v) => el.setAttribute('value', str(v)),\n _events: ['change'],\n };\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 t of [...(mods.get('event') ?? a._events), 'sigmx-prop-change']) listen(el, t, sync);\n effect(() => a._write(current())); // undefined (removed signal) clears the field\n});\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,WAAW;AAIpB,MAAM,MAAM,CAAC,MAAe,OAAO,KAAK,EAAE;AAE1C,MAAM,YAAY,CAAC,UACjB,QAAQ;AAAA,EACN,CAAC,GAAI,MAAM,SAAS,CAAC,CAAE,EAAE;AAAA,IACvB,CAAC,MACC,IAAI,QAAwE,CAAC,YAAY;AACvF,YAAM,IAAI,IAAI,WAAW;AACzB,QAAE,YAAY,MACZ,QAAQ,EAAE,MAAM,EAAE,MAAM,MAAM,EAAE,MAAM,MAAM,EAAE,MAAM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,MAC9CC,GAAS,CAAC,QAAQ;AAAA,IACpB;AAAA,EACF;AAEA,MAAI,CAAC,MAAM,IAAI,IAAI,GAAG;AACpB,UAAM,UAAU,EAAEF,EAAM;AACxB,QAAI,YAAY,UAAa,YAAY,GAAI,OAAM,IAAI,MAAM,OAAO;AAAA,EACtE;AACA,QAAM,OAAO,MAAM,MAAM,IAAI,MAAM,EAAEA,EAAM,CAAC;AAC5C,aAAW,KAAK,CAAC,GAAI,KAAK,IAAI,OAAO,KAAK,EAAEE,GAAU,mBAAmB,EAAG,QAAO,IAAI,GAAG,IAAI;AAC9F,SAAO,MAAM,EAAED,EAAO,QAAQ,CAAC,CAAC;AAClC,CAAC;",
|
|
6
6
|
"names": ["_read", "_write", "_events"]
|
|
7
7
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { dir } from "../def.js";
|
|
2
2
|
const parse = (s) => {
|
|
3
3
|
try {
|
|
4
4
|
return JSON.parse(s);
|
|
@@ -6,69 +6,45 @@ const parse = (s) => {
|
|
|
6
6
|
return s;
|
|
7
7
|
}
|
|
8
8
|
};
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
const enc = (v) => typeof v === "string" ? v : JSON.stringify(v);
|
|
10
|
+
const same = (a, b) => enc(a) === enc(b);
|
|
11
|
+
const params = () => new URLSearchParams(location.search);
|
|
12
|
+
const queryString = dir("query-string", 1, ({ key, value, mods, evaluate, cased, store, listen, effect }) => {
|
|
13
|
+
const history = mods.has("history");
|
|
14
|
+
let restoring = false;
|
|
15
|
+
const wire = (read, write) => {
|
|
16
|
+
effect(() => {
|
|
17
|
+
const q = params();
|
|
18
|
+
write(q);
|
|
19
|
+
if (restoring) return;
|
|
20
|
+
const qs = String(q);
|
|
21
|
+
const url = `${location.pathname}${qs ? `?${qs}` : ""}${location.hash}`;
|
|
15
22
|
if (url !== location.pathname + location.search + location.hash)
|
|
16
23
|
window.history[history ? "pushState" : "replaceState"](null, "", url);
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
if (key) {
|
|
29
|
-
const path = cased();
|
|
30
|
-
const fallback = value ? evaluate() : "";
|
|
31
|
-
const fromUrl2 = () => {
|
|
32
|
-
const raw = new URLSearchParams(location.search).get(key);
|
|
33
|
-
store.set(path, raw === null ? fallback : parse(raw));
|
|
34
|
-
};
|
|
35
|
-
if (!store.has(path) || new URLSearchParams(location.search).has(key)) fromUrl2();
|
|
36
|
-
effect(() => {
|
|
37
|
-
const v = store.get(path);
|
|
38
|
-
if (restoring) return;
|
|
39
|
-
const q = new URLSearchParams(location.search);
|
|
40
|
-
if (v === void 0 || same(v, fallback)) q.delete(key);
|
|
41
|
-
else q.set(key, typeof v === "string" ? v : JSON.stringify(v));
|
|
42
|
-
push(urlWith(q));
|
|
24
|
+
});
|
|
25
|
+
if (history)
|
|
26
|
+
listen(window, "popstate", () => {
|
|
27
|
+
restoring = true;
|
|
28
|
+
try {
|
|
29
|
+
read(params());
|
|
30
|
+
} finally {
|
|
31
|
+
restoring = false;
|
|
32
|
+
}
|
|
43
33
|
});
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
const
|
|
48
|
-
const
|
|
49
|
-
const
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
store.merge(patch);
|
|
34
|
+
};
|
|
35
|
+
{
|
|
36
|
+
const name = key;
|
|
37
|
+
const path = cased();
|
|
38
|
+
const fallback = value ? evaluate() : "";
|
|
39
|
+
const read = (q) => {
|
|
40
|
+
const raw = q.get(name);
|
|
41
|
+
store.set(path, raw === null ? fallback : typeof fallback === "string" ? raw : parse(raw));
|
|
53
42
|
};
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
const q = new URLSearchParams(location.search);
|
|
59
|
-
const walk = (obj, prefix) => {
|
|
60
|
-
for (const k in obj) {
|
|
61
|
-
const p = prefix ? `${prefix}.${k}` : k;
|
|
62
|
-
const v = obj[k];
|
|
63
|
-
if (v && typeof v === "object" && !Array.isArray(v)) walk(v, p);
|
|
64
|
-
else if (mods.has("filter") && (v === "" || v == null)) q.delete(p);
|
|
65
|
-
else q.set(p, typeof v === "string" ? v : JSON.stringify(v));
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
walk(snap, "");
|
|
69
|
-
push(urlWith(q));
|
|
43
|
+
if (!store.has(path) || params().has(name)) read(params());
|
|
44
|
+
wire(read, (q) => {
|
|
45
|
+
const v = store.get(path);
|
|
46
|
+
v === void 0 || same(v, fallback) ? q.delete(name) : q.set(name, enc(v));
|
|
70
47
|
});
|
|
71
|
-
if (history) listen(window, "popstate", () => restore(fromUrl));
|
|
72
48
|
}
|
|
73
49
|
});
|
|
74
50
|
export {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/plugins/directives/url-params.ts"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": "AAAA,SAAS,WAAW
|
|
6
|
-
"names": [
|
|
4
|
+
"sourcesContent": ["import { dir } from '../def.js';\n\nconst parse = (s: string): unknown => {\n try {\n return JSON.parse(s);\n } catch {\n return s;\n }\n};\nconst enc = (v: unknown) => (typeof v === 'string' ? v : JSON.stringify(v));\nconst same = (a: unknown, b: unknown) => enc(a) === enc(b);\nconst params = () => new URLSearchParams(location.search);\n\n/**\n * Keeps signals and the URL query string in step.\n *\n * Keyed form declares one signal with a default: `query-string:page=\"1\"` creates `page`, reads\n * `?page=` on load when present (otherwise uses the default), writes it whenever it changes, and\n * drops the parameter again when the value is back at the default. The parameter name is the key\n * as written; the signal name is recased as usual.\n *\n * Bare form syncs existing signals: `query-string=\"{ include: /^(q|sort)$/ }\"` mirrors matching\n * paths both ways. `__history` pushes an entry per change and restores on back/forward;\n * `__filter` drops empty values from the URL.\n */\nexport const queryString = dir('query-string', 1, ({ key, value, mods, evaluate, cased, store, listen, effect }) => {\n const history = mods.has('history');\n let restoring = false;\n /** `read` pulls signals from the query; `write` puts them into it. Reads are wired to back/forward. */\n const wire = (read: (q: URLSearchParams) => void, write: (q: URLSearchParams) => void) => {\n effect(() => {\n const q = params();\n write(q);\n if (restoring) return;\n const qs = String(q);\n const url = `${location.pathname}${qs ? `?${qs}` : ''}${location.hash}`;\n if (url !== location.pathname + location.search + location.hash)\n window.history[history ? 'pushState' : 'replaceState'](null, '', url);\n });\n if (history)\n listen(window, 'popstate', () => {\n restoring = true;\n try {\n read(params());\n } finally {\n restoring = false;\n }\n });\n };\n\n {\n const name = key as string;\n const path = cased();\n const fallback = value ? evaluate() : '';\n const read = (q: URLSearchParams) => {\n const raw = q.get(name);\n // The parameter takes the default's type: a string default keeps '007' a string, a number default parses.\n store.set(path, raw === null ? fallback : typeof fallback === 'string' ? raw : parse(raw));\n };\n if (!store.has(path) || params().has(name)) read(params());\n wire(read, (q) => {\n const v = store.get(path);\n v === undefined || same(v, fallback) ? q.delete(name) : q.set(name, enc(v));\n });\n }\n});\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,WAAW;AAEpB,MAAM,QAAQ,CAAC,MAAuB;AACpC,MAAI;AACF,WAAO,KAAK,MAAM,CAAC;AAAA,EACrB,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AACA,MAAM,MAAM,CAAC,MAAgB,OAAO,MAAM,WAAW,IAAI,KAAK,UAAU,CAAC;AACzE,MAAM,OAAO,CAAC,GAAY,MAAe,IAAI,CAAC,MAAM,IAAI,CAAC;AACzD,MAAM,SAAS,MAAM,IAAI,gBAAgB,SAAS,MAAM;AAcjD,MAAM,cAAc,IAAI,gBAAgB,GAAG,CAAC,EAAE,KAAK,OAAO,MAAM,UAAU,OAAO,OAAO,QAAQ,OAAO,MA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|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
});
|
|
1
|
+
import { dir } from "../def.js";
|
|
2
|
+
const replaceUrl = dir(
|
|
3
|
+
"replace-url",
|
|
4
|
+
6,
|
|
5
|
+
({ evaluate, effect }) => effect(() => history.replaceState(history.state, "", new URL(String(evaluate()), location.href)))
|
|
6
|
+
);
|
|
8
7
|
export {
|
|
9
8
|
replaceUrl
|
|
10
9
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/plugins/directives/url-replace.ts"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": "AAAA,SAAS,
|
|
4
|
+
"sourcesContent": ["import { dir } from '../def.js';\n\nexport const replaceUrl = dir('replace-url', 6, ({ evaluate, effect }) =>\n effect(() => history.replaceState(history.state, '', new URL(String(evaluate()), location.href))),\n);\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,WAAW;AAEb,MAAM,aAAa;AAAA,EAAI;AAAA,EAAe;AAAA,EAAG,CAAC,EAAE,UAAU,OAAO,MAClE,OAAO,MAAM,QAAQ,aAAa,QAAQ,OAAO,IAAI,IAAI,IAAI,OAAO,SAAS,CAAC,GAAG,SAAS,IAAI,CAAC,CAAC;AAClG;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
const customValidity =
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
if (!("setCustomValidity" in el)) throw error("only works on form fields");
|
|
8
|
-
effect(() => el.setCustomValidity(String(evaluate() ?? "")));
|
|
9
|
-
}
|
|
1
|
+
import { dir } from "../def.js";
|
|
2
|
+
const customValidity = dir("custom-validity", 6, ({ el, evaluate, effect, error }) => {
|
|
3
|
+
if (!("setCustomValidity" in el)) throw error("only works on form fields");
|
|
4
|
+
const field = el;
|
|
5
|
+
effect(() => field.setCustomValidity(String(evaluate() ?? "")));
|
|
6
|
+
return () => field.setCustomValidity("");
|
|
10
7
|
});
|
|
11
8
|
export {
|
|
12
9
|
customValidity
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/plugins/directives/validity.ts"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": "AAAA,SAAS,
|
|
4
|
+
"sourcesContent": ["import { dir } from '../def.js';\n\n/** The expression's string becomes the field's validity message; '' means valid. */\nexport const customValidity = dir('custom-validity', 6, ({ el, evaluate, effect, error }) => {\n if (!('setCustomValidity' in el)) throw error('only works on form fields');\n const field = el as HTMLInputElement;\n effect(() => field.setCustomValidity(String(evaluate() ?? '')));\n return () => field.setCustomValidity('');\n});\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,WAAW;AAGb,MAAM,iBAAiB,IAAI,mBAAmB,GAAG,CAAC,EAAE,IAAI,UAAU,QAAQ,MAAM,MAAM;AAC3F,MAAI,EAAE,uBAAuB,IAAK,OAAM,MAAM,2BAA2B;AACzE,QAAM,QAAQ;AACd,SAAO,MAAM,MAAM,kBAAkB,OAAO,SAAS,KAAK,EAAE,CAAC,CAAC;AAC9D,SAAO,MAAM,MAAM,kBAAkB,EAAE;AACzC,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,29 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
if (mods.has("once")) io.disconnect();
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
|
-
{ threshold }
|
|
23
|
-
);
|
|
24
|
-
io.observe(el);
|
|
25
|
-
return () => io.disconnect();
|
|
26
|
-
}
|
|
1
|
+
import { withTiming } from "../../kernel/index.js";
|
|
2
|
+
import { dir } from "../def.js";
|
|
3
|
+
const onIntersect = dir("on-intersect", 22, ({ el, mods, evaluate, cleanup }) => {
|
|
4
|
+
const t = +(mods.get("threshold")?.join(".") ?? 0);
|
|
5
|
+
const threshold = Number.isFinite(t) ? Math.min(100, Math.max(0, t)) / 100 : 0;
|
|
6
|
+
const run = withTiming(() => evaluate(), mods, cleanup);
|
|
7
|
+
const io = new IntersectionObserver(
|
|
8
|
+
(entries) => {
|
|
9
|
+
for (const e of entries) {
|
|
10
|
+
if (e.isIntersecting === mods.has("exit")) continue;
|
|
11
|
+
run();
|
|
12
|
+
if (mods.has("once")) io.disconnect();
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
{ threshold }
|
|
16
|
+
);
|
|
17
|
+
io.observe(el);
|
|
18
|
+
return () => io.disconnect();
|
|
27
19
|
});
|
|
28
20
|
export {
|
|
29
21
|
onIntersect
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/plugins/directives/viewport.ts"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": "AAAA,SAAS,
|
|
4
|
+
"sourcesContent": ["import { withTiming } from '../../kernel/index.js';\nimport { dir } from '../def.js';\n\n/** Runs when the element enters the viewport. Modifiers: once, exit, full, half, threshold.N. */\nexport const onIntersect = dir('on-intersect', 22, ({ el, mods, evaluate, cleanup }) => {\n const t = +(mods.get('threshold')?.join('.') ?? 0);\n const threshold = Number.isFinite(t) ? Math.min(100, Math.max(0, t)) / 100 : 0;\n const run = withTiming(() => evaluate(), mods, cleanup);\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"],
|
|
5
|
+
"mappings": "AAAA,SAAS,kBAAkB;AAC3B,SAAS,WAAW;AAGb,MAAM,cAAc,IAAI,gBAAgB,IAAI,CAAC,EAAE,IAAI,MAAM,UAAU,QAAQ,MAAM;AACtF,QAAM,IAAI,EAAE,KAAK,IAAI,WAAW,GAAG,KAAK,GAAG,KAAK;AAChD,QAAM,YAAY,OAAO,SAAS,CAAC,IAAI,KAAK,IAAI,KAAK,KAAK,IAAI,GAAG,CAAC,CAAC,IAAI,MAAM;AAC7E,QAAM,MAAM,WAAW,MAAM,SAAS,GAAG,MAAM,OAAO;AACtD,QAAM,KAAK,IAAI;AAAA,IACb,CAAC,YAAY;AACX,iBAAW,KAAK,SAAS;AACvB,YAAI,EAAE,mBAAmB,KAAK,IAAI,MAAM,EAAG;AAC3C,YAAI;AACJ,YAAI,KAAK,IAAI,MAAM,EAAG,IAAG,WAAW;AAAA,MACtC;AAAA,IACF;AAAA,IACA,EAAE,UAAU;AAAA,EACd;AACA,KAAG,QAAQ,EAAE;AACb,SAAO,MAAM,GAAG,WAAW;AAC7B,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,17 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
const show =
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
});
|
|
11
|
-
return () => {
|
|
12
|
-
el.style.display = initial;
|
|
13
|
-
};
|
|
14
|
-
}
|
|
1
|
+
import { dir } from "../def.js";
|
|
2
|
+
const show = dir("show", 6, ({ el, evaluate, effect }) => {
|
|
3
|
+
const initial = el.style.display === "none" ? "" : el.style.display;
|
|
4
|
+
effect(() => {
|
|
5
|
+
el.style.display = evaluate() ? initial : "none";
|
|
6
|
+
});
|
|
7
|
+
return () => {
|
|
8
|
+
el.style.display = initial;
|
|
9
|
+
};
|
|
15
10
|
});
|
|
16
11
|
export {
|
|
17
12
|
show
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/plugins/directives/visibility.ts"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": "AAAA,SAAS,
|
|
4
|
+
"sourcesContent": ["import { dir } from '../def.js';\n\n/** Toggles `display: none`, restoring whatever inline display the element had. */\nexport const show = dir('show', 6, ({ 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"],
|
|
5
|
+
"mappings": "AAAA,SAAS,WAAW;AAGb,MAAM,OAAO,IAAI,QAAQ,GAAG,CAAC,EAAE,IAAI,UAAU,OAAO,MAAM;AAC/D,QAAM,UAAU,GAAG,MAAM,YAAY,SAAS,KAAK,GAAG,MAAM;AAC5D,SAAO,MAAM;AACX,OAAG,MAAM,UAAU,SAAS,IAAI,UAAU;AAAA,EAC5C,CAAC;AACD,SAAO,MAAM;AACX,OAAG,MAAM,UAAU;AAAA,EACrB;AACF,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
const effect =
|
|
3
|
-
name: "effect",
|
|
4
|
-
key: "forbidden",
|
|
5
|
-
value: "required",
|
|
6
|
-
returns: false,
|
|
7
|
-
mount: (ctx) => ctx.effect(() => ctx.evaluate())
|
|
8
|
-
});
|
|
1
|
+
import { dir } from "../def.js";
|
|
2
|
+
const effect = dir("effect", 22, (ctx) => ctx.effect(() => ctx.evaluate()));
|
|
9
3
|
export {
|
|
10
4
|
effect
|
|
11
5
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/plugins/directives/watch.ts"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": "AAAA,SAAS,
|
|
4
|
+
"sourcesContent": ["import { dir } from '../def.js';\n\nexport const effect = dir('effect', 22, (ctx) => ctx.effect(() => ctx.evaluate()));\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,WAAW;AAEb,MAAM,SAAS,IAAI,UAAU,IAAI,CAAC,QAAQ,IAAI,OAAO,MAAM,IAAI,SAAS,CAAC,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|