@niscorp/nova 0.2.0 → 0.2.2
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/CHANGELOG.md +61 -0
- package/README.md +56 -13
- package/SHELL_DOCS.md +13 -4
- package/dist/adapters/dom/components/index.cjs +4 -51
- package/dist/adapters/dom/components/index.cjs.map +1 -1
- package/dist/adapters/dom/index.cjs +22 -686
- package/dist/adapters/dom/index.cjs.map +1 -1
- package/dist/adapters/dom/index.js +2 -2
- package/dist/adapters/dom/server.cjs +14 -411
- package/dist/adapters/dom/server.cjs.map +1 -1
- package/dist/adapters/dom/server.js +2 -2
- package/dist/adapters/react/components/index.cjs +87 -562
- package/dist/adapters/react/components/index.cjs.map +1 -1
- package/dist/adapters/react/components/index.d.cts +2 -2
- package/dist/adapters/react/components/index.d.ts +2 -2
- package/dist/adapters/react/components/index.js +3 -3
- package/dist/adapters/react/index.cjs +97 -1815
- package/dist/adapters/react/index.cjs.map +1 -1
- package/dist/adapters/react/index.js +3 -3
- package/dist/adapters/tty/components/index.cjs +3 -44
- package/dist/adapters/tty/components/index.cjs.map +1 -1
- package/dist/adapters/tty/index.cjs +13 -5
- package/dist/adapters/tty/index.cjs.map +1 -1
- package/dist/adapters/tty/index.js +1 -1
- package/dist/adapters/vue/components/index.cjs +88 -639
- package/dist/adapters/vue/components/index.cjs.map +1 -1
- package/dist/adapters/vue/components/index.d.cts +10 -10
- package/dist/adapters/vue/components/index.d.ts +10 -10
- package/dist/adapters/vue/components/index.js +3 -3
- package/dist/adapters/vue/index.cjs +96 -962
- package/dist/adapters/vue/index.cjs.map +1 -1
- package/dist/adapters/vue/index.js +4 -4
- package/dist/agent/index.cjs +13 -151
- package/dist/agent/index.cjs.map +1 -1
- package/dist/chunk-3IPM5QBT.cjs +436 -0
- package/dist/chunk-3IPM5QBT.cjs.map +1 -0
- package/dist/chunk-5AF72LOE.cjs +97 -0
- package/dist/chunk-5AF72LOE.cjs.map +1 -0
- package/dist/chunk-5YQIAS4V.cjs +184 -0
- package/dist/chunk-5YQIAS4V.cjs.map +1 -0
- package/dist/chunk-D4PUWBN6.cjs +72 -0
- package/dist/chunk-D4PUWBN6.cjs.map +1 -0
- package/dist/{chunk-RYIIIXDX.js → chunk-DU2VIJAF.js} +57 -15
- package/dist/chunk-DU2VIJAF.js.map +1 -0
- package/dist/{chunk-VU6NNCEJ.js → chunk-F2H7WP6R.js} +4 -4
- package/dist/{chunk-VU6NNCEJ.js.map → chunk-F2H7WP6R.js.map} +1 -1
- package/dist/chunk-FSUMCJAR.cjs +646 -0
- package/dist/chunk-FSUMCJAR.cjs.map +1 -0
- package/dist/{chunk-QXQCPH33.js → chunk-G4LSLLGI.js} +4 -4
- package/dist/{chunk-QXQCPH33.js.map → chunk-G4LSLLGI.js.map} +1 -1
- package/dist/chunk-GV7UC3SS.cjs +33 -0
- package/dist/chunk-GV7UC3SS.cjs.map +1 -0
- package/dist/chunk-IZ2UU5UL.cjs +808 -0
- package/dist/chunk-IZ2UU5UL.cjs.map +1 -0
- package/dist/chunk-KOYRJXTI.cjs +123 -0
- package/dist/chunk-KOYRJXTI.cjs.map +1 -0
- package/dist/chunk-KW34ZKF5.cjs +12 -0
- package/dist/chunk-KW34ZKF5.cjs.map +1 -0
- package/dist/chunk-OE527MXF.cjs +49 -0
- package/dist/chunk-OE527MXF.cjs.map +1 -0
- package/dist/chunk-OO247V4J.cjs +2117 -0
- package/dist/chunk-OO247V4J.cjs.map +1 -0
- package/dist/chunk-PMKWYOOX.cjs +64 -0
- package/dist/chunk-PMKWYOOX.cjs.map +1 -0
- package/dist/chunk-PNQY6OFB.cjs +132 -0
- package/dist/chunk-PNQY6OFB.cjs.map +1 -0
- package/dist/chunk-Q7SFCCGT.cjs +11 -0
- package/dist/chunk-Q7SFCCGT.cjs.map +1 -0
- package/dist/{chunk-MHW5VEIM.js → chunk-SVNK5NIK.js} +3 -3
- package/dist/{chunk-MHW5VEIM.js.map → chunk-SVNK5NIK.js.map} +1 -1
- package/dist/chunk-TMLNVU5W.cjs +318 -0
- package/dist/chunk-TMLNVU5W.cjs.map +1 -0
- package/dist/chunk-TRJYDVWK.cjs +623 -0
- package/dist/chunk-TRJYDVWK.cjs.map +1 -0
- package/dist/chunk-UGG7MCX4.cjs +34 -0
- package/dist/chunk-UGG7MCX4.cjs.map +1 -0
- package/dist/{chunk-UDCXGDLQ.js → chunk-VOD5JA4D.js} +3 -3
- package/dist/{chunk-UDCXGDLQ.js.map → chunk-VOD5JA4D.js.map} +1 -1
- package/dist/chunk-WGPFR7MN.cjs +808 -0
- package/dist/chunk-WGPFR7MN.cjs.map +1 -0
- package/dist/chunk-WGZZKCJQ.cjs +157 -0
- package/dist/chunk-WGZZKCJQ.cjs.map +1 -0
- package/dist/chunk-XQTI4Q4I.js +178 -0
- package/dist/chunk-XQTI4Q4I.js.map +1 -0
- package/dist/devtools/index.cjs +13 -697
- package/dist/devtools/index.cjs.map +1 -1
- package/dist/document/index.cjs +56 -301
- package/dist/document/index.cjs.map +1 -1
- package/dist/examples/index.cjs +1161 -0
- package/dist/examples/index.cjs.map +1 -0
- package/dist/examples/index.d.cts +63 -0
- package/dist/examples/index.d.ts +63 -0
- package/dist/examples/index.js +1158 -0
- package/dist/examples/index.js.map +1 -0
- package/dist/i18n/index.cjs +44 -292
- package/dist/i18n/index.cjs.map +1 -1
- package/dist/i18n/index.js +2 -176
- package/dist/i18n/index.js.map +1 -1
- package/dist/index.cjs +335 -3911
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +1 -1
- package/dist/migrations/index.cjs +7 -590
- package/dist/migrations/index.cjs.map +1 -1
- package/dist/reflect/index.cjs +85 -994
- package/dist/reflect/index.cjs.map +1 -1
- package/package.json +19 -8
- package/dist/chunk-RYIIIXDX.js.map +0 -1
- package/dist/{primitive-props-CGoJvmcH.d.cts → primitive-props-Cl5jiC8g.d.cts} +5 -5
- package/dist/{primitive-props-CGoJvmcH.d.ts → primitive-props-Cl5jiC8g.d.ts} +5 -5
package/dist/document/index.cjs
CHANGED
|
@@ -1,308 +1,63 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
var HEAD_LINK_NAME = "nova:link";
|
|
8
|
-
var HEAD_SCRIPT_NAME = "nova:script";
|
|
9
|
-
var HEAD_NAMES = [HEAD_NAME, HEAD_TITLE_NAME, HEAD_META_NAME, HEAD_LINK_NAME, HEAD_SCRIPT_NAME];
|
|
10
|
-
var headKeyOf = (element) => {
|
|
11
|
-
const said = (name) => {
|
|
12
|
-
const found = Object.entries(element.attributes).find(([key]) => key.toLowerCase() === name)?.[1].trim().toLowerCase();
|
|
13
|
-
return found === void 0 || found === "" ? void 0 : found;
|
|
14
|
-
};
|
|
15
|
-
if (element.tag === "title") return "title";
|
|
16
|
-
if (element.tag === "meta") {
|
|
17
|
-
const [name, property] = [said("name"), said("property")];
|
|
18
|
-
if (name !== void 0) return `meta name ${name}`;
|
|
19
|
-
return property === void 0 ? void 0 : `meta property ${property}`;
|
|
20
|
-
}
|
|
21
|
-
if (element.tag === "link") return (said("rel") ?? "").split(/\s+/).includes("canonical") ? "link canonical" : void 0;
|
|
22
|
-
return void 0;
|
|
23
|
-
};
|
|
3
|
+
var chunkWGZZKCJQ_cjs = require('../chunk-WGZZKCJQ.cjs');
|
|
4
|
+
var chunkPNQY6OFB_cjs = require('../chunk-PNQY6OFB.cjs');
|
|
5
|
+
var chunkGV7UC3SS_cjs = require('../chunk-GV7UC3SS.cjs');
|
|
6
|
+
require('../chunk-Q7SFCCGT.cjs');
|
|
24
7
|
|
|
25
|
-
// src/shell/slot-names.ts
|
|
26
|
-
var CANVAS_SLOT_NAME = "CanvasSlot";
|
|
27
|
-
var ACTION_SLOT_NAME = "ActionSlot";
|
|
28
8
|
|
|
29
|
-
// src/shell/head.ts
|
|
30
|
-
var ATTRIBUTE_NAME = /^[A-Za-z][A-Za-z0-9:._-]*$/;
|
|
31
|
-
var DATA_TYPE = /^application\/([a-z0-9.-]+\+)?json$/i;
|
|
32
|
-
var written = (value) => {
|
|
33
|
-
if (typeof value === "string") return value.trim() === "" ? void 0 : value;
|
|
34
|
-
if (typeof value === "number") return String(value);
|
|
35
|
-
return value === true ? "" : void 0;
|
|
36
|
-
};
|
|
37
|
-
var attributesOf = (what, props, skip = []) => {
|
|
38
|
-
const attributes = {};
|
|
39
|
-
for (const [name, value] of Object.entries(props)) {
|
|
40
|
-
if (skip.includes(name)) continue;
|
|
41
|
-
if (!ATTRIBUTE_NAME.test(name)) return { refused: `${what}: "${name}" is not an attribute\u2019s name` };
|
|
42
|
-
if (/^on/i.test(name)) return { refused: `${what}: \`${name}\` is a handler, and a layout does not run` };
|
|
43
|
-
const text = written(value);
|
|
44
|
-
if (text !== void 0) attributes[name] = text;
|
|
45
|
-
}
|
|
46
|
-
return { attributes };
|
|
47
|
-
};
|
|
48
|
-
var has = (attributes, name) => Object.keys(attributes).some((key) => key.toLowerCase() === name);
|
|
49
|
-
var valueOf = (attributes, name) => Object.entries(attributes).find(([key]) => key.toLowerCase() === name)?.[1] ?? "";
|
|
50
|
-
var textOf = (nodes) => nodes.map((node) => node.type === "text" ? node.value : node.type === "fragment" ? textOf(node.children) : "").join("");
|
|
51
|
-
var titleOf = (node) => {
|
|
52
|
-
const text = textOf(node.children).trim();
|
|
53
|
-
return text === "" ? void 0 : { element: { tag: "title", attributes: {}, text } };
|
|
54
|
-
};
|
|
55
|
-
var metaOf = (node) => {
|
|
56
|
-
const read = attributesOf(HEAD_META_NAME, node.props);
|
|
57
|
-
if ("refused" in read) return read;
|
|
58
|
-
if (has(read.attributes, "http-equiv")) return { refused: `${HEAD_META_NAME}: \`http-equiv\` instructs the browser, and a layout does not` };
|
|
59
|
-
return has(read.attributes, "content") ? { element: { tag: "meta", attributes: read.attributes } } : void 0;
|
|
60
|
-
};
|
|
61
|
-
var linkOf = (node) => {
|
|
62
|
-
const read = attributesOf(HEAD_LINK_NAME, node.props);
|
|
63
|
-
if ("refused" in read) return read;
|
|
64
|
-
if (valueOf(read.attributes, "rel").toLowerCase().split(/\s+/).includes("stylesheet")) return { refused: `${HEAD_LINK_NAME}: a stylesheet styles the page, and a layout does not` };
|
|
65
|
-
return has(read.attributes, "href") ? { element: { tag: "link", attributes: read.attributes } } : void 0;
|
|
66
|
-
};
|
|
67
|
-
var scriptOf = (node) => {
|
|
68
|
-
const read = attributesOf(HEAD_SCRIPT_NAME, node.props, ["data"]);
|
|
69
|
-
if ("refused" in read) return read;
|
|
70
|
-
if (has(read.attributes, "src")) return { refused: `${HEAD_SCRIPT_NAME}: a script with a \`src\` runs, and a layout does not` };
|
|
71
|
-
const type = valueOf(read.attributes, "type");
|
|
72
|
-
if (!DATA_TYPE.test(type)) return { refused: `${HEAD_SCRIPT_NAME}: only a data block may be written (a JSON \`type\`), and "${type}" is not one` };
|
|
73
|
-
const data = node.props["data"];
|
|
74
|
-
if (data === void 0 || data === null || data === "") return void 0;
|
|
75
|
-
return { element: { tag: "script", attributes: read.attributes, text: JSON.stringify(data) } };
|
|
76
|
-
};
|
|
77
|
-
var READERS = {
|
|
78
|
-
[HEAD_TITLE_NAME]: titleOf,
|
|
79
|
-
[HEAD_META_NAME]: metaOf,
|
|
80
|
-
[HEAD_LINK_NAME]: linkOf,
|
|
81
|
-
[HEAD_SCRIPT_NAME]: scriptOf
|
|
82
|
-
};
|
|
83
|
-
var isHeadNode = (node) => node.type === "component" && node.name === HEAD_NAME;
|
|
84
|
-
var headOf = (api) => {
|
|
85
|
-
let heads = 0;
|
|
86
|
-
const said = [];
|
|
87
|
-
const refused = [];
|
|
88
|
-
const open = /* @__PURE__ */ new Set();
|
|
89
|
-
const hold = (nodes, action) => {
|
|
90
|
-
for (const node of nodes) {
|
|
91
|
-
if (node.type === "fragment") {
|
|
92
|
-
hold(node.children, action);
|
|
93
|
-
continue;
|
|
94
|
-
}
|
|
95
|
-
if (node.type === "error") {
|
|
96
|
-
refused.push(`${HEAD_NAME}: ${node.message}`);
|
|
97
|
-
continue;
|
|
98
|
-
}
|
|
99
|
-
if (node.type !== "component") continue;
|
|
100
|
-
const read = READERS[node.name];
|
|
101
|
-
if (read === void 0) {
|
|
102
|
-
refused.push(`${HEAD_NAME}: "${node.name}" is not something a head holds`);
|
|
103
|
-
continue;
|
|
104
|
-
}
|
|
105
|
-
const found = read(node);
|
|
106
|
-
if (found === void 0) continue;
|
|
107
|
-
if ("refused" in found) {
|
|
108
|
-
refused.push(found.refused);
|
|
109
|
-
continue;
|
|
110
|
-
}
|
|
111
|
-
const key = headKeyOf(found.element);
|
|
112
|
-
const earlier = key === void 0 ? -1 : said.findIndex((other) => headKeyOf(other.element) === key);
|
|
113
|
-
if (earlier >= 0) said.splice(earlier, 1);
|
|
114
|
-
said.push({ element: found.element, action });
|
|
115
|
-
}
|
|
116
|
-
};
|
|
117
|
-
const walk = (nodes, action) => {
|
|
118
|
-
for (const node of nodes) {
|
|
119
|
-
if (node.type === "fragment") {
|
|
120
|
-
walk(node.children, action);
|
|
121
|
-
continue;
|
|
122
|
-
}
|
|
123
|
-
if (node.type !== "component") continue;
|
|
124
|
-
if (node.name === HEAD_NAME) {
|
|
125
|
-
heads += 1;
|
|
126
|
-
hold(node.children, action);
|
|
127
|
-
continue;
|
|
128
|
-
}
|
|
129
|
-
if (node.name === CANVAS_SLOT_NAME) {
|
|
130
|
-
const canvasId = node.props["canvasId"];
|
|
131
|
-
if (typeof canvasId !== "string" || canvasId === "" || open.has(canvasId)) continue;
|
|
132
|
-
open.add(canvasId);
|
|
133
|
-
walk(api.canvasTree(canvasId), void 0);
|
|
134
|
-
open.delete(canvasId);
|
|
135
|
-
continue;
|
|
136
|
-
}
|
|
137
|
-
const definitionId = node.name === ACTION_SLOT_NAME ? node.props["definitionId"] : void 0;
|
|
138
|
-
walk(node.children, typeof definitionId === "string" ? definitionId : action);
|
|
139
|
-
}
|
|
140
|
-
};
|
|
141
|
-
walk(api.frame(), void 0);
|
|
142
|
-
if (heads === 0) return void 0;
|
|
143
|
-
const actions = [...new Set(said.flatMap((one) => one.action === void 0 ? [] : [one.action]))];
|
|
144
|
-
return { elements: said.map((one) => one.element), actions, refused };
|
|
145
|
-
};
|
|
146
9
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
return
|
|
174
|
-
};
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
return
|
|
182
|
-
};
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
);
|
|
200
|
-
var write = (section, elements, screen) => {
|
|
201
|
-
if (elements.length === 0) return section;
|
|
202
|
-
const tags = tagsOf(section);
|
|
203
|
-
const changes = [];
|
|
204
|
-
const added = [];
|
|
205
|
-
const own = [];
|
|
206
|
-
for (const element of elements) {
|
|
207
|
-
const key = headKeyOf(element);
|
|
208
|
-
const [first, ...others] = key === void 0 ? [] : tags.filter((tag) => keyOfTag(tag) === key);
|
|
209
|
-
if (first === void 0) {
|
|
210
|
-
added.push(markupOf(element, screen));
|
|
211
|
-
continue;
|
|
212
|
-
}
|
|
213
|
-
changes.push({ start: first.start, end: first.end, text: markupOf(element, screen) });
|
|
214
|
-
own.push(first.text);
|
|
215
|
-
for (const other of others) {
|
|
216
|
-
changes.push({ start: other.start, end: other.end, text: "" });
|
|
217
|
-
own.push(other.text);
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
if (screen && own.length > 0) added.push(`<template ${OWN_MARK}>${own.join("")}</template>`);
|
|
221
|
-
const written2 = changed(section, changes);
|
|
222
|
-
const tail = /\s*$/.exec(written2)?.[0] ?? "";
|
|
223
|
-
const body = written2.slice(0, written2.length - tail.length);
|
|
224
|
-
const indent = /(?:^|\n)([ \t]*)\S[^\n]*$/.exec(body)?.[1] ?? "";
|
|
225
|
-
const lead = tail.includes("\n") ? `
|
|
226
|
-
${indent}` : "";
|
|
227
|
-
return `${body}${added.map((tag) => `${lead}${tag}`).join("")}${tail}`;
|
|
228
|
-
};
|
|
229
|
-
var placeHead = (html, elements, place = {}) => {
|
|
230
|
-
const opening = /<head\b[^>]*>/i.exec(html);
|
|
231
|
-
if (opening === null) return html;
|
|
232
|
-
const from = opening.index + opening[0].length;
|
|
233
|
-
const closing = html.slice(from).search(/<\/head\s*>/i);
|
|
234
|
-
if (closing < 0) return html;
|
|
235
|
-
const located = write(restored(html.slice(from, from + closing)), addressOf(place), false);
|
|
236
|
-
return `${html.slice(0, from)}${write(located, elements ?? [], true)}${html.slice(from + closing)}`;
|
|
237
|
-
};
|
|
238
|
-
|
|
239
|
-
// src/document/head-keeper.ts
|
|
240
|
-
var TAGS2 = ["title", "meta", "link"];
|
|
241
|
-
var keyOfNode = (node) => {
|
|
242
|
-
const tag = TAGS2.find((name) => name === node.tagName.toLowerCase());
|
|
243
|
-
if (tag !== "title" && tag !== "meta" && tag !== "link") return void 0;
|
|
244
|
-
return headKeyOf({ tag, attributes: Object.fromEntries([...node.attributes].map((attribute) => [attribute.name, attribute.value])) });
|
|
245
|
-
};
|
|
246
|
-
var createHeadKeeper = (doc) => {
|
|
247
|
-
let mine = [];
|
|
248
|
-
let away = [];
|
|
249
|
-
let said;
|
|
250
|
-
const built = (element) => {
|
|
251
|
-
const node = doc.createElement(element.tag);
|
|
252
|
-
for (const [name, value] of Object.entries(element.attributes)) node.setAttribute(name, value);
|
|
253
|
-
node.setAttribute(HEAD_MARK, "");
|
|
254
|
-
if (element.text !== void 0) node.textContent = element.text;
|
|
255
|
-
return node;
|
|
256
|
-
};
|
|
257
|
-
const adopt = () => {
|
|
258
|
-
mine = [...doc.head.querySelectorAll(`[${HEAD_MARK}]`)];
|
|
259
|
-
const view = doc.defaultView;
|
|
260
|
-
for (const stash of doc.head.querySelectorAll(`template[${OWN_MARK}]`)) {
|
|
261
|
-
if (view === null || !(stash instanceof view.HTMLTemplateElement)) continue;
|
|
262
|
-
for (const child of [...stash.content.children]) {
|
|
263
|
-
const key = keyOfNode(child);
|
|
264
|
-
if (key !== void 0) away.push({ key, node: doc.importNode(child, true), before: null });
|
|
265
|
-
}
|
|
266
|
-
stash.remove();
|
|
267
|
-
}
|
|
268
|
-
};
|
|
269
|
-
return (elements) => {
|
|
270
|
-
const now = elements ?? [];
|
|
271
|
-
const next = JSON.stringify(now);
|
|
272
|
-
if (said === void 0) {
|
|
273
|
-
if (now.length === 0) return;
|
|
274
|
-
adopt();
|
|
275
|
-
}
|
|
276
|
-
if (next === said) return;
|
|
277
|
-
said = next;
|
|
278
|
-
for (const node of mine) node.remove();
|
|
279
|
-
mine = now.map(built);
|
|
280
|
-
const keys = new Set(now.flatMap((element) => headKeyOf(element) ?? []));
|
|
281
|
-
for (const node of [...doc.head.children]) {
|
|
282
|
-
const key = keyOfNode(node);
|
|
283
|
-
if (key === void 0 || !keys.has(key)) continue;
|
|
284
|
-
away.push({ key, node, before: node.nextSibling });
|
|
285
|
-
node.remove();
|
|
286
|
-
}
|
|
287
|
-
const [back, still] = [away.filter((gone) => !keys.has(gone.key)), away.filter((gone) => keys.has(gone.key))];
|
|
288
|
-
for (const gone of [...back].reverse()) doc.head.insertBefore(gone.node, gone.before !== null && gone.before.parentNode === doc.head ? gone.before : null);
|
|
289
|
-
away = still;
|
|
290
|
-
doc.head.append(...mine);
|
|
291
|
-
};
|
|
292
|
-
};
|
|
293
|
-
|
|
294
|
-
exports.HEAD_LINK_NAME = HEAD_LINK_NAME;
|
|
295
|
-
exports.HEAD_MARK = HEAD_MARK;
|
|
296
|
-
exports.HEAD_META_NAME = HEAD_META_NAME;
|
|
297
|
-
exports.HEAD_NAME = HEAD_NAME;
|
|
298
|
-
exports.HEAD_NAMES = HEAD_NAMES;
|
|
299
|
-
exports.HEAD_SCRIPT_NAME = HEAD_SCRIPT_NAME;
|
|
300
|
-
exports.HEAD_TITLE_NAME = HEAD_TITLE_NAME;
|
|
301
|
-
exports.OWN_MARK = OWN_MARK;
|
|
302
|
-
exports.createHeadKeeper = createHeadKeeper;
|
|
303
|
-
exports.headKeyOf = headKeyOf;
|
|
304
|
-
exports.headOf = headOf;
|
|
305
|
-
exports.isHeadNode = isHeadNode;
|
|
306
|
-
exports.placeHead = placeHead;
|
|
10
|
+
Object.defineProperty(exports, "HEAD_MARK", {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () { return chunkWGZZKCJQ_cjs.HEAD_MARK; }
|
|
13
|
+
});
|
|
14
|
+
Object.defineProperty(exports, "OWN_MARK", {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function () { return chunkWGZZKCJQ_cjs.OWN_MARK; }
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "createHeadKeeper", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () { return chunkWGZZKCJQ_cjs.createHeadKeeper; }
|
|
21
|
+
});
|
|
22
|
+
Object.defineProperty(exports, "placeHead", {
|
|
23
|
+
enumerable: true,
|
|
24
|
+
get: function () { return chunkWGZZKCJQ_cjs.placeHead; }
|
|
25
|
+
});
|
|
26
|
+
Object.defineProperty(exports, "headOf", {
|
|
27
|
+
enumerable: true,
|
|
28
|
+
get: function () { return chunkPNQY6OFB_cjs.headOf; }
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, "isHeadNode", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () { return chunkPNQY6OFB_cjs.isHeadNode; }
|
|
33
|
+
});
|
|
34
|
+
Object.defineProperty(exports, "HEAD_LINK_NAME", {
|
|
35
|
+
enumerable: true,
|
|
36
|
+
get: function () { return chunkGV7UC3SS_cjs.HEAD_LINK_NAME; }
|
|
37
|
+
});
|
|
38
|
+
Object.defineProperty(exports, "HEAD_META_NAME", {
|
|
39
|
+
enumerable: true,
|
|
40
|
+
get: function () { return chunkGV7UC3SS_cjs.HEAD_META_NAME; }
|
|
41
|
+
});
|
|
42
|
+
Object.defineProperty(exports, "HEAD_NAME", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function () { return chunkGV7UC3SS_cjs.HEAD_NAME; }
|
|
45
|
+
});
|
|
46
|
+
Object.defineProperty(exports, "HEAD_NAMES", {
|
|
47
|
+
enumerable: true,
|
|
48
|
+
get: function () { return chunkGV7UC3SS_cjs.HEAD_NAMES; }
|
|
49
|
+
});
|
|
50
|
+
Object.defineProperty(exports, "HEAD_SCRIPT_NAME", {
|
|
51
|
+
enumerable: true,
|
|
52
|
+
get: function () { return chunkGV7UC3SS_cjs.HEAD_SCRIPT_NAME; }
|
|
53
|
+
});
|
|
54
|
+
Object.defineProperty(exports, "HEAD_TITLE_NAME", {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function () { return chunkGV7UC3SS_cjs.HEAD_TITLE_NAME; }
|
|
57
|
+
});
|
|
58
|
+
Object.defineProperty(exports, "headKeyOf", {
|
|
59
|
+
enumerable: true,
|
|
60
|
+
get: function () { return chunkGV7UC3SS_cjs.headKeyOf; }
|
|
61
|
+
});
|
|
307
62
|
//# sourceMappingURL=index.cjs.map
|
|
308
63
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/layout/head.ts","../../src/shell/slot-names.ts","../../src/shell/head.ts","../../src/document/place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AAA,CAAI,IAAA,CAAK,MAAA,CAAO,GAAG,IAAI,CAAA;AAAA,EACzB,CAAA;AACF","file":"index.cjs","sourcesContent":["// ═══════════════════════════════════════════════════════════\n// THE HEAD — `nova:head` is the document's <head>, as a node in a layout.\n//\n// A document has a part nobody sees on the screen: its title, the sentence\n// that describes it, the card shown where a link to it is pasted. That part\n// is written the way the rest of the screen is — a layout node, its children\n// bound to the action's data — and travels the way the rest does, in the\n// render tree.\n//\n// Its children are the elements a head holds, named as HTML names them:\n// `nova:title`, `nova:meta`, `nova:link`, `nova:script`. A child's props are\n// that element's ATTRIBUTES, written as given. Nova keeps no list of them, so\n// any `name`, `property` or `rel` there is — or will be — can be said without\n// nova learning it.\n//\n// Nothing here is drawn on the screen. No adapter builds an element for a head\n// or for anything in it, and no registry has to hold the names. Whoever writes\n// the document reads the elements off the tree (`headOf`) and writes them into\n// its <head>.\n//\n// WHAT A HEAD DOES NOT HOLD is what runs or styles: a script that executes, a\n// stylesheet, a <base>, an instruction to the browser (`http-equiv`), a handler\n// attribute. A layout is data, and data that reaches every page must not be\n// able to run. Those stay in the app's own index.html, which holds anything.\n//\n// This file holds no schema on purpose: a terminal that only reads a head off\n// the wire needs the names and the shape, and nothing to validate with.\n// ═══════════════════════════════════════════════════════════\n\n// Namespaced as a package's own in-layout components are (`loom:field`), so\n// none can be a name an app's kit already uses for something else.\nexport const HEAD_NAME = 'nova:head';\nexport const HEAD_TITLE_NAME = 'nova:title';\nexport const HEAD_META_NAME = 'nova:meta';\nexport const HEAD_LINK_NAME = 'nova:link';\nexport const HEAD_SCRIPT_NAME = 'nova:script';\n\n// The head and what it holds: the names a layout may use with no registry\n// entry behind them.\nexport const HEAD_NAMES: readonly string[] = [HEAD_NAME, HEAD_TITLE_NAME, HEAD_META_NAME, HEAD_LINK_NAME, HEAD_SCRIPT_NAME];\n\n// One element of a head, as data: what to write, wherever a head is written.\nexport type HeadElement = {\n tag: 'title' | 'meta' | 'link' | 'script';\n // as the layout gave them, in the order it gave them\n attributes: Record<string, string>;\n // a title's words; a script's data, as JSON\n text?: string;\n};\n\n// What two elements both say, when they say the same thing — the later one\n// then takes the earlier one's place. A document has one title, one <meta> of\n// a given name or property, one canonical address. Anything else stands beside\n// its like: two alternates, two data blocks.\nexport const headKeyOf = (element: Pick<HeadElement, 'tag' | 'attributes'>): string | undefined => {\n const said = (name: string): string | undefined => {\n const found = Object.entries(element.attributes).find(([key]) => key.toLowerCase() === name)?.[1].trim().toLowerCase();\n return found === undefined || found === '' ? undefined : found;\n };\n if (element.tag === 'title') return 'title';\n if (element.tag === 'meta') {\n const [name, property] = [said('name'), said('property')];\n if (name !== undefined) return `meta name ${name}`;\n return property === undefined ? undefined : `meta property ${property}`;\n }\n if (element.tag === 'link') return (said('rel') ?? '').split(/\\s+/).includes('canonical') ? 'link canonical' : undefined;\n return undefined;\n};\n","// ═══════════════════════════════════════════════════════════\n// Slot component name constants.\n//\n// Every framework adapter (React, future Vue/Svelte/etc.) must\n// register components under these names in its ComponentRegistry\n// to participate in shell/canvas layout rendering:\n//\n// CANVAS_SLOT_NAME — renders a canvas by id (props: canvasId?)\n// ACTION_SLOT_NAME — renders an action instance by id (props: instanceId?)\n//\n// The shell uses these names in its default layouts and when\n// flattening a render tree for non-React consumers (evaluators,\n// export, testing), so they are part of the package's public\n// contract — not React-only.\n// ═══════════════════════════════════════════════════════════\n\nexport const CANVAS_SLOT_NAME = 'CanvasSlot';\nexport const ACTION_SLOT_NAME = 'ActionSlot';\n","import { HEAD_LINK_NAME, HEAD_META_NAME, HEAD_NAME, HEAD_SCRIPT_NAME, HEAD_TITLE_NAME, headKeyOf } from '../layout/head';\nimport type { HeadElement } from '../layout/head';\nimport type { RenderNode } from '../layout';\nimport type { RenderApi } from './types';\nimport { ACTION_SLOT_NAME, CANVAS_SLOT_NAME } from './slot-names';\n\n// ═══════════════════════════════════════════════════════════\n// The head a screen has, read off its render tree.\n//\n// The frame is walked in the order it is drawn, into each canvas where its\n// slot stands and into each instance on it, and every `nova:head` it meets\n// gives its elements in turn. A screen can hold more than one head — the\n// shell's chrome says what holds on every screen, an action says its own, a\n// dialog opens over a page. An element that says the same thing as an earlier\n// one (the title, a <meta> of that name) takes its place; anything else stands\n// beside what came before.\n//\n// What a head may not hold is refused here, once, for every writer: the\n// element is left out and the reason is given. See ../layout/head.\n// ═══════════════════════════════════════════════════════════\n\nexport type ScreenHead = {\n // what the document's head is to hold, in the order the screen said it\n elements: HeadElement[];\n // the actions whose instances said any of it (none: only the shell's chrome did)\n actions: string[];\n // what a head held that it may not — left out, each with why\n refused: string[];\n};\n\ntype ComponentNode = Extract<RenderNode, { type: 'component' }>;\ntype Read = { element: HeadElement } | { refused: string } | undefined;\n\nconst ATTRIBUTE_NAME = /^[A-Za-z][A-Za-z0-9:._-]*$/;\n// a data block: a type no browser runs\nconst DATA_TYPE = /^application\\/([a-z0-9.-]+\\+)?json$/i;\n\n// A prop, as the attribute it is written as — or nothing, when it says nothing.\nconst written = (value: unknown): string | undefined => {\n if (typeof value === 'string') return value.trim() === '' ? undefined : value;\n if (typeof value === 'number') return String(value);\n return value === true ? '' : undefined;\n};\n\n// An element's attributes, from its props — or why it may not be written.\nconst attributesOf = (what: string, props: Record<string, unknown>, skip: readonly string[] = []): { attributes: Record<string, string> } | { refused: string } => {\n const attributes: Record<string, string> = {};\n for (const [name, value] of Object.entries(props)) {\n if (skip.includes(name)) continue;\n if (!ATTRIBUTE_NAME.test(name)) return { refused: `${what}: \"${name}\" is not an attribute’s name` };\n if (/^on/i.test(name)) return { refused: `${what}: \\`${name}\\` is a handler, and a layout does not run` };\n const text = written(value);\n if (text !== undefined) attributes[name] = text;\n }\n return { attributes };\n};\n\nconst has = (attributes: Record<string, string>, name: string): boolean => Object.keys(attributes).some((key) => key.toLowerCase() === name);\nconst valueOf = (attributes: Record<string, string>, name: string): string => Object.entries(attributes).find(([key]) => key.toLowerCase() === name)?.[1] ?? '';\n\nconst textOf = (nodes: readonly RenderNode[]): string =>\n nodes.map((node) => (node.type === 'text' ? node.value : node.type === 'fragment' ? textOf(node.children) : '')).join('');\n\nconst titleOf = (node: ComponentNode): Read => {\n const text = textOf(node.children).trim();\n return text === '' ? undefined : { element: { tag: 'title', attributes: {}, text } };\n};\n\nconst metaOf = (node: ComponentNode): Read => {\n const read = attributesOf(HEAD_META_NAME, node.props);\n if ('refused' in read) return read;\n if (has(read.attributes, 'http-equiv')) return { refused: `${HEAD_META_NAME}: \\`http-equiv\\` instructs the browser, and a layout does not` };\n // nothing to say yet: its value is not answered\n return has(read.attributes, 'content') ? { element: { tag: 'meta', attributes: read.attributes } } : undefined;\n};\n\nconst linkOf = (node: ComponentNode): Read => {\n const read = attributesOf(HEAD_LINK_NAME, node.props);\n if ('refused' in read) return read;\n if (valueOf(read.attributes, 'rel').toLowerCase().split(/\\s+/).includes('stylesheet')) return { refused: `${HEAD_LINK_NAME}: a stylesheet styles the page, and a layout does not` };\n return has(read.attributes, 'href') ? { element: { tag: 'link', attributes: read.attributes } } : undefined;\n};\n\nconst scriptOf = (node: ComponentNode): Read => {\n const read = attributesOf(HEAD_SCRIPT_NAME, node.props, ['data']);\n if ('refused' in read) return read;\n if (has(read.attributes, 'src')) return { refused: `${HEAD_SCRIPT_NAME}: a script with a \\`src\\` runs, and a layout does not` };\n const type = valueOf(read.attributes, 'type');\n if (!DATA_TYPE.test(type)) return { refused: `${HEAD_SCRIPT_NAME}: only a data block may be written (a JSON \\`type\\`), and \"${type}\" is not one` };\n const data = node.props['data'];\n if (data === undefined || data === null || data === '') return undefined;\n return { element: { tag: 'script', attributes: read.attributes, text: JSON.stringify(data) } };\n};\n\nconst READERS: Record<string, (node: ComponentNode) => Read> = {\n [HEAD_TITLE_NAME]: titleOf,\n [HEAD_META_NAME]: metaOf,\n [HEAD_LINK_NAME]: linkOf,\n [HEAD_SCRIPT_NAME]: scriptOf,\n};\n\nexport const isHeadNode = (node: RenderNode): boolean => node.type === 'component' && node.name === HEAD_NAME;\n\nexport const headOf = (api: Pick<RenderApi, 'frame' | 'canvasTree'>): ScreenHead | undefined => {\n let heads = 0;\n const said: { element: HeadElement; action: string | undefined }[] = [];\n const refused: string[] = [];\n // a canvas whose own tree names it again would never end\n const open = new Set<string>();\n\n const hold = (nodes: readonly RenderNode[], action: string | undefined): void => {\n for (const node of nodes) {\n if (node.type === 'fragment') {\n hold(node.children, action);\n continue;\n }\n if (node.type === 'error') {\n refused.push(`${HEAD_NAME}: ${node.message}`);\n continue;\n }\n // text between a head's elements is nothing\n if (node.type !== 'component') continue;\n const read = READERS[node.name];\n if (read === undefined) {\n refused.push(`${HEAD_NAME}: \"${node.name}\" is not something a head holds`);\n continue;\n }\n const found = read(node);\n if (found === undefined) continue;\n if ('refused' in found) {\n refused.push(found.refused);\n continue;\n }\n const key = headKeyOf(found.element);\n const earlier = key === undefined ? -1 : said.findIndex((other) => headKeyOf(other.element) === key);\n if (earlier >= 0) said.splice(earlier, 1);\n said.push({ element: found.element, action });\n }\n };\n\n const walk = (nodes: readonly RenderNode[], action: string | undefined): void => {\n for (const node of nodes) {\n if (node.type === 'fragment') {\n walk(node.children, action);\n continue;\n }\n if (node.type !== 'component') continue;\n if (node.name === HEAD_NAME) {\n heads += 1;\n hold(node.children, action);\n continue;\n }\n if (node.name === CANVAS_SLOT_NAME) {\n const canvasId = node.props['canvasId'];\n if (typeof canvasId !== 'string' || canvasId === '' || open.has(canvasId)) continue;\n open.add(canvasId);\n walk(api.canvasTree(canvasId), undefined);\n open.delete(canvasId);\n continue;\n }\n const definitionId = node.name === ACTION_SLOT_NAME ? node.props['definitionId'] : undefined;\n walk(node.children, typeof definitionId === 'string' ? definitionId : action);\n }\n };\n\n walk(api.frame(), undefined);\n if (heads === 0) return undefined;\n const actions = [...new Set(said.flatMap((one) => (one.action === undefined ? [] : [one.action])))];\n return { elements: said.map((one) => one.element), actions, refused };\n};\n","import { headKeyOf } from '../layout/head';\nimport type { HeadElement } from '../layout/head';\n\n// ═══════════════════════════════════════════════════════════\n// A screen's head, written into an HTML document.\n//\n// The document is the app's own `index.html` with a screen already drawn into\n// it. Its <head> is what holds on every page; the screen's head elements are\n// what this page says. An element that says the same thing as a tag the\n// document already has — its <title>, a <meta> of that name or property, its\n// canonical address — takes that tag's place, where it stood. Anything else is\n// added after what is there. Everything the screen does not speak of is left\n// exactly as it was: the icon, the viewport, the stylesheet.\n//\n// TWO THINGS ARE KEPT FOR THE PAGE ITSELF, which goes on living after the file\n// is read (./head-keeper). What was written is marked (`data-nova-head`), so\n// the page can tell the screen's elements from the document's own. And a tag\n// that gave up its place is kept, inert, in a <template data-nova-own>: when\n// the screen moves on to one that no longer says it, the document's own comes\n// back.\n//\n// WHERE the document lives is known to whoever writes the file: the site plus\n// the path it was drawn at. With a `site`, every path is given its own\n// canonical address, whether or not its screen has a head. That address is the\n// document's own for this path — unmarked, and it stays when the screen moves\n// on. A screen that says a canonical address itself is taken at its word.\n//\n// With nothing to write, the document comes back untouched.\n// ═══════════════════════════════════════════════════════════\n\nexport type HeadPlace = {\n // The address the site is served at (\"https://example.com\"). With it, each\n // path's canonical address is written.\n site?: string;\n // The path this document was drawn at.\n path?: string;\n};\n\nexport const HEAD_MARK = 'data-nova-head';\nexport const OWN_MARK = 'data-nova-own';\n\nconst escapeAttribute = (value: string): string => value.replace(/&/g, '&').replace(/\"/g, '"').replace(/</g, '<');\nconst escapeText = (value: string): string => value.replace(/&/g, '&').replace(/</g, '<');\n// Inside a <script>, the one thing that may not appear is the start of a tag.\n// The two separators end a line in a script though not in JSON, so they are\n// written as escapes too (named by code: the characters themselves would end\n// a line here as well).\nconst LINE_ENDS = [0x2028, 0x2029];\nconst escapeScript = (json: string): string =>\n LINE_ENDS.reduce((text, code) => text.split(String.fromCharCode(code)).join(`\\\\u${code.toString(16)}`), json.replace(/</g, '\\\\u003c'));\n\n// What stands in a head, read a tag at a time: comments and the bodies of\n// scripts, styles and templates are passed over whole, so a tag written inside\n// one is not mistaken for a tag.\nconst ATTRIBUTES = `((?:[^>\"']|\"[^\"]*\"|'[^']*')*)`;\nconst TAGS = new RegExp(`<!--[\\\\s\\\\S]*?-->|<(script|style|title|template)\\\\b${ATTRIBUTES}>([\\\\s\\\\S]*?)<\\\\/\\\\1\\\\s*>|<(meta|link)\\\\b${ATTRIBUTES}>`, 'gi');\nconst ATTRIBUTE = /([^\\s\"'=<>/]+)(?:\\s*=\\s*(?:\"([^\"]*)\"|'([^']*)'|([^\\s\"'=<>`]+)))?/g;\n\ntype Tag = { start: number; end: number; name: string; attributes: Record<string, string>; inner: string; text: string };\n\nconst attributesOf = (source: string): Record<string, string> => {\n const attributes: Record<string, string> = {};\n for (const match of source.matchAll(ATTRIBUTE)) {\n const name = match[1]?.toLowerCase();\n if (name === undefined || name in attributes) continue;\n attributes[name] = match[2] ?? match[3] ?? match[4] ?? '';\n }\n return attributes;\n};\n\nconst tagsOf = (section: string): Tag[] => {\n const tags: Tag[] = [];\n for (const match of section.matchAll(TAGS)) {\n const name = (match[1] ?? match[4])?.toLowerCase();\n if (name === undefined) continue;\n tags.push({ start: match.index, end: match.index + match[0].length, name, attributes: attributesOf(match[2] ?? match[5] ?? ''), inner: match[3] ?? '', text: match[0] });\n }\n return tags;\n};\n\n// What a tag in the document says, in the same terms as an element.\nconst keyOfTag = (tag: Tag): string | undefined =>\n tag.name === 'title' || tag.name === 'meta' || tag.name === 'link' ? headKeyOf({ tag: tag.name, attributes: tag.attributes }) : undefined;\n\n// An element, as the tag it is written as.\nconst markupOf = (element: HeadElement, marked: boolean): string => {\n const written = Object.entries(element.attributes).map(([name, value]) => (value === '' ? ` ${name}` : ` ${name}=\"${escapeAttribute(value)}\"`));\n const attributes = [...written, ...(marked ? [` ${HEAD_MARK}`] : [])].join('');\n if (element.tag === 'title') return `<title${attributes}>${escapeText(element.text ?? '')}</title>`;\n if (element.tag === 'script') return `<script${attributes}>${escapeScript(element.text ?? '')}</script>`;\n return `<${element.tag}${attributes}>`;\n};\n\n// Where the document lives, as elements: what a `site` and a path say.\nconst addressOf = (place: HeadPlace): HeadElement[] => {\n if (place.site === undefined || place.path === undefined) return [];\n const path = place.path.split(/[?#]/)[0] ?? '';\n const address = `${place.site.replace(/\\/+$/, '')}${path.startsWith('/') ? path : `/${path}`}`;\n return [\n { tag: 'link', attributes: { rel: 'canonical', href: address } },\n { tag: 'meta', attributes: { property: 'og:url', content: address } },\n ];\n};\n\nconst changed = (text: string, changes: readonly { start: number; end: number; text: string }[]): string =>\n [...changes].sort((a, b) => b.start - a.start).reduce((at, change) => `${at.slice(0, change.start)}${change.text}${at.slice(change.end)}`, text);\n\n// A head that was written before, put back as the document had it: what the\n// last screen said is taken out, and what the document gave up for it is given\n// back. A head never written comes back as it is.\nconst restored = (section: string): string =>\n changed(\n section,\n tagsOf(section).flatMap((tag) => {\n if (tag.name === 'template' && OWN_MARK in tag.attributes) return [{ start: tag.start, end: tag.end, text: tag.inner }];\n return HEAD_MARK in tag.attributes ? [{ start: tag.start, end: tag.end, text: '' }] : [];\n }),\n );\n\n// Elements, written into a head. `screen`: they are what a screen says — each\n// is marked, and a tag that gives up its place is kept for the page. Otherwise\n// they are the document's own from here on, and what they replace is gone.\nconst write = (section: string, elements: readonly HeadElement[], screen: boolean): string => {\n if (elements.length === 0) return section;\n const tags = tagsOf(section);\n const changes: { start: number; end: number; text: string }[] = [];\n const added: string[] = [];\n const own: string[] = [];\n for (const element of elements) {\n const key = headKeyOf(element);\n const [first, ...others] = key === undefined ? [] : tags.filter((tag) => keyOfTag(tag) === key);\n if (first === undefined) {\n added.push(markupOf(element, screen));\n continue;\n }\n changes.push({ start: first.start, end: first.end, text: markupOf(element, screen) });\n own.push(first.text);\n // said twice, the second would still say the old thing\n for (const other of others) {\n changes.push({ start: other.start, end: other.end, text: '' });\n own.push(other.text);\n }\n }\n if (screen && own.length > 0) added.push(`<template ${OWN_MARK}>${own.join('')}</template>`);\n\n const written = changed(section, changes);\n // What is added goes after the last thing in the head, a line each, indented\n // as that last thing is — or straight on, in a head written on one line.\n const tail = /\\s*$/.exec(written)?.[0] ?? '';\n const body = written.slice(0, written.length - tail.length);\n const indent = /(?:^|\\n)([ \\t]*)\\S[^\\n]*$/.exec(body)?.[1] ?? '';\n const lead = tail.includes('\\n') ? `\\n${indent}` : '';\n return `${body}${added.map((tag) => `${lead}${tag}`).join('')}${tail}`;\n};\n\nexport const placeHead = (html: string, elements: readonly HeadElement[] | undefined, place: HeadPlace = {}): string => {\n const opening = /<head\\b[^>]*>/i.exec(html);\n if (opening === null) return html;\n const from = opening.index + opening[0].length;\n const closing = html.slice(from).search(/<\\/head\\s*>/i);\n if (closing < 0) return html;\n // Where the document lives is the document's own, for this path: written\n // first and unmarked, so a screen that says an address of its own takes its\n // place — and gives it back.\n const located = write(restored(html.slice(from, from + closing)), addressOf(place), false);\n return `${html.slice(0, from)}${write(located, elements ?? [], true)}${html.slice(from + closing)}`;\n};\n","import { headKeyOf } from '../layout/head';\nimport type { HeadElement } from '../layout/head';\nimport { HEAD_MARK, OWN_MARK } from './place-head';\n\n// ═══════════════════════════════════════════════════════════\n// A page's <head>, kept on the screen.\n//\n// A drawn page arrives with its head written (`placeHead`). From then on the\n// shell is live and the screen moves without the page being fetched again, so\n// the head is kept on whatever the screen says now: its elements are put in\n// `document.head`, and taken out again when the screen stops saying them.\n//\n// THE DOCUMENT'S OWN TAGS GIVE WAY AND COME BACK. A tag the page was written\n// with — the title in index.html, its description — is taken out while the\n// screen says the same thing itself, and put back where it stood when the\n// screen no longer does. A drawn page has already given some up: they arrive\n// inert, in the <template data-nova-own> the writer left, and come back the\n// same way.\n//\n// A KEEPER THAT WAS NEVER HANDED AN ELEMENT NEVER WRITES. Two shells can share\n// a page (an inspector beside the app), and the one with nothing to say must\n// not touch what the other wrote — nor what the page arrived with.\n// ═══════════════════════════════════════════════════════════\n\nexport type HeadKeeper = (elements: readonly HeadElement[] | undefined) => void;\n\ntype Away = { key: string; node: Element; before: Node | null };\n\nconst TAGS = ['title', 'meta', 'link'];\n\n// What a tag standing in the page says, in the same terms as an element.\nconst keyOfNode = (node: Element): string | undefined => {\n const tag = TAGS.find((name) => name === node.tagName.toLowerCase());\n if (tag !== 'title' && tag !== 'meta' && tag !== 'link') return undefined;\n return headKeyOf({ tag, attributes: Object.fromEntries([...node.attributes].map((attribute) => [attribute.name, attribute.value])) });\n};\n\nexport const createHeadKeeper = (doc: Document): HeadKeeper => {\n // the screen's elements standing in the head\n let mine: Element[] = [];\n // the document's own tags that have given up their place\n let away: Away[] = [];\n let said: string | undefined;\n\n const built = (element: HeadElement): Element => {\n const node = doc.createElement(element.tag);\n for (const [name, value] of Object.entries(element.attributes)) node.setAttribute(name, value);\n node.setAttribute(HEAD_MARK, '');\n if (element.text !== undefined) node.textContent = element.text;\n return node;\n };\n\n // What the page arrived with: the elements a writer put there for the first\n // screen, and the tags that gave way to them.\n const adopt = (): void => {\n mine = [...doc.head.querySelectorAll(`[${HEAD_MARK}]`)];\n // the document's own window, not a global: a page's document is not always\n // the one the code was loaded in\n const view = doc.defaultView;\n for (const stash of doc.head.querySelectorAll(`template[${OWN_MARK}]`)) {\n if (view === null || !(stash instanceof view.HTMLTemplateElement)) continue;\n for (const child of [...stash.content.children]) {\n const key = keyOfNode(child);\n if (key !== undefined) away.push({ key, node: doc.importNode(child, true), before: null });\n }\n stash.remove();\n }\n };\n\n return (elements) => {\n const now = elements ?? [];\n const next = JSON.stringify(now);\n if (said === undefined) {\n if (now.length === 0) return;\n adopt();\n }\n if (next === said) return;\n said = next;\n\n for (const node of mine) node.remove();\n mine = now.map(built);\n const keys = new Set(now.flatMap((element) => headKeyOf(element) ?? []));\n\n // the document's own that now say what the screen says: out, each remembering where it stood\n for (const node of [...doc.head.children]) {\n const key = keyOfNode(node);\n if (key === undefined || !keys.has(key)) continue;\n away.push({ key, node, before: node.nextSibling });\n node.remove();\n }\n // Those the screen no longer says: back where each stood. The last to leave\n // goes back first — what stood after an earlier one may have left after it,\n // and has to be standing again for the earlier one to go in front of it.\n const [back, still] = [away.filter((gone) => !keys.has(gone.key)), away.filter((gone) => keys.has(gone.key))];\n for (const gone of [...back].reverse()) doc.head.insertBefore(gone.node, gone.before !== null && gone.before.parentNode === doc.head ? gone.before : null);\n away = still;\n\n doc.head.append(...mine);\n };\n};\n"]}
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.cjs"}
|