@dxos/plugin-stack 0.7.2 → 0.7.3-staging.971cd8d

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.
@@ -233,7 +233,7 @@ var StackPlugin = () => {
233
233
  },
234
234
  translations: translations_default,
235
235
  echo: {
236
- schema: [
236
+ system: [
237
237
  StackViewType
238
238
  ]
239
239
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/StackPlugin.tsx", "../../../src/components/index.ts", "../../../src/components/StackSettings.tsx", "../../../src/components/AddSectionDialog.tsx", "../../../src/translations.ts", "../../../src/index.ts"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nimport { type Plugin, type PluginDefinition } from '@dxos/app-framework';\nimport { create, type ReactiveEchoObject, fullyQualifiedId } from '@dxos/client/echo';\nimport { LocalStorageStore } from '@dxos/local-storage';\nimport { CollectionType } from '@dxos/plugin-space/types';\nimport { Main } from '@dxos/react-ui';\nimport { baseSurface, topbarBlockPaddingStart, bottombarBlockPaddingEnd } from '@dxos/react-ui-theme';\n\nimport { StackMain, StackSettings, AddSectionDialog, dataHasAddSectionDialogProps } from './components';\nimport meta, { SECTION_IDENTIFIER, STACK_PLUGIN } from './meta';\nimport translations from './translations';\nimport { StackViewType } from './types';\nimport { type StackPluginProvides, type StackProvides, type StackState, type StackSettingsProps } from './types';\n\nexport const StackPlugin = (): PluginDefinition<StackPluginProvides> => {\n const settings = new LocalStorageStore<StackSettingsProps>(STACK_PLUGIN, { separation: true });\n const stackState = create<StackState>({ creators: [] });\n\n return {\n meta,\n ready: async (plugins) => {\n settings.prop({ key: 'separation', type: LocalStorageStore.bool() });\n\n for (const plugin of plugins) {\n if (plugin.meta.id === STACK_PLUGIN) {\n continue;\n }\n\n if (Array.isArray((plugin as Plugin<StackProvides>).provides?.stack?.creators)) {\n stackState.creators.push(...((plugin as Plugin<StackProvides>).provides.stack.creators ?? []));\n }\n }\n },\n provides: {\n settings: settings.values,\n metadata: {\n records: {\n [StackViewType.typename]: {\n placeholder: ['stack title placeholder', { ns: STACK_PLUGIN }],\n icon: 'ph--stack-simple--regular',\n },\n [SECTION_IDENTIFIER]: {\n parse: (section: { object: ReactiveEchoObject<any> }, type: string) => {\n switch (type) {\n case 'node':\n // TODO(wittjosiah): Remove cast.\n return { id: section.object.id, label: section.object.title, data: section.object };\n case 'object':\n return section.object;\n case 'view-object':\n return section;\n }\n },\n },\n },\n },\n translations,\n echo: {\n schema: [StackViewType],\n },\n surface: {\n component: ({ data, role }) => {\n switch (data.component) {\n case `${STACK_PLUGIN}/AddSectionDialog`:\n return dataHasAddSectionDialogProps(data) ? <AddSectionDialog {...data.subject} /> : null;\n }\n\n const primary = data.active ?? data.object;\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 switch (role) {\n case 'main':\n return primary instanceof CollectionType ? (\n <Main.Content bounce classNames={[baseSurface, topbarBlockPaddingStart, bottombarBlockPaddingEnd]}>\n <StackMain id={id ?? fullyQualifiedId(primary)} collection={primary} />\n </Main.Content>\n ) : null;\n case 'article':\n return primary instanceof CollectionType ? (\n <div role='none' className='overflow-auto' style={{ contain: 'layout' }}>\n <StackMain id={id ?? fullyQualifiedId(primary)} collection={primary} />\n </div>\n ) : null;\n case 'settings': {\n return data.plugin === meta.id ? <StackSettings settings={settings.values} /> : null;\n }\n default:\n return null;\n }\n },\n },\n stack: stackState,\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';\nexport * from './AddSectionDialog';\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nimport { Input, useTranslation } from '@dxos/react-ui';\nimport { 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 <>\n <DeprecatedFormInput label={t('settings separation label')}>\n <Input.Switch checked={settings.separation} onCheckedChange={(checked) => (settings.separation = !!checked)} />\n </DeprecatedFormInput>\n </>\n );\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { FilePlus } from '@phosphor-icons/react';\nimport React, { useCallback, useRef, useState } from 'react';\n\nimport { usePlugin, useIntent, LayoutAction, useResolvePlugin, parseFileManagerPlugin } from '@dxos/app-framework';\nimport { type ReactiveEchoObject, create, getSpace } from '@dxos/client/echo';\nimport { FileType } from '@dxos/plugin-ipfs/types';\nimport { type CollectionType } from '@dxos/plugin-space/types';\nimport { Dialog, toLocalizedString, useTranslation } from '@dxos/react-ui';\nimport { Path } from '@dxos/react-ui-mosaic';\nimport { SearchList } from '@dxos/react-ui-searchlist';\nimport { getSize, mx } from '@dxos/react-ui-theme';\nimport { nonNullable } from '@dxos/util';\n\nimport { STACK_PLUGIN } from '../meta';\nimport { StackViewType, type StackPluginProvides, type AddSectionPosition } from '../types';\n\ntype AddSectionDialogProps = { path?: string; position: AddSectionPosition; collection: CollectionType };\n\nexport const dataHasAddSectionDialogProps = (data: any): data is { subject: AddSectionDialogProps } => {\n return (\n 'subject' in data &&\n typeof data.subject === 'object' &&\n !!data.subject &&\n 'position' in data.subject &&\n typeof data.subject.position === 'string' &&\n 'collection' in data.subject\n );\n};\n\nexport const AddSectionDialog = ({ path, position, collection }: AddSectionDialogProps) => {\n const { t } = useTranslation(STACK_PLUGIN);\n const stackPlugin = usePlugin<StackPluginProvides>(STACK_PLUGIN);\n const fileManagerPlugin = useResolvePlugin(parseFileManagerPlugin);\n const fileRef = useRef<HTMLInputElement | null>(null);\n const { dispatch } = useIntent();\n const space = getSpace(collection);\n const [pending, setPending] = useState<boolean>(false);\n const [uploadError, setUploadError] = useState<Error | undefined>();\n\n const handleAdd = useCallback(\n (sectionObject: ReactiveEchoObject<any>) => {\n const index =\n position === 'beforeAll'\n ? 0\n : position === 'afterAll'\n ? collection.objects.length\n : collection.objects.filter(nonNullable).findIndex((section) => section.id === Path.last(path!));\n\n collection.objects.splice(index + (position === 'after' ? 1 : 0), 0, sectionObject);\n const stack = collection.views[StackViewType.typename];\n if (stack) {\n stack.sections[sectionObject.id] = {};\n }\n setPending(false);\n void dispatch?.({ action: LayoutAction.SET_LAYOUT, data: { element: 'dialog', state: false } });\n },\n [collection, path, position, dispatch],\n );\n\n const handleFileUpload =\n fileManagerPlugin?.provides.file.upload && space\n ? async (file: File) => {\n const filename = file.name.split('.')[0];\n try {\n const info = await fileManagerPlugin.provides.file.upload?.(file, space);\n if (info) {\n const obj = create(FileType, { type: file.type, name: filename, filename, cid: info.cid });\n handleAdd(obj);\n }\n } catch (err: any) {\n setUploadError(err);\n }\n }\n : undefined;\n\n return (\n <Dialog.Content>\n <Dialog.Title>{t(`add section ${position} dialog title`)}</Dialog.Title>\n <SearchList.Root label={t('add section input placeholder')}>\n <SearchList.Input placeholder={t('add section input placeholder')} classNames='pli-3' disabled={pending} />\n <SearchList.Content classNames='min-bs-24 bs-fit max-bs-64 overflow-auto' {...(pending && { inert: 'true' })}>\n {stackPlugin?.provides?.stack.creators?.map(({ id, icon: Icon, label: propsLabel, testId, intent }) => {\n const label = toLocalizedString(propsLabel, t);\n return (\n <SearchList.Item\n value={label}\n key={id}\n onSelect={async () => {\n setPending(true);\n const { data: nextSection } = (await dispatch({ ...intent, data: { space } })) ?? {};\n handleAdd(nextSection);\n }}\n classNames='flex items-center gap-2 pli-2'\n data-testid={testId}\n >\n {Icon && <Icon className={mx(getSize(4), 'shrink-0')} />}\n <span className='grow truncate'>{label}</span>\n </SearchList.Item>\n );\n })}\n {handleFileUpload && (\n <SearchList.Item\n value={t('upload file label')}\n classNames='flex items-center gap-2 pli-2'\n onSelect={() => fileRef.current?.click()}\n >\n <FilePlus />\n <span className='grow truncate'>{t('upload file label')}</span>\n </SearchList.Item>\n )}\n {uploadError && <div className='text-error-500'>{uploadError.message}</div>}\n </SearchList.Content>\n </SearchList.Root>\n {handleFileUpload && (\n <input\n type='file'\n className='sr-only'\n ref={fileRef}\n onChange={({ target: { files } }) => files && handleFileUpload(files[0])}\n />\n )}\n </Dialog.Content>\n );\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { translations as stackTranslations } from '@dxos/react-ui-stack';\n\nimport { STACK_PLUGIN } from './meta';\n\nexport default [\n {\n 'en-US': {\n [STACK_PLUGIN]: {\n 'plugin name': 'Stacks',\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 'drag handle label': 'Press space or enter to begin dragging this item.',\n },\n },\n },\n ...stackTranslations,\n];\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { StackPlugin } from './StackPlugin';\n\nexport default StackPlugin;\n\nexport * from './types';\n\nexport * from './StackPlugin';\n"],
4
+ "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nimport { type Plugin, type PluginDefinition } from '@dxos/app-framework';\nimport { create, type ReactiveEchoObject, fullyQualifiedId } from '@dxos/client/echo';\nimport { LocalStorageStore } from '@dxos/local-storage';\nimport { CollectionType } from '@dxos/plugin-space/types';\nimport { Main } from '@dxos/react-ui';\nimport { baseSurface, topbarBlockPaddingStart, bottombarBlockPaddingEnd } from '@dxos/react-ui-theme';\n\nimport { StackMain, StackSettings, AddSectionDialog, dataHasAddSectionDialogProps } from './components';\nimport meta, { SECTION_IDENTIFIER, STACK_PLUGIN } from './meta';\nimport translations from './translations';\nimport { StackViewType } from './types';\nimport { type StackPluginProvides, type StackProvides, type StackState, type StackSettingsProps } from './types';\n\nexport const StackPlugin = (): PluginDefinition<StackPluginProvides> => {\n const settings = new LocalStorageStore<StackSettingsProps>(STACK_PLUGIN, { separation: true });\n const stackState = create<StackState>({ creators: [] });\n\n return {\n meta,\n ready: async (plugins) => {\n settings.prop({ key: 'separation', type: LocalStorageStore.bool() });\n\n for (const plugin of plugins) {\n if (plugin.meta.id === STACK_PLUGIN) {\n continue;\n }\n\n if (Array.isArray((plugin as Plugin<StackProvides>).provides?.stack?.creators)) {\n stackState.creators.push(...((plugin as Plugin<StackProvides>).provides.stack.creators ?? []));\n }\n }\n },\n provides: {\n settings: settings.values,\n metadata: {\n records: {\n [StackViewType.typename]: {\n placeholder: ['stack title placeholder', { ns: STACK_PLUGIN }],\n icon: 'ph--stack-simple--regular',\n },\n [SECTION_IDENTIFIER]: {\n parse: (section: { object: ReactiveEchoObject<any> }, type: string) => {\n switch (type) {\n case 'node':\n // TODO(wittjosiah): Remove cast.\n return { id: section.object.id, label: section.object.title, data: section.object };\n case 'object':\n return section.object;\n case 'view-object':\n return section;\n }\n },\n },\n },\n },\n translations,\n echo: {\n system: [StackViewType],\n },\n surface: {\n component: ({ data, role }) => {\n switch (data.component) {\n case `${STACK_PLUGIN}/AddSectionDialog`:\n return dataHasAddSectionDialogProps(data) ? <AddSectionDialog {...data.subject} /> : null;\n }\n\n const primary = data.active ?? data.object;\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 switch (role) {\n case 'main':\n return primary instanceof CollectionType ? (\n <Main.Content bounce classNames={[baseSurface, topbarBlockPaddingStart, bottombarBlockPaddingEnd]}>\n <StackMain id={id ?? fullyQualifiedId(primary)} collection={primary} />\n </Main.Content>\n ) : null;\n case 'article':\n return primary instanceof CollectionType ? (\n <div role='none' className='overflow-auto' style={{ contain: 'layout' }}>\n <StackMain id={id ?? fullyQualifiedId(primary)} collection={primary} />\n </div>\n ) : null;\n case 'settings': {\n return data.plugin === meta.id ? <StackSettings settings={settings.values} /> : null;\n }\n default:\n return null;\n }\n },\n },\n stack: stackState,\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';\nexport * from './AddSectionDialog';\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nimport { Input, useTranslation } from '@dxos/react-ui';\nimport { 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 <>\n <DeprecatedFormInput label={t('settings separation label')}>\n <Input.Switch checked={settings.separation} onCheckedChange={(checked) => (settings.separation = !!checked)} />\n </DeprecatedFormInput>\n </>\n );\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { FilePlus } from '@phosphor-icons/react';\nimport React, { useCallback, useRef, useState } from 'react';\n\nimport { usePlugin, useIntent, LayoutAction, useResolvePlugin, parseFileManagerPlugin } from '@dxos/app-framework';\nimport { type ReactiveEchoObject, create, getSpace } from '@dxos/client/echo';\nimport { FileType } from '@dxos/plugin-ipfs/types';\nimport { type CollectionType } from '@dxos/plugin-space/types';\nimport { Dialog, toLocalizedString, useTranslation } from '@dxos/react-ui';\nimport { Path } from '@dxos/react-ui-mosaic';\nimport { SearchList } from '@dxos/react-ui-searchlist';\nimport { getSize, mx } from '@dxos/react-ui-theme';\nimport { nonNullable } from '@dxos/util';\n\nimport { STACK_PLUGIN } from '../meta';\nimport { StackViewType, type StackPluginProvides, type AddSectionPosition } from '../types';\n\ntype AddSectionDialogProps = { path?: string; position: AddSectionPosition; collection: CollectionType };\n\nexport const dataHasAddSectionDialogProps = (data: any): data is { subject: AddSectionDialogProps } => {\n return (\n 'subject' in data &&\n typeof data.subject === 'object' &&\n !!data.subject &&\n 'position' in data.subject &&\n typeof data.subject.position === 'string' &&\n 'collection' in data.subject\n );\n};\n\nexport const AddSectionDialog = ({ path, position, collection }: AddSectionDialogProps) => {\n const { t } = useTranslation(STACK_PLUGIN);\n const stackPlugin = usePlugin<StackPluginProvides>(STACK_PLUGIN);\n const fileManagerPlugin = useResolvePlugin(parseFileManagerPlugin);\n const fileRef = useRef<HTMLInputElement | null>(null);\n const { dispatch } = useIntent();\n const space = getSpace(collection);\n const [pending, setPending] = useState<boolean>(false);\n const [uploadError, setUploadError] = useState<Error | undefined>();\n\n const handleAdd = useCallback(\n (sectionObject: ReactiveEchoObject<any>) => {\n const index =\n position === 'beforeAll'\n ? 0\n : position === 'afterAll'\n ? collection.objects.length\n : collection.objects.filter(nonNullable).findIndex((section) => section.id === Path.last(path!));\n\n collection.objects.splice(index + (position === 'after' ? 1 : 0), 0, sectionObject);\n const stack = collection.views[StackViewType.typename];\n if (stack) {\n stack.sections[sectionObject.id] = {};\n }\n setPending(false);\n void dispatch?.({ action: LayoutAction.SET_LAYOUT, data: { element: 'dialog', state: false } });\n },\n [collection, path, position, dispatch],\n );\n\n const handleFileUpload =\n fileManagerPlugin?.provides.file.upload && space\n ? async (file: File) => {\n const filename = file.name.split('.')[0];\n try {\n const info = await fileManagerPlugin.provides.file.upload?.(file, space);\n if (info) {\n const obj = create(FileType, { type: file.type, name: filename, filename, cid: info.cid });\n handleAdd(obj);\n }\n } catch (err: any) {\n setUploadError(err);\n }\n }\n : undefined;\n\n return (\n <Dialog.Content>\n <Dialog.Title>{t(`add section ${position} dialog title`)}</Dialog.Title>\n <SearchList.Root label={t('add section input placeholder')}>\n <SearchList.Input placeholder={t('add section input placeholder')} classNames='pli-3' disabled={pending} />\n <SearchList.Content classNames='min-bs-24 bs-fit max-bs-64 overflow-auto' {...(pending && { inert: 'true' })}>\n {stackPlugin?.provides?.stack.creators?.map(({ id, icon: Icon, label: propsLabel, testId, intent }) => {\n const label = toLocalizedString(propsLabel, t);\n return (\n <SearchList.Item\n value={label}\n key={id}\n onSelect={async () => {\n setPending(true);\n const { data: nextSection } = (await dispatch({ ...intent, data: { space } })) ?? {};\n handleAdd(nextSection);\n }}\n classNames='flex items-center gap-2 pli-2'\n data-testid={testId}\n >\n {Icon && <Icon className={mx(getSize(4), 'shrink-0')} />}\n <span className='grow truncate'>{label}</span>\n </SearchList.Item>\n );\n })}\n {handleFileUpload && (\n <SearchList.Item\n value={t('upload file label')}\n classNames='flex items-center gap-2 pli-2'\n onSelect={() => fileRef.current?.click()}\n >\n <FilePlus />\n <span className='grow truncate'>{t('upload file label')}</span>\n </SearchList.Item>\n )}\n {uploadError && <div className='text-error-500'>{uploadError.message}</div>}\n </SearchList.Content>\n </SearchList.Root>\n {handleFileUpload && (\n <input\n type='file'\n className='sr-only'\n ref={fileRef}\n onChange={({ target: { files } }) => files && handleFileUpload(files[0])}\n />\n )}\n </Dialog.Content>\n );\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { translations as stackTranslations } from '@dxos/react-ui-stack';\n\nimport { STACK_PLUGIN } from './meta';\n\nexport default [\n {\n 'en-US': {\n [STACK_PLUGIN]: {\n 'plugin name': 'Stacks',\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 'drag handle label': 'Press space or enter to begin dragging this item.',\n },\n },\n },\n ...stackTranslations,\n];\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { StackPlugin } from './StackPlugin';\n\nexport default StackPlugin;\n\nexport * from './types';\n\nexport * from './StackPlugin';\n"],
5
5
  "mappings": ";;;;;;;;;;;AAIA,OAAOA,YAAW;AAGlB,SAASC,UAAAA,SAAiCC,wBAAwB;AAClE,SAASC,yBAAyB;AAClC,SAASC,sBAAsB;AAC/B,SAASC,YAAY;AACrB,SAASC,aAAaC,yBAAyBC,gCAAgC;;;ACP/E,SAASC,YAAY;;;ACArB,OAAOC,WAAW;AAElB,SAASC,OAAOC,sBAAsB;AACtC,SAASC,2BAA2B;AAK7B,IAAMC,gBAAgB,CAAC,EAAEC,SAAQ,MAAoC;AAC1E,QAAM,EAAEC,EAAC,IAAKC,eAAeC,YAAAA;AAE7B,SACE,sBAAA,cAAA,MAAA,UAAA,MACE,sBAAA,cAACC,qBAAAA;IAAoBC,OAAOJ,EAAE,2BAAA;KAC5B,sBAAA,cAACK,MAAMC,QAAM;IAACC,SAASR,SAASS;IAAYC,iBAAiB,CAACF,YAAaR,SAASS,aAAa,CAAC,CAACD;;AAI3G;;;AClBA,SAASG,gBAAgB;AACzB,OAAOC,UAASC,aAAaC,QAAQC,gBAAgB;AAErD,SAASC,WAAWC,WAAWC,cAAcC,kBAAkBC,8BAA8B;AAC7F,SAAkCC,QAAQC,gBAAgB;AAC1D,SAASC,gBAAgB;AAEzB,SAASC,QAAQC,mBAAmBC,kBAAAA,uBAAsB;AAC1D,SAASC,YAAY;AACrB,SAASC,kBAAkB;AAC3B,SAASC,SAASC,UAAU;AAC5B,SAASC,mBAAmB;AAOrB,IAAMC,+BAA+B,CAACC,SAAAA;AAC3C,SACE,aAAaA,QACb,OAAOA,KAAKC,YAAY,YACxB,CAAC,CAACD,KAAKC,WACP,cAAcD,KAAKC,WACnB,OAAOD,KAAKC,QAAQC,aAAa,YACjC,gBAAgBF,K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,OAAA,cAACc,WAAAA;gBAAU1C,IAAIA,MAAM2C,iBAAiBZ,OAAAA;gBAAUa,YAAYb;oBAE5D;YACN,KAAK;AACH,qBAAOA,mBAAmBG,iBACxB,gBAAAN,OAAA,cAACiB,OAAAA;gBAAInB,MAAK;gBAAOoB,WAAU;gBAAgBC,OAAO;kBAAEC,SAAS;gBAAS;iBACpE,gBAAApB,OAAA,cAACc,WAAAA;gBAAU1C,IAAIA,MAAM2C,iBAAiBZ,OAAAA;gBAAUa,YAAYb;oBAE5D;YACN,KAAK,YAAY;AACf,qBAAOX,KAAKrB,WAAWP,aAAKQ,KAAK,gBAAA4B,OAAA,cAACqB,eAAAA;gBAAchE,UAAUA,SAASqB;mBAAa;YAClF;YACA;AACE,qBAAO;UACX;QACF;MACF;MACAF,OAAOf;IACT;EACF;AACF;;;AK9FA,IAAA,cAAe6D;",
6
- "names": ["React", "create", "fullyQualifiedId", "LocalStorageStore", "CollectionType", "Main", "baseSurface", "topbarBlockPaddingStart", "bottombarBlockPaddingEnd", "lazy", "React", "Input", "useTranslation", "DeprecatedFormInput", "StackSettings", "settings", "t", "useTranslation", "STACK_PLUGIN", "DeprecatedFormInput", "label", "Input", "Switch", "checked", "separation", "onCheckedChange", "FilePlus", "React", "useCallback", "useRef", "useState", "usePlugin", "useIntent", "LayoutAction", "useResolvePlugin", "parseFileManagerPlugin", "create", "getSpace", "FileType", "Dialog", "toLocalizedString", "useTranslation", "Path", "SearchList", "getSize", "mx", "nonNullable", "dataHasAddSectionDialogProps", "data", "subject", "position", "AddSectionDialog", "path", "collection", "t", "useTranslation", "STACK_PLUGIN", "stackPlugin", "usePlugin", "fileManagerPlugin", "useResolvePlugin", "parseFileManagerPlugin", "fileRef", "useRef", "dispatch", "useIntent", "space", "getSpace", "pending", "setPending", "useState", "uploadError", "setUploadError", "handleAdd", "useCallback", "sectionObject", "index", "objects", "length", "filter", "nonNullable", "findIndex", "section", "id", "Path", "last", "splice", "stack", "views", "StackViewType", "typename", "sections", "action", "LayoutAction", "SET_LAYOUT", "element", "state", "handleFileUpload", "provides", "file", "upload", "filename", "name", "split", "info", "obj", "create", "FileType", "type", "cid", "err", "undefined", "React", "Dialog", "Content", "Title", "SearchList", "Root", "label", "Input", "placeholder", "classNames", "disabled", "inert", "creators", "map", "icon", "Icon", "propsLabel", "testId", "intent", "toLocalizedString", "Item", "value", "key", "onSelect", "nextSection", "data-testid", "className", "mx", "getSize", "span", "current", "click", "FilePlus", "div", "message", "input", "ref", "onChange", "target", "files", "StackMain", "lazy", "translations", "stackTranslations", "STACK_PLUGIN", "stackTranslations", "StackPlugin", "settings", "LocalStorageStore", "STACK_PLUGIN", "separation", "stackState", "create", "creators", "meta", "ready", "plugins", "prop", "key", "type", "bool", "plugin", "id", "Array", "isArray", "provides", "stack", "push", "values", "metadata", "records", "StackViewType", "typename", "placeholder", "ns", "icon", "SECTION_IDENTIFIER", "parse", "section", "object", "label", "title", "data", "translations", "echo", "schema", "surface", "component", "role", "dataHasAddSectionDialogProps", "React", "AddSectionDialog", "subject", "primary", "active", "undefined", "CollectionType", "Main", "Content", "bounce", "classNames", "baseSurface", "topbarBlockPaddingStart", "bottombarBlockPaddingEnd", "StackMain", "fullyQualifiedId", "collection", "div", "className", "style", "contain", "StackSettings", "StackPlugin"]
6
+ "names": ["React", "create", "fullyQualifiedId", "LocalStorageStore", "CollectionType", "Main", "baseSurface", "topbarBlockPaddingStart", "bottombarBlockPaddingEnd", "lazy", "React", "Input", "useTranslation", "DeprecatedFormInput", "StackSettings", "settings", "t", "useTranslation", "STACK_PLUGIN", "DeprecatedFormInput", "label", "Input", "Switch", "checked", "separation", "onCheckedChange", "FilePlus", "React", "useCallback", "useRef", "useState", "usePlugin", "useIntent", "LayoutAction", "useResolvePlugin", "parseFileManagerPlugin", "create", "getSpace", "FileType", "Dialog", "toLocalizedString", "useTranslation", "Path", "SearchList", "getSize", "mx", "nonNullable", "dataHasAddSectionDialogProps", "data", "subject", "position", "AddSectionDialog", "path", "collection", "t", "useTranslation", "STACK_PLUGIN", "stackPlugin", "usePlugin", "fileManagerPlugin", "useResolvePlugin", "parseFileManagerPlugin", "fileRef", "useRef", "dispatch", "useIntent", "space", "getSpace", "pending", "setPending", "useState", "uploadError", "setUploadError", "handleAdd", "useCallback", "sectionObject", "index", "objects", "length", "filter", "nonNullable", "findIndex", "section", "id", "Path", "last", "splice", "stack", "views", "StackViewType", "typename", "sections", "action", "LayoutAction", "SET_LAYOUT", "element", "state", "handleFileUpload", "provides", "file", "upload", "filename", "name", "split", "info", "obj", "create", "FileType", "type", "cid", "err", "undefined", "React", "Dialog", "Content", "Title", "SearchList", "Root", "label", "Input", "placeholder", "classNames", "disabled", "inert", "creators", "map", "icon", "Icon", "propsLabel", "testId", "intent", "toLocalizedString", "Item", "value", "key", "onSelect", "nextSection", "data-testid", "className", "mx", "getSize", "span", "current", "click", "FilePlus", "div", "message", "input", "ref", "onChange", "target", "files", "StackMain", "lazy", "translations", "stackTranslations", "STACK_PLUGIN", "stackTranslations", "StackPlugin", "settings", "LocalStorageStore", "STACK_PLUGIN", "separation", "stackState", "create", "creators", "meta", "ready", "plugins", "prop", "key", "type", "bool", "plugin", "id", "Array", "isArray", "provides", "stack", "push", "values", "metadata", "records", "StackViewType", "typename", "placeholder", "ns", "icon", "SECTION_IDENTIFIER", "parse", "section", "object", "label", "title", "data", "translations", "echo", "system", "surface", "component", "role", "dataHasAddSectionDialogProps", "React", "AddSectionDialog", "subject", "primary", "active", "undefined", "CollectionType", "Main", "Content", "bounce", "classNames", "baseSurface", "topbarBlockPaddingStart", "bottombarBlockPaddingEnd", "StackMain", "fullyQualifiedId", "collection", "div", "className", "style", "contain", "StackSettings", "StackPlugin"]
7
7
  }
@@ -248,7 +248,7 @@ var StackPlugin = () => {
248
248
  },
249
249
  translations: translations_default,
250
250
  echo: {
251
- schema: [
251
+ system: [
252
252
  import_chunk_6IPBX635.StackViewType
253
253
  ]
254
254
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/StackPlugin.tsx", "../../../src/components/index.ts", "../../../src/components/StackSettings.tsx", "../../../src/components/AddSectionDialog.tsx", "../../../src/translations.ts", "../../../src/index.ts"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nimport { type Plugin, type PluginDefinition } from '@dxos/app-framework';\nimport { create, type ReactiveEchoObject, fullyQualifiedId } from '@dxos/client/echo';\nimport { LocalStorageStore } from '@dxos/local-storage';\nimport { CollectionType } from '@dxos/plugin-space/types';\nimport { Main } from '@dxos/react-ui';\nimport { baseSurface, topbarBlockPaddingStart, bottombarBlockPaddingEnd } from '@dxos/react-ui-theme';\n\nimport { StackMain, StackSettings, AddSectionDialog, dataHasAddSectionDialogProps } from './components';\nimport meta, { SECTION_IDENTIFIER, STACK_PLUGIN } from './meta';\nimport translations from './translations';\nimport { StackViewType } from './types';\nimport { type StackPluginProvides, type StackProvides, type StackState, type StackSettingsProps } from './types';\n\nexport const StackPlugin = (): PluginDefinition<StackPluginProvides> => {\n const settings = new LocalStorageStore<StackSettingsProps>(STACK_PLUGIN, { separation: true });\n const stackState = create<StackState>({ creators: [] });\n\n return {\n meta,\n ready: async (plugins) => {\n settings.prop({ key: 'separation', type: LocalStorageStore.bool() });\n\n for (const plugin of plugins) {\n if (plugin.meta.id === STACK_PLUGIN) {\n continue;\n }\n\n if (Array.isArray((plugin as Plugin<StackProvides>).provides?.stack?.creators)) {\n stackState.creators.push(...((plugin as Plugin<StackProvides>).provides.stack.creators ?? []));\n }\n }\n },\n provides: {\n settings: settings.values,\n metadata: {\n records: {\n [StackViewType.typename]: {\n placeholder: ['stack title placeholder', { ns: STACK_PLUGIN }],\n icon: 'ph--stack-simple--regular',\n },\n [SECTION_IDENTIFIER]: {\n parse: (section: { object: ReactiveEchoObject<any> }, type: string) => {\n switch (type) {\n case 'node':\n // TODO(wittjosiah): Remove cast.\n return { id: section.object.id, label: section.object.title, data: section.object };\n case 'object':\n return section.object;\n case 'view-object':\n return section;\n }\n },\n },\n },\n },\n translations,\n echo: {\n schema: [StackViewType],\n },\n surface: {\n component: ({ data, role }) => {\n switch (data.component) {\n case `${STACK_PLUGIN}/AddSectionDialog`:\n return dataHasAddSectionDialogProps(data) ? <AddSectionDialog {...data.subject} /> : null;\n }\n\n const primary = data.active ?? data.object;\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 switch (role) {\n case 'main':\n return primary instanceof CollectionType ? (\n <Main.Content bounce classNames={[baseSurface, topbarBlockPaddingStart, bottombarBlockPaddingEnd]}>\n <StackMain id={id ?? fullyQualifiedId(primary)} collection={primary} />\n </Main.Content>\n ) : null;\n case 'article':\n return primary instanceof CollectionType ? (\n <div role='none' className='overflow-auto' style={{ contain: 'layout' }}>\n <StackMain id={id ?? fullyQualifiedId(primary)} collection={primary} />\n </div>\n ) : null;\n case 'settings': {\n return data.plugin === meta.id ? <StackSettings settings={settings.values} /> : null;\n }\n default:\n return null;\n }\n },\n },\n stack: stackState,\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';\nexport * from './AddSectionDialog';\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nimport { Input, useTranslation } from '@dxos/react-ui';\nimport { 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 <>\n <DeprecatedFormInput label={t('settings separation label')}>\n <Input.Switch checked={settings.separation} onCheckedChange={(checked) => (settings.separation = !!checked)} />\n </DeprecatedFormInput>\n </>\n );\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { FilePlus } from '@phosphor-icons/react';\nimport React, { useCallback, useRef, useState } from 'react';\n\nimport { usePlugin, useIntent, LayoutAction, useResolvePlugin, parseFileManagerPlugin } from '@dxos/app-framework';\nimport { type ReactiveEchoObject, create, getSpace } from '@dxos/client/echo';\nimport { FileType } from '@dxos/plugin-ipfs/types';\nimport { type CollectionType } from '@dxos/plugin-space/types';\nimport { Dialog, toLocalizedString, useTranslation } from '@dxos/react-ui';\nimport { Path } from '@dxos/react-ui-mosaic';\nimport { SearchList } from '@dxos/react-ui-searchlist';\nimport { getSize, mx } from '@dxos/react-ui-theme';\nimport { nonNullable } from '@dxos/util';\n\nimport { STACK_PLUGIN } from '../meta';\nimport { StackViewType, type StackPluginProvides, type AddSectionPosition } from '../types';\n\ntype AddSectionDialogProps = { path?: string; position: AddSectionPosition; collection: CollectionType };\n\nexport const dataHasAddSectionDialogProps = (data: any): data is { subject: AddSectionDialogProps } => {\n return (\n 'subject' in data &&\n typeof data.subject === 'object' &&\n !!data.subject &&\n 'position' in data.subject &&\n typeof data.subject.position === 'string' &&\n 'collection' in data.subject\n );\n};\n\nexport const AddSectionDialog = ({ path, position, collection }: AddSectionDialogProps) => {\n const { t } = useTranslation(STACK_PLUGIN);\n const stackPlugin = usePlugin<StackPluginProvides>(STACK_PLUGIN);\n const fileManagerPlugin = useResolvePlugin(parseFileManagerPlugin);\n const fileRef = useRef<HTMLInputElement | null>(null);\n const { dispatch } = useIntent();\n const space = getSpace(collection);\n const [pending, setPending] = useState<boolean>(false);\n const [uploadError, setUploadError] = useState<Error | undefined>();\n\n const handleAdd = useCallback(\n (sectionObject: ReactiveEchoObject<any>) => {\n const index =\n position === 'beforeAll'\n ? 0\n : position === 'afterAll'\n ? collection.objects.length\n : collection.objects.filter(nonNullable).findIndex((section) => section.id === Path.last(path!));\n\n collection.objects.splice(index + (position === 'after' ? 1 : 0), 0, sectionObject);\n const stack = collection.views[StackViewType.typename];\n if (stack) {\n stack.sections[sectionObject.id] = {};\n }\n setPending(false);\n void dispatch?.({ action: LayoutAction.SET_LAYOUT, data: { element: 'dialog', state: false } });\n },\n [collection, path, position, dispatch],\n );\n\n const handleFileUpload =\n fileManagerPlugin?.provides.file.upload && space\n ? async (file: File) => {\n const filename = file.name.split('.')[0];\n try {\n const info = await fileManagerPlugin.provides.file.upload?.(file, space);\n if (info) {\n const obj = create(FileType, { type: file.type, name: filename, filename, cid: info.cid });\n handleAdd(obj);\n }\n } catch (err: any) {\n setUploadError(err);\n }\n }\n : undefined;\n\n return (\n <Dialog.Content>\n <Dialog.Title>{t(`add section ${position} dialog title`)}</Dialog.Title>\n <SearchList.Root label={t('add section input placeholder')}>\n <SearchList.Input placeholder={t('add section input placeholder')} classNames='pli-3' disabled={pending} />\n <SearchList.Content classNames='min-bs-24 bs-fit max-bs-64 overflow-auto' {...(pending && { inert: 'true' })}>\n {stackPlugin?.provides?.stack.creators?.map(({ id, icon: Icon, label: propsLabel, testId, intent }) => {\n const label = toLocalizedString(propsLabel, t);\n return (\n <SearchList.Item\n value={label}\n key={id}\n onSelect={async () => {\n setPending(true);\n const { data: nextSection } = (await dispatch({ ...intent, data: { space } })) ?? {};\n handleAdd(nextSection);\n }}\n classNames='flex items-center gap-2 pli-2'\n data-testid={testId}\n >\n {Icon && <Icon className={mx(getSize(4), 'shrink-0')} />}\n <span className='grow truncate'>{label}</span>\n </SearchList.Item>\n );\n })}\n {handleFileUpload && (\n <SearchList.Item\n value={t('upload file label')}\n classNames='flex items-center gap-2 pli-2'\n onSelect={() => fileRef.current?.click()}\n >\n <FilePlus />\n <span className='grow truncate'>{t('upload file label')}</span>\n </SearchList.Item>\n )}\n {uploadError && <div className='text-error-500'>{uploadError.message}</div>}\n </SearchList.Content>\n </SearchList.Root>\n {handleFileUpload && (\n <input\n type='file'\n className='sr-only'\n ref={fileRef}\n onChange={({ target: { files } }) => files && handleFileUpload(files[0])}\n />\n )}\n </Dialog.Content>\n );\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { translations as stackTranslations } from '@dxos/react-ui-stack';\n\nimport { STACK_PLUGIN } from './meta';\n\nexport default [\n {\n 'en-US': {\n [STACK_PLUGIN]: {\n 'plugin name': 'Stacks',\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 'drag handle label': 'Press space or enter to begin dragging this item.',\n },\n },\n },\n ...stackTranslations,\n];\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { StackPlugin } from './StackPlugin';\n\nexport default StackPlugin;\n\nexport * from './types';\n\nexport * from './StackPlugin';\n"],
4
+ "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nimport { type Plugin, type PluginDefinition } from '@dxos/app-framework';\nimport { create, type ReactiveEchoObject, fullyQualifiedId } from '@dxos/client/echo';\nimport { LocalStorageStore } from '@dxos/local-storage';\nimport { CollectionType } from '@dxos/plugin-space/types';\nimport { Main } from '@dxos/react-ui';\nimport { baseSurface, topbarBlockPaddingStart, bottombarBlockPaddingEnd } from '@dxos/react-ui-theme';\n\nimport { StackMain, StackSettings, AddSectionDialog, dataHasAddSectionDialogProps } from './components';\nimport meta, { SECTION_IDENTIFIER, STACK_PLUGIN } from './meta';\nimport translations from './translations';\nimport { StackViewType } from './types';\nimport { type StackPluginProvides, type StackProvides, type StackState, type StackSettingsProps } from './types';\n\nexport const StackPlugin = (): PluginDefinition<StackPluginProvides> => {\n const settings = new LocalStorageStore<StackSettingsProps>(STACK_PLUGIN, { separation: true });\n const stackState = create<StackState>({ creators: [] });\n\n return {\n meta,\n ready: async (plugins) => {\n settings.prop({ key: 'separation', type: LocalStorageStore.bool() });\n\n for (const plugin of plugins) {\n if (plugin.meta.id === STACK_PLUGIN) {\n continue;\n }\n\n if (Array.isArray((plugin as Plugin<StackProvides>).provides?.stack?.creators)) {\n stackState.creators.push(...((plugin as Plugin<StackProvides>).provides.stack.creators ?? []));\n }\n }\n },\n provides: {\n settings: settings.values,\n metadata: {\n records: {\n [StackViewType.typename]: {\n placeholder: ['stack title placeholder', { ns: STACK_PLUGIN }],\n icon: 'ph--stack-simple--regular',\n },\n [SECTION_IDENTIFIER]: {\n parse: (section: { object: ReactiveEchoObject<any> }, type: string) => {\n switch (type) {\n case 'node':\n // TODO(wittjosiah): Remove cast.\n return { id: section.object.id, label: section.object.title, data: section.object };\n case 'object':\n return section.object;\n case 'view-object':\n return section;\n }\n },\n },\n },\n },\n translations,\n echo: {\n system: [StackViewType],\n },\n surface: {\n component: ({ data, role }) => {\n switch (data.component) {\n case `${STACK_PLUGIN}/AddSectionDialog`:\n return dataHasAddSectionDialogProps(data) ? <AddSectionDialog {...data.subject} /> : null;\n }\n\n const primary = data.active ?? data.object;\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 switch (role) {\n case 'main':\n return primary instanceof CollectionType ? (\n <Main.Content bounce classNames={[baseSurface, topbarBlockPaddingStart, bottombarBlockPaddingEnd]}>\n <StackMain id={id ?? fullyQualifiedId(primary)} collection={primary} />\n </Main.Content>\n ) : null;\n case 'article':\n return primary instanceof CollectionType ? (\n <div role='none' className='overflow-auto' style={{ contain: 'layout' }}>\n <StackMain id={id ?? fullyQualifiedId(primary)} collection={primary} />\n </div>\n ) : null;\n case 'settings': {\n return data.plugin === meta.id ? <StackSettings settings={settings.values} /> : null;\n }\n default:\n return null;\n }\n },\n },\n stack: stackState,\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';\nexport * from './AddSectionDialog';\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nimport { Input, useTranslation } from '@dxos/react-ui';\nimport { 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 <>\n <DeprecatedFormInput label={t('settings separation label')}>\n <Input.Switch checked={settings.separation} onCheckedChange={(checked) => (settings.separation = !!checked)} />\n </DeprecatedFormInput>\n </>\n );\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { FilePlus } from '@phosphor-icons/react';\nimport React, { useCallback, useRef, useState } from 'react';\n\nimport { usePlugin, useIntent, LayoutAction, useResolvePlugin, parseFileManagerPlugin } from '@dxos/app-framework';\nimport { type ReactiveEchoObject, create, getSpace } from '@dxos/client/echo';\nimport { FileType } from '@dxos/plugin-ipfs/types';\nimport { type CollectionType } from '@dxos/plugin-space/types';\nimport { Dialog, toLocalizedString, useTranslation } from '@dxos/react-ui';\nimport { Path } from '@dxos/react-ui-mosaic';\nimport { SearchList } from '@dxos/react-ui-searchlist';\nimport { getSize, mx } from '@dxos/react-ui-theme';\nimport { nonNullable } from '@dxos/util';\n\nimport { STACK_PLUGIN } from '../meta';\nimport { StackViewType, type StackPluginProvides, type AddSectionPosition } from '../types';\n\ntype AddSectionDialogProps = { path?: string; position: AddSectionPosition; collection: CollectionType };\n\nexport const dataHasAddSectionDialogProps = (data: any): data is { subject: AddSectionDialogProps } => {\n return (\n 'subject' in data &&\n typeof data.subject === 'object' &&\n !!data.subject &&\n 'position' in data.subject &&\n typeof data.subject.position === 'string' &&\n 'collection' in data.subject\n );\n};\n\nexport const AddSectionDialog = ({ path, position, collection }: AddSectionDialogProps) => {\n const { t } = useTranslation(STACK_PLUGIN);\n const stackPlugin = usePlugin<StackPluginProvides>(STACK_PLUGIN);\n const fileManagerPlugin = useResolvePlugin(parseFileManagerPlugin);\n const fileRef = useRef<HTMLInputElement | null>(null);\n const { dispatch } = useIntent();\n const space = getSpace(collection);\n const [pending, setPending] = useState<boolean>(false);\n const [uploadError, setUploadError] = useState<Error | undefined>();\n\n const handleAdd = useCallback(\n (sectionObject: ReactiveEchoObject<any>) => {\n const index =\n position === 'beforeAll'\n ? 0\n : position === 'afterAll'\n ? collection.objects.length\n : collection.objects.filter(nonNullable).findIndex((section) => section.id === Path.last(path!));\n\n collection.objects.splice(index + (position === 'after' ? 1 : 0), 0, sectionObject);\n const stack = collection.views[StackViewType.typename];\n if (stack) {\n stack.sections[sectionObject.id] = {};\n }\n setPending(false);\n void dispatch?.({ action: LayoutAction.SET_LAYOUT, data: { element: 'dialog', state: false } });\n },\n [collection, path, position, dispatch],\n );\n\n const handleFileUpload =\n fileManagerPlugin?.provides.file.upload && space\n ? async (file: File) => {\n const filename = file.name.split('.')[0];\n try {\n const info = await fileManagerPlugin.provides.file.upload?.(file, space);\n if (info) {\n const obj = create(FileType, { type: file.type, name: filename, filename, cid: info.cid });\n handleAdd(obj);\n }\n } catch (err: any) {\n setUploadError(err);\n }\n }\n : undefined;\n\n return (\n <Dialog.Content>\n <Dialog.Title>{t(`add section ${position} dialog title`)}</Dialog.Title>\n <SearchList.Root label={t('add section input placeholder')}>\n <SearchList.Input placeholder={t('add section input placeholder')} classNames='pli-3' disabled={pending} />\n <SearchList.Content classNames='min-bs-24 bs-fit max-bs-64 overflow-auto' {...(pending && { inert: 'true' })}>\n {stackPlugin?.provides?.stack.creators?.map(({ id, icon: Icon, label: propsLabel, testId, intent }) => {\n const label = toLocalizedString(propsLabel, t);\n return (\n <SearchList.Item\n value={label}\n key={id}\n onSelect={async () => {\n setPending(true);\n const { data: nextSection } = (await dispatch({ ...intent, data: { space } })) ?? {};\n handleAdd(nextSection);\n }}\n classNames='flex items-center gap-2 pli-2'\n data-testid={testId}\n >\n {Icon && <Icon className={mx(getSize(4), 'shrink-0')} />}\n <span className='grow truncate'>{label}</span>\n </SearchList.Item>\n );\n })}\n {handleFileUpload && (\n <SearchList.Item\n value={t('upload file label')}\n classNames='flex items-center gap-2 pli-2'\n onSelect={() => fileRef.current?.click()}\n >\n <FilePlus />\n <span className='grow truncate'>{t('upload file label')}</span>\n </SearchList.Item>\n )}\n {uploadError && <div className='text-error-500'>{uploadError.message}</div>}\n </SearchList.Content>\n </SearchList.Root>\n {handleFileUpload && (\n <input\n type='file'\n className='sr-only'\n ref={fileRef}\n onChange={({ target: { files } }) => files && handleFileUpload(files[0])}\n />\n )}\n </Dialog.Content>\n );\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { translations as stackTranslations } from '@dxos/react-ui-stack';\n\nimport { STACK_PLUGIN } from './meta';\n\nexport default [\n {\n 'en-US': {\n [STACK_PLUGIN]: {\n 'plugin name': 'Stacks',\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 'drag handle label': 'Press space or enter to begin dragging this item.',\n },\n },\n },\n ...stackTranslations,\n];\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { StackPlugin } from './StackPlugin';\n\nexport default StackPlugin;\n\nexport * from './types';\n\nexport * from './StackPlugin';\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,mBAAkB;AAGlB,kBAAkE;AAClE,2BAAkC;AAClC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AA,QAAA,cAAC2G,WAAAA;gBAAUlE,IAAIA,UAAMuG,8BAAiBR,OAAAA;gBAAU1H,YAAY0H;oBAE5D;YACN,KAAK,YAAY;AACf,qBAAO/H,KAAK6G,WAAWL,mCAAKxE,KAAKzC,6BAAAA,QAAA,cAACL,eAAAA;gBAAcC,UAAUA,SAAS8H;mBAAa;YAClF;YACA;AACE,qBAAO;UACX;QACF;MACF;MACA7E,OAAOmE;IACT;EACF;AACF;AK9FA,IAAA,cAAeF;",
6
- "names": ["import_react", "import_react_ui", "import_echo", "import_types", "import_react_ui_theme", "StackSettings", "settings", "t", "useTranslation", "STACK_PLUGIN", "React", "DeprecatedFormInput", "label", "Input", "Switch", "checked", "separation", "onCheckedChange", "dataHasAddSectionDialogProps", "data", "subject", "position", "AddSectionDialog", "path", "collection", "stackPlugin", "usePlugin", "fileManagerPlugin", "useResolvePlugin", "parseFileManagerPlugin", "fileRef", "useRef", "dispatch", "useIntent", "space", "getSpace", "pending", "setPending", "useState", "uploadError", "setUploadError", "handleAdd", "useCallback", "sectionObject", "index", "objects", "length", "filter", "nonNullable", "findIndex", "section", "id", "Path", "last", "splice", "stack", "views", "StackViewType", "typename", "sections", "action", "LayoutAction", "SET_LAYOUT", "element", "state", "handleFileUpload", "provides", "file", "upload", "filename", "name", "split", "info", "obj", "create", "FileType", "type", "cid", "err", "undefined", "Dialog", "Content", "Title", "SearchList", "Root", "placeholder", "classNames", "disabled", "inert", "creators", "map", "icon", "Icon", "propsLabel", "testId", "intent", "toLocalizedString", "Item", "value", "key", "onSelect", "nextSection", "data-testid", "className", "mx", "getSize", "span", "current", "click", "FilePlus", "div", "message", "input", "ref", "onChange", "target", "files", "StackMain", "lazy", "stackTranslations", "StackPlugin", "LocalStorageStore", "stackState", "meta", "ready", "plugins", "prop", "bool", "plugin", "Array", "isArray", "push", "values", "metadata", "records", "ns", "SECTION_IDENTIFIER", "parse", "object", "title", "translations", "echo", "schema", "surface", "component", "role", "primary", "active", "CollectionType", "Main", "bounce", "baseSurface", "topbarBlockPaddingStart", "bottombarBlockPaddingEnd", "fullyQualifiedId", "style", "contain"]
6
+ "names": ["import_react", "import_react_ui", "import_echo", "import_types", "import_react_ui_theme", "StackSettings", "settings", "t", "useTranslation", "STACK_PLUGIN", "React", "DeprecatedFormInput", "label", "Input", "Switch", "checked", "separation", "onCheckedChange", "dataHasAddSectionDialogProps", "data", "subject", "position", "AddSectionDialog", "path", "collection", "stackPlugin", "usePlugin", "fileManagerPlugin", "useResolvePlugin", "parseFileManagerPlugin", "fileRef", "useRef", "dispatch", "useIntent", "space", "getSpace", "pending", "setPending", "useState", "uploadError", "setUploadError", "handleAdd", "useCallback", "sectionObject", "index", "objects", "length", "filter", "nonNullable", "findIndex", "section", "id", "Path", "last", "splice", "stack", "views", "StackViewType", "typename", "sections", "action", "LayoutAction", "SET_LAYOUT", "element", "state", "handleFileUpload", "provides", "file", "upload", "filename", "name", "split", "info", "obj", "create", "FileType", "type", "cid", "err", "undefined", "Dialog", "Content", "Title", "SearchList", "Root", "placeholder", "classNames", "disabled", "inert", "creators", "map", "icon", "Icon", "propsLabel", "testId", "intent", "toLocalizedString", "Item", "value", "key", "onSelect", "nextSection", "data-testid", "className", "mx", "getSize", "span", "current", "click", "FilePlus", "div", "message", "input", "ref", "onChange", "target", "files", "StackMain", "lazy", "stackTranslations", "StackPlugin", "LocalStorageStore", "stackState", "meta", "ready", "plugins", "prop", "bool", "plugin", "Array", "isArray", "push", "values", "metadata", "records", "ns", "SECTION_IDENTIFIER", "parse", "object", "title", "translations", "echo", "system", "surface", "component", "role", "primary", "active", "CollectionType", "Main", "bounce", "baseSurface", "topbarBlockPaddingStart", "bottombarBlockPaddingEnd", "fullyQualifiedId", "style", "contain"]
7
7
  }
@@ -234,7 +234,7 @@ var StackPlugin = () => {
234
234
  },
235
235
  translations: translations_default,
236
236
  echo: {
237
- schema: [
237
+ system: [
238
238
  StackViewType
239
239
  ]
240
240
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/StackPlugin.tsx", "../../../src/components/index.ts", "../../../src/components/StackSettings.tsx", "../../../src/components/AddSectionDialog.tsx", "../../../src/translations.ts", "../../../src/index.ts"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nimport { type Plugin, type PluginDefinition } from '@dxos/app-framework';\nimport { create, type ReactiveEchoObject, fullyQualifiedId } from '@dxos/client/echo';\nimport { LocalStorageStore } from '@dxos/local-storage';\nimport { CollectionType } from '@dxos/plugin-space/types';\nimport { Main } from '@dxos/react-ui';\nimport { baseSurface, topbarBlockPaddingStart, bottombarBlockPaddingEnd } from '@dxos/react-ui-theme';\n\nimport { StackMain, StackSettings, AddSectionDialog, dataHasAddSectionDialogProps } from './components';\nimport meta, { SECTION_IDENTIFIER, STACK_PLUGIN } from './meta';\nimport translations from './translations';\nimport { StackViewType } from './types';\nimport { type StackPluginProvides, type StackProvides, type StackState, type StackSettingsProps } from './types';\n\nexport const StackPlugin = (): PluginDefinition<StackPluginProvides> => {\n const settings = new LocalStorageStore<StackSettingsProps>(STACK_PLUGIN, { separation: true });\n const stackState = create<StackState>({ creators: [] });\n\n return {\n meta,\n ready: async (plugins) => {\n settings.prop({ key: 'separation', type: LocalStorageStore.bool() });\n\n for (const plugin of plugins) {\n if (plugin.meta.id === STACK_PLUGIN) {\n continue;\n }\n\n if (Array.isArray((plugin as Plugin<StackProvides>).provides?.stack?.creators)) {\n stackState.creators.push(...((plugin as Plugin<StackProvides>).provides.stack.creators ?? []));\n }\n }\n },\n provides: {\n settings: settings.values,\n metadata: {\n records: {\n [StackViewType.typename]: {\n placeholder: ['stack title placeholder', { ns: STACK_PLUGIN }],\n icon: 'ph--stack-simple--regular',\n },\n [SECTION_IDENTIFIER]: {\n parse: (section: { object: ReactiveEchoObject<any> }, type: string) => {\n switch (type) {\n case 'node':\n // TODO(wittjosiah): Remove cast.\n return { id: section.object.id, label: section.object.title, data: section.object };\n case 'object':\n return section.object;\n case 'view-object':\n return section;\n }\n },\n },\n },\n },\n translations,\n echo: {\n schema: [StackViewType],\n },\n surface: {\n component: ({ data, role }) => {\n switch (data.component) {\n case `${STACK_PLUGIN}/AddSectionDialog`:\n return dataHasAddSectionDialogProps(data) ? <AddSectionDialog {...data.subject} /> : null;\n }\n\n const primary = data.active ?? data.object;\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 switch (role) {\n case 'main':\n return primary instanceof CollectionType ? (\n <Main.Content bounce classNames={[baseSurface, topbarBlockPaddingStart, bottombarBlockPaddingEnd]}>\n <StackMain id={id ?? fullyQualifiedId(primary)} collection={primary} />\n </Main.Content>\n ) : null;\n case 'article':\n return primary instanceof CollectionType ? (\n <div role='none' className='overflow-auto' style={{ contain: 'layout' }}>\n <StackMain id={id ?? fullyQualifiedId(primary)} collection={primary} />\n </div>\n ) : null;\n case 'settings': {\n return data.plugin === meta.id ? <StackSettings settings={settings.values} /> : null;\n }\n default:\n return null;\n }\n },\n },\n stack: stackState,\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';\nexport * from './AddSectionDialog';\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nimport { Input, useTranslation } from '@dxos/react-ui';\nimport { 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 <>\n <DeprecatedFormInput label={t('settings separation label')}>\n <Input.Switch checked={settings.separation} onCheckedChange={(checked) => (settings.separation = !!checked)} />\n </DeprecatedFormInput>\n </>\n );\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { FilePlus } from '@phosphor-icons/react';\nimport React, { useCallback, useRef, useState } from 'react';\n\nimport { usePlugin, useIntent, LayoutAction, useResolvePlugin, parseFileManagerPlugin } from '@dxos/app-framework';\nimport { type ReactiveEchoObject, create, getSpace } from '@dxos/client/echo';\nimport { FileType } from '@dxos/plugin-ipfs/types';\nimport { type CollectionType } from '@dxos/plugin-space/types';\nimport { Dialog, toLocalizedString, useTranslation } from '@dxos/react-ui';\nimport { Path } from '@dxos/react-ui-mosaic';\nimport { SearchList } from '@dxos/react-ui-searchlist';\nimport { getSize, mx } from '@dxos/react-ui-theme';\nimport { nonNullable } from '@dxos/util';\n\nimport { STACK_PLUGIN } from '../meta';\nimport { StackViewType, type StackPluginProvides, type AddSectionPosition } from '../types';\n\ntype AddSectionDialogProps = { path?: string; position: AddSectionPosition; collection: CollectionType };\n\nexport const dataHasAddSectionDialogProps = (data: any): data is { subject: AddSectionDialogProps } => {\n return (\n 'subject' in data &&\n typeof data.subject === 'object' &&\n !!data.subject &&\n 'position' in data.subject &&\n typeof data.subject.position === 'string' &&\n 'collection' in data.subject\n );\n};\n\nexport const AddSectionDialog = ({ path, position, collection }: AddSectionDialogProps) => {\n const { t } = useTranslation(STACK_PLUGIN);\n const stackPlugin = usePlugin<StackPluginProvides>(STACK_PLUGIN);\n const fileManagerPlugin = useResolvePlugin(parseFileManagerPlugin);\n const fileRef = useRef<HTMLInputElement | null>(null);\n const { dispatch } = useIntent();\n const space = getSpace(collection);\n const [pending, setPending] = useState<boolean>(false);\n const [uploadError, setUploadError] = useState<Error | undefined>();\n\n const handleAdd = useCallback(\n (sectionObject: ReactiveEchoObject<any>) => {\n const index =\n position === 'beforeAll'\n ? 0\n : position === 'afterAll'\n ? collection.objects.length\n : collection.objects.filter(nonNullable).findIndex((section) => section.id === Path.last(path!));\n\n collection.objects.splice(index + (position === 'after' ? 1 : 0), 0, sectionObject);\n const stack = collection.views[StackViewType.typename];\n if (stack) {\n stack.sections[sectionObject.id] = {};\n }\n setPending(false);\n void dispatch?.({ action: LayoutAction.SET_LAYOUT, data: { element: 'dialog', state: false } });\n },\n [collection, path, position, dispatch],\n );\n\n const handleFileUpload =\n fileManagerPlugin?.provides.file.upload && space\n ? async (file: File) => {\n const filename = file.name.split('.')[0];\n try {\n const info = await fileManagerPlugin.provides.file.upload?.(file, space);\n if (info) {\n const obj = create(FileType, { type: file.type, name: filename, filename, cid: info.cid });\n handleAdd(obj);\n }\n } catch (err: any) {\n setUploadError(err);\n }\n }\n : undefined;\n\n return (\n <Dialog.Content>\n <Dialog.Title>{t(`add section ${position} dialog title`)}</Dialog.Title>\n <SearchList.Root label={t('add section input placeholder')}>\n <SearchList.Input placeholder={t('add section input placeholder')} classNames='pli-3' disabled={pending} />\n <SearchList.Content classNames='min-bs-24 bs-fit max-bs-64 overflow-auto' {...(pending && { inert: 'true' })}>\n {stackPlugin?.provides?.stack.creators?.map(({ id, icon: Icon, label: propsLabel, testId, intent }) => {\n const label = toLocalizedString(propsLabel, t);\n return (\n <SearchList.Item\n value={label}\n key={id}\n onSelect={async () => {\n setPending(true);\n const { data: nextSection } = (await dispatch({ ...intent, data: { space } })) ?? {};\n handleAdd(nextSection);\n }}\n classNames='flex items-center gap-2 pli-2'\n data-testid={testId}\n >\n {Icon && <Icon className={mx(getSize(4), 'shrink-0')} />}\n <span className='grow truncate'>{label}</span>\n </SearchList.Item>\n );\n })}\n {handleFileUpload && (\n <SearchList.Item\n value={t('upload file label')}\n classNames='flex items-center gap-2 pli-2'\n onSelect={() => fileRef.current?.click()}\n >\n <FilePlus />\n <span className='grow truncate'>{t('upload file label')}</span>\n </SearchList.Item>\n )}\n {uploadError && <div className='text-error-500'>{uploadError.message}</div>}\n </SearchList.Content>\n </SearchList.Root>\n {handleFileUpload && (\n <input\n type='file'\n className='sr-only'\n ref={fileRef}\n onChange={({ target: { files } }) => files && handleFileUpload(files[0])}\n />\n )}\n </Dialog.Content>\n );\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { translations as stackTranslations } from '@dxos/react-ui-stack';\n\nimport { STACK_PLUGIN } from './meta';\n\nexport default [\n {\n 'en-US': {\n [STACK_PLUGIN]: {\n 'plugin name': 'Stacks',\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 'drag handle label': 'Press space or enter to begin dragging this item.',\n },\n },\n },\n ...stackTranslations,\n];\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { StackPlugin } from './StackPlugin';\n\nexport default StackPlugin;\n\nexport * from './types';\n\nexport * from './StackPlugin';\n"],
4
+ "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nimport { type Plugin, type PluginDefinition } from '@dxos/app-framework';\nimport { create, type ReactiveEchoObject, fullyQualifiedId } from '@dxos/client/echo';\nimport { LocalStorageStore } from '@dxos/local-storage';\nimport { CollectionType } from '@dxos/plugin-space/types';\nimport { Main } from '@dxos/react-ui';\nimport { baseSurface, topbarBlockPaddingStart, bottombarBlockPaddingEnd } from '@dxos/react-ui-theme';\n\nimport { StackMain, StackSettings, AddSectionDialog, dataHasAddSectionDialogProps } from './components';\nimport meta, { SECTION_IDENTIFIER, STACK_PLUGIN } from './meta';\nimport translations from './translations';\nimport { StackViewType } from './types';\nimport { type StackPluginProvides, type StackProvides, type StackState, type StackSettingsProps } from './types';\n\nexport const StackPlugin = (): PluginDefinition<StackPluginProvides> => {\n const settings = new LocalStorageStore<StackSettingsProps>(STACK_PLUGIN, { separation: true });\n const stackState = create<StackState>({ creators: [] });\n\n return {\n meta,\n ready: async (plugins) => {\n settings.prop({ key: 'separation', type: LocalStorageStore.bool() });\n\n for (const plugin of plugins) {\n if (plugin.meta.id === STACK_PLUGIN) {\n continue;\n }\n\n if (Array.isArray((plugin as Plugin<StackProvides>).provides?.stack?.creators)) {\n stackState.creators.push(...((plugin as Plugin<StackProvides>).provides.stack.creators ?? []));\n }\n }\n },\n provides: {\n settings: settings.values,\n metadata: {\n records: {\n [StackViewType.typename]: {\n placeholder: ['stack title placeholder', { ns: STACK_PLUGIN }],\n icon: 'ph--stack-simple--regular',\n },\n [SECTION_IDENTIFIER]: {\n parse: (section: { object: ReactiveEchoObject<any> }, type: string) => {\n switch (type) {\n case 'node':\n // TODO(wittjosiah): Remove cast.\n return { id: section.object.id, label: section.object.title, data: section.object };\n case 'object':\n return section.object;\n case 'view-object':\n return section;\n }\n },\n },\n },\n },\n translations,\n echo: {\n system: [StackViewType],\n },\n surface: {\n component: ({ data, role }) => {\n switch (data.component) {\n case `${STACK_PLUGIN}/AddSectionDialog`:\n return dataHasAddSectionDialogProps(data) ? <AddSectionDialog {...data.subject} /> : null;\n }\n\n const primary = data.active ?? data.object;\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 switch (role) {\n case 'main':\n return primary instanceof CollectionType ? (\n <Main.Content bounce classNames={[baseSurface, topbarBlockPaddingStart, bottombarBlockPaddingEnd]}>\n <StackMain id={id ?? fullyQualifiedId(primary)} collection={primary} />\n </Main.Content>\n ) : null;\n case 'article':\n return primary instanceof CollectionType ? (\n <div role='none' className='overflow-auto' style={{ contain: 'layout' }}>\n <StackMain id={id ?? fullyQualifiedId(primary)} collection={primary} />\n </div>\n ) : null;\n case 'settings': {\n return data.plugin === meta.id ? <StackSettings settings={settings.values} /> : null;\n }\n default:\n return null;\n }\n },\n },\n stack: stackState,\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';\nexport * from './AddSectionDialog';\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nimport { Input, useTranslation } from '@dxos/react-ui';\nimport { 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 <>\n <DeprecatedFormInput label={t('settings separation label')}>\n <Input.Switch checked={settings.separation} onCheckedChange={(checked) => (settings.separation = !!checked)} />\n </DeprecatedFormInput>\n </>\n );\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { FilePlus } from '@phosphor-icons/react';\nimport React, { useCallback, useRef, useState } from 'react';\n\nimport { usePlugin, useIntent, LayoutAction, useResolvePlugin, parseFileManagerPlugin } from '@dxos/app-framework';\nimport { type ReactiveEchoObject, create, getSpace } from '@dxos/client/echo';\nimport { FileType } from '@dxos/plugin-ipfs/types';\nimport { type CollectionType } from '@dxos/plugin-space/types';\nimport { Dialog, toLocalizedString, useTranslation } from '@dxos/react-ui';\nimport { Path } from '@dxos/react-ui-mosaic';\nimport { SearchList } from '@dxos/react-ui-searchlist';\nimport { getSize, mx } from '@dxos/react-ui-theme';\nimport { nonNullable } from '@dxos/util';\n\nimport { STACK_PLUGIN } from '../meta';\nimport { StackViewType, type StackPluginProvides, type AddSectionPosition } from '../types';\n\ntype AddSectionDialogProps = { path?: string; position: AddSectionPosition; collection: CollectionType };\n\nexport const dataHasAddSectionDialogProps = (data: any): data is { subject: AddSectionDialogProps } => {\n return (\n 'subject' in data &&\n typeof data.subject === 'object' &&\n !!data.subject &&\n 'position' in data.subject &&\n typeof data.subject.position === 'string' &&\n 'collection' in data.subject\n );\n};\n\nexport const AddSectionDialog = ({ path, position, collection }: AddSectionDialogProps) => {\n const { t } = useTranslation(STACK_PLUGIN);\n const stackPlugin = usePlugin<StackPluginProvides>(STACK_PLUGIN);\n const fileManagerPlugin = useResolvePlugin(parseFileManagerPlugin);\n const fileRef = useRef<HTMLInputElement | null>(null);\n const { dispatch } = useIntent();\n const space = getSpace(collection);\n const [pending, setPending] = useState<boolean>(false);\n const [uploadError, setUploadError] = useState<Error | undefined>();\n\n const handleAdd = useCallback(\n (sectionObject: ReactiveEchoObject<any>) => {\n const index =\n position === 'beforeAll'\n ? 0\n : position === 'afterAll'\n ? collection.objects.length\n : collection.objects.filter(nonNullable).findIndex((section) => section.id === Path.last(path!));\n\n collection.objects.splice(index + (position === 'after' ? 1 : 0), 0, sectionObject);\n const stack = collection.views[StackViewType.typename];\n if (stack) {\n stack.sections[sectionObject.id] = {};\n }\n setPending(false);\n void dispatch?.({ action: LayoutAction.SET_LAYOUT, data: { element: 'dialog', state: false } });\n },\n [collection, path, position, dispatch],\n );\n\n const handleFileUpload =\n fileManagerPlugin?.provides.file.upload && space\n ? async (file: File) => {\n const filename = file.name.split('.')[0];\n try {\n const info = await fileManagerPlugin.provides.file.upload?.(file, space);\n if (info) {\n const obj = create(FileType, { type: file.type, name: filename, filename, cid: info.cid });\n handleAdd(obj);\n }\n } catch (err: any) {\n setUploadError(err);\n }\n }\n : undefined;\n\n return (\n <Dialog.Content>\n <Dialog.Title>{t(`add section ${position} dialog title`)}</Dialog.Title>\n <SearchList.Root label={t('add section input placeholder')}>\n <SearchList.Input placeholder={t('add section input placeholder')} classNames='pli-3' disabled={pending} />\n <SearchList.Content classNames='min-bs-24 bs-fit max-bs-64 overflow-auto' {...(pending && { inert: 'true' })}>\n {stackPlugin?.provides?.stack.creators?.map(({ id, icon: Icon, label: propsLabel, testId, intent }) => {\n const label = toLocalizedString(propsLabel, t);\n return (\n <SearchList.Item\n value={label}\n key={id}\n onSelect={async () => {\n setPending(true);\n const { data: nextSection } = (await dispatch({ ...intent, data: { space } })) ?? {};\n handleAdd(nextSection);\n }}\n classNames='flex items-center gap-2 pli-2'\n data-testid={testId}\n >\n {Icon && <Icon className={mx(getSize(4), 'shrink-0')} />}\n <span className='grow truncate'>{label}</span>\n </SearchList.Item>\n );\n })}\n {handleFileUpload && (\n <SearchList.Item\n value={t('upload file label')}\n classNames='flex items-center gap-2 pli-2'\n onSelect={() => fileRef.current?.click()}\n >\n <FilePlus />\n <span className='grow truncate'>{t('upload file label')}</span>\n </SearchList.Item>\n )}\n {uploadError && <div className='text-error-500'>{uploadError.message}</div>}\n </SearchList.Content>\n </SearchList.Root>\n {handleFileUpload && (\n <input\n type='file'\n className='sr-only'\n ref={fileRef}\n onChange={({ target: { files } }) => files && handleFileUpload(files[0])}\n />\n )}\n </Dialog.Content>\n );\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { translations as stackTranslations } from '@dxos/react-ui-stack';\n\nimport { STACK_PLUGIN } from './meta';\n\nexport default [\n {\n 'en-US': {\n [STACK_PLUGIN]: {\n 'plugin name': 'Stacks',\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 'drag handle label': 'Press space or enter to begin dragging this item.',\n },\n },\n },\n ...stackTranslations,\n];\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { StackPlugin } from './StackPlugin';\n\nexport default StackPlugin;\n\nexport * from './types';\n\nexport * from './StackPlugin';\n"],
5
5
  "mappings": ";;;;;;;;;;;;AAIA,OAAOA,YAAW;AAGlB,SAASC,UAAAA,SAAiCC,wBAAwB;AAClE,SAASC,yBAAy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MAAM2C,iBAAiBZ,OAAAA;gBAAUa,YAAYb;oBAE5D;YACN,KAAK,YAAY;AACf,qBAAOX,KAAKrB,WAAWP,aAAKQ,KAAK,gBAAA4B,OAAA,cAACqB,eAAAA;gBAAchE,UAAUA,SAASqB;mBAAa;YAClF;YACA;AACE,qBAAO;UACX;QACF;MACF;MACAF,OAAOf;IACT;EACF;AACF;;;AK9FA,IAAA,cAAe6D;",
6
- "names": ["React", "create", "fullyQualifiedId", "LocalStorageStore", "CollectionType", "Main", "baseSurface", "topbarBlockPaddingStart", "bottombarBlockPaddingEnd", "lazy", "React", "Input", "useTranslation", "DeprecatedFormInput", "StackSettings", "settings", "t", "useTranslation", "STACK_PLUGIN", "DeprecatedFormInput", "label", "Input", "Switch", "checked", "separation", "onCheckedChange", "FilePlus", "React", "useCallback", "useRef", "useState", "usePlugin", "useIntent", "LayoutAction", "useResolvePlugin", "parseFileManagerPlugin", "create", "getSpace", "FileType", "Dialog", "toLocalizedString", "useTranslation", "Path", "SearchList", "getSize", "mx", "nonNullable", "dataHasAddSectionDialogProps", "data", "subject", "position", "AddSectionDialog", "path", "collection", "t", "useTranslation", "STACK_PLUGIN", "stackPlugin", "usePlugin", "fileManagerPlugin", "useResolvePlugin", "parseFileManagerPlugin", "fileRef", "useRef", "dispatch", "useIntent", "space", "getSpace", "pending", "setPending", "useState", "uploadError", "setUploadError", "handleAdd", "useCallback", "sectionObject", "index", "objects", "length", "filter", "nonNullable", "findIndex", "section", "id", "Path", "last", "splice", "stack", "views", "StackViewType", "typename", "sections", "action", "LayoutAction", "SET_LAYOUT", "element", "state", "handleFileUpload", "provides", "file", "upload", "filename", "name", "split", "info", "obj", "create", "FileType", "type", "cid", "err", "undefined", "React", "Dialog", "Content", "Title", "SearchList", "Root", "label", "Input", "placeholder", "classNames", "disabled", "inert", "creators", "map", "icon", "Icon", "propsLabel", "testId", "intent", "toLocalizedString", "Item", "value", "key", "onSelect", "nextSection", "data-testid", "className", "mx", "getSize", "span", "current", "click", "FilePlus", "div", "message", "input", "ref", "onChange", "target", "files", "StackMain", "lazy", "translations", "stackTranslations", "STACK_PLUGIN", "stackTranslations", "StackPlugin", "settings", "LocalStorageStore", "STACK_PLUGIN", "separation", "stackState", "create", "creators", "meta", "ready", "plugins", "prop", "key", "type", "bool", "plugin", "id", "Array", "isArray", "provides", "stack", "push", "values", "metadata", "records", "StackViewType", "typename", "placeholder", "ns", "icon", "SECTION_IDENTIFIER", "parse", "section", "object", "label", "title", "data", "translations", "echo", "schema", "surface", "component", "role", "dataHasAddSectionDialogProps", "React", "AddSectionDialog", "subject", "primary", "active", "undefined", "CollectionType", "Main", "Content", "bounce", "classNames", "baseSurface", "topbarBlockPaddingStart", "bottombarBlockPaddingEnd", "StackMain", "fullyQualifiedId", "collection", "div", "className", "style", "contain", "StackSettings", "StackPlugin"]
6
+ "names": ["React", "create", "fullyQualifiedId", "LocalStorageStore", "CollectionType", "Main", "baseSurface", "topbarBlockPaddingStart", "bottombarBlockPaddingEnd", "lazy", "React", "Input", "useTranslation", "DeprecatedFormInput", "StackSettings", "settings", "t", "useTranslation", "STACK_PLUGIN", "DeprecatedFormInput", "label", "Input", "Switch", "checked", "separation", "onCheckedChange", "FilePlus", "React", "useCallback", "useRef", "useState", "usePlugin", "useIntent", "LayoutAction", "useResolvePlugin", "parseFileManagerPlugin", "create", "getSpace", "FileType", "Dialog", "toLocalizedString", "useTranslation", "Path", "SearchList", "getSize", "mx", "nonNullable", "dataHasAddSectionDialogProps", "data", "subject", "position", "AddSectionDialog", "path", "collection", "t", "useTranslation", "STACK_PLUGIN", "stackPlugin", "usePlugin", "fileManagerPlugin", "useResolvePlugin", "parseFileManagerPlugin", "fileRef", "useRef", "dispatch", "useIntent", "space", "getSpace", "pending", "setPending", "useState", "uploadError", "setUploadError", "handleAdd", "useCallback", "sectionObject", "index", "objects", "length", "filter", "nonNullable", "findIndex", "section", "id", "Path", "last", "splice", "stack", "views", "StackViewType", "typename", "sections", "action", "LayoutAction", "SET_LAYOUT", "element", "state", "handleFileUpload", "provides", "file", "upload", "filename", "name", "split", "info", "obj", "create", "FileType", "type", "cid", "err", "undefined", "React", "Dialog", "Content", "Title", "SearchList", "Root", "label", "Input", "placeholder", "classNames", "disabled", "inert", "creators", "map", "icon", "Icon", "propsLabel", "testId", "intent", "toLocalizedString", "Item", "value", "key", "onSelect", "nextSection", "data-testid", "className", "mx", "getSize", "span", "current", "click", "FilePlus", "div", "message", "input", "ref", "onChange", "target", "files", "StackMain", "lazy", "translations", "stackTranslations", "STACK_PLUGIN", "stackTranslations", "StackPlugin", "settings", "LocalStorageStore", "STACK_PLUGIN", "separation", "stackState", "create", "creators", "meta", "ready", "plugins", "prop", "key", "type", "bool", "plugin", "id", "Array", "isArray", "provides", "stack", "push", "values", "metadata", "records", "StackViewType", "typename", "placeholder", "ns", "icon", "SECTION_IDENTIFIER", "parse", "section", "object", "label", "title", "data", "translations", "echo", "system", "surface", "component", "role", "dataHasAddSectionDialogProps", "React", "AddSectionDialog", "subject", "primary", "active", "undefined", "CollectionType", "Main", "Content", "bounce", "classNames", "baseSurface", "topbarBlockPaddingStart", "bottombarBlockPaddingEnd", "StackMain", "fullyQualifiedId", "collection", "div", "className", "style", "contain", "StackSettings", "StackPlugin"]
7
7
  }
@@ -1,7 +1,7 @@
1
1
  import { type IconProps } from '@phosphor-icons/react';
2
2
  import { type FC } from 'react';
3
3
  import type { Intent, MetadataRecordsProvides, SettingsProvides, SurfaceProvides, TranslationsProvides } from '@dxos/app-framework';
4
- import { type SchemaProvides } from '@dxos/plugin-client';
4
+ import { type SchemaProvides } from '@dxos/plugin-space';
5
5
  import { type CollectionType } from '@dxos/plugin-space/types';
6
6
  import { type Label } from '@dxos/react-ui';
7
7
  import { type StackItemSize } from '@dxos/react-ui-stack';
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/types/types.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,uBAAu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AAC;CAC5D,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,cAAc,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC;IAC1C,IAAI,EAAE,gBAAgB,CAAC;IACvB,QAAQ,EAAE,oBAAoB,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,kBAAkB,GAAG;IACrD,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE;QACL,QAAQ,CAAC,EAAE,mBAAmB,EAAE,CAAC;KAClC,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,QAAQ,EAAE,mBAAmB,EAAE,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAAE,UAAU,EAAE,OAAO,CAAA;CAAE,CAAC;AAEzD,MAAM,MAAM,mBAAmB,GAAG,eAAe,GAC/C,uBAAuB,GACvB,gBAAgB,CAAC,kBAAkB,CAAC,GACpC,oBAAoB,GACpB,cAAc,GAAG;IAAE,KAAK,EAAE,UAAU,CAAA;CAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/plugin-stack",
3
- "version": "0.7.2",
3
+ "version": "0.7.3-staging.971cd8d",
4
4
  "description": "DXOS Surface plugin for Stack entities",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -46,23 +46,23 @@
46
46
  "@radix-ui/react-collapsible": "^1.0.2",
47
47
  "node-fetch": "^2.6.0",
48
48
  "react-is": "~18.2.0",
49
- "@dxos/app-framework": "0.7.2",
50
- "@dxos/async": "0.7.2",
51
- "@dxos/echo-schema": "0.7.2",
52
- "@dxos/client": "0.7.2",
53
- "@dxos/invariant": "0.7.2",
54
- "@dxos/local-storage": "0.7.2",
55
- "@dxos/plugin-client": "0.7.2",
56
- "@dxos/plugin-ipfs": "0.7.2",
57
- "@dxos/plugin-graph": "0.7.2",
58
- "@dxos/plugin-space": "0.7.2",
59
- "@dxos/react-ui-attention": "0.7.2",
60
- "@dxos/react-client": "0.7.2",
61
- "@dxos/react-ui-mosaic": "0.7.2",
62
- "@dxos/react-ui-form": "0.7.2",
63
- "@dxos/react-ui-searchlist": "0.7.2",
64
- "@dxos/react-ui-stack": "0.7.2",
65
- "@dxos/util": "0.7.2"
49
+ "@dxos/app-framework": "0.7.3-staging.971cd8d",
50
+ "@dxos/async": "0.7.3-staging.971cd8d",
51
+ "@dxos/client": "0.7.3-staging.971cd8d",
52
+ "@dxos/invariant": "0.7.3-staging.971cd8d",
53
+ "@dxos/echo-schema": "0.7.3-staging.971cd8d",
54
+ "@dxos/local-storage": "0.7.3-staging.971cd8d",
55
+ "@dxos/plugin-client": "0.7.3-staging.971cd8d",
56
+ "@dxos/plugin-graph": "0.7.3-staging.971cd8d",
57
+ "@dxos/plugin-space": "0.7.3-staging.971cd8d",
58
+ "@dxos/plugin-ipfs": "0.7.3-staging.971cd8d",
59
+ "@dxos/react-ui-attention": "0.7.3-staging.971cd8d",
60
+ "@dxos/react-client": "0.7.3-staging.971cd8d",
61
+ "@dxos/react-ui-form": "0.7.3-staging.971cd8d",
62
+ "@dxos/react-ui-mosaic": "0.7.3-staging.971cd8d",
63
+ "@dxos/react-ui-searchlist": "0.7.3-staging.971cd8d",
64
+ "@dxos/react-ui-stack": "0.7.3-staging.971cd8d",
65
+ "@dxos/util": "0.7.3-staging.971cd8d"
66
66
  },
67
67
  "devDependencies": {
68
68
  "@babel/core": "^7.18.13",
@@ -72,16 +72,16 @@
72
72
  "react": "~18.2.0",
73
73
  "react-dom": "~18.2.0",
74
74
  "vite": "5.4.7",
75
- "@dxos/react-ui": "0.7.2",
76
- "@dxos/react-ui-theme": "0.7.2",
77
- "@dxos/storybook-utils": "0.7.2"
75
+ "@dxos/react-ui": "0.7.3-staging.971cd8d",
76
+ "@dxos/storybook-utils": "0.7.3-staging.971cd8d",
77
+ "@dxos/react-ui-theme": "0.7.3-staging.971cd8d"
78
78
  },
79
79
  "peerDependencies": {
80
80
  "@phosphor-icons/react": "^2.1.5",
81
81
  "react": "~18.2.0",
82
82
  "react-dom": "~18.2.0",
83
- "@dxos/react-ui": "0.7.2",
84
- "@dxos/react-ui-theme": "0.7.2"
83
+ "@dxos/react-ui": "0.7.3-staging.971cd8d",
84
+ "@dxos/react-ui-theme": "0.7.3-staging.971cd8d"
85
85
  },
86
86
  "publishConfig": {
87
87
  "access": "public"
@@ -61,7 +61,7 @@ export const StackPlugin = (): PluginDefinition<StackPluginProvides> => {
61
61
  },
62
62
  translations,
63
63
  echo: {
64
- schema: [StackViewType],
64
+ system: [StackViewType],
65
65
  },
66
66
  surface: {
67
67
  component: ({ data, role }) => {
@@ -12,7 +12,7 @@ import type {
12
12
  SurfaceProvides,
13
13
  TranslationsProvides,
14
14
  } from '@dxos/app-framework';
15
- import { type SchemaProvides } from '@dxos/plugin-client';
15
+ import { type SchemaProvides } from '@dxos/plugin-space';
16
16
  import { type CollectionType } from '@dxos/plugin-space/types';
17
17
  import { type Label } from '@dxos/react-ui';
18
18
  import { type StackItemSize } from '@dxos/react-ui-stack';