@domicile-desktop/manganese-quick-settings 0.0.0-stage → 0.0.0

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 (129) hide show
  1. package/README.md +31 -2
  2. package/package.json +58 -4
  3. package/src/QuickSettings.tsx +223 -0
  4. package/src/desk-parts.tsx +62 -0
  5. package/styled-system/css/conditions.mjs +36 -0
  6. package/styled-system/css/css.d.ts +22 -0
  7. package/styled-system/css/css.mjs +45 -0
  8. package/styled-system/css/cva.d.ts +6 -0
  9. package/styled-system/css/cva.mjs +87 -0
  10. package/styled-system/css/cx.d.ts +5 -0
  11. package/styled-system/css/cx.mjs +15 -0
  12. package/styled-system/css/index.d.ts +5 -0
  13. package/styled-system/css/index.mjs +4 -0
  14. package/styled-system/css/sva.d.ts +4 -0
  15. package/styled-system/css/sva.mjs +46 -0
  16. package/styled-system/helpers.mjs +328 -0
  17. package/styled-system/jsx/aspect-ratio.d.ts +10 -0
  18. package/styled-system/jsx/aspect-ratio.mjs +14 -0
  19. package/styled-system/jsx/bleed.d.ts +10 -0
  20. package/styled-system/jsx/bleed.mjs +14 -0
  21. package/styled-system/jsx/box.d.ts +10 -0
  22. package/styled-system/jsx/box.mjs +14 -0
  23. package/styled-system/jsx/center.d.ts +10 -0
  24. package/styled-system/jsx/center.mjs +14 -0
  25. package/styled-system/jsx/circle.d.ts +10 -0
  26. package/styled-system/jsx/circle.mjs +14 -0
  27. package/styled-system/jsx/container.d.ts +10 -0
  28. package/styled-system/jsx/container.mjs +14 -0
  29. package/styled-system/jsx/cq.d.ts +10 -0
  30. package/styled-system/jsx/cq.mjs +14 -0
  31. package/styled-system/jsx/create-style-context.d.ts +54 -0
  32. package/styled-system/jsx/create-style-context.mjs +121 -0
  33. package/styled-system/jsx/divider.d.ts +10 -0
  34. package/styled-system/jsx/divider.mjs +14 -0
  35. package/styled-system/jsx/factory-helper.mjs +22 -0
  36. package/styled-system/jsx/factory.d.ts +3 -0
  37. package/styled-system/jsx/factory.mjs +89 -0
  38. package/styled-system/jsx/flex.d.ts +10 -0
  39. package/styled-system/jsx/flex.mjs +14 -0
  40. package/styled-system/jsx/float.d.ts +10 -0
  41. package/styled-system/jsx/float.mjs +14 -0
  42. package/styled-system/jsx/grid-item.d.ts +10 -0
  43. package/styled-system/jsx/grid-item.mjs +14 -0
  44. package/styled-system/jsx/grid.d.ts +10 -0
  45. package/styled-system/jsx/grid.mjs +14 -0
  46. package/styled-system/jsx/hstack.d.ts +10 -0
  47. package/styled-system/jsx/hstack.mjs +14 -0
  48. package/styled-system/jsx/index.d.ts +25 -0
  49. package/styled-system/jsx/index.mjs +23 -0
  50. package/styled-system/jsx/is-valid-prop.d.ts +11 -0
  51. package/styled-system/jsx/is-valid-prop.mjs +17 -0
  52. package/styled-system/jsx/link-overlay.d.ts +10 -0
  53. package/styled-system/jsx/link-overlay.mjs +14 -0
  54. package/styled-system/jsx/spacer.d.ts +10 -0
  55. package/styled-system/jsx/spacer.mjs +14 -0
  56. package/styled-system/jsx/square.d.ts +10 -0
  57. package/styled-system/jsx/square.mjs +14 -0
  58. package/styled-system/jsx/stack.d.ts +10 -0
  59. package/styled-system/jsx/stack.mjs +14 -0
  60. package/styled-system/jsx/visually-hidden.d.ts +10 -0
  61. package/styled-system/jsx/visually-hidden.mjs +14 -0
  62. package/styled-system/jsx/vstack.d.ts +10 -0
  63. package/styled-system/jsx/vstack.mjs +14 -0
  64. package/styled-system/jsx/wrap.d.ts +10 -0
  65. package/styled-system/jsx/wrap.mjs +14 -0
  66. package/styled-system/patterns/aspect-ratio.d.ts +20 -0
  67. package/styled-system/patterns/aspect-ratio.mjs +38 -0
  68. package/styled-system/patterns/bleed.d.ts +21 -0
  69. package/styled-system/patterns/bleed.mjs +24 -0
  70. package/styled-system/patterns/box.d.ts +20 -0
  71. package/styled-system/patterns/box.mjs +15 -0
  72. package/styled-system/patterns/center.d.ts +20 -0
  73. package/styled-system/patterns/center.mjs +21 -0
  74. package/styled-system/patterns/circle.d.ts +20 -0
  75. package/styled-system/patterns/circle.mjs +25 -0
  76. package/styled-system/patterns/container.d.ts +20 -0
  77. package/styled-system/patterns/container.mjs +21 -0
  78. package/styled-system/patterns/cq.d.ts +21 -0
  79. package/styled-system/patterns/cq.mjs +21 -0
  80. package/styled-system/patterns/divider.d.ts +22 -0
  81. package/styled-system/patterns/divider.mjs +25 -0
  82. package/styled-system/patterns/flex.d.ts +26 -0
  83. package/styled-system/patterns/flex.mjs +26 -0
  84. package/styled-system/patterns/float.d.ts +23 -0
  85. package/styled-system/patterns/float.mjs +52 -0
  86. package/styled-system/patterns/grid-item.d.ts +25 -0
  87. package/styled-system/patterns/grid-item.mjs +25 -0
  88. package/styled-system/patterns/grid.d.ts +24 -0
  89. package/styled-system/patterns/grid.mjs +27 -0
  90. package/styled-system/patterns/hstack.d.ts +21 -0
  91. package/styled-system/patterns/hstack.mjs +24 -0
  92. package/styled-system/patterns/index.d.ts +21 -0
  93. package/styled-system/patterns/index.mjs +20 -0
  94. package/styled-system/patterns/link-overlay.d.ts +20 -0
  95. package/styled-system/patterns/link-overlay.mjs +24 -0
  96. package/styled-system/patterns/spacer.d.ts +20 -0
  97. package/styled-system/patterns/spacer.mjs +25 -0
  98. package/styled-system/patterns/square.d.ts +20 -0
  99. package/styled-system/patterns/square.mjs +24 -0
  100. package/styled-system/patterns/stack.d.ts +23 -0
  101. package/styled-system/patterns/stack.mjs +24 -0
  102. package/styled-system/patterns/visually-hidden.d.ts +20 -0
  103. package/styled-system/patterns/visually-hidden.mjs +18 -0
  104. package/styled-system/patterns/vstack.d.ts +21 -0
  105. package/styled-system/patterns/vstack.mjs +24 -0
  106. package/styled-system/patterns/wrap.d.ts +24 -0
  107. package/styled-system/patterns/wrap.mjs +25 -0
  108. package/styled-system/recipes/control.d.ts +31 -0
  109. package/styled-system/recipes/control.mjs +35 -0
  110. package/styled-system/recipes/create-recipe.mjs +82 -0
  111. package/styled-system/recipes/index.d.ts +2 -0
  112. package/styled-system/recipes/index.mjs +1 -0
  113. package/styled-system/tokens/index.d.ts +9 -0
  114. package/styled-system/tokens/index.mjs +49700 -0
  115. package/styled-system/tokens/tokens.d.ts +72 -0
  116. package/styled-system/types/composition.d.ts +227 -0
  117. package/styled-system/types/conditions.d.ts +330 -0
  118. package/styled-system/types/csstype.d.ts +22570 -0
  119. package/styled-system/types/global.d.ts +20 -0
  120. package/styled-system/types/index.d.ts +8 -0
  121. package/styled-system/types/jsx.d.ts +69 -0
  122. package/styled-system/types/parts.d.ts +8 -0
  123. package/styled-system/types/pattern.d.ts +78 -0
  124. package/styled-system/types/prop-type.d.ts +268 -0
  125. package/styled-system/types/recipe.d.ts +181 -0
  126. package/styled-system/types/selectors.d.ts +59 -0
  127. package/styled-system/types/static-css.d.ts +56 -0
  128. package/styled-system/types/style-props.d.ts +8089 -0
  129. package/styled-system/types/system-types.d.ts +151 -0
package/README.md CHANGED
@@ -1,3 +1,32 @@
1
- # Temporary Holding Version
1
+ # @domicile-desktop/manganese-quick-settings
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ A manganese bar item: quick settings. The network, Bluetooth, sound and
4
+ battery icons in one button, and their controls in one panel, with brightness,
5
+ keep awake, night light, dark mode and a way to the Settings app. In manganese's
6
+ default bars.
7
+
8
+ ## Use
9
+
10
+ Put `<QuickSettings />` in a column of
11
+ [`runManganese`](../shell-manganese/README.md)'s `bar`:
12
+
13
+ ```tsx
14
+ import { runManganese } from "@domicile-desktop/manganese";
15
+ import { QuickSettings } from "@domicile-desktop/manganese-quick-settings";
16
+
17
+ export const Shell = runManganese({
18
+ bar: { center: [], left: [], right: [<QuickSettings key="quick-settings" />] },
19
+ });
20
+ ```
21
+
22
+ It reads `useDomicile()`. Its parts come from the hardware items' packages
23
+ (`manganese-bar-module-network`, `-bluetooth`, `-volume`, `-brightness`,
24
+ `-battery`, `-idle-inhibitor`, `-theme-switch`), whose own bar items stay
25
+ usable on their own. See
26
+ [TOP-BAR.md](../shell-manganese/docs/TOP-BAR.md#quick-settings).
27
+
28
+ ## Test
29
+
30
+ ```sh
31
+ bun run turbo test --filter @domicile-desktop/manganese-quick-settings
32
+ ```
package/package.json CHANGED
@@ -1,6 +1,60 @@
1
1
  {
2
+ "dependencies": {
3
+ "@domicile-desktop/component-library": "1.0.0",
4
+ "@domicile-desktop/manganese-bar": "1.0.0",
5
+ "@domicile-desktop/manganese-bar-module-battery": "1.0.0",
6
+ "@domicile-desktop/manganese-bar-module-bluetooth": "1.0.0",
7
+ "@domicile-desktop/manganese-bar-module-brightness": "1.0.0",
8
+ "@domicile-desktop/manganese-bar-module-idle-inhibitor": "1.0.0",
9
+ "@domicile-desktop/manganese-bar-module-network": "1.0.0",
10
+ "@domicile-desktop/manganese-bar-module-theme-switch": "1.0.0",
11
+ "@domicile-desktop/manganese-bar-module-volume": "1.0.0",
12
+ "@domicile-desktop/react": "0.0.0",
13
+ "@pandacss/dev": "^1.12.1",
14
+ "react": "^19.2.8"
15
+ },
16
+ "description": "A manganese bar item: quick settings, the network, Bluetooth, sound, brightness and battery in one panel.",
17
+ "devDependencies": {
18
+ "@cprussin/tsconfig": "^5.0.0",
19
+ "@domicile-desktop/test-support": "0.0.1",
20
+ "@pandacss/preset-panda": "^1.12.1",
21
+ "@testing-library/react": "^16.3.3",
22
+ "@testing-library/user-event": "^14.6.7",
23
+ "@types/bun": "^1.4.2",
24
+ "@types/react": "^19.2.18",
25
+ "@types/react-dom": "^19.2.7",
26
+ "postcss": "^8.5.28",
27
+ "typescript": "^7.0.2"
28
+ },
29
+ "engines": {
30
+ "bun": ">=1.4.2",
31
+ "node": ">=24"
32
+ },
33
+ "exports": {
34
+ ".": "./src/QuickSettings.tsx"
35
+ },
36
+ "files": [
37
+ "src/**",
38
+ "styled-system/**",
39
+ "!src/**/*.test.ts",
40
+ "!src/**/*.test.tsx"
41
+ ],
42
+ "license": "MIT",
2
43
  "name": "@domicile-desktop/manganese-quick-settings",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
44
+ "private": false,
45
+ "publishConfig": {
46
+ "access": "public"
47
+ },
48
+ "repository": {
49
+ "directory": "packages/manganese-quick-settings",
50
+ "type": "git",
51
+ "url": "git+https://github.com/cprussin/domicile.git"
52
+ },
53
+ "scripts": {
54
+ "prepare": "panda codegen --silent",
55
+ "test:types": "tsc --noEmit",
56
+ "test:unit": "bun test"
57
+ },
58
+ "type": "module",
59
+ "version": "0.0.0"
60
+ }
@@ -0,0 +1,223 @@
1
+ import { AnimatedGearIcon } from "@domicile-desktop/component-library/AnimatedGearIcon";
2
+ import { Button } from "@domicile-desktop/component-library/Button";
3
+ import type { DrilldownDetail } from "@domicile-desktop/component-library/Drilldown";
4
+ import { Drilldown } from "@domicile-desktop/component-library/Drilldown";
5
+ import { FluidItem } from "@domicile-desktop/component-library/FluidItem";
6
+ import { PanelFooter } from "@domicile-desktop/component-library/PanelFooter";
7
+ import { Popover } from "@domicile-desktop/component-library/Popover";
8
+ import { useBar } from "@domicile-desktop/manganese-bar/bar-context";
9
+ import { useKeepsKeyboard } from "@domicile-desktop/manganese-bar/panel-keyboard";
10
+ import type { ComponentType, MouseEvent, WheelEvent } from "react";
11
+ import { useState } from "react";
12
+
13
+ import { css, cva } from "../styled-system/css";
14
+ import { flex, grid, hstack } from "../styled-system/patterns";
15
+ import { DESK_PARTS } from "./desk-parts";
16
+
17
+ /** A tile or slider with details: `onMore` opens them, absent while locked. */
18
+ type WithDetails = ComponentType<{ onMore?: (() => void) | undefined }>;
19
+
20
+ /** What quick settings is made of, injectable so tests can draw their own. */
21
+ export type QuickSettingsParts = {
22
+ /**
23
+ * The icons in the button, in order. Each hides by rendering nothing, and
24
+ * eases in and out.
25
+ */
26
+ Indicators: readonly ComponentType[];
27
+ /** The button's wheel and middle click. */
28
+ useGestures: () => {
29
+ onAuxClick: (event: MouseEvent) => void;
30
+ onWheel: (event: WheelEvent) => void;
31
+ };
32
+ NetworkTile: WithDetails;
33
+ BluetoothTile: WithDetails;
34
+ KeepAwakeTile: ComponentType;
35
+ NightLightTile: ComponentType;
36
+ DarkModeTile: ComponentType;
37
+ BrightnessRow: ComponentType;
38
+ SoundRow: WithDetails;
39
+ BatteryStatus: ComponentType;
40
+ NetworkDetails: ComponentType;
41
+ BluetoothDetails: ComponentType;
42
+ SoundDetails: ComponentType;
43
+ /** Opens the Settings app. */
44
+ useOpenSettings: () => () => void;
45
+ };
46
+
47
+ /** Which details show over the tiles. */
48
+ enum Details {
49
+ Network,
50
+ Bluetooth,
51
+ Sound,
52
+ }
53
+
54
+ /**
55
+ * One bar item for the computer's settings: the network, Bluetooth, sound
56
+ * and battery icons in a button, each shown only when it has something to
57
+ * say. It opens a panel of tiles into the network and Bluetooth details, a
58
+ * row of switches for what is turned on and off often, the brightness and
59
+ * volume sliders, the battery, and a way to the Settings app. Details open
60
+ * in place.
61
+ *
62
+ * Offers only what a locked desktop allows: no network, keep awake, theme,
63
+ * details or Settings.
64
+ */
65
+ export const QuickSettings = ({
66
+ parts = DESK_PARTS,
67
+ }: {
68
+ parts?: QuickSettingsParts | undefined;
69
+ }) => {
70
+ const { locked } = useBar();
71
+ const [open, setOpen] = useState(false);
72
+ const [details, setDetails] = useState<Details | undefined>(undefined);
73
+ const openSettings = parts.useOpenSettings();
74
+ useKeepsKeyboard(open);
75
+ const opener = (shown: Details) =>
76
+ locked
77
+ ? undefined
78
+ : () => {
79
+ setDetails(shown);
80
+ };
81
+ return (
82
+ <Popover
83
+ align="end"
84
+ onOpenChange={setOpen}
85
+ // Back to the tiles once hidden, so the panel closes on what it shows.
86
+ onOpenChangeComplete={(opened) => {
87
+ if (!opened) {
88
+ setDetails(undefined);
89
+ }
90
+ }}
91
+ open={open}
92
+ side="bottom"
93
+ tone="overPhoto"
94
+ trigger={
95
+ <button
96
+ aria-label="Quick settings"
97
+ className={triggerStyles}
98
+ type="button"
99
+ {...parts.useGestures()}
100
+ >
101
+ {parts.Indicators.map((Indicator, index) => (
102
+ // The list is fixed, so its order is its identity.
103
+ <FluidItem gap="narrow" key={index}>
104
+ <Indicator />
105
+ </FluidItem>
106
+ ))}
107
+ </button>
108
+ }
109
+ wide
110
+ >
111
+ <span className={panelStyles}>
112
+ <Drilldown
113
+ detail={detailOf(parts, details)}
114
+ onBack={() => {
115
+ setDetails(undefined);
116
+ }}
117
+ >
118
+ <span className={mainStyles}>
119
+ <span className={tilesStyles}>
120
+ {!locked && (
121
+ <parts.NetworkTile onMore={opener(Details.Network)} />
122
+ )}
123
+ <parts.BluetoothTile onMore={opener(Details.Bluetooth)} />
124
+ </span>
125
+ <span className={togglesStyles}>
126
+ {!locked && <parts.KeepAwakeTile />}
127
+ <parts.NightLightTile />
128
+ {!locked && <parts.DarkModeTile />}
129
+ </span>
130
+ <span className={slidersStyles}>
131
+ {/* Clear of the volume's arrow, so the sliders end together. */}
132
+ <span className={brightnessStyles({ besideArrow: !locked })}>
133
+ <parts.BrightnessRow />
134
+ </span>
135
+ <parts.SoundRow onMore={opener(Details.Sound)} />
136
+ </span>
137
+ <PanelFooter
138
+ action={
139
+ !locked && (
140
+ <Button
141
+ beforeIcon={<AnimatedGearIcon size={14} />}
142
+ onClick={() => {
143
+ openSettings();
144
+ setOpen(false);
145
+ }}
146
+ rounded
147
+ size="xs"
148
+ variant="ghost"
149
+ >
150
+ Settings
151
+ </Button>
152
+ )
153
+ }
154
+ >
155
+ <parts.BatteryStatus />
156
+ </PanelFooter>
157
+ </span>
158
+ </Drilldown>
159
+ </span>
160
+ </Popover>
161
+ );
162
+ };
163
+
164
+ const detailOf = (
165
+ parts: QuickSettingsParts,
166
+ details: Details | undefined,
167
+ ): DrilldownDetail | undefined => {
168
+ switch (details) {
169
+ case undefined:
170
+ return undefined;
171
+ case Details.Network:
172
+ return { content: <parts.NetworkDetails />, title: "Network" };
173
+ case Details.Bluetooth:
174
+ return { content: <parts.BluetoothDetails />, title: "Bluetooth" };
175
+ case Details.Sound:
176
+ return { content: <parts.SoundDetails />, title: "Sound" };
177
+ }
178
+ };
179
+
180
+ // The other bar items' hover circle, stretched around several icons. Each icon
181
+ // holds half the gap on either side, so the padding is short by as much.
182
+ const triggerStyles = hstack({
183
+ _hoverOrOpen: { backgroundColor: "fillOverPhoto" },
184
+ backgroundColor: "transparent",
185
+ blockSize: 7,
186
+ borderRadius: "lg",
187
+ borderStyle: "none",
188
+ color: "inherit",
189
+ cursor: "pointer",
190
+ flexShrink: 0,
191
+ gap: 0,
192
+ paddingInline: 0.75,
193
+ transition: "background-color {durations.fast} {easings.default}",
194
+ });
195
+
196
+ // A popover's usual width, which its network and Bluetooth details fit. The
197
+ // padding evens out the panel's, which is thinner above and below.
198
+ const panelStyles = css({
199
+ display: "block",
200
+ inlineSize: 88,
201
+ paddingBlock: 1.5,
202
+ });
203
+
204
+ // Tiles, sliders and the footer, a step apart.
205
+ const mainStyles = flex({ direction: "column", gap: 3 });
206
+
207
+ const slidersStyles = flex({ direction: "column", gap: 1.5 });
208
+
209
+ const tilesStyles = grid({ columns: 2, gap: 2 });
210
+
211
+ // The switches share the row evenly, however many a locked desktop leaves.
212
+ const togglesStyles = flex({ gap: 2 });
213
+
214
+ // The volume's arrow, an `IconButton`, and the gap before it.
215
+ const brightnessStyles = cva({
216
+ base: { display: "flex" },
217
+ variants: {
218
+ besideArrow: {
219
+ false: {},
220
+ true: { paddingInlineEnd: 8 },
221
+ },
222
+ },
223
+ });
@@ -0,0 +1,62 @@
1
+ import { useBar } from "@domicile-desktop/manganese-bar/bar-context";
2
+ import {
3
+ BatteryCharge,
4
+ BatteryIndicator,
5
+ } from "@domicile-desktop/manganese-bar-module-battery/quick-settings";
6
+ import {
7
+ BluetoothCard,
8
+ BluetoothDevices,
9
+ BluetoothIndicator,
10
+ } from "@domicile-desktop/manganese-bar-module-bluetooth/quick-settings";
11
+ import {
12
+ BrightnessLevel,
13
+ NightLight,
14
+ } from "@domicile-desktop/manganese-bar-module-brightness/quick-settings";
15
+ import { KeepAwake } from "@domicile-desktop/manganese-bar-module-idle-inhibitor/quick-settings";
16
+ import {
17
+ NetworkCard,
18
+ NetworkDetails,
19
+ NetworkIndicator,
20
+ } from "@domicile-desktop/manganese-bar-module-network/quick-settings";
21
+ import { DarkModeTile } from "@domicile-desktop/manganese-bar-module-theme-switch/quick-settings";
22
+ import {
23
+ SoundIndicator,
24
+ SoundLevel,
25
+ SoundMixer,
26
+ useDeskSoundGestures,
27
+ } from "@domicile-desktop/manganese-bar-module-volume/quick-settings";
28
+ import { useDomicile } from "@domicile-desktop/react/domicile-provider";
29
+
30
+ import type { QuickSettingsParts } from "./QuickSettings";
31
+
32
+ /** Quick settings from the desk's own readouts. */
33
+ export const DESK_PARTS: QuickSettingsParts = {
34
+ BatteryStatus: BatteryCharge,
35
+ BluetoothDetails: BluetoothDevices,
36
+ BluetoothTile: BluetoothCard,
37
+ BrightnessRow: BrightnessLevel,
38
+ DarkModeTile,
39
+ Indicators: [
40
+ () => {
41
+ const { locked } = useBar();
42
+ return !locked && <NetworkIndicator />;
43
+ },
44
+ BluetoothIndicator,
45
+ SoundIndicator,
46
+ BatteryIndicator,
47
+ ],
48
+ KeepAwakeTile: KeepAwake,
49
+ NetworkDetails,
50
+ NetworkTile: NetworkCard,
51
+ NightLightTile: NightLight,
52
+ SoundDetails: SoundMixer,
53
+ SoundRow: SoundLevel,
54
+ useGestures: useDeskSoundGestures,
55
+ // As the launcher runs it.
56
+ useOpenSettings: () => {
57
+ const { processes } = useDomicile();
58
+ return () => {
59
+ processes.launch(["domicile-settings"]);
60
+ };
61
+ },
62
+ };
@@ -0,0 +1,36 @@
1
+ import { withoutSpace } from '../helpers.mjs';
2
+
3
+ const conditionsStr = "_hover,_focus,_focusWithin,_focusVisible,_disabled,_active,_visited,_target,_readOnly,_readWrite,_empty,_checked,_enabled,_expanded,_highlighted,_complete,_incomplete,_dragging,_before,_after,_firstLetter,_firstLine,_marker,_selection,_file,_backdrop,_first,_last,_only,_even,_odd,_firstOfType,_lastOfType,_onlyOfType,_peerFocus,_peerHover,_peerActive,_peerFocusWithin,_peerFocusVisible,_peerDisabled,_peerChecked,_peerInvalid,_peerExpanded,_peerPlaceholderShown,_groupFocus,_groupHover,_groupActive,_groupFocusWithin,_groupFocusVisible,_groupDisabled,_groupChecked,_groupExpanded,_groupInvalid,_indeterminate,_required,_valid,_invalid,_autofill,_inRange,_outOfRange,_placeholder,_placeholderShown,_pressed,_selected,_grabbed,_underValue,_overValue,_atValue,_default,_optional,_open,_closed,_fullscreen,_loading,_hidden,_current,_currentPage,_currentStep,_today,_unavailable,_rangeStart,_rangeEnd,_now,_topmost,_motionReduce,_motionSafe,_print,_landscape,_portrait,_dark,_light,_osDark,_osLight,_highContrast,_lessContrast,_moreContrast,_ltr,_rtl,_scrollbar,_scrollbarThumb,_scrollbarTrack,_horizontal,_vertical,_icon,_starting,_noscript,_invertedColors,_activeEnabled,_contrastHigh,_controlActive,_controlHover,_hoverEnabled,_hoverOrOpen,_onPhoto,_pointerCoarse,_touchOverlay,_touchSheet,sm,smOnly,smDown,md,mdOnly,mdDown,lg,lgOnly,lgDown,xl,xlOnly,xlDown,2xl,2xlOnly,2xlDown,smToMd,smToLg,smToXl,smTo2xl,mdToLg,mdToXl,mdTo2xl,lgToXl,lgTo2xl,xlTo2xl,@/xs,@/sm,@/md,@/lg,@/xl,@/2xl,@/3xl,@/4xl,@/5xl,@/6xl,@/7xl,@/8xl,base"
4
+ const conditions = new Set(conditionsStr.split(','))
5
+
6
+ const conditionRegex = /^@|&|&$/
7
+
8
+ export function isCondition(value){
9
+ return conditions.has(value) || conditionRegex.test(value)
10
+ }
11
+
12
+ const underscoreRegex = /^_/
13
+ const conditionsSelectorRegex = /&|@/
14
+
15
+ export function finalizeConditions(paths){
16
+ return paths.map((path) => {
17
+ if (conditions.has(path)){
18
+ return path.replace(underscoreRegex, '')
19
+ }
20
+
21
+ if (conditionsSelectorRegex.test(path)){
22
+ return `[${withoutSpace(path.trim())}]`
23
+ }
24
+
25
+ return path
26
+ })}
27
+
28
+ export function sortConditions(paths){
29
+ return paths.sort((a, b) => {
30
+ const aa = isCondition(a)
31
+ const bb = isCondition(b)
32
+ if (aa && !bb) return 1
33
+ if (!aa && bb) return -1
34
+ return 0
35
+ })
36
+ }
@@ -0,0 +1,22 @@
1
+ /* eslint-disable */
2
+ import type { SystemStyleObject } from '../types/index';
3
+
4
+ type Styles = SystemStyleObject | undefined | null | false
5
+
6
+ interface CssRawFunction {
7
+ (styles: Styles): SystemStyleObject
8
+ (styles: Styles[]): SystemStyleObject
9
+ (...styles: Array<Styles | Styles[]>): SystemStyleObject
10
+ (styles: Styles): SystemStyleObject
11
+ }
12
+
13
+ interface CssFunction {
14
+ (styles: Styles): string
15
+ (styles: Styles[]): string
16
+ (...styles: Array<Styles | Styles[]>): string
17
+ (styles: Styles): string
18
+
19
+ raw: CssRawFunction
20
+ }
21
+
22
+ export declare const css: CssFunction;
@@ -0,0 +1,45 @@
1
+ import { createCss, createMergeCss, hypenateProperty, withoutSpace } from '../helpers.mjs';
2
+ import { sortConditions, finalizeConditions } from './conditions.mjs';
3
+
4
+ const utilities = "aspectRatio:asp,boxDecorationBreak:bx-db,zIndex:z,boxSizing:bx-s,objectPosition:obj-p,objectFit:obj-f,overscrollBehavior:ovs-b,overscrollBehaviorX:ovs-bx,overscrollBehaviorY:ovs-by,position:pos/1,top:top,left:left,inset:inset,insetInline:inset-x/insetX,insetBlock:inset-y/insetY,insetBlockEnd:inset-be,insetBlockStart:inset-bs,insetInlineEnd:inset-e/insetEnd/end,insetInlineStart:inset-s/insetStart/start,right:right,bottom:bottom,float:float,visibility:vis,display:d,hideFrom:hide,hideBelow:show,flexBasis:flex-b,flex:flex,flexDirection:flex-d/flexDir,flexGrow:flex-g,flexShrink:flex-sh,gridTemplateColumns:grid-tc,gridTemplateRows:grid-tr,gridColumn:grid-c,gridRow:grid-r,gridColumnStart:grid-cs,gridColumnEnd:grid-ce,gridAutoFlow:grid-af,gridAutoColumns:grid-ac,gridAutoRows:grid-ar,gap:gap,gridGap:grid-g,gridRowGap:grid-rg,gridColumnGap:grid-cg,rowGap:rg,columnGap:cg,justifyContent:jc,alignContent:ac,alignItems:ai,alignSelf:as,padding:p/1,paddingLeft:pl/1,paddingRight:pr/1,paddingTop:pt/1,paddingBottom:pb/1,paddingBlock:py/1/paddingY,paddingBlockEnd:pbe,paddingBlockStart:pbs,paddingInline:px/paddingX/1,paddingInlineEnd:pe/1/paddingEnd,paddingInlineStart:ps/1/paddingStart,marginLeft:ml/1,marginRight:mr/1,marginTop:mt/1,marginBottom:mb/1,margin:m/1,marginBlock:my/1/marginY,marginBlockEnd:mbe,marginBlockStart:mbs,marginInline:mx/1/marginX,marginInlineEnd:me/1/marginEnd,marginInlineStart:ms/1/marginStart,spaceX:sx,spaceY:sy,outlineWidth:ring-w/ringWidth,outlineColor:ring-c/ringColor,outline:ring/1,outlineOffset:ring-o/ringOffset,focusRing:focus-ring,focusVisibleRing:focus-v-ring,focusRingColor:focus-ring-c,focusRingOffset:focus-ring-o,focusRingWidth:focus-ring-w,focusRingStyle:focus-ring-s,divideX:dvd-x,divideY:dvd-y,divideColor:dvd-c,divideStyle:dvd-s,width:w/1,inlineSize:w-is,minWidth:min-w/minW,minInlineSize:min-w-is,maxWidth:max-w/maxW,maxInlineSize:max-w-is,height:h/1,blockSize:h-bs,minHeight:min-h/minH,minBlockSize:min-h-bs,maxHeight:max-h/maxH,maxBlockSize:max-b,boxSize:size,color:c,fontFamily:ff,fontSize:fs,fontSizeAdjust:fs-a,fontPalette:fp,fontKerning:fk,fontFeatureSettings:ff-s,fontWeight:fw,fontSmoothing:fsmt,fontVariant:fv,fontVariantAlternates:fv-alt,fontVariantCaps:fv-caps,fontVariationSettings:fv-s,fontVariantNumeric:fv-num,letterSpacing:ls,lineHeight:lh,textAlign:ta,textDecoration:td,textDecorationColor:td-c,textEmphasisColor:te-c,textDecorationStyle:td-s,textDecorationThickness:td-t,textUnderlineOffset:tu-o,textTransform:tt,textIndent:ti,textShadow:tsh,textShadowColor:tsh-c/textShadowColor,WebkitTextFillColor:wktf-c,textOverflow:tov,verticalAlign:va,wordBreak:wb,textWrap:tw,truncate:trunc,lineClamp:lc,listStyleType:li-t,listStylePosition:li-pos,listStyleImage:li-img,listStyle:li-s,backgroundPosition:bg-p/bgPosition,backgroundPositionX:bg-p-x/bgPositionX,backgroundPositionY:bg-p-y/bgPositionY,backgroundAttachment:bg-a/bgAttachment,backgroundClip:bg-cp/bgClip,background:bg/1,backgroundColor:bg-c/bgColor,backgroundOrigin:bg-o/bgOrigin,backgroundImage:bg-i/bgImage,backgroundRepeat:bg-r/bgRepeat,backgroundBlendMode:bg-bm/bgBlendMode,backgroundSize:bg-s/bgSize,backgroundGradient:bg-grad/bgGradient,backgroundLinear:bg-linear/bgLinear,backgroundRadial:bg-radial/bgRadial,backgroundConic:bg-conic/bgConic,textGradient:txt-grad,gradientFromPosition:grad-from-pos,gradientToPosition:grad-to-pos,gradientFrom:grad-from,gradientTo:grad-to,gradientVia:grad-via,gradientViaPosition:grad-via-pos,borderRadius:bdr/rounded,borderTopLeftRadius:bdr-tl/roundedTopLeft,borderTopRightRadius:bdr-tr/roundedTopRight,borderBottomRightRadius:bdr-br/roundedBottomRight,borderBottomLeftRadius:bdr-bl/roundedBottomLeft,borderTopRadius:bdr-t/roundedTop,borderRightRadius:bdr-r/roundedRight,borderBottomRadius:bdr-b/roundedBottom,borderLeftRadius:bdr-l/roundedLeft,borderStartStartRadius:bdr-ss/roundedStartStart,borderStartEndRadius:bdr-se/roundedStartEnd,borderStartRadius:bdr-s/roundedStart,borderEndStartRadius:bdr-es/roundedEndStart,borderEndEndRadius:bdr-ee/roundedEndEnd,borderEndRadius:bdr-e/roundedEnd,border:bd,borderWidth:bd-w,borderTopWidth:bd-t-w,borderLeftWidth:bd-l-w,borderRightWidth:bd-r-w,borderBottomWidth:bd-b-w,borderBlockStartWidth:bd-bs-w,borderBlockEndWidth:bd-be-w,borderColor:bd-c,borderInline:bd-x/borderX,borderInlineWidth:bd-x-w/borderXWidth,borderInlineColor:bd-x-c/borderXColor,borderBlock:bd-y/borderY,borderBlockWidth:bd-y-w/borderYWidth,borderBlockColor:bd-y-c/borderYColor,borderLeft:bd-l,borderLeftColor:bd-l-c,borderInlineStart:bd-s/borderStart,borderInlineStartWidth:bd-s-w/borderStartWidth,borderInlineStartColor:bd-s-c/borderStartColor,borderRight:bd-r,borderRightColor:bd-r-c,borderInlineEnd:bd-e/borderEnd,borderInlineEndWidth:bd-e-w/borderEndWidth,borderInlineEndColor:bd-e-c/borderEndColor,borderTop:bd-t,borderTopColor:bd-t-c,borderBottom:bd-b,borderBottomColor:bd-b-c,borderBlockEnd:bd-be,borderBlockEndColor:bd-be-c,borderBlockStart:bd-bs,borderBlockStartColor:bd-bs-c,opacity:op,boxShadow:bx-sh/shadow,boxShadowColor:bx-sh-c/shadowColor,mixBlendMode:mix-bm,filter:filter,brightness:brightness,contrast:contrast,grayscale:grayscale,hueRotate:hue-rotate,invert:invert,saturate:saturate,sepia:sepia,dropShadow:drop-shadow,blur:blur,backdropFilter:bkdp,backdropBlur:bkdp-blur,backdropBrightness:bkdp-brightness,backdropContrast:bkdp-contrast,backdropGrayscale:bkdp-grayscale,backdropHueRotate:bkdp-hue-rotate,backdropInvert:bkdp-invert,backdropOpacity:bkdp-opacity,backdropSaturate:bkdp-saturate,backdropSepia:bkdp-sepia,borderCollapse:bd-cl,borderSpacing:bd-sp,borderSpacingX:bd-sx,borderSpacingY:bd-sy,tableLayout:tbl,transitionTimingFunction:trs-tmf,transitionDelay:trs-dly,transitionDuration:trs-dur,transitionProperty:trs-prop,transition:trs,animation:anim,animationName:anim-n,animationTimingFunction:anim-tmf,animationDuration:anim-dur,animationDelay:anim-dly,animationPlayState:anim-ps,animationComposition:anim-comp,animationFillMode:anim-fm,animationDirection:anim-dir,animationIterationCount:anim-ic,animationRange:anim-r,animationState:anim-s,animationRangeStart:anim-rs,animationRangeEnd:anim-re,animationTimeline:anim-tl,transformOrigin:trf-o,transformBox:trf-b,transformStyle:trf-s,transform:trf,rotate:rotate,rotateX:rotate-x,rotateY:rotate-y,rotateZ:rotate-z,scale:scale,scaleX:scale-x,scaleY:scale-y,translate:translate,translateX:translate-x/x,translateY:translate-y/y,translateZ:translate-z/z,accentColor:ac-c,caretColor:ca-c,scrollBehavior:scr-bhv,scrollbar:scr-bar,scrollbarColor:scr-bar-c,scrollbarGutter:scr-bar-g,scrollbarWidth:scr-bar-w,scrollMargin:scr-m,scrollMarginLeft:scr-ml,scrollMarginRight:scr-mr,scrollMarginTop:scr-mt,scrollMarginBottom:scr-mb,scrollMarginBlock:scr-my/scrollMarginY,scrollMarginBlockEnd:scr-mbe,scrollMarginBlockStart:scr-mbt,scrollMarginInline:scr-mx/scrollMarginX,scrollMarginInlineEnd:scr-me,scrollMarginInlineStart:scr-ms,scrollPadding:scr-p,scrollPaddingBlock:scr-py/scrollPaddingY,scrollPaddingBlockStart:scr-pbs,scrollPaddingBlockEnd:scr-pbe,scrollPaddingInline:scr-px/scrollPaddingX,scrollPaddingInlineEnd:scr-pe,scrollPaddingInlineStart:scr-ps,scrollPaddingLeft:scr-pl,scrollPaddingRight:scr-pr,scrollPaddingTop:scr-pt,scrollPaddingBottom:scr-pb,scrollSnapAlign:scr-sa,scrollSnapStop:scrs-s,scrollSnapType:scrs-t,scrollSnapStrictness:scrs-strt,scrollSnapMargin:scrs-m,scrollSnapMarginTop:scrs-mt,scrollSnapMarginBottom:scrs-mb,scrollSnapMarginLeft:scrs-ml,scrollSnapMarginRight:scrs-mr,scrollSnapCoordinate:scrs-c,scrollSnapDestination:scrs-d,scrollSnapPointsX:scrs-px,scrollSnapPointsY:scrs-py,scrollSnapTypeX:scrs-tx,scrollSnapTypeY:scrs-ty,scrollTimeline:scrtl,scrollTimelineAxis:scrtl-a,scrollTimelineName:scrtl-n,touchAction:tch-a,userSelect:us,overflow:ov,overflowWrap:ov-wrap,overflowX:ov-x,overflowY:ov-y,overflowAnchor:ov-a,overflowBlock:ov-b,overflowInline:ov-i,overflowClipBox:ovcp-bx,overflowClipMargin:ovcp-m,overscrollBehaviorBlock:ovs-bb,overscrollBehaviorInline:ovs-bi,fill:fill,stroke:stk,strokeWidth:stk-w,strokeDasharray:stk-dsh,strokeDashoffset:stk-do,strokeLinecap:stk-lc,strokeLinejoin:stk-lj,strokeMiterlimit:stk-ml,strokeOpacity:stk-op,srOnly:sr,debug:debug,appearance:ap,backfaceVisibility:bfv,clipPath:cp-path,hyphens:hy,mask:msk,maskImage:msk-i,maskSize:msk-s,textSizeAdjust:txt-adj,container:cq,containerName:cq-n,containerType:cq-t,cursor:cursor,textStyle:textStyle"
5
+
6
+ const classNameByProp = new Map()
7
+ const shorthands = new Map()
8
+ utilities.split(',').forEach((utility) => {
9
+ const [prop, meta] = utility.split(':')
10
+ const [className, ...shorthandList] = meta.split('/')
11
+ classNameByProp.set(prop, className)
12
+ if (shorthandList.length) {
13
+ shorthandList.forEach((shorthand) => {
14
+ shorthands.set(shorthand === '1' ? className : shorthand, prop)
15
+ })
16
+ }
17
+ })
18
+
19
+ const resolveShorthand = (prop) => shorthands.get(prop) || prop
20
+
21
+ const context = {
22
+ hash: true,
23
+ conditions: {
24
+ shift: sortConditions,
25
+ finalize: finalizeConditions,
26
+ breakpoints: { keys: ["base","sm","md","lg","xl","2xl"] }
27
+ },
28
+ utility: {
29
+
30
+ transform: (prop, value) => {
31
+ const key = resolveShorthand(prop)
32
+ const propKey = classNameByProp.get(key) || hypenateProperty(key)
33
+ return { className: `${propKey}_${withoutSpace(value)}` }
34
+ },
35
+ hasShorthand: true,
36
+ toHash: (path, hashFn) => hashFn(path.join(":")),
37
+ resolveShorthand: resolveShorthand,
38
+ }
39
+ }
40
+
41
+ const cssFn = createCss(context)
42
+ export const css = (...styles) => cssFn(mergeCss(...styles))
43
+ css.raw = (...styles) => mergeCss(...styles)
44
+
45
+ export const { mergeCss, assignCss } = createMergeCss(context)
@@ -0,0 +1,6 @@
1
+ /* eslint-disable */
2
+ import type { RecipeCreatorFn } from '../types/recipe';
3
+
4
+ export declare const cva: RecipeCreatorFn
5
+
6
+ export type { RecipeVariant, RecipeVariantProps } from '../types/recipe';
@@ -0,0 +1,87 @@
1
+ import { compact, mergeProps, memo, splitProps, uniq } from '../helpers.mjs';
2
+ import { css, mergeCss } from './css.mjs';
3
+
4
+ const defaults = (conf) => ({
5
+ base: {},
6
+ variants: {},
7
+ defaultVariants: {},
8
+ compoundVariants: [],
9
+ ...conf,
10
+ })
11
+
12
+ export function cva(config) {
13
+ const { base, variants, defaultVariants, compoundVariants } = defaults(config)
14
+ const getVariantProps = (variants) => ({ ...defaultVariants, ...compact(variants) })
15
+
16
+ function resolve(props = {}) {
17
+ const computedVariants = getVariantProps(props)
18
+ let variantCss = { ...base }
19
+ for (const [key, value] of Object.entries(computedVariants)) {
20
+ if (variants[key]?.[value]) {
21
+ variantCss = mergeCss(variantCss, variants[key][value])
22
+ }
23
+ }
24
+ const compoundVariantCss = getCompoundVariantCss(compoundVariants, computedVariants)
25
+ return mergeCss(variantCss, compoundVariantCss)
26
+ }
27
+
28
+ function merge(__cva) {
29
+ const override = defaults(__cva.config)
30
+ const variantKeys = uniq(__cva.variantKeys, Object.keys(variants))
31
+ return cva({
32
+ base: mergeCss(base, override.base),
33
+ variants: Object.fromEntries(
34
+ variantKeys.map((key) => [key, mergeCss(variants[key], override.variants[key])]),
35
+ ),
36
+ defaultVariants: mergeProps(defaultVariants, override.defaultVariants),
37
+ compoundVariants: [...compoundVariants, ...override.compoundVariants],
38
+ })
39
+ }
40
+
41
+ function cvaFn(props) {
42
+ return css(resolve(props))
43
+ }
44
+
45
+ const variantKeys = Object.keys(variants)
46
+
47
+ function splitVariantProps(props) {
48
+ return splitProps(props, variantKeys)
49
+ }
50
+
51
+ const variantMap = Object.fromEntries(Object.entries(variants).map(([key, value]) => [key, Object.keys(value)]))
52
+
53
+ return Object.assign(memo(cvaFn), {
54
+ __cva__: true,
55
+ variantMap,
56
+ variantKeys,
57
+ raw: resolve,
58
+ config,
59
+ merge,
60
+ splitVariantProps,
61
+ getVariantProps
62
+ })
63
+ }
64
+
65
+ export function getCompoundVariantCss(compoundVariants, variantMap) {
66
+ let result = {}
67
+ compoundVariants.forEach((compoundVariant) => {
68
+ const isMatching = Object.entries(compoundVariant).every(([key, value]) => {
69
+ if (key === 'css') return true
70
+
71
+ const values = Array.isArray(value) ? value : [value]
72
+ return values.some((value) => variantMap[key] === value)
73
+ })
74
+
75
+ if (isMatching) {
76
+ result = mergeCss(result, compoundVariant.css)
77
+ }
78
+ })
79
+
80
+ return result
81
+ }
82
+
83
+ export function assertCompoundVariant(name, compoundVariants, variants, prop) {
84
+ if (compoundVariants.length > 0 && typeof variants?.[prop] === 'object') {
85
+ throw new Error(`[recipe:${name}:${prop}] Conditions are not supported when using compound variants.`)
86
+ }
87
+ }
@@ -0,0 +1,5 @@
1
+ /* eslint-disable */
2
+ type Argument = string | boolean | null | undefined
3
+
4
+ /** Conditionally join classNames into a single string */
5
+ export declare function cx(...args: Argument[]): string
@@ -0,0 +1,15 @@
1
+ function cx() {
2
+ let str = '',
3
+ i = 0,
4
+ arg
5
+
6
+ for (; i < arguments.length; ) {
7
+ if ((arg = arguments[i++]) && typeof arg === 'string') {
8
+ str && (str += ' ')
9
+ str += arg
10
+ }
11
+ }
12
+ return str
13
+ }
14
+
15
+ export { cx }
@@ -0,0 +1,5 @@
1
+ /* eslint-disable */
2
+ export * from './css';
3
+ export * from './cx';
4
+ export * from './cva';
5
+ export * from './sva';
@@ -0,0 +1,4 @@
1
+ export * from './css.mjs';
2
+ export * from './cx.mjs';
3
+ export * from './cva.mjs';
4
+ export * from './sva.mjs';
@@ -0,0 +1,4 @@
1
+ /* eslint-disable */
2
+ import type { SlotRecipeCreatorFn } from '../types/recipe';
3
+
4
+ export declare const sva: SlotRecipeCreatorFn