@mistriwork/engine 1.0.0-rc.39 → 1.0.0-rc.40

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.
@@ -108,6 +108,15 @@ interface ShellTitle {
108
108
  manifest: string;
109
109
  register: string;
110
110
  };
111
+ /**
112
+ * The App's control kit (Preview; the App framework's appComponents.ts compileUiKit): its module, preloaded and named
113
+ * in a meta the shell reads to install it before its first render, and its stylesheet, linked so it is in force from
114
+ * the first paint. Never the Workbench's.
115
+ */
116
+ uiKit?: {
117
+ js: string;
118
+ css?: string;
119
+ };
111
120
  /** The App declared `ui.microphone`: its pages may ask for the microphone, from this origin alone (`pagePermissions`). */
112
121
  microphone?: true;
113
122
  /** The scheme that look says (clientSurface.ts lookSchemeFor), said in the page so it is dark from its first paint. */
@@ -139,6 +139,7 @@ const writesHead = (head) => Boolean(head?.title ||
139
139
  head?.looks?.length ||
140
140
  head?.social ||
141
141
  head?.pane ||
142
+ head?.uiKit ||
142
143
  head?.pwa);
143
144
  /** What an App's own theme carries that a page's head never writes: its served files and where its menu sits. */
144
145
  const HEAD_UNWRITTEN = new Set(['faces', 'stylesheet', 'shell']);
@@ -255,6 +256,14 @@ export function withHead(html, head) {
255
256
  script is needed and the page's policy admits them as they stand. */
256
257
  if (head.pwa)
257
258
  out = out.replace(/<\/head>/i, () => ` <link rel="manifest" href="${escapeHtml(head.pwa.manifest)}">\n <script src="${escapeHtml(head.pwa.register)}" defer></script>\n </head>`);
259
+ /* The kit's module is fetched beside the entry rather than after it, and its sheet is a link in the head, so the
260
+ first render draws the kit's controls in the kit's rules: nothing is swapped, and nothing moves, after paint. */
261
+ if (head.uiKit && !head.workbench) {
262
+ const kit = head.uiKit;
263
+ const css = kit.css ? ` <link rel="stylesheet" href="${escapeHtml(kit.css)}" data-component-css="ui-kit">\n` : '';
264
+ out = out.replace(/<\/head>/i, () => ` <link rel="modulepreload" crossorigin href="${escapeHtml(kit.js)}">\n${css}` +
265
+ ` <meta name="mistri-ui-kit" content="${escapeHtml(kit.js)}"${kit.css ? ` data-css="${escapeHtml(kit.css)}"` : ''}>\n </head>`);
266
+ }
258
267
  if (!head?.title && !head?.canonical)
259
268
  return out;
260
269
  /* Replaced by a function, never a replacement string: a string's `$&`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mistriwork/engine",
3
- "version": "1.0.0-rc.39",
3
+ "version": "1.0.0-rc.40",
4
4
  "description": "The engine both products stand on: the adapters (SQLite, Postgres), the catalog, the query language, keyset pages, the HTTP kit and the shared rules. No React.",
5
5
  "homepage": "https://mistriwork.dev",
6
6
  "bugs": {