@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,73 @@
1
+ /** @jsxImportSource @solidjs/web */
2
+ import { type Element as SolidElement } from 'solid-js';
3
+ /**
4
+ * Whether an item (nav link, filter chip, step pill) is the selected one.
5
+ * An enum, not a boolean (app models use no booleans).
6
+ */
7
+ export type Selection = 'Active' | 'Inactive';
8
+ export interface NavLinkItem {
9
+ /** Stable id; the link is mounted once per id. */
10
+ readonly id: string;
11
+ readonly href: string;
12
+ readonly label: string;
13
+ readonly badge?: string;
14
+ readonly active: Selection;
15
+ readonly testId?: string;
16
+ }
17
+ /**
18
+ * Primary navigation. Links are keyed by `id`, so a rebuilt `items` array
19
+ * (e.g. a selector returning fresh objects on every route change) updates
20
+ * the kept links in place. A plain left click calls `onNavigate(item)` (send
21
+ * a `Navigated` Message); modified clicks keep the browser's default.
22
+ */
23
+ export declare function NavBar<Item extends NavLinkItem>(props: {
24
+ readonly brand: string;
25
+ readonly items: readonly Item[];
26
+ /**
27
+ * Client-side handler for a plain click. Omit it for plain links (a full
28
+ * page load: the kit's navigation model, and what a static page needs).
29
+ */
30
+ readonly onNavigate?: (item: Item) => void;
31
+ readonly meta?: SolidElement;
32
+ }): SolidElement;
33
+ export interface FilterChipItem {
34
+ readonly id: string;
35
+ readonly label: string;
36
+ readonly count?: number;
37
+ readonly active: Selection;
38
+ readonly onSelect: () => void;
39
+ }
40
+ export declare function FilterBar(props: {
41
+ readonly items: readonly FilterChipItem[];
42
+ }): SolidElement;
43
+ /**
44
+ * An in-app link: a real `<a href>` (works without JS, opens in a new tab
45
+ * with a modifier). A plain left click calls `onNavigate()` instead (send a
46
+ * `Navigated` Message).
47
+ */
48
+ export declare function Link(props: {
49
+ readonly href: string;
50
+ /** Client-side handler for a plain click; omit it for a plain link (full page load). */
51
+ readonly onNavigate?: () => void;
52
+ readonly testId?: string;
53
+ readonly children: SolidElement;
54
+ }): SolidElement;
55
+ export interface TabItem {
56
+ /** Stable id; the tab is mounted once per id. */
57
+ readonly id: string;
58
+ readonly href: string;
59
+ readonly label: string;
60
+ readonly active: Selection;
61
+ readonly testId?: string;
62
+ }
63
+ /**
64
+ * Tabs that are URLs (`?tab=stats`): each is a real link, so tabs work
65
+ * without JS and survive reload / Back. A plain left click calls
66
+ * `onSelect(item)` (send a `Navigated` Message with the tab's route).
67
+ */
68
+ export declare function Tabs<Item extends TabItem>(props: {
69
+ readonly label: string;
70
+ readonly items: readonly Item[];
71
+ /** Client-side handler for a plain click; omit it for plain links (full page load). */
72
+ readonly onSelect?: (item: Item) => void;
73
+ }): SolidElement;
@@ -0,0 +1,112 @@
1
+ /** @jsxImportSource @solidjs/web */
2
+ import { For, Show } from 'solid-js';
3
+ import { Badge } from './text.jsx';
4
+ import { byId } from '../list-keys.js';
5
+ /**
6
+ * Primary navigation. Links are keyed by `id`, so a rebuilt `items` array
7
+ * (e.g. a selector returning fresh objects on every route change) updates
8
+ * the kept links in place. A plain left click calls `onNavigate(item)` (send
9
+ * a `Navigated` Message); modified clicks keep the browser's default.
10
+ */
11
+ export function NavBar(props) {
12
+ return (<nav class="ui-navbar" aria-label="Primary navigation">
13
+ <div class="ui-navbar-brand">
14
+ <span class="ui-navbar-title">{props.brand}</span>
15
+ <div class="ui-navbar-links">
16
+ <For each={props.items} keyed={byId}>
17
+ {(item) => (<a href={item().href} data-testid={item().testId} aria-current={item().active === 'Active'
18
+ ? 'page'
19
+ : undefined} class={[
20
+ 'ui-navlink',
21
+ {
22
+ 'ui-navlink--active': item().active === 'Active',
23
+ },
24
+ ]} onClick={props.onNavigate
25
+ ? (e) => {
26
+ if (!isPlainClick(e))
27
+ return;
28
+ e.preventDefault();
29
+ props.onNavigate?.(item());
30
+ }
31
+ : undefined}>
32
+ <span>{item().label}</span>
33
+ <Show when={item().badge}>
34
+ {(b) => (<Badge tone={item().active === 'Active'
35
+ ? 'info'
36
+ : 'neutral'}>
37
+ {b()}
38
+ </Badge>)}
39
+ </Show>
40
+ </a>)}
41
+ </For>
42
+ </div>
43
+ </div>
44
+ <Show when={props.meta}>
45
+ {(m) => <div class="ui-header-meta">{m()}</div>}
46
+ </Show>
47
+ </nav>);
48
+ }
49
+ export function FilterBar(props) {
50
+ return (<div class="ui-filterbar" role="group" aria-label="Layer filter">
51
+ <For each={props.items} keyed={byId}>
52
+ {(item) => (<button type="button" data-testid={`filter-${item().id}`} aria-pressed={item().active === 'Active' ? 'true' : 'false'} class={[
53
+ 'ui-filterchip',
54
+ {
55
+ 'ui-filterchip--active': item().active === 'Active',
56
+ },
57
+ ]} onClick={() => item().onSelect()}>
58
+ <span>{item().label}</span>
59
+ <Show when={item().count !== undefined}>
60
+ <span class="ui-filterchip-count">
61
+ {item().count}
62
+ </span>
63
+ </Show>
64
+ </button>)}
65
+ </For>
66
+ </div>);
67
+ }
68
+ /** A plain left click (no modifier, main button): the app handles it; others keep the browser default. */
69
+ function isPlainClick(e) {
70
+ return !(e.metaKey || e.ctrlKey || e.shiftKey || e.altKey || e.button !== 0);
71
+ }
72
+ /**
73
+ * An in-app link: a real `<a href>` (works without JS, opens in a new tab
74
+ * with a modifier). A plain left click calls `onNavigate()` instead (send a
75
+ * `Navigated` Message).
76
+ */
77
+ export function Link(props) {
78
+ return (<a href={props.href} data-testid={props.testId} class="ui-link" onClick={props.onNavigate
79
+ ? (e) => {
80
+ if (!isPlainClick(e))
81
+ return;
82
+ e.preventDefault();
83
+ props.onNavigate?.();
84
+ }
85
+ : undefined}>
86
+ {props.children}
87
+ </a>);
88
+ }
89
+ /**
90
+ * Tabs that are URLs (`?tab=stats`): each is a real link, so tabs work
91
+ * without JS and survive reload / Back. A plain left click calls
92
+ * `onSelect(item)` (send a `Navigated` Message with the tab's route).
93
+ */
94
+ export function Tabs(props) {
95
+ return (<nav class="ui-tabs" aria-label={props.label}>
96
+ <For each={props.items} keyed={byId}>
97
+ {(item) => (<a href={item().href} data-testid={item().testId} aria-current={item().active === 'Active' ? 'page' : undefined} class={[
98
+ 'ui-tab',
99
+ { 'ui-tab--active': item().active === 'Active' },
100
+ ]} onClick={props.onSelect
101
+ ? (e) => {
102
+ if (!isPlainClick(e))
103
+ return;
104
+ e.preventDefault();
105
+ props.onSelect?.(item());
106
+ }
107
+ : undefined}>
108
+ {item().label}
109
+ </a>)}
110
+ </For>
111
+ </nav>);
112
+ }
@@ -0,0 +1,34 @@
1
+ /** @jsxImportSource @solidjs/web */
2
+ import { type Element as SolidElement } from 'solid-js';
3
+ import type { Tone } from './layout.tsx';
4
+ export declare function Heading(props: {
5
+ readonly level?: 1 | 2 | 3;
6
+ readonly children: SolidElement;
7
+ }): SolidElement;
8
+ export declare function Text(props: {
9
+ readonly variant?: 'body' | 'muted' | 'subtle' | 'mono' | 'strong';
10
+ readonly testId?: string;
11
+ readonly children: SolidElement;
12
+ }): SolidElement;
13
+ export declare function Badge(props: {
14
+ readonly tone?: Tone;
15
+ readonly testId?: string;
16
+ readonly children: SolidElement;
17
+ }): SolidElement;
18
+ export interface CodeLogEntry {
19
+ readonly id: number;
20
+ readonly time: string;
21
+ readonly message: string;
22
+ readonly commands: readonly string[];
23
+ }
24
+ export declare function CodeLog(props: {
25
+ readonly entries: readonly CodeLogEntry[];
26
+ readonly emptyLabel?: string;
27
+ }): SolidElement;
28
+ export declare function CodeBlock(props: {
29
+ readonly filename: string;
30
+ readonly badge?: string;
31
+ readonly code: string;
32
+ readonly startLine?: number;
33
+ readonly testId?: string;
34
+ }): SolidElement;
@@ -0,0 +1,163 @@
1
+ /** @jsxImportSource @solidjs/web */
2
+ import { createSignal, For, Show } from 'solid-js';
3
+ import { Button } from './controls.jsx';
4
+ import { byId } from '../list-keys.js';
5
+ export function Heading(props) {
6
+ return (<Show when={props.level === 1} fallback={<Show when={props.level === 2} fallback={<h3 class="ui-heading ui-heading--3">
7
+ {props.children}
8
+ </h3>}>
9
+ <h2 class="ui-heading ui-heading--2">{props.children}</h2>
10
+ </Show>}>
11
+ <h1 class="ui-heading ui-heading--1">{props.children}</h1>
12
+ </Show>);
13
+ }
14
+ export function Text(props) {
15
+ return (<p data-testid={props.testId} class={[
16
+ 'ui-text',
17
+ {
18
+ 'ui-text--muted': props.variant === 'muted',
19
+ 'ui-text--subtle': props.variant === 'subtle',
20
+ 'ui-text--mono': props.variant === 'mono',
21
+ 'ui-text--strong': props.variant === 'strong',
22
+ },
23
+ ]}>
24
+ {props.children}
25
+ </p>);
26
+ }
27
+ export function Badge(props) {
28
+ return (<span data-testid={props.testId} class={[
29
+ 'ui-badge',
30
+ {
31
+ 'ui-badge--neutral': !props.tone || props.tone === 'neutral',
32
+ 'ui-badge--info': props.tone === 'info',
33
+ 'ui-badge--success': props.tone === 'success',
34
+ 'ui-badge--warning': props.tone === 'warning',
35
+ 'ui-badge--danger': props.tone === 'danger',
36
+ 'ui-badge--violet': props.tone === 'violet',
37
+ },
38
+ ]}>
39
+ {props.children}
40
+ </span>);
41
+ }
42
+ export function CodeLog(props) {
43
+ return (<div class="ui-codelog" data-testid="message-command-log">
44
+ <For each={props.entries} keyed={byId} fallback={<span class="ui-codelog-time">
45
+ {props.emptyLabel ?? 'No messages dispatched yet.'}
46
+ </span>}>
47
+ {(entry) => (<div class="ui-codelog-row">
48
+ <span class="ui-codelog-time">
49
+ #{entry().id} · {entry().time}
50
+ </span>
51
+ <span class="ui-codelog-msg">
52
+ MSG: {entry().message}
53
+ </span>
54
+ <Show when={entry().commands.length > 0}>
55
+ <span class="ui-codelog-cmd">
56
+ CMD: {entry().commands.join(' | ')}
57
+ </span>
58
+ </Show>
59
+ </div>)}
60
+ </For>
61
+ </div>);
62
+ }
63
+ const CODE_FEEDBACK_RE = /\/\/\s*FEEDBACK:|\{\/\*\s*FEEDBACK:/;
64
+ const TOKEN_RE = /(\/\/.*$|"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'|`(?:[^`\\]|\\.)*`|\b(?:import|export|from|function|const|let|return|type|interface|class|extends|readonly|async|await|yield|switch|case|default|if|else|for|of|new|as|in|typeof)\b|\b\d+(?:\.\d+)?\b|<\/?[A-Z][A-Za-z0-9]*)/g;
65
+ function tokenizeCodeLine(line) {
66
+ const tokens = [];
67
+ let cursor = 0;
68
+ // `matchAll` iterates a copy of the regex, so the shared `g` regex's
69
+ // `lastIndex` is never read or written here.
70
+ for (const match of line.matchAll(TOKEN_RE)) {
71
+ const idx = match.index ?? 0;
72
+ if (idx > cursor) {
73
+ tokens.push({ kind: 'plain', text: line.slice(cursor, idx) });
74
+ }
75
+ const text = match[0];
76
+ let kind = 'kw';
77
+ if (text.startsWith('//'))
78
+ kind = 'cmt';
79
+ else if (text.startsWith('"') ||
80
+ text.startsWith("'") ||
81
+ text.startsWith('`'))
82
+ kind = 'str';
83
+ else if (text.startsWith('<'))
84
+ kind = 'tag';
85
+ else if (/^\d/.test(text))
86
+ kind = 'num';
87
+ tokens.push({ kind, text });
88
+ cursor = idx + text.length;
89
+ }
90
+ if (cursor < line.length) {
91
+ tokens.push({ kind: 'plain', text: line.slice(cursor) });
92
+ }
93
+ return tokens.map((token, id) => ({ ...token, id }));
94
+ }
95
+ function codeLines(code) {
96
+ return code.split('\n').map((text, id) => ({
97
+ id,
98
+ text,
99
+ feedback: CODE_FEEDBACK_RE.test(text),
100
+ tokens: tokenizeCodeLine(text),
101
+ }));
102
+ }
103
+ export function CodeBlock(props) {
104
+ const [copied, setCopied] = createSignal(false);
105
+ const lines = () => codeLines(props.code);
106
+ const baseLine = () => props.startLine ?? 1;
107
+ const copyCode = () => {
108
+ if (typeof navigator !== 'undefined' && navigator.clipboard) {
109
+ void navigator.clipboard.writeText(props.code).then(() => {
110
+ setCopied(true);
111
+ setTimeout(() => setCopied(false), 1600);
112
+ });
113
+ }
114
+ };
115
+ return (<div class="ui-codeblock" data-testid={props.testId}>
116
+ <div class="ui-codeblock-head">
117
+ <span class="ui-codeblock-file">{props.filename}</span>
118
+ <div class="ui-codeblock-actions">
119
+ <Show when={props.badge}>
120
+ {(b) => <Badge tone="neutral">{b()}</Badge>}
121
+ </Show>
122
+ <Button size="sm" variant="ghost" onClick={copyCode}>
123
+ {copied() ? 'Copied' : 'Copy'}
124
+ </Button>
125
+ </div>
126
+ </div>
127
+ <pre class="ui-codeblock-pre">
128
+ <code>
129
+ <For each={lines()} keyed={byId}>
130
+ {(line) => (<div class={[
131
+ 'ui-codeblock-line',
132
+ {
133
+ 'ui-codeblock-line--feedback': line().feedback,
134
+ },
135
+ ]}>
136
+ <span class="ui-codeblock-ln">
137
+ {baseLine() + line().id}
138
+ </span>
139
+ <span>
140
+ <Show when={!line().feedback} fallback={line().text}>
141
+ <For each={line().tokens} keyed={byId}>
142
+ {(tok) => (<span class={{
143
+ 'ui-tok-kw': tok().kind === 'kw',
144
+ 'ui-tok-str': tok().kind ===
145
+ 'str',
146
+ 'ui-tok-num': tok().kind ===
147
+ 'num',
148
+ 'ui-tok-cmt': tok().kind ===
149
+ 'cmt',
150
+ 'ui-tok-tag': tok().kind ===
151
+ 'tag',
152
+ }}>
153
+ {tok().text}
154
+ </span>)}
155
+ </For>
156
+ </Show>
157
+ </span>
158
+ </div>)}
159
+ </For>
160
+ </code>
161
+ </pre>
162
+ </div>);
163
+ }
@@ -0,0 +1,7 @@
1
+ export { Button, TextArea, FormFrame, HiddenInput, Field, TextInput, SubmitButton, } from './components/controls.tsx';
2
+ export { Spinner, Notice, Toast, Dialog } from './components/feedback.tsx';
3
+ export { DocumentShell, Page, Header, Stack, Grid, Section, Card, Divider, Spacer, CursorSurface, StickyAside, StickyBottomBar, type Tone, } from './components/layout.tsx';
4
+ export { DataTable, StatTile, BarChart, FeedbackList, StepStrip, type DataTableColumn, type BarChartItem, type FeedbackListItem, type StepStripItem, } from './components/lists.tsx';
5
+ export { NavBar, FilterBar, Link, Tabs, type Selection, type NavLinkItem, type FilterChipItem, type TabItem, } from './components/navigation.tsx';
6
+ export { Heading, Text, Badge, CodeLog, CodeBlock, type CodeLogEntry, } from './components/text.tsx';
7
+ export { byId, liveView } from './list-keys.ts';
@@ -0,0 +1,7 @@
1
+ export { Button, TextArea, FormFrame, HiddenInput, Field, TextInput, SubmitButton, } from './components/controls.jsx';
2
+ export { Spinner, Notice, Toast, Dialog } from './components/feedback.jsx';
3
+ export { DocumentShell, Page, Header, Stack, Grid, Section, Card, Divider, Spacer, CursorSurface, StickyAside, StickyBottomBar, } from './components/layout.jsx';
4
+ export { DataTable, StatTile, BarChart, FeedbackList, StepStrip, } from './components/lists.jsx';
5
+ export { NavBar, FilterBar, Link, Tabs, } from './components/navigation.jsx';
6
+ export { Heading, Text, Badge, CodeLog, CodeBlock, } from './components/text.jsx';
7
+ export { byId, liveView } from './list-keys.js';
@@ -0,0 +1,19 @@
1
+ import type { JSX as SolidJSX } from '@solidjs/web';
2
+ /**
3
+ * Closed-kit JSX type boundary for app packages.
4
+ * `IntrinsicElements` is intentionally empty so raw HTML tags (`<div>`,
5
+ * `<span>`, `<button>`, ...) fail TypeScript compilation in app code.
6
+ * Only typed `@alecsibilia/ui-kit/ui` and `@alecsibilia/ui-kit/view` components are valid JSX elements.
7
+ */
8
+ export declare namespace JSX {
9
+ type Element = SolidJSX.Element;
10
+ interface ElementClass {
11
+ }
12
+ interface ElementAttributesProperty {
13
+ }
14
+ interface ElementChildrenAttribute {
15
+ children: {};
16
+ }
17
+ interface IntrinsicElements {
18
+ }
19
+ }
File without changes
@@ -0,0 +1,31 @@
1
+ /**
2
+ * List identity helpers for `<For>` in the UI kit.
3
+ *
4
+ * Every kit list is keyed by a stable id (`keyed={byId}`), so a row is
5
+ * mounted once per id and updated in place when its data changes. Callers
6
+ * may rebuild the array (fresh objects from a selector) on every change
7
+ * without remounting rows: Solid's `<For keyed={fn}>` keeps the row and swaps
8
+ * the item behind its accessor.
9
+ *
10
+ * Pure (no Solid import), so probes under `bun --conditions=browser` can use
11
+ * the exact key function the components use.
12
+ */
13
+ /** Key function for items with a stable `id`. */
14
+ export declare function byId(item: {
15
+ readonly id: string | number;
16
+ }): string | number;
17
+ /**
18
+ * A live read-only view over a row accessor: every property read goes
19
+ * through `read()`, so bindings created once per row (e.g. by a
20
+ * `DataTable` column `render`) stay reactive while the row is kept.
21
+ *
22
+ * @param read - Accessor of the current row value (an object).
23
+ * @returns A proxy that reads through `read()`.
24
+ *
25
+ * @example
26
+ * ```ts
27
+ * const row = liveView(() => rows()[0]);
28
+ * row.name; // always the current row's name
29
+ * ```
30
+ */
31
+ export declare function liveView<T extends object>(read: () => T): T;
@@ -0,0 +1,45 @@
1
+ /**
2
+ * List identity helpers for `<For>` in the UI kit.
3
+ *
4
+ * Every kit list is keyed by a stable id (`keyed={byId}`), so a row is
5
+ * mounted once per id and updated in place when its data changes. Callers
6
+ * may rebuild the array (fresh objects from a selector) on every change
7
+ * without remounting rows: Solid's `<For keyed={fn}>` keeps the row and swaps
8
+ * the item behind its accessor.
9
+ *
10
+ * Pure (no Solid import), so probes under `bun --conditions=browser` can use
11
+ * the exact key function the components use.
12
+ */
13
+ /** Key function for items with a stable `id`. */
14
+ export function byId(item) {
15
+ return item.id;
16
+ }
17
+ /**
18
+ * A live read-only view over a row accessor: every property read goes
19
+ * through `read()`, so bindings created once per row (e.g. by a
20
+ * `DataTable` column `render`) stay reactive while the row is kept.
21
+ *
22
+ * @param read - Accessor of the current row value (an object).
23
+ * @returns A proxy that reads through `read()`.
24
+ *
25
+ * @example
26
+ * ```ts
27
+ * const row = liveView(() => rows()[0]);
28
+ * row.name; // always the current row's name
29
+ * ```
30
+ */
31
+ export function liveView(read) {
32
+ return new Proxy({}, {
33
+ get: (_target, key) => Reflect.get(read(), key),
34
+ has: (_target, key) => key in read(),
35
+ ownKeys: () => Reflect.ownKeys(read()),
36
+ getOwnPropertyDescriptor: (_target, key) => {
37
+ const descriptor = Reflect.getOwnPropertyDescriptor(read(), key);
38
+ return descriptor
39
+ ? { ...descriptor, configurable: true }
40
+ : undefined;
41
+ },
42
+ set: () => false,
43
+ deleteProperty: () => false,
44
+ });
45
+ }
@@ -0,0 +1,38 @@
1
+ /* Document defaults, island roots and screen-reader-only text. */
2
+ *,
3
+ *::before,
4
+ *::after {
5
+ box-sizing: border-box;
6
+ }
7
+
8
+ html,
9
+ body {
10
+ margin: 0;
11
+ padding: 0;
12
+ background: var(--bg);
13
+ color: var(--text);
14
+ font-family: var(--font-sans);
15
+ line-height: 1.5;
16
+ -webkit-font-smoothing: antialiased;
17
+ }
18
+
19
+ /*
20
+ * Island roots (kit `<Island of>`, hydrated at load): layout-neutral, so an
21
+ * island can be a grid or flex item of the static page around it.
22
+ */
23
+ .kit-island {
24
+ display: contents;
25
+ }
26
+
27
+ /* Screen-reader-only text (the kit's client navigation announces each new page title here). */
28
+ .kit-sr-only {
29
+ position: absolute;
30
+ width: 1px;
31
+ height: 1px;
32
+ margin: -1px;
33
+ padding: 0;
34
+ overflow: hidden;
35
+ clip: rect(0 0 0 0);
36
+ white-space: nowrap;
37
+ border: 0;
38
+ }