@domicile-desktop/manganese-bar-module-workspace-switcher 1.1.1 → 1.2.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/README.md +2 -1
- package/package.json +13 -14
- package/src/OverviewButton.tsx +52 -0
- package/src/Workspaces.tsx +179 -50
- package/src/bar-item.tsx +20 -8
- package/styled-system/patterns/aspect-ratio.mjs +2 -2
- package/styled-system/patterns/bleed.mjs +1 -2
- package/styled-system/patterns/float.mjs +5 -11
- package/styled-system/patterns/grid-item.mjs +1 -2
- package/styled-system/patterns/grid.mjs +1 -2
- package/styled-system/patterns/link-overlay.mjs +1 -1
- package/styled-system/patterns/spacer.mjs +3 -3
- package/styled-system/patterns/visually-hidden.mjs +1 -1
- package/styled-system/tokens/index.mjs +7 -3
- package/styled-system/tokens/tokens.d.ts +2 -2
- package/styled-system/types/prop-type.d.ts +2 -2
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -1,27 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"dependencies": {
|
|
3
|
-
"@domicile-desktop/component-library": "2.0
|
|
4
|
-
"@domicile-desktop/manganese-bar": "1.1.
|
|
5
|
-
"@domicile-desktop/manganese-window-management": "
|
|
6
|
-
"@pandacss/dev": "^1.12.
|
|
7
|
-
"react": "^19.
|
|
3
|
+
"@domicile-desktop/component-library": "2.2.0",
|
|
4
|
+
"@domicile-desktop/manganese-bar": "1.1.3",
|
|
5
|
+
"@domicile-desktop/manganese-window-management": "2.0.0",
|
|
6
|
+
"@pandacss/dev": "^1.12.2",
|
|
7
|
+
"react": "^19.3.1"
|
|
8
8
|
},
|
|
9
9
|
"description": "A manganese bar item: the screen's workspaces.",
|
|
10
10
|
"devDependencies": {
|
|
11
11
|
"@cprussin/tsconfig": "^5.0.0",
|
|
12
12
|
"@domicile-desktop/test-support": "0.0.2",
|
|
13
|
-
"@pandacss/preset-panda": "^1.12.
|
|
13
|
+
"@pandacss/preset-panda": "^1.12.2",
|
|
14
14
|
"@testing-library/react": "^16.3.3",
|
|
15
|
-
"@testing-library/user-event": "^14.6.
|
|
16
|
-
"@types/bun": "^1.4.
|
|
17
|
-
"@types/react": "^19.
|
|
18
|
-
"@types/react-dom": "^19.
|
|
19
|
-
"postcss": "^8.5.
|
|
15
|
+
"@testing-library/user-event": "^14.6.10",
|
|
16
|
+
"@types/bun": "^1.4.4",
|
|
17
|
+
"@types/react": "^19.3.0",
|
|
18
|
+
"@types/react-dom": "^19.3.0",
|
|
19
|
+
"postcss": "^8.5.32",
|
|
20
20
|
"typescript": "^7.0.2"
|
|
21
21
|
},
|
|
22
22
|
"engines": {
|
|
23
|
-
"bun": ">=1.4.2"
|
|
24
|
-
"node": ">=24"
|
|
23
|
+
"bun": ">=1.4.2"
|
|
25
24
|
},
|
|
26
25
|
"exports": {
|
|
27
26
|
".": "./src/bar-item.tsx"
|
|
@@ -49,5 +48,5 @@
|
|
|
49
48
|
"test:unit": "bun test"
|
|
50
49
|
},
|
|
51
50
|
"type": "module",
|
|
52
|
-
"version": "1.
|
|
51
|
+
"version": "1.2.1"
|
|
53
52
|
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { AnimatedSquaresIcon } from "@domicile-desktop/component-library/AnimatedSquaresIcon";
|
|
2
|
+
import { Tooltip } from "@domicile-desktop/component-library/Tooltip";
|
|
3
|
+
|
|
4
|
+
import { css } from "../styled-system/css";
|
|
5
|
+
|
|
6
|
+
type Props = {
|
|
7
|
+
/** Opens or closes the overview. */
|
|
8
|
+
onToggle: () => void;
|
|
9
|
+
/** Whether the overview is open, which keeps the button lit. */
|
|
10
|
+
open: boolean;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* The switcher's overview button, the pointer equivalent of Meta+O: each
|
|
15
|
+
* screen's workspaces at once.
|
|
16
|
+
*/
|
|
17
|
+
export const OverviewButton = ({ onToggle, open }: Props) => (
|
|
18
|
+
<Tooltip
|
|
19
|
+
content="Overview"
|
|
20
|
+
tone="overPhoto"
|
|
21
|
+
trigger={
|
|
22
|
+
<button
|
|
23
|
+
aria-label="Overview"
|
|
24
|
+
aria-pressed={open}
|
|
25
|
+
className={buttonStyles}
|
|
26
|
+
onClick={onToggle}
|
|
27
|
+
type="button"
|
|
28
|
+
>
|
|
29
|
+
<AnimatedSquaresIcon size={15} />
|
|
30
|
+
</button>
|
|
31
|
+
}
|
|
32
|
+
/>
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
// Styled like the launcher button, and lit like a bar button whose panel is
|
|
36
|
+
// open.
|
|
37
|
+
const buttonStyles = css({
|
|
38
|
+
_hover: { backgroundColor: "fillOverPhoto" },
|
|
39
|
+
"&[aria-pressed=true]": { backgroundColor: "fillOverPhoto" },
|
|
40
|
+
alignItems: "center",
|
|
41
|
+
backgroundColor: "transparent",
|
|
42
|
+
blockSize: 7,
|
|
43
|
+
borderRadius: "lg",
|
|
44
|
+
borderStyle: "none",
|
|
45
|
+
cursor: "pointer",
|
|
46
|
+
display: "inline-flex",
|
|
47
|
+
flexShrink: 0,
|
|
48
|
+
inlineSize: 7,
|
|
49
|
+
justifyContent: "center",
|
|
50
|
+
padding: 0,
|
|
51
|
+
transition: "background-color {durations.fast} {easings.default}",
|
|
52
|
+
});
|
package/src/Workspaces.tsx
CHANGED
|
@@ -1,11 +1,28 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { CSSProperties } from "react";
|
|
2
|
+
import { useLayoutEffect, useRef, useState } from "react";
|
|
3
|
+
|
|
4
|
+
import { css, cva, cx } from "../styled-system/css";
|
|
2
5
|
import { hstack } from "../styled-system/patterns";
|
|
3
6
|
|
|
7
|
+
/** A chip's distance from the row's start and its width, in px. */
|
|
8
|
+
export type Place = { start: number; width: number };
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Calls `onPlace` with `chip`'s place in its row once the row is laid out and
|
|
12
|
+
* whenever its layout changes, until the returned function stops it.
|
|
13
|
+
*/
|
|
14
|
+
export type MeasureChip = (
|
|
15
|
+
chip: HTMLElement,
|
|
16
|
+
onPlace: (place: Place) => void,
|
|
17
|
+
) => () => void;
|
|
18
|
+
|
|
4
19
|
type Props = {
|
|
5
20
|
/** The workspace this screen shows. */
|
|
6
21
|
current: string;
|
|
7
22
|
/** Whether this screen has keyboard focus, which decides `current`'s fill. */
|
|
8
23
|
focused: boolean;
|
|
24
|
+
/** Injectable for tests; defaults to a `ResizeObserver` on the row. */
|
|
25
|
+
measureChip?: MeasureChip | undefined;
|
|
9
26
|
onSelect: (name: string) => void;
|
|
10
27
|
/** This screen's workspaces, in order. */
|
|
11
28
|
workspaces: readonly string[];
|
|
@@ -15,9 +32,13 @@ type Props = {
|
|
|
15
32
|
* The workspace switcher at the bar's start. Like sway's bar, it shows this
|
|
16
33
|
* screen's workspaces that have windows, plus the one on screen.
|
|
17
34
|
*
|
|
18
|
-
* Each is a number. The focused workspace
|
|
19
|
-
* out over a bright wallpaper; one visible on another screen gets a
|
|
20
|
-
* outline; the rest are slightly dimmed and light up under the pointer.
|
|
35
|
+
* Each is a number. The focused workspace sits under a solid white chip, so it
|
|
36
|
+
* stands out over a bright wallpaper; one visible on another screen gets a
|
|
37
|
+
* white outline; the rest are slightly dimmed and light up under the pointer.
|
|
38
|
+
*
|
|
39
|
+
* The white chip slides between workspaces. It is a black copy of the row on
|
|
40
|
+
* white, clipped to the chip, so each number turns black as the chip passes
|
|
41
|
+
* under it.
|
|
21
42
|
*
|
|
22
43
|
* A plain `<button>` rather than the library's `Button`, which does not support
|
|
23
44
|
* `aria-current` styling or an external `className`. It inherits the bar's
|
|
@@ -26,60 +47,144 @@ type Props = {
|
|
|
26
47
|
export const Workspaces = ({
|
|
27
48
|
current,
|
|
28
49
|
focused,
|
|
50
|
+
measureChip = offsetPlace,
|
|
29
51
|
onSelect,
|
|
30
52
|
workspaces,
|
|
31
|
-
}: Props) =>
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
<button
|
|
35
|
-
// `aria-current` marks the visible workspace. `disabled` would be
|
|
36
|
-
// wrong: a press on it switches back via `workspaceAutoBackAndForth`.
|
|
37
|
-
aria-current={name === current ? "true" : undefined}
|
|
38
|
-
className={workspaceStyles({
|
|
39
|
-
shown: shownAs(name === current, focused),
|
|
40
|
-
})}
|
|
41
|
-
key={name}
|
|
42
|
-
onClick={() => {
|
|
43
|
-
onSelect(name);
|
|
44
|
-
}}
|
|
45
|
-
type="button"
|
|
46
|
-
>
|
|
47
|
-
{name}
|
|
48
|
-
</button>
|
|
49
|
-
))}
|
|
50
|
-
</nav>
|
|
51
|
-
);
|
|
53
|
+
}: Props) => {
|
|
54
|
+
const chips = useRef(new Map<string, HTMLButtonElement>());
|
|
55
|
+
const [place, setPlace] = useState<Place>();
|
|
52
56
|
|
|
53
|
-
|
|
57
|
+
useLayoutEffect(() => {
|
|
58
|
+
const chip = chips.current.get(current);
|
|
59
|
+
if (chip === undefined) {
|
|
60
|
+
throw new Error(`manganese: workspace ${current} is not in the bar`);
|
|
61
|
+
}
|
|
62
|
+
return measureChip(chip, setPlace);
|
|
63
|
+
}, [current, measureChip]);
|
|
64
|
+
|
|
65
|
+
return (
|
|
66
|
+
<nav aria-label="Workspaces" className={listStyles}>
|
|
67
|
+
{workspaces.map((name) => (
|
|
68
|
+
<button
|
|
69
|
+
// `aria-current` marks the visible workspace. `disabled` would be
|
|
70
|
+
// wrong: a press on it switches back via `workspaceAutoBackAndForth`.
|
|
71
|
+
aria-current={name === current ? "true" : undefined}
|
|
72
|
+
className={cx(
|
|
73
|
+
chipStyles,
|
|
74
|
+
workspaceStyles({ shown: shownAs(name === current, focused) }),
|
|
75
|
+
)}
|
|
76
|
+
data-label={name}
|
|
77
|
+
key={name}
|
|
78
|
+
onClick={() => {
|
|
79
|
+
onSelect(name);
|
|
80
|
+
}}
|
|
81
|
+
ref={(chip) => {
|
|
82
|
+
if (chip === null) {
|
|
83
|
+
chips.current.delete(name);
|
|
84
|
+
} else {
|
|
85
|
+
chips.current.set(name, chip);
|
|
86
|
+
}
|
|
87
|
+
}}
|
|
88
|
+
type="button"
|
|
89
|
+
>
|
|
90
|
+
<span className={labelStyles}>{name}</span>
|
|
91
|
+
</button>
|
|
92
|
+
))}
|
|
93
|
+
{place !== undefined && (
|
|
94
|
+
<div
|
|
95
|
+
aria-hidden="true"
|
|
96
|
+
className={highlightStyles}
|
|
97
|
+
data-shown={focused}
|
|
98
|
+
data-testid="highlight"
|
|
99
|
+
style={
|
|
100
|
+
{
|
|
101
|
+
"--highlight-start": `${place.start}px`,
|
|
102
|
+
"--highlight-width": `${place.width}px`,
|
|
103
|
+
} as CSSProperties
|
|
104
|
+
}
|
|
105
|
+
>
|
|
106
|
+
{workspaces.map((name) => (
|
|
107
|
+
<span className={chipStyles} data-label={name} key={name}>
|
|
108
|
+
<span className={labelStyles}>{name}</span>
|
|
109
|
+
</span>
|
|
110
|
+
))}
|
|
111
|
+
</div>
|
|
112
|
+
)}
|
|
113
|
+
</nav>
|
|
114
|
+
);
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* `MeasureChip` from offsets, whenever the row resizes. Starts with the
|
|
119
|
+
* observer's first callback, after the frame's layout, rather than reading
|
|
120
|
+
* offsets now: a read while React commits a workspace switch would restyle
|
|
121
|
+
* and lay out the whole desk at once, stalling the slide's first frame.
|
|
122
|
+
*/
|
|
123
|
+
const offsetPlace: MeasureChip = (chip, onPlace) => {
|
|
124
|
+
const row = chip.parentElement;
|
|
125
|
+
if (row === null) {
|
|
126
|
+
throw new Error("manganese: workspace chip has no row");
|
|
127
|
+
}
|
|
128
|
+
const observer = new ResizeObserver(() => {
|
|
129
|
+
onPlace({
|
|
130
|
+
start: chip.offsetLeft,
|
|
131
|
+
width: chip.offsetWidth,
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
observer.observe(row);
|
|
135
|
+
return () => {
|
|
136
|
+
observer.disconnect();
|
|
137
|
+
};
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
// Relative, so the chips' offsets and the highlight are from the row.
|
|
141
|
+
const listStyles = hstack({ gap: 0.5, position: "relative" });
|
|
142
|
+
|
|
143
|
+
// The number and a hidden bold copy share one cell, so every chip is as wide
|
|
144
|
+
// as its bold number and the highlight's bold copy lines up with the row.
|
|
145
|
+
const chipStyles = css({
|
|
146
|
+
_after: {
|
|
147
|
+
blockSize: 0,
|
|
148
|
+
content: "attr(data-label)",
|
|
149
|
+
fontWeight: "semibold",
|
|
150
|
+
gridArea: "1 / 1",
|
|
151
|
+
overflow: "hidden",
|
|
152
|
+
visibility: "hidden",
|
|
153
|
+
},
|
|
154
|
+
alignItems: "center",
|
|
155
|
+
blockSize: 6,
|
|
156
|
+
borderRadius: "lg",
|
|
157
|
+
display: "grid",
|
|
158
|
+
// 13px, matching the clock.
|
|
159
|
+
fontSize: "ui",
|
|
160
|
+
// Tabular figures keep every number the same width.
|
|
161
|
+
fontVariantNumeric: "tabular-nums",
|
|
162
|
+
// Only matters where `text-box` trim is unsupported.
|
|
163
|
+
lineHeight: "tight",
|
|
164
|
+
minInlineSize: 6,
|
|
165
|
+
paddingBlock: 0,
|
|
166
|
+
paddingInline: 2,
|
|
167
|
+
textAlign: "center",
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
const labelStyles = css({
|
|
171
|
+
gridArea: "1 / 1",
|
|
172
|
+
// Center vertically. Trimming the line box to cap height and baseline
|
|
173
|
+
// leaves only the glyph, so the digit sits centered rather than high.
|
|
174
|
+
textBox: "trim-both cap alphabetic",
|
|
175
|
+
});
|
|
54
176
|
|
|
55
177
|
const workspaceStyles = cva({
|
|
56
178
|
base: {
|
|
57
179
|
// Skips `aria-current`, so the chip keeps its fill under the pointer.
|
|
58
180
|
_hoverEnabled: { backgroundColor: "fillOverPhoto", color: "onPhoto" },
|
|
59
181
|
backgroundColor: "transparent",
|
|
60
|
-
blockSize: 6,
|
|
61
|
-
borderRadius: "lg",
|
|
62
182
|
borderStyle: "none",
|
|
63
183
|
color: "color-mix(in oklab, {colors.onPhoto} 85%, transparent)",
|
|
64
184
|
cursor: "pointer",
|
|
65
|
-
// A block, not flex: `text-box` trim below works only on block containers.
|
|
66
|
-
display: "block",
|
|
67
|
-
// 13px, matching the clock.
|
|
68
|
-
fontSize: "ui",
|
|
69
|
-
// Tabular figures keep every number the same width.
|
|
70
|
-
fontVariantNumeric: "tabular-nums",
|
|
71
185
|
fontWeight: "medium",
|
|
72
|
-
// Only matters where `text-box` trim is unsupported.
|
|
73
|
-
lineHeight: "tight",
|
|
74
|
-
minInlineSize: 6,
|
|
75
|
-
paddingBlock: 0,
|
|
76
|
-
paddingInline: 2,
|
|
77
186
|
// Pressed feedback that is not just color.
|
|
78
187
|
scale: { _active: 0.92, base: 1 },
|
|
79
|
-
textAlign: "center",
|
|
80
|
-
// Center vertically. Trimming the line box to cap height and baseline
|
|
81
|
-
// leaves only the glyph, so the digit sits centered rather than high.
|
|
82
|
-
textBox: "trim-both cap alphabetic",
|
|
83
188
|
transition: `
|
|
84
189
|
background-color {durations.fast} {easings.out},
|
|
85
190
|
color {durations.fast} {easings.out},
|
|
@@ -88,13 +193,8 @@ const workspaceStyles = cva({
|
|
|
88
193
|
},
|
|
89
194
|
variants: {
|
|
90
195
|
shown: {
|
|
91
|
-
//
|
|
92
|
-
focused: {
|
|
93
|
-
backgroundColor: "onPhoto",
|
|
94
|
-
color: "black",
|
|
95
|
-
fontWeight: "semibold",
|
|
96
|
-
textShadow: "none",
|
|
97
|
-
},
|
|
196
|
+
// Under the highlight, which draws it.
|
|
197
|
+
focused: { color: "onPhoto", fontWeight: "semibold" },
|
|
98
198
|
hidden: {},
|
|
99
199
|
// Visible on another screen: an outline, 1.5px, between the spacing
|
|
100
200
|
// scale's 1px and 2px steps.
|
|
@@ -107,6 +207,35 @@ const workspaceStyles = cva({
|
|
|
107
207
|
},
|
|
108
208
|
});
|
|
109
209
|
|
|
210
|
+
// A copy of the row over it, clipped to the current chip. `outBack` overshoots
|
|
211
|
+
// the chip a little and settles back. Black needs no shadow, and one would
|
|
212
|
+
// smudge it.
|
|
213
|
+
const highlightStyles = css({
|
|
214
|
+
"&[data-shown=false]": { opacity: 0 },
|
|
215
|
+
alignItems: "center",
|
|
216
|
+
backgroundColor: "onPhoto",
|
|
217
|
+
// From the start edge only, so the chip slides smoothly while a workspace
|
|
218
|
+
// comes or goes at the row's end and the row's width jumps.
|
|
219
|
+
clipPath:
|
|
220
|
+
"xywh(calc(var(--highlight-start) + {spacing.10}) 0 var(--highlight-width) 100% round {radii.lg})",
|
|
221
|
+
color: "black",
|
|
222
|
+
display: "flex",
|
|
223
|
+
fontWeight: "semibold",
|
|
224
|
+
gap: 0.5,
|
|
225
|
+
insetBlock: 0,
|
|
226
|
+
// Past both ends of the row, so a bounce past the first or last chip is
|
|
227
|
+
// not cut flat.
|
|
228
|
+
insetInline: -10,
|
|
229
|
+
paddingInline: 10,
|
|
230
|
+
pointerEvents: "none",
|
|
231
|
+
position: "absolute",
|
|
232
|
+
textShadow: "none",
|
|
233
|
+
transition: `
|
|
234
|
+
clip-path {durations.slower} {easings.outBack},
|
|
235
|
+
opacity {durations.fast} {easings.out}
|
|
236
|
+
`,
|
|
237
|
+
});
|
|
238
|
+
|
|
110
239
|
const shownAs = (
|
|
111
240
|
current: boolean,
|
|
112
241
|
focused: boolean,
|
package/src/bar-item.tsx
CHANGED
|
@@ -2,23 +2,33 @@ import { useBar } from "@domicile-desktop/manganese-bar/bar-context";
|
|
|
2
2
|
import { workspacesOn } from "@domicile-desktop/manganese-window-management/window-state";
|
|
3
3
|
import { useWorkspaces } from "@domicile-desktop/manganese-window-management/workspaces-context";
|
|
4
4
|
import { useMemo } from "react";
|
|
5
|
+
|
|
6
|
+
import { hstack } from "../styled-system/patterns";
|
|
7
|
+
import { OverviewButton } from "./OverviewButton";
|
|
5
8
|
import { Workspaces } from "./Workspaces";
|
|
6
9
|
|
|
7
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* The overview button, then this screen's workspaces, with the visible one
|
|
12
|
+
* marked.
|
|
13
|
+
*/
|
|
8
14
|
export const WorkspaceSwitcher = () => {
|
|
9
15
|
const { screen } = useBar();
|
|
10
|
-
const { current, focused, homes, select } =
|
|
16
|
+
const { current, focused, homes, overviewOpen, select, toggleOverview } =
|
|
17
|
+
useWorkspaces();
|
|
11
18
|
const workspaces = useMemo(
|
|
12
19
|
() => workspacesOn({ homes }, screen),
|
|
13
20
|
[homes, screen],
|
|
14
21
|
);
|
|
15
22
|
return (
|
|
16
|
-
<
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
23
|
+
<div className={rowStyles}>
|
|
24
|
+
<OverviewButton onToggle={toggleOverview} open={overviewOpen} />
|
|
25
|
+
<Workspaces
|
|
26
|
+
current={shownOn(current, screen)}
|
|
27
|
+
focused={focused === screen}
|
|
28
|
+
onSelect={select}
|
|
29
|
+
workspaces={workspaces}
|
|
30
|
+
/>
|
|
31
|
+
</div>
|
|
22
32
|
);
|
|
23
33
|
};
|
|
24
34
|
|
|
@@ -34,3 +44,5 @@ const shownOn = (
|
|
|
34
44
|
return workspace;
|
|
35
45
|
}
|
|
36
46
|
};
|
|
47
|
+
|
|
48
|
+
const rowStyles = hstack({ gap: 1 });
|
|
@@ -3,11 +3,11 @@ import { css } from '../css/index.mjs';
|
|
|
3
3
|
|
|
4
4
|
const aspectRatioConfig = {
|
|
5
5
|
transform(props, { map }) {
|
|
6
|
-
const { ratio =
|
|
6
|
+
const { ratio = 1.3333333333333333, ...rest } = props;
|
|
7
7
|
return {
|
|
8
8
|
position: "relative",
|
|
9
9
|
_before: {
|
|
10
|
-
content:
|
|
10
|
+
content: '""',
|
|
11
11
|
display: "block",
|
|
12
12
|
height: "0",
|
|
13
13
|
paddingBottom: map(ratio, (r) => `${1 / r * 100}%`)
|
|
@@ -3,8 +3,7 @@ import { css } from '../css/index.mjs';
|
|
|
3
3
|
|
|
4
4
|
const bleedConfig = {
|
|
5
5
|
transform(props, { map, isCssUnit, isCssVar }) {
|
|
6
|
-
const { inline, block, ...rest } = props
|
|
7
|
-
const valueFn = (v) => isCssUnit(v) || isCssVar(v) ? v : `token(spacing.${v}, ${v})`;
|
|
6
|
+
const { inline, block, ...rest } = props, valueFn = (v) => isCssUnit(v) || isCssVar(v) ? v : `token(spacing.${v}, ${v})`;
|
|
8
7
|
return {
|
|
9
8
|
"--bleed-x": map(inline, valueFn),
|
|
10
9
|
"--bleed-y": map(block, valueFn),
|
|
@@ -11,28 +11,22 @@ transform(props, { map }) {
|
|
|
11
11
|
position: "absolute",
|
|
12
12
|
insetBlockStart: map(placement, (v) => {
|
|
13
13
|
const [side] = v.split("-");
|
|
14
|
-
|
|
15
|
-
return map2[side];
|
|
14
|
+
return { top: offsetY, middle: "50%", bottom: "auto" }[side];
|
|
16
15
|
}),
|
|
17
16
|
insetBlockEnd: map(placement, (v) => {
|
|
18
17
|
const [side] = v.split("-");
|
|
19
|
-
|
|
20
|
-
return map2[side];
|
|
18
|
+
return { top: "auto", middle: "50%", bottom: offsetY }[side];
|
|
21
19
|
}),
|
|
22
20
|
insetInlineStart: map(placement, (v) => {
|
|
23
21
|
const [, align] = v.split("-");
|
|
24
|
-
|
|
25
|
-
return map2[align];
|
|
22
|
+
return { start: offsetX, center: "50%", end: "auto" }[align];
|
|
26
23
|
}),
|
|
27
24
|
insetInlineEnd: map(placement, (v) => {
|
|
28
25
|
const [, align] = v.split("-");
|
|
29
|
-
|
|
30
|
-
return map2[align];
|
|
26
|
+
return { start: "auto", center: "50%", end: offsetX }[align];
|
|
31
27
|
}),
|
|
32
28
|
translate: map(placement, (v) => {
|
|
33
|
-
const [side, align] = v.split("-");
|
|
34
|
-
const mapX = { start: "-50%", center: "-50%", end: "50%" };
|
|
35
|
-
const mapY = { top: "-50%", middle: "-50%", bottom: "50%" };
|
|
29
|
+
const [side, align] = v.split("-"), mapX = { start: "-50%", center: "-50%", end: "50%" }, mapY = { top: "-50%", middle: "-50%", bottom: "50%" };
|
|
36
30
|
return `${mapX[align]} ${mapY[side]}`;
|
|
37
31
|
}),
|
|
38
32
|
...rest
|
|
@@ -3,8 +3,7 @@ import { css } from '../css/index.mjs';
|
|
|
3
3
|
|
|
4
4
|
const gridItemConfig = {
|
|
5
5
|
transform(props, { map }) {
|
|
6
|
-
const { colSpan, rowSpan, colStart, rowStart, colEnd, rowEnd, ...rest } = props
|
|
7
|
-
const spanFn = (v) => v === "auto" ? v : `span ${v}`;
|
|
6
|
+
const { colSpan, rowSpan, colStart, rowStart, colEnd, rowEnd, ...rest } = props, spanFn = (v) => v === "auto" ? v : `span ${v}`;
|
|
8
7
|
return {
|
|
9
8
|
gridColumn: colSpan != null ? map(colSpan, spanFn) : void 0,
|
|
10
9
|
gridRow: rowSpan != null ? map(rowSpan, spanFn) : void 0,
|
|
@@ -3,8 +3,7 @@ import { css } from '../css/index.mjs';
|
|
|
3
3
|
|
|
4
4
|
const gridConfig = {
|
|
5
5
|
transform(props, { map, isCssUnit }) {
|
|
6
|
-
const { columnGap, rowGap, gap, columns, minChildWidth, ...rest } = props
|
|
7
|
-
const getValue = (v) => isCssUnit(v) ? v : `token(sizes.${v}, ${v})`;
|
|
6
|
+
const { columnGap, rowGap, gap, columns, minChildWidth, ...rest } = props, getValue = (v) => isCssUnit(v) ? v : `token(sizes.${v}, ${v})`;
|
|
8
7
|
return {
|
|
9
8
|
display: "grid",
|
|
10
9
|
gridTemplateColumns: columns != null ? map(columns, (v) => `repeat(${v}, minmax(0, 1fr))`) : minChildWidth != null ? map(minChildWidth, (v) => `repeat(auto-fit, minmax(${getValue(v)}, 1fr))`) : void 0,
|
|
@@ -8,9 +8,9 @@ transform(props, { map, isCssUnit, isCssVar }) {
|
|
|
8
8
|
alignSelf: "stretch",
|
|
9
9
|
justifySelf: "stretch",
|
|
10
10
|
flex: map(size, (v) => {
|
|
11
|
-
if (v == null)
|
|
12
|
-
|
|
13
|
-
return `0 0 ${
|
|
11
|
+
if (v == null)
|
|
12
|
+
return "1";
|
|
13
|
+
return `0 0 ${isCssUnit(v) || isCssVar(v) ? v : `token(spacing.${v}, ${v})`}`;
|
|
14
14
|
}),
|
|
15
15
|
...rest
|
|
16
16
|
};
|
|
@@ -33504,15 +33504,15 @@ const tokens = {
|
|
|
33504
33504
|
"variable": "var(--jRjWKm)"
|
|
33505
33505
|
},
|
|
33506
33506
|
"zIndex.lock": {
|
|
33507
|
-
"value": "
|
|
33507
|
+
"value": "2147483647",
|
|
33508
33508
|
"variable": "var(--fkMZTt)"
|
|
33509
33509
|
},
|
|
33510
33510
|
"zIndex.modal": {
|
|
33511
|
-
"value": "
|
|
33511
|
+
"value": "2147483646",
|
|
33512
33512
|
"variable": "var(--dIktSh)"
|
|
33513
33513
|
},
|
|
33514
33514
|
"zIndex.modalBackdrop": {
|
|
33515
|
-
"value": "
|
|
33515
|
+
"value": "2147483645",
|
|
33516
33516
|
"variable": "var(--jXaBXH)"
|
|
33517
33517
|
},
|
|
33518
33518
|
"zIndex.toast": {
|
|
@@ -33595,6 +33595,10 @@ const tokens = {
|
|
|
33595
33595
|
"value": "var(--dIlxIZ)",
|
|
33596
33596
|
"variable": "var(--dIlxIZ)"
|
|
33597
33597
|
},
|
|
33598
|
+
"colors.onDanger": {
|
|
33599
|
+
"value": "white",
|
|
33600
|
+
"variable": "var(--hgeHO)"
|
|
33601
|
+
},
|
|
33598
33602
|
"colors.onPhoto": {
|
|
33599
33603
|
"value": "white",
|
|
33600
33604
|
"variable": "var(--cFzlNp)"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
2
|
export type Token = `aspectRatios.${AspectRatioToken}` | `borders.${BorderToken}` | `radii.${RadiusToken}` | `fontWeights.${FontWeightToken}` | `lineHeights.${LineHeightToken}` | `letterSpacings.${LetterSpacingToken}` | `shadows.${ShadowToken}` | `colors.${ColorToken}` | `blurs.${BlurToken}` | `animations.${AnimationToken}` | `borderWidths.${BorderWidthToken}` | `durations.${DurationToken}` | `easings.${EasingToken}` | `fontSizes.${FontSizeToken}` | `fonts.${FontToken}` | `gradients.${GradientToken}` | `opacity.${OpacityToken}` | `sizes.${SizeToken}` | `spacing.${SpacingToken}` | `zIndex.${ZIndexToken}` | `breakpoints.${BreakpointToken}`
|
|
3
3
|
|
|
4
|
-
export type ColorPalette = "current" | "black" | "white" | "transparent" | "rose" | "pink" | "fuchsia" | "purple" | "violet" | "indigo" | "blue" | "sky" | "cyan" | "teal" | "emerald" | "green" | "lime" | "yellow" | "amber" | "orange" | "red" | "neutral" | "stone" | "zinc" | "gray" | "slate" | "accent" | "backdrop" | "background" | "border" | "borderStrong" | "card" | "danger" | "dangerSoft" | "divider" | "fill" | "fillHover" | "fillOverPhoto" | "foreground" | "muted" | "onPhoto" | "panelOverPhoto" | "private" | "skeleton" | "success" | "textFaint" | "textSoft" | "warning"
|
|
4
|
+
export type ColorPalette = "current" | "black" | "white" | "transparent" | "rose" | "pink" | "fuchsia" | "purple" | "violet" | "indigo" | "blue" | "sky" | "cyan" | "teal" | "emerald" | "green" | "lime" | "yellow" | "amber" | "orange" | "red" | "neutral" | "stone" | "zinc" | "gray" | "slate" | "accent" | "backdrop" | "background" | "border" | "borderStrong" | "card" | "danger" | "dangerSoft" | "divider" | "fill" | "fillHover" | "fillOverPhoto" | "foreground" | "muted" | "onDanger" | "onPhoto" | "panelOverPhoto" | "private" | "skeleton" | "success" | "textFaint" | "textSoft" | "warning"
|
|
5
5
|
|
|
6
6
|
export type AspectRatioToken = "square" | "landscape" | "portrait" | "wide" | "ultrawide" | "golden"
|
|
7
7
|
|
|
@@ -17,7 +17,7 @@ export type LetterSpacingToken = "tighter" | "tight" | "normal" | "wide" | "wide
|
|
|
17
17
|
|
|
18
18
|
export type ShadowToken = "2xs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "inset-2xs" | "inset-xs" | "inset-sm" | "lifted" | "modal" | "textOverPhoto"
|
|
19
19
|
|
|
20
|
-
export type ColorToken = "current" | "black" | "white" | "transparent" | "rose.50" | "rose.100" | "rose.200" | "rose.300" | "rose.400" | "rose.500" | "rose.600" | "rose.700" | "rose.800" | "rose.900" | "rose.950" | "pink.50" | "pink.100" | "pink.200" | "pink.300" | "pink.400" | "pink.500" | "pink.600" | "pink.700" | "pink.800" | "pink.900" | "pink.950" | "fuchsia.50" | "fuchsia.100" | "fuchsia.200" | "fuchsia.300" | "fuchsia.400" | "fuchsia.500" | "fuchsia.600" | "fuchsia.700" | "fuchsia.800" | "fuchsia.900" | "fuchsia.950" | "purple.50" | "purple.100" | "purple.200" | "purple.300" | "purple.400" | "purple.500" | "purple.600" | "purple.700" | "purple.800" | "purple.900" | "purple.950" | "violet.50" | "violet.100" | "violet.200" | "violet.300" | "violet.400" | "violet.500" | "violet.600" | "violet.700" | "violet.800" | "violet.900" | "violet.950" | "indigo.50" | "indigo.100" | "indigo.200" | "indigo.300" | "indigo.400" | "indigo.500" | "indigo.600" | "indigo.700" | "indigo.800" | "indigo.900" | "indigo.950" | "blue.50" | "blue.100" | "blue.200" | "blue.300" | "blue.400" | "blue.500" | "blue.600" | "blue.700" | "blue.800" | "blue.900" | "blue.950" | "sky.50" | "sky.100" | "sky.200" | "sky.300" | "sky.400" | "sky.500" | "sky.600" | "sky.700" | "sky.800" | "sky.900" | "sky.950" | "cyan.50" | "cyan.100" | "cyan.200" | "cyan.300" | "cyan.400" | "cyan.500" | "cyan.600" | "cyan.700" | "cyan.800" | "cyan.900" | "cyan.950" | "teal.50" | "teal.100" | "teal.200" | "teal.300" | "teal.400" | "teal.500" | "teal.600" | "teal.700" | "teal.800" | "teal.900" | "teal.950" | "emerald.50" | "emerald.100" | "emerald.200" | "emerald.300" | "emerald.400" | "emerald.500" | "emerald.600" | "emerald.700" | "emerald.800" | "emerald.900" | "emerald.950" | "green.50" | "green.100" | "green.200" | "green.300" | "green.400" | "green.500" | "green.600" | "green.700" | "green.800" | "green.900" | "green.950" | "lime.50" | "lime.100" | "lime.200" | "lime.300" | "lime.400" | "lime.500" | "lime.600" | "lime.700" | "lime.800" | "lime.900" | "lime.950" | "yellow.50" | "yellow.100" | "yellow.200" | "yellow.300" | "yellow.400" | "yellow.500" | "yellow.600" | "yellow.700" | "yellow.800" | "yellow.900" | "yellow.950" | "amber.50" | "amber.100" | "amber.200" | "amber.300" | "amber.400" | "amber.500" | "amber.600" | "amber.700" | "amber.800" | "amber.900" | "amber.950" | "orange.50" | "orange.100" | "orange.200" | "orange.300" | "orange.400" | "orange.500" | "orange.600" | "orange.700" | "orange.800" | "orange.900" | "orange.950" | "red.50" | "red.100" | "red.200" | "red.300" | "red.400" | "red.500" | "red.600" | "red.700" | "red.800" | "red.900" | "red.950" | "neutral.50" | "neutral.100" | "neutral.200" | "neutral.300" | "neutral.400" | "neutral.500" | "neutral.600" | "neutral.700" | "neutral.800" | "neutral.900" | "neutral.950" | "stone.50" | "stone.100" | "stone.200" | "stone.300" | "stone.400" | "stone.500" | "stone.600" | "stone.700" | "stone.800" | "stone.900" | "stone.950" | "zinc.50" | "zinc.100" | "zinc.200" | "zinc.300" | "zinc.400" | "zinc.500" | "zinc.600" | "zinc.700" | "zinc.800" | "zinc.900" | "zinc.950" | "gray.50" | "gray.100" | "gray.200" | "gray.300" | "gray.400" | "gray.500" | "gray.600" | "gray.700" | "gray.800" | "gray.900" | "gray.950" | "slate.50" | "slate.100" | "slate.200" | "slate.300" | "slate.400" | "slate.500" | "slate.600" | "slate.700" | "slate.800" | "slate.900" | "slate.950" | "accent" | "backdrop" | "background" | "border" | "borderStrong" | "card" | "danger" | "dangerSoft" | "divider" | "fill" | "fillHover" | "fillOverPhoto" | "foreground" | "muted" | "onPhoto" | "panelOverPhoto" | "private" | "skeleton" | "success" | "textFaint" | "textSoft" | "warning" | "colorPalette" | "colorPalette.50" | "colorPalette.100" | "colorPalette.200" | "colorPalette.300" | "colorPalette.400" | "colorPalette.500" | "colorPalette.600" | "colorPalette.700" | "colorPalette.800" | "colorPalette.900" | "colorPalette.950"
|
|
20
|
+
export type ColorToken = "current" | "black" | "white" | "transparent" | "rose.50" | "rose.100" | "rose.200" | "rose.300" | "rose.400" | "rose.500" | "rose.600" | "rose.700" | "rose.800" | "rose.900" | "rose.950" | "pink.50" | "pink.100" | "pink.200" | "pink.300" | "pink.400" | "pink.500" | "pink.600" | "pink.700" | "pink.800" | "pink.900" | "pink.950" | "fuchsia.50" | "fuchsia.100" | "fuchsia.200" | "fuchsia.300" | "fuchsia.400" | "fuchsia.500" | "fuchsia.600" | "fuchsia.700" | "fuchsia.800" | "fuchsia.900" | "fuchsia.950" | "purple.50" | "purple.100" | "purple.200" | "purple.300" | "purple.400" | "purple.500" | "purple.600" | "purple.700" | "purple.800" | "purple.900" | "purple.950" | "violet.50" | "violet.100" | "violet.200" | "violet.300" | "violet.400" | "violet.500" | "violet.600" | "violet.700" | "violet.800" | "violet.900" | "violet.950" | "indigo.50" | "indigo.100" | "indigo.200" | "indigo.300" | "indigo.400" | "indigo.500" | "indigo.600" | "indigo.700" | "indigo.800" | "indigo.900" | "indigo.950" | "blue.50" | "blue.100" | "blue.200" | "blue.300" | "blue.400" | "blue.500" | "blue.600" | "blue.700" | "blue.800" | "blue.900" | "blue.950" | "sky.50" | "sky.100" | "sky.200" | "sky.300" | "sky.400" | "sky.500" | "sky.600" | "sky.700" | "sky.800" | "sky.900" | "sky.950" | "cyan.50" | "cyan.100" | "cyan.200" | "cyan.300" | "cyan.400" | "cyan.500" | "cyan.600" | "cyan.700" | "cyan.800" | "cyan.900" | "cyan.950" | "teal.50" | "teal.100" | "teal.200" | "teal.300" | "teal.400" | "teal.500" | "teal.600" | "teal.700" | "teal.800" | "teal.900" | "teal.950" | "emerald.50" | "emerald.100" | "emerald.200" | "emerald.300" | "emerald.400" | "emerald.500" | "emerald.600" | "emerald.700" | "emerald.800" | "emerald.900" | "emerald.950" | "green.50" | "green.100" | "green.200" | "green.300" | "green.400" | "green.500" | "green.600" | "green.700" | "green.800" | "green.900" | "green.950" | "lime.50" | "lime.100" | "lime.200" | "lime.300" | "lime.400" | "lime.500" | "lime.600" | "lime.700" | "lime.800" | "lime.900" | "lime.950" | "yellow.50" | "yellow.100" | "yellow.200" | "yellow.300" | "yellow.400" | "yellow.500" | "yellow.600" | "yellow.700" | "yellow.800" | "yellow.900" | "yellow.950" | "amber.50" | "amber.100" | "amber.200" | "amber.300" | "amber.400" | "amber.500" | "amber.600" | "amber.700" | "amber.800" | "amber.900" | "amber.950" | "orange.50" | "orange.100" | "orange.200" | "orange.300" | "orange.400" | "orange.500" | "orange.600" | "orange.700" | "orange.800" | "orange.900" | "orange.950" | "red.50" | "red.100" | "red.200" | "red.300" | "red.400" | "red.500" | "red.600" | "red.700" | "red.800" | "red.900" | "red.950" | "neutral.50" | "neutral.100" | "neutral.200" | "neutral.300" | "neutral.400" | "neutral.500" | "neutral.600" | "neutral.700" | "neutral.800" | "neutral.900" | "neutral.950" | "stone.50" | "stone.100" | "stone.200" | "stone.300" | "stone.400" | "stone.500" | "stone.600" | "stone.700" | "stone.800" | "stone.900" | "stone.950" | "zinc.50" | "zinc.100" | "zinc.200" | "zinc.300" | "zinc.400" | "zinc.500" | "zinc.600" | "zinc.700" | "zinc.800" | "zinc.900" | "zinc.950" | "gray.50" | "gray.100" | "gray.200" | "gray.300" | "gray.400" | "gray.500" | "gray.600" | "gray.700" | "gray.800" | "gray.900" | "gray.950" | "slate.50" | "slate.100" | "slate.200" | "slate.300" | "slate.400" | "slate.500" | "slate.600" | "slate.700" | "slate.800" | "slate.900" | "slate.950" | "accent" | "backdrop" | "background" | "border" | "borderStrong" | "card" | "danger" | "dangerSoft" | "divider" | "fill" | "fillHover" | "fillOverPhoto" | "foreground" | "muted" | "onDanger" | "onPhoto" | "panelOverPhoto" | "private" | "skeleton" | "success" | "textFaint" | "textSoft" | "warning" | "colorPalette" | "colorPalette.50" | "colorPalette.100" | "colorPalette.200" | "colorPalette.300" | "colorPalette.400" | "colorPalette.500" | "colorPalette.600" | "colorPalette.700" | "colorPalette.800" | "colorPalette.900" | "colorPalette.950"
|
|
21
21
|
|
|
22
22
|
export type BlurToken = "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl"
|
|
23
23
|
|
|
@@ -169,7 +169,7 @@ export interface UtilityValues {
|
|
|
169
169
|
transitionProperty: "common" | "colors" | "size" | "position" | "background";
|
|
170
170
|
transition: "all" | "common" | "size" | "position" | "background" | "colors" | "opacity" | "shadow" | "transform";
|
|
171
171
|
animation: Tokens["animations"];
|
|
172
|
-
animationName: "bounce" | "iconArcRipple" | "iconArcSearch" | "iconArmReach" | "iconArmSwing" | "iconArrowWind" | "iconBellClapper" | "iconBellNudge" | "iconBellSwing" | "iconBoltStrike" | "iconBubbleTip" | "iconCapsuleBob" | "iconCheckDraw" | "iconCoreIn" | "iconCoreOut" | "iconDotBlink" | "iconDownloadDrop" | "iconGearTurn" | "iconKeyholePulse" | "iconKeyPress" | "iconLineWrite" | "iconMoonIn" | "iconMoonOut" | "iconMoonRock" | "iconPartSpread" | "iconPupilGlance" | "iconRayIn" | "iconRayOut" | "iconRayPulse" | "iconShackleLift" | "iconShackleShut" | "iconTrayGive" | "iconWavePull" | "iconWavePush" | "levelToastEnter" | "levelToastHold" | "levelToastHoldAgain" | "noticeShown" | "ping" | "pulse" | "spin" | "themeSwipeFromBottom" | "themeSwipeFromTop" | "toastCountdown";
|
|
172
|
+
animationName: "bounce" | "iconArcRipple" | "iconArcSearch" | "iconArmReach" | "iconArmSwing" | "iconArrowWind" | "iconBellClapper" | "iconBellNudge" | "iconBellSwing" | "iconBoltStrike" | "iconBubbleTip" | "iconCapsuleBob" | "iconCheckDraw" | "iconCoreIn" | "iconCoreOut" | "iconDotBlink" | "iconDownloadDrop" | "iconGearTurn" | "iconKeyholePulse" | "iconKeyPress" | "iconLineWrite" | "iconMoonIn" | "iconMoonOut" | "iconMoonRock" | "iconPartSpread" | "iconPupilGlance" | "iconRayIn" | "iconRayOut" | "iconRayPulse" | "iconShackleLift" | "iconShackleShut" | "iconSparkleTwinkle" | "iconSparkleWink" | "iconTrayGive" | "iconWavePull" | "iconWavePush" | "levelToastEnter" | "levelToastHold" | "levelToastHoldAgain" | "noticeShown" | "ping" | "pulse" | "spin" | "themeSwipeFromBottom" | "themeSwipeFromTop" | "toastCountdown";
|
|
173
173
|
animationTimingFunction: Tokens["easings"];
|
|
174
174
|
animationDuration: Tokens["durations"];
|
|
175
175
|
animationDelay: Tokens["durations"];
|
|
@@ -222,7 +222,7 @@ export interface UtilityValues {
|
|
|
222
222
|
srOnly: boolean;
|
|
223
223
|
debug: boolean;
|
|
224
224
|
containerName: CssProperties["containerName"];
|
|
225
|
-
colorPalette: "current" | "black" | "white" | "transparent" | "rose" | "pink" | "fuchsia" | "purple" | "violet" | "indigo" | "blue" | "sky" | "cyan" | "teal" | "emerald" | "green" | "lime" | "yellow" | "amber" | "orange" | "red" | "neutral" | "stone" | "zinc" | "gray" | "slate" | "accent" | "backdrop" | "background" | "border" | "borderStrong" | "card" | "danger" | "dangerSoft" | "divider" | "fill" | "fillHover" | "fillOverPhoto" | "foreground" | "muted" | "onPhoto" | "panelOverPhoto" | "private" | "skeleton" | "success" | "textFaint" | "textSoft" | "warning";
|
|
225
|
+
colorPalette: "current" | "black" | "white" | "transparent" | "rose" | "pink" | "fuchsia" | "purple" | "violet" | "indigo" | "blue" | "sky" | "cyan" | "teal" | "emerald" | "green" | "lime" | "yellow" | "amber" | "orange" | "red" | "neutral" | "stone" | "zinc" | "gray" | "slate" | "accent" | "backdrop" | "background" | "border" | "borderStrong" | "card" | "danger" | "dangerSoft" | "divider" | "fill" | "fillHover" | "fillOverPhoto" | "foreground" | "muted" | "onDanger" | "onPhoto" | "panelOverPhoto" | "private" | "skeleton" | "success" | "textFaint" | "textSoft" | "warning";
|
|
226
226
|
textStyle: "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl" | "5xl" | "6xl" | "7xl" | "8xl" | "9xl" | "panelDetail" | "panelLabel" | "panelOverline" | "panelTitle";
|
|
227
227
|
}
|
|
228
228
|
|