@threadlabs/markupkit 0.0.0-stage → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +62 -2
  3. package/components/breadcrumbs.html +9 -0
  4. package/components/nav.html +51 -0
  5. package/components/pager.html +13 -0
  6. package/dist/application.d.ts +31 -0
  7. package/dist/application.d.ts.map +1 -0
  8. package/dist/application.js +488 -0
  9. package/dist/application.js.map +1 -0
  10. package/dist/browser.d.ts +13 -0
  11. package/dist/browser.d.ts.map +1 -0
  12. package/dist/browser.js +151 -0
  13. package/dist/browser.js.map +1 -0
  14. package/dist/build.d.ts +5 -0
  15. package/dist/build.d.ts.map +1 -0
  16. package/dist/build.js +351 -0
  17. package/dist/build.js.map +1 -0
  18. package/dist/bundle-worker.d.ts +2 -0
  19. package/dist/bundle-worker.d.ts.map +1 -0
  20. package/dist/bundle-worker.js +48 -0
  21. package/dist/bundle-worker.js.map +1 -0
  22. package/dist/bundle.d.ts +23 -0
  23. package/dist/bundle.d.ts.map +1 -0
  24. package/dist/bundle.js +34 -0
  25. package/dist/bundle.js.map +1 -0
  26. package/dist/cli.d.ts +3 -0
  27. package/dist/cli.d.ts.map +1 -0
  28. package/dist/cli.js +68 -0
  29. package/dist/cli.js.map +1 -0
  30. package/dist/client.d.ts +40 -0
  31. package/dist/client.d.ts.map +1 -0
  32. package/dist/client.js +447 -0
  33. package/dist/client.js.map +1 -0
  34. package/dist/component-module.d.ts +20 -0
  35. package/dist/component-module.d.ts.map +1 -0
  36. package/dist/component-module.js +82 -0
  37. package/dist/component-module.js.map +1 -0
  38. package/dist/config.d.ts +36 -0
  39. package/dist/config.d.ts.map +1 -0
  40. package/dist/config.js +111 -0
  41. package/dist/config.js.map +1 -0
  42. package/dist/csp.d.ts +23 -0
  43. package/dist/csp.d.ts.map +1 -0
  44. package/dist/csp.js +91 -0
  45. package/dist/csp.js.map +1 -0
  46. package/dist/description.d.ts +45 -0
  47. package/dist/description.d.ts.map +1 -0
  48. package/dist/description.js +28 -0
  49. package/dist/description.js.map +1 -0
  50. package/dist/document.d.ts +48 -0
  51. package/dist/document.d.ts.map +1 -0
  52. package/dist/document.js +65 -0
  53. package/dist/document.js.map +1 -0
  54. package/dist/index.d.ts +13 -0
  55. package/dist/index.d.ts.map +1 -0
  56. package/dist/index.js +9 -0
  57. package/dist/index.js.map +1 -0
  58. package/dist/links.d.ts +8 -0
  59. package/dist/links.d.ts.map +1 -0
  60. package/dist/links.js +90 -0
  61. package/dist/links.js.map +1 -0
  62. package/dist/private-api.d.ts +12 -0
  63. package/dist/private-api.d.ts.map +1 -0
  64. package/dist/private-api.js +158 -0
  65. package/dist/private-api.js.map +1 -0
  66. package/dist/private-client.d.ts +11 -0
  67. package/dist/private-client.d.ts.map +1 -0
  68. package/dist/private-client.js +18 -0
  69. package/dist/private-client.js.map +1 -0
  70. package/dist/private-readers.d.ts +26 -0
  71. package/dist/private-readers.d.ts.map +1 -0
  72. package/dist/private-readers.js +107 -0
  73. package/dist/private-readers.js.map +1 -0
  74. package/dist/provider-preparation.d.ts +20 -0
  75. package/dist/provider-preparation.d.ts.map +1 -0
  76. package/dist/provider-preparation.js +82 -0
  77. package/dist/provider-preparation.js.map +1 -0
  78. package/dist/providers.d.ts +14 -0
  79. package/dist/providers.d.ts.map +1 -0
  80. package/dist/providers.js +127 -0
  81. package/dist/providers.js.map +1 -0
  82. package/dist/read-channel.d.ts +30 -0
  83. package/dist/read-channel.d.ts.map +1 -0
  84. package/dist/read-channel.js +65 -0
  85. package/dist/read-channel.js.map +1 -0
  86. package/dist/resource.d.ts +31 -0
  87. package/dist/resource.d.ts.map +1 -0
  88. package/dist/resource.js +117 -0
  89. package/dist/resource.js.map +1 -0
  90. package/dist/routes.d.ts +90 -0
  91. package/dist/routes.d.ts.map +1 -0
  92. package/dist/routes.js +536 -0
  93. package/dist/routes.js.map +1 -0
  94. package/dist/serve.d.ts +4 -0
  95. package/dist/serve.d.ts.map +1 -0
  96. package/dist/serve.js +221 -0
  97. package/dist/serve.js.map +1 -0
  98. package/dist/server.d.ts +211 -0
  99. package/dist/server.d.ts.map +1 -0
  100. package/dist/server.js +734 -0
  101. package/dist/server.js.map +1 -0
  102. package/dist/types.d.ts +504 -0
  103. package/dist/types.d.ts.map +1 -0
  104. package/dist/types.js +2 -0
  105. package/dist/types.js.map +1 -0
  106. package/package.json +80 -4
package/dist/client.js ADDED
@@ -0,0 +1,447 @@
1
+ /** Consume only this component's read identities; the renderer adopts accepted values itself. */
2
+ export function preparedBinding(root, tag) {
3
+ const text = root.getAttribute("data-markupkit-bindings");
4
+ if (text === null)
5
+ return undefined;
6
+ const records = JSON.parse(text);
7
+ if (!Object.hasOwn(records, tag))
8
+ return undefined;
9
+ const snapshot = records[tag];
10
+ delete records[tag];
11
+ if (Object.keys(records).length === 0)
12
+ root.removeAttribute("data-markupkit-bindings");
13
+ else
14
+ root.setAttribute("data-markupkit-bindings", JSON.stringify(records));
15
+ return snapshot;
16
+ }
17
+ const components = new Map();
18
+ let started = false;
19
+ /** A page that defines a tag differently from this document. Only a document of its own can show it. */
20
+ class Conflict extends Error {
21
+ }
22
+ /** Marks the document navigation a page that cannot render in place gets, which MarkupKit leaves native. */
23
+ const documentLoad = Symbol("MarkupKit document load");
24
+ /**
25
+ * Adopts the server-rendered components within `root`, outermost first: each adopts the components its
26
+ * template invokes, and a root projected into another (a page in its layout) is adopted here.
27
+ */
28
+ function adopt(root) {
29
+ for (const element of [...root instanceof Element ? [root] : [], ...root.querySelectorAll("[data-html-next-instance]")]) {
30
+ if (!element.hasAttribute("data-html-next-instance"))
31
+ continue;
32
+ const component = components.get(element.getAttribute("data-component").split(" ")[0]);
33
+ if (component === undefined)
34
+ element.removeAttribute("data-html-next-instance");
35
+ else
36
+ component[0]({}, undefined, element);
37
+ }
38
+ }
39
+ /** Each page module calls this once, when it is first imported. */
40
+ export function page(runtime, options, pageComponents) {
41
+ // A document keeps one component per tag, as HTML Next's registry does (HR001). A page that
42
+ // redefines a tag fails here, when navigation imports its module, before anything renders, and loads as a document instead.
43
+ for (const [tag, component] of Object.entries(pageComponents)) {
44
+ if ((components.get(tag)?.[0] ?? component[0]) !== component[0])
45
+ throw new Conflict(`MarkupKit: <${tag}> already has another definition in this document.`);
46
+ }
47
+ for (const [tag, component] of Object.entries(pageComponents))
48
+ components.set(tag, component);
49
+ if (started)
50
+ return;
51
+ started = true;
52
+ adopt(document);
53
+ // ponytail: links stay document navigations without NavigateEvent.sourceElement (Chrome 135, Firefox 147,
54
+ // Safari 26.2), which carries the per-link opt-outs; earlier Navigation API versions would skip them.
55
+ if ("navigation" in window && "sourceElement" in NavigateEvent.prototype)
56
+ navigate(runtime, options);
57
+ document.dispatchEvent(new Event("mk:ready"));
58
+ }
59
+ const layer = (root, index) => root.querySelector(`[data-mk-layer="${index}"]`) ?? root.getElementById(`mk-layer-${index}`);
60
+ const fresh = (time) => performance.now() - time < 30_000;
61
+ const loaded = async (url, signal) => {
62
+ const response = await fetch(url, signal === undefined ? {} : { signal });
63
+ if (!response.ok || response.redirected)
64
+ throw new Error(`MarkupKit cannot load ${url} (${response.status}).`);
65
+ return response;
66
+ };
67
+ /**
68
+ * Renders a payload's layers as the server does (application.ts): the same invocations, through each
69
+ * component's factory, each page nested in its layout's `page` slot, with each loader's state. Every
70
+ * layer renders, kept layouts included, so a kept layout gets its new props from its rendering.
71
+ */
72
+ async function render(runtime, payload) {
73
+ if (![1, 2].includes(payload.version) || payload.layers.length === 0)
74
+ throw new Error("MarkupKit cannot read this page payload.");
75
+ const next = document.implementation.createHTMLDocument("");
76
+ if (payload.version === 2) {
77
+ if (payload.rendered === undefined)
78
+ throw new Error("MarkupKit cannot read this prepared page payload.");
79
+ next.head.innerHTML = payload.rendered.head;
80
+ next.body.innerHTML = payload.rendered.body;
81
+ }
82
+ const append = (parent, tag, attributes) => {
83
+ const element = parent.appendChild(next.createElement(tag));
84
+ for (const [name, value] of Object.entries(attributes))
85
+ element.setAttribute(name, value);
86
+ return element;
87
+ };
88
+ if (payload.version === 1 && payload.head.canonical !== undefined)
89
+ append(next.head, "link", { rel: "canonical", href: payload.head.canonical });
90
+ for (const href of payload.styles)
91
+ append(next.head, "link", { rel: "stylesheet", href });
92
+ for (const src of payload.modules)
93
+ append(next.head, "script", { type: "module", src });
94
+ next.documentElement.lang = payload.head.lang;
95
+ if (payload.version === 2) {
96
+ const layers = payload.layers.map((_, index) => {
97
+ const root = layer(next, index);
98
+ if (root === null)
99
+ throw new Error(`MarkupKit cannot find prepared layer ${index}.`);
100
+ return root;
101
+ });
102
+ return { next, layers, adopt: true };
103
+ }
104
+ // Innermost first: each layer is projected into its layout's `page` slot, as its invocation is on the server.
105
+ const layers = [];
106
+ for (let index = payload.layers.length - 1; index >= 0; index -= 1) {
107
+ const { component: tag, attributes: authored, props, state } = payload.layers[index];
108
+ const component = components.get(tag);
109
+ if (component === undefined)
110
+ throw new Error(`MarkupKit cannot render <${tag}>: no page module defines it.`);
111
+ const attributes = { id: `mk-layer-${index}`, "data-mk-layer": String(index), ...index === 0 ? {} : { slot: "page" } };
112
+ const html = {};
113
+ for (const [name, value] of Object.entries(authored)) {
114
+ const prop = component[1][name];
115
+ if (prop === undefined)
116
+ attributes[name] = value;
117
+ else if (props === undefined)
118
+ html[prop] = value;
119
+ }
120
+ const root = component[0]({ ...props, attributes, ...layers.length === 0 ? {} : { slots: { page: [layers[0]] } } }, props === undefined ? html : undefined);
121
+ if (state !== undefined) {
122
+ const host = runtime.generatedHost(root);
123
+ if (host === undefined)
124
+ throw new Error(`MarkupKit cannot give layer ${index} its state.`);
125
+ Object.assign(host.state, state);
126
+ }
127
+ layers.unshift(root);
128
+ }
129
+ // As the server does: let the state's updates render.
130
+ await new Promise(done => setTimeout(done));
131
+ return { next, layers, adopt: false };
132
+ }
133
+ function navigate(runtime, { base, prefetch: policy, manifest }) {
134
+ /**
135
+ * The path and query whose layers the document shows. A navigation's URL commits before its layers
136
+ * arrive. A document shows the page of the entry it loaded into, navigation.activation's, until
137
+ * MarkupKit renders another. Chromium 153 and WebKit 26.6 treat the entries of a document that a load
138
+ * replaced as the new document's own, so traversing to one before MarkupKit starts changes only the URL.
139
+ */
140
+ const loadedInto = navigation.activation?.entry;
141
+ const shown = new URL(loadedInto?.url == null || loadedInto.key === navigation.currentEntry?.key ? location.href : loadedInto.url);
142
+ let rendered = shown.pathname + shown.search;
143
+ /**
144
+ * The links MarkupKit's documents carry: stylesheets and an alias page's canonical link. HTML Next
145
+ * manages head declarations, marked data-component-head; elements that scripts add are never removed.
146
+ */
147
+ const shell = (head) => [...head.querySelectorAll("link:not([data-component-head])")];
148
+ let owned = shell(document.head);
149
+ const announcer = document.createElement("div");
150
+ announcer.id = "mk-announcer";
151
+ announcer.setAttribute("aria-live", "polite");
152
+ announcer.setAttribute("aria-atomic", "true");
153
+ announcer.style.cssText = "position:absolute;width:1px;height:1px;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap";
154
+ document.body.append(announcer);
155
+ /**
156
+ * Same-origin page URLs under base. Page URLs end in a slash; files and other sites load natively.
157
+ * Firefox 155 follows a download link's navigate event with a second one that has no downloadRequest.
158
+ */
159
+ const local = (url, source) => url.origin === location.origin && url.pathname.startsWith(base) &&
160
+ url.pathname.endsWith("/") && !source?.closest("[data-mk-reload]") && !source?.hasAttribute("download");
161
+ const payloadURL = (url) => `${base}_markupkit/pages/${url.pathname.slice(base.length)}payload.json${url.search}`;
162
+ // Prefetching never runs anything: payloads are data, and modules and stylesheets are only hinted.
163
+ const hinted = new Set();
164
+ const hint = (rel, href) => {
165
+ if (hinted.has(href) || document.querySelector(`[src="${CSS.escape(href)}"], [href="${CSS.escape(href)}"]`) !== null)
166
+ return;
167
+ hinted.add(href);
168
+ const link = document.createElement("link");
169
+ link.rel = rel;
170
+ link.href = href;
171
+ document.head.append(link);
172
+ };
173
+ const prefetched = new Map();
174
+ const payloadOf = (url, signal) => loaded(payloadURL(url), signal).then(response => response.json());
175
+ /** The page an HTML link would visit in place, if any. An unparsable href is not a page. */
176
+ const target = (anchor) => {
177
+ const url = anchor instanceof HTMLAnchorElement ? URL.parse(anchor.href) : null;
178
+ return url !== null && local(url, anchor) && ["", "_self"].includes(anchor.target) && url.pathname + url.search !== rendered ? url : undefined;
179
+ };
180
+ const prefetchPage = (url) => {
181
+ const cached = prefetched.get(url.pathname + url.search);
182
+ if (cached !== undefined && fresh(cached.time))
183
+ return;
184
+ const payload = payloadOf(url);
185
+ prefetched.set(url.pathname + url.search, { time: performance.now(), payload });
186
+ payload.then(({ modules, styles }) => {
187
+ for (const src of modules)
188
+ hint("modulepreload", src);
189
+ for (const href of styles)
190
+ hint("prefetch", href);
191
+ }).catch(() => { prefetched.delete(url.pathname + url.search); });
192
+ };
193
+ // Links on screen prefetch only the shared chunks their page needs: a page's own module holds its
194
+ // content, so a long menu would otherwise download every page.
195
+ let chunks;
196
+ const prefetchShared = (url) => {
197
+ if (manifest === undefined)
198
+ return;
199
+ chunks ??= loaded(manifest).then(response => response.json())
200
+ .then((data) => new Map(data.pages.map(page => [page.pathname, page.chunks ?? []])))
201
+ .catch(() => new Map());
202
+ void chunks.then(map => { for (const src of map.get(url.pathname) ?? [])
203
+ hint("modulepreload", src); });
204
+ };
205
+ /** A link's policy: its own or an ancestor's data-mk-prefetch, else the site's. */
206
+ const mode = (anchor) => {
207
+ const value = anchor.closest("[data-mk-prefetch]")?.getAttribute("data-mk-prefetch");
208
+ return value === "interaction" || value === "visible" || value === "none" ? value : policy;
209
+ };
210
+ // Intent: touch at once; a link that keeps the pointer or focus briefly, so sweeping across a menu
211
+ // or tabbing through it fetches nothing.
212
+ let intended;
213
+ const intent = (event) => {
214
+ clearTimeout(intended);
215
+ const anchor = event.target instanceof Element ? event.target.closest("a[href]") : null;
216
+ const url = anchor !== null && mode(anchor) !== "none" ? target(anchor) : undefined;
217
+ if (url !== undefined)
218
+ intended = setTimeout(prefetchPage, event.type === "touchstart" ? 0 : 80, url);
219
+ };
220
+ document.addEventListener("pointerover", intent);
221
+ document.addEventListener("focusin", intent);
222
+ document.addEventListener("touchstart", intent, { passive: true });
223
+ // At idle, or within 2 s on a busy page; a timer where requestIdleCallback is missing.
224
+ const idle = (run) => "requestIdleCallback" in window ? requestIdleCallback(run, { timeout: 2000 }) : setTimeout(run, 1);
225
+ const visible = new IntersectionObserver(entries => {
226
+ for (const { isIntersecting, target: anchor } of entries) {
227
+ if (!isIntersecting)
228
+ continue;
229
+ visible.unobserve(anchor);
230
+ const url = target(anchor);
231
+ const policy = mode(anchor);
232
+ if (url !== undefined && policy !== "none")
233
+ idle(() => (policy === "visible" ? prefetchPage : prefetchShared)(url));
234
+ }
235
+ });
236
+ // ponytail: links that controllers add later are not watched; they still prefetch on interaction.
237
+ const watch = () => { for (const anchor of document.querySelectorAll("a[href]"))
238
+ visible.observe(anchor); };
239
+ watch();
240
+ /** A page's document, whose server markup the components adopt. */
241
+ const parse = async (response, url) => {
242
+ if (!response.headers.get("content-type")?.startsWith("text/html"))
243
+ throw new Error(`MarkupKit cannot render ${url.href} in place.`);
244
+ const next = new DOMParser().parseFromString(await response.text(), "text/html");
245
+ const layers = [];
246
+ for (let index = 0, root = layer(next, 0); root !== null; root = layer(next, ++index))
247
+ layers.push(root);
248
+ return { next, layers, adopt: true };
249
+ };
250
+ const html = async (url, signal) => parse(await loaded(url.pathname + url.search, signal), url);
251
+ /** A submission's redirect, for the navigation to its URL. */
252
+ let redirected;
253
+ /**
254
+ * A form's POST, as the browser would send it: its action's page, or for a redirect, the page it
255
+ * redirects to, which replaces the submission's history entry as a document's POST/redirect/GET does.
256
+ */
257
+ const submit = async (url, form, submitter, body, signal) => {
258
+ const enctype = submitter?.hasAttribute("formenctype") ? submitter.formEnctype : form?.enctype;
259
+ // An urlencoded form names each file by its name, as the browser does.
260
+ const fields = enctype === "multipart/form-data" ? body : new URLSearchParams([...body].map(([name, value]) => [name, typeof value === "string" ? value : value.name]));
261
+ const response = await fetch(url, { method: "POST", body: fields, signal });
262
+ if (response.redirected) {
263
+ // The redirect's navigation, which aborts this one, renders its page from this response, read
264
+ // first, since the abort ends its body. A page it can't render loads as any visit does.
265
+ redirected = { url: response.url, page: await parse(response, new URL(response.url)).catch(() => undefined) };
266
+ void navigation.navigate(response.url, { history: "replace" });
267
+ signal.throwIfAborted();
268
+ }
269
+ // A validation error renders the page with its status, such as 422, as a document shows it.
270
+ return parse(response, url);
271
+ };
272
+ const payload = async (url, signal) => {
273
+ const cached = prefetched.get(url.pathname + url.search);
274
+ prefetched.delete(url.pathname + url.search);
275
+ const data = await (cached !== undefined && fresh(cached.time) ? cached.payload : payloadOf(url, signal));
276
+ // The page's module registers its definitions before anything renders. An absolute URL is the
277
+ // module's identity everywhere: Vite's development server adds ?import to a path, a second URL.
278
+ await Promise.all(data.modules.map(src => import(/* @vite-ignore */ new URL(src, location.href).href)));
279
+ signal.throwIfAborted();
280
+ return render(runtime, data);
281
+ };
282
+ const visit = async (url, event, form) => {
283
+ const { signal } = event;
284
+ const sheets = [];
285
+ let committed = false;
286
+ clearTimeout(intended);
287
+ const handed = redirected?.url === url.href ? redirected.page : undefined;
288
+ redirected = undefined;
289
+ try {
290
+ // The payload carries data, not markup; a page it cannot render loads from its HTML. A page
291
+ // whose definitions conflict with this document's would conflict there too.
292
+ const { next, layers, adopt: hydrate } = await (handed !== undefined ? handed :
293
+ event.formData !== null ? submit(url, form, event.sourceElement, event.formData, signal) : payload(url, signal).catch(error => {
294
+ if (signal.aborted || error instanceof Conflict)
295
+ throw error;
296
+ console.warn("MarkupKit renders this page from its HTML:", error);
297
+ return html(url, signal);
298
+ }));
299
+ if (layers.length === 0 || layer(document, 0) === null)
300
+ throw new Error(`MarkupKit cannot render ${url.href} in place: it has no layers.`);
301
+ // Links both documents share stay; the rest are removed or added at the swap.
302
+ const kept = new Set();
303
+ const added = [];
304
+ for (const element of shell(next.head)) {
305
+ const same = owned.find(candidate => !kept.has(candidate) && candidate.isEqualNode(element));
306
+ if (same === undefined)
307
+ added.push(element);
308
+ else
309
+ kept.add(same);
310
+ }
311
+ // New stylesheets load before the swap, so the next page never paints unstyled. Component styles
312
+ // are scoped, so only the next page's global rules apply to this one meanwhile.
313
+ for (const element of added)
314
+ if (element instanceof HTMLLinkElement && element.relList.contains("stylesheet"))
315
+ sheets.push(element);
316
+ const loading = sheets.map(sheet => new Promise(done => { sheet.addEventListener("load", done); sheet.addEventListener("error", done); }));
317
+ document.head.append(...sheets);
318
+ // The next page's components register before its DOM arrives; a conflicting one falls back below.
319
+ // Resolved against the page's URL: the next document has no <base>, which base-uri 'none' forbids.
320
+ const modules = [...next.head.querySelectorAll('script[type="module"][src]')].map(script => import(/* @vite-ignore */ new URL(script.getAttribute("src"), url).href));
321
+ await Promise.all([...loading, ...modules]);
322
+ const adopting = [];
323
+ for (let index = 0; index < layers.length - 1 && layer(document, index)?.getAttribute("data-component") === layers[index].getAttribute("data-component"); index += 1) {
324
+ const tags = layer(document, index).getAttribute("data-component").split(/\s+/);
325
+ adopting.push(Promise.all(tags.map(tag => components.get(tag)?.[2]?.())));
326
+ }
327
+ const adopters = await Promise.all(adopting);
328
+ const commit = () => {
329
+ signal.throwIfAborted();
330
+ committed = true;
331
+ for (const element of owned)
332
+ if (!kept.has(element))
333
+ element.remove();
334
+ document.head.append(...added.filter(element => !sheets.includes(element)));
335
+ owned = [...kept, ...added];
336
+ document.documentElement.lang = next.documentElement.lang;
337
+ // Layouts persist while each depth renders the same component: they keep their DOM, state,
338
+ // and controllers, and take the new rendering's props. The page layer is always replaced.
339
+ let index = 0;
340
+ while (index < layers.length - 1 && layer(document, index)?.getAttribute("data-component") === layers[index].getAttribute("data-component")) {
341
+ const update = () => runtime.adoptRenderedProps(layer(document, index), layers[index]);
342
+ for (const [at, adoptPrepared] of adopters[index].entries()) {
343
+ const applyCaller = at === 0 ? update : () => { };
344
+ if (adoptPrepared === undefined)
345
+ applyCaller();
346
+ else
347
+ adoptPrepared(layer(document, index), layers[index], applyCaller);
348
+ runtime.flushComponent(layer(document, index));
349
+ }
350
+ index += 1;
351
+ }
352
+ // A page sits in its layout's slot; the layout projects the new page as it did the old one.
353
+ runtime.replaceProjectedNode(layer(document, index), layers[index]);
354
+ // Server markup from the fallback is adopted in place, as the first page was.
355
+ if (hydrate)
356
+ adopt(layers[index]);
357
+ rendered = url.pathname + url.search;
358
+ watch();
359
+ };
360
+ signal.throwIfAborted();
361
+ // The swap disconnects the old page and connects the new one, and HTML Next reconciles the head
362
+ // once in the microtasks after it, which a view transition's update includes.
363
+ if (typeof document.startViewTransition !== "function" || !transitions(document.styleSheets))
364
+ commit();
365
+ else
366
+ await document.startViewTransition(commit).updateCallbackDone;
367
+ const saved = event.navigationType === "traverse" ? positions.get(event.destination.key) : undefined;
368
+ if (saved === undefined)
369
+ event.scroll();
370
+ else
371
+ scrollTo(...saved);
372
+ // The next task, when the head holds the new page's title, announces it.
373
+ await new Promise(done => setTimeout(done));
374
+ announcer.textContent = document.title;
375
+ }
376
+ catch (error) {
377
+ if (!committed)
378
+ for (const sheet of sheets)
379
+ sheet.remove();
380
+ if (signal.aborted)
381
+ return;
382
+ // Anything this document cannot render in place loads as a document instead, in place of the
383
+ // committed entry, so it starts at the top or its fragment as a document load does; a reload would
384
+ // keep this page's scroll position. A submission's URL loads with GET, so a failed render never
385
+ // sends its form twice. A conflicting definition is expected: the new document has its own registry.
386
+ if (!(error instanceof Conflict))
387
+ console.error(error);
388
+ void navigation.navigate(url.href, { history: "replace", info: documentLoad });
389
+ }
390
+ };
391
+ // ponytail: WebKit 26.6 sometimes restores no position for an intercepted back or forward
392
+ // navigation, so MarkupKit records where each entry was left. Other scrolling stays native.
393
+ const positions = new Map();
394
+ // While a navigation renders in place: data-mk-navigating on <html>, and on a submitting form,
395
+ // data-mk-submitting and aria-busy. Only the latest navigation clears <html>'s.
396
+ let latest = 0;
397
+ navigation.addEventListener("navigate", event => {
398
+ if (navigation.currentEntry !== null)
399
+ positions.set(navigation.currentEntry.key, [scrollX, scrollY]);
400
+ const url = new URL(event.destination.url);
401
+ const source = event.sourceElement;
402
+ // A submission's source is its submitter, or the form itself without one.
403
+ const form = event.formData === null ? undefined : source instanceof HTMLFormElement ? source : source?.form ?? undefined;
404
+ // Reloads, downloads, fragment and history.pushState changes, and other documents stay native.
405
+ // Modified clicks and link and form targets open other browsing contexts without this event.
406
+ if (!event.canIntercept || event.navigationType === "reload" || event.downloadRequest !== null || event.info === documentLoad ||
407
+ !local(url, form ?? source) || event.destination.sameDocument && (event.navigationType !== "traverse" || url.pathname + url.search === rendered))
408
+ return;
409
+ // After the swap, a new entry scrolls to its fragment or the top, back and forward return to
410
+ // where the entry was left, and focus resets as after a document load.
411
+ event.intercept({ scroll: "manual", async handler() {
412
+ const id = ++latest;
413
+ document.documentElement.setAttribute("data-mk-navigating", "");
414
+ form?.setAttribute("data-mk-submitting", "");
415
+ form?.setAttribute("aria-busy", "true");
416
+ try {
417
+ await visit(url, event, form);
418
+ }
419
+ finally {
420
+ form?.removeAttribute("data-mk-submitting");
421
+ form?.removeAttribute("aria-busy");
422
+ if (id === latest)
423
+ document.documentElement.removeAttribute("data-mk-navigating");
424
+ }
425
+ } });
426
+ });
427
+ // The entry the document moved to before MarkupKit started renders now, as a traversal to it would:
428
+ // in place, or as a document when its page conflicts with this document's definitions.
429
+ // ponytail: an entry a script pushed before MarkupKit started looks the same as one traversed to, and
430
+ // renders its URL's page too. MarkupKit leaves later pushes alone.
431
+ if (rendered !== location.pathname + location.search)
432
+ void navigation.navigate(location.href, { history: "replace" });
433
+ }
434
+ /** Authors animate navigation with @view-transition { navigation: auto }, as for document navigation. */
435
+ function transitions(rules) {
436
+ return Array.prototype.some.call(rules, (rule) => {
437
+ try {
438
+ return rule instanceof CSSStyleSheet ? transitions(rule.cssRules) :
439
+ typeof CSSViewTransitionRule === "function" && rule instanceof CSSViewTransitionRule ? rule.navigation === "auto" :
440
+ rule instanceof CSSGroupingRule && (!(rule instanceof CSSMediaRule) || matchMedia(rule.conditionText).matches) && transitions(rule.cssRules);
441
+ }
442
+ catch {
443
+ return false;
444
+ } // A cross-origin stylesheet hides its rules.
445
+ });
446
+ }
447
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAWA,iGAAiG;AACjG,MAAM,UAAU,eAAe,CAAC,IAAa,EAAE,GAAW;IACxD,MAAM,IAAI,GAAG,IAAI,CAAC,YAAY,CAAC,yBAAyB,CAAC,CAAC;IAC1D,IAAI,IAAI,KAAK,IAAI;QAAE,OAAO,SAAS,CAAC;IACpC,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAoC,CAAC;IACpE,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,GAAG,CAAC;QAAE,OAAO,SAAS,CAAC;IACnD,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;IAC9B,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC;IACpB,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,KAAK,CAAC;QAAE,IAAI,CAAC,eAAe,CAAC,yBAAyB,CAAC,CAAC;;QAClF,IAAI,CAAC,YAAY,CAAC,yBAAyB,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;IAC3E,OAAO,QAAQ,CAAC;AAClB,CAAC;AAmCD,MAAM,UAAU,GAAG,IAAI,GAAG,EAAqB,CAAC;AAChD,IAAI,OAAO,GAAG,KAAK,CAAC;AACpB,wGAAwG;AACxG,MAAM,QAAS,SAAQ,KAAK;CAAG;AAC/B,4GAA4G;AAC5G,MAAM,YAAY,GAAG,MAAM,CAAC,yBAAyB,CAAC,CAAC;AAEvD;;;GAGG;AACH,SAAS,KAAK,CAAC,IAAgB;IAC7B,KAAK,MAAM,OAAO,IAAI,CAAC,GAAG,IAAI,YAAY,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI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a,CAAC,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;gBACjE,OAAO,qBAAqB,KAAK,UAAU,IAAI,IAAI,YAAY,qBAAqB,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,KAAK,MAAM,CAAC,CAAC;oBACjH,IAAI,YAAY,eAAe,IAAI,CAAC,CAAC,CAAC,IAAI,YAAY,YAAY,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC,IAAI,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACnJ,CAAC;QAAC,MAAM,CAAC;YAAC,OAAO,KAAK,CAAC;QAAC,CAAC,CAAC,6CAA6C;IACzE,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,20 @@
1
+ import type { BindingDefinition, BindingHost, BindingModule, BindingProvider } from "@nextwebwg/html-next/bindings";
2
+ import type { ComponentHost } from "@nextwebwg/html-next/runtime";
3
+ /** Environment companions may replace a reader while retaining the common selector and policy. */
4
+ export interface ComponentBindingDefinition<H extends BindingHost = ComponentHost> {
5
+ readonly props?: Readonly<Record<string, Partial<BindingProvider<any, any, any, any>> | false>>;
6
+ readonly connect?: BindingDefinition<H>["connect"];
7
+ }
8
+ export type ComponentBindingModule<H extends BindingHost = ComponentHost> = (ComponentBindingDefinition<H> & {
9
+ readonly create?: never;
10
+ }) | {
11
+ readonly create: () => ComponentBindingDefinition<H>;
12
+ readonly props?: never;
13
+ readonly connect?: never;
14
+ };
15
+ export declare function moduleDefinition<H extends BindingHost>(module: ComponentBindingModule<H>): ComponentBindingDefinition<H>;
16
+ /** Both hooks start on connection; completed cleanups run in reverse order and late ones still close. */
17
+ export declare function connectModules<H extends BindingHost>(common: BindingDefinition<H>["connect"], local: BindingDefinition<H>["connect"]): BindingDefinition<H>["connect"];
18
+ /** MarkupKit composition only; the binding library retains instance, source and activation ownership. */
19
+ export declare function componentModule<H extends BindingHost>(common?: ComponentBindingModule<H>, local?: ComponentBindingModule<H>, deferClientReads?: boolean): BindingModule<H>;
20
+ //# sourceMappingURL=component-module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"component-module.d.ts","sourceRoot":"","sources":["../src/component-module.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAqB,iBAAiB,EAAE,WAAW,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AACvI,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAElE,kGAAkG;AAClG,MAAM,WAAW,0BAA0B,CAAC,CAAC,SAAS,WAAW,GAAG,aAAa;IAC/E,QAAQ,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC;IAChG,QAAQ,CAAC,OAAO,CAAC,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;CACpD;AACD,MAAM,MAAM,sBAAsB,CAAC,CAAC,SAAS,WAAW,GAAG,aAAa,IAAI,CAAA,0BAA0B,CAAC,CAAC,CAAC,GAAG;IAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,KAAK,CAAA;CAAE,IACrI;IAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,0BAA0B,CAAC,CAAC,CAAC,CAAC;IAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC;AAE7G,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,WAAW,EAAE,MAAM,EAAE,sBAAsB,CAAC,CAAC,CAAC,GAAG,0BAA0B,CAAC,CAAC,CAAC,CAexH;AAED,yGAAyG;AACzG,wBAAgB,cAAc,CAAC,CAAC,SAAS,WAAW,EAAE,MAAM,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAwBtK;AAED,yGAAyG;AACzG,wBAAgB,eAAe,CAAC,CAAC,SAAS,WAAW,EAAE,MAAM,GAAE,sBAAsB,CAAC,CAAC,CAAM,EAAE,KAAK,GAAE,sBAAsB,CAAC,CAAC,CAAM,EAAE,gBAAgB,UAAQ,GAAG,aAAa,CAAC,CAAC,CAAC,CAkBhL"}
@@ -0,0 +1,82 @@
1
+ export function moduleDefinition(module) {
2
+ if (module.create !== undefined && (typeof module.create !== "function" || module.props !== undefined || module.connect !== undefined)) {
3
+ throw new TypeError("A component module exports create, or props and connect; do not mix the two forms.");
4
+ }
5
+ const value = module.create === undefined ? module : module.create();
6
+ if (value !== null && typeof value === "object" && "then" in value) {
7
+ void Promise.resolve(value).catch(() => { });
8
+ throw new TypeError("A component create factory must return synchronously.");
9
+ }
10
+ if (value === null || typeof value !== "object" || Array.isArray(value) ||
11
+ value.connect !== undefined && typeof value.connect !== "function" ||
12
+ value.props !== undefined && (value.props === null || typeof value.props !== "object" || Array.isArray(value.props))) {
13
+ throw new TypeError("A component module must provide { props, connect } synchronously.");
14
+ }
15
+ return value;
16
+ }
17
+ /** Both hooks start on connection; completed cleanups run in reverse order and late ones still close. */
18
+ export function connectModules(common, local) {
19
+ if (common === undefined)
20
+ return local;
21
+ if (local === undefined)
22
+ return common;
23
+ return (host, context) => {
24
+ context.signal.throwIfAborted();
25
+ const stops = [];
26
+ let closed = false;
27
+ const close = () => {
28
+ if (closed)
29
+ return;
30
+ closed = true;
31
+ context.signal.removeEventListener("abort", close);
32
+ try {
33
+ stops[1]?.();
34
+ }
35
+ finally {
36
+ stops[0]?.();
37
+ }
38
+ };
39
+ context.signal.addEventListener("abort", close, { once: true });
40
+ const start = (connect, index) => {
41
+ try {
42
+ return Promise.resolve(connect(host, context)).then(cleanup => {
43
+ if (cleanup !== undefined && typeof cleanup !== "function")
44
+ throw new TypeError("A component connect must return cleanup or undefined.");
45
+ if (closed)
46
+ cleanup?.();
47
+ else
48
+ stops[index] = cleanup;
49
+ });
50
+ }
51
+ catch (error) {
52
+ return Promise.reject(error);
53
+ }
54
+ };
55
+ return Promise.all([start(common, 0), start(local, 1)]).then(() => close, error => { close(); throw error; });
56
+ };
57
+ }
58
+ /** MarkupKit composition only; the binding library retains instance, source and activation ownership. */
59
+ export function componentModule(common = {}, local = {}, deferClientReads = false) {
60
+ return { create() {
61
+ const base = moduleDefinition(common);
62
+ const environment = moduleDefinition(local);
63
+ const props = { ...base.props };
64
+ for (const [name, patch] of Object.entries(environment.props ?? {})) {
65
+ if (patch !== false && (patch === null || typeof patch !== "object" || Array.isArray(patch)))
66
+ throw new TypeError(`Binding ${name} must be a provider or false.`);
67
+ const previous = props[name];
68
+ props[name] = patch === false ? false : { ...previous === false ? {} : previous, ...patch };
69
+ }
70
+ if (deferClientReads)
71
+ for (const [name, provider] of Object.entries(props)) {
72
+ if (provider !== false && provider.load === undefined && provider.subscribe === undefined)
73
+ props[name] = {
74
+ ...provider, initial: provider.initial === "manual" ? "manual" : "browser",
75
+ load() { throw new TypeError(`Binding ${name} has no server reader.`); },
76
+ };
77
+ }
78
+ const connect = connectModules(base.connect, environment.connect);
79
+ return { props: props, ...connect === undefined ? {} : { connect } };
80
+ } };
81
+ }
82
+ //# sourceMappingURL=component-module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"component-module.js","sourceRoot":"","sources":["../src/component-module.ts"],"names":[],"mappings":"AAWA,MAAM,UAAU,gBAAgB,CAAwB,MAAiC;IACvF,IAAI,MAAM,CAAC,MAAM,KAAK,SAAS,IAAI,CAAC,OAAO,MAAM,CAAC,MAAM,KAAK,UAAU,IAAI,MAAM,CAAC,KAAK,KAAK,SAAS,IAAI,MAAM,CAAC,OAAO,KAAK,SAAS,CAAC,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