@calliopelabs/ui 0.6.1 → 0.11.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 (120) hide show
  1. package/README.md +253 -3
  2. package/dist/appearance/AppearancePicker.js +6 -4
  3. package/dist/appearance/AppearanceProvider.d.ts +10 -2
  4. package/dist/appearance/AppearanceProvider.js +6 -2
  5. package/dist/appearance/AppearanceScript.d.ts +15 -4
  6. package/dist/appearance/AppearanceScript.js +11 -5
  7. package/dist/appearance/appearance.js +1 -1
  8. package/dist/appearance/boot.d.ts +13 -2
  9. package/dist/appearance/boot.js +35 -5
  10. package/dist/appearance/product.d.ts +13 -0
  11. package/dist/appearance/product.js +2 -2
  12. package/dist/appearance/runtime-brand.d.ts +106 -0
  13. package/dist/appearance/runtime-brand.js +420 -0
  14. package/dist/css/appearance.js +147 -0
  15. package/dist/css/calliope.css +1221 -0
  16. package/dist/css/components.css +729 -0
  17. package/dist/css/tokens.css +491 -0
  18. package/dist/data/DefinitionList.d.ts +16 -0
  19. package/dist/data/DefinitionList.js +9 -0
  20. package/dist/data/Stat.d.ts +25 -0
  21. package/dist/data/Stat.js +19 -0
  22. package/dist/data/Tag.d.ts +21 -0
  23. package/dist/data/Tag.js +18 -0
  24. package/dist/data/types.d.ts +3 -2
  25. package/dist/data/use-local-table.d.ts +36 -0
  26. package/dist/data/use-local-table.js +127 -0
  27. package/dist/index.d.ts +42 -3
  28. package/dist/index.js +39 -1
  29. package/dist/nav/Nav.d.ts +2 -1
  30. package/dist/nav/Nav.js +34 -15
  31. package/dist/nav/model.d.ts +21 -0
  32. package/dist/page/PageHeader.d.ts +5 -3
  33. package/dist/page/PageHeader.js +5 -4
  34. package/dist/page/Panel.d.ts +19 -0
  35. package/dist/page/Panel.js +12 -0
  36. package/dist/primitives/Avatar.d.ts +37 -0
  37. package/dist/primitives/Avatar.js +43 -0
  38. package/dist/primitives/Field.d.ts +33 -0
  39. package/dist/primitives/Field.js +30 -0
  40. package/dist/primitives/Segmented.d.ts +30 -0
  41. package/dist/primitives/Segmented.js +20 -0
  42. package/dist/primitives/Select.d.ts +40 -0
  43. package/dist/primitives/Select.js +47 -0
  44. package/dist/primitives/Switch.d.ts +7 -0
  45. package/dist/primitives/Switch.js +8 -0
  46. package/dist/primitives/Textarea.d.ts +3 -0
  47. package/dist/primitives/Textarea.js +6 -0
  48. package/dist/provider/messages.d.ts +415 -2
  49. package/dist/provider/messages.js +633 -0
  50. package/dist/shell/BrandMark.d.ts +25 -3
  51. package/dist/shell/BrandMark.js +34 -4
  52. package/dist/shell/RailPanel.js +2 -2
  53. package/dist/shell/RailTree.js +2 -2
  54. package/dist/shell/Sidebar.d.ts +9 -2
  55. package/dist/shell/Sidebar.js +10 -4
  56. package/dist/shell/UserMenu.d.ts +3 -1
  57. package/dist/shell/UserMenu.js +3 -11
  58. package/dist/shell/rail-boot.d.ts +28 -0
  59. package/dist/shell/rail-boot.js +45 -0
  60. package/dist/shell/rail-state.d.ts +6 -1
  61. package/dist/shell/rail-state.js +18 -2
  62. package/dist/styles/preset.css +4 -0
  63. package/dist/styles/theme.css +36 -13
  64. package/dist/theme/css-layer.d.ts +19 -0
  65. package/dist/theme/css-layer.js +171 -0
  66. package/dist/theme/css.d.ts +1 -0
  67. package/dist/theme/css.js +45 -9
  68. package/dist/workflow/ArtifactCard.d.ts +47 -0
  69. package/dist/workflow/ArtifactCard.js +45 -0
  70. package/dist/workflow/DocumentReview.d.ts +74 -0
  71. package/dist/workflow/DocumentReview.js +54 -0
  72. package/dist/workflow/FormReview.d.ts +53 -0
  73. package/dist/workflow/FormReview.js +83 -0
  74. package/dist/workflow/GateBadge.d.ts +11 -0
  75. package/dist/workflow/GateBadge.js +14 -0
  76. package/dist/workflow/MediaReview.d.ts +63 -0
  77. package/dist/workflow/MediaReview.js +166 -0
  78. package/dist/workflow/ReviewPanel.d.ts +41 -0
  79. package/dist/workflow/ReviewPanel.js +59 -0
  80. package/dist/workflow/RunTimeline.d.ts +25 -0
  81. package/dist/workflow/RunTimeline.js +56 -0
  82. package/dist/workflow/WorkflowCard.d.ts +39 -0
  83. package/dist/workflow/WorkflowCard.js +56 -0
  84. package/dist/workflow/WorkflowGallery.d.ts +43 -0
  85. package/dist/workflow/WorkflowGallery.js +69 -0
  86. package/dist/workflow/canvas/WorkflowCanvas.d.ts +39 -0
  87. package/dist/workflow/canvas/WorkflowCanvas.js +648 -0
  88. package/dist/workflow/definition.d.ts +408 -0
  89. package/dist/workflow/definition.js +411 -0
  90. package/dist/workflow/editor/WorkflowDiff.d.ts +17 -0
  91. package/dist/workflow/editor/WorkflowDiff.js +25 -0
  92. package/dist/workflow/editor/WorkflowImportPreview.d.ts +19 -0
  93. package/dist/workflow/editor/WorkflowImportPreview.js +50 -0
  94. package/dist/workflow/editor/WorkflowInspector.d.ts +40 -0
  95. package/dist/workflow/editor/WorkflowInspector.js +349 -0
  96. package/dist/workflow/editor/WorkflowJsonView.d.ts +16 -0
  97. package/dist/workflow/editor/WorkflowJsonView.js +40 -0
  98. package/dist/workflow/editor/WorkflowPalette.d.ts +16 -0
  99. package/dist/workflow/editor/WorkflowPalette.js +36 -0
  100. package/dist/workflow/editor/WorkflowProblems.d.ts +20 -0
  101. package/dist/workflow/editor/WorkflowProblems.js +51 -0
  102. package/dist/workflow/editor/WorkflowWorkspace.d.ts +49 -0
  103. package/dist/workflow/editor/WorkflowWorkspace.js +154 -0
  104. package/dist/workflow/gallery.d.ts +21 -0
  105. package/dist/workflow/gallery.js +29 -0
  106. package/dist/workflow/layout.d.ts +49 -0
  107. package/dist/workflow/layout.js +162 -0
  108. package/dist/workflow/model.d.ts +50 -0
  109. package/dist/workflow/model.js +7 -0
  110. package/dist/workflow/palette.d.ts +34 -0
  111. package/dist/workflow/palette.js +70 -0
  112. package/dist/workflow/portable.d.ts +162 -0
  113. package/dist/workflow/portable.js +547 -0
  114. package/dist/workflow/problems.d.ts +38 -0
  115. package/dist/workflow/problems.js +409 -0
  116. package/dist/workflow/run.d.ts +94 -0
  117. package/dist/workflow/run.js +31 -0
  118. package/dist/workflow/workspace.d.ts +33 -0
  119. package/dist/workflow/workspace.js +17 -0
  120. package/package.json +6 -1
@@ -0,0 +1,69 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { LayoutGridIcon, ListIcon, PlusIcon, SearchIcon, UploadIcon } from "lucide-react";
4
+ import * as React from "react";
5
+ import { cn } from "../lib/cn.js";
6
+ import { PageHeader } from "../page/PageHeader.js";
7
+ import { Button } from "../primitives/Button.js";
8
+ import { Input } from "../primitives/Input.js";
9
+ import { Segmented } from "../primitives/Segmented.js";
10
+ import { Select } from "../primitives/Select.js";
11
+ import { useUI } from "../provider/UIProvider.js";
12
+ import { EmptyState } from "../states/EmptyState.js";
13
+ import { ErrorState } from "../states/ErrorState.js";
14
+ import { ANY_FILTER, DEFAULT_WORKFLOW_FILTERS, isFiltered, } from "./gallery.js";
15
+ import { WorkflowCard, WorkflowCardSkeleton } from "./WorkflowCard.js";
16
+ const SCOPES = ["private", "project", "organization", "shared"];
17
+ const STATUSES = ["draft", "published"];
18
+ /**
19
+ * The workflow gallery: a full page of saved definitions over WorkflowCard,
20
+ * with search, a module filter, scope and status filters, grid and list
21
+ * views, and create and import when the host permits them. Host-driven: the
22
+ * filters are controlled and the host returns the matching workflows (a host
23
+ * holding the whole set uses `filterWorkflows`). Empty and no-matches are
24
+ * different states.
25
+ */
26
+ export function WorkflowGallery({ title, description, workflows, modules, filters, onFiltersChange, view: viewProp, defaultView = "grid", onViewChange, loading = false, error, onRetry, onCreate, onImport, actionsFor, renderPreview, className, }) {
27
+ const { messages } = useUI();
28
+ const t = messages.workflow;
29
+ const [ownView, setOwnView] = React.useState(defaultView);
30
+ const view = viewProp ?? ownView;
31
+ const searchId = React.useId();
32
+ const heading = title ?? t.galleryTitle;
33
+ const label = typeof heading === "string" ? heading : t.galleryTitle;
34
+ const filtered = isFiltered(filters);
35
+ const set = (patch) => onFiltersChange({ ...filters, ...patch });
36
+ const create = onCreate && (_jsxs(Button, { onClick: onCreate, children: [_jsx(PlusIcon, { "aria-hidden": true }), t.create] }));
37
+ const importButton = onImport && (_jsxs(Button, { variant: "outline", onClick: onImport, children: [_jsx(UploadIcon, { "aria-hidden": true }), t.import] }));
38
+ let body;
39
+ if (error) {
40
+ body = _jsx(ErrorState, { title: t.loadFailed, error: error, onRetry: onRetry });
41
+ }
42
+ else if (loading) {
43
+ body = (_jsxs("div", { "aria-busy": true, className: view === "grid" ? GRID : LIST, children: [_jsx("p", { role: "status", className: "sr-only", children: messages.states.loading }), Array.from({ length: 6 }, (_, i) => (_jsx(WorkflowCardSkeleton, { layout: view === "grid" ? "card" : "row" }, i)))] }));
44
+ }
45
+ else if (workflows.length === 0) {
46
+ body = filtered ? (_jsx(EmptyState, { icon: _jsx(SearchIcon, {}), title: t.noMatches, description: t.noMatchesDescription, secondary: _jsx(Button, { variant: "outline", onClick: () => onFiltersChange(DEFAULT_WORKFLOW_FILTERS), children: t.clearFilters }) })) : (_jsx(EmptyState, { title: t.empty, description: t.emptyDescription, secondary: (create || importButton) && (_jsxs("div", { className: "flex flex-wrap justify-center gap-2", children: [create, importButton] })) }));
47
+ }
48
+ else {
49
+ body = (_jsx("ul", { "aria-label": label, className: view === "grid" ? GRID : LIST, children: workflows.map((workflow) => (_jsx("li", { className: "flex min-w-0", children: _jsx(WorkflowCard, { workflow: workflow, layout: view === "grid" ? "card" : "row", headingLevel: "h2", preview: renderPreview?.(workflow), className: "flex-1", ...actionsFor?.(workflow) }) }, workflow.id))) }));
50
+ }
51
+ return (_jsxs("div", { "data-slot": "workflow-gallery", className: cn("flex min-w-0 flex-col gap-4", className), children: [_jsx(PageHeader, { title: heading, description: description, primaryAction: (create || importButton) && (_jsxs("div", { className: "flex flex-wrap gap-2", children: [importButton, create] })) }), _jsxs("div", { role: "search", "aria-label": t.filters, className: "flex min-w-0 flex-col gap-3 md:flex-row md:flex-wrap md:items-center", children: [_jsxs("div", { className: "relative min-w-0 md:w-64", children: [_jsx(SearchIcon, { "aria-hidden": true, className: "pointer-events-none absolute top-1/2 left-2.5 size-4 -translate-y-1/2 text-muted-foreground" }), _jsx("label", { htmlFor: searchId, className: "sr-only", children: t.search }), _jsx(Input, { id: searchId, type: "search", value: filters.query, placeholder: t.search, onChange: (event) => set({ query: event.target.value }), className: "pl-8" })] }), _jsxs("div", { className: "flex min-w-0 flex-wrap items-center gap-2", children: [_jsx(Select, { "aria-label": t.scopeFilter, size: "sm", value: filters.scope, onValueChange: (scope) => set({ scope: scope }), options: [
52
+ { value: ANY_FILTER, label: t.anyScope },
53
+ ...SCOPES.map((scope) => ({ value: scope, label: t.scope(scope) })),
54
+ ] }), _jsx(Select, { "aria-label": t.statusFilter, size: "sm", value: filters.status, onValueChange: (status) => set({ status: status }), options: [
55
+ { value: ANY_FILTER, label: t.anyStatus },
56
+ ...STATUSES.map((status) => ({ value: status, label: t.status(status) })),
57
+ ] }), _jsx(Segmented, { label: t.view, iconOnly: true, size: "sm", value: view, onValueChange: (next) => {
58
+ setOwnView(next);
59
+ onViewChange?.(next);
60
+ }, options: [
61
+ { value: "grid", label: t.grid, icon: LayoutGridIcon },
62
+ { value: "list", label: t.list, icon: ListIcon },
63
+ ] })] }), modules.length > 0 && (_jsx(Segmented, { label: t.moduleFilter, size: "sm", value: filters.module, onValueChange: (module) => set({ module }), options: [
64
+ { value: ANY_FILTER, label: t.anyModule },
65
+ ...modules.map((module) => ({ value: module.id, label: module.label })),
66
+ ], className: "flex-wrap md:basis-full" }))] }), !loading && !error && (_jsx("p", { role: "status", className: "font-mono text-xs text-muted-foreground", children: t.count(workflows.length) })), body] }));
67
+ }
68
+ const GRID = "grid min-w-0 grid-cols-[repeat(auto-fill,minmax(min(100%,17rem),1fr))] gap-3";
69
+ const LIST = "flex min-w-0 flex-col gap-2";
@@ -0,0 +1,39 @@
1
+ import * as React from "react";
2
+ import { type WorkflowDefinition, type WorkflowRegistry, type WorkflowSelection } from "../definition.js";
3
+ import type { WorkflowProblem } from "../problems.js";
4
+ /** The canvas never zooms out past this: below it a node's words stop being readable. */
5
+ export declare const READABLE_ZOOM = 0.7;
6
+ export interface WorkflowCanvasProps {
7
+ definition: WorkflowDefinition;
8
+ /** The flow to draw; the main flow when omitted. */
9
+ flow?: string;
10
+ registry: WorkflowRegistry;
11
+ /** Every edit, as the whole next definition. Omit it, or set `readOnly`, for a viewer. */
12
+ onChange?: (definition: WorkflowDefinition) => void;
13
+ readOnly?: boolean;
14
+ selection?: WorkflowSelection | null;
15
+ onSelectionChange?: (selection: WorkflowSelection | null) => void;
16
+ /** From `checkDefinition`: nodes and edges with problems are marked. */
17
+ problems?: readonly WorkflowProblem[];
18
+ /** Folded regions by id (`regionsOf`). Uncontrolled from `defaultFolded` when omitted. */
19
+ folded?: readonly string[];
20
+ defaultFolded?: readonly string[];
21
+ onFoldedChange?: (folded: string[]) => void;
22
+ /** Sub-flow nodes shown in place, by id. */
23
+ defaultInPlace?: readonly string[];
24
+ /** Names the canvas; the editor's copy by default. */
25
+ label?: string;
26
+ className?: string;
27
+ }
28
+ /**
29
+ * One flow of a workflow definition, drawn and edited on a pannable,
30
+ * zoomable canvas. The run goes left to right: work comes into a node's
31
+ * input on the left and leaves by its exits on the right; typed inputs and
32
+ * outputs sit in rows below the header; a loop leaves from the bottom right
33
+ * and goes back into an earlier node's bottom left. `canConnect` decides
34
+ * what snaps, so an invalid edge never lands. Loop bodies and fan-out
35
+ * branches fold; a sub-flow shows in place. Every drag has a keyboard
36
+ * equivalent: Tab to a node, Enter to select, arrows to move, Delete to
37
+ * remove; Add and Connect in the toolbar.
38
+ */
39
+ export declare function WorkflowCanvas(props: WorkflowCanvasProps): React.JSX.Element;