@publisle/adapter-core 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +12 -2
  3. package/dist/composition.d.ts +25 -0
  4. package/dist/composition.d.ts.map +1 -0
  5. package/dist/composition.js +239 -0
  6. package/dist/composition.js.map +1 -0
  7. package/dist/document.css +128 -0
  8. package/dist/html.d.ts +5 -0
  9. package/dist/html.d.ts.map +1 -0
  10. package/dist/html.js +199 -0
  11. package/dist/html.js.map +1 -0
  12. package/dist/index.d.ts +9 -0
  13. package/dist/index.d.ts.map +1 -0
  14. package/dist/index.js +7 -0
  15. package/dist/index.js.map +1 -0
  16. package/dist/island-runtime.d.ts +20 -0
  17. package/dist/island-runtime.d.ts.map +1 -0
  18. package/dist/island-runtime.js +166 -0
  19. package/dist/island-runtime.js.map +1 -0
  20. package/dist/javascript.d.ts +3 -0
  21. package/dist/javascript.d.ts.map +1 -0
  22. package/dist/javascript.js +11 -0
  23. package/dist/javascript.js.map +1 -0
  24. package/dist/katex.css +1 -0
  25. package/dist/node.d.ts +11 -0
  26. package/dist/node.d.ts.map +1 -0
  27. package/dist/node.js +37 -0
  28. package/dist/node.js.map +1 -0
  29. package/dist/placement.d.ts +4 -0
  30. package/dist/placement.d.ts.map +1 -0
  31. package/dist/placement.js +24 -0
  32. package/dist/placement.js.map +1 -0
  33. package/dist/publication-runtime.d.ts +10 -0
  34. package/dist/publication-runtime.d.ts.map +1 -0
  35. package/dist/publication-runtime.js +127 -0
  36. package/dist/publication-runtime.js.map +1 -0
  37. package/dist/publication.d.ts +76 -0
  38. package/dist/publication.d.ts.map +1 -0
  39. package/dist/publication.js +196 -0
  40. package/dist/publication.js.map +1 -0
  41. package/dist/render-plan.d.ts +4 -0
  42. package/dist/render-plan.d.ts.map +1 -0
  43. package/dist/render-plan.js +814 -0
  44. package/dist/render-plan.js.map +1 -0
  45. package/dist/types.d.ts +98 -0
  46. package/dist/types.d.ts.map +1 -0
  47. package/dist/types.js +2 -0
  48. package/dist/types.js.map +1 -0
  49. package/dist/vite.d.ts +6 -0
  50. package/dist/vite.d.ts.map +1 -0
  51. package/dist/vite.js +99 -0
  52. package/dist/vite.js.map +1 -0
  53. package/package.json +65 -3
  54. package/src/composition.ts +299 -0
  55. package/src/document.css +128 -0
  56. package/src/html.ts +221 -0
  57. package/src/index.ts +36 -0
  58. package/src/island-runtime.ts +199 -0
  59. package/src/javascript.ts +9 -0
  60. package/src/katex.css +1 -0
  61. package/src/node.ts +56 -0
  62. package/src/placement.ts +21 -0
  63. package/src/publication-runtime.ts +172 -0
  64. package/src/publication.ts +335 -0
  65. package/src/render-plan.ts +1214 -0
  66. package/src/types.ts +110 -0
  67. package/src/vite.ts +118 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 VoidReg
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,13 @@
1
- # Temporary Holding Version
1
+ # @publisle/adapter-core
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Publisle Core package.
4
+
5
+ Requires Node.js 24 or later. Framework adapters also require their declared peer dependencies.
6
+ This package is part of Publisle `0.1.0`, the first beta release.
7
+ Frozen contract version integers are independent of npm package versions.
8
+
9
+ - [Core standard](https://github.com/VoidReg/publisle/blob/main/docs/standards/README.md)
10
+ - [Quickstart and package usage](https://github.com/VoidReg/publisle#readme)
11
+ - [Distribution and release checklist](https://github.com/VoidReg/publisle/blob/main/docs/guides/releases.md)
12
+
13
+ Core packages do not install Research templates, citeproc, PDF compilers, or TeX.
@@ -0,0 +1,25 @@
1
+ import { type SemanticDeclaration } from "@publisle/schema";
2
+ export interface CompositionInstance {
3
+ readonly blockId: string;
4
+ readonly contractDigest: string;
5
+ readonly data: unknown;
6
+ readonly semantics: SemanticDeclaration;
7
+ }
8
+ export interface PortConnection {
9
+ readonly from: {
10
+ readonly block: string;
11
+ readonly port: string;
12
+ };
13
+ readonly to: {
14
+ readonly block: string;
15
+ readonly port: string;
16
+ };
17
+ }
18
+ export interface CompositionCompilation {
19
+ readonly documentDigest: string;
20
+ readonly instances: readonly CompositionInstance[];
21
+ readonly connections: readonly PortConnection[];
22
+ }
23
+ /** Trusted build-time lowering. Returned ES module contains no schemas, graph, registry or interpreter. */
24
+ export declare function compileComposition(options: CompositionCompilation): string;
25
+ //# sourceMappingURL=composition.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"composition.d.ts","sourceRoot":"","sources":["../src/composition.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,mBAAmB,EAEzB,MAAM,kBAAkB,CAAC;AAG1B,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,SAAS,EAAE,mBAAmB,CAAC;CACzC;AACD,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE;QAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IACjE,QAAQ,CAAC,EAAE,EAAE;QAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;CAChE;AACD,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,SAAS,EAAE,SAAS,mBAAmB,EAAE,CAAC;IACnD,QAAQ,CAAC,WAAW,EAAE,SAAS,cAAc,EAAE,CAAC;CACjD;AA8HD,2GAA2G;AAC3G,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,sBAAsB,GAAG,MAAM,CAkJ1E"}
@@ -0,0 +1,239 @@
1
+ import { canonicalizeJson, parseComposition, resolvePointer, validateSemantics, } from "@publisle/schema";
2
+ import { javascriptValue as js } from "./javascript.js";
3
+ function digest(value) {
4
+ if (!/^sha256:[a-f0-9]{64}$/u.test(value))
5
+ throw new Error("Expected immutable SHA-256 revision");
6
+ }
7
+ function check(field, variable) {
8
+ const clauses = field.type === "integer"
9
+ ? [`typeof ${variable} === "number"`, `Number.isSafeInteger(${variable})`]
10
+ : [`typeof ${variable} === ${js(field.type)}`];
11
+ if (field.type === "number")
12
+ clauses.push(`Number.isFinite(${variable})`);
13
+ if (field.minimum !== undefined)
14
+ clauses.push(`${variable} >= ${js(field.minimum)}`);
15
+ if (field.maximum !== undefined)
16
+ clauses.push(`${variable} <= ${js(field.maximum)}`);
17
+ if (field.type === "string")
18
+ clauses.push(`${variable}.length <= ${js(2 * (field.maxLength ?? 4096))}`, `Array.from(${variable}).length <= ${js(field.maxLength ?? 4096)}`, `!/[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|(?<![\\uD800-\\uDBFF])[\\uDC00-\\uDFFF]/u.test(${variable})`);
19
+ if (field.values)
20
+ clauses.push(`${js(field.values)}.includes(${variable})`);
21
+ return clauses.map((clause) => `(${clause})`).join(" && ");
22
+ }
23
+ function session(instance, profile, documentDigest) {
24
+ const initial = Object.fromEntries(profile.fields.map((field) => [
25
+ field.id,
26
+ resolvePointer(instance.data, field.binding).value,
27
+ ]));
28
+ const read = (key) => `state[${js(key)}]`;
29
+ const assignment = (key, expression) => `${read(key)} = ${expression};`;
30
+ const validators = profile.fields
31
+ .map((field) => `case ${js(field.id)}: return ${check(field, "value")};`)
32
+ .join("\n");
33
+ const writable = profile.fields
34
+ .filter((field) => field.writable)
35
+ .map((field) => field.id);
36
+ const shareable = profile.fields
37
+ .filter((field) => field.shareable)
38
+ .map((field) => field.id);
39
+ const presetCases = profile.presets
40
+ .map((preset) => `case ${js(preset.id)}: ${Object.entries(preset.values)
41
+ .map(([key, value]) => assignment(key, js(value)))
42
+ .join("\n")} return;`)
43
+ .join("\n");
44
+ const operations = profile.operations
45
+ .map((operation) => {
46
+ switch (operation.kind) {
47
+ case "assign":
48
+ return `case ${js(operation.id)}: set(${js(operation.field)}, value); return;`;
49
+ case "preset":
50
+ return `case ${js(operation.id)}: preset(${js(operation.preset)}); return;`;
51
+ case "transition":
52
+ return `case ${js(operation.id)}: if (${read(operation.field)} !== ${js(operation.from)}) throw Error("Invalid transition"); ${assignment(operation.field, js(operation.to))} return;`;
53
+ }
54
+ })
55
+ .join("\n");
56
+ const inputs = profile.ports
57
+ .filter((port) => port.direction === "input")
58
+ .map((port) => `case ${js(port.id)}: ${port.presetSelection ? `if (!valid(${js(port.field)}, value)) throw Error("Invalid preset port"); preset(value);` : ""} set(${js(port.field)}, value); return;`)
59
+ .join("\n");
60
+ const outputs = profile.ports
61
+ .filter((port) => port.direction === "output")
62
+ .map((port) => `case ${js(port.id)}: return ${read(port.field)};`)
63
+ .join("\n");
64
+ const views = profile.views
65
+ .map((view) => `[${js(view.id)}]: ${read(view.field)}`)
66
+ .join(",");
67
+ const identity = {
68
+ profile: "urn:publisle:snapshot:beta",
69
+ documentDigest,
70
+ contractDigest: instance.contractDigest,
71
+ blockId: instance.blockId,
72
+ };
73
+ return `(() => {
74
+ const authored = Object.freeze(${js(initial)});
75
+ let state = {...authored};
76
+ let disposed = false;
77
+ function alive() { if (disposed) throw Error("Session disposed"); }
78
+ function valid(key, value) { switch(key) { ${validators} default: return false; } }
79
+ function set(key, value) { alive(); if (!${js(writable)}.includes(key) || !valid(key, value)) throw Error("Invalid writable state"); state[key] = value; }
80
+ function preset(id) { alive(); switch(id) { ${presetCases} default: throw Error("Unknown preset"); } }
81
+ return Object.freeze({
82
+ authored,
83
+ read() { alive(); return Object.freeze({...state}); },
84
+ views() { alive(); return Object.freeze({${views}}); },
85
+ action(id, value) { alive(); switch(id) { ${operations} default: throw Error("Unknown action"); } },
86
+ preset,
87
+ reset() { alive(); state = {...authored}; },
88
+ receive(port, value) { alive(); switch(port) { ${inputs} default: throw Error("Unknown input port"); } },
89
+ output(port) { alive(); switch(port) { ${outputs} default: throw Error("Unknown output port"); } },
90
+ snapshot() { alive(); const result = Object.freeze({...${js(identity)}, state: Object.freeze({${shareable.map((key) => `[${js(key)}]: ${read(key)}`).join(",")}})}); snapshotBytes(result); return result; },
91
+ restore(snapshot) {
92
+ alive();
93
+ plain(snapshot, ["profile", "documentDigest", "contractDigest", "blockId", "state"]);
94
+ ${Object.entries(identity)
95
+ .map(([key, value]) => `if (snapshot[${js(key)}] !== ${js(value)}) throw Error("Incompatible snapshot");`)
96
+ .join("\n")}
97
+ plain(snapshot.state, ${js(shareable)});
98
+ // Validate the complete candidate before any write; readonly values reset to authored.
99
+ for (const key of ${js(shareable)}) if (!valid(key, snapshot.state[key])) throw Error("Invalid snapshot state");
100
+ snapshotBytes(snapshot);
101
+ state = {...authored, ...snapshot.state};
102
+ },
103
+ dispose() { disposed = true; state = {}; }
104
+ });
105
+ })()`;
106
+ }
107
+ /** Trusted build-time lowering. Returned ES module contains no schemas, graph, registry or interpreter. */
108
+ export function compileComposition(options) {
109
+ canonicalizeJson(options);
110
+ digest(options.documentDigest);
111
+ if (options.instances.length > 128 || options.connections.length > 256)
112
+ throw new Error("Composition size limit");
113
+ const profiles = new Map();
114
+ for (const instance of options.instances) {
115
+ digest(instance.contractDigest);
116
+ if (!instance.blockId ||
117
+ instance.blockId.length > 128 ||
118
+ profiles.has(instance.blockId))
119
+ throw new Error("Invalid or duplicate block ID");
120
+ const diagnostics = validateSemantics(instance.semantics, instance.data);
121
+ if (diagnostics.length)
122
+ throw new Error(diagnostics.map((entry) => entry.message).join("; "));
123
+ profiles.set(instance.blockId, parseComposition(instance.semantics.composition, instance.data, instance.semantics.entities));
124
+ }
125
+ const indegree = new Map([...profiles.keys()].map((key) => [key, 0]));
126
+ const outgoing = new Map();
127
+ const edgeIds = new Set();
128
+ for (const connection of options.connections) {
129
+ const source = profiles.get(connection.from.block);
130
+ const target = profiles.get(connection.to.block);
131
+ const from = source?.ports.find((port) => port.id === connection.from.port && port.direction === "output");
132
+ const to = target?.ports.find((port) => port.id === connection.to.port && port.direction === "input");
133
+ if (!source || !target || !from || !to)
134
+ throw new Error("Missing block or typed port");
135
+ if (source.fields.find((field) => field.id === from.field)?.type !==
136
+ target.fields.find((field) => field.id === to.field)?.type)
137
+ throw new Error("Port type mismatch");
138
+ const key = canonicalizeJson(connection);
139
+ if (edgeIds.has(key))
140
+ throw new Error("Duplicate connection");
141
+ edgeIds.add(key);
142
+ indegree.set(connection.to.block, (indegree.get(connection.to.block) ?? 0) + 1);
143
+ const edges = outgoing.get(connection.from.block) ?? [];
144
+ edges.push(connection);
145
+ outgoing.set(connection.from.block, edges);
146
+ }
147
+ const order = [];
148
+ const ready = [...indegree.keys()]
149
+ .filter((key) => indegree.get(key) === 0)
150
+ .sort();
151
+ while (ready.length) {
152
+ const key = ready.shift();
153
+ if (key === undefined)
154
+ break;
155
+ order.push(key);
156
+ for (const edge of outgoing.get(key) ?? []) {
157
+ const count = (indegree.get(edge.to.block) ?? 0) - 1;
158
+ indegree.set(edge.to.block, count);
159
+ if (count === 0) {
160
+ ready.push(edge.to.block);
161
+ ready.sort();
162
+ }
163
+ }
164
+ }
165
+ if (order.length !== profiles.size)
166
+ throw new Error("Unsupported cross-block cycle");
167
+ const propagation = order
168
+ .map((key) => {
169
+ const edges = [...(outgoing.get(key) ?? [])].sort((a, b) => {
170
+ const left = canonicalizeJson(a);
171
+ const right = canonicalizeJson(b);
172
+ return left < right ? -1 : left > right ? 1 : 0;
173
+ });
174
+ return `if (changed.has(${js(key)})) { ${edges.map((edge) => `try { sessions[${js(edge.to.block)}].receive(${js(edge.to.port)}, sessions[${js(key)}].output(${js(edge.from.port)})); changed.add(${js(edge.to.block)}); } catch(error) { errors.push({block: ${js(edge.to.block)}, message: String(error)}); }`).join("\n")} }`;
175
+ })
176
+ .join("\n");
177
+ return `// Generated bounded Publisle composition; host chooses storage, routing and presentation.
178
+ function snapshotBytes(value) { if (new TextEncoder().encode(JSON.stringify(value)).byteLength > 16384) throw Error("Snapshot exceeds 16 KiB"); }
179
+ function notify(listener, views, signal) {
180
+ return new Promise((resolve, reject) => {
181
+ const stopped = () => finish(Error("Placement disposed"));
182
+ const timer = setTimeout(() => finish(Error("Host observer timeout")), 1000);
183
+ function finish(error) { clearTimeout(timer); signal.removeEventListener("abort", stopped); if(error) reject(error); else resolve(); }
184
+ signal.addEventListener("abort", stopped, {once: true});
185
+ Promise.resolve().then(() => { if(signal.aborted) throw Error("Placement disposed"); return listener(views, signal); }).then(() => finish(), finish);
186
+ });
187
+ }
188
+ function plain(value, keys) {
189
+ if (!value || typeof value !== "object" || (Object.getPrototypeOf(value) !== Object.prototype && Object.getPrototypeOf(value) !== null) || Object.getOwnPropertySymbols(value).length) throw Error("Expected plain data");
190
+ const descriptors = Object.getOwnPropertyDescriptors(value);
191
+ if (Object.keys(descriptors).length !== keys.length || keys.some(key => !Object.hasOwn(descriptors, key)) || Object.values(descriptors).some(entry => !entry.enumerable || !("value" in entry))) throw Error("Unexpected snapshot fields or accessors");
192
+ }
193
+ export function createPlacement() {
194
+ let disposed = false;
195
+ const cancellation = new AbortController();
196
+ let tail = Promise.resolve();
197
+ const observers = new Map();
198
+ const sessions = Object.freeze({${options.instances.map((instance) => `[${js(instance.blockId)}]: ${session(instance, profiles.get(instance.blockId), options.documentDigest)}`).join(",")}});
199
+ return Object.freeze({
200
+ session(id) { if (disposed || !Object.hasOwn(sessions, id)) throw Error("Unknown or disposed block"); return sessions[id]; },
201
+ observe(id, listener) { if (disposed || !Object.hasOwn(sessions, id) || typeof listener !== "function") throw Error("Invalid host observer"); observers.set(id, listener); return () => { if (observers.get(id) === listener) observers.delete(id); }; },
202
+ batch(commands) {
203
+ if (!Array.isArray(commands) || commands.length > 128) return Promise.reject(Error("Batch size limit"));
204
+ // Capture host input now, not after a queued asynchronous observer yields.
205
+ const captured = commands.map(command => {
206
+ plain(command, Object.hasOwn(command, "value") ? ["block", "kind", "id", "value"] : ["block", "kind", "id"]);
207
+ if (typeof command.block !== "string" || typeof command.kind !== "string" || typeof command.id !== "string" || (Object.hasOwn(command, "value") && !["number", "string", "boolean"].includes(typeof command.value))) throw Error("Invalid host command");
208
+ return {...command};
209
+ });
210
+ const run = async () => {
211
+ if (disposed) throw Error("Placement disposed");
212
+ const changed = new Set(); const errors = [];
213
+ for (const command of captured) {
214
+ try {
215
+ if (!Object.hasOwn(sessions, command.block)) throw Error("Unknown block");
216
+ const target = sessions[command.block];
217
+ switch(command.kind) {
218
+ case "action": target.action(command.id, command.value); break;
219
+ case "preset": target.preset(command.id); break;
220
+ case "reset": if(command.id !== "reset") throw Error("Unknown reset action"); target.reset(); break;
221
+ default: throw Error("Unsupported command");
222
+ }
223
+ changed.add(command.block);
224
+ } catch(error) { errors.push({block: command.block, message: String(error)}); }
225
+ }
226
+ ${propagation}
227
+ // Host observers are out of band. Failures cannot stop other views or poison the queue.
228
+ ${order.map((key) => `if (!disposed && changed.has(${js(key)}) && observers.has(${js(key)})) { try { await notify(observers.get(${js(key)}), sessions[${js(key)}].views(), cancellation.signal); } catch(error) { errors.push({block: ${js(key)}, message: String(error)}); } }`).join("\n")}
229
+ return Object.freeze(errors.map(error => Object.freeze(error)));
230
+ };
231
+ const result = tail.then(run);
232
+ tail = result.then(() => undefined, () => undefined);
233
+ return result;
234
+ },
235
+ dispose() { if (disposed) return; disposed = true; cancellation.abort(); observers.clear(); ${order.map((key) => `sessions[${js(key)}].dispose();`).join("\n")} }
236
+ });
237
+ }`;
238
+ }
239
+ //# sourceMappingURL=composition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"composition.js","sourceRoot":"","sources":["../src/composition.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,iBAAiB,GAIlB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,eAAe,IAAI,EAAE,EAAE,MAAM,iBAAiB,CAAC;AAiBxD,SAAS,MAAM,CAAC,KAAa;IAC3B,IAAI,CAAC,wBAAwB,CAAC,IAAI,CAAC,KAAK,CAAC;QACvC,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;AAC3D,CAAC;AACD,SAAS,KAAK,CAAC,KAAiB,EAAE,QAAgB;IAChD,MAAM,OAAO,GACX,KAAK,CAAC,IAAI,KAAK,SAAS;QACtB,CAAC,CAAC,CAAC,UAAU,QAAQ,eAAe,EAAE,wBAAwB,QAAQ,GAAG,CAAC;QAC1E,CAAC,CAAC,CAAC,UAAU,QAAQ,QAAQ,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACnD,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ;QAAE,OAAO,CAAC,IAAI,CAAC,mBAAmB,QAAQ,GAAG,CAAC,CAAC;IAC1E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,EAAE,CAAC,KAAK,CAAC,2CAA2C,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;IAClU,CAAC,CAAC;SACD,IAAI,CAAC,IAAI,CAAC,CAAC;IACd,OAAO;;;;;;;;;;;;;;;;;;;;;sCAqB6B,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,OAAO,CAAC,QAAQ,EAAE,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAE,EAAE,OAAO,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;YA4BnL,WAAW;;YAEX,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,gCAAgC,EAAE,CAAC,GAAG,CAAC,sBAAsB,EAAE,CAAC,GAAG,CAAC,yCAAyC,EAAE,CAAC,GAAG,CAAC,eAAe,EAAE,CAAC,GAAG,CAAC,yEAAyE,EAAE,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;;;;;;;oGAOlM,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,YAAY,EAAE,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;;IAEhK,CAAC;AACL,CAAC"}
@@ -0,0 +1,128 @@
1
+ .publisle-document {
2
+ color: var(--publisle-text, inherit);
3
+ font-family: var(--publisle-font, inherit);
4
+ }
5
+
6
+ .publisle-document .publisle-embed iframe {
7
+ width: 100%;
8
+ border: 0;
9
+ }
10
+
11
+ .publisle-document .publisle-figure-credit,
12
+ .publisle-document .publisle-figure-original {
13
+ display: block;
14
+ }
15
+
16
+ .publisle-document [data-publisle-unresolved] {
17
+ text-decoration-style: wavy;
18
+ }
19
+
20
+ .publisle-document .publisle-align-left {
21
+ text-align: left;
22
+ }
23
+
24
+ .publisle-document .publisle-align-center {
25
+ text-align: center;
26
+ }
27
+
28
+ .publisle-document .publisle-align-right {
29
+ text-align: right;
30
+ }
31
+
32
+ .publisle-document .publisle-diagram-print {
33
+ display: none;
34
+ }
35
+
36
+ @media (prefers-reduced-motion: reduce) {
37
+ .publisle-document .publisle-interactive,
38
+ .publisle-document [data-publisle-island],
39
+ .publisle-document .publisle-island {
40
+ scroll-behavior: auto;
41
+ transition: none;
42
+ animation: none;
43
+ }
44
+ }
45
+
46
+ @media print {
47
+ .publisle-document [data-publisle-activate] {
48
+ display: none;
49
+ }
50
+
51
+ .publisle-document [data-publisle-mount] {
52
+ display: none !important;
53
+ }
54
+
55
+ .publisle-document [data-publisle-fallback] {
56
+ display: block !important;
57
+ }
58
+
59
+ .publisle-document .publisle-diagram-print {
60
+ display: block;
61
+ }
62
+
63
+ .publisle-document .publisle-diagram-print + .publisle-diagram-screen,
64
+ .publisle-document .publisle-diagram-screen:has(+ .publisle-diagram-print) {
65
+ display: none;
66
+ }
67
+ }
68
+
69
+ .publisle-document :where(h1) {
70
+ font-size: 2em;
71
+ }
72
+
73
+ .publisle-document :where(h2) {
74
+ font-size: 1.5em;
75
+ }
76
+
77
+ .publisle-document :where(h3) {
78
+ font-size: 1.25em;
79
+ }
80
+
81
+ .publisle-document :where(h4) {
82
+ font-size: 1.1em;
83
+ }
84
+
85
+ .publisle-document :where(h5, h6) {
86
+ font-size: 1em;
87
+ }
88
+
89
+ .publisle-document :where(pre) {
90
+ overflow-x: auto;
91
+ }
92
+
93
+ .publisle-document :where(table) {
94
+ border-collapse: collapse;
95
+ }
96
+
97
+ .publisle-document :where(img) {
98
+ max-width: 100%;
99
+ }
100
+
101
+ .publisle-document .publisle-task-list-item {
102
+ display: grid;
103
+ grid-template-columns: 1em minmax(0, 1fr);
104
+ column-gap: 0.6em;
105
+ margin-block: 0.35em;
106
+ }
107
+
108
+ .publisle-document .publisle-task-list-item > input[type="checkbox"] {
109
+ grid-column: 1;
110
+ grid-row: 1;
111
+ align-self: start;
112
+ margin: 0.3em 0 0;
113
+ width: 1em;
114
+ height: 1em;
115
+ }
116
+
117
+ .publisle-document .publisle-task-list-item > :not(input[type="checkbox"]) {
118
+ grid-column: 2;
119
+ min-width: 0;
120
+ }
121
+
122
+ .publisle-document .publisle-task-list-item > input[type="checkbox"] + p {
123
+ margin-block: 0;
124
+ }
125
+
126
+ .publisle-document .publisle-task-list-item > :last-child {
127
+ margin-block-end: 0;
128
+ }
package/dist/html.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ import type { RenderNode } from "./types.js";
2
+ export declare function serializeNodes(nodes: readonly RenderNode[]): string;
3
+ /** Assign placement ids from recorded attributes. This walks tags, not document text. */
4
+ export declare function instantiateHtml(html: string, instanceId: string): string;
5
+ //# sourceMappingURL=html.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"html.d.ts","sourceRoot":"","sources":["../src/html.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,mBAAmB;AAqD7C,wBAAgB,cAAc,CAAC,KAAK,EAAE,SAAS,UAAU,EAAE,GAAG,MAAM,CAEnE;AAmED,yFAAyF;AACzF,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CA4BxE"}
package/dist/html.js ADDED
@@ -0,0 +1,199 @@
1
+ const VOID_ELEMENTS = new Set([
2
+ "area",
3
+ "base",
4
+ "br",
5
+ "col",
6
+ "embed",
7
+ "hr",
8
+ "img",
9
+ "input",
10
+ "link",
11
+ "meta",
12
+ "param",
13
+ "source",
14
+ "track",
15
+ "wbr",
16
+ ]);
17
+ function escapeText(value) {
18
+ return value
19
+ .replaceAll("&", "&amp;")
20
+ .replaceAll("<", "&lt;")
21
+ .replaceAll(">", "&gt;");
22
+ }
23
+ function escapeAttribute(value) {
24
+ return escapeText(value).replaceAll('"', "&quot;");
25
+ }
26
+ function serializeAttributes(attributes) {
27
+ let result = "";
28
+ for (const [name, value] of Object.entries(attributes)) {
29
+ if (value === false || value === undefined)
30
+ continue;
31
+ if (value === true) {
32
+ result += ` ${name}`;
33
+ continue;
34
+ }
35
+ result += ` ${name}="${escapeAttribute(String(value))}"`;
36
+ }
37
+ return result;
38
+ }
39
+ function isActivateButton(node) {
40
+ return (node.kind === "element" &&
41
+ node.tag === "button" &&
42
+ node.attributes["data-publisle-activate"] !== undefined);
43
+ }
44
+ export function serializeNodes(nodes) {
45
+ return nodes.map(serializeNode).join("");
46
+ }
47
+ function serializeNode(node) {
48
+ if (node.kind === "text")
49
+ return escapeText(node.value);
50
+ if (node.kind === "raw")
51
+ return node.value.replace(/<script\b[^>]*>[\s\S]*?<\/script>/giu, "");
52
+ if (node.kind === "component") {
53
+ if (!node.artifact?.length)
54
+ throw new Error("Cannot serialize a framework component without static lowering or authored fallback.");
55
+ return serializeNodes(node.artifact);
56
+ }
57
+ if (node.kind === "island") {
58
+ const content = node.fallback.filter((child) => !isActivateButton(child));
59
+ const button = node.fallback.find(isActivateButton);
60
+ const provenance = node.provenance
61
+ ? ` data-publisle-contract="${escapeAttribute(node.provenance)}"`
62
+ : "";
63
+ return `<section data-publisle-island="${escapeAttribute(node.blockId)}" aria-label="${escapeAttribute(node.label)}"${provenance}><div data-publisle-fallback>${serializeNodes(content)}</div><div data-publisle-mount hidden></div>${button ? serializeNode(button) : ""}</section>`;
64
+ }
65
+ if (node.tag === "script")
66
+ return "";
67
+ const attributes = publicationAttributes(node.attributes);
68
+ const attrs = serializeAttributes(attributes);
69
+ if (VOID_ELEMENTS.has(node.tag))
70
+ return `<${node.tag}${attrs}>`;
71
+ return `<${node.tag}${attrs}>${serializeNodes(node.children)}</${node.tag}>`;
72
+ }
73
+ function publicationAttributes(attributes) {
74
+ const result = {};
75
+ for (const [name, value] of Object.entries(attributes)) {
76
+ if (name === "id" && typeof value === "string") {
77
+ result["data-publisle-id"] = value;
78
+ continue;
79
+ }
80
+ if (name === "href" && typeof value === "string" && value.startsWith("#")) {
81
+ result["data-publisle-ref"] ??= value.slice(1);
82
+ continue;
83
+ }
84
+ result[name] = value;
85
+ }
86
+ return result;
87
+ }
88
+ function readAttributes(source) {
89
+ const attributes = new Map();
90
+ const pattern = /([^\s=/><]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/gu;
91
+ for (const match of source.matchAll(pattern)) {
92
+ const name = match[1];
93
+ if (!name)
94
+ continue;
95
+ const value = match[2] ?? match[3] ?? match[4] ?? "";
96
+ attributes.set(name, value);
97
+ }
98
+ return attributes;
99
+ }
100
+ function writeAttributes(attributes) {
101
+ let result = "";
102
+ for (const [name, value] of attributes) {
103
+ result += ` ${name}="${escapeAttribute(value)}"`;
104
+ }
105
+ return result;
106
+ }
107
+ /** Assign placement ids from recorded attributes. This walks tags, not document text. */
108
+ export function instantiateHtml(html, instanceId) {
109
+ if (!/^[A-Za-z][A-Za-z0-9_-]{0,63}$/u.test(instanceId))
110
+ throw new Error("Placement ID must be a bounded safe host identifier.");
111
+ const generated = new Set();
112
+ for (let offset = 0; offset < html.length;) {
113
+ const start = html.indexOf("<", offset);
114
+ if (start < 0)
115
+ break;
116
+ const end = tagEnd(html, start);
117
+ const tag = html.slice(start, end + 1);
118
+ const id = /\bdata-publisle-id="([^"]*)"/u.exec(tag)?.[1];
119
+ if (id !== undefined)
120
+ generated.add(id);
121
+ offset = end + 1;
122
+ }
123
+ let result = "";
124
+ let index = 0;
125
+ while (index < html.length) {
126
+ const start = html.indexOf("<", index);
127
+ if (start === -1) {
128
+ result += html.slice(index);
129
+ break;
130
+ }
131
+ result += html.slice(index, start);
132
+ const end = tagEnd(html, start);
133
+ const tag = html.slice(start, end + 1);
134
+ result += rewriteTag(tag, instanceId, generated);
135
+ index = end + 1;
136
+ }
137
+ return result;
138
+ }
139
+ function tagEnd(html, start) {
140
+ let quote = "";
141
+ for (let index = start + 1; index < html.length; index += 1) {
142
+ const character = html[index] ?? "";
143
+ if (quote) {
144
+ if (character === quote)
145
+ quote = "";
146
+ continue;
147
+ }
148
+ if (character === '"' || character === "'") {
149
+ quote = character;
150
+ continue;
151
+ }
152
+ if (character === ">")
153
+ return index;
154
+ }
155
+ return html.length - 1;
156
+ }
157
+ function rewriteTag(tag, instanceId, generated) {
158
+ if (!tag.startsWith("<") || tag.startsWith("</") || tag.startsWith("<!"))
159
+ return tag;
160
+ const nameEnd = tag.search(/[\s/>]/u);
161
+ const tagName = tag.slice(1, nameEnd === -1 ? undefined : nameEnd);
162
+ const attributeSource = tag.slice(tagName.length + 1, tag.endsWith("/>") ? -2 : -1);
163
+ const attributes = readAttributes(attributeSource);
164
+ const localId = attributes.get("data-publisle-id");
165
+ if (localId !== undefined)
166
+ attributes.set("id", `${instanceId}-${localId}`);
167
+ const localRef = attributes.get("data-publisle-ref");
168
+ if (localRef !== undefined)
169
+ attributes.set("href", `#${instanceId}-${localRef}`);
170
+ for (const name of [
171
+ "aria-labelledby",
172
+ "aria-describedby",
173
+ "aria-controls",
174
+ "aria-owns",
175
+ "aria-flowto",
176
+ "aria-activedescendant",
177
+ "aria-details",
178
+ "aria-errormessage",
179
+ "for",
180
+ "headers",
181
+ "list",
182
+ "form",
183
+ ]) {
184
+ const value = attributes.get(name);
185
+ if (value !== undefined)
186
+ attributes.set(name, value
187
+ .split(/\s+/u)
188
+ .map((id) => (generated.has(id) ? `${instanceId}-${id}` : id))
189
+ .join(" "));
190
+ }
191
+ for (const name of ["href", "xlink:href"]) {
192
+ const value = attributes.get(name);
193
+ if (value?.startsWith("#") && generated.has(value.slice(1)))
194
+ attributes.set(name, `#${instanceId}-${value.slice(1)}`);
195
+ }
196
+ const closing = tag.endsWith("/>") ? " />" : ">";
197
+ return `<${tagName}${writeAttributes(attributes)}${closing}`;
198
+ }
199
+ //# sourceMappingURL=html.js.map