@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.
- package/dist/cyclonedx/bom.json +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -8216
- package/dist/pages/action-bar/action-bar.js +471 -0
- package/dist/pages/action-bar/action-bar.props.js +3 -0
- package/dist/pages/app-shell/app-shell.js +4899 -0
- package/dist/pages/app-shell/app-shell.props.js +3 -0
- package/dist/pages/floating-panel/floating-panel.js +995 -0
- package/dist/pages/floating-panel/floating-panel.props.js +3 -0
- package/dist/pages/locale-switcher/locale-switcher.js +180 -0
- package/dist/pages/locale-switcher/locale-switcher.props.js +3 -0
- package/dist/pages/page/page.js +2308 -0
- package/dist/pages/page/page.props.js +3 -0
- package/dist/pages/pages.json +123 -0
- package/dist/pages/section/section.js +1241 -0
- package/dist/pages/section/section.props.js +3 -0
- package/dist/pages/sidebar/sidebar.js +1743 -0
- package/dist/pages/sidebar/sidebar.props.js +3 -0
- package/dist/pages/splitter/splitter.js +1563 -0
- package/dist/pages/splitter/splitter.props.js +3 -0
- package/dist/pages/switcher/switcher.js +900 -0
- package/dist/pages/switcher/switcher.props.js +3 -0
- package/dist/pages/theme-switcher/theme-switcher.js +180 -0
- package/dist/pages/theme-switcher/theme-switcher.props.js +3 -0
- package/dist/pages/toolbar/toolbar.js +1045 -0
- package/dist/pages/toolbar/toolbar.props.js +3 -0
- package/dist/{recipe-sZAQY6Kq.js → recipes-Cmy1leBm.js} +312 -30
- package/dist/shared-DxlFabHA.js +9547 -0
- package/dist/shell.js +1 -165
- package/dist/theme.js +3 -4
- package/locales/en/specimen/action-bar.json +46 -0
- package/locales/en/specimen/app-shell.json +288 -0
- package/locales/en/specimen/floating-panel.json +70 -0
- package/locales/en/specimen/locale-switcher.json +15 -0
- package/locales/en/specimen/page.json +198 -0
- package/locales/en/specimen/section.json +91 -0
- package/locales/en/specimen/sidebar.json +87 -0
- package/locales/en/specimen/splitter.json +93 -0
- package/locales/en/specimen/switcher.json +61 -0
- package/locales/en/specimen/theme-switcher.json +15 -0
- package/locales/en/specimen/toolbar.json +80 -0
- package/package.json +25 -24
- package/dist/recipe-DRMsitrw.js +0 -283
- package/dist/root-qEh4u7y5.js +0 -1182
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stealthscale/component-screen",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "Lays an application out on whatever screen it is opened on: the shell, the page, the toolbar and the sidebar, each folding on its own as the screen narrows.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"components",
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"files": [
|
|
20
20
|
"dist",
|
|
21
21
|
"LICENSE",
|
|
22
|
+
"locales",
|
|
22
23
|
"README.md"
|
|
23
24
|
],
|
|
24
25
|
"type": "module",
|
|
@@ -44,16 +45,16 @@
|
|
|
44
45
|
},
|
|
45
46
|
"devDependencies": {
|
|
46
47
|
"@arethetypeswrong/core": "^0.18",
|
|
47
|
-
"@stealthscale/component-a11y": "^0.1.
|
|
48
|
-
"@stealthscale/component-actions": "^0.2.
|
|
49
|
-
"@stealthscale/component-data": "^0.2.
|
|
50
|
-
"@stealthscale/component-disclosure": "^0.2.
|
|
51
|
-
"@stealthscale/component-forms": "^0.3.
|
|
52
|
-
"@stealthscale/component-layout": "^0.2.
|
|
53
|
-
"@stealthscale/component-modals": "^0.2.
|
|
54
|
-
"@stealthscale/component-navigation": "^0.3.
|
|
55
|
-
"@stealthscale/component-primitives": "^0.3.
|
|
56
|
-
"@stealthscale/component-typography": "^0.3.
|
|
48
|
+
"@stealthscale/component-a11y": "^0.1.3",
|
|
49
|
+
"@stealthscale/component-actions": "^0.2.3",
|
|
50
|
+
"@stealthscale/component-data": "^0.2.2",
|
|
51
|
+
"@stealthscale/component-disclosure": "^0.2.4",
|
|
52
|
+
"@stealthscale/component-forms": "^0.3.2",
|
|
53
|
+
"@stealthscale/component-layout": "^0.2.2",
|
|
54
|
+
"@stealthscale/component-modals": "^0.2.2",
|
|
55
|
+
"@stealthscale/component-navigation": "^0.3.2",
|
|
56
|
+
"@stealthscale/component-primitives": "^0.3.1",
|
|
57
|
+
"@stealthscale/component-typography": "^0.3.2",
|
|
57
58
|
"@stealthscale/hooks": "^0.3.0",
|
|
58
59
|
"@stealthscale/provider-color-mode": "^0.2.2",
|
|
59
60
|
"@stealthscale/provider-locale": "^0.1.1",
|
|
@@ -62,10 +63,10 @@
|
|
|
62
63
|
"@stealthscale/settings": "^0.2.0",
|
|
63
64
|
"@stealthscale/theme": "^0.5.0",
|
|
64
65
|
"@stealthscale/vite-config": "^0.8.0",
|
|
65
|
-
"@stealthscale/vite-config-i18n": "^0.2.
|
|
66
|
+
"@stealthscale/vite-config-i18n": "^0.2.2",
|
|
66
67
|
"@stealthscale/vite-config-react": "^0.9.1",
|
|
67
|
-
"@stealthscale/vite-config-specimen": "^0.
|
|
68
|
-
"@stealthscale/vite-config-theme": "^0.
|
|
68
|
+
"@stealthscale/vite-config-specimen": "^0.3.0",
|
|
69
|
+
"@stealthscale/vite-config-theme": "^0.3.0",
|
|
69
70
|
"@stealthscale/vite-config-typescript": "^0.3.0",
|
|
70
71
|
"@testing-library/react": "^16.3",
|
|
71
72
|
"@types/react": "^19.3",
|
|
@@ -80,16 +81,16 @@
|
|
|
80
81
|
"vitest": "5.0.3"
|
|
81
82
|
},
|
|
82
83
|
"peerDependencies": {
|
|
83
|
-
"@stealthscale/component-a11y": "^0.1.
|
|
84
|
-
"@stealthscale/component-actions": "^0.2.
|
|
85
|
-
"@stealthscale/component-data": "^0.2.
|
|
86
|
-
"@stealthscale/component-disclosure": "^0.2.
|
|
87
|
-
"@stealthscale/component-forms": "^0.3.
|
|
88
|
-
"@stealthscale/component-layout": "^0.2.
|
|
89
|
-
"@stealthscale/component-modals": "^0.2.
|
|
90
|
-
"@stealthscale/component-navigation": "^0.3.
|
|
91
|
-
"@stealthscale/component-primitives": "^0.3.
|
|
92
|
-
"@stealthscale/component-typography": "^0.3.
|
|
84
|
+
"@stealthscale/component-a11y": "^0.1.3",
|
|
85
|
+
"@stealthscale/component-actions": "^0.2.3",
|
|
86
|
+
"@stealthscale/component-data": "^0.2.2",
|
|
87
|
+
"@stealthscale/component-disclosure": "^0.2.4",
|
|
88
|
+
"@stealthscale/component-forms": "^0.3.2",
|
|
89
|
+
"@stealthscale/component-layout": "^0.2.2",
|
|
90
|
+
"@stealthscale/component-modals": "^0.2.2",
|
|
91
|
+
"@stealthscale/component-navigation": "^0.3.2",
|
|
92
|
+
"@stealthscale/component-primitives": "^0.3.1",
|
|
93
|
+
"@stealthscale/component-typography": "^0.3.2",
|
|
93
94
|
"@stealthscale/hooks": "^0.3.0",
|
|
94
95
|
"@stealthscale/provider-locale": "^0.1.1",
|
|
95
96
|
"@stealthscale/provider-shell": "^0.2.2",
|
package/dist/recipe-DRMsitrw.js
DELETED
|
@@ -1,283 +0,0 @@
|
|
|
1
|
-
import { below, defineSlotRecipe, dense, interactive, lookVariants, onSlot, onSlots, paletteVariants, sizeVariants, truncate } from "@stealthscale/theme/authoring";
|
|
2
|
-
//#region src/folding/folding.ts
|
|
3
|
-
/**
|
|
4
|
-
* Styles an action that folds to its icon while its row is narrow, for the page, the toolbar and
|
|
5
|
-
* the section.
|
|
6
|
-
*
|
|
7
|
-
* @remarks
|
|
8
|
-
* A secondary action shows its icon alone, and its words remain for a screen reader. A tertiary
|
|
9
|
-
* action renders nothing on a narrow row and runs from the row's menu, which the action registers
|
|
10
|
-
* with. The row measures its own width, so a row beside an open sidebar folds on its own width
|
|
11
|
-
* and the caller does not write a breakpoint.
|
|
12
|
-
*/
|
|
13
|
-
/**
|
|
14
|
-
* Attribute an action sets on itself while its own row is narrow.
|
|
15
|
-
*
|
|
16
|
-
* @remarks
|
|
17
|
-
* The action reads the state from its row's context, so a narrow ancestor folds no action of a
|
|
18
|
-
* wider row inside it. A bar fixed to the window is wider than the page around it in the
|
|
19
|
-
* document.
|
|
20
|
-
*/
|
|
21
|
-
const NARROW$1 = "data-narrow";
|
|
22
|
-
/**
|
|
23
|
-
* Attribute a toolbar control sets to the id it registers its menu row under, while a narrow row
|
|
24
|
-
* can move it into the row's menu.
|
|
25
|
-
*
|
|
26
|
-
* @remarks
|
|
27
|
-
* The row reads the attribute in document order. It moves the control nearest its end first, and
|
|
28
|
-
* its menu lists the moved controls in the row's order.
|
|
29
|
-
*/
|
|
30
|
-
const FOLDS = "data-folds";
|
|
31
|
-
/**
|
|
32
|
-
* Attribute an action sets to its priority.
|
|
33
|
-
*
|
|
34
|
-
* @remarks
|
|
35
|
-
* The priority is an attribute and not an axis, because a slot recipe resolves its variants once,
|
|
36
|
-
* at the root, and each action in a row folds on its own priority.
|
|
37
|
-
*/
|
|
38
|
-
const PRIORITY = "data-priority";
|
|
39
|
-
/**
|
|
40
|
-
* Styles an action by its priority while its row is narrow.
|
|
41
|
-
*
|
|
42
|
-
* @remarks
|
|
43
|
-
* Every action keeps its words on one line at every width, because a wrapped control would make
|
|
44
|
-
* the row taller. A secondary action hides its element children other than its icon with
|
|
45
|
-
* `srOnly`, so it keeps its accessible name, and renders as a square around its icon. Its words
|
|
46
|
-
* must be in an element, because a CSS selector cannot select a bare text node. A primary action
|
|
47
|
-
* is unchanged.
|
|
48
|
-
*/
|
|
49
|
-
const FOLDING = {
|
|
50
|
-
[`&[${PRIORITY}=secondary]`]: { [`&[${NARROW$1}]`]: {
|
|
51
|
-
"& > :not(svg)": { srOnly: true },
|
|
52
|
-
aspectRatio: "square",
|
|
53
|
-
justifyContent: "center",
|
|
54
|
-
paddingInline: "0"
|
|
55
|
-
} },
|
|
56
|
-
whiteSpace: "nowrap"
|
|
57
|
-
};
|
|
58
|
-
//#endregion
|
|
59
|
-
//#region src/switcher/recipe.ts
|
|
60
|
-
/**
|
|
61
|
-
* Declares the switcher's slot recipe, which styles the control that shows the current workspace,
|
|
62
|
-
* project or environment and opens the menu of the others.
|
|
63
|
-
*
|
|
64
|
-
* @remarks
|
|
65
|
-
* The recipe has six slots. The root slot is the trigger, and the mark, the label, the name, the
|
|
66
|
-
* detail and the indicator are inside it. `Switcher.Root` is the disclosure package's menu, so
|
|
67
|
-
* the menu's recipe styles the panel and its rows. The trigger takes the button's looks and
|
|
68
|
-
* palettes from the same layer styles, so an outlined switcher has the button's light edge. The
|
|
69
|
-
* mark renders an initial, an icon or an avatar in the palette's ink, without a fill. The name
|
|
70
|
-
* and the detail truncate to keep the control at one height. A pair of chevrons marks a control
|
|
71
|
-
* that switches and not a direction, so the indicator does not rotate while the menu is open. In
|
|
72
|
-
* a sidebar closed to icons, and in a narrow toolbar for a switcher with a mark, the control is
|
|
73
|
-
* its mark alone, square. The words remain in the accessible name in both.
|
|
74
|
-
*/
|
|
75
|
-
/**
|
|
76
|
-
* Selects a part of a switcher drawn as its mark alone, in a sidebar closed to icons.
|
|
77
|
-
*/
|
|
78
|
-
const ICONIC = ".switcher__root[data-iconic] &";
|
|
79
|
-
/**
|
|
80
|
-
* Selects a part of a switcher with a mark in a toolbar too narrow for the name. A switcher
|
|
81
|
-
* without a mark keeps its name, because the name is the only content that identifies it.
|
|
82
|
-
*/
|
|
83
|
-
const NARROW = ".switcher__root[data-narrow]:has(.switcher__mark) &";
|
|
84
|
-
/**
|
|
85
|
-
* Custom property the size axis sets to the height of a button at the switcher's size.
|
|
86
|
-
*/
|
|
87
|
-
const HEIGHT = "--switcher-height";
|
|
88
|
-
/**
|
|
89
|
-
* Styles a control that is one line as wide as its words: in a toolbar and on its own.
|
|
90
|
-
*
|
|
91
|
-
* @remarks
|
|
92
|
-
* `inlineSize: fit` keeps the control as wide as its words, because a flex container fills its
|
|
93
|
-
* line otherwise. The detail is hidden, because the control is one line tall. The control is at
|
|
94
|
-
* least as tall as a button of its size, so it lines up with the buttons in a toolbar: 36px at
|
|
95
|
-
* `sm` and 40px at `md`. In a narrow toolbar a control with a mark is a square of that height
|
|
96
|
-
* around the mark, as an action with an icon is.
|
|
97
|
-
*/
|
|
98
|
-
const INLINE = {
|
|
99
|
-
detail: { display: "none" },
|
|
100
|
-
root: {
|
|
101
|
-
"&[data-narrow]:has(.switcher__mark)": {
|
|
102
|
-
aspectRatio: "square",
|
|
103
|
-
inlineSize: "auto",
|
|
104
|
-
justifyContent: "center",
|
|
105
|
-
paddingInline: "0"
|
|
106
|
-
},
|
|
107
|
-
inlineSize: "fit",
|
|
108
|
-
minBlockSize: `var(${HEIGHT})`
|
|
109
|
-
}
|
|
110
|
-
};
|
|
111
|
-
/**
|
|
112
|
-
* Styles the control in a sidebar: a row as wide as the column, and the mark alone on a rail.
|
|
113
|
-
*
|
|
114
|
-
* @remarks
|
|
115
|
-
* On a rail the control has no padding and no edge, so it is the mark's square, as tall as the
|
|
116
|
-
* rows under it: 32px at `md`.
|
|
117
|
-
*/
|
|
118
|
-
const ROW = { root: {
|
|
119
|
-
"&[data-iconic]": {
|
|
120
|
-
alignSelf: "center",
|
|
121
|
-
aspectRatio: "square",
|
|
122
|
-
borderWidth: "0",
|
|
123
|
-
inlineSize: "auto",
|
|
124
|
-
justifyContent: "center",
|
|
125
|
-
padding: "0"
|
|
126
|
-
},
|
|
127
|
-
inlineSize: "full"
|
|
128
|
-
} };
|
|
129
|
-
/**
|
|
130
|
-
* Styles a ghost switcher at the middle size, alone.
|
|
131
|
-
*/
|
|
132
|
-
const recipe = defineSlotRecipe({
|
|
133
|
-
base: {
|
|
134
|
-
detail: {
|
|
135
|
-
...truncate(),
|
|
136
|
-
textStyle: "caption",
|
|
137
|
-
color: "fg.subtle"
|
|
138
|
-
},
|
|
139
|
-
indicator: {
|
|
140
|
-
_open: { rotate: "0deg" },
|
|
141
|
-
alignItems: "center",
|
|
142
|
-
color: "fg.subtle",
|
|
143
|
-
display: "inline-flex",
|
|
144
|
-
flexShrink: "0",
|
|
145
|
-
[ICONIC]: { display: "none" },
|
|
146
|
-
justifyContent: "center",
|
|
147
|
-
marginInlineStart: "auto",
|
|
148
|
-
[NARROW]: { display: "none" },
|
|
149
|
-
transitionDuration: "press",
|
|
150
|
-
transitionProperty: "common",
|
|
151
|
-
transitionTimingFunction: "press"
|
|
152
|
-
},
|
|
153
|
-
label: {
|
|
154
|
-
display: "flex",
|
|
155
|
-
flex: "1",
|
|
156
|
-
flexDirection: "column",
|
|
157
|
-
[ICONIC]: { srOnly: true },
|
|
158
|
-
minInlineSize: "0",
|
|
159
|
-
[NARROW]: { srOnly: true },
|
|
160
|
-
textAlign: "start"
|
|
161
|
-
},
|
|
162
|
-
mark: {
|
|
163
|
-
alignItems: "center",
|
|
164
|
-
color: "colorPalette.fg",
|
|
165
|
-
display: "inline-flex",
|
|
166
|
-
flexShrink: "0",
|
|
167
|
-
fontWeight: "semibold",
|
|
168
|
-
justifyContent: "center",
|
|
169
|
-
lineHeight: "tight",
|
|
170
|
-
overflow: "clip"
|
|
171
|
-
},
|
|
172
|
-
name: {
|
|
173
|
-
...truncate(),
|
|
174
|
-
fontWeight: "medium"
|
|
175
|
-
},
|
|
176
|
-
root: {
|
|
177
|
-
...interactive(),
|
|
178
|
-
alignItems: "center",
|
|
179
|
-
appearance: "none",
|
|
180
|
-
borderColor: "transparent",
|
|
181
|
-
borderWidth: "control",
|
|
182
|
-
colorPalette: "neutral",
|
|
183
|
-
display: "flex",
|
|
184
|
-
minInlineSize: "0"
|
|
185
|
-
}
|
|
186
|
-
},
|
|
187
|
-
className: "switcher",
|
|
188
|
-
compoundVariants: [{
|
|
189
|
-
css: { mark: {
|
|
190
|
-
boxSize: dense("{sizes.icon.lg}"),
|
|
191
|
-
fontSize: "xs"
|
|
192
|
-
} },
|
|
193
|
-
name: "marked",
|
|
194
|
-
placement: ["alone", "toolbar"]
|
|
195
|
-
}, (
|
|
196
|
-
/**
|
|
197
|
-
* Sets the detail and the indicator in the trigger's own ink on the solid look, where the
|
|
198
|
-
* page's subtle ink is not read against the fill.
|
|
199
|
-
*/
|
|
200
|
-
{
|
|
201
|
-
css: {
|
|
202
|
-
detail: { color: "inherit" },
|
|
203
|
-
indicator: { color: "inherit" }
|
|
204
|
-
},
|
|
205
|
-
name: "inked",
|
|
206
|
-
variant: "solid"
|
|
207
|
-
})],
|
|
208
|
-
defaultVariants: {
|
|
209
|
-
placement: "alone",
|
|
210
|
-
size: "md",
|
|
211
|
-
variant: "ghost"
|
|
212
|
-
},
|
|
213
|
-
jsx: [/^Switcher(\.\w+)?$/u],
|
|
214
|
-
slots: [
|
|
215
|
-
"root",
|
|
216
|
-
"mark",
|
|
217
|
-
"label",
|
|
218
|
-
"name",
|
|
219
|
-
"detail",
|
|
220
|
-
"indicator"
|
|
221
|
-
],
|
|
222
|
-
variants: {
|
|
223
|
-
/**
|
|
224
|
-
* The palette of the look and the mark.
|
|
225
|
-
*/
|
|
226
|
-
palette: onSlot("root", paletteVariants()),
|
|
227
|
-
/**
|
|
228
|
-
* Where the control is placed, which sets its width and its lines.
|
|
229
|
-
*
|
|
230
|
-
* @remarks
|
|
231
|
-
* `Switcher.Root` reads the placement from the sidebar or the toolbar around it unless a
|
|
232
|
-
* caller states one. The `marked` compound sizes the mark to `icon.lg` on one line, because
|
|
233
|
-
* the size axis sizes it for a sidebar and a compound applies over an axis.
|
|
234
|
-
*/
|
|
235
|
-
placement: {
|
|
236
|
-
alone: INLINE,
|
|
237
|
-
sidebar: ROW,
|
|
238
|
-
toolbar: INLINE
|
|
239
|
-
},
|
|
240
|
-
size: onSlots({
|
|
241
|
-
indicator: sizeVariants((size) => ({ boxSize: dense(`{sizes.icon.${below(size)}}`) }), [
|
|
242
|
-
"sm",
|
|
243
|
-
"md",
|
|
244
|
-
"lg"
|
|
245
|
-
]),
|
|
246
|
-
mark: sizeVariants((size) => ({
|
|
247
|
-
boxSize: dense(`{sizes.control.${below(below(size))}}`),
|
|
248
|
-
fontSize: below(size)
|
|
249
|
-
}), [
|
|
250
|
-
"sm",
|
|
251
|
-
"md",
|
|
252
|
-
"lg"
|
|
253
|
-
]),
|
|
254
|
-
name: sizeVariants((size) => ({ textStyle: `body.${below(size)}` }), [
|
|
255
|
-
"sm",
|
|
256
|
-
"md",
|
|
257
|
-
"lg"
|
|
258
|
-
]),
|
|
259
|
-
root: sizeVariants((size) => ({
|
|
260
|
-
textStyle: `body.${below(size)}`,
|
|
261
|
-
borderRadius: "l2",
|
|
262
|
-
gap: dense(`{spacing.gap.${size}}`),
|
|
263
|
-
[HEIGHT]: dense(`{sizes.control.${size}}`),
|
|
264
|
-
paddingBlock: dense(`{spacing.gap.${below(size)}}`),
|
|
265
|
-
paddingInline: dense(`{spacing.gap.${size}}`)
|
|
266
|
-
}), [
|
|
267
|
-
"sm",
|
|
268
|
-
"md",
|
|
269
|
-
"lg"
|
|
270
|
-
])
|
|
271
|
-
}),
|
|
272
|
-
/**
|
|
273
|
-
* The button's six looks, each one of the theme's layer styles.
|
|
274
|
-
*
|
|
275
|
-
* @remarks
|
|
276
|
-
* `ghost`, the default, has no fill at rest, so a switcher at the head of a sidebar shows the
|
|
277
|
-
* sidebar's own ground and fills under a pointer.
|
|
278
|
-
*/
|
|
279
|
-
variant: onSlot("root", lookVariants())
|
|
280
|
-
}
|
|
281
|
-
});
|
|
282
|
-
//#endregion
|
|
283
|
-
export { PRIORITY as a, NARROW$1 as i, FOLDING as n, FOLDS as r, recipe as t };
|