@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,47 +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/capabilities/react-surface.tsx
|
|
7
|
-
import React2 from "react";
|
|
8
|
-
import { Capabilities, contributes, createSurface } from "@dxos/app-framework";
|
|
9
|
-
import { Obj } from "@dxos/echo";
|
|
10
|
-
import { fullyQualifiedId } from "@dxos/react-client/echo";
|
|
11
|
-
import { DataType } from "@dxos/schema";
|
|
12
|
-
|
|
13
|
-
// src/components/index.ts
|
|
14
|
-
import { lazy } from "react";
|
|
15
|
-
|
|
16
|
-
// src/components/StackSettings.tsx
|
|
17
|
-
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
18
|
-
import React from "react";
|
|
19
|
-
import { Input, useTranslation } from "@dxos/react-ui";
|
|
20
|
-
import { DeprecatedFormContainer, DeprecatedFormInput } from "@dxos/react-ui-form";
|
|
21
|
-
|
|
22
|
-
// src/components/index.ts
|
|
23
|
-
var StackMain = lazy(() => import("./StackMain-G55P33OY.mjs"));
|
|
24
|
-
|
|
25
|
-
// src/capabilities/react-surface.tsx
|
|
26
|
-
var react_surface_default = () => contributes(Capabilities.ReactSurface, createSurface({
|
|
27
|
-
id: `${STACK_PLUGIN}/article`,
|
|
28
|
-
role: "article",
|
|
29
|
-
filter: (data) => Obj.instanceOf(DataType.Collection, data.subject),
|
|
30
|
-
component: ({ data }) => {
|
|
31
|
-
const id = typeof data.id === "string" ? data.id : void 0;
|
|
32
|
-
return /* @__PURE__ */ React2.createElement("div", {
|
|
33
|
-
role: "none",
|
|
34
|
-
className: "overflow-auto",
|
|
35
|
-
style: {
|
|
36
|
-
contain: "layout"
|
|
37
|
-
}
|
|
38
|
-
}, /* @__PURE__ */ React2.createElement(StackMain, {
|
|
39
|
-
id: id ?? fullyQualifiedId(data.subject),
|
|
40
|
-
collection: data.subject
|
|
41
|
-
}));
|
|
42
|
-
}
|
|
43
|
-
}));
|
|
44
|
-
export {
|
|
45
|
-
react_surface_default as default
|
|
46
|
-
};
|
|
47
|
-
//# sourceMappingURL=react-surface-H33L4IMD.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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CaretDownUp.d.ts","sourceRoot":"","sources":["../../../../src/components/CaretDownUp.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,EAAE,KAAK,wBAAwB,EAAE,MAAM,OAAO,CAAC;AAE7D,eAAO,MAAM,WAAW,GAAI,wBAAwB,wBAAwB,CAAC,KAAK,CAAC,sBAuBlF,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"StackContext.d.ts","sourceRoot":"","sources":["../../../../src/components/StackContext.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAEnD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,UAAU,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;IACrD,UAAU,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1C,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACxC,KAAK,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,kBAAkB,KAAK,IAAI,CAAC;CAC3D,CAAC;AAEF,eAAO,MAAM,YAAY,4CAKvB,CAAC;AAEH,eAAO,MAAM,QAAQ,yBAAiC,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { type DataType } from '@dxos/schema';
|
|
3
|
-
type StackMainProps = {
|
|
4
|
-
id: string;
|
|
5
|
-
collection: DataType.Collection;
|
|
6
|
-
};
|
|
7
|
-
declare const StackMain: ({ id, collection }: StackMainProps) => React.JSX.Element;
|
|
8
|
-
export default StackMain;
|
|
9
|
-
//# sourceMappingURL=StackMain.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"StackMain.d.ts","sourceRoot":"","sources":["../../../../src/components/StackMain.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAgC,MAAM,OAAO,CAAC;AAgBrD,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,cAAc,CAAC;AAc7C,KAAK,cAAc,GAAG;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,QAAQ,CAAC,UAAU,CAAC;CACjC,CAAC;AAEF,QAAA,MAAM,SAAS,GAAI,oBAAoB,cAAc,sBAoHpD,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"StackSection.d.ts","sourceRoot":"","sources":["../../../../src/components/StackSection.tsx"],"names":[],"mappings":"AAKA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAWjD,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAIjD,MAAM,MAAM,iBAAiB,GAAG,gBAAgB,CAAC;AAEjD,eAAO,MAAM,YAAY,GAAI,2CAK1B,iBAAiB,sBA2FnB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"StackSettings.d.ts","sourceRoot":"","sources":["../../../../src/components/StackSettings.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAEnD,eAAO,MAAM,aAAa,GAAI,cAAc;IAAE,QAAQ,EAAE,kBAAkB,CAAA;CAAE,sBAU3E,CAAC"}
|
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { Plus } from '@phosphor-icons/react';
|
|
6
|
-
import { Option } from 'effect';
|
|
7
|
-
import React, { useCallback, useState } from 'react';
|
|
8
|
-
|
|
9
|
-
import {
|
|
10
|
-
Capabilities,
|
|
11
|
-
LayoutAction,
|
|
12
|
-
createIntent,
|
|
13
|
-
useAppGraph,
|
|
14
|
-
useCapabilities,
|
|
15
|
-
useIntentDispatcher,
|
|
16
|
-
} from '@dxos/app-framework';
|
|
17
|
-
import { fullyQualifiedId, isLiveObject } from '@dxos/client/echo';
|
|
18
|
-
import { Obj } from '@dxos/echo';
|
|
19
|
-
import { SpaceAction } from '@dxos/plugin-space/types';
|
|
20
|
-
import { Button, toLocalizedString, useTranslation } from '@dxos/react-ui';
|
|
21
|
-
import { AttentionProvider } from '@dxos/react-ui-attention';
|
|
22
|
-
import { Stack } from '@dxos/react-ui-stack';
|
|
23
|
-
import { type DataType } from '@dxos/schema';
|
|
24
|
-
import { isNonNullable } from '@dxos/util';
|
|
25
|
-
|
|
26
|
-
import { StackContext } from './StackContext';
|
|
27
|
-
import { StackSection } from './StackSection';
|
|
28
|
-
import { STACK_PLUGIN } from '../meta';
|
|
29
|
-
import {
|
|
30
|
-
type AddSectionPosition,
|
|
31
|
-
type CollapsedSections,
|
|
32
|
-
type StackSectionItem,
|
|
33
|
-
type StackSectionMetadata,
|
|
34
|
-
type StackSectionView,
|
|
35
|
-
} from '../types';
|
|
36
|
-
|
|
37
|
-
type StackMainProps = {
|
|
38
|
-
id: string;
|
|
39
|
-
collection: DataType.Collection;
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
const StackMain = ({ id, collection }: StackMainProps) => {
|
|
43
|
-
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
44
|
-
const { graph } = useAppGraph();
|
|
45
|
-
const { t } = useTranslation(STACK_PLUGIN);
|
|
46
|
-
const allMetadata = useCapabilities(Capabilities.Metadata);
|
|
47
|
-
const [collapsedSections, setCollapsedSections] = useState<CollapsedSections>({});
|
|
48
|
-
|
|
49
|
-
// TODO(wittjosiah): Re-implement stack views with relations.
|
|
50
|
-
// const defaultStack = useMemo(() => Obj.make(StackViewType, { sections: {} }), [collection]);
|
|
51
|
-
// const stack = (collection.views[StackViewType.typename]?.target as StackViewType | undefined) ?? defaultStack;
|
|
52
|
-
// useEffect(() => {
|
|
53
|
-
// if (!collection.views[StackViewType.typename]) {
|
|
54
|
-
// collection.views[StackViewType.typename] = Ref.make(stack);
|
|
55
|
-
// }
|
|
56
|
-
// }, [collection, stack]);
|
|
57
|
-
|
|
58
|
-
const items =
|
|
59
|
-
collection.objects
|
|
60
|
-
// TODO(wittjosiah): Should the database handle this differently?
|
|
61
|
-
// TODO(wittjosiah): Render placeholders for missing objects so they can be removed from the stack?
|
|
62
|
-
.map((object) => object.target)
|
|
63
|
-
.filter(isNonNullable)
|
|
64
|
-
.map((object) => {
|
|
65
|
-
const metadata = allMetadata.find((m) => m.id === (Obj.getTypename(object) ?? 'never'))
|
|
66
|
-
?.metadata as StackSectionMetadata;
|
|
67
|
-
const view = {
|
|
68
|
-
// ...stack.sections[object.id],
|
|
69
|
-
collapsed: collapsedSections[fullyQualifiedId(object)],
|
|
70
|
-
title:
|
|
71
|
-
(object as any)?.title ??
|
|
72
|
-
// TODO(wittjosiah): `getNode` is not reactive.
|
|
73
|
-
toLocalizedString(graph.getNode(fullyQualifiedId(object)).pipe(Option.getOrNull)?.properties.label, t),
|
|
74
|
-
} as StackSectionView;
|
|
75
|
-
return { id: fullyQualifiedId(object), object, metadata, view } satisfies StackSectionItem;
|
|
76
|
-
}) ?? [];
|
|
77
|
-
|
|
78
|
-
const handleDelete = useCallback(
|
|
79
|
-
async (id: string) => {
|
|
80
|
-
const index = collection.objects
|
|
81
|
-
.map((object) => object.target)
|
|
82
|
-
.filter(isNonNullable)
|
|
83
|
-
.findIndex((section) => fullyQualifiedId(section) === id);
|
|
84
|
-
const object = collection.objects[index].target;
|
|
85
|
-
if (isLiveObject(object)) {
|
|
86
|
-
await dispatch(createIntent(SpaceAction.RemoveObjects, { objects: [object], target: collection }));
|
|
87
|
-
|
|
88
|
-
// TODO(wittjosiah): The section should also be removed, but needs to be restored if the action is undone.
|
|
89
|
-
// delete stack.sections[Path.last(path)];
|
|
90
|
-
}
|
|
91
|
-
},
|
|
92
|
-
[collection, dispatch],
|
|
93
|
-
);
|
|
94
|
-
|
|
95
|
-
const handleAdd = useCallback(
|
|
96
|
-
async (id: string, position: AddSectionPosition) => {
|
|
97
|
-
await dispatch?.(
|
|
98
|
-
// TODO(wittjosiah): Use object creation dialog.
|
|
99
|
-
createIntent(LayoutAction.UpdateDialog, {
|
|
100
|
-
part: 'dialog',
|
|
101
|
-
subject: `${STACK_PLUGIN}/AddSectionDialog`,
|
|
102
|
-
options: {
|
|
103
|
-
blockAlign: 'start',
|
|
104
|
-
props: {
|
|
105
|
-
path: id,
|
|
106
|
-
position,
|
|
107
|
-
collection,
|
|
108
|
-
},
|
|
109
|
-
},
|
|
110
|
-
}),
|
|
111
|
-
);
|
|
112
|
-
},
|
|
113
|
-
[collection, dispatch],
|
|
114
|
-
);
|
|
115
|
-
|
|
116
|
-
const handleNavigate = useCallback(
|
|
117
|
-
async (id: string) => {
|
|
118
|
-
await dispatch(createIntent(LayoutAction.Open, { part: 'main', subject: [id] }));
|
|
119
|
-
},
|
|
120
|
-
[dispatch],
|
|
121
|
-
);
|
|
122
|
-
|
|
123
|
-
const handleCollapse = useCallback(
|
|
124
|
-
(id: string, collapsed: boolean) => setCollapsedSections((prev) => ({ ...prev, [id]: collapsed })),
|
|
125
|
-
[],
|
|
126
|
-
);
|
|
127
|
-
|
|
128
|
-
const handleAddSection = useCallback(
|
|
129
|
-
() => dispatch?.(createIntent(SpaceAction.OpenCreateObject, { target: collection, navigable: false })),
|
|
130
|
-
[collection, dispatch],
|
|
131
|
-
);
|
|
132
|
-
|
|
133
|
-
return (
|
|
134
|
-
<AttentionProvider id={id}>
|
|
135
|
-
<StackContext.Provider
|
|
136
|
-
value={{
|
|
137
|
-
onCollapse: handleCollapse,
|
|
138
|
-
onNavigate: handleNavigate,
|
|
139
|
-
onDelete: handleDelete,
|
|
140
|
-
onAdd: handleAdd,
|
|
141
|
-
}}
|
|
142
|
-
>
|
|
143
|
-
<Stack orientation='vertical' size='intrinsic' id={id} data-testid='main.stack'>
|
|
144
|
-
{items.map((item) => (
|
|
145
|
-
<StackSection key={item.id} {...item} />
|
|
146
|
-
))}
|
|
147
|
-
</Stack>
|
|
148
|
-
|
|
149
|
-
<div role='none' className='flex mlb-2 pli-2 justify-center'>
|
|
150
|
-
<Button data-testid='stack.createSection' classNames='gap-2' onClick={handleAddSection}>
|
|
151
|
-
<Plus />
|
|
152
|
-
<span className='sr-only'>{t('add section label')}</span>
|
|
153
|
-
</Button>
|
|
154
|
-
</div>
|
|
155
|
-
</StackContext.Provider>
|
|
156
|
-
</AttentionProvider>
|
|
157
|
-
);
|
|
158
|
-
};
|
|
159
|
-
|
|
160
|
-
export default StackMain;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React from 'react';
|
|
6
|
-
|
|
7
|
-
import { Input, useTranslation } from '@dxos/react-ui';
|
|
8
|
-
import { DeprecatedFormContainer, DeprecatedFormInput } from '@dxos/react-ui-form';
|
|
9
|
-
|
|
10
|
-
import { STACK_PLUGIN } from '../meta';
|
|
11
|
-
import { type StackSettingsProps } from '../types';
|
|
12
|
-
|
|
13
|
-
export const StackSettings = ({ settings }: { settings: StackSettingsProps }) => {
|
|
14
|
-
const { t } = useTranslation(STACK_PLUGIN);
|
|
15
|
-
|
|
16
|
-
return (
|
|
17
|
-
<DeprecatedFormContainer>
|
|
18
|
-
<DeprecatedFormInput label={t('settings separation label')}>
|
|
19
|
-
<Input.Switch checked={settings.separation} onCheckedChange={(checked) => (settings.separation = !!checked)} />
|
|
20
|
-
</DeprecatedFormInput>
|
|
21
|
-
</DeprecatedFormContainer>
|
|
22
|
-
);
|
|
23
|
-
};
|
|
File without changes
|