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,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,68 +6,45 @@ const parse = (s) => {
|
|
|
6
6
|
return s;
|
|
7
7
|
}
|
|
8
8
|
};
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
};
|
|
17
|
-
const urlWith = (q) => `${location.pathname}${q.size ? `?${q}` : ""}${location.hash}`;
|
|
18
|
-
let restoring = false;
|
|
19
|
-
const restore = (fn) => {
|
|
20
|
-
restoring = true;
|
|
21
|
-
try {
|
|
22
|
-
fn();
|
|
23
|
-
} finally {
|
|
24
|
-
restoring = false;
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
if (key) {
|
|
28
|
-
const path = cased();
|
|
29
|
-
const fallback = value ? evaluate() : "";
|
|
30
|
-
const fromUrl2 = () => {
|
|
31
|
-
const raw = new URLSearchParams(location.search).get(key);
|
|
32
|
-
store.set(path, raw === null ? fallback : parse(raw));
|
|
33
|
-
};
|
|
34
|
-
if (!store.has(path) || new URLSearchParams(location.search).has(key)) fromUrl2();
|
|
35
|
-
effect(() => {
|
|
36
|
-
const v = store.get(path);
|
|
37
|
-
if (restoring) return;
|
|
38
|
-
const q = new URLSearchParams(location.search);
|
|
39
|
-
if (v === void 0 || same(v, fallback)) q.delete(key);
|
|
40
|
-
else q.set(key, typeof v === "string" ? v : JSON.stringify(v));
|
|
41
|
-
push(urlWith(q));
|
|
42
|
-
});
|
|
43
|
-
if (history) listen(window, "popstate", () => restore(fromUrl2));
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
const filter = value ? evaluate() : void 0;
|
|
47
|
-
const ok = toPredicate(filter);
|
|
48
|
-
const fromUrl = () => {
|
|
49
|
-
const patch = {};
|
|
50
|
-
for (const [k, v] of new URLSearchParams(location.search)) if (ok(k)) expand(patch, k, parse(v));
|
|
51
|
-
store.merge(patch);
|
|
52
|
-
};
|
|
53
|
-
fromUrl();
|
|
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) => {
|
|
54
16
|
effect(() => {
|
|
55
|
-
const
|
|
17
|
+
const q = params();
|
|
18
|
+
write(q);
|
|
56
19
|
if (restoring) return;
|
|
57
|
-
const
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
20
|
+
const qs = String(q);
|
|
21
|
+
const url = `${location.pathname}${qs ? `?${qs}` : ""}${location.hash}`;
|
|
22
|
+
if (url !== location.pathname + location.search + location.hash)
|
|
23
|
+
window.history[history ? "pushState" : "replaceState"](null, "", url);
|
|
24
|
+
});
|
|
25
|
+
if (history)
|
|
26
|
+
listen(window, "popstate", () => {
|
|
27
|
+
restoring = true;
|
|
28
|
+
try {
|
|
29
|
+
read(params());
|
|
30
|
+
} finally {
|
|
31
|
+
restoring = false;
|
|
65
32
|
}
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
|
|
33
|
+
});
|
|
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));
|
|
42
|
+
};
|
|
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));
|
|
69
47
|
});
|
|
70
|
-
if (history) listen(window, "popstate", () => restore(fromUrl));
|
|
71
48
|
}
|
|
72
49
|
});
|
|
73
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,MAAM;AAClH,QAAM,UAAU,KAAK,IAAI,SAAS;AAClC,MAAI,YAAY;AAEhB,QAAM,OAAO,CAAC,MAAoC,UAAwC;AACxF,WAAO,MAAM;AACX,YAAM,IAAI,OAAO;AACjB,YAAM,CAAC;AACP,UAAI,UAAW;AACf,YAAM,KAAK,OAAO,CAAC;AACnB,YAAM,MAAM,GAAG,SAAS,QAAQ,GAAG,KAAK,IAAI,EAAE,KAAK,EAAE,GAAG,SAAS,IAAI;AACrE,UAAI,QAAQ,SAAS,WAAW,SAAS,SAAS,SAAS;AACzD,eAAO,QAAQ,UAAU,cAAc,cAAc,EAAE,MAAM,IAAI,GAAG;AAAA,IACxE,CAAC;AACD,QAAI;AACF,aAAO,QAAQ,YAAY,MAAM;AAC/B,oBAAY;AACZ,YAAI;AACF,eAAK,OAAO,CAAC;AAAA,QACf,UAAE;AACA,sBAAY;AAAA,QACd;AAAA,MACF,CAAC;AAAA,EACL;AAEA;AACE,UAAM,OAAO;AACb,UAAM,OAAO,MAAM;AACnB,UAAM,WAAW,QAAQ,SAAS,IAAI;AACtC,UAAM,OAAO,CAAC,MAAuB;AACnC,YAAM,MAAM,EAAE,IAAI,IAAI;AAEtB,YAAM,IAAI,MAAM,QAAQ,OAAO,WAAW,OAAO,aAAa,WAAW,MAAM,MAAM,GAAG,CAAC;AAAA,IAC3F;AACA,QAAI,CAAC,MAAM,IAAI,IAAI,KAAK,OAAO,EAAE,IAAI,IAAI,EAAG,MAAK,OAAO,CAAC;AACzD,SAAK,MAAM,CAAC,MAAM;AAChB,YAAM,IAAI,MAAM,IAAI,IAAI;AACxB,YAAM,UAAa,KAAK,GAAG,QAAQ,IAAI,EAAE,OAAO,IAAI,IAAI,EAAE,IAAI,MAAM,IAAI,CAAC,CAAC;AAAA,IAC5E,CAAC;AAAA,EACH;AACF,CAAC;",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
const replaceUrl =
|
|
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,26 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
{ threshold }
|
|
20
|
-
);
|
|
21
|
-
io.observe(el);
|
|
22
|
-
return () => io.disconnect();
|
|
23
|
-
}
|
|
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();
|
|
24
19
|
});
|
|
25
20
|
export {
|
|
26
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
|
}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
});
|
|
1
|
+
import { batch, untracked } from "../../kernel/index.js";
|
|
2
|
+
import { act } from "../def.js";
|
|
3
|
+
const setAll = act(
|
|
4
|
+
"setAll",
|
|
5
|
+
({ store }, value, filter) => batch(
|
|
6
|
+
() => untracked(() => {
|
|
7
|
+
for (const p of store.paths(filter, { computed: false })) store.set(p, value);
|
|
8
|
+
})
|
|
9
|
+
)
|
|
10
|
+
);
|
|
8
11
|
export {
|
|
9
12
|
setAll
|
|
10
13
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/plugins/functions/bulk-set.ts"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": "AAAA,SAAS,
|
|
4
|
+
"sourcesContent": ["import { batch, type Filter, untracked } from '../../kernel/index.js';\nimport { act } from '../def.js';\n\n/** `@setAll(value, { include: /^form\\./ })` assigns every matching signal. */\nexport const setAll = act('setAll', ({ store }, value: unknown, filter?: Filter) =>\n batch(() =>\n untracked(() => {\n for (const p of store.paths(filter, { computed: false })) store.set(p, value);\n }),\n ),\n);\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,OAAoB,iBAAiB;AAC9C,SAAS,WAAW;AAGb,MAAM,SAAS;AAAA,EAAI;AAAA,EAAU,CAAC,EAAE,MAAM,GAAG,OAAgB,WAC9D;AAAA,IAAM,MACJ,UAAU,MAAM;AACd,iBAAW,KAAK,MAAM,MAAM,QAAQ,EAAE,UAAU,MAAM,CAAC,EAAG,OAAM,IAAI,GAAG,KAAK;AAAA,IAC9E,CAAC;AAAA,EACH;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
});
|
|
1
|
+
import { batch, untracked } from "../../kernel/index.js";
|
|
2
|
+
import { act } from "../def.js";
|
|
3
|
+
const toggleAll = act(
|
|
4
|
+
"toggleAll",
|
|
5
|
+
({ store }, filter) => batch(
|
|
6
|
+
() => untracked(() => {
|
|
7
|
+
for (const p of store.paths(filter, { computed: false })) store.set(p, !store.get(p));
|
|
8
|
+
})
|
|
9
|
+
)
|
|
10
|
+
);
|
|
8
11
|
export {
|
|
9
12
|
toggleAll
|
|
10
13
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/plugins/functions/bulk-toggle.ts"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": "AAAA,SAAS,
|
|
4
|
+
"sourcesContent": ["import { batch, type Filter, untracked } from '../../kernel/index.js';\nimport { act } from '../def.js';\n\n/** `@toggleAll({ include: /^flags\\./ })` negates every matching boolean signal. */\nexport const toggleAll = act('toggleAll', ({ store }, filter?: Filter) =>\n batch(() =>\n untracked(() => {\n for (const p of store.paths(filter, { computed: false })) store.set(p, !store.get(p));\n }),\n ),\n);\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,OAAoB,iBAAiB;AAC9C,SAAS,WAAW;AAGb,MAAM,YAAY;AAAA,EAAI;AAAA,EAAa,CAAC,EAAE,MAAM,GAAG,WACpD;AAAA,IAAM,MACJ,UAAU,MAAM;AACd,iBAAW,KAAK,MAAM,MAAM,QAAQ,EAAE,UAAU,MAAM,CAAC,EAAG,OAAM,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC;AAAA,IACtF,CAAC;AAAA,EACH;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
const confirm =
|
|
1
|
+
import { act } from "../def.js";
|
|
2
|
+
const confirm = act("confirm", (_, message) => window.confirm(message));
|
|
3
3
|
export {
|
|
4
4
|
confirm
|
|
5
5
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/plugins/functions/confirm.ts"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": "AAAA,SAAS,
|
|
4
|
+
"sourcesContent": ["import { act } from '../def.js';\n\n/** `@confirm('Delete?') && @delete('/x')` asks before continuing. */\nexport const confirm = act('confirm', (_, message: string) => window.confirm(message));\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,WAAW;AAGb,MAAM,UAAU,IAAI,WAAW,CAAC,GAAG,YAAoB,OAAO,QAAQ,OAAO,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
const clipboard =
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { act } from "../def.js";
|
|
2
|
+
const clipboard = act(
|
|
3
|
+
"clipboard",
|
|
4
|
+
(_, text, base64 = false) => navigator.clipboard.writeText(
|
|
5
5
|
base64 ? new TextDecoder().decode(Uint8Array.from(atob(text), (c) => c.charCodeAt(0))) : text
|
|
6
6
|
)
|
|
7
|
-
|
|
7
|
+
);
|
|
8
8
|
export {
|
|
9
9
|
clipboard
|
|
10
10
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/plugins/functions/copy-text.ts"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": "AAAA,SAAS,
|
|
4
|
+
"sourcesContent": ["import { act } from '../def.js';\n\n/** `@clipboard(text, isBase64?)` copies text; base64 input is decoded first. */\nexport const clipboard = act('clipboard', (_, text: string, base64 = false) =>\n navigator.clipboard.writeText(\n base64 ? new TextDecoder().decode(Uint8Array.from(atob(text), (c) => c.charCodeAt(0))) : text,\n ),\n);\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,WAAW;AAGb,MAAM,YAAY;AAAA,EAAI;AAAA,EAAa,CAAC,GAAG,MAAc,SAAS,UACnE,UAAU,UAAU;AAAA,IAClB,SAAS,IAAI,YAAY,EAAE,OAAO,WAAW,KAAK,KAAK,IAAI,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,IAAI;AAAA,EAC3F;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
const dispatch =
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { act } from "../def.js";
|
|
2
|
+
const dispatch = act(
|
|
3
|
+
"dispatch",
|
|
4
|
+
({ el }, name, detail) => el.dispatchEvent(new CustomEvent(name, { detail, bubbles: true, composed: true }))
|
|
5
|
+
);
|
|
6
6
|
export {
|
|
7
7
|
dispatch
|
|
8
8
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/plugins/functions/dispatch.ts"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": "AAAA,SAAS,
|
|
4
|
+
"sourcesContent": ["import { act } from '../def.js';\n\n/** `@dispatch('name', detail)` fires a bubbling CustomEvent from the element. */\nexport const dispatch = act('dispatch', ({ el }, name: string, detail?: unknown) =>\n el.dispatchEvent(new CustomEvent(name, { detail, bubbles: true, composed: true })),\n);\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,WAAW;AAGb,MAAM,WAAW;AAAA,EAAI;AAAA,EAAY,CAAC,EAAE,GAAG,GAAG,MAAc,WAC7D,GAAG,cAAc,IAAI,YAAY,MAAM,EAAE,QAAQ,SAAS,MAAM,UAAU,KAAK,CAAC,CAAC;AACnF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* `@intl('NumberFormat', 1234.5, { style: 'currency', currency: 'EUR' }, 'de')` formats with the named
|
|
3
|
+
* `Intl` API (NumberFormat, DateTimeFormat, PluralRules, RelativeTimeFormat as `[value, unit]`, ListFormat, DisplayNames).
|
|
4
|
+
*/
|
|
2
5
|
export declare const intl: import("../../kernel/contracts.js").ActionPlugin;
|
|
@@ -1,20 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
};
|
|
10
|
-
const intl = action({
|
|
11
|
-
name: "intl",
|
|
12
|
-
call: ({ error }, type, value, options, locale) => {
|
|
13
|
-
const f = formats[type];
|
|
14
|
-
if (!f) throw error(`unknown @intl type "${type}"`);
|
|
15
|
-
return f(locale, value, options);
|
|
1
|
+
import { act } from "../def.js";
|
|
2
|
+
const intl = act(
|
|
3
|
+
"intl",
|
|
4
|
+
({ error }, type, value, options, locale) => {
|
|
5
|
+
const C = Intl[type];
|
|
6
|
+
if (!C) throw error(`unknown @intl type "${type}"`);
|
|
7
|
+
const f = new C(locale, options);
|
|
8
|
+
return (f.select ?? f.of ?? f.format).call(f, ...type === "RelativeTimeFormat" ? value : [value]) ?? "";
|
|
16
9
|
}
|
|
17
|
-
|
|
10
|
+
);
|
|
18
11
|
export {
|
|
19
12
|
intl
|
|
20
13
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/plugins/functions/locale-format.ts"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": "AAAA,SAAS,
|
|
4
|
+
"sourcesContent": ["import { act } from '../def.js';\n\n/**\n * `@intl('NumberFormat', 1234.5, { style: 'currency', currency: 'EUR' }, 'de')` formats with the named\n * `Intl` API (NumberFormat, DateTimeFormat, PluralRules, RelativeTimeFormat as `[value, unit]`, ListFormat, DisplayNames).\n */\nexport const intl = act(\n 'intl',\n ({ error }, type: string, value: any, options?: Record<string, unknown>, locale?: string | string[]) => {\n const C = (Intl as any)[type];\n if (!C) throw error(`unknown @intl type \"${type}\"`);\n const f = new C(locale, options);\n return (f.select ?? f.of ?? f.format).call(f, ...(type === 'RelativeTimeFormat' ? value : [value])) ?? '';\n },\n);\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,WAAW;AAMb,MAAM,OAAO;AAAA,EAClB;AAAA,EACA,CAAC,EAAE,MAAM,GAAG,MAAc,OAAY,SAAmC,WAA+B;AACtG,UAAM,IAAK,KAAa,IAAI;AAC5B,QAAI,CAAC,EAAG,OAAM,MAAM,uBAAuB,IAAI,GAAG;AAClD,UAAM,IAAI,IAAI,EAAE,QAAQ,OAAO;AAC/B,YAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,KAAK,GAAG,GAAI,SAAS,uBAAuB,QAAQ,CAAC,KAAK,CAAE,KAAK;AAAA,EACzG;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
const fit =
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
let t = (v - inMin) / (inMax - inMin);
|
|
1
|
+
import { act } from "../def.js";
|
|
2
|
+
const fit = act(
|
|
3
|
+
"fit",
|
|
4
|
+
(_, v, inMin, inMax, outMin, outMax, clamp = false, round = false) => {
|
|
5
|
+
let t = inMax === inMin ? 0 : (v - inMin) / (inMax - inMin);
|
|
6
6
|
if (clamp) t = Math.min(1, Math.max(0, t));
|
|
7
7
|
const out = outMin + t * (outMax - outMin);
|
|
8
8
|
return round ? Math.round(out) : out;
|
|
9
9
|
}
|
|
10
|
-
|
|
10
|
+
);
|
|
11
11
|
export {
|
|
12
12
|
fit
|
|
13
13
|
};
|