@stealthscale/component-screen 0.2.1 → 0.2.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.
Files changed (44) hide show
  1. package/dist/cyclonedx/bom.json +1 -1
  2. package/dist/index.d.ts +3 -3
  3. package/dist/index.js +1 -8216
  4. package/dist/pages/action-bar/action-bar.js +471 -0
  5. package/dist/pages/action-bar/action-bar.props.js +3 -0
  6. package/dist/pages/app-shell/app-shell.js +4899 -0
  7. package/dist/pages/app-shell/app-shell.props.js +3 -0
  8. package/dist/pages/floating-panel/floating-panel.js +995 -0
  9. package/dist/pages/floating-panel/floating-panel.props.js +3 -0
  10. package/dist/pages/locale-switcher/locale-switcher.js +180 -0
  11. package/dist/pages/locale-switcher/locale-switcher.props.js +3 -0
  12. package/dist/pages/page/page.js +2308 -0
  13. package/dist/pages/page/page.props.js +3 -0
  14. package/dist/pages/pages.json +123 -0
  15. package/dist/pages/section/section.js +1241 -0
  16. package/dist/pages/section/section.props.js +3 -0
  17. package/dist/pages/sidebar/sidebar.js +1743 -0
  18. package/dist/pages/sidebar/sidebar.props.js +3 -0
  19. package/dist/pages/splitter/splitter.js +1563 -0
  20. package/dist/pages/splitter/splitter.props.js +3 -0
  21. package/dist/pages/switcher/switcher.js +900 -0
  22. package/dist/pages/switcher/switcher.props.js +3 -0
  23. package/dist/pages/theme-switcher/theme-switcher.js +180 -0
  24. package/dist/pages/theme-switcher/theme-switcher.props.js +3 -0
  25. package/dist/pages/toolbar/toolbar.js +1045 -0
  26. package/dist/pages/toolbar/toolbar.props.js +3 -0
  27. package/dist/{recipe-sZAQY6Kq.js → recipes-Cmy1leBm.js} +312 -30
  28. package/dist/shared-DxlFabHA.js +9547 -0
  29. package/dist/shell.js +1 -165
  30. package/dist/theme.js +3 -4
  31. package/locales/en/specimen/action-bar.json +46 -0
  32. package/locales/en/specimen/app-shell.json +288 -0
  33. package/locales/en/specimen/floating-panel.json +70 -0
  34. package/locales/en/specimen/locale-switcher.json +15 -0
  35. package/locales/en/specimen/page.json +198 -0
  36. package/locales/en/specimen/section.json +91 -0
  37. package/locales/en/specimen/sidebar.json +87 -0
  38. package/locales/en/specimen/splitter.json +93 -0
  39. package/locales/en/specimen/switcher.json +61 -0
  40. package/locales/en/specimen/theme-switcher.json +15 -0
  41. package/locales/en/specimen/toolbar.json +80 -0
  42. package/package.json +25 -24
  43. package/dist/recipe-DRMsitrw.js +0 -283
  44. package/dist/root-qEh4u7y5.js +0 -1182
@@ -0,0 +1,3 @@
1
+ export const dropped = {"ActionProps": {"conditions": 284, "foreign": 1044}, "DetailProps": {"conditions": 284, "foreign": 1041}, "IndicatorProps": {"conditions": 284, "foreign": 1041}, "LabelProps": {"conditions": 284, "foreign": 1041}, "MarkProps": {"conditions": 284, "foreign": 1041}, "NameProps": {"conditions": 284, "foreign": 1041}, "RootProps": {"conditions": 284, "foreign": 1063}, "TriggerProps": {"conditions": 284, "foreign": 1051}};
2
+ export const parts = {"ActionProps": [{"accepts": "ReactNode", "fallback": "", "kind": "option", "name": "icon", "refers": ["react.ReactElement", "react.ReactPortal"], "required": false, "says": "Mark before the words."}, {"accepts": "string", "fallback": "", "kind": "option", "name": "value", "refers": [], "required": false, "says": "Value the menu identifies the row by. A generated one when absent."}], "DetailProps": [], "IndicatorProps": [], "LabelProps": [], "MarkProps": [], "NameProps": [], "RootProps": [{"accepts": "ReactNode", "fallback": "", "kind": "option", "name": "checkIcon", "refers": ["react.ReactElement", "react.ReactPortal"], "required": false, "says": "Glyph that marks the current choice's row in the menu."}, {"accepts": "string", "fallback": "", "kind": "option", "name": "defaultValue", "refers": [], "required": false, "says": "Value of the choice that is current at first, when the caller does not control it. Defaults to the first choice."}, {"accepts": "\"ltr\" | \"rtl\"", "fallback": "\"ltr\"", "kind": "option", "name": "dir", "refers": [], "required": false, "says": "The document's text/writing direction."}, {"accepts": "(() => Document | Node | ShadowRoot)", "fallback": "", "kind": "option", "name": "getRootNode", "refers": [], "required": false, "says": "A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron."}, {"accepts": "Highlight", "fallback": "", "kind": "variant", "name": "highlight", "refers": ["kit.Highlight"], "required": false, "says": "Look of the highlighted row."}, {"accepts": "string", "fallback": "", "kind": "option", "name": "id", "refers": [], "required": false, "says": "The unique identifier of the machine."}, {"accepts": "ReactNode", "fallback": "", "kind": "option", "name": "indicator", "refers": ["react.ReactElement", "react.ReactPortal"], "required": false, "says": "Glyph at the end of the trigger."}, {"accepts": "boolean", "fallback": "", "kind": "variant", "name": "inset", "refers": [], "required": false, "says": "Whether a row without a leading icon or mark starts its text after the gutter an icon takes, for a menu where some rows lead with an icon."}, {"accepts": "readonly Choice[]", "fallback": "", "kind": "option", "name": "items", "refers": ["kit.Choice", "react.ReactElement", "react.ReactPortal"], "required": false, "says": "The choices. With them the root renders the trigger and the menu."}, {"accepts": "string", "fallback": "", "kind": "option", "name": "label", "refers": [], "required": false, "says": "Kind of thing the switcher switches, which a screen reader announces before the current name. Used with `items`."}, {"accepts": "((value: string) => void)", "fallback": "", "kind": "option", "name": "onValueChange", "refers": [], "required": false, "says": "Called with the value of the choice the reader switches to."}, {"accepts": "\"accent\" | \"error\" | \"info\" | \"neutral\" | \"primary\" | \"secondary\" | \"success\" | \"warning\"", "fallback": "", "kind": "variant", "name": "palette", "refers": [], "required": false, "says": "The palette of the look and the mark."}, {"accepts": "Placement", "fallback": "", "kind": "option", "name": "placement", "refers": ["kit.Placement"], "required": false, "says": "Where the switcher renders. Read from the sidebar or the toolbar around it when absent."}, {"accepts": "SwitcherSize", "fallback": "", "kind": "option", "name": "size", "refers": ["kit.SwitcherSize"], "required": false, "says": "Size of the switcher. The sidebar's or the toolbar's size when absent, and `md` alone."}, {"accepts": "string", "fallback": "", "kind": "option", "name": "value", "refers": [], "required": false, "says": "Value of the current choice, when the caller controls it."}, {"accepts": "Look", "fallback": "", "kind": "variant", "name": "variant", "refers": ["kit.Look"], "required": false, "says": "The button's six looks, each one of the theme's layer styles."}], "TriggerProps": [{"accepts": "string", "fallback": "", "kind": "option", "name": "label", "refers": [], "required": true, "says": "Kind of thing the control switches: `Workspace`, `Project`, `Environment`. A screen reader announces it before the current name."}]};
3
+ export const shapes = {"react.ReactElement": [{"accepts": "string | JSXElementConstructor<any>", "name": "type", "says": ""}, {"accepts": "unknown", "name": "props", "says": ""}, {"accepts": "string | null", "name": "key", "says": ""}], "react.ReactPortal": [{"accepts": "ReactNode", "name": "children", "says": ""}, {"accepts": "string | JSXElementConstructor<any>", "name": "type", "says": ""}, {"accepts": "unknown", "name": "props", "says": ""}, {"accepts": "string | null", "name": "key", "says": ""}], "kit.Choice": [{"accepts": "string", "name": "detail", "says": "Plan, role or region, rendered under the name in a sidebar and in the menu's row."}, {"accepts": "boolean", "name": "disabled", "says": "Whether the reader cannot switch to the choice."}, {"accepts": "string", "name": "href", "says": "Address of the choice's own page, which renders its row as a link."}, {"accepts": "string", "name": "label", "says": "Name of the choice."}, {"accepts": "ReactNode", "name": "mark", "says": "Logo or avatar. The mark shows the name's initials without one."}, {"accepts": "string", "name": "value", "says": "Value the application knows the choice by."}], "kit.Placement": [{"accepts": "", "name": "\"alone\"", "says": ""}, {"accepts": "", "name": "\"sidebar\"", "says": ""}, {"accepts": "", "name": "\"toolbar\"", "says": ""}], "kit.SwitcherSize": [{"accepts": "", "name": "\"lg\"", "says": ""}, {"accepts": "", "name": "\"md\"", "says": ""}, {"accepts": "", "name": "\"sm\"", "says": ""}], "kit.Highlight": [{"accepts": "", "name": "\"bar\"", "says": ""}, {"accepts": "", "name": "\"fill\"", "says": ""}, {"accepts": "", "name": "\"tint\"", "says": ""}], "kit.Look": [{"accepts": "", "name": "\"ghost\"", "says": ""}, {"accepts": "", "name": "\"outline\"", "says": ""}, {"accepts": "", "name": "\"plain\"", "says": ""}, {"accepts": "", "name": "\"solid\"", "says": ""}, {"accepts": "", "name": "\"subtle\"", "says": ""}, {"accepts": "", "name": "\"surface\"", "says": ""}]};
@@ -0,0 +1,180 @@
1
+ import { t as __exportAll } from "../../rolldown-runtime-D7D4PA-g.js";
2
+ import { a as Start, c as Root, d as End, t as ThemeSwitcher } from "../../shared-DxlFabHA.js";
3
+ import { c } from "react/compiler-runtime";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ import { Matrix, Sample, specimen, useWords } from "@stealthscale/specimen";
6
+ import { CheckIcon, ChevronsUpDownIcon } from "lucide-react";
7
+ import { Text } from "@stealthscale/component-typography";
8
+ //#region src/theme-switcher/examples/bar.example.tsx
9
+ var bar_example_exports = /* @__PURE__ */ __exportAll({
10
+ Bar: () => Bar,
11
+ source: () => source$1
12
+ });
13
+ function Bar() {
14
+ const $ = c(16);
15
+ const { t } = useWords("theme-switcher");
16
+ let t0;
17
+ if ($[0] !== t) {
18
+ t0 = t("application");
19
+ $[0] = t;
20
+ $[1] = t0;
21
+ } else t0 = $[1];
22
+ let t1;
23
+ if ($[2] !== t) {
24
+ t1 = t("product");
25
+ $[2] = t;
26
+ $[3] = t1;
27
+ } else t1 = $[3];
28
+ let t2;
29
+ if ($[4] !== t1) {
30
+ t2 = /* @__PURE__ */ jsx(Start, { children: /* @__PURE__ */ jsx(Text, {
31
+ as: "span",
32
+ size: "sm",
33
+ weight: "semibold",
34
+ children: t1
35
+ }) });
36
+ $[4] = t1;
37
+ $[5] = t2;
38
+ } else t2 = $[5];
39
+ let t3;
40
+ let t4;
41
+ if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
42
+ t3 = /* @__PURE__ */ jsx(CheckIcon, { size: "1em" });
43
+ t4 = /* @__PURE__ */ jsx(ChevronsUpDownIcon, { size: "1em" });
44
+ $[6] = t3;
45
+ $[7] = t4;
46
+ } else {
47
+ t3 = $[6];
48
+ t4 = $[7];
49
+ }
50
+ let t5;
51
+ if ($[8] !== t) {
52
+ t5 = t("label");
53
+ $[8] = t;
54
+ $[9] = t5;
55
+ } else t5 = $[9];
56
+ let t6;
57
+ if ($[10] !== t5) {
58
+ t6 = /* @__PURE__ */ jsx(End, { children: /* @__PURE__ */ jsx(ThemeSwitcher, {
59
+ checkIcon: t3,
60
+ indicator: t4,
61
+ label: t5
62
+ }) });
63
+ $[10] = t5;
64
+ $[11] = t6;
65
+ } else t6 = $[11];
66
+ let t7;
67
+ if ($[12] !== t0 || $[13] !== t2 || $[14] !== t6) {
68
+ t7 = /* @__PURE__ */ jsxs(Root, {
69
+ "aria-label": t0,
70
+ size: "sm",
71
+ children: [t2, t6]
72
+ });
73
+ $[12] = t0;
74
+ $[13] = t2;
75
+ $[14] = t6;
76
+ $[15] = t7;
77
+ } else t7 = $[15];
78
+ return t7;
79
+ }
80
+ const source$1 = "import { type ReactElement } from \"react\";\n\nimport { CheckIcon, ChevronsUpDownIcon } from \"lucide-react\";\n\nimport { Text } from \"@stealthscale/component-typography\";\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { ThemeSwitcher, Toolbar } from \"@stealthscale/component-screen\";\n\nexport function Bar(): ReactElement {\n const { t } = useWords(\"theme-switcher\");\n\n return (\n <Toolbar.Root aria-label={t(\"application\")} size=\"sm\">\n <Toolbar.Start>\n <Text as=\"span\" size=\"sm\" weight=\"semibold\">\n {t(\"product\")}\n </Text>\n </Toolbar.Start>\n <Toolbar.End>\n <ThemeSwitcher\n checkIcon={<CheckIcon size=\"1em\" />}\n indicator={<ChevronsUpDownIcon size=\"1em\" />}\n label={t(\"label\")}\n />\n </Toolbar.End>\n </Toolbar.Root>\n );\n}\n";
81
+ //#endregion
82
+ //#region src/theme-switcher/examples/looks.example.tsx
83
+ var looks_example_exports = /* @__PURE__ */ __exportAll({
84
+ Looks: () => Looks,
85
+ source: () => source
86
+ });
87
+ function Looks(props) {
88
+ const $ = c(7);
89
+ const { t } = useWords("theme-switcher");
90
+ let t0;
91
+ let t1;
92
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
93
+ t0 = /* @__PURE__ */ jsx(CheckIcon, { size: "1em" });
94
+ t1 = /* @__PURE__ */ jsx(ChevronsUpDownIcon, { size: "1em" });
95
+ $[0] = t0;
96
+ $[1] = t1;
97
+ } else {
98
+ t0 = $[0];
99
+ t1 = $[1];
100
+ }
101
+ let t2;
102
+ if ($[2] !== t) {
103
+ t2 = t("label");
104
+ $[2] = t;
105
+ $[3] = t2;
106
+ } else t2 = $[3];
107
+ let t3;
108
+ if ($[4] !== props || $[5] !== t2) {
109
+ t3 = /* @__PURE__ */ jsx(ThemeSwitcher, {
110
+ checkIcon: t0,
111
+ indicator: t1,
112
+ label: t2,
113
+ ...props
114
+ });
115
+ $[4] = props;
116
+ $[5] = t2;
117
+ $[6] = t3;
118
+ } else t3 = $[6];
119
+ return t3;
120
+ }
121
+ const source = "import { type ReactElement } from \"react\";\n\nimport { CheckIcon, ChevronsUpDownIcon } from \"lucide-react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { ThemeSwitcher, ThemeSwitcherProps } from \"@stealthscale/component-screen\";\n\nexport function Looks(props: Partial<ThemeSwitcherProps>): ReactElement {\n const { t } = useWords(\"theme-switcher\");\n\n return (\n <ThemeSwitcher\n checkIcon={<CheckIcon size=\"1em\" />}\n indicator={<ChevronsUpDownIcon size=\"1em\" />}\n label={t(\"label\")}\n {...props}\n />\n );\n}\n";
122
+ //#endregion
123
+ //#region src/theme-switcher/theme-switcher.specimen.tsx
124
+ /**
125
+ * Catalogue page for the theme switcher.
126
+ *
127
+ * @remarks
128
+ * The switcher has no recipe of its own: it renders `Switcher.Root`, so every scene is
129
+ * hand-written. Each switcher changes the catalogue's own theme, because the catalogue renders
130
+ * inside a shell that offers ten themes. The toolbar scene shows the switcher at the end of an
131
+ * application's bar, and the looks scene turns the switcher's `variant`. The examples come
132
+ * through their barrel, and the switcher's own barrel is imported as a type, so the props band
133
+ * reads the switcher alone and not the toolbar an example renders it in. The words are keys under
134
+ * `theme-switcher` in `locales/en/specimen/theme-switcher.json`.
135
+ */
136
+ /**
137
+ * Looks of the looks scene: the switcher's looks for a control in a bar, in reading order.
138
+ */
139
+ const LOOKS = [
140
+ "ghost",
141
+ "outline",
142
+ "subtle",
143
+ "surface"
144
+ ];
145
+ /**
146
+ * Hand-written scene for the switcher at the end of an application's bar.
147
+ */
148
+ const inToolbar = {
149
+ about: "theme-switcher.toolbar.about",
150
+ draw: () => /* @__PURE__ */ jsx(Sample, {
151
+ place: "stretch",
152
+ variant: "outline",
153
+ children: /* @__PURE__ */ jsx(Bar, {})
154
+ }),
155
+ example: bar_example_exports,
156
+ title: "theme-switcher.toolbar.title"
157
+ };
158
+ /**
159
+ * Hand-written scene for the looks the switcher takes from `Switcher.Root`.
160
+ */
161
+ const looked = {
162
+ about: "theme-switcher.looks.about",
163
+ draw: () => /* @__PURE__ */ jsx(Matrix, {
164
+ knob: "variant",
165
+ of: LOOKS,
166
+ children: (variant) => /* @__PURE__ */ jsx(Looks, { variant })
167
+ }),
168
+ example: looks_example_exports,
169
+ props: { variant: "ghost" },
170
+ title: "theme-switcher.looks.title"
171
+ };
172
+ var theme_switcher_specimen_default = specimen({
173
+ about: "theme-switcher.about",
174
+ id: "components/screen/theme-switcher",
175
+ imports: "import { ThemeSwitcher } from \"@stealthscale/component-screen/shell\";",
176
+ scenes: [inToolbar, looked],
177
+ title: "theme-switcher.title"
178
+ });
179
+ //#endregion
180
+ export { theme_switcher_specimen_default as default, inToolbar, looked };
@@ -0,0 +1,3 @@
1
+ export const dropped = {"ThemeSwitcherProps": {"conditions": 284, "foreign": 1063}};
2
+ export const parts = {"ThemeSwitcherProps": [{"accepts": "ReactNode", "fallback": "", "kind": "option", "name": "checkIcon", "refers": ["react.ReactElement", "react.ReactPortal"], "required": false, "says": "Glyph that marks the current choice's row in the menu."}, {"accepts": "\"ltr\" | \"rtl\"", "fallback": "\"ltr\"", "kind": "option", "name": "dir", "refers": [], "required": false, "says": "The document's text/writing direction."}, {"accepts": "(() => Document | Node | ShadowRoot)", "fallback": "", "kind": "option", "name": "getRootNode", "refers": [], "required": false, "says": "A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron."}, {"accepts": "Highlight", "fallback": "", "kind": "variant", "name": "highlight", "refers": ["kit.Highlight"], "required": false, "says": "Look of the highlighted row."}, {"accepts": "string", "fallback": "", "kind": "option", "name": "id", "refers": [], "required": false, "says": "The unique identifier of the machine."}, {"accepts": "ReactNode", "fallback": "", "kind": "option", "name": "indicator", "refers": ["react.ReactElement", "react.ReactPortal"], "required": false, "says": "Glyph at the end of the trigger."}, {"accepts": "boolean", "fallback": "", "kind": "variant", "name": "inset", "refers": [], "required": false, "says": "Whether a row without a leading icon or mark starts its text after the gutter an icon takes, for a menu where some rows lead with an icon."}, {"accepts": "string", "fallback": "", "kind": "option", "name": "label", "refers": [], "required": false, "says": "Name of the control, which a screen reader announces before the current theme. \"Theme\" unless the caller passes another."}, {"accepts": "\"accent\" | \"error\" | \"info\" | \"neutral\" | \"primary\" | \"secondary\" | \"success\" | \"warning\"", "fallback": "", "kind": "variant", "name": "palette", "refers": [], "required": false, "says": "The palette of the look and the mark."}, {"accepts": "Placement", "fallback": "", "kind": "option", "name": "placement", "refers": ["kit.Placement"], "required": false, "says": "Where the switcher renders. Read from the sidebar or the toolbar around it when absent."}, {"accepts": "SwitcherSize", "fallback": "", "kind": "option", "name": "size", "refers": ["kit.SwitcherSize"], "required": false, "says": "Size of the switcher. The sidebar's or the toolbar's size when absent, and `md` alone."}, {"accepts": "Look", "fallback": "", "kind": "variant", "name": "variant", "refers": ["kit.Look"], "required": false, "says": "The button's six looks, each one of the theme's layer styles."}]};
3
+ export const shapes = {"kit.Highlight": [{"accepts": "", "name": "\"bar\"", "says": ""}, {"accepts": "", "name": "\"fill\"", "says": ""}, {"accepts": "", "name": "\"tint\"", "says": ""}], "kit.Look": [{"accepts": "", "name": "\"ghost\"", "says": ""}, {"accepts": "", "name": "\"outline\"", "says": ""}, {"accepts": "", "name": "\"plain\"", "says": ""}, {"accepts": "", "name": "\"solid\"", "says": ""}, {"accepts": "", "name": "\"subtle\"", "says": ""}, {"accepts": "", "name": "\"surface\"", "says": ""}], "react.ReactElement": [{"accepts": "string | JSXElementConstructor<any>", "name": "type", "says": ""}, {"accepts": "unknown", "name": "props", "says": ""}, {"accepts": "string | null", "name": "key", "says": ""}], "react.ReactPortal": [{"accepts": "ReactNode", "name": "children", "says": ""}, {"accepts": "string | JSXElementConstructor<any>", "name": "type", "says": ""}, {"accepts": "unknown", "name": "props", "says": ""}, {"accepts": "string | null", "name": "key", "says": ""}], "kit.Placement": [{"accepts": "", "name": "\"alone\"", "says": ""}, {"accepts": "", "name": "\"sidebar\"", "says": ""}, {"accepts": "", "name": "\"toolbar\"", "says": ""}], "kit.SwitcherSize": [{"accepts": "", "name": "\"lg\"", "says": ""}, {"accepts": "", "name": "\"md\"", "says": ""}, {"accepts": "", "name": "\"sm\"", "says": ""}]};