@dxos/plugin-stack 0.8.4-main.f9ba587 → 0.8.4-main.fcc0d83b33
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.
- package/dist/lib/browser/index.mjs +48 -90
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/translations.mjs +37 -0
- package/dist/lib/browser/translations.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +21 -4
- package/dist/lib/browser/types/index.mjs.map +4 -4
- package/dist/lib/node-esm/index.mjs +49 -90
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/translations.mjs +39 -0
- package/dist/lib/node-esm/translations.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +22 -4
- package/dist/lib/node-esm/types/index.mjs.map +4 -4
- package/dist/types/src/StackPlugin.d.ts +2 -1
- package/dist/types/src/StackPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +2 -1
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts +3 -2
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/components/{StackContext.d.ts → StackContext/StackContext.d.ts} +2 -1
- package/dist/types/src/components/StackContext/StackContext.d.ts.map +1 -0
- package/dist/types/src/components/StackContext/index.d.ts +2 -0
- package/dist/types/src/components/StackContext/index.d.ts.map +1 -0
- package/dist/types/src/components/{CaretDownUp.d.ts → StackSection/CaretDownUp.d.ts} +1 -1
- package/dist/types/src/components/StackSection/CaretDownUp.d.ts.map +1 -0
- package/dist/types/src/components/{StackSection.d.ts → StackSection/StackSection.d.ts} +1 -1
- package/dist/types/src/components/StackSection/StackSection.d.ts.map +1 -0
- package/dist/types/src/components/StackSection/index.d.ts +2 -0
- package/dist/types/src/components/StackSection/index.d.ts.map +1 -0
- package/dist/types/src/components/{StackSettings.d.ts → StackSettings/StackSettings.d.ts} +1 -1
- package/dist/types/src/components/StackSettings/StackSettings.d.ts.map +1 -0
- package/dist/types/src/components/StackSettings/index.d.ts +2 -0
- package/dist/types/src/components/StackSettings/index.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +2 -4
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/StackContainer/StackContainer.d.ts +7 -0
- package/dist/types/src/containers/StackContainer/StackContainer.d.ts.map +1 -0
- package/dist/types/src/containers/StackContainer/index.d.ts +2 -0
- package/dist/types/src/containers/StackContainer/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +3 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/meta.d.ts +3 -4
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +31 -30
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/index.d.ts +1 -1
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/stack.d.ts +13 -14
- package/dist/types/src/types/stack.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +7 -5
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +59 -46
- package/src/StackPlugin.ts +29 -45
- package/src/capabilities/index.ts +2 -2
- package/src/capabilities/react-surface.tsx +20 -26
- package/src/components/{StackContext.tsx → StackContext/StackContext.tsx} +3 -1
- package/src/components/StackContext/index.ts +5 -0
- package/src/components/{StackSection.tsx → StackSection/StackSection.tsx} +30 -26
- package/src/components/StackSection/index.ts +5 -0
- package/src/components/StackSettings/StackSettings.tsx +28 -0
- package/src/components/StackSettings/index.ts +5 -0
- package/src/components/index.ts +2 -4
- package/src/containers/StackContainer/StackContainer.tsx +170 -0
- package/src/containers/StackContainer/index.ts +5 -0
- package/src/containers/index.ts +7 -0
- package/src/meta.ts +9 -6
- package/src/translations.ts +23 -21
- package/src/types/index.ts +1 -1
- package/src/types/stack.ts +12 -8
- package/src/types/types.ts +4 -5
- package/dist/lib/browser/StackMain-6EC3A3IC.mjs +0 -298
- package/dist/lib/browser/StackMain-6EC3A3IC.mjs.map +0 -7
- package/dist/lib/browser/chunk-FVB7LGW7.mjs +0 -19
- package/dist/lib/browser/chunk-FVB7LGW7.mjs.map +0 -7
- package/dist/lib/browser/chunk-VDSBIEAC.mjs +0 -28
- package/dist/lib/browser/chunk-VDSBIEAC.mjs.map +0 -7
- package/dist/lib/browser/react-surface-KLOW5O2E.mjs +0 -46
- package/dist/lib/browser/react-surface-KLOW5O2E.mjs.map +0 -7
- package/dist/lib/node-esm/StackMain-G55P33OY.mjs +0 -299
- package/dist/lib/node-esm/StackMain-G55P33OY.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-GOXSWCA4.mjs +0 -30
- package/dist/lib/node-esm/chunk-GOXSWCA4.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-UN5PA7TK.mjs +0 -21
- package/dist/lib/node-esm/chunk-UN5PA7TK.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-H33L4IMD.mjs +0 -47
- package/dist/lib/node-esm/react-surface-H33L4IMD.mjs.map +0 -7
- package/dist/types/src/components/CaretDownUp.d.ts.map +0 -1
- package/dist/types/src/components/StackContext.d.ts.map +0 -1
- package/dist/types/src/components/StackMain.d.ts +0 -9
- package/dist/types/src/components/StackMain.d.ts.map +0 -1
- package/dist/types/src/components/StackSection.d.ts.map +0 -1
- package/dist/types/src/components/StackSettings.d.ts.map +0 -1
- package/src/components/StackMain.tsx +0 -160
- package/src/components/StackSettings.tsx +0 -23
- /package/src/components/{CaretDownUp.tsx → StackSection/CaretDownUp.tsx} +0 -0
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/StackMain.tsx", "../../../src/components/StackContext.tsx", "../../../src/components/StackSection.tsx", "../../../src/components/CaretDownUp.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { Plus } from '@phosphor-icons/react';\nimport { Option } from 'effect';\nimport React, { useCallback, useState } from 'react';\n\nimport {\n Capabilities,\n LayoutAction,\n createIntent,\n useAppGraph,\n useCapabilities,\n useIntentDispatcher,\n} from '@dxos/app-framework';\nimport { fullyQualifiedId, isLiveObject } from '@dxos/client/echo';\nimport { Obj } from '@dxos/echo';\nimport { SpaceAction } from '@dxos/plugin-space/types';\nimport { Button, toLocalizedString, useTranslation } from '@dxos/react-ui';\nimport { AttentionProvider } from '@dxos/react-ui-attention';\nimport { Stack } from '@dxos/react-ui-stack';\nimport { type DataType } from '@dxos/schema';\nimport { isNonNullable } from '@dxos/util';\n\nimport { StackContext } from './StackContext';\nimport { StackSection } from './StackSection';\nimport { STACK_PLUGIN } from '../meta';\nimport {\n type AddSectionPosition,\n type CollapsedSections,\n type StackSectionItem,\n type StackSectionMetadata,\n type StackSectionView,\n} from '../types';\n\ntype StackMainProps = {\n id: string;\n collection: DataType.Collection;\n};\n\nconst StackMain = ({ id, collection }: StackMainProps) => {\n const { dispatchPromise: dispatch } = useIntentDispatcher();\n const { graph } = useAppGraph();\n const { t } = useTranslation(STACK_PLUGIN);\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[fullyQualifiedId(object)],\n title:\n (object as any)?.title ??\n // TODO(wittjosiah): `getNode` is not reactive.\n toLocalizedString(graph.getNode(fullyQualifiedId(object)).pipe(Option.getOrNull)?.properties.label, t),\n } as StackSectionView;\n return { id: fullyQualifiedId(object), 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) => fullyQualifiedId(section) === id);\n const object = collection.objects[index].target;\n if (isLiveObject(object)) {\n await dispatch(createIntent(SpaceAction.RemoveObjects, { objects: [object], target: collection }));\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: `${STACK_PLUGIN}/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 () => dispatch?.(createIntent(SpaceAction.OpenCreateObject, { target: collection, navigable: false })),\n [collection, dispatch],\n );\n\n return (\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'>\n {items.map((item) => (\n <StackSection key={item.id} {...item} />\n ))}\n </Stack>\n\n <div role='none' className='flex mlb-2 pli-2 justify-center'>\n <Button data-testid='stack.createSection' classNames='gap-2' onClick={handleAddSection}>\n <Plus />\n <span className='sr-only'>{t('add section label')}</span>\n </Button>\n </div>\n </StackContext.Provider>\n </AttentionProvider>\n );\n};\n\nexport default StackMain;\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';\nimport { DropdownMenu, Icon, useTranslation, IconButton } from '@dxos/react-ui';\nimport { useAttentionAttributes } from '@dxos/react-ui-attention';\nimport { StackItem } from '@dxos/react-ui-stack';\nimport { mx, getSize, textBlockWidth } from '@dxos/react-ui-theme';\n\nimport { CaretDownUp } from './CaretDownUp';\nimport { useStack } from './StackContext';\nimport { STACK_PLUGIN } from '../meta';\nimport { type StackSectionItem } from '../types';\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(STACK_PLUGIN);\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,SAASA,YAAY;AACrB,SAASC,cAAc;AACvB,OAAOC,UAASC,aAAaC,YAAAA,iBAAgB;AAE7C,SACEC,cACAC,cACAC,cACAC,aACAC,iBACAC,2BACK;AACP,SAASC,kBAAkBC,oBAAoB;AAC/C,SAASC,WAAW;AACpB,SAASC,mBAAmB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G;MAAChE;MAAYE;KAAS;AAGxB,WACE,gBAAA+D,OAAA,cAACC,mBAAAA;MAAkBnE;OACjB,gBAAAkE,OAAA,cAACE,aAAaC,UAAQ;MACpBC,OAAO;QACLC,YAAYV;QACZW,YAAYb;QACZc,UAAUjC;QACVkC,OAAOzB;MACT;OAEA,gBAAAiB,OAAA,cAACS,OAAAA;MAAMC,aAAY;MAAWC,MAAK;MAAY7E;MAAQ8E,eAAY;OAChE7D,MAAME,IAAI,CAAC4D,SACV,gBAAAb,OAAA,cAACc,cAAAA;MAAaC,KAAKF,KAAK/E;MAAK,GAAG+E;UAIpC,gBAAAb,OAAA,cAACgB,OAAAA;MAAIC,MAAK;MAAOC,WAAU;OACzB,gBAAAlB,OAAA,cAACmB,QAAAA;MAAOP,eAAY;MAAsBQ,YAAW;MAAQC,SAASxB;OACpE,gBAAAG,OAAA,cAACsB,MAAAA,IAAAA,GACD,gBAAAtB,OAAA,cAACuB,QAAAA;MAAKL,WAAU;OAAW7E,EAAE,mBAAA,CAAA,CAAA,CAAA,CAAA,CAAA;;;;AAMzC;AAEA,IAAA,oBAAeR;",
|
|
6
|
-
"names": ["Plus", "Option", "React", "useCallback", "useState", "Capabilities", "LayoutAction", "createIntent", "useAppGraph", "useCapabilities", "useIntentDispatcher", "fullyQualifiedId", "isLiveObject", "Obj", "SpaceAction", "Button", "toLocalizedString", "useTranslation", "AttentionProvider", "Stack", "isNonNullable", "createContext", "useContext", "StackContext", "createContext", "onCollapse", "onNavigate", "onDelete", "onAdd", "useStack", "useContext", "CollapsiblePrimitive", "React", "useMemo", "useState", "Surface", "DropdownMenu", "Icon", "useTranslation", "IconButton", "useAttentionAttributes", "StackItem", "mx", "getSize", "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", "STACK_PLUGIN", "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", "StackMain", "id", "collection", "dispatchPromise", "dispatch", "useIntentDispatcher", "graph", "useAppGraph", "t", "useTranslation", "STACK_PLUGIN", "allMetadata", "useCapabilities", "Capabilities", "Metadata", "collapsedSections", "setCollapsedSections", "useState", "items", "objects", "map", "object", "target", "filter", "isNonNullable", "metadata", "find", "m", "Obj", "getTypename", "view", "collapsed", "fullyQualifiedId", "title", "toLocalizedString", "getNode", "pipe", "Option", "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", "AttentionProvider", "StackContext", "Provider", "value", "onCollapse", "onNavigate", "onDelete", "onAdd", "Stack", "orientation", "size", "data-testid", "item", "StackSection", "key", "div", "role", "className", "Button", "classNames", "onClick", "Plus", "span"]
|
|
7
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
// src/meta.ts
|
|
2
|
-
var STACK_PLUGIN = "dxos.org/plugin/stack";
|
|
3
|
-
var SECTION_IDENTIFIER = "dxos.org/type/StackSection";
|
|
4
|
-
var meta = {
|
|
5
|
-
id: STACK_PLUGIN,
|
|
6
|
-
// TODO(wittjosiah): Prevents "stacks" language from being exposed to users in settings panel.
|
|
7
|
-
// Conside renaming this to the collection plugin and trying to factor more collections logic from the space plugin.
|
|
8
|
-
name: "Collections",
|
|
9
|
-
description: "View collections of objects within the deck.",
|
|
10
|
-
icon: "ph--stack-simple--regular",
|
|
11
|
-
source: "https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-stack"
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export {
|
|
15
|
-
STACK_PLUGIN,
|
|
16
|
-
SECTION_IDENTIFIER,
|
|
17
|
-
meta
|
|
18
|
-
};
|
|
19
|
-
//# sourceMappingURL=chunk-FVB7LGW7.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';\n\nexport const STACK_PLUGIN = 'dxos.org/plugin/stack';\nexport const SECTION_IDENTIFIER = 'dxos.org/type/StackSection';\n\nexport const meta: PluginMeta = {\n id: STACK_PLUGIN,\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: 'View collections of objects within the deck.',\n icon: 'ph--stack-simple--regular',\n source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-stack',\n};\n"],
|
|
5
|
-
"mappings": ";AAMO,IAAMA,eAAe;AACrB,IAAMC,qBAAqB;AAE3B,IAAMC,OAAmB;EAC9BC,IAAIH;;;EAGJI,MAAM;EACNC,aAAa;EACbC,MAAM;EACNC,QAAQ;AACV;",
|
|
6
|
-
"names": ["STACK_PLUGIN", "SECTION_IDENTIFIER", "meta", "id", "name", "description", "icon", "source"]
|
|
7
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
// src/types/stack.ts
|
|
2
|
-
import { Schema } from "effect";
|
|
3
|
-
import { TypedObject } from "@dxos/echo-schema";
|
|
4
|
-
var SectionSchema = Schema.Struct({
|
|
5
|
-
height: Schema.optional(Schema.Number),
|
|
6
|
-
// Space for data that isn't stack-specific but is specific to this view instance.
|
|
7
|
-
// e.g. cover/fill for an image
|
|
8
|
-
custom: Schema.optional(Schema.Record({
|
|
9
|
-
key: Schema.String,
|
|
10
|
-
value: Schema.Any
|
|
11
|
-
}))
|
|
12
|
-
});
|
|
13
|
-
var StackViewType = class extends TypedObject({
|
|
14
|
-
typename: "dxos.org/type/StackView",
|
|
15
|
-
version: "0.1.0"
|
|
16
|
-
})({
|
|
17
|
-
sections: Schema.mutable(Schema.Record({
|
|
18
|
-
key: Schema.String,
|
|
19
|
-
value: SectionSchema
|
|
20
|
-
}))
|
|
21
|
-
}) {
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export {
|
|
25
|
-
SectionSchema,
|
|
26
|
-
StackViewType
|
|
27
|
-
};
|
|
28
|
-
//# sourceMappingURL=chunk-VDSBIEAC.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 { Schema } from 'effect';\n\nimport { TypedObject } from '@dxos/echo-schema';\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,SAASA,cAAc;AAEvB,SAASC,mBAAmB;AAOrB,IAAMC,gBAAgBC,OAAOC,OAAO;EACzCC,QAAQF,OAAOG,SAASH,OAAOI,MAAM;;;EAGrCC,QAAQL,OAAOG,SAASH,OAAOM,OAAO;IAAEC,KAAKP,OAAOQ;IAAQC,OAAOT,OAAOU;EAAI,CAAA,CAAA;AAChF,CAAA;AAGO,IAAMC,gBAAN,cAA4BC,YAAY;EAC7CC,UAAU;EACVC,SAAS;AACX,CAAA,EAAG;EACDC,UAAUf,OAAOgB,QAAQhB,OAAOM,OAAO;IAAEC,KAAKP,OAAOQ;IAAQC,OAAOV;EAAc,CAAA,CAAA;AACpF,CAAA,EAAA;AAAI;",
|
|
6
|
-
"names": ["Schema", "TypedObject", "SectionSchema", "Schema", "Struct", "height", "optional", "Number", "custom", "Record", "key", "String", "value", "Any", "StackViewType", "TypedObject", "typename", "version", "sections", "mutable"]
|
|
7
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
STACK_PLUGIN
|
|
3
|
-
} from "./chunk-FVB7LGW7.mjs";
|
|
4
|
-
|
|
5
|
-
// src/capabilities/react-surface.tsx
|
|
6
|
-
import React2 from "react";
|
|
7
|
-
import { Capabilities, contributes, createSurface } from "@dxos/app-framework";
|
|
8
|
-
import { Obj } from "@dxos/echo";
|
|
9
|
-
import { fullyQualifiedId } from "@dxos/react-client/echo";
|
|
10
|
-
import { DataType } 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 { DeprecatedFormContainer, DeprecatedFormInput } from "@dxos/react-ui-form";
|
|
20
|
-
|
|
21
|
-
// src/components/index.ts
|
|
22
|
-
var StackMain = lazy(() => import("./StackMain-6EC3A3IC.mjs"));
|
|
23
|
-
|
|
24
|
-
// src/capabilities/react-surface.tsx
|
|
25
|
-
var react_surface_default = () => contributes(Capabilities.ReactSurface, createSurface({
|
|
26
|
-
id: `${STACK_PLUGIN}/article`,
|
|
27
|
-
role: "article",
|
|
28
|
-
filter: (data) => Obj.instanceOf(DataType.Collection, data.subject),
|
|
29
|
-
component: ({ data }) => {
|
|
30
|
-
const id = typeof data.id === "string" ? data.id : void 0;
|
|
31
|
-
return /* @__PURE__ */ React2.createElement("div", {
|
|
32
|
-
role: "none",
|
|
33
|
-
className: "overflow-auto",
|
|
34
|
-
style: {
|
|
35
|
-
contain: "layout"
|
|
36
|
-
}
|
|
37
|
-
}, /* @__PURE__ */ React2.createElement(StackMain, {
|
|
38
|
-
id: id ?? fullyQualifiedId(data.subject),
|
|
39
|
-
collection: data.subject
|
|
40
|
-
}));
|
|
41
|
-
}
|
|
42
|
-
}));
|
|
43
|
-
export {
|
|
44
|
-
react_surface_default as default
|
|
45
|
-
};
|
|
46
|
-
//# sourceMappingURL=react-surface-KLOW5O2E.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 { fullyQualifiedId } from '@dxos/react-client/echo';\nimport { DataType } from '@dxos/schema';\n\nimport { StackMain } from '../components';\nimport { STACK_PLUGIN } from '../meta';\n\nexport default () =>\n contributes(\n Capabilities.ReactSurface,\n createSurface({\n id: `${STACK_PLUGIN}/article`,\n role: 'article',\n filter: (data): data is { id?: string; subject: DataType.Collection } =>\n Obj.instanceOf(DataType.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 (\n <div role='none' className='overflow-auto' style={{ contain: 'layout' }}>\n <StackMain id={id ?? fullyQualifiedId(data.subject)} collection={data.subject} />\n </div>\n );\n },\n }),\n );\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { lazy } from 'react';\n\nexport const StackMain = lazy(() => import('./StackMain'));\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 { DeprecatedFormContainer, DeprecatedFormInput } from '@dxos/react-ui-form';\n\nimport { STACK_PLUGIN } from '../meta';\nimport { type StackSettingsProps } from '../types';\n\nexport const StackSettings = ({ settings }: { settings: StackSettingsProps }) => {\n const { t } = useTranslation(STACK_PLUGIN);\n\n return (\n <DeprecatedFormContainer>\n <DeprecatedFormInput label={t('settings separation label')}>\n <Input.Switch checked={settings.separation} onCheckedChange={(checked) => (settings.separation = !!checked)} />\n </DeprecatedFormInput>\n </DeprecatedFormContainer>\n );\n};\n"],
|
|
5
|
-
"mappings": ";;;;;AAIA,OAAOA,YAAW;AAElB,SAASC,cAAcC,aAAaC,qBAAqB;AACzD,SAASC,WAAW;AACpB,SAASC,wBAAwB;AACjC,SAASC,gBAAgB;;;ACLzB,SAASC,YAAY;;;;ACArB,OAAOC,WAAW;AAElB,SAASC,OAAOC,sBAAsB;AACtC,SAASC,yBAAyBC,2BAA2B;;;ADDtD,IAAMC,YAAYC,KAAK,MAAM,OAAO,0BAAA,CAAA;;;ADQ3C,IAAA,wBAAe,MACbC,YACEC,aAAaC,cACbC,cAAc;EACZC,IAAI,GAAGC,YAAAA;EACPC,MAAM;EACNC,QAAQ,CAACC,SACPC,IAAIC,WAAWC,SAASC,YAAYJ,KAAKK,OAAO;EAClDC,WAAW,CAAC,EAAEN,KAAI,MAAE;AAGlB,UAAMJ,KAAK,OAAOI,KAAKJ,OAAO,WAAWI,KAAKJ,KAAKW;AACnD,WACE,gBAAAC,OAAA,cAACC,OAAAA;MAAIX,MAAK;MAAOY,WAAU;MAAgBC,OAAO;QAAEC,SAAS;MAAS;OACpE,gBAAAJ,OAAA,cAACK,WAAAA;MAAUjB,IAAIA,MAAMkB,iBAAiBd,KAAKK,OAAO;MAAGU,YAAYf,KAAKK;;EAG5E;AACF,CAAA,CAAA;",
|
|
6
|
-
"names": ["React", "Capabilities", "contributes", "createSurface", "Obj", "fullyQualifiedId", "DataType", "lazy", "React", "Input", "useTranslation", "DeprecatedFormContainer", "DeprecatedFormInput", "StackMain", "lazy", "contributes", "Capabilities", "ReactSurface", "createSurface", "id", "STACK_PLUGIN", "role", "filter", "data", "Obj", "instanceOf", "DataType", "Collection", "subject", "component", "undefined", "React", "div", "className", "style", "contain", "StackMain", "fullyQualifiedId", "collection"]
|
|
7
|
-
}
|
|
@@ -1,299 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
STACK_PLUGIN
|
|
4
|
-
} from "./chunk-UN5PA7TK.mjs";
|
|
5
|
-
|
|
6
|
-
// src/components/StackMain.tsx
|
|
7
|
-
import { useSignals as _useSignals3 } from "@preact-signals/safe-react/tracking";
|
|
8
|
-
import { Plus } from "@phosphor-icons/react";
|
|
9
|
-
import { Option } from "effect";
|
|
10
|
-
import React3, { useCallback, useState as useState2 } from "react";
|
|
11
|
-
import { Capabilities, LayoutAction, createIntent, useAppGraph, useCapabilities, useIntentDispatcher } from "@dxos/app-framework";
|
|
12
|
-
import { fullyQualifiedId, isLiveObject } from "@dxos/client/echo";
|
|
13
|
-
import { Obj } from "@dxos/echo";
|
|
14
|
-
import { SpaceAction } from "@dxos/plugin-space/types";
|
|
15
|
-
import { Button, toLocalizedString, useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
16
|
-
import { AttentionProvider } from "@dxos/react-ui-attention";
|
|
17
|
-
import { Stack } from "@dxos/react-ui-stack";
|
|
18
|
-
import { isNonNullable } from "@dxos/util";
|
|
19
|
-
|
|
20
|
-
// src/components/StackContext.tsx
|
|
21
|
-
import { createContext, useContext } from "react";
|
|
22
|
-
var StackContext = /* @__PURE__ */ createContext({
|
|
23
|
-
onCollapse: () => {
|
|
24
|
-
},
|
|
25
|
-
onNavigate: async () => {
|
|
26
|
-
},
|
|
27
|
-
onDelete: async () => {
|
|
28
|
-
},
|
|
29
|
-
onAdd: () => {
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
var useStack = () => useContext(StackContext);
|
|
33
|
-
|
|
34
|
-
// src/components/StackSection.tsx
|
|
35
|
-
import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
|
|
36
|
-
import * as CollapsiblePrimitive from "@radix-ui/react-collapsible";
|
|
37
|
-
import React2, { useMemo, useState } from "react";
|
|
38
|
-
import { Surface } from "@dxos/app-framework";
|
|
39
|
-
import { DropdownMenu, Icon, useTranslation, IconButton } from "@dxos/react-ui";
|
|
40
|
-
import { useAttentionAttributes } from "@dxos/react-ui-attention";
|
|
41
|
-
import { StackItem } from "@dxos/react-ui-stack";
|
|
42
|
-
import { mx, getSize, textBlockWidth } from "@dxos/react-ui-theme";
|
|
43
|
-
|
|
44
|
-
// src/components/CaretDownUp.tsx
|
|
45
|
-
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
46
|
-
import React from "react";
|
|
47
|
-
var CaretDownUp = ({ children, ...props }) => {
|
|
48
|
-
var _effect = _useSignals();
|
|
49
|
-
try {
|
|
50
|
-
return /* @__PURE__ */ React.createElement("svg", {
|
|
51
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
52
|
-
viewBox: "0 0 256 256",
|
|
53
|
-
...props
|
|
54
|
-
}, /* @__PURE__ */ React.createElement("rect", {
|
|
55
|
-
width: "256",
|
|
56
|
-
height: "256",
|
|
57
|
-
fill: "none"
|
|
58
|
-
}), /* @__PURE__ */ React.createElement("polyline", {
|
|
59
|
-
points: "80 224 128 176 176 224",
|
|
60
|
-
fill: "none",
|
|
61
|
-
stroke: "currentColor",
|
|
62
|
-
strokeLinecap: "round",
|
|
63
|
-
strokeLinejoin: "round",
|
|
64
|
-
strokeWidth: "16"
|
|
65
|
-
}), /* @__PURE__ */ React.createElement("polyline", {
|
|
66
|
-
points: "80 32 128 80 176 32",
|
|
67
|
-
fill: "none",
|
|
68
|
-
stroke: "currentColor",
|
|
69
|
-
strokeLinecap: "round",
|
|
70
|
-
strokeLinejoin: "round",
|
|
71
|
-
strokeWidth: "16"
|
|
72
|
-
}), children);
|
|
73
|
-
} finally {
|
|
74
|
-
_effect.f();
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
// src/components/StackSection.tsx
|
|
79
|
-
var sectionActionDimensions = "p-1 mlb-1 shrink-0 min-bs-0 is-[--rail-action] bs-min";
|
|
80
|
-
var StackSection = ({ id, view, object, metadata: { icon = "ph--placeholder--regular" } }) => {
|
|
81
|
-
var _effect = _useSignals2();
|
|
82
|
-
try {
|
|
83
|
-
const { t } = useTranslation(STACK_PLUGIN);
|
|
84
|
-
const { onNavigate, onAdd, onCollapse, onDelete } = useStack();
|
|
85
|
-
const [optionsMenuOpen, setOptionsMenuOpen] = useState(false);
|
|
86
|
-
const attentionAttrs = useAttentionAttributes(id);
|
|
87
|
-
const stackItem = useMemo(() => ({
|
|
88
|
-
id
|
|
89
|
-
}), [
|
|
90
|
-
id
|
|
91
|
-
]);
|
|
92
|
-
return /* @__PURE__ */ React2.createElement(CollapsiblePrimitive.Root, {
|
|
93
|
-
asChild: true,
|
|
94
|
-
open: !view.collapsed,
|
|
95
|
-
onOpenChange: (nextOpen) => onCollapse?.(id, !nextOpen)
|
|
96
|
-
}, /* @__PURE__ */ React2.createElement(StackItem.Root, {
|
|
97
|
-
item: stackItem,
|
|
98
|
-
role: "section",
|
|
99
|
-
...attentionAttrs
|
|
100
|
-
}, /* @__PURE__ */ React2.createElement(StackItem.Heading, {
|
|
101
|
-
classNames: "attention-surface"
|
|
102
|
-
}, /* @__PURE__ */ React2.createElement("span", {
|
|
103
|
-
className: "sr-only"
|
|
104
|
-
}, view.title), /* @__PURE__ */ React2.createElement(StackItem.HeadingStickyContent, null, /* @__PURE__ */ React2.createElement(DropdownMenu.Root, {
|
|
105
|
-
open: optionsMenuOpen,
|
|
106
|
-
onOpenChange: setOptionsMenuOpen
|
|
107
|
-
}, /* @__PURE__ */ React2.createElement(DropdownMenu.Trigger, {
|
|
108
|
-
asChild: true
|
|
109
|
-
}, /* @__PURE__ */ React2.createElement(StackItem.SigilButton, null, /* @__PURE__ */ React2.createElement(Icon, {
|
|
110
|
-
icon,
|
|
111
|
-
size: 5,
|
|
112
|
-
classNames: "transition-opacity"
|
|
113
|
-
}))), /* @__PURE__ */ React2.createElement(DropdownMenu.Portal, null, /* @__PURE__ */ React2.createElement(DropdownMenu.Content, null, /* @__PURE__ */ React2.createElement(DropdownMenu.Viewport, null, view.collapsed ? /* @__PURE__ */ React2.createElement(DropdownMenu.Item, {
|
|
114
|
-
onClick: () => onNavigate(id),
|
|
115
|
-
"data-testid": "section.navigate-to"
|
|
116
|
-
}, /* @__PURE__ */ React2.createElement(Icon, {
|
|
117
|
-
icon: "ph--arrow-right--regular",
|
|
118
|
-
size: 5
|
|
119
|
-
}), /* @__PURE__ */ React2.createElement("span", {
|
|
120
|
-
className: "mis-2 grow"
|
|
121
|
-
}, t("navigate to section label"))) : /* @__PURE__ */ React2.createElement(CollapsiblePrimitive.Trigger, {
|
|
122
|
-
asChild: true
|
|
123
|
-
}, /* @__PURE__ */ React2.createElement(DropdownMenu.Item, null, /* @__PURE__ */ React2.createElement(CaretDownUp, {
|
|
124
|
-
className: getSize(5)
|
|
125
|
-
}), /* @__PURE__ */ React2.createElement("span", {
|
|
126
|
-
className: "mis-2 grow"
|
|
127
|
-
}, t("collapse label")))), /* @__PURE__ */ React2.createElement(DropdownMenu.Item, {
|
|
128
|
-
onClick: () => onAdd(id, "before"),
|
|
129
|
-
"data-testid": "section.add-before"
|
|
130
|
-
}, /* @__PURE__ */ React2.createElement(Icon, {
|
|
131
|
-
icon: "ph--arrow-line-up--regular",
|
|
132
|
-
size: 5
|
|
133
|
-
}), /* @__PURE__ */ React2.createElement("span", {
|
|
134
|
-
className: "mis-2 grow"
|
|
135
|
-
}, t("add section before label"))), /* @__PURE__ */ React2.createElement(DropdownMenu.Item, {
|
|
136
|
-
onClick: () => onAdd(id, "after"),
|
|
137
|
-
"data-testid": "section.add-after"
|
|
138
|
-
}, /* @__PURE__ */ React2.createElement(Icon, {
|
|
139
|
-
icon: "ph--arrow-line-down--regular",
|
|
140
|
-
size: 5
|
|
141
|
-
}), /* @__PURE__ */ React2.createElement("span", {
|
|
142
|
-
className: "mis-2 grow"
|
|
143
|
-
}, t("add section after label"))), /* @__PURE__ */ React2.createElement(DropdownMenu.Item, {
|
|
144
|
-
onClick: () => onDelete(id),
|
|
145
|
-
"data-testid": "section.remove"
|
|
146
|
-
}, /* @__PURE__ */ React2.createElement(Icon, {
|
|
147
|
-
icon: "ph--trash--regular",
|
|
148
|
-
size: 5
|
|
149
|
-
}), /* @__PURE__ */ React2.createElement("span", {
|
|
150
|
-
className: "mis-2 grow"
|
|
151
|
-
}, t("remove section label")))), /* @__PURE__ */ React2.createElement(DropdownMenu.Arrow, null)))), view.collapsed ? /* @__PURE__ */ React2.createElement(CollapsiblePrimitive.Trigger, {
|
|
152
|
-
asChild: true
|
|
153
|
-
}, /* @__PURE__ */ React2.createElement(IconButton, {
|
|
154
|
-
iconOnly: true,
|
|
155
|
-
variant: "ghost",
|
|
156
|
-
label: t("expand label"),
|
|
157
|
-
icon: "ph--caret-up-down--regular",
|
|
158
|
-
classNames: sectionActionDimensions
|
|
159
|
-
})) : /* @__PURE__ */ React2.createElement(IconButton, {
|
|
160
|
-
iconOnly: true,
|
|
161
|
-
variant: "ghost",
|
|
162
|
-
onClick: () => onNavigate(id),
|
|
163
|
-
label: t("navigate to section label"),
|
|
164
|
-
icon: "ph--arrow-right--regular",
|
|
165
|
-
"data-testid": "section.navigate-to",
|
|
166
|
-
classNames: sectionActionDimensions
|
|
167
|
-
}))), /* @__PURE__ */ React2.createElement(CollapsiblePrimitive.Content, null, /* @__PURE__ */ React2.createElement(Surface, {
|
|
168
|
-
role: "section",
|
|
169
|
-
data: {
|
|
170
|
-
subject: object
|
|
171
|
-
},
|
|
172
|
-
limit: 1,
|
|
173
|
-
placeholder: /* @__PURE__ */ React2.createElement(React2.Fragment, null)
|
|
174
|
-
})), view.collapsed && /* @__PURE__ */ React2.createElement(StackItem.Content, {
|
|
175
|
-
classNames: "attention-surface"
|
|
176
|
-
}, /* @__PURE__ */ React2.createElement("h2", {
|
|
177
|
-
className: mx("flex items-center p-4 font-medium", textBlockWidth)
|
|
178
|
-
}, view.title))));
|
|
179
|
-
} finally {
|
|
180
|
-
_effect.f();
|
|
181
|
-
}
|
|
182
|
-
};
|
|
183
|
-
|
|
184
|
-
// src/components/StackMain.tsx
|
|
185
|
-
var StackMain = ({ id, collection }) => {
|
|
186
|
-
var _effect = _useSignals3();
|
|
187
|
-
try {
|
|
188
|
-
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
189
|
-
const { graph } = useAppGraph();
|
|
190
|
-
const { t } = useTranslation2(STACK_PLUGIN);
|
|
191
|
-
const allMetadata = useCapabilities(Capabilities.Metadata);
|
|
192
|
-
const [collapsedSections, setCollapsedSections] = useState2({});
|
|
193
|
-
const items = collection.objects.map((object) => object.target).filter(isNonNullable).map((object) => {
|
|
194
|
-
const metadata = allMetadata.find((m) => m.id === (Obj.getTypename(object) ?? "never"))?.metadata;
|
|
195
|
-
const view = {
|
|
196
|
-
// ...stack.sections[object.id],
|
|
197
|
-
collapsed: collapsedSections[fullyQualifiedId(object)],
|
|
198
|
-
title: object?.title ?? // TODO(wittjosiah): `getNode` is not reactive.
|
|
199
|
-
toLocalizedString(graph.getNode(fullyQualifiedId(object)).pipe(Option.getOrNull)?.properties.label, t)
|
|
200
|
-
};
|
|
201
|
-
return {
|
|
202
|
-
id: fullyQualifiedId(object),
|
|
203
|
-
object,
|
|
204
|
-
metadata,
|
|
205
|
-
view
|
|
206
|
-
};
|
|
207
|
-
}) ?? [];
|
|
208
|
-
const handleDelete = useCallback(async (id2) => {
|
|
209
|
-
const index = collection.objects.map((object2) => object2.target).filter(isNonNullable).findIndex((section) => fullyQualifiedId(section) === id2);
|
|
210
|
-
const object = collection.objects[index].target;
|
|
211
|
-
if (isLiveObject(object)) {
|
|
212
|
-
await dispatch(createIntent(SpaceAction.RemoveObjects, {
|
|
213
|
-
objects: [
|
|
214
|
-
object
|
|
215
|
-
],
|
|
216
|
-
target: collection
|
|
217
|
-
}));
|
|
218
|
-
}
|
|
219
|
-
}, [
|
|
220
|
-
collection,
|
|
221
|
-
dispatch
|
|
222
|
-
]);
|
|
223
|
-
const handleAdd = useCallback(async (id2, position) => {
|
|
224
|
-
await dispatch?.(
|
|
225
|
-
// TODO(wittjosiah): Use object creation dialog.
|
|
226
|
-
createIntent(LayoutAction.UpdateDialog, {
|
|
227
|
-
part: "dialog",
|
|
228
|
-
subject: `${STACK_PLUGIN}/AddSectionDialog`,
|
|
229
|
-
options: {
|
|
230
|
-
blockAlign: "start",
|
|
231
|
-
props: {
|
|
232
|
-
path: id2,
|
|
233
|
-
position,
|
|
234
|
-
collection
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
})
|
|
238
|
-
);
|
|
239
|
-
}, [
|
|
240
|
-
collection,
|
|
241
|
-
dispatch
|
|
242
|
-
]);
|
|
243
|
-
const handleNavigate = useCallback(async (id2) => {
|
|
244
|
-
await dispatch(createIntent(LayoutAction.Open, {
|
|
245
|
-
part: "main",
|
|
246
|
-
subject: [
|
|
247
|
-
id2
|
|
248
|
-
]
|
|
249
|
-
}));
|
|
250
|
-
}, [
|
|
251
|
-
dispatch
|
|
252
|
-
]);
|
|
253
|
-
const handleCollapse = useCallback((id2, collapsed) => setCollapsedSections((prev) => ({
|
|
254
|
-
...prev,
|
|
255
|
-
[id2]: collapsed
|
|
256
|
-
})), []);
|
|
257
|
-
const handleAddSection = useCallback(() => dispatch?.(createIntent(SpaceAction.OpenCreateObject, {
|
|
258
|
-
target: collection,
|
|
259
|
-
navigable: false
|
|
260
|
-
})), [
|
|
261
|
-
collection,
|
|
262
|
-
dispatch
|
|
263
|
-
]);
|
|
264
|
-
return /* @__PURE__ */ React3.createElement(AttentionProvider, {
|
|
265
|
-
id
|
|
266
|
-
}, /* @__PURE__ */ React3.createElement(StackContext.Provider, {
|
|
267
|
-
value: {
|
|
268
|
-
onCollapse: handleCollapse,
|
|
269
|
-
onNavigate: handleNavigate,
|
|
270
|
-
onDelete: handleDelete,
|
|
271
|
-
onAdd: handleAdd
|
|
272
|
-
}
|
|
273
|
-
}, /* @__PURE__ */ React3.createElement(Stack, {
|
|
274
|
-
orientation: "vertical",
|
|
275
|
-
size: "intrinsic",
|
|
276
|
-
id,
|
|
277
|
-
"data-testid": "main.stack"
|
|
278
|
-
}, items.map((item) => /* @__PURE__ */ React3.createElement(StackSection, {
|
|
279
|
-
key: item.id,
|
|
280
|
-
...item
|
|
281
|
-
}))), /* @__PURE__ */ React3.createElement("div", {
|
|
282
|
-
role: "none",
|
|
283
|
-
className: "flex mlb-2 pli-2 justify-center"
|
|
284
|
-
}, /* @__PURE__ */ React3.createElement(Button, {
|
|
285
|
-
"data-testid": "stack.createSection",
|
|
286
|
-
classNames: "gap-2",
|
|
287
|
-
onClick: handleAddSection
|
|
288
|
-
}, /* @__PURE__ */ React3.createElement(Plus, null), /* @__PURE__ */ React3.createElement("span", {
|
|
289
|
-
className: "sr-only"
|
|
290
|
-
}, t("add section label"))))));
|
|
291
|
-
} finally {
|
|
292
|
-
_effect.f();
|
|
293
|
-
}
|
|
294
|
-
};
|
|
295
|
-
var StackMain_default = StackMain;
|
|
296
|
-
export {
|
|
297
|
-
StackMain_default as default
|
|
298
|
-
};
|
|
299
|
-
//# sourceMappingURL=StackMain-G55P33OY.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/StackMain.tsx", "../../../src/components/StackContext.tsx", "../../../src/components/StackSection.tsx", "../../../src/components/CaretDownUp.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { Plus } from '@phosphor-icons/react';\nimport { Option } from 'effect';\nimport React, { useCallback, useState } from 'react';\n\nimport {\n Capabilities,\n LayoutAction,\n createIntent,\n useAppGraph,\n useCapabilities,\n useIntentDispatcher,\n} from '@dxos/app-framework';\nimport { fullyQualifiedId, isLiveObject } from '@dxos/client/echo';\nimport { Obj } from '@dxos/echo';\nimport { SpaceAction } from '@dxos/plugin-space/types';\nimport { Button, toLocalizedString, useTranslation } from '@dxos/react-ui';\nimport { AttentionProvider } from '@dxos/react-ui-attention';\nimport { Stack } from '@dxos/react-ui-stack';\nimport { type DataType } from '@dxos/schema';\nimport { isNonNullable } from '@dxos/util';\n\nimport { StackContext } from './StackContext';\nimport { StackSection } from './StackSection';\nimport { STACK_PLUGIN } from '../meta';\nimport {\n type AddSectionPosition,\n type CollapsedSections,\n type StackSectionItem,\n type StackSectionMetadata,\n type StackSectionView,\n} from '../types';\n\ntype StackMainProps = {\n id: string;\n collection: DataType.Collection;\n};\n\nconst StackMain = ({ id, collection }: StackMainProps) => {\n const { dispatchPromise: dispatch } = useIntentDispatcher();\n const { graph } = useAppGraph();\n const { t } = useTranslation(STACK_PLUGIN);\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[fullyQualifiedId(object)],\n title:\n (object as any)?.title ??\n // TODO(wittjosiah): `getNode` is not reactive.\n toLocalizedString(graph.getNode(fullyQualifiedId(object)).pipe(Option.getOrNull)?.properties.label, t),\n } as StackSectionView;\n return { id: fullyQualifiedId(object), 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) => fullyQualifiedId(section) === id);\n const object = collection.objects[index].target;\n if (isLiveObject(object)) {\n await dispatch(createIntent(SpaceAction.RemoveObjects, { objects: [object], target: collection }));\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: `${STACK_PLUGIN}/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 () => dispatch?.(createIntent(SpaceAction.OpenCreateObject, { target: collection, navigable: false })),\n [collection, dispatch],\n );\n\n return (\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'>\n {items.map((item) => (\n <StackSection key={item.id} {...item} />\n ))}\n </Stack>\n\n <div role='none' className='flex mlb-2 pli-2 justify-center'>\n <Button data-testid='stack.createSection' classNames='gap-2' onClick={handleAddSection}>\n <Plus />\n <span className='sr-only'>{t('add section label')}</span>\n </Button>\n </div>\n </StackContext.Provider>\n </AttentionProvider>\n );\n};\n\nexport default StackMain;\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';\nimport { DropdownMenu, Icon, useTranslation, IconButton } from '@dxos/react-ui';\nimport { useAttentionAttributes } from '@dxos/react-ui-attention';\nimport { StackItem } from '@dxos/react-ui-stack';\nimport { mx, getSize, textBlockWidth } from '@dxos/react-ui-theme';\n\nimport { CaretDownUp } from './CaretDownUp';\nimport { useStack } from './StackContext';\nimport { STACK_PLUGIN } from '../meta';\nimport { type StackSectionItem } from '../types';\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(STACK_PLUGIN);\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 strok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AAiBpB,YACrB,CAACzC,KAAY8B,cAAuBf,qBAAqB,CAAC+C,UAAU;MAAE,GAAGA;MAAM,CAAC9D,GAAAA,GAAK8B;IAAU,EAAA,GAC/F,CAAA,CAAE;AAGJ,UAAMiC,mBAAmBtB,YACvB,MAAMtC,WAAW2C,aAAaC,YAAYiB,kBAAkB;MAAE3C,QAAQpB;MAAYgE,WAAW;IAAM,CAAA,CAAA,GACnG;MAAChE;MAAYE;KAAS;AAGxB,WACE,gBAAA+D,OAAA,cAACC,mBAAAA;MAAkBnE;OACjB,gBAAAkE,OAAA,cAACE,aAAaC,UAAQ;MACpBC,OAAO;QACLC,YAAYV;QACZW,YAAYb;QACZc,UAAUjC;QACVkC,OAAOzB;MACT;OAEA,gBAAAiB,OAAA,cAACS,OAAAA;MAAMC,aAAY;MAAWC,MAAK;MAAY7E;MAAQ8E,eAAY;OAChE7D,MAAME,IAAI,CAAC4D,SACV,gBAAAb,OAAA,cAACc,cAAAA;MAAaC,KAAKF,KAAK/E;MAAK,GAAG+E;UAIpC,gBAAAb,OAAA,cAACgB,OAAAA;MAAIC,MAAK;MAAOC,WAAU;OACzB,gBAAAlB,OAAA,cAACmB,QAAAA;MAAOP,eAAY;MAAsBQ,YAAW;MAAQC,SAASxB;OACpE,gBAAAG,OAAA,cAACsB,MAAAA,IAAAA,GACD,gBAAAtB,OAAA,cAACuB,QAAAA;MAAKL,WAAU;OAAW7E,EAAE,mBAAA,CAAA,CAAA,CAAA,CAAA,CAAA;;;;AAMzC;AAEA,IAAA,oBAAeR;",
|
|
6
|
-
"names": ["Plus", "Option", "React", "useCallback", "useState", "Capabilities", "LayoutAction", "createIntent", "useAppGraph", "useCapabilities", "useIntentDispatcher", "fullyQualifiedId", "isLiveObject", "Obj", "SpaceAction", "Button", "toLocalizedString", "useTranslation", "AttentionProvider", "Stack", "isNonNullable", "createContext", "useContext", "StackContext", "createContext", "onCollapse", "onNavigate", "onDelete", "onAdd", "useStack", "useContext", "CollapsiblePrimitive", "React", "useMemo", "useState", "Surface", "DropdownMenu", "Icon", "useTranslation", "IconButton", "useAttentionAttributes", "StackItem", "mx", "getSize", "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", "STACK_PLUGIN", "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", "StackMain", "id", "collection", "dispatchPromise", "dispatch", "useIntentDispatcher", "graph", "useAppGraph", "t", "useTranslation", "STACK_PLUGIN", "allMetadata", "useCapabilities", "Capabilities", "Metadata", "collapsedSections", "setCollapsedSections", "useState", "items", "objects", "map", "object", "target", "filter", "isNonNullable", "metadata", "find", "m", "Obj", "getTypename", "view", "collapsed", "fullyQualifiedId", "title", "toLocalizedString", "getNode", "pipe", "Option", "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", "AttentionProvider", "StackContext", "Provider", "value", "onCollapse", "onNavigate", "onDelete", "onAdd", "Stack", "orientation", "size", "data-testid", "item", "StackSection", "key", "div", "role", "className", "Button", "classNames", "onClick", "Plus", "span"]
|
|
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 { Schema } from "effect";
|
|
5
|
-
import { TypedObject } from "@dxos/echo-schema";
|
|
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-GOXSWCA4.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 { Schema } from 'effect';\n\nimport { TypedObject } from '@dxos/echo-schema';\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,SAASA,cAAc;AAEvB,SAASC,mBAAmB;AAOrB,IAAMC,gBAAgBC,OAAOC,OAAO;EACzCC,QAAQF,OAAOG,SAASH,OAAOI,MAAM;;;EAGrCC,QAAQL,OAAOG,SAASH,OAAOM,OAAO;IAAEC,KAAKP,OAAOQ;IAAQC,OAAOT,OAAOU;EAAI,CAAA,CAAA;AAChF,CAAA;AAGO,IAAMC,gBAAN,cAA4BC,YAAY;EAC7CC,UAAU;EACVC,SAAS;AACX,CAAA,EAAG;EACDC,UAAUf,OAAOgB,QAAQhB,OAAOM,OAAO;IAAEC,KAAKP,OAAOQ;IAAQC,OAAOV;EAAc,CAAA,CAAA;AACpF,CAAA,EAAA;AAAI;",
|
|
6
|
-
"names": ["Schema", "TypedObject", "SectionSchema", "Schema", "Struct", "height", "optional", "Number", "custom", "Record", "key", "String", "value", "Any", "StackViewType", "TypedObject", "typename", "version", "sections", "mutable"]
|
|
7
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
-
|
|
3
|
-
// src/meta.ts
|
|
4
|
-
var STACK_PLUGIN = "dxos.org/plugin/stack";
|
|
5
|
-
var SECTION_IDENTIFIER = "dxos.org/type/StackSection";
|
|
6
|
-
var meta = {
|
|
7
|
-
id: STACK_PLUGIN,
|
|
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: "View collections of objects within the deck.",
|
|
12
|
-
icon: "ph--stack-simple--regular",
|
|
13
|
-
source: "https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-stack"
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export {
|
|
17
|
-
STACK_PLUGIN,
|
|
18
|
-
SECTION_IDENTIFIER,
|
|
19
|
-
meta
|
|
20
|
-
};
|
|
21
|
-
//# sourceMappingURL=chunk-UN5PA7TK.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';\n\nexport const STACK_PLUGIN = 'dxos.org/plugin/stack';\nexport const SECTION_IDENTIFIER = 'dxos.org/type/StackSection';\n\nexport const meta: PluginMeta = {\n id: STACK_PLUGIN,\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: 'View collections of objects within the deck.',\n icon: 'ph--stack-simple--regular',\n source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-stack',\n};\n"],
|
|
5
|
-
"mappings": ";;;AAMO,IAAMA,eAAe;AACrB,IAAMC,qBAAqB;AAE3B,IAAMC,OAAmB;EAC9BC,IAAIH;;;EAGJI,MAAM;EACNC,aAAa;EACbC,MAAM;EACNC,QAAQ;AACV;",
|
|
6
|
-
"names": ["STACK_PLUGIN", "SECTION_IDENTIFIER", "meta", "id", "name", "description", "icon", "source"]
|
|
7
|
-
}
|