@k8ordo/framework 1.4.2 → 1.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -35,7 +35,7 @@ dependencies in either mode: the build bundles what the application runs.
35
35
 
36
36
  | Package | Version | Required | Needed for |
37
37
  | --------------------- | -------- | -------- | ------------------------------------------ |
38
- | `@k8ordo/router` | ^1.4.2 | yes | routing, re-exported by the framework |
38
+ | `@k8ordo/router` | ^1.4.3 | yes | routing, re-exported by the framework |
39
39
  | `react` | ≥19.3.0 | yes | rendering |
40
40
  | `react-dom` | ≥19.3.0 | yes | rendering |
41
41
  | `vite` | ≥8.1.0 | yes | the build (`framework()` is a Vite plugin) |
@@ -0,0 +1,13 @@
1
+ import { ReactNode } from "react";
2
+ /**
3
+ * What the HTML render and the browser both render at the root, around the
4
+ * application. `useId` derives an id from where its component sits among its
5
+ * siblings all the way up, so a sibling only one side rendered here would
6
+ * give every id below another value in the browser than in the HTML, whose
7
+ * attributes hydration keeps.
8
+ */
9
+ export declare function DocumentRoot({ children, styleNonce }: {
10
+ children: ReactNode;
11
+ /** The HTML render's, under a server. The browser finds the style written. */
12
+ styleNonce?: string | undefined;
13
+ }): ReactNode;
@@ -0,0 +1,18 @@
1
+ import { SERVER_STYLESHEETS, STYLESHEET_ORDER_HREF } from "./payload.mjs";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
+ // src/runtime/document-root.tsx
4
+ /**
5
+ * What the HTML render and the browser both render at the root, around the
6
+ * application. `useId` derives an id from where its component sits among its
7
+ * siblings all the way up, so a sibling only one side rendered here would
8
+ * give every id below another value in the browser than in the HTML, whose
9
+ * attributes hydration keeps.
10
+ */
11
+ function DocumentRoot({ children, styleNonce }) {
12
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("style", {
13
+ href: STYLESHEET_ORDER_HREF,
14
+ precedence: SERVER_STYLESHEETS,
15
+ nonce: styleNonce
16
+ }), children] });
17
+ }
18
+ export { DocumentRoot };
@@ -1,6 +1,7 @@
1
1
  import { whenClientReady } from "./client-ready.mjs";
2
2
  import { AppRouter, setDocumentClient } from "./app-router.mjs";
3
3
  import { connectAppRouter } from "./browser-payloads.mjs";
4
+ import { DocumentRoot } from "./document-root.mjs";
4
5
  import { mount } from "./mount.mjs";
5
6
  import { reportCaught } from "./page-boundary.mjs";
6
7
  import { whenRevealed } from "./revealed.mjs";
@@ -14,12 +15,12 @@ const start = async () => {
14
15
  setDocumentClient(payload.client);
15
16
  await whenRevealed();
16
17
  await whenClientReady([payload.tree, payload.notFound], { rows: "wait" });
17
- mount(document, /* @__PURE__ */ jsx(AppRouter, {
18
+ mount(document, /* @__PURE__ */ jsx(DocumentRoot, { children: /* @__PURE__ */ jsx(AppRouter, {
18
19
  notFound: payload.notFound,
19
20
  pathname: payload.pathname,
20
21
  search: payload.search,
21
22
  tree: payload.tree
22
- }), payload.pathname, {
23
+ }) }), payload.pathname, {
23
24
  formState: payload.formState,
24
25
  onCaughtError: reportCaught
25
26
  });
@@ -1,10 +1,10 @@
1
- import { SERVER_STYLESHEETS, STYLESHEET_ORDER_HREF } from "./payload.mjs";
2
1
  import { whenClientReady } from "./client-ready.mjs";
3
2
  import { AppRouter } from "./app-router.mjs";
4
3
  import { noticeCancel } from "./cancel.mjs";
4
+ import { DocumentRoot } from "./document-root.mjs";
5
5
  import { PageShownContext } from "./page-shown.mjs";
6
6
  import { use } from "react";
7
- import { jsx, jsxs } from "react/jsx-runtime";
7
+ import { jsx } from "react/jsx-runtime";
8
8
  import { createFromReadableStream, getClientEntryUrl } from "@vitejs/plugin-rsc/ssr";
9
9
  import { preinit, preloadModule } from "react-dom";
10
10
  import { renderToReadableStream } from "react-dom/server.edge";
@@ -76,13 +76,12 @@ async function renderHtml(rscStream, nonce, showsPage, carriesFormState, named)
76
76
  const shown = Promise.withResolvers();
77
77
  let readerLeft = false;
78
78
  const styleNonce = import.meta.env.K8ORDO_MODE === "static" ? void 0 : nonce;
79
- const htmlStream = await renderToReadableStream(/* @__PURE__ */ jsxs(PageShownContext, {
79
+ const htmlStream = await renderToReadableStream(/* @__PURE__ */ jsx(PageShownContext, {
80
80
  value: () => shown.resolve(void 0),
81
- children: [/* @__PURE__ */ jsx("style", {
82
- href: STYLESHEET_ORDER_HREF,
83
- precedence: SERVER_STYLESHEETS,
84
- nonce: styleNonce
85
- }), /* @__PURE__ */ jsx(Root, {})]
81
+ children: /* @__PURE__ */ jsx(DocumentRoot, {
82
+ styleNonce,
83
+ children: /* @__PURE__ */ jsx(Root, {})
84
+ })
86
85
  }), {
87
86
  bootstrapModules: [clientEntry],
88
87
  nonce: styleNonce === void 0 ? nonce : {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@k8ordo/framework",
3
- "version": "1.4.2",
3
+ "version": "1.4.3",
4
4
  "description": "The k8ordo framework: routes/ compiled into React Server Components, run with or without a server.",
5
5
  "keywords": [
6
6
  "k8ordo",
@@ -76,7 +76,7 @@
76
76
  "devDependencies": {
77
77
  "@arethetypeswrong/cli": "0.18.5",
78
78
  "@k8ordo/framework-engine": "^0.1.1",
79
- "@k8ordo/router": "^1.4.2",
79
+ "@k8ordo/router": "^1.4.3",
80
80
  "@types/compressible": "2.0.3",
81
81
  "@types/fresh": "0.5.3",
82
82
  "@types/mime-types": "3.0.1",
@@ -92,7 +92,7 @@
92
92
  "vitest": "5.0.5"
93
93
  },
94
94
  "peerDependencies": {
95
- "@k8ordo/router": "^1.4.2",
95
+ "@k8ordo/router": "^1.4.3",
96
96
  "oxc-transform-react": "^0.152.0",
97
97
  "react": ">=19.3.0",
98
98
  "react-dom": ">=19.3.0",