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.
Files changed (308) hide show
  1. package/README.md +54 -43
  2. package/dist/cli.js +3 -1
  3. package/dist/cli.js.map +2 -2
  4. package/dist/kernel/compile.d.ts +8 -9
  5. package/dist/kernel/compile.js +102 -67
  6. package/dist/kernel/compile.js.map +2 -2
  7. package/dist/kernel/contracts.d.ts +12 -13
  8. package/dist/kernel/index.d.ts +11 -12
  9. package/dist/kernel/index.js +14 -12
  10. package/dist/kernel/index.js.map +3 -3
  11. package/dist/kernel/precompile.d.ts +8 -12
  12. package/dist/kernel/precompile.js +33 -76
  13. package/dist/kernel/precompile.js.map +2 -2
  14. package/dist/kernel/precompiled.d.ts +7 -4
  15. package/dist/kernel/precompiled.js +5 -5
  16. package/dist/kernel/precompiled.js.map +2 -2
  17. package/dist/kernel/reactive.d.ts +13 -11
  18. package/dist/kernel/reactive.js +96 -71
  19. package/dist/kernel/reactive.js.map +3 -3
  20. package/dist/kernel/runtime.js +85 -63
  21. package/dist/kernel/runtime.js.map +3 -3
  22. package/dist/kernel/scan.d.ts +2 -11
  23. package/dist/kernel/scan.js +26 -9
  24. package/dist/kernel/scan.js.map +2 -2
  25. package/dist/kernel/state.d.ts +5 -8
  26. package/dist/kernel/state.js +114 -76
  27. package/dist/kernel/state.js.map +2 -2
  28. package/dist/kernel/strict-csp.d.ts +0 -5
  29. package/dist/kernel/strict-csp.js +2 -2
  30. package/dist/kernel/strict-csp.js.map +2 -2
  31. package/dist/lib/casing.d.ts +4 -1
  32. package/dist/lib/casing.js +8 -1
  33. package/dist/lib/casing.js.map +2 -2
  34. package/dist/lib/objects.d.ts +5 -4
  35. package/dist/lib/objects.js +13 -5
  36. package/dist/lib/objects.js.map +2 -2
  37. package/dist/lib/schedule.d.ts +3 -5
  38. package/dist/lib/schedule.js +12 -10
  39. package/dist/lib/schedule.js.map +2 -2
  40. package/dist/lib/sse.d.ts +10 -1
  41. package/dist/lib/sse.js +32 -28
  42. package/dist/lib/sse.js.map +2 -2
  43. package/dist/plugins/def.d.ts +5 -0
  44. package/dist/plugins/def.js +22 -0
  45. package/dist/plugins/def.js.map +7 -0
  46. package/dist/plugins/directives/attribute-sync.js +8 -12
  47. package/dist/plugins/directives/attribute-sync.js.map +2 -2
  48. package/dist/plugins/directives/boost.d.ts +1 -1
  49. package/dist/plugins/directives/boost.js +34 -30
  50. package/dist/plugins/directives/boost.js.map +2 -2
  51. package/dist/plugins/directives/busy-flag.js +13 -16
  52. package/dist/plugins/directives/busy-flag.js.map +2 -2
  53. package/dist/plugins/directives/class-toggle.js +17 -16
  54. package/dist/plugins/directives/class-toggle.js.map +2 -2
  55. package/dist/plugins/directives/cloak.js +2 -7
  56. package/dist/plugins/directives/cloak.js.map +2 -2
  57. package/dist/plugins/directives/collapse.js +36 -37
  58. package/dist/plugins/directives/collapse.js.map +2 -2
  59. package/dist/plugins/directives/declare.js +5 -8
  60. package/dist/plugins/directives/declare.js.map +2 -2
  61. package/dist/plugins/directives/derive.js +9 -15
  62. package/dist/plugins/directives/derive.js.map +2 -2
  63. package/dist/plugins/directives/element-ref.js +8 -8
  64. package/dist/plugins/directives/element-ref.js.map +2 -2
  65. package/dist/plugins/directives/event-listener.js +18 -23
  66. package/dist/plugins/directives/event-listener.js.map +2 -2
  67. package/dist/plugins/directives/frame-loop.js +9 -14
  68. package/dist/plugins/directives/frame-loop.js.map +2 -2
  69. package/dist/plugins/directives/html.js +6 -7
  70. package/dist/plugins/directives/html.js.map +2 -2
  71. package/dist/plugins/directives/inline-style.js +17 -20
  72. package/dist/plugins/directives/inline-style.js.map +2 -2
  73. package/dist/plugins/directives/mask.js +19 -23
  74. package/dist/plugins/directives/mask.js.map +2 -2
  75. package/dist/plugins/directives/media-query.d.ts +4 -1
  76. package/dist/plugins/directives/media-query.js +13 -12
  77. package/dist/plugins/directives/media-query.js.map +2 -2
  78. package/dist/plugins/directives/on-mount.js +4 -9
  79. package/dist/plugins/directives/on-mount.js.map +2 -2
  80. package/dist/plugins/directives/patch-listener.js +24 -19
  81. package/dist/plugins/directives/patch-listener.js.map +2 -2
  82. package/dist/plugins/directives/remove-me.js +7 -8
  83. package/dist/plugins/directives/remove-me.js.map +2 -2
  84. package/dist/plugins/directives/scroll-to.d.ts +4 -1
  85. package/dist/plugins/directives/scroll-to.js +8 -14
  86. package/dist/plugins/directives/scroll-to.js.map +2 -2
  87. package/dist/plugins/directives/size-watch.js +7 -12
  88. package/dist/plugins/directives/size-watch.js.map +2 -2
  89. package/dist/plugins/directives/state-dump.js +6 -10
  90. package/dist/plugins/directives/state-dump.js.map +2 -2
  91. package/dist/plugins/directives/storage-sync.js +13 -9
  92. package/dist/plugins/directives/storage-sync.js.map +2 -2
  93. package/dist/plugins/directives/teleport.js +8 -14
  94. package/dist/plugins/directives/teleport.js.map +2 -2
  95. package/dist/plugins/directives/text-content.js +6 -7
  96. package/dist/plugins/directives/text-content.js.map +2 -2
  97. package/dist/plugins/directives/timer.js +7 -13
  98. package/dist/plugins/directives/timer.js.map +2 -2
  99. package/dist/plugins/directives/transition.d.ts +1 -2
  100. package/dist/plugins/directives/transition.js +32 -34
  101. package/dist/plugins/directives/transition.js.map +2 -2
  102. package/dist/plugins/directives/tween.d.ts +2 -2
  103. package/dist/plugins/directives/tween.js +34 -50
  104. package/dist/plugins/directives/tween.js.map +2 -2
  105. package/dist/plugins/directives/two-way-bind.d.ts +1 -1
  106. package/dist/plugins/directives/two-way-bind.js +70 -67
  107. package/dist/plugins/directives/two-way-bind.js.map +2 -2
  108. package/dist/plugins/directives/url-params.js +36 -59
  109. package/dist/plugins/directives/url-params.js.map +3 -3
  110. package/dist/plugins/directives/url-replace.js +6 -7
  111. package/dist/plugins/directives/url-replace.js.map +2 -2
  112. package/dist/plugins/directives/validity.js +6 -9
  113. package/dist/plugins/directives/validity.js.map +2 -2
  114. package/dist/plugins/directives/viewport.js +18 -23
  115. package/dist/plugins/directives/viewport.js.map +2 -2
  116. package/dist/plugins/directives/visibility.js +9 -14
  117. package/dist/plugins/directives/visibility.js.map +2 -2
  118. package/dist/plugins/directives/watch.d.ts +0 -1
  119. package/dist/plugins/directives/watch.js +2 -8
  120. package/dist/plugins/directives/watch.js.map +2 -2
  121. package/dist/plugins/functions/bulk-set.js +10 -7
  122. package/dist/plugins/functions/bulk-set.js.map +2 -2
  123. package/dist/plugins/functions/bulk-toggle.js +10 -7
  124. package/dist/plugins/functions/bulk-toggle.js.map +2 -2
  125. package/dist/plugins/functions/confirm.js +2 -2
  126. package/dist/plugins/functions/confirm.js.map +2 -2
  127. package/dist/plugins/functions/copy-text.js +5 -5
  128. package/dist/plugins/functions/copy-text.js.map +2 -2
  129. package/dist/plugins/functions/dispatch.js +5 -5
  130. package/dist/plugins/functions/dispatch.js.map +2 -2
  131. package/dist/plugins/functions/locale-format.d.ts +4 -1
  132. package/dist/plugins/functions/locale-format.js +9 -16
  133. package/dist/plugins/functions/locale-format.js.map +2 -2
  134. package/dist/plugins/functions/range-map.js +6 -6
  135. package/dist/plugins/functions/range-map.js.map +2 -2
  136. package/dist/plugins/functions/request.d.ts +7 -3
  137. package/dist/plugins/functions/request.js +85 -80
  138. package/dist/plugins/functions/request.js.map +2 -2
  139. package/dist/plugins/functions/untracked-read.js +3 -2
  140. package/dist/plugins/functions/untracked-read.js.map +2 -2
  141. package/dist/plugins/functions/websocket.d.ts +3 -3
  142. package/dist/plugins/functions/websocket.js +18 -25
  143. package/dist/plugins/functions/websocket.js.map +2 -2
  144. package/dist/plugins/index.d.ts +34 -36
  145. package/dist/plugins/index.js +31 -35
  146. package/dist/plugins/index.js.map +2 -2
  147. package/dist/plugins/server-events/apply-elements.d.ts +1 -1
  148. package/dist/plugins/server-events/apply-elements.js +41 -40
  149. package/dist/plugins/server-events/apply-elements.js.map +2 -2
  150. package/dist/plugins/server-events/apply-state.js +9 -12
  151. package/dist/plugins/server-events/apply-state.js.map +2 -2
  152. package/dist/plugins/server-events/morph.d.ts +0 -2
  153. package/dist/plugins/server-events/morph.js +58 -55
  154. package/dist/plugins/server-events/morph.js.map +3 -3
  155. package/dist/presets/all.d.ts +0 -1
  156. package/dist/presets/all.js +22 -26
  157. package/dist/presets/all.js.map +2 -2
  158. package/dist/presets/essentials.d.ts +0 -1
  159. package/dist/presets/essentials.js +27 -9
  160. package/dist/presets/essentials.js.map +2 -2
  161. package/dist/presets/minimal.d.ts +0 -1
  162. package/dist/presets/minimal.js +2 -2
  163. package/dist/presets/minimal.js.map +2 -2
  164. package/dist/server.d.ts +108 -0
  165. package/dist/server.js +218 -0
  166. package/dist/server.js.map +7 -0
  167. package/dist/sigmx.standalone.js +1 -1
  168. package/dist/standalone.js.map +2 -2
  169. package/dist/vite.d.ts +2 -2
  170. package/dist/vite.js +48 -15
  171. package/dist/vite.js.map +2 -2
  172. package/package.json +21 -2
  173. package/dist/auto.d.ts +0 -1
  174. package/dist/auto.js +0 -7
  175. package/dist/auto.js.map +0 -7
  176. package/dist/core/csp.d.ts +0 -7
  177. package/dist/core/csp.js +0 -20
  178. package/dist/core/csp.js.map +0 -7
  179. package/dist/core/engine.d.ts +0 -10
  180. package/dist/core/engine.js +0 -200
  181. package/dist/core/engine.js.map +0 -7
  182. package/dist/core/expr.d.ts +0 -12
  183. package/dist/core/expr.js +0 -94
  184. package/dist/core/expr.js.map +0 -7
  185. package/dist/core/index.d.ts +0 -16
  186. package/dist/core/index.js +0 -46
  187. package/dist/core/index.js.map +0 -7
  188. package/dist/core/signals.d.ts +0 -42
  189. package/dist/core/signals.js +0 -195
  190. package/dist/core/signals.js.map +0 -7
  191. package/dist/core/store.d.ts +0 -32
  192. package/dist/core/store.js +0 -185
  193. package/dist/core/store.js.map +0 -7
  194. package/dist/core/types.d.ts +0 -101
  195. package/dist/core/types.js +0 -1
  196. package/dist/core/types.js.map +0 -7
  197. package/dist/plugins/actions/clipboard.d.ts +0 -2
  198. package/dist/plugins/actions/clipboard.js +0 -11
  199. package/dist/plugins/actions/clipboard.js.map +0 -7
  200. package/dist/plugins/actions/fit.d.ts +0 -2
  201. package/dist/plugins/actions/fit.js +0 -14
  202. package/dist/plugins/actions/fit.js.map +0 -7
  203. package/dist/plugins/actions/intl.d.ts +0 -2
  204. package/dist/plugins/actions/intl.js +0 -21
  205. package/dist/plugins/actions/intl.js.map +0 -7
  206. package/dist/plugins/actions/peek.d.ts +0 -2
  207. package/dist/plugins/actions/peek.js +0 -6
  208. package/dist/plugins/actions/peek.js.map +0 -7
  209. package/dist/plugins/actions/setAll.d.ts +0 -2
  210. package/dist/plugins/actions/setAll.js +0 -11
  211. package/dist/plugins/actions/setAll.js.map +0 -7
  212. package/dist/plugins/actions/toggleAll.d.ts +0 -2
  213. package/dist/plugins/actions/toggleAll.js +0 -11
  214. package/dist/plugins/actions/toggleAll.js.map +0 -7
  215. package/dist/plugins/attributes/attr.d.ts +0 -2
  216. package/dist/plugins/attributes/attr.js +0 -20
  217. package/dist/plugins/attributes/attr.js.map +0 -7
  218. package/dist/plugins/attributes/bind.d.ts +0 -6
  219. package/dist/plugins/attributes/bind.js +0 -81
  220. package/dist/plugins/attributes/bind.js.map +0 -7
  221. package/dist/plugins/attributes/class.d.ts +0 -2
  222. package/dist/plugins/attributes/class.js +0 -22
  223. package/dist/plugins/attributes/class.js.map +0 -7
  224. package/dist/plugins/attributes/computed.d.ts +0 -2
  225. package/dist/plugins/attributes/computed.js +0 -20
  226. package/dist/plugins/attributes/computed.js.map +0 -7
  227. package/dist/plugins/attributes/customValidity.d.ts +0 -2
  228. package/dist/plugins/attributes/customValidity.js +0 -14
  229. package/dist/plugins/attributes/customValidity.js.map +0 -7
  230. package/dist/plugins/attributes/effect.d.ts +0 -2
  231. package/dist/plugins/attributes/effect.js +0 -12
  232. package/dist/plugins/attributes/effect.js.map +0 -7
  233. package/dist/plugins/attributes/indicator.d.ts +0 -2
  234. package/dist/plugins/attributes/indicator.js +0 -20
  235. package/dist/plugins/attributes/indicator.js.map +0 -7
  236. package/dist/plugins/attributes/init.d.ts +0 -2
  237. package/dist/plugins/attributes/init.js +0 -14
  238. package/dist/plugins/attributes/init.js.map +0 -7
  239. package/dist/plugins/attributes/jsonSignals.d.ts +0 -2
  240. package/dist/plugins/attributes/jsonSignals.js +0 -15
  241. package/dist/plugins/attributes/jsonSignals.js.map +0 -7
  242. package/dist/plugins/attributes/matchMedia.d.ts +0 -2
  243. package/dist/plugins/attributes/matchMedia.js +0 -19
  244. package/dist/plugins/attributes/matchMedia.js.map +0 -7
  245. package/dist/plugins/attributes/on.d.ts +0 -5
  246. package/dist/plugins/attributes/on.js +0 -28
  247. package/dist/plugins/attributes/on.js.map +0 -7
  248. package/dist/plugins/attributes/onIntersect.d.ts +0 -2
  249. package/dist/plugins/attributes/onIntersect.js +0 -28
  250. package/dist/plugins/attributes/onIntersect.js.map +0 -7
  251. package/dist/plugins/attributes/onInterval.d.ts +0 -2
  252. package/dist/plugins/attributes/onInterval.js +0 -18
  253. package/dist/plugins/attributes/onInterval.js.map +0 -7
  254. package/dist/plugins/attributes/onRaf.d.ts +0 -1
  255. package/dist/plugins/attributes/onRaf.js +0 -19
  256. package/dist/plugins/attributes/onRaf.js.map +0 -7
  257. package/dist/plugins/attributes/onResize.d.ts +0 -1
  258. package/dist/plugins/attributes/onResize.js +0 -17
  259. package/dist/plugins/attributes/onResize.js.map +0 -7
  260. package/dist/plugins/attributes/onSignalPatch.d.ts +0 -5
  261. package/dist/plugins/attributes/onSignalPatch.js +0 -35
  262. package/dist/plugins/attributes/onSignalPatch.js.map +0 -7
  263. package/dist/plugins/attributes/persist.d.ts +0 -6
  264. package/dist/plugins/attributes/persist.js +0 -16
  265. package/dist/plugins/attributes/persist.js.map +0 -7
  266. package/dist/plugins/attributes/queryString.d.ts +0 -5
  267. package/dist/plugins/attributes/queryString.js +0 -54
  268. package/dist/plugins/attributes/queryString.js.map +0 -7
  269. package/dist/plugins/attributes/ref.d.ts +0 -2
  270. package/dist/plugins/attributes/ref.js +0 -13
  271. package/dist/plugins/attributes/ref.js.map +0 -7
  272. package/dist/plugins/attributes/replaceUrl.d.ts +0 -1
  273. package/dist/plugins/attributes/replaceUrl.js +0 -11
  274. package/dist/plugins/attributes/replaceUrl.js.map +0 -7
  275. package/dist/plugins/attributes/scrollIntoView.d.ts +0 -2
  276. package/dist/plugins/attributes/scrollIntoView.js +0 -19
  277. package/dist/plugins/attributes/scrollIntoView.js.map +0 -7
  278. package/dist/plugins/attributes/show.d.ts +0 -2
  279. package/dist/plugins/attributes/show.js +0 -19
  280. package/dist/plugins/attributes/show.js.map +0 -7
  281. package/dist/plugins/attributes/signals.d.ts +0 -2
  282. package/dist/plugins/attributes/signals.js +0 -13
  283. package/dist/plugins/attributes/signals.js.map +0 -7
  284. package/dist/plugins/attributes/style.d.ts +0 -2
  285. package/dist/plugins/attributes/style.js +0 -25
  286. package/dist/plugins/attributes/style.js.map +0 -7
  287. package/dist/plugins/attributes/text.d.ts +0 -1
  288. package/dist/plugins/attributes/text.js +0 -13
  289. package/dist/plugins/attributes/text.js.map +0 -7
  290. package/dist/plugins/attributes/viewTransition.d.ts +0 -1
  291. package/dist/plugins/attributes/viewTransition.js +0 -11
  292. package/dist/plugins/attributes/viewTransition.js.map +0 -7
  293. package/dist/plugins/directives/transition-name.d.ts +0 -1
  294. package/dist/plugins/directives/transition-name.js +0 -11
  295. package/dist/plugins/directives/transition-name.js.map +0 -7
  296. package/dist/plugins/directives/trap.d.ts +0 -5
  297. package/dist/plugins/directives/trap.js +0 -48
  298. package/dist/plugins/directives/trap.js.map +0 -7
  299. package/dist/sigmx.auto.js +0 -5
  300. package/dist/utils/object.d.ts +0 -9
  301. package/dist/utils/object.js +0 -26
  302. package/dist/utils/object.js.map +0 -7
  303. package/dist/utils/text.d.ts +0 -7
  304. package/dist/utils/text.js +0 -15
  305. package/dist/utils/text.js.map +0 -7
  306. package/dist/utils/timing.d.ts +0 -14
  307. package/dist/utils/timing.js +0 -58
  308. package/dist/utils/timing.js.map +0 -7
@@ -1,4 +1,4 @@
1
- import { attribute, expand, toPredicate } from "../../kernel/index.js";
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 same = (a, b) => JSON.stringify(a) === JSON.stringify(b);
10
- const queryString = attribute({
11
- name: "query-string",
12
- mount({ key, value, mods, evaluate, cased, store, listen, effect }) {
13
- const history = mods.has("history");
14
- const push = (url) => {
15
- if (url !== location.pathname + location.search + location.hash) window.history[history ? "pushState" : "replaceState"](null, "", url);
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 snap = store.snapshot(filter, { computed: false });
17
+ const q = params();
18
+ write(q);
56
19
  if (restoring) return;
57
- const q = new URLSearchParams(location.search);
58
- const walk = (obj, prefix) => {
59
- for (const k in obj) {
60
- const p = prefix ? `${prefix}.${k}` : k;
61
- const v = obj[k];
62
- if (v && typeof v === "object" && !Array.isArray(v)) walk(v, p);
63
- else if (mods.has("filter") && (v === "" || v == null)) q.delete(p);
64
- else q.set(p, typeof v === "string" ? v : JSON.stringify(v));
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
- walk(snap, "");
68
- push(urlWith(q));
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 { attribute, expand, toPredicate } from '../../kernel/index.js'\n\nconst parse = (s: string): unknown => {\n try {\n return JSON.parse(s)\n } catch {\n return s\n }\n}\nconst same = (a: unknown, b: unknown) => JSON.stringify(a) === JSON.stringify(b)\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 = attribute({\n name: 'query-string',\n mount({ key, value, mods, evaluate, cased, store, listen, effect }) {\n const history = mods.has('history')\n const push = (url: string) => {\n if (url !== location.pathname + location.search + location.hash) window.history[history ? 'pushState' : 'replaceState'](null, '', url)\n }\n const urlWith = (q: URLSearchParams) => `${location.pathname}${q.size ? `?${q}` : ''}${location.hash}`\n let restoring = false\n const restore = (fn: () => void) => {\n restoring = true\n try {\n fn()\n } finally {\n restoring = false\n }\n }\n\n if (key) {\n const path = cased()\n const fallback = value ? evaluate() : ''\n const fromUrl = () => {\n const raw = new URLSearchParams(location.search).get(key)\n store.set(path, raw === null ? fallback : parse(raw))\n }\n if (!store.has(path) || new URLSearchParams(location.search).has(key)) fromUrl()\n effect(() => {\n const v = store.get(path)\n if (restoring) return\n const q = new URLSearchParams(location.search)\n if (v === undefined || same(v, fallback)) q.delete(key)\n else q.set(key, typeof v === 'string' ? v : JSON.stringify(v))\n push(urlWith(q))\n })\n if (history) listen(window, 'popstate', () => restore(fromUrl))\n return\n }\n\n const filter = value ? evaluate() : undefined\n const ok = toPredicate(filter)\n const fromUrl = () => {\n const patch = {}\n for (const [k, v] of new URLSearchParams(location.search)) if (ok(k)) expand(patch, k, parse(v))\n store.merge(patch)\n }\n fromUrl()\n effect(() => {\n const snap = store.snapshot(filter, { computed: false })\n if (restoring) return\n const q = new URLSearchParams(location.search)\n const walk = (obj: Record<string, any>, prefix: string) => {\n for (const k in obj) {\n const p = prefix ? `${prefix}.${k}` : k\n const v = obj[k]\n if (v && typeof v === 'object' && !Array.isArray(v)) walk(v, p)\n else if (mods.has('filter') && (v === '' || v == null)) q.delete(p)\n else q.set(p, typeof v === 'string' ? v : JSON.stringify(v))\n }\n }\n walk(snap, '')\n push(urlWith(q))\n })\n if (history) listen(window, 'popstate', () => restore(fromUrl))\n },\n})\n"],
5
- "mappings": "AAAA,SAAS,WAAW,QAAQ,mBAAmB;AAE/C,MAAM,QAAQ,CAAC,MAAuB;AACpC,MAAI;AACF,WAAO,KAAK,MAAM,CAAC;AAAA,EACrB,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AACA,MAAM,OAAO,CAAC,GAAY,MAAe,KAAK,UAAU,CAAC,MAAM,KAAK,UAAU,CAAC;AAcxE,MAAM,cAAc,UAAU;AAAA,EACnC,MAAM;AAAA,EACN,MAAM,EAAE,KAAK,OAAO,MAAM,UAAU,OAAO,OAAO,QAAQ,OAAO,GAAG;AAClE,UAAM,UAAU,KAAK,IAAI,SAAS;AAClC,UAAM,OAAO,CAAC,QAAgB;AAC5B,UAAI,QAAQ,SAAS,WAAW,SAAS,SAAS,SAAS,KAAM,QAAO,QAAQ,UAAU,cAAc,cAAc,EAAE,MAAM,IAAI,GAAG;AAAA,IACvI;AACA,UAAM,UAAU,CAAC,MAAuB,GAAG,SAAS,QAAQ,GAAG,EAAE,OAAO,IAAI,CAAC,KAAK,EAAE,GAAG,SAAS,IAAI;AACpG,QAAI,YAAY;AAChB,UAAM,UAAU,CAAC,OAAmB;AAClC,kBAAY;AACZ,UAAI;AACF,WAAG;AAAA,MACL,UAAE;AACA,oBAAY;AAAA,MACd;AAAA,IACF;AAEA,QAAI,KAAK;AACP,YAAM,OAAO,MAAM;AACnB,YAAM,WAAW,QAAQ,SAAS,IAAI;AACtC,YAAMA,WAAU,MAAM;AACpB,cAAM,MAAM,IAAI,gBAAgB,SAAS,MAAM,EAAE,IAAI,GAAG;AACxD,cAAM,IAAI,MAAM,QAAQ,OAAO,WAAW,MAAM,GAAG,CAAC;AAAA,MACtD;AACA,UAAI,CAAC,MAAM,IAAI,IAAI,KAAK,IAAI,gBAAgB,SAAS,MAAM,EAAE,IAAI,GAAG,EAAG,CAAAA,SAAQ;AAC/E,aAAO,MAAM;AACX,cAAM,IAAI,MAAM,IAAI,IAAI;AACxB,YAAI,UAAW;AACf,cAAM,IAAI,IAAI,gBAAgB,SAAS,MAAM;AAC7C,YAAI,MAAM,UAAa,KAAK,GAAG,QAAQ,EAAG,GAAE,OAAO,GAAG;AAAA,YACjD,GAAE,IAAI,KAAK,OAAO,MAAM,WAAW,IAAI,KAAK,UAAU,CAAC,CAAC;AAC7D,aAAK,QAAQ,CAAC,CAAC;AAAA,MACjB,CAAC;AACD,UAAI,QAAS,QAAO,QAAQ,YAAY,MAAM,QAAQA,QAAO,CAAC;AAC9D;AAAA,IACF;AAEA,UAAM,SAAS,QAAQ,SAAS,IAAI;AACpC,UAAM,KAAK,YAAY,MAAM;AAC7B,UAAM,UAAU,MAAM;AACpB,YAAM,QAAQ,CAAC;AACf,iBAAW,CAAC,GAAG,CAAC,KAAK,IAAI,gBAAgB,SAAS,MAAM,EAAG,KAAI,GAAG,CAAC,EAAG,QAAO,OAAO,GAAG,MAAM,CAAC,CAAC;AAC/F,YAAM,MAAM,KAAK;AAAA,IACnB;AACA,YAAQ;AACR,WAAO,MAAM;AACX,YAAM,OAAO,MAAM,SAAS,QAAQ,EAAE,UAAU,MAAM,CAAC;AACvD,UAAI,UAAW;AACf,YAAM,IAAI,IAAI,gBAAgB,SAAS,MAAM;AAC7C,YAAM,OAAO,CAAC,KAA0B,WAAmB;AACzD,mBAAW,KAAK,KAAK;AACnB,gBAAM,IAAI,SAAS,GAAG,MAAM,IAAI,CAAC,KAAK;AACtC,gBAAM,IAAI,IAAI,CAAC;AACf,cAAI,KAAK,OAAO,MAAM,YAAY,CAAC,MAAM,QAAQ,CAAC,EAAG,MAAK,GAAG,CAAC;AAAA,mBACrD,KAAK,IAAI,QAAQ,MAAM,MAAM,MAAM,KAAK,MAAO,GAAE,OAAO,CAAC;AAAA,cAC7D,GAAE,IAAI,GAAG,OAAO,MAAM,WAAW,IAAI,KAAK,UAAU,CAAC,CAAC;AAAA,QAC7D;AAAA,MACF;AACA,WAAK,MAAM,EAAE;AACb,WAAK,QAAQ,CAAC,CAAC;AAAA,IACjB,CAAC;AACD,QAAI,QAAS,QAAO,QAAQ,YAAY,MAAM,QAAQ,OAAO,CAAC;AAAA,EAChE;AACF,CAAC;",
6
- "names": ["fromUrl"]
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 { attribute } from "../../kernel/index.js";
2
- const replaceUrl = attribute({
3
- name: "replace-url",
4
- key: "forbidden",
5
- value: "required",
6
- mount: ({ evaluate, effect }) => effect(() => history.replaceState(history.state, "", new URL(String(evaluate()), location.href)))
7
- });
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 { attribute } from '../../kernel/index.js'\n\nexport const replaceUrl = attribute({\n name: 'replace-url',\n key: 'forbidden',\n value: 'required',\n mount: ({ evaluate, effect }) =>\n effect(() => history.replaceState(history.state, '', new URL(String(evaluate()), location.href))),\n})\n"],
5
- "mappings": "AAAA,SAAS,iBAAiB;AAEnB,MAAM,aAAa,UAAU;AAAA,EAClC,MAAM;AAAA,EACN,KAAK;AAAA,EACL,OAAO;AAAA,EACP,OAAO,CAAC,EAAE,UAAU,OAAO,MACzB,OAAO,MAAM,QAAQ,aAAa,QAAQ,OAAO,IAAI,IAAI,IAAI,OAAO,SAAS,CAAC,GAAG,SAAS,IAAI,CAAC,CAAC;AACpG,CAAC;",
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 { attribute } from "../../kernel/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
- }
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 { attribute } from '../../kernel/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;",
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 { attribute, withTiming, withViewTransition } from "../../kernel/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
- }
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 { attribute, withTiming, withViewTransition } from '../../kernel/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;",
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 { attribute } from "../../kernel/index.js";
2
- const show = attribute({
3
- name: "show",
4
- key: "forbidden",
5
- value: "required",
6
- mount({ el, evaluate, effect }) {
7
- const initial = el.style.display === "none" ? "" : el.style.display;
8
- effect(() => {
9
- el.style.display = evaluate() ? initial : "none";
10
- });
11
- return () => {
12
- el.style.display = initial;
13
- };
14
- }
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 { attribute } from '../../kernel/index.js'\n\n/** Toggles `display: none`, restoring whatever inline display the element had. */\nexport const show = attribute({\n name: 'show',\n key: 'forbidden',\n value: 'required',\n mount({ el, evaluate, effect }) {\n const initial = el.style.display === 'none' ? '' : el.style.display\n effect(() => {\n el.style.display = evaluate() ? initial : 'none'\n })\n return () => {\n el.style.display = initial\n }\n },\n})\n"],
5
- "mappings": "AAAA,SAAS,iBAAiB;AAGnB,MAAM,OAAO,UAAU;AAAA,EAC5B,MAAM;AAAA,EACN,KAAK;AAAA,EACL,OAAO;AAAA,EACP,MAAM,EAAE,IAAI,UAAU,OAAO,GAAG;AAC9B,UAAM,UAAU,GAAG,MAAM,YAAY,SAAS,KAAK,GAAG,MAAM;AAC5D,WAAO,MAAM;AACX,SAAG,MAAM,UAAU,SAAS,IAAI,UAAU;AAAA,IAC5C,CAAC;AACD,WAAO,MAAM;AACX,SAAG,MAAM,UAAU;AAAA,IACrB;AAAA,EACF;AACF,CAAC;",
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,2 +1 @@
1
- /** Runs the expression now and whenever a signal it read changes. */
2
1
  export declare const effect: import("../../kernel/contracts.js").AttributePlugin;
@@ -1,11 +1,5 @@
1
- import { attribute } from "../../kernel/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
- });
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 { attribute } from '../../kernel/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;",
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 { action, batch, untracked } from "../../kernel/index.js";
2
- const setAll = action({
3
- name: "setAll",
4
- call: ({ store }, value, filter) => batch(() => untracked(() => {
5
- for (const p of store.paths(filter)) store.set(p, value);
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 { action, batch, untracked, type Filter } from '../../kernel/index.js'\n\n/** `@setAll(value, { include: /^form\\./ })` assigns every matching signal. */\nexport const setAll = action({\n name: 'setAll',\n call: ({ store }, value: unknown, filter?: Filter) =>\n batch(() => untracked(() => { for (const p of store.paths(filter)) store.set(p, value) })),\n})\n"],
5
- "mappings": "AAAA,SAAS,QAAQ,OAAO,iBAA8B;AAG/C,MAAM,SAAS,OAAO;AAAA,EAC3B,MAAM;AAAA,EACN,MAAM,CAAC,EAAE,MAAM,GAAG,OAAgB,WAChC,MAAM,MAAM,UAAU,MAAM;AAAE,eAAW,KAAK,MAAM,MAAM,MAAM,EAAG,OAAM,IAAI,GAAG,KAAK;AAAA,EAAE,CAAC,CAAC;AAC7F,CAAC;",
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 { action, batch, untracked } from "../../kernel/index.js";
2
- const toggleAll = action({
3
- name: "toggleAll",
4
- call: ({ store }, filter) => batch(() => untracked(() => {
5
- for (const p of store.paths(filter)) store.set(p, !store.get(p));
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 { action, batch, untracked, type Filter } from '../../kernel/index.js'\n\n/** `@toggleAll({ include: /^flags\\./ })` negates every matching boolean signal. */\nexport const toggleAll = action({\n name: 'toggleAll',\n call: ({ store }, filter?: Filter) =>\n batch(() => untracked(() => { for (const p of store.paths(filter)) store.set(p, !store.get(p)) })),\n})\n"],
5
- "mappings": "AAAA,SAAS,QAAQ,OAAO,iBAA8B;AAG/C,MAAM,YAAY,OAAO;AAAA,EAC9B,MAAM;AAAA,EACN,MAAM,CAAC,EAAE,MAAM,GAAG,WAChB,MAAM,MAAM,UAAU,MAAM;AAAE,eAAW,KAAK,MAAM,MAAM,MAAM,EAAG,OAAM,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC;AAAA,EAAE,CAAC,CAAC;AACrG,CAAC;",
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 { action } from "../../kernel/index.js";
2
- const confirm = action({ name: "confirm", call: (_, message) => window.confirm(message) });
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 { action } from '../../kernel/index.js'\n\n/** `@confirm('Delete?') && @delete('/x')` asks before continuing. */\nexport const confirm = action({ name: 'confirm', call: (_, message: string) => window.confirm(message) })\n"],
5
- "mappings": "AAAA,SAAS,cAAc;AAGhB,MAAM,UAAU,OAAO,EAAE,MAAM,WAAW,MAAM,CAAC,GAAG,YAAoB,OAAO,QAAQ,OAAO,EAAE,CAAC;",
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 { action } from "../../kernel/index.js";
2
- const clipboard = action({
3
- name: "clipboard",
4
- call: (_, text, base64 = false) => navigator.clipboard.writeText(
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 { action } from '../../kernel/index.js'\n\n/** `@clipboard(text, isBase64?)` copies text; base64 input is decoded first. */\nexport const clipboard = action({\n name: 'clipboard',\n call: (_, 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,cAAc;AAGhB,MAAM,YAAY,OAAO;AAAA,EAC9B,MAAM;AAAA,EACN,MAAM,CAAC,GAAG,MAAc,SAAS,UAC/B,UAAU,UAAU;AAAA,IAClB,SAAS,IAAI,YAAY,EAAE,OAAO,WAAW,KAAK,KAAK,IAAI,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,IAAI;AAAA,EAC3F;AACJ,CAAC;",
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 { action } from "../../kernel/index.js";
2
- const dispatch = action({
3
- name: "dispatch",
4
- call: ({ el }, name, detail) => el.dispatchEvent(new CustomEvent(name, { detail, bubbles: true, composed: true }))
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 { action } from '../../kernel/index.js'\n\n/** `@dispatch('name', detail)` fires a bubbling CustomEvent from the element. */\nexport const dispatch = action({\n name: 'dispatch',\n call: ({ el }, name: string, detail?: unknown) => el.dispatchEvent(new CustomEvent(name, { detail, bubbles: true, composed: true })),\n})\n"],
5
- "mappings": "AAAA,SAAS,cAAc;AAGhB,MAAM,WAAW,OAAO;AAAA,EAC7B,MAAM;AAAA,EACN,MAAM,CAAC,EAAE,GAAG,GAAG,MAAc,WAAqB,GAAG,cAAc,IAAI,YAAY,MAAM,EAAE,QAAQ,SAAS,MAAM,UAAU,KAAK,CAAC,CAAC;AACrI,CAAC;",
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
- /** `@intl('number', 1234.5, { style: 'currency', currency: 'USD' }, 'en-US')`. */
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 { action } from "../../kernel/index.js";
2
- const formats = {
3
- number: (l, v, o) => new Intl.NumberFormat(l, o).format(v),
4
- datetime: (l, v, o) => new Intl.DateTimeFormat(l, o).format(v),
5
- pluralRules: (l, v, o) => new Intl.PluralRules(l, o).select(v),
6
- relativeTime: (l, v, o) => new Intl.RelativeTimeFormat(l, o).format(v[0], v[1]),
7
- list: (l, v, o) => new Intl.ListFormat(l, o).format(v),
8
- displayNames: (l, v, o) => new Intl.DisplayNames(l, o).of(v) ?? ""
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 { action } from '../../kernel/index.js'\n\ntype Fmt = (locale: string | string[] | undefined, value: any, options: any) => string\nconst formats: Record<string, Fmt> = {\n number: (l, v, o) => new Intl.NumberFormat(l, o).format(v),\n datetime: (l, v, o) => new Intl.DateTimeFormat(l, o).format(v),\n pluralRules: (l, v, o) => new Intl.PluralRules(l, o).select(v),\n relativeTime: (l, v, o) => new Intl.RelativeTimeFormat(l, o).format(v[0], v[1]),\n list: (l, v, o) => new Intl.ListFormat(l, o).format(v),\n displayNames: (l, v, o) => new Intl.DisplayNames(l, o).of(v) ?? '',\n}\n\n/** `@intl('number', 1234.5, { style: 'currency', currency: 'USD' }, 'en-US')`. */\nexport const intl = action({\n name: 'intl',\n call: ({ error }, type: string, value: unknown, options?: Record<string, unknown>, locale?: string | string[]) => {\n const f = formats[type]\n if (!f) throw error(`unknown @intl type \"${type}\"`)\n return f(locale, value, options)\n },\n})\n"],
5
- "mappings": "AAAA,SAAS,cAAc;AAGvB,MAAM,UAA+B;AAAA,EACnC,QAAQ,CAAC,GAAG,GAAG,MAAM,IAAI,KAAK,aAAa,GAAG,CAAC,EAAE,OAAO,CAAC;AAAA,EACzD,UAAU,CAAC,GAAG,GAAG,MAAM,IAAI,KAAK,eAAe,GAAG,CAAC,EAAE,OAAO,CAAC;AAAA,EAC7D,aAAa,CAAC,GAAG,GAAG,MAAM,IAAI,KAAK,YAAY,GAAG,CAAC,EAAE,OAAO,CAAC;AAAA,EAC7D,cAAc,CAAC,GAAG,GAAG,MAAM,IAAI,KAAK,mBAAmB,GAAG,CAAC,EAAE,OAAO,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC;AAAA,EAC9E,MAAM,CAAC,GAAG,GAAG,MAAM,IAAI,KAAK,WAAW,GAAG,CAAC,EAAE,OAAO,CAAC;AAAA,EACrD,cAAc,CAAC,GAAG,GAAG,MAAM,IAAI,KAAK,aAAa,GAAG,CAAC,EAAE,GAAG,CAAC,KAAK;AAClE;AAGO,MAAM,OAAO,OAAO;AAAA,EACzB,MAAM;AAAA,EACN,MAAM,CAAC,EAAE,MAAM,GAAG,MAAc,OAAgB,SAAmC,WAA+B;AAChH,UAAM,IAAI,QAAQ,IAAI;AACtB,QAAI,CAAC,EAAG,OAAM,MAAM,uBAAuB,IAAI,GAAG;AAClD,WAAO,EAAE,QAAQ,OAAO,OAAO;AAAA,EACjC;AACF,CAAC;",
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 { action } from "../../kernel/index.js";
2
- const fit = action({
3
- name: "fit",
4
- call: (_, v, inMin, inMax, outMin, outMax, clamp = false, round = false) => {
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
  };