nodality 1.3.26 → 1.4.1

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 (291) hide show
  1. package/API.md +39 -20
  2. package/README.md +75 -25
  3. package/dist/animator.cjs.js +1 -1
  4. package/dist/animator.cjs.js.LICENSE.txt +1 -1
  5. package/dist/animator.esm.js +1 -1
  6. package/dist/animator.esm.js.LICENSE.txt +1 -1
  7. package/dist/audionew.cjs.js +1 -1
  8. package/dist/audionew.cjs.js.LICENSE.txt +1 -1
  9. package/dist/audionew.esm.js +1 -1
  10. package/dist/audionew.esm.js.LICENSE.txt +1 -1
  11. package/dist/base.cjs.js +1 -1
  12. package/dist/base.cjs.js.LICENSE.txt +1 -1
  13. package/dist/base.esm.js +1 -1
  14. package/dist/base.esm.js.LICENSE.txt +1 -1
  15. package/dist/beta-desktop-bar.cjs.js +1 -1
  16. package/dist/beta-desktop-bar.cjs.js.LICENSE.txt +1 -1
  17. package/dist/beta-desktop-bar.esm.js +1 -1
  18. package/dist/beta-desktop-bar.esm.js.LICENSE.txt +1 -1
  19. package/dist/beta-mobile-bar.cjs.js +1 -1
  20. package/dist/beta-mobile-bar.cjs.js.LICENSE.txt +1 -1
  21. package/dist/beta-mobile-bar.esm.js +1 -1
  22. package/dist/beta-mobile-bar.esm.js.LICENSE.txt +1 -1
  23. package/dist/bundle.umd.js +1 -1
  24. package/dist/bundle.umd.js.LICENSE.txt +20 -1
  25. package/dist/button.cjs.js +1 -1
  26. package/dist/button.cjs.js.LICENSE.txt +1 -1
  27. package/dist/button.esm.js +1 -1
  28. package/dist/button.esm.js.LICENSE.txt +1 -1
  29. package/dist/card-getter.cjs.js.LICENSE.txt +1 -1
  30. package/dist/card-getter.esm.js.LICENSE.txt +1 -1
  31. package/dist/center.cjs.js +1 -1
  32. package/dist/center.cjs.js.LICENSE.txt +1 -1
  33. package/dist/center.esm.js +1 -1
  34. package/dist/center.esm.js.LICENSE.txt +1 -1
  35. package/dist/checkbox.cjs.js +1 -1
  36. package/dist/checkbox.cjs.js.LICENSE.txt +1 -1
  37. package/dist/checkbox.esm.js +1 -1
  38. package/dist/checkbox.esm.js.LICENSE.txt +1 -1
  39. package/dist/code.cjs.js +1 -1
  40. package/dist/code.cjs.js.LICENSE.txt +1 -1
  41. package/dist/code.esm.js +1 -1
  42. package/dist/code.esm.js.LICENSE.txt +1 -1
  43. package/dist/container.cjs.js +1 -1
  44. package/dist/container.cjs.js.LICENSE.txt +1 -1
  45. package/dist/container.esm.js +1 -1
  46. package/dist/container.esm.js.LICENSE.txt +1 -1
  47. package/dist/data-list.cjs.js +1 -1
  48. package/dist/data-list.cjs.js.LICENSE.txt +1 -1
  49. package/dist/data-list.esm.js.LICENSE.txt +1 -1
  50. package/dist/designer.cjs.js +1 -1
  51. package/dist/designer.cjs.js.LICENSE.txt +20 -1
  52. package/dist/designer.esm.js +1 -1
  53. package/dist/designer.esm.js.LICENSE.txt +20 -1
  54. package/dist/element-mapper.cjs.js +1 -1
  55. package/dist/element-mapper.cjs.js.LICENSE.txt +1 -1
  56. package/dist/element-mapper.esm.js +1 -1
  57. package/dist/element-mapper.esm.js.LICENSE.txt +1 -1
  58. package/dist/finalresult.esm.js +1 -1
  59. package/dist/finalresult.esm.js.LICENSE.txt +20 -1
  60. package/dist/flex-card.cjs.js +1 -1
  61. package/dist/flex-card.cjs.js.LICENSE.txt +1 -1
  62. package/dist/flex-card.esm.js +1 -1
  63. package/dist/flex-card.esm.js.LICENSE.txt +1 -1
  64. package/dist/flex-grid.cjs.js +1 -1
  65. package/dist/flex-grid.cjs.js.LICENSE.txt +1 -1
  66. package/dist/flex-grid.esm.js +1 -1
  67. package/dist/flex-grid.esm.js.LICENSE.txt +1 -1
  68. package/dist/flex-row.cjs.js +1 -1
  69. package/dist/flex-row.cjs.js.LICENSE.txt +1 -1
  70. package/dist/flex-row.esm.js +1 -1
  71. package/dist/flex-row.esm.js.LICENSE.txt +1 -1
  72. package/dist/floating-input.cjs.js +1 -1
  73. package/dist/floating-input.cjs.js.LICENSE.txt +1 -1
  74. package/dist/floating-input.esm.js +1 -1
  75. package/dist/floating-input.esm.js.LICENSE.txt +1 -1
  76. package/dist/free.cjs.js +1 -1
  77. package/dist/free.cjs.js.LICENSE.txt +1 -1
  78. package/dist/free.esm.js +1 -1
  79. package/dist/free.esm.js.LICENSE.txt +1 -1
  80. package/dist/horizontal-scroller.cjs.js.LICENSE.txt +1 -1
  81. package/dist/horizontal-scroller.esm.js.LICENSE.txt +1 -1
  82. package/dist/image-picker.cjs.js +1 -1
  83. package/dist/image-picker.cjs.js.LICENSE.txt +1 -1
  84. package/dist/image-picker.esm.js +1 -1
  85. package/dist/image-picker.esm.js.LICENSE.txt +1 -1
  86. package/dist/image.cjs.js +1 -1
  87. package/dist/image.cjs.js.LICENSE.txt +1 -1
  88. package/dist/image.esm.js +1 -1
  89. package/dist/image.esm.js.LICENSE.txt +1 -1
  90. package/dist/index.cjs.js +1 -1
  91. package/dist/index.cjs.js.LICENSE.txt +20 -1
  92. package/dist/index.d.ts +1 -1
  93. package/dist/index.esm.js +1 -1
  94. package/dist/index.esm.js.LICENSE.txt +20 -1
  95. package/dist/keyframe-animation.cjs.js.LICENSE.txt +1 -1
  96. package/dist/keyframe-animation.esm.js.LICENSE.txt +1 -1
  97. package/dist/link-getter.cjs.js +1 -1
  98. package/dist/link-getter.cjs.js.LICENSE.txt +1 -1
  99. package/dist/link-getter.esm.js +1 -1
  100. package/dist/link-getter.esm.js.LICENSE.txt +1 -1
  101. package/dist/link.cjs.js +1 -1
  102. package/dist/link.cjs.js.LICENSE.txt +1 -1
  103. package/dist/link.esm.js +1 -1
  104. package/dist/link.esm.js.LICENSE.txt +1 -1
  105. package/dist/meta-adder.cjs.js +1 -1
  106. package/dist/meta-adder.cjs.js.LICENSE.txt +1 -1
  107. package/dist/meta-adder.esm.js +1 -1
  108. package/dist/meta-adder.esm.js.LICENSE.txt +1 -1
  109. package/dist/modal-2025.cjs.js +1 -1
  110. package/dist/modal-2025.cjs.js.LICENSE.txt +1 -1
  111. package/dist/modal-2025.esm.js +1 -1
  112. package/dist/modal-2025.esm.js.LICENSE.txt +1 -1
  113. package/dist/multiswitcher.cjs.js +1 -1
  114. package/dist/multiswitcher.cjs.js.LICENSE.txt +1 -1
  115. package/dist/multiswitcher.esm.js +1 -1
  116. package/dist/multiswitcher.esm.js.LICENSE.txt +1 -1
  117. package/dist/new-nav-bar.cjs.js +1 -1
  118. package/dist/new-nav-bar.cjs.js.LICENSE.txt +1 -1
  119. package/dist/new-nav-bar.esm.js +1 -1
  120. package/dist/new-nav-bar.esm.js.LICENSE.txt +1 -1
  121. package/dist/picker.cjs.js +1 -1
  122. package/dist/picker.cjs.js.LICENSE.txt +1 -1
  123. package/dist/picker.esm.js +1 -1
  124. package/dist/picker.esm.js.LICENSE.txt +1 -1
  125. package/dist/progress.cjs.js +1 -1
  126. package/dist/progress.cjs.js.LICENSE.txt +1 -1
  127. package/dist/progress.esm.js +1 -1
  128. package/dist/progress.esm.js.LICENSE.txt +1 -1
  129. package/dist/radio.cjs.js +1 -1
  130. package/dist/radio.cjs.js.LICENSE.txt +1 -1
  131. package/dist/radio.esm.js.LICENSE.txt +1 -1
  132. package/dist/range.cjs.js +1 -1
  133. package/dist/range.cjs.js.LICENSE.txt +1 -1
  134. package/dist/range.esm.js.LICENSE.txt +1 -1
  135. package/dist/scroll-video.cjs.js.LICENSE.txt +1 -1
  136. package/dist/scroll-video.esm.js.LICENSE.txt +1 -1
  137. package/dist/side-bar.cjs.js +1 -1
  138. package/dist/side-bar.cjs.js.LICENSE.txt +1 -1
  139. package/dist/side-bar.esm.js +1 -1
  140. package/dist/side-bar.esm.js.LICENSE.txt +1 -1
  141. package/dist/side-nav-bar.cjs.js +1 -1
  142. package/dist/side-nav-bar.cjs.js.LICENSE.txt +1 -1
  143. package/dist/side-nav-bar.esm.js +1 -1
  144. package/dist/side-nav-bar.esm.js.LICENSE.txt +1 -1
  145. package/dist/simple-bar.cjs.js +1 -1
  146. package/dist/simple-bar.cjs.js.LICENSE.txt +1 -1
  147. package/dist/simple-bar.esm.js +1 -1
  148. package/dist/simple-bar.esm.js.LICENSE.txt +1 -1
  149. package/dist/slider-2025.cjs.js +1 -1
  150. package/dist/slider-2025.cjs.js.LICENSE.txt +1 -1
  151. package/dist/slider-2025.esm.js +1 -1
  152. package/dist/slider-2025.esm.js.LICENSE.txt +1 -1
  153. package/dist/spacer.cjs.js +1 -1
  154. package/dist/spacer.cjs.js.LICENSE.txt +1 -1
  155. package/dist/spacer.esm.js +1 -1
  156. package/dist/spacer.esm.js.LICENSE.txt +1 -1
  157. package/dist/stack.cjs.js +1 -1
  158. package/dist/stack.cjs.js.LICENSE.txt +1 -1
  159. package/dist/stack.esm.js +1 -1
  160. package/dist/stack.esm.js.LICENSE.txt +1 -1
  161. package/dist/stacker.cjs.js.LICENSE.txt +1 -1
  162. package/dist/stacker.esm.js.LICENSE.txt +1 -1
  163. package/dist/table.cjs.js +1 -1
  164. package/dist/table.cjs.js.LICENSE.txt +1 -1
  165. package/dist/table.esm.js +1 -1
  166. package/dist/table.esm.js.LICENSE.txt +1 -1
  167. package/dist/text-field.cjs.js +1 -1
  168. package/dist/text-field.cjs.js.LICENSE.txt +1 -1
  169. package/dist/text-field.esm.js +1 -1
  170. package/dist/text-field.esm.js.LICENSE.txt +1 -1
  171. package/dist/text.cjs.js +1 -1
  172. package/dist/text.cjs.js.LICENSE.txt +1 -1
  173. package/dist/text.esm.js +1 -1
  174. package/dist/text.esm.js.LICENSE.txt +1 -1
  175. package/dist/theme.cjs.js.LICENSE.txt +1 -1
  176. package/dist/theme.esm.js.LICENSE.txt +1 -1
  177. package/dist/transform-anim.cjs.js.LICENSE.txt +1 -1
  178. package/dist/transform-anim.esm.js.LICENSE.txt +1 -1
  179. package/dist/ulist.cjs.js +1 -1
  180. package/dist/ulist.cjs.js.LICENSE.txt +1 -1
  181. package/dist/ulist.esm.js +1 -1
  182. package/dist/ulist.esm.js.LICENSE.txt +1 -1
  183. package/dist/video.cjs.js +1 -1
  184. package/dist/video.cjs.js.LICENSE.txt +1 -1
  185. package/dist/video.esm.js +1 -1
  186. package/dist/video.esm.js.LICENSE.txt +1 -1
  187. package/dist/wrap.cjs.js +1 -1
  188. package/dist/wrap.cjs.js.LICENSE.txt +1 -1
  189. package/dist/wrap.esm.js +1 -1
  190. package/dist/wrap.esm.js.LICENSE.txt +1 -1
  191. package/dist/zoom-card.cjs.js +1 -1
  192. package/dist/zoom-card.cjs.js.LICENSE.txt +1 -1
  193. package/dist/zoom-card.esm.js +1 -1
  194. package/dist/zoom-card.esm.js.LICENSE.txt +1 -1
  195. package/layout/animator.js +13 -4
  196. package/layout/audio.js +1 -1
  197. package/layout/audionew.js +1 -1
  198. package/layout/base.js +1 -1
  199. package/layout/beta-desktop-bar.js +1 -1
  200. package/layout/beta-mobile-bar.js +1 -1
  201. package/layout/button.js +1 -1
  202. package/layout/center.js +1 -1
  203. package/layout/checkbox.js +1 -1
  204. package/layout/circle.js +1 -1
  205. package/layout/code.js +1 -1
  206. package/layout/container.js +1 -1
  207. package/layout/dropdown-2025.js +1 -1
  208. package/layout/flex-card.js +1 -1
  209. package/layout/flex-grid.js +1 -1
  210. package/layout/flex-row.js +1 -1
  211. package/layout/form-components/custom.js +1 -1
  212. package/layout/form-components/data-list.js +1 -1
  213. package/layout/form-components/floating-input.js +1 -1
  214. package/layout/form-components/form-all.js +1 -1
  215. package/layout/form-components/form.js +1 -1
  216. package/layout/form-components/image-picker.js +1 -1
  217. package/layout/form-components/picker.js +1 -1
  218. package/layout/form-components/radio.js +1 -1
  219. package/layout/form-components/radiogroup.js +1 -1
  220. package/layout/form-components/range.js +1 -1
  221. package/layout/free.js +1 -1
  222. package/layout/grid-overlay.js +1 -1
  223. package/layout/grid-switcher.js +1 -1
  224. package/layout/grid.js +1 -1
  225. package/layout/horizontal-scroller.js +1 -1
  226. package/layout/image.js +1 -1
  227. package/layout/index.js +1 -1
  228. package/layout/link.js +1 -1
  229. package/layout/list.js +1 -1
  230. package/layout/meta-adder.js +1 -1
  231. package/layout/modal-2025.js +1 -1
  232. package/layout/morph.js +1 -1
  233. package/layout/multiswitcher.js +1 -1
  234. package/layout/nav-bar.js +1 -1
  235. package/layout/nav-factor/custom-div.js +1 -1
  236. package/layout/new-nav-bar.js +1 -1
  237. package/layout/polygon.js +1 -1
  238. package/layout/prerender-site.js +1 -1
  239. package/layout/prerender.js +1 -1
  240. package/layout/progress.js +1 -1
  241. package/layout/row.js +1 -1
  242. package/layout/scroll-video.js +1 -1
  243. package/layout/shop.js +1 -1
  244. package/layout/side-bar.js +1 -1
  245. package/layout/side-nav-bar.js +1 -1
  246. package/layout/simple-bar.js +1 -1
  247. package/layout/slider-2025.js +1 -1
  248. package/layout/spacer.js +1 -1
  249. package/layout/stack.js +1 -1
  250. package/layout/svg.js +1 -1
  251. package/layout/switcher.js +1 -1
  252. package/layout/table.js +1 -1
  253. package/layout/text-field.js +1 -1
  254. package/layout/text.js +1 -1
  255. package/layout/ulist.js +1 -1
  256. package/layout/video.js +1 -1
  257. package/layout/wrap.js +1 -1
  258. package/layout/zoom-card.js +1 -1
  259. package/lib/agent-surface.js +1 -1
  260. package/lib/card-getter.js +1 -1
  261. package/lib/check-page.js +1 -1
  262. package/lib/codegen.js +1 -1
  263. package/lib/data.js +1 -1
  264. package/lib/designer.js +14 -1
  265. package/lib/element-mapper.js +1 -1
  266. package/lib/element-params.generated.js +1 -1
  267. package/lib/grid-geometry.js +1 -1
  268. package/lib/keyframe-animation.js +1 -1
  269. package/lib/known-inert.js +1 -1
  270. package/lib/link-getter.js +1 -1
  271. package/lib/morph-node.js +48 -9
  272. package/lib/normalize-spec.js +1 -1
  273. package/lib/parse-html.js +1 -1
  274. package/lib/raster-inspect.js +1 -1
  275. package/lib/raster-ops.js +255 -34
  276. package/lib/raster-presets.js +32 -1
  277. package/lib/react.js +1 -1
  278. package/lib/resolve-refs.js +1 -1
  279. package/lib/responsive.js +647 -0
  280. package/lib/scroll-video.js +1 -1
  281. package/lib/seo.js +1 -1
  282. package/lib/stacker.js +1 -1
  283. package/lib/suggest.js +1 -1
  284. package/lib/theme.js +1 -1
  285. package/lib/transform-anim.js +1 -1
  286. package/lib/transition.js +1 -1
  287. package/lib/validate-nodes.js +27 -2
  288. package/lib/view-transition.js +287 -0
  289. package/lib/webmcp-adapter.js +20 -3
  290. package/package.json +13 -3
  291. package/skills/nodality/SKILL.md +9 -0
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * nodality v1.3.26
2
+ * nodality v1.4.1
3
3
  * (c) 2026 Filip Vabrousek
4
4
  * License: MIT
5
5
  */
package/lib/transition.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * nodality v1.3.26
2
+ * nodality v1.4.1
3
3
  * (c) 2026 Filip Vabrousek
4
4
  * License: MIT
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * nodality v1.3.26
2
+ * nodality v1.4.1
3
3
  * (c) 2026 Filip Vabrousek
4
4
  * License: MIT
5
5
  */
@@ -195,11 +195,14 @@ const BARE_DESIGN_OPS = [
195
195
  * over-reporting costs more than under-reporting.
196
196
  */
197
197
  const DESIGN_OP_NAMES = [
198
- "animation", "background", "blast", "card-style", "filter", "gradient",
198
+ "animation", "arrange", "background", "blast", "card-style", "filter", "gradient",
199
199
  "layout", "link-style", "margin", "navStyle", "shadow", "slayout",
200
200
  "span", "transform",
201
201
  ];
202
202
 
203
+ /** What an `arrange` node can switch its target to inside its range. */
204
+ const ARRANGE_MODES = ["row", "column", "expand", "collapse"];
205
+
203
206
  /**
204
207
  * Every top-level key a design node reads.
205
208
  *
@@ -770,6 +773,28 @@ export function validateNodes(nodes, elements, defs) {
770
773
  ["a CSS gradient, e.g. \"linear-gradient(#1d6fe0, #7fd1ff)\"",
771
774
  "or direction: \"radial\" to take the built-in one"]);
772
775
  }
776
+
777
+ // An `arrange` node does nothing without a target and a range, and
778
+ // a mode outside the two it knows would be dropped in silence.
779
+ if (!bare && name === "arrange") {
780
+ const mode = node.op.mode;
781
+ if (mode !== undefined && !ARRANGE_MODES.includes(mode)) {
782
+ push("BAD_FIELD", `${path}.op.mode`, mode,
783
+ suggest(String(mode), ARRANGE_MODES), ARRANGE_MODES);
784
+ }
785
+ const r = node.range;
786
+ const num = (x) => (typeof x === "number" ? x : parseInt(x, 10));
787
+ const rangeOk = Array.isArray(r) && r.length === 2 &&
788
+ r.every((x) => Number.isFinite(num(x))) && num(r[0]) >= 0 && num(r[0]) <= num(r[1]);
789
+ if (!rangeOk) {
790
+ push("BAD_FIELD", `${path}.range`, r, [],
791
+ ["[lo, hi] viewport widths in CSS px, 0 <= lo <= hi"]);
792
+ }
793
+ if (!Array.isArray(node.target) || node.target.length === 0) {
794
+ push("MISSING_FIELD", `${path}.target`, node.target, [],
795
+ ["the id of the row, cards or nav it switches"]);
796
+ }
797
+ }
773
798
  return;
774
799
  }
775
800
 
@@ -0,0 +1,287 @@
1
+ /*!
2
+ * nodality v1.4.1
3
+ * (c) 2026 Filip Vabrousek
4
+ * License: MIT
5
+ */
6
+
7
+ /*!
8
+ * view-transition.js — shader transitions for single-page route changes,
9
+ * with the View Transitions API's calling convention.
10
+ *
11
+ * A router that already does
12
+ *
13
+ * document.startViewTransition(() => render(route));
14
+ *
15
+ * swaps one call and keeps everything else, including its CSS:
16
+ *
17
+ * import { nodalityTransition } from "nodality/view-transition";
18
+ * nodalityTransition(() => render(route), { effect: "t-fluid" });
19
+ *
20
+ * Elements are paired by `view-transition-name`, exactly as the platform
21
+ * pairs them, and each pair is morphed by a raster transition: the old
22
+ * element is frozen before the update, the new one after it, and the
23
+ * pipeline interpolates between their rects while the effect chain runs
24
+ * over both stills.
25
+ *
26
+ * WHY NOT ON TOP OF THE PLATFORM'S TRANSITION. The browser renders a view
27
+ * transition as `::view-transition-old/new` snapshots in its own top
28
+ * layer. CSS can move, fade and filter those, but no shader can draw them
29
+ * and nothing on the page can paint above them while the transition runs.
30
+ * So this does the platform's job itself — freeze, update, pair, animate —
31
+ * and hands the platform back the cases where there is nothing to add:
32
+ * reduced motion (no effect is allowed), and no WebGL (no effect is
33
+ * possible). There the native transition runs if the browser has one.
34
+ *
35
+ * Unlike the native transition, only NAMED elements animate. Everything
36
+ * else changes at once; the native one also cross-fades the page root.
37
+ */
38
+
39
+ import { applyRasterPipeline } from "./raster-ops.js";
40
+ import { preset } from "./raster-presets.js";
41
+ import { progressTimeline, prefersReducedMotion } from "./transition.js";
42
+ import { captureStill } from "./morph-node.js";
43
+
44
+ const nextFrame = () => new Promise((r) => requestAnimationFrame(() => r()));
45
+
46
+ /** The name an element transitions under, or null. */
47
+ function nameOf(el) {
48
+ const own = el.style && el.style.viewTransitionName;
49
+ if (own && own !== "none") return own;
50
+ const attr = el.getAttribute && el.getAttribute("data-view-transition-name");
51
+ if (attr) return attr;
52
+ const cs = getComputedStyle(el);
53
+ const css = cs.viewTransitionName || cs.getPropertyValue("view-transition-name");
54
+ return css && css !== "none" && css !== "auto" ? css.trim() : null;
55
+ }
56
+
57
+ /**
58
+ * Every named, visible element under `root`, by name. A duplicate name
59
+ * is an error in the platform API (the transition is skipped); here the
60
+ * first one wins and the rest are reported, so a page still advances.
61
+ */
62
+ function collect(root) {
63
+ const found = new Map();
64
+ for (const el of root.querySelectorAll("*")) {
65
+ const name = nameOf(el);
66
+ if (!name) continue;
67
+ const r = el.getBoundingClientRect();
68
+ if (!r.width || !r.height) continue;
69
+ if (found.has(name)) {
70
+ console.warn(`[nodality] view transition: two elements are named "${name}" — ` +
71
+ "only the first animates.");
72
+ continue;
73
+ }
74
+ found.set(name, el);
75
+ }
76
+ return found;
77
+ }
78
+
79
+ /** A box in viewport coordinates, the space the overlay is drawn in. */
80
+ const boxOf = (el) => {
81
+ const r = el.getBoundingClientRect();
82
+ return { x: r.x, y: r.y, w: r.width, h: r.height };
83
+ };
84
+
85
+ function webglAvailable() {
86
+ try {
87
+ const c = document.createElement("canvas");
88
+ return !!(c.getContext("webgl2") || c.getContext("webgl"));
89
+ } catch (e) {
90
+ return false;
91
+ }
92
+ }
93
+
94
+ const chainFor = (effect) => {
95
+ if (!effect) return [];
96
+ if (Array.isArray(effect)) return effect;
97
+ try { return preset(effect) || []; } catch (e) { return []; }
98
+ };
99
+
100
+ /** New images have no box until they decode, and the rect must be final. */
101
+ async function settleImages(els) {
102
+ const imgs = els.flatMap((el) => [...el.querySelectorAll("img")]);
103
+ await Promise.all(imgs.map((im) => (im.complete && im.naturalWidth) ? null
104
+ : (typeof im.decode === "function" ? im.decode().catch(() => {}) : null)));
105
+ }
106
+
107
+ /**
108
+ * Run `update` as a shader transition.
109
+ *
110
+ * @param {() => (void|Promise<void>)} update renders the next route
111
+ * @param {object} [opts]
112
+ * @param {string|object[]} [opts.effect="t-fluid"] preset name or node array
113
+ * @param {number} [opts.duration=800] ms
114
+ * @param {string} [opts.fade="opaque"] how the two stills combine; see the
115
+ * pipeline's `fade` ("opaque", "dissolve", "morph")
116
+ * @param {number[]} [opts.crossfade=[0.05, 0.45]] the slice of progress in
117
+ * which the old content hands over to the new; the shapes still travel
118
+ * the whole duration
119
+ * @param {Element} [opts.root=document.body] where named elements are looked for
120
+ * @returns {{ updateCallbackDone: Promise<void>, ready: Promise<void>,
121
+ * finished: Promise<void>, skipTransition(): void }}
122
+ * the same shape as the platform's ViewTransition
123
+ */
124
+ function nodalityTransition(update, opts = {}) {
125
+ const root = opts.root || document.body;
126
+
127
+ // Nothing to add: let the platform do it, or just update.
128
+ if (prefersReducedMotion() || !webglAvailable()) {
129
+ if (typeof document.startViewTransition === "function") {
130
+ return document.startViewTransition(update);
131
+ }
132
+ const done = Promise.resolve().then(update);
133
+ return { updateCallbackDone: done, ready: done, finished: done, skipTransition() {} };
134
+ }
135
+
136
+ let skip = null;
137
+ let skipped = false;
138
+ const hidden = [];
139
+ let resolveUpdate, resolveReady;
140
+ const updateCallbackDone = new Promise((r) => { resolveUpdate = r; });
141
+ const ready = new Promise((r) => { resolveReady = r; });
142
+
143
+ const finished = (async () => {
144
+ // 1. Freeze the old side. Captures are async, so the update waits
145
+ // for them; that is the same order the platform uses.
146
+ const before = collect(root);
147
+ const olds = new Map();
148
+ // The old element's partner is not known yet, so it is rasterised
149
+ // as if it may grow to fill the viewport: the stills are vector
150
+ // until this point, and a small name drawn into a full-screen box
151
+ // from a 1x capture is the pixelation this avoids.
152
+ const reach = (rect) => Math.min(4, Math.max(1,
153
+ window.innerWidth / Math.max(rect.w, 1)));
154
+ await Promise.all([...before].map(async ([name, el]) => {
155
+ const rect = boxOf(el);
156
+ try {
157
+ olds.set(name, { rect, image: await captureStill(el, rect.w, rect.h, reach(rect)) });
158
+ } catch (e) {
159
+ console.warn(`[nodality] view transition: could not capture "${name}".`, e);
160
+ }
161
+ }));
162
+
163
+ // The overlay holds the old stills while the DOM changes under it,
164
+ // so there is no frame where the old element has gone and the
165
+ // transition has not yet begun.
166
+ const overlay = document.createElement("div");
167
+ overlay.setAttribute("data-nodality-view-transition", "");
168
+ overlay.setAttribute("aria-hidden", "true");
169
+ overlay.style.cssText = "position:fixed;inset:0;pointer-events:none;z-index:2147483000;";
170
+ const stills = new Map();
171
+ for (const [name, o] of olds) {
172
+ const img = o.image;
173
+ img.style.cssText = `position:absolute;left:${o.rect.x}px;top:${o.rect.y}px;` +
174
+ `width:${o.rect.w}px;height:${o.rect.h}px;`;
175
+ overlay.appendChild(img);
176
+ stills.set(name, img);
177
+ }
178
+ document.body.appendChild(overlay);
179
+
180
+ // 2. Update.
181
+ try {
182
+ await update();
183
+ } finally {
184
+ resolveUpdate();
185
+ }
186
+ await nextFrame();
187
+
188
+ // 3. Pair by name and freeze the new side.
189
+ const after = collect(root);
190
+ const pairs = [];
191
+ for (const [name, el] of after) {
192
+ if (olds.has(name)) pairs.push({ name, el, old: olds.get(name) });
193
+ }
194
+ await settleImages(pairs.map((p) => p.el));
195
+ // Hidden while the transition owns the pixels; it still lays out,
196
+ // so it measures and captures.
197
+ for (const p of pairs) {
198
+ p.el.style.visibility = "hidden";
199
+ hidden.push(p.el);
200
+ }
201
+ await Promise.all(pairs.map(async (p) => {
202
+ p.rect = boxOf(p.el);
203
+ p.image = await captureStill(p.el, p.rect.w, p.rect.h);
204
+ }));
205
+
206
+ // An old element with no partner fades out; a new one with no
207
+ // partner is simply there, as with the native transition's
208
+ // unpaired groups.
209
+ for (const [name, img] of stills) {
210
+ if (pairs.some((p) => p.name === name)) continue;
211
+ img.style.transition = `opacity ${Math.round((opts.duration || 800) / 2)}ms ease-out`;
212
+ requestAnimationFrame(() => { img.style.opacity = "0"; });
213
+ }
214
+
215
+ // 4. One pipeline per pair, all on one timeline.
216
+ const pipes = [];
217
+ for (const p of pairs) {
218
+ const host = document.createElement("div");
219
+ host.style.cssText = "position:absolute;inset:0;";
220
+ overlay.appendChild(host);
221
+ const pipe = applyRasterPipeline(host, chainFor(opts.effect || "t-fluid"), {
222
+ transition: {
223
+ oldImage: p.old.image, newImage: p.image,
224
+ oldRect: p.old.rect, oldTo: p.rect,
225
+ newRect: p.rect, newFrom: p.old.rect,
226
+ fade: opts.fade || "opaque",
227
+ // Each capture at its own aspect ratio, and the old
228
+ // content handed over early — see buildFragmentShader.
229
+ fit: "width",
230
+ crossfade: opts.crossfade || [0.05, 0.45],
231
+ },
232
+ });
233
+ if (pipe) pipes.push(pipe);
234
+ }
235
+ const group = {
236
+ progress: 0,
237
+ setProgress(t) {
238
+ for (const pipe of pipes) pipe.setProgress(t);
239
+ group.progress = Math.min(1, Math.max(0, t));
240
+ return group.progress;
241
+ },
242
+ };
243
+ group.setProgress(0);
244
+ await nextFrame();
245
+ // The pipelines are presenting the old side now; the stills under
246
+ // them can go.
247
+ for (const p of pairs) {
248
+ const img = stills.get(p.name);
249
+ if (img) img.remove();
250
+ }
251
+ resolveReady();
252
+
253
+ const tl = progressTimeline(group, { duration: opts.duration || 800 });
254
+ skip = () => tl.set(1);
255
+ if (skipped) skip();
256
+ await tl.to(1);
257
+
258
+ // 5. Hand the screen back to the real elements.
259
+ for (const p of pairs) p.el.style.visibility = "";
260
+ await nextFrame();
261
+ tl.destroy();
262
+ for (const pipe of pipes) pipe.destroy();
263
+ overlay.remove();
264
+ })();
265
+
266
+ // A failure mid-transition must not leave the page frozen under an
267
+ // overlay or with its new elements hidden.
268
+ finished.catch((e) => {
269
+ console.warn("[nodality] view transition failed:", e);
270
+ document.querySelectorAll("[data-nodality-view-transition]").forEach((o) => o.remove());
271
+ for (const el of hidden) el.style.visibility = "";
272
+ resolveUpdate();
273
+ resolveReady();
274
+ });
275
+
276
+ return {
277
+ updateCallbackDone,
278
+ ready,
279
+ finished: finished.catch(() => {}),
280
+ skipTransition() {
281
+ skipped = true;
282
+ if (skip) skip();
283
+ },
284
+ };
285
+ }
286
+
287
+ export { nodalityTransition };
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * nodality v1.3.26
2
+ * nodality v1.4.1
3
3
  * (c) 2026 Filip Vabrousek
4
4
  * License: MIT
5
5
  */
@@ -330,11 +330,28 @@ export function installAgentSurface({ mount, elements, nodes, morphs }) {
330
330
  const accepts = (field) => field.tagName === "SELECT"
331
331
  ? [...field.options].map((o) => o.value) : [];
332
332
 
333
+ /**
334
+ * The control a schema key names.
335
+ *
336
+ * A `labelInput` puts its `id` on the WRAPPER and renders an
337
+ * <input> with no name or id inside it. Matching `#key` alone
338
+ * found the div: the value was set on it as an expando, the
339
+ * read-back saw that same expando and reported the field as
340
+ * filled, and the form went out empty while the tool said
341
+ * `ok: true`. When the match is not itself a control, the
342
+ * control is the one inside it.
343
+ */
344
+ const CONTROL = "input, select, textarea";
345
+ const controlFor = (key) => {
346
+ const hit = form.querySelector(`[name="${key}"], #${CSS.escape(key)}`);
347
+ if (!hit || hit.matches(CONTROL)) return hit;
348
+ return hit.querySelector(CONTROL);
349
+ };
350
+
333
351
  for (const key of Object.keys(props)) {
334
352
  if (args[key] === undefined) continue;
335
353
  const want = args[key];
336
- const field = form.querySelector(
337
- `[name="${key}"], #${CSS.escape(key)}`);
354
+ const field = controlFor(key);
338
355
  // Named by the schema and carried by nothing. Also silent
339
356
  // before, and the same lie by omission.
340
357
  if (!field) { absent.push(key); continue; }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nodality",
3
- "version": "1.3.26",
4
- "description": "A lightweight library for declarative UI elements.",
3
+ "version": "1.4.1",
4
+ "description": "A UI is two arrays: what exists, and what is done to it. Zero-dependency declarative UI library with build-time prerendering, composable WebGL effects, and an MCP server and validator for coding agents.",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
7
7
  "bin": {
@@ -39,6 +39,8 @@
39
39
  "./inspect": "./lib/raster-inspect.js",
40
40
  "./examples/*": "./examples/*.js",
41
41
  "./transition": "./lib/transition.js",
42
+ "./view-transition": "./lib/view-transition.js",
43
+ "./responsive": "./lib/responsive.js",
42
44
  "./designer": "./lib/designer.js",
43
45
  "./react": {
44
46
  "types": "./lib/react.d.ts",
@@ -87,7 +89,15 @@
87
89
  "nodality",
88
90
  "effects",
89
91
  "style",
90
- "open-source"
92
+ "open-source",
93
+ "ai",
94
+ "llm",
95
+ "agents",
96
+ "ai-agents",
97
+ "mcp",
98
+ "model-context-protocol",
99
+ "code-generation",
100
+ "static-site-generator"
91
101
  ],
92
102
  "devDependencies": {
93
103
  "@babel/core": "^7.28.0",
@@ -185,6 +185,15 @@ Rules that are not obvious from the schema:
185
185
  - **`agent-surface` is opt-in and allow-listed.** No form is exposed
186
186
  unless named in `forms`. Do not add it unless the user asks for an
187
187
  agent-operable page.
188
+ - **`arrange` switches a group's arrangement inside a width range.**
189
+ `{ op: { name: "arrange", mode: "column" }, target: ["hero"], range: [0, 640] }`
190
+ stacks a `row` or `cards` grid at 0–640 px, and `mode: "row"` keeps it
191
+ side by side; on a `nav`, `mode: "collapse"` shows the menu button up to
192
+ the range's end and `mode: "expand"` the full bar. Ranges are inclusive
193
+ CSS px. Do not guess them: `nodality/responsive`'s `respond()` measures
194
+ the page in a browser and emits one node per interval, covering every
195
+ width, switching exactly where a group stops fitting (experimental). Of
196
+ two overlapping ranges on one element, the first declared wins.
188
197
 
189
198
  A complete navigation graph is one node:
190
199