@dxos/plugin-stack 0.9.1-main.c7dcc2e112 → 0.10.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 (88) hide show
  1. package/dist/lib/neutral/StackArticle-DDKRSUE7.mjs +199 -0
  2. package/dist/lib/neutral/StackArticle-DDKRSUE7.mjs.map +7 -0
  3. package/dist/lib/neutral/StackPlugin.mjs +4 -2
  4. package/dist/lib/neutral/StackPlugin.mjs.map +3 -3
  5. package/dist/lib/neutral/capabilities/index.mjs +3 -1
  6. package/dist/lib/neutral/capabilities/index.mjs.map +1 -1
  7. package/dist/lib/neutral/chunk-FDNICBZZ.mjs +18 -0
  8. package/dist/lib/neutral/chunk-FDNICBZZ.mjs.map +7 -0
  9. package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
  10. package/dist/lib/neutral/chunk-J5LGTIGS.mjs.map +7 -0
  11. package/dist/lib/neutral/{chunk-CTWUHXK5.mjs → chunk-ZOIZTRMG.mjs} +3 -5
  12. package/dist/lib/neutral/chunk-ZOIZTRMG.mjs.map +7 -0
  13. package/dist/lib/neutral/components/index.mjs +188 -145
  14. package/dist/lib/neutral/components/index.mjs.map +4 -4
  15. package/dist/lib/neutral/containers/index.mjs +3 -1
  16. package/dist/lib/neutral/containers/index.mjs.map +1 -1
  17. package/dist/lib/neutral/index.mjs +5 -6
  18. package/dist/lib/neutral/meta.json +1 -1
  19. package/dist/lib/neutral/meta.mjs +2 -1
  20. package/dist/lib/neutral/plugin.mjs +2 -1
  21. package/dist/lib/neutral/plugin.mjs.map +1 -1
  22. package/dist/lib/neutral/{react-surface-MD3CVY2N.mjs → react-surface-IL4CW7ND.mjs} +3 -1
  23. package/dist/lib/neutral/{react-surface-MD3CVY2N.mjs.map → react-surface-IL4CW7ND.mjs.map} +1 -1
  24. package/dist/lib/neutral/translations.mjs +8 -6
  25. package/dist/lib/neutral/translations.mjs.map +3 -3
  26. package/dist/lib/neutral/types/index.mjs +4 -5
  27. package/dist/types/src/capabilities/react-surface.d.ts +1 -1
  28. package/dist/types/src/components/Stack/Stack.d.ts +67 -0
  29. package/dist/types/src/components/Stack/Stack.d.ts.map +1 -0
  30. package/dist/types/src/components/Stack/index.d.ts +2 -0
  31. package/dist/types/src/components/Stack/index.d.ts.map +1 -0
  32. package/dist/types/src/components/index.d.ts +1 -3
  33. package/dist/types/src/components/index.d.ts.map +1 -1
  34. package/dist/types/src/containers/StackArticle/StackArticle.d.ts +1 -2
  35. package/dist/types/src/containers/StackArticle/StackArticle.d.ts.map +1 -1
  36. package/dist/types/src/containers/StackArticle/StackArticle.stories.d.ts +7 -0
  37. package/dist/types/src/containers/StackArticle/StackArticle.stories.d.ts.map +1 -0
  38. package/dist/types/src/meta.d.ts +4 -0
  39. package/dist/types/src/meta.d.ts.map +1 -1
  40. package/dist/types/src/translations.d.ts +5 -16
  41. package/dist/types/src/translations.d.ts.map +1 -1
  42. package/dist/types/src/types/Stack.d.ts +6 -0
  43. package/dist/types/src/types/Stack.d.ts.map +1 -0
  44. package/dist/types/src/types/index.d.ts +1 -2
  45. package/dist/types/src/types/index.d.ts.map +1 -1
  46. package/dist/types/tsconfig.tsbuildinfo +1 -1
  47. package/dx.config.ts +2 -4
  48. package/package.json +33 -28
  49. package/src/StackPlugin.ts +2 -2
  50. package/src/components/Stack/Stack.tsx +319 -0
  51. package/src/components/{StackContext → Stack}/index.ts +1 -1
  52. package/src/components/index.ts +1 -3
  53. package/src/containers/StackArticle/StackArticle.stories.tsx +122 -0
  54. package/src/containers/StackArticle/StackArticle.tsx +180 -118
  55. package/src/translations.ts +5 -5
  56. package/src/types/Stack.ts +12 -0
  57. package/src/types/index.ts +1 -2
  58. package/dist/lib/neutral/StackArticle-SBM3FBJM.mjs +0 -124
  59. package/dist/lib/neutral/StackArticle-SBM3FBJM.mjs.map +0 -7
  60. package/dist/lib/neutral/chunk-CTWUHXK5.mjs.map +0 -7
  61. package/dist/lib/neutral/chunk-T4NSFSPH.mjs +0 -24
  62. package/dist/lib/neutral/chunk-T4NSFSPH.mjs.map +0 -7
  63. package/dist/types/src/components/StackContext/StackContext.d.ts +0 -11
  64. package/dist/types/src/components/StackContext/StackContext.d.ts.map +0 -1
  65. package/dist/types/src/components/StackContext/index.d.ts +0 -2
  66. package/dist/types/src/components/StackContext/index.d.ts.map +0 -1
  67. package/dist/types/src/components/StackSection/CaretDownUp.d.ts +0 -3
  68. package/dist/types/src/components/StackSection/CaretDownUp.d.ts.map +0 -1
  69. package/dist/types/src/components/StackSection/StackSection.d.ts +0 -5
  70. package/dist/types/src/components/StackSection/StackSection.d.ts.map +0 -1
  71. package/dist/types/src/components/StackSection/index.d.ts +0 -2
  72. package/dist/types/src/components/StackSection/index.d.ts.map +0 -1
  73. package/dist/types/src/components/StackSettings/StackSettings.d.ts +0 -6
  74. package/dist/types/src/components/StackSettings/StackSettings.d.ts.map +0 -1
  75. package/dist/types/src/components/StackSettings/index.d.ts +0 -2
  76. package/dist/types/src/components/StackSettings/index.d.ts.map +0 -1
  77. package/dist/types/src/types/stack.d.ts +0 -18
  78. package/dist/types/src/types/stack.d.ts.map +0 -1
  79. package/dist/types/src/types/types.d.ts +0 -44
  80. package/dist/types/src/types/types.d.ts.map +0 -1
  81. package/src/components/StackContext/StackContext.tsx +0 -25
  82. package/src/components/StackSection/CaretDownUp.tsx +0 -30
  83. package/src/components/StackSection/StackSection.tsx +0 -124
  84. package/src/components/StackSection/index.ts +0 -5
  85. package/src/components/StackSettings/StackSettings.tsx +0 -28
  86. package/src/components/StackSettings/index.ts +0 -5
  87. package/src/types/stack.ts +0 -26
  88. package/src/types/types.ts +0 -46
@@ -0,0 +1,199 @@
1
+ import "./chunk-J5LGTIGS.mjs";
2
+
3
+ // src/containers/StackArticle/StackArticle.tsx
4
+ import { Atom, useAtomValue } from "@effect-atom/atom-react";
5
+ import React, { useCallback, useMemo, useState } from "react";
6
+ import { useOperationInvoker } from "@dxos/app-framework/ui";
7
+ import { Obj } from "@dxos/echo";
8
+ import { SpaceOperation } from "@dxos/plugin-space";
9
+ import { Panel, Toolbar, useTranslation } from "@dxos/react-ui";
10
+ import { Menu, createMenuAction } from "@dxos/react-ui-menu";
11
+ import { Mosaic } from "@dxos/react-ui-mosaic";
12
+ import { arrayMove, isNonNullable } from "@dxos/util";
13
+ import { Stack } from "#components";
14
+ import { meta } from "#meta";
15
+ var StackArticle = ({ attendableId, subject: collection }) => {
16
+ const { invokePromise } = useOperationInvoker();
17
+ const { t } = useTranslation(meta.profile.key);
18
+ const [collapsedSections, setCollapsedSections] = useState({});
19
+ const collectionObjects = useAtomValue(createCollectionObjects(collection));
20
+ const items = useMemo(() => collectionObjects.map((object) => ({
21
+ id: Obj.getURI(object),
22
+ object
23
+ })), [
24
+ collectionObjects
25
+ ]);
26
+ const collapsed = useMemo(() => new Set(Object.keys(collapsedSections).filter((id) => collapsedSections[id])), [
27
+ collapsedSections
28
+ ]);
29
+ const findIndex = useCallback((id) => collection.objects.findIndex((ref) => ref.target != null && Obj.getURI(ref.target) === id), [
30
+ collection
31
+ ]);
32
+ const eventHandler = useMemo(() => ({
33
+ id: Obj.getURI(collection),
34
+ canDrop: ({ source }) => collection.objects.some((ref) => ref.target != null && Obj.getURI(ref.target) === source.id),
35
+ onDrop: ({ source, target }) => {
36
+ const to = target?.type === "tile" || target?.type === "placeholder" ? target.location : target?.type === "container" ? collection.objects.length : -1;
37
+ const insert = typeof to === "number" && to >= 0 ? Math.floor(to) : -1;
38
+ if (insert < 0) {
39
+ return;
40
+ }
41
+ Obj.update(collection, (collection2) => {
42
+ const from = findIndex(source.id);
43
+ if (from !== -1) {
44
+ arrayMove(collection2.objects, from, insert);
45
+ }
46
+ });
47
+ }
48
+ }), [
49
+ collection,
50
+ findIndex
51
+ ]);
52
+ const handleMoveUp = useCallback((id) => {
53
+ const index = findIndex(id);
54
+ if (index > 0) {
55
+ Obj.update(collection, (collection2) => {
56
+ const [ref] = collection2.objects.splice(index, 1);
57
+ collection2.objects.splice(index - 1, 0, ref);
58
+ });
59
+ }
60
+ }, [
61
+ collection,
62
+ findIndex
63
+ ]);
64
+ const handleMoveDown = useCallback((id) => {
65
+ const index = findIndex(id);
66
+ if (index >= 0 && index < collection.objects.length - 1) {
67
+ Obj.update(collection, (collection2) => {
68
+ const [ref] = collection2.objects.splice(index, 1);
69
+ collection2.objects.splice(index + 1, 0, ref);
70
+ });
71
+ }
72
+ }, [
73
+ collection,
74
+ findIndex
75
+ ]);
76
+ const handleDelete = useCallback((id) => {
77
+ const index = findIndex(id);
78
+ if (index >= 0) {
79
+ Obj.update(collection, (collection2) => {
80
+ collection2.objects.splice(index, 1);
81
+ });
82
+ }
83
+ }, [
84
+ collection,
85
+ findIndex
86
+ ]);
87
+ const handleAdd = useCallback((id) => invokePromise(SpaceOperation.OpenCreateObject, {
88
+ target: collection,
89
+ navigable: false,
90
+ // The created object is appended; move it to immediately after the originating section.
91
+ onCreateObject: (object) => {
92
+ const from = findIndex(Obj.getURI(object));
93
+ const anchor = findIndex(id);
94
+ if (from >= 0 && anchor >= 0) {
95
+ Obj.update(collection, (collection2) => {
96
+ const [ref] = collection2.objects.splice(from, 1);
97
+ collection2.objects.splice(anchor < from ? anchor + 1 : anchor, 0, ref);
98
+ });
99
+ }
100
+ }
101
+ }), [
102
+ collection,
103
+ invokePromise,
104
+ findIndex
105
+ ]);
106
+ const handleCollapse = useCallback((id, value) => setCollapsedSections((prev) => ({
107
+ ...prev,
108
+ [id]: value
109
+ })), []);
110
+ const handleCollapseAll = useCallback(() => setCollapsedSections(Object.fromEntries(collectionObjects.map((object) => [
111
+ Obj.getURI(object),
112
+ true
113
+ ]))), [
114
+ collectionObjects
115
+ ]);
116
+ const handleExpandAll = useCallback(() => setCollapsedSections({}), []);
117
+ const optionsMenu = useMemo(() => [
118
+ createMenuAction("collapse-all", handleCollapseAll, {
119
+ label: [
120
+ "collapse-all.label",
121
+ {
122
+ ns: meta.profile.key
123
+ }
124
+ ],
125
+ icon: "ph--arrows-in-line-vertical--regular",
126
+ testId: "stack.collapse-all"
127
+ }),
128
+ createMenuAction("expand-all", handleExpandAll, {
129
+ label: [
130
+ "expand-all.label",
131
+ {
132
+ ns: meta.profile.key
133
+ }
134
+ ],
135
+ icon: "ph--arrows-out-line-vertical--regular",
136
+ testId: "stack.expand-all"
137
+ })
138
+ ], [
139
+ handleCollapseAll,
140
+ handleExpandAll
141
+ ]);
142
+ const handleAddSection = useCallback(() => invokePromise(SpaceOperation.OpenCreateObject, {
143
+ target: collection,
144
+ navigable: false
145
+ }), [
146
+ collection,
147
+ invokePromise
148
+ ]);
149
+ return /* @__PURE__ */ React.createElement(Panel.Root, null, /* @__PURE__ */ React.createElement(Panel.Toolbar, {
150
+ classNames: "bg-toolbar-surface"
151
+ }, /* @__PURE__ */ React.createElement(Toolbar.Root, {
152
+ classNames: "dx-document"
153
+ }, /* @__PURE__ */ React.createElement(Toolbar.IconButton, {
154
+ square: true,
155
+ icon: "ph--plus--regular",
156
+ iconOnly: true,
157
+ label: t("add-section.label"),
158
+ "data-testid": "stack.addSection",
159
+ onClick: handleAddSection
160
+ }), /* @__PURE__ */ React.createElement(Toolbar.Separator, null), /* @__PURE__ */ React.createElement(Menu.Root, null, /* @__PURE__ */ React.createElement(Menu.Trigger, {
161
+ asChild: true
162
+ }, /* @__PURE__ */ React.createElement(Toolbar.IconButton, {
163
+ square: true,
164
+ icon: "ph--dots-three-vertical--regular",
165
+ iconOnly: true,
166
+ label: t("options.label"),
167
+ "data-testid": "stack.options"
168
+ })), /* @__PURE__ */ React.createElement(Menu.Content, {
169
+ items: optionsMenu
170
+ })))), /* @__PURE__ */ React.createElement(Panel.Content, null, /* @__PURE__ */ React.createElement(Stack.Root, {
171
+ id: Obj.getURI(collection),
172
+ attendableId,
173
+ collapsed,
174
+ eventHandler,
175
+ onCollapse: handleCollapse,
176
+ onAdd: handleAdd,
177
+ onMoveUp: handleMoveUp,
178
+ onMoveDown: handleMoveDown,
179
+ onDelete: handleDelete
180
+ }, /* @__PURE__ */ React.createElement(Stack.Content, {
181
+ centered: true,
182
+ padding: true,
183
+ "data-testid": "main.stack"
184
+ }, /* @__PURE__ */ React.createElement(Stack.Viewport, null, /* @__PURE__ */ React.createElement(Mosaic.Stack, {
185
+ classNames: "dx-document",
186
+ items,
187
+ getId,
188
+ Tile: Stack.Section
189
+ }))))));
190
+ };
191
+ var getId = (item) => item.id;
192
+ var createCollectionObjects = Atom.family((collection) => Atom.make((get) => {
193
+ const snapshot = get(Obj.atom(collection));
194
+ return snapshot.objects.map((ref) => get(Obj.atomReactive(ref))).filter(isNonNullable);
195
+ }));
196
+ export {
197
+ StackArticle as default
198
+ };
199
+ //# sourceMappingURL=StackArticle-DDKRSUE7.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/containers/StackArticle/StackArticle.tsx"],
4
+ "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { Atom, useAtomValue } from '@effect-atom/atom-react';\nimport React, { useCallback, 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 { Menu, createMenuAction } from '@dxos/react-ui-menu';\nimport { Mosaic, type MosaicEventHandler } 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 // 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<MosaicEventHandler<StackSectionItem>>(\n () => ({\n id: Obj.getURI(collection),\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],\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='bg-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"],
5
+ "mappings": "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",
6
+ "names": ["Atom", "useAtomValue", "React", "useCallback", "useMemo", "useState", "useOperationInvoker", "Obj", "SpaceOperation", "Panel", "Toolbar", "useTranslation", "Menu", "createMenuAction", "Mosaic", "arrayMove", "isNonNullable", "Stack", "meta", "StackArticle", "attendableId", "subject", "collection", "invokePromise", "t", "profile", "key", "collapsedSections", "setCollapsedSections", "collectionObjects", "createCollectionObjects", "items", "map", "object", "id", "getURI", "collapsed", "Set", "Object", "keys", "filter", "findIndex", "objects", "ref", "target", "eventHandler", "canDrop", "source", "some", "onDrop", "to", "type", "location", "length", "insert", "Math", "floor", "update", "from", "handleMoveUp", "index", "splice", "handleMoveDown", "handleDelete", "handleAdd", "OpenCreateObject", "navigable", "onCreateObject", "anchor", "handleCollapse", "value", "prev", "handleCollapseAll", "fromEntries", "handleExpandAll", "optionsMenu", "label", "ns", "icon", "testId", "handleAddSection", "Root", "classNames", "IconButton", "square", "iconOnly", "data-testid", "onClick", "Separator", "Trigger", "asChild", "Content", "onCollapse", "onAdd", "onMoveUp", "onMoveDown", "onDelete", "centered", "padding", "Viewport", "getId", "Tile", "Section", "item", "family", "make", "get", "snapshot", "atom", "atomReactive"]
7
+ }
@@ -1,10 +1,12 @@
1
+ import "./chunk-J5LGTIGS.mjs";
2
+
1
3
  // src/StackPlugin.ts
2
4
  import { Plugin } from "@dxos/app-framework";
3
5
  import { AppPlugin } from "@dxos/app-toolkit";
4
6
  import { ReactSurface } from "#capabilities";
5
7
  import { meta } from "#meta";
6
8
  import { translations } from "#translations";
7
- import { StackViewType } from "#types";
9
+ import { Stack } from "#types";
8
10
 
9
11
  // raw-loader:/__w/dxos/dxos/packages/plugins/plugin-stack/PLUGIN.mdl
10
12
  var PLUGIN_default = '---\nid: org.dxos.plugin.stack\nname: StackPlugin\nversion: 0.1.0\n---\n\nCollections plugin for `DXOS` Composer \u2014 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 \u2014 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 \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n \u2502 Toolbar [+ Add Section] \u2502\n \u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n \u2502 Stack (vertical, intrinsic) \u2502\n \u2502 \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510 \u2502\n \u2502 \u2502 StackSection \u2502 \u2502\n \u2502 \u2502 \u25BE [icon] Title [\u2192] \u2502 \u2502\n \u2502 \u2502 \u2514\u2500 Surface:section \u2502 \u2502\n \u2502 \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518 \u2502\n \u2502 \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510 \u2502\n \u2502 \u2502 StackSection (collapsed\u2502 \u2502\n \u2502 \u2502 \u25B8 [icon] Title [\u2195] \u2502 \u2502\n \u2502 \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518 \u2502\n \u2502 \u2026 \u2502\n \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n```\n\n```mdl\ncomponent StackSection\n desc: A single collapsible section in the stack \u2014 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 \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n \u2502 StackItem.Heading \u2502\n \u2502 [sigil\u25BE] (sticky) [\u2192 or \u2195] \u2502\n \u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n \u2502 CollapsibleContent \u2502\n \u2502 Surface type=section \u2502\n \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\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 \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n \u2502 Settings.Section \u2502\n \u2502 Separation [toggle] \u2502\n \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\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';
@@ -12,7 +14,7 @@ var PLUGIN_default = '---\nid: org.dxos.plugin.stack\nname: StackPlugin\nversion
12
14
  // src/StackPlugin.ts
13
15
  var StackPlugin = Plugin.define(meta).pipe(AppPlugin.addSchemaModule({
14
16
  schema: [
15
- StackViewType
17
+ Stack.Stack
16
18
  ]
17
19
  }), AppPlugin.addSurfaceModule({
18
20
  activate: ReactSurface
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/StackPlugin.ts", "raw-loader:/__w/dxos/dxos/packages/plugins/plugin-stack/PLUGIN.mdl"],
4
- "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 { StackViewType } 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: [StackViewType] }),\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", "---\nid: org.dxos.plugin.stack\nname: StackPlugin\nversion: 0.1.0\n---\n\nCollections plugin for `DXOS` Composer \u2014 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 \u2014 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 \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n \u2502 Toolbar [+ Add Section] \u2502\n \u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n \u2502 Stack (vertical, intrinsic) \u2502\n \u2502 \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510 \u2502\n \u2502 \u2502 StackSection \u2502 \u2502\n \u2502 \u2502 \u25BE [icon] Title [\u2192] \u2502 \u2502\n \u2502 \u2502 \u2514\u2500 Surface:section \u2502 \u2502\n \u2502 \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518 \u2502\n \u2502 \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510 \u2502\n \u2502 \u2502 StackSection (collapsed\u2502 \u2502\n \u2502 \u2502 \u25B8 [icon] Title [\u2195] \u2502 \u2502\n \u2502 \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518 \u2502\n \u2502 \u2026 \u2502\n \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n```\n\n```mdl\ncomponent StackSection\n desc: A single collapsible section in the stack \u2014 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 \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n \u2502 StackItem.Heading \u2502\n \u2502 [sigil\u25BE] (sticky) [\u2192 or \u2195] \u2502\n \u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n \u2502 CollapsibleContent \u2502\n \u2502 Surface type=section \u2502\n \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\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 \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n \u2502 Settings.Section \u2502\n \u2502 Separation [toggle] \u2502\n \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\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"],
5
- "mappings": ";AAIA,SAASA,cAAc;AACvB,SAASC,iBAAiB;AAE1B,SAASC,oBAAoB;AAC7B,SAASC,YAAY;AACrB,SAASC,oBAAoB;AAC7B,SAASC,qBAAqB;;;ACV9B;;;ADeO,IAAMC,cAAcC,OAAOC,OAAOC,IAAAA,EAAMC,KAC7CC,UAAUC,gBAAgB;EAAEC,QAAQ;IAACC;;AAAe,CAAA,GACpDH,UAAUI,iBAAiB;EAAEC,UAAUC;AAAa,CAAA,GACpDN,UAAUO,sBAAsB;EAAEC;AAAa,CAAA,GAC/CR,UAAUS,qBAAqB;EAC7BC,OAAO;IAAEC,UAAUb,KAAKc,QAAQC;IAAKC,MAAM;IAAcC,SAASC;IAAYC,UAAU;EAAoB;AAC9G,CAAA,GACArB,OAAOsB,IAAI;AAGb,IAAA,sBAAevB;",
6
- "names": ["Plugin", "AppPlugin", "ReactSurface", "meta", "translations", "StackViewType", "StackPlugin", "Plugin", "define", "meta", "pipe", "AppPlugin", "addSchemaModule", "schema", "StackViewType", "addSurfaceModule", "activate", "ReactSurface", "addTranslationsModule", "translations", "addPluginAssetModule", "asset", "pluginId", "profile", "key", "path", "content", "pluginSpec", "mimeType", "make"]
4
+ "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", "---\nid: org.dxos.plugin.stack\nname: StackPlugin\nversion: 0.1.0\n---\n\nCollections plugin for `DXOS` Composer \u2014 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 \u2014 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 \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n \u2502 Toolbar [+ Add Section] \u2502\n \u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n \u2502 Stack (vertical, intrinsic) \u2502\n \u2502 \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510 \u2502\n \u2502 \u2502 StackSection \u2502 \u2502\n \u2502 \u2502 \u25BE [icon] Title [\u2192] \u2502 \u2502\n \u2502 \u2502 \u2514\u2500 Surface:section \u2502 \u2502\n \u2502 \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518 \u2502\n \u2502 \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510 \u2502\n \u2502 \u2502 StackSection (collapsed\u2502 \u2502\n \u2502 \u2502 \u25B8 [icon] Title [\u2195] \u2502 \u2502\n \u2502 \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518 \u2502\n \u2502 \u2026 \u2502\n \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n```\n\n```mdl\ncomponent StackSection\n desc: A single collapsible section in the stack \u2014 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 \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n \u2502 StackItem.Heading \u2502\n \u2502 [sigil\u25BE] (sticky) [\u2192 or \u2195] \u2502\n \u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n \u2502 CollapsibleContent \u2502\n \u2502 Surface type=section \u2502\n \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\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 \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n \u2502 Settings.Section \u2502\n \u2502 Separation [toggle] \u2502\n \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\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"],
5
+ "mappings": ";;;AAIA,SAASA,cAAc;AACvB,SAASC,iBAAiB;AAE1B,SAASC,oBAAoB;AAC7B,SAASC,YAAY;AACrB,SAASC,oBAAoB;AAC7B,SAASC,aAAa;;;ACVtB;;;ADeO,IAAMC,cAAcC,OAAOC,OAAOC,IAAAA,EAAMC,KAC7CC,UAAUC,gBAAgB;EAAEC,QAAQ;IAACC,MAAMA;;AAAO,CAAA,GAClDH,UAAUI,iBAAiB;EAAEC,UAAUC;AAAa,CAAA,GACpDN,UAAUO,sBAAsB;EAAEC;AAAa,CAAA,GAC/CR,UAAUS,qBAAqB;EAC7BC,OAAO;IAAEC,UAAUb,KAAKc,QAAQC;IAAKC,MAAM;IAAcC,SAASC;IAAYC,UAAU;EAAoB;AAC9G,CAAA,GACArB,OAAOsB,IAAI;AAGb,IAAA,sBAAevB;",
6
+ "names": ["Plugin", "AppPlugin", "ReactSurface", "meta", "translations", "Stack", "StackPlugin", "Plugin", "define", "meta", "pipe", "AppPlugin", "addSchemaModule", "schema", "Stack", "addSurfaceModule", "activate", "ReactSurface", "addTranslationsModule", "translations", "addPluginAssetModule", "asset", "pluginId", "profile", "key", "path", "content", "pluginSpec", "mimeType", "make"]
7
7
  }
@@ -1,6 +1,8 @@
1
+ import "../chunk-J5LGTIGS.mjs";
2
+
1
3
  // src/capabilities/index.ts
2
4
  import { Capability } from "@dxos/app-framework";
3
- var ReactSurface = Capability.lazy("ReactSurface", () => import("../react-surface-MD3CVY2N.mjs"));
5
+ var ReactSurface = Capability.lazy("ReactSurface", () => import("../react-surface-IL4CW7ND.mjs"));
4
6
  export {
5
7
  ReactSurface
6
8
  };
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/capabilities/index.ts"],
4
4
  "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"],
5
- "mappings": ";AAIA,SAASA,kBAAkB;AAEpB,IAAMC,eAAeD,WAAWE,KAAK,gBAAgB,MAAM,OAAO,+BAAA,CAAA;",
5
+ "mappings": ";;;AAIA,SAASA,kBAAkB;AAEpB,IAAMC,eAAeD,WAAWE,KAAK,gBAAgB,MAAM,OAAO,+BAAA,CAAA;",
6
6
  "names": ["Capability", "ReactSurface", "lazy"]
7
7
  }
@@ -0,0 +1,18 @@
1
+ import {
2
+ __export
3
+ } from "./chunk-J5LGTIGS.mjs";
4
+
5
+ // src/types/Stack.ts
6
+ var Stack_exports = {};
7
+ __export(Stack_exports, {
8
+ Stack: () => Stack
9
+ });
10
+ import * as Schema from "effect/Schema";
11
+ import { DXN, Type } from "@dxos/echo";
12
+ var Stack = class extends Type.makeObject(DXN.make("org.dxos.type.stack", "0.1.0"))(Schema.Struct({})) {
13
+ };
14
+
15
+ export {
16
+ Stack_exports
17
+ };
18
+ //# sourceMappingURL=chunk-FDNICBZZ.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/types/Stack.ts"],
4
+ "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"],
5
+ "mappings": ";;;;;AAAA;;;;AAMA,YAAYA,YAAY;AAExB,SAASC,KAAKC,YAAY;AAGnB,IAAMC,QAAN,cAAoBD,KAAKE,WAAkBH,IAAII,KAAK,uBAAuB,OAAA,CAAA,EAAiBC,cAAO,CAAC,CAAA,CAAA,EAAA;AAAK;",
6
+ "names": ["Schema", "DXN", "Type", "Stack", "makeObject", "make", "Struct"]
7
+ }
@@ -0,0 +1,10 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __export = (target, all) => {
3
+ for (var name in all)
4
+ __defProp(target, name, { get: all[name], enumerable: true });
5
+ };
6
+
7
+ export {
8
+ __export
9
+ };
10
+ //# sourceMappingURL=chunk-J5LGTIGS.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -8,12 +8,10 @@ import { trim } from "@dxos/util";
8
8
  var dx_config_default = Config2.make({
9
9
  plugin: {
10
10
  key: "org.dxos.plugin.stack",
11
- // TODO(wittjosiah): Prevents "stacks" language from being exposed to users in settings panel.
12
- // Conside renaming this to the collection plugin and trying to factor more collections logic from the space plugin.
13
- name: "Collections",
11
+ name: "Stacks",
14
12
  author: "DXOS",
15
13
  description: trim`
16
- StackPlugin renders any Collection object as a vertically scrollable stack of collapsible sections in the
14
+ The Stack plugin renders any Collection as a vertically scrollable stack of collapsible sections in the
17
15
  Composer article surface. Each section wraps an arbitrary ECHO object and delegates its content rendering
18
16
  to the section surface role, enabling any other plugin to contribute its own section renderer.
19
17
 
@@ -43,4 +41,4 @@ export {
43
41
  SECTION_IDENTIFIER,
44
42
  meta
45
43
  };
46
- //# sourceMappingURL=chunk-CTWUHXK5.mjs.map
44
+ //# sourceMappingURL=chunk-ZOIZTRMG.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/meta.ts", "../../../dx.config.ts"],
4
+ "sourcesContent": ["//\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", "//\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 },\n});\n"],
5
+ "mappings": ";AAIA,SAASA,cAAc;AACvB,SAASC,WAAW;;;ACDpB,SAASC,eAAe;AACxB,SAASC,YAAY;AAErB,IAAA,oBAAeD,QAAQE,KAAK;EAC1BC,QAAQ;IACNC,KAAK;IACLC,MAAM;IACNC,QAAQ;IACRC,aAAaN;;;;;;;;;;;;;;;IAebO,QAAQ;IACRC,MAAM;MAAEL,KAAK;IAA4B;IACzCM,MAAM;EACR;AACF,CAAA;;;ADtBO,IAAMC,qBAAqBC,IAAIC,KAAK,4BAAA;AAEpC,IAAMC,OAAOC,OAAOC,kBAAkBC,iBAAAA;",
6
+ "names": ["Plugin", "DXN", "Config2", "trim", "make", "plugin", "key", "name", "author", "description", "source", "icon", "spec", "SECTION_IDENTIFIER", "DXN", "make", "meta", "Plugin", "getMetaFromConfig", "config"]
7
+ }