@dxos/plugin-pipeline 0.8.4-main.2244d791bb → 0.8.4-main.3fbcb4aa9b
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/neutral/PipelineContainer-7MK2SS76.mjs +69 -0
- package/dist/lib/neutral/PipelineContainer-7MK2SS76.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/{browser/PipelineSettings-R54RTVWZ.mjs → neutral/PipelineProperties-RRPQ3V6I.mjs} +45 -56
- package/dist/lib/neutral/PipelineProperties-RRPQ3V6I.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/{browser/chunk-QWNKLHBY.mjs → neutral/chunk-ULB5DKWO.mjs} +2 -9
- package/dist/lib/{browser/chunk-QWNKLHBY.mjs.map → neutral/chunk-ULB5DKWO.mjs.map} +3 -3
- package/dist/lib/neutral/components/index.mjs +206 -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-ZJYFACOI.mjs +25 -0
- package/dist/lib/neutral/create-object-ZJYFACOI.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/neutral/react-surface-TW6TRMO6.mjs +49 -0
- package/dist/lib/neutral/react-surface-TW6TRMO6.mjs.map +7 -0
- package/dist/lib/neutral/translations.mjs +38 -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/capabilities/app-graph-builder.d.ts +6 -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 +5 -0
- 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 +1 -4
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/PipelineContainer/PipelineContainer.d.ts +6 -0
- package/dist/types/src/containers/PipelineContainer/PipelineContainer.d.ts.map +1 -0
- package/dist/types/src/containers/PipelineContainer/PipelineContainer.stories.d.ts +76 -0
- package/dist/types/src/containers/PipelineContainer/PipelineContainer.stories.d.ts.map +1 -0
- package/dist/types/src/containers/PipelineContainer/index.d.ts +2 -0
- package/dist/types/src/containers/PipelineContainer/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 +4 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +2 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -0
- package/dist/types/src/hooks/usePipelineBoardModel.d.ts +6 -0
- package/dist/types/src/hooks/usePipelineBoardModel.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +0 -1
- package/dist/types/src/index.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 +100 -54
- package/src/PipelinePlugin.node.ts +19 -0
- package/src/PipelinePlugin.test.ts +27 -0
- package/src/PipelinePlugin.tsx +7 -31
- package/src/capabilities/app-graph-builder.ts +40 -0
- package/src/capabilities/create-object.ts +29 -0
- package/src/capabilities/index.ts +5 -3
- package/src/capabilities/react-surface.tsx +53 -0
- package/src/components/{PipelineColumn.tsx → PipelineComponent/PipelineColumn.tsx} +67 -48
- package/src/components/{PipelineComponent.stories.tsx → PipelineComponent/PipelineComponent.stories.tsx} +40 -32
- package/src/components/PipelineComponent/PipelineComponent.tsx +140 -0
- package/src/components/PipelineComponent/index.ts +6 -0
- package/src/components/index.ts +1 -7
- package/src/containers/PipelineContainer/PipelineContainer.stories.tsx +230 -0
- package/src/containers/PipelineContainer/PipelineContainer.tsx +84 -0
- package/src/containers/PipelineContainer/index.ts +5 -0
- package/src/{components/PipelineSettings.tsx → containers/PipelineProperties/PipelineProperties.tsx} +50 -43
- package/src/containers/PipelineProperties/index.ts +5 -0
- package/src/containers/index.ts +8 -0
- package/src/hooks/index.ts +5 -0
- package/src/hooks/usePipelineBoardModel.ts +79 -0
- package/src/index.ts +0 -1
- package/src/meta.ts +1 -1
- package/src/plugin.ts +9 -0
- package/src/templates/research.ts +16 -17
- package/src/translations.ts +22 -21
- package/src/types/index.ts +0 -3
- package/dist/lib/browser/PipelineContainer-2BRZPECS.mjs +0 -289
- package/dist/lib/browser/PipelineContainer-2BRZPECS.mjs.map +0 -7
- package/dist/lib/browser/PipelineSettings-R54RTVWZ.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-7GVESVYR.mjs +0 -42
- package/dist/lib/browser/chunk-7GVESVYR.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-CMTEEE6F.mjs +0 -57
- package/dist/lib/browser/react-surface-CMTEEE6F.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 +0 -6
- 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 +0 -5
- 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 -44
- 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/components/PipelineContainer.d.ts +0 -7
- package/dist/types/src/components/PipelineContainer.d.ts.map +0 -1
- package/dist/types/src/components/PipelineContainer.stories.d.ts +0 -56
- package/dist/types/src/components/PipelineContainer.stories.d.ts.map +0 -1
- package/dist/types/src/components/PipelineSettings.d.ts +0 -12
- package/dist/types/src/components/PipelineSettings.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/capabilities/react-surface/react-surface.tsx +0 -50
- package/src/components/PipelineComponent.tsx +0 -186
- package/src/components/PipelineContainer.stories.tsx +0 -226
- package/src/components/PipelineContainer.tsx +0 -61
- package/src/types/PipelineAction.ts +0 -29
- /package/dist/lib/{browser/types → neutral}/index.mjs.map +0 -0
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import * as Effect from 'effect/Effect';
|
|
6
|
-
import React from 'react';
|
|
7
|
-
|
|
8
|
-
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
9
|
-
import { Surface } from '@dxos/app-framework/ui';
|
|
10
|
-
import { InvocationTraceContainer } from '@dxos/devtools';
|
|
11
|
-
import { Obj } from '@dxos/echo';
|
|
12
|
-
import { Layout } from '@dxos/react-ui';
|
|
13
|
-
import { Pipeline } from '@dxos/types';
|
|
14
|
-
|
|
15
|
-
import { PipelineContainer, PipelineObjectSettings } from '../../components';
|
|
16
|
-
import { meta } from '../../meta';
|
|
17
|
-
|
|
18
|
-
export default Capability.makeModule(() =>
|
|
19
|
-
Effect.succeed(
|
|
20
|
-
Capability.contributes(Capabilities.ReactSurface, [
|
|
21
|
-
Surface.create({
|
|
22
|
-
id: meta.id,
|
|
23
|
-
role: 'article',
|
|
24
|
-
filter: (data): data is { subject: Pipeline.Pipeline } => Obj.instanceOf(Pipeline.Pipeline, data.subject),
|
|
25
|
-
component: ({ data, role }) => <PipelineContainer role={role} subject={data.subject} />,
|
|
26
|
-
}),
|
|
27
|
-
Surface.create({
|
|
28
|
-
id: `${meta.id}/companion/invocations`,
|
|
29
|
-
role: 'article',
|
|
30
|
-
filter: (data): data is { companionTo: Pipeline.Pipeline } =>
|
|
31
|
-
Obj.instanceOf(Pipeline.Pipeline, data.companionTo) && data.subject === 'invocations',
|
|
32
|
-
component: ({ data, role }) => {
|
|
33
|
-
const db = Obj.getDatabase(data.companionTo);
|
|
34
|
-
// TODO(wittjosiah): Filter the invocations to those relevant to the project.
|
|
35
|
-
return (
|
|
36
|
-
<Layout.Main role={role}>
|
|
37
|
-
<InvocationTraceContainer db={db} detailAxis='block' />
|
|
38
|
-
</Layout.Main>
|
|
39
|
-
);
|
|
40
|
-
},
|
|
41
|
-
}),
|
|
42
|
-
Surface.create({
|
|
43
|
-
id: `${meta.id}/object-settings`,
|
|
44
|
-
role: 'object-settings',
|
|
45
|
-
filter: (data): data is { subject: Pipeline.Pipeline } => Obj.instanceOf(Pipeline.Pipeline, data.subject),
|
|
46
|
-
component: ({ data }) => <PipelineObjectSettings pipeline={data.subject} />,
|
|
47
|
-
}),
|
|
48
|
-
]),
|
|
49
|
-
),
|
|
50
|
-
);
|
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { Atom, type Registry, useAtomValue } from '@effect-atom/atom-react';
|
|
6
|
-
import { createContext } from '@radix-ui/react-context';
|
|
7
|
-
import * as Schema from 'effect/Schema';
|
|
8
|
-
import React, { type FC, type PropsWithChildren, useMemo } from 'react';
|
|
9
|
-
|
|
10
|
-
import { Obj, Query } from '@dxos/echo';
|
|
11
|
-
import { AtomObj, AtomQuery } from '@dxos/echo-atom';
|
|
12
|
-
import { getQueryTarget } from '@dxos/plugin-space';
|
|
13
|
-
import { getSpace, isSpace } from '@dxos/react-client/echo';
|
|
14
|
-
import { Toolbar, type ToolbarRootProps, useTranslation } from '@dxos/react-ui';
|
|
15
|
-
import { Board, type BoardModel, useBoard, useEventHandlerAdapter } from '@dxos/react-ui-mosaic';
|
|
16
|
-
import { type ProjectionModel } from '@dxos/schema';
|
|
17
|
-
import { Pipeline, type Pipeline as PipelineType } from '@dxos/types';
|
|
18
|
-
|
|
19
|
-
import { meta } from '../meta';
|
|
20
|
-
|
|
21
|
-
import { PipelineColumn } from './PipelineColumn';
|
|
22
|
-
|
|
23
|
-
type ItemProps = {
|
|
24
|
-
item: Obj.Unknown;
|
|
25
|
-
projectionModel?: ProjectionModel;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
const itemNoOp = ({ item }: ItemProps) => <span>{item.id}</span>;
|
|
29
|
-
|
|
30
|
-
type PipelineContextValue = {
|
|
31
|
-
Item: FC<ItemProps>;
|
|
32
|
-
// TODO(wittjosiah): Support adding items.
|
|
33
|
-
// If the created item doesn't match the current query, it will not be visible.
|
|
34
|
-
// onAddItem?: (schema: Schema.Schema.AnyNoContext) => void;
|
|
35
|
-
onAddColumn?: () => void;
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
//
|
|
39
|
-
// Root
|
|
40
|
-
//
|
|
41
|
-
|
|
42
|
-
type PipelineRootProps = PropsWithChildren<
|
|
43
|
-
PipelineContextValue & {
|
|
44
|
-
model: BoardModel<PipelineType.Column, Obj.Unknown>;
|
|
45
|
-
}
|
|
46
|
-
>;
|
|
47
|
-
|
|
48
|
-
const PIPELINE_ROOT = 'Pipeline.Root';
|
|
49
|
-
|
|
50
|
-
const [PipelineRootContext, usePipeline] = createContext<PipelineContextValue>(PIPELINE_ROOT, {
|
|
51
|
-
Item: itemNoOp,
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
const PipelineRoot = ({ model, children, ...contextValue }: PipelineRootProps) => (
|
|
55
|
-
<PipelineRootContext {...contextValue}>
|
|
56
|
-
<Board.Root model={model}>{children}</Board.Root>
|
|
57
|
-
</PipelineRootContext>
|
|
58
|
-
);
|
|
59
|
-
|
|
60
|
-
PipelineRoot.displayName = PIPELINE_ROOT;
|
|
61
|
-
|
|
62
|
-
//
|
|
63
|
-
// usePipelineBoardModel
|
|
64
|
-
//
|
|
65
|
-
|
|
66
|
-
const emptyColumnsAtom = Atom.make(() => [] as PipelineType.Column[]);
|
|
67
|
-
const emptyItemsAtom = Atom.make(() => [] as Obj.Unknown[]);
|
|
68
|
-
const emptyPipelineModel: BoardModel<PipelineType.Column, Obj.Unknown> = {
|
|
69
|
-
getColumnId: (data) => (data as PipelineType.Column).view.dxn.toString(),
|
|
70
|
-
getItemId: (data) => (data as Obj.Unknown).id,
|
|
71
|
-
isColumn: (obj: unknown): obj is PipelineType.Column => Schema.is(Pipeline.Column)(obj),
|
|
72
|
-
isItem: (obj): obj is Obj.Unknown => Obj.isObject(obj),
|
|
73
|
-
columns: emptyColumnsAtom,
|
|
74
|
-
items: () => emptyItemsAtom,
|
|
75
|
-
getColumns: () => [],
|
|
76
|
-
getItems: () => [],
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
const usePipelineBoardModel = (
|
|
80
|
-
pipeline: PipelineType.Pipeline | undefined,
|
|
81
|
-
registry: Registry.Registry,
|
|
82
|
-
): BoardModel<PipelineType.Column, Obj.Unknown> =>
|
|
83
|
-
useMemo<BoardModel<PipelineType.Column, Obj.Unknown>>(() => {
|
|
84
|
-
if (pipeline == null) {
|
|
85
|
-
return emptyPipelineModel;
|
|
86
|
-
}
|
|
87
|
-
const space = getSpace(pipeline);
|
|
88
|
-
const columnsAtom = AtomObj.makeProperty(pipeline, 'columns');
|
|
89
|
-
const columnAtomFamily = Atom.family<string, Atom.Atom<PipelineType.Column | undefined>>((viewKey: string) =>
|
|
90
|
-
Atom.make((get) => {
|
|
91
|
-
const columns = get(columnsAtom);
|
|
92
|
-
return columns.find((c) => c.view.dxn.toString() === viewKey);
|
|
93
|
-
}),
|
|
94
|
-
);
|
|
95
|
-
const itemsAtomFamily = Atom.family<string, Atom.Atom<Obj.Unknown[]>>((viewKey: string) =>
|
|
96
|
-
Atom.make((get) => {
|
|
97
|
-
const column = get(columnAtomFamily(viewKey));
|
|
98
|
-
if (column == null) {
|
|
99
|
-
return [];
|
|
100
|
-
}
|
|
101
|
-
const viewSnapshot = get(AtomObj.make(column.view));
|
|
102
|
-
if (!viewSnapshot?.query?.ast) {
|
|
103
|
-
return [];
|
|
104
|
-
}
|
|
105
|
-
const query = Query.fromAst(JSON.parse(JSON.stringify(viewSnapshot.query.ast)));
|
|
106
|
-
const queryTarget = space ? getQueryTarget(query.ast, space) : undefined;
|
|
107
|
-
if (!queryTarget) {
|
|
108
|
-
return [];
|
|
109
|
-
}
|
|
110
|
-
const raw = get(AtomQuery.make(queryTarget, query));
|
|
111
|
-
return isSpace(queryTarget) ? raw : [...raw].reverse();
|
|
112
|
-
}),
|
|
113
|
-
);
|
|
114
|
-
return {
|
|
115
|
-
getColumnId: (data) => (data as PipelineType.Column).view.dxn.toString(),
|
|
116
|
-
getItemId: (data) => (data as Obj.Unknown).id,
|
|
117
|
-
isColumn: (obj: unknown): obj is PipelineType.Column => Schema.is(Pipeline.Column)(obj),
|
|
118
|
-
isItem: (obj: unknown): obj is Obj.Unknown => Obj.isObject(obj),
|
|
119
|
-
columns: columnsAtom,
|
|
120
|
-
items: (column) => itemsAtomFamily(column.view.dxn.toString()),
|
|
121
|
-
getColumns: () => [...registry.get(columnsAtom)],
|
|
122
|
-
getItems: (column) => registry.get(itemsAtomFamily(column.view.dxn.toString())) ?? [],
|
|
123
|
-
};
|
|
124
|
-
}, [pipeline, registry]);
|
|
125
|
-
|
|
126
|
-
//
|
|
127
|
-
// Content
|
|
128
|
-
//
|
|
129
|
-
|
|
130
|
-
const PIPELINE_CONTENT_NAME = 'Pipeline.Content';
|
|
131
|
-
|
|
132
|
-
type PipelineContentProps = {
|
|
133
|
-
pipeline: PipelineType.Pipeline;
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
const PipelineContent = ({ pipeline }: PipelineContentProps) => {
|
|
137
|
-
const { model } = useBoard(PIPELINE_CONTENT_NAME);
|
|
138
|
-
const columns = useAtomValue(model.columns);
|
|
139
|
-
const eventHandler = useEventHandlerAdapter<PipelineType.Column, Obj.Unknown>({
|
|
140
|
-
id: pipeline.id,
|
|
141
|
-
// TODO(wittjosiah): Cast because columns array is readonly.
|
|
142
|
-
items: columns as any,
|
|
143
|
-
getId: model.getColumnId,
|
|
144
|
-
get: (data) => data as unknown as Obj.Unknown,
|
|
145
|
-
make: (object) => object as unknown as PipelineType.Column,
|
|
146
|
-
canDrop: ({ source }) => model.isColumn(source.data),
|
|
147
|
-
onChange: (mutate) => Obj.change(pipeline, (p) => mutate(p.columns)),
|
|
148
|
-
});
|
|
149
|
-
|
|
150
|
-
return <Board.Content id='pipeline' eventHandler={eventHandler} Tile={PipelineColumn} />;
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
PipelineContent.displayName = PIPELINE_CONTENT_NAME;
|
|
154
|
-
|
|
155
|
-
//
|
|
156
|
-
// Toolbar
|
|
157
|
-
//
|
|
158
|
-
|
|
159
|
-
const PIPELINE_TOOLBAR_NAME = 'Pipeline.Toolbar';
|
|
160
|
-
|
|
161
|
-
export const PipelineToolbar = (props: ToolbarRootProps) => {
|
|
162
|
-
const { t } = useTranslation(meta.id);
|
|
163
|
-
const { onAddColumn } = usePipeline(PIPELINE_TOOLBAR_NAME);
|
|
164
|
-
|
|
165
|
-
return (
|
|
166
|
-
<Toolbar.Root {...props}>
|
|
167
|
-
<Toolbar.IconButton icon='ph--plus--regular' iconOnly label={t('add column label')} onClick={onAddColumn} />
|
|
168
|
-
</Toolbar.Root>
|
|
169
|
-
);
|
|
170
|
-
};
|
|
171
|
-
|
|
172
|
-
PipelineToolbar.displayName = PIPELINE_TOOLBAR_NAME;
|
|
173
|
-
|
|
174
|
-
//
|
|
175
|
-
// Project
|
|
176
|
-
//
|
|
177
|
-
|
|
178
|
-
export const PipelineComponent = {
|
|
179
|
-
Root: PipelineRoot,
|
|
180
|
-
Content: PipelineContent,
|
|
181
|
-
Toolbar: PipelineToolbar,
|
|
182
|
-
};
|
|
183
|
-
|
|
184
|
-
export { usePipeline, usePipelineBoardModel };
|
|
185
|
-
|
|
186
|
-
export type { ItemProps, PipelineContextValue, PipelineRootProps };
|
|
@@ -1,226 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2024 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
-
import * as Effect from 'effect/Effect';
|
|
7
|
-
import React from 'react';
|
|
8
|
-
|
|
9
|
-
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
10
|
-
import { Filter, Ref } from '@dxos/client/echo';
|
|
11
|
-
import { Obj, Query, Tag, Type } from '@dxos/echo';
|
|
12
|
-
import { ClientPlugin } from '@dxos/plugin-client';
|
|
13
|
-
import { InboxPlugin } from '@dxos/plugin-inbox';
|
|
14
|
-
import { PreviewPlugin } from '@dxos/plugin-preview';
|
|
15
|
-
import { StorybookPlugin, corePlugins } from '@dxos/plugin-testing';
|
|
16
|
-
import { faker } from '@dxos/random';
|
|
17
|
-
import { useDatabase, useQuery } from '@dxos/react-client/echo';
|
|
18
|
-
import { withTheme } from '@dxos/react-ui/testing';
|
|
19
|
-
import { translations as stackTranslations } from '@dxos/react-ui-stack';
|
|
20
|
-
import { Stack } from '@dxos/react-ui-stack';
|
|
21
|
-
import { Collection, View } from '@dxos/schema';
|
|
22
|
-
import { createObjectFactory } from '@dxos/schema/testing';
|
|
23
|
-
import { Message, Organization, Person, Pipeline, Task } from '@dxos/types';
|
|
24
|
-
|
|
25
|
-
import { translations } from '../translations';
|
|
26
|
-
|
|
27
|
-
import { PipelineContainer } from './PipelineContainer';
|
|
28
|
-
import { PipelineObjectSettings } from './PipelineSettings';
|
|
29
|
-
|
|
30
|
-
faker.seed(0);
|
|
31
|
-
|
|
32
|
-
const DefaultStory = () => {
|
|
33
|
-
const db = useDatabase();
|
|
34
|
-
const pipelines = useQuery(db, Filter.type(Pipeline.Pipeline));
|
|
35
|
-
const pipeline = pipelines[0];
|
|
36
|
-
|
|
37
|
-
if (!pipeline) {
|
|
38
|
-
return <p>Loading…</p>;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return (
|
|
42
|
-
<Stack orientation='horizontal' size='split' rail={false} classNames='pli-0 bs-full'>
|
|
43
|
-
<PipelineContainer role='article' subject={pipeline} />
|
|
44
|
-
<PipelineObjectSettings pipeline={pipeline} classNames='border-is border-separator' />
|
|
45
|
-
</Stack>
|
|
46
|
-
);
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
const meta = {
|
|
50
|
-
title: 'plugins/plugin-pipeline/PipelineContainer',
|
|
51
|
-
render: DefaultStory,
|
|
52
|
-
decorators: [
|
|
53
|
-
withTheme(),
|
|
54
|
-
withPluginManager({
|
|
55
|
-
plugins: [
|
|
56
|
-
...corePlugins(),
|
|
57
|
-
StorybookPlugin({}),
|
|
58
|
-
ClientPlugin({
|
|
59
|
-
types: [
|
|
60
|
-
Tag.Tag,
|
|
61
|
-
Pipeline.Pipeline,
|
|
62
|
-
View.View,
|
|
63
|
-
Collection.Collection,
|
|
64
|
-
Organization.Organization,
|
|
65
|
-
Task.Task,
|
|
66
|
-
Person.Person,
|
|
67
|
-
Message.Message,
|
|
68
|
-
],
|
|
69
|
-
onClientInitialized: ({ client }) =>
|
|
70
|
-
Effect.gen(function* () {
|
|
71
|
-
yield* Effect.promise(() => client.halo.createIdentity());
|
|
72
|
-
yield* Effect.promise(() => client.spaces.waitUntilReady());
|
|
73
|
-
const space = client.spaces.default;
|
|
74
|
-
yield* Effect.promise(() => space.waitUntilReady());
|
|
75
|
-
|
|
76
|
-
const tag = space.db.add(Tag.make({ label: 'important', hue: 'green' }));
|
|
77
|
-
const tagDxn = Obj.getDXN(tag).toString();
|
|
78
|
-
|
|
79
|
-
// Create a view for Contacts.
|
|
80
|
-
const personView = View.make({
|
|
81
|
-
query: Query.select(Filter.type(Person.Person)),
|
|
82
|
-
jsonSchema: Type.toJsonSchema(Person.Person),
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
// Create a view for Organizations.
|
|
86
|
-
const organizationView = View.make({
|
|
87
|
-
query: Query.select(Filter.type(Organization.Organization)).select(Filter.tag(tagDxn)),
|
|
88
|
-
jsonSchema: Type.toJsonSchema(Organization.Organization),
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
// Create a view for Tasks.
|
|
92
|
-
const taskView = View.make({
|
|
93
|
-
query: Query.select(Filter.type(Task.Task)).select(Filter.tag(tagDxn)),
|
|
94
|
-
jsonSchema: Type.toJsonSchema(Task.Task),
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
// Create a view for Project-Projects.
|
|
98
|
-
const projectView = View.make({
|
|
99
|
-
query: Query.select(Filter.type(Pipeline.Pipeline)),
|
|
100
|
-
jsonSchema: Type.toJsonSchema(Pipeline.Pipeline),
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
// Create a view for Messages.
|
|
104
|
-
const messageQueue = space.queues.create();
|
|
105
|
-
const messageView = View.make({
|
|
106
|
-
query: Query.select(Filter.type(Message.Message)).options({
|
|
107
|
-
queues: [messageQueue.dxn.toString()],
|
|
108
|
-
}),
|
|
109
|
-
jsonSchema: Type.toJsonSchema(Message.Message),
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
// Create pipline with columns.
|
|
113
|
-
const pipeline = Pipeline.make({
|
|
114
|
-
columns: [
|
|
115
|
-
{
|
|
116
|
-
name: 'Contacts',
|
|
117
|
-
view: Ref.make(personView),
|
|
118
|
-
order: [],
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
name: 'Organizations',
|
|
122
|
-
view: Ref.make(organizationView),
|
|
123
|
-
order: [],
|
|
124
|
-
},
|
|
125
|
-
{
|
|
126
|
-
name: 'Tasks',
|
|
127
|
-
view: Ref.make(taskView),
|
|
128
|
-
order: [],
|
|
129
|
-
},
|
|
130
|
-
{
|
|
131
|
-
name: 'Projects',
|
|
132
|
-
view: Ref.make(projectView),
|
|
133
|
-
order: [],
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
name: 'Messages',
|
|
137
|
-
view: Ref.make(messageView),
|
|
138
|
-
order: [],
|
|
139
|
-
},
|
|
140
|
-
],
|
|
141
|
-
});
|
|
142
|
-
|
|
143
|
-
// Add pipeline to space.
|
|
144
|
-
space.db.add(pipeline);
|
|
145
|
-
|
|
146
|
-
// Generate sample Organizations
|
|
147
|
-
Array.from({ length: 20 }).forEach(() => {
|
|
148
|
-
const org = Obj.make(
|
|
149
|
-
Organization.Organization,
|
|
150
|
-
{
|
|
151
|
-
name: faker.company.name(),
|
|
152
|
-
website: faker.internet.url(),
|
|
153
|
-
description: faker.lorem.paragraph(),
|
|
154
|
-
image: faker.image.url(),
|
|
155
|
-
},
|
|
156
|
-
{
|
|
157
|
-
tags: faker.datatype.boolean() ? [Obj.getDXN(tag).toString()] : [],
|
|
158
|
-
},
|
|
159
|
-
);
|
|
160
|
-
space.db.add(org);
|
|
161
|
-
});
|
|
162
|
-
|
|
163
|
-
// Generate sample Tasks
|
|
164
|
-
Array.from({ length: 20 }).forEach(() => {
|
|
165
|
-
const task = Obj.make(
|
|
166
|
-
Task.Task,
|
|
167
|
-
{
|
|
168
|
-
title: faker.lorem.sentence(),
|
|
169
|
-
status: faker.helpers.arrayElement(['todo', 'in-progress', 'done']) as any,
|
|
170
|
-
priority: faker.helpers.arrayElement(['low', 'medium', 'high']) as any,
|
|
171
|
-
},
|
|
172
|
-
{
|
|
173
|
-
tags: faker.datatype.boolean() ? [Obj.getDXN(tag).toString()] : [],
|
|
174
|
-
},
|
|
175
|
-
);
|
|
176
|
-
space.db.add(task);
|
|
177
|
-
});
|
|
178
|
-
|
|
179
|
-
// Generate sample Contacts
|
|
180
|
-
const factory = createObjectFactory(space.db, faker as any);
|
|
181
|
-
yield* Effect.promise(() => factory([{ type: Person.Person, count: 12 }]));
|
|
182
|
-
|
|
183
|
-
// Generate sample Projects
|
|
184
|
-
Array.from({ length: 20 }).forEach(() => {
|
|
185
|
-
const nestedProject = Pipeline.make({
|
|
186
|
-
name: faker.commerce.productName(),
|
|
187
|
-
description: faker.lorem.sentence(),
|
|
188
|
-
});
|
|
189
|
-
space.db.add(nestedProject);
|
|
190
|
-
});
|
|
191
|
-
|
|
192
|
-
// Generate sample Messages
|
|
193
|
-
const messages = Array.from({ length: 20 }).map(() => {
|
|
194
|
-
const message = Obj.make(Message.Message, {
|
|
195
|
-
created: faker.date.recent().toISOString(),
|
|
196
|
-
sender: { role: 'user' },
|
|
197
|
-
blocks: [
|
|
198
|
-
{
|
|
199
|
-
_tag: 'text' as const,
|
|
200
|
-
text: faker.lorem.sentences(2),
|
|
201
|
-
},
|
|
202
|
-
],
|
|
203
|
-
});
|
|
204
|
-
return message;
|
|
205
|
-
});
|
|
206
|
-
|
|
207
|
-
yield* Effect.promise(() => messageQueue.append(messages));
|
|
208
|
-
}),
|
|
209
|
-
}),
|
|
210
|
-
|
|
211
|
-
InboxPlugin(),
|
|
212
|
-
PreviewPlugin(),
|
|
213
|
-
],
|
|
214
|
-
}),
|
|
215
|
-
],
|
|
216
|
-
parameters: {
|
|
217
|
-
layout: 'fullscreen',
|
|
218
|
-
translations: [...translations, ...stackTranslations],
|
|
219
|
-
},
|
|
220
|
-
} satisfies Meta<typeof PipelineContainer>;
|
|
221
|
-
|
|
222
|
-
export default meta;
|
|
223
|
-
|
|
224
|
-
type Story = StoryObj<typeof meta>;
|
|
225
|
-
|
|
226
|
-
export const Default: Story = {};
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, { useCallback } from 'react';
|
|
6
|
-
|
|
7
|
-
import { Capabilities } from '@dxos/app-framework';
|
|
8
|
-
import { useCapability } from '@dxos/app-framework/ui';
|
|
9
|
-
import { useOperationInvoker } from '@dxos/app-framework/ui';
|
|
10
|
-
import { Surface } from '@dxos/app-framework/ui';
|
|
11
|
-
import { type SurfaceComponentProps } from '@dxos/app-toolkit/ui';
|
|
12
|
-
import { Obj } from '@dxos/echo';
|
|
13
|
-
import { ATTENDABLE_PATH_SEPARATOR, DeckOperation } from '@dxos/plugin-deck/types';
|
|
14
|
-
import { Layout } from '@dxos/react-ui';
|
|
15
|
-
import { useAttention } from '@dxos/react-ui-attention';
|
|
16
|
-
import { type Pipeline as PipelineType } from '@dxos/types';
|
|
17
|
-
|
|
18
|
-
import { type ItemProps, PipelineComponent, usePipelineBoardModel } from './PipelineComponent';
|
|
19
|
-
|
|
20
|
-
export type PipelineContainerProps = SurfaceComponentProps<PipelineType.Pipeline>;
|
|
21
|
-
|
|
22
|
-
export const PipelineContainer = ({ role, subject: pipeline }: PipelineContainerProps) => {
|
|
23
|
-
const registry = useCapability(Capabilities.AtomRegistry);
|
|
24
|
-
const model = usePipelineBoardModel(pipeline, registry);
|
|
25
|
-
const { invokePromise } = useOperationInvoker();
|
|
26
|
-
const attendableId = Obj.getDXN(pipeline).toString();
|
|
27
|
-
const { hasAttention } = useAttention(attendableId);
|
|
28
|
-
|
|
29
|
-
const handleColumnAdd = useCallback(
|
|
30
|
-
() =>
|
|
31
|
-
invokePromise(DeckOperation.ChangeCompanion, {
|
|
32
|
-
primary: attendableId,
|
|
33
|
-
companion: `${attendableId}${ATTENDABLE_PATH_SEPARATOR}settings`,
|
|
34
|
-
}),
|
|
35
|
-
[invokePromise, attendableId],
|
|
36
|
-
);
|
|
37
|
-
|
|
38
|
-
return (
|
|
39
|
-
<Layout.Main role={role} toolbar>
|
|
40
|
-
<PipelineComponent.Root Item={PipelineItem} model={model} onAddColumn={handleColumnAdd}>
|
|
41
|
-
<PipelineComponent.Toolbar disabled={!hasAttention} />
|
|
42
|
-
<PipelineComponent.Content pipeline={pipeline} />
|
|
43
|
-
</PipelineComponent.Root>
|
|
44
|
-
</Layout.Main>
|
|
45
|
-
);
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
const PipelineItem = ({ item, projectionModel }: ItemProps) => {
|
|
49
|
-
return (
|
|
50
|
-
<Surface.Surface
|
|
51
|
-
role='card--content'
|
|
52
|
-
data={{
|
|
53
|
-
subject: item,
|
|
54
|
-
projection: projectionModel,
|
|
55
|
-
}}
|
|
56
|
-
limit={1}
|
|
57
|
-
/>
|
|
58
|
-
);
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
export default PipelineContainer;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import * as Schema from 'effect/Schema';
|
|
6
|
-
|
|
7
|
-
import { Capability } from '@dxos/app-framework';
|
|
8
|
-
import { Operation } from '@dxos/operation';
|
|
9
|
-
import { SpaceSchema } from '@dxos/react-client/echo';
|
|
10
|
-
import { Collection } from '@dxos/schema';
|
|
11
|
-
|
|
12
|
-
import { meta } from '../meta';
|
|
13
|
-
|
|
14
|
-
const PIPELINE_OPERATION = `${meta.id}/operation`;
|
|
15
|
-
|
|
16
|
-
export namespace PipelineOperation {
|
|
17
|
-
export const OnCreateSpace = Operation.make({
|
|
18
|
-
meta: { key: `${PIPELINE_OPERATION}/on-create-space`, name: 'On Create Space' },
|
|
19
|
-
services: [Capability.Service],
|
|
20
|
-
schema: {
|
|
21
|
-
input: Schema.Struct({
|
|
22
|
-
space: SpaceSchema,
|
|
23
|
-
rootCollection: Collection.Collection,
|
|
24
|
-
isDefault: Schema.optional(Schema.Boolean),
|
|
25
|
-
}),
|
|
26
|
-
output: Schema.Void,
|
|
27
|
-
},
|
|
28
|
-
});
|
|
29
|
-
}
|
|
File without changes
|