@unofficialbox/box-open-elements 0.5.0 → 0.7.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 (227) hide show
  1. package/README.md +27 -73
  2. package/dist/components/collections/table.d.ts +113 -3
  3. package/dist/components/collections/table.js +540 -37
  4. package/dist/components/feedback/due-badge.d.ts +38 -0
  5. package/dist/components/feedback/due-badge.js +168 -0
  6. package/dist/components/feedback/due-types.d.ts +32 -0
  7. package/dist/components/feedback/due-types.js +91 -0
  8. package/dist/components/feedback/progress-steps.d.ts +51 -5
  9. package/dist/components/feedback/progress-steps.js +200 -22
  10. package/dist/components/feedback/stage-path.d.ts +44 -0
  11. package/dist/components/feedback/stage-path.js +235 -0
  12. package/dist/components/forms/select.d.ts +21 -0
  13. package/dist/components/forms/select.js +100 -3
  14. package/dist/components/forms/text-field.d.ts +21 -0
  15. package/dist/components/forms/text-field.js +100 -1
  16. package/dist/components/layout/nav-sidebar.d.ts +14 -0
  17. package/dist/components/layout/nav-sidebar.js +49 -0
  18. package/dist/components/layout/split-view.d.ts +14 -0
  19. package/dist/components/layout/split-view.js +80 -1
  20. package/dist/components/overlays/command-palette.d.ts +62 -0
  21. package/dist/components/overlays/command-palette.js +537 -0
  22. package/dist/components/overlays/command-types.d.ts +90 -0
  23. package/dist/components/overlays/command-types.js +259 -0
  24. package/dist/components/overlays/drawer.d.ts +18 -0
  25. package/dist/components/overlays/drawer.js +135 -9
  26. package/dist/components/overlays/shortcuts-overlay.d.ts +48 -0
  27. package/dist/components/overlays/shortcuts-overlay.js +385 -0
  28. package/dist/components/overlays/tooltip.js +1 -1
  29. package/dist/core/index.d.ts +4 -0
  30. package/dist/core/index.js +2 -0
  31. package/dist/core/offset-window.d.ts +70 -0
  32. package/dist/core/offset-window.js +134 -0
  33. package/dist/core/virtualize.d.ts +71 -0
  34. package/dist/core/virtualize.js +67 -0
  35. package/dist/element-maps.d.ts +292 -0
  36. package/dist/element-maps.js +1 -0
  37. package/dist/entries/activity-density.d.ts +1 -0
  38. package/dist/entries/activity-density.js +1 -0
  39. package/dist/entries/agent-chat.d.ts +1 -0
  40. package/dist/entries/agent-chat.js +1 -0
  41. package/dist/entries/audit-log.d.ts +1 -0
  42. package/dist/entries/audit-log.js +1 -0
  43. package/dist/entries/command-palette.d.ts +1 -0
  44. package/dist/entries/command-palette.js +1 -0
  45. package/dist/entries/compare-view.d.ts +1 -0
  46. package/dist/entries/compare-view.js +1 -0
  47. package/dist/entries/diff-viewer.d.ts +1 -0
  48. package/dist/entries/diff-viewer.js +1 -0
  49. package/dist/entries/due-badge.d.ts +1 -0
  50. package/dist/entries/due-badge.js +1 -0
  51. package/dist/entries/form-wizard.d.ts +1 -0
  52. package/dist/entries/form-wizard.js +1 -0
  53. package/dist/entries/lineage-graph.d.ts +1 -0
  54. package/dist/entries/lineage-graph.js +1 -0
  55. package/dist/entries/notification-bell.d.ts +1 -0
  56. package/dist/entries/notification-bell.js +1 -0
  57. package/dist/entries/notification-inbox.d.ts +1 -0
  58. package/dist/entries/notification-inbox.js +1 -0
  59. package/dist/entries/provenance-strip.d.ts +1 -0
  60. package/dist/entries/provenance-strip.js +1 -0
  61. package/dist/entries/run-trace.d.ts +1 -0
  62. package/dist/entries/run-trace.js +1 -0
  63. package/dist/entries/shortcuts-overlay.d.ts +1 -0
  64. package/dist/entries/shortcuts-overlay.js +1 -0
  65. package/dist/entries/signature-ceremony.d.ts +1 -0
  66. package/dist/entries/signature-ceremony.js +1 -0
  67. package/dist/entries/stage-path.d.ts +1 -0
  68. package/dist/entries/stage-path.js +1 -0
  69. package/dist/entries/timeline.d.ts +1 -0
  70. package/dist/entries/timeline.js +1 -0
  71. package/dist/entries/version-graph.d.ts +1 -0
  72. package/dist/entries/version-graph.js +1 -0
  73. package/dist/entries/version-list.d.ts +1 -0
  74. package/dist/entries/version-list.js +1 -0
  75. package/dist/entries/wizard-summary.d.ts +1 -0
  76. package/dist/entries/wizard-summary.js +1 -0
  77. package/dist/entries/work-queue.d.ts +1 -0
  78. package/dist/entries/work-queue.js +1 -0
  79. package/dist/entries/workload-board.d.ts +1 -0
  80. package/dist/entries/workload-board.js +1 -0
  81. package/dist/index.d.ts +21 -0
  82. package/dist/index.js +21 -0
  83. package/dist/patterns/agent-chat/agent-chat.d.ts +75 -0
  84. package/dist/patterns/agent-chat/agent-chat.js +820 -0
  85. package/dist/patterns/agent-chat/controller.d.ts +27 -0
  86. package/dist/patterns/agent-chat/controller.js +182 -0
  87. package/dist/patterns/agent-chat/index.d.ts +3 -0
  88. package/dist/patterns/agent-chat/index.js +6 -0
  89. package/dist/patterns/agent-chat/types.d.ts +109 -0
  90. package/dist/patterns/agent-chat/types.js +1 -0
  91. package/dist/patterns/audit/activity-density.d.ts +68 -0
  92. package/dist/patterns/audit/activity-density.js +428 -0
  93. package/dist/patterns/audit/audit-log.d.ts +182 -0
  94. package/dist/patterns/audit/audit-log.js +1082 -0
  95. package/dist/patterns/audit/index.d.ts +3 -0
  96. package/dist/patterns/audit/index.js +7 -0
  97. package/dist/patterns/audit/shared.d.ts +10 -0
  98. package/dist/patterns/audit/shared.js +50 -0
  99. package/dist/patterns/audit/types.d.ts +143 -0
  100. package/dist/patterns/audit/types.js +327 -0
  101. package/dist/patterns/audit/window.d.ts +116 -0
  102. package/dist/patterns/audit/window.js +132 -0
  103. package/dist/patterns/content-explorer/actions/controller.js +12 -2
  104. package/dist/patterns/content-explorer/box-transport.js +117 -25
  105. package/dist/patterns/content-explorer/content-explorer.d.ts +13 -1
  106. package/dist/patterns/content-explorer/content-explorer.js +36 -3
  107. package/dist/patterns/content-explorer/contracts.d.ts +24 -1
  108. package/dist/patterns/content-explorer/contracts.js +68 -11
  109. package/dist/patterns/content-explorer/controller.d.ts +16 -1
  110. package/dist/patterns/content-explorer/controller.js +130 -4
  111. package/dist/patterns/content-explorer/navigation/controller.js +11 -9
  112. package/dist/patterns/content-explorer/types.d.ts +58 -1
  113. package/dist/patterns/content-picker/content-picker.d.ts +71 -0
  114. package/dist/patterns/content-picker/content-picker.js +747 -0
  115. package/dist/patterns/content-picker/controller.d.ts +38 -0
  116. package/dist/patterns/content-picker/controller.js +141 -0
  117. package/dist/patterns/content-picker/index.d.ts +3 -0
  118. package/dist/patterns/content-picker/index.js +6 -0
  119. package/dist/patterns/content-picker/types.d.ts +52 -0
  120. package/dist/patterns/content-picker/types.js +26 -0
  121. package/dist/patterns/content-sidebar/content-sidebar.d.ts +43 -0
  122. package/dist/patterns/content-sidebar/content-sidebar.js +293 -0
  123. package/dist/patterns/content-sidebar/index.d.ts +2 -0
  124. package/dist/patterns/content-sidebar/index.js +4 -0
  125. package/dist/patterns/content-sidebar/types.d.ts +18 -0
  126. package/dist/patterns/content-sidebar/types.js +20 -0
  127. package/dist/patterns/content-uploader/box-transport.d.ts +14 -0
  128. package/dist/patterns/content-uploader/box-transport.js +54 -0
  129. package/dist/patterns/content-uploader/content-uploader.d.ts +62 -0
  130. package/dist/patterns/content-uploader/content-uploader.js +559 -0
  131. package/dist/patterns/content-uploader/controller.d.ts +39 -0
  132. package/dist/patterns/content-uploader/controller.js +227 -0
  133. package/dist/patterns/content-uploader/index.d.ts +4 -0
  134. package/dist/patterns/content-uploader/index.js +8 -0
  135. package/dist/patterns/content-uploader/types.d.ts +120 -0
  136. package/dist/patterns/content-uploader/types.js +38 -0
  137. package/dist/patterns/diff/compare-view.d.ts +47 -0
  138. package/dist/patterns/diff/compare-view.js +276 -0
  139. package/dist/patterns/diff/diff-viewer.d.ts +42 -0
  140. package/dist/patterns/diff/diff-viewer.js +434 -0
  141. package/dist/patterns/diff/engine.d.ts +22 -0
  142. package/dist/patterns/diff/engine.js +276 -0
  143. package/dist/patterns/diff/index.d.ts +4 -0
  144. package/dist/patterns/diff/index.js +8 -0
  145. package/dist/patterns/diff/types.d.ts +69 -0
  146. package/dist/patterns/diff/types.js +24 -0
  147. package/dist/patterns/form-wizard/controller.d.ts +39 -0
  148. package/dist/patterns/form-wizard/controller.js +157 -0
  149. package/dist/patterns/form-wizard/form-wizard.d.ts +63 -0
  150. package/dist/patterns/form-wizard/form-wizard.js +468 -0
  151. package/dist/patterns/form-wizard/index.d.ts +4 -0
  152. package/dist/patterns/form-wizard/index.js +8 -0
  153. package/dist/patterns/form-wizard/types.d.ts +109 -0
  154. package/dist/patterns/form-wizard/types.js +83 -0
  155. package/dist/patterns/form-wizard/wizard-summary.d.ts +62 -0
  156. package/dist/patterns/form-wizard/wizard-summary.js +324 -0
  157. package/dist/patterns/internal/safe-href.d.ts +17 -0
  158. package/dist/patterns/internal/safe-href.js +17 -0
  159. package/dist/patterns/lineage/index.d.ts +3 -0
  160. package/dist/patterns/lineage/index.js +6 -0
  161. package/dist/patterns/lineage/lineage-graph.d.ts +30 -0
  162. package/dist/patterns/lineage/lineage-graph.js +434 -0
  163. package/dist/patterns/lineage/provenance-strip.d.ts +22 -0
  164. package/dist/patterns/lineage/provenance-strip.js +194 -0
  165. package/dist/patterns/lineage/types.d.ts +53 -0
  166. package/dist/patterns/lineage/types.js +49 -0
  167. package/dist/patterns/notifications/index.d.ts +3 -0
  168. package/dist/patterns/notifications/index.js +6 -0
  169. package/dist/patterns/notifications/notification-bell.d.ts +38 -0
  170. package/dist/patterns/notifications/notification-bell.js +198 -0
  171. package/dist/patterns/notifications/notification-inbox.d.ts +46 -0
  172. package/dist/patterns/notifications/notification-inbox.js +537 -0
  173. package/dist/patterns/notifications/types.d.ts +61 -0
  174. package/dist/patterns/notifications/types.js +108 -0
  175. package/dist/patterns/preview/annotation-inspector.d.ts +25 -6
  176. package/dist/patterns/preview/annotation-inspector.js +239 -94
  177. package/dist/patterns/preview/annotation-thread.d.ts +25 -5
  178. package/dist/patterns/preview/annotation-thread.js +233 -82
  179. package/dist/patterns/preview/annotation-toolbar.d.ts +20 -6
  180. package/dist/patterns/preview/annotation-toolbar.js +162 -96
  181. package/dist/patterns/preview/content-preview-adapter.d.ts +10 -1
  182. package/dist/patterns/preview/content-preview-adapter.js +26 -1
  183. package/dist/patterns/preview/preview-element.d.ts +15 -2
  184. package/dist/patterns/preview/preview-element.js +223 -52
  185. package/dist/patterns/preview/provider-adapter.d.ts +47 -0
  186. package/dist/patterns/preview/provider-adapter.js +17 -0
  187. package/dist/patterns/run/index.d.ts +2 -0
  188. package/dist/patterns/run/index.js +4 -0
  189. package/dist/patterns/run/run-trace.d.ts +40 -0
  190. package/dist/patterns/run/run-trace.js +441 -0
  191. package/dist/patterns/run/types.d.ts +66 -0
  192. package/dist/patterns/run/types.js +152 -0
  193. package/dist/patterns/signature/index.d.ts +2 -0
  194. package/dist/patterns/signature/index.js +4 -0
  195. package/dist/patterns/signature/signature-ceremony.d.ts +33 -0
  196. package/dist/patterns/signature/signature-ceremony.js +317 -0
  197. package/dist/patterns/signature/types.d.ts +68 -0
  198. package/dist/patterns/signature/types.js +89 -0
  199. package/dist/patterns/timeline/index.d.ts +2 -0
  200. package/dist/patterns/timeline/index.js +4 -0
  201. package/dist/patterns/timeline/timeline.d.ts +27 -0
  202. package/dist/patterns/timeline/timeline.js +430 -0
  203. package/dist/patterns/timeline/types.d.ts +36 -0
  204. package/dist/patterns/timeline/types.js +27 -0
  205. package/dist/patterns/versions/graph-layout.d.ts +43 -0
  206. package/dist/patterns/versions/graph-layout.js +159 -0
  207. package/dist/patterns/versions/index.d.ts +4 -0
  208. package/dist/patterns/versions/index.js +8 -0
  209. package/dist/patterns/versions/shared.d.ts +4 -0
  210. package/dist/patterns/versions/shared.js +13 -0
  211. package/dist/patterns/versions/types.d.ts +37 -0
  212. package/dist/patterns/versions/types.js +39 -0
  213. package/dist/patterns/versions/version-graph.d.ts +36 -0
  214. package/dist/patterns/versions/version-graph.js +438 -0
  215. package/dist/patterns/versions/version-list.d.ts +39 -0
  216. package/dist/patterns/versions/version-list.js +407 -0
  217. package/dist/patterns/work-queue/controller.d.ts +26 -0
  218. package/dist/patterns/work-queue/controller.js +150 -0
  219. package/dist/patterns/work-queue/index.d.ts +4 -0
  220. package/dist/patterns/work-queue/index.js +7 -0
  221. package/dist/patterns/work-queue/types.d.ts +128 -0
  222. package/dist/patterns/work-queue/types.js +45 -0
  223. package/dist/patterns/work-queue/work-queue.d.ts +48 -0
  224. package/dist/patterns/work-queue/work-queue.js +534 -0
  225. package/dist/patterns/work-queue/workload-board.d.ts +53 -0
  226. package/dist/patterns/work-queue/workload-board.js +608 -0
  227. package/package.json +89 -5
package/README.md CHANGED
@@ -10,96 +10,49 @@
10
10
 
11
11
  > **Community project — not affiliated with, authorized, or endorsed by Box, Inc.** “Box” is a trademark of Box, Inc. This library tracks Box’s public design language for interoperability; it ships no Box code.
12
12
 
13
- It is a ground-up rebuild of [`box-open-web-components`](https://github.com/unofficialbox/box-open-web-components), carrying forward that repo's validated architecture, docs, and research — without its accumulated baggage — under a new industry-standard taxonomy:
13
+ Browse the full catalog on the **[live docs site](https://unofficialbox.github.io/box-open-elements)** — live previews, an events/properties inspector, per-framework code snippets (React / Angular / Vue / Svelte / HTML), and the foundations pages.
14
+
15
+ The library is organized around three layers (see [docs/taxonomy.md](./docs/taxonomy.md) for the canonical model):
14
16
 
15
17
  - **Foundations** — design decisions as data: tokens, color, typography, iconography, accessibility, theming
16
18
  - **Components** — accessible Web Components for single controls, organized by category
17
19
  - **Patterns** — combinations of components that address user objectives with sequences and flows: headless controllers, transport contracts, and composed workflow surfaces, grouped by Box noun
18
20
 
19
- See [docs/taxonomy.md](./docs/taxonomy.md) for the canonical model.
20
-
21
- The guiding idea is unchanged: predictable, extensible building blocks that are easy for both human developers and AI coding assistants to compose.
21
+ Core implementation principles:
22
22
 
23
- - plain TypeScript modules, no React requirement in the core package
23
+ - plain TypeScript modules, no React requirement in the core package — zero runtime dependencies
24
24
  - state and business logic separate from rendering: controllers and stores, not framework components
25
25
  - standard DOM events where a UI layer needs them
26
26
  - accessibility semantics and keyboard support as part of the component contract
27
27
  - injected transport contracts instead of SDK coupling
28
28
 
29
- ## Preview
30
-
31
- [![The box-open-elements documentation site](https://raw.githubusercontent.com/unofficialbox/box-open-elements/main/docs/screenshots/docs-site/home.png)](https://unofficialbox.github.io/box-open-elements)
32
-
33
- The **[live docs site](https://unofficialbox.github.io/box-open-elements)** browses the full catalog with live previews, an events/properties inspector, per-framework code snippets (React / Angular / Vue / Svelte / HTML), and the foundations pages.
34
-
35
- Components track Box’s design language out of the box — tokens-driven, light and dark, keyboard-accessible:
36
-
37
- ![A selection of form components — text field, search, select, checkboxes, radios, and a pill-selector dropdown](https://raw.githubusercontent.com/unofficialbox/box-open-elements/main/docs/screenshots/gallery/forms.png)
38
-
39
- ## Setup
40
-
41
- This package uses Bun as its package manager and task runner.
29
+ ## Install
42
30
 
43
31
  ```bash
44
- bun install
32
+ npm install @unofficialbox/box-open-elements
45
33
  ```
46
34
 
47
- ## Common commands
35
+ Importing the root registers the full `box-*` catalog; flat entrypoints register only the imported component:
48
36
 
49
- ```bash
50
- bun run typecheck
51
- bun run test
52
- bun run test:coverage
53
- bun run build
54
- bun run verify
55
- bun run docs
37
+ ```ts
38
+ import { Accordion, Avatar, Button, Switch } from "@unofficialbox/box-open-elements";
39
+ import { TextField } from "@unofficialbox/box-open-elements/text-field";
56
40
  ```
57
41
 
58
- `bun run docs` builds the library and serves the component-documentation site at `http://localhost:4600` — browse the full catalog with live previews, events/properties inspectors, and foundations pages.
59
-
60
- `bun run verify` is the main safety check and runs typecheck, **coverage-gated** tests (`test:coverage`), and build in sequence.
61
-
62
- ## Current state
63
-
64
- Full catalog parity with the reference repo, plus every scoped gap the research surfaced:
65
-
66
- - `src/core` — typed event emitter, controller base class, `BaseElement` (in-place shadow DOM render contract), and `FormAssociatedElement` (native form participation + invalid state)
67
- - `src/foundations/tokens` — the design-system registry (tokens, icons, illustrations), the Box default bundle, and the Box dark bundle, retoned to Box's modernized Blueprint palette with an Inter typography baseline; shared interaction helpers (`interaction.ts`) for focus/hover/active/disabled
68
- - `src/foundations/motion` — shared duration/easing vocabulary and reduced-motion CSS helper
69
- - `src/foundations/profiles` — typed runtime profiles for density, geometry, typography, elevation, and motion
70
- - `src/foundations/icons` — the generated Box iconography manifest and alias layer
71
- - `tools/style-bridge` — CSS/SCSS → BOE token/selector bridge (`bun run style-bridge`; BUE explorer: `bun run style-bridge:bue-explorer`)
72
- - `src/components` — 78 components across all ten categories, including the Phase 5 gap fills (`box-chip`, `box-divider`, `box-calendar`, `box-tag-input`, `box-nav-sidebar`, `box-sidebar-toggle-button`, `box-grid-view`, `box-fieldset`, `box-section`, `box-error-mask`, `box-draggable-list`, `box-nudge`, `box-pill-cloud`, `box-pill-selector-dropdown`, `box-datalist-item`, `box-contact-datalist-item`, `box-category-selector`)
73
- - `src/patterns/content-explorer` — the full headless explorer stack (collection, navigation, selection, actions, facade controller, data-source contracts, Box transport, wire schemas) plus the `box-explorer-*` presentation adapters and the composed `box-content-explorer` surface
74
- - `src/patterns/{search,item,metadata,share,preview,file-request,task,governance,insights}` — all nine composition/workflow areas, including contracts and wire schemas for metadata and share, the provider-neutral preview adapter stack, the pluggable `box-preview-element`, and the share workflows (`box-presence`, `box-invite-collaborators-modal`, `box-unified-share-modal`, `box-access-stats`, `box-collaborator-avatars`)
75
- - `packages/box-server` — a dependency-free server-side adapter: CCG auth + REST client, Box-backed explorer/share/metadata data sources, DTO mappers, and framework-neutral route handlers (see [docs/integration/box-server.md](./docs/integration/box-server.md))
76
- - `packages/react` — optional React wrappers (`@box-open-elements/react`); the validated surface ships `Button`, `TextField`, and `Select`. React, Angular, Vue, and Svelte progress is tracked in [docs/integration/framework-adapters.md](./docs/integration/framework-adapters.md).
77
- - `storybook/` — a Bun-native workshop: typed stories → identity-guarded extracted JSON → a self-contained, separately-deployable static site, with no Storybook/Vite runtime or consumer dependency (see [storybook/README.md](./storybook/README.md))
78
- - Docs site + CI — live GitHub Pages deploy, Storybook-backed variant dropdown, and a strict pixel-diff visual-regression gate in CI
79
-
80
- **Fidelity program**: complete — Batches 0–7, the medium/low audit nits, and the design-heavy leftovers have shipped.
81
-
82
- Everything in the [components catalog](./docs/components/catalog.md) and [patterns catalog](./docs/patterns/catalog.md) that carries a **built** marker is implemented here with dedicated tests. Remaining catalog entries are intentional generic-component gaps whose current implementations are explorer-bound; future additions are gap-driven rather than phase-gated ports.
42
+ ```html
43
+ <box-button label="Save" tone="primary"></box-button>
44
+ ```
83
45
 
84
- ## Example: foundations + components
46
+ Components consume foundation tokens (`--boe-token-*`) with safe fallbacks, so they render sensibly with no design system registered and restyle automatically when one is active:
85
47
 
86
48
  ```ts
87
- import {
88
- createThemeController,
89
- } from "@unofficialbox/box-open-elements/foundations/theming";
90
- import { Button } from "@unofficialbox/box-open-elements";
49
+ import { createThemeController } from "@unofficialbox/box-open-elements/foundations/theming";
91
50
 
92
51
  const theme = createThemeController();
93
52
  theme.start();
94
53
  ```
95
54
 
96
- ```html
97
- <box-button label="Save" tone="primary"></box-button>
98
- ```
99
-
100
- Components consume foundation tokens (`--boe-token-*`) with safe fallbacks, so they render sensibly with no design system registered and restyle automatically when one is active.
101
-
102
- ## Example: headless patterns
55
+ Workflow patterns begin as headless behavior and gain presentation adapters, so custom React components, Angular templates, Vue SFCs, Svelte components, Web Components, and plain DOM can all consume the same state:
103
56
 
104
57
  ```ts
105
58
  import { ExplorerSelectionController } from "@unofficialbox/box-open-elements/patterns/content-explorer/selection";
@@ -114,8 +67,6 @@ selection.setItems([{ id: "1" }, { id: "2" }]);
114
67
  selection.toggleSelection("1");
115
68
  ```
116
69
 
117
- Workflow patterns begin as headless behavior and gain presentation adapters, so custom React components, Angular templates, Vue SFCs, Svelte components, Web Components, and plain DOM can all consume the same state.
118
-
119
70
  ## Import contract
120
71
 
121
72
  - root exports: `@unofficialbox/box-open-elements`
@@ -124,15 +75,17 @@ Workflow patterns begin as headless behavior and gain presentation adapters, so
124
75
  - optimized component entrypoints: `@unofficialbox/box-open-elements/<name>`
125
76
  - patterns: `@unofficialbox/box-open-elements/patterns/<area>` and `@unofficialbox/box-open-elements/patterns/<area>/<module>`
126
77
 
127
- The root entrypoint is the concise convenience API and registers the full
128
- catalog. Flat component entrypoints register only the imported component:
78
+ See [docs/api-guidelines.md](./docs/api-guidelines.md).
129
79
 
130
- ```ts
131
- import { Accordion, Avatar, Button, Switch } from "@unofficialbox/box-open-elements";
132
- import { TextField } from "@unofficialbox/box-open-elements/text-field";
133
- ```
80
+ ## Developing
134
81
 
135
- See [docs/api-guidelines.md](./docs/api-guidelines.md).
82
+ This repo uses Bun as its package manager and task runner.
83
+
84
+ ```bash
85
+ bun install
86
+ bun run verify # the main safety gate: typecheck, coverage-gated tests, build
87
+ bun run docs # build + serve the docs site at http://localhost:4600
88
+ ```
136
89
 
137
90
  ## Documentation
138
91
 
@@ -141,6 +94,7 @@ The docs index is at [docs/README.md](./docs/README.md). The most important entr
141
94
  - [Taxonomy](./docs/taxonomy.md)
142
95
  - [Architecture](./docs/architecture.md)
143
96
  - [API Guidelines](./docs/api-guidelines.md)
97
+ - [Components catalog](./docs/components/catalog.md) and [patterns catalog](./docs/patterns/catalog.md)
144
98
  - [Using with React, Angular, Vue, and Svelte](./docs/integration/frameworks.md)
145
99
  - [Design Tokens](./docs/foundations/tokens.md)
146
100
  - [Content Explorer](./docs/patterns/content-explorer.md)
@@ -1,4 +1,5 @@
1
1
  import { BaseElement } from "../../core/index.js";
2
+ import type { RowWindow } from "../../core/index.js";
2
3
  export interface TableColumn {
3
4
  key: string;
4
5
  label: string;
@@ -7,12 +8,47 @@ export interface TableColumn {
7
8
  /** Mark the column sortable — clicking its header emits `sort`. */
8
9
  sortable?: boolean;
9
10
  }
11
+ export type TableCellTone = "neutral" | "brand" | "success" | "warning" | "error";
12
+ /**
13
+ * Declarative cell content beyond plain text. Deliberately a descriptor the
14
+ * table renders itself, never an HTML string or a render callback: cell data
15
+ * is server-supplied and stays escaped — a string renderer would reopen the
16
+ * injection hole the escaping exists to close.
17
+ */
18
+ export interface TableCellDescriptor {
19
+ kind: "text" | "badge" | "link";
20
+ text: string;
21
+ /** Badge colour; the text still carries the meaning. */
22
+ tone?: TableCellTone;
23
+ /** Link target; non-http(s) schemes render as plain text. */
24
+ href?: string;
25
+ }
26
+ export type TableCellValue = string | TableCellDescriptor;
10
27
  export interface TableRow {
11
28
  id: string;
12
- /** Cell text keyed by column key, or positional strings matching `columns`. */
13
- cells: Record<string, string> | string[];
29
+ /** Cell values keyed by column key, or positional, matching `columns`. */
30
+ cells: Record<string, TableCellValue> | TableCellValue[];
31
+ /**
32
+ * Expandable detail. Renders a per-row toggle and a full-width detail row
33
+ * holding this text plus a `detail-<id>` slot for rich host content.
34
+ */
35
+ detail?: string;
14
36
  }
15
37
  export type TableSelectionMode = "none" | "single" | "multiple";
38
+ /** Detail of the `sort` event, for typed listeners. */
39
+ export interface TableSortDetail {
40
+ key: string;
41
+ direction: "ascending" | "descending";
42
+ }
43
+ /** Detail of the `selection-changed` event, for typed listeners. */
44
+ export interface TableSelectionChangedDetail {
45
+ selectedIds: string[];
46
+ }
47
+ /** Detail of the `row-toggled` event, for typed listeners. */
48
+ export interface TableRowToggledDetail {
49
+ rowId: string;
50
+ expanded: boolean;
51
+ }
16
52
  /**
17
53
  * A semantic, selectable data table — box-ui-elements `Table` + `makeSelectable`.
18
54
  * Rows and columns come from JSON. Selection supports single / Ctrl-click toggle
@@ -25,8 +61,68 @@ export declare class Table extends BaseElement {
25
61
  static get observedAttributes(): string[];
26
62
  private bodyEl;
27
63
  private headEl;
64
+ private shellEl;
28
65
  private selected;
29
66
  private anchorIndex;
67
+ private readonly expandedIds;
68
+ private lastWindow;
69
+ /**
70
+ * Whether the last render actually windowed. Not the same as `virtualize`:
71
+ * the flag is suppressed for a collection the fixed-height window cannot
72
+ * describe (see `update`). Cached at render time so the scroll handler does
73
+ * not re-parse `rows` on every frame to answer the question.
74
+ */
75
+ private windowing;
76
+ private scrollFrame;
77
+ private measuredRowHeight;
78
+ private measureFrame;
79
+ /** True while rows are being fetched: the body states "Loading rows…". */
80
+ get loading(): boolean;
81
+ set loading(value: boolean);
82
+ /** What the body says when there are no rows and nothing is loading. */
83
+ get emptyText(): string;
84
+ set emptyText(value: string);
85
+ /** Non-empty puts the table in an error state stating this text. */
86
+ get errorText(): string;
87
+ set errorText(value: string);
88
+ /**
89
+ * Render only the rows near the viewport. Opt-in: a windowed table needs a
90
+ * bounded height to scroll within, and silently windowing an unbounded table
91
+ * would render nothing.
92
+ *
93
+ * A request, not a guarantee. The window arithmetic is fixed-height, so it is
94
+ * suppressed for a collection whose rows can change height — today that means
95
+ * any collection where a row declares `detail`. Read `renderedWindow` to see
96
+ * whether a render actually windowed.
97
+ */
98
+ get virtualize(): boolean;
99
+ set virtualize(value: boolean);
100
+ /**
101
+ * Row height in pixels for the window arithmetic — a starting estimate, not
102
+ * a contract. The real height depends on density, font, and zoom, and a
103
+ * declared value that is off by a fraction of a pixel makes the scroll range
104
+ * drift as you scroll (a 10k-row table measured ~55px of wobble at 37px
105
+ * declared). After the first paint the element measures a rendered row and
106
+ * uses that instead, so the estimate only has to be close enough to pick a
107
+ * sane first window.
108
+ */
109
+ get rowHeight(): number;
110
+ private get declaredRowHeight();
111
+ set rowHeight(value: number);
112
+ /**
113
+ * Adopt the real rendered row height, once, when it differs from the value
114
+ * the last window was computed with. Re-rendering with the measured height
115
+ * settles immediately: the next measurement matches, so this cannot loop.
116
+ */
117
+ private measureRowHeight;
118
+ /**
119
+ * The window the last render used, or null when it rendered every row — for
120
+ * tests and hosts. Null despite `virtualize` means the collection is one the
121
+ * fixed-height window cannot describe and windowing was suppressed.
122
+ */
123
+ get renderedWindow(): RowWindow | null;
124
+ /** Ids of the rows whose detail is expanded (host-readable). */
125
+ get expandedRows(): string[];
30
126
  get columns(): TableColumn[];
31
127
  set columns(value: TableColumn[]);
32
128
  get rows(): TableRow[];
@@ -38,16 +134,30 @@ export declare class Table extends BaseElement {
38
134
  get label(): string;
39
135
  set label(value: string);
40
136
  private parseJson;
41
- private cellText;
137
+ private cellValue;
138
+ /**
139
+ * Descriptor rendering. Everything is escaped; a link with a non-http(s)
140
+ * href renders as plain text; a badge's tone colours a word that already
141
+ * carries the meaning.
142
+ */
143
+ private cellMarkup;
42
144
  protected renderTemplate(): void;
43
145
  protected setupListeners(): void;
44
146
  private rowElements;
147
+ private toggleRowDetail;
45
148
  private onBodyKeydown;
149
+ /**
150
+ * Focus a row by its absolute index, bringing it into the window first when
151
+ * virtualizing — keyboard navigation must be able to reach a row that is not
152
+ * currently rendered, or Home/End stop at the edge of the window.
153
+ */
154
+ private focusRowByIndex;
46
155
  private toggleSort;
47
156
  private activateRow;
48
157
  private selectRange;
49
158
  private selectAll;
50
159
  private setSelection;
51
160
  private applySelectionState;
161
+ private currentWindow;
52
162
  protected update(): void;
53
163
  }