@anchrd/intel-ui 0.3.0 → 0.5.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 (52) hide show
  1. package/components.json +7 -1
  2. package/package.json +3 -1
  3. package/src/app/action-slot/action-slot.tsx +23 -0
  4. package/src/app/app-sidebar/app-sidebar.tsx +71 -0
  5. package/src/app/app-tree/app-tree.tsx +798 -0
  6. package/src/app/app.tsx +99 -54
  7. package/src/app/header-search/header-search.tsx +291 -0
  8. package/src/app/sidebar-preferences/sidebar-preferences.ts +68 -0
  9. package/src/app/sidebar-preferences/sidebar-preferences.types.ts +15 -0
  10. package/src/app/sidebar-resize-handle/sidebar-resize-handle.tsx +86 -0
  11. package/src/app/tree-move/tree-move.tsx +197 -0
  12. package/src/app/user-footer/user-footer.tsx +103 -0
  13. package/src/app/view-toggle/view-toggle.tsx +77 -0
  14. package/src/blocknote-view/blocknote-view.tsx +19 -2
  15. package/src/branding/favicon.default.svg +2 -2
  16. package/src/branding/favicon.svg +2 -2
  17. package/src/components/ui/breadcrumb.tsx +102 -0
  18. package/src/components/ui/button.tsx +64 -0
  19. package/src/components/ui/collapsible.tsx +20 -0
  20. package/src/components/ui/command.tsx +160 -0
  21. package/src/components/ui/dialog.tsx +143 -0
  22. package/src/components/ui/dropdown-menu.tsx +162 -0
  23. package/src/components/ui/input.tsx +21 -0
  24. package/src/components/ui/separator.tsx +26 -0
  25. package/src/components/ui/sheet.tsx +136 -0
  26. package/src/components/ui/sidebar.tsx +693 -0
  27. package/src/components/ui/skeleton.tsx +13 -0
  28. package/src/components/ui/tooltip.tsx +51 -0
  29. package/src/data/intel-data-provider/intel-data-provider.ts +170 -85
  30. package/src/data/intel-data-provider/intel-data-provider.types.ts +64 -20
  31. package/src/document-link/document-link.tsx +132 -0
  32. package/src/flow-runs/flow-runs.tsx +225 -0
  33. package/src/flows/flows.tsx +684 -368
  34. package/src/flows/node-icon/node-icon.ts +28 -0
  35. package/src/flows/node-palette/node-palette.tsx +174 -0
  36. package/src/flows/node-palette/node-palette.types.ts +15 -0
  37. package/src/graph-pane/graph-pane.tsx +44 -0
  38. package/src/hooks/use-mobile.ts +19 -0
  39. package/src/i18n/en.json +188 -52
  40. package/src/knowledge/knowledge.tsx +133 -709
  41. package/src/knowledge-editor/knowledge-editor.tsx +169 -21
  42. package/src/knowledge-graph/knowledge-graph.ts +26 -24
  43. package/src/knowledge-graph/knowledge-graph.tsx +33 -24
  44. package/src/knowledge-table/knowledge-table.tsx +129 -0
  45. package/src/main.tsx +2 -2
  46. package/src/resource-menu/resource-menu.tsx +580 -0
  47. package/src/router/router.tsx +4 -0
  48. package/src/router/selection-search.ts +43 -0
  49. package/src/save-button/save-button.tsx +103 -0
  50. package/src/styles.css +91 -51
  51. package/src/theme/theme.ts +24 -0
  52. package/src/tools/tools.tsx +175 -158
package/components.json CHANGED
@@ -3,7 +3,13 @@
3
3
  "style": "new-york",
4
4
  "rsc": false,
5
5
  "tsx": true,
6
- "tailwind": { "css": "src/styles.css", "baseColor": "neutral", "cssVariables": true },
6
+ "tailwind": {
7
+ "config": "",
8
+ "css": "src/styles.css",
9
+ "baseColor": "neutral",
10
+ "cssVariables": true,
11
+ "prefix": ""
12
+ },
7
13
  "aliases": {
8
14
  "components": "@/components",
9
15
  "utils": "@/lib/utils",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anchrd/intel-ui",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "type": "module",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
@@ -40,9 +40,11 @@
40
40
  "@xyflow/react": "^12.11.2",
41
41
  "class-variance-authority": "^0.7.1",
42
42
  "clsx": "^2.1.1",
43
+ "cmdk": "^1.1.1",
43
44
  "colorjs.io": "^0.7.1",
44
45
  "graphology": "^0.26.0",
45
46
  "lucide-react": "^1.25.0",
47
+ "radix-ui": "^1.6.7",
46
48
  "react": "^19.2.0",
47
49
  "react-aria-components": "^1.19.0",
48
50
  "react-dom": "^19.2.0",
@@ -0,0 +1,23 @@
1
+ import type * as React from "react";
2
+ import { useEffect, useState } from "react";
3
+ import { createPortal } from "react-dom";
4
+
5
+ // A bar owns a place for actions, and whoever owns the action renders into it from wherever its
6
+ // state happens to live. Two such places exist: `header-actions` in the shell, beside the
7
+ // breadcrumb, for what belongs to the area; and `title-actions` in the title line of an open
8
+ // document, for what belongs to that one document (#24).
9
+ //
10
+ // ⚠️ The slot lives above the component that fills it, so it is not in the document while that
11
+ // component first renders. Looking it up in an effect costs one extra render and is the only order
12
+ // that works; reading it during render finds nothing on the first paint.
13
+ export function ActionSlot({
14
+ name = "header-actions",
15
+ children,
16
+ }: {
17
+ name?: string;
18
+ children: React.ReactNode;
19
+ }) {
20
+ const [slot, setSlot] = useState<Element | null>(null);
21
+ useEffect(() => setSlot(document.querySelector(`[data-slot="${name}"]`)), [name]);
22
+ return slot ? createPortal(children, slot) : null;
23
+ }
@@ -0,0 +1,71 @@
1
+ import { Link } from "@tanstack/react-router";
2
+ import { AppTree } from "@/app/app-tree/app-tree.tsx";
3
+ import { SidebarResizeHandle } from "@/app/sidebar-resize-handle/sidebar-resize-handle.tsx";
4
+ import { UserFooter } from "@/app/user-footer/user-footer.tsx";
5
+ import { AppLogo } from "@/branding/branding.tsx";
6
+ import {
7
+ Sidebar,
8
+ SidebarContent,
9
+ SidebarFooter,
10
+ SidebarHeader,
11
+ SidebarMenu,
12
+ SidebarMenuButton,
13
+ SidebarMenuItem,
14
+ useSidebar,
15
+ } from "@/components/ui/sidebar";
16
+ import { useIntelRouterContext } from "@/router/router-context.ts";
17
+
18
+ // One tree is the whole navigation: documents and flows side by side in the folder they share, with
19
+ // no Knowledge or Flows entry above them (ADR-0004). Tools stay below, next to the user, because
20
+ // they come live from the portal and have no tree.
21
+ export function AppSidebar({
22
+ width,
23
+ onWidthChange,
24
+ }: {
25
+ width: number;
26
+ onWidthChange(width: number): void;
27
+ }) {
28
+ const { i18n } = useIntelRouterContext();
29
+ // `offcanvas` rather than `icon`: the icon rail is the mode for a list of equal entries with one
30
+ // icon each, and a tree says what it says through indentation, disclosure arrows and nesting —
31
+ // none of which survives 48px. Collapsing exists to free the canvas, so the sidebar goes.
32
+ //
33
+ // ⚠️ Offcanvas only moves the panel out of sight; it stays in the document and keeps its focus
34
+ // order, so a keyboard would still walk through an invisible tree. The shell therefore unmounts
35
+ // the panel's content itself — the registry file is off limits. On a narrow screen the sidebar is
36
+ // an overlay driven by `openMobile`, and `state` says nothing about it, hence the `isMobile` arm.
37
+ const { state, isMobile } = useSidebar();
38
+ const showPanel = isMobile || state === "expanded";
39
+
40
+ return (
41
+ <Sidebar collapsible="offcanvas" variant="inset">
42
+ {!showPanel ? null : (
43
+ <>
44
+ <SidebarHeader>
45
+ <SidebarMenu>
46
+ <SidebarMenuItem>
47
+ <SidebarMenuButton size="lg" asChild>
48
+ <Link to="/knowledge">
49
+ <AppLogo className="size-8" />
50
+ <span className="font-semibold">{i18n.t("app.name")}</span>
51
+ </Link>
52
+ </SidebarMenuButton>
53
+ </SidebarMenuItem>
54
+ </SidebarMenu>
55
+ </SidebarHeader>
56
+ <SidebarContent aria-label={i18n.t("nav.primary")}>
57
+ <AppTree />
58
+ </SidebarContent>
59
+ <SidebarFooter>
60
+ <UserFooter />
61
+ </SidebarFooter>
62
+ <SidebarResizeHandle
63
+ width={width}
64
+ label={i18n.t("shell.resizeSidebar")}
65
+ onWidthChange={onWidthChange}
66
+ />
67
+ </>
68
+ )}
69
+ </Sidebar>
70
+ );
71
+ }