@dxos/plugin-stack 0.8.4-main.fffef41 → 0.9.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 (123) hide show
  1. package/LICENSE +102 -5
  2. package/PLUGIN.mdl +326 -0
  3. package/README.md +1 -1
  4. package/dist/lib/neutral/StackArticle-R7IS6TYR.mjs +124 -0
  5. package/dist/lib/neutral/StackArticle-R7IS6TYR.mjs.map +7 -0
  6. package/dist/lib/neutral/StackPlugin.mjs +34 -0
  7. package/dist/lib/neutral/StackPlugin.mjs.map +7 -0
  8. package/dist/lib/neutral/capabilities/index.mjs +7 -0
  9. package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
  10. package/dist/lib/neutral/chunk-RGJSGQGF.mjs +36 -0
  11. package/dist/lib/neutral/chunk-RGJSGQGF.mjs.map +7 -0
  12. package/dist/lib/{browser/chunk-NHMDZYOB.mjs → neutral/chunk-T4NSFSPH.mjs} +6 -10
  13. package/dist/lib/neutral/chunk-T4NSFSPH.mjs.map +7 -0
  14. package/dist/lib/neutral/components/index.mjs +182 -0
  15. package/dist/lib/neutral/components/index.mjs.map +7 -0
  16. package/dist/lib/neutral/containers/index.mjs +7 -0
  17. package/dist/lib/neutral/containers/index.mjs.map +7 -0
  18. package/dist/lib/neutral/index.mjs +15 -0
  19. package/dist/lib/neutral/meta.json +1 -0
  20. package/dist/lib/neutral/meta.mjs +9 -0
  21. package/dist/lib/neutral/plugin.mjs +11 -0
  22. package/dist/lib/neutral/plugin.mjs.map +7 -0
  23. package/dist/lib/neutral/react-surface-MD3CVY2N.mjs +23 -0
  24. package/dist/lib/neutral/react-surface-MD3CVY2N.mjs.map +7 -0
  25. package/dist/lib/neutral/translations.mjs +37 -0
  26. package/dist/lib/neutral/translations.mjs.map +7 -0
  27. package/dist/lib/{browser → neutral}/types/index.mjs +1 -1
  28. package/dist/lib/neutral/types/index.mjs.map +7 -0
  29. package/dist/types/src/StackPlugin.d.ts +3 -1
  30. package/dist/types/src/StackPlugin.d.ts.map +1 -1
  31. package/dist/types/src/capabilities/index.d.ts +2 -1
  32. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  33. package/dist/types/src/capabilities/react-surface.d.ts +3 -2
  34. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  35. package/dist/types/src/components/{StackContext.d.ts → StackContext/StackContext.d.ts} +2 -1
  36. package/dist/types/src/components/StackContext/StackContext.d.ts.map +1 -0
  37. package/dist/types/src/components/StackContext/index.d.ts +2 -0
  38. package/dist/types/src/components/StackContext/index.d.ts.map +1 -0
  39. package/dist/types/src/components/{CaretDownUp.d.ts → StackSection/CaretDownUp.d.ts} +1 -1
  40. package/dist/types/src/components/StackSection/CaretDownUp.d.ts.map +1 -0
  41. package/dist/types/src/components/{StackSection.d.ts → StackSection/StackSection.d.ts} +1 -1
  42. package/dist/types/src/components/StackSection/StackSection.d.ts.map +1 -0
  43. package/dist/types/src/components/StackSection/index.d.ts +2 -0
  44. package/dist/types/src/components/StackSection/index.d.ts.map +1 -0
  45. package/dist/types/src/components/{StackSettings.d.ts → StackSettings/StackSettings.d.ts} +1 -1
  46. package/dist/types/src/components/StackSettings/StackSettings.d.ts.map +1 -0
  47. package/dist/types/src/components/StackSettings/index.d.ts +2 -0
  48. package/dist/types/src/components/StackSettings/index.d.ts.map +1 -0
  49. package/dist/types/src/components/index.d.ts +2 -7
  50. package/dist/types/src/components/index.d.ts.map +1 -1
  51. package/dist/types/src/containers/StackArticle/StackArticle.d.ts +7 -0
  52. package/dist/types/src/containers/StackArticle/StackArticle.d.ts.map +1 -0
  53. package/dist/types/src/containers/StackArticle/index.d.ts +2 -0
  54. package/dist/types/src/containers/StackArticle/index.d.ts.map +1 -0
  55. package/dist/types/src/containers/index.d.ts +3 -0
  56. package/dist/types/src/containers/index.d.ts.map +1 -0
  57. package/dist/types/src/index.d.ts +1 -1
  58. package/dist/types/src/index.d.ts.map +1 -1
  59. package/dist/types/src/meta.d.ts +4 -3
  60. package/dist/types/src/meta.d.ts.map +1 -1
  61. package/dist/types/src/plugin.d.ts +3 -0
  62. package/dist/types/src/plugin.d.ts.map +1 -0
  63. package/dist/types/src/translations.d.ts +31 -31
  64. package/dist/types/src/translations.d.ts.map +1 -1
  65. package/dist/types/src/types/stack.d.ts +12 -14
  66. package/dist/types/src/types/stack.d.ts.map +1 -1
  67. package/dist/types/src/types/types.d.ts +2 -3
  68. package/dist/types/src/types/types.d.ts.map +1 -1
  69. package/dist/types/tsconfig.tsbuildinfo +1 -1
  70. package/package.json +87 -54
  71. package/src/StackPlugin.ts +19 -44
  72. package/src/capabilities/index.ts +2 -2
  73. package/src/capabilities/react-surface.tsx +20 -21
  74. package/src/components/{StackContext.tsx → StackContext/StackContext.tsx} +3 -1
  75. package/src/components/StackContext/index.ts +5 -0
  76. package/src/components/{StackSection.tsx → StackSection/StackSection.tsx} +28 -25
  77. package/src/components/StackSection/index.ts +5 -0
  78. package/src/components/StackSettings/StackSettings.tsx +28 -0
  79. package/src/components/StackSettings/index.ts +5 -0
  80. package/src/components/index.ts +2 -4
  81. package/src/containers/StackArticle/StackArticle.tsx +164 -0
  82. package/src/containers/StackArticle/index.ts +5 -0
  83. package/src/containers/index.ts +7 -0
  84. package/src/index.ts +1 -1
  85. package/src/meta.ts +21 -7
  86. package/src/plugin.ts +9 -0
  87. package/src/translations.ts +23 -22
  88. package/src/types/stack.ts +6 -7
  89. package/src/types/types.ts +2 -3
  90. package/src/vite-env.d.ts +10 -0
  91. package/dist/lib/browser/StackContainer-DD3ZD5OE.mjs +0 -299
  92. package/dist/lib/browser/StackContainer-DD3ZD5OE.mjs.map +0 -7
  93. package/dist/lib/browser/chunk-NHMDZYOB.mjs.map +0 -7
  94. package/dist/lib/browser/chunk-UIKFKRFJ.mjs +0 -21
  95. package/dist/lib/browser/chunk-UIKFKRFJ.mjs.map +0 -7
  96. package/dist/lib/browser/index.mjs +0 -99
  97. package/dist/lib/browser/index.mjs.map +0 -7
  98. package/dist/lib/browser/meta.json +0 -1
  99. package/dist/lib/browser/react-surface-HVPK7YZQ.mjs +0 -39
  100. package/dist/lib/browser/react-surface-HVPK7YZQ.mjs.map +0 -7
  101. package/dist/lib/node-esm/StackContainer-JGWPXSUF.mjs +0 -300
  102. package/dist/lib/node-esm/StackContainer-JGWPXSUF.mjs.map +0 -7
  103. package/dist/lib/node-esm/chunk-BGVQYUYP.mjs +0 -23
  104. package/dist/lib/node-esm/chunk-BGVQYUYP.mjs.map +0 -7
  105. package/dist/lib/node-esm/chunk-ZZFA7HIV.mjs +0 -30
  106. package/dist/lib/node-esm/chunk-ZZFA7HIV.mjs.map +0 -7
  107. package/dist/lib/node-esm/index.mjs +0 -100
  108. package/dist/lib/node-esm/index.mjs.map +0 -7
  109. package/dist/lib/node-esm/meta.json +0 -1
  110. package/dist/lib/node-esm/react-surface-HYSD7AC2.mjs +0 -40
  111. package/dist/lib/node-esm/react-surface-HYSD7AC2.mjs.map +0 -7
  112. package/dist/lib/node-esm/types/index.mjs +0 -10
  113. package/dist/types/src/components/CaretDownUp.d.ts.map +0 -1
  114. package/dist/types/src/components/StackContainer.d.ts +0 -9
  115. package/dist/types/src/components/StackContainer.d.ts.map +0 -1
  116. package/dist/types/src/components/StackContext.d.ts.map +0 -1
  117. package/dist/types/src/components/StackSection.d.ts.map +0 -1
  118. package/dist/types/src/components/StackSettings.d.ts.map +0 -1
  119. package/src/components/StackContainer.tsx +0 -172
  120. package/src/components/StackSettings.tsx +0 -30
  121. /package/dist/lib/{browser/types → neutral}/index.mjs.map +0 -0
  122. /package/dist/lib/{node-esm/types/index.mjs.map → neutral/meta.mjs.map} +0 -0
  123. /package/src/components/{CaretDownUp.tsx → StackSection/CaretDownUp.tsx} +0 -0
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/StackContainer.tsx", "../../../src/components/StackContext.tsx", "../../../src/components/StackSection.tsx", "../../../src/components/CaretDownUp.tsx"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport * as Option from 'effect/Option';\nimport React, { useCallback, useState } from 'react';\n\nimport { Capabilities, LayoutAction, createIntent } from '@dxos/app-framework';\nimport { useAppGraph, useCapabilities, useIntentDispatcher } from '@dxos/app-framework/react';\nimport { isLiveObject } from '@dxos/client/echo';\nimport { Obj } from '@dxos/echo';\nimport { SpaceAction } from '@dxos/plugin-space/types';\nimport { Toolbar, toLocalizedString, useTranslation } from '@dxos/react-ui';\nimport { AttentionProvider } from '@dxos/react-ui-attention';\nimport { Stack, StackItem } from '@dxos/react-ui-stack';\nimport { type Collection } from '@dxos/schema';\nimport { isNonNullable } from '@dxos/util';\n\nimport { meta } from '../meta';\nimport {\n type AddSectionPosition,\n type CollapsedSections,\n type StackSectionItem,\n type StackSectionMetadata,\n type StackSectionView,\n} from '../types';\n\nimport { StackContext } from './StackContext';\nimport { StackSection } from './StackSection';\n\ntype StackContainerProps = {\n id: string;\n collection: Collection.Collection;\n};\n\nconst StackContainer = ({ id, collection }: StackContainerProps) => {\n const { dispatchPromise: dispatch } = useIntentDispatcher();\n const { graph } = useAppGraph();\n const { t } = useTranslation(meta.id);\n const allMetadata = useCapabilities(Capabilities.Metadata);\n const [collapsedSections, setCollapsedSections] = useState<CollapsedSections>({});\n\n // TODO(wittjosiah): Re-implement stack views with relations.\n // const defaultStack = useMemo(() => Obj.make(StackViewType, { sections: {} }), [collection]);\n // const stack = (collection.views[StackViewType.typename]?.target as StackViewType | undefined) ?? defaultStack;\n // useEffect(() => {\n // if (!collection.views[StackViewType.typename]) {\n // collection.views[StackViewType.typename] = Ref.make(stack);\n // }\n // }, [collection, stack]);\n\n const items =\n collection.objects\n // TODO(wittjosiah): Should the database handle this differently?\n // TODO(wittjosiah): Render placeholders for missing objects so they can be removed from the stack?\n .map((object) => object.target)\n .filter(isNonNullable)\n .map((object) => {\n const metadata = allMetadata.find((m) => m.id === (Obj.getTypename(object) ?? 'never'))\n ?.metadata as StackSectionMetadata;\n const view = {\n // ...stack.sections[object.id],\n collapsed: collapsedSections[Obj.getDXN(object).toString()],\n title:\n (object as any)?.title ??\n // TODO(wittjosiah): `getNode` is not reactive.\n toLocalizedString(graph.getNode(Obj.getDXN(object).toString()).pipe(Option.getOrNull)?.properties.label, t),\n } as StackSectionView;\n return { id: Obj.getDXN(object).toString(), object, metadata, view } satisfies StackSectionItem;\n }) ?? [];\n\n const handleDelete = useCallback(\n async (id: string) => {\n const index = collection.objects\n .map((object) => object.target)\n .filter(isNonNullable)\n .findIndex((section) => Obj.getDXN(section).toString() === id);\n const object = collection.objects[index].target;\n if (isLiveObject(object)) {\n await dispatch(\n createIntent(SpaceAction.RemoveObjects, {\n objects: [object],\n target: collection,\n }),\n );\n\n // TODO(wittjosiah): The section should also be removed, but needs to be restored if the action is undone.\n // delete stack.sections[Path.last(path)];\n }\n },\n [collection, dispatch],\n );\n\n const handleAdd = useCallback(\n async (id: string, position: AddSectionPosition) => {\n await dispatch?.(\n // TODO(wittjosiah): Use object creation dialog.\n createIntent(LayoutAction.UpdateDialog, {\n part: 'dialog',\n subject: `${meta.id}/AddSectionDialog`,\n options: {\n blockAlign: 'start',\n props: {\n path: id,\n position,\n collection,\n },\n },\n }),\n );\n },\n [collection, dispatch],\n );\n\n const handleNavigate = useCallback(\n async (id: string) => {\n await dispatch(createIntent(LayoutAction.Open, { part: 'main', subject: [id] }));\n },\n [dispatch],\n );\n\n const handleCollapse = useCallback(\n (id: string, collapsed: boolean) => setCollapsedSections((prev) => ({ ...prev, [id]: collapsed })),\n [],\n );\n\n const handleAddSection = useCallback(\n () =>\n dispatch?.(\n createIntent(SpaceAction.OpenCreateObject, {\n target: collection,\n navigable: false,\n }),\n ),\n [collection, dispatch],\n );\n\n return (\n <StackItem.Content\n toolbar\n classNames='container-max-width overflow-hidden border-l border-r border-subduedSeparator'\n >\n <Toolbar.Root>\n <Toolbar.IconButton\n icon='ph--plus--regular'\n iconOnly\n label='Add section'\n data-testid='stack.addSection'\n onClick={handleAddSection}\n />\n </Toolbar.Root>\n <AttentionProvider id={id}>\n <StackContext.Provider\n value={{\n onCollapse: handleCollapse,\n onNavigate: handleNavigate,\n onDelete: handleDelete,\n onAdd: handleAdd,\n }}\n >\n <Stack orientation='vertical' size='intrinsic' id={id} data-testid='main.stack' classNames='overflow-y-auto'>\n {items.map((item) => (\n <StackSection key={item.id} {...item} />\n ))}\n </Stack>\n </StackContext.Provider>\n </AttentionProvider>\n </StackItem.Content>\n );\n};\n\nexport default StackContainer;\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { createContext, useContext } from 'react';\n\nimport { type AddSectionPosition } from '../types';\n\nexport type StackContextValue = {\n onCollapse: (id: string, collapsed: boolean) => void;\n onNavigate: (id: string) => Promise<void>;\n onDelete: (id: string) => Promise<void>;\n onAdd: (id: string, position: AddSectionPosition) => void;\n};\n\nexport const StackContext = createContext<StackContextValue>({\n onCollapse: () => {},\n onNavigate: async () => {},\n onDelete: async () => {},\n onAdd: () => {},\n});\n\nexport const useStack = () => useContext(StackContext);\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport * as CollapsiblePrimitive from '@radix-ui/react-collapsible';\nimport React, { useMemo, useState } from 'react';\n\nimport { Surface } from '@dxos/app-framework/react';\nimport { DropdownMenu, Icon, IconButton, useTranslation } from '@dxos/react-ui';\nimport { useAttentionAttributes } from '@dxos/react-ui-attention';\nimport { StackItem } from '@dxos/react-ui-stack';\nimport { getSize, mx, textBlockWidth } from '@dxos/react-ui-theme';\n\nimport { meta } from '../meta';\nimport { type StackSectionItem } from '../types';\n\nimport { CaretDownUp } from './CaretDownUp';\nimport { useStack } from './StackContext';\n\nconst sectionActionDimensions = 'p-1 mlb-1 shrink-0 min-bs-0 is-[--rail-action] bs-min';\n\nexport type StackSectionProps = StackSectionItem;\n\nexport const StackSection = ({\n id,\n view,\n object,\n metadata: { icon = 'ph--placeholder--regular' },\n}: StackSectionProps) => {\n const { t } = useTranslation(meta.id);\n const { onNavigate, onAdd, onCollapse, onDelete } = useStack();\n const [optionsMenuOpen, setOptionsMenuOpen] = useState(false);\n const attentionAttrs = useAttentionAttributes(id);\n const stackItem = useMemo(() => ({ id }), [id]);\n\n return (\n <CollapsiblePrimitive.Root asChild open={!view.collapsed} onOpenChange={(nextOpen) => onCollapse?.(id, !nextOpen)}>\n <StackItem.Root item={stackItem} role='section' {...attentionAttrs}>\n <StackItem.Heading classNames='attention-surface'>\n <span className='sr-only'>{view.title}</span>\n <StackItem.HeadingStickyContent>\n <DropdownMenu.Root\n {...{\n open: optionsMenuOpen,\n onOpenChange: setOptionsMenuOpen,\n }}\n >\n <DropdownMenu.Trigger asChild>\n <StackItem.SigilButton>\n <Icon icon={icon} size={5} classNames='transition-opacity' />\n </StackItem.SigilButton>\n </DropdownMenu.Trigger>\n <DropdownMenu.Portal>\n <DropdownMenu.Content>\n <DropdownMenu.Viewport>\n {view.collapsed ? (\n <DropdownMenu.Item onClick={() => onNavigate(id)} data-testid='section.navigate-to'>\n <Icon icon='ph--arrow-right--regular' size={5} />\n <span className='mis-2 grow'>{t('navigate to section label')}</span>\n </DropdownMenu.Item>\n ) : (\n <CollapsiblePrimitive.Trigger asChild>\n <DropdownMenu.Item>\n <CaretDownUp className={getSize(5)} />\n <span className='mis-2 grow'>{t('collapse label')}</span>\n </DropdownMenu.Item>\n </CollapsiblePrimitive.Trigger>\n )}\n <DropdownMenu.Item onClick={() => onAdd(id, 'before')} data-testid='section.add-before'>\n <Icon icon='ph--arrow-line-up--regular' size={5} />\n <span className='mis-2 grow'>{t('add section before label')}</span>\n </DropdownMenu.Item>\n <DropdownMenu.Item onClick={() => onAdd(id, 'after')} data-testid='section.add-after'>\n <Icon icon='ph--arrow-line-down--regular' size={5} />\n <span className='mis-2 grow'>{t('add section after label')}</span>\n </DropdownMenu.Item>\n <DropdownMenu.Item onClick={() => onDelete(id)} data-testid='section.remove'>\n <Icon icon='ph--trash--regular' size={5} />\n <span className='mis-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 {view.collapsed ? (\n <CollapsiblePrimitive.Trigger asChild>\n <IconButton\n iconOnly\n variant='ghost'\n label={t('expand label')}\n icon='ph--caret-up-down--regular'\n classNames={sectionActionDimensions}\n />\n </CollapsiblePrimitive.Trigger>\n ) : (\n <IconButton\n iconOnly\n variant='ghost'\n onClick={() => onNavigate(id)}\n label={t('navigate to section label')}\n icon='ph--arrow-right--regular'\n data-testid='section.navigate-to'\n classNames={sectionActionDimensions}\n />\n )}\n </StackItem.HeadingStickyContent>\n </StackItem.Heading>\n <CollapsiblePrimitive.Content>\n <Surface role='section' data={{ subject: object }} limit={1} placeholder={<></>} />\n </CollapsiblePrimitive.Content>\n {view.collapsed && (\n <StackItem.Content classNames='attention-surface'>\n <h2 className={mx('flex items-center p-4 font-medium', textBlockWidth)}>{view.title}</h2>\n </StackItem.Content>\n )}\n </StackItem.Root>\n </CollapsiblePrimitive.Root>\n );\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { type ComponentPropsWithoutRef } from 'react';\n\nexport const CaretDownUp = ({ children, ...props }: ComponentPropsWithoutRef<'svg'>) => {\n return (\n <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256' {...props}>\n <rect width='256' height='256' fill='none' />\n <polyline\n points='80 224 128 176 176 224'\n fill='none'\n stroke='currentColor'\n strokeLinecap='round'\n strokeLinejoin='round'\n strokeWidth='16'\n />\n <polyline\n points='80 32 128 80 176 32'\n fill='none'\n stroke='currentColor'\n strokeLinecap='round'\n strokeLinejoin='round'\n strokeWidth='16'\n />\n {children}\n </svg>\n );\n};\n"],
5
- "mappings": ";;;;;;;AAIA,YAAYA,YAAY;AACxB,OAAOC,UAASC,aAAaC,YAAAA,iBAAgB;AAE7C,SAASC,cAAcC,cAAcC,oBAAoB;AACzD,SAASC,aAAaC,iBAAiBC,2BAA2B;AAClE,SAASC,oBAAoB;A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AA,CAAE;AAGJ,UAAMiC,mBAAmBtB,YACvB,MACEtC,WACE2C,aAAaC,YAAYiB,kBAAkB;MACzC3C,QAAQpB;MACRgE,WAAW;IACb,CAAA,CAAA,GAEJ;MAAChE;MAAYE;KAAS;AAGxB,WACE,gBAAA+D,OAAA,cAACC,WAAUC,SAAO;MAChBC,SAAAA;MACAC,YAAW;OAEX,gBAAAJ,OAAA,cAACK,QAAQC,MAAI,MACX,gBAAAN,OAAA,cAACK,QAAQE,YAAU;MACjBC,MAAK;MACLC,UAAAA;MACApC,OAAM;MACNqC,eAAY;MACZC,SAASd;SAGb,gBAAAG,OAAA,cAACY,mBAAAA;MAAkB9E;OACjB,gBAAAkE,OAAA,cAACa,aAAaC,UAAQ;MACpBC,OAAO;QACLC,YAAYrB;QACZsB,YAAYxB;QACZyB,UAAU5C;QACV6C,OAAOpC;MACT;OAEA,gBAAAiB,OAAA,cAACoB,OAAAA;MAAMC,aAAY;MAAWC,MAAK;MAAYxF;MAAQ4E,eAAY;MAAaN,YAAW;OACxFrD,MAAME,IAAI,CAACsE,SACV,gBAAAvB,OAAA,cAACwB,cAAAA;MAAaC,KAAKF,KAAKzF;MAAK,GAAGyF;;;;;AAO9C;AAEA,IAAA,yBAAe1F;",
6
- "names": ["Option", "React", "useCallback", "useState", "Capabilities", "LayoutAction", "createIntent", "useAppGraph", "useCapabilities", "useIntentDispatcher", "isLiveObject", "Obj", "SpaceAction", "Toolbar", "toLocalizedString", "useTranslation", "AttentionProvider", "Stack", "StackItem", "isNonNullable", "createContext", "useContext", "StackContext", "createContext", "onCollapse", "onNavigate", "onDelete", "onAdd", "useStack", "useContext", "CollapsiblePrimitive", "React", "useMemo", "useState", "Surface", "DropdownMenu", "Icon", "IconButton", "useTranslation", "useAttentionAttributes", "StackItem", "getSize", "mx", "textBlockWidth", "React", "CaretDownUp", "children", "props", "svg", "xmlns", "viewBox", "rect", "width", "height", "fill", "polyline", "points", "stroke", "strokeLinecap", "strokeLinejoin", "strokeWidth", "sectionActionDimensions", "StackSection", "id", "view", "object", "metadata", "icon", "t", "useTranslation", "meta", "onNavigate", "onAdd", "onCollapse", "onDelete", "useStack", "optionsMenuOpen", "setOptionsMenuOpen", "useState", "attentionAttrs", "useAttentionAttributes", "stackItem", "useMemo", "React", "Root", "asChild", "open", "collapsed", "onOpenChange", "nextOpen", "StackItem", "item", "role", "Heading", "classNames", "span", "className", "title", "HeadingStickyContent", "DropdownMenu", "Trigger", "SigilButton", "Icon", "size", "Portal", "Content", "Viewport", "Item", "onClick", "data-testid", "CaretDownUp", "getSize", "Arrow", "IconButton", "iconOnly", "variant", "label", "Surface", "data", "subject", "limit", "placeholder", "h2", "mx", "textBlockWidth", "StackContainer", "id", "collection", "dispatchPromise", "dispatch", "useIntentDispatcher", "graph", "useAppGraph", "t", "useTranslation", "meta", "allMetadata", "useCapabilities", "Capabilities", "Metadata", "collapsedSections", "setCollapsedSections", "useState", "items", "objects", "map", "object", "target", "filter", "isNonNullable", "metadata", "find", "m", "Obj", "getTypename", "view", "collapsed", "getDXN", "toString", "title", "toLocalizedString", "getNode", "pipe", "getOrNull", "properties", "label", "handleDelete", "useCallback", "index", "findIndex", "section", "isLiveObject", "createIntent", "SpaceAction", "RemoveObjects", "handleAdd", "position", "LayoutAction", "UpdateDialog", "part", "subject", "options", "blockAlign", "props", "path", "handleNavigate", "Open", "handleCollapse", "prev", "handleAddSection", "OpenCreateObject", "navigable", "React", "StackItem", "Content", "toolbar", "classNames", "Toolbar", "Root", "IconButton", "icon", "iconOnly", "data-testid", "onClick", "AttentionProvider", "StackContext", "Provider", "value", "onCollapse", "onNavigate", "onDelete", "onAdd", "Stack", "orientation", "size", "item", "StackSection", "key"]
7
- }
@@ -1,23 +0,0 @@
1
- import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
-
3
- // src/meta.ts
4
- import { trim } from "@dxos/util";
5
- var SECTION_IDENTIFIER = "dxos.org/type/StackSection";
6
- var meta = {
7
- id: "dxos.org/plugin/stack",
8
- // TODO(wittjosiah): Prevents "stacks" language from being exposed to users in settings panel.
9
- // Conside renaming this to the collection plugin and trying to factor more collections logic from the space plugin.
10
- name: "Collections",
11
- description: trim`
12
- Organize and view curated collections of workspace objects in customizable layouts.
13
- Group related items together and manage collections with sections and filtering.
14
- `,
15
- icon: "ph--stack-simple--regular",
16
- source: "https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-stack"
17
- };
18
-
19
- export {
20
- SECTION_IDENTIFIER,
21
- meta
22
- };
23
- //# sourceMappingURL=chunk-BGVQYUYP.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/meta.ts"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type PluginMeta } from '@dxos/app-framework';\nimport { trim } from '@dxos/util';\n\nexport const SECTION_IDENTIFIER = 'dxos.org/type/StackSection';\n\nexport const meta: PluginMeta = {\n id: 'dxos.org/plugin/stack',\n // TODO(wittjosiah): Prevents \"stacks\" language from being exposed to users in settings panel.\n // Conside renaming this to the collection plugin and trying to factor more collections logic from the space plugin.\n name: 'Collections',\n description: trim`\n Organize and view curated collections of workspace objects in customizable layouts.\n Group related items together and manage collections with sections and filtering.\n `,\n icon: 'ph--stack-simple--regular',\n source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-stack',\n};\n"],
5
- "mappings": ";;;AAKA,SAASA,YAAY;AAEd,IAAMC,qBAAqB;AAE3B,IAAMC,OAAmB;EAC9BC,IAAI;;;EAGJC,MAAM;EACNC,aAAaC;;;;EAIbC,MAAM;EACNC,QAAQ;AACV;",
6
- "names": ["trim", "SECTION_IDENTIFIER", "meta", "id", "name", "description", "trim", "icon", "source"]
7
- }
@@ -1,30 +0,0 @@
1
- import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
-
3
- // src/types/stack.ts
4
- import * as Schema from "effect/Schema";
5
- import { TypedObject } from "@dxos/echo/internal";
6
- var SectionSchema = Schema.Struct({
7
- height: Schema.optional(Schema.Number),
8
- // Space for data that isn't stack-specific but is specific to this view instance.
9
- // e.g. cover/fill for an image
10
- custom: Schema.optional(Schema.Record({
11
- key: Schema.String,
12
- value: Schema.Any
13
- }))
14
- });
15
- var StackViewType = class extends TypedObject({
16
- typename: "dxos.org/type/StackView",
17
- version: "0.1.0"
18
- })({
19
- sections: Schema.mutable(Schema.Record({
20
- key: Schema.String,
21
- value: SectionSchema
22
- }))
23
- }) {
24
- };
25
-
26
- export {
27
- SectionSchema,
28
- StackViewType
29
- };
30
- //# sourceMappingURL=chunk-ZZFA7HIV.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/types/stack.ts"],
4
- "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { TypedObject } from '@dxos/echo/internal';\n\n// All section metadata needs to be optional/have defaults.\n// Any objects added to the collection will start with the section defaults.\n// If an object is removed from the collection without removing the section metadata this is fine.\n// Stack components should clean-up the superfluous data on future edits.\n\nexport const SectionSchema = Schema.Struct({\n height: Schema.optional(Schema.Number),\n // Space for data that isn't stack-specific but is specific to this view instance.\n // e.g. cover/fill for an image\n custom: Schema.optional(Schema.Record({ key: Schema.String, value: Schema.Any })),\n});\n\n// TODO(wittjosiah): This needs a relation to be connected to a stack.\nexport class StackViewType extends TypedObject({\n typename: 'dxos.org/type/StackView',\n version: '0.1.0',\n})({\n sections: Schema.mutable(Schema.Record({ key: Schema.String, value: SectionSchema })),\n}) {}\n"],
5
- "mappings": ";;;AAIA,YAAYA,YAAY;AAExB,SAASC,mBAAmB;AAOrB,IAAMC,gBAAuBC,cAAO;EACzCC,QAAeC,gBAAgBC,aAAM;;;EAGrCC,QAAeF,gBAAgBG,cAAO;IAAEC,KAAYC;IAAQC,OAAcC;EAAI,CAAA,CAAA;AAChF,CAAA;AAGO,IAAMC,gBAAN,cAA4BC,YAAY;EAC7CC,UAAU;EACVC,SAAS;AACX,CAAA,EAAG;EACDC,UAAiBC,eAAeV,cAAO;IAAEC,KAAYC;IAAQC,OAAOT;EAAc,CAAA,CAAA;AACpF,CAAA,EAAA;AAAI;",
6
- "names": ["Schema", "TypedObject", "SectionSchema", "Struct", "height", "optional", "Number", "custom", "Record", "key", "String", "value", "Any", "StackViewType", "TypedObject", "typename", "version", "sections", "mutable"]
7
- }
@@ -1,100 +0,0 @@
1
- import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
- import {
3
- StackViewType
4
- } from "./chunk-ZZFA7HIV.mjs";
5
- import {
6
- SECTION_IDENTIFIER,
7
- meta
8
- } from "./chunk-BGVQYUYP.mjs";
9
-
10
- // src/StackPlugin.ts
11
- import { Capabilities, Events, contributes, defineModule, definePlugin } from "@dxos/app-framework";
12
- import { ClientCapabilities, ClientEvents } from "@dxos/plugin-client";
13
-
14
- // src/capabilities/index.ts
15
- import { lazy } from "@dxos/app-framework";
16
- var ReactSurface = lazy(() => import("./react-surface-HYSD7AC2.mjs"));
17
-
18
- // src/translations.ts
19
- import { translations as stackTranslations } from "@dxos/react-ui-stack";
20
- var translations = [
21
- {
22
- "en-US": {
23
- [meta.id]: {
24
- "plugin name": "Stacks",
25
- "settings title": "Stack plugin settings",
26
- "settings separation label": "Separate sections",
27
- "add section beforeAll dialog title": "Add a section to the start",
28
- "add section afterAll dialog title": "Add a section to the end",
29
- "add section before dialog title": "Add a section",
30
- "add section after dialog title": "Add a section",
31
- "add section input placeholder": "Find the type of section to add",
32
- "upload file label": "Add file",
33
- "add section label": "Add section",
34
- "empty stack message": "Drag items into the stack.",
35
- "remove section label": "Delete",
36
- "navigate to section label": "Navigate to item",
37
- "untitled section title": "Untitled section",
38
- "add section before label": "Add before",
39
- "add section after label": "Add after",
40
- "expand label": "Expand",
41
- "collapse label": "Collapse",
42
- "open chat thread label": "Open chat thread",
43
- "drag handle label": "Press space or enter to begin dragging this item."
44
- }
45
- }
46
- },
47
- ...stackTranslations
48
- ];
49
-
50
- // src/StackPlugin.ts
51
- var StackPlugin = definePlugin(meta, () => [
52
- defineModule({
53
- id: `${meta.id}/module/translations`,
54
- activatesOn: Events.SetupTranslations,
55
- activate: () => contributes(Capabilities.Translations, translations)
56
- }),
57
- defineModule({
58
- id: `${meta.id}/module/metadata`,
59
- activatesOn: Events.SetupMetadata,
60
- activate: () => [
61
- contributes(Capabilities.Metadata, {
62
- id: SECTION_IDENTIFIER,
63
- metadata: {
64
- parse: (section, type) => {
65
- switch (type) {
66
- case "node":
67
- return {
68
- id: section.object.id,
69
- label: section.object.title,
70
- data: section.object
71
- };
72
- case "object":
73
- return section.object;
74
- case "view-object":
75
- return section;
76
- }
77
- }
78
- }
79
- })
80
- ]
81
- }),
82
- defineModule({
83
- id: `${meta.id}/module/schema`,
84
- activatesOn: ClientEvents.SetupSchema,
85
- activate: () => contributes(ClientCapabilities.Schema, [
86
- StackViewType
87
- ])
88
- }),
89
- defineModule({
90
- id: `${meta.id}/module/react-surface`,
91
- activatesOn: Events.SetupReactSurface,
92
- activate: ReactSurface
93
- })
94
- ]);
95
- export {
96
- SECTION_IDENTIFIER,
97
- StackPlugin,
98
- meta
99
- };
100
- //# sourceMappingURL=index.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/StackPlugin.ts", "../../../src/capabilities/index.ts", "../../../src/translations.ts"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { Capabilities, Events, contributes, defineModule, definePlugin } from '@dxos/app-framework';\nimport { type Obj } from '@dxos/echo';\nimport { ClientCapabilities, ClientEvents } from '@dxos/plugin-client';\n\nimport { ReactSurface } from './capabilities';\nimport { SECTION_IDENTIFIER, meta } from './meta';\nimport { translations } from './translations';\nimport { StackViewType } from './types';\n\nexport const StackPlugin = definePlugin(meta, () => [\n defineModule({\n id: `${meta.id}/module/translations`,\n activatesOn: Events.SetupTranslations,\n activate: () => contributes(Capabilities.Translations, translations),\n }),\n defineModule({\n id: `${meta.id}/module/metadata`,\n activatesOn: Events.SetupMetadata,\n activate: () => [\n contributes(Capabilities.Metadata, {\n id: SECTION_IDENTIFIER,\n metadata: {\n parse: (section: { object: Obj.Any }, type: string) => {\n switch (type) {\n case 'node':\n return { id: section.object.id, label: (section.object as any).title, data: section.object };\n case 'object':\n return section.object;\n case 'view-object':\n return section;\n }\n },\n },\n }),\n ],\n }),\n defineModule({\n id: `${meta.id}/module/schema`,\n activatesOn: ClientEvents.SetupSchema,\n activate: () => contributes(ClientCapabilities.Schema, [StackViewType]),\n }),\n defineModule({\n id: `${meta.id}/module/react-surface`,\n activatesOn: Events.SetupReactSurface,\n activate: ReactSurface,\n }),\n]);\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { lazy } from '@dxos/app-framework';\n\nexport const ReactSurface = lazy(() => import('./react-surface'));\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Resource } from '@dxos/react-ui';\nimport { translations as stackTranslations } from '@dxos/react-ui-stack';\n\nimport { meta } from './meta';\n\nexport const translations = [\n {\n 'en-US': {\n [meta.id]: {\n 'plugin name': 'Stacks',\n 'settings title': 'Stack plugin settings',\n 'settings separation label': 'Separate sections',\n 'add section beforeAll dialog title': 'Add a section to the start',\n 'add section afterAll dialog title': 'Add a section to the end',\n 'add section before dialog title': 'Add a section',\n 'add section after dialog title': 'Add a section',\n 'add section input placeholder': 'Find the type of section to add',\n 'upload file label': 'Add file',\n 'add section label': 'Add section',\n 'empty stack message': 'Drag items into the stack.',\n 'remove section label': 'Delete',\n 'navigate to section label': 'Navigate to item',\n 'untitled section title': 'Untitled section',\n 'add section before label': 'Add before',\n 'add section after label': 'Add after',\n 'expand label': 'Expand',\n 'collapse label': 'Collapse',\n 'open chat thread label': 'Open chat thread',\n 'drag handle label': 'Press space or enter to begin dragging this item.',\n },\n },\n },\n ...stackTranslations,\n] as const satisfies Resource[];\n"],
5
- "mappings": ";;;;;;;;;;AAIA,SAASA,cAAcC,QAAQC,aAAaC,cAAcC,oBAAoB;AAE9E,SAASC,oBA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ACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaC,OAAOuB;IACpBrB,UAAUsB;EACZ,CAAA;CACD;",
6
- "names": ["Capabilities", "Events", "contributes", "defineModule", "definePlugin", "ClientCapabilities", "ClientEvents", "lazy", "ReactSurface", "lazy", "translations", "stackTranslations", "translations", "meta", "id", "stackTranslations", "StackPlugin", "definePlugin", "meta", "defineModule", "id", "activatesOn", "Events", "SetupTranslations", "activate", "contributes", "Capabilities", "Translations", "translations", "SetupMetadata", "Metadata", "SECTION_IDENTIFIER", "metadata", "parse", "section", "type", "object", "label", "title", "data", "ClientEvents", "SetupSchema", "ClientCapabilities", "Schema", "StackViewType", "SetupReactSurface", "ReactSurface"]
7
- }
@@ -1 +0,0 @@
1
- {"inputs":{"src/meta.ts":{"bytes":2526,"imports":[{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"src/components/StackSettings.tsx":{"bytes":3545,"imports":[{"path":"@preact-signals/safe-react/tracking","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-form","kind":"import-statement","external":true},{"path":"src/meta.ts","kind":"import-statement","original":"../meta"}],"format":"esm"},"src/components/StackContext.tsx":{"bytes":1834,"imports":[{"path":"react","kind":"import-statement","external":true}],"format":"esm"},"src/components/CaretDownUp.tsx":{"bytes":3228,"imports":[{"path":"@preact-signals/safe-react/tracking","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true}],"format":"esm"},"src/components/StackSection.tsx":{"bytes":17874,"imports":[{"path":"@preact-signals/safe-react/tracking","kind":"import-statement","external":true},{"path":"@radix-ui/react-collapsible","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework/react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-attention","kind":"import-statement","external":true},{"path":"@dxos/react-ui-stack","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"src/meta.ts","kind":"import-statement","original":"../meta"},{"path":"src/components/CaretDownUp.tsx","kind":"import-statement","original":"./CaretDownUp"},{"path":"src/components/StackContext.tsx","kind":"import-statement","original":"./StackContext"}],"format":"esm"},"src/components/StackContainer.tsx":{"bytes":19859,"imports":[{"path":"@preact-signals/safe-react/tracking","kind":"import-statement","external":true},{"path":"effect/Option","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/app-framework/react","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/plugin-space/types","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-attention","kind":"import-statement","external":true},{"path":"@dxos/react-ui-stack","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"src/meta.ts","kind":"import-statement","original":"../meta"},{"path":"src/components/StackContext.tsx","kind":"import-statement","original":"./StackContext"},{"path":"src/components/StackSection.tsx","kind":"import-statement","original":"./StackSection"}],"format":"esm"},"src/components/index.ts":{"bytes":858,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"src/components/StackSettings.tsx","kind":"import-statement","original":"./StackSettings"},{"path":"src/components/StackContainer.tsx","kind":"dynamic-import","original":"./StackContainer"}],"format":"esm"},"src/capabilities/react-surface.tsx":{"bytes":3873,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/schema","kind":"import-statement","external":true},{"path":"src/components/index.ts","kind":"import-statement","original":"../components"},{"path":"src/meta.ts","kind":"import-statement","original":"../meta"}],"format":"esm"},"src/capabilities/index.ts":{"bytes":778,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"src/capabilities/react-surface.tsx","kind":"dynamic-import","original":"./react-surface"}],"format":"esm"},"src/translations.ts":{"bytes":4437,"imports":[{"path":"@dxos/react-ui-stack","kind":"import-statement","external":true},{"path":"src/meta.ts","kind":"import-statement","original":"./meta"}],"format":"esm"},"src/types/stack.ts":{"bytes":3643,"imports":[{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/echo/internal","kind":"import-statement","external":true}],"format":"esm"},"src/types/index.ts":{"bytes":499,"imports":[{"path":"src/types/stack.ts","kind":"import-statement","original":"./stack"}],"format":"esm"},"src/StackPlugin.ts":{"bytes":6689,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/plugin-client","kind":"import-statement","external":true},{"path":"src/capabilities/index.ts","kind":"import-statement","original":"./capabilities"},{"path":"src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"src/translations.ts","kind":"import-statement","original":"./translations"},{"path":"src/types/index.ts","kind":"import-statement","original":"./types"}],"format":"esm"},"src/index.ts":{"bytes":547,"imports":[{"path":"src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"src/StackPlugin.ts","kind":"import-statement","original":"./StackPlugin"}],"format":"esm"}},"outputs":{"dist/lib/node-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":5373},"dist/lib/node-esm/index.mjs":{"imports":[{"path":"dist/lib/node-esm/chunk-ZZFA7HIV.mjs","kind":"import-statement"},{"path":"dist/lib/node-esm/chunk-BGVQYUYP.mjs","kind":"import-statement"},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/plugin-client","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"dist/lib/node-esm/react-surface-HYSD7AC2.mjs","kind":"dynamic-import"},{"path":"@dxos/react-ui-stack","kind":"import-statement","external":true}],"exports":["SECTION_IDENTIFIER","StackPlugin","meta"],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":0},"src/StackPlugin.ts":{"bytesInOutput":1394},"src/capabilities/index.ts":{"bytesInOutput":115},"src/translations.ts":{"bytesInOutput":1268}},"bytes":3185},"dist/lib/node-esm/types/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"dist/lib/node-esm/types/index.mjs":{"imports":[{"path":"dist/lib/node-esm/chunk-ZZFA7HIV.mjs","kind":"import-statement"}],"exports":["SectionSchema","StackViewType"],"entryPoint":"src/types/index.ts","inputs":{},"bytes":246},"dist/lib/node-esm/chunk-ZZFA7HIV.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1697},"dist/lib/node-esm/chunk-ZZFA7HIV.mjs":{"imports":[{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/echo/internal","kind":"import-statement","external":true}],"exports":["SectionSchema","StackViewType"],"inputs":{"src/types/stack.ts":{"bytesInOutput":605},"src/types/index.ts":{"bytesInOutput":0}},"bytes":810},"dist/lib/node-esm/StackContainer-JGWPXSUF.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":21902},"dist/lib/node-esm/StackContainer-JGWPXSUF.mjs":{"imports":[{"path":"dist/lib/node-esm/chunk-BGVQYUYP.mjs","kind":"import-statement"},{"path":"@preact-signals/safe-react/tracking","kind":"import-statement","external":true},{"path":"effect/Option","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/app-framework/react","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/plugin-space/types","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-attention","kind":"import-statement","external":true},{"path":"@dxos/react-ui-stack","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@preact-signals/safe-react/tracking","kind":"import-statement","external":true},{"path":"@radix-ui/react-collapsible","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework/react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-attention","kind":"import-statement","external":true},{"path":"@dxos/react-ui-stack","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"@preact-signals/safe-react/tracking","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"src/components/StackContainer.tsx","inputs":{"src/components/StackContainer.tsx":{"bytesInOutput":4587},"src/components/StackContext.tsx":{"bytesInOutput":265},"src/components/StackSection.tsx":{"bytesInOutput":5412},"src/components/CaretDownUp.tsx":{"bytesInOutput":972}},"bytes":11695},"dist/lib/node-esm/react-surface-HYSD7AC2.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3435},"dist/lib/node-esm/react-surface-HYSD7AC2.mjs":{"imports":[{"path":"dist/lib/node-esm/chunk-BGVQYUYP.mjs","kind":"import-statement"},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/schema","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@preact-signals/safe-react/tracking","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-form","kind":"import-statement","external":true},{"path":"dist/lib/node-esm/StackContainer-JGWPXSUF.mjs","kind":"dynamic-import"}],"exports":["default"],"entryPoint":"src/capabilities/react-surface.tsx","inputs":{"src/capabilities/react-surface.tsx":{"bytesInOutput":655},"src/components/index.ts":{"bytesInOutput":104},"src/components/StackSettings.tsx":{"bytesInOutput":263}},"bytes":1431},"dist/lib/node-esm/chunk-BGVQYUYP.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1170},"dist/lib/node-esm/chunk-BGVQYUYP.mjs":{"imports":[{"path":"@dxos/util","kind":"import-statement","external":true}],"exports":["SECTION_IDENTIFIER","meta"],"inputs":{"src/meta.ts":{"bytesInOutput":695}},"bytes":889}}}
@@ -1,40 +0,0 @@
1
- import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
- import {
3
- meta
4
- } from "./chunk-BGVQYUYP.mjs";
5
-
6
- // src/capabilities/react-surface.tsx
7
- import React2 from "react";
8
- import { Capabilities, contributes, createSurface } from "@dxos/app-framework";
9
- import { Obj } from "@dxos/echo";
10
- import { Collection } from "@dxos/schema";
11
-
12
- // src/components/index.ts
13
- import { lazy } from "react";
14
-
15
- // src/components/StackSettings.tsx
16
- import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
17
- import React from "react";
18
- import { Input, useTranslation } from "@dxos/react-ui";
19
- import { ControlGroup, ControlItemInput, ControlPage, ControlSection } from "@dxos/react-ui-form";
20
-
21
- // src/components/index.ts
22
- var StackContainer = lazy(() => import("./StackContainer-JGWPXSUF.mjs"));
23
-
24
- // src/capabilities/react-surface.tsx
25
- var react_surface_default = (() => contributes(Capabilities.ReactSurface, createSurface({
26
- id: `${meta.id}/article`,
27
- role: "article",
28
- filter: (data) => Obj.instanceOf(Collection.Collection, data.subject),
29
- component: ({ data }) => {
30
- const id = typeof data.id === "string" ? data.id : void 0;
31
- return /* @__PURE__ */ React2.createElement(StackContainer, {
32
- id: id ?? Obj.getDXN(data.subject).toString(),
33
- collection: data.subject
34
- });
35
- }
36
- })));
37
- export {
38
- react_surface_default as default
39
- };
40
- //# sourceMappingURL=react-surface-HYSD7AC2.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/capabilities/react-surface.tsx", "../../../src/components/index.ts", "../../../src/components/StackSettings.tsx"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport React from 'react';\n\nimport { Capabilities, contributes, createSurface } from '@dxos/app-framework';\nimport { Obj } from '@dxos/echo';\nimport { Collection } from '@dxos/schema';\n\nimport { StackContainer } from '../components';\nimport { meta } from '../meta';\n\nexport default () =>\n contributes(\n Capabilities.ReactSurface,\n createSurface({\n id: `${meta.id}/article`,\n role: 'article',\n filter: (data): data is { id?: string; subject: Collection.Collection } =>\n Obj.instanceOf(Collection.Collection, data.subject),\n component: ({ data }) => {\n // This allows the id to be overridden by the surface for situations where the id of the collection\n // is not the same as the id of what is being represented (e.g., a space with a root collection).\n const id = typeof data.id === 'string' ? data.id : undefined;\n return <StackContainer id={id ?? Obj.getDXN(data.subject).toString()} collection={data.subject} />;\n },\n }),\n );\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { lazy } from 'react';\n\nexport const StackContainer = lazy(() => import('./StackContainer'));\n\nexport * from './StackSettings';\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nimport { Input, useTranslation } from '@dxos/react-ui';\nimport { ControlGroup, ControlItemInput, ControlPage, ControlSection } from '@dxos/react-ui-form';\n\nimport { meta } from '../meta';\nimport { type StackSettingsProps } from '../types';\n\nexport const StackSettings = ({ settings }: { settings: StackSettingsProps }) => {\n const { t } = useTranslation(meta.id);\n\n return (\n <ControlPage>\n <ControlSection title={t('settings title', { ns: meta.id })}>\n <ControlGroup>\n <ControlItemInput title={t('settings separation label')}>\n <Input.Switch\n checked={settings.separation}\n onCheckedChange={(checked) => (settings.separation = !!checked)}\n />\n </ControlItemInput>\n </ControlGroup>\n </ControlSection>\n </ControlPage>\n );\n};\n"],
5
- "mappings": ";;;;;;AAIA,OAAOA,YAAW;AAElB,SAASC,cAAcC,aAAaC,qBAAqB;AACzD,SAASC,WAAW;AACpB,SAASC,kBAAkB;;;ACJ3B,SAASC,YAAY;;;;ACArB,OAAOC,WAAW;AAElB,SAASC,OAAOC,sBAAsB;AACtC,SAASC,cAAcC,kBAAkBC,aAAaC,sBAAsB;;;ADDrE,IAAMC,iBAAiBC,KAAK,MAAM,OAAO,+BAAA,CAAA;;;ADOhD,IAAA,yBAAe,MACbC,YACEC,aAAaC,cACbC,cAAc;EACZC,IAAI,GAAGC,KAAKD,EAAE;EACdE,MAAM;EACNC,QAAQ,CAACC,SACPC,IAAIC,WAAWC,WAAWA,YAAYH,KAAKI,OAAO;EACpDC,WAAW,CAAC,EAAEL,KAAI,MAAE;AAGlB,UAAMJ,KAAK,OAAOI,KAAKJ,OAAO,WAAWI,KAAKJ,KAAKU;AACnD,WAAO,gBAAAC,OAAA,cAACC,gBAAAA;MAAeZ,IAAIA,MAAMK,IAAIQ,OAAOT,KAAKI,OAAO,EAAEM,SAAQ;MAAIC,YAAYX,KAAKI;;EACzF;AACF,CAAA,CAAA;",
6
- "names": ["React", "Capabilities", "contributes", "createSurface", "Obj", "Collection", "lazy", "React", "Input", "useTranslation", "ControlGroup", "ControlItemInput", "ControlPage", "ControlSection", "StackContainer", "lazy", "contributes", "Capabilities", "ReactSurface", "createSurface", "id", "meta", "role", "filter", "data", "Obj", "instanceOf", "Collection", "subject", "component", "undefined", "React", "StackContainer", "getDXN", "toString", "collection"]
7
- }
@@ -1,10 +0,0 @@
1
- import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
- import {
3
- SectionSchema,
4
- StackViewType
5
- } from "../chunk-ZZFA7HIV.mjs";
6
- export {
7
- SectionSchema,
8
- StackViewType
9
- };
10
- //# sourceMappingURL=index.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CaretDownUp.d.ts","sourceRoot":"","sources":["../../../../src/components/CaretDownUp.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,EAAE,KAAK,wBAAwB,EAAE,MAAM,OAAO,CAAC;AAE7D,eAAO,MAAM,WAAW,GAAI,wBAAwB,wBAAwB,CAAC,KAAK,CAAC,sBAuBlF,CAAC"}
@@ -1,9 +0,0 @@
1
- import React from 'react';
2
- import { type Collection } from '@dxos/schema';
3
- type StackContainerProps = {
4
- id: string;
5
- collection: Collection.Collection;
6
- };
7
- declare const StackContainer: ({ id, collection }: StackContainerProps) => React.JSX.Element;
8
- export default StackContainer;
9
- //# sourceMappingURL=StackContainer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"StackContainer.d.ts","sourceRoot":"","sources":["../../../../src/components/StackContainer.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAgC,MAAM,OAAO,CAAC;AAUrD,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAe/C,KAAK,mBAAmB,GAAG;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,UAAU,CAAC,UAAU,CAAC;CACnC,CAAC;AAEF,QAAA,MAAM,cAAc,GAAI,oBAAoB,mBAAmB,sBAsI9D,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"StackContext.d.ts","sourceRoot":"","sources":["../../../../src/components/StackContext.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAEnD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,UAAU,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;IACrD,UAAU,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1C,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACxC,KAAK,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,kBAAkB,KAAK,IAAI,CAAC;CAC3D,CAAC;AAEF,eAAO,MAAM,YAAY,4CAKvB,CAAC;AAEH,eAAO,MAAM,QAAQ,yBAAiC,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"StackSection.d.ts","sourceRoot":"","sources":["../../../../src/components/StackSection.tsx"],"names":[],"mappings":"AAKA,OAAO,KAA4B,MAAM,OAAO,CAAC;AASjD,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAOjD,MAAM,MAAM,iBAAiB,GAAG,gBAAgB,CAAC;AAEjD,eAAO,MAAM,YAAY,GAAI,2CAK1B,iBAAiB,sBA2FnB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"StackSettings.d.ts","sourceRoot":"","sources":["../../../../src/components/StackSettings.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAEnD,eAAO,MAAM,aAAa,GAAI,cAAc;IAAE,QAAQ,EAAE,kBAAkB,CAAA;CAAE,sBAiB3E,CAAC"}
@@ -1,172 +0,0 @@
1
- //
2
- // Copyright 2023 DXOS.org
3
- //
4
-
5
- import * as Option from 'effect/Option';
6
- import React, { useCallback, useState } from 'react';
7
-
8
- import { Capabilities, LayoutAction, createIntent } from '@dxos/app-framework';
9
- import { useAppGraph, useCapabilities, useIntentDispatcher } from '@dxos/app-framework/react';
10
- import { isLiveObject } from '@dxos/client/echo';
11
- import { Obj } from '@dxos/echo';
12
- import { SpaceAction } from '@dxos/plugin-space/types';
13
- import { Toolbar, toLocalizedString, useTranslation } from '@dxos/react-ui';
14
- import { AttentionProvider } from '@dxos/react-ui-attention';
15
- import { Stack, StackItem } from '@dxos/react-ui-stack';
16
- import { type Collection } from '@dxos/schema';
17
- import { isNonNullable } from '@dxos/util';
18
-
19
- import { meta } from '../meta';
20
- import {
21
- type AddSectionPosition,
22
- type CollapsedSections,
23
- type StackSectionItem,
24
- type StackSectionMetadata,
25
- type StackSectionView,
26
- } from '../types';
27
-
28
- import { StackContext } from './StackContext';
29
- import { StackSection } from './StackSection';
30
-
31
- type StackContainerProps = {
32
- id: string;
33
- collection: Collection.Collection;
34
- };
35
-
36
- const StackContainer = ({ id, collection }: StackContainerProps) => {
37
- const { dispatchPromise: dispatch } = useIntentDispatcher();
38
- const { graph } = useAppGraph();
39
- const { t } = useTranslation(meta.id);
40
- const allMetadata = useCapabilities(Capabilities.Metadata);
41
- const [collapsedSections, setCollapsedSections] = useState<CollapsedSections>({});
42
-
43
- // TODO(wittjosiah): Re-implement stack views with relations.
44
- // const defaultStack = useMemo(() => Obj.make(StackViewType, { sections: {} }), [collection]);
45
- // const stack = (collection.views[StackViewType.typename]?.target as StackViewType | undefined) ?? defaultStack;
46
- // useEffect(() => {
47
- // if (!collection.views[StackViewType.typename]) {
48
- // collection.views[StackViewType.typename] = Ref.make(stack);
49
- // }
50
- // }, [collection, stack]);
51
-
52
- const items =
53
- collection.objects
54
- // TODO(wittjosiah): Should the database handle this differently?
55
- // TODO(wittjosiah): Render placeholders for missing objects so they can be removed from the stack?
56
- .map((object) => object.target)
57
- .filter(isNonNullable)
58
- .map((object) => {
59
- const metadata = allMetadata.find((m) => m.id === (Obj.getTypename(object) ?? 'never'))
60
- ?.metadata as StackSectionMetadata;
61
- const view = {
62
- // ...stack.sections[object.id],
63
- collapsed: collapsedSections[Obj.getDXN(object).toString()],
64
- title:
65
- (object as any)?.title ??
66
- // TODO(wittjosiah): `getNode` is not reactive.
67
- toLocalizedString(graph.getNode(Obj.getDXN(object).toString()).pipe(Option.getOrNull)?.properties.label, t),
68
- } as StackSectionView;
69
- return { id: Obj.getDXN(object).toString(), object, metadata, view } satisfies StackSectionItem;
70
- }) ?? [];
71
-
72
- const handleDelete = useCallback(
73
- async (id: string) => {
74
- const index = collection.objects
75
- .map((object) => object.target)
76
- .filter(isNonNullable)
77
- .findIndex((section) => Obj.getDXN(section).toString() === id);
78
- const object = collection.objects[index].target;
79
- if (isLiveObject(object)) {
80
- await dispatch(
81
- createIntent(SpaceAction.RemoveObjects, {
82
- objects: [object],
83
- target: collection,
84
- }),
85
- );
86
-
87
- // TODO(wittjosiah): The section should also be removed, but needs to be restored if the action is undone.
88
- // delete stack.sections[Path.last(path)];
89
- }
90
- },
91
- [collection, dispatch],
92
- );
93
-
94
- const handleAdd = useCallback(
95
- async (id: string, position: AddSectionPosition) => {
96
- await dispatch?.(
97
- // TODO(wittjosiah): Use object creation dialog.
98
- createIntent(LayoutAction.UpdateDialog, {
99
- part: 'dialog',
100
- subject: `${meta.id}/AddSectionDialog`,
101
- options: {
102
- blockAlign: 'start',
103
- props: {
104
- path: id,
105
- position,
106
- collection,
107
- },
108
- },
109
- }),
110
- );
111
- },
112
- [collection, dispatch],
113
- );
114
-
115
- const handleNavigate = useCallback(
116
- async (id: string) => {
117
- await dispatch(createIntent(LayoutAction.Open, { part: 'main', subject: [id] }));
118
- },
119
- [dispatch],
120
- );
121
-
122
- const handleCollapse = useCallback(
123
- (id: string, collapsed: boolean) => setCollapsedSections((prev) => ({ ...prev, [id]: collapsed })),
124
- [],
125
- );
126
-
127
- const handleAddSection = useCallback(
128
- () =>
129
- dispatch?.(
130
- createIntent(SpaceAction.OpenCreateObject, {
131
- target: collection,
132
- navigable: false,
133
- }),
134
- ),
135
- [collection, dispatch],
136
- );
137
-
138
- return (
139
- <StackItem.Content
140
- toolbar
141
- classNames='container-max-width overflow-hidden border-l border-r border-subduedSeparator'
142
- >
143
- <Toolbar.Root>
144
- <Toolbar.IconButton
145
- icon='ph--plus--regular'
146
- iconOnly
147
- label='Add section'
148
- data-testid='stack.addSection'
149
- onClick={handleAddSection}
150
- />
151
- </Toolbar.Root>
152
- <AttentionProvider id={id}>
153
- <StackContext.Provider
154
- value={{
155
- onCollapse: handleCollapse,
156
- onNavigate: handleNavigate,
157
- onDelete: handleDelete,
158
- onAdd: handleAdd,
159
- }}
160
- >
161
- <Stack orientation='vertical' size='intrinsic' id={id} data-testid='main.stack' classNames='overflow-y-auto'>
162
- {items.map((item) => (
163
- <StackSection key={item.id} {...item} />
164
- ))}
165
- </Stack>
166
- </StackContext.Provider>
167
- </AttentionProvider>
168
- </StackItem.Content>
169
- );
170
- };
171
-
172
- export default StackContainer;
@@ -1,30 +0,0 @@
1
- //
2
- // Copyright 2023 DXOS.org
3
- //
4
-
5
- import React from 'react';
6
-
7
- import { Input, useTranslation } from '@dxos/react-ui';
8
- import { ControlGroup, ControlItemInput, ControlPage, ControlSection } from '@dxos/react-ui-form';
9
-
10
- import { meta } from '../meta';
11
- import { type StackSettingsProps } from '../types';
12
-
13
- export const StackSettings = ({ settings }: { settings: StackSettingsProps }) => {
14
- const { t } = useTranslation(meta.id);
15
-
16
- return (
17
- <ControlPage>
18
- <ControlSection title={t('settings title', { ns: meta.id })}>
19
- <ControlGroup>
20
- <ControlItemInput title={t('settings separation label')}>
21
- <Input.Switch
22
- checked={settings.separation}
23
- onCheckedChange={(checked) => (settings.separation = !!checked)}
24
- />
25
- </ControlItemInput>
26
- </ControlGroup>
27
- </ControlSection>
28
- </ControlPage>
29
- );
30
- };