@dxos/plugin-pipeline 0.8.4-main.7996785055 → 0.8.4-main.abd8ff62ef

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.
Files changed (85) hide show
  1. package/dist/lib/browser/index.mjs +19 -82
  2. package/dist/lib/browser/index.mjs.map +4 -4
  3. package/dist/lib/browser/meta.json +1 -1
  4. package/dist/lib/browser/translations.mjs +38 -0
  5. package/dist/lib/browser/translations.mjs.map +7 -0
  6. package/dist/types/src/PipelinePlugin.d.ts +1 -0
  7. package/dist/types/src/PipelinePlugin.d.ts.map +1 -1
  8. package/dist/types/src/PipelinePlugin.node.d.ts +4 -0
  9. package/dist/types/src/PipelinePlugin.node.d.ts.map +1 -0
  10. package/dist/types/src/PipelinePlugin.test.d.ts +2 -0
  11. package/dist/types/src/PipelinePlugin.test.d.ts.map +1 -0
  12. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
  13. package/dist/types/src/capabilities/index.d.ts +3 -2
  14. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  15. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
  16. package/dist/types/src/components/PipelineComponent/PipelineColumn.d.ts +4 -4
  17. package/dist/types/src/components/PipelineComponent/PipelineColumn.d.ts.map +1 -1
  18. package/dist/types/src/components/PipelineComponent/PipelineComponent.d.ts +8 -20
  19. package/dist/types/src/components/PipelineComponent/PipelineComponent.d.ts.map +1 -1
  20. package/dist/types/src/components/PipelineComponent/PipelineComponent.stories.d.ts +44 -25
  21. package/dist/types/src/components/PipelineComponent/PipelineComponent.stories.d.ts.map +1 -1
  22. package/dist/types/src/containers/PipelineContainer/PipelineContainer.d.ts +2 -2
  23. package/dist/types/src/containers/PipelineContainer/PipelineContainer.d.ts.map +1 -1
  24. package/dist/types/src/containers/PipelineContainer/PipelineContainer.stories.d.ts +52 -33
  25. package/dist/types/src/containers/PipelineContainer/PipelineContainer.stories.d.ts.map +1 -1
  26. package/dist/types/src/containers/PipelineContainer/index.d.ts +1 -2
  27. package/dist/types/src/containers/PipelineContainer/index.d.ts.map +1 -1
  28. package/dist/types/src/containers/PipelineProperties/PipelineProperties.d.ts +11 -0
  29. package/dist/types/src/containers/PipelineProperties/PipelineProperties.d.ts.map +1 -0
  30. package/dist/types/src/containers/PipelineProperties/index.d.ts +2 -0
  31. package/dist/types/src/containers/PipelineProperties/index.d.ts.map +1 -0
  32. package/dist/types/src/containers/index.d.ts +1 -1
  33. package/dist/types/src/containers/index.d.ts.map +1 -1
  34. package/dist/types/src/hooks/usePipelineBoardModel.d.ts.map +1 -1
  35. package/dist/types/src/index.d.ts +2 -1
  36. package/dist/types/src/index.d.ts.map +1 -1
  37. package/dist/types/src/templates/research.d.ts.map +1 -1
  38. package/dist/types/src/translations.d.ts +44 -26
  39. package/dist/types/src/translations.d.ts.map +1 -1
  40. package/dist/types/tsconfig.tsbuildinfo +1 -1
  41. package/package.json +61 -49
  42. package/src/PipelinePlugin.node.ts +44 -0
  43. package/src/PipelinePlugin.test.ts +27 -0
  44. package/src/PipelinePlugin.tsx +7 -5
  45. package/src/capabilities/app-graph-builder.ts +40 -0
  46. package/src/capabilities/index.ts +4 -2
  47. package/src/capabilities/{react-surface/react-surface.tsx → react-surface.tsx} +12 -14
  48. package/src/components/PipelineComponent/PipelineColumn.tsx +4 -4
  49. package/src/components/PipelineComponent/PipelineComponent.stories.tsx +16 -16
  50. package/src/components/PipelineComponent/PipelineComponent.tsx +4 -4
  51. package/src/containers/PipelineContainer/PipelineContainer.stories.tsx +23 -23
  52. package/src/containers/PipelineContainer/PipelineContainer.tsx +10 -12
  53. package/src/containers/PipelineContainer/index.ts +1 -3
  54. package/src/containers/{PipelineObjectSettings/PipelineObjectSettings.tsx → PipelineProperties/PipelineProperties.tsx} +10 -11
  55. package/src/containers/PipelineProperties/index.ts +5 -0
  56. package/src/containers/index.ts +1 -1
  57. package/src/hooks/usePipelineBoardModel.ts +1 -1
  58. package/src/index.ts +6 -1
  59. package/src/translations.ts +22 -22
  60. package/dist/lib/browser/PipelineContainer-LY2P4JPA.mjs +0 -345
  61. package/dist/lib/browser/PipelineContainer-LY2P4JPA.mjs.map +0 -7
  62. package/dist/lib/browser/PipelineObjectSettings-QFMIKJH5.mjs +0 -220
  63. package/dist/lib/browser/PipelineObjectSettings-QFMIKJH5.mjs.map +0 -7
  64. package/dist/lib/browser/app-graph-builder-QQKBLYFD.mjs +0 -56
  65. package/dist/lib/browser/app-graph-builder-QQKBLYFD.mjs.map +0 -7
  66. package/dist/lib/browser/chunk-3A235GUD.mjs +0 -21
  67. package/dist/lib/browser/chunk-3A235GUD.mjs.map +0 -7
  68. package/dist/lib/browser/react-surface-QVPKOGEI.mjs +0 -61
  69. package/dist/lib/browser/react-surface-QVPKOGEI.mjs.map +0 -7
  70. package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +0 -1
  71. package/dist/types/src/capabilities/app-graph-builder/index.d.ts +0 -3
  72. package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +0 -1
  73. package/dist/types/src/capabilities/react-surface/index.d.ts +0 -3
  74. package/dist/types/src/capabilities/react-surface/index.d.ts.map +0 -1
  75. package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +0 -1
  76. package/dist/types/src/containers/PipelineObjectSettings/PipelineObjectSettings.d.ts +0 -11
  77. package/dist/types/src/containers/PipelineObjectSettings/PipelineObjectSettings.d.ts.map +0 -1
  78. package/dist/types/src/containers/PipelineObjectSettings/index.d.ts +0 -3
  79. package/dist/types/src/containers/PipelineObjectSettings/index.d.ts.map +0 -1
  80. package/src/capabilities/app-graph-builder/app-graph-builder.ts +0 -49
  81. package/src/capabilities/app-graph-builder/index.ts +0 -7
  82. package/src/capabilities/react-surface/index.ts +0 -7
  83. package/src/containers/PipelineObjectSettings/index.ts +0 -7
  84. /package/dist/types/src/capabilities/{app-graph-builder/app-graph-builder.d.ts → app-graph-builder.d.ts} +0 -0
  85. /package/dist/types/src/capabilities/{react-surface/react-surface.d.ts → react-surface.d.ts} +0 -0
@@ -5,28 +5,26 @@
5
5
  import React, { useCallback, useEffect } from 'react';
6
6
 
7
7
  import { Capabilities } from '@dxos/app-framework';
8
- import { useCapability } from '@dxos/app-framework/ui';
9
- import { useOperationInvoker } from '@dxos/app-framework/ui';
10
- import { Surface } from '@dxos/app-framework/ui';
8
+ import { Surface, useCapability, useOperationInvoker } from '@dxos/app-framework/ui';
9
+ import { LayoutOperation } from '@dxos/app-toolkit';
11
10
  import {
11
+ AppSurface,
12
12
  OBJECT_ACTIONS_CONTRIBUTION_ID,
13
13
  OBJECT_ACTIONS_CONTRIBUTION_PRIORITY,
14
- type SurfaceComponentProps,
15
14
  useObjectMenuItems,
16
15
  } from '@dxos/app-toolkit/ui';
17
- import { companionSegment } from '@dxos/app-toolkit';
18
- import { DeckOperation } from '@dxos/plugin-deck/operations';
19
16
  import { Panel } from '@dxos/react-ui';
17
+ import { linkedSegment } from '@dxos/react-ui-attention';
20
18
  import { useAttention } from '@dxos/react-ui-attention';
21
19
  import { useMenu } from '@dxos/react-ui-menu';
22
20
  import { type Pipeline } from '@dxos/types';
23
21
 
24
- import { type ItemProps, PipelineComponent } from '../../components';
25
- import { usePipelineBoardModel } from '../../hooks';
22
+ import { type ItemProps, PipelineComponent } from '#components';
23
+ import { usePipelineBoardModel } from '#hooks';
26
24
 
27
25
  const PIPELINE_ITEM = 'PipelineItem';
28
26
 
29
- export type PipelineContainerProps = SurfaceComponentProps<Pipeline.Pipeline>;
27
+ export type PipelineContainerProps = AppSurface.ObjectArticleProps<Pipeline.Pipeline>;
30
28
 
31
29
  export const PipelineContainer = ({ role, subject: pipeline, attendableId }: PipelineContainerProps) => {
32
30
  const registry = useCapability(Capabilities.AtomRegistry);
@@ -36,8 +34,8 @@ export const PipelineContainer = ({ role, subject: pipeline, attendableId }: Pip
36
34
 
37
35
  const handleColumnAdd = useCallback(
38
36
  () =>
39
- invokePromise(DeckOperation.ChangeCompanion, {
40
- companion: companionSegment('settings'),
37
+ invokePromise(LayoutOperation.UpdateCompanion, {
38
+ subject: linkedSegment('settings'),
41
39
  }),
42
40
  [invokePromise],
43
41
  );
@@ -75,7 +73,7 @@ const PipelineItem = ({ item, projectionModel }: ItemProps) => {
75
73
 
76
74
  return (
77
75
  <Surface.Surface
78
- role='card--content'
76
+ type={AppSurface.Card}
79
77
  data={{
80
78
  subject: item,
81
79
  projection: projectionModel,
@@ -2,6 +2,4 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import { PipelineContainer } from './PipelineContainer';
6
-
7
- export default PipelineContainer;
5
+ export { PipelineContainer as default } from './PipelineContainer';
@@ -5,10 +5,10 @@
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 { useTypeOptions } from '@dxos/plugin-space';
11
- import { resolveSchemaWithRegistry } from '@dxos/plugin-space';
12
12
  import { getSpace, 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';
@@ -18,22 +18,21 @@ import { Pipeline } from '@dxos/types';
18
18
  import { mx, osTranslations, subtleHover } from '@dxos/ui-theme';
19
19
  import { arrayMove } from '@dxos/util';
20
20
 
21
- import { meta } from '../../meta';
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
- // TODO(burdon): Standardize Object/Plugin settings.
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 PipelineObjectSettings = ({ classNames, pipeline }: PipelineObjectSettingsProps) => {
35
+ export const PipelineProperties = ({ classNames, pipeline }: PipelinePropertiesProps) => {
37
36
  const { t } = useTranslation(meta.id);
38
37
  const space = getSpace(pipeline);
39
38
  const [expandedId, setExpandedId] = useState<string>();
@@ -162,7 +161,7 @@ export const PipelineObjectSettings = ({ classNames, pipeline }: PipelineObjectS
162
161
 
163
162
  return (
164
163
  <div role='none' className={mx('py-form-padding overflow-y-auto', classNames)}>
165
- <h2 className='text-sm text-description py-1'>{t('views label')}</h2>
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}
@@ -183,10 +182,10 @@ export const PipelineObjectSettings = ({ classNames, pipeline }: PipelineObjectS
183
182
  <div role='none' className={mx(subtleHover, listItemGrid, 'rounded-xs cursor-pointer min-h-10')}>
184
183
  <List.ItemDragHandle />
185
184
  <List.ItemTitle onClick={() => handleToggleField(column)}>
186
- {column.name || t('untitled view title')}
185
+ {column.name || t('untitled-view.title')}
187
186
  </List.ItemTitle>
188
187
  <List.ItemDeleteButton
189
- label={t('delete view label')}
188
+ label={t('delete-view.label')}
190
189
  autoHide={false}
191
190
  onClick={() => handleDelete(column)}
192
191
  data-testid='view.delete'
@@ -194,7 +193,7 @@ export const PipelineObjectSettings = ({ classNames, pipeline }: PipelineObjectS
194
193
  <IconButton
195
194
  iconOnly
196
195
  variant='ghost'
197
- label={t('toggle expand label', { ns: osTranslations })}
196
+ label={t('toggle-expand.label', { ns: osTranslations })}
198
197
  icon={
199
198
  expandedId === column.view.dxn.toString()
200
199
  ? 'ph--caret-down--regular'
@@ -236,7 +235,7 @@ export const PipelineObjectSettings = ({ classNames, pipeline }: PipelineObjectS
236
235
  </List.Root>
237
236
 
238
237
  <div role='none' className='my-form-padding'>
239
- <IconButton icon='ph--plus--regular' label={t('add view label')} onClick={handleAdd} classNames='w-full' />
238
+ <IconButton icon='ph--plus--regular' label={t('add-view.label')} onClick={handleAdd} classNames='w-full' />
240
239
  </div>
241
240
  </div>
242
241
  );
@@ -0,0 +1,5 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ export { PipelineProperties as default } from './PipelineProperties';
@@ -5,4 +5,4 @@
5
5
  import { type ComponentType, lazy } from 'react';
6
6
 
7
7
  export const PipelineContainer: ComponentType<any> = lazy(() => import('./PipelineContainer'));
8
- export const PipelineObjectSettings: ComponentType<any> = lazy(() => import('./PipelineObjectSettings'));
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
@@ -2,5 +2,10 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
+ import { Plugin } from '@dxos/app-framework';
6
+
7
+ import { meta } from './meta';
8
+
9
+ export const PipelinePlugin = Plugin.lazy(meta, () => import('#plugin'));
10
+
5
11
  export * from './meta';
6
- export * from './PipelinePlugin';
@@ -4,35 +4,35 @@ import { Pipeline } from '@dxos/types';
4
4
  // Copyright 2023 DXOS.org
5
5
  //
6
6
 
7
- import { meta } from './meta';
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 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',
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 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',
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,345 +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 { companionSegment } from "@dxos/app-toolkit";
13
- import { DeckOperation } from "@dxos/plugin-deck/operations";
14
- import { Panel as Panel2 } 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 * as Function from "effect/Function";
21
- import * as Option from "effect/Option";
22
- import React2, { forwardRef, useMemo, useRef, useState } from "react";
23
- import { Annotation, JsonSchema, Obj as Obj2, Query, Type } from "@dxos/echo";
24
- import { resolveSchemaWithRegistry } from "@dxos/plugin-space";
25
- import { Filter, getSpace, useObject } from "@dxos/react-client/echo";
26
- import { Panel, Toolbar as Toolbar2, useAsyncEffect, useTranslation as useTranslation2 } from "@dxos/react-ui";
27
- import { Card } from "@dxos/react-ui";
28
- import { Board as Board2, Focus, Mosaic } from "@dxos/react-ui-mosaic";
29
- import { ProjectionModel, createEchoChangeCallback } from "@dxos/schema";
30
-
31
- // src/components/PipelineComponent/PipelineComponent.tsx
32
- import { useAtomValue } from "@effect-atom/atom-react";
33
- import { createContext } from "@radix-ui/react-context";
34
- import { Slot } from "@radix-ui/react-slot";
35
- import React from "react";
36
- import { Obj } from "@dxos/echo";
37
- import { Toolbar, useTranslation } from "@dxos/react-ui";
38
- import { Board, useBoard, useEventHandlerAdapter } from "@dxos/react-ui-mosaic";
39
- import { composable, composableProps, slottable } from "@dxos/ui-theme";
40
- var itemNoOp = ({ item }) => /* @__PURE__ */ React.createElement("span", null, item.id);
41
- var PIPELINE_ROOT = "Pipeline.Root";
42
- var [PipelineRootContext, usePipeline] = createContext(PIPELINE_ROOT, {
43
- Item: itemNoOp
44
- });
45
- var PipelineRoot = ({ children, ...contextValue }) => /* @__PURE__ */ React.createElement(PipelineRootContext, contextValue, children);
46
- PipelineRoot.displayName = PIPELINE_ROOT;
47
- var PIPELINE_CONTENT_NAME = "Pipeline.Content";
48
- var PipelineContent = slottable(({ asChild, model, children, ...props }, forwardedRef) => {
49
- const Comp = asChild ? Slot : "div";
50
- return /* @__PURE__ */ React.createElement(Board.Root, {
51
- model
52
- }, /* @__PURE__ */ React.createElement(Comp, {
53
- ...composableProps(props, {
54
- role: "none"
55
- }),
56
- ref: forwardedRef
57
- }, children));
58
- });
59
- PipelineContent.displayName = PIPELINE_CONTENT_NAME;
60
- var PIPELINE_COLUMNS_NAME = "Pipeline.Columns";
61
- var PipelineColumns = composable(({ pipeline, ...props }) => {
62
- const { model } = useBoard(PIPELINE_COLUMNS_NAME);
63
- const columns = useAtomValue(model.columns);
64
- const eventHandler = useEventHandlerAdapter({
65
- id: pipeline.id,
66
- // TODO(wittjosiah): Cast because columns array is readonly.
67
- items: columns,
68
- getId: model.getColumnId,
69
- get: (data) => data,
70
- make: (object) => object,
71
- canDrop: ({ source }) => model.isColumn(source.data),
72
- onChange: (mutate) => Obj.change(pipeline, (obj) => mutate(obj.columns))
73
- });
74
- return /* @__PURE__ */ React.createElement(Board.Content, {
75
- ...props,
76
- id: "pipeline",
77
- eventHandler,
78
- Tile: PipelineColumn
79
- });
80
- });
81
- PipelineColumns.displayName = PIPELINE_COLUMNS_NAME;
82
- var PIPELINE_TOOLBAR_NAME = "Pipeline.Toolbar";
83
- var PipelineToolbar = composable(({ children, ...props }, forwardedRef) => {
84
- const { t } = useTranslation(meta.id);
85
- const { onAddColumn } = usePipeline(PIPELINE_TOOLBAR_NAME);
86
- return /* @__PURE__ */ React.createElement(Toolbar.Root, {
87
- ...composableProps(props),
88
- ref: forwardedRef
89
- }, /* @__PURE__ */ React.createElement(Toolbar.IconButton, {
90
- icon: "ph--plus--regular",
91
- iconOnly: true,
92
- label: t("add column label"),
93
- onClick: onAddColumn
94
- }));
95
- });
96
- PipelineToolbar.displayName = PIPELINE_TOOLBAR_NAME;
97
- var PipelineComponent = {
98
- Root: PipelineRoot,
99
- Content: PipelineContent,
100
- Columns: PipelineColumns,
101
- Toolbar: PipelineToolbar
102
- };
103
-
104
- // src/components/PipelineComponent/PipelineColumn.tsx
105
- import { Menu } from "@dxos/react-ui-menu";
106
- var PIPELINE_COLUMN_NAME = "PipelineColumn";
107
- var PipelineColumn = ({ data: column, location, classNames, debug }) => {
108
- const { t } = useTranslation2(meta.id);
109
- const dragHandleRef = useRef(null);
110
- const [viewSnapshot] = useObject(column.view);
111
- const view = column.view.target;
112
- const space = getSpace(view);
113
- const { Item } = usePipeline(PIPELINE_COLUMN_NAME);
114
- const [schema, setSchema] = useState();
115
- const query = useMemo(() => {
116
- if (!view) {
117
- return Query.select(Filter.nothing());
118
- } else {
119
- return Query.fromAst(JSON.parse(JSON.stringify(viewSnapshot?.query.ast)));
120
- }
121
- }, [
122
- JSON.stringify(viewSnapshot?.query.ast)
123
- ]);
124
- useAsyncEffect(async () => {
125
- if (!query || !space?.db) {
126
- return;
127
- }
128
- const schema2 = await resolveSchemaWithRegistry(space.db.schemaRegistry, query.ast);
129
- setSchema(() => schema2);
130
- }, [
131
- space,
132
- query
133
- ]);
134
- const projectionModel = useMemo(() => {
135
- if (!schema || !view) {
136
- return void 0;
137
- }
138
- const jsonSchema = Type.isMutable(schema) ? schema.jsonSchema : JsonSchema.toJsonSchema(schema);
139
- const change = createEchoChangeCallback(view, Type.isMutable(schema) ? schema : void 0);
140
- return new ProjectionModel({
141
- view,
142
- baseSchema: jsonSchema,
143
- change
144
- });
145
- }, [
146
- schema,
147
- view
148
- ]);
149
- const PipelineTile = useMemo(() => {
150
- return /* @__PURE__ */ forwardRef((props, ref) => /* @__PURE__ */ React2.createElement(ItemTile, {
151
- ...props,
152
- itemProps: {
153
- item: props.data,
154
- projectionModel
155
- },
156
- ref
157
- }));
158
- }, [
159
- projectionModel
160
- ]);
161
- if (!view) {
162
- return null;
163
- }
164
- return /* @__PURE__ */ React2.createElement(Panel.Root, {
165
- asChild: true
166
- }, /* @__PURE__ */ React2.createElement(Board2.Column.Root, {
167
- debug,
168
- data: column,
169
- location,
170
- classNames,
171
- dragHandleRef
172
- }, /* @__PURE__ */ React2.createElement(Panel.Toolbar, {
173
- asChild: true
174
- }, /* @__PURE__ */ React2.createElement(Board2.Column.Header, {
175
- classNames: "_opacity-10",
176
- label: column.name || t("untitled view title"),
177
- dragHandleRef
178
- })), /* @__PURE__ */ React2.createElement(Panel.Content, {
179
- asChild: true
180
- }, /* @__PURE__ */ React2.createElement(Board2.Column.Body, {
181
- data: column,
182
- Tile: PipelineTile
183
- }))));
184
- };
185
- PipelineColumn.displayName = PIPELINE_COLUMN_NAME;
186
- var ITEM_TILE_NAME = "ItemTile";
187
- var ItemTile = /* @__PURE__ */ forwardRef(({ classNames, data, location, debug, itemProps }, forwardedRef) => {
188
- const rootRef = useRef(null);
189
- const composedRef = useComposedRefs(rootRef, forwardedRef);
190
- const { Item } = usePipeline(ITEM_TILE_NAME);
191
- const icon = Function.pipe(Obj2.getSchema(data), Option.fromNullable, Option.flatMap(Annotation.IconAnnotation.get), Option.map(({ icon: icon2 }) => icon2), Option.getOrElse(() => "ph--placeholder--regular"));
192
- return /* @__PURE__ */ React2.createElement(Menu.Root, null, /* @__PURE__ */ React2.createElement(Mosaic.Tile, {
193
- asChild: true,
194
- id: data.id,
195
- data,
196
- location,
197
- debug
198
- }, /* @__PURE__ */ React2.createElement(Focus.Item, {
199
- asChild: true
200
- }, /* @__PURE__ */ React2.createElement(Card.Root, {
201
- classNames,
202
- ref: composedRef
203
- }, /* @__PURE__ */ React2.createElement(Card.Toolbar, null, /* @__PURE__ */ React2.createElement(Card.Icon, {
204
- icon
205
- }), /* @__PURE__ */ React2.createElement(Card.Title, null, Obj2.getLabel(data)), /* @__PURE__ */ React2.createElement(Card.IconBlock, {
206
- padding: true
207
- }, /* @__PURE__ */ React2.createElement(Menu.Trigger, {
208
- asChild: true
209
- }, /* @__PURE__ */ React2.createElement(Toolbar2.IconButton, {
210
- iconOnly: true,
211
- variant: "ghost",
212
- icon: "ph--dots-three-vertical--regular",
213
- label: "Actions"
214
- })), /* @__PURE__ */ React2.createElement(Menu.Content, null))), /* @__PURE__ */ React2.createElement(Card.Content, null, /* @__PURE__ */ React2.createElement(Item, itemProps))))));
215
- });
216
- ItemTile.displayName = ITEM_TILE_NAME;
217
-
218
- // src/hooks/usePipelineBoardModel.ts
219
- import { Atom } from "@effect-atom/atom-react";
220
- import * as Schema from "effect/Schema";
221
- import { useMemo as useMemo2 } from "react";
222
- import { Obj as Obj3, Query as Query2 } from "@dxos/echo";
223
- import { AtomObj, AtomQuery } from "@dxos/echo-atom";
224
- import { getQueryTarget } from "@dxos/plugin-space";
225
- import { getSpace as getSpace2, isSpace } from "@dxos/react-client/echo";
226
- import { Pipeline } from "@dxos/types";
227
- var usePipelineBoardModel = (pipeline, registry) => useMemo2(() => {
228
- if (pipeline == null) {
229
- return emptyPipelineModel;
230
- }
231
- const space = getSpace2(pipeline);
232
- const columnsAtom = AtomObj.makeProperty(pipeline, "columns");
233
- const columnAtomFamily = Atom.family((viewKey) => Atom.make((get) => {
234
- const columns = get(columnsAtom);
235
- return columns.find((c) => c.view.dxn.toString() === viewKey);
236
- }));
237
- const itemsAtomFamily = Atom.family((viewKey) => Atom.make((get) => {
238
- const column = get(columnAtomFamily(viewKey));
239
- if (column == null) {
240
- return [];
241
- }
242
- const viewSnapshot = get(AtomObj.make(column.view));
243
- if (!viewSnapshot?.query?.ast) {
244
- return [];
245
- }
246
- const query = Query2.fromAst(JSON.parse(JSON.stringify(viewSnapshot.query.ast)));
247
- const queryTarget = space ? getQueryTarget(query.ast, space) : void 0;
248
- if (!queryTarget) {
249
- return [];
250
- }
251
- const raw = get(AtomQuery.make(queryTarget, query));
252
- return isSpace(queryTarget) ? raw : [
253
- ...raw
254
- ].reverse();
255
- }));
256
- return {
257
- getColumnId: (data) => data.view.dxn.toString(),
258
- getItemId: (data) => data.id,
259
- isColumn: (obj) => Schema.is(Pipeline.Column)(obj),
260
- isItem: (obj) => Obj3.isObject(obj),
261
- columns: columnsAtom,
262
- items: (column) => itemsAtomFamily(column.view.dxn.toString()),
263
- getColumns: () => [
264
- ...registry.get(columnsAtom)
265
- ],
266
- getItems: (column) => registry.get(itemsAtomFamily(column.view.dxn.toString())) ?? []
267
- };
268
- }, [
269
- pipeline,
270
- registry
271
- ]);
272
- var emptyColumnsAtom = Atom.make(() => []);
273
- var emptyItemsAtom = Atom.make(() => []);
274
- var emptyPipelineModel = {
275
- getColumnId: (data) => data.view.dxn.toString(),
276
- getItemId: (data) => data.id,
277
- isColumn: (obj) => Schema.is(Pipeline.Column)(obj),
278
- isItem: (obj) => Obj3.isObject(obj),
279
- columns: emptyColumnsAtom,
280
- items: () => emptyItemsAtom,
281
- getColumns: () => [],
282
- getItems: () => []
283
- };
284
-
285
- // src/containers/PipelineContainer/PipelineContainer.tsx
286
- var PIPELINE_ITEM = "PipelineItem";
287
- var PipelineContainer = ({ role, subject: pipeline, attendableId }) => {
288
- const registry = useCapability(Capabilities.AtomRegistry);
289
- const model = usePipelineBoardModel(pipeline, registry);
290
- const { invokePromise } = useOperationInvoker();
291
- const { hasAttention } = useAttention(attendableId);
292
- const handleColumnAdd = useCallback(() => invokePromise(DeckOperation.ChangeCompanion, {
293
- companion: companionSegment("settings")
294
- }), [
295
- invokePromise
296
- ]);
297
- return /* @__PURE__ */ React3.createElement(PipelineComponent.Root, {
298
- Item: PipelineItem,
299
- onAddColumn: handleColumnAdd
300
- }, /* @__PURE__ */ React3.createElement(Panel2.Root, {
301
- role
302
- }, /* @__PURE__ */ React3.createElement(Panel2.Toolbar, {
303
- asChild: true
304
- }, /* @__PURE__ */ React3.createElement(PipelineComponent.Toolbar, {
305
- disabled: !hasAttention
306
- })), /* @__PURE__ */ React3.createElement(Panel2.Content, {
307
- asChild: true
308
- }, /* @__PURE__ */ React3.createElement(PipelineComponent.Content, {
309
- asChild: true,
310
- model
311
- }, /* @__PURE__ */ React3.createElement(PipelineComponent.Columns, {
312
- pipeline
313
- })))));
314
- };
315
- var PipelineItem = ({ item, projectionModel }) => {
316
- const menu = useMenu(PIPELINE_ITEM);
317
- const items = useObjectMenuItems(item);
318
- useEffect(() => {
319
- menu.addMenuItems({
320
- id: OBJECT_ACTIONS_CONTRIBUTION_ID,
321
- mode: "additive",
322
- priority: OBJECT_ACTIONS_CONTRIBUTION_PRIORITY,
323
- items
324
- });
325
- return () => menu.removeMenuItems(OBJECT_ACTIONS_CONTRIBUTION_ID);
326
- }, [
327
- menu,
328
- items
329
- ]);
330
- return /* @__PURE__ */ React3.createElement(Surface.Surface, {
331
- role: "card--content",
332
- data: {
333
- subject: item,
334
- projection: projectionModel
335
- },
336
- limit: 1
337
- });
338
- };
339
-
340
- // src/containers/PipelineContainer/index.ts
341
- var PipelineContainer_default = PipelineContainer;
342
- export {
343
- PipelineContainer_default as default
344
- };
345
- //# sourceMappingURL=PipelineContainer-LY2P4JPA.mjs.map