@mechane-ai/elements 0.41.0 → 0.42.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.
- package/README.md +40 -9
- package/bin/catalog.d.mts +17 -0
- package/bin/mechane-elements-catalog.mjs +60 -0
- package/dist/agent.js +1 -1
- package/dist/ai.js +23 -23
- package/dist/catalog.json +1896 -0
- package/dist/{categorical-values-DnGR_pQx.js → categorical-values-B6lGI7BH.js} +3 -3
- package/dist/{chart-frame-BsyI1Zc8.js → chart-frame-D0enjyj9.js} +1 -1
- package/dist/{chart-input-r4S3-QCT.js → chart-input-D4_Awave.js} +2 -2
- package/dist/{chart-navigation-D7OkLdSx.js → chart-navigation-D4-pdgpj.js} +12 -1
- package/dist/charts/cartesian.js +263 -243
- package/dist/charts/distribution.js +4 -4
- package/dist/charts/graph.js +4 -4
- package/dist/charts/hierarchy.js +4 -4
- package/dist/charts/matrix.js +4 -4
- package/dist/charts/timeline.js +3 -3
- package/dist/charts.js +2 -2
- package/dist/{code-block-C4K1sM9O.js → code-block-Cpfr7B6a.js} +1 -1
- package/dist/collections.js +475 -354
- package/dist/content/code.js +1 -1
- package/dist/content/diff.js +3 -3
- package/dist/content/link.js +1 -1
- package/dist/content/markdown.js +2 -2
- package/dist/content/tree.js +2 -2
- package/dist/{content-link-CBDqSvgP.js → content-link-CGeFFb9F.js} +1 -1
- package/dist/content.js +1 -1
- package/dist/feedback.js +1 -1
- package/dist/forms/dates.js +11 -11
- package/dist/{forms-I-WMHTkr.js → forms-DeU0Tiv3.js} +6 -2
- package/dist/forms.js +3 -3
- package/dist/index.js +1 -1
- package/dist/layout.js +275 -249
- package/dist/mechane-elements-catalog.mjs +4 -0
- package/dist/navigation.js +2 -2
- package/dist/packages/charts/src/chart-inspection.d.ts +1 -0
- package/dist/packages/charts/src/chart-navigation.d.ts +2 -0
- package/dist/packages/charts/src/chart-surface.d.ts +2 -0
- package/dist/packages/collections/src/collection-controls.d.ts +2 -1
- package/dist/packages/collections/src/data-table.d.ts +12 -8
- package/dist/packages/collections/src/index.d.ts +1 -0
- package/dist/packages/collections/src/table-results.d.ts +26 -0
- package/dist/packages/core/src/actions.d.ts +6 -0
- package/dist/packages/core/src/index.d.ts +1 -1
- package/dist/packages/forms/src/form-status.d.ts +7 -0
- package/dist/packages/forms/src/forms.d.ts +3 -1
- package/dist/packages/forms/src/index.d.ts +2 -0
- package/dist/packages/foundations/src/agent/index.d.ts +2 -2
- package/dist/packages/layout/src/page-context.d.ts +4 -0
- package/dist/packages/navigation/src/index.d.ts +1 -0
- package/dist/packages/navigation/src/route-link.d.ts +2 -0
- package/dist/{pierre-diff-DJ3oOfPX.js → pierre-diff-B3tD3-6z.js} +1 -1
- package/dist/{src-D2OHco8V.js → src-Bk7M67zy.js} +3 -3
- package/dist/{src-DfOAlAd2.js → src-BpvnBWrF.js} +1 -1
- package/dist/{src-CQQvXi7a.js → src-DBNncL7_.js} +70 -50
- package/dist/{src-s3tWwnN4.js → src-DcW_gMX8.js} +178 -168
- package/dist/{src-CNV1ewzb.js → src-gqEebHEa.js} +319 -285
- package/package.json +9 -2
- package/recipes/consequential-form.tsx +132 -0
- package/recipes/searchable-collection.tsx +106 -0
- package/recipes/sectioned-report.tsx +58 -0
- package/recipes/tabbed-workspace.tsx +84 -0
- package/skills/extend-elements/SKILL.md +28 -0
- package/skills/use-elements/SKILL.md +36 -0
- package/skills/{elements-presentation/SKILL.md → use-elements/references/reports.md} +0 -6
- package/skills/{elements-workspace/SKILL.md → use-elements/references/workspace.md} +0 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mechane-ai/elements",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.42.0",
|
|
4
4
|
"description": "Elements by Mechane — React components for applications, AI interfaces, and analytical graphics",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -8,8 +8,14 @@
|
|
|
8
8
|
"url": "https://github.com/mechane-ai/mechane.git",
|
|
9
9
|
"directory": "workspaces/core/packages/browser/elements"
|
|
10
10
|
},
|
|
11
|
+
"bin": {
|
|
12
|
+
"mechane-elements-catalog": "./dist/mechane-elements-catalog.mjs"
|
|
13
|
+
},
|
|
11
14
|
"files": [
|
|
12
15
|
"dist",
|
|
16
|
+
"bin/*.mjs",
|
|
17
|
+
"bin/*.d.mts",
|
|
18
|
+
"recipes",
|
|
13
19
|
"skills",
|
|
14
20
|
"packages/foundations/src/constants.stylex.ts",
|
|
15
21
|
"packages/foundations/src/tokens.stylex.ts",
|
|
@@ -132,7 +138,8 @@
|
|
|
132
138
|
},
|
|
133
139
|
"./constants.stylex": "./packages/foundations/src/constants.stylex.ts",
|
|
134
140
|
"./tokens.stylex": "./packages/foundations/src/tokens.stylex.ts",
|
|
135
|
-
"./styles.css": "./dist/styles2.css"
|
|
141
|
+
"./styles.css": "./dist/styles2.css",
|
|
142
|
+
"./catalog.json": "./dist/catalog.json"
|
|
136
143
|
},
|
|
137
144
|
"dependencies": {
|
|
138
145
|
"@base-ui/react": "1.9.0",
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { Button, ConfirmButton, Stack } from '@mechane-ai/elements';
|
|
2
|
+
import { Field, FormActions, FormStatus, Input } from '@mechane-ai/elements/forms';
|
|
3
|
+
import { DetailPage, PageLayout } from '@mechane-ai/elements/layout';
|
|
4
|
+
import { AlertDialog } from '@mechane-ai/elements/overlays';
|
|
5
|
+
import { useRef, useState } from 'react';
|
|
6
|
+
import type { SubmitEvent } from 'react';
|
|
7
|
+
|
|
8
|
+
type ArchiveRequest = { readonly projectId: string; readonly reason: string };
|
|
9
|
+
|
|
10
|
+
type ArchiveProps = {
|
|
11
|
+
readonly projectId: string;
|
|
12
|
+
readonly project: string;
|
|
13
|
+
readonly onArchive: (request: ArchiveRequest) => Promise<void>;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Build a form for a consequential mutation with validation, confirmation, progress, and retry. The application
|
|
18
|
+
* authorizes the mutation and resolves it only after the server acknowledges success.
|
|
19
|
+
*/
|
|
20
|
+
export function ConsequentialForm(props: ArchiveProps) {
|
|
21
|
+
return <ArchiveProject key={props.projectId} {...props} />;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function ArchiveProject({ projectId, project, onArchive }: ArchiveProps) {
|
|
25
|
+
const [reason, setReason] = useState('');
|
|
26
|
+
const [isInvalid, setInvalid] = useState(false);
|
|
27
|
+
const [isOpen, setOpen] = useState(false);
|
|
28
|
+
const [status, setStatus] = useState<'idle' | 'pending' | 'error' | 'success'>('idle');
|
|
29
|
+
const reasonInput = useRef<HTMLInputElement>(null);
|
|
30
|
+
const reviewButton = useRef<HTMLButtonElement>(null);
|
|
31
|
+
const receipt = useRef<HTMLDivElement>(null);
|
|
32
|
+
const submitting = useRef(false);
|
|
33
|
+
|
|
34
|
+
function review(event: SubmitEvent<HTMLFormElement>) {
|
|
35
|
+
event.preventDefault();
|
|
36
|
+
|
|
37
|
+
if (reason.trim().length === 0) {
|
|
38
|
+
setInvalid(true);
|
|
39
|
+
reasonInput.current?.focus();
|
|
40
|
+
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
setStatus('idle');
|
|
45
|
+
setOpen(true);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
async function archive() {
|
|
49
|
+
if (submitting.current || reason.trim().length === 0) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
submitting.current = true;
|
|
54
|
+
|
|
55
|
+
setStatus('pending');
|
|
56
|
+
|
|
57
|
+
try {
|
|
58
|
+
await onArchive({ projectId, reason: reason.trim() });
|
|
59
|
+
setStatus('success');
|
|
60
|
+
setOpen(false);
|
|
61
|
+
} catch {
|
|
62
|
+
setStatus('error');
|
|
63
|
+
} finally {
|
|
64
|
+
submitting.current = false;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return (
|
|
69
|
+
<PageLayout title="Archive project" showNavigation={false}>
|
|
70
|
+
<DetailPage>
|
|
71
|
+
{status === 'success' ? (
|
|
72
|
+
<div ref={receipt} tabIndex={-1}>
|
|
73
|
+
<FormStatus status="success" message={`${project} archived.`} />
|
|
74
|
+
</div>
|
|
75
|
+
) : (
|
|
76
|
+
<form noValidate onSubmit={review}>
|
|
77
|
+
<Stack>
|
|
78
|
+
<Field.Root name="reason" invalid={isInvalid}>
|
|
79
|
+
<Field.Label>Reason for archiving {project}</Field.Label>
|
|
80
|
+
<Input
|
|
81
|
+
ref={reasonInput}
|
|
82
|
+
required
|
|
83
|
+
value={reason}
|
|
84
|
+
onValueChange={(value) => {
|
|
85
|
+
setReason(value);
|
|
86
|
+
|
|
87
|
+
if (value.trim().length > 0) {
|
|
88
|
+
setInvalid(false);
|
|
89
|
+
}
|
|
90
|
+
}}
|
|
91
|
+
/>
|
|
92
|
+
<Field.Error match={isInvalid}>Enter a reason.</Field.Error>
|
|
93
|
+
</Field.Root>
|
|
94
|
+
<FormActions>
|
|
95
|
+
<Button ref={reviewButton} type="submit">
|
|
96
|
+
Review archive
|
|
97
|
+
</Button>
|
|
98
|
+
</FormActions>
|
|
99
|
+
</Stack>
|
|
100
|
+
</form>
|
|
101
|
+
)}
|
|
102
|
+
<AlertDialog.Root
|
|
103
|
+
open={isOpen}
|
|
104
|
+
onOpenChange={(open) => {
|
|
105
|
+
if (!open && !submitting.current) {
|
|
106
|
+
setOpen(false);
|
|
107
|
+
}
|
|
108
|
+
}}
|
|
109
|
+
>
|
|
110
|
+
<AlertDialog.Backdrop />
|
|
111
|
+
<AlertDialog.Popup finalFocus={() => receipt.current ?? reviewButton.current}>
|
|
112
|
+
<AlertDialog.Title>Archive {project}?</AlertDialog.Title>
|
|
113
|
+
<AlertDialog.Description>Members will lose write access to this project.</AlertDialog.Description>
|
|
114
|
+
{status === 'pending' && <FormStatus status="pending" message="Archiving project…" />}
|
|
115
|
+
{status === 'error' && <FormStatus status="error" message="Could not archive the project. Try again." />}
|
|
116
|
+
<FormActions>
|
|
117
|
+
<AlertDialog.Close render={<Button disabled={status === 'pending'} />}>Keep project</AlertDialog.Close>
|
|
118
|
+
<ConfirmButton
|
|
119
|
+
tone="danger"
|
|
120
|
+
confirmation={`Archive ${project}?`}
|
|
121
|
+
isPending={status === 'pending'}
|
|
122
|
+
onClick={archive}
|
|
123
|
+
>
|
|
124
|
+
Archive project
|
|
125
|
+
</ConfirmButton>
|
|
126
|
+
</FormActions>
|
|
127
|
+
</AlertDialog.Popup>
|
|
128
|
+
</AlertDialog.Root>
|
|
129
|
+
</DetailPage>
|
|
130
|
+
</PageLayout>
|
|
131
|
+
);
|
|
132
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { Button } from '@mechane-ai/elements';
|
|
2
|
+
import { DataTable } from '@mechane-ai/elements/collections';
|
|
3
|
+
import type { DataTableColumn, DataTableSort } from '@mechane-ai/elements/collections';
|
|
4
|
+
import { Notice } from '@mechane-ai/elements/feedback';
|
|
5
|
+
import { PageLayout } from '@mechane-ai/elements/layout';
|
|
6
|
+
|
|
7
|
+
export type Worker = { readonly id: string; readonly name: string; readonly status: string };
|
|
8
|
+
|
|
9
|
+
export type WorkerQuery = {
|
|
10
|
+
readonly text: string;
|
|
11
|
+
readonly status: string;
|
|
12
|
+
readonly page: number;
|
|
13
|
+
readonly sort: DataTableSort | undefined;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
type WorkerPage = { readonly rows: ReadonlyArray<Worker>; readonly number: number; readonly hasNext: boolean };
|
|
17
|
+
|
|
18
|
+
export type WorkerRead =
|
|
19
|
+
| { readonly status: 'ready'; readonly page: WorkerPage }
|
|
20
|
+
| { readonly status: 'pending' | 'failed'; readonly page?: WorkerPage };
|
|
21
|
+
|
|
22
|
+
type CollectionProps = {
|
|
23
|
+
readonly query: WorkerQuery;
|
|
24
|
+
readonly result: WorkerRead;
|
|
25
|
+
readonly onQueryChange: (query: WorkerQuery) => void;
|
|
26
|
+
readonly onRetry: () => void;
|
|
27
|
+
readonly workerHref: (worker: Worker) => string;
|
|
28
|
+
readonly onOpen?: (worker: Worker) => void;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const columns = [
|
|
32
|
+
{ id: 'name', label: 'Worker', role: 'primary', canSort: true, cell: (worker) => worker.name },
|
|
33
|
+
{ id: 'status', label: 'Status', role: 'status', cell: (worker) => worker.status },
|
|
34
|
+
] satisfies ReadonlyArray<DataTableColumn<Worker>>;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Build a searchable, filterable server-paged table with record links. Keep query state in the route and retain the
|
|
38
|
+
* previous page during refresh. The server authorizes, filters and sorts the collection before paging.
|
|
39
|
+
*/
|
|
40
|
+
export function SearchableCollection({ query, result, onQueryChange, onRetry, workerHref, onOpen }: CollectionProps) {
|
|
41
|
+
const page = result.page;
|
|
42
|
+
const isPending = result.status === 'pending';
|
|
43
|
+
const isReady = result.status === 'ready';
|
|
44
|
+
const hasResults = page !== undefined;
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<PageLayout title="Workers" showNavigation={false}>
|
|
48
|
+
{isPending && <Notice>Loading workers…</Notice>}
|
|
49
|
+
{result.status === 'failed' && (
|
|
50
|
+
<Notice hasError>
|
|
51
|
+
Could not load workers. <Button onClick={onRetry}>Retry</Button>
|
|
52
|
+
</Notice>
|
|
53
|
+
)}
|
|
54
|
+
<DataTable
|
|
55
|
+
caption="Workers"
|
|
56
|
+
hideCaption
|
|
57
|
+
columns={columns}
|
|
58
|
+
rows={page?.rows ?? []}
|
|
59
|
+
getRowId={(worker) => worker.id}
|
|
60
|
+
resultStatus={result.status}
|
|
61
|
+
query={{
|
|
62
|
+
mode: 'controlled',
|
|
63
|
+
search: {
|
|
64
|
+
label: 'Find workers',
|
|
65
|
+
value: query.text,
|
|
66
|
+
onChange: (text) => onQueryChange({ ...query, text, page: 1 }),
|
|
67
|
+
},
|
|
68
|
+
filters: [
|
|
69
|
+
{
|
|
70
|
+
id: 'status',
|
|
71
|
+
label: 'Status',
|
|
72
|
+
defaultValue: '',
|
|
73
|
+
value: query.status,
|
|
74
|
+
options: [
|
|
75
|
+
{ value: '', label: 'All statuses' },
|
|
76
|
+
{ value: 'Available', label: 'Available' },
|
|
77
|
+
{ value: 'Busy', label: 'Busy' },
|
|
78
|
+
],
|
|
79
|
+
onChange: (status) => onQueryChange({ ...query, status, page: 1 }),
|
|
80
|
+
},
|
|
81
|
+
],
|
|
82
|
+
}}
|
|
83
|
+
sort={query.sort}
|
|
84
|
+
onSortChange={(sort) => onQueryChange({ ...query, sort, page: 1 })}
|
|
85
|
+
rowAction={{
|
|
86
|
+
label: (worker) => `Open ${worker.name}`,
|
|
87
|
+
href: workerHref,
|
|
88
|
+
...(onOpen !== undefined && { onActivate: onOpen }),
|
|
89
|
+
}}
|
|
90
|
+
pagination={{
|
|
91
|
+
description: hasResults ? `Page ${page.number}` : '',
|
|
92
|
+
previous: {
|
|
93
|
+
disabled: !isReady || query.page <= 1,
|
|
94
|
+
onClick: () => onQueryChange({ ...query, page: query.page - 1 }),
|
|
95
|
+
},
|
|
96
|
+
next: {
|
|
97
|
+
disabled: !isReady || page?.hasNext !== true,
|
|
98
|
+
onClick: () => onQueryChange({ ...query, page: query.page + 1 }),
|
|
99
|
+
},
|
|
100
|
+
}}
|
|
101
|
+
empty={isReady && 'No workers yet.'}
|
|
102
|
+
filteredEmpty={isReady && 'No workers match your search or filters.'}
|
|
103
|
+
/>
|
|
104
|
+
</PageLayout>
|
|
105
|
+
);
|
|
106
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { DataTable, Metric, MetricGrid } from '@mechane-ai/elements/collections';
|
|
2
|
+
import type { DataTableColumn } from '@mechane-ai/elements/collections';
|
|
3
|
+
import { PageLayout, PageSection } from '@mechane-ai/elements/layout';
|
|
4
|
+
|
|
5
|
+
type ReportRow = { readonly id: string; readonly name: string; readonly team: string };
|
|
6
|
+
|
|
7
|
+
type ReportSection = {
|
|
8
|
+
readonly id: string;
|
|
9
|
+
readonly title: string;
|
|
10
|
+
readonly metric: { readonly label: string; readonly value: string };
|
|
11
|
+
readonly contributors: ReadonlyArray<ReportRow>;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
type ReportProps = { readonly sections: ReadonlyArray<ReportSection> };
|
|
15
|
+
|
|
16
|
+
const columns = [
|
|
17
|
+
{ id: 'name', label: 'Work item', role: 'primary', cell: (row) => row.name },
|
|
18
|
+
{ id: 'team', label: 'Team', role: 'text', cell: (row) => row.team },
|
|
19
|
+
] satisfies ReadonlyArray<DataTableColumn<ReportRow>>;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Build a scrolling report with a persistent page toolbar and rotating sticky section headings. Each section owns its
|
|
23
|
+
* summary and full-width breakdown.
|
|
24
|
+
*/
|
|
25
|
+
export function SectionedReport({ sections }: ReportProps) {
|
|
26
|
+
return (
|
|
27
|
+
<PageLayout title="Work overview" showNavigation={false}>
|
|
28
|
+
{sections.map((section) => (
|
|
29
|
+
<PageSection
|
|
30
|
+
key={section.id}
|
|
31
|
+
id={section.id}
|
|
32
|
+
title={section.title}
|
|
33
|
+
summary={
|
|
34
|
+
<MetricGrid>
|
|
35
|
+
<Metric {...section.metric} variant="headline" />
|
|
36
|
+
</MetricGrid>
|
|
37
|
+
}
|
|
38
|
+
breakdown={
|
|
39
|
+
<DataTable
|
|
40
|
+
caption={section.title}
|
|
41
|
+
hideCaption
|
|
42
|
+
rows={section.contributors}
|
|
43
|
+
getRowId={(row) => row.id}
|
|
44
|
+
columns={columns}
|
|
45
|
+
query={{
|
|
46
|
+
mode: 'local',
|
|
47
|
+
search: (row) => row.name,
|
|
48
|
+
filters: [{ id: 'team', label: 'Team', value: (row) => row.team }],
|
|
49
|
+
}}
|
|
50
|
+
empty="No contributing work items."
|
|
51
|
+
filteredEmpty="No matching work items."
|
|
52
|
+
/>
|
|
53
|
+
}
|
|
54
|
+
/>
|
|
55
|
+
))}
|
|
56
|
+
</PageLayout>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
@@ -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
|