@mechane-ai/elements 0.41.0 → 0.43.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 (92) hide show
  1. package/README.md +72 -41
  2. package/bin/catalog.d.mts +17 -0
  3. package/bin/mechane-elements-catalog.mjs +60 -0
  4. package/dist/agent.js +1 -1
  5. package/dist/ai.js +23 -23
  6. package/dist/catalog.json +1984 -0
  7. package/dist/{categorical-values-DnGR_pQx.js → categorical-values-DzhbfZ5w.js} +3 -3
  8. package/dist/{chart-frame-BsyI1Zc8.js → chart-frame-9dQQNF3F.js} +74 -22
  9. package/dist/{chart-input-r4S3-QCT.js → chart-input-DT0STflx.js} +2 -2
  10. package/dist/{chart-navigation-D7OkLdSx.js → chart-navigation-BAbb5PV9.js} +67 -32
  11. package/dist/charts/cartesian.js +1728 -559
  12. package/dist/charts/distribution.js +5 -5
  13. package/dist/charts/graph.js +443 -76
  14. package/dist/charts/hierarchy.js +5 -5
  15. package/dist/charts/matrix.js +232 -63
  16. package/dist/charts/timeline.js +3 -3
  17. package/dist/charts.js +2 -2
  18. package/dist/{code-block-C4K1sM9O.js → code-block-Cpfr7B6a.js} +1 -1
  19. package/dist/collections.js +475 -354
  20. package/dist/content/code.js +1 -1
  21. package/dist/content/diff.js +3 -3
  22. package/dist/content/link.js +1 -1
  23. package/dist/content/markdown.js +2 -2
  24. package/dist/content/tree.js +2 -2
  25. package/dist/{content-link-CBDqSvgP.js → content-link-CGeFFb9F.js} +1 -1
  26. package/dist/content.js +1 -1
  27. package/dist/feedback.js +1 -1
  28. package/dist/forms/dates.js +11 -11
  29. package/dist/{forms-I-WMHTkr.js → forms-DeU0Tiv3.js} +6 -2
  30. package/dist/forms.js +3 -3
  31. package/dist/index.js +1 -1
  32. package/dist/label-spacing-BncjePGb.js +6 -0
  33. package/dist/layout.js +275 -249
  34. package/dist/mechane-elements-catalog.mjs +4 -0
  35. package/dist/navigation.js +2 -2
  36. package/dist/packages/charts/src/cartesian/bar-chart.d.ts +15 -3
  37. package/dist/packages/charts/src/cartesian/bar-data.d.ts +43 -0
  38. package/dist/packages/charts/src/cartesian/bar-overlays.d.ts +32 -0
  39. package/dist/packages/charts/src/cartesian/bridge-chart.d.ts +29 -0
  40. package/dist/packages/charts/src/cartesian/bridge-data.d.ts +40 -0
  41. package/dist/packages/charts/src/cartesian/index.d.ts +7 -2
  42. package/dist/packages/charts/src/cartesian/reference-lines.d.ts +34 -0
  43. package/dist/packages/charts/src/cartesian/sparkline.d.ts +10 -1
  44. package/dist/packages/charts/src/cartesian/time-series-bands.d.ts +66 -0
  45. package/dist/packages/charts/src/cartesian/time-series-data.d.ts +11 -1
  46. package/dist/packages/charts/src/cartesian/time-series-overlays.d.ts +35 -0
  47. package/dist/packages/charts/src/cartesian/time-series.d.ts +6 -1
  48. package/dist/packages/charts/src/chart-inspection.d.ts +4 -1
  49. package/dist/packages/charts/src/chart-navigation.d.ts +5 -1
  50. package/dist/packages/charts/src/chart-series-marker.d.ts +8 -1
  51. package/dist/packages/charts/src/chart-surface.d.ts +4 -0
  52. package/dist/packages/charts/src/chart-theme.d.ts +26 -0
  53. package/dist/packages/charts/src/graph/flow-diagram.d.ts +26 -0
  54. package/dist/packages/charts/src/graph/flow-layout.d.ts +70 -0
  55. package/dist/packages/charts/src/graph/index.d.ts +2 -0
  56. package/dist/packages/charts/src/index.d.ts +1 -1
  57. package/dist/packages/charts/src/label-spacing.d.ts +15 -0
  58. package/dist/packages/charts/src/matrix/matrix-cells.d.ts +4 -0
  59. package/dist/packages/charts/src/matrix/matrix-strip.d.ts +20 -0
  60. package/dist/packages/charts/src/matrix/matrix-types.d.ts +21 -0
  61. package/dist/packages/charts/src/matrix/matrix.d.ts +8 -19
  62. package/dist/packages/collections/src/collection-controls.d.ts +2 -1
  63. package/dist/packages/collections/src/data-table.d.ts +12 -8
  64. package/dist/packages/collections/src/index.d.ts +1 -0
  65. package/dist/packages/collections/src/table-results.d.ts +26 -0
  66. package/dist/packages/core/src/actions.d.ts +6 -0
  67. package/dist/packages/core/src/index.d.ts +1 -1
  68. package/dist/packages/forms/src/form-status.d.ts +7 -0
  69. package/dist/packages/forms/src/forms.d.ts +3 -1
  70. package/dist/packages/forms/src/index.d.ts +2 -0
  71. package/dist/packages/foundations/src/agent/index.d.ts +2 -2
  72. package/dist/packages/layout/src/page-context.d.ts +4 -0
  73. package/dist/packages/navigation/src/index.d.ts +1 -0
  74. package/dist/packages/navigation/src/route-link.d.ts +2 -0
  75. package/dist/{pierre-diff-DJ3oOfPX.js → pierre-diff-B3tD3-6z.js} +1 -1
  76. package/dist/{plot-width-BQQS-mw9.js → plot-width-DzCmthQW.js} +28 -0
  77. package/dist/{src-D2OHco8V.js → src-Bk7M67zy.js} +3 -3
  78. package/dist/{src-DfOAlAd2.js → src-BpvnBWrF.js} +1 -1
  79. package/dist/{src-CQQvXi7a.js → src-DBNncL7_.js} +70 -50
  80. package/dist/{src-s3tWwnN4.js → src-DcW_gMX8.js} +178 -168
  81. package/dist/{src-CNV1ewzb.js → src-gqEebHEa.js} +319 -285
  82. package/dist/styles2.css +115 -0
  83. package/package.json +9 -2
  84. package/recipes/allocation-report.tsx +115 -0
  85. package/recipes/consequential-form.tsx +132 -0
  86. package/recipes/searchable-collection.tsx +106 -0
  87. package/recipes/sectioned-report.tsx +58 -0
  88. package/recipes/tabbed-workspace.tsx +84 -0
  89. package/skills/extend-elements/SKILL.md +28 -0
  90. package/skills/use-elements/SKILL.md +36 -0
  91. package/skills/{elements-presentation/SKILL.md → use-elements/references/reports.md} +0 -6
  92. package/skills/{elements-workspace/SKILL.md → use-elements/references/workspace.md} +0 -6
@@ -0,0 +1,84 @@
1
+ import { Text } from '@mechane-ai/elements';
2
+ import { useCollectionControls } from '@mechane-ai/elements/collections';
3
+ import { EmptyState } from '@mechane-ai/elements/feedback';
4
+ import { PageContent, PageLayout } from '@mechane-ai/elements/layout';
5
+ import { ContentTabs } from '@mechane-ai/elements/navigation';
6
+ import type { PageNavigationItem } from '@mechane-ai/elements/navigation';
7
+ import { useState } from 'react';
8
+
9
+ type WorkspaceView = 'overview' | 'activity';
10
+ type WorkspaceEvent = { readonly id: string; readonly description: string };
11
+
12
+ type WorkspaceProps = {
13
+ readonly project: string;
14
+ readonly summary: string;
15
+ readonly owner: string;
16
+ readonly events: ReadonlyArray<WorkspaceEvent>;
17
+ readonly views: ReadonlyArray<PageNavigationItem<WorkspaceView>>;
18
+ readonly currentView: WorkspaceView;
19
+ readonly onNavigate?: (view: PageNavigationItem<WorkspaceView>) => void;
20
+ };
21
+
22
+ /**
23
+ * Build a tabbed workspace with real route links, search in the header action slot, and local panels. Keep route
24
+ * selection in the router and use ContentTabs for panels within a route.
25
+ */
26
+ export function TabbedWorkspace({ project, summary, owner, events, views, currentView, onNavigate }: WorkspaceProps) {
27
+ const [query, setQuery] = useState('');
28
+
29
+ const search = useCollectionControls({
30
+ label: 'Activity controls',
31
+ isReady: true,
32
+ search: { label: 'Find activity', value: query, onChange: setQuery },
33
+ });
34
+
35
+ const matching = events.filter((event) => event.description.toLowerCase().includes(query.trim().toLowerCase()));
36
+
37
+ return (
38
+ <PageLayout
39
+ title={project}
40
+ showNavigation={false}
41
+ navigation={{
42
+ label: 'Project views',
43
+ selectedId: currentView,
44
+ items: views,
45
+ ...(onNavigate !== undefined && { onNavigate }),
46
+ actions: currentView === 'activity' && search.actions,
47
+ }}
48
+ >
49
+ {currentView === 'overview' && (
50
+ <ContentTabs
51
+ label="Project details"
52
+ items={[
53
+ {
54
+ id: 'summary',
55
+ label: 'Summary',
56
+ content: (
57
+ <PageContent>
58
+ <Text>{summary}</Text>
59
+ </PageContent>
60
+ ),
61
+ },
62
+ {
63
+ id: 'ownership',
64
+ label: 'Ownership',
65
+ content: (
66
+ <PageContent>
67
+ <Text>{owner}</Text>
68
+ </PageContent>
69
+ ),
70
+ },
71
+ ]}
72
+ />
73
+ )}
74
+ {currentView === 'activity' && (
75
+ <PageContent>
76
+ {matching.map((event) => (
77
+ <Text key={event.id}>{event.description}</Text>
78
+ ))}
79
+ {matching.length === 0 && <EmptyState title="No matching activity" />}
80
+ </PageContent>
81
+ )}
82
+ </PageLayout>
83
+ );
84
+ }
@@ -0,0 +1,28 @@
1
+ ---
2
+ name: extend-elements
3
+ description:
4
+ Implement or change a shared component in the Mechane Elements source repository, including its UI SDK behavior,
5
+ StyleX appearance, or agent-visible state.
6
+ ---
7
+
8
+ # Extend Elements
9
+
10
+ Find the closest component in the owning family under `packages/` and read its public entry and story. When several
11
+ controls already provide the desired behavior together, compose them in a recipe. Add a shared component when the
12
+ library needs to own a repeated interaction or prevent an invalid combination of inputs.
13
+
14
+ For a new interaction, open `node_modules/@ui-sdk/core/skills/ui-sdk/SKILL.md` from the Elements package directory. This
15
+ is the guide for the pinned SDK. Use an existing UI SDK behavior where one fits. Keep one owner for keyboard, pointer,
16
+ and agent actions. Use the family's StyleX tokens and density choices and export the supported API from its public
17
+ entry.
18
+
19
+ Give interactive components a meaningful accessible name. Advertise actions only when the visible control can perform
20
+ them. Derive visible items and readings from the authorized data currently on screen. Route actions through the same
21
+ selection, navigation, or submit callback used by a person. The application supplies permissions, pending state,
22
+ accepted results, and errors. A requested change to a controlled value is complete when the owner supplies the new
23
+ state.
24
+
25
+ Check a representative task in the family story with keyboard and the public `/agent` bridge. Check what the agent sees
26
+ once the control is disabled, its selection changes, or its data is loading. For sensitive controls also inspect
27
+ compound snapshots and action results for private values. Update the page recipe if the preferred consumer composition
28
+ changes.
@@ -0,0 +1,36 @@
1
+ ---
2
+ name: use-elements
3
+ description:
4
+ Build React pages with Mechane Elements. Find the page recipe, public imports, and Storybook example for a collection,
5
+ report, tabbed workspace, or form.
6
+ ---
7
+
8
+ # Build with Elements
9
+
10
+ From the app with `@mechane-ai/elements` installed, look up the user’s task:
11
+
12
+ ```sh
13
+ pnpm exec mechane-elements-catalog "searchable table with filters"
14
+ ```
15
+
16
+ Start with the matching recipe. Read its TSX for the full component composition and its public imports. The same example
17
+ runs in the Elements Storybook under **Recipes**. The command uses the installed package. The machine-readable index is
18
+ also available at `@mechane-ai/elements/catalog.json`.
19
+
20
+ Load `@mechane-ai/elements/styles.css` once at the app entry. Choose the owning family for each import. Keep route
21
+ state, authorized data, and mutations in the application.
22
+
23
+ - **Searchable collection.** Use local query mode for a complete finite collection. For a paged source, send search and
24
+ filters to the data owner before it takes a page. Keep the query and current page together in route state when users
25
+ need to return to the same results.
26
+ - **Sectioned report.** Mount the shell around the router outlet. Put each heading and its body in a sibling
27
+ `PageSection`. The shell and sections own the sticky geometry. See [workspace layout](references/workspace.md) and
28
+ [report loading and inspection](references/reports.md).
29
+ - **Tabbed workspace.** Put page-wide navigation and its actions in the page navigation slot. Use links for route
30
+ destinations and tabs for panels within the current view.
31
+ - **Consequential form.** The owner validates and submits the draft. Use the shared confirmation and pending states,
32
+ mark sensitive input at its source, and keep the draft available when the save fails.
33
+
34
+ For a task outside those four recipes, search the same catalog for a public component. Inspect its declaration for
35
+ supported props and callbacks. In a running Elements Storybook, an MCP client can also discover components and examples
36
+ at `/mcp`.
@@ -1,9 +1,3 @@
1
- ---
2
- name: elements-presentation
3
- description:
4
- Coordinate Elements route loading, chart feedback, and keyboard or pointer inspection in analytical workspaces.
5
- ---
6
-
7
1
  # Loading and inspecting reports
8
2
 
9
3
  Give the route a `LoadingScope` from `/feedback` with a navigation identity. Keep the shell mounted. Wrap the entering
@@ -1,9 +1,3 @@
1
- ---
2
- name: elements-workspace
3
- description:
4
- Compose or review an Elements application shell, full-width workspaces, task navigation, and aligned toolbars.
5
- ---
6
-
7
1
  # Workspace layout
8
2
 
9
3
  Mount one `AppShell` around the authenticated router outlet. Keep its rail, secondary pane, collapse state and toolbar