@trypattern/sdk 0.0.0-stage → 0.1.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 (247) hide show
  1. package/README.md +127 -2
  2. package/dist/access.d.ts +31 -0
  3. package/dist/access.js +72 -0
  4. package/dist/actions.d.ts +57 -0
  5. package/dist/actions.js +198 -0
  6. package/dist/api.d.ts +20 -0
  7. package/dist/api.js +34 -0
  8. package/dist/app.d.ts +106 -0
  9. package/dist/app.js +224 -0
  10. package/dist/appearance.d.ts +7 -0
  11. package/dist/appearance.js +2 -0
  12. package/dist/auth/sessionApi.d.ts +41 -0
  13. package/dist/auth/sessionApi.js +158 -0
  14. package/dist/auth/sessionStore.d.ts +20 -0
  15. package/dist/auth/sessionStore.js +40 -0
  16. package/dist/auth/user.d.ts +11 -0
  17. package/dist/auth/user.js +9 -0
  18. package/dist/builtins/Account.d.ts +25 -0
  19. package/dist/builtins/Account.js +15 -0
  20. package/dist/builtins/Palette.d.ts +29 -0
  21. package/dist/builtins/Palette.js +63 -0
  22. package/dist/builtins/SignIn.d.ts +28 -0
  23. package/dist/builtins/SignIn.js +60 -0
  24. package/dist/builtins/Toasts.d.ts +32 -0
  25. package/dist/builtins/Toasts.js +24 -0
  26. package/dist/builtins/actions.d.ts +2 -0
  27. package/dist/builtins/actions.js +45 -0
  28. package/dist/cache.d.ts +24 -0
  29. package/dist/cache.js +112 -0
  30. package/dist/cli/app.d.ts +2 -0
  31. package/dist/cli/app.js +1329 -0
  32. package/dist/cli/screenshot.d.ts +1 -0
  33. package/dist/cli/screenshot.js +96 -0
  34. package/dist/cli/tools.d.ts +12 -0
  35. package/dist/cli/tools.js +35 -0
  36. package/dist/components/AppFrame.d.ts +14 -0
  37. package/dist/components/AppFrame.js +64 -0
  38. package/dist/components/AppearancePicker.d.ts +1 -0
  39. package/dist/components/AppearancePicker.js +12 -0
  40. package/dist/components/Avatar.d.ts +9 -0
  41. package/dist/components/Avatar.js +63 -0
  42. package/dist/components/Badge.d.ts +11 -0
  43. package/dist/components/Badge.js +87 -0
  44. package/dist/components/Button.d.ts +23 -0
  45. package/dist/components/Button.js +249 -0
  46. package/dist/components/Card.d.ts +12 -0
  47. package/dist/components/Card.js +38 -0
  48. package/dist/components/CommandMenu.d.ts +23 -0
  49. package/dist/components/CommandMenu.js +214 -0
  50. package/dist/components/CommandPalette.d.ts +1 -0
  51. package/dist/components/CommandPalette.js +7 -0
  52. package/dist/components/Content.d.ts +7 -0
  53. package/dist/components/Content.js +24 -0
  54. package/dist/components/ContextMenu.d.ts +8 -0
  55. package/dist/components/ContextMenu.js +23 -0
  56. package/dist/components/Dialog.d.ts +11 -0
  57. package/dist/components/Dialog.js +81 -0
  58. package/dist/components/Divider.d.ts +6 -0
  59. package/dist/components/Divider.js +15 -0
  60. package/dist/components/EmptyState.d.ts +8 -0
  61. package/dist/components/EmptyState.js +24 -0
  62. package/dist/components/Form.d.ts +9 -0
  63. package/dist/components/Form.js +23 -0
  64. package/dist/components/Icon.d.ts +10 -0
  65. package/dist/components/Icon.js +22 -0
  66. package/dist/components/IconButton.d.ts +14 -0
  67. package/dist/components/IconButton.js +53 -0
  68. package/dist/components/Kbd.d.ts +6 -0
  69. package/dist/components/Kbd.js +67 -0
  70. package/dist/components/Link.d.ts +9 -0
  71. package/dist/components/Link.js +35 -0
  72. package/dist/components/ListRow.d.ts +12 -0
  73. package/dist/components/ListRow.js +62 -0
  74. package/dist/components/LoadingRows.d.ts +5 -0
  75. package/dist/components/LoadingRows.js +6 -0
  76. package/dist/components/Menu.d.ts +12 -0
  77. package/dist/components/Menu.js +33 -0
  78. package/dist/components/MenuItems.d.ts +21 -0
  79. package/dist/components/MenuItems.js +32 -0
  80. package/dist/components/Placement.d.ts +21 -0
  81. package/dist/components/Placement.js +1 -0
  82. package/dist/components/Popup.d.ts +8 -0
  83. package/dist/components/Popup.js +43 -0
  84. package/dist/components/PopupItem.d.ts +8 -0
  85. package/dist/components/PopupItem.js +51 -0
  86. package/dist/components/PropertyRow.d.ts +7 -0
  87. package/dist/components/PropertyRow.js +23 -0
  88. package/dist/components/Row.d.ts +16 -0
  89. package/dist/components/Row.js +27 -0
  90. package/dist/components/Screen.d.ts +13 -0
  91. package/dist/components/Screen.js +56 -0
  92. package/dist/components/Scrim.d.ts +8 -0
  93. package/dist/components/Scrim.js +40 -0
  94. package/dist/components/ScrollArea.d.ts +15 -0
  95. package/dist/components/ScrollArea.js +13 -0
  96. package/dist/components/SegmentedControl.d.ts +17 -0
  97. package/dist/components/SegmentedControl.js +68 -0
  98. package/dist/components/Select.d.ts +17 -0
  99. package/dist/components/Select.js +107 -0
  100. package/dist/components/SettingsRow.d.ts +8 -0
  101. package/dist/components/SettingsRow.js +32 -0
  102. package/dist/components/Sidebar.d.ts +20 -0
  103. package/dist/components/Sidebar.js +138 -0
  104. package/dist/components/SignInScreen.d.ts +1 -0
  105. package/dist/components/SignInScreen.js +40 -0
  106. package/dist/components/Size.d.ts +1 -0
  107. package/dist/components/Size.js +1 -0
  108. package/dist/components/Skeleton.d.ts +8 -0
  109. package/dist/components/Skeleton.js +48 -0
  110. package/dist/components/Spinner.d.ts +6 -0
  111. package/dist/components/Spinner.js +54 -0
  112. package/dist/components/Stack.d.ts +14 -0
  113. package/dist/components/Stack.js +19 -0
  114. package/dist/components/Switch.d.ts +10 -0
  115. package/dist/components/Switch.js +71 -0
  116. package/dist/components/Text.d.ts +21 -0
  117. package/dist/components/Text.js +77 -0
  118. package/dist/components/TextField.d.ts +25 -0
  119. package/dist/components/TextField.js +68 -0
  120. package/dist/components/Toaster.d.ts +1 -0
  121. package/dist/components/Toaster.js +83 -0
  122. package/dist/components/Tooltip.d.ts +8 -0
  123. package/dist/components/Tooltip.js +43 -0
  124. package/dist/components/controlLook.d.ts +60 -0
  125. package/dist/components/controlLook.js +67 -0
  126. package/dist/components/frame.d.ts +4 -0
  127. package/dist/components/frame.js +2 -0
  128. package/dist/components/icons.d.ts +58 -0
  129. package/dist/components/icons.js +105 -0
  130. package/dist/components/interaction.d.ts +12 -0
  131. package/dist/components/interaction.js +22 -0
  132. package/dist/components/spacing.d.ts +118 -0
  133. package/dist/components/spacing.js +46 -0
  134. package/dist/components/tones.d.ts +28 -0
  135. package/dist/components/tones.js +12 -0
  136. package/dist/entityStore.d.ts +46 -0
  137. package/dist/entityStore.js +160 -0
  138. package/dist/flows/accessFlows.d.ts +9 -0
  139. package/dist/flows/accessFlows.js +151 -0
  140. package/dist/flows/browser.d.ts +32 -0
  141. package/dist/flows/browser.js +164 -0
  142. package/dist/flows/contactSheet.d.ts +1 -0
  143. package/dist/flows/contactSheet.js +63 -0
  144. package/dist/flows/flowBrowser.d.ts +23 -0
  145. package/dist/flows/flowBrowser.js +21 -0
  146. package/dist/flows/flowSetup.d.ts +3 -0
  147. package/dist/flows/flowSetup.js +35 -0
  148. package/dist/flows/flows.d.ts +41 -0
  149. package/dist/flows/flows.js +148 -0
  150. package/dist/flows/screenshotName.d.ts +1 -0
  151. package/dist/flows/screenshotName.js +6 -0
  152. package/dist/gate.d.ts +8 -0
  153. package/dist/gate.js +52 -0
  154. package/dist/hooks/appContext.d.ts +14 -0
  155. package/dist/hooks/appContext.js +5 -0
  156. package/dist/hooks/appHooks.d.ts +21 -0
  157. package/dist/hooks/appHooks.js +24 -0
  158. package/dist/hooks/useAnimatesOnChange.d.ts +1 -0
  159. package/dist/hooks/useAnimatesOnChange.js +14 -0
  160. package/dist/hooks/useStoreState.d.ts +6 -0
  161. package/dist/hooks/useStoreState.js +5 -0
  162. package/dist/index.d.ts +40 -0
  163. package/dist/index.js +19 -0
  164. package/dist/memoryApi.d.ts +19 -0
  165. package/dist/memoryApi.js +42 -0
  166. package/dist/model.d.ts +94 -0
  167. package/dist/model.js +243 -0
  168. package/dist/page.d.ts +11 -0
  169. package/dist/page.js +9 -0
  170. package/dist/platform.d.ts +1 -0
  171. package/dist/platform.js +5 -0
  172. package/dist/react.d.ts +46 -0
  173. package/dist/react.js +38 -0
  174. package/dist/registered.d.ts +54 -0
  175. package/dist/registered.js +17 -0
  176. package/dist/routes.d.ts +38 -0
  177. package/dist/routes.js +21 -0
  178. package/dist/rules/checkAllFiles.d.ts +1 -0
  179. package/dist/rules/checkAllFiles.js +741 -0
  180. package/dist/rules/checkApiRouting.d.ts +1 -0
  181. package/dist/rules/checkApiRouting.js +112 -0
  182. package/dist/rules/lintPlugin.d.ts +252 -0
  183. package/dist/rules/lintPlugin.js +1157 -0
  184. package/dist/rules/messages.d.ts +48 -0
  185. package/dist/rules/messages.js +48 -0
  186. package/dist/rules/themeTokens.d.ts +6 -0
  187. package/dist/rules/themeTokens.js +64 -0
  188. package/dist/schema.d.ts +2 -0
  189. package/dist/schema.js +1 -0
  190. package/dist/server/auth.d.ts +115 -0
  191. package/dist/server/auth.js +131 -0
  192. package/dist/server/authService.d.ts +9 -0
  193. package/dist/server/authService.js +50 -0
  194. package/dist/server/createServer.d.ts +357 -0
  195. package/dist/server/createServer.js +62 -0
  196. package/dist/server/env.d.ts +15 -0
  197. package/dist/server/env.js +1 -0
  198. package/dist/server/index.d.ts +8 -0
  199. package/dist/server/index.js +5 -0
  200. package/dist/server/session.d.ts +28 -0
  201. package/dist/server/session.js +54 -0
  202. package/dist/server/sessions.d.ts +92 -0
  203. package/dist/server/sessions.js +47 -0
  204. package/dist/server/signInWire.d.ts +52 -0
  205. package/dist/server/signInWire.js +22 -0
  206. package/dist/server/tables.d.ts +242 -0
  207. package/dist/server/tables.js +246 -0
  208. package/dist/server/users.d.ts +189 -0
  209. package/dist/server/users.js +49 -0
  210. package/dist/shortcuts.d.ts +3 -0
  211. package/dist/shortcuts.js +40 -0
  212. package/dist/start.d.ts +20 -0
  213. package/dist/start.js +121 -0
  214. package/dist/state.d.ts +14 -0
  215. package/dist/state.js +17 -0
  216. package/dist/store.d.ts +43 -0
  217. package/dist/store.js +198 -0
  218. package/dist/subscribers.d.ts +5 -0
  219. package/dist/subscribers.js +13 -0
  220. package/dist/table.d.ts +143 -0
  221. package/dist/table.js +91 -0
  222. package/dist/tables.d.ts +77 -0
  223. package/dist/tables.js +216 -0
  224. package/dist/theme/reset.css +84 -0
  225. package/dist/theme/scales.d.ts +76 -0
  226. package/dist/theme/scales.js +82 -0
  227. package/dist/theme/tokens.stylex.d.ts +218 -0
  228. package/dist/theme/tokens.stylex.js +233 -0
  229. package/dist/vite/commandBridge.d.ts +2 -0
  230. package/dist/vite/commandBridge.js +46 -0
  231. package/dist/vite/designManifest.d.ts +25 -0
  232. package/dist/vite/designManifest.js +191 -0
  233. package/dist/vite/localWorker.d.ts +4 -0
  234. package/dist/vite/localWorker.js +59 -0
  235. package/dist/vite/rootAlias.d.ts +2 -0
  236. package/dist/vite/rootAlias.js +15 -0
  237. package/dist/vite/vite.d.ts +7 -0
  238. package/dist/vite/vite.js +88 -0
  239. package/dist/wire.d.ts +7 -0
  240. package/dist/wire.js +1 -0
  241. package/package.json +99 -3
  242. package/presets/lintPlugin.js +7 -0
  243. package/presets/oxlint.json +167 -0
  244. package/presets/register.d.ts +19 -0
  245. package/presets/server.d.ts +2 -0
  246. package/presets/tsconfig.app.json +29 -0
  247. package/presets/tsconfig.server.json +27 -0
@@ -0,0 +1,249 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Button as BaseButton } from '@base-ui/react/button';
3
+ import { Link as RouterLink } from 'react-router';
4
+ import * as stylex from '@stylexjs/stylex';
5
+ import { colors, controls, fontWeights, motion, shadows } from "../theme/tokens.stylex.js";
6
+ import { controlSizes } from "./controlLook.js";
7
+ import { Icon } from "./Icon.js";
8
+ import { interact, textOf } from "./interaction.js";
9
+ import { Kbd } from "./Kbd.js";
10
+ import { Spinner } from "./Spinner.js";
11
+ export function Button({ children, variant = 'primary', tone = 'neutral', size = 'md', to, icon, trailingIcon, shortcut, type = 'button', disabled = false, isPending = false, isFullWidth = false, onClick, style }) {
12
+ const isDisabled = disabled || isPending;
13
+ const report = () => {
14
+ interact({ primitive: 'Button', event: 'click', label: textOf(children) });
15
+ onClick?.();
16
+ };
17
+ const className = stylex.props(styles.button, controlSizes[size], icon !== undefined && leadingIconSizes[size], trailingIcon !== undefined && trailingIconSizes[size], looks[`${variant}${toneKeys[tone]}`], !isDisabled && hovers[`${variant}${toneKeys[tone]}`], isDisabled && styles.disabled, isDisabled && variant === 'transparent' && styles.disabledTransparent, isFullWidth && styles.fullWidth, style).className;
18
+ const content = (_jsxs("span", { ...stylex.props(styles.stack), children: [_jsxs("span", { ...stylex.props(styles.content, isPending && styles.hidden), children: [icon === undefined ? null : _jsx(Icon, { name: icon, size: size }), _jsx("span", { ...stylex.props(styles.label, shortcut !== undefined && styles.labelBeforeShortcut), children: children }), trailingIcon === undefined ? null : (_jsx(Icon, { name: trailingIcon, size: size })), shortcut === undefined ? null : _jsx(Kbd, { keys: shortcut })] }), isPending ? (_jsx("span", { "aria-hidden": "true", ...stylex.props(styles.pending), children: _jsx(Spinner, { size: size }) })) : null] }));
19
+ if (to !== undefined) {
20
+ return (_jsx(RouterLink, { to: to, onClick: report, className: className, children: content }));
21
+ }
22
+ return (_jsx(BaseButton, { type: type, disabled: isDisabled, focusableWhenDisabled: true, "aria-busy": isPending || undefined, onClick: report, className: className, children: content }));
23
+ }
24
+ const toneKeys = {
25
+ neutral: 'Neutral',
26
+ brand: 'Brand',
27
+ danger: 'Danger'
28
+ };
29
+ const styles = stylex.create({
30
+ button: {
31
+ position: 'relative',
32
+ display: 'flex',
33
+ flexShrink: 0,
34
+ alignItems: 'center',
35
+ justifyContent: 'center',
36
+ minWidth: 0,
37
+ fontWeight: fontWeights.medium,
38
+ whiteSpace: 'nowrap',
39
+ textDecoration: 'none',
40
+ touchAction: 'manipulation',
41
+ outlineOffset: 0,
42
+ transitionTimingFunction: motion.easeOut,
43
+ transitionDuration: motion.fast,
44
+ transitionProperty: 'color, background-color, transform'
45
+ },
46
+ fullWidth: {
47
+ justifyContent: 'flex-start',
48
+ width: '100%'
49
+ },
50
+ stack: {
51
+ display: 'grid',
52
+ flexGrow: 1,
53
+ gridTemplateColumns: 'minmax(0, 1fr)',
54
+ gap: 'inherit',
55
+ justifyContent: 'inherit',
56
+ minWidth: 0,
57
+ overflow: 'clip'
58
+ },
59
+ content: {
60
+ display: 'flex',
61
+ gridRowStart: 1,
62
+ gridColumnStart: 1,
63
+ gap: 'inherit',
64
+ alignItems: 'center',
65
+ justifyContent: 'inherit',
66
+ minWidth: 0,
67
+ transitionTimingFunction: motion.easeOut,
68
+ transitionDuration: motion.base,
69
+ transitionProperty: 'opacity, transform'
70
+ },
71
+ hidden: {
72
+ opacity: 0,
73
+ transform: 'translateY(24px)'
74
+ },
75
+ pending: {
76
+ display: 'flex',
77
+ gridRowStart: 1,
78
+ gridColumnStart: 1,
79
+ alignItems: 'center',
80
+ justifyContent: 'center',
81
+ pointerEvents: 'none'
82
+ },
83
+ label: {
84
+ overflow: 'hidden',
85
+ textOverflow: 'ellipsis'
86
+ },
87
+ labelBeforeShortcut: {
88
+ flexGrow: 1,
89
+ textAlign: 'start'
90
+ },
91
+ disabled: {
92
+ color: colors.disabledForeground,
93
+ backgroundColor: colors.disabled,
94
+ boxShadow: 'none'
95
+ },
96
+ disabledTransparent: {
97
+ backgroundColor: 'transparent'
98
+ }
99
+ });
100
+ const leadingIconSizes = stylex.create({
101
+ xs: { paddingInlineStart: `calc(${controls.paddingXs} - 2px)` },
102
+ sm: { paddingInlineStart: `calc(${controls.paddingSm} - 2px)` },
103
+ md: { paddingInlineStart: `calc(${controls.paddingMd} - 4px)` },
104
+ lg: { paddingInlineStart: `calc(${controls.paddingLg} - 2px)` },
105
+ xl: { paddingInlineStart: `calc(${controls.paddingXl} - 4px)` }
106
+ });
107
+ const trailingIconSizes = stylex.create({
108
+ xs: { paddingInlineEnd: `calc(${controls.paddingXs} - 2px)` },
109
+ sm: { paddingInlineEnd: `calc(${controls.paddingSm} - 2px)` },
110
+ md: { paddingInlineEnd: `calc(${controls.paddingMd} - 4px)` },
111
+ lg: { paddingInlineEnd: `calc(${controls.paddingLg} - 2px)` },
112
+ xl: { paddingInlineEnd: `calc(${controls.paddingXl} - 4px)` }
113
+ });
114
+ const looks = stylex.create({
115
+ primaryNeutral: {
116
+ color: colors.onInvertedForeground,
117
+ backgroundColor: colors.invertedSolid
118
+ },
119
+ primaryBrand: {
120
+ color: colors.onBrandSolidForeground,
121
+ backgroundColor: colors.brandSolid
122
+ },
123
+ primaryDanger: {
124
+ color: colors.onDangerSolidForeground,
125
+ backgroundColor: colors.dangerSolid
126
+ },
127
+ secondaryNeutral: {
128
+ color: colors.primaryForeground,
129
+ backgroundColor: colors.componentOnContainerStrong,
130
+ boxShadow: shadows.default
131
+ },
132
+ secondaryBrand: {
133
+ color: colors.brandForeground,
134
+ backgroundColor: colors.componentOnContainerStrong,
135
+ boxShadow: shadows.default
136
+ },
137
+ secondaryDanger: {
138
+ color: colors.dangerForeground,
139
+ backgroundColor: colors.componentOnContainerStrong,
140
+ boxShadow: shadows.default
141
+ },
142
+ tertiaryNeutral: {
143
+ color: colors.secondaryForeground,
144
+ backgroundColor: colors.component
145
+ },
146
+ tertiaryBrand: {
147
+ color: colors.onBrandSubtleForeground,
148
+ backgroundColor: colors.brandSubtle
149
+ },
150
+ tertiaryDanger: {
151
+ color: colors.dangerForeground,
152
+ backgroundColor: colors.dangerSubtle
153
+ },
154
+ transparentNeutral: {
155
+ color: colors.secondaryForeground,
156
+ backgroundColor: 'transparent'
157
+ },
158
+ transparentBrand: {
159
+ color: colors.brandForeground,
160
+ backgroundColor: 'transparent'
161
+ },
162
+ transparentDanger: {
163
+ color: colors.dangerForeground,
164
+ backgroundColor: 'transparent'
165
+ }
166
+ });
167
+ const hovers = stylex.create({
168
+ primaryNeutral: {
169
+ backgroundColor: {
170
+ default: colors.invertedSolid,
171
+ ':hover': colors.invertedSolidHover,
172
+ ':active': colors.invertedSolidActive
173
+ }
174
+ },
175
+ primaryBrand: {
176
+ backgroundColor: {
177
+ default: colors.brandSolid,
178
+ ':hover': colors.brandSolidHover,
179
+ ':active': colors.brandSolidActive
180
+ }
181
+ },
182
+ primaryDanger: {
183
+ backgroundColor: {
184
+ default: colors.dangerSolid,
185
+ ':hover': colors.dangerSolidHover,
186
+ ':active': colors.dangerSolidActive
187
+ }
188
+ },
189
+ secondaryNeutral: {
190
+ backgroundColor: {
191
+ default: colors.componentOnContainerStrong,
192
+ ':hover': colors.componentOnContainerStrongHover
193
+ }
194
+ },
195
+ secondaryBrand: {
196
+ backgroundColor: {
197
+ default: colors.componentOnContainerStrong,
198
+ ':hover': colors.componentOnContainerStrongHover
199
+ }
200
+ },
201
+ secondaryDanger: {
202
+ backgroundColor: {
203
+ default: colors.componentOnContainerStrong,
204
+ ':hover': colors.componentOnContainerStrongHover
205
+ }
206
+ },
207
+ tertiaryNeutral: {
208
+ backgroundColor: {
209
+ default: colors.component,
210
+ ':hover': colors.componentHover,
211
+ ':active': colors.componentActive
212
+ }
213
+ },
214
+ tertiaryBrand: {
215
+ backgroundColor: {
216
+ default: colors.brandSubtle,
217
+ ':hover': colors.brandSubtleHover
218
+ }
219
+ },
220
+ tertiaryDanger: {
221
+ backgroundColor: {
222
+ default: colors.dangerSubtle,
223
+ ':hover': colors.dangerSubtleHover,
224
+ ':active': colors.dangerSubtleActive
225
+ }
226
+ },
227
+ transparentNeutral: {
228
+ color: {
229
+ default: colors.secondaryForeground,
230
+ ':hover': colors.primaryForeground
231
+ },
232
+ backgroundColor: {
233
+ default: 'transparent',
234
+ ':hover': colors.transparentHover
235
+ }
236
+ },
237
+ transparentBrand: {
238
+ backgroundColor: {
239
+ default: 'transparent',
240
+ ':hover': colors.transparentHover
241
+ }
242
+ },
243
+ transparentDanger: {
244
+ backgroundColor: {
245
+ default: 'transparent',
246
+ ':hover': colors.dangerSubtleHover
247
+ }
248
+ }
249
+ });
@@ -0,0 +1,12 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { Placement } from './Placement.ts';
3
+ type CardPadding = 'none' | 'sm' | 'md' | 'lg';
4
+ type CardProps = {
5
+ children: ReactNode;
6
+ surface?: 'subtle' | 'strong' | 'container';
7
+ padding?: CardPadding;
8
+ paddingBlock?: CardPadding;
9
+ style?: Placement;
10
+ };
11
+ export declare function Card({ children, surface, padding, paddingBlock, style }: CardProps): import("react").JSX.Element;
12
+ export {};
@@ -0,0 +1,38 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import * as stylex from '@stylexjs/stylex';
3
+ import { colors, radii, shadows, space } from "../theme/tokens.stylex.js";
4
+ export function Card({ children, surface = 'subtle', padding = 'lg', paddingBlock, style }) {
5
+ return (_jsx("div", { ...stylex.props(styles.card, surfaces[surface], paddings[padding], paddingBlock !== undefined && paddingBlocks[paddingBlock], style), children: children }));
6
+ }
7
+ const styles = stylex.create({
8
+ card: {
9
+ display: 'flex',
10
+ flexDirection: 'column',
11
+ overflow: 'hidden',
12
+ borderRadius: radii.xxl,
13
+ boxShadow: shadows.default
14
+ }
15
+ });
16
+ const surfaces = stylex.create({
17
+ subtle: {
18
+ backgroundColor: colors.componentOnContainerSubtle
19
+ },
20
+ strong: {
21
+ backgroundColor: colors.componentOnContainerStrong
22
+ },
23
+ container: {
24
+ backgroundColor: colors.container
25
+ }
26
+ });
27
+ const paddings = stylex.create({
28
+ none: { padding: 0 },
29
+ sm: { padding: space.sm },
30
+ md: { padding: space.md },
31
+ lg: { padding: space.lg }
32
+ });
33
+ const paddingBlocks = stylex.create({
34
+ none: { paddingBlock: 0 },
35
+ sm: { paddingBlock: space.sm },
36
+ md: { paddingBlock: space.md },
37
+ lg: { paddingBlock: space.lg }
38
+ });
@@ -0,0 +1,23 @@
1
+ import type { IconName } from './icons.ts';
2
+ export type CommandMenuItem = {
3
+ readonly id: string;
4
+ readonly label: string;
5
+ readonly group: string;
6
+ readonly icon: IconName;
7
+ readonly keys: readonly string[];
8
+ readonly isDanger: boolean;
9
+ };
10
+ type CommandMenuProps = {
11
+ isOpen: boolean;
12
+ onOpenChange: (isOpen: boolean) => void;
13
+ query: string;
14
+ onQueryChange: (query: string) => void;
15
+ results: readonly CommandMenuItem[];
16
+ highlighted: string | null;
17
+ onHighlight: (id: string) => void;
18
+ onMove: (by: 1 | -1) => void;
19
+ onRun: (id: string) => void;
20
+ onSubmit: () => void;
21
+ };
22
+ export declare function CommandMenu({ isOpen, onOpenChange, query, onQueryChange, results, highlighted, onHighlight, onMove, onRun, onSubmit }: CommandMenuProps): import("react").JSX.Element;
23
+ export {};
@@ -0,0 +1,214 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import * as stylex from '@stylexjs/stylex';
3
+ import { useId } from 'react';
4
+ import { borders, colors, controls, fontSizes, fontWeights, iconSizes, lineHeights, radii, space } from "../theme/tokens.stylex.js";
5
+ import { interact } from "./interaction.js";
6
+ import { Dialog } from "./Dialog.js";
7
+ import { Icon } from "./Icon.js";
8
+ import { Kbd } from "./Kbd.js";
9
+ import { ScrollArea } from "./ScrollArea.js";
10
+ export function CommandMenu({ isOpen, onOpenChange, query, onQueryChange, results, highlighted, onHighlight, onMove, onRun, onSubmit }) {
11
+ const listId = useId();
12
+ const optionId = (id) => `${listId}-${id}`;
13
+ const onKeyDown = (event) => {
14
+ if (event.nativeEvent.isComposing)
15
+ return;
16
+ if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {
17
+ event.preventDefault();
18
+ onMove(event.key === 'ArrowDown' ? 1 : -1);
19
+ }
20
+ else if (event.key === 'Enter') {
21
+ event.preventDefault();
22
+ const chosen = results.find((result) => result.id === highlighted);
23
+ if (chosen !== undefined) {
24
+ interact({
25
+ primitive: 'CommandMenu',
26
+ event: 'select',
27
+ label: chosen.label
28
+ });
29
+ }
30
+ onSubmit();
31
+ }
32
+ };
33
+ return (_jsxs(Dialog, { label: "Command menu", isOpen: isOpen, onOpenChange: onOpenChange, placement: "top", size: "lg", children: [_jsxs("div", { ...stylex.props(styles.search), children: [_jsx("span", { ...stylex.props(styles.searchIcon), children: _jsx(Icon, { name: "search" }) }), _jsx("input", { "aria-label": "Type a command or search", role: "combobox", "aria-expanded": "true", "aria-controls": listId, "aria-activedescendant": highlighted === null ? undefined : optionId(highlighted), autoComplete: "off", spellCheck: false, placeholder: "Type a command or search\u2026", value: query, onChange: (event) => onQueryChange(event.target.value), onKeyDown: onKeyDown, ...stylex.props(styles.input) })] }), _jsx(ScrollArea, { style: styles.scroll, children: _jsxs("div", { id: listId, role: "listbox", "aria-label": "Suggestions", ...stylex.props(styles.list), children: [results.length === 0 ? (_jsx("div", { ...stylex.props(styles.empty), children: "No results found" })) : null, sectionsOf(results).map(({ group, items }) => (_jsxs("div", { role: "group", "aria-label": group, ...stylex.props(styles.group), children: [_jsx("div", { "aria-hidden": "true", ...stylex.props(styles.heading), children: group }), _jsx("div", { ...stylex.props(styles.items), children: items.map((action) => {
34
+ const isHighlighted = action.id === highlighted;
35
+ return (_jsxs("div", { id: optionId(action.id), role: "option", "aria-selected": isHighlighted, ref: isHighlighted
36
+ ? (node) => node?.scrollIntoView({ block: 'nearest' })
37
+ : undefined, onPointerMove: () => {
38
+ if (!isHighlighted)
39
+ onHighlight(action.id);
40
+ }, onClick: () => {
41
+ interact({
42
+ primitive: 'CommandMenu',
43
+ event: 'select',
44
+ label: action.label
45
+ });
46
+ onRun(action.id);
47
+ }, ...stylex.props(styles.item, isHighlighted && styles.itemHighlighted, action.isDanger && styles.itemDanger, action.isDanger &&
48
+ isHighlighted &&
49
+ styles.itemDangerHighlighted), children: [_jsx("span", { ...stylex.props(styles.itemIcon, isHighlighted && styles.itemIconHighlighted, action.isDanger && styles.itemIconDanger), children: _jsx(Icon, { name: action.icon }) }), _jsx("span", { ...stylex.props(styles.itemLabel), children: action.label }), action.keys.length === 0 ? null : (_jsx(Kbd, { keys: action.keys }))] }, action.id));
50
+ }) })] }, group)))] }) }), _jsxs("div", { "aria-hidden": "true", ...stylex.props(styles.footer), children: [_jsx("span", { ...stylex.props(styles.glow) }), footerHints.map((hint) => (_jsxs("span", { ...stylex.props(styles.hint), children: [_jsx(Kbd, { keys: hint.keys }), hint.label] }, hint.label)))] })] }));
51
+ }
52
+ function sectionsOf(results) {
53
+ const sections = [];
54
+ for (const result of results) {
55
+ const last = sections.at(-1);
56
+ if (last?.group === result.group)
57
+ last.items.push(result);
58
+ else
59
+ sections.push({ group: result.group, items: [result] });
60
+ }
61
+ return sections;
62
+ }
63
+ const footerHints = [
64
+ { keys: ['arrowup', 'arrowdown'], label: 'Navigate' },
65
+ { keys: ['enter'], label: 'Select' },
66
+ { keys: ['escape'], label: 'Close' }
67
+ ];
68
+ const styles = stylex.create({
69
+ search: {
70
+ display: 'flex',
71
+ gap: space.sm,
72
+ alignItems: 'center',
73
+ padding: space.xs
74
+ },
75
+ searchIcon: {
76
+ display: 'flex',
77
+ alignItems: 'center',
78
+ height: controls.heightXl,
79
+ paddingInlineStart: controls.paddingMd,
80
+ color: colors.secondaryForeground
81
+ },
82
+ input: {
83
+ flexGrow: 1,
84
+ minWidth: 0,
85
+ height: controls.heightXl,
86
+ paddingInlineStart: 0,
87
+ paddingInlineEnd: controls.paddingMd,
88
+ fontFamily: 'inherit',
89
+ fontSize: fontSizes.bodySm,
90
+ fontWeight: fontWeights.semimedium,
91
+ fontFeatureSettings: 'inherit',
92
+ lineHeight: lineHeights.bodySm,
93
+ color: colors.primaryForeground,
94
+ outline: 'none',
95
+ backgroundColor: 'transparent',
96
+ borderWidth: 0,
97
+ '::placeholder': {
98
+ color: colors.tertiaryForeground
99
+ }
100
+ },
101
+ scroll: {
102
+ maxHeight: '456px'
103
+ },
104
+ list: {
105
+ display: 'flex',
106
+ flexDirection: 'column',
107
+ gap: space.sm,
108
+ paddingBlockEnd: space.sm,
109
+ scrollPaddingBlock: space.sm
110
+ },
111
+ empty: {
112
+ display: 'flex',
113
+ alignItems: 'center',
114
+ justifyContent: 'center',
115
+ height: `calc(2 * ${space.xxl})`,
116
+ fontSize: fontSizes.bodySm,
117
+ fontWeight: fontWeights.semimedium,
118
+ lineHeight: lineHeights.bodySm,
119
+ color: colors.secondaryForeground
120
+ },
121
+ group: {
122
+ paddingInline: space.sm
123
+ },
124
+ heading: {
125
+ padding: space.sm,
126
+ fontSize: fontSizes.captionLg,
127
+ fontWeight: fontWeights.medium,
128
+ lineHeight: lineHeights.caption,
129
+ color: colors.tertiaryForeground
130
+ },
131
+ items: {
132
+ display: 'flex',
133
+ flexDirection: 'column',
134
+ gap: space.xxs
135
+ },
136
+ item: {
137
+ display: 'flex',
138
+ gap: space.sm,
139
+ alignItems: 'center',
140
+ minHeight: `calc(${lineHeights.bodySm} + 2 * ${space.sm})`,
141
+ paddingBlock: space.sm,
142
+ paddingInlineStart: controls.paddingSm,
143
+ paddingInlineEnd: controls.paddingMd,
144
+ fontSize: fontSizes.bodySm,
145
+ fontWeight: fontWeights.semimedium,
146
+ lineHeight: lineHeights.bodySm,
147
+ color: colors.primaryForeground,
148
+ borderRadius: radii.lg
149
+ },
150
+ itemHighlighted: {
151
+ backgroundColor: colors.transparentHover
152
+ },
153
+ itemDanger: {
154
+ color: colors.onDangerSubtleForeground
155
+ },
156
+ itemDangerHighlighted: {
157
+ backgroundColor: colors.dangerSubtle
158
+ },
159
+ itemIcon: {
160
+ display: 'flex',
161
+ flexShrink: 0,
162
+ alignItems: 'center',
163
+ justifyContent: 'center',
164
+ width: iconSizes.xl,
165
+ height: iconSizes.xl,
166
+ color: colors.tertiaryForeground
167
+ },
168
+ itemIconHighlighted: {
169
+ color: colors.primaryForeground
170
+ },
171
+ itemIconDanger: {
172
+ color: 'inherit'
173
+ },
174
+ itemLabel: {
175
+ flexGrow: 1,
176
+ overflow: 'hidden',
177
+ textOverflow: 'ellipsis',
178
+ fontWeight: fontWeights.medium,
179
+ whiteSpace: 'nowrap'
180
+ },
181
+ footer: {
182
+ position: 'relative',
183
+ display: 'flex',
184
+ gap: space.lg,
185
+ alignItems: 'center',
186
+ minHeight: `calc(${controls.heightMd} + 2 * ${controls.paddingXs})`,
187
+ paddingBlock: controls.paddingXs,
188
+ paddingInlineStart: space.lg,
189
+ paddingInlineEnd: space.sm,
190
+ borderBlockStartColor: colors.borderDefault,
191
+ borderBlockStartStyle: 'solid',
192
+ borderBlockStartWidth: borders.hairline,
193
+ isolation: 'isolate'
194
+ },
195
+ glow: {
196
+ position: 'absolute',
197
+ insetInline: 0,
198
+ bottom: -28,
199
+ zIndex: -1,
200
+ height: controls.heightMd,
201
+ pointerEvents: 'none',
202
+ backgroundImage: colors.brandGradientSubtle,
203
+ borderRadius: radii.full,
204
+ filter: 'blur(25px)'
205
+ },
206
+ hint: {
207
+ display: 'flex',
208
+ gap: space.sm,
209
+ alignItems: 'center',
210
+ fontSize: fontSizes.captionLg,
211
+ lineHeight: lineHeights.caption,
212
+ color: colors.secondaryForeground
213
+ }
214
+ });
@@ -0,0 +1 @@
1
+ export declare function CommandPalette(): import("react").JSX.Element;
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useModel } from "../hooks/appContext.js";
3
+ import { CommandMenu } from "./CommandMenu.js";
4
+ export function CommandPalette() {
5
+ const palette = useModel('palette');
6
+ return (_jsx(CommandMenu, { isOpen: palette.isOpen, onOpenChange: (open) => (open ? palette.open() : palette.close()), query: palette.query, onQueryChange: (query) => palette.setQuery({ query }), results: palette.results, highlighted: palette.highlighted, onHighlight: (id) => palette.highlight({ id }), onMove: (by) => palette.moveHighlight({ by }), onRun: (id) => palette.run({ id }), onSubmit: palette.submit }));
7
+ }
@@ -0,0 +1,7 @@
1
+ import type { ReactNode } from 'react';
2
+ type ContentProps = {
3
+ children: ReactNode;
4
+ width?: 'xs' | 'sm' | 'md' | 'lg' | 'full';
5
+ };
6
+ export declare function Content({ children, width }: ContentProps): import("react").JSX.Element;
7
+ export {};
@@ -0,0 +1,24 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import * as stylex from '@stylexjs/stylex';
3
+ import { breakpoints, space, widths } from "../theme/tokens.stylex.js";
4
+ export function Content({ children, width = 'md' }) {
5
+ return (_jsx("div", { ...stylex.props(styles.content, columnWidths[width]), children: children }));
6
+ }
7
+ const styles = stylex.create({
8
+ content: {
9
+ width: '100%',
10
+ paddingBlock: space.xl,
11
+ paddingInline: {
12
+ default: space.xl,
13
+ [breakpoints.compact]: space.lg
14
+ },
15
+ marginInline: 'auto'
16
+ }
17
+ });
18
+ const columnWidths = stylex.create({
19
+ xs: { maxWidth: widths.contentXs },
20
+ sm: { maxWidth: widths.contentSm },
21
+ md: { maxWidth: widths.contentMd },
22
+ lg: { maxWidth: widths.contentLg },
23
+ full: { maxWidth: 'none' }
24
+ });
@@ -0,0 +1,8 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { MenuEntry } from './MenuItems.tsx';
3
+ type ContextMenuProps = {
4
+ items: readonly MenuEntry[];
5
+ children: ReactNode;
6
+ };
7
+ export declare function ContextMenu({ items, children }: ContextMenuProps): import("react").JSX.Element;
8
+ export {};
@@ -0,0 +1,23 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { ContextMenu as BaseContextMenu } from '@base-ui/react/context-menu';
3
+ import * as stylex from '@stylexjs/stylex';
4
+ import { colors, layers, radii } from "../theme/tokens.stylex.js";
5
+ import { MenuItems } from "./MenuItems.js";
6
+ import { Popup } from "./Popup.js";
7
+ export function ContextMenu({ items, children }) {
8
+ return (_jsxs(BaseContextMenu.Root, { children: [_jsx(BaseContextMenu.Trigger, { className: (state) => stylex.props(styles.trigger, state.open && styles.triggerOpen)
9
+ .className, children: children }), _jsx(BaseContextMenu.Portal, { children: _jsx(BaseContextMenu.Positioner, { className: stylex.props(styles.positioner).className, children: _jsx(BaseContextMenu.Popup, { render: (props, state) => (_jsx(Popup, { ...props, kind: "menu", isOpen: state.open, transitionStatus: state.transitionStatus })), children: _jsx(MenuItems, { items: items, primitive: "ContextMenu" }) }) }) })] }));
10
+ }
11
+ const styles = stylex.create({
12
+ trigger: {
13
+ backgroundColor: 'transparent',
14
+ borderRadius: radii.md
15
+ },
16
+ triggerOpen: {
17
+ backgroundColor: colors.transparentHover
18
+ },
19
+ positioner: {
20
+ zIndex: layers.menu,
21
+ outline: 'none'
22
+ }
23
+ });
@@ -0,0 +1,11 @@
1
+ import type { ReactNode } from 'react';
2
+ type DialogProps = {
3
+ label: string;
4
+ isOpen: boolean;
5
+ onOpenChange: (isOpen: boolean) => void;
6
+ placement?: 'center' | 'top';
7
+ size?: 'sm' | 'md' | 'lg';
8
+ children: ReactNode;
9
+ };
10
+ export declare function Dialog({ label, isOpen, onOpenChange, placement, size, children }: DialogProps): import("react").JSX.Element;
11
+ export {};