@dxos/plugin-pipeline 0.8.4-main.6fa680abb7 → 0.8.4-main.765dc60934
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/{browser/PipelineObjectSettings-JFOS6Z37.mjs → neutral/PipelineProperties-GED4FJSS.mjs} +36 -45
- package/dist/lib/neutral/PipelineProperties-GED4FJSS.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-3A235GUD.mjs → neutral/chunk-ULB5DKWO.mjs} +1 -1
- package/dist/lib/{browser/chunk-3A235GUD.mjs.map → neutral/chunk-ULB5DKWO.mjs.map} +2 -2
- 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/{browser/react-surface-XD6PVALN.mjs → neutral/react-surface-4W5YLCHT.mjs} +13 -25
- package/dist/lib/neutral/react-surface-4W5YLCHT.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.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.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/PipelineComponent/PipelineColumn.d.ts +4 -4
- package/dist/types/src/components/PipelineComponent/PipelineColumn.d.ts.map +1 -1
- package/dist/types/src/components/PipelineComponent/PipelineComponent.d.ts +22 -16
- package/dist/types/src/components/PipelineComponent/PipelineComponent.d.ts.map +1 -1
- package/dist/types/src/components/PipelineComponent/PipelineComponent.stories.d.ts +44 -25
- package/dist/types/src/components/PipelineComponent/PipelineComponent.stories.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/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 -26
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +101 -57
- package/src/PipelinePlugin.node.ts +19 -0
- package/src/PipelinePlugin.test.ts +27 -0
- package/src/PipelinePlugin.tsx +6 -17
- 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/react-surface.tsx → react-surface.tsx} +14 -16
- package/src/components/PipelineComponent/PipelineColumn.tsx +70 -39
- package/src/components/PipelineComponent/PipelineComponent.stories.tsx +21 -21
- package/src/components/PipelineComponent/PipelineComponent.tsx +22 -13
- package/src/containers/{PipelineContainer/PipelineContainer.stories.tsx → PipelineArticle/PipelineArticle.stories.tsx} +44 -45
- package/src/containers/{PipelineContainer/PipelineContainer.tsx → PipelineArticle/PipelineArticle.tsx} +13 -15
- package/src/containers/PipelineArticle/index.ts +5 -0
- package/src/containers/{PipelineObjectSettings/PipelineObjectSettings.tsx → PipelineProperties/PipelineProperties.tsx} +39 -38
- package/src/containers/PipelineProperties/index.ts +5 -0
- package/src/containers/index.ts +2 -2
- package/src/hooks/usePipelineBoardModel.ts +1 -1
- package/src/index.ts +0 -1
- package/src/plugin.ts +9 -0
- package/src/templates/research.ts +2 -2
- package/src/translations.ts +22 -22
- package/dist/lib/browser/PipelineContainer-FAOVECDX.mjs +0 -318
- package/dist/lib/browser/PipelineContainer-FAOVECDX.mjs.map +0 -7
- package/dist/lib/browser/PipelineObjectSettings-JFOS6Z37.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-QQKBLYFD.mjs +0 -56
- package/dist/lib/browser/app-graph-builder-QQKBLYFD.mjs.map +0 -7
- package/dist/lib/browser/index.mjs +0 -85
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/react-surface-XD6PVALN.mjs.map +0 -7
- 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/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 -57
- 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/src/capabilities/app-graph-builder/app-graph-builder.ts +0 -49
- 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 -9
- package/src/capabilities/react-surface/index.ts +0 -7
- package/src/containers/PipelineContainer/index.ts +0 -7
- package/src/containers/PipelineObjectSettings/index.ts +0 -7
- /package/dist/lib/{browser/types → neutral}/index.mjs.map +0 -0
- /package/dist/lib/{browser → neutral}/types/index.mjs +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
|
@@ -5,37 +5,36 @@
|
|
|
5
5
|
import * as Schema from 'effect/Schema';
|
|
6
6
|
import React, { useCallback, useMemo, useRef, useState } from 'react';
|
|
7
7
|
|
|
8
|
+
import { resolveSchemaWithRegistry } from '@dxos/app-toolkit/query';
|
|
9
|
+
import { useTypeOptions } from '@dxos/app-toolkit/ui';
|
|
8
10
|
import { DXN, Filter, JsonSchema, Obj, Query, type QueryAST, Ref, Tag } from '@dxos/echo';
|
|
9
11
|
import { type JsonPath, type Mutable } from '@dxos/echo/internal';
|
|
10
|
-
import {
|
|
11
|
-
import { resolveSchemaWithRegistry } from '@dxos/plugin-space';
|
|
12
|
-
import { getSpace, useObject, useQuery } from '@dxos/react-client/echo';
|
|
12
|
+
import { useObject, useQuery } from '@dxos/react-client/echo';
|
|
13
13
|
import { IconButton, type ThemedClassName, useAsyncEffect, useTranslation } from '@dxos/react-ui';
|
|
14
14
|
import { Form, ViewEditor } from '@dxos/react-ui-form';
|
|
15
15
|
import { List } from '@dxos/react-ui-list';
|
|
16
16
|
import { type ProjectionModel, ViewModel } from '@dxos/schema';
|
|
17
|
-
import { Pipeline
|
|
18
|
-
import { mx, osTranslations
|
|
17
|
+
import { Pipeline } from '@dxos/types';
|
|
18
|
+
import { mx, osTranslations } from '@dxos/ui-theme';
|
|
19
19
|
import { arrayMove } from '@dxos/util';
|
|
20
20
|
|
|
21
|
-
import { meta } from '
|
|
21
|
+
import { meta } from '#meta';
|
|
22
22
|
|
|
23
23
|
const listGrid = 'grid grid-cols-[min-content_1fr_min-content_min-content_min-content]';
|
|
24
24
|
const listItemGrid = 'grid grid-cols-subgrid col-span-5';
|
|
25
25
|
|
|
26
26
|
const ColumnFormSchema = Pipeline.Column.pipe(Schema.mutable, Schema.pick('name'));
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
export type PipelineObjectSettingsProps = ThemedClassName<{
|
|
28
|
+
export type PipelinePropertiesProps = ThemedClassName<{
|
|
30
29
|
pipeline: Pipeline.Pipeline;
|
|
31
30
|
}>;
|
|
32
31
|
|
|
33
32
|
/**
|
|
34
33
|
* Supports editing the pipeline view.
|
|
35
34
|
*/
|
|
36
|
-
export const
|
|
35
|
+
export const PipelineProperties = ({ classNames, pipeline }: PipelinePropertiesProps) => {
|
|
37
36
|
const { t } = useTranslation(meta.id);
|
|
38
|
-
const
|
|
37
|
+
const db = Obj.getDatabase(pipeline);
|
|
39
38
|
const [expandedId, setExpandedId] = useState<string>();
|
|
40
39
|
const [columns, updateColumns] = useObject(pipeline, 'columns');
|
|
41
40
|
const column = useMemo(
|
|
@@ -45,9 +44,9 @@ export const PipelineObjectSettings = ({ classNames, pipeline }: PipelineObjectS
|
|
|
45
44
|
const [view, updateView] = useObject(column?.view);
|
|
46
45
|
const [schema, setSchema] = useState<Schema.Schema.AnyNoContext>(() => Schema.Struct({}));
|
|
47
46
|
const projectionRef = useRef<ProjectionModel>(null);
|
|
48
|
-
const tags = useQuery(
|
|
47
|
+
const tags = useQuery(db, Filter.type(Tag.Tag));
|
|
49
48
|
const types = useTypeOptions({
|
|
50
|
-
|
|
49
|
+
db,
|
|
51
50
|
annotation: {
|
|
52
51
|
location: ['database', 'runtime'],
|
|
53
52
|
kind: ['user'],
|
|
@@ -55,15 +54,15 @@ export const PipelineObjectSettings = ({ classNames, pipeline }: PipelineObjectS
|
|
|
55
54
|
});
|
|
56
55
|
|
|
57
56
|
useAsyncEffect(async () => {
|
|
58
|
-
if (!view?.query || !
|
|
57
|
+
if (!view?.query || !db) {
|
|
59
58
|
return;
|
|
60
59
|
}
|
|
61
60
|
|
|
62
|
-
const foundSchema = await resolveSchemaWithRegistry(
|
|
61
|
+
const foundSchema = await resolveSchemaWithRegistry(db.schemaRegistry, view.query.ast);
|
|
63
62
|
if (foundSchema && foundSchema !== schema) {
|
|
64
63
|
setSchema(() => foundSchema);
|
|
65
64
|
}
|
|
66
|
-
}, [
|
|
65
|
+
}, [db, view, schema]);
|
|
67
66
|
|
|
68
67
|
const handleMove = useCallback(
|
|
69
68
|
(fromIndex: number, toIndex: number) =>
|
|
@@ -75,16 +74,16 @@ export const PipelineObjectSettings = ({ classNames, pipeline }: PipelineObjectS
|
|
|
75
74
|
|
|
76
75
|
const handleQueryChanged = useCallback(
|
|
77
76
|
async (newQuery: QueryAST.Query, target?: string) => {
|
|
78
|
-
if (!view || !
|
|
77
|
+
if (!view || !db) {
|
|
79
78
|
return;
|
|
80
79
|
}
|
|
81
80
|
|
|
82
81
|
const queue = target && DXN.tryParse(target) ? target : undefined;
|
|
83
|
-
const query = queue ? Query.fromAst(newQuery).from({
|
|
82
|
+
const query = queue ? Query.fromAst(newQuery).from({ feeds: [queue] }) : Query.fromAst(newQuery);
|
|
84
83
|
updateView((view) => {
|
|
85
84
|
view.query.ast = query.ast as Mutable<typeof query.ast>;
|
|
86
85
|
});
|
|
87
|
-
const newSchema = await resolveSchemaWithRegistry(
|
|
86
|
+
const newSchema = await resolveSchemaWithRegistry(db.schemaRegistry, query.ast);
|
|
88
87
|
if (!newSchema) {
|
|
89
88
|
return;
|
|
90
89
|
}
|
|
@@ -99,7 +98,7 @@ export const PipelineObjectSettings = ({ classNames, pipeline }: PipelineObjectS
|
|
|
99
98
|
|
|
100
99
|
setSchema(() => newSchema);
|
|
101
100
|
},
|
|
102
|
-
[view, updateView, schema],
|
|
101
|
+
[db, view, updateView, schema],
|
|
103
102
|
);
|
|
104
103
|
|
|
105
104
|
const handleColumnValuesChanged = useCallback(
|
|
@@ -135,34 +134,34 @@ export const PipelineObjectSettings = ({ classNames, pipeline }: PipelineObjectS
|
|
|
135
134
|
updateColumns((columns) => {
|
|
136
135
|
columns.splice(index, 1);
|
|
137
136
|
});
|
|
138
|
-
|
|
137
|
+
db?.remove(viewToRemove);
|
|
139
138
|
},
|
|
140
|
-
[expandedId, columns, updateColumns,
|
|
139
|
+
[expandedId, columns, updateColumns, db],
|
|
141
140
|
);
|
|
142
141
|
|
|
143
142
|
const handleAdd = useCallback(() => {
|
|
144
|
-
if (!
|
|
143
|
+
if (!db) {
|
|
145
144
|
return;
|
|
146
145
|
}
|
|
147
146
|
const newView = ViewModel.make({
|
|
148
|
-
query: Query.select(Filter.
|
|
149
|
-
jsonSchema: JsonSchema.toJsonSchema(
|
|
147
|
+
query: Query.select(Filter.nothing()),
|
|
148
|
+
jsonSchema: JsonSchema.toJsonSchema(Schema.Struct({})),
|
|
150
149
|
});
|
|
151
|
-
|
|
150
|
+
db.add(newView);
|
|
152
151
|
updateColumns((columns) => {
|
|
153
152
|
columns.push({
|
|
154
|
-
name: '
|
|
153
|
+
name: '',
|
|
155
154
|
// Type assertion needed due to QueryAST type variance.
|
|
156
155
|
view: Ref.make(newView) as (typeof columns)[number]['view'],
|
|
157
156
|
order: [],
|
|
158
157
|
});
|
|
159
158
|
});
|
|
160
159
|
setExpandedId(newView.id);
|
|
161
|
-
}, [
|
|
160
|
+
}, [db, updateColumns]);
|
|
162
161
|
|
|
163
162
|
return (
|
|
164
|
-
<div
|
|
165
|
-
<h2 className='text-sm text-description py-1'>{t('views
|
|
163
|
+
<div className={mx('py-form-padding overflow-y-auto', classNames)}>
|
|
164
|
+
<h2 className='text-sm text-description py-1'>{t('views.label')}</h2>
|
|
166
165
|
|
|
167
166
|
<List.Root<Pipeline.Column>
|
|
168
167
|
items={columns}
|
|
@@ -180,11 +179,13 @@ export const PipelineObjectSettings = ({ classNames, pipeline }: PipelineObjectS
|
|
|
180
179
|
classNames={listItemGrid}
|
|
181
180
|
aria-expanded={expandedId === column.view.dxn.toString()}
|
|
182
181
|
>
|
|
183
|
-
<div
|
|
182
|
+
<div className={mx(listItemGrid, 'dx-hover rounded-xs cursor-pointer min-h-10')}>
|
|
184
183
|
<List.ItemDragHandle />
|
|
185
|
-
<List.ItemTitle onClick={() => handleToggleField(column)}>
|
|
184
|
+
<List.ItemTitle onClick={() => handleToggleField(column)}>
|
|
185
|
+
{column.name || t('untitled-view.title')}
|
|
186
|
+
</List.ItemTitle>
|
|
186
187
|
<List.ItemDeleteButton
|
|
187
|
-
label={t('delete
|
|
188
|
+
label={t('delete-view.label')}
|
|
188
189
|
autoHide={false}
|
|
189
190
|
onClick={() => handleDelete(column)}
|
|
190
191
|
data-testid='view.delete'
|
|
@@ -192,7 +193,7 @@ export const PipelineObjectSettings = ({ classNames, pipeline }: PipelineObjectS
|
|
|
192
193
|
<IconButton
|
|
193
194
|
iconOnly
|
|
194
195
|
variant='ghost'
|
|
195
|
-
label={t('toggle
|
|
196
|
+
label={t('toggle-expand.label', { ns: osTranslations })}
|
|
196
197
|
icon={
|
|
197
198
|
expandedId === column.view.dxn.toString()
|
|
198
199
|
? 'ph--caret-down--regular'
|
|
@@ -202,7 +203,7 @@ export const PipelineObjectSettings = ({ classNames, pipeline }: PipelineObjectS
|
|
|
202
203
|
/>
|
|
203
204
|
</div>
|
|
204
205
|
{expandedId === column.view.dxn.toString() && column?.view.target && (
|
|
205
|
-
<div
|
|
206
|
+
<div className='col-span-5 my-2 border border-separator rounded-md'>
|
|
206
207
|
<Form.Root
|
|
207
208
|
schema={ColumnFormSchema}
|
|
208
209
|
values={column}
|
|
@@ -218,8 +219,8 @@ export const PipelineObjectSettings = ({ classNames, pipeline }: PipelineObjectS
|
|
|
218
219
|
readonly
|
|
219
220
|
schema={schema}
|
|
220
221
|
view={column.view.target}
|
|
221
|
-
registry={
|
|
222
|
-
db={
|
|
222
|
+
registry={db?.schemaRegistry}
|
|
223
|
+
db={db}
|
|
223
224
|
tags={tags}
|
|
224
225
|
types={types}
|
|
225
226
|
onQueryChanged={handleQueryChanged}
|
|
@@ -233,8 +234,8 @@ export const PipelineObjectSettings = ({ classNames, pipeline }: PipelineObjectS
|
|
|
233
234
|
)}
|
|
234
235
|
</List.Root>
|
|
235
236
|
|
|
236
|
-
<div
|
|
237
|
-
<IconButton icon='ph--plus--regular' label={t('add
|
|
237
|
+
<div className='my-form-padding'>
|
|
238
|
+
<IconButton icon='ph--plus--regular' label={t('add-view.label')} onClick={handleAdd} classNames='w-full' />
|
|
238
239
|
</div>
|
|
239
240
|
</div>
|
|
240
241
|
);
|
package/src/containers/index.ts
CHANGED
|
@@ -4,5 +4,5 @@
|
|
|
4
4
|
|
|
5
5
|
import { type ComponentType, lazy } from 'react';
|
|
6
6
|
|
|
7
|
-
export const
|
|
8
|
-
export const
|
|
7
|
+
export const PipelineArticle: ComponentType<any> = lazy(() => import('./PipelineArticle'));
|
|
8
|
+
export const PipelineProperties: ComponentType<any> = lazy(() => import('./PipelineProperties'));
|
|
@@ -6,9 +6,9 @@ import { Atom, type Registry } from '@effect-atom/atom-react';
|
|
|
6
6
|
import * as Schema from 'effect/Schema';
|
|
7
7
|
import { useMemo } from 'react';
|
|
8
8
|
|
|
9
|
+
import { getQueryTarget } from '@dxos/app-toolkit/query';
|
|
9
10
|
import { Obj, Query } from '@dxos/echo';
|
|
10
11
|
import { AtomObj, AtomQuery } from '@dxos/echo-atom';
|
|
11
|
-
import { getQueryTarget } from '@dxos/plugin-space';
|
|
12
12
|
import { getSpace, isSpace } from '@dxos/react-client/echo';
|
|
13
13
|
import { type BoardModel } from '@dxos/react-ui-mosaic';
|
|
14
14
|
import { Pipeline } from '@dxos/types';
|
package/src/index.ts
CHANGED
package/src/plugin.ts
ADDED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { type Database, Filter, JsonSchema, Query, Ref } from '@dxos/echo';
|
|
6
|
-
import { Mailbox } from '@dxos/plugin-inbox
|
|
7
|
-
import { Markdown } from '@dxos/plugin-markdown
|
|
6
|
+
import { Mailbox } from '@dxos/plugin-inbox';
|
|
7
|
+
import { Markdown } from '@dxos/plugin-markdown';
|
|
8
8
|
import { ViewModel } from '@dxos/schema';
|
|
9
9
|
import { Message, Organization, Person, Pipeline } from '@dxos/types';
|
|
10
10
|
|
package/src/translations.ts
CHANGED
|
@@ -4,35 +4,35 @@ import { Pipeline } from '@dxos/types';
|
|
|
4
4
|
// Copyright 2023 DXOS.org
|
|
5
5
|
//
|
|
6
6
|
|
|
7
|
-
import { meta } from '
|
|
7
|
+
import { meta } from '#meta';
|
|
8
8
|
|
|
9
9
|
export const translations = [
|
|
10
10
|
{
|
|
11
11
|
'en-US': {
|
|
12
12
|
[Pipeline.Pipeline.typename]: {
|
|
13
|
-
'typename
|
|
14
|
-
'typename
|
|
15
|
-
'typename
|
|
16
|
-
'typename
|
|
17
|
-
'object
|
|
18
|
-
'add
|
|
19
|
-
'rename
|
|
20
|
-
'delete
|
|
21
|
-
'object
|
|
13
|
+
'typename.label': 'Pipeline',
|
|
14
|
+
'typename.label_zero': 'Pipelines',
|
|
15
|
+
'typename.label_one': 'Pipeline',
|
|
16
|
+
'typename.label_other': 'Pipelines',
|
|
17
|
+
'object-name.placeholder': 'New pipeline',
|
|
18
|
+
'add-object.label': 'Add pipeline',
|
|
19
|
+
'rename-object.label': 'Rename pipeline',
|
|
20
|
+
'delete-object.label': 'Delete pipeline',
|
|
21
|
+
'object-deleted.label': 'Pipeline deleted',
|
|
22
22
|
},
|
|
23
23
|
[meta.id]: {
|
|
24
|
-
'plugin
|
|
25
|
-
'add
|
|
26
|
-
'add
|
|
27
|
-
'untitled
|
|
28
|
-
'enumerating
|
|
29
|
-
'editing
|
|
30
|
-
'views
|
|
31
|
-
'pipeline
|
|
32
|
-
'pipeline
|
|
33
|
-
'toggle
|
|
34
|
-
'delete
|
|
35
|
-
'add
|
|
24
|
+
'plugin.name': 'Pipelines',
|
|
25
|
+
'add-column.label': 'Add column',
|
|
26
|
+
'add-card.label': 'Add object',
|
|
27
|
+
'untitled-view.title': 'New view',
|
|
28
|
+
'enumerating-tab.label': 'List',
|
|
29
|
+
'editing-tab.label': 'Edit',
|
|
30
|
+
'views.label': 'Views',
|
|
31
|
+
'pipeline-invocations.label': 'Invocations',
|
|
32
|
+
'pipeline-automation.label': 'Automations',
|
|
33
|
+
'toggle-expand.label': 'Toggle expand',
|
|
34
|
+
'delete-view.label': 'Delete view',
|
|
35
|
+
'add-view.label': 'Add view',
|
|
36
36
|
},
|
|
37
37
|
},
|
|
38
38
|
},
|
|
@@ -1,318 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
meta
|
|
3
|
-
} from "./chunk-3A235GUD.mjs";
|
|
4
|
-
|
|
5
|
-
// src/containers/PipelineContainer/PipelineContainer.tsx
|
|
6
|
-
import React3, { useCallback, useEffect } from "react";
|
|
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 { OBJECT_ACTIONS_CONTRIBUTION_ID, OBJECT_ACTIONS_CONTRIBUTION_PRIORITY, useObjectMenuItems } from "@dxos/app-toolkit/ui";
|
|
12
|
-
import { COMPANION_PREFIX } from "@dxos/app-toolkit";
|
|
13
|
-
import { DeckOperation } from "@dxos/plugin-deck/types";
|
|
14
|
-
import { Panel } from "@dxos/react-ui";
|
|
15
|
-
import { useAttention } from "@dxos/react-ui-attention";
|
|
16
|
-
import { useMenu } from "@dxos/react-ui-menu";
|
|
17
|
-
|
|
18
|
-
// src/components/PipelineComponent/PipelineColumn.tsx
|
|
19
|
-
import { useComposedRefs } from "@radix-ui/react-compose-refs";
|
|
20
|
-
import React2, { forwardRef, useMemo, useRef, useState } from "react";
|
|
21
|
-
import { useObjectNavigate } from "@dxos/app-toolkit/ui";
|
|
22
|
-
import { JsonSchema, Obj as Obj2, Query, Type } from "@dxos/echo";
|
|
23
|
-
import { resolveSchemaWithRegistry } from "@dxos/plugin-space";
|
|
24
|
-
import { Filter, getSpace, useObject } from "@dxos/react-client/echo";
|
|
25
|
-
import { useAsyncEffect, useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
26
|
-
import { Card } from "@dxos/react-ui";
|
|
27
|
-
import { Board as Board2, Focus, Mosaic } from "@dxos/react-ui-mosaic";
|
|
28
|
-
import { ProjectionModel, createEchoChangeCallback } from "@dxos/schema";
|
|
29
|
-
|
|
30
|
-
// src/components/PipelineComponent/PipelineComponent.tsx
|
|
31
|
-
import { useAtomValue } from "@effect-atom/atom-react";
|
|
32
|
-
import { createContext } from "@radix-ui/react-context";
|
|
33
|
-
import React from "react";
|
|
34
|
-
import { Obj } from "@dxos/echo";
|
|
35
|
-
import { Toolbar, useTranslation } from "@dxos/react-ui";
|
|
36
|
-
import { Board, useBoard, useEventHandlerAdapter } from "@dxos/react-ui-mosaic";
|
|
37
|
-
var itemNoOp = ({ item }) => /* @__PURE__ */ React.createElement("span", null, item.id);
|
|
38
|
-
var PIPELINE_ROOT = "Pipeline.Root";
|
|
39
|
-
var [PipelineRootContext, usePipeline] = createContext(PIPELINE_ROOT, {
|
|
40
|
-
Item: itemNoOp
|
|
41
|
-
});
|
|
42
|
-
var PipelineRoot = ({ children, ...contextValue }) => /* @__PURE__ */ React.createElement(PipelineRootContext, contextValue, children);
|
|
43
|
-
PipelineRoot.displayName = PIPELINE_ROOT;
|
|
44
|
-
var PIPELINE_CONTENT_NAME = "Pipeline.Content";
|
|
45
|
-
var PipelineContent = ({ model, children, ...props }) => /* @__PURE__ */ React.createElement(Board.Root, {
|
|
46
|
-
...props,
|
|
47
|
-
model
|
|
48
|
-
}, children);
|
|
49
|
-
PipelineContent.displayName = PIPELINE_CONTENT_NAME;
|
|
50
|
-
var PIPELINE_COLUMNS_NAME = "Pipeline.Columns";
|
|
51
|
-
var PipelineColumns = ({ pipeline }) => {
|
|
52
|
-
const { model } = useBoard(PIPELINE_COLUMNS_NAME);
|
|
53
|
-
const columns = useAtomValue(model.columns);
|
|
54
|
-
const eventHandler = useEventHandlerAdapter({
|
|
55
|
-
id: pipeline.id,
|
|
56
|
-
// TODO(wittjosiah): Cast because columns array is readonly.
|
|
57
|
-
items: columns,
|
|
58
|
-
getId: model.getColumnId,
|
|
59
|
-
get: (data) => data,
|
|
60
|
-
make: (object) => object,
|
|
61
|
-
canDrop: ({ source }) => model.isColumn(source.data),
|
|
62
|
-
onChange: (mutate) => Obj.change(pipeline, (p) => mutate(p.columns))
|
|
63
|
-
});
|
|
64
|
-
return /* @__PURE__ */ React.createElement(Board.Content, {
|
|
65
|
-
id: "pipeline",
|
|
66
|
-
eventHandler,
|
|
67
|
-
Tile: PipelineColumn
|
|
68
|
-
});
|
|
69
|
-
};
|
|
70
|
-
PipelineColumns.displayName = PIPELINE_COLUMNS_NAME;
|
|
71
|
-
var PIPELINE_TOOLBAR_NAME = "Pipeline.Toolbar";
|
|
72
|
-
var PipelineToolbar = (props) => {
|
|
73
|
-
const { t } = useTranslation(meta.id);
|
|
74
|
-
const { onAddColumn } = usePipeline(PIPELINE_TOOLBAR_NAME);
|
|
75
|
-
return /* @__PURE__ */ React.createElement(Toolbar.Root, props, /* @__PURE__ */ React.createElement(Toolbar.IconButton, {
|
|
76
|
-
icon: "ph--plus--regular",
|
|
77
|
-
iconOnly: true,
|
|
78
|
-
label: t("add column label"),
|
|
79
|
-
onClick: onAddColumn
|
|
80
|
-
}));
|
|
81
|
-
};
|
|
82
|
-
PipelineToolbar.displayName = PIPELINE_TOOLBAR_NAME;
|
|
83
|
-
var PipelineComponent = {
|
|
84
|
-
Root: PipelineRoot,
|
|
85
|
-
Content: PipelineContent,
|
|
86
|
-
Columns: PipelineColumns,
|
|
87
|
-
Toolbar: PipelineToolbar
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
// src/components/PipelineComponent/PipelineColumn.tsx
|
|
91
|
-
var PIPELINE_COLUMN_NAME = "PipelineColumn";
|
|
92
|
-
var PipelineColumn = ({ data: column, location, classNames, debug }) => {
|
|
93
|
-
const { t } = useTranslation2(meta.id);
|
|
94
|
-
const dragHandleRef = useRef(null);
|
|
95
|
-
const [viewSnapshot] = useObject(column.view);
|
|
96
|
-
const view = column.view.target;
|
|
97
|
-
const space = getSpace(view);
|
|
98
|
-
const { Item } = usePipeline(PIPELINE_COLUMN_NAME);
|
|
99
|
-
const [schema, setSchema] = useState();
|
|
100
|
-
const query = useMemo(() => {
|
|
101
|
-
if (!view) {
|
|
102
|
-
return Query.select(Filter.nothing());
|
|
103
|
-
} else {
|
|
104
|
-
return Query.fromAst(JSON.parse(JSON.stringify(viewSnapshot?.query.ast)));
|
|
105
|
-
}
|
|
106
|
-
}, [
|
|
107
|
-
JSON.stringify(viewSnapshot?.query.ast)
|
|
108
|
-
]);
|
|
109
|
-
useAsyncEffect(async () => {
|
|
110
|
-
if (!query || !space?.db) {
|
|
111
|
-
return;
|
|
112
|
-
}
|
|
113
|
-
const schema2 = await resolveSchemaWithRegistry(space.db.schemaRegistry, query.ast);
|
|
114
|
-
setSchema(() => schema2);
|
|
115
|
-
}, [
|
|
116
|
-
space,
|
|
117
|
-
query
|
|
118
|
-
]);
|
|
119
|
-
const projectionModel = useMemo(() => {
|
|
120
|
-
if (!schema || !view) {
|
|
121
|
-
return void 0;
|
|
122
|
-
}
|
|
123
|
-
const jsonSchema = Type.isMutable(schema) ? schema.jsonSchema : JsonSchema.toJsonSchema(schema);
|
|
124
|
-
const change = createEchoChangeCallback(view, Type.isMutable(schema) ? schema : void 0);
|
|
125
|
-
return new ProjectionModel({
|
|
126
|
-
view,
|
|
127
|
-
baseSchema: jsonSchema,
|
|
128
|
-
change
|
|
129
|
-
});
|
|
130
|
-
}, [
|
|
131
|
-
schema,
|
|
132
|
-
view
|
|
133
|
-
]);
|
|
134
|
-
const Tile = useMemo(() => {
|
|
135
|
-
return /* @__PURE__ */ forwardRef((props, ref) => /* @__PURE__ */ React2.createElement(ItemTile, {
|
|
136
|
-
...props,
|
|
137
|
-
ref,
|
|
138
|
-
itemProps: {
|
|
139
|
-
item: props.data,
|
|
140
|
-
projectionModel
|
|
141
|
-
}
|
|
142
|
-
}));
|
|
143
|
-
}, [
|
|
144
|
-
Item,
|
|
145
|
-
projectionModel
|
|
146
|
-
]);
|
|
147
|
-
if (!view) {
|
|
148
|
-
return null;
|
|
149
|
-
}
|
|
150
|
-
return /* @__PURE__ */ React2.createElement(Board2.Column.Root, {
|
|
151
|
-
data: column,
|
|
152
|
-
location,
|
|
153
|
-
classNames: [
|
|
154
|
-
"group/column grid h-full overflow-hidden grid-rows-[var(--dx-rail-action)_1fr]",
|
|
155
|
-
classNames
|
|
156
|
-
],
|
|
157
|
-
debug,
|
|
158
|
-
dragHandleRef
|
|
159
|
-
}, /* @__PURE__ */ React2.createElement(Board2.Column.Header, {
|
|
160
|
-
label: column.name ?? t("untitled view title"),
|
|
161
|
-
dragHandleRef
|
|
162
|
-
}), /* @__PURE__ */ React2.createElement(Board2.Column.Body, {
|
|
163
|
-
data: column,
|
|
164
|
-
Tile
|
|
165
|
-
}));
|
|
166
|
-
};
|
|
167
|
-
PipelineColumn.displayName = PIPELINE_COLUMN_NAME;
|
|
168
|
-
var ITEM_TILE_NAME = "ItemTile";
|
|
169
|
-
var ItemTile = /* @__PURE__ */ forwardRef(({ classNames, data, location, debug, itemProps }, forwardedRef) => {
|
|
170
|
-
const rootRef = useRef(null);
|
|
171
|
-
const composedRef = useComposedRefs(rootRef, forwardedRef);
|
|
172
|
-
const { Item } = usePipeline(ITEM_TILE_NAME);
|
|
173
|
-
const handleNavigate = useObjectNavigate(data);
|
|
174
|
-
return /* @__PURE__ */ React2.createElement(Mosaic.Tile, {
|
|
175
|
-
asChild: true,
|
|
176
|
-
id: data.id,
|
|
177
|
-
data,
|
|
178
|
-
location,
|
|
179
|
-
debug
|
|
180
|
-
}, /* @__PURE__ */ React2.createElement(Focus.Group, {
|
|
181
|
-
asChild: true
|
|
182
|
-
}, /* @__PURE__ */ React2.createElement(Card.Root, {
|
|
183
|
-
classNames,
|
|
184
|
-
ref: composedRef
|
|
185
|
-
}, /* @__PURE__ */ React2.createElement(Card.Toolbar, null, /* @__PURE__ */ React2.createElement(Card.DragHandle, null), /* @__PURE__ */ React2.createElement(Card.Title, {
|
|
186
|
-
onClick: handleNavigate
|
|
187
|
-
}, Obj2.getLabel(data)), /* @__PURE__ */ React2.createElement(Card.Menu, null)), /* @__PURE__ */ React2.createElement(Card.Content, null, /* @__PURE__ */ React2.createElement(Item, itemProps)))));
|
|
188
|
-
});
|
|
189
|
-
ItemTile.displayName = ITEM_TILE_NAME;
|
|
190
|
-
|
|
191
|
-
// src/hooks/usePipelineBoardModel.ts
|
|
192
|
-
import { Atom } from "@effect-atom/atom-react";
|
|
193
|
-
import * as Schema from "effect/Schema";
|
|
194
|
-
import { useMemo as useMemo2 } from "react";
|
|
195
|
-
import { Obj as Obj3, Query as Query2 } from "@dxos/echo";
|
|
196
|
-
import { AtomObj, AtomQuery } from "@dxos/echo-atom";
|
|
197
|
-
import { getQueryTarget } from "@dxos/plugin-space";
|
|
198
|
-
import { getSpace as getSpace2, isSpace } from "@dxos/react-client/echo";
|
|
199
|
-
import { Pipeline } from "@dxos/types";
|
|
200
|
-
var usePipelineBoardModel = (pipeline, registry) => useMemo2(() => {
|
|
201
|
-
if (pipeline == null) {
|
|
202
|
-
return emptyPipelineModel;
|
|
203
|
-
}
|
|
204
|
-
const space = getSpace2(pipeline);
|
|
205
|
-
const columnsAtom = AtomObj.makeProperty(pipeline, "columns");
|
|
206
|
-
const columnAtomFamily = Atom.family((viewKey) => Atom.make((get) => {
|
|
207
|
-
const columns = get(columnsAtom);
|
|
208
|
-
return columns.find((c) => c.view.dxn.toString() === viewKey);
|
|
209
|
-
}));
|
|
210
|
-
const itemsAtomFamily = Atom.family((viewKey) => Atom.make((get) => {
|
|
211
|
-
const column = get(columnAtomFamily(viewKey));
|
|
212
|
-
if (column == null) {
|
|
213
|
-
return [];
|
|
214
|
-
}
|
|
215
|
-
const viewSnapshot = get(AtomObj.make(column.view));
|
|
216
|
-
if (!viewSnapshot?.query?.ast) {
|
|
217
|
-
return [];
|
|
218
|
-
}
|
|
219
|
-
const query = Query2.fromAst(JSON.parse(JSON.stringify(viewSnapshot.query.ast)));
|
|
220
|
-
const queryTarget = space ? getQueryTarget(query.ast, space) : void 0;
|
|
221
|
-
if (!queryTarget) {
|
|
222
|
-
return [];
|
|
223
|
-
}
|
|
224
|
-
const raw = get(AtomQuery.make(queryTarget, query));
|
|
225
|
-
return isSpace(queryTarget) ? raw : [
|
|
226
|
-
...raw
|
|
227
|
-
].reverse();
|
|
228
|
-
}));
|
|
229
|
-
return {
|
|
230
|
-
getColumnId: (data) => data.view.dxn.toString(),
|
|
231
|
-
getItemId: (data) => data.id,
|
|
232
|
-
isColumn: (obj) => Schema.is(Pipeline.Column)(obj),
|
|
233
|
-
isItem: (obj) => Obj3.isObject(obj),
|
|
234
|
-
columns: columnsAtom,
|
|
235
|
-
items: (column) => itemsAtomFamily(column.view.dxn.toString()),
|
|
236
|
-
getColumns: () => [
|
|
237
|
-
...registry.get(columnsAtom)
|
|
238
|
-
],
|
|
239
|
-
getItems: (column) => registry.get(itemsAtomFamily(column.view.dxn.toString())) ?? []
|
|
240
|
-
};
|
|
241
|
-
}, [
|
|
242
|
-
pipeline,
|
|
243
|
-
registry
|
|
244
|
-
]);
|
|
245
|
-
var emptyColumnsAtom = Atom.make(() => []);
|
|
246
|
-
var emptyItemsAtom = Atom.make(() => []);
|
|
247
|
-
var emptyPipelineModel = {
|
|
248
|
-
getColumnId: (data) => data.view.dxn.toString(),
|
|
249
|
-
getItemId: (data) => data.id,
|
|
250
|
-
isColumn: (obj) => Schema.is(Pipeline.Column)(obj),
|
|
251
|
-
isItem: (obj) => Obj3.isObject(obj),
|
|
252
|
-
columns: emptyColumnsAtom,
|
|
253
|
-
items: () => emptyItemsAtom,
|
|
254
|
-
getColumns: () => [],
|
|
255
|
-
getItems: () => []
|
|
256
|
-
};
|
|
257
|
-
|
|
258
|
-
// src/containers/PipelineContainer/PipelineContainer.tsx
|
|
259
|
-
var PIPELINE_ITEM = "PipelineItem";
|
|
260
|
-
var PipelineContainer = ({ role, subject: pipeline, attendableId }) => {
|
|
261
|
-
const registry = useCapability(Capabilities.AtomRegistry);
|
|
262
|
-
const model = usePipelineBoardModel(pipeline, registry);
|
|
263
|
-
const { invokePromise } = useOperationInvoker();
|
|
264
|
-
const { hasAttention } = useAttention(attendableId);
|
|
265
|
-
const handleColumnAdd = useCallback(() => invokePromise(DeckOperation.ChangeCompanion, {
|
|
266
|
-
companion: `${COMPANION_PREFIX}settings`
|
|
267
|
-
}), [
|
|
268
|
-
invokePromise
|
|
269
|
-
]);
|
|
270
|
-
return /* @__PURE__ */ React3.createElement(PipelineComponent.Root, {
|
|
271
|
-
Item: PipelineItem,
|
|
272
|
-
onAddColumn: handleColumnAdd
|
|
273
|
-
}, /* @__PURE__ */ React3.createElement(Panel.Root, {
|
|
274
|
-
role,
|
|
275
|
-
className: "dx-article"
|
|
276
|
-
}, /* @__PURE__ */ React3.createElement(Panel.Toolbar, {
|
|
277
|
-
asChild: true
|
|
278
|
-
}, /* @__PURE__ */ React3.createElement(PipelineComponent.Toolbar, {
|
|
279
|
-
disabled: !hasAttention
|
|
280
|
-
})), /* @__PURE__ */ React3.createElement(Panel.Content, {
|
|
281
|
-
asChild: true
|
|
282
|
-
}, /* @__PURE__ */ React3.createElement(PipelineComponent.Content, {
|
|
283
|
-
model
|
|
284
|
-
}, /* @__PURE__ */ React3.createElement(PipelineComponent.Columns, {
|
|
285
|
-
pipeline
|
|
286
|
-
})))));
|
|
287
|
-
};
|
|
288
|
-
var PipelineItem = ({ item, projectionModel }) => {
|
|
289
|
-
const menu = useMenu(PIPELINE_ITEM);
|
|
290
|
-
const items = useObjectMenuItems(item);
|
|
291
|
-
useEffect(() => {
|
|
292
|
-
menu.addMenuItems({
|
|
293
|
-
id: OBJECT_ACTIONS_CONTRIBUTION_ID,
|
|
294
|
-
mode: "additive",
|
|
295
|
-
priority: OBJECT_ACTIONS_CONTRIBUTION_PRIORITY,
|
|
296
|
-
items
|
|
297
|
-
});
|
|
298
|
-
return () => menu.removeMenuItems(OBJECT_ACTIONS_CONTRIBUTION_ID);
|
|
299
|
-
}, [
|
|
300
|
-
menu,
|
|
301
|
-
items
|
|
302
|
-
]);
|
|
303
|
-
return /* @__PURE__ */ React3.createElement(Surface.Surface, {
|
|
304
|
-
role: "card--content",
|
|
305
|
-
data: {
|
|
306
|
-
subject: item,
|
|
307
|
-
projection: projectionModel
|
|
308
|
-
},
|
|
309
|
-
limit: 1
|
|
310
|
-
});
|
|
311
|
-
};
|
|
312
|
-
|
|
313
|
-
// src/containers/PipelineContainer/index.ts
|
|
314
|
-
var PipelineContainer_default = PipelineContainer;
|
|
315
|
-
export {
|
|
316
|
-
PipelineContainer_default as default
|
|
317
|
-
};
|
|
318
|
-
//# sourceMappingURL=PipelineContainer-FAOVECDX.mjs.map
|