@dxos/plugin-stack 0.10.0 → 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 (71) hide show
  1. package/dist/lib/StackPlugin.mjs +18 -0
  2. package/dist/lib/StackPlugin.mjs.map +1 -0
  3. package/dist/lib/capabilities.mjs +7 -0
  4. package/dist/lib/capabilities.mjs.map +1 -0
  5. package/dist/lib/chunk-StackArticle.mjs +155 -0
  6. package/dist/lib/chunk-StackArticle.mjs.map +1 -0
  7. package/dist/lib/{neutral/chunk-ZOIZTRMG.mjs → chunk-meta.mjs} +16 -23
  8. package/dist/lib/chunk-meta.mjs.map +1 -0
  9. package/dist/lib/chunk-react-surface.mjs +21 -0
  10. package/dist/lib/chunk-react-surface.mjs.map +1 -0
  11. package/dist/lib/chunk-types.mjs +21 -0
  12. package/dist/lib/chunk-types.mjs.map +1 -0
  13. package/dist/lib/components.mjs +242 -0
  14. package/dist/lib/components.mjs.map +1 -0
  15. package/dist/lib/containers.mjs +7 -0
  16. package/dist/lib/containers.mjs.map +1 -0
  17. package/dist/lib/index.mjs +3 -0
  18. package/dist/lib/meta.mjs +2 -0
  19. package/dist/lib/plugin.mjs +8 -0
  20. package/dist/lib/plugin.mjs.map +1 -0
  21. package/dist/lib/translations.mjs +31 -0
  22. package/dist/lib/translations.mjs.map +1 -0
  23. package/dist/lib/types.mjs +2 -0
  24. package/dist/types/src/capabilities/react-surface.d.ts +1 -1
  25. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  26. package/dist/types/src/components/Stack/Stack.d.ts +11 -4
  27. package/dist/types/src/components/Stack/Stack.d.ts.map +1 -1
  28. package/dist/types/src/components/Stack/StackContext.d.ts +6 -0
  29. package/dist/types/src/components/Stack/StackContext.d.ts.map +1 -0
  30. package/dist/types/src/components/Stack/index.d.ts +1 -0
  31. package/dist/types/src/components/Stack/index.d.ts.map +1 -1
  32. package/dist/types/src/containers/StackArticle/StackArticle.d.ts +4 -1
  33. package/dist/types/src/containers/StackArticle/StackArticle.d.ts.map +1 -1
  34. package/dist/types/src/containers/StackArticle/StackArticle.stories.d.ts.map +1 -1
  35. package/dist/types/tsconfig.tsbuildinfo +1 -1
  36. package/dx.config.ts +1 -0
  37. package/package.json +40 -37
  38. package/src/capabilities/{react-surface.tsx → react-surface.ts} +2 -4
  39. package/src/components/Stack/Stack.tsx +11 -27
  40. package/src/components/Stack/StackContext.ts +23 -0
  41. package/src/components/Stack/index.ts +2 -0
  42. package/src/containers/StackArticle/StackArticle.stories.tsx +14 -11
  43. package/src/containers/StackArticle/StackArticle.tsx +12 -6
  44. package/dist/lib/neutral/StackArticle-DDKRSUE7.mjs +0 -199
  45. package/dist/lib/neutral/StackArticle-DDKRSUE7.mjs.map +0 -7
  46. package/dist/lib/neutral/StackPlugin.mjs +0 -36
  47. package/dist/lib/neutral/StackPlugin.mjs.map +0 -7
  48. package/dist/lib/neutral/capabilities/index.mjs +0 -9
  49. package/dist/lib/neutral/capabilities/index.mjs.map +0 -7
  50. package/dist/lib/neutral/chunk-FDNICBZZ.mjs +0 -18
  51. package/dist/lib/neutral/chunk-FDNICBZZ.mjs.map +0 -7
  52. package/dist/lib/neutral/chunk-J5LGTIGS.mjs +0 -10
  53. package/dist/lib/neutral/chunk-J5LGTIGS.mjs.map +0 -7
  54. package/dist/lib/neutral/chunk-ZOIZTRMG.mjs.map +0 -7
  55. package/dist/lib/neutral/components/index.mjs +0 -226
  56. package/dist/lib/neutral/components/index.mjs.map +0 -7
  57. package/dist/lib/neutral/containers/index.mjs +0 -9
  58. package/dist/lib/neutral/containers/index.mjs.map +0 -7
  59. package/dist/lib/neutral/index.mjs +0 -14
  60. package/dist/lib/neutral/index.mjs.map +0 -7
  61. package/dist/lib/neutral/meta.json +0 -1
  62. package/dist/lib/neutral/meta.mjs +0 -10
  63. package/dist/lib/neutral/meta.mjs.map +0 -7
  64. package/dist/lib/neutral/plugin.mjs +0 -12
  65. package/dist/lib/neutral/plugin.mjs.map +0 -7
  66. package/dist/lib/neutral/react-surface-IL4CW7ND.mjs +0 -25
  67. package/dist/lib/neutral/react-surface-IL4CW7ND.mjs.map +0 -7
  68. package/dist/lib/neutral/translations.mjs +0 -39
  69. package/dist/lib/neutral/translations.mjs.map +0 -7
  70. package/dist/lib/neutral/types/index.mjs +0 -8
  71. package/dist/lib/neutral/types/index.mjs.map +0 -7
@@ -0,0 +1,18 @@
1
+ import { Plugin } from "@dxos/app-framework";
2
+ import { AppPlugin } from "@dxos/app-toolkit";
3
+ import { ReactSurface } from "#capabilities";
4
+ import { meta } from "#meta";
5
+ import { translations } from "#translations";
6
+ import { Stack } from "#types";
7
+ //#endregion
8
+ //#region src/StackPlugin.ts
9
+ var StackPlugin = Plugin.define(meta).pipe(AppPlugin.addSchemaModule({ schema: [Stack.Stack] }), AppPlugin.addSurfaceModule({ activate: ReactSurface }), AppPlugin.addTranslationsModule({ translations }), AppPlugin.addPluginAssetModule({ asset: {
10
+ pluginId: meta.profile.key,
11
+ path: "PLUGIN.mdl",
12
+ content: "---\nid: org.dxos.plugin.stack\nname: StackPlugin\nversion: 0.1.0\n---\n\nCollections plugin for `DXOS` Composer — renders any `Collection` object as a vertically scrollable stack of collapsible sections, where each section displays an arbitrary ECHO object via the `section` surface role. Supports adding, removing, navigating, and collapsing individual sections.\n\n## Extensions\n\nThe following extension dialects are used in this document.\nEach extension is defined in the Appendix or resolved via its URI.\n\n| Term | URI |\n|-------------|--------------------------------|\n| `type` | `org.dxos.mdl.type@1.0` |\n| `feat` | `org.dxos.mdl.feat@1.0` |\n| `test` | `org.dxos.mdl.test@1.0` |\n| `component` | `org.dxos.mdl.component@1.0` |\n| `op` | `org.dxos.mdl.op@1.0` |\n\n## Types\n\n```mdl\ntype SectionSchema\n fields:\n height?: number # explicit height override for the section\n custom?: Record<string, any> # view-instance-specific data (e.g. cover mode for images)\n```\n\n```mdl\ntype StackViewType\n typename: org.dxos.type.stackView\n version: 0.1.0\n fields:\n sections: Record<string, SectionSchema>\n```\n\n```mdl\ntype StackSectionView\n fields:\n title?: string\n size?: StackItemSize\n height?: number\n collapsed?: boolean\n custom?: Record<string, any>\n```\n\n```mdl\ntype StackSectionMetadata\n fields:\n icon?: string\n placeholder?: Label\n viewActions?: (item: CollectionItem) => StackSectionAction\n```\n\n```mdl\ntype StackSectionItem\n fields:\n id: string # DXN string for the contained object\n object: Obj.Unknown\n view: StackSectionView\n metadata: StackSectionMetadata\n```\n\n```mdl\ntype AddSectionPosition\n literals: before | after | beforeAll | afterAll\n```\n\n```mdl\ntype StackSettingsProps\n fields:\n separation: boolean # whether visual separators are shown between sections\n```\n\n## Components\n\n```mdl\ncomponent StackArticle\n desc: Full-page article view of a Collection — renders items as a vertical stack of StackSection components with a toolbar for adding sections.\n props:\n subject: Collection\n role: AppSurface.Role\n attendableId?: string\n state:\n collapsedSections: Record<string, boolean> # collapsed state by DXN string\n items: StackSectionItem[] # derived from collection objects\n slots:\n (none)\n actions:\n handleAdd(id: string, position: AddSectionPosition)\n handleDelete(id: string)\n handleNavigate(id: string)\n handleCollapse(id: string, collapsed: boolean)\n handleAddSection()\n emits:\n (none)\n layout: |\n ┌──────────────────────────────┐\n │ Toolbar [+ Add Section] │\n ├──────────────────────────────┤\n │ Stack (vertical, intrinsic) │\n │ ┌────────────────────────┐ │\n │ │ StackSection │ │\n │ │ ▾ [icon] Title [→] │ │\n │ │ └─ Surface:section │ │\n │ └────────────────────────┘ │\n │ ┌────────────────────────┐ │\n │ │ StackSection (collapsed│ │\n │ │ ▸ [icon] Title [↕] │ │\n │ └────────────────────────┘ │\n │ … │\n └──────────────────────────────┘\n```\n\n```mdl\ncomponent StackSection\n desc: A single collapsible section in the stack — shows a sigil icon button with a dropdown menu and delegates content rendering to the section surface slot.\n props:\n id: string\n object: Obj.Unknown\n view: StackSectionView\n metadata: StackSectionMetadata\n state:\n optionsMenuOpen: boolean\n attendableId: string # composed as parentAttendableId/object.id\n slots:\n content: ReactNode # rendered by Surface(type=section, subject=object)\n actions:\n navigate(id: string)\n add(id: string, position: AddSectionPosition)\n collapse(id: string, collapsed: boolean)\n delete(id: string)\n layout: |\n ┌─────────────────────────────────┐\n │ StackItem.Heading │\n │ [sigil▾] (sticky) [→ or ↕] │\n ├─────────────────────────────────┤\n │ CollapsibleContent │\n │ Surface type=section │\n └─────────────────────────────────┘\n```\n\n```mdl\ncomponent StackSettings\n desc: Settings panel for configuring stack-level display preferences such as section separation.\n props:\n settings: StackSettingsProps\n layout: |\n ┌─────────────────────────────┐\n │ Settings.Section │\n │ Separation [toggle] │\n └─────────────────────────────┘\n```\n\n## Features\n\n```mdl\nfeat F-1: Stack Rendering\n\n req F-1.1: StackPlugin registers a surface for the article role filtered to Collection objects.\n req F-1.2: StackArticle renders each item in the collection as a StackSection in document order.\n req F-1.3: Each StackSection title is derived from the object's title property or graph node label.\n req F-1.4: The icon displayed on the section sigil is taken from the object schema's IconAnnotation.\n```\n\n```mdl\nfeat F-2: Section Management\n\n req F-2.1:\n when: user clicks the Add Section button in the toolbar\n then: SpaceOperation.OpenCreateObject dialog is invoked with the collection as target\n req F-2.2:\n when: user selects \"Add Before\" or \"Add After\" from a section dropdown\n then: LayoutOperation.UpdateDialog is invoked with the AddSectionDialog, position, and collection context\n req F-2.3:\n when: user selects \"Remove\" from a section dropdown\n then: SpaceOperation.RemoveObjects is invoked; section is removed from the collection\n req F-2.4:\n when: user selects \"Navigate to\" from a collapsed section dropdown or the navigate button\n then: LayoutOperation.Open is invoked with the section's id\n```\n\n```mdl\nfeat F-3: Collapse / Expand\n\n req F-3.1: Each section can be individually collapsed via the dropdown menu or caret trigger.\n req F-3.2:\n when: section is expanded\n then: full Surface:section content is visible; navigate button shown in heading\n req F-3.3:\n when: section is collapsed\n then: only the title is shown in StackItem.Content; expand toggle shown in heading\n req F-3.4: Collapsed state is managed locally in StackArticle component state (not persisted).\n```\n\n```mdl\nfeat F-4: Settings\n\n req F-4.1: StackPlugin exposes a settings panel via the StackSettings component.\n req F-4.2: The separation setting controls whether visual separators appear between sections.\n```\n\n```mdl\nfeat F-5: Schema Registration\n\n req F-5.1: StackPlugin registers StackViewType with the ECHO schema module on activation.\n req F-5.2: StackViewType stores per-section metadata (height, custom data) keyed by object id.\n```\n\n## Acceptance\n\n```mdl\ntest T-1: Collection renders as stack\n given: a Collection with three objects is opened in article role\n then:\n - StackArticle is displayed\n - three StackSection components are rendered in order\n - each section shows the object's title\n```\n\n```mdl\ntest T-2: Add section via toolbar\n given: StackArticle is open\n when: user clicks the Add Section toolbar button\n then: SpaceOperation.OpenCreateObject is invoked with the collection as target\n```\n\n```mdl\ntest T-3: Remove section\n given: StackArticle is open with at least one section\n when: user selects Remove from a section dropdown\n then:\n - SpaceOperation.RemoveObjects is invoked\n - section no longer appears in the stack\n```\n\n```mdl\ntest T-4: Collapse section\n given: a section is expanded\n when: user selects Collapse from the section dropdown\n then:\n - section content is hidden\n - section title is shown in collapsed state\n - expand toggle is visible in heading\n```\n\n```mdl\ntest T-5: Navigate to section\n given: StackArticle is open\n when: user clicks the navigate button on a section heading\n then: LayoutOperation.Open is invoked with the section's DXN id\n```\n\n```mdl\ntest T-6: StackViewType registered\n given: StackPlugin is active\n then: StackViewType (typename org.dxos.type.stackView) is registered with the ECHO schema module\n```\n\n---\n\n## Appendix: Extension Definitions\n\n```mdl\next type\n uri: org.dxos.mdl.type@1.0\n desc: A named data structure with typed fields and optional literals.\n fields:\n desc?: Prose\n fields?: FieldMap\n literals?: UnionList\n extends?: TypeRef[]\n```\n\n```mdl\next feat\n uri: org.dxos.mdl.feat@1.0\n desc: A named feature grouping one or more requirements.\n fields:\n desc?: Prose\n req: RequirementList\n nesting: self\n```\n\n```mdl\next test\n uri: org.dxos.mdl.test@1.0\n desc: An acceptance scenario expressed as given / when / then steps.\n fields:\n given?: Step | Step[]\n when?: Step | Step[]\n then: Step | Step[]\n tags?: TagList\n```\n\n```mdl\next component\n uri: org.dxos.mdl.component@1.0\n desc: A UI component with props, internal state, slots, actions, and events.\n fields:\n desc?: Prose\n props?: FieldMap\n state?: FieldMap\n slots?: FieldMap\n actions?: ActionMap\n emits?: EventMap\n layout?: CodeBlock\n```\n\n```mdl\next op\n uri: org.dxos.mdl.op@1.0\n desc: |\n A named operation with typed inputs, outputs, and declared errors.\n Pure ops have no effects or requires. Effectful ops declare both.\n fields:\n desc?: Prose\n input?: FieldMap\n output?: TypeExpr\n errors?: ErrorMap\n effects?: EffectList\n requires?: ServiceList\n note?: Prose\n```\n",
13
+ mimeType: "application/x-mdl"
14
+ } }), Plugin.make);
15
+ //#endregion
16
+ export { StackPlugin, StackPlugin as default };
17
+
18
+ //# sourceMappingURL=StackPlugin.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StackPlugin.mjs","names":[],"sources":["../../src/StackPlugin.ts"],"sourcesContent":["//\n// Copyright 2023 DXOS.org\n//\n\nimport { Plugin } from '@dxos/app-framework';\nimport { AppPlugin } from '@dxos/app-toolkit';\n\nimport { ReactSurface } from '#capabilities';\nimport { meta } from '#meta';\nimport { translations } from '#translations';\nimport { Stack } from '#types';\n\n// eslint-disable-next-line import/no-relative-packages\nimport pluginSpec from '../PLUGIN.mdl?raw';\n\nexport const StackPlugin = Plugin.define(meta).pipe(\n AppPlugin.addSchemaModule({ schema: [Stack.Stack] }),\n AppPlugin.addSurfaceModule({ activate: ReactSurface }),\n AppPlugin.addTranslationsModule({ translations }),\n AppPlugin.addPluginAssetModule({\n asset: { pluginId: meta.profile.key, path: 'PLUGIN.mdl', content: pluginSpec, mimeType: 'application/x-mdl' },\n }),\n Plugin.make,\n);\n\nexport default StackPlugin;\n"],"mappings":";;;;;;;;AAeA,IAAa,cAAc,OAAO,OAAO,IAAI,CAAC,CAAC,KAC7C,UAAU,gBAAgB,EAAE,QAAQ,CAAC,MAAM,KAAK,EAAE,CAAC,GACnD,UAAU,iBAAiB,EAAE,UAAU,aAAa,CAAC,GACrD,UAAU,sBAAsB,EAAE,aAAa,CAAC,GAChD,UAAU,qBAAqB,EAC7B,OAAO;CAAE,UAAU,KAAK,QAAQ;CAAK,MAAM;CAAc,SAAS;CAAY,UAAU;AAAoB,EAC9G,CAAC,GACD,OAAO,IACT"}
@@ -0,0 +1,7 @@
1
+ import { Capability } from "@dxos/app-framework";
2
+ //#region src/capabilities/index.ts
3
+ var ReactSurface = Capability.lazy("ReactSurface", () => import("./chunk-react-surface.mjs"));
4
+ //#endregion
5
+ export { ReactSurface };
6
+
7
+ //# sourceMappingURL=capabilities.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capabilities.mjs","names":[],"sources":["../../src/capabilities/index.ts"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Capability } from '@dxos/app-framework';\n\nexport const ReactSurface = Capability.lazy('ReactSurface', () => import('./react-surface'));\n"],"mappings":";;AAMA,IAAa,eAAe,WAAW,KAAK,sBAAsB,OAAO,4BAAkB"}
@@ -0,0 +1,155 @@
1
+ import { arrayMove, isNonNullable } from "@dxos/util";
2
+ import { Obj } from "@dxos/echo";
3
+ import { meta } from "#meta";
4
+ import { useCallback, useId, useMemo, useState } from "react";
5
+ import { useOperationInvoker } from "@dxos/app-framework/ui";
6
+ import { Panel, Toolbar, useTranslation } from "@dxos/react-ui";
7
+ import { Mosaic } from "@dxos/react-ui-mosaic";
8
+ import { jsx, jsxs } from "react/jsx-runtime";
9
+ import { Atom, useAtomValue } from "@effect-atom/atom-react";
10
+ import { SpaceOperation } from "@dxos/plugin-space";
11
+ import { Menu, createMenuAction } from "@dxos/react-ui-menu";
12
+ import { Stack } from "#components";
13
+ //#region src/containers/StackArticle/StackArticle.tsx
14
+ var StackArticle = ({ attendableId, subject: collection }) => {
15
+ const { invokePromise } = useOperationInvoker();
16
+ const { t } = useTranslation(meta.profile.key);
17
+ const [collapsedSections, setCollapsedSections] = useState({});
18
+ const collectionObjects = useAtomValue(createCollectionObjects(collection));
19
+ const items = useMemo(() => collectionObjects.map((object) => ({
20
+ id: Obj.getURI(object),
21
+ object
22
+ })), [collectionObjects]);
23
+ const collapsed = useMemo(() => new Set(Object.keys(collapsedSections).filter((id) => collapsedSections[id])), [collapsedSections]);
24
+ const findIndex = useCallback((id) => collection.objects.findIndex((ref) => ref.target != null && Obj.getURI(ref.target) === id), [collection]);
25
+ const instanceId = useId();
26
+ const eventHandler = useMemo(() => ({
27
+ id: `${Obj.getURI(collection)}:${instanceId}`,
28
+ canDrop: ({ source }) => collection.objects.some((ref) => ref.target != null && Obj.getURI(ref.target) === source.id),
29
+ onDrop: ({ source, target }) => {
30
+ const to = target?.type === "tile" || target?.type === "placeholder" ? target.location : target?.type === "container" ? collection.objects.length : -1;
31
+ const insert = typeof to === "number" && to >= 0 ? Math.floor(to) : -1;
32
+ if (insert < 0) return;
33
+ Obj.update(collection, (collection) => {
34
+ const from = findIndex(source.id);
35
+ if (from !== -1) arrayMove(collection.objects, from, insert);
36
+ });
37
+ }
38
+ }), [
39
+ collection,
40
+ findIndex,
41
+ instanceId
42
+ ]);
43
+ const handleMoveUp = useCallback((id) => {
44
+ const index = findIndex(id);
45
+ if (index > 0) Obj.update(collection, (collection) => {
46
+ const [ref] = collection.objects.splice(index, 1);
47
+ collection.objects.splice(index - 1, 0, ref);
48
+ });
49
+ }, [collection, findIndex]);
50
+ const handleMoveDown = useCallback((id) => {
51
+ const index = findIndex(id);
52
+ if (index >= 0 && index < collection.objects.length - 1) Obj.update(collection, (collection) => {
53
+ const [ref] = collection.objects.splice(index, 1);
54
+ collection.objects.splice(index + 1, 0, ref);
55
+ });
56
+ }, [collection, findIndex]);
57
+ const handleDelete = useCallback((id) => {
58
+ const index = findIndex(id);
59
+ if (index >= 0) Obj.update(collection, (collection) => {
60
+ collection.objects.splice(index, 1);
61
+ });
62
+ }, [collection, findIndex]);
63
+ const handleAdd = useCallback((id) => invokePromise(SpaceOperation.OpenCreateObject, {
64
+ target: collection,
65
+ navigable: false,
66
+ onCreateObject: (object) => {
67
+ const from = findIndex(Obj.getURI(object));
68
+ const anchor = findIndex(id);
69
+ if (from >= 0 && anchor >= 0) Obj.update(collection, (collection) => {
70
+ const [ref] = collection.objects.splice(from, 1);
71
+ collection.objects.splice(anchor < from ? anchor + 1 : anchor, 0, ref);
72
+ });
73
+ }
74
+ }), [
75
+ collection,
76
+ invokePromise,
77
+ findIndex
78
+ ]);
79
+ const handleCollapse = useCallback((id, value) => setCollapsedSections((prev) => ({
80
+ ...prev,
81
+ [id]: value
82
+ })), []);
83
+ const handleCollapseAll = useCallback(() => setCollapsedSections(Object.fromEntries(collectionObjects.map((object) => [Obj.getURI(object), true]))), [collectionObjects]);
84
+ const handleExpandAll = useCallback(() => setCollapsedSections({}), []);
85
+ const optionsMenu = useMemo(() => [createMenuAction("collapse-all", handleCollapseAll, {
86
+ label: ["collapse-all.label", { ns: meta.profile.key }],
87
+ icon: "ph--arrows-in-line-vertical--regular",
88
+ testId: "stack.collapse-all"
89
+ }), createMenuAction("expand-all", handleExpandAll, {
90
+ label: ["expand-all.label", { ns: meta.profile.key }],
91
+ icon: "ph--arrows-out-line-vertical--regular",
92
+ testId: "stack.expand-all"
93
+ })], [handleCollapseAll, handleExpandAll]);
94
+ const handleAddSection = useCallback(() => invokePromise(SpaceOperation.OpenCreateObject, {
95
+ target: collection,
96
+ navigable: false
97
+ }), [collection, invokePromise]);
98
+ return /* @__PURE__ */ jsxs(Panel.Root, { children: [/* @__PURE__ */ jsx(Panel.Toolbar, {
99
+ classNames: "dx-toolbar-surface",
100
+ children: /* @__PURE__ */ jsxs(Toolbar.Root, {
101
+ classNames: "dx-document",
102
+ children: [
103
+ /* @__PURE__ */ jsx(Toolbar.IconButton, {
104
+ square: true,
105
+ icon: "ph--plus--regular",
106
+ iconOnly: true,
107
+ label: t("add-section.label"),
108
+ "data-testid": "stack.addSection",
109
+ onClick: handleAddSection
110
+ }),
111
+ /* @__PURE__ */ jsx(Toolbar.Separator, {}),
112
+ /* @__PURE__ */ jsxs(Menu.Root, { children: [/* @__PURE__ */ jsx(Menu.Trigger, {
113
+ asChild: true,
114
+ children: /* @__PURE__ */ jsx(Toolbar.IconButton, {
115
+ square: true,
116
+ icon: "ph--dots-three-vertical--regular",
117
+ iconOnly: true,
118
+ label: t("options.label"),
119
+ "data-testid": "stack.options"
120
+ })
121
+ }), /* @__PURE__ */ jsx(Menu.Content, { items: optionsMenu })] })
122
+ ]
123
+ })
124
+ }), /* @__PURE__ */ jsx(Panel.Content, { children: /* @__PURE__ */ jsx(Stack.Root, {
125
+ id: Obj.getURI(collection),
126
+ attendableId,
127
+ collapsed,
128
+ eventHandler,
129
+ onCollapse: handleCollapse,
130
+ onAdd: handleAdd,
131
+ onMoveUp: handleMoveUp,
132
+ onMoveDown: handleMoveDown,
133
+ onDelete: handleDelete,
134
+ children: /* @__PURE__ */ jsx(Stack.Content, {
135
+ centered: true,
136
+ padding: true,
137
+ "data-testid": "main.stack",
138
+ children: /* @__PURE__ */ jsx(Stack.Viewport, { children: /* @__PURE__ */ jsx(Mosaic.Stack, {
139
+ classNames: "dx-document",
140
+ items,
141
+ getId,
142
+ Tile: Stack.Section
143
+ }) })
144
+ })
145
+ }) })] });
146
+ };
147
+ var getId = (item) => item.id;
148
+ var createCollectionObjects = Atom.family((collection) => Atom.make((get) => {
149
+ return get(Obj.atom(collection)).objects.map((ref) => get(Obj.atomReactive(ref))).filter(isNonNullable);
150
+ }));
151
+ StackArticle.displayName = "StackArticle";
152
+ //#endregion
153
+ export { StackArticle as default };
154
+
155
+ //# sourceMappingURL=chunk-StackArticle.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk-StackArticle.mjs","names":[],"sources":["../../src/containers/StackArticle/StackArticle.tsx"],"sourcesContent":["//\n// Copyright 2023 DXOS.org\n//\n\nimport { Atom, useAtomValue } from '@effect-atom/atom-react';\nimport React, { useCallback, useId, useMemo, useState } from 'react';\n\nimport { useOperationInvoker } from '@dxos/app-framework/ui';\nimport { type AppSurface } from '@dxos/app-toolkit/ui';\nimport { type Collection, Obj } from '@dxos/echo';\nimport { SpaceOperation } from '@dxos/plugin-space';\nimport { Panel, Toolbar, useTranslation } from '@dxos/react-ui';\nimport { type DndContainerHandler } from '@dxos/react-ui-dnd';\nimport { Menu, createMenuAction } from '@dxos/react-ui-menu';\nimport { Mosaic } from '@dxos/react-ui-mosaic';\nimport { arrayMove, isNonNullable } from '@dxos/util';\n\nimport { Stack, type StackSectionItem } from '#components';\nimport { meta } from '#meta';\n\nexport type StackArticleProps = AppSurface.ObjectArticleProps<Collection.Collection>;\n\nexport const StackArticle = ({ attendableId, subject: collection }: StackArticleProps) => {\n const { invokePromise } = useOperationInvoker();\n const { t } = useTranslation(meta.profile.key);\n const [collapsedSections, setCollapsedSections] = useState<Record<string, boolean>>({});\n\n const collectionObjects = useAtomValue(createCollectionObjects(collection));\n const items = useMemo<StackSectionItem[]>(\n () => collectionObjects.map((object) => ({ id: Obj.getURI(object), object })),\n [collectionObjects],\n );\n\n const collapsed = useMemo<ReadonlySet<string>>(\n () => new Set(Object.keys(collapsedSections).filter((id) => collapsedSections[id])),\n [collapsedSections],\n );\n\n // Index of a section within the collection by its object URI.\n const findIndex = useCallback(\n (id: string) => collection.objects.findIndex((ref) => ref.target != null && Obj.getURI(ref.target) === id),\n [collection],\n );\n\n // Per-instance discriminator so the same collection opened in two planks doesn't collide in the Mosaic registry.\n const instanceId = useId();\n\n // Reorder sections in place. Placeholder/tile drop locations are 1-based with half-step placeholders\n // between tiles, so the floor of the drop location is the destination array index (see Mosaic.Stack).\n const eventHandler = useMemo<DndContainerHandler<StackSectionItem>>(\n () => ({\n id: `${Obj.getURI(collection)}:${instanceId}`,\n canDrop: ({ source }) =>\n collection.objects.some((ref) => ref.target != null && Obj.getURI(ref.target) === source.id),\n onDrop: ({ source, target }) => {\n const to =\n target?.type === 'tile' || target?.type === 'placeholder'\n ? target.location\n : target?.type === 'container'\n ? collection.objects.length\n : -1;\n const insert = typeof to === 'number' && to >= 0 ? Math.floor(to) : -1;\n if (insert < 0) {\n return;\n }\n\n Obj.update(collection, (collection) => {\n const from = findIndex(source.id);\n if (from !== -1) {\n arrayMove(collection.objects, from, insert);\n }\n });\n },\n }),\n [collection, findIndex, instanceId],\n );\n\n const handleMoveUp = useCallback(\n (id: string) => {\n const index = findIndex(id);\n if (index > 0) {\n Obj.update(collection, (collection) => {\n const [ref] = collection.objects.splice(index, 1);\n collection.objects.splice(index - 1, 0, ref);\n });\n }\n },\n [collection, findIndex],\n );\n\n const handleMoveDown = useCallback(\n (id: string) => {\n const index = findIndex(id);\n if (index >= 0 && index < collection.objects.length - 1) {\n Obj.update(collection, (collection) => {\n const [ref] = collection.objects.splice(index, 1);\n collection.objects.splice(index + 1, 0, ref);\n });\n }\n },\n [collection, findIndex],\n );\n\n const handleDelete = useCallback(\n (id: string) => {\n const index = findIndex(id);\n if (index >= 0) {\n Obj.update(collection, (collection) => {\n collection.objects.splice(index, 1);\n });\n }\n },\n [collection, findIndex],\n );\n\n const handleAdd = useCallback(\n (id: string) =>\n invokePromise(SpaceOperation.OpenCreateObject, {\n target: collection,\n navigable: false,\n // The created object is appended; move it to immediately after the originating section.\n onCreateObject: (object: Obj.Unknown) => {\n const from = findIndex(Obj.getURI(object));\n const anchor = findIndex(id);\n if (from >= 0 && anchor >= 0) {\n Obj.update(collection, (collection) => {\n const [ref] = collection.objects.splice(from, 1);\n collection.objects.splice(anchor < from ? anchor + 1 : anchor, 0, ref);\n });\n }\n },\n }),\n [collection, invokePromise, findIndex],\n );\n\n const handleCollapse = useCallback(\n (id: string, value: boolean) => setCollapsedSections((prev) => ({ ...prev, [id]: value })),\n [],\n );\n\n const handleCollapseAll = useCallback(\n () => setCollapsedSections(Object.fromEntries(collectionObjects.map((object) => [Obj.getURI(object), true]))),\n [collectionObjects],\n );\n\n const handleExpandAll = useCallback(() => setCollapsedSections({}), []);\n\n const optionsMenu = useMemo(\n () => [\n createMenuAction('collapse-all', handleCollapseAll, {\n label: ['collapse-all.label', { ns: meta.profile.key }],\n icon: 'ph--arrows-in-line-vertical--regular',\n testId: 'stack.collapse-all',\n }),\n createMenuAction('expand-all', handleExpandAll, {\n label: ['expand-all.label', { ns: meta.profile.key }],\n icon: 'ph--arrows-out-line-vertical--regular',\n testId: 'stack.expand-all',\n }),\n ],\n [handleCollapseAll, handleExpandAll],\n );\n\n const handleAddSection = useCallback(\n () =>\n invokePromise(SpaceOperation.OpenCreateObject, {\n target: collection,\n navigable: false,\n }),\n [collection, invokePromise],\n );\n\n return (\n <Panel.Root>\n <Panel.Toolbar classNames='dx-toolbar-surface'>\n <Toolbar.Root classNames='dx-document'>\n <Toolbar.IconButton\n square\n icon='ph--plus--regular'\n iconOnly\n label={t('add-section.label')}\n data-testid='stack.addSection'\n onClick={handleAddSection}\n />\n <Toolbar.Separator />\n <Menu.Root>\n <Menu.Trigger asChild>\n <Toolbar.IconButton\n square\n icon='ph--dots-three-vertical--regular'\n iconOnly\n label={t('options.label')}\n data-testid='stack.options'\n />\n </Menu.Trigger>\n <Menu.Content items={optionsMenu} />\n </Menu.Root>\n </Toolbar.Root>\n </Panel.Toolbar>\n <Panel.Content>\n <Stack.Root\n id={Obj.getURI(collection)}\n attendableId={attendableId}\n collapsed={collapsed}\n eventHandler={eventHandler}\n onCollapse={handleCollapse}\n onAdd={handleAdd}\n onMoveUp={handleMoveUp}\n onMoveDown={handleMoveDown}\n onDelete={handleDelete}\n >\n <Stack.Content centered padding data-testid='main.stack'>\n <Stack.Viewport>\n <Mosaic.Stack classNames='dx-document' items={items} getId={getId} Tile={Stack.Section} />\n </Stack.Viewport>\n </Stack.Content>\n </Stack.Root>\n </Panel.Content>\n </Panel.Root>\n );\n};\n\nconst getId = (item: StackSectionItem) => item.id;\n\nconst createCollectionObjects = Atom.family((collection: Collection.Collection) =>\n Atom.make((get) => {\n const snapshot = get(Obj.atom(collection));\n return snapshot.objects.map((ref) => get(Obj.atomReactive(ref))).filter(isNonNullable);\n }),\n);\n\nStackArticle.displayName = 'StackArticle';\n"],"mappings":";;;;;;;;;;;;;AAsBA,IAAa,gBAAgB,EAAE,cAA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,GACf,oBAAC,MAAM,SAAP,EAAA,UACE,oBAAC,MAAM,MAAP;EACE,IAAI,IAAI,OAAO,UAAU;EACX;EACH;EACG;EACd,YAAY;EACZ,OAAO;EACP,UAAU;EACV,YAAY;EACZ,UAAU;YAEV,oBAAC,MAAM,SAAP;GAAe,UAAA;GAAS,SAAA;GAAQ,eAAY;aAC1C,oBAAC,MAAM,UAAP,EAAA,UACE,oBAAC,OAAO,OAAR;IAAc,YAAW;IAAqB;IAAc;IAAO,MAAM,MAAM;GAAU,CAAA,EAC3E,CAAA;EACH,CAAA;CACL,CAAA,EACC,CAAA,CACL,EAAA,CAAA;AAEhB;AAEA,IAAM,SAAS,SAA2B,KAAK;AAE/C,IAAM,0BAA0B,KAAK,QAAQ,eAC3C,KAAK,MAAM,QAAQ;CAEjB,OADiB,IAAI,IAAI,KAAK,UAAU,CACjC,CAAA,CAAS,QAAQ,KAAK,QAAQ,IAAI,IAAI,aAAa,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,aAAa;AACvF,CAAC,CACH;AAEA,aAAa,cAAc"}
@@ -1,16 +1,13 @@
1
- // src/meta.ts
2
1
  import { Plugin } from "@dxos/app-framework";
3
2
  import { DXN } from "@dxos/keys";
4
-
5
- // dx.config.ts
6
3
  import { Config2 } from "@dxos/app-framework/config";
7
4
  import { trim } from "@dxos/util";
8
- var dx_config_default = Config2.make({
9
- plugin: {
10
- key: "org.dxos.plugin.stack",
11
- name: "Stacks",
12
- author: "DXOS",
13
- description: trim`
5
+ //#region dx.config.ts
6
+ var dx_config_default = Config2.make({ plugin: {
7
+ key: "org.dxos.plugin.stack",
8
+ name: "Stacks",
9
+ author: "DXOS",
10
+ description: trim`
14
11
  The Stack plugin renders any Collection as a vertically scrollable stack of collapsible sections in the
15
12
  Composer article surface. Each section wraps an arbitrary ECHO object and delegates its content rendering
16
13
  to the section surface role, enabling any other plugin to contribute its own section renderer.
@@ -25,20 +22,16 @@ var dx_config_default = Config2.make({
25
22
  A settings panel exposes a separation toggle that controls whether visual dividers are rendered between
26
23
  sections.
27
24
  `,
28
- source: "https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-stack",
29
- icon: {
30
- key: "ph--stack-simple--regular"
31
- },
32
- spec: "PLUGIN.mdl"
33
- }
34
- });
35
-
36
- // src/meta.ts
25
+ source: "https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-stack",
26
+ icon: { key: "ph--stack-simple--regular" },
27
+ spec: "PLUGIN.mdl",
28
+ tags: ["alpha"]
29
+ } });
30
+ //#endregion
31
+ //#region src/meta.ts
37
32
  var SECTION_IDENTIFIER = DXN.make("org.dxos.type.stackSection");
38
33
  var meta = Plugin.getMetaFromConfig(dx_config_default);
34
+ //#endregion
35
+ export { meta as n, SECTION_IDENTIFIER as t };
39
36
 
40
- export {
41
- SECTION_IDENTIFIER,
42
- meta
43
- };
44
- //# sourceMappingURL=chunk-ZOIZTRMG.mjs.map
37
+ //# sourceMappingURL=chunk-meta.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk-meta.mjs","names":[],"sources":["../../dx.config.ts","../../src/meta.ts"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Config2 } from '@dxos/app-framework/config';\nimport { trim } from '@dxos/util';\n\nexport default Config2.make({\n plugin: {\n key: 'org.dxos.plugin.stack',\n name: 'Stacks',\n author: 'DXOS',\n description: trim`\n The Stack plugin renders any Collection as a vertically scrollable stack of collapsible sections in the\n Composer article surface. Each section wraps an arbitrary ECHO object and delegates its content rendering\n to the section surface role, enabling any other plugin to contribute its own section renderer.\n\n Sections can be individually collapsed to show only their title, expanded to reveal full content, navigated\n to directly, or removed from the collection. New sections can be inserted before or after any existing\n section via a per-section dropdown menu, or appended via the toolbar Add button.\n\n The plugin registers StackViewType with the ECHO schema module so that per-section view metadata\n (height overrides, custom display data) can be stored and replicated alongside the collection.\n\n A settings panel exposes a separation toggle that controls whether visual dividers are rendered between\n sections.\n `,\n source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-stack',\n icon: { key: 'ph--stack-simple--regular' },\n spec: 'PLUGIN.mdl',\n tags: ['alpha'],\n },\n});\n","//\n// Copyright 2023 DXOS.org\n//\n\nimport { Plugin } from '@dxos/app-framework';\nimport { DXN } from '@dxos/keys';\n\nimport config from '../dx.config';\n\nexport const SECTION_IDENTIFIER = DXN.make('org.dxos.type.stackSection');\n\nexport const meta = Plugin.getMetaFromConfig(config);\n"],"mappings":";;;;;AAOA,IAAA,oBAAe,QAAQ,KAAK,EAC1B,QAAQ;CACN,KAAK;CACL,MAAM;CACN,QAAQ;CACR,aAAa,IAAI;;;;;;;;;;;;;;;CAejB,QAAQ;CACR,MAAM,EAAE,KAAK,4BAA4B;CACzC,MAAM;CACN,MAAM,CAAC,OAAO;AAChB,EACF,CAAC;;;ACvBD,IAAa,qBAAqB,IAAI,KAAK,4BAA4B;AAEvE,IAAa,OAAO,OAAO,kBAAkB,iBAAM"}
@@ -0,0 +1,21 @@
1
+ import { Capabilities, Capability } from "@dxos/app-framework";
2
+ import { Collection } from "@dxos/echo";
3
+ import { Surface } from "@dxos/app-framework/ui";
4
+ import { AppSurface } from "@dxos/app-toolkit/ui";
5
+ import * as Effect from "effect/Effect";
6
+ import { StackArticle } from "#containers";
7
+ //#region src/capabilities/react-surface.ts
8
+ var react_surface_default = Capability.makeModule(() => Effect.succeed(Capability.contributes(Capabilities.ReactSurface, Surface.create({
9
+ id: "article",
10
+ filter: AppSurface.object(AppSurface.Article, Collection.Collection),
11
+ component: StackArticle,
12
+ props: ({ role, data: { subject, attendableId } }) => ({
13
+ role,
14
+ subject,
15
+ attendableId
16
+ })
17
+ }))));
18
+ //#endregion
19
+ export { react_surface_default as default };
20
+
21
+ //# sourceMappingURL=chunk-react-surface.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk-react-surface.mjs","names":[],"sources":["../../src/capabilities/react-surface.ts"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Capabilities, Capability } from '@dxos/app-framework';\nimport { Surface } from '@dxos/app-framework/ui';\nimport { AppSurface } from '@dxos/app-toolkit/ui';\nimport { Collection } from '@dxos/echo';\n\nimport { StackArticle } from '#containers';\n\nexport default Capability.makeModule(() =>\n Effect.succeed(\n Capability.contributes(\n Capabilities.ReactSurface,\n Surface.create({\n id: 'article',\n filter: AppSurface.object(AppSurface.Article, Collection.Collection),\n component: StackArticle,\n props: ({ role, data: { subject, attendableId } }) => ({ role, subject, attendableId }),\n }),\n ),\n ),\n);\n"],"mappings":";;;;;;;AAaA,IAAA,wBAAe,WAAW,iBACxB,OAAO,QACL,WAAW,YACT,aAAa,cACb,QAAQ,OAAO;CACb,IAAI;CACJ,QAAQ,WAAW,OAAO,WAAW,SAAS,WAAW,UAAU;CACnE,WAAW;CACX,QAAQ,EAAE,MAAM,MAAM,EAAE,SAAS,sBAAsB;EAAE;EAAM;EAAS;CAAa;AACvF,CAAC,CACH,CACF,CACF"}
@@ -0,0 +1,21 @@
1
+ import * as Schema from "effect/Schema";
2
+ import { DXN, Type } from "@dxos/echo";
3
+ //#region \0rolldown/runtime.js
4
+ var __defProp = Object.defineProperty;
5
+ var __exportAll = (all, no_symbols) => {
6
+ let target = {};
7
+ for (var name in all) __defProp(target, name, {
8
+ get: all[name],
9
+ enumerable: true
10
+ });
11
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
12
+ return target;
13
+ };
14
+ //#endregion
15
+ //#region src/types/Stack.ts
16
+ var Stack_exports = /* @__PURE__ */ __exportAll({ Stack: () => Stack });
17
+ var Stack = class extends Type.makeObject(DXN.make("org.dxos.type.stack", "0.1.0"))(Schema.Struct({})) {};
18
+ //#endregion
19
+ export { Stack_exports as t };
20
+
21
+ //# sourceMappingURL=chunk-types.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk-types.mjs","names":[],"sources":["../../src/types/Stack.ts"],"sourcesContent":["//\n// Copyright 2024 DXOS.org\n//\n\n// @import-as-namespace\n\nimport * as Schema from 'effect/Schema';\n\nimport { DXN, Type } from '@dxos/echo';\n\n// TODO(burdon): Placeholder.\nexport class Stack extends Type.makeObject<Stack>(DXN.make('org.dxos.type.stack', '0.1.0'))(Schema.Struct({})) {}\n"],"mappings":";;;;;;;;;;;;;;;;AAWA,IAAa,QAAb,cAA2B,KAAK,WAAkB,IAAI,KAAK,uBAAuB,OAAO,CAAC,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC"}
@@ -0,0 +1,242 @@
1
+ import { Obj } from "@dxos/echo";
2
+ import { GraphPath } from "@dxos/app-toolkit";
3
+ import { meta } from "#meta";
4
+ import { createContext, forwardRef, useCallback, useContext, useMemo, useState } from "react";
5
+ import { Surface } from "@dxos/app-framework/ui";
6
+ import { AppSurface, AttentionSigilButton } from "@dxos/app-toolkit/ui";
7
+ import { DropdownMenu, Icon, ScrollArea, useTranslation } from "@dxos/react-ui";
8
+ import { useAttentionAttributes } from "@dxos/react-ui-attention";
9
+ import { Mosaic } from "@dxos/react-ui-mosaic";
10
+ import { jsx, jsxs } from "react/jsx-runtime";
11
+ //#region src/components/Stack/StackContext.ts
12
+ var StackContext = createContext(void 0);
13
+ var useStackContext = (consumer) => {
14
+ const context = useContext(StackContext);
15
+ if (!context) throw new Error(`\`${consumer}\` must be used within \`Stack.Root\`.`);
16
+ return context;
17
+ };
18
+ /** Section-level callbacks consumed by stack sections. */
19
+ var useStack = () => useStackContext("useStack");
20
+ //#endregion
21
+ //#region src/components/Stack/Stack.tsx
22
+ var StackRoot = ({ id, eventHandler, children, attendableId, collapsed, onCollapse, onAdd, onMoveUp, onMoveDown, onDelete }) => {
23
+ const [viewport, setViewport] = useState(null);
24
+ const value = useMemo(() => ({
25
+ id,
26
+ eventHandler: eventHandler ?? {
27
+ id,
28
+ canDrop: () => false
29
+ },
30
+ viewport,
31
+ setViewport,
32
+ attendableId,
33
+ collapsed,
34
+ onCollapse,
35
+ onAdd,
36
+ onMoveUp,
37
+ onMoveDown,
38
+ onDelete
39
+ }), [
40
+ id,
41
+ eventHandler,
42
+ viewport,
43
+ attendableId,
44
+ collapsed,
45
+ onCollapse,
46
+ onAdd,
47
+ onMoveUp,
48
+ onMoveDown,
49
+ onDelete
50
+ ]);
51
+ return /* @__PURE__ */ jsx(StackContext.Provider, {
52
+ value,
53
+ children
54
+ });
55
+ };
56
+ StackRoot.displayName = "Stack.Root";
57
+ var StackContent = forwardRef(({ children, ...props }, forwardedRef) => {
58
+ const { eventHandler, viewport } = useStackContext("Stack.Content");
59
+ return /* @__PURE__ */ jsx(Mosaic.Container, {
60
+ asChild: true,
61
+ orientation: "vertical",
62
+ autoScroll: viewport,
63
+ eventHandler,
64
+ children: /* @__PURE__ */ jsx(ScrollArea.Root, {
65
+ ...props,
66
+ orientation: "vertical",
67
+ ref: forwardedRef,
68
+ children
69
+ })
70
+ });
71
+ });
72
+ StackContent.displayName = "Stack.Content";
73
+ var StackViewport = forwardRef(({ classNames, children }, forwardedRef) => {
74
+ const { setViewport } = useStackContext("Stack.Viewport");
75
+ const setRefs = useCallback((element) => {
76
+ setViewport(element);
77
+ if (typeof forwardedRef === "function") forwardedRef(element);
78
+ else if (forwardedRef) forwardedRef.current = element;
79
+ }, [setViewport, forwardedRef]);
80
+ return /* @__PURE__ */ jsx(ScrollArea.Viewport, {
81
+ classNames,
82
+ ref: setRefs,
83
+ children
84
+ });
85
+ });
86
+ StackViewport.displayName = "Stack.Viewport";
87
+ /**
88
+ * A stack section rendered as a Mosaic tile: a 40px left rail (drag handle + section menu) beside the
89
+ * main content area, which renders the object's content surface (or its title when collapsed). The
90
+ * rail sticks to the top of the scroll viewport while the section is in view.
91
+ */
92
+ var DragHandleGlyph = () => /* @__PURE__ */ jsx("svg", {
93
+ width: 10,
94
+ height: 16,
95
+ viewBox: "0 0 10 16",
96
+ "aria-hidden": true,
97
+ className: "shrink-0 text-description",
98
+ children: [
99
+ 3,
100
+ 8,
101
+ 13
102
+ ].flatMap((cy) => [2.5, 7.5].map((cx) => /* @__PURE__ */ jsx("circle", {
103
+ cx,
104
+ cy,
105
+ r: 1.1,
106
+ fill: "currentColor"
107
+ }, `${cx}-${cy}`)))
108
+ });
109
+ var StackSection = ({ data, ...tileProps }) => {
110
+ const { id, object } = data;
111
+ const { t } = useTranslation(meta.profile.key);
112
+ const { attendableId: parentAttendableId, collapsed, onAdd, onMoveUp, onMoveDown, onCollapse, onDelete } = useStack();
113
+ const [optionsMenuOpen, setOptionsMenuOpen] = useState(false);
114
+ const attendableId = GraphPath.getCollectionObjectPath(parentAttendableId, object.id);
115
+ const attentionAttrs = useAttentionAttributes(attendableId);
116
+ const surfaceData = useMemo(() => ({
117
+ attendableId,
118
+ subject: object
119
+ }), [object, attendableId]);
120
+ const isCollapsed = collapsed.has(id);
121
+ const icon = Obj.getIcon(object)?.icon ?? "ph--circle-dashed--regular";
122
+ const title = Obj.getLabel(object, { fallback: "typename" }) ?? t("untitled-section.title");
123
+ const rail = /* @__PURE__ */ jsxs("div", {
124
+ className: "grid grid-rows-[min-content_1fr]",
125
+ children: [/* @__PURE__ */ jsx("div", {
126
+ className: "p-1 dx-toolbar-surface",
127
+ children: /* @__PURE__ */ jsxs(DropdownMenu.Root, {
128
+ open: optionsMenuOpen,
129
+ onOpenChange: setOptionsMenuOpen,
130
+ children: [/* @__PURE__ */ jsx(DropdownMenu.Trigger, {
131
+ asChild: true,
132
+ children: /* @__PURE__ */ jsx(AttentionSigilButton, {
133
+ size: "md",
134
+ attendableId,
135
+ children: /* @__PURE__ */ jsx(Icon, {
136
+ icon,
137
+ classNames: "transition-opacity"
138
+ })
139
+ })
140
+ }), /* @__PURE__ */ jsx(DropdownMenu.Portal, { children: /* @__PURE__ */ jsxs(DropdownMenu.Content, { children: [/* @__PURE__ */ jsxs(DropdownMenu.Viewport, { children: [
141
+ isCollapsed ? /* @__PURE__ */ jsxs(DropdownMenu.Item, {
142
+ onClick: () => onCollapse(id, false),
143
+ "data-testid": "section.expand",
144
+ children: [/* @__PURE__ */ jsx(Icon, { icon: "ph--arrows-out-line-vertical--regular" }), /* @__PURE__ */ jsx("span", {
145
+ className: "ms-2 grow",
146
+ children: t("expand.label")
147
+ })]
148
+ }) : /* @__PURE__ */ jsxs(DropdownMenu.Item, {
149
+ onClick: () => onCollapse(id, true),
150
+ "data-testid": "section.collapse",
151
+ children: [/* @__PURE__ */ jsx(Icon, { icon: "ph--arrows-in-line-vertical--regular" }), /* @__PURE__ */ jsx("span", {
152
+ className: "ms-2 grow",
153
+ children: t("collapse.label")
154
+ })]
155
+ }),
156
+ /* @__PURE__ */ jsx(DropdownMenu.Separator, {}),
157
+ /* @__PURE__ */ jsxs(DropdownMenu.Item, {
158
+ onClick: () => onAdd(id),
159
+ "data-testid": "section.add",
160
+ children: [/* @__PURE__ */ jsx(Icon, { icon: "ph--plus--regular" }), /* @__PURE__ */ jsx("span", {
161
+ className: "ms-2 grow",
162
+ children: t("add-section.label")
163
+ })]
164
+ }),
165
+ /* @__PURE__ */ jsxs(DropdownMenu.Item, {
166
+ onClick: () => onMoveUp(id),
167
+ "data-testid": "section.move-up",
168
+ children: [/* @__PURE__ */ jsx(Icon, { icon: "ph--arrow-line-up--regular" }), /* @__PURE__ */ jsx("span", {
169
+ className: "ms-2 grow",
170
+ children: t("move-up.label")
171
+ })]
172
+ }),
173
+ /* @__PURE__ */ jsxs(DropdownMenu.Item, {
174
+ onClick: () => onMoveDown(id),
175
+ "data-testid": "section.move-down",
176
+ children: [/* @__PURE__ */ jsx(Icon, { icon: "ph--arrow-line-down--regular" }), /* @__PURE__ */ jsx("span", {
177
+ className: "ms-2 grow",
178
+ children: t("move-down.label")
179
+ })]
180
+ }),
181
+ /* @__PURE__ */ jsx(DropdownMenu.Separator, {}),
182
+ /* @__PURE__ */ jsxs(DropdownMenu.Item, {
183
+ onClick: () => onDelete(id),
184
+ "data-testid": "section.remove",
185
+ children: [/* @__PURE__ */ jsx(Icon, { icon: "ph--trash--regular" }), /* @__PURE__ */ jsx("span", {
186
+ className: "ms-2 grow",
187
+ children: t("remove-section.label")
188
+ })]
189
+ })
190
+ ] }), /* @__PURE__ */ jsx(DropdownMenu.Arrow, {})] }) })]
191
+ })
192
+ }), /* @__PURE__ */ jsx("div", {
193
+ className: "p-1",
194
+ children: /* @__PURE__ */ jsx(Mosaic.DragHandle, {
195
+ label: t("drag-handle.label"),
196
+ classNames: "p-1 min-h-0 w-(--dx-rail-item) h-(--dx-rail-item)",
197
+ testId: "section.drag-handle",
198
+ children: /* @__PURE__ */ jsx(DragHandleGlyph, {})
199
+ })
200
+ })]
201
+ });
202
+ return /* @__PURE__ */ jsxs(Mosaic.Tile, {
203
+ ...tileProps,
204
+ data,
205
+ classNames: "grid grid-cols-[var(--dx-rail-action)_1fr] dx-attention-surface border border-subdued-separator",
206
+ children: [/* @__PURE__ */ jsx("div", {
207
+ className: "border-e border-subdued-separator",
208
+ children: /* @__PURE__ */ jsx("div", {
209
+ className: "sticky top-0 flex flex-col items-center",
210
+ children: rail
211
+ })
212
+ }), /* @__PURE__ */ jsxs("div", {
213
+ ...attentionAttrs,
214
+ className: "min-w-0",
215
+ children: [/* @__PURE__ */ jsx("span", {
216
+ className: "sr-only",
217
+ children: title
218
+ }), isCollapsed ? /* @__PURE__ */ jsx("div", {
219
+ className: "h-(--dx-toolbar-size) flex p-1",
220
+ children: /* @__PURE__ */ jsx("h2", {
221
+ className: "flex items-center font-medium",
222
+ children: title
223
+ })
224
+ }) : /* @__PURE__ */ jsx(Surface.Surface, {
225
+ type: AppSurface.Section,
226
+ data: surfaceData,
227
+ limit: 1
228
+ })]
229
+ })]
230
+ });
231
+ };
232
+ StackSection.displayName = "Stack.Section";
233
+ var Stack = {
234
+ Root: StackRoot,
235
+ Content: StackContent,
236
+ Viewport: StackViewport,
237
+ Section: StackSection
238
+ };
239
+ //#endregion
240
+ export { Stack, useStack };
241
+
242
+ //# sourceMappingURL=components.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"components.mjs","names":[],"sources":["../../src/components/Stack/StackContext.ts","../../src/components/Stack/Stack.tsx"],"sourcesContent":["//\n// Copyright 2024 DXOS.org\n//\n\nimport { createContext, useContext } from 'react';\n\nimport { type StackContextType, type StackContextValue } from './Stack';\n\n// Kept out of `Stack.tsx`: react-refresh only fast-refreshes a module whose exports are all\n// components, so a context and its hook exported beside them force a full page reload on every edit.\n\nexport const StackContext = createContext<StackContextType | undefined>(undefined);\n\nexport const useStackContext = (consumer: string): StackContextType => {\n const context = useContext(StackContext);\n if (!context) {\n throw new Error(`\\`${consumer}\\` must be used within \\`Stack.Root\\`.`);\n }\n return context;\n};\n\n/** Section-level callbacks consumed by stack sections. */\nexport const useStack = (): StackContextValue => useStackContext('useStack');\n","//\n// Copyright 2024 DXOS.org\n//\n\nimport React, {\n type ComponentPropsWithoutRef,\n type ForwardedRef,\n type PropsWithChildren,\n forwardRef,\n useCallback,\n useMemo,\n useState,\n} from 'react';\n\nimport { Surface } from '@dxos/app-framework/ui';\nimport { GraphPath } from '@dxos/app-toolkit';\nimport { AppSurface, AttentionSigilButton } from '@dxos/app-toolkit/ui';\nimport { Obj } from '@dxos/echo';\nimport {\n DropdownMenu,\n Icon,\n ScrollArea,\n ScrollAreaRootProps,\n type ThemedClassName,\n useTranslation,\n} from '@dxos/react-ui';\nimport { useAttentionAttributes } from '@dxos/react-ui-attention';\nimport { type DndContainerHandler } from '@dxos/react-ui-dnd';\nimport { Mosaic, type MosaicTileProps } from '@dxos/react-ui-mosaic';\n\nimport { meta } from '#meta';\n\nimport { StackContext, useStack, useStackContext } from './StackContext';\n\n//\n// Types\n//\n\nexport type StackSectionItem = {\n id: string;\n object: Obj.Unknown;\n};\n\n//\n// Context\n//\n\n/** Section-level callbacks consumed by stack sections. */\nexport type StackContextValue = {\n attendableId: string;\n /** Ids of sections that are currently collapsed. */\n collapsed: ReadonlySet<string>;\n onCollapse: (id: string, collapsed: boolean) => void;\n /** Add a new section immediately after the given section. */\n onAdd: (id: string) => void;\n onMoveUp: (id: string) => void;\n onMoveDown: (id: string) => void;\n onDelete: (id: string) => void;\n};\n\nexport type StackContextType = StackContextValue & {\n /** Container id used to scope Mosaic drag/drop. */\n id: string;\n eventHandler: DndContainerHandler;\n /** Scroll viewport element; threaded to the Mosaic container for autoscroll. */\n viewport: HTMLElement | null;\n setViewport: (element: HTMLElement | null) => void;\n};\n\n//\n// Root\n//\n\ntype StackRootProps = PropsWithChildren<\n StackContextValue & {\n /** Container id used to scope Mosaic drag/drop. */\n id: string;\n /** Drag/drop event handler; defaults to a read-only (no-drop) handler. */\n eventHandler?: DndContainerHandler;\n }\n>;\n\nconst StackRoot = ({\n id,\n eventHandler,\n children,\n attendableId,\n collapsed,\n onCollapse,\n onAdd,\n onMoveUp,\n onMoveDown,\n onDelete,\n}: StackRootProps) => {\n const [viewport, setViewport] = useState<HTMLElement | null>(null);\n const value = useMemo<StackContextType>(\n () => ({\n id,\n eventHandler: eventHandler ?? { id, canDrop: () => false },\n viewport,\n setViewport,\n attendableId,\n collapsed,\n onCollapse,\n onAdd,\n onMoveUp,\n onMoveDown,\n onDelete,\n }),\n [id, eventHandler, viewport, attendableId, collapsed, onCollapse, onAdd, onMoveUp, onMoveDown, onDelete],\n );\n\n return <StackContext.Provider value={value}>{children}</StackContext.Provider>;\n};\n\nStackRoot.displayName = 'Stack.Root';\n\n//\n// Content\n//\n\ntype StackContentProps = ThemedClassName<\n ComponentPropsWithoutRef<'div'> & Pick<ScrollAreaRootProps, 'centered' | 'thin' | 'padding'>\n>;\n\nconst StackContent = forwardRef<HTMLDivElement, StackContentProps>(({ children, ...props }, forwardedRef) => {\n const { eventHandler, viewport } = useStackContext('Stack.Content');\n return (\n <Mosaic.Container asChild orientation='vertical' autoScroll={viewport} eventHandler={eventHandler}>\n <ScrollArea.Root {...props} orientation='vertical' ref={forwardedRef}>\n {children}\n </ScrollArea.Root>\n </Mosaic.Container>\n );\n});\n\nStackContent.displayName = 'Stack.Content';\n\n//\n// Viewport\n//\n\ntype StackViewportProps = ThemedClassName<PropsWithChildren>;\n\nconst StackViewport = forwardRef<HTMLDivElement, StackViewportProps>(\n ({ classNames, children }, forwardedRef: ForwardedRef<HTMLDivElement>) => {\n const { setViewport } = useStackContext('Stack.Viewport');\n // Capture the viewport element for autoscroll while still honouring a forwarded ref.\n const setRefs = useCallback(\n (element: HTMLDivElement | null) => {\n setViewport(element);\n if (typeof forwardedRef === 'function') {\n forwardedRef(element);\n } else if (forwardedRef) {\n forwardedRef.current = element;\n }\n },\n [setViewport, forwardedRef],\n );\n\n return (\n <ScrollArea.Viewport classNames={classNames} ref={setRefs}>\n {children}\n </ScrollArea.Viewport>\n );\n },\n);\n\nStackViewport.displayName = 'Stack.Viewport';\n\n//\n// Section\n//\n\ntype StackSectionProps = MosaicTileProps<StackSectionItem>;\n\n/**\n * A stack section rendered as a Mosaic tile: a 40px left rail (drag handle + section menu) beside the\n * main content area, which renders the object's content surface (or its title when collapsed). The\n * rail sticks to the top of the scroll viewport while the section is in view.\n */\n// TODO(burdon): All sections are intrinsic (content-sized) for now. Extrinsic content (e.g. a sketch\n// with no intrinsic height) should later get a Mosaic-native resizable height affordance.\n\n// Inline grip glyph for the drag preview. The native drag image does not rasterize external SVG sprite\n// `<use>` icons (e.g. `@dxos/react-ui` `Icon`), so the preview uses plain inline SVG circles instead.\nconst DragHandleGlyph = () => (\n <svg width={10} height={16} viewBox='0 0 10 16' aria-hidden className='shrink-0 text-description'>\n {[3, 8, 13].flatMap((cy) =>\n [2.5, 7.5].map((cx) => <circle key={`${cx}-${cy}`} cx={cx} cy={cy} r={1.1} fill='currentColor' />),\n )}\n </svg>\n);\n\nconst StackSection = ({ data, ...tileProps }: StackSectionProps) => {\n const { id, object } = data;\n const { t } = useTranslation(meta.profile.key);\n const { attendableId: parentAttendableId, collapsed, onAdd, onMoveUp, onMoveDown, onCollapse, onDelete } = useStack();\n const [optionsMenuOpen, setOptionsMenuOpen] = useState(false);\n const attendableId = GraphPath.getCollectionObjectPath(parentAttendableId, object.id);\n const attentionAttrs = useAttentionAttributes(attendableId);\n const surfaceData = useMemo(() => ({ attendableId, subject: object }), [object, attendableId]);\n const isCollapsed = collapsed.has(id);\n const icon = Obj.getIcon(object)?.icon ?? 'ph--circle-dashed--regular';\n const title = Obj.getLabel(object, { fallback: 'typename' }) ?? t('untitled-section.title');\n\n const rail = (\n <div className='grid grid-rows-[min-content_1fr]'>\n <div className='p-1 dx-toolbar-surface'>\n <DropdownMenu.Root open={optionsMenuOpen} onOpenChange={setOptionsMenuOpen}>\n <DropdownMenu.Trigger asChild>\n <AttentionSigilButton size='md' attendableId={attendableId}>\n <Icon icon={icon} classNames='transition-opacity' />\n </AttentionSigilButton>\n </DropdownMenu.Trigger>\n <DropdownMenu.Portal>\n <DropdownMenu.Content>\n <DropdownMenu.Viewport>\n {isCollapsed ? (\n <DropdownMenu.Item onClick={() => onCollapse(id, false)} data-testid='section.expand'>\n <Icon icon='ph--arrows-out-line-vertical--regular' />\n <span className='ms-2 grow'>{t('expand.label')}</span>\n </DropdownMenu.Item>\n ) : (\n <DropdownMenu.Item onClick={() => onCollapse(id, true)} data-testid='section.collapse'>\n <Icon icon='ph--arrows-in-line-vertical--regular' />\n <span className='ms-2 grow'>{t('collapse.label')}</span>\n </DropdownMenu.Item>\n )}\n <DropdownMenu.Separator />\n <DropdownMenu.Item onClick={() => onAdd(id)} data-testid='section.add'>\n <Icon icon='ph--plus--regular' />\n <span className='ms-2 grow'>{t('add-section.label')}</span>\n </DropdownMenu.Item>\n <DropdownMenu.Item onClick={() => onMoveUp(id)} data-testid='section.move-up'>\n <Icon icon='ph--arrow-line-up--regular' />\n <span className='ms-2 grow'>{t('move-up.label')}</span>\n </DropdownMenu.Item>\n <DropdownMenu.Item onClick={() => onMoveDown(id)} data-testid='section.move-down'>\n <Icon icon='ph--arrow-line-down--regular' />\n <span className='ms-2 grow'>{t('move-down.label')}</span>\n </DropdownMenu.Item>\n <DropdownMenu.Separator />\n <DropdownMenu.Item onClick={() => onDelete(id)} data-testid='section.remove'>\n <Icon icon='ph--trash--regular' />\n <span className='ms-2 grow'>{t('remove-section.label')}</span>\n </DropdownMenu.Item>\n </DropdownMenu.Viewport>\n <DropdownMenu.Arrow />\n </DropdownMenu.Content>\n </DropdownMenu.Portal>\n </DropdownMenu.Root>\n </div>\n <div className='p-1'>\n {/* Inline glyph (not a sprite `Icon`) so the handle stays visible in the tile's native drag image. */}\n <Mosaic.DragHandle\n label={t('drag-handle.label')}\n classNames='p-1 min-h-0 w-(--dx-rail-item) h-(--dx-rail-item)'\n testId='section.drag-handle'\n >\n <DragHandleGlyph />\n </Mosaic.DragHandle>\n </div>\n </div>\n );\n\n return (\n <Mosaic.Tile\n {...tileProps}\n data={data}\n classNames='grid grid-cols-[var(--dx-rail-action)_1fr] dx-attention-surface border border-subdued-separator'\n >\n <div className='border-e border-subdued-separator'>\n <div className='sticky top-0 flex flex-col items-center'>{rail}</div>\n </div>\n <div {...attentionAttrs} className='min-w-0'>\n <span className='sr-only'>{title}</span>\n {isCollapsed ? (\n <div className='h-(--dx-toolbar-size) flex p-1'>\n <h2 className='flex items-center font-medium'>{title}</h2>\n </div>\n ) : (\n <Surface.Surface type={AppSurface.Section} data={surfaceData} limit={1} />\n )}\n </div>\n </Mosaic.Tile>\n );\n};\n\nStackSection.displayName = 'Stack.Section';\n\n//\n// Stack\n//\n\nexport const Stack = {\n Root: StackRoot,\n Content: StackContent,\n Viewport: StackViewport,\n Section: StackSection,\n};\n\nexport type { StackContentProps, StackRootProps, StackSectionProps, StackViewportProps };\n"],"mappings":";;;;;;;;;;;AAWA,IAAa,eAAe,cAA4C,KAAA,CAAS;AAEjF,IAAa,mBAAmB,aAAuC;CACrE,MAAM,UAAU,WAAW,YAAY;CACvC,IAAI,CAAC,SACH,MAAM,IAAI,MAAM,KAAK,SAAS,uCAAuC;CAEvE,OAAO;AACT;;AAGA,IAAa,iBAAoC,gBAAgB,UAAU;;;AC4D3E,IAAM,aAAa,EACjB,IACA,c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