@starci/grammar 0.15.3 → 0.15.6
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 +48 -11
- package/dist/.build-stamp.json +4 -4
- package/dist/common/components-forms.css +141 -4
- package/dist/common/components-navigation.css +104 -1
- package/dist/common/components-overlays.css +2 -0
- package/dist/common/registry.d.ts +4 -0
- package/dist/common/registry.d.ts.map +1 -1
- package/dist/common/registry.js +2 -2
- package/dist/common/registry.js.map +1 -1
- package/dist/common/renderers-forms.d.ts +4 -0
- package/dist/common/renderers-forms.d.ts.map +1 -1
- package/dist/common/renderers-forms.js +6 -2
- package/dist/common/renderers-forms.js.map +1 -1
- package/dist/common/renderers-navigation.d.ts +3 -1
- package/dist/common/renderers-navigation.d.ts.map +1 -1
- package/dist/common/renderers-navigation.js +3 -1
- package/dist/common/renderers-navigation.js.map +1 -1
- package/dist/common/renderers.d.ts +1 -0
- package/dist/common/renderers.d.ts.map +1 -1
- package/dist/common/renderers.js +1 -0
- package/dist/common/renderers.js.map +1 -1
- package/dist/common/styles.css +68 -4
- package/dist/core/branch/CopyField/index.d.ts +48 -0
- package/dist/core/branch/CopyField/index.d.ts.map +1 -0
- package/dist/core/branch/CopyField/index.js +102 -0
- package/dist/core/branch/CopyField/index.js.map +1 -0
- package/dist/core/branch/FlowGraph/index.d.ts +1 -1
- package/dist/core/branch/FlowGraph/index.d.ts.map +1 -1
- package/dist/core/branch/FlowGraph/index.js +11 -2
- package/dist/core/branch/FlowGraph/index.js.map +1 -1
- package/dist/core/branch/FlowGraph/types.d.ts +9 -0
- package/dist/core/branch/FlowGraph/types.d.ts.map +1 -1
- package/dist/core/branch/MermaidDiagram/index.d.ts +30 -0
- package/dist/core/branch/MermaidDiagram/index.d.ts.map +1 -0
- package/dist/core/branch/MermaidDiagram/index.js +110 -0
- package/dist/core/branch/MermaidDiagram/index.js.map +1 -0
- package/dist/core/branch/MermaidDiagram/theme.d.ts +40 -0
- package/dist/core/branch/MermaidDiagram/theme.d.ts.map +1 -0
- package/dist/core/branch/MermaidDiagram/theme.js +86 -0
- package/dist/core/branch/MermaidDiagram/theme.js.map +1 -0
- package/dist/core/branch/Tabs/index.d.ts +11 -3
- package/dist/core/branch/Tabs/index.d.ts.map +1 -1
- package/dist/core/branch/Tabs/index.js +48 -2
- package/dist/core/branch/Tabs/index.js.map +1 -1
- package/dist/core/composite/FormGrid/index.d.ts +17 -0
- package/dist/core/composite/FormGrid/index.d.ts.map +1 -0
- package/dist/core/composite/FormGrid/index.js +16 -0
- package/dist/core/composite/FormGrid/index.js.map +1 -0
- package/dist/core/composition/Page/index.d.ts +30 -0
- package/dist/core/composition/Page/index.d.ts.map +1 -0
- package/dist/core/composition/Page/index.js +13 -0
- package/dist/core/composition/Page/index.js.map +1 -0
- package/dist/core/primitive/Button/index.d.ts +9 -3
- package/dist/core/primitive/Button/index.d.ts.map +1 -1
- package/dist/core/primitive/Button/index.js +2 -2
- package/dist/core/primitive/Button/index.js.map +1 -1
- package/dist/core/primitive/Field/index.d.ts +2 -2
- package/dist/core/primitive/Field/index.js +4 -4
- package/dist/core/primitive/Field/index.js.map +1 -1
- package/dist/core/primitive/FileDropzone/index.js +2 -2
- package/dist/core/primitive/FileDropzone/index.js.map +1 -1
- package/dist/core/primitive/Input/index.d.ts +7 -7
- package/dist/core/primitive/Input/index.d.ts.map +1 -1
- package/dist/core/primitive/Input/index.js +9 -9
- package/dist/core/primitive/Input/index.js.map +1 -1
- package/dist/offset-pop/components-forms.css +5 -3
- package/package.json +3 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/core/branch/FlowGraph/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,CAAA;AAC7F,MAAM,MAAM,iBAAiB,GAAG,IAAI,GAAG,IAAI,G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;IAC9E,QAAQ,CAAC,QAAQ,CAAC,EAAE;QAAE,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;CACjE,CAAA;AAED,MAAM,MAAM,aAAa,GAAG;IACxB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,iIAAiI;IACjI,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,aAAa,CAAC,EAAE,OAAO,CAAA;CACnC,CAAA;AAED;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG;IAC/B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;CACtB,CAAA"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/** The canvas box every state reserves: `sm` 16rem, `md` 24rem, `lg` 32rem (the FlowGraph heights). */
|
|
2
|
+
export type MermaidDiagramHeight = "sm" | "md" | "lg";
|
|
3
|
+
export type MermaidDiagramProps = {
|
|
4
|
+
/** The Mermaid text, as written in the article's fence (without the fence itself). */
|
|
5
|
+
readonly source: string;
|
|
6
|
+
/** Names the diagram for assistive technology, e.g. "Request flow". The drawing is one image with this name. */
|
|
7
|
+
readonly label: string;
|
|
8
|
+
/**
|
|
9
|
+
* The least height of the canvas, kept by the loading, ready and error states alike so the page does not jump when
|
|
10
|
+
* the drawing arrives. A taller drawing grows the canvas; a wider one scrolls inline. Default `sm`.
|
|
11
|
+
*/
|
|
12
|
+
readonly height?: MermaidDiagramHeight;
|
|
13
|
+
/** The error title shown in the region when the source cannot be drawn; the source follows it as code. */
|
|
14
|
+
readonly errorTitle?: string;
|
|
15
|
+
/** Accessible name of the source code block in the error state. Default: `${label} source`. */
|
|
16
|
+
readonly sourceLabel?: string;
|
|
17
|
+
/** Unresolved source (STATE-8): the frame at its height with a Skeleton block, Mermaid not loaded, `aria-busy`. */
|
|
18
|
+
readonly isSkeleton?: boolean;
|
|
19
|
+
/** Layout only. */
|
|
20
|
+
readonly className?: string;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* A Mermaid diagram drawn client-side in the grammar's theme: Mermaid (`mermaid`) is imported lazily on the first
|
|
24
|
+
* diagram, initialised with colours resolved from the root's semantic tokens (surface, foreground, separator, accent),
|
|
25
|
+
* and its SVG is placed as one named image. Loading keeps the canvas box with a Skeleton; a source Mermaid refuses is
|
|
26
|
+
* an error inside the same region, the title then the source as code, so the reader still has the text.
|
|
27
|
+
* Contract: overflow OVERFLOW-4; loading and failure keep the anatomy STATE-8.
|
|
28
|
+
*/
|
|
29
|
+
export declare const MermaidDiagram: ({ source, label, height, errorTitle, sourceLabel, isSkeleton, className, }: MermaidDiagramProps) => import("react").JSX.Element;
|
|
30
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/branch/MermaidDiagram/index.tsx"],"names":[],"mappings":"AAQA,uGAAuG;AACvG,MAAM,MAAM,oBAAoB,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;AAErD,MAAM,MAAM,mBAAmB,GAAG;IAC9B,sFAAsF;IACtF,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,gHAAgH;IAChH,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB;;;OAGG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,oBAAoB,CAAA;IACtC,0GAA0G;IAC1G,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAA;IAC5B,+FAA+F;IAC/F,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;IAC7B,mHAAmH;IACnH,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAA;IAC7B,mBAAmB;IACnB,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAC9B,CAAA;AAgFD;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,GAAI,4EAQ5B,mBAAmB,gCAuDrB,CAAA"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useId, useRef, useState } from "react";
|
|
4
|
+
import { Alert } from "../../composite/Alert/index.js";
|
|
5
|
+
import { Skeleton } from "../../primitive/Skeleton/index.js";
|
|
6
|
+
import { FencedCodeBlock } from "../MarkdownArticle/index.js";
|
|
7
|
+
import { resolveMermaidTheme } from "./theme.js";
|
|
8
|
+
let mermaidModule = null;
|
|
9
|
+
/** Mermaid is loaded on the first diagram that needs it, once per page, and never on the server. */
|
|
10
|
+
const loadMermaid = () => {
|
|
11
|
+
mermaidModule ??= import("mermaid").then((module) => module.default);
|
|
12
|
+
return mermaidModule;
|
|
13
|
+
};
|
|
14
|
+
let queue = Promise.resolve();
|
|
15
|
+
/**
|
|
16
|
+
* Mermaid's configuration is one global, so each diagram initialises it with its own theme and renders before the next
|
|
17
|
+
* diagram may: the renders of one page run one after another.
|
|
18
|
+
*/
|
|
19
|
+
const renderSerially = (id, source, theme) => {
|
|
20
|
+
const run = queue.then(async () => {
|
|
21
|
+
const mermaid = await loadMermaid();
|
|
22
|
+
mermaid.initialize({
|
|
23
|
+
startOnLoad: false,
|
|
24
|
+
securityLevel: "strict",
|
|
25
|
+
// A refused source throws and leaves nothing in the document: the error state is the component's, in its region.
|
|
26
|
+
suppressErrorRendering: true,
|
|
27
|
+
theme: "base",
|
|
28
|
+
darkMode: theme.darkMode,
|
|
29
|
+
fontFamily: theme.fontFamily,
|
|
30
|
+
themeVariables: theme,
|
|
31
|
+
htmlLabels: false,
|
|
32
|
+
flowchart: { htmlLabels: false },
|
|
33
|
+
});
|
|
34
|
+
try {
|
|
35
|
+
const { svg } = await mermaid.render(id, source);
|
|
36
|
+
return svg;
|
|
37
|
+
}
|
|
38
|
+
finally {
|
|
39
|
+
// Mermaid draws in a temporary node of the body; a failed render can leave it behind.
|
|
40
|
+
document.getElementById(`d${id}`)?.remove();
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
queue = run.catch(() => undefined);
|
|
44
|
+
return run;
|
|
45
|
+
};
|
|
46
|
+
/** The SVG Mermaid returns, as a node of this document; null when the text is not one `<svg>` element. */
|
|
47
|
+
const svgNode = (svg) => {
|
|
48
|
+
const parsed = new DOMParser().parseFromString(svg, "image/svg+xml");
|
|
49
|
+
const root = parsed.documentElement;
|
|
50
|
+
if (root.nodeName.toLowerCase() !== "svg" || parsed.getElementsByTagName("parsererror").length > 0)
|
|
51
|
+
return null;
|
|
52
|
+
const node = document.importNode(root, true);
|
|
53
|
+
node.setAttribute("aria-hidden", "true");
|
|
54
|
+
node.removeAttribute("height");
|
|
55
|
+
return node;
|
|
56
|
+
};
|
|
57
|
+
/** Re-renders when the root's theme changes: its attributes (theme, family, token overrides) or the system scheme. */
|
|
58
|
+
const useThemeRevision = (anchor) => {
|
|
59
|
+
const [revision, setRevision] = useState(0);
|
|
60
|
+
useEffect(() => {
|
|
61
|
+
const root = anchor.current?.closest(".grammar-common-root") ?? null;
|
|
62
|
+
const bump = () => setRevision((value) => value + 1);
|
|
63
|
+
const scheme = window.matchMedia("(prefers-color-scheme: dark)");
|
|
64
|
+
scheme.addEventListener("change", bump);
|
|
65
|
+
const observer = root === null ? null : new MutationObserver(bump);
|
|
66
|
+
observer?.observe(root, { attributes: true, attributeFilter: ["data-grammar-theme", "data-grammar-family", "style", "class"] });
|
|
67
|
+
return () => {
|
|
68
|
+
scheme.removeEventListener("change", bump);
|
|
69
|
+
observer?.disconnect();
|
|
70
|
+
};
|
|
71
|
+
}, [anchor]);
|
|
72
|
+
return revision;
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* A Mermaid diagram drawn client-side in the grammar's theme: Mermaid (`mermaid`) is imported lazily on the first
|
|
76
|
+
* diagram, initialised with colours resolved from the root's semantic tokens (surface, foreground, separator, accent),
|
|
77
|
+
* and its SVG is placed as one named image. Loading keeps the canvas box with a Skeleton; a source Mermaid refuses is
|
|
78
|
+
* an error inside the same region, the title then the source as code, so the reader still has the text.
|
|
79
|
+
* Contract: overflow OVERFLOW-4; loading and failure keep the anatomy STATE-8.
|
|
80
|
+
*/
|
|
81
|
+
export const MermaidDiagram = ({ source, label, height = "sm", errorTitle = "This diagram could not be drawn.", sourceLabel, isSkeleton = false, className, }) => {
|
|
82
|
+
const frame = useRef(null);
|
|
83
|
+
const canvas = useRef(null);
|
|
84
|
+
const [drawing, setDrawing] = useState({ status: "loading" });
|
|
85
|
+
const revision = useThemeRevision(frame);
|
|
86
|
+
const id = `grammar-mermaid-${useId().replace(/[^a-zA-Z0-9_-]/g, "")}`;
|
|
87
|
+
useEffect(() => {
|
|
88
|
+
if (isSkeleton || frame.current === null)
|
|
89
|
+
return;
|
|
90
|
+
let isCurrent = true;
|
|
91
|
+
setDrawing({ status: "loading" });
|
|
92
|
+
const theme = resolveMermaidTheme(frame.current);
|
|
93
|
+
renderSerially(`${id}-${revision}`, source, theme).then((svg) => { if (isCurrent)
|
|
94
|
+
setDrawing(svgNode(svg) === null ? { status: "error", message: "not an svg" } : { status: "ready", svg }); }, (error) => { if (isCurrent)
|
|
95
|
+
setDrawing({ status: "error", message: error instanceof Error ? error.message : String(error) }); });
|
|
96
|
+
return () => { isCurrent = false; };
|
|
97
|
+
}, [id, isSkeleton, revision, source]);
|
|
98
|
+
useEffect(() => {
|
|
99
|
+
if (drawing.status !== "ready" || canvas.current === null)
|
|
100
|
+
return;
|
|
101
|
+
const node = svgNode(drawing.svg);
|
|
102
|
+
if (node !== null)
|
|
103
|
+
canvas.current.replaceChildren(node);
|
|
104
|
+
}, [drawing]);
|
|
105
|
+
const state = isSkeleton ? "loading" : drawing.status;
|
|
106
|
+
return (_jsx("figure", { ref: frame, className: ["starci-core-mermaid-diagram", className].filter(Boolean).join(" "), "data-component": "MermaidDiagram", "data-contract": state === "ready" ? "OVERFLOW-4" : "OVERFLOW-4 STATE-8", "data-grammar-mermaid-height": height, "data-grammar-mermaid-state": state, "data-tier": "branch", "aria-label": label, ...(state === "loading" ? { "aria-busy": true, "data-loading": "true" } : {}), children: state === "error" ? (_jsxs("div", { className: "starci-core-mermaid-diagram-error", "data-grammar-mermaid-error": "true", children: [_jsx(Alert, { tone: "negative", appearance: "soft", title: errorTitle }), _jsx(FencedCodeBlock, { language: "mermaid", label: sourceLabel ?? `${label} source`, code: source })] })) : (
|
|
107
|
+
// A wide drawing scrolls inline in this frame: a named Tab stop, since the drawing holds nothing focusable.
|
|
108
|
+
_jsx("div", { className: "starci-core-mermaid-diagram-canvas", "data-grammar-mermaid-canvas": "true", ...(state === "ready" ? { role: "region", "aria-label": label, tabIndex: 0 } : {}), children: state === "loading" ? _jsx(Skeleton, { shape: "rect" }) : _jsx("div", { ref: canvas, className: "starci-core-mermaid-diagram-drawing", role: "img", "aria-label": label }) })) }));
|
|
109
|
+
};
|
|
110
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/core/branch/MermaidDiagram/index.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAA;AAC1E,OAAO,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAAA;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAA;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAC7D,OAAO,EAAE,mBAAmB,EAA8B,MAAM,YAAY,CAAA;AAmC5E,IAAI,aAAa,GAA+B,IAAI,CAAA;AACpD,oGAAoG;AACpG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shades from the
|
|
3
|
+
* colours it is given, so it needs concrete colours: each token is resolved in the page (through a probe inside the
|
|
4
|
+
* diagram, so family, theme and the caller's token overrides apply) and converted to hex through a 1px canvas, which
|
|
5
|
+
* turns any CSS colour syntax (oklch, color-mix) into sRGB.
|
|
6
|
+
*/
|
|
7
|
+
export type MermaidThemeVariables = {
|
|
8
|
+
readonly darkMode: boolean;
|
|
9
|
+
readonly fontFamily: string;
|
|
10
|
+
readonly fontSize: string;
|
|
11
|
+
readonly background: string;
|
|
12
|
+
readonly primaryColor: string;
|
|
13
|
+
readonly primaryTextColor: string;
|
|
14
|
+
readonly primaryBorderColor: string;
|
|
15
|
+
readonly secondaryColor: string;
|
|
16
|
+
readonly secondaryTextColor: string;
|
|
17
|
+
readonly secondaryBorderColor: string;
|
|
18
|
+
readonly tertiaryColor: string;
|
|
19
|
+
readonly tertiaryTextColor: string;
|
|
20
|
+
readonly tertiaryBorderColor: string;
|
|
21
|
+
readonly mainBkg: string;
|
|
22
|
+
readonly nodeBorder: string;
|
|
23
|
+
readonly textColor: string;
|
|
24
|
+
readonly titleColor: string;
|
|
25
|
+
readonly lineColor: string;
|
|
26
|
+
readonly edgeLabelBackground: string;
|
|
27
|
+
readonly clusterBkg: string;
|
|
28
|
+
readonly clusterBorder: string;
|
|
29
|
+
readonly noteBkgColor: string;
|
|
30
|
+
readonly noteTextColor: string;
|
|
31
|
+
readonly noteBorderColor: string;
|
|
32
|
+
readonly actorBkg: string;
|
|
33
|
+
readonly actorBorder: string;
|
|
34
|
+
readonly actorTextColor: string;
|
|
35
|
+
readonly signalColor: string;
|
|
36
|
+
readonly signalTextColor: string;
|
|
37
|
+
};
|
|
38
|
+
/** The theme variables of the diagram rendered inside `anchor`. */
|
|
39
|
+
export declare const resolveMermaidTheme: (anchor: HTMLElement) => MermaidThemeVariables;
|
|
40
|
+
//# sourceMappingURL=theme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRo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AQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAA;IAC/B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAA;CACnC,CAAA;AAyDD,mEAAmE;AACnE,eAAO,MAAM,mBAAmB,GAAI,QAAQ,WAAW,KAAG,qBAiCzD,CAAA"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/** Token, then the system colour used when the token resolves to nothing. */
|
|
2
|
+
const TOKENS = {
|
|
3
|
+
surface: ["--surface", "Canvas"],
|
|
4
|
+
surfaceSecondary: ["--surface-secondary", "Canvas"],
|
|
5
|
+
foreground: ["--foreground", "CanvasText"],
|
|
6
|
+
muted: ["--muted", "GrayText"],
|
|
7
|
+
border: ["--border", "CanvasText"],
|
|
8
|
+
separator: ["--separator", "GrayText"],
|
|
9
|
+
accentSoft: ["--accent-soft", "Canvas"],
|
|
10
|
+
accentSoftForeground: ["--accent-soft-foreground", "CanvasText"],
|
|
11
|
+
accent: ["--accent", "Highlight"],
|
|
12
|
+
warningSoft: ["--warning-soft", "Canvas"],
|
|
13
|
+
};
|
|
14
|
+
const hex = (channel) => channel.toString(16).padStart(2, "0");
|
|
15
|
+
/** Resolves every token to `#rrggbb` inside `anchor`, so the values are the ones the diagram's own root shows. */
|
|
16
|
+
const resolveTokens = (anchor) => {
|
|
17
|
+
const probe = document.createElement("span");
|
|
18
|
+
probe.setAttribute("aria-hidden", "true");
|
|
19
|
+
probe.style.cssText = "position:absolute;inline-size:0;block-size:0;overflow:hidden;visibility:hidden";
|
|
20
|
+
anchor.append(probe);
|
|
21
|
+
const context = document.createElement("canvas").getContext("2d", { willReadFrequently: true });
|
|
22
|
+
const resolved = {};
|
|
23
|
+
for (const [name, [token, fallback]] of Object.entries(TOKENS)) {
|
|
24
|
+
probe.style.color = `var(${token}, ${fallback})`;
|
|
25
|
+
const color = getComputedStyle(probe).color;
|
|
26
|
+
if (context === null) {
|
|
27
|
+
resolved[name] = color;
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
context.clearRect(0, 0, 1, 1);
|
|
31
|
+
context.fillStyle = "#000000";
|
|
32
|
+
context.fillStyle = color;
|
|
33
|
+
context.fillRect(0, 0, 1, 1);
|
|
34
|
+
const [red = 0, green = 0, blue = 0] = context.getImageData(0, 0, 1, 1).data;
|
|
35
|
+
resolved[name] = `#${hex(red)}${hex(green)}${hex(blue)}`;
|
|
36
|
+
}
|
|
37
|
+
probe.remove();
|
|
38
|
+
return resolved;
|
|
39
|
+
};
|
|
40
|
+
/** Relative luminance of a `#rrggbb` colour, for Mermaid's dark-mode switch. */
|
|
41
|
+
const luminance = (color) => {
|
|
42
|
+
const match = /^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(color);
|
|
43
|
+
if (match === null)
|
|
44
|
+
return 1;
|
|
45
|
+
const [red, green, blue] = match.slice(1).map((part) => {
|
|
46
|
+
const value = Number.parseInt(part, 16) / 255;
|
|
47
|
+
return value <= 0.03928 ? value / 12.92 : ((value + 0.055) / 1.055) ** 2.4;
|
|
48
|
+
});
|
|
49
|
+
return 0.2126 * red + 0.7152 * green + 0.0722 * blue;
|
|
50
|
+
};
|
|
51
|
+
/** The theme variables of the diagram rendered inside `anchor`. */
|
|
52
|
+
export const resolveMermaidTheme = (anchor) => {
|
|
53
|
+
const token = resolveTokens(anchor);
|
|
54
|
+
return {
|
|
55
|
+
darkMode: luminance(token.surface) < 0.5,
|
|
56
|
+
fontFamily: getComputedStyle(anchor).fontFamily,
|
|
57
|
+
fontSize: "14px",
|
|
58
|
+
background: token.surface,
|
|
59
|
+
primaryColor: token.surfaceSecondary,
|
|
60
|
+
primaryTextColor: token.foreground,
|
|
61
|
+
primaryBorderColor: token.border,
|
|
62
|
+
secondaryColor: token.accentSoft,
|
|
63
|
+
secondaryTextColor: token.accentSoftForeground,
|
|
64
|
+
secondaryBorderColor: token.accent,
|
|
65
|
+
tertiaryColor: token.surface,
|
|
66
|
+
tertiaryTextColor: token.foreground,
|
|
67
|
+
tertiaryBorderColor: token.separator,
|
|
68
|
+
mainBkg: token.surfaceSecondary,
|
|
69
|
+
nodeBorder: token.border,
|
|
70
|
+
textColor: token.foreground,
|
|
71
|
+
titleColor: token.foreground,
|
|
72
|
+
lineColor: token.muted,
|
|
73
|
+
edgeLabelBackground: token.surface,
|
|
74
|
+
clusterBkg: token.surface,
|
|
75
|
+
clusterBorder: token.separator,
|
|
76
|
+
noteBkgColor: token.warningSoft,
|
|
77
|
+
noteTextColor: token.foreground,
|
|
78
|
+
noteBorderColor: token.separator,
|
|
79
|
+
actorBkg: token.surfaceSecondary,
|
|
80
|
+
actorBorder: token.border,
|
|
81
|
+
actorTextColor: token.foreground,
|
|
82
|
+
signalColor: token.foreground,
|
|
83
|
+
signalTextColor: token.foreground,
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
//# sourceMappingURL=theme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.js","sourceRoot":"","sources":["../../../../src/core/branch/MermaidDiagram/theme.ts"],"names":[],"mappings":"AAsCA,6EAA6E;AAC7E,MAAM,MAAM,GAAG;IACX,OAAO,EAAE,CAAC,WAAW,EAAE,QAAQ,CAAC;IAChC,gBAAgB,EAAE,CAAC,qBAAqB,EAAE,QAAQ,CAAC;IACnD,UAAU,EAAE,CAAC,cAAc,EAAE,YAAY,CAAC;IAC1C,KAAK,EAAE,CAAC,SAAS,EAAE,UAAU,CAAC;IAC9B,MAAM,EAAE,CAAC,UAAU,EAAE,YAAY,CAAC;IAClC,SAAS,EAAE,CAAC,aAAa,EAAE,UAAU,CAAC;IACtC,UAAU,EAAE,CAAC,eAAe,EAAE,QAAQ,CAAC;IACvC,oBAAoB,EAAE,CAAC,0BAA0B,EAAE,YAAY,CAAC;IAChE,MAAM,EAAE,CAAC,UAAU,EAAE,WAAW,CAAC;IACjC,WAAW,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AAK,CAAC,UAAU;KACpC,CAAA;AACL,CAAC,CAAA"}
|
|
@@ -4,14 +4,22 @@ export type TabItem = {
|
|
|
4
4
|
readonly id: string;
|
|
5
5
|
readonly label: string;
|
|
6
6
|
readonly leading?: ReactNode;
|
|
7
|
+
/**
|
|
8
|
+
* The route this tab opens. A tab with `href` is a link tab: it renders an anchor, navigates through the
|
|
9
|
+
* `GrammarRoot` router (`navigate`, `useHref`) or the browser, and needs no `onSelect`, so a server page can pass
|
|
10
|
+
* its page tabs as plain data. The selected link tab follows the current path unless `selectedKey` is given.
|
|
11
|
+
*/
|
|
12
|
+
readonly href?: string;
|
|
7
13
|
};
|
|
8
14
|
/**
|
|
9
|
-
* Business-neutral
|
|
10
|
-
*
|
|
15
|
+
* Business-neutral peer tabs with the shared horizontal frame owning overflow, scroll shadows and the directional
|
|
16
|
+
* controls. Controlled tabs pass `selectedKey` and `onSelect`; link tabs pass an `href` on every item and the selected
|
|
17
|
+
* tab is the one whose `href` matches the current path (the exact path, else the longest `href` the path lies under).
|
|
11
18
|
*/
|
|
12
19
|
export type TabsProps = {
|
|
13
20
|
readonly label: string;
|
|
14
|
-
|
|
21
|
+
/** The selected tab. Required for controlled tabs; link tabs derive it from the current path when it is omitted. */
|
|
22
|
+
readonly selectedKey?: string;
|
|
15
23
|
readonly items: ReadonlyArray<TabItem>;
|
|
16
24
|
readonly onSelect?: (key: string) => void;
|
|
17
25
|
readonly panelId?: (key: string) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/branch/Tabs/index.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAgD,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAUpF,mEAAmE;AACnE,MAAM,MAAM,OAAO,GAAG;IAClB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,OAAO,CAAC,E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A4GpC,CAAA"}
|
|
@@ -5,12 +5,58 @@ import { useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
|
5
5
|
import { HorizontalScrollFrame } from "../../HorizontalScrollFrame.js";
|
|
6
6
|
import { useSurfaceNesting } from "../../surfaceContext.js";
|
|
7
7
|
import { tabContentClassName, tabLabelClassName, tabsClassName, tabsFrameClassName, } from "./classNames.js";
|
|
8
|
+
/** A path without its trailing slash, the root kept as `/`. */
|
|
9
|
+
const trimPath = (path) => (path.length > 1 && path.endsWith("/") ? path.slice(0, -1) : path);
|
|
10
|
+
/**
|
|
11
|
+
* The link tab the current path selects: the item whose `href` path is the current path, else the one with the
|
|
12
|
+
* longest `href` path the current path lies under, else none.
|
|
13
|
+
*/
|
|
14
|
+
const tabKeyFromPath = (items, pathname, base) => {
|
|
15
|
+
const current = trimPath(pathname);
|
|
16
|
+
let best;
|
|
17
|
+
for (const item of items) {
|
|
18
|
+
if (item.href === undefined)
|
|
19
|
+
continue;
|
|
20
|
+
const path = trimPath(new URL(item.href, base).pathname);
|
|
21
|
+
if (path === current)
|
|
22
|
+
return item.id;
|
|
23
|
+
const under = path === "/" ? current.startsWith("/") : current.startsWith(`${path}/`);
|
|
24
|
+
if (under && (best === undefined || path.length > best.length))
|
|
25
|
+
best = { id: item.id, length: path.length };
|
|
26
|
+
}
|
|
27
|
+
return best?.id;
|
|
28
|
+
};
|
|
29
|
+
/** The current location's path, read on the client and kept current across history moves. */
|
|
30
|
+
const useLocationPath = (enabled) => {
|
|
31
|
+
const [path, setPath] = useState(undefined);
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
if (!enabled)
|
|
34
|
+
return;
|
|
35
|
+
const read = () => setPath(window.location.pathname);
|
|
36
|
+
read();
|
|
37
|
+
window.addEventListener("popstate", read);
|
|
38
|
+
return () => window.removeEventListener("popstate", read);
|
|
39
|
+
}, [enabled]);
|
|
40
|
+
return [path, setPath];
|
|
41
|
+
};
|
|
8
42
|
/** Render peer tabs through Core's selected, accessible and responsive treatment. */
|
|
9
43
|
export const Tabs = (props) => {
|
|
10
44
|
const nested = useSurfaceNesting();
|
|
11
45
|
const [isClientReady, setIsClientReady] = useState(false);
|
|
12
46
|
const frameRef = useRef(null);
|
|
13
47
|
useEffect(() => setIsClientReady(true), []);
|
|
48
|
+
const isLinkTabs = props.items.some((item) => item.href !== undefined);
|
|
49
|
+
const [locationPath, setLocationPath] = useLocationPath(isLinkTabs && props.selectedKey === undefined);
|
|
50
|
+
// A path no link tab owns falls back to the first tab, so link tabs stay controlled from their first render.
|
|
51
|
+
const selectedKey = props.selectedKey
|
|
52
|
+
?? (isLinkTabs && locationPath !== undefined ? tabKeyFromPath(props.items, locationPath, window.location.href) ?? props.items[0]?.id : undefined);
|
|
53
|
+
const select = (key) => {
|
|
54
|
+
const href = props.items.find((item) => item.id === key)?.href;
|
|
55
|
+
// A link tab navigates on its own; selecting it ahead of the route change keeps the indicator on the press.
|
|
56
|
+
if (href !== undefined && props.selectedKey === undefined)
|
|
57
|
+
setLocationPath(new URL(href, window.location.href).pathname);
|
|
58
|
+
props.onSelect?.(key);
|
|
59
|
+
};
|
|
14
60
|
useLayoutEffect(() => {
|
|
15
61
|
const frame = frameRef.current;
|
|
16
62
|
const panelId = props.panelId;
|
|
@@ -48,7 +94,7 @@ export const Tabs = (props) => {
|
|
|
48
94
|
tab.setAttribute("aria-controls", original);
|
|
49
95
|
});
|
|
50
96
|
};
|
|
51
|
-
}, [isClientReady, props.items, props.panelId,
|
|
97
|
+
}, [isClientReady, props.items, props.panelId, selectedKey]);
|
|
52
98
|
// The vendor indicator fills its tab and animates width. A label edit resizes the selected tab, so the
|
|
53
99
|
// indicator follows at once: the frame disables that width transition for the commit that changed a label.
|
|
54
100
|
const labelSignature = props.items.map((item) => `${item.id}|${item.label}`).join(", ");
|
|
@@ -76,6 +122,6 @@ export const Tabs = (props) => {
|
|
|
76
122
|
const frameContract = inset === "page" ? "PADDING-5" : undefined;
|
|
77
123
|
if (!isClientReady)
|
|
78
124
|
return _jsx("div", { "aria-hidden": "true", className: tabsFrameClassName, "data-contract": frameContract, "data-component": "Tabs", "data-tier": "branch", "data-grammar-tabs": "true", "data-grammar-tabs-client": "pending", "data-grammar-tabs-inset": inset, "data-grammar-tabs-variant": variant, style: { minHeight: "3rem" } });
|
|
79
|
-
return _jsx("div", { ref: frameRef, className: tabsFrameClassName, "data-contract": frameContract, "data-component": "Tabs", "data-tier": "branch", "data-grammar-tabs": "true", "data-grammar-tabs-client": "ready", "data-grammar-tabs-inset": inset, "data-grammar-tabs-variant": variant, "data-grammar-tab-labels": props.labelVisibility ?? "responsive", children: _jsx(HeroTabs, { variant: vendorVariant, selectedKey:
|
|
125
|
+
return _jsx("div", { ref: frameRef, className: tabsFrameClassName, "data-contract": frameContract, "data-component": "Tabs", "data-tier": "branch", "data-grammar-tabs": "true", "data-grammar-tabs-client": "ready", "data-grammar-tabs-inset": inset, "data-grammar-tabs-variant": variant, "data-grammar-tab-labels": props.labelVisibility ?? "responsive", children: _jsx(HeroTabs, { variant: vendorVariant, ...(selectedKey === undefined ? {} : { selectedKey }), onSelectionChange: (key) => select(String(key)), className: tabsClassName ?? "", "data-contract": "FLOW-2", children: _jsx(HeroTabs.List, { "aria-label": props.label, render: ({ children, ref, ...listProps }) => (_jsx(HorizontalScrollFrame, { appearance: "tabs", hideScrollBar: true, size: 64, scrollPreviousLabel: scrollPreviousLabel, scrollNextLabel: scrollNextLabel, children: _jsx("div", { ...listProps, ref: ref, children: children }) })), children: props.items.map((item) => (_jsxs(HeroTabs.Tab, { id: item.id, ...(item.href === undefined ? {} : { href: item.href }), "aria-label": item.label, "data-contract": "PADDING-3", children: [_jsxs("span", { className: tabContentClassName, "data-contract": "GAP-2", "data-grammar-tab-id": item.id, children: [item.leading, _jsx("span", { className: tabLabelClassName, style: props.labelVisibility === "always" || item.leading == null ? { display: "inline" } : undefined, children: item.label })] }), _jsx(HeroTabs.Indicator, {})] }, item.id))) }) }) });
|
|
80
126
|
};
|
|
81
127
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/core/branch/Tabs/index.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,eAAe,CAAA;AAChD,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAA;AACpF,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAA;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAC3D,OAAO,EACH,mBAAmB,EACnB,iBAAiB,EACjB,aAAa,EACb,kBAAkB,GACrB,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/core/branch/Tabs/index.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,eAAe,CAAA;AAChD,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAA;AACpF,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAA;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAC3D,OAAO,EACH,mBAAmB,EACnB,iBAAiB,EACjB,aAAa,EACb,kBAAkB,GACrB,MAAM,iBAAiB,CAAA;AA6CxB,+DAA+D;AAC/D,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAU,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;AAE7G;;;GAGG;AACH,MA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AAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CACvB,MAAC,QAAQ,CAAC,GAAG,IAET,EAAE,EAAE,IAAI,CAAC,EAAE,KACP,CAAC,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,gBAC5C,IAAI,CAAC,KAAK,mBACR,WAAW,aAEzB,gBAAM,SAAS,EAAE,mBAAmB,mBAAgB,OAAO,yBAAsB,IAAI,CAAC,EAAE,aACnF,IAAI,CAAC,OAAO,EACb,eAAM,SAAS,EAAE,iBAAiB,EAAE,KAAK,EAAE,KAAK,CAAC,eAAe,KAAK,QAAQ,IAAI,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,SAAS,YAAG,IAAI,CAAC,KAAK,GAAQ,IAC3J,EACP,KAAC,QAAQ,CAAC,SAAS,KAAG,KAVjB,IAAI,CAAC,EAAE,CAWD,CAClB,CAAC,GACU,GACT,GACT,CAAA;AACV,CAAC,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
/** How many fields share a row once the grid's own width holds them. */
|
|
3
|
+
export type FormGridColumns = 1 | 2;
|
|
4
|
+
export type FormGridProps = {
|
|
5
|
+
/** The fields, in reading order; they fill the rows left to right. */
|
|
6
|
+
readonly children: ReactNode;
|
|
7
|
+
/** Fields per row at a wide container; below it every row is one column (RESPONSIVE-1). Default 2. */
|
|
8
|
+
readonly columns?: FormGridColumns;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* The form column layout. Fields fill rows of `columns`; every row is a grid of four tracks (label, control, description,
|
|
12
|
+
* error) that each field takes as a subgrid, so the controls of one row stand on one line whether or not a neighbour
|
|
13
|
+
* carries a description, an error or a two-line label. The columns come from a container query on the grid itself, never
|
|
14
|
+
* from the viewport, so a form in a narrow owner (drawer, rail, dialog) stays one column.
|
|
15
|
+
*/
|
|
16
|
+
export declare const FormGrid: ({ children, columns }: FormGridProps) => import("react").JSX.Element;
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/composite/FormGrid/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA4B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAEhE,wEAAwE;AACxE,MAAM,MAAM,eAAe,GAAG,CAAC,GAAG,CAAC,CAAA;AAEnC,MAAM,MAAM,aAAa,GAAG;IACxB,sEAAsE;IACtE,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAA;IAC5B,sGAAsG;IACtG,QAAQ,CAAC,OAAO,CAAC,EAAE,eAAe,CAAA;CACrC,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,GAAI,uBAA2B,aAAa,gCAuBhE,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Children, isValidElement } from "react";
|
|
3
|
+
/**
|
|
4
|
+
* The form column layout. Fields fill rows of `columns`; every row is a grid of four tracks (label, control, description,
|
|
5
|
+
* error) that each field takes as a subgrid, so the controls of one row stand on one line whether or not a neighbour
|
|
6
|
+
* carries a description, an error or a two-line label. The columns come from a container query on the grid itself, never
|
|
7
|
+
* from the viewport, so a form in a narrow owner (drawer, rail, dialog) stays one column.
|
|
8
|
+
*/
|
|
9
|
+
export const FormGrid = ({ children, columns = 2 }) => {
|
|
10
|
+
const fields = Children.toArray(children);
|
|
11
|
+
const rows = [];
|
|
12
|
+
for (let start = 0; start < fields.length; start += columns)
|
|
13
|
+
rows.push(fields.slice(start, start + columns));
|
|
14
|
+
return (_jsx("div", { "data-tier": "composite", "data-component": "FormGrid", "data-contract": "RESPONSIVE-1", "data-grammar-form-grid-columns": String(columns), className: "starci-core-form-grid", children: rows.map((row) => (_jsx("div", { className: "starci-core-form-grid-row", "data-grammar-form-grid-row": "true", children: row }, row.map((field) => (isValidElement(field) ? String(field.key) : "")).join("|")))) }));
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/core/composite/FormGrid/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAkB,MAAM,OAAO,CAAA;AAYhE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,EAAE,QAAQ,EAAE,OAAO,GAAG,CAAC,EAAiB,EAAE,EAAE;IACjE,MAAM,MAAM,GAAG,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;IACzC,MAAM,IAAI,GAAkB,EAAE,CAAA;IAC9B,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,IAAI,OAAO;QAAE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,CAAC,CAAA;IAC5G,OAAO,CACH,2BACc,WAAW,oBACN,UAAU,mBACX,cAAc,oCACI,MAAM,CAAC,OAAO,CAAC,EAC/C,SAAS,EAAC,uBAAuB,YAEhC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CACf,cAEI,SAAS,EAAC,2BAA2B,gCACV,MAAM,YAEhC,GAAG,IAJC,GAAG,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAKjF,CACT,CAAC,GACA,CACT,CAAA;AACL,CAAC,CAAA"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { type PageContainerProps } from "../../primitive/PageContainer/index.js";
|
|
3
|
+
import { type PageHeaderProps } from "../PageHeader/index.js";
|
|
4
|
+
/** The page header Page draws: every `PageHeader` prop except the two Page owns, `measure` and `isSkeleton`. */
|
|
5
|
+
export type PageHeaderContent = Omit<PageHeaderProps, "measure" | "isSkeleton" | "className">;
|
|
6
|
+
export type PageProps = {
|
|
7
|
+
/**
|
|
8
|
+
* The page header band, as `PageHeader`'s props (data, not an element): Page draws it full width with the body's
|
|
9
|
+
* measure, so the header's content edges are the body's. Leave it out for a page with no header band (a sign-in
|
|
10
|
+
* card, a landing hero); the body then starts one region step below the top.
|
|
11
|
+
*/
|
|
12
|
+
readonly header?: PageHeaderContent;
|
|
13
|
+
/** The page body. It always sits inside the page measure and gutter; nothing in it reaches past the gutter. */
|
|
14
|
+
readonly children: ReactNode;
|
|
15
|
+
/** The page measure, shared by the header's content and the body. Default `product`. */
|
|
16
|
+
readonly measure?: PageContainerProps["measure"];
|
|
17
|
+
/** Unresolved page subject (STATE-8): passed to the header, which keeps its slots' boxes. The body owns its own loading. */
|
|
18
|
+
readonly isSkeleton?: boolean;
|
|
19
|
+
/** Layout only: the page's placement in the app's layout region. */
|
|
20
|
+
readonly className?: string;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* One route page: the header band across the region, then the body in the page measure and gutter, one region step
|
|
24
|
+
* below it. Page is the single owner of the page inset and the page's vertical rhythm; layout frames (WorkspaceShell,
|
|
25
|
+
* PrimaryRailLayout, ChatWorkspace) only place regions and never wrap a page in a PageContainer. Page tabs are the
|
|
26
|
+
* header's `tabs`, never a Tabs at the top of the body (lint `page-tabs-in-header`), and a route page renders nothing
|
|
27
|
+
* beside its Page (lint `route-page-is-one-page`).
|
|
28
|
+
*/
|
|
29
|
+
export declare const Page: ({ header, children, measure, isSkeleton, className }: PageProps) => import("react").JSX.Element;
|
|
30
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/composition/Page/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,EAAiB,KAAK,kBAAkB,EAAE,MAAM,wCAAwC,CAAA;AAC/F,OAAO,EAAc,KAAK,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAEzE,gHAAgH;AAChH,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC,eAAe,EAAE,SAAS,GAAG,YAAY,GAAG,WAAW,CAAC,CAAA;AAE7F,MAAM,MAAM,SAAS,GAAG;IACpB;;;;OAIG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,iBAAiB,CAAA;IACnC,+GAA+G;IAC/G,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAA;IAC5B,wFAAwF;IACxF,QAAQ,CAAC,OAAO,CAAC,EAAE,kBAAkB,CAAC,SAAS,CAAC,CAAA;IAChD,4HAA4H;IAC5H,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAA;IAC7B,oEAAoE;IACpE,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAC9B,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,IAAI,GAAI,sDAA0E,SAAS,gCAavG,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "@heroui/react";
|
|
3
|
+
import { PageContainer } from "../../primitive/PageContainer/index.js";
|
|
4
|
+
import { PageHeader } from "../PageHeader/index.js";
|
|
5
|
+
/**
|
|
6
|
+
* One route page: the header band across the region, then the body in the page measure and gutter, one region step
|
|
7
|
+
* below it. Page is the single owner of the page inset and the page's vertical rhythm; layout frames (WorkspaceShell,
|
|
8
|
+
* PrimaryRailLayout, ChatWorkspace) only place regions and never wrap a page in a PageContainer. Page tabs are the
|
|
9
|
+
* header's `tabs`, never a Tabs at the top of the body (lint `page-tabs-in-header`), and a route page renders nothing
|
|
10
|
+
* beside its Page (lint `route-page-is-one-page`).
|
|
11
|
+
*/
|
|
12
|
+
export const Page = ({ header, children, measure = "product", isSkeleton = false, className }) => (_jsxs("div", { className: cn("starci-core-page", className), "data-component": "Page", "data-tier": "composition", "data-contract": "MARGIN-5 MEASURE-1", "data-grammar-page-header": header === undefined ? "false" : "true", children: [header === undefined ? null : _jsx(PageHeader, { ...header, measure: measure, isSkeleton: isSkeleton }), _jsx(PageContainer, { className: "starci-core-page-body", "data-grammar-page-body": "true", measure: measure, children: children })] }));
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/core/composition/Page/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,eAAe,CAAA;AAElC,OAAO,EAAE,aAAa,EAA2B,MAAM,wCAAwC,CAAA;AAC/F,OAAO,EAAE,UAAU,EAAwB,MAAM,wBAAwB,CAAA;AAsBzE;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,GAAG,SAAS,EAAE,UAAU,GAAG,KAAK,EAAE,SAAS,EAAa,EAAE,EAAE,CAAC,CACzG,eACI,SAAS,EAAE,EAAE,CAAC,kBAAkB,EAAE,SAAS,CAAC,oBAC7B,MAAM,eACX,aAAa,mBACT,oBAAoB,8BACR,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,aAEhE,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAC,UAAU,OAAK,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,GAAI,EACnG,KAAC,aAAa,IAAC,SAAS,EAAC,uBAAuB,4BAAwB,MAAM,EAAC,OAAO,EAAE,OAAO,YAC1F,QAAQ,GACG,IACd,CACT,CAAA"}
|
|
@@ -36,8 +36,8 @@ type ButtonBase = {
|
|
|
36
36
|
* How the action takes its inline space: to its own content, or filling its parent.
|
|
37
37
|
*
|
|
38
38
|
* `fill` forwards the vendor's own full-width variant and adds the part the vendor does not
|
|
39
|
-
* own - a label that WRAPS onto a second line instead of overflowing,
|
|
40
|
-
*
|
|
39
|
+
* own - a label that WRAPS onto a second line instead of overflowing, the box holding its size
|
|
40
|
+
* step (md 40px) on one line and growing only with the wrapped label - from `.starci-core-button[data-width="fill"]` in the packaged
|
|
41
41
|
* stylesheet. An app never has to reach through the boundary with a descendant width utility.
|
|
42
42
|
*/
|
|
43
43
|
readonly width?: ButtonWidth;
|
|
@@ -57,13 +57,19 @@ type DestinationButton = {
|
|
|
57
57
|
readonly onFollow?: () => void;
|
|
58
58
|
readonly onPress?: never;
|
|
59
59
|
readonly type?: never;
|
|
60
|
+
readonly form?: never;
|
|
60
61
|
};
|
|
61
|
-
/** A same-document command. It renders the vendor button and may submit or reset a form. */
|
|
62
|
+
/** A same-document command. It renders the vendor button and may submit or reset a form, its own or the one `form` names. */
|
|
62
63
|
type CommandButton = {
|
|
63
64
|
/** Controlled toggle state. Keep the action label unchanged between pressed and unpressed. */
|
|
64
65
|
readonly "aria-pressed"?: boolean;
|
|
65
66
|
readonly onPress?: () => void;
|
|
66
67
|
readonly type?: ButtonType;
|
|
68
|
+
/**
|
|
69
|
+
* The `id` of the form this button submits or resets from outside it: a `Drawer` or `Modal` footer button with
|
|
70
|
+
* `type="submit"` and `form` naming the form in the overlay's body.
|
|
71
|
+
*/
|
|
72
|
+
readonly form?: string;
|
|
67
73
|
readonly href?: never;
|
|
68
74
|
readonly target?: never;
|
|
69
75
|
readonly rel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