nodality 1.5.1 → 1.5.3
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 +2 -22
- package/bin/mcp-server.mjs +0 -98
- package/bin/nodality.mjs +3 -28
- package/dist/animator.cjs.js.LICENSE.txt +1 -1
- package/dist/animator.esm.js.LICENSE.txt +1 -1
- package/dist/audionew.cjs.js +1 -1
- package/dist/audionew.cjs.js.LICENSE.txt +1 -1
- package/dist/audionew.esm.js +1 -1
- package/dist/audionew.esm.js.LICENSE.txt +1 -1
- package/dist/base.cjs.js.LICENSE.txt +1 -1
- package/dist/base.esm.js.LICENSE.txt +1 -1
- package/dist/beta-desktop-bar.cjs.js.LICENSE.txt +1 -1
- package/dist/beta-desktop-bar.esm.js.LICENSE.txt +1 -1
- package/dist/beta-mobile-bar.cjs.js.LICENSE.txt +1 -1
- package/dist/beta-mobile-bar.esm.js.LICENSE.txt +1 -1
- package/dist/bundle.umd.js +1 -1
- package/dist/bundle.umd.js.LICENSE.txt +28 -1
- package/dist/button.cjs.js +1 -1
- package/dist/button.cjs.js.LICENSE.txt +1 -1
- package/dist/button.esm.js +1 -1
- package/dist/button.esm.js.LICENSE.txt +1 -1
- package/dist/card-getter.cjs.js.LICENSE.txt +1 -1
- package/dist/card-getter.esm.js.LICENSE.txt +1 -1
- package/dist/center.cjs.js.LICENSE.txt +1 -1
- package/dist/center.esm.js.LICENSE.txt +1 -1
- package/dist/checkbox.cjs.js +1 -1
- package/dist/checkbox.cjs.js.LICENSE.txt +1 -1
- package/dist/checkbox.esm.js +1 -1
- package/dist/checkbox.esm.js.LICENSE.txt +1 -1
- package/dist/code.cjs.js +1 -1
- package/dist/code.cjs.js.LICENSE.txt +1 -1
- package/dist/code.esm.js +1 -1
- package/dist/code.esm.js.LICENSE.txt +1 -1
- package/dist/container.cjs.js +1 -1
- package/dist/container.cjs.js.LICENSE.txt +1 -1
- package/dist/container.esm.js +1 -1
- package/dist/container.esm.js.LICENSE.txt +1 -1
- package/dist/data-list.cjs.js.LICENSE.txt +1 -1
- package/dist/data-list.esm.js.LICENSE.txt +1 -1
- package/dist/designer.cjs.js +1 -1
- package/dist/designer.cjs.js.LICENSE.txt +28 -1
- package/dist/designer.esm.js +1 -1
- package/dist/designer.esm.js.LICENSE.txt +28 -1
- package/dist/element-mapper.cjs.js +1 -1
- package/dist/element-mapper.cjs.js.LICENSE.txt +1 -1
- package/dist/element-mapper.esm.js +1 -1
- package/dist/element-mapper.esm.js.LICENSE.txt +1 -1
- package/dist/finalresult.esm.js +1 -1
- package/dist/finalresult.esm.js.LICENSE.txt +28 -1
- package/dist/flex-card.cjs.js.LICENSE.txt +1 -1
- package/dist/flex-card.esm.js.LICENSE.txt +1 -1
- package/dist/flex-grid.cjs.js +1 -1
- package/dist/flex-grid.cjs.js.LICENSE.txt +1 -1
- package/dist/flex-grid.esm.js +1 -1
- package/dist/flex-grid.esm.js.LICENSE.txt +1 -1
- package/dist/flex-row.cjs.js +1 -1
- package/dist/flex-row.cjs.js.LICENSE.txt +1 -1
- package/dist/flex-row.esm.js +1 -1
- package/dist/flex-row.esm.js.LICENSE.txt +1 -1
- package/dist/floating-input.cjs.js.LICENSE.txt +1 -1
- package/dist/floating-input.esm.js.LICENSE.txt +1 -1
- package/dist/free.cjs.js.LICENSE.txt +1 -1
- package/dist/free.esm.js.LICENSE.txt +1 -1
- package/dist/horizontal-scroller.cjs.js.LICENSE.txt +1 -1
- package/dist/horizontal-scroller.esm.js.LICENSE.txt +1 -1
- package/dist/image-picker.cjs.js.LICENSE.txt +1 -1
- package/dist/image-picker.esm.js.LICENSE.txt +1 -1
- package/dist/image.cjs.js +1 -1
- package/dist/image.cjs.js.LICENSE.txt +1 -1
- package/dist/image.esm.js +1 -1
- package/dist/image.esm.js.LICENSE.txt +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.LICENSE.txt +28 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.LICENSE.txt +28 -1
- package/dist/keyframe-animation.cjs.js.LICENSE.txt +1 -1
- package/dist/keyframe-animation.esm.js.LICENSE.txt +1 -1
- package/dist/link-getter.cjs.js +1 -1
- package/dist/link-getter.cjs.js.LICENSE.txt +1 -1
- package/dist/link-getter.esm.js +1 -1
- package/dist/link-getter.esm.js.LICENSE.txt +1 -1
- package/dist/link.cjs.js +1 -1
- package/dist/link.cjs.js.LICENSE.txt +1 -1
- package/dist/link.esm.js +1 -1
- package/dist/link.esm.js.LICENSE.txt +1 -1
- package/dist/meta-adder.cjs.js.LICENSE.txt +1 -1
- package/dist/meta-adder.esm.js.LICENSE.txt +1 -1
- package/dist/modal-2025.cjs.js.LICENSE.txt +1 -1
- package/dist/modal-2025.esm.js.LICENSE.txt +1 -1
- package/dist/multiswitcher.cjs.js +1 -1
- package/dist/multiswitcher.cjs.js.LICENSE.txt +1 -1
- package/dist/multiswitcher.esm.js +1 -1
- package/dist/multiswitcher.esm.js.LICENSE.txt +1 -1
- package/dist/new-nav-bar.cjs.js.LICENSE.txt +1 -1
- package/dist/new-nav-bar.esm.js.LICENSE.txt +1 -1
- package/dist/picker.cjs.js.LICENSE.txt +1 -1
- package/dist/picker.esm.js.LICENSE.txt +1 -1
- package/dist/progress.cjs.js.LICENSE.txt +1 -1
- package/dist/progress.esm.js.LICENSE.txt +1 -1
- package/dist/radio.cjs.js.LICENSE.txt +1 -1
- package/dist/radio.esm.js.LICENSE.txt +1 -1
- package/dist/range.cjs.js.LICENSE.txt +1 -1
- package/dist/range.esm.js.LICENSE.txt +1 -1
- package/dist/scroll-video.cjs.js.LICENSE.txt +1 -1
- package/dist/scroll-video.esm.js.LICENSE.txt +1 -1
- package/dist/side-bar.cjs.js.LICENSE.txt +1 -1
- package/dist/side-bar.esm.js.LICENSE.txt +1 -1
- package/dist/side-nav-bar.cjs.js.LICENSE.txt +1 -1
- package/dist/side-nav-bar.esm.js.LICENSE.txt +1 -1
- package/dist/simple-bar.cjs.js.LICENSE.txt +1 -1
- package/dist/simple-bar.esm.js.LICENSE.txt +1 -1
- package/dist/slider-2025.cjs.js +1 -1
- package/dist/slider-2025.cjs.js.LICENSE.txt +1 -1
- package/dist/slider-2025.esm.js +1 -1
- package/dist/slider-2025.esm.js.LICENSE.txt +1 -1
- package/dist/spacer.cjs.js.LICENSE.txt +1 -1
- package/dist/spacer.esm.js.LICENSE.txt +1 -1
- package/dist/stack.cjs.js.LICENSE.txt +1 -1
- package/dist/stack.esm.js.LICENSE.txt +1 -1
- package/dist/stacker.cjs.js.LICENSE.txt +1 -1
- package/dist/stacker.esm.js.LICENSE.txt +1 -1
- package/dist/table.cjs.js.LICENSE.txt +1 -1
- package/dist/table.esm.js.LICENSE.txt +1 -1
- package/dist/text-field.cjs.js.LICENSE.txt +1 -1
- package/dist/text-field.esm.js.LICENSE.txt +1 -1
- package/dist/text.cjs.js +1 -1
- package/dist/text.cjs.js.LICENSE.txt +1 -1
- package/dist/text.esm.js +1 -1
- package/dist/text.esm.js.LICENSE.txt +1 -1
- package/dist/theme.cjs.js.LICENSE.txt +1 -1
- package/dist/theme.esm.js.LICENSE.txt +1 -1
- package/dist/transform-anim.cjs.js.LICENSE.txt +1 -1
- package/dist/transform-anim.esm.js.LICENSE.txt +1 -1
- package/dist/ulist.cjs.js +1 -1
- package/dist/ulist.cjs.js.LICENSE.txt +1 -1
- package/dist/ulist.esm.js +1 -1
- package/dist/ulist.esm.js.LICENSE.txt +1 -1
- package/dist/video.cjs.js +1 -1
- package/dist/video.cjs.js.LICENSE.txt +1 -1
- package/dist/video.esm.js +1 -1
- package/dist/video.esm.js.LICENSE.txt +1 -1
- package/dist/wrap.cjs.js.LICENSE.txt +1 -1
- package/dist/wrap.esm.js.LICENSE.txt +1 -1
- package/dist/zoom-card.cjs.js.LICENSE.txt +1 -1
- package/dist/zoom-card.esm.js.LICENSE.txt +1 -1
- package/layout/animator.js +1 -1
- package/layout/audio.js +1 -1
- package/layout/audionew.js +3 -2
- package/layout/base.js +1 -1
- package/layout/beta-desktop-bar.js +1 -1
- package/layout/beta-mobile-bar.js +1 -1
- package/layout/button.js +9 -7
- package/layout/center.js +1 -1
- package/layout/checkbox.js +3 -2
- package/layout/circle.js +1 -1
- package/layout/code.js +5 -11
- package/layout/container.js +14 -14
- package/layout/dropdown-2025.js +3 -2
- package/layout/flex-card.js +1 -1
- package/layout/flex-grid.js +4 -3
- package/layout/flex-row.js +3 -9
- package/layout/form-components/custom.js +1 -1
- package/layout/form-components/data-list.js +1 -1
- package/layout/form-components/floating-input.js +1 -1
- package/layout/form-components/form-all.js +1 -1
- package/layout/form-components/form.js +1 -1
- package/layout/form-components/image-picker.js +1 -1
- package/layout/form-components/picker.js +1 -1
- package/layout/form-components/radio.js +1 -1
- package/layout/form-components/radiogroup.js +1 -1
- package/layout/form-components/range.js +1 -1
- package/layout/free.js +1 -1
- package/layout/grid-overlay.js +1 -1
- package/layout/grid-switcher.js +1 -1
- package/layout/grid.js +1 -1
- package/layout/horizontal-scroller.js +1 -1
- package/layout/image.js +18 -17
- package/layout/index.js +1 -1
- package/layout/link.js +12 -12
- package/layout/list.js +1 -1
- package/layout/meta-adder.js +1 -1
- package/layout/modal-2025.js +1 -1
- package/layout/morph.js +1 -1
- package/layout/multiswitcher.js +3 -2
- package/layout/nav-bar.js +1 -1
- package/layout/nav-factor/custom-div.js +1 -1
- package/layout/new-nav-bar.js +1 -1
- package/layout/polygon.js +1 -1
- package/layout/prerender-site.js +1 -1
- package/layout/prerender.js +1 -1
- package/layout/progress.js +1 -1
- package/layout/row.js +1 -1
- package/layout/scroll-video.js +1 -1
- package/layout/shop.js +1 -1
- package/layout/side-bar.js +1 -1
- package/layout/side-nav-bar.js +1 -1
- package/layout/simple-bar.js +1 -1
- package/layout/slider-2025.js +1 -1
- package/layout/spacer.js +1 -1
- package/layout/stack.js +1 -1
- package/layout/svg.js +1 -1
- package/layout/switcher.js +3 -2
- package/layout/table.js +1 -1
- package/layout/text-field.js +1 -1
- package/layout/text.js +21 -13
- package/layout/ulist.js +3 -2
- package/layout/video.js +3 -3
- package/layout/wrap.js +1 -1
- package/layout/zoom-card.js +1 -1
- package/lib/agent-surface.js +1 -1
- package/lib/card-getter.js +1 -1
- package/lib/check-page.js +1 -1
- package/lib/codegen.js +11 -2
- package/lib/data.js +1 -1
- package/lib/designer.js +4 -3
- package/lib/element-mapper.js +3 -2
- package/lib/element-params.generated.js +1 -1
- package/lib/grid-geometry.js +1 -1
- package/lib/keyframe-animation.js +1 -1
- package/lib/known-inert.js +1 -1
- package/lib/link-getter.js +1 -1
- package/lib/morph-node.js +1 -1
- package/lib/normalize-spec.js +1 -1
- package/lib/op-semantics.js +178 -0
- package/lib/parse-html.js +1 -1
- package/lib/raster-inspect.js +1 -1
- package/lib/raster-ops.js +1 -1
- package/lib/raster-presets.js +1 -1
- package/lib/react.js +1 -1
- package/lib/resolve-refs.js +1 -1
- package/lib/responsive.js +41 -1
- package/lib/scroll-video.js +1 -1
- package/lib/seo.js +1 -1
- package/lib/stacker.js +1 -1
- package/lib/suggest.js +1 -1
- package/lib/theme.js +1 -1
- package/lib/transform-anim.js +1 -1
- package/lib/transition.js +1 -1
- package/lib/validate-nodes.js +13 -2
- package/lib/view-transition.js +1 -1
- package/lib/webmcp-adapter.js +1 -1
- package/package.json +1 -1
- package/skills/nodality/SKILL.md +3 -5
- package/bin/dev-server.mjs +0 -200
- package/lib/dev-inspector.js +0 -295
- package/lib/dev-state.js +0 -257
- package/skills/nodality-apply-comments/SKILL.md +0 -52
- package/skills/nodality-current/SKILL.md +0 -69
package/layout/text.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* nodality v1.5.
|
|
2
|
+
* nodality v1.5.3
|
|
3
3
|
* (c) 2026 Filip Vabrousek
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import {Animator} from "./animator.js";
|
|
8
8
|
|
|
9
|
-
import { toObjectSource } from "../lib/codegen.js";
|
|
9
|
+
import { toObjectSource, jsString } from "../lib/codegen.js";
|
|
10
10
|
import { keyPattern } from "../lib/codegen.js";
|
|
11
11
|
// 13:28 07/04/2020 - BEGIN NOTHING GONNA STOP US NOW Lets go!
|
|
12
12
|
|
|
@@ -23,7 +23,7 @@ class Text extends Animator {
|
|
|
23
23
|
this.elCSS = [];
|
|
24
24
|
this.html = [];
|
|
25
25
|
this.react = [];
|
|
26
|
-
this.code.push(`new Text(
|
|
26
|
+
this.code.push(`new Text(${jsString(this.text)})`);
|
|
27
27
|
//console.log("15/12/25 cool");
|
|
28
28
|
}
|
|
29
29
|
|
|
@@ -41,7 +41,7 @@ class Text extends Animator {
|
|
|
41
41
|
|
|
42
42
|
const objString = toObjectSource(cleanedObj, 4);
|
|
43
43
|
|
|
44
|
-
return [`new Text(
|
|
44
|
+
return [`new Text(${jsString(this.text)}).set(${objString})`];
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
|
|
@@ -120,26 +120,34 @@ class Text extends Animator {
|
|
|
120
120
|
return /(\*\*.*\*\*|\*.*\*|`[^`]+`|\[.*?\]\(.*?\)|^# )/m.test(str);
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
-
// Minimal Markdown parser
|
|
123
|
+
// Minimal Markdown parser. The text is escaped first and only the
|
|
124
|
+
// tags below are added back, so text can never inject markup; a link keeps
|
|
125
|
+
// its href only for http(s), mailto, tel or a relative URL.
|
|
124
126
|
parseMarkdown(mdString) {
|
|
125
|
-
let html = mdString
|
|
127
|
+
let html = String(mdString)
|
|
128
|
+
.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">")
|
|
129
|
+
.replace(/"/g, """).replace(/'/g, "'");
|
|
126
130
|
|
|
127
131
|
// Headers: # H1, ## H2, ### H3
|
|
128
132
|
html = html.replace(/^### (.*$)/gim, "<h3>$1</h3>");
|
|
129
133
|
html = html.replace(/^## (.*$)/gim, "<h2>$1</h2>");
|
|
130
134
|
html = html.replace(/^# (.*$)/gim, "<h1>$1</h1>");
|
|
131
135
|
|
|
132
|
-
// Bold
|
|
133
|
-
html = html.replace(/\*\*(
|
|
134
|
-
|
|
135
|
-
// Italic: *text*
|
|
136
|
-
html = html.replace(/\*(.*?)\*/g, "<em>$1</em>");
|
|
136
|
+
// Bold and italic only when the asterisks hug text, so "2 * 3 * 4" stays.
|
|
137
|
+
html = html.replace(/\*\*(?=\S)(.+?)(?<=\S)\*\*/g, "<strong>$1</strong>");
|
|
138
|
+
html = html.replace(/\*(?=\S)([^*\n]+?)(?<=\S)\*/g, "<em>$1</em>");
|
|
137
139
|
|
|
138
140
|
// Inline code: `code`
|
|
139
141
|
html = html.replace(/`([^`]+)`/g, "<code>$1</code>");
|
|
140
142
|
|
|
141
|
-
// Links: [text](url)
|
|
142
|
-
|
|
143
|
+
// Links: [text](url). Browsers drop tabs and newlines inside a URL, so the
|
|
144
|
+
// scheme is checked after removing them ("java\tscript:" is javascript:).
|
|
145
|
+
html = html.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (m, label, url) => {
|
|
146
|
+
const bare = url.replace(/[\u0000-\u0020]/g, "");
|
|
147
|
+
const scheme = /^([a-z][a-z0-9+.-]*):/i.exec(bare);
|
|
148
|
+
const safe = !scheme || /^(https?|mailto|tel)$/i.test(scheme[1]);
|
|
149
|
+
return safe ? `<a href="${bare}">${label}</a>` : label;
|
|
150
|
+
});
|
|
143
151
|
|
|
144
152
|
// Line breaks
|
|
145
153
|
html = html.replace(/\n/g, "<br>");
|
package/layout/ulist.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* nodality v1.5.
|
|
2
|
+
* nodality v1.5.3
|
|
3
3
|
* (c) 2026 Filip Vabrousek
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import {Animator} from "./animator.js";
|
|
8
8
|
|
|
9
|
+
import { jsString } from "../lib/codegen.js";
|
|
9
10
|
class UList extends Animator {
|
|
10
11
|
constructor() {
|
|
11
12
|
super();
|
|
@@ -195,7 +196,7 @@ toCode(indent = 0) {
|
|
|
195
196
|
code += `\n${pad} .setItems([\n` +
|
|
196
197
|
this.items.map(c =>
|
|
197
198
|
typeof c === "string"
|
|
198
|
-
? `${" ".repeat(indent + 4)}
|
|
199
|
+
? `${" ".repeat(indent + 4)}${jsString(c)}`
|
|
199
200
|
: c.toCode(indent + 4)
|
|
200
201
|
).join(",\n") +
|
|
201
202
|
`\n${pad} ])`;
|
package/layout/video.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* nodality v1.5.
|
|
2
|
+
* nodality v1.5.3
|
|
3
3
|
* (c) 2026 Filip Vabrousek
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { Animator } from "./animator.js";
|
|
8
|
-
import { toObjectSource } from "../lib/codegen.js";
|
|
8
|
+
import { toObjectSource, jsString } from "../lib/codegen.js";
|
|
9
9
|
|
|
10
10
|
// Video — a <video> element as data.
|
|
11
11
|
//
|
|
@@ -231,7 +231,7 @@ class Video extends Animator {
|
|
|
231
231
|
const cleaned = Object.fromEntries(
|
|
232
232
|
Object.entries(this.options || {}).filter(([, v]) => v != null)
|
|
233
233
|
);
|
|
234
|
-
return [`new Video(
|
|
234
|
+
return [`new Video(${jsString(this.url)}).set(${toObjectSource(cleaned, 4)})`];
|
|
235
235
|
}
|
|
236
236
|
|
|
237
237
|
render(el) {
|
package/layout/wrap.js
CHANGED
package/layout/zoom-card.js
CHANGED
package/lib/agent-surface.js
CHANGED
package/lib/card-getter.js
CHANGED
package/lib/check-page.js
CHANGED
package/lib/codegen.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* nodality v1.5.
|
|
2
|
+
* nodality v1.5.3
|
|
3
3
|
* (c) 2026 Filip Vabrousek
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
* unquoteKeys(jsonString) // already have the JSON? just fix the keys
|
|
28
28
|
* IDENT_KEY // the pattern, for call sites that chain
|
|
29
29
|
* // further replaces onto the same string
|
|
30
|
+
* jsString(value) // a value as a quoted, escaped JS string
|
|
30
31
|
*/
|
|
31
32
|
|
|
32
33
|
// A quoted JSON key whose bare form is a valid JS identifier. Anything
|
|
@@ -59,4 +60,12 @@ function toObjectSource(value, indent = 4) {
|
|
|
59
60
|
return unquoteKeys(JSON.stringify(value, null, indent));
|
|
60
61
|
}
|
|
61
62
|
|
|
62
|
-
|
|
63
|
+
/**
|
|
64
|
+
* A value as a JavaScript string literal. Every value pasted into generated
|
|
65
|
+
* source goes through this, so page text can never close the string it sits in.
|
|
66
|
+
*/
|
|
67
|
+
function jsString(value) {
|
|
68
|
+
return JSON.stringify(String(value));
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export { toObjectSource, unquoteKeys, keyPattern, jsString };
|
package/lib/data.js
CHANGED
package/lib/designer.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* nodality v1.5.
|
|
2
|
+
* nodality v1.5.3
|
|
3
3
|
* (c) 2026 Filip Vabrousek
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -81,6 +81,7 @@ import { Shop } from "../layout/shop.js";
|
|
|
81
81
|
|
|
82
82
|
|
|
83
83
|
|
|
84
|
+
import { jsString } from "./codegen.js";
|
|
84
85
|
// Audio, progress, TextField, import navFactor
|
|
85
86
|
class Des {
|
|
86
87
|
constructor() {
|
|
@@ -1446,7 +1447,7 @@ new Slider(texts, null, { tintColor: "#e74c3c", inactiveColor: "#ccc" })
|
|
|
1446
1447
|
let codea = document.createElement("code");
|
|
1447
1448
|
|
|
1448
1449
|
|
|
1449
|
-
const prepare = this.code.map(c => `${c}.render(
|
|
1450
|
+
const prepare = this.code.map(c => `${c}.render(${jsString(target)}); \n \n`);
|
|
1450
1451
|
this.code = prepare;
|
|
1451
1452
|
|
|
1452
1453
|
codea.textContent = this.code;//.replaceAll(",.", ".").replaceAll(",, new", "new").replaceAll(/\[\s*\n*,\s*\n*/g, "["); // replace with your code
|
|
@@ -1498,7 +1499,7 @@ new Slider(texts, null, { tintColor: "#e74c3c", inactiveColor: "#ccc" })
|
|
|
1498
1499
|
// when run from the CLI — no rendering side effects.
|
|
1499
1500
|
if (typeof globalThis !== "undefined" && globalThis.NODALITY_EMIT === true) {
|
|
1500
1501
|
// Populate this.code without triggering DOM work.
|
|
1501
|
-
const prepare = this.code.map((c) => `${c}.render(
|
|
1502
|
+
const prepare = this.code.map((c) => `${c}.render(${jsString((obj && obj.mount) || "#mount")})`);
|
|
1502
1503
|
globalThis.__NODALITY_EMITTED__ = prepare;
|
|
1503
1504
|
return this;
|
|
1504
1505
|
}
|
package/lib/element-mapper.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* nodality v1.5.
|
|
2
|
+
* nodality v1.5.3
|
|
3
3
|
* (c) 2026 Filip Vabrousek
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -74,6 +74,7 @@ import { GridOverlay } from "../layout/grid-overlay.js";
|
|
|
74
74
|
import { Shop } from "../layout/shop.js";
|
|
75
75
|
|
|
76
76
|
|
|
77
|
+
import { jsString } from "./codegen.js";
|
|
77
78
|
// The closed set of `type:` values mapType understands, in the order it
|
|
78
79
|
// tests them. Kept beside the dispatch so a new branch without a new entry
|
|
79
80
|
// is visible in review — the vocabulary and the router should not drift.
|
|
@@ -557,7 +558,7 @@ animation: {
|
|
|
557
558
|
justifyContent: "center",
|
|
558
559
|
alignItems: "center",
|
|
559
560
|
position: "absolute",
|
|
560
|
-
id:
|
|
561
|
+
id: ${jsString(obj.el.id ? String(obj.el.id) : "#first")},
|
|
561
562
|
scale: 0.3,
|
|
562
563
|
${ft?.animation ? animation : ""}${
|
|
563
564
|
// Wrapper routes its options through commonMethods(), so a raster
|
package/lib/grid-geometry.js
CHANGED
package/lib/known-inert.js
CHANGED
package/lib/link-getter.js
CHANGED
package/lib/morph-node.js
CHANGED
package/lib/normalize-spec.js
CHANGED
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* nodality v1.5.3
|
|
3
|
+
* (c) 2026 Filip Vabrousek
|
|
4
|
+
* License: MIT
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/*!
|
|
8
|
+
* op-semantics.js: how the nodes of each op combine, declared as data.
|
|
9
|
+
*
|
|
10
|
+
* Read from the renderer, not designed. Each entry records what the code does
|
|
11
|
+
* today; __tests__/unit/op-semantics.test.mjs checks the lookups behind it.
|
|
12
|
+
* The validator uses it to report nodes that can never apply, and
|
|
13
|
+
* describeOps() hands it to agents.
|
|
14
|
+
*
|
|
15
|
+
* combine
|
|
16
|
+
* first the first node with this op that reaches an element applies;
|
|
17
|
+
* later ones are ignored (ElementMapper.filtero, Array.find)
|
|
18
|
+
* sequence every node applies, in array order. link-style: later values
|
|
19
|
+
* overwrite earlier ones. Raster ops: chained within their stage,
|
|
20
|
+
* and stages always run field, warp, cell, displace, color, so
|
|
21
|
+
* order only matters between ops of one stage.
|
|
22
|
+
* inert accepted by the validator, read by no renderer code
|
|
23
|
+
*
|
|
24
|
+
* scope (what "reaches" means)
|
|
25
|
+
* element per target element; a node without `target` reaches every one
|
|
26
|
+
* range per element and overlapping viewport range (arrange)
|
|
27
|
+
* page one decision per page; `target` is not consulted
|
|
28
|
+
*
|
|
29
|
+
* slot ops that share one decision (layout and slayout)
|
|
30
|
+
*
|
|
31
|
+
* Pure module: no DOM at import.
|
|
32
|
+
*/
|
|
33
|
+
import { RASTER_OP_NAMES } from "./raster-ops.js";
|
|
34
|
+
|
|
35
|
+
const MAX_WIDTH = 99999;
|
|
36
|
+
|
|
37
|
+
const DESIGN_SEMANTICS = {
|
|
38
|
+
animation: { combine: "first", scope: "element" },
|
|
39
|
+
arrange: { combine: "first", scope: "range" },
|
|
40
|
+
background: { combine: "first", scope: "element" },
|
|
41
|
+
blast: { combine: "first", scope: "element" },
|
|
42
|
+
"card-style": { combine: "first", scope: "page" },
|
|
43
|
+
filter: { combine: "first", scope: "element" },
|
|
44
|
+
gradient: { combine: "first", scope: "element" },
|
|
45
|
+
layout: { combine: "first", scope: "page", slot: "layout" },
|
|
46
|
+
slayout: { combine: "first", scope: "page", slot: "layout" },
|
|
47
|
+
// LinkStyler.style applies every matching node in order and only
|
|
48
|
+
// compares an element against target[0].
|
|
49
|
+
"link-style": { combine: "sequence", scope: "element", firstTargetOnly: true },
|
|
50
|
+
margin: { combine: "first", scope: "element" },
|
|
51
|
+
navStyle: { combine: "inert", scope: "element" },
|
|
52
|
+
shadow: { combine: "first", scope: "element" },
|
|
53
|
+
span: { combine: "first", scope: "element" },
|
|
54
|
+
transform: { combine: "first", scope: "element" },
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export const OP_SEMANTICS = Object.freeze({
|
|
58
|
+
...DESIGN_SEMANTICS,
|
|
59
|
+
...Object.fromEntries(RASTER_OP_NAMES.map((name) =>
|
|
60
|
+
[name, { combine: "sequence", scope: "element", byStage: true }])),
|
|
61
|
+
morph: { combine: "sequence", scope: "page" },
|
|
62
|
+
"agent-surface": { combine: "first", scope: "page" },
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
/** The op name a node carries, whichever form it is written in. */
|
|
66
|
+
export function opName(node) {
|
|
67
|
+
if (!node || typeof node !== "object") return null;
|
|
68
|
+
if (typeof node.op === "string") return node.op;
|
|
69
|
+
if (node.op && typeof node.op === "object" && typeof node.op.name === "string") return node.op.name;
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const bare = (id) => String(id).replace(/^#/, "");
|
|
74
|
+
|
|
75
|
+
function rangeOf(node) {
|
|
76
|
+
const r = Array.isArray(node.range) && node.range.length === 2 ? node.range : [0, MAX_WIDTH];
|
|
77
|
+
const lo = Number(r[0]);
|
|
78
|
+
const hi = Number(r[1]);
|
|
79
|
+
return [Number.isFinite(lo) ? lo : 0, Number.isFinite(hi) ? hi : MAX_WIDTH];
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Nodes that lose to an earlier node under the declared rules, and nodes of
|
|
84
|
+
* inert ops. Each finding: { index, code, by, lost, detail }.
|
|
85
|
+
* SHADOWED_NODE `lost` lists the targets (or "page") the node loses on;
|
|
86
|
+
* `by` the indices of the nodes that win there; `whole` is
|
|
87
|
+
* true when the node applies nowhere.
|
|
88
|
+
* INERT_OP no renderer code reads this op.
|
|
89
|
+
*/
|
|
90
|
+
export function shadowedNodes(nodes) {
|
|
91
|
+
const out = [];
|
|
92
|
+
if (!Array.isArray(nodes)) return out;
|
|
93
|
+
const seenPage = new Map(); // slot -> first index
|
|
94
|
+
const seenAll = new Map(); // slot -> first untargeted index
|
|
95
|
+
const seenEl = new Map(); // `${slot}|${id}` -> first index
|
|
96
|
+
const seenRange = new Map(); // `${slot}|${id}` -> [{ index, lo, hi }]
|
|
97
|
+
|
|
98
|
+
nodes.forEach((node, index) => {
|
|
99
|
+
const name = opName(node);
|
|
100
|
+
const sem = name && OP_SEMANTICS[name];
|
|
101
|
+
if (!sem) return;
|
|
102
|
+
if (sem.combine === "inert") {
|
|
103
|
+
out.push({ index, code: "INERT_OP", by: [], lost: [], whole: true,
|
|
104
|
+
detail: `No renderer code reads "${name}"; this node does nothing.` });
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
if (sem.combine !== "first") return;
|
|
108
|
+
const slot = sem.slot || name;
|
|
109
|
+
|
|
110
|
+
if (sem.scope === "page") {
|
|
111
|
+
if (seenPage.has(slot)) {
|
|
112
|
+
const by = seenPage.get(slot);
|
|
113
|
+
out.push({ index, code: "SHADOWED_NODE", by: [by], lost: ["page"], whole: true,
|
|
114
|
+
detail: `Node ${by} already decides "${slot}" for the page; this node does nothing.` });
|
|
115
|
+
} else {
|
|
116
|
+
seenPage.set(slot, index);
|
|
117
|
+
}
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const targets = Array.isArray(node.target) && node.target.length ? node.target.map(bare) : null;
|
|
122
|
+
|
|
123
|
+
if (sem.scope === "range") {
|
|
124
|
+
if (!targets) return;
|
|
125
|
+
const [lo, hi] = rangeOf(node);
|
|
126
|
+
const lost = [];
|
|
127
|
+
const by = new Set();
|
|
128
|
+
for (const id of targets) {
|
|
129
|
+
const key = `${slot}|${id}`;
|
|
130
|
+
const earlier = seenRange.get(key) || [];
|
|
131
|
+
const hits = earlier.filter((e) => e.lo <= hi && lo <= e.hi);
|
|
132
|
+
if (hits.length) {
|
|
133
|
+
lost.push(id);
|
|
134
|
+
hits.forEach((h) => by.add(h.index));
|
|
135
|
+
}
|
|
136
|
+
seenRange.set(key, [...earlier, { index, lo, hi }]);
|
|
137
|
+
}
|
|
138
|
+
if (lost.length) {
|
|
139
|
+
out.push({ index, code: "SHADOWED_NODE", by: [...by], lost, whole: false,
|
|
140
|
+
detail: `On ${lost.join(", ")}, an earlier "${slot}" node covers part of [${lo}, ${hi}]; there the earlier node wins.` });
|
|
141
|
+
}
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// scope "element"
|
|
146
|
+
if (seenAll.has(slot)) {
|
|
147
|
+
const by = seenAll.get(slot);
|
|
148
|
+
out.push({ index, code: "SHADOWED_NODE", by: [by], lost: targets || ["all"], whole: true,
|
|
149
|
+
detail: `Node ${by} has no target, so it reaches every element first; this node does nothing.` });
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
if (!targets) {
|
|
153
|
+
const earlier = [...seenEl.entries()].filter(([k]) => k.startsWith(`${slot}|`));
|
|
154
|
+
if (earlier.length) {
|
|
155
|
+
out.push({ index, code: "SHADOWED_NODE", by: [...new Set(earlier.map(([, i]) => i))],
|
|
156
|
+
lost: earlier.map(([k]) => k.slice(slot.length + 1)), whole: false,
|
|
157
|
+
detail: `On ${earlier.map(([k]) => k.slice(slot.length + 1)).join(", ")}, an earlier "${slot}" node wins; this node applies to every other element.` });
|
|
158
|
+
}
|
|
159
|
+
seenAll.set(slot, index);
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
const lost = [];
|
|
163
|
+
const by = new Set();
|
|
164
|
+
for (const id of targets) {
|
|
165
|
+
const key = `${slot}|${id}`;
|
|
166
|
+
if (seenEl.has(key)) { lost.push(id); by.add(seenEl.get(key)); }
|
|
167
|
+
else seenEl.set(key, index);
|
|
168
|
+
}
|
|
169
|
+
if (lost.length) {
|
|
170
|
+
const whole = lost.length === targets.length;
|
|
171
|
+
out.push({ index, code: "SHADOWED_NODE", by: [...by], lost, whole,
|
|
172
|
+
detail: whole
|
|
173
|
+
? `An earlier "${slot}" node already applies to ${lost.join(", ")}; this node does nothing.`
|
|
174
|
+
: `On ${lost.join(", ")}, an earlier "${slot}" node wins; this node still applies to the rest.` });
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
return out;
|
|
178
|
+
}
|
package/lib/parse-html.js
CHANGED
package/lib/raster-inspect.js
CHANGED
package/lib/raster-ops.js
CHANGED
package/lib/raster-presets.js
CHANGED
package/lib/react.js
CHANGED
package/lib/resolve-refs.js
CHANGED
package/lib/responsive.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* nodality v1.5.
|
|
2
|
+
* nodality v1.5.3
|
|
3
3
|
* (c) 2026 Filip Vabrousek
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -489,6 +489,10 @@ export async function respond(page, spec, renderAt, opts = {}) {
|
|
|
489
489
|
const groups = eligibleGroups(elements);
|
|
490
490
|
const maxPasses = opts.maxPasses || 4;
|
|
491
491
|
let measurements = 0;
|
|
492
|
+
// Cell certification (see solveLevel): renders spent, and the cells whose
|
|
493
|
+
// fit was not affine and were split.
|
|
494
|
+
let certifyRenders = 0;
|
|
495
|
+
const nonAffine = [];
|
|
492
496
|
|
|
493
497
|
// Solve one depth level, with `others` (the current nodes of every group
|
|
494
498
|
// not in the level) in force. Returns each group's narrow intervals and
|
|
@@ -535,6 +539,41 @@ export async function respond(page, spec, renderAt, opts = {}) {
|
|
|
535
539
|
}
|
|
536
540
|
};
|
|
537
541
|
for (const w of grid) await measureAt(w, level);
|
|
542
|
+
// Certify every grid cell before bracketing. A bracket needs the two
|
|
543
|
+
// sides of a switch on different samples, so a fit that turns and turns
|
|
544
|
+
// back inside one cell would be missed. Each cell is measured at its
|
|
545
|
+
// midpoint; where any group's fit (g or gn) is more than `tolerance` px
|
|
546
|
+
// off the line through the cell's ends, sizes are not affine in the
|
|
547
|
+
// width there, and the cell is split and checked again.
|
|
548
|
+
if (opts.certify !== false) {
|
|
549
|
+
const tol = opts.tolerance ?? 1;
|
|
550
|
+
const minCell = opts.minCell ?? 8;
|
|
551
|
+
const cap = opts.maxCertify ?? 64;
|
|
552
|
+
const at = (list, v) => list.find((x) => x.v === v);
|
|
553
|
+
const offLine = (a, m, b, key) => {
|
|
554
|
+
if (![a, m, b].every((x) => x && typeof x[key] === "number")) return false;
|
|
555
|
+
const t = (m.v - a.v) / (b.v - a.v);
|
|
556
|
+
return Math.abs(m[key] - (a[key] + t * (b[key] - a[key]))) > tol;
|
|
557
|
+
};
|
|
558
|
+
let cells = grid.slice(1).map((b, i) => [grid[i], b]);
|
|
559
|
+
let spent = 0;
|
|
560
|
+
while (cells.length && spent < cap) {
|
|
561
|
+
const next = [];
|
|
562
|
+
for (const [a, b] of cells) {
|
|
563
|
+
if (b - a <= minCell || spent >= cap) continue;
|
|
564
|
+
const m = Math.floor((a + b) / 2);
|
|
565
|
+
await measureAt(m, level);
|
|
566
|
+
spent++;
|
|
567
|
+
certifyRenders++;
|
|
568
|
+
const bent = level.some((g) => {
|
|
569
|
+
const list = samples.get(g.id);
|
|
570
|
+
return ["g", "gn"].some((k) => offLine(at(list, a), at(list, m), at(list, b), k));
|
|
571
|
+
});
|
|
572
|
+
if (bent) { next.push([a, m], [m, b]); nonAffine.push([a, b]); }
|
|
573
|
+
}
|
|
574
|
+
cells = next;
|
|
575
|
+
}
|
|
576
|
+
}
|
|
538
577
|
const solved = new Map();
|
|
539
578
|
const reports = new Map();
|
|
540
579
|
for (const g of level) {
|
|
@@ -621,6 +660,7 @@ export async function respond(page, spec, renderAt, opts = {}) {
|
|
|
621
660
|
synthesized,
|
|
622
661
|
report,
|
|
623
662
|
measurements,
|
|
663
|
+
certification: opts.certify === false ? null : { renders: certifyRenders, nonAffine },
|
|
624
664
|
passes,
|
|
625
665
|
converged,
|
|
626
666
|
skipped: findGroups(elements).filter((g) => g.authored || g.members < 2).map((g) => ({ id: g.id, kind: g.kind, reason: g.authored ? "authored" : "fewer than two members" })),
|
package/lib/scroll-video.js
CHANGED
package/lib/seo.js
CHANGED
package/lib/stacker.js
CHANGED
package/lib/suggest.js
CHANGED
package/lib/theme.js
CHANGED
package/lib/transform-anim.js
CHANGED