@softure-ai/theme-notion 0.29.0 → 0.29.1

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 CHANGED
@@ -4,6 +4,14 @@ Newest first. Each version lists what changed for an app that uses the theme. Wh
4
4
  production, the version gets a line `verified in: <app>@<commit>` ([docs/05](../../docs/05-adoption-playbook.md),
5
5
  "Definition of done").
6
6
 
7
+ ## 0.29.1
8
+
9
+ - The loading states' counter script (`LaunchScreen`, `TopLoadingBar`, and through them `RouteLoading`) is drawn only
10
+ in the server's HTML, where the browser runs it, and kept while React hydrates it. A render that starts on the
11
+ client (a loading state shown by a client-side navigation) draws no `<script>`: React never runs one it creates,
12
+ and in development it logged "Encountered a script tag while rendering React component" on every such navigation.
13
+ - Migrate: nothing. The counter still moves on a page load and, as before, stays put on a client-side navigation.
14
+
7
15
  ## 0.29.0
8
16
 
9
17
  - Touch-sized `TabBar`: `size="touch"` draws every tab link at least the touch target (44 x 44 px, `h-touch-target
@@ -0,0 +1,12 @@
1
+ export interface StreamedScriptProps {
2
+ /** The inline script's text, e.g. a launch counter from `@softure-ai/pwa`. */
3
+ readonly script: string;
4
+ }
5
+ /**
6
+ * An inline script that runs only where the browser parses it: in the HTML the server streams. React keeps it while it
7
+ * hydrates that HTML (the server snapshot) and drops it afterwards, once it has run. A render that starts on the client
8
+ * (a loading state shown by a client-side navigation) draws no script at all: React never runs a script it creates and
9
+ * warns about one in development ("Encountered a script tag while rendering React component").
10
+ */
11
+ export declare function StreamedScript({ script }: StreamedScriptProps): import("react").JSX.Element | null;
12
+ //# sourceMappingURL=StreamedScript.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StreamedScript.d.ts","sourceRoot":"","sources":["../../src/lib/StreamedScript.tsx"],"names":[],"mappings":"AAIA,MAAM,WAAW,mBAAmB;IAClC,8EAA8E;IAC9E,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAcD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,EAAE,MAAM,EAAE,EAAE,mBAAmB,sCAG7D"}
@@ -0,0 +1,23 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { useSyncExternalStore } from "react";
4
+ function subscribe() {
5
+ return () => undefined;
6
+ }
7
+ function isClientRender() {
8
+ return false;
9
+ }
10
+ function isServerRender() {
11
+ return true;
12
+ }
13
+ /**
14
+ * An inline script that runs only where the browser parses it: in the HTML the server streams. React keeps it while it
15
+ * hydrates that HTML (the server snapshot) and drops it afterwards, once it has run. A render that starts on the client
16
+ * (a loading state shown by a client-side navigation) draws no script at all: React never runs a script it creates and
17
+ * warns about one in development ("Encountered a script tag while rendering React component").
18
+ */
19
+ export function StreamedScript({ script }) {
20
+ const isServerHtml = useSyncExternalStore(subscribe, isClientRender, isServerRender);
21
+ return isServerHtml ? _jsx("script", { dangerouslySetInnerHTML: { __html: script } }) : null;
22
+ }
23
+ //# sourceMappingURL=StreamedScript.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StreamedScript.js","sourceRoot":"","sources":["../../src/lib/StreamedScript.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAO7C,SAAS,SAAS;IAChB,OAAO,GAAG,EAAE,CAAC,SAAS,CAAC;AACzB,CAAC;AAED,SAAS,cAAc;IACrB,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,cAAc;IACrB,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,EAAE,MAAM,EAAuB;IAC5D,MAAM,YAAY,GAAG,oBAAoB,CAAC,SAAS,EAAE,cAAc,EAAE,cAAc,CAAC,CAAC;IACrF,OAAO,YAAY,CAAC,CAAC,CAAC,iBAAQ,uBAAuB,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,GAAI,CAAC,CAAC,CAAC,IAAI,CAAC;AACvF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"LaunchScreen.d.ts","sourceRoot":"","sources":["../../src/notion/LaunchScreen.tsx"],"names":[],"mappings":"AAGA,MAAM,WAAW,iBAAiB;IAChC,4CAA4C;IAC5C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,qGAAqG;IACrG,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,+FAA+F;IAC/F,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,yHAAyH;IACzH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAMD,wBAAgB,YAAY,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,iBAAiB,+BAiB1F"}
1
+ {"version":3,"file":"LaunchScreen.d.ts","sourceRoot":"","sources":["../../src/notion/LaunchScreen.tsx"],"names":[],"mappings":"AAIA,MAAM,WAAW,iBAAiB;IAChC,4CAA4C;IAC5C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,qGAAqG;IACrG,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,+FAA+F;IAC/F,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,yHAAyH;IACzH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAMD,wBAAgB,YAAY,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,iBAAiB,+BAiB1F"}
@@ -1,11 +1,12 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { cn } from "../lib/utils.js";
3
3
  import { Progress } from "../ui/progress.js";
4
+ import { StreamedScript } from "../lib/StreamedScript.js";
4
5
  // The screen an installed app shows from its first byte until the page arrives, streamed from `app/loading.tsx`: the
5
6
  // app's icon and name, a progress bar and a percentage on the theme's background, full screen in light and dark. The
6
7
  // counter script moves the bar, its indicator and the percentage through their `data-slot`s; the percentage is
7
8
  // hidden from screen readers (the bar reports the value) and keeps the script's text if React hydrates the screen.
8
9
  export function LaunchScreen({ name, iconSrc, label, script, className }) {
9
- return (_jsxs("div", { "data-slot": "launch-screen", className: cn("fixed inset-0 z-50 flex flex-col items-center justify-center gap-4 bg-background p-6 text-foreground", className), children: [_jsx("img", { "data-slot": "launch-screen-icon", src: iconSrc, alt: "", width: 64, height: 64, className: "size-16 rounded-2xl" }), _jsx("p", { "data-slot": "launch-screen-name", className: "text-lg font-semibold", children: name }), _jsx(Progress, { value: 0, "aria-label": label, className: "w-48" }), _jsx("p", { "data-slot": "launch-screen-percent", "aria-hidden": "true", suppressHydrationWarning: true, className: "text-sm text-muted-foreground tabular-nums", children: "0%" }), script === undefined ? null : _jsx("script", { dangerouslySetInnerHTML: { __html: script } })] }));
10
+ return (_jsxs("div", { "data-slot": "launch-screen", className: cn("fixed inset-0 z-50 flex flex-col items-center justify-center gap-4 bg-background p-6 text-foreground", className), children: [_jsx("img", { "data-slot": "launch-screen-icon", src: iconSrc, alt: "", width: 64, height: 64, className: "size-16 rounded-2xl" }), _jsx("p", { "data-slot": "launch-screen-name", className: "text-lg font-semibold", children: name }), _jsx(Progress, { value: 0, "aria-label": label, className: "w-48" }), _jsx("p", { "data-slot": "launch-screen-percent", "aria-hidden": "true", suppressHydrationWarning: true, className: "text-sm text-muted-foreground tabular-nums", children: "0%" }), script === undefined ? null : _jsx(StreamedScript, { script: script })] }));
10
11
  }
11
12
  //# sourceMappingURL=LaunchScreen.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"LaunchScreen.js","sourceRoot":"","sources":["../../src/notion/LaunchScreen.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,i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SAAS,EAAqB;IACzF,OAAO,CACL,4BACY,eAAe,EACzB,SAAS,EAAE,EAAE,CAAC,sGAAsG,EAAE,SAAS,CAAC,aAEhI,2BAAe,oBAAoB,EAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAC,EAAE,EAAC,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,SAAS,EAAC,qBAAqB,GAAG,EAClH,yBAAa,oBAAoB,EAAC,SAAS,EAAC,uBAAuB,YAChE,IAAI,GACH,EACJ,KAAC,QAAQ,IAAC,KAAK,EAAE,CAAC,gBAAc,KAAK,EAAE,SAAS,EAAC,MAAM,GAAG,EAC1D,yBAAa,uBAAuB,iBAAa,MAAM,EAAC,wBAAwB,QAAC,SAAS,EAAC,4CAA4C,mBAEnI,EACH,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAC,cAAc,IAAC,MAAM,EAAE,MAAM,GAAI,IAC7D,CACP,CAAC;AACJ,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"TopLoadingBar.d.ts","sourceRoot":"","sources":["../../src/notion/TopLoadingBar.tsx"],"names":[],"mappings":"AAGA,MAAM,WAAW,kBAAkB;IACjC,+FAA+F;IAC/F,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,uFAAuF;IACvF,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB;;;;OAIG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAKD,wBAAgB,aAAa,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,kBAAkB,+BAOpF"}
1
+ {"version":3,"file":"TopLoadingBar.d.ts","sourceRoot":"","sources":["../../src/notion/TopLoadingBar.tsx"],"names":[],"mappings":"AAIA,MAAM,WAAW,kBAAkB;IACjC,+FAA+F;IAC/F,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,uFAAuF;IACvF,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB;;;;OAIG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAKD,wBAAgB,aAAa,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,kBAAkB,+BAOpF"}
@@ -1,10 +1,11 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { cn } from "../lib/utils.js";
3
3
  import { Progress } from "../ui/progress.js";
4
+ import { StreamedScript } from "../lib/StreamedScript.js";
4
5
  // A thin bar along the top edge while a route loads on a wide screen: 2 px, square, on a transparent track, above the
5
6
  // page and never in the way of a pointer, so the page under it stays usable. `LaunchScreen` is its full-screen
6
7
  // counterpart for a phone or an installed app; `RouteLoading` picks one of the two in the browser.
7
8
  export function TopLoadingBar({ label, value, script, className }) {
8
- return (_jsxs("div", { "data-slot": "top-loading-bar", className: cn("pointer-events-none fixed inset-x-0 top-0 z-50", className), children: [_jsx(Progress, { value: value, "aria-label": label, className: "h-0.5 rounded-none bg-transparent" }), script === undefined ? null : _jsx("script", { dangerouslySetInnerHTML: { __html: script } })] }));
9
+ return (_jsxs("div", { "data-slot": "top-loading-bar", className: cn("pointer-events-none fixed inset-x-0 top-0 z-50", className), children: [_jsx(Progress, { value: value, "aria-label": label, className: "h-0.5 rounded-none bg-transparent" }), script === undefined ? null : _jsx(StreamedScript, { script: script })] }));
9
10
  }
10
11
  //# sourceMappingURL=TopLoadingBar.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TopLoadingBar.js","sourceRoot":"","sources":["../../src/notion/TopLoadingBar.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AACrC,OAAO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1
1
  {
2
2
  "name": "@softure-ai/theme-notion",
3
- "version": "0.29.0",
3
+ "version": "0.29.1",
4
4
  "description": "SOFTURE AI Notion theme: shadcn/ui components (new-york v4, Radix, Tailwind CSS v4, lucide) with the Notion design system's tokens and deltas, ready to import.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -0,0 +1,31 @@
1
+ "use client";
2
+
3
+ import { useSyncExternalStore } from "react";
4
+
5
+ export interface StreamedScriptProps {
6
+ /** The inline script's text, e.g. a launch counter from `@softure-ai/pwa`. */
7
+ readonly script: string;
8
+ }
9
+
10
+ function subscribe(): () => void {
11
+ return () => undefined;
12
+ }
13
+
14
+ function isClientRender(): boolean {
15
+ return false;
16
+ }
17
+
18
+ function isServerRender(): boolean {
19
+ return true;
20
+ }
21
+
22
+ /**
23
+ * An inline script that runs only where the browser parses it: in the HTML the server streams. React keeps it while it
24
+ * hydrates that HTML (the server snapshot) and drops it afterwards, once it has run. A render that starts on the client
25
+ * (a loading state shown by a client-side navigation) draws no script at all: React never runs a script it creates and
26
+ * warns about one in development ("Encountered a script tag while rendering React component").
27
+ */
28
+ export function StreamedScript({ script }: StreamedScriptProps) {
29
+ const isServerHtml = useSyncExternalStore(subscribe, isClientRender, isServerRender);
30
+ return isServerHtml ? <script dangerouslySetInnerHTML={{ __html: script }} /> : null;
31
+ }
@@ -1,5 +1,6 @@
1
1
  import { cn } from "../lib/utils.js";
2
2
  import { Progress } from "../ui/progress.js";
3
+ import { StreamedScript } from "../lib/StreamedScript.js";
3
4
 
4
5
  export interface LaunchScreenProps {
5
6
  /** The app's name, shown under its icon. */
@@ -31,7 +32,7 @@ export function LaunchScreen({ name, iconSrc, label, script, className }: Launch
31
32
  <p data-slot="launch-screen-percent" aria-hidden="true" suppressHydrationWarning className="text-sm text-muted-foreground tabular-nums">
32
33
  0%
33
34
  </p>
34
- {script === undefined ? null : <script dangerouslySetInnerHTML={{ __html: script }} />}
35
+ {script === undefined ? null : <StreamedScript script={script} />}
35
36
  </div>
36
37
  );
37
38
  }
@@ -1,5 +1,6 @@
1
1
  import { cn } from "../lib/utils.js";
2
2
  import { Progress } from "../ui/progress.js";
3
+ import { StreamedScript } from "../lib/StreamedScript.js";
3
4
 
4
5
  export interface TopLoadingBarProps {
5
6
  /** The progress bar's accessible name (`pwaMessages.en.launch.label` in `@softure-ai/pwa`). */
@@ -22,7 +23,7 @@ export function TopLoadingBar({ label, value, script, className }: TopLoadingBar
22
23
  return (
23
24
  <div data-slot="top-loading-bar" className={cn("pointer-events-none fixed inset-x-0 top-0 z-50", className)}>
24
25
  <Progress value={value} aria-label={label} className="h-0.5 rounded-none bg-transparent" />
25
- {script === undefined ? null : <script dangerouslySetInnerHTML={{ __html: script }} />}
26
+ {script === undefined ? null : <StreamedScript script={script} />}
26
27
  </div>
27
28
  );
28
29
  }