@dxos/plugin-pipeline 0.8.3-main.ef1bc66f44 → 0.8.4-main.03d5cd7b56
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-EBR3UU5C.mjs → neutral/PipelineProperties-RRPQ3V6I.mjs} +76 -78
- 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/neutral/chunk-ULB5DKWO.mjs +21 -0
- package/dist/lib/neutral/chunk-ULB5DKWO.mjs.map +7 -0
- 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/PipelineComponent/PipelineColumn.d.ts +9 -0
- 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 -53
- 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/PipelineComponent/PipelineColumn.tsx +164 -0
- package/src/components/{PipelineComponent.stories.tsx → PipelineComponent/PipelineComponent.stories.tsx} +45 -30
- 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} +78 -66
- 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-TRO66W6L.mjs +0 -216
- package/dist/lib/browser/PipelineContainer-TRO66W6L.mjs.map +0 -7
- package/dist/lib/browser/PipelineSettings-EBR3UU5C.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-NKUZQ6A7.mjs +0 -64
- package/dist/lib/browser/app-graph-builder-NKUZQ6A7.mjs.map +0 -7
- package/dist/lib/browser/chunk-J5YNPKHT.mjs +0 -28
- package/dist/lib/browser/chunk-J5YNPKHT.mjs.map +0 -7
- package/dist/lib/browser/chunk-XDHJKK7D.mjs +0 -42
- package/dist/lib/browser/chunk-XDHJKK7D.mjs.map +0 -7
- package/dist/lib/browser/index.mjs +0 -108
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/react-surface-CH2SUJTQ.mjs +0 -56
- package/dist/lib/browser/react-surface-CH2SUJTQ.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 +0 -10
- package/dist/types/src/components/PipelineColumn.d.ts.map +0 -1
- package/dist/types/src/components/PipelineComponent.d.ts +0 -38
- 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/PipelineColumn.tsx +0 -145
- package/src/components/PipelineComponent.tsx +0 -103
- package/src/components/PipelineContainer.stories.tsx +0 -226
- package/src/components/PipelineContainer.tsx +0 -57
- package/src/types/PipelineAction.ts +0 -29
- /package/dist/lib/{browser/types → neutral}/index.mjs.map +0 -0
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { useComposedRefs } from '@radix-ui/react-compose-refs';
|
|
6
|
-
import type * as Schema from 'effect/Schema';
|
|
7
|
-
import React, { forwardRef, useMemo, useRef, useState } from 'react';
|
|
8
|
-
|
|
9
|
-
import { Obj, Query, Type } from '@dxos/echo';
|
|
10
|
-
import { getQueryTarget, resolveSchemaWithRegistry } from '@dxos/plugin-space';
|
|
11
|
-
import { Filter, getSpace, isSpace, useObject, useQuery } from '@dxos/react-client/echo';
|
|
12
|
-
import { ScrollArea, useAsyncEffect, useTranslation } from '@dxos/react-ui';
|
|
13
|
-
import { Card, Focus, Mosaic, type MosaicTileProps } from '@dxos/react-ui-mosaic';
|
|
14
|
-
import { ProjectionModel, createEchoChangeCallback } from '@dxos/schema';
|
|
15
|
-
import { type Pipeline } from '@dxos/types';
|
|
16
|
-
|
|
17
|
-
import { meta } from '../meta';
|
|
18
|
-
|
|
19
|
-
import { type ItemProps, usePipeline } from './PipelineComponent';
|
|
20
|
-
|
|
21
|
-
//
|
|
22
|
-
// PipelineColumn
|
|
23
|
-
//
|
|
24
|
-
|
|
25
|
-
const PIPELINE_COLUMN_NAME = 'PipelineColumn';
|
|
26
|
-
|
|
27
|
-
export type PipelineColumnProps = {
|
|
28
|
-
column: Pipeline.Column;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
// TODO(thure): Duplicates a lot of the same boilerplate as Kanban columns; is there an opportunity to DRY these out?
|
|
32
|
-
// TODO(wittjosiah): Support column DnD reordering.
|
|
33
|
-
// TODO(wittjosiah): Support item DnD reordering (ordering needs to be stored on the view presentation collection).
|
|
34
|
-
export const PipelineColumn = ({ column }: PipelineColumnProps) => {
|
|
35
|
-
const { t } = useTranslation(meta.id);
|
|
36
|
-
// Subscribe to the view target for reactivity.
|
|
37
|
-
const [viewSnapshot] = useObject(column.view);
|
|
38
|
-
const view = column.view.target;
|
|
39
|
-
const space = getSpace(view);
|
|
40
|
-
const { Item } = usePipeline(PIPELINE_COLUMN_NAME);
|
|
41
|
-
const [schema, setSchema] = useState<Schema.Schema.AnyNoContext>();
|
|
42
|
-
const query = useMemo(() => {
|
|
43
|
-
if (!view) {
|
|
44
|
-
return Query.select(Filter.nothing());
|
|
45
|
-
} else {
|
|
46
|
-
// NOTE: Snapshot is required to prevent signal read in prohibited scope.
|
|
47
|
-
// TODO(wittjosiah): Without stringify, filter.filters remains a proxied array.
|
|
48
|
-
return Query.fromAst(JSON.parse(JSON.stringify(viewSnapshot?.query.ast)));
|
|
49
|
-
}
|
|
50
|
-
}, [JSON.stringify(viewSnapshot?.query.ast)]);
|
|
51
|
-
|
|
52
|
-
useAsyncEffect(async () => {
|
|
53
|
-
if (!query || !space) {
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
const schema = await resolveSchemaWithRegistry(space.db.schemaRegistry, query.ast);
|
|
58
|
-
setSchema(() => schema);
|
|
59
|
-
}, [space, query]);
|
|
60
|
-
|
|
61
|
-
const queryTarget = getQueryTarget(query.ast, space);
|
|
62
|
-
const items = useQuery(queryTarget, query);
|
|
63
|
-
const sortedItems = useMemo(() => {
|
|
64
|
-
// TODO(burdon): Hack to reverse queue.
|
|
65
|
-
return isSpace(queryTarget) ? items : [...items.reverse()];
|
|
66
|
-
}, [queryTarget, items]);
|
|
67
|
-
const projectionModel = useMemo(() => {
|
|
68
|
-
if (!schema || !view) {
|
|
69
|
-
return undefined;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
// For mutable schemas (EchoSchema), use the live jsonSchema reference for reactivity.
|
|
73
|
-
const jsonSchema = Type.isMutable(schema) ? schema.jsonSchema : Type.toJsonSchema(schema);
|
|
74
|
-
const change = createEchoChangeCallback(view, Type.isMutable(schema) ? schema : undefined);
|
|
75
|
-
return new ProjectionModel({ view, baseSchema: jsonSchema, change });
|
|
76
|
-
}, [schema, view]);
|
|
77
|
-
|
|
78
|
-
const Tile = useMemo(() => {
|
|
79
|
-
return forwardRef<HTMLDivElement, Pick<MosaicTileProps<Obj.Unknown>, 'classNames' | 'location' | 'data' | 'debug'>>(
|
|
80
|
-
(props, ref) => <ItemTile {...props} ref={ref} itemProps={{ item: props.data, projectionModel }} />,
|
|
81
|
-
);
|
|
82
|
-
}, [Item, projectionModel]);
|
|
83
|
-
|
|
84
|
-
if (!view) {
|
|
85
|
-
return null;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
return (
|
|
89
|
-
<Focus.Group asChild>
|
|
90
|
-
<div className='grid bs-full card-default-width overflow-hidden grid-rows-[min-content_1fr] density-fine border border-separator rounded-md bg-deckSurface'>
|
|
91
|
-
<Card.Toolbar>
|
|
92
|
-
<Card.DragHandle />
|
|
93
|
-
<Card.Title>{column.name ?? t('untitled view title')}</Card.Title>
|
|
94
|
-
<Card.Menu />
|
|
95
|
-
</Card.Toolbar>
|
|
96
|
-
<Mosaic.Container asChild orientation='vertical' withFocus>
|
|
97
|
-
<ScrollArea.Root orientation='vertical'>
|
|
98
|
-
<ScrollArea.Viewport classNames='p-2'>
|
|
99
|
-
<Mosaic.Stack orientation='vertical' items={sortedItems} getId={(item) => item.id} Tile={Tile} />
|
|
100
|
-
</ScrollArea.Viewport>
|
|
101
|
-
</ScrollArea.Root>
|
|
102
|
-
</Mosaic.Container>
|
|
103
|
-
</div>
|
|
104
|
-
</Focus.Group>
|
|
105
|
-
);
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
PipelineColumn.displayName = PIPELINE_COLUMN_NAME;
|
|
109
|
-
|
|
110
|
-
//
|
|
111
|
-
// ItemTile
|
|
112
|
-
//
|
|
113
|
-
|
|
114
|
-
const ITEM_TILE_NAME = 'ItemTile';
|
|
115
|
-
|
|
116
|
-
type ItemTileProps = Pick<MosaicTileProps<Obj.Unknown>, 'classNames' | 'location' | 'data' | 'debug'> & {
|
|
117
|
-
itemProps: ItemProps;
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
const ItemTile = forwardRef<HTMLDivElement, ItemTileProps>(
|
|
121
|
-
({ classNames, data, location, debug, itemProps }, forwardedRef) => {
|
|
122
|
-
const rootRef = useRef<HTMLDivElement>(null);
|
|
123
|
-
const composedRef = useComposedRefs<HTMLDivElement>(rootRef, forwardedRef);
|
|
124
|
-
const { Item } = usePipeline(ITEM_TILE_NAME);
|
|
125
|
-
|
|
126
|
-
return (
|
|
127
|
-
<Mosaic.Tile asChild id={data.id} data={data} location={location} debug={debug}>
|
|
128
|
-
<Focus.Group asChild>
|
|
129
|
-
<Card.Root classNames={classNames} ref={composedRef}>
|
|
130
|
-
<Card.Toolbar>
|
|
131
|
-
<Card.DragHandle />
|
|
132
|
-
<Card.Title>{Obj.getLabel(data)}</Card.Title>
|
|
133
|
-
<Card.Menu />
|
|
134
|
-
</Card.Toolbar>
|
|
135
|
-
<Card.Content>
|
|
136
|
-
<Item {...itemProps} />
|
|
137
|
-
</Card.Content>
|
|
138
|
-
</Card.Root>
|
|
139
|
-
</Focus.Group>
|
|
140
|
-
</Mosaic.Tile>
|
|
141
|
-
);
|
|
142
|
-
},
|
|
143
|
-
);
|
|
144
|
-
|
|
145
|
-
ItemTile.displayName = ITEM_TILE_NAME;
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { createContext } from '@radix-ui/react-context';
|
|
6
|
-
import React, { type FC } from 'react';
|
|
7
|
-
|
|
8
|
-
import { type Obj } from '@dxos/echo';
|
|
9
|
-
import { useObject } from '@dxos/react-client/echo';
|
|
10
|
-
import { Toolbar, type ToolbarRootProps, useTranslation } from '@dxos/react-ui';
|
|
11
|
-
import { Stack } from '@dxos/react-ui-stack';
|
|
12
|
-
import { type ProjectionModel } from '@dxos/schema';
|
|
13
|
-
import { type Pipeline as PipelineType } from '@dxos/types';
|
|
14
|
-
|
|
15
|
-
import { meta } from '../meta';
|
|
16
|
-
|
|
17
|
-
import { PipelineColumn } from './PipelineColumn';
|
|
18
|
-
|
|
19
|
-
type ItemProps = {
|
|
20
|
-
item: Obj.Unknown;
|
|
21
|
-
projectionModel?: ProjectionModel;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
const itemNoOp = ({ item }: ItemProps) => <span>{item.id}</span>;
|
|
25
|
-
|
|
26
|
-
type PipelineContextValue = {
|
|
27
|
-
Item: FC<ItemProps>;
|
|
28
|
-
// TODO(wittjosiah): Support adding items.
|
|
29
|
-
// If the created item doesn't match the current query, it will not be visible.
|
|
30
|
-
// onAddItem?: (schema: Schema.Schema.AnyNoContext) => void;
|
|
31
|
-
onAddColumn?: () => void;
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
//
|
|
35
|
-
// Root
|
|
36
|
-
//
|
|
37
|
-
|
|
38
|
-
type PipelineRootProps = PipelineContextValue;
|
|
39
|
-
|
|
40
|
-
const PIPELINE_ROOT = 'Pipeline.Root';
|
|
41
|
-
|
|
42
|
-
const [PipelineRoot, usePipeline] = createContext<PipelineContextValue>(PIPELINE_ROOT, {
|
|
43
|
-
Item: itemNoOp,
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
PipelineRoot.displayName = PIPELINE_ROOT;
|
|
47
|
-
|
|
48
|
-
//
|
|
49
|
-
// Content
|
|
50
|
-
//
|
|
51
|
-
|
|
52
|
-
const PIPELINE_CONTENT_NAME = 'Pipeline.Content';
|
|
53
|
-
|
|
54
|
-
type PipelineContentProps = {
|
|
55
|
-
pipeline: PipelineType.Pipeline;
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
const PipelineContent = ({ pipeline }: PipelineContentProps) => {
|
|
59
|
-
const [columns] = useObject(pipeline, 'columns');
|
|
60
|
-
|
|
61
|
-
return (
|
|
62
|
-
<Stack orientation='horizontal' size='contain' rail={false}>
|
|
63
|
-
{columns.map((column) => {
|
|
64
|
-
return <PipelineColumn key={column.view.dxn.toString()} column={column} />;
|
|
65
|
-
})}
|
|
66
|
-
</Stack>
|
|
67
|
-
);
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
PipelineContent.displayName = PIPELINE_CONTENT_NAME;
|
|
71
|
-
|
|
72
|
-
//
|
|
73
|
-
// Toolbar
|
|
74
|
-
//
|
|
75
|
-
|
|
76
|
-
const PIPELINE_TOOLBAR_NAME = 'Pipeline.Toolbar';
|
|
77
|
-
|
|
78
|
-
export const PipelineToolbar = (props: ToolbarRootProps) => {
|
|
79
|
-
const { t } = useTranslation(meta.id);
|
|
80
|
-
const { onAddColumn } = usePipeline(PIPELINE_TOOLBAR_NAME);
|
|
81
|
-
|
|
82
|
-
return (
|
|
83
|
-
<Toolbar.Root {...props}>
|
|
84
|
-
<Toolbar.IconButton icon='ph--plus--regular' iconOnly label={t('add column label')} onClick={onAddColumn} />
|
|
85
|
-
</Toolbar.Root>
|
|
86
|
-
);
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
PipelineToolbar.displayName = PIPELINE_TOOLBAR_NAME;
|
|
90
|
-
|
|
91
|
-
//
|
|
92
|
-
// Project
|
|
93
|
-
//
|
|
94
|
-
|
|
95
|
-
export const PipelineComponent = {
|
|
96
|
-
Root: PipelineRoot,
|
|
97
|
-
Content: PipelineContent,
|
|
98
|
-
Toolbar: PipelineToolbar,
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
export { usePipeline };
|
|
102
|
-
|
|
103
|
-
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'>
|
|
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: 5 }).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: 8 }).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: 3 }).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: 6 }).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,57 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, { useCallback } from 'react';
|
|
6
|
-
|
|
7
|
-
import { useOperationInvoker } from '@dxos/app-framework/ui';
|
|
8
|
-
import { Surface } from '@dxos/app-framework/ui';
|
|
9
|
-
import { type SurfaceComponentProps } from '@dxos/app-toolkit/ui';
|
|
10
|
-
import { Obj } from '@dxos/echo';
|
|
11
|
-
import { ATTENDABLE_PATH_SEPARATOR, DeckOperation } from '@dxos/plugin-deck/types';
|
|
12
|
-
import { Layout } from '@dxos/react-ui';
|
|
13
|
-
import { useAttention } from '@dxos/react-ui-attention';
|
|
14
|
-
import { type Pipeline as PipelineType } from '@dxos/types';
|
|
15
|
-
|
|
16
|
-
import { type ItemProps, PipelineComponent } from './PipelineComponent';
|
|
17
|
-
|
|
18
|
-
export type PipelineContainerProps = SurfaceComponentProps<PipelineType.Pipeline>;
|
|
19
|
-
|
|
20
|
-
export const PipelineContainer = ({ role, subject: pipeline }: PipelineContainerProps) => {
|
|
21
|
-
const { invokePromise } = useOperationInvoker();
|
|
22
|
-
const attendableId = Obj.getDXN(pipeline).toString();
|
|
23
|
-
const { hasAttention } = useAttention(attendableId);
|
|
24
|
-
|
|
25
|
-
const handleColumnAdd = useCallback(
|
|
26
|
-
() =>
|
|
27
|
-
invokePromise(DeckOperation.ChangeCompanion, {
|
|
28
|
-
primary: attendableId,
|
|
29
|
-
companion: `${attendableId}${ATTENDABLE_PATH_SEPARATOR}settings`,
|
|
30
|
-
}),
|
|
31
|
-
[invokePromise, attendableId],
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
return (
|
|
35
|
-
<Layout.Main role={role} toolbar>
|
|
36
|
-
<PipelineComponent.Root Item={PipelineItem} onAddColumn={handleColumnAdd}>
|
|
37
|
-
<PipelineComponent.Toolbar disabled={!hasAttention} />
|
|
38
|
-
<PipelineComponent.Content pipeline={pipeline} />
|
|
39
|
-
</PipelineComponent.Root>
|
|
40
|
-
</Layout.Main>
|
|
41
|
-
);
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
const PipelineItem = ({ item, projectionModel }: ItemProps) => {
|
|
45
|
-
return (
|
|
46
|
-
<Surface.Surface
|
|
47
|
-
role='card--content'
|
|
48
|
-
data={{
|
|
49
|
-
subject: item,
|
|
50
|
-
projection: projectionModel,
|
|
51
|
-
}}
|
|
52
|
-
limit={1}
|
|
53
|
-
/>
|
|
54
|
-
);
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
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
|