@trypattern/sdk 0.0.0-stage → 0.1.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.
Files changed (273) 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 +30 -0
  7. package/dist/api.js +60 -0
  8. package/dist/app.d.ts +115 -0
  9. package/dist/app.js +266 -0
  10. package/dist/appInfo.d.ts +35 -0
  11. package/dist/appInfo.js +67 -0
  12. package/dist/appTitle.d.ts +6 -0
  13. package/dist/appTitle.js +3 -0
  14. package/dist/appearance.d.ts +7 -0
  15. package/dist/appearance.js +2 -0
  16. package/dist/auth/sessionApi.d.ts +41 -0
  17. package/dist/auth/sessionApi.js +158 -0
  18. package/dist/auth/sessionStore.d.ts +20 -0
  19. package/dist/auth/sessionStore.js +40 -0
  20. package/dist/auth/user.d.ts +11 -0
  21. package/dist/auth/user.js +9 -0
  22. package/dist/builtins/Account.d.ts +25 -0
  23. package/dist/builtins/Account.js +15 -0
  24. package/dist/builtins/AppSettings.d.ts +12 -0
  25. package/dist/builtins/AppSettings.js +31 -0
  26. package/dist/builtins/Palette.d.ts +29 -0
  27. package/dist/builtins/Palette.js +63 -0
  28. package/dist/builtins/SignIn.d.ts +28 -0
  29. package/dist/builtins/SignIn.js +60 -0
  30. package/dist/builtins/Toasts.d.ts +32 -0
  31. package/dist/builtins/Toasts.js +25 -0
  32. package/dist/builtins/actions.d.ts +2 -0
  33. package/dist/builtins/actions.js +45 -0
  34. package/dist/cache.d.ts +24 -0
  35. package/dist/cache.js +112 -0
  36. package/dist/cli/app.d.ts +2 -0
  37. package/dist/cli/app.js +1406 -0
  38. package/dist/cli/publishing.d.ts +21 -0
  39. package/dist/cli/publishing.js +493 -0
  40. package/dist/cli/screenshot.d.ts +1 -0
  41. package/dist/cli/screenshot.js +96 -0
  42. package/dist/cli/tools.d.ts +12 -0
  43. package/dist/cli/tools.js +35 -0
  44. package/dist/clock.d.ts +6 -0
  45. package/dist/clock.js +31 -0
  46. package/dist/components/AppFrame.d.ts +14 -0
  47. package/dist/components/AppFrame.js +64 -0
  48. package/dist/components/AppearancePicker.d.ts +1 -0
  49. package/dist/components/AppearancePicker.js +12 -0
  50. package/dist/components/Avatar.d.ts +9 -0
  51. package/dist/components/Avatar.js +63 -0
  52. package/dist/components/Badge.d.ts +11 -0
  53. package/dist/components/Badge.js +87 -0
  54. package/dist/components/Button.d.ts +24 -0
  55. package/dist/components/Button.js +252 -0
  56. package/dist/components/Card.d.ts +12 -0
  57. package/dist/components/Card.js +38 -0
  58. package/dist/components/CommandMenu.d.ts +23 -0
  59. package/dist/components/CommandMenu.js +214 -0
  60. package/dist/components/CommandPalette.d.ts +1 -0
  61. package/dist/components/CommandPalette.js +7 -0
  62. package/dist/components/Content.d.ts +7 -0
  63. package/dist/components/Content.js +24 -0
  64. package/dist/components/ContextMenu.d.ts +8 -0
  65. package/dist/components/ContextMenu.js +23 -0
  66. package/dist/components/CopyButton.d.ts +11 -0
  67. package/dist/components/CopyButton.js +16 -0
  68. package/dist/components/Dialog.d.ts +11 -0
  69. package/dist/components/Dialog.js +81 -0
  70. package/dist/components/Divider.d.ts +7 -0
  71. package/dist/components/Divider.js +30 -0
  72. package/dist/components/EmptyState.d.ts +8 -0
  73. package/dist/components/EmptyState.js +24 -0
  74. package/dist/components/Form.d.ts +9 -0
  75. package/dist/components/Form.js +23 -0
  76. package/dist/components/Icon.d.ts +10 -0
  77. package/dist/components/Icon.js +22 -0
  78. package/dist/components/IconButton.d.ts +14 -0
  79. package/dist/components/IconButton.js +53 -0
  80. package/dist/components/Kbd.d.ts +6 -0
  81. package/dist/components/Kbd.js +67 -0
  82. package/dist/components/Link.d.ts +14 -0
  83. package/dist/components/Link.js +44 -0
  84. package/dist/components/ListRow.d.ts +12 -0
  85. package/dist/components/ListRow.js +62 -0
  86. package/dist/components/LoadingRows.d.ts +5 -0
  87. package/dist/components/LoadingRows.js +6 -0
  88. package/dist/components/Menu.d.ts +12 -0
  89. package/dist/components/Menu.js +33 -0
  90. package/dist/components/MenuItems.d.ts +21 -0
  91. package/dist/components/MenuItems.js +32 -0
  92. package/dist/components/Placement.d.ts +21 -0
  93. package/dist/components/Placement.js +1 -0
  94. package/dist/components/Popup.d.ts +8 -0
  95. package/dist/components/Popup.js +43 -0
  96. package/dist/components/PopupItem.d.ts +8 -0
  97. package/dist/components/PopupItem.js +51 -0
  98. package/dist/components/PropertyRow.d.ts +7 -0
  99. package/dist/components/PropertyRow.js +23 -0
  100. package/dist/components/RadioGroup.d.ts +18 -0
  101. package/dist/components/RadioGroup.js +85 -0
  102. package/dist/components/Row.d.ts +16 -0
  103. package/dist/components/Row.js +27 -0
  104. package/dist/components/Screen.d.ts +13 -0
  105. package/dist/components/Screen.js +56 -0
  106. package/dist/components/Scrim.d.ts +8 -0
  107. package/dist/components/Scrim.js +40 -0
  108. package/dist/components/ScrollArea.d.ts +15 -0
  109. package/dist/components/ScrollArea.js +13 -0
  110. package/dist/components/SegmentedControl.d.ts +17 -0
  111. package/dist/components/SegmentedControl.js +68 -0
  112. package/dist/components/Select.d.ts +17 -0
  113. package/dist/components/Select.js +107 -0
  114. package/dist/components/SettingsRow.d.ts +8 -0
  115. package/dist/components/SettingsRow.js +32 -0
  116. package/dist/components/Sidebar.d.ts +20 -0
  117. package/dist/components/Sidebar.js +137 -0
  118. package/dist/components/SignInScreen.d.ts +1 -0
  119. package/dist/components/SignInScreen.js +40 -0
  120. package/dist/components/Size.d.ts +1 -0
  121. package/dist/components/Size.js +1 -0
  122. package/dist/components/Skeleton.d.ts +8 -0
  123. package/dist/components/Skeleton.js +48 -0
  124. package/dist/components/Spinner.d.ts +6 -0
  125. package/dist/components/Spinner.js +54 -0
  126. package/dist/components/Stack.d.ts +14 -0
  127. package/dist/components/Stack.js +19 -0
  128. package/dist/components/Switch.d.ts +10 -0
  129. package/dist/components/Switch.js +72 -0
  130. package/dist/components/Text.d.ts +21 -0
  131. package/dist/components/Text.js +77 -0
  132. package/dist/components/TextField.d.ts +25 -0
  133. package/dist/components/TextField.js +68 -0
  134. package/dist/components/Toaster.d.ts +1 -0
  135. package/dist/components/Toaster.js +83 -0
  136. package/dist/components/Tooltip.d.ts +8 -0
  137. package/dist/components/Tooltip.js +43 -0
  138. package/dist/components/controlLook.d.ts +70 -0
  139. package/dist/components/controlLook.js +80 -0
  140. package/dist/components/frame.d.ts +4 -0
  141. package/dist/components/frame.js +2 -0
  142. package/dist/components/icons.d.ts +59 -0
  143. package/dist/components/icons.js +111 -0
  144. package/dist/components/interaction.d.ts +12 -0
  145. package/dist/components/interaction.js +22 -0
  146. package/dist/components/spacing.d.ts +118 -0
  147. package/dist/components/spacing.js +46 -0
  148. package/dist/components/tones.d.ts +28 -0
  149. package/dist/components/tones.js +12 -0
  150. package/dist/entityStore.d.ts +46 -0
  151. package/dist/entityStore.js +160 -0
  152. package/dist/flows/accessFlows.d.ts +9 -0
  153. package/dist/flows/accessFlows.js +167 -0
  154. package/dist/flows/browser.d.ts +34 -0
  155. package/dist/flows/browser.js +167 -0
  156. package/dist/flows/contactSheet.d.ts +1 -0
  157. package/dist/flows/contactSheet.js +63 -0
  158. package/dist/flows/flowBrowser.d.ts +25 -0
  159. package/dist/flows/flowBrowser.js +23 -0
  160. package/dist/flows/flowSetup.d.ts +3 -0
  161. package/dist/flows/flowSetup.js +35 -0
  162. package/dist/flows/flows.d.ts +47 -0
  163. package/dist/flows/flows.js +175 -0
  164. package/dist/flows/screenshotName.d.ts +1 -0
  165. package/dist/flows/screenshotName.js +6 -0
  166. package/dist/gate.d.ts +8 -0
  167. package/dist/gate.js +52 -0
  168. package/dist/hooks/appContext.d.ts +15 -0
  169. package/dist/hooks/appContext.js +5 -0
  170. package/dist/hooks/appHooks.d.ts +21 -0
  171. package/dist/hooks/appHooks.js +24 -0
  172. package/dist/hooks/useAnimatesOnChange.d.ts +1 -0
  173. package/dist/hooks/useAnimatesOnChange.js +14 -0
  174. package/dist/hooks/useStoreState.d.ts +6 -0
  175. package/dist/hooks/useStoreState.js +5 -0
  176. package/dist/index.d.ts +44 -0
  177. package/dist/index.js +21 -0
  178. package/dist/memoryApi.d.ts +19 -0
  179. package/dist/memoryApi.js +42 -0
  180. package/dist/model.d.ts +94 -0
  181. package/dist/model.js +243 -0
  182. package/dist/page.d.ts +11 -0
  183. package/dist/page.js +9 -0
  184. package/dist/platform.d.ts +1 -0
  185. package/dist/platform.js +5 -0
  186. package/dist/publishWire.d.ts +271 -0
  187. package/dist/publishWire.js +168 -0
  188. package/dist/react.d.ts +49 -0
  189. package/dist/react.js +40 -0
  190. package/dist/registered.d.ts +60 -0
  191. package/dist/registered.js +19 -0
  192. package/dist/routes.d.ts +38 -0
  193. package/dist/routes.js +21 -0
  194. package/dist/rules/checkAllFiles.d.ts +1 -0
  195. package/dist/rules/checkAllFiles.js +749 -0
  196. package/dist/rules/checkApiRouting.d.ts +1 -0
  197. package/dist/rules/checkApiRouting.js +112 -0
  198. package/dist/rules/lintPlugin.d.ts +252 -0
  199. package/dist/rules/lintPlugin.js +1159 -0
  200. package/dist/rules/messages.d.ts +48 -0
  201. package/dist/rules/messages.js +48 -0
  202. package/dist/rules/themeTokens.d.ts +6 -0
  203. package/dist/rules/themeTokens.js +64 -0
  204. package/dist/schema.d.ts +4 -0
  205. package/dist/schema.js +2 -0
  206. package/dist/server/auth.d.ts +115 -0
  207. package/dist/server/auth.js +134 -0
  208. package/dist/server/authService.d.ts +9 -0
  209. package/dist/server/authService.js +50 -0
  210. package/dist/server/createServer.d.ts +402 -0
  211. package/dist/server/createServer.js +82 -0
  212. package/dist/server/env.d.ts +15 -0
  213. package/dist/server/env.js +1 -0
  214. package/dist/server/index.d.ts +13 -0
  215. package/dist/server/index.js +9 -0
  216. package/dist/server/services.d.ts +9 -0
  217. package/dist/server/services.js +47 -0
  218. package/dist/server/session.d.ts +29 -0
  219. package/dist/server/session.js +65 -0
  220. package/dist/server/sessions.d.ts +92 -0
  221. package/dist/server/sessions.js +47 -0
  222. package/dist/server/settings.d.ts +49 -0
  223. package/dist/server/settings.js +25 -0
  224. package/dist/server/signInWire.d.ts +53 -0
  225. package/dist/server/signInWire.js +23 -0
  226. package/dist/server/tables.d.ts +242 -0
  227. package/dist/server/tables.js +246 -0
  228. package/dist/server/users.d.ts +189 -0
  229. package/dist/server/users.js +49 -0
  230. package/dist/serviceClients.d.ts +5 -0
  231. package/dist/serviceClients.js +70 -0
  232. package/dist/services.d.ts +53 -0
  233. package/dist/services.js +30 -0
  234. package/dist/shortcuts.d.ts +3 -0
  235. package/dist/shortcuts.js +40 -0
  236. package/dist/start.d.ts +20 -0
  237. package/dist/start.js +145 -0
  238. package/dist/state.d.ts +14 -0
  239. package/dist/state.js +17 -0
  240. package/dist/store.d.ts +45 -0
  241. package/dist/store.js +208 -0
  242. package/dist/subscribers.d.ts +5 -0
  243. package/dist/subscribers.js +13 -0
  244. package/dist/table.d.ts +143 -0
  245. package/dist/table.js +91 -0
  246. package/dist/tables.d.ts +77 -0
  247. package/dist/tables.js +216 -0
  248. package/dist/theme/reset.css +84 -0
  249. package/dist/theme/scales.d.ts +76 -0
  250. package/dist/theme/scales.js +82 -0
  251. package/dist/theme/tokens.stylex.d.ts +218 -0
  252. package/dist/theme/tokens.stylex.js +233 -0
  253. package/dist/vite/commandBridge.d.ts +2 -0
  254. package/dist/vite/commandBridge.js +46 -0
  255. package/dist/vite/designManifest.d.ts +25 -0
  256. package/dist/vite/designManifest.js +191 -0
  257. package/dist/vite/localWorker.d.ts +4 -0
  258. package/dist/vite/localWorker.js +60 -0
  259. package/dist/vite/projectFile.d.ts +9 -0
  260. package/dist/vite/projectFile.js +17 -0
  261. package/dist/vite/rootAlias.d.ts +2 -0
  262. package/dist/vite/rootAlias.js +15 -0
  263. package/dist/vite/vite.d.ts +8 -0
  264. package/dist/vite/vite.js +95 -0
  265. package/dist/wire.d.ts +7 -0
  266. package/dist/wire.js +1 -0
  267. package/package.json +103 -3
  268. package/presets/lintPlugin.js +7 -0
  269. package/presets/oxlint.json +167 -0
  270. package/presets/register.d.ts +21 -0
  271. package/presets/server.d.ts +2 -0
  272. package/presets/tsconfig.app.json +29 -0
  273. package/presets/tsconfig.server.json +27 -0
@@ -0,0 +1,67 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import * as stylex from '@stylexjs/stylex';
3
+ import { isApplePlatform } from "../platform.js";
4
+ import { borders, breakpoints, colors, controls, fontFeatures, fontSizes, fontWeights, lineHeights, radii, space } from "../theme/tokens.stylex.js";
5
+ import { Icon } from "./Icon.js";
6
+ export function Kbd({ keys, surface = 'default' }) {
7
+ return (_jsx("span", { "aria-hidden": "true", ...stylex.props(styles.keys), children: keys.map((key, index) => {
8
+ const icon = keyIcons[key];
9
+ const symbol = symbolFor(key);
10
+ return (_jsx("kbd", { ...stylex.props(styles.key, surface === 'standout' && styles.standout, icon === undefined && symbol.length > 1 && styles.word), children: icon === undefined ? symbol : _jsx(Icon, { name: icon, size: "xs" }) }, `${index}-${key}`));
11
+ }) }));
12
+ }
13
+ const keyIcons = {
14
+ enter: 'enter',
15
+ arrowup: 'arrowUp',
16
+ arrowdown: 'arrowDown'
17
+ };
18
+ const keyWords = {
19
+ escape: 'esc',
20
+ tab: 'tab'
21
+ };
22
+ function symbolFor(key) {
23
+ if (key === 'mod')
24
+ return isApplePlatform() ? '⌘' : 'ctrl';
25
+ return keyWords[key] ?? key;
26
+ }
27
+ const styles = stylex.create({
28
+ keys: {
29
+ display: {
30
+ default: 'flex',
31
+ [breakpoints.coarsePointer]: 'none'
32
+ },
33
+ flexShrink: 0,
34
+ gap: space.xxs,
35
+ alignItems: 'center'
36
+ },
37
+ key: {
38
+ display: 'inline-flex',
39
+ alignItems: 'center',
40
+ justifyContent: 'center',
41
+ minWidth: lineHeights.caption,
42
+ height: lineHeights.caption,
43
+ fontFamily: 'inherit',
44
+ fontSize: fontSizes.captionBase,
45
+ fontWeight: fontWeights.medium,
46
+ fontFeatureSettings: fontFeatures.kbd,
47
+ lineHeight: lineHeights.caption,
48
+ color: colors.secondaryForeground,
49
+ textTransform: 'uppercase',
50
+ pointerEvents: 'none',
51
+ backgroundColor: colors.component,
52
+ borderColor: colors.borderDefault,
53
+ borderStyle: 'solid',
54
+ borderWidth: borders.hairline,
55
+ borderRadius: radii.sm
56
+ },
57
+ standout: {
58
+ color: colors.onStandoutSecondaryForeground,
59
+ backgroundColor: colors.borderOnStandout,
60
+ borderColor: colors.borderOnStandout
61
+ },
62
+ word: {
63
+ paddingBlockEnd: space.xxs,
64
+ paddingInline: controls.paddingXs,
65
+ textTransform: 'lowercase'
66
+ }
67
+ });
@@ -0,0 +1,14 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { AppPath } from '../registered.ts';
3
+ type LinkProps = {
4
+ tone?: 'brand' | 'secondary';
5
+ children: ReactNode;
6
+ } & ({
7
+ to: AppPath;
8
+ href?: never;
9
+ } | {
10
+ href: string;
11
+ to?: never;
12
+ });
13
+ export declare function Link({ to, href, tone, children }: LinkProps): import("react").JSX.Element;
14
+ export {};
@@ -0,0 +1,44 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import * as stylex from '@stylexjs/stylex';
3
+ import { Link as RouterLink } from 'react-router';
4
+ import { colors, motion, radii } from "../theme/tokens.stylex.js";
5
+ import { focusRing } from "./controlLook.js";
6
+ import { interact, textOf } from "./interaction.js";
7
+ export function Link({ to, href, tone = 'brand', children }) {
8
+ const className = stylex.props(styles.link, looks[tone], focusRing.visible).className;
9
+ if (href !== undefined) {
10
+ return (_jsx("a", { href: href, target: "_blank", rel: "noreferrer", onClick: () => interact({
11
+ primitive: 'Link',
12
+ event: 'open',
13
+ label: textOf(children) || href
14
+ }), className: className, children: children }));
15
+ }
16
+ return (_jsx(RouterLink, { to: to, onClick: () => interact({
17
+ primitive: 'Link',
18
+ event: 'navigate',
19
+ label: textOf(children) || to
20
+ }), className: className, children: children }));
21
+ }
22
+ const styles = stylex.create({
23
+ link: {
24
+ textDecoration: 'none',
25
+ borderRadius: radii.xs,
26
+ transitionTimingFunction: motion.easeOut,
27
+ transitionDuration: motion.fast,
28
+ transitionProperty: 'color'
29
+ }
30
+ });
31
+ const looks = stylex.create({
32
+ brand: {
33
+ color: {
34
+ default: colors.brandForeground,
35
+ ':hover': colors.brandSolidHover
36
+ }
37
+ },
38
+ secondary: {
39
+ color: {
40
+ default: colors.secondaryForeground,
41
+ ':hover': colors.primaryForeground
42
+ }
43
+ }
44
+ });
@@ -0,0 +1,12 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { AppPath } from '../registered.ts';
3
+ type ListRowProps = {
4
+ to?: AppPath;
5
+ onClick?: () => void;
6
+ isMuted?: boolean;
7
+ leading?: ReactNode;
8
+ trailing?: ReactNode;
9
+ children: ReactNode;
10
+ };
11
+ export declare function ListRow({ to, onClick, isMuted, leading, trailing, children }: ListRowProps): import("react").JSX.Element;
12
+ export {};
@@ -0,0 +1,62 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Button as BaseButton } from '@base-ui/react/button';
3
+ import * as stylex from '@stylexjs/stylex';
4
+ import { Link as RouterLink } from 'react-router';
5
+ import { colors, controls, radii, space } from "../theme/tokens.stylex.js";
6
+ import { focusRing } from "./controlLook.js";
7
+ import { interact, textOf } from "./interaction.js";
8
+ export function ListRow({ to, onClick, isMuted = false, leading, trailing, children }) {
9
+ const content = (_jsxs(_Fragment, { children: [leading, _jsx("span", { ...stylex.props(styles.main), children: children }), trailing === undefined ? null : (_jsx("span", { ...stylex.props(styles.trailing), children: trailing }))] }));
10
+ const look = stylex.props(styles.row, (to !== undefined || onClick !== undefined) && styles.interactive, isMuted && styles.muted, focusRing.visible, focusRing.inside);
11
+ const report = () => {
12
+ interact({
13
+ primitive: 'ListRow',
14
+ event: to === undefined ? 'click' : 'navigate',
15
+ label: textOf(children) || (to ?? '')
16
+ });
17
+ onClick?.();
18
+ };
19
+ if (to !== undefined) {
20
+ return (_jsx(RouterLink, { to: to, onClick: report, ...look, children: content }));
21
+ }
22
+ if (onClick !== undefined) {
23
+ return (_jsx(BaseButton, { onClick: report, className: look.className, children: content }));
24
+ }
25
+ return _jsx("div", { ...look, children: content });
26
+ }
27
+ const styles = stylex.create({
28
+ row: {
29
+ display: 'flex',
30
+ gap: space.md,
31
+ alignItems: 'center',
32
+ width: '100%',
33
+ height: controls.heightXl,
34
+ paddingInline: space.md,
35
+ color: colors.primaryForeground,
36
+ textAlign: 'start',
37
+ textDecoration: 'none',
38
+ borderRadius: radii.md
39
+ },
40
+ interactive: {
41
+ backgroundColor: {
42
+ default: 'transparent',
43
+ ':hover': colors.transparentHover
44
+ }
45
+ },
46
+ muted: {
47
+ color: colors.tertiaryForeground
48
+ },
49
+ main: {
50
+ display: 'flex',
51
+ flexGrow: 1,
52
+ gap: space.sm,
53
+ alignItems: 'center',
54
+ minWidth: 0
55
+ },
56
+ trailing: {
57
+ display: 'flex',
58
+ flexShrink: 0,
59
+ gap: space.sm,
60
+ alignItems: 'center'
61
+ }
62
+ });
@@ -0,0 +1,5 @@
1
+ type LoadingRowsProps = {
2
+ count: number;
3
+ };
4
+ export declare function LoadingRows({ count }: LoadingRowsProps): import("react").JSX.Element[];
5
+ export {};
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { ListRow } from "./ListRow.js";
3
+ import { Skeleton } from "./Skeleton.js";
4
+ export function LoadingRows({ count }) {
5
+ return Array.from({ length: count }, (_, row) => (_jsx(ListRow, { leading: _jsx(Skeleton, { variant: "icon" }), children: _jsx(Skeleton, { width: "md" }) }, row)));
6
+ }
@@ -0,0 +1,12 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { MenuEntry } from './MenuItems.tsx';
3
+ import type { Placement } from './Placement.ts';
4
+ import type { Size } from './Size.ts';
5
+ type MenuProps = {
6
+ trigger: ReactNode;
7
+ items: readonly MenuEntry[];
8
+ size?: Size;
9
+ style?: Placement;
10
+ };
11
+ export declare function Menu({ trigger, items, size, style }: MenuProps): import("react").JSX.Element;
12
+ export {};
@@ -0,0 +1,33 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Menu as BaseMenu } from '@base-ui/react/menu';
3
+ import * as stylex from '@stylexjs/stylex';
4
+ import { colors, controls, layers, space } from "../theme/tokens.stylex.js";
5
+ import { controlSizes, focusRing, transparentLook } from "./controlLook.js";
6
+ import { MenuItems } from "./MenuItems.js";
7
+ import { Popup } from "./Popup.js";
8
+ export function Menu({ trigger, items, size = 'md', style }) {
9
+ return (_jsxs(BaseMenu.Root, { children: [_jsx(BaseMenu.Trigger, { className: (state) => stylex.props(styles.trigger, controlSizes[size], triggerPaddings[size], transparentLook.rest, transparentLook.hoverable, state.open && transparentLook.open, styles.triggerText, focusRing.visible, style).className, children: trigger }), _jsx(BaseMenu.Portal, { children: _jsx(BaseMenu.Positioner, { side: "bottom", align: "start", sideOffset: 4, className: stylex.props(styles.positioner).className, children: _jsx(BaseMenu.Popup, { render: (props, state) => (_jsx(Popup, { ...props, kind: "menu", isOpen: state.open, transitionStatus: state.transitionStatus })), children: _jsx(MenuItems, { items: items, primitive: "Menu" }) }) }) })] }));
10
+ }
11
+ const styles = stylex.create({
12
+ trigger: {
13
+ display: 'flex',
14
+ alignItems: 'center',
15
+ minWidth: 0,
16
+ outlineOffset: 0
17
+ },
18
+ triggerText: {
19
+ gap: space.sm,
20
+ color: colors.primaryForeground
21
+ },
22
+ positioner: {
23
+ zIndex: layers.menu,
24
+ outline: 'none'
25
+ }
26
+ });
27
+ const triggerPaddings = stylex.create({
28
+ xs: { paddingInline: `calc(${controls.paddingXs} - 2px)` },
29
+ sm: { paddingInline: `calc(${controls.paddingSm} - 2px)` },
30
+ md: { paddingInline: `calc(${controls.paddingMd} - 2px)` },
31
+ lg: { paddingInline: `calc(${controls.paddingLg} - 2px)` },
32
+ xl: { paddingInline: `calc(${controls.paddingXl} - 2px)` }
33
+ });
@@ -0,0 +1,21 @@
1
+ import type { AppPath } from '../registered.ts';
2
+ import type { IconName } from './icons.ts';
3
+ type MenuAction = {
4
+ id: string;
5
+ label: string;
6
+ icon?: IconName;
7
+ isDanger?: boolean;
8
+ } & ({
9
+ onSelect: () => void;
10
+ to?: never;
11
+ } | {
12
+ to: AppPath;
13
+ onSelect?: never;
14
+ });
15
+ export type MenuEntry = MenuAction | 'separator';
16
+ type MenuItemsProps = {
17
+ items: readonly MenuEntry[];
18
+ primitive: 'Menu' | 'ContextMenu';
19
+ };
20
+ export declare function MenuItems({ items, primitive }: MenuItemsProps): import("react").JSX.Element[];
21
+ export {};
@@ -0,0 +1,32 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Menu as BaseMenu } from '@base-ui/react/menu';
3
+ import { useNavigate } from 'react-router';
4
+ import * as stylex from '@stylexjs/stylex';
5
+ import { colors, space } from "../theme/tokens.stylex.js";
6
+ import { Divider } from "./Divider.js";
7
+ import { Icon } from "./Icon.js";
8
+ import { interact } from "./interaction.js";
9
+ import { PopupItem } from "./PopupItem.js";
10
+ export function MenuItems({ items, primitive }) {
11
+ const navigate = useNavigate();
12
+ return items.map((entry, index) => entry === 'separator' ? (_jsx(Divider, { style: styles.separator }, `separator-${index}`)) : (_jsxs(BaseMenu.Item, { onClick: () => {
13
+ interact({ primitive, event: 'select', label: entry.label });
14
+ if (entry.onSelect !== undefined)
15
+ entry.onSelect();
16
+ else
17
+ void navigate(entry.to);
18
+ }, render: (props, state) => (_jsx(PopupItem, { ...props, kind: "menu", isHighlighted: state.highlighted, isDanger: entry.isDanger ?? false })), children: [entry.icon === undefined ? null : (_jsx("span", { ...stylex.props(styles.icon, entry.isDanger && styles.dangerIcon), children: _jsx(Icon, { name: entry.icon }) })), entry.label] }, entry.id)));
19
+ }
20
+ const styles = stylex.create({
21
+ separator: {
22
+ marginBlock: space.xs,
23
+ marginInline: `calc(-1 * ${space.xs})`
24
+ },
25
+ icon: {
26
+ display: 'flex',
27
+ color: colors.secondaryForeground
28
+ },
29
+ dangerIcon: {
30
+ color: 'inherit'
31
+ }
32
+ });
@@ -0,0 +1,21 @@
1
+ import type { StyleXStyles } from '@stylexjs/stylex';
2
+ export type PlacementProperties = {
3
+ display?: 'none' | null;
4
+ alignSelf?: string;
5
+ justifySelf?: string;
6
+ gridArea?: string;
7
+ gridColumn?: string;
8
+ gridRow?: string;
9
+ flexGrow?: number;
10
+ flexShrink?: number;
11
+ flexBasis?: number | string;
12
+ minWidth?: number | string;
13
+ maxWidth?: number | string;
14
+ marginBlock?: number | string;
15
+ marginBlockStart?: number | string;
16
+ marginBlockEnd?: number | string;
17
+ marginInline?: number | string;
18
+ marginInlineStart?: number | string;
19
+ marginInlineEnd?: number | string;
20
+ };
21
+ export type Placement = StyleXStyles<PlacementProperties>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,8 @@
1
+ import type { ComponentPropsWithRef } from 'react';
2
+ type PopupProps = Omit<ComponentPropsWithRef<'div'>, 'className' | 'style'> & {
3
+ isOpen: boolean;
4
+ transitionStatus: 'starting' | 'ending' | 'idle' | undefined;
5
+ kind: 'menu' | 'select';
6
+ };
7
+ export declare function Popup({ isOpen, transitionStatus, kind, ...popupProps }: PopupProps): import("react").JSX.Element;
8
+ export {};
@@ -0,0 +1,43 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import * as stylex from '@stylexjs/stylex';
3
+ import { colors, motion, radii, shadows, space } from "../theme/tokens.stylex.js";
4
+ export function Popup({ isOpen, transitionStatus, kind, ...popupProps }) {
5
+ const isHidden = !isOpen || transitionStatus === 'starting';
6
+ return (_jsx("div", { ...popupProps, ...stylex.props(styles.popup, kinds[kind], isHidden && (kind === 'menu' ? styles.hiddenMenu : styles.hiddenSelect), !isOpen && styles.exiting) }));
7
+ }
8
+ const styles = stylex.create({
9
+ popup: {
10
+ padding: space.xs,
11
+ color: colors.primaryForeground,
12
+ outline: 'none',
13
+ backgroundColor: colors.componentOnSunken,
14
+ borderRadius: radii.xl,
15
+ boxShadow: shadows.extraLarge,
16
+ transformOrigin: 'var(--transform-origin)',
17
+ transitionTimingFunction: motion.easeInOut,
18
+ transitionDuration: motion.base,
19
+ transitionProperty: 'opacity, transform'
20
+ },
21
+ exiting: {
22
+ transitionTimingFunction: motion.easeOut,
23
+ transitionDuration: motion.exit
24
+ },
25
+ hiddenMenu: {
26
+ pointerEvents: 'none',
27
+ opacity: 0,
28
+ transform: 'scale(0.95)'
29
+ },
30
+ hiddenSelect: {
31
+ pointerEvents: 'none',
32
+ opacity: 0,
33
+ transform: 'scale(0.97)'
34
+ }
35
+ });
36
+ const kinds = stylex.create({
37
+ menu: {
38
+ minWidth: 224
39
+ },
40
+ select: {
41
+ minWidth: 'var(--anchor-width)'
42
+ }
43
+ });
@@ -0,0 +1,8 @@
1
+ import type { ComponentPropsWithRef } from 'react';
2
+ type PopupItemProps = Omit<ComponentPropsWithRef<'div'>, 'className' | 'style'> & {
3
+ isHighlighted: boolean;
4
+ isDanger?: boolean;
5
+ kind: 'menu' | 'select';
6
+ };
7
+ export declare function PopupItem({ isHighlighted, isDanger, kind, ...itemProps }: PopupItemProps): import("react").JSX.Element;
8
+ export {};
@@ -0,0 +1,51 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import * as stylex from '@stylexjs/stylex';
3
+ import { breakpoints, colors, controls, fontSizes, fontWeights, iconSizes, lineHeights, radii, space } from "../theme/tokens.stylex.js";
4
+ export function PopupItem({ isHighlighted, isDanger = false, kind, ...itemProps }) {
5
+ return (_jsx("div", { ...itemProps, ...stylex.props(styles.item, kinds[kind], isHighlighted && styles.highlighted, isDanger && styles.danger, isDanger && isHighlighted && styles.dangerHighlighted) }));
6
+ }
7
+ const styles = stylex.create({
8
+ item: {
9
+ position: 'relative',
10
+ gap: space.sm,
11
+ alignItems: 'center',
12
+ minHeight: {
13
+ default: controls.heightMd,
14
+ [breakpoints.compact]: controls.heightXl
15
+ },
16
+ paddingInlineStart: controls.paddingSm,
17
+ fontSize: {
18
+ default: fontSizes.bodySm,
19
+ [breakpoints.compact]: fontSizes.bodyBase
20
+ },
21
+ fontWeight: fontWeights.semimedium,
22
+ lineHeight: {
23
+ default: lineHeights.bodySm,
24
+ [breakpoints.compact]: lineHeights.body
25
+ },
26
+ color: colors.primaryForeground,
27
+ outline: 'none',
28
+ borderRadius: radii.md
29
+ },
30
+ highlighted: {
31
+ backgroundColor: colors.transparentHover
32
+ },
33
+ danger: {
34
+ color: colors.onDangerSubtleForeground
35
+ },
36
+ dangerHighlighted: {
37
+ backgroundColor: colors.dangerSubtle
38
+ }
39
+ });
40
+ const kinds = stylex.create({
41
+ menu: {
42
+ display: 'flex',
43
+ paddingInlineEnd: controls.paddingXs
44
+ },
45
+ select: {
46
+ display: 'grid',
47
+ gridTemplateColumns: `${iconSizes.md} 1fr`,
48
+ paddingBlock: space.xs,
49
+ paddingInlineEnd: space.lg
50
+ }
51
+ });
@@ -0,0 +1,7 @@
1
+ import type { ReactNode } from 'react';
2
+ type PropertyRowProps = {
3
+ label: string;
4
+ children: ReactNode;
5
+ };
6
+ export declare function PropertyRow({ label, children }: PropertyRowProps): import("react").JSX.Element;
7
+ export {};
@@ -0,0 +1,23 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import * as stylex from '@stylexjs/stylex';
3
+ import { controls, space } from "../theme/tokens.stylex.js";
4
+ import { Text } from "./Text.js";
5
+ export function PropertyRow({ label, children }) {
6
+ return (_jsxs("div", { ...stylex.props(styles.row), children: [_jsx(Text, { tone: "secondary", children: label }), _jsx("div", { ...stylex.props(styles.value), children: children })] }));
7
+ }
8
+ const styles = stylex.create({
9
+ row: {
10
+ display: 'flex',
11
+ gap: space.lg,
12
+ alignItems: 'center',
13
+ justifyContent: 'space-between',
14
+ minHeight: `calc(${controls.heightXl} + ${space.sm})`
15
+ },
16
+ value: {
17
+ display: 'flex',
18
+ gap: space.sm,
19
+ alignItems: 'center',
20
+ justifyContent: 'flex-end',
21
+ minWidth: 0
22
+ }
23
+ });
@@ -0,0 +1,18 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { Placement } from './Placement.ts';
3
+ export type RadioOption<Value extends string> = {
4
+ value: Value;
5
+ label: string;
6
+ content?: ReactNode;
7
+ trailing?: ReactNode;
8
+ isDisabled?: boolean;
9
+ };
10
+ type RadioGroupProps<Value extends string> = {
11
+ label: string;
12
+ value: Value | null;
13
+ options: readonly RadioOption<Value>[];
14
+ onChange: (value: Value) => void;
15
+ style?: Placement;
16
+ };
17
+ export declare function RadioGroup<Value extends string>({ label, value, options, onChange, style }: RadioGroupProps<Value>): import("react").JSX.Element;
18
+ export {};
@@ -0,0 +1,85 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Radio as BaseRadio } from '@base-ui/react/radio';
3
+ import { RadioGroup as BaseRadioGroup } from '@base-ui/react/radio-group';
4
+ import * as stylex from '@stylexjs/stylex';
5
+ import { borders, colors, iconSizes, motion, radii, shadows, space } from "../theme/tokens.stylex.js";
6
+ import { focusRing } from "./controlLook.js";
7
+ import { interact } from "./interaction.js";
8
+ import { Text } from "./Text.js";
9
+ export function RadioGroup({ label, value, options, onChange, style }) {
10
+ return (_jsx(BaseRadioGroup, { "aria-label": label, value: value, onValueChange: (next) => {
11
+ const chosen = options.find((option) => option.value === next);
12
+ if (chosen === undefined)
13
+ return;
14
+ interact({
15
+ primitive: 'RadioGroup',
16
+ event: 'change',
17
+ label: chosen.label
18
+ });
19
+ onChange(chosen.value);
20
+ }, className: stylex.props(styles.group, style).className, children: options.map((option) => (_jsxs("label", { ...stylex.props(styles.row, option.isDisabled === true && styles.rowDisabled), children: [_jsx(BaseRadio.Root, { value: option.value, disabled: option.isDisabled === true, "aria-label": option.label, className: (state) => stylex.props(styles.dot, state.checked ? styles.dotOn : styles.dotOff, focusRing.visible).className, children: _jsx(BaseRadio.Indicator, { className: stylex.props(styles.mark).className }) }), _jsx("span", { ...stylex.props(styles.content), children: option.content ?? (_jsx(Text, { tone: option.isDisabled === true ? 'tertiary' : 'primary', isTruncated: true, children: option.label })) }), option.trailing === undefined ? null : (_jsx("span", { ...stylex.props(styles.trailing), children: option.trailing }))] }, option.value))) }));
21
+ }
22
+ const styles = stylex.create({
23
+ group: {
24
+ display: 'flex',
25
+ flexDirection: 'column',
26
+ overflow: 'hidden',
27
+ backgroundColor: colors.componentOnContainerStrong,
28
+ borderRadius: radii.xl,
29
+ boxShadow: shadows.default
30
+ },
31
+ row: {
32
+ display: 'flex',
33
+ gap: space.md,
34
+ alignItems: 'center',
35
+ minWidth: 0,
36
+ paddingBlock: space.md,
37
+ paddingInline: space.md,
38
+ borderTopColor: colors.divider,
39
+ borderTopStyle: {
40
+ default: 'solid',
41
+ ':first-child': 'none'
42
+ },
43
+ borderTopWidth: borders.hairline
44
+ },
45
+ rowDisabled: {
46
+ color: colors.tertiaryForeground
47
+ },
48
+ dot: {
49
+ display: 'grid',
50
+ flexShrink: 0,
51
+ placeItems: 'center',
52
+ width: iconSizes.md,
53
+ height: iconSizes.md,
54
+ padding: 0,
55
+ borderStyle: 'solid',
56
+ borderWidth: borders.thin,
57
+ borderRadius: radii.full,
58
+ transitionTimingFunction: motion.easeOut,
59
+ transitionDuration: motion.fast,
60
+ transitionProperty: 'background-color, border-color'
61
+ },
62
+ dotOff: {
63
+ backgroundColor: colors.componentOnContainerStrong,
64
+ borderColor: colors.borderStrong
65
+ },
66
+ dotOn: {
67
+ backgroundColor: colors.invertedSolid,
68
+ borderColor: colors.invertedSolid
69
+ },
70
+ mark: {
71
+ width: `calc(${iconSizes.md} / 2.5)`,
72
+ height: `calc(${iconSizes.md} / 2.5)`,
73
+ backgroundColor: colors.onInvertedForeground,
74
+ borderRadius: radii.full
75
+ },
76
+ content: {
77
+ flexGrow: 1,
78
+ minWidth: 0
79
+ },
80
+ trailing: {
81
+ display: 'flex',
82
+ flexShrink: 0,
83
+ alignItems: 'center'
84
+ }
85
+ });
@@ -0,0 +1,16 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { Placement } from './Placement.ts';
3
+ import type { SpaceName } from './spacing.ts';
4
+ type RowProps = {
5
+ children: ReactNode;
6
+ gap?: SpaceName;
7
+ align?: 'start' | 'center' | 'end' | 'baseline';
8
+ justify?: 'start' | 'center' | 'end' | 'between';
9
+ isWrapping?: boolean;
10
+ padding?: SpaceName;
11
+ paddingBlock?: SpaceName;
12
+ paddingInline?: SpaceName;
13
+ style?: Placement;
14
+ };
15
+ export declare function Row({ children, gap, align, justify, isWrapping, padding, paddingBlock, paddingInline, style }: RowProps): import("react").JSX.Element;
16
+ export {};
@@ -0,0 +1,27 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import * as stylex from '@stylexjs/stylex';
3
+ import { gaps, paddingBlocks, paddingInlines, paddings } from "./spacing.js";
4
+ export function Row({ children, gap = 'sm', align = 'center', justify = 'start', isWrapping = false, padding = 'none', paddingBlock, paddingInline, style }) {
5
+ return (_jsx("div", { ...stylex.props(styles.row, alignments[align], justifications[justify], isWrapping && styles.wrapping, gaps[gap], paddings[padding], paddingBlock !== undefined && paddingBlocks[paddingBlock], paddingInline !== undefined && paddingInlines[paddingInline], style), children: children }));
6
+ }
7
+ const styles = stylex.create({
8
+ row: {
9
+ display: 'flex',
10
+ minWidth: 0
11
+ },
12
+ wrapping: {
13
+ flexWrap: 'wrap'
14
+ }
15
+ });
16
+ const alignments = stylex.create({
17
+ start: { alignItems: 'flex-start' },
18
+ center: { alignItems: 'center' },
19
+ end: { alignItems: 'flex-end' },
20
+ baseline: { alignItems: 'baseline' }
21
+ });
22
+ const justifications = stylex.create({
23
+ start: { justifyContent: 'flex-start' },
24
+ center: { justifyContent: 'center' },
25
+ end: { justifyContent: 'flex-end' },
26
+ between: { justifyContent: 'space-between' }
27
+ });
@@ -0,0 +1,13 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { AppPath } from '../registered.ts';
3
+ type ScreenProps = {
4
+ title: string;
5
+ parent?: {
6
+ label: string;
7
+ to: AppPath;
8
+ };
9
+ actions?: ReactNode;
10
+ children: ReactNode;
11
+ };
12
+ export declare function Screen({ title, parent, actions, children }: ScreenProps): import("react").JSX.Element;
13
+ export {};