@dxos/plugin-pipeline 0.8.4-main.c85a9c8dae → 0.8.4-main.effb148878
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/LICENSE +102 -5
- package/README.md +1 -1
- package/dist/lib/neutral/PipelineArticle-6JIVXMYF.mjs +69 -0
- package/dist/lib/neutral/PipelineArticle-6JIVXMYF.mjs.map +7 -0
- package/dist/lib/neutral/PipelinePlugin.mjs +26 -0
- package/dist/lib/neutral/PipelinePlugin.mjs.map +7 -0
- package/dist/lib/neutral/PipelinePlugin.node.mjs +21 -0
- package/dist/lib/neutral/PipelinePlugin.node.mjs.map +7 -0
- package/dist/lib/neutral/PipelinePlugin.workerd.mjs +16 -0
- package/dist/lib/neutral/PipelinePlugin.workerd.mjs.map +7 -0
- package/dist/lib/{browser/PipelineObjectSettings-D36OYVHW.mjs → neutral/PipelineProperties-NFNEU3NR.mjs} +56 -69
- package/dist/lib/neutral/PipelineProperties-NFNEU3NR.mjs.map +7 -0
- package/dist/lib/neutral/app-graph-builder-ZLGRWRJU.mjs +44 -0
- package/dist/lib/neutral/app-graph-builder-ZLGRWRJU.mjs.map +7 -0
- package/dist/lib/neutral/capabilities/index.mjs +11 -0
- package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
- package/dist/lib/neutral/chunk-OVZ2ASS7.mjs +33 -0
- package/dist/lib/neutral/chunk-OVZ2ASS7.mjs.map +7 -0
- package/dist/lib/neutral/components/index.mjs +207 -0
- package/dist/lib/neutral/components/index.mjs.map +7 -0
- package/dist/lib/neutral/containers/index.mjs +9 -0
- package/dist/lib/neutral/containers/index.mjs.map +7 -0
- package/dist/lib/neutral/create-object-6Z4MMGX4.mjs +26 -0
- package/dist/lib/neutral/create-object-6Z4MMGX4.mjs.map +7 -0
- package/dist/lib/neutral/hooks/index.mjs +70 -0
- package/dist/lib/neutral/hooks/index.mjs.map +7 -0
- package/dist/lib/neutral/index.mjs +7 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/lib/neutral/meta.mjs +7 -0
- package/dist/lib/neutral/meta.mjs.map +7 -0
- package/dist/lib/neutral/plugin.mjs +11 -0
- package/dist/lib/neutral/plugin.mjs.map +7 -0
- package/dist/lib/{browser/react-surface-ZGQVH4VX.mjs → neutral/react-surface-4W5YLCHT.mjs} +15 -26
- package/dist/lib/neutral/react-surface-4W5YLCHT.mjs.map +7 -0
- package/dist/lib/neutral/translations.mjs +39 -0
- package/dist/lib/neutral/translations.mjs.map +7 -0
- package/dist/lib/neutral/types/index.mjs +1 -0
- package/dist/lib/neutral/types/index.mjs.map +7 -0
- package/dist/types/src/PipelinePlugin.d.ts +1 -0
- package/dist/types/src/PipelinePlugin.d.ts.map +1 -1
- package/dist/types/src/PipelinePlugin.node.d.ts +4 -0
- package/dist/types/src/PipelinePlugin.node.d.ts.map +1 -0
- package/dist/types/src/PipelinePlugin.test.d.ts +2 -0
- package/dist/types/src/PipelinePlugin.test.d.ts.map +1 -0
- package/dist/types/src/PipelinePlugin.workerd.d.ts +4 -0
- package/dist/types/src/PipelinePlugin.workerd.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/create-object.d.ts +11 -0
- package/dist/types/src/capabilities/create-object.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +9 -3
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- package/dist/types/src/components/{PipelineColumn.d.ts → PipelineComponent/PipelineColumn.d.ts} +4 -4
- package/dist/types/src/components/PipelineComponent/PipelineColumn.d.ts.map +1 -0
- package/dist/types/src/components/PipelineComponent/PipelineComponent.d.ts +53 -0
- package/dist/types/src/components/PipelineComponent/PipelineComponent.d.ts.map +1 -0
- package/dist/types/src/components/PipelineComponent/PipelineComponent.stories.d.ts +62 -0
- package/dist/types/src/components/PipelineComponent/PipelineComponent.stories.d.ts.map +1 -0
- package/dist/types/src/components/PipelineComponent/index.d.ts +3 -0
- package/dist/types/src/components/PipelineComponent/index.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +0 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/PipelineArticle/PipelineArticle.d.ts +6 -0
- package/dist/types/src/containers/PipelineArticle/PipelineArticle.d.ts.map +1 -0
- package/dist/types/src/containers/PipelineArticle/PipelineArticle.stories.d.ts +76 -0
- package/dist/types/src/containers/PipelineArticle/PipelineArticle.stories.d.ts.map +1 -0
- package/dist/types/src/containers/PipelineArticle/index.d.ts +2 -0
- package/dist/types/src/containers/PipelineArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/PipelineProperties/PipelineProperties.d.ts +11 -0
- package/dist/types/src/containers/PipelineProperties/PipelineProperties.d.ts.map +1 -0
- package/dist/types/src/containers/PipelineProperties/index.d.ts +2 -0
- package/dist/types/src/containers/PipelineProperties/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +2 -2
- package/dist/types/src/containers/index.d.ts.map +1 -1
- package/dist/types/src/hooks/usePipelineBoardModel.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +0 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/plugin.d.ts +3 -0
- package/dist/types/src/plugin.d.ts.map +1 -0
- package/dist/types/src/templates/research.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +44 -25
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/index.d.ts +0 -2
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +103 -57
- package/src/PipelinePlugin.node.ts +19 -0
- package/src/PipelinePlugin.test.ts +27 -0
- package/src/PipelinePlugin.tsx +7 -31
- package/src/PipelinePlugin.workerd.ts +16 -0
- package/src/capabilities/app-graph-builder.ts +40 -0
- package/src/capabilities/create-object.ts +30 -0
- package/src/capabilities/index.ts +5 -3
- package/src/capabilities/{react-surface/react-surface.tsx → react-surface.tsx} +16 -15
- package/src/components/PipelineComponent/PipelineColumn.tsx +163 -0
- package/src/components/{PipelineComponent.stories.tsx → PipelineComponent/PipelineComponent.stories.tsx} +21 -21
- package/src/components/{PipelineComponent.tsx → PipelineComponent/PipelineComponent.tsx} +22 -13
- package/src/components/PipelineComponent/index.ts +6 -0
- package/src/components/index.ts +0 -1
- package/src/containers/{PipelineContainer/PipelineContainer.stories.tsx → PipelineArticle/PipelineArticle.stories.tsx} +44 -45
- package/src/containers/{PipelineContainer/PipelineContainer.tsx → PipelineArticle/PipelineArticle.tsx} +14 -17
- package/src/containers/PipelineArticle/index.ts +5 -0
- package/src/containers/{PipelineObjectSettings/PipelineObjectSettings.tsx → PipelineProperties/PipelineProperties.tsx} +68 -75
- package/src/containers/PipelineProperties/index.ts +5 -0
- package/src/containers/index.ts +2 -2
- package/src/hooks/usePipelineBoardModel.ts +6 -6
- package/src/index.ts +0 -1
- package/src/meta.ts +15 -3
- package/src/plugin.ts +9 -0
- package/src/templates/research.ts +8 -7
- package/src/translations.ts +24 -22
- package/src/types/index.ts +0 -3
- package/dist/lib/browser/PipelineContainer-2ZYSZATA.mjs +0 -320
- package/dist/lib/browser/PipelineContainer-2ZYSZATA.mjs.map +0 -7
- package/dist/lib/browser/PipelineObjectSettings-D36OYVHW.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-NUJB33F7.mjs +0 -65
- package/dist/lib/browser/app-graph-builder-NUJB33F7.mjs.map +0 -7
- package/dist/lib/browser/chunk-N6FZHYWT.mjs +0 -42
- package/dist/lib/browser/chunk-N6FZHYWT.mjs.map +0 -7
- package/dist/lib/browser/chunk-QWNKLHBY.mjs +0 -28
- package/dist/lib/browser/chunk-QWNKLHBY.mjs.map +0 -7
- package/dist/lib/browser/index.mjs +0 -109
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/react-surface-ZGQVH4VX.mjs.map +0 -7
- package/dist/lib/browser/types/index.mjs +0 -10
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +0 -1
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts +0 -3
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/operation-resolver/index.d.ts +0 -2
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +0 -5
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts +0 -3
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +0 -1
- package/dist/types/src/components/PipelineColumn.d.ts.map +0 -1
- package/dist/types/src/components/PipelineComponent.d.ts +0 -47
- package/dist/types/src/components/PipelineComponent.d.ts.map +0 -1
- package/dist/types/src/components/PipelineComponent.stories.d.ts +0 -42
- package/dist/types/src/components/PipelineComponent.stories.d.ts.map +0 -1
- package/dist/types/src/containers/PipelineContainer/PipelineContainer.d.ts +0 -6
- package/dist/types/src/containers/PipelineContainer/PipelineContainer.d.ts.map +0 -1
- package/dist/types/src/containers/PipelineContainer/PipelineContainer.stories.d.ts +0 -56
- package/dist/types/src/containers/PipelineContainer/PipelineContainer.stories.d.ts.map +0 -1
- package/dist/types/src/containers/PipelineContainer/index.d.ts +0 -3
- package/dist/types/src/containers/PipelineContainer/index.d.ts.map +0 -1
- package/dist/types/src/containers/PipelineObjectSettings/PipelineObjectSettings.d.ts +0 -11
- package/dist/types/src/containers/PipelineObjectSettings/PipelineObjectSettings.d.ts.map +0 -1
- package/dist/types/src/containers/PipelineObjectSettings/index.d.ts +0 -3
- package/dist/types/src/containers/PipelineObjectSettings/index.d.ts.map +0 -1
- package/dist/types/src/types/PipelineAction.d.ts +0 -25
- package/dist/types/src/types/PipelineAction.d.ts.map +0 -1
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +0 -51
- package/src/capabilities/app-graph-builder/index.ts +0 -7
- package/src/capabilities/operation-resolver/index.ts +0 -5
- package/src/capabilities/operation-resolver/operation-resolver.ts +0 -29
- package/src/capabilities/react-surface/index.ts +0 -7
- package/src/components/PipelineColumn.tsx +0 -133
- package/src/containers/PipelineContainer/index.ts +0 -7
- package/src/containers/PipelineObjectSettings/index.ts +0 -7
- package/src/types/PipelineAction.ts +0 -29
- /package/dist/lib/{browser/types → neutral}/index.mjs.map +0 -0
- /package/dist/types/src/capabilities/{app-graph-builder/app-graph-builder.d.ts → app-graph-builder.d.ts} +0 -0
- /package/dist/types/src/capabilities/{react-surface/react-surface.d.ts → react-surface.d.ts} +0 -0
|
@@ -4,33 +4,33 @@
|
|
|
4
4
|
|
|
5
5
|
import { RegistryContext } from '@effect-atom/atom-react';
|
|
6
6
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
7
|
-
import React, { useCallback, useContext, useEffect } from 'react';
|
|
7
|
+
import React, { useCallback, useContext, useEffect, useMemo } from 'react';
|
|
8
8
|
|
|
9
|
-
import { Filter, Ref } from '@dxos/
|
|
10
|
-
import {
|
|
11
|
-
import { Collection, View } from '@dxos/echo';
|
|
12
|
-
import { faker } from '@dxos/random';
|
|
9
|
+
import { Collection, Filter, JsonSchema, Obj, Query, Ref, Type, View } from '@dxos/echo';
|
|
10
|
+
import { random } from '@dxos/random';
|
|
13
11
|
import { useQuery } from '@dxos/react-client/echo';
|
|
14
12
|
import { useClientStory, withClientProvider } from '@dxos/react-client/testing';
|
|
15
|
-
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
16
13
|
import { Form, omitId } from '@dxos/react-ui-form';
|
|
17
14
|
import { withMosaic } from '@dxos/react-ui-mosaic/testing';
|
|
15
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
18
16
|
import { ViewModel } from '@dxos/schema';
|
|
19
17
|
import { createObjectFactory } from '@dxos/schema/testing';
|
|
20
18
|
import { withRegistry } from '@dxos/storybook-utils';
|
|
21
19
|
import { Person, Pipeline } from '@dxos/types';
|
|
22
20
|
|
|
23
|
-
import { usePipelineBoardModel } from '
|
|
24
|
-
import { translations } from '
|
|
21
|
+
import { usePipelineBoardModel } from '#hooks';
|
|
22
|
+
import { translations } from '#translations';
|
|
25
23
|
|
|
26
24
|
import { type ItemProps, PipelineComponent } from './PipelineComponent';
|
|
27
25
|
|
|
28
26
|
const StorybookProjectItem = ({ item, projectionModel }: ItemProps) => {
|
|
27
|
+
const personSchema = useMemo(() => omitId(Type.getSchema(Person.Person)), []);
|
|
28
|
+
|
|
29
29
|
if (Obj.instanceOf(Person.Person, item)) {
|
|
30
30
|
const contact = item as Obj.OfShape<Person.Person>;
|
|
31
31
|
|
|
32
32
|
return (
|
|
33
|
-
<Form.Root schema={
|
|
33
|
+
<Form.Root schema={personSchema} projection={projectionModel} values={contact} autoSave>
|
|
34
34
|
<Form.Viewport>
|
|
35
35
|
<Form.Content>
|
|
36
36
|
<Form.FieldSet />
|
|
@@ -62,10 +62,10 @@ const DefaultStory = () => {
|
|
|
62
62
|
fields: ['fullName'],
|
|
63
63
|
});
|
|
64
64
|
|
|
65
|
-
Obj.
|
|
66
|
-
|
|
65
|
+
Obj.update(pipeline, (pipeline) => {
|
|
66
|
+
pipeline.columns.push({
|
|
67
67
|
name: 'New Contacts',
|
|
68
|
-
view: Ref.make(view) as (typeof
|
|
68
|
+
view: Ref.make(view) as (typeof pipeline.columns)[number]['view'],
|
|
69
69
|
order: [],
|
|
70
70
|
});
|
|
71
71
|
});
|
|
@@ -106,10 +106,10 @@ const MutationsStory = () => {
|
|
|
106
106
|
fields: ['fullName'],
|
|
107
107
|
});
|
|
108
108
|
|
|
109
|
-
Obj.
|
|
110
|
-
|
|
109
|
+
Obj.update(pipeline, (pipeline) => {
|
|
110
|
+
pipeline.columns.push({
|
|
111
111
|
name: 'New Contacts',
|
|
112
|
-
view: Ref.make(view) as (typeof
|
|
112
|
+
view: Ref.make(view) as (typeof pipeline.columns)[number]['view'],
|
|
113
113
|
order: [],
|
|
114
114
|
});
|
|
115
115
|
});
|
|
@@ -123,19 +123,19 @@ const MutationsStory = () => {
|
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
const interval = setInterval(() => {
|
|
126
|
-
const factory = createObjectFactory(space.db,
|
|
126
|
+
const factory = createObjectFactory(space.db, random as any);
|
|
127
127
|
const p = Math.random();
|
|
128
128
|
|
|
129
129
|
if (p < 0.4) {
|
|
130
130
|
// Append to the name
|
|
131
|
-
const contactToAdjust =
|
|
132
|
-
Obj.
|
|
133
|
-
|
|
131
|
+
const contactToAdjust = random.helpers.arrayElement(contacts);
|
|
132
|
+
Obj.update(contactToAdjust, (contactToAdjust) => {
|
|
133
|
+
contactToAdjust.fullName = (contactToAdjust.fullName ?? '') + ' X';
|
|
134
134
|
});
|
|
135
135
|
return;
|
|
136
136
|
} else if (p < 0.7 && contacts.length > 1) {
|
|
137
137
|
// Remove a contact (30% chance, but only if we have more than 1)
|
|
138
|
-
const contactToRemove =
|
|
138
|
+
const contactToRemove = random.helpers.arrayElement(contacts);
|
|
139
139
|
space.db.remove(contactToRemove);
|
|
140
140
|
} else {
|
|
141
141
|
// Add a new contact (30% chance)
|
|
@@ -193,7 +193,7 @@ const meta = {
|
|
|
193
193
|
);
|
|
194
194
|
|
|
195
195
|
// Generate random contacts.
|
|
196
|
-
const factory = createObjectFactory(space.db,
|
|
196
|
+
const factory = createObjectFactory(space.db, random as any);
|
|
197
197
|
await factory([{ type: Person.Person, count: 12 }]);
|
|
198
198
|
},
|
|
199
199
|
}),
|
|
@@ -4,15 +4,17 @@
|
|
|
4
4
|
|
|
5
5
|
import { useAtomValue } from '@effect-atom/atom-react';
|
|
6
6
|
import { createContext } from '@radix-ui/react-context';
|
|
7
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
7
8
|
import React, { type FC, type PropsWithChildren } from 'react';
|
|
8
9
|
|
|
9
10
|
import { Obj } from '@dxos/echo';
|
|
10
11
|
import { Toolbar, type ToolbarRootProps, useTranslation } from '@dxos/react-ui';
|
|
12
|
+
import { composable, composableProps, slottable } from '@dxos/react-ui';
|
|
11
13
|
import { Board, type BoardModel, useBoard, useEventHandlerAdapter } from '@dxos/react-ui-mosaic';
|
|
12
14
|
import { type ProjectionModel } from '@dxos/schema';
|
|
13
15
|
import { type Pipeline } from '@dxos/types';
|
|
14
16
|
|
|
15
|
-
import { meta } from '
|
|
17
|
+
import { meta } from '#meta';
|
|
16
18
|
|
|
17
19
|
import { PipelineColumn } from './PipelineColumn';
|
|
18
20
|
|
|
@@ -59,10 +61,17 @@ type PipelineContentProps = PropsWithChildren<{
|
|
|
59
61
|
model: BoardModel<Pipeline.Column, Obj.Unknown>;
|
|
60
62
|
}>;
|
|
61
63
|
|
|
62
|
-
const PipelineContent =
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
const PipelineContent = slottable<HTMLDivElement, PipelineContentProps>(
|
|
65
|
+
({ asChild, model, children, ...props }, forwardedRef) => {
|
|
66
|
+
const Comp = asChild ? Slot : 'div';
|
|
67
|
+
return (
|
|
68
|
+
<Board.Root model={model}>
|
|
69
|
+
<Comp {...composableProps(props)} ref={forwardedRef}>
|
|
70
|
+
{children}
|
|
71
|
+
</Comp>
|
|
72
|
+
</Board.Root>
|
|
73
|
+
);
|
|
74
|
+
},
|
|
66
75
|
);
|
|
67
76
|
|
|
68
77
|
PipelineContent.displayName = PIPELINE_CONTENT_NAME;
|
|
@@ -77,7 +86,7 @@ type PipelineColumnsProps = {
|
|
|
77
86
|
pipeline: Pipeline.Pipeline;
|
|
78
87
|
};
|
|
79
88
|
|
|
80
|
-
const PipelineColumns = ({ pipeline }
|
|
89
|
+
const PipelineColumns = composable<HTMLDivElement, PipelineColumnsProps>(({ pipeline, ...props }) => {
|
|
81
90
|
const { model } = useBoard(PIPELINE_COLUMNS_NAME);
|
|
82
91
|
const columns = useAtomValue(model.columns);
|
|
83
92
|
const eventHandler = useEventHandlerAdapter<Pipeline.Column, Obj.Unknown>({
|
|
@@ -88,11 +97,11 @@ const PipelineColumns = ({ pipeline }: PipelineColumnsProps) => {
|
|
|
88
97
|
get: (data) => data as unknown as Obj.Unknown,
|
|
89
98
|
make: (object) => object as unknown as Pipeline.Column,
|
|
90
99
|
canDrop: ({ source }) => model.isColumn(source.data),
|
|
91
|
-
onChange: (mutate) => Obj.
|
|
100
|
+
onChange: (mutate) => Obj.update(pipeline, (pipeline) => mutate(pipeline.columns)),
|
|
92
101
|
});
|
|
93
102
|
|
|
94
|
-
return <Board.Content id='pipeline' eventHandler={eventHandler} Tile={PipelineColumn} />;
|
|
95
|
-
};
|
|
103
|
+
return <Board.Content {...props} id='pipeline' eventHandler={eventHandler} Tile={PipelineColumn} />;
|
|
104
|
+
});
|
|
96
105
|
|
|
97
106
|
PipelineColumns.displayName = PIPELINE_COLUMNS_NAME;
|
|
98
107
|
|
|
@@ -102,16 +111,16 @@ PipelineColumns.displayName = PIPELINE_COLUMNS_NAME;
|
|
|
102
111
|
|
|
103
112
|
const PIPELINE_TOOLBAR_NAME = 'Pipeline.Toolbar';
|
|
104
113
|
|
|
105
|
-
export const PipelineToolbar = (props
|
|
114
|
+
export const PipelineToolbar = composable<HTMLDivElement, ToolbarRootProps>(({ children, ...props }, forwardedRef) => {
|
|
106
115
|
const { t } = useTranslation(meta.id);
|
|
107
116
|
const { onAddColumn } = usePipeline(PIPELINE_TOOLBAR_NAME);
|
|
108
117
|
|
|
109
118
|
return (
|
|
110
|
-
<Toolbar.Root {...props}>
|
|
111
|
-
<Toolbar.IconButton icon='ph--plus--regular' iconOnly label={t('add
|
|
119
|
+
<Toolbar.Root {...composableProps(props)} ref={forwardedRef}>
|
|
120
|
+
<Toolbar.IconButton icon='ph--plus--regular' iconOnly label={t('add-column.label')} onClick={onAddColumn} />
|
|
112
121
|
</Toolbar.Root>
|
|
113
122
|
);
|
|
114
|
-
};
|
|
123
|
+
});
|
|
115
124
|
|
|
116
125
|
PipelineToolbar.displayName = PIPELINE_TOOLBAR_NAME;
|
|
117
126
|
|
package/src/components/index.ts
CHANGED
|
@@ -8,28 +8,27 @@ import * as Layer from 'effect/Layer';
|
|
|
8
8
|
import React from 'react';
|
|
9
9
|
|
|
10
10
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
11
|
-
import { Filter, Ref } from '@dxos/
|
|
12
|
-
import { Database, Feed, JsonSchema, Obj, Query, Tag } from '@dxos/echo';
|
|
13
|
-
import { Collection, View } from '@dxos/echo';
|
|
11
|
+
import { Collection, Database, Feed, Filter, JsonSchema, Obj, Query, Ref, Tag, View } from '@dxos/echo';
|
|
14
12
|
import { createFeedServiceLayer } from '@dxos/echo-db';
|
|
15
|
-
import { ClientPlugin } from '@dxos/plugin-client';
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
13
|
+
import { ClientPlugin } from '@dxos/plugin-client/plugin';
|
|
14
|
+
import { initializeIdentity } from '@dxos/plugin-client/testing';
|
|
15
|
+
import { InboxPlugin } from '@dxos/plugin-inbox/plugin';
|
|
16
|
+
import { PreviewPlugin } from '@dxos/plugin-preview/testing';
|
|
18
17
|
import { StorybookPlugin, corePlugins } from '@dxos/plugin-testing';
|
|
19
|
-
import {
|
|
18
|
+
import { random } from '@dxos/random';
|
|
20
19
|
import { useDatabase, useQuery } from '@dxos/react-client/echo';
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
20
|
+
import { translations as stackTranslations } from '@dxos/react-ui-stack/translations';
|
|
21
|
+
import { withLayout } from '@dxos/react-ui/testing';
|
|
23
22
|
import { ViewModel } from '@dxos/schema';
|
|
24
23
|
import { createObjectFactory } from '@dxos/schema/testing';
|
|
25
24
|
import { Message, Organization, Person, Pipeline, Task } from '@dxos/types';
|
|
26
25
|
|
|
27
|
-
import { translations } from '
|
|
28
|
-
import PipelineObjectSettings from '../PipelineObjectSettings';
|
|
26
|
+
import { translations } from '#translations';
|
|
29
27
|
|
|
30
|
-
import
|
|
28
|
+
import PipelineProperties from '../PipelineProperties';
|
|
29
|
+
import { PipelineArticle } from './PipelineArticle';
|
|
31
30
|
|
|
32
|
-
|
|
31
|
+
random.seed(0);
|
|
33
32
|
|
|
34
33
|
const DefaultStory = () => {
|
|
35
34
|
const db = useDatabase();
|
|
@@ -42,17 +41,16 @@ const DefaultStory = () => {
|
|
|
42
41
|
|
|
43
42
|
return (
|
|
44
43
|
<div className='grow grid grid-cols-[1fr_350px] overflow-hidden h-full w-full'>
|
|
45
|
-
<
|
|
46
|
-
<
|
|
44
|
+
<PipelineArticle role='article' subject={pipeline} attendableId='test' />
|
|
45
|
+
<PipelineProperties pipeline={pipeline} classNames='border-s border-separator' />
|
|
47
46
|
</div>
|
|
48
47
|
);
|
|
49
48
|
};
|
|
50
49
|
|
|
51
50
|
const meta = {
|
|
52
|
-
title: 'plugins/plugin-pipeline/containers/
|
|
51
|
+
title: 'plugins/plugin-pipeline/containers/PipelineArticle',
|
|
53
52
|
render: DefaultStory,
|
|
54
53
|
decorators: [
|
|
55
|
-
withTheme(),
|
|
56
54
|
withLayout({ layout: 'fullscreen' }),
|
|
57
55
|
withPluginManager({
|
|
58
56
|
plugins: [
|
|
@@ -71,14 +69,11 @@ const meta = {
|
|
|
71
69
|
Message.Message,
|
|
72
70
|
],
|
|
73
71
|
onClientInitialized: Effect.fnUntraced(function* ({ client }) {
|
|
74
|
-
yield*
|
|
75
|
-
yield* Effect.promise(() => client.spaces.waitUntilReady());
|
|
76
|
-
const space = client.spaces.default;
|
|
77
|
-
yield* Effect.promise(() => space.waitUntilReady());
|
|
72
|
+
const { personalSpace } = yield* initializeIdentity(client);
|
|
78
73
|
|
|
79
74
|
yield* Effect.gen(function* () {
|
|
80
75
|
const tag = yield* Database.add(Tag.make({ label: 'important', hue: 'green' }));
|
|
81
|
-
const
|
|
76
|
+
const tagUri = Obj.getURI(tag);
|
|
82
77
|
|
|
83
78
|
// Create a view for Contacts.
|
|
84
79
|
const personView = ViewModel.make({
|
|
@@ -88,13 +83,13 @@ const meta = {
|
|
|
88
83
|
|
|
89
84
|
// Create a view for Organizations.
|
|
90
85
|
const organizationView = ViewModel.make({
|
|
91
|
-
query: Query.select(Filter.type(Organization.Organization)).select(Filter.tag(
|
|
86
|
+
query: Query.select(Filter.type(Organization.Organization)).select(Filter.tag(tagUri)),
|
|
92
87
|
jsonSchema: JsonSchema.toJsonSchema(Organization.Organization),
|
|
93
88
|
});
|
|
94
89
|
|
|
95
90
|
// Create a view for Tasks.
|
|
96
91
|
const taskView = ViewModel.make({
|
|
97
|
-
query: Query.select(Filter.type(Task.Task)).select(Filter.tag(
|
|
92
|
+
query: Query.select(Filter.type(Task.Task)).select(Filter.tag(tagUri)),
|
|
98
93
|
jsonSchema: JsonSchema.toJsonSchema(Task.Task),
|
|
99
94
|
});
|
|
100
95
|
|
|
@@ -108,17 +103,17 @@ const meta = {
|
|
|
108
103
|
const messageFeed = yield* Database.add(Feed.make({ name: 'Messages' }));
|
|
109
104
|
const messages = Array.from({ length: 20 }).map(() =>
|
|
110
105
|
Obj.make(Message.Message, {
|
|
111
|
-
created:
|
|
106
|
+
created: random.date.recent().toISOString(),
|
|
112
107
|
sender: { role: 'user' },
|
|
113
|
-
blocks: [{ _tag: 'text' as const, text:
|
|
108
|
+
blocks: [{ _tag: 'text' as const, text: random.lorem.sentences(2) }],
|
|
114
109
|
}),
|
|
115
110
|
);
|
|
116
111
|
yield* Feed.append(messageFeed, messages);
|
|
117
112
|
|
|
118
|
-
const messageQueueDxn = Feed.
|
|
113
|
+
const messageQueueDxn = Feed.getQueueUri(messageFeed)!;
|
|
119
114
|
const messageView = ViewModel.make({
|
|
120
115
|
query: Query.select(Filter.type(Message.Message)).from({
|
|
121
|
-
|
|
116
|
+
feeds: [messageQueueDxn],
|
|
122
117
|
}),
|
|
123
118
|
jsonSchema: JsonSchema.toJsonSchema(Message.Message),
|
|
124
119
|
});
|
|
@@ -127,9 +122,9 @@ const meta = {
|
|
|
127
122
|
const taskFeed = yield* Database.add(Feed.make({ name: 'Tasks' }));
|
|
128
123
|
const feedTasks = Array.from({ length: 10 }).map(() =>
|
|
129
124
|
Obj.make(Task.Task, {
|
|
130
|
-
title:
|
|
131
|
-
status:
|
|
132
|
-
priority:
|
|
125
|
+
title: random.lorem.sentence(),
|
|
126
|
+
status: random.helpers.arrayElement(['todo', 'in-progress', 'done']) as any,
|
|
127
|
+
priority: random.helpers.arrayElement(['low', 'medium', 'high']) as any,
|
|
133
128
|
}),
|
|
134
129
|
);
|
|
135
130
|
yield* Feed.append(taskFeed, feedTasks);
|
|
@@ -171,12 +166,12 @@ const meta = {
|
|
|
171
166
|
yield* Database.add(
|
|
172
167
|
Obj.make(Organization.Organization, {
|
|
173
168
|
[Obj.Meta]: {
|
|
174
|
-
tags:
|
|
169
|
+
tags: random.datatype.boolean() ? [tagUri] : [],
|
|
175
170
|
},
|
|
176
|
-
name:
|
|
177
|
-
website:
|
|
178
|
-
description:
|
|
179
|
-
image:
|
|
171
|
+
name: random.company.name(),
|
|
172
|
+
website: random.internet.url(),
|
|
173
|
+
description: random.lorem.paragraph(),
|
|
174
|
+
image: random.image.url(),
|
|
180
175
|
}),
|
|
181
176
|
);
|
|
182
177
|
}
|
|
@@ -186,29 +181,33 @@ const meta = {
|
|
|
186
181
|
yield* Database.add(
|
|
187
182
|
Obj.make(Task.Task, {
|
|
188
183
|
[Obj.Meta]: {
|
|
189
|
-
tags:
|
|
184
|
+
tags: random.datatype.boolean() ? [tagUri] : [],
|
|
190
185
|
},
|
|
191
|
-
title:
|
|
192
|
-
status:
|
|
193
|
-
priority:
|
|
186
|
+
title: random.lorem.sentence(),
|
|
187
|
+
status: random.helpers.arrayElement(['todo', 'in-progress', 'done']) as any,
|
|
188
|
+
priority: random.helpers.arrayElement(['low', 'medium', 'high']) as any,
|
|
194
189
|
}),
|
|
195
190
|
);
|
|
196
191
|
}
|
|
197
192
|
|
|
198
193
|
// Generate sample Contacts.
|
|
199
|
-
const factory = createObjectFactory(
|
|
194
|
+
const factory = createObjectFactory(personalSpace.db, random as any);
|
|
200
195
|
yield* Effect.promise(() => factory([{ type: Person.Person, count: 12 }]));
|
|
201
196
|
|
|
202
197
|
// Generate sample Projects.
|
|
203
198
|
for (const _ of Array.from({ length: 20 })) {
|
|
204
199
|
yield* Database.add(
|
|
205
200
|
Pipeline.make({
|
|
206
|
-
name:
|
|
207
|
-
description:
|
|
201
|
+
name: random.commerce.productName(),
|
|
202
|
+
description: random.lorem.sentence(),
|
|
208
203
|
}),
|
|
209
204
|
);
|
|
210
205
|
}
|
|
211
|
-
}).pipe(
|
|
206
|
+
}).pipe(
|
|
207
|
+
Effect.provide(
|
|
208
|
+
Layer.merge(Database.layer(personalSpace.db), createFeedServiceLayer(personalSpace.queues)),
|
|
209
|
+
),
|
|
210
|
+
);
|
|
212
211
|
}),
|
|
213
212
|
}),
|
|
214
213
|
InboxPlugin(),
|
|
@@ -220,7 +219,7 @@ const meta = {
|
|
|
220
219
|
layout: 'fullscreen',
|
|
221
220
|
translations: [...translations, ...stackTranslations],
|
|
222
221
|
},
|
|
223
|
-
} satisfies Meta<typeof
|
|
222
|
+
} satisfies Meta<typeof PipelineArticle>;
|
|
224
223
|
|
|
225
224
|
export default meta;
|
|
226
225
|
|
|
@@ -5,52 +5,49 @@
|
|
|
5
5
|
import React, { useCallback, useEffect } from 'react';
|
|
6
6
|
|
|
7
7
|
import { Capabilities } from '@dxos/app-framework';
|
|
8
|
-
import { useCapability } from '@dxos/app-framework/ui';
|
|
9
|
-
import {
|
|
10
|
-
import { Surface } from '@dxos/app-framework/ui';
|
|
8
|
+
import { Surface, useCapability, useOperationInvoker } from '@dxos/app-framework/ui';
|
|
9
|
+
import { LayoutOperation } from '@dxos/app-toolkit';
|
|
11
10
|
import {
|
|
11
|
+
AppSurface,
|
|
12
12
|
OBJECT_ACTIONS_CONTRIBUTION_ID,
|
|
13
13
|
OBJECT_ACTIONS_CONTRIBUTION_PRIORITY,
|
|
14
|
-
type SurfaceComponentProps,
|
|
15
14
|
useObjectMenuItems,
|
|
16
15
|
} from '@dxos/app-toolkit/ui';
|
|
17
|
-
import { Obj } from '@dxos/echo';
|
|
18
|
-
import { ATTENDABLE_PATH_SEPARATOR, DeckOperation } from '@dxos/plugin-deck/types';
|
|
19
16
|
import { Panel } from '@dxos/react-ui';
|
|
17
|
+
import { linkedSegment } from '@dxos/react-ui-attention';
|
|
20
18
|
import { useAttention } from '@dxos/react-ui-attention';
|
|
21
19
|
import { useMenu } from '@dxos/react-ui-menu';
|
|
22
20
|
import { type Pipeline } from '@dxos/types';
|
|
23
21
|
|
|
24
|
-
import { type ItemProps, PipelineComponent } from '
|
|
25
|
-
import { usePipelineBoardModel } from '
|
|
22
|
+
import { type ItemProps, PipelineComponent } from '#components';
|
|
23
|
+
import { usePipelineBoardModel } from '#hooks';
|
|
26
24
|
|
|
27
25
|
const PIPELINE_ITEM = 'PipelineItem';
|
|
28
26
|
|
|
29
|
-
export type
|
|
27
|
+
export type PipelineArticleProps = AppSurface.ObjectArticleProps<Pipeline.Pipeline>;
|
|
30
28
|
|
|
31
|
-
export const
|
|
29
|
+
export const PipelineArticle = ({ role, subject: pipeline, attendableId }: PipelineArticleProps) => {
|
|
32
30
|
const registry = useCapability(Capabilities.AtomRegistry);
|
|
33
31
|
const model = usePipelineBoardModel(pipeline, registry);
|
|
34
32
|
const { invokePromise } = useOperationInvoker();
|
|
35
|
-
const attendableId = Obj.getDXN(pipeline).toString();
|
|
36
33
|
const { hasAttention } = useAttention(attendableId);
|
|
37
34
|
|
|
38
35
|
const handleColumnAdd = useCallback(
|
|
39
36
|
() =>
|
|
40
|
-
invokePromise(
|
|
41
|
-
|
|
37
|
+
invokePromise(LayoutOperation.UpdateCompanion, {
|
|
38
|
+
subject: linkedSegment('settings'),
|
|
42
39
|
}),
|
|
43
|
-
[invokePromise
|
|
40
|
+
[invokePromise],
|
|
44
41
|
);
|
|
45
42
|
|
|
46
43
|
return (
|
|
47
44
|
<PipelineComponent.Root Item={PipelineItem} onAddColumn={handleColumnAdd}>
|
|
48
|
-
<Panel.Root role={role}
|
|
45
|
+
<Panel.Root role={role}>
|
|
49
46
|
<Panel.Toolbar asChild>
|
|
50
47
|
<PipelineComponent.Toolbar disabled={!hasAttention} />
|
|
51
48
|
</Panel.Toolbar>
|
|
52
49
|
<Panel.Content asChild>
|
|
53
|
-
<PipelineComponent.Content model={model}>
|
|
50
|
+
<PipelineComponent.Content asChild model={model}>
|
|
54
51
|
<PipelineComponent.Columns pipeline={pipeline} />
|
|
55
52
|
</PipelineComponent.Content>
|
|
56
53
|
</Panel.Content>
|
|
@@ -76,7 +73,7 @@ const PipelineItem = ({ item, projectionModel }: ItemProps) => {
|
|
|
76
73
|
|
|
77
74
|
return (
|
|
78
75
|
<Surface.Surface
|
|
79
|
-
|
|
76
|
+
type={AppSurface.Card}
|
|
80
77
|
data={{
|
|
81
78
|
subject: item,
|
|
82
79
|
projection: projectionModel,
|