@mechane-ai/elements 0.8.0 → 0.10.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 (94) hide show
  1. package/NOTICE +24 -0
  2. package/README.md +67 -40
  3. package/dist/ai.js +274 -209
  4. package/dist/{categorical-values-dGbaZ0tp.js → categorical-values-DLRE4EEW.js} +4 -4
  5. package/dist/{chart-frame-DgPdIguO.js → chart-frame-et6f6Vhg.js} +22 -14
  6. package/dist/{chart-input-Sac4StHN.js → chart-input-CdLkFomi.js} +2 -2
  7. package/dist/charts/cartesian.js +529 -450
  8. package/dist/charts/distribution.js +302 -261
  9. package/dist/charts/graph.js +137 -103
  10. package/dist/charts/hierarchy.js +7 -7
  11. package/dist/charts/matrix.js +187 -174
  12. package/dist/charts/timeline.js +118 -92
  13. package/dist/charts.js +1 -1
  14. package/dist/code-block-D77maJBB.js +180 -0
  15. package/dist/collections.js +388 -300
  16. package/dist/content/code.js +1 -1
  17. package/dist/content/diff.js +81 -63
  18. package/dist/content/link.js +1 -1
  19. package/dist/content/markdown.js +115 -96
  20. package/dist/content/tree.js +43 -38
  21. package/dist/{content-link-Dd8gapwc.js → content-link-BpSZeTNK.js} +6 -2
  22. package/dist/content.js +169 -150
  23. package/dist/{assets/stylex.css → elements.css} +862 -338
  24. package/dist/feedback.js +1 -1
  25. package/dist/forms/dates.js +31 -31
  26. package/dist/forms.js +1 -1
  27. package/dist/index.js +1 -1
  28. package/dist/layout.js +286 -187
  29. package/dist/navigation/commands.js +45 -42
  30. package/dist/{navigation-yxK3iQXo.js → navigation-D2_sGy3C.js} +2 -2
  31. package/dist/navigation.js +10 -10
  32. package/dist/overlays.js +1 -1
  33. package/dist/packages/ai/src/conversation.d.ts +2 -1
  34. package/dist/packages/ai/src/index.d.ts +4 -0
  35. package/dist/packages/ai/src/message-action.d.ts +10 -0
  36. package/dist/packages/ai/src/message-boundary.d.ts +6 -0
  37. package/dist/packages/ai/src/message.d.ts +2 -1
  38. package/dist/packages/charts/src/cartesian/bar-chart.d.ts +5 -0
  39. package/dist/packages/charts/src/cartesian/index.d.ts +2 -2
  40. package/dist/packages/charts/src/chart-frame.d.ts +3 -0
  41. package/dist/packages/charts/src/chart-theme.d.ts +2 -1
  42. package/dist/packages/charts/src/distribution/distribution-plot.d.ts +22 -2
  43. package/dist/packages/collections/src/collection-scroll.d.ts +2 -1
  44. package/dist/packages/collections/src/data-table.d.ts +6 -0
  45. package/dist/packages/collections/src/index.d.ts +2 -2
  46. package/dist/packages/collections/src/timeline.d.ts +10 -3
  47. package/dist/packages/content/src/diff/pierre-diff.d.ts +2 -1
  48. package/dist/packages/content/src/viewer-styles.d.ts +64 -0
  49. package/dist/packages/core/src/actions.d.ts +7 -0
  50. package/dist/packages/core/src/agent-avatar-glyphs.d.ts +5 -0
  51. package/dist/packages/core/src/agent-avatar.d.ts +17 -0
  52. package/dist/packages/core/src/copy-value.d.ts +2 -1
  53. package/dist/packages/core/src/index.d.ts +6 -2
  54. package/dist/packages/core/src/surfaces.d.ts +5 -0
  55. package/dist/packages/feedback/src/index.d.ts +4 -1
  56. package/dist/packages/feedback/src/toast.d.ts +5 -27
  57. package/dist/packages/forms/src/agent-avatar-picker.d.ts +8 -0
  58. package/dist/packages/forms/src/field-styles.d.ts +28 -0
  59. package/dist/packages/forms/src/forms.d.ts +2 -1
  60. package/dist/packages/forms/src/index.d.ts +2 -0
  61. package/dist/packages/forms/src/selection-styles.d.ts +18 -2
  62. package/dist/packages/foundations/src/overlay-styles.d.ts +3 -1
  63. package/dist/packages/foundations/src/popup-styles.d.ts +7 -0
  64. package/dist/packages/foundations/src/tokens.stylex.d.ts +61 -0
  65. package/dist/packages/layout/src/app-shell.d.ts +2 -1
  66. package/dist/packages/layout/src/frame.stylex.d.ts +1 -0
  67. package/dist/packages/layout/src/index.d.ts +2 -1
  68. package/dist/packages/layout/src/page-toolbar.d.ts +3 -1
  69. package/dist/packages/layout/src/sidebar.d.ts +7 -1
  70. package/dist/packages/layout/src/view-stack.d.ts +13 -0
  71. package/dist/packages/layout/src/workbench.d.ts +5 -2
  72. package/dist/packages/overlays/src/alert-dialog.d.ts +5 -2
  73. package/dist/packages/overlays/src/dialog.d.ts +7 -3
  74. package/dist/pierre-diff--zsiHCCB.js +71 -0
  75. package/dist/pierre-theme-D9hnHv3Z.js +126 -0
  76. package/dist/{pierre-tree-DdE1boiT.js → pierre-tree-BFxEuxwb.js} +3 -3
  77. package/dist/src-Be7NLG8c.js +1242 -0
  78. package/dist/src-CBspCKfO.js +969 -0
  79. package/dist/src-Cs0dRc4X.js +617 -0
  80. package/dist/src-sU9b0oZW.js +1168 -0
  81. package/dist/theme.js +1 -1
  82. package/dist/tokens.js +69 -10
  83. package/dist/viewer-styles-CpHqp5Qv.js +70 -0
  84. package/package.json +2 -1
  85. package/packages/foundations/src/tokens.stylex.ts +61 -0
  86. package/styles.css +1 -1
  87. package/dist/code-block-BRNdtTaP.js +0 -175
  88. package/dist/pierre-diff-CZdzgiYm.js +0 -66
  89. package/dist/pierre-theme-BpESNIsV.js +0 -96
  90. package/dist/popup-styles-CvtZDE2t.js +0 -135
  91. package/dist/src-Bc5sEhdO.js +0 -680
  92. package/dist/src-CfDf8TY8.js +0 -466
  93. package/dist/src-DV0BNk1M.js +0 -360
  94. package/dist/src-Eg_ytPjv.js +0 -1107
package/NOTICE CHANGED
@@ -30,3 +30,27 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
30
30
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
31
31
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
32
32
  SOFTWARE.
33
+
34
+ Bundled Sonner
35
+
36
+ MIT License
37
+
38
+ Copyright (c) 2023 Emil Kowalski
39
+
40
+ Permission is hereby granted, free of charge, to any person obtaining a copy
41
+ of this software and associated documentation files (the "Software"), to deal
42
+ in the Software without restriction, including without limitation the rights
43
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
44
+ copies of the Software, and to permit persons to whom the Software is
45
+ furnished to do so, subject to the following conditions:
46
+
47
+ The above copyright notice and this permission notice shall be included in all
48
+ copies or substantial portions of the Software.
49
+
50
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
51
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
52
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
53
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
54
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
55
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
56
+ SOFTWARE.
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
@@ -94,13 +95,34 @@ Use `ToolbarAction` for page-header actions, including links composed with `rend
94
95
  `CopyValue render={<ToolbarAction />}`; the rendered control owns its appearance and CopyValue owns copy feedback. Use
95
96
  `Row` for aligned inline actions, `Stack` for related content, and `RecordPage.Content` for separated page sections.
96
97
  Detail titles wrap; list metadata truncates. Sidebar items share contiguous hit areas. Put scrolling commands with the
97
- navigation and reserve the divided sidebar footer for persistent account information.
98
+ navigation and reserve the divided sidebar footer for persistent account controls. Use
99
+ `SidebarFooter layout="navigation"` for a group of commands; its intrinsic height keeps the scrolling navigation clear.
100
+
101
+ `AppShell focus` temporarily hides navigation while retaining its expansion state. `ViewStack.Panel` keeps inactive
102
+ content mounted and measurable but removes it from keyboard and assistive-technology navigation. The application owns
103
+ which view is active and when to unmount it; use this for a draft or reading position that must survive inspection.
104
+ `WorkbenchScroll` requires an accessible `label`; its `flush` mode leaves list insets to the table. Its
105
+ `scrollRestorationId` identifies the actual scroll region for application-owned restoration.
98
106
 
99
107
  `DataTable` uses 48px rows by default and truncates text to preserve stable column and virtualization geometry. Set
100
108
  `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.
109
+ belongs in a detail view or a deliberately content-sized row, not behind a clipped control. Use `DataTableText` for a
110
+ primary string and optional secondary string inside one cell; both text elements own their ellipsis. Arbitrary nested
111
+ layouts do not inherit text truncation. Give dates and numeric values sufficient column width or explicit content
112
+ sizing. The table owns its cell insets, so an enclosing page should not add another gutter around its rows.
113
+ `CollectionEnd` renders nothing when complete unless an explicit summary is supplied. `Timeline.Root` and
114
+ `Timeline.Item` compose readable activity with supplied titles, icons, timestamps, metadata, and body content, without
115
+ interpreting domain events.
116
+
117
+ `Message` reserves space for secondary actions and reveals them on hover and keyboard focus; touch devices keep them
118
+ visible. `MessageAction` supplies a named icon button and tooltip. Keep errors, decisions, and current activity outside
119
+ that action region. `MessageBoundary` groups expandable context between messages. `PromptInput` keeps its label
120
+ accessible while integrating the submit control into the input frame. The application owns submission identity,
121
+ acknowledgement, and draft retention.
122
+
123
+ `AgentAvatar` derives a repeatable shape and palette from a supplied seed, or renders an explicit appearance.
124
+ `AgentAvatarPicker` accepts that appearance and reports changes; applications own storage. Keep the same seed for a
125
+ record and store named choices rather than catalog indexes. Identity palettes remain separate from status colors.
104
126
 
105
127
  `MetricGrid layout="columns"` distributes supplied metrics by available container width. Its inline layout suits compact
106
128
  record summaries. `SettingsSection` keeps wide tables inside their scroll region; group sections with `Stack` and align
@@ -110,10 +132,10 @@ The default theme is light, with system fonts and a compact spacing scale. Impor
110
132
  `@mechane-ai/elements/theme` and spread `themeProps.light` or `themeProps.dark` onto the document root. Portaled content
111
133
  then inherits the same theme. The application owns the preference; no theme provider is required.
112
134
 
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.
135
+ For custom StyleX themes, import definitions from `@mechane-ai/elements/tokens.stylex`, enable `useCSSLayers: true` and
136
+ CommonJS module resolution in the StyleX plugin, and use `stylex.createTheme`. The defining path is preserved in the
137
+ archive so generated variables match its compiled CSS. The ordinary `/tokens` entry supplies runtime references rather
138
+ than compile-time definitions.
117
139
 
118
140
  Set the consumer compiler's `debug: false` so placement overrides use the archive's property keys. Keep definition
119
141
  resolution for compilation; bundle `/tokens` runtime references to avoid reinjecting defaults over a chosen theme.
@@ -123,6 +145,11 @@ When an application's Content Security Policy requires nonces, wrap its componen
123
145
  This is [Base UI's CSP provider](https://base-ui.com/react/utils/csp-provider); it authorizes component style tags such
124
146
  as Select's scrollbar rules. The application owns nonce generation and its security policy.
125
147
 
148
+ Mount one `Toaster` from `/feedback` and call its exported `toast` API for notifications. Elements includes Sonner's
149
+ structural styles in the published stylesheet, so the production package injects no additional toast style tag. Keep
150
+ initial-read failures and field validation local; retained-content refresh failures can use one notification with Retry.
151
+ The application owns stable notification IDs and dismissal on recovery or navigation.
152
+
126
153
  ## Develop and release
127
154
 
128
155
  From `workspaces/core`: