@alecsibilia/ui-kit 0.0.0-stage → 0.1.0-alpha.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 (283) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/LICENSE +201 -0
  3. package/README.md +233 -2
  4. package/bin/ui-kit.js +12 -0
  5. package/dist/alchemy/app.d.ts +34 -0
  6. package/dist/alchemy/app.js +88 -0
  7. package/dist/alchemy/index.d.ts +11 -0
  8. package/dist/alchemy/index.js +11 -0
  9. package/dist/alchemy/live-rooms.d.ts +21 -0
  10. package/dist/alchemy/live-rooms.js +31 -0
  11. package/dist/alchemy/migrations.d.ts +28 -0
  12. package/dist/alchemy/migrations.js +56 -0
  13. package/dist/alchemy/stage.d.ts +20 -0
  14. package/dist/alchemy/stage.js +20 -0
  15. package/dist/alchemy/wrangler-config.d.ts +76 -0
  16. package/dist/alchemy/wrangler-config.js +82 -0
  17. package/dist/build/app-modules.d.ts +11 -0
  18. package/dist/build/app-modules.js +40 -0
  19. package/dist/build/check.d.ts +4 -0
  20. package/dist/build/check.js +170 -0
  21. package/dist/build/cli.d.ts +1 -0
  22. package/dist/build/cli.js +79 -0
  23. package/dist/build/feature.d.ts +8 -0
  24. package/dist/build/feature.js +24 -0
  25. package/dist/build/index.d.ts +13 -0
  26. package/dist/build/index.js +13 -0
  27. package/dist/build/measure-cpu.d.ts +2 -0
  28. package/dist/build/measure-cpu.js +196 -0
  29. package/dist/build/prerender.d.ts +5 -0
  30. package/dist/build/prerender.js +109 -0
  31. package/dist/build/preview.d.ts +7 -0
  32. package/dist/build/preview.js +41 -0
  33. package/dist/build/seo-files.d.ts +27 -0
  34. package/dist/build/seo-files.js +24 -0
  35. package/dist/client/head-swap.d.ts +45 -0
  36. package/dist/client/head-swap.js +183 -0
  37. package/dist/client/hydration-pass.d.ts +56 -0
  38. package/dist/client/hydration-pass.js +186 -0
  39. package/dist/client/hydration-reset.d.ts +82 -0
  40. package/dist/client/hydration-reset.js +154 -0
  41. package/dist/client/index.d.ts +37 -0
  42. package/dist/client/index.js +65 -0
  43. package/dist/client/nav-client.d.ts +35 -0
  44. package/dist/client/nav-client.js +371 -0
  45. package/dist/live/collab/doc-provider.d.ts +74 -0
  46. package/dist/live/collab/doc-provider.js +412 -0
  47. package/dist/live/collab/index.d.ts +51 -0
  48. package/dist/live/collab/index.jsx +142 -0
  49. package/dist/live/collab-status.d.ts +25 -0
  50. package/dist/live/collab-status.js +17 -0
  51. package/dist/live/cursors/cursor-engine.d.ts +57 -0
  52. package/dist/live/cursors/cursor-engine.js +243 -0
  53. package/dist/live/cursors/index.d.ts +46 -0
  54. package/dist/live/cursors/index.jsx +110 -0
  55. package/dist/live/declaration.d.ts +113 -0
  56. package/dist/live/declaration.js +94 -0
  57. package/dist/live/index.d.ts +8 -0
  58. package/dist/live/index.js +8 -0
  59. package/dist/live/protocol.d.ts +224 -0
  60. package/dist/live/protocol.js +272 -0
  61. package/dist/live/server/doc-store.d.ts +68 -0
  62. package/dist/live/server/doc-store.js +187 -0
  63. package/dist/live/server/index.d.ts +60 -0
  64. package/dist/live/server/index.js +77 -0
  65. package/dist/live/server/room-presence.d.ts +24 -0
  66. package/dist/live/server/room-presence.js +123 -0
  67. package/dist/live/server/room-sockets.d.ts +65 -0
  68. package/dist/live/server/room-sockets.js +97 -0
  69. package/dist/live/server/room.d.ts +20 -0
  70. package/dist/live/server/room.js +348 -0
  71. package/dist/live/server/route.d.ts +56 -0
  72. package/dist/live/server/route.js +159 -0
  73. package/dist/live/server/types.d.ts +163 -0
  74. package/dist/live/server/types.js +2 -0
  75. package/dist/logic/agent-actions.d.ts +133 -0
  76. package/dist/logic/agent-actions.js +150 -0
  77. package/dist/logic/command-types.d.ts +53 -0
  78. package/dist/logic/command-types.js +0 -0
  79. package/dist/logic/dev.d.ts +9 -0
  80. package/dist/logic/dev.js +10 -0
  81. package/dist/logic/draft-rebase.d.ts +59 -0
  82. package/dist/logic/draft-rebase.js +71 -0
  83. package/dist/logic/form-state.d.ts +105 -0
  84. package/dist/logic/form-state.js +93 -0
  85. package/dist/logic/head.d.ts +145 -0
  86. package/dist/logic/head.js +140 -0
  87. package/dist/logic/index.d.ts +27 -0
  88. package/dist/logic/index.js +25 -0
  89. package/dist/logic/island-def.d.ts +89 -0
  90. package/dist/logic/island-def.js +59 -0
  91. package/dist/logic/kit-commands.d.ts +104 -0
  92. package/dist/logic/kit-commands.js +72 -0
  93. package/dist/logic/kit-errors.d.ts +25 -0
  94. package/dist/logic/kit-errors.js +6 -0
  95. package/dist/logic/listen.d.ts +99 -0
  96. package/dist/logic/listen.js +92 -0
  97. package/dist/logic/mutation-def.d.ts +65 -0
  98. package/dist/logic/mutation-def.js +43 -0
  99. package/dist/logic/navigation-data.d.ts +50 -0
  100. package/dist/logic/navigation-data.js +55 -0
  101. package/dist/logic/navigation-policy.d.ts +74 -0
  102. package/dist/logic/navigation-policy.js +127 -0
  103. package/dist/logic/page-model-def.d.ts +108 -0
  104. package/dist/logic/page-model-def.js +31 -0
  105. package/dist/logic/path.d.ts +31 -0
  106. package/dist/logic/path.js +48 -0
  107. package/dist/logic/query-def.d.ts +56 -0
  108. package/dist/logic/query-def.js +37 -0
  109. package/dist/logic/query-key.d.ts +24 -0
  110. package/dist/logic/query-key.js +35 -0
  111. package/dist/logic/query-types.d.ts +28 -0
  112. package/dist/logic/query-types.js +2 -0
  113. package/dist/logic/resources.d.ts +163 -0
  114. package/dist/logic/resources.js +62 -0
  115. package/dist/logic/result.d.ts +30 -0
  116. package/dist/logic/result.js +23 -0
  117. package/dist/logic/route-model.d.ts +139 -0
  118. package/dist/logic/route-model.js +207 -0
  119. package/dist/logic/route-params.d.ts +80 -0
  120. package/dist/logic/route-params.js +114 -0
  121. package/dist/logic/route-table.d.ts +308 -0
  122. package/dist/logic/route-table.js +206 -0
  123. package/dist/logic/seo.d.ts +61 -0
  124. package/dist/logic/seo.js +101 -0
  125. package/dist/logic/site.d.ts +12 -0
  126. package/dist/logic/site.js +0 -0
  127. package/dist/logic/subscriptions.d.ts +177 -0
  128. package/dist/logic/subscriptions.js +152 -0
  129. package/dist/render/index.d.ts +32 -0
  130. package/dist/render/index.js +52 -0
  131. package/dist/runtime/island-wake.d.ts +38 -0
  132. package/dist/runtime/island-wake.js +147 -0
  133. package/dist/runtime/query-scope.d.ts +224 -0
  134. package/dist/runtime/query-scope.js +222 -0
  135. package/dist/runtime/room-hub.d.ts +107 -0
  136. package/dist/runtime/room-hub.js +307 -0
  137. package/dist/runtime/subscription-runner.d.ts +71 -0
  138. package/dist/runtime/subscription-runner.js +240 -0
  139. package/dist/server/bindings.d.ts +41 -0
  140. package/dist/server/bindings.js +74 -0
  141. package/dist/server/browser.d.ts +9 -0
  142. package/dist/server/browser.js +9 -0
  143. package/dist/server/edge-cache.d.ts +28 -0
  144. package/dist/server/edge-cache.js +35 -0
  145. package/dist/server/errors.d.ts +45 -0
  146. package/dist/server/errors.js +36 -0
  147. package/dist/server/form-actions-setup.d.ts +1 -0
  148. package/dist/server/form-actions-setup.js +15 -0
  149. package/dist/server/form-actions.d.ts +121 -0
  150. package/dist/server/form-actions.js +211 -0
  151. package/dist/server/index.d.ts +36 -0
  152. package/dist/server/index.js +35 -0
  153. package/dist/server/inputs.d.ts +45 -0
  154. package/dist/server/inputs.js +77 -0
  155. package/dist/server/rate-limit.d.ts +29 -0
  156. package/dist/server/rate-limit.js +32 -0
  157. package/dist/server/read-cache.d.ts +74 -0
  158. package/dist/server/read-cache.js +58 -0
  159. package/dist/server/request-info.d.ts +17 -0
  160. package/dist/server/request-info.js +11 -0
  161. package/dist/server/request.d.ts +52 -0
  162. package/dist/server/request.js +73 -0
  163. package/dist/server/response-cookies.d.ts +23 -0
  164. package/dist/server/response-cookies.js +24 -0
  165. package/dist/server/run-effect.d.ts +42 -0
  166. package/dist/server/run-effect.js +92 -0
  167. package/dist/server/run.d.ts +63 -0
  168. package/dist/server/run.js +66 -0
  169. package/dist/server/session.d.ts +125 -0
  170. package/dist/server/session.js +247 -0
  171. package/dist/test/fake-bindings.d.ts +32 -0
  172. package/dist/test/fake-bindings.js +108 -0
  173. package/dist/test/fake-room.d.ts +66 -0
  174. package/dist/test/fake-room.js +216 -0
  175. package/dist/test/index.d.ts +19 -0
  176. package/dist/test/index.js +44 -0
  177. package/dist/test/probe.d.ts +11 -0
  178. package/dist/test/probe.js +11 -0
  179. package/dist/test/solid-jsx.d.ts +23 -0
  180. package/dist/test/solid-jsx.js +28 -0
  181. package/dist/test/solid-preload.d.ts +1 -0
  182. package/dist/test/solid-preload.js +29 -0
  183. package/dist/ui/code-editor/index.d.ts +21 -0
  184. package/dist/ui/code-editor/index.jsx +286 -0
  185. package/dist/ui/collab-text/index.d.ts +29 -0
  186. package/dist/ui/collab-text/index.jsx +96 -0
  187. package/dist/ui/components/controls.d.ts +69 -0
  188. package/dist/ui/components/controls.jsx +81 -0
  189. package/dist/ui/components/feedback.d.ts +26 -0
  190. package/dist/ui/components/feedback.jsx +80 -0
  191. package/dist/ui/components/layout.d.ts +74 -0
  192. package/dist/ui/components/layout.jsx +146 -0
  193. package/dist/ui/components/lists.d.ts +69 -0
  194. package/dist/ui/components/lists.jsx +133 -0
  195. package/dist/ui/components/navigation.d.ts +73 -0
  196. package/dist/ui/components/navigation.jsx +112 -0
  197. package/dist/ui/components/text.d.ts +34 -0
  198. package/dist/ui/components/text.jsx +163 -0
  199. package/dist/ui/index.d.ts +7 -0
  200. package/dist/ui/index.js +7 -0
  201. package/dist/ui/jsx-runtime.d.ts +19 -0
  202. package/dist/ui/jsx-runtime.js +0 -0
  203. package/dist/ui/list-keys.d.ts +31 -0
  204. package/dist/ui/list-keys.js +45 -0
  205. package/dist/ui/styles/base.css +38 -0
  206. package/dist/ui/styles/components.css +608 -0
  207. package/dist/ui/styles/tokens.css +27 -0
  208. package/dist/ui/styles/transitions.css +23 -0
  209. package/dist/ui/styles/workbench.css +428 -0
  210. package/dist/ui/styles.css +9 -0
  211. package/dist/view/agent-actions-view.d.ts +30 -0
  212. package/dist/view/agent-actions-view.js +27 -0
  213. package/dist/view/agent-surface.d.ts +42 -0
  214. package/dist/view/agent-surface.js +123 -0
  215. package/dist/view/app-scope.d.ts +51 -0
  216. package/dist/view/app-scope.js +75 -0
  217. package/dist/view/boundary.d.ts +18 -0
  218. package/dist/view/boundary.jsx +26 -0
  219. package/dist/view/command-runner.d.ts +16 -0
  220. package/dist/view/command-runner.js +245 -0
  221. package/dist/view/form.d.ts +82 -0
  222. package/dist/view/form.jsx +109 -0
  223. package/dist/view/head-view.d.ts +31 -0
  224. package/dist/view/head-view.js +46 -0
  225. package/dist/view/index.d.ts +41 -0
  226. package/dist/view/index.js +40 -0
  227. package/dist/view/island-root.d.ts +30 -0
  228. package/dist/view/island-root.js +36 -0
  229. package/dist/view/island.d.ts +102 -0
  230. package/dist/view/island.jsx +154 -0
  231. package/dist/view/match.d.ts +41 -0
  232. package/dist/view/match.js +111 -0
  233. package/dist/view/model.d.ts +92 -0
  234. package/dist/view/model.js +162 -0
  235. package/dist/view/navigation-head.d.ts +29 -0
  236. package/dist/view/navigation-head.jsx +38 -0
  237. package/dist/view/page-model.d.ts +46 -0
  238. package/dist/view/page-model.js +146 -0
  239. package/dist/view/query-effects.d.ts +87 -0
  240. package/dist/view/query-effects.js +147 -0
  241. package/dist/view/query-ok.d.ts +45 -0
  242. package/dist/view/query-ok.js +96 -0
  243. package/dist/view/query.d.ts +115 -0
  244. package/dist/view/query.jsx +179 -0
  245. package/dist/view/result-view.d.ts +14 -0
  246. package/dist/view/result-view.jsx +15 -0
  247. package/dist/view/route-pages.d.ts +43 -0
  248. package/dist/view/route-pages.js +59 -0
  249. package/dist/view/router.d.ts +44 -0
  250. package/dist/view/router.js +123 -0
  251. package/dist/vite/dev-middleware.d.ts +12 -0
  252. package/dist/vite/dev-middleware.js +39 -0
  253. package/dist/vite/dev-objects.d.ts +25 -0
  254. package/dist/vite/dev-objects.js +127 -0
  255. package/dist/vite/dev-platform.d.ts +19 -0
  256. package/dist/vite/dev-platform.js +77 -0
  257. package/dist/vite/dev-seo-files.d.ts +11 -0
  258. package/dist/vite/dev-seo-files.js +40 -0
  259. package/dist/vite/index.d.ts +53 -0
  260. package/dist/vite/index.js +148 -0
  261. package/dist/vite/local-config.d.ts +34 -0
  262. package/dist/vite/local-config.js +72 -0
  263. package/dist/vite/worker-build.d.ts +24 -0
  264. package/dist/vite/worker-build.js +84 -0
  265. package/dist/worker/create-worker.d.ts +52 -0
  266. package/dist/worker/create-worker.js +90 -0
  267. package/dist/worker/index.d.ts +12 -0
  268. package/dist/worker/index.js +12 -0
  269. package/dist/worker/page-routes.d.ts +88 -0
  270. package/dist/worker/page-routes.js +100 -0
  271. package/dist/worker/page-status.d.ts +41 -0
  272. package/dist/worker/page-status.js +23 -0
  273. package/dist/worker/request-prelude.d.ts +69 -0
  274. package/dist/worker/request-prelude.js +107 -0
  275. package/dist/worker/security.d.ts +76 -0
  276. package/dist/worker/security.js +137 -0
  277. package/dist/worker/server-app.d.ts +54 -0
  278. package/dist/worker/server-app.js +76 -0
  279. package/guards/browser-only.js +5 -0
  280. package/guards/node-only.js +6 -0
  281. package/guards/server-only.js +5 -0
  282. package/migrations/0001-sessions.sql +22 -0
  283. package/package.json +233 -5
@@ -0,0 +1,81 @@
1
+ /** @jsxImportSource @solidjs/web */
2
+ import { Show, untrack } from 'solid-js';
3
+ export function Button(props) {
4
+ return (<button type="button" data-testid={props.testId} disabled={props.disabled} class={[
5
+ 'ui-button',
6
+ {
7
+ 'ui-button--primary': props.variant === 'primary',
8
+ 'ui-button--danger': props.variant === 'danger',
9
+ 'ui-button--ghost': props.variant === 'ghost',
10
+ 'ui-button--sm': props.size === 'sm',
11
+ },
12
+ ]} onClick={() => props.onClick?.()}>
13
+ {props.children}
14
+ </button>);
15
+ }
16
+ export function TextArea(props) {
17
+ return (<label class="ui-field">
18
+ <span class="ui-field-label">{props.label}</span>
19
+ <textarea class="ui-textarea" data-testid={props.testId} rows={props.rows ?? 4} placeholder={props.placeholder} value={props.value} onInput={(e) => props.onInput(e.currentTarget.value)}/>
20
+ </label>);
21
+ }
22
+ /**
23
+ * A `<form method="post">` to `action` (a server function's form address).
24
+ * Without JS the browser posts it; with JS a submit calls `onSubmit` with
25
+ * the form's data instead. Used by the kit's `<Form>`; app code uses that.
26
+ */
27
+ export function FormFrame(props) {
28
+ return (<form method="post" action={props.action} class="ui-form" data-testid={props.testId} aria-busy={props.busy ? 'true' : undefined} novalidate onSubmit={(e) => {
29
+ e.preventDefault();
30
+ props.onSubmit(new FormData(e.currentTarget));
31
+ }}>
32
+ {props.children}
33
+ </form>);
34
+ }
35
+ /** A hidden form value (e.g. where to go after a no-JS submit). */
36
+ export function HiddenInput(props) {
37
+ return <input type="hidden" name={props.name} value={props.value}/>;
38
+ }
39
+ /**
40
+ * A labelled form field: label, the control (`children`), an optional
41
+ * hint, and an error slot (`role="alert"`) shown when `error` is set.
42
+ */
43
+ export function Field(props) {
44
+ return (<div class={['ui-field', { 'ui-field--invalid': Boolean(props.error) }]}>
45
+ <label class="ui-field-label" for={props.for}>
46
+ {props.label}
47
+ </label>
48
+ {props.children}
49
+ <Show when={props.hint}>
50
+ {(hint) => <p class="ui-field-hint">{hint()}</p>}
51
+ </Show>
52
+ <Show when={props.error}>
53
+ {(error) => (<p class="ui-field-error" role="alert" id={`${props.for}-error`}>
54
+ {error()}
55
+ </p>)}
56
+ </Show>
57
+ </div>);
58
+ }
59
+ /**
60
+ * A single-line text input. Uncontrolled: `defaultValue` is what the server
61
+ * rendered (a re-rendered no-JS form keeps the typed value); the browser
62
+ * owns what the user types until the form submits.
63
+ */
64
+ export function TextInput(props) {
65
+ // Read once: the DOM owns the value after first render (a reactive
66
+ // `value` would overwrite what the user typed).
67
+ const initial = untrack(() => props.defaultValue ?? '');
68
+ return (<input class="ui-input" id={props.id} name={props.name} type={props.type ?? 'text'} value={initial} autocomplete={props.autocomplete} required={props.required} aria-invalid={props.invalid ? 'true' : undefined} aria-describedby={props.invalid ? `${props.id}-error` : undefined} data-testid={props.testId}/>);
69
+ }
70
+ /** The form's submit button; `disabled` while the submission runs. */
71
+ export function SubmitButton(props) {
72
+ return (<button type="submit" data-testid={props.testId} disabled={props.disabled} class={[
73
+ 'ui-button',
74
+ {
75
+ 'ui-button--primary': !props.variant || props.variant === 'primary',
76
+ 'ui-button--danger': props.variant === 'danger',
77
+ },
78
+ ]}>
79
+ {props.children}
80
+ </button>);
81
+ }
@@ -0,0 +1,26 @@
1
+ /** @jsxImportSource @solidjs/web */
2
+ import { type Element as SolidElement } from 'solid-js';
3
+ export declare function Spinner(props: {
4
+ readonly label?: string;
5
+ }): SolidElement;
6
+ /**
7
+ * Inline status message. `tone="danger"` also sets `role="alert"` so screen
8
+ * readers announce it (used by `<Query>`'s default error view).
9
+ */
10
+ export declare function Notice(props: {
11
+ readonly tone?: 'info' | 'success' | 'warning' | 'danger';
12
+ readonly title: string;
13
+ readonly description?: string;
14
+ readonly action?: SolidElement;
15
+ }): SolidElement;
16
+ export declare function Toast(props: {
17
+ readonly tone: 'success' | 'warning' | 'danger';
18
+ readonly message: string;
19
+ readonly onDismiss?: () => void;
20
+ }): SolidElement;
21
+ export declare function Dialog(props: {
22
+ readonly open: boolean;
23
+ readonly title: string;
24
+ readonly onClose: () => void;
25
+ readonly children: SolidElement;
26
+ }): SolidElement;
@@ -0,0 +1,80 @@
1
+ /** @jsxImportSource @solidjs/web */
2
+ import { onSettled, Show } from 'solid-js';
3
+ import { Button } from './controls.jsx';
4
+ export function Spinner(props) {
5
+ return (<div class="ui-spinner-wrap" role="status" aria-live="polite">
6
+ <span class="ui-spinner" aria-hidden="true"/>
7
+ <span>{props.label ?? 'Loading...'}</span>
8
+ </div>);
9
+ }
10
+ /**
11
+ * Inline status message. `tone="danger"` also sets `role="alert"` so screen
12
+ * readers announce it (used by `<Query>`'s default error view).
13
+ */
14
+ export function Notice(props) {
15
+ return (<div role={props.tone === 'danger' ? 'alert' : undefined} class={[
16
+ 'ui-notice',
17
+ {
18
+ 'ui-notice--info': !props.tone || props.tone === 'info',
19
+ 'ui-notice--success': props.tone === 'success',
20
+ 'ui-notice--warning': props.tone === 'warning',
21
+ 'ui-notice--danger': props.tone === 'danger',
22
+ },
23
+ ]}>
24
+ <strong class="ui-heading ui-heading--3">{props.title}</strong>
25
+ <Show when={props.description}>
26
+ {(desc) => <p class="ui-text ui-text--muted">{desc()}</p>}
27
+ </Show>
28
+ <Show when={props.action}>
29
+ {(act) => (<div class="ui-stack ui-stack--row ui-stack--gap-sm">
30
+ {act()}
31
+ </div>)}
32
+ </Show>
33
+ </div>);
34
+ }
35
+ export function Toast(props) {
36
+ return (<div role="status" class={[
37
+ 'ui-toast-bar',
38
+ {
39
+ 'ui-toast-bar--success': props.tone === 'success',
40
+ 'ui-toast-bar--warning': props.tone === 'warning',
41
+ 'ui-toast-bar--danger': props.tone === 'danger',
42
+ },
43
+ ]}>
44
+ <span>{props.message}</span>
45
+ <Show when={props.onDismiss}>
46
+ {(dismiss) => (<Button variant="ghost" size="sm" onClick={() => dismiss()()}>
47
+ Dismiss
48
+ </Button>)}
49
+ </Show>
50
+ </div>);
51
+ }
52
+ export function Dialog(props) {
53
+ onSettled(() => {
54
+ if (typeof window === 'undefined')
55
+ return;
56
+ const onKeyDown = (e) => {
57
+ if (e.key === 'Escape' && props.open) {
58
+ props.onClose();
59
+ }
60
+ };
61
+ window.addEventListener('keydown', onKeyDown);
62
+ return () => window.removeEventListener('keydown', onKeyDown);
63
+ });
64
+ return (<Show when={props.open}>
65
+ <div class="ui-dialog-backdrop" role="dialog" aria-modal="true" aria-label={props.title} onClick={(e) => {
66
+ if (e.target === e.currentTarget)
67
+ props.onClose();
68
+ }}>
69
+ <div class="ui-dialog">
70
+ <div class="ui-card-head">
71
+ <h2 class="ui-heading ui-heading--2">{props.title}</h2>
72
+ <Button variant="ghost" size="sm" onClick={() => props.onClose()}>
73
+ Close
74
+ </Button>
75
+ </div>
76
+ {props.children}
77
+ </div>
78
+ </div>
79
+ </Show>);
80
+ }
@@ -0,0 +1,74 @@
1
+ /** @jsxImportSource @solidjs/web */
2
+ import '../styles.css';
3
+ import { type Element as SolidElement } from 'solid-js';
4
+ export type Tone = 'neutral' | 'info' | 'success' | 'warning' | 'danger' | 'violet';
5
+ /**
6
+ * The HTML document. Title, description, canonical, Open Graph and JSON-LD
7
+ * come from the route table's `head` (the kit renders them with Solid's
8
+ * `useHead`, spliced in before `</head>`), so the shell has none of its own.
9
+ */
10
+ export declare function DocumentShell(props: {
11
+ /** `<html lang>` (the site's `lang`). */
12
+ readonly lang: string;
13
+ /**
14
+ * Scripts for the `<head>`: the kit's `<IslandScripts>` (hydration
15
+ * bootstrap + island client entry; removed from pages without islands).
16
+ */
17
+ readonly head?: SolidElement;
18
+ readonly children: SolidElement;
19
+ }): SolidElement;
20
+ export declare function Page(props: {
21
+ readonly children: SolidElement;
22
+ }): SolidElement;
23
+ export declare function Header(props: {
24
+ readonly title: string;
25
+ readonly subtitle?: string;
26
+ readonly badges?: SolidElement;
27
+ readonly actions?: SolidElement;
28
+ }): SolidElement;
29
+ export declare function Stack(props: {
30
+ readonly direction?: 'column' | 'row';
31
+ readonly gap?: 'xs' | 'sm' | 'md' | 'lg';
32
+ readonly align?: 'start' | 'center' | 'stretch';
33
+ readonly justify?: 'start' | 'between' | 'end';
34
+ readonly children: SolidElement;
35
+ }): SolidElement;
36
+ export declare function Grid(props: {
37
+ readonly columns: 2 | 3 | 4 | 'planner' | 'arch';
38
+ readonly children: SolidElement;
39
+ }): SolidElement;
40
+ export declare function Section(props: {
41
+ readonly title: string;
42
+ readonly description?: string;
43
+ readonly badge?: SolidElement;
44
+ readonly children: SolidElement;
45
+ }): SolidElement;
46
+ export declare function Card(props: {
47
+ readonly title?: string;
48
+ readonly badge?: SolidElement;
49
+ readonly tone?: 'default' | 'accent' | 'success' | 'danger' | 'violet';
50
+ readonly pulseKey?: string | number;
51
+ readonly testId?: string;
52
+ readonly children: SolidElement;
53
+ }): SolidElement;
54
+ export declare function Divider(): SolidElement;
55
+ export declare function Spacer(props: {
56
+ readonly size?: 'md' | 'lg';
57
+ }): SolidElement;
58
+ /**
59
+ * The area live cursors are drawn over (`position: relative`): put the
60
+ * kit's cursors island (`@alecsibilia/ui-kit/live/cursors`) inside it. Static HTML;
61
+ * without JS it is just a wrapper.
62
+ */
63
+ export declare function CursorSurface(props: {
64
+ readonly children: SolidElement;
65
+ }): SolidElement;
66
+ export declare function StickyAside(props: {
67
+ readonly children: SolidElement;
68
+ }): SolidElement;
69
+ export declare function StickyBottomBar(props: {
70
+ readonly left?: SolidElement;
71
+ readonly center?: SolidElement;
72
+ readonly right?: SolidElement;
73
+ readonly testId?: string;
74
+ }): SolidElement;
@@ -0,0 +1,146 @@
1
+ /** @jsxImportSource @solidjs/web */
2
+ // The kit's styles ride with the components (not the `ui/index.ts`
3
+ // barrel, which bundlers skip as side-effect free).
4
+ import '../styles.css';
5
+ import { createEffect, createSignal, Show, } from 'solid-js';
6
+ /**
7
+ * The HTML document. Title, description, canonical, Open Graph and JSON-LD
8
+ * come from the route table's `head` (the kit renders them with Solid's
9
+ * `useHead`, spliced in before `</head>`), so the shell has none of its own.
10
+ */
11
+ export function DocumentShell(props) {
12
+ return (<html lang={props.lang}>
13
+ <head>
14
+ <meta charset="utf-8"/>
15
+ <meta name="viewport" content="width=device-width, initial-scale=1"/>
16
+ <link rel="icon" href="/favicon.ico" sizes="any"/>
17
+ {props.head}
18
+ </head>
19
+ <body>{props.children}</body>
20
+ </html>);
21
+ }
22
+ export function Page(props) {
23
+ return <main class="ui-page">{props.children}</main>;
24
+ }
25
+ export function Header(props) {
26
+ return (<header class="ui-header">
27
+ <div class="ui-header-main">
28
+ <h1 class="ui-heading ui-heading--1">{props.title}</h1>
29
+ <Show when={props.subtitle}>
30
+ {(sub) => <p class="ui-text ui-text--muted">{sub()}</p>}
31
+ </Show>
32
+ <Show when={props.badges}>
33
+ {(b) => <div class="ui-header-meta">{b()}</div>}
34
+ </Show>
35
+ </div>
36
+ <Show when={props.actions}>
37
+ {(a) => <div class="ui-header-meta">{a()}</div>}
38
+ </Show>
39
+ </header>);
40
+ }
41
+ export function Stack(props) {
42
+ return (<div class={[
43
+ 'ui-stack',
44
+ {
45
+ 'ui-stack--row': props.direction === 'row',
46
+ 'ui-stack--gap-xs': props.gap === 'xs',
47
+ 'ui-stack--gap-sm': !props.gap || props.gap === 'sm',
48
+ 'ui-stack--gap-md': props.gap === 'md',
49
+ 'ui-stack--gap-lg': props.gap === 'lg',
50
+ 'ui-stack--align-start': props.align === 'start',
51
+ 'ui-stack--align-center': props.align === 'center',
52
+ 'ui-stack--align-stretch': props.align === 'stretch',
53
+ 'ui-stack--justify-between': props.justify === 'between',
54
+ 'ui-stack--justify-end': props.justify === 'end',
55
+ },
56
+ ]}>
57
+ {props.children}
58
+ </div>);
59
+ }
60
+ export function Grid(props) {
61
+ return (<div class={[
62
+ 'ui-grid',
63
+ {
64
+ 'ui-grid--cols-2': props.columns === 2,
65
+ 'ui-grid--cols-3': props.columns === 3,
66
+ 'ui-grid--cols-4': props.columns === 4,
67
+ 'ui-grid--cols-planner': props.columns === 'planner',
68
+ 'ui-grid--cols-arch': props.columns === 'arch',
69
+ },
70
+ ]}>
71
+ {props.children}
72
+ </div>);
73
+ }
74
+ export function Section(props) {
75
+ return (<section class="ui-section">
76
+ <div class="ui-section-head">
77
+ <div class="ui-stack ui-stack--gap-xs">
78
+ <h2 class="ui-heading ui-heading--2">{props.title}</h2>
79
+ <Show when={props.description}>
80
+ {(d) => <p class="ui-text ui-text--subtle">{d()}</p>}
81
+ </Show>
82
+ </div>
83
+ <Show when={props.badge}>{(b) => <>{b()}</>}</Show>
84
+ </div>
85
+ {props.children}
86
+ </section>);
87
+ }
88
+ export function Card(props) {
89
+ const [pulsing, setPulsing] = createSignal(false);
90
+ createEffect(() => props.pulseKey, (key) => {
91
+ if (key === undefined)
92
+ return;
93
+ setPulsing(true);
94
+ const timer = setTimeout(() => setPulsing(false), 760);
95
+ return () => clearTimeout(timer);
96
+ }, { defer: true });
97
+ return (<article data-testid={props.testId} class={[
98
+ 'ui-card',
99
+ {
100
+ 'ui-card--accent': props.tone === 'accent',
101
+ 'ui-card--success': props.tone === 'success',
102
+ 'ui-card--danger': props.tone === 'danger',
103
+ 'ui-card--violet': props.tone === 'violet',
104
+ 'ui-card--pulse': pulsing(),
105
+ },
106
+ ]}>
107
+ <Show when={props.title || props.badge}>
108
+ <div class="ui-card-head">
109
+ <Show when={props.title}>
110
+ {(t) => <h3 class="ui-heading ui-heading--3">{t()}</h3>}
111
+ </Show>
112
+ <Show when={props.badge}>{(b) => <>{b()}</>}</Show>
113
+ </div>
114
+ </Show>
115
+ {props.children}
116
+ </article>);
117
+ }
118
+ export function Divider() {
119
+ return <hr class="ui-divider"/>;
120
+ }
121
+ export function Spacer(props) {
122
+ return (<div class={{
123
+ 'ui-spacer--md': !props.size || props.size === 'md',
124
+ 'ui-spacer--lg': props.size === 'lg',
125
+ }} aria-hidden="true"/>);
126
+ }
127
+ /**
128
+ * The area live cursors are drawn over (`position: relative`): put the
129
+ * kit's cursors island (`@alecsibilia/ui-kit/live/cursors`) inside it. Static HTML;
130
+ * without JS it is just a wrapper.
131
+ */
132
+ export function CursorSurface(props) {
133
+ return (<div class="ui-cursor-surface" data-live-cursors-surface="">
134
+ {props.children}
135
+ </div>);
136
+ }
137
+ export function StickyAside(props) {
138
+ return <aside class="ui-sticky-col">{props.children}</aside>;
139
+ }
140
+ export function StickyBottomBar(props) {
141
+ return (<div class="ui-bottom-bar" data-testid={props.testId}>
142
+ <div class="ui-bottom-bar-group">{props.left}</div>
143
+ <div class="ui-bottom-bar-group">{props.center}</div>
144
+ <div class="ui-bottom-bar-group">{props.right}</div>
145
+ </div>);
146
+ }
@@ -0,0 +1,69 @@
1
+ /** @jsxImportSource @solidjs/web */
2
+ import { type Element as SolidElement } from 'solid-js';
3
+ import type { Selection } from './navigation.tsx';
4
+ export interface DataTableColumn<Row> {
5
+ readonly key: string;
6
+ readonly label: string;
7
+ readonly render: (row: Row) => SolidElement;
8
+ }
9
+ /**
10
+ * Table with stable row identity: rows are keyed by `rowKey`, so a rebuilt
11
+ * `rows` array (fresh objects) updates each kept row in place. Each column's
12
+ * `render` runs once per row with a live view of the row (read fields where
13
+ * used; never destructure).
14
+ */
15
+ export declare function DataTable<Row extends object>(props: {
16
+ readonly columns: readonly DataTableColumn<Row>[];
17
+ readonly rows: readonly Row[];
18
+ /** Stable id of a row (e.g. `(row) => row.id`). */
19
+ readonly rowKey: (row: Row) => string | number;
20
+ readonly emptyLabel?: string;
21
+ }): SolidElement;
22
+ export declare function StatTile(props: {
23
+ readonly label: string;
24
+ readonly value: string | number;
25
+ readonly hint?: string;
26
+ }): SolidElement;
27
+ export interface BarChartItem {
28
+ /** Stable id: a bar is kept (and animates) while its id stays. */
29
+ readonly id: string;
30
+ readonly label: string;
31
+ readonly value: number;
32
+ readonly unit?: string;
33
+ }
34
+ export declare function BarChart(props: {
35
+ readonly items: readonly BarChartItem[];
36
+ readonly max?: number;
37
+ }): SolidElement;
38
+ export interface FeedbackListItem {
39
+ /** Stable id; the entry is mounted once per id. */
40
+ readonly id: string;
41
+ readonly location: string;
42
+ readonly text: string;
43
+ }
44
+ /**
45
+ * List of `// FEEDBACK:` comments, keyed by `id`. With `onSelect`, every
46
+ * entry is a button that calls `onSelect(item)`.
47
+ */
48
+ export declare function FeedbackList<Item extends FeedbackListItem>(props: {
49
+ readonly items: readonly Item[];
50
+ readonly onSelect?: (item: Item) => void;
51
+ readonly emptyLabel?: string;
52
+ }): SolidElement;
53
+ export interface StepStripItem {
54
+ /** Stable id; the pill is mounted once per id. */
55
+ readonly id: string;
56
+ readonly label: string;
57
+ readonly active: Selection;
58
+ readonly feedbackCount?: number;
59
+ readonly testId?: string;
60
+ }
61
+ /**
62
+ * Row of step pills, keyed by `id`: a rebuilt `items` array (fresh objects
63
+ * from a selector on every step change or snippet edit) updates the kept
64
+ * pills in place. A click calls `onSelect(item)`.
65
+ */
66
+ export declare function StepStrip<Item extends StepStripItem>(props: {
67
+ readonly items: readonly Item[];
68
+ readonly onSelect: (item: Item) => void;
69
+ }): SolidElement;
@@ -0,0 +1,133 @@
1
+ /** @jsxImportSource @solidjs/web */
2
+ import { For, Show } from 'solid-js';
3
+ import { Stack } from './layout.jsx';
4
+ import { Text } from './text.jsx';
5
+ import { byId, liveView } from '../list-keys.js';
6
+ /**
7
+ * Table with stable row identity: rows are keyed by `rowKey`, so a rebuilt
8
+ * `rows` array (fresh objects) updates each kept row in place. Each column's
9
+ * `render` runs once per row with a live view of the row (read fields where
10
+ * used; never destructure).
11
+ */
12
+ export function DataTable(props) {
13
+ return (<div class="ui-table-wrap">
14
+ <table class="ui-table">
15
+ <thead>
16
+ <tr>
17
+ <For each={props.columns} keyed={(col) => col.key}>
18
+ {(col) => <th>{col().label}</th>}
19
+ </For>
20
+ </tr>
21
+ </thead>
22
+ <tbody>
23
+ <For each={props.rows} keyed={(row) => props.rowKey(row)} fallback={<tr>
24
+ <td colspan={props.columns.length}>
25
+ {props.emptyLabel ?? 'No rows'}
26
+ </td>
27
+ </tr>}>
28
+ {(row) => {
29
+ const view = liveView(row);
30
+ return (<tr>
31
+ <For each={props.columns} keyed={(col) => col.key}>
32
+ {(col) => <td>{col().render(view)}</td>}
33
+ </For>
34
+ </tr>);
35
+ }}
36
+ </For>
37
+ </tbody>
38
+ </table>
39
+ </div>);
40
+ }
41
+ export function StatTile(props) {
42
+ return (<div class="ui-stat">
43
+ <span class="ui-stat-label">{props.label}</span>
44
+ <span class="ui-stat-value">{props.value}</span>
45
+ <Show when={props.hint}>
46
+ {(h) => <span class="ui-stat-hint">{h()}</span>}
47
+ </Show>
48
+ </div>);
49
+ }
50
+ export function BarChart(props) {
51
+ const maxVal = () => {
52
+ if (props.max !== undefined && props.max > 0)
53
+ return props.max;
54
+ let hi = 1;
55
+ for (const item of props.items) {
56
+ if (item.value > hi)
57
+ hi = item.value;
58
+ }
59
+ return hi;
60
+ };
61
+ return (<div class="ui-bar-list">
62
+ <For each={props.items} keyed={byId}>
63
+ {(item) => (<div class="ui-bar-row">
64
+ <span>{item().label}</span>
65
+ <div class="ui-bar-track">
66
+ <div class="ui-bar-fill" style={{
67
+ width: `${Math.max(4, Math.round((item().value / maxVal()) * 100))}%`,
68
+ }}/>
69
+ </div>
70
+ <span class="ui-bar-value">
71
+ {item().value}
72
+ {item().unit ?? ''}
73
+ </span>
74
+ </div>)}
75
+ </For>
76
+ </div>);
77
+ }
78
+ /**
79
+ * List of `// FEEDBACK:` comments, keyed by `id`. With `onSelect`, every
80
+ * entry is a button that calls `onSelect(item)`.
81
+ */
82
+ export function FeedbackList(props) {
83
+ return (<Stack gap="xs">
84
+ <For each={props.items} keyed={byId} fallback={<Text variant="subtle">
85
+ {props.emptyLabel ?? 'No // FEEDBACK: comments yet.'}
86
+ </Text>}>
87
+ {(item) => (<Show when={props.onSelect} keyed fallback={<div class="ui-feedback-item">
88
+ <span class="ui-feedback-item-meta">
89
+ {item().location}
90
+ </span>
91
+ <span class="ui-feedback-item-text">
92
+ {item().text}
93
+ </span>
94
+ </div>}>
95
+ {(select) => (<button type="button" class="ui-feedback-item ui-feedback-item--clickable" onClick={() => select(item())}>
96
+ <span class="ui-feedback-item-meta">
97
+ {item().location}
98
+ </span>
99
+ <span class="ui-feedback-item-text">
100
+ {item().text}
101
+ </span>
102
+ </button>)}
103
+ </Show>)}
104
+ </For>
105
+ </Stack>);
106
+ }
107
+ /**
108
+ * Row of step pills, keyed by `id`: a rebuilt `items` array (fresh objects
109
+ * from a selector on every step change or snippet edit) updates the kept
110
+ * pills in place. A click calls `onSelect(item)`.
111
+ */
112
+ export function StepStrip(props) {
113
+ const count = (item) => item.feedbackCount ?? 0;
114
+ return (<div class="ui-step-strip" role="navigation" aria-label="Architecture steps">
115
+ <For each={props.items} keyed={byId}>
116
+ {(item) => (<button type="button" data-testid={item().testId ?? `step-${item().id}`} aria-current={item().active === 'Active' ? 'step' : undefined} class={[
117
+ 'ui-step-pill',
118
+ {
119
+ 'ui-step-pill--active': item().active === 'Active',
120
+ 'ui-step-pill--feedback': item().active === 'Inactive' &&
121
+ count(item()) > 0,
122
+ },
123
+ ]} onClick={() => props.onSelect(item())}>
124
+ <span>{item().label}</span>
125
+ <Show when={count(item()) > 0}>
126
+ <span class="ui-step-pill-count">
127
+ {item().feedbackCount}
128
+ </span>
129
+ </Show>
130
+ </button>)}
131
+ </For>
132
+ </div>);
133
+ }