@dxos/plugin-stack 0.11.1 → 0.12.0-next-2800d0376abcc62d5544afdd744b16b2b960434e

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 (74) hide show
  1. package/PLUGIN.mdl +2 -2
  2. package/dist/lib/Stack.mjs +10 -0
  3. package/dist/lib/Stack.mjs.map +1 -0
  4. package/dist/lib/StackEvents.mjs +15 -0
  5. package/dist/lib/StackEvents.mjs.map +1 -0
  6. package/dist/lib/StackPlugin.mjs +12 -14
  7. package/dist/lib/StackPlugin.mjs.map +1 -1
  8. package/dist/lib/capabilities.mjs +14 -3
  9. package/dist/lib/capabilities.mjs.map +1 -1
  10. package/dist/lib/capabilities.node.mjs +11 -0
  11. package/dist/lib/capabilities.node.mjs.map +1 -0
  12. package/dist/lib/capabilities.workerd.mjs +11 -0
  13. package/dist/lib/capabilities.workerd.mjs.map +1 -0
  14. package/dist/lib/chunk-StackArticle.mjs +20 -17
  15. package/dist/lib/chunk-StackArticle.mjs.map +1 -1
  16. package/dist/lib/chunk-react-surface.mjs +4 -3
  17. package/dist/lib/chunk-react-surface.mjs.map +1 -1
  18. package/dist/lib/chunk-rolldown-runtime.mjs +13 -0
  19. package/dist/lib/chunk-schema.mjs +11 -0
  20. package/dist/lib/chunk-schema.mjs.map +1 -0
  21. package/dist/lib/components.mjs +2 -2
  22. package/dist/lib/components.mjs.map +1 -1
  23. package/dist/lib/index.mjs +4 -3
  24. package/dist/lib/meta.mjs +36 -1
  25. package/dist/lib/meta.mjs.map +1 -0
  26. package/dist/lib/plugin.mjs +5 -4
  27. package/dist/lib/plugin.mjs.map +1 -1
  28. package/dist/lib/types.mjs +3 -2
  29. package/dist/types/src/StackPlugin.d.ts +36 -3
  30. package/dist/types/src/StackPlugin.d.ts.map +1 -1
  31. package/dist/types/src/capabilities/gen/node.d.ts +5 -0
  32. package/dist/types/src/capabilities/gen/node.d.ts.map +1 -0
  33. package/dist/types/src/capabilities/gen/workerd.d.ts +5 -0
  34. package/dist/types/src/capabilities/gen/workerd.d.ts.map +1 -0
  35. package/dist/types/src/capabilities/index.d.ts +4 -2
  36. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  37. package/dist/types/src/capabilities/react-surface.d.ts +2 -2
  38. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  39. package/dist/types/src/capabilities/schema.d.ts +8 -0
  40. package/dist/types/src/capabilities/schema.d.ts.map +1 -0
  41. package/dist/types/src/components/Stack/Stack.d.ts +11 -16
  42. package/dist/types/src/components/Stack/Stack.d.ts.map +1 -1
  43. package/dist/types/src/containers/StackArticle/StackArticle.d.ts.map +1 -1
  44. package/dist/types/src/containers/StackArticle/StackArticle.stories.d.ts.map +1 -1
  45. package/dist/types/src/index.d.ts +3 -2
  46. package/dist/types/src/index.d.ts.map +1 -1
  47. package/dist/types/src/plugin.d.ts +2 -1
  48. package/dist/types/src/plugin.d.ts.map +1 -1
  49. package/dist/types/src/translations.d.ts +2 -1
  50. package/dist/types/src/translations.d.ts.map +1 -1
  51. package/dist/types/src/types/StackEvents.d.ts +8 -0
  52. package/dist/types/src/types/StackEvents.d.ts.map +1 -0
  53. package/dist/types/src/types/index.d.ts +1 -0
  54. package/dist/types/src/types/index.d.ts.map +1 -1
  55. package/dist/types/tsconfig.tsbuildinfo +1 -1
  56. package/package.json +65 -45
  57. package/src/StackPlugin.ts +7 -18
  58. package/src/capabilities/gen/node.ts +16 -0
  59. package/src/capabilities/gen/workerd.ts +16 -0
  60. package/src/capabilities/index.ts +18 -2
  61. package/src/capabilities/react-surface.ts +3 -2
  62. package/src/capabilities/schema.ts +11 -0
  63. package/src/components/Stack/Stack.tsx +1 -1
  64. package/src/containers/StackArticle/StackArticle.stories.tsx +17 -17
  65. package/src/containers/StackArticle/StackArticle.tsx +22 -17
  66. package/src/index.ts +3 -2
  67. package/src/meta.ts +1 -1
  68. package/src/plugin.ts +12 -3
  69. package/src/types/StackEvents.ts +16 -0
  70. package/src/types/index.ts +2 -1
  71. package/dist/lib/chunk-meta.mjs +0 -37
  72. package/dist/lib/chunk-meta.mjs.map +0 -1
  73. package/dist/lib/chunk-types.mjs +0 -21
  74. package/dist/lib/chunk-types.mjs.map +0 -1
package/PLUGIN.mdl CHANGED
@@ -170,7 +170,7 @@ feat F-2: Section Management
170
170
 
171
171
  req F-2.1:
172
172
  when: user clicks the Add Section button in the toolbar
173
- then: SpaceOperation.OpenCreateObject dialog is invoked with the collection as target
173
+ then: SpaceOperation.OpenObjectForm dialog is invoked with the collection as target
174
174
  req F-2.2:
175
175
  when: user selects "Add Before" or "Add After" from a section dropdown
176
176
  then: LayoutOperation.UpdateDialog is invoked with the AddSectionDialog, position, and collection context
@@ -224,7 +224,7 @@ test T-1: Collection renders as stack
224
224
  test T-2: Add section via toolbar
225
225
  given: StackArticle is open
226
226
  when: user clicks the Add Section toolbar button
227
- then: SpaceOperation.OpenCreateObject is invoked with the collection as target
227
+ then: SpaceOperation.OpenObjectForm is invoked with the collection as target
228
228
  ```
229
229
 
230
230
  ```mdl
@@ -0,0 +1,10 @@
1
+ import { t as __exportAll } from "./chunk-rolldown-runtime.mjs";
2
+ import { DXN, Type } from "@dxos/echo";
3
+ import * as Schema from "effect/Schema";
4
+ //#region src/types/Stack.ts
5
+ var Stack_exports = /* @__PURE__ */ __exportAll({ Stack: () => Stack });
6
+ var Stack = class extends Type.makeObject(DXN.make("org.dxos.type.stack", "0.1.0"))(Schema.Struct({})) {};
7
+ //#endregion
8
+ export { Stack, Stack_exports as t };
9
+
10
+ //# sourceMappingURL=Stack.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Stack.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,15 @@
1
+ import { t as __exportAll } from "./chunk-rolldown-runtime.mjs";
2
+ import { meta } from "#meta";
3
+ import * as ActivationEvent from "@dxos/app-framework/ActivationEvent";
4
+ //#region src/types/StackEvents.ts
5
+ var StackEvents_exports = /* @__PURE__ */ __exportAll({ Start: () => Start });
6
+ /**
7
+ * The feature's start event: the plugin's start-gated modules (and cross-plugin
8
+ * contributions consumed by this feature) activate here. Fired on demand and by the
9
+ * host's idle trickle.
10
+ */
11
+ var Start = ActivationEvent.pluginStart(meta.profile.key);
12
+ //#endregion
13
+ export { Start, StackEvents_exports as t };
14
+
15
+ //# sourceMappingURL=StackEvents.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StackEvents.mjs","names":[],"sources":["../../src/types/StackEvents.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\n// @import-as-namespace\n\nimport * as ActivationEvent from '@dxos/app-framework/ActivationEvent';\n\nimport { meta } from '#meta';\n\n/**\n * The feature's start event: the plugin's start-gated modules (and cross-plugin\n * contributions consumed by this feature) activate here. Fired on demand and by the\n * host's idle trickle.\n */\nexport const Start = ActivationEvent.pluginStart(meta.profile.key);\n"],"mappings":";;;;;;;;;;AAeA,IAAa,QAAQ,gBAAgB,YAAY,KAAK,QAAQ,GAAG"}
@@ -1,18 +1,16 @@
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
1
+ import { t as __exportAll } from "./chunk-rolldown-runtime.mjs";
2
+ import { meta as meta$1 } from "#meta";
3
+ import * as Plugin from "@dxos/app-framework/Plugin";
8
4
  //#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);
5
+ var StackPlugin_exports = /* @__PURE__ */ __exportAll({
6
+ make: () => make,
7
+ meta: () => meta
8
+ });
9
+ /** Plugin metadata, available without loading the plugin body. */
10
+ var meta = meta$1;
11
+ /** Constructs the plugin; the body loads on first enable. */
12
+ var make = Plugin.lazy(meta, () => import("#plugin"));
15
13
  //#endregion
16
- export { StackPlugin, StackPlugin as default };
14
+ export { make, meta, StackPlugin_exports as t };
17
15
 
18
16
  //# sourceMappingURL=StackPlugin.mjs.map
@@ -1 +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"}
1
+ {"version":3,"file":"StackPlugin.mjs","names":[],"sources":["../../src/StackPlugin.ts"],"sourcesContent":["//\n// Copyright 2023 DXOS.org\n//\n\n// @import-as-namespace\n\nimport * as Plugin from '@dxos/app-framework/Plugin';\n\nimport { meta as pluginMeta } from '#meta';\n\n/** Plugin metadata, available without loading the plugin body. */\nexport const meta = pluginMeta;\n\n/** Constructs the plugin; the body loads on first enable. */\nexport const make = Plugin.lazy(meta, () => import('#plugin'));\n"],"mappings":";;;;;;;;;AAWA,IAAa,OAAO;;AAGpB,IAAa,OAAO,OAAO,KAAK,YAAY,OAAO,UAAU"}
@@ -1,7 +1,18 @@
1
- import { Capability } from "@dxos/app-framework";
1
+ import * as AppCapability from "@dxos/app-toolkit/AppCapability";
2
+ import { translations } from "#translations";
3
+ import { meta } from "#meta";
4
+ //#endregion
2
5
  //#region src/capabilities/index.ts
3
- var ReactSurface = Capability.lazy("ReactSurface", () => import("./chunk-react-surface.mjs"));
6
+ var PluginAsset = AppCapability.pluginAsset({
7
+ pluginId: meta.profile.key,
8
+ path: "PLUGIN.mdl",
9
+ 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.OpenObjectForm 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.OpenObjectForm 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",
10
+ mimeType: "application/x-mdl"
11
+ });
12
+ var ReactSurface = AppCapability.surface(() => import("./chunk-react-surface.mjs"), { roles: ["org.dxos.role.article"] });
13
+ var Schema = AppCapability.schema(() => import("./chunk-schema.mjs"));
14
+ var Translations = AppCapability.translations(translations);
4
15
  //#endregion
5
- export { ReactSurface };
16
+ export { PluginAsset, ReactSurface, Schema, Translations };
6
17
 
7
18
  //# sourceMappingURL=capabilities.mjs.map
@@ -1 +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"}
1
+ {"version":3,"file":"capabilities.mjs","names":[],"sources":["../../src/capabilities/index.ts"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as AppCapability from '@dxos/app-toolkit/AppCapability';\n\nimport { meta } from '#meta';\nimport { translations } from '#translations';\n\n// eslint-disable-next-line import/no-relative-packages\nimport pluginSpec from '../../PLUGIN.mdl?raw';\n\nexport const PluginAsset = AppCapability.pluginAsset({\n pluginId: meta.profile.key,\n path: 'PLUGIN.mdl',\n content: pluginSpec,\n mimeType: 'application/x-mdl',\n});\nexport const ReactSurface = AppCapability.surface(() => import('./react-surface'), {\n roles: ['org.dxos.role.article'],\n});\nexport const Schema = AppCapability.schema(() => import('./schema'));\nexport const Translations = AppCapability.translations(translations);\n"],"mappings":";;;;;AAYA,IAAa,cAAc,cAAc,YAAY;CACnD,UAAU,KAAK,QAAQ;CACvB,MAAM;CACN,SAAS;CACT,UAAU;AACZ,CAAC;AACD,IAAa,eAAe,cAAc,cAAc,OAAO,8BAAoB,EACjF,OAAO,CAAC,uBAAuB,EACjC,CAAC;AACD,IAAa,SAAS,cAAc,aAAa,OAAO,qBAAW;AACnE,IAAa,eAAe,cAAc,aAAa,YAAY"}
@@ -0,0 +1,11 @@
1
+ import * as AppCapability from "@dxos/app-toolkit/AppCapability";
2
+ import { translations } from "#translations";
3
+ //#region src/capabilities/gen/node.ts
4
+ var Schema = AppCapability.schema(() => import("./chunk-schema.mjs"));
5
+ var Translations = AppCapability.translations(translations);
6
+ var PluginAsset = void 0;
7
+ var ReactSurface = void 0;
8
+ //#endregion
9
+ export { PluginAsset, ReactSurface, Schema, Translations };
10
+
11
+ //# sourceMappingURL=capabilities.node.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capabilities.node.mjs","names":[],"sources":["../../src/capabilities/gen/node.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\n// GENERATED by dx-plugin — do not edit. Sliced from ../index.ts for the 'node' condition.\n\nimport * as AppCapability from '@dxos/app-toolkit/AppCapability';\n\nimport { translations } from '#translations';\n\nexport const Schema = AppCapability.schema(() => import('../schema'));\n\nexport const Translations = AppCapability.translations(translations);\n\nexport const PluginAsset = undefined;\nexport const ReactSurface = undefined;\n"],"mappings":";;;AAUA,IAAa,SAAS,cAAc,aAAa,OAAO,qBAAY;AAEpE,IAAa,eAAe,cAAc,aAAa,YAAY;AAEnE,IAAa,cAAc,KAAA;AAC3B,IAAa,eAAe,KAAA"}
@@ -0,0 +1,11 @@
1
+ import * as AppCapability from "@dxos/app-toolkit/AppCapability";
2
+ import { translations } from "#translations";
3
+ //#region src/capabilities/gen/workerd.ts
4
+ var Schema = AppCapability.schema(() => import("./chunk-schema.mjs"));
5
+ var Translations = AppCapability.translations(translations);
6
+ var PluginAsset = void 0;
7
+ var ReactSurface = void 0;
8
+ //#endregion
9
+ export { PluginAsset, ReactSurface, Schema, Translations };
10
+
11
+ //# sourceMappingURL=capabilities.workerd.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capabilities.workerd.mjs","names":[],"sources":["../../src/capabilities/gen/workerd.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\n// GENERATED by dx-plugin — do not edit. Sliced from ../index.ts for the 'workerd' condition.\n\nimport * as AppCapability from '@dxos/app-toolkit/AppCapability';\n\nimport { translations } from '#translations';\n\nexport const Schema = AppCapability.schema(() => import('../schema'));\n\nexport const Translations = AppCapability.translations(translations);\n\nexport const PluginAsset = undefined;\nexport const ReactSurface = undefined;\n"],"mappings":";;;AAUA,IAAa,SAAS,cAAc,aAAa,OAAO,qBAAY;AAEpE,IAAa,eAAe,cAAc,aAAa,YAAY;AAEnE,IAAa,cAAc,KAAA;AAC3B,IAAa,eAAe,KAAA"}
@@ -1,13 +1,14 @@
1
- import { arrayMove, isNonNullable } from "@dxos/util";
2
- import { Obj } from "@dxos/echo";
3
1
  import { meta } from "#meta";
4
2
  import { useCallback, useId, useMemo, useState } from "react";
5
3
  import { useOperationInvoker } from "@dxos/app-framework/ui";
4
+ import { Obj } from "@dxos/echo";
6
5
  import { Panel, Toolbar, useTranslation } from "@dxos/react-ui";
7
6
  import { Mosaic } from "@dxos/react-ui-mosaic";
8
7
  import { jsx, jsxs } from "react/jsx-runtime";
9
- import { Atom, useAtomValue } from "@effect-atom/atom-react";
10
- import { SpaceOperation } from "@dxos/plugin-space";
8
+ import { arrayMove, isNonNullable } from "@dxos/util";
9
+ import { useAtomValue } from "@effect/atom-react/Hooks";
10
+ import * as Atom from "effect/unstable/reactivity/Atom";
11
+ import * as SpaceOperation from "@dxos/plugin-space/SpaceOperation";
11
12
  import { Menu, createMenuAction } from "@dxos/react-ui-menu";
12
13
  import { Stack } from "#components";
13
14
  //#region src/containers/StackArticle/StackArticle.tsx
@@ -60,18 +61,20 @@ var StackArticle = ({ attendableId, subject: collection }) => {
60
61
  collection.objects.splice(index, 1);
61
62
  });
62
63
  }, [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
- }), [
64
+ const handleAdd = useCallback(async (id) => {
65
+ const { data } = await invokePromise(SpaceOperation.OpenObjectForm, {
66
+ target: collection,
67
+ navigable: false
68
+ });
69
+ const object = data?.target;
70
+ if (!object) return;
71
+ const from = findIndex(Obj.getURI(object));
72
+ const anchor = findIndex(id);
73
+ if (from >= 0 && anchor >= 0) Obj.update(collection, (collection) => {
74
+ const [ref] = collection.objects.splice(from, 1);
75
+ collection.objects.splice(anchor < from ? anchor + 1 : anchor, 0, ref);
76
+ });
77
+ }, [
75
78
  collection,
76
79
  invokePromise,
77
80
  findIndex
@@ -91,7 +94,7 @@ var StackArticle = ({ attendableId, subject: collection }) => {
91
94
  icon: "ph--arrows-out-line-vertical--regular",
92
95
  testId: "stack.expand-all"
93
96
  })], [handleCollapseAll, handleExpandAll]);
94
- const handleAddSection = useCallback(() => invokePromise(SpaceOperation.OpenCreateObject, {
97
+ const handleAddSection = useCallback(() => invokePromise(SpaceOperation.OpenObjectForm, {
95
98
  target: collection,
96
99
  navigable: false
97
100
  }), [collection, invokePromise]);
@@ -1 +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.atomReact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,eAAY;KACb,CAAA;IACW,CAAA,GACd,oBAAC,KAAK,SAAN,EAAc,OAAO,YAAc,CAAA,CAC1B,EAAA,CAAA;GACC;;CACD,CAAA,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
+ {"version":3,"file":"chunk-StackArticle.mjs","names":[],"sources":["../../src/containers/StackArticle/StackArticle.tsx"],"sourcesContent":["//\n// Copyright 2023 DXOS.org\n//\n\nimport { useAtomValue } from '@effect/atom-react/Hooks';\nimport * as Atom from 'effect/unstable/reactivity/Atom';\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 * as SpaceOperation from '@dxos/plugin-space/SpaceOperation';\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 async (id: string) => {\n const { data } = await invokePromise(SpaceOperation.OpenObjectForm, {\n target: collection,\n navigable: false,\n });\n const object = data?.target;\n if (!object) {\n return;\n }\n\n // The created object is appended; move it to immediately after the originating section.\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 [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.OpenObjectForm, {\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":";;;;;;;;;;;;;;AAuBA,IAAa,gBAAgB,EAAE,cAAc,SAAS,iBAAoC;CACxF,MAAM,EAAE,kBAAkB,oBAAoB;CAC9C,MAAM,EAAE,MAAM,eAAe,KAAK,QAAQ,GA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SAAP,EAAA,UACE,oBAAC,MAAM,MAAP;EACE,IAAI,IAAI,OAAO,UAAU;EACX;EACH;EACG;EACd,YAAY;EACZ,OAAO;EACP,UAAU;EACV,YAAY;EACZ,UAAU;EAEV,UAAA,oBAAC,MAAM,SAAP;GAAe,UAAA;GAAS,SAAA;GAAQ,eAAY;GAC1C,UAAA,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,11 +1,12 @@
1
- import { Capabilities, Capability } from "@dxos/app-framework";
2
- import { Collection } from "@dxos/echo";
3
1
  import { Surface } from "@dxos/app-framework/ui";
4
2
  import { AppSurface } from "@dxos/app-toolkit/ui";
3
+ import { Collection } from "@dxos/echo";
5
4
  import * as Effect from "effect/Effect";
5
+ import * as Capabilities from "@dxos/app-framework/Capabilities";
6
+ import * as Capability from "@dxos/app-framework/Capability";
6
7
  import { StackArticle } from "#containers";
7
8
  //#region src/capabilities/react-surface.ts
8
- var react_surface_default = Capability.makeModule(() => Effect.succeed(Capability.contributes(Capabilities.ReactSurface, Surface.create({
9
+ var react_surface_default = Capability.makeModule(() => Effect.succeed(Capability.contribute(Capabilities.ReactSurface, Surface.create({
9
10
  id: "article",
10
11
  filter: AppSurface.object(AppSurface.Article, Collection.Collection),
11
12
  component: StackArticle,
@@ -1 +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"}
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 * as Capabilities from '@dxos/app-framework/Capabilities';\nimport * as Capability from '@dxos/app-framework/Capability';\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.contribute(\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":";;;;;;;;AAcA,IAAA,wBAAe,WAAW,iBACxB,OAAO,QACL,WAAW,WACT,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,13 @@
1
+ //#region \0rolldown/runtime.js
2
+ var __defProp = Object.defineProperty;
3
+ var __exportAll = (all, no_symbols) => {
4
+ let target = {};
5
+ for (var name in all) __defProp(target, name, {
6
+ get: all[name],
7
+ enumerable: true
8
+ });
9
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
10
+ return target;
11
+ };
12
+ //#endregion
13
+ export { __exportAll as t };
@@ -0,0 +1,11 @@
1
+ import { Stack } from "#types";
2
+ //#region src/capabilities/schema.ts
3
+ /**
4
+ * Schemas this plugin registers, loaded on demand: the capability activates at idle,
5
+ * so naming them here keeps them out of the plugin body's module graph.
6
+ */
7
+ var schema_default = [Stack.Stack];
8
+ //#endregion
9
+ export { schema_default as default };
10
+
11
+ //# sourceMappingURL=chunk-schema.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk-schema.mjs","names":[],"sources":["../../src/capabilities/schema.ts"],"sourcesContent":["//\n// Copyright 2023 DXOS.org\n//\n\nimport { Stack } from '#types';\n\n/**\n * Schemas this plugin registers, loaded on demand: the capability activates at idle,\n * so naming them here keeps them out of the plugin body's module graph.\n */\nexport default [Stack.Stack];\n"],"mappings":";;;;;;AAUA,IAAA,iBAAe,CAAC,MAAM,KAAK"}
@@ -1,9 +1,9 @@
1
- import { Obj } from "@dxos/echo";
2
- import { GraphPath } from "@dxos/app-toolkit";
3
1
  import { meta } from "#meta";
4
2
  import { createContext, forwardRef, useCallback, useContext, useMemo, useState } from "react";
5
3
  import { Surface } from "@dxos/app-framework/ui";
4
+ import * as GraphPath from "@dxos/app-toolkit/GraphPath";
6
5
  import { AppSurface, AttentionSigilButton } from "@dxos/app-toolkit/ui";
6
+ import { Obj } from "@dxos/echo";
7
7
  import { DropdownMenu, Icon, ScrollArea, useTranslation } from "@dxos/react-ui";
8
8
  import { useAttentionAttributes } from "@dxos/react-ui-attention";
9
9
  import { Mosaic } from "@dxos/react-ui-mosaic";
@@ -1 +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":";;;;;;;;;;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AC,MAAD,EAAM,MAAK,qBAAsB,CAAA,GACjC,oBAAC,QAAD;OAAM,WAAU;iBAAa,EAAE,sBAAsB;MAAQ,CAAA,CAC5C;;IACE,EAAA,CAAA,GACvB,oBAAC,aAAa,OAAd,CAAqB,CAAA,CACD,EAAA,CAAA,EACH,CAAA,CACJ;;EAChB,CAAA,GACL,oBAAC,OAAD;GAAK,WAAU;aAEb,oBAAC,OAAO,YAAR;IACE,OAAO,EAAE,mBAAmB;IAC5B,YAAW;IACX,QAAO;cAEP,oBAAC,iBAAD,CAAkB,CAAA;GACD,CAAA;EAChB,CAAA,CACF;;CAGP,OACE,qBAAC,OAAO,MAAR;EACE,GAAI;EACE;EACN,YAAW;YAHb,CAKE,oBAAC,OAAD;GAAK,WAAU;aACb,oBAAC,OAAD;IAAK,WAAU;cAA2C;GAAU,CAAA;EACjE,CAAA,GACL,qBAAC,OAAD;GAAK,GAAI;GAAgB,WAAU;aAAnC,CACE,oBAAC,QAAD;IAAM,WAAU;cAAW;GAAY,CAAA,GACtC,cACC,oBAAC,OAAD;IAAK,WAAU;cACb,oBAAC,MAAD;KAAI,WAAU;eAAiC;IAAU,CAAA;GACtD,CAAA,IAEL,oBAAC,QAAQ,SAAT;IAAiB,MAAM,WAAW;IAAS,MAAM;IAAa,OAAO;GAAI,CAAA,CAExE;IACM;;AAEjB;AAEA,aAAa,cAAc;AAM3B,IAAa,QAAQ;CACnB,MAAM;CACN,SAAS;CACT,UAAU;CACV,SAAS;AACX"}
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 * as GraphPath from '@dxos/app-toolkit/GraphPath';\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,cACA,UACA,cACA,WACA,YACA,OACA,UACA,YACA,eACoB;CACpB,MAAM,CAAC,UAAU,eAAe,SAA6B,IAAI;CACjE,MAAM,QAAQ,eACL;EACL;EACA,cAAc,gBAAgB;GAAE;GAAI,eAAe;EAAM;EACzD;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,IACA;EAAC;EAAI;EAAc;EAAU;EAAc;EAAW;EAAY;EAAO;EAAU;EAAY;CAAQ,CACzG;CA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,GAAI;EACE;EACN,YAAW;EAHb,UAAA,CAKE,oBAAC,OAAD;GAAK,WAAU;GACb,UAAA,oBAAC,OAAD;IAAK,WAAU;IAA2C,UAAA;GAAU,CAAA;EACjE,CAAA,GACL,qBAAC,OAAD;GAAK,GAAI;GAAgB,WAAU;GAAnC,UAAA,CACE,oBAAC,QAAD;IAAM,WAAU;IAAW,UAAA;GAAY,CAAA,GACtC,cACC,oBAAC,OAAD;IAAK,WAAU;IACb,UAAA,oBAAC,MAAD;KAAI,WAAU;KAAiC,UAAA;IAAU,CAAA;GACtD,CAAA,IAEL,oBAAC,QAAQ,SAAT;IAAiB,MAAM,WAAW;IAAS,MAAM;IAAa,OAAO;GAAI,CAAA,CAExE;EACM,CAAA,CAAA;;AAEjB;AAEA,aAAa,cAAc;AAM3B,IAAa,QAAQ;CACnB,MAAM;CACN,SAAS;CACT,UAAU;CACV,SAAS;AACX"}
@@ -1,3 +1,4 @@
1
- import { t as Stack_exports } from "./chunk-types.mjs";
2
- import { n as meta, t as SECTION_IDENTIFIER } from "./chunk-meta.mjs";
3
- export { SECTION_IDENTIFIER, Stack_exports as Stack, meta };
1
+ import { t as StackPlugin_exports } from "./StackPlugin.mjs";
2
+ export * from "#meta";
3
+ export * from "#types";
4
+ export { StackPlugin_exports as StackPlugin };
package/dist/lib/meta.mjs CHANGED
@@ -1,2 +1,37 @@
1
- import { n as meta, t as SECTION_IDENTIFIER } from "./chunk-meta.mjs";
1
+ import * as Plugin from "@dxos/app-framework/Plugin";
2
+ import { DXN } from "@dxos/keys";
3
+ import { Config2 } from "@dxos/app-framework/config";
4
+ import { trim } from "@dxos/util";
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`
11
+ The Stack plugin renders any Collection as a vertically scrollable stack of collapsible sections in the
12
+ Composer article surface. Each section wraps an arbitrary ECHO object and delegates its content rendering
13
+ to the section surface role, enabling any other plugin to contribute its own section renderer.
14
+
15
+ Sections can be individually collapsed to show only their title, expanded to reveal full content, navigated
16
+ to directly, or removed from the collection. New sections can be inserted before or after any existing
17
+ section via a per-section dropdown menu, or appended via the toolbar Add button.
18
+
19
+ The plugin registers StackViewType with the ECHO schema module so that per-section view metadata
20
+ (height overrides, custom display data) can be stored and replicated alongside the collection.
21
+
22
+ A settings panel exposes a separation toggle that controls whether visual dividers are rendered between
23
+ sections.
24
+ `,
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
32
+ var SECTION_IDENTIFIER = DXN.make("org.dxos.type.stackSection");
33
+ var meta = Plugin.getMetaFromConfig(dx_config_default);
34
+ //#endregion
2
35
  export { SECTION_IDENTIFIER, meta };
36
+
37
+ //# sourceMappingURL=meta.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"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 * as Plugin from '@dxos/app-framework/Plugin';\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"}
@@ -1,8 +1,9 @@
1
- import { n as meta } from "./chunk-meta.mjs";
2
- import { Plugin } from "@dxos/app-framework";
1
+ import { meta } from "#meta";
2
+ import * as Plugin from "@dxos/app-framework/Plugin";
3
+ import { PluginAsset, ReactSurface, Schema, Translations } from "#capabilities";
3
4
  //#region src/plugin.ts
4
- var StackPlugin = Plugin.lazy(meta, () => import("#plugin"));
5
+ var StackPlugin = Plugin.define(meta).pipe(Plugin.addModule(PluginAsset), Plugin.addModule(ReactSurface), Plugin.addModule(Schema), Plugin.addModule(Translations), Plugin.make);
5
6
  //#endregion
6
- export { StackPlugin };
7
+ export { StackPlugin, StackPlugin as default };
7
8
 
8
9
  //# sourceMappingURL=plugin.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.mjs","names":[],"sources":["../../src/plugin.ts"],"sourcesContent":["//\n// Copyright 2023 DXOS.org\n//\n\nimport { Plugin } from '@dxos/app-framework';\n\nimport { meta } from './meta';\n\nexport const StackPlugin = Plugin.lazy(meta, () => import('#plugin'));\n"],"mappings":";;;AAQA,IAAa,cAAc,OAAO,KAAK,YAAY,OAAO,UAAU"}
1
+ {"version":3,"file":"plugin.mjs","names":[],"sources":["../../src/plugin.ts"],"sourcesContent":["//\n// Copyright 2023 DXOS.org\n//\n\nimport * as Plugin from '@dxos/app-framework/Plugin';\n\nimport { PluginAsset, ReactSurface, Schema, Translations } from '#capabilities';\nimport { meta } from '#meta';\n\nexport const StackPlugin = Plugin.define(meta).pipe(\n Plugin.addModule(PluginAsset),\n Plugin.addModule(ReactSurface),\n Plugin.addModule(Schema),\n Plugin.addModule(Translations),\n Plugin.make,\n);\n\nexport default StackPlugin;\n"],"mappings":";;;;AASA,IAAa,cAAc,OAAO,OAAO,IAAI,CAAC,CAAC,KAC7C,OAAO,UAAU,WAAW,GAC5B,OAAO,UAAU,YAAY,GAC7B,OAAO,UAAU,MAAM,GACvB,OAAO,UAAU,YAAY,GAC7B,OAAO,IACT"}
@@ -1,2 +1,3 @@
1
- import { t as Stack_exports } from "./chunk-types.mjs";
2
- export { Stack_exports as Stack };
1
+ import { t as Stack_exports } from "./Stack.mjs";
2
+ import { t as StackEvents_exports } from "./StackEvents.mjs";
3
+ export { Stack_exports as Stack, StackEvents_exports as StackEvents };