@mechane-ai/elements 0.8.0 → 0.9.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 (61) hide show
  1. package/README.md +60 -39
  2. package/dist/ai.js +231 -170
  3. package/dist/assets/stylex.css +402 -164
  4. package/dist/{categorical-values-dGbaZ0tp.js → categorical-values-DYRiw5Qd.js} +2 -2
  5. package/dist/{chart-frame-DgPdIguO.js → chart-frame-RL1hCWBC.js} +1 -1
  6. package/dist/{chart-input-Sac4StHN.js → chart-input-Bm3ot1yD.js} +2 -2
  7. package/dist/charts/cartesian.js +5 -5
  8. package/dist/charts/distribution.js +2 -2
  9. package/dist/charts/graph.js +2 -2
  10. package/dist/charts/hierarchy.js +3 -3
  11. package/dist/charts/matrix.js +2 -2
  12. package/dist/charts/timeline.js +1 -1
  13. package/dist/charts.js +1 -1
  14. package/dist/{code-block-BRNdtTaP.js → code-block-B30xQKqg.js} +1 -1
  15. package/dist/collections.js +305 -261
  16. package/dist/content/code.js +1 -1
  17. package/dist/content/diff.js +2 -2
  18. package/dist/content/link.js +1 -1
  19. package/dist/content/markdown.js +4 -4
  20. package/dist/content/tree.js +2 -2
  21. package/dist/{content-link-Dd8gapwc.js → content-link-BrPrpBof.js} +1 -1
  22. package/dist/content.js +35 -35
  23. package/dist/feedback.js +1 -1
  24. package/dist/forms/dates.js +7 -7
  25. package/dist/forms.js +1 -1
  26. package/dist/index.js +1 -1
  27. package/dist/layout.js +138 -86
  28. package/dist/navigation/commands.js +1 -1
  29. package/dist/packages/ai/src/conversation.d.ts +2 -1
  30. package/dist/packages/ai/src/index.d.ts +4 -0
  31. package/dist/packages/ai/src/message-action.d.ts +10 -0
  32. package/dist/packages/ai/src/message-boundary.d.ts +6 -0
  33. package/dist/packages/ai/src/message.d.ts +2 -1
  34. package/dist/packages/collections/src/data-table.d.ts +6 -0
  35. package/dist/packages/collections/src/index.d.ts +2 -2
  36. package/dist/packages/collections/src/timeline.d.ts +10 -3
  37. package/dist/packages/core/src/actions.d.ts +7 -0
  38. package/dist/packages/core/src/agent-avatar-glyphs.d.ts +5 -0
  39. package/dist/packages/core/src/agent-avatar.d.ts +17 -0
  40. package/dist/packages/core/src/copy-value.d.ts +2 -1
  41. package/dist/packages/core/src/index.d.ts +5 -1
  42. package/dist/packages/forms/src/agent-avatar-picker.d.ts +8 -0
  43. package/dist/packages/forms/src/field-styles.d.ts +19 -0
  44. package/dist/packages/forms/src/forms.d.ts +2 -1
  45. package/dist/packages/forms/src/index.d.ts +2 -0
  46. package/dist/packages/foundations/src/tokens.stylex.d.ts +52 -0
  47. package/dist/packages/layout/src/app-shell.d.ts +2 -1
  48. package/dist/packages/layout/src/index.d.ts +2 -1
  49. package/dist/packages/layout/src/page-toolbar.d.ts +3 -1
  50. package/dist/packages/layout/src/sidebar.d.ts +4 -0
  51. package/dist/packages/layout/src/view-stack.d.ts +13 -0
  52. package/dist/packages/layout/src/workbench.d.ts +5 -2
  53. package/dist/{pierre-tree-DdE1boiT.js → pierre-tree-CRk09rx7.js} +2 -2
  54. package/dist/{src-Eg_ytPjv.js → src-Cc0Sadzr.js} +376 -293
  55. package/dist/{src-DV0BNk1M.js → src-DuuAmS-c.js} +1 -1
  56. package/dist/src-elMBQ2Dh.js +1087 -0
  57. package/dist/theme.js +1 -1
  58. package/dist/tokens.js +61 -10
  59. package/package.json +1 -1
  60. package/packages/foundations/src/tokens.stylex.ts +54 -0
  61. package/dist/src-Bc5sEhdO.js +0 -680
package/README.md CHANGED
@@ -41,43 +41,44 @@ export function Example() {
41
41
  Elements supplies compiled ESM, TypeScript declarations, and CSS. Ordinary React consumers need no StyleX compiler.
42
42
  Applications install their own reset and fonts. Put reset rules in the `reset` CSS layer. Elements and consumer StyleX
43
43
  rules share the compiler's ordered `priority` layers. Keep those layers at the top level: wrapping Elements in another
44
- layer lets consumer base declarations override component hover and focus states. Unlayered application themes can
45
- override token defaults.
44
+ layer lets consumer base declarations override component hover and focus states. Packaged token defaults and themes use
45
+ `priority1`; ordinary unlayered application rules can override the package. Consumer-generated themes follow their own
46
+ emitted layers and selector specificity.
46
47
 
47
48
  ## Imports
48
49
 
49
50
  Every path below belongs to `@mechane-ai/elements`. There is one package, version, and stylesheet.
50
51
 
51
- | Entry | Responsibility |
52
- | ---------------------- | --------------------------------------------------------------------------------- |
53
- | Root | Buttons, text, surfaces, disclosure, Avatar, and CopyValue. |
54
- | `/forms` | Fields, inputs, selection, file picking, and settings sections. |
55
- | `/forms/dates` | Civil-date calendars and range selection. |
56
- | `/overlays` | Dialog, Drawer, Menu, Popover, Preview, Tooltip, and AlertDialog. |
57
- | `/feedback` | Async regions, skeletons, progress, meters, notices, empty states, and toasts. |
58
- | `/navigation` | Tabs, page navigation, breadcrumbs, skip links, and shortcut labels. |
59
- | `/navigation/commands` | Command palette and scoped application-owned shortcuts. |
60
- | `/layout` | Application shell, sidebar, toolbars, compound record pages, and resizable panes. |
61
- | `/collections` | Tables, inspectors, collection controls, timelines, metrics, and timestamps. |
62
- | `/content` | Trace, JSON, recorded logs, and stack traces. |
63
- | `/content/link` | Safe content links without a renderer dependency. |
64
- | `/content/markdown` | Completed and streaming Markdown, embedded headings, and inert previews. |
65
- | `/content/code` | Source-preserving code highlighting. |
66
- | `/content/diff` | File changes and patches. |
67
- | `/content/tree` | File paths, statuses, and controlled selection. |
68
- | `/ai` | Conversations, messages, prompts, approvals, sources, and citations. |
69
- | `/charts` | Shared frames, legends, selection, and category types. |
70
- | `/charts/cartesian` | Lines, areas, sparklines, small multiples, bars, and scatter plots. |
71
- | `/charts/distribution` | Histograms, cumulative distributions, intervals, and ranked values. |
72
- | `/charts/matrix` | Matrices, token heatmaps, and color legends. |
73
- | `/charts/graph` | Supplied relationships and node selection. |
74
- | `/charts/hierarchy` | Treemaps. |
75
- | `/charts/timeline` | Waterfall intervals and instants. |
76
- | `/theme` | Light and dark theme props. |
77
- | `/csp` | Application-supplied content security policy configuration. |
78
- | `/tokens` | Compiled token references for runtime styles. |
79
- | `/tokens.stylex` | Direct definitions for StyleX authoring and themes. |
80
- | `/styles.css` | Component styles and token defaults. |
52
+ | Entry | Responsibility |
53
+ | ---------------------- | ----------------------------------------------------------------------------------- |
54
+ | Root | Buttons, text, surfaces, disclosure, avatars, and CopyValue. |
55
+ | `/forms` | Fields, inputs, selection, appearance picking, file picking, and settings sections. |
56
+ | `/forms/dates` | Civil-date calendars and range selection. |
57
+ | `/overlays` | Dialog, Drawer, Menu, Popover, Preview, Tooltip, and AlertDialog. |
58
+ | `/feedback` | Async regions, skeletons, progress, meters, notices, empty states, and toasts. |
59
+ | `/navigation` | Tabs, page navigation, breadcrumbs, skip links, and shortcut labels. |
60
+ | `/navigation/commands` | Command palette and scoped application-owned shortcuts. |
61
+ | `/layout` | Application shell, sidebar, toolbars, compound record pages, and resizable panes. |
62
+ | `/collections` | Tables, inspectors, collection controls, timelines, metrics, and timestamps. |
63
+ | `/content` | Trace, JSON, recorded logs, and stack traces. |
64
+ | `/content/link` | Safe content links without a renderer dependency. |
65
+ | `/content/markdown` | Completed and streaming Markdown, embedded headings, and inert previews. |
66
+ | `/content/code` | Source-preserving code highlighting. |
67
+ | `/content/diff` | File changes and patches. |
68
+ | `/content/tree` | File paths, statuses, and controlled selection. |
69
+ | `/ai` | Conversations, messages, prompts, approvals, sources, and citations. |
70
+ | `/charts` | Shared frames, legends, selection, and category types. |
71
+ | `/charts/cartesian` | Lines, areas, sparklines, small multiples, bars, and scatter plots. |
72
+ | `/charts/distribution` | Histograms, cumulative distributions, intervals, and ranked values. |
73
+ | `/charts/matrix` | Matrices, token heatmaps, and color legends. |
74
+ | `/charts/graph` | Supplied relationships and node selection. |
75
+ | `/charts/hierarchy` | Treemaps. |
76
+ | `/charts/timeline` | Waterfall intervals and instants. |
77
+ | `/theme` | Light and dark theme props. |
78
+ | `/csp` | Application-supplied content security policy configuration. |
79
+ | `/tokens` | Compiled token references for runtime styles. |
80
+ | `/tokens.stylex` | Direct definitions for StyleX authoring and themes. |
81
+ | `/styles.css` | Component styles and token defaults. |
81
82
 
82
83
  Focused entries keep renderer and chart dependencies out of basic controls. There is no all-components barrel. Renderers
83
84
  initialize when used, without a consumer-managed worker pool or grammar CDN. The
@@ -96,11 +97,31 @@ Use `ToolbarAction` for page-header actions, including links composed with `rend
96
97
  Detail titles wrap; list metadata truncates. Sidebar items share contiguous hit areas. Put scrolling commands with the
97
98
  navigation and reserve the divided sidebar footer for persistent account information.
98
99
 
100
+ `AppShell focus` temporarily hides navigation while retaining its expansion state. `ViewStack.Panel` keeps inactive
101
+ content mounted and measurable but removes it from keyboard and assistive-technology navigation. The application owns
102
+ which view is active and when to unmount it; use this for a draft or reading position that must survive inspection.
103
+ `WorkbenchScroll` requires an accessible `label`; its `flush` mode leaves list insets to the table. Its
104
+ `scrollRestorationId` identifies the actual scroll region for application-owned restoration.
105
+
99
106
  `DataTable` uses 48px rows by default and truncates text to preserve stable column and virtualization geometry. Set
100
107
  `rowSizing="content"` for records that need multiline cells; virtualization then measures those rows. Long content
101
- belongs in a detail view or a deliberately content-sized row, not behind a clipped control. `CollectionEnd` renders
102
- nothing when complete unless an explicit summary is supplied. `Timeline.Root` and `Timeline.Item` compose readable
103
- activity with supplied titles, icons, timestamps, metadata, and body content, without interpreting domain events.
108
+ belongs in a detail view or a deliberately content-sized row, not behind a clipped control. Use `DataTableText` for a
109
+ primary string and optional secondary string inside one cell; both text elements own their ellipsis. Arbitrary nested
110
+ layouts do not inherit text truncation. Give dates and numeric values sufficient column width or explicit content
111
+ sizing. The table owns its cell insets, so an enclosing page should not add another gutter around its rows.
112
+ `CollectionEnd` renders nothing when complete unless an explicit summary is supplied. `Timeline.Root` and
113
+ `Timeline.Item` compose readable activity with supplied titles, icons, timestamps, metadata, and body content, without
114
+ interpreting domain events.
115
+
116
+ `Message` reserves space for secondary actions and reveals them on hover and keyboard focus; touch devices keep them
117
+ visible. `MessageAction` supplies a named icon button and tooltip. Keep errors, decisions, and current activity outside
118
+ that action region. `MessageBoundary` groups expandable context between messages. `PromptInput` keeps its label
119
+ accessible while integrating the submit control into the input frame. The application owns submission identity,
120
+ acknowledgement, and draft retention.
121
+
122
+ `AgentAvatar` derives a repeatable shape and palette from a supplied seed, or renders an explicit appearance.
123
+ `AgentAvatarPicker` accepts that appearance and reports changes; applications own storage. Keep the same seed for a
124
+ record and store named choices rather than catalog indexes. Identity palettes remain separate from status colors.
104
125
 
105
126
  `MetricGrid layout="columns"` distributes supplied metrics by available container width. Its inline layout suits compact
106
127
  record summaries. `SettingsSection` keeps wide tables inside their scroll region; group sections with `Stack` and align
@@ -110,10 +131,10 @@ The default theme is light, with system fonts and a compact spacing scale. Impor
110
131
  `@mechane-ai/elements/theme` and spread `themeProps.light` or `themeProps.dark` onto the document root. Portaled content
111
132
  then inherits the same theme. The application owns the preference; no theme provider is required.
112
133
 
113
- For custom StyleX themes, import definitions from `@mechane-ai/elements/tokens.stylex`, enable CommonJS module
114
- resolution in the StyleX plugin, and use `stylex.createTheme`. The defining path is preserved in the archive so
115
- generated variables match its compiled CSS. The ordinary `/tokens` entry supplies runtime references rather than
116
- compile-time definitions.
134
+ For custom StyleX themes, import definitions from `@mechane-ai/elements/tokens.stylex`, enable `useCSSLayers: true` and
135
+ CommonJS module resolution in the StyleX plugin, and use `stylex.createTheme`. The defining path is preserved in the
136
+ archive so generated variables match its compiled CSS. The ordinary `/tokens` entry supplies runtime references rather
137
+ than compile-time definitions.
117
138
 
118
139
  Set the consumer compiler's `debug: false` so placement overrides use the archive's property keys. Keep definition
119
140
  resolution for compilation; bundle `/tokens` runtime references to avoid reinjecting defaults over a chosen theme.