@dxos/plugin-kanban 0.8.4-main.2e9d522 → 0.8.4-main.5ea62a8
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/browser/blueprint-definition-GFG7LX2C.mjs +28 -0
- package/dist/lib/browser/blueprint-definition-GFG7LX2C.mjs.map +7 -0
- package/dist/lib/browser/{chunk-X44RHBZK.mjs → chunk-NCNNL74W.mjs} +3 -29
- package/dist/lib/browser/chunk-NCNNL74W.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +13 -12
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/{intent-resolver-E6O3LBAB.mjs → intent-resolver-2IYZ7TZE.mjs} +9 -9
- package/dist/lib/browser/intent-resolver-2IYZ7TZE.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-MWNNZYMN.mjs → react-surface-XRHHQ4OI.mjs} +13 -14
- package/dist/lib/browser/react-surface-XRHHQ4OI.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +3 -5
- package/dist/lib/node-esm/blueprint-definition-MIMDXMUM.mjs +30 -0
- package/dist/lib/node-esm/blueprint-definition-MIMDXMUM.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-6WK5CGYY.mjs → chunk-5B3LKGA7.mjs} +3 -29
- package/dist/lib/node-esm/chunk-5B3LKGA7.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +13 -12
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/{intent-resolver-LPASDELU.mjs → intent-resolver-T7CEL6EN.mjs} +9 -9
- package/dist/lib/node-esm/intent-resolver-T7CEL6EN.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-surface-T52BBG45.mjs → react-surface-BTB5JAKG.mjs} +13 -14
- package/dist/lib/node-esm/react-surface-BTB5JAKG.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +3 -5
- package/dist/types/src/KanbanPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/artifact-definition.d.ts +1 -1
- package/dist/types/src/capabilities/artifact-definition.d.ts.map +1 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts +5 -0
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +3 -3
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts +1 -1
- package/dist/types/src/components/KanbanContainer.d.ts.map +1 -1
- package/dist/types/src/components/KanbanContainer.stories.d.ts +36 -5
- package/dist/types/src/components/KanbanContainer.stories.d.ts.map +1 -1
- package/dist/types/src/components/KanbanViewEditor.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +2 -2
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/index.d.ts +0 -1
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/schema.d.ts +23 -33
- package/dist/types/src/types/schema.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +36 -33
- package/src/KanbanPlugin.tsx +8 -7
- package/src/capabilities/artifact-definition.ts +7 -4
- package/src/capabilities/blueprint-definition.ts +30 -0
- package/src/capabilities/index.ts +1 -1
- package/src/capabilities/intent-resolver.ts +5 -4
- package/src/capabilities/react-surface.tsx +4 -4
- package/src/components/KanbanContainer.stories.tsx +12 -12
- package/src/components/KanbanContainer.tsx +3 -3
- package/src/components/KanbanViewEditor.tsx +9 -7
- package/src/translations.ts +2 -2
- package/src/types/index.ts +0 -1
- package/src/types/schema.ts +2 -2
- package/dist/lib/browser/artifact-definition-WMSZK3RW.mjs +0 -174
- package/dist/lib/browser/artifact-definition-WMSZK3RW.mjs.map +0 -7
- package/dist/lib/browser/chunk-X44RHBZK.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-E6O3LBAB.mjs.map +0 -7
- package/dist/lib/browser/react-surface-MWNNZYMN.mjs.map +0 -7
- package/dist/lib/node-esm/artifact-definition-QVZXPDXK.mjs +0 -175
- package/dist/lib/node-esm/artifact-definition-QVZXPDXK.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-6WK5CGYY.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-LPASDELU.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-T52BBG45.mjs.map +0 -7
- package/dist/types/src/types/kanban.d.ts +0 -11
- package/dist/types/src/types/kanban.d.ts.map +0 -1
- package/src/types/kanban.ts +0 -29
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-kanban",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.5ea62a8",
|
|
4
4
|
"description": "Kanban DXOS Surface plugin",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -10,11 +10,13 @@
|
|
|
10
10
|
"type": "module",
|
|
11
11
|
"exports": {
|
|
12
12
|
".": {
|
|
13
|
+
"source": "./src/index.ts",
|
|
13
14
|
"types": "./dist/types/src/index.d.ts",
|
|
14
15
|
"browser": "./dist/lib/browser/index.mjs",
|
|
15
16
|
"node": "./dist/lib/node-esm/index.mjs"
|
|
16
17
|
},
|
|
17
18
|
"./types": {
|
|
19
|
+
"source": "./src/types/index.ts",
|
|
18
20
|
"types": "./dist/types/src/types/index.d.ts",
|
|
19
21
|
"browser": "./dist/lib/browser/types/index.mjs",
|
|
20
22
|
"node": "./dist/lib/node-esm/types/index.mjs"
|
|
@@ -35,49 +37,50 @@
|
|
|
35
37
|
"dependencies": {
|
|
36
38
|
"@preact-signals/safe-react": "^0.9.0",
|
|
37
39
|
"@preact/signals-core": "^1.9.0",
|
|
38
|
-
"effect": "3.17.
|
|
39
|
-
"@dxos/
|
|
40
|
-
"@dxos/
|
|
41
|
-
"@dxos/
|
|
42
|
-
"@dxos/
|
|
43
|
-
"@dxos/echo": "0.8.4-main.
|
|
44
|
-
"@dxos/echo-schema": "0.8.4-main.
|
|
45
|
-
"@dxos/
|
|
46
|
-
"@dxos/effect": "0.8.4-main.
|
|
47
|
-
"@dxos/
|
|
48
|
-
"@dxos/
|
|
49
|
-
"@dxos/
|
|
50
|
-
"@dxos/plugin-
|
|
51
|
-
"@dxos/plugin-space": "0.8.4-main.
|
|
52
|
-
"@dxos/
|
|
53
|
-
"@dxos/
|
|
54
|
-
"@dxos/react-
|
|
55
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
56
|
-
"@dxos/react-ui-
|
|
57
|
-
"@dxos/react-
|
|
58
|
-
"@dxos/
|
|
59
|
-
"@dxos/
|
|
60
|
-
"@dxos/
|
|
40
|
+
"effect": "3.17.7",
|
|
41
|
+
"@dxos/app-framework": "0.8.4-main.5ea62a8",
|
|
42
|
+
"@dxos/ai": "0.8.4-main.5ea62a8",
|
|
43
|
+
"@dxos/assistant": "0.8.4-main.5ea62a8",
|
|
44
|
+
"@dxos/async": "0.8.4-main.5ea62a8",
|
|
45
|
+
"@dxos/echo": "0.8.4-main.5ea62a8",
|
|
46
|
+
"@dxos/echo-schema": "0.8.4-main.5ea62a8",
|
|
47
|
+
"@dxos/blueprints": "0.8.4-main.5ea62a8",
|
|
48
|
+
"@dxos/effect": "0.8.4-main.5ea62a8",
|
|
49
|
+
"@dxos/functions": "0.8.4-main.5ea62a8",
|
|
50
|
+
"@dxos/invariant": "0.8.4-main.5ea62a8",
|
|
51
|
+
"@dxos/log": "0.8.4-main.5ea62a8",
|
|
52
|
+
"@dxos/plugin-graph": "0.8.4-main.5ea62a8",
|
|
53
|
+
"@dxos/plugin-space": "0.8.4-main.5ea62a8",
|
|
54
|
+
"@dxos/plugin-search": "0.8.4-main.5ea62a8",
|
|
55
|
+
"@dxos/random": "0.8.4-main.5ea62a8",
|
|
56
|
+
"@dxos/react-ui": "0.8.4-main.5ea62a8",
|
|
57
|
+
"@dxos/react-ui-form": "0.8.4-main.5ea62a8",
|
|
58
|
+
"@dxos/react-ui-kanban": "0.8.4-main.5ea62a8",
|
|
59
|
+
"@dxos/react-client": "0.8.4-main.5ea62a8",
|
|
60
|
+
"@dxos/react-ui-stack": "0.8.4-main.5ea62a8",
|
|
61
|
+
"@dxos/schema": "0.8.4-main.5ea62a8",
|
|
62
|
+
"@dxos/plugin-client": "0.8.4-main.5ea62a8",
|
|
63
|
+
"@dxos/util": "0.8.4-main.5ea62a8"
|
|
61
64
|
},
|
|
62
65
|
"devDependencies": {
|
|
63
66
|
"@types/react": "~18.2.0",
|
|
64
67
|
"@types/react-dom": "~18.2.0",
|
|
65
68
|
"react": "~18.2.0",
|
|
66
69
|
"react-dom": "~18.2.0",
|
|
67
|
-
"vite": "
|
|
68
|
-
"@dxos/plugin-
|
|
69
|
-
"@dxos/plugin-
|
|
70
|
-
"@dxos/react-ui-syntax-highlighter": "0.8.4-main.
|
|
71
|
-
"@dxos/
|
|
72
|
-
"@dxos/
|
|
73
|
-
"@dxos/
|
|
70
|
+
"vite": "7.1.1",
|
|
71
|
+
"@dxos/plugin-theme": "0.8.4-main.5ea62a8",
|
|
72
|
+
"@dxos/plugin-preview": "0.8.4-main.5ea62a8",
|
|
73
|
+
"@dxos/react-ui-syntax-highlighter": "0.8.4-main.5ea62a8",
|
|
74
|
+
"@dxos/react-ui-theme": "0.8.4-main.5ea62a8",
|
|
75
|
+
"@dxos/storybook-utils": "0.8.4-main.5ea62a8",
|
|
76
|
+
"@dxos/test-utils": "0.8.4-main.5ea62a8"
|
|
74
77
|
},
|
|
75
78
|
"peerDependencies": {
|
|
76
79
|
"effect": "^3.13.3",
|
|
77
80
|
"react": "~18.2.0",
|
|
78
81
|
"react-dom": "~18.2.0",
|
|
79
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
80
|
-
"@dxos/react-ui-theme": "0.8.4-main.
|
|
82
|
+
"@dxos/react-ui": "0.8.4-main.5ea62a8",
|
|
83
|
+
"@dxos/react-ui-theme": "0.8.4-main.5ea62a8"
|
|
81
84
|
},
|
|
82
85
|
"publishConfig": {
|
|
83
86
|
"access": "public"
|
package/src/KanbanPlugin.tsx
CHANGED
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { Capabilities, Events, contributes, createIntent, defineModule, definePlugin } from '@dxos/app-framework';
|
|
6
6
|
import { ClientEvents } from '@dxos/plugin-client';
|
|
7
7
|
import { SpaceCapabilities } from '@dxos/plugin-space';
|
|
8
8
|
import { defineObjectForm } from '@dxos/plugin-space/types';
|
|
9
|
-
import {
|
|
9
|
+
import { translations as kanbanTranslations } from '@dxos/react-ui-kanban';
|
|
10
|
+
import { Kanban } from '@dxos/react-ui-kanban/types';
|
|
10
11
|
|
|
11
|
-
import {
|
|
12
|
+
import { BlueprintDefinition, IntentResolver, ReactSurface } from './capabilities';
|
|
12
13
|
import { meta } from './meta';
|
|
13
14
|
import { translations } from './translations';
|
|
14
15
|
import { CreateKanbanSchema, KanbanAction } from './types';
|
|
@@ -25,7 +26,7 @@ export const KanbanPlugin = () =>
|
|
|
25
26
|
activatesOn: Events.SetupMetadata,
|
|
26
27
|
activate: () =>
|
|
27
28
|
contributes(Capabilities.Metadata, {
|
|
28
|
-
id:
|
|
29
|
+
id: Kanban.Kanban.typename,
|
|
29
30
|
metadata: {
|
|
30
31
|
icon: 'ph--kanban--regular',
|
|
31
32
|
},
|
|
@@ -38,7 +39,7 @@ export const KanbanPlugin = () =>
|
|
|
38
39
|
contributes(
|
|
39
40
|
SpaceCapabilities.ObjectForm,
|
|
40
41
|
defineObjectForm({
|
|
41
|
-
objectSchema:
|
|
42
|
+
objectSchema: Kanban.Kanban,
|
|
42
43
|
formSchema: CreateKanbanSchema,
|
|
43
44
|
hidden: true,
|
|
44
45
|
getIntent: (props, options) => createIntent(KanbanAction.Create, { ...props, space: options.space }),
|
|
@@ -56,8 +57,8 @@ export const KanbanPlugin = () =>
|
|
|
56
57
|
activate: IntentResolver,
|
|
57
58
|
}),
|
|
58
59
|
defineModule({
|
|
59
|
-
id: `${meta.id}/module/
|
|
60
|
+
id: `${meta.id}/module/blueprint`,
|
|
60
61
|
activatesOn: Events.SetupArtifactDefinition,
|
|
61
|
-
activate:
|
|
62
|
+
activate: BlueprintDefinition,
|
|
62
63
|
}),
|
|
63
64
|
]);
|
|
@@ -2,16 +2,19 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
// ISSUE(burdon): defineArtifact
|
|
6
|
+
// @ts-nocheck
|
|
7
|
+
|
|
5
8
|
import { Schema, pipe } from 'effect';
|
|
6
9
|
|
|
7
|
-
import {
|
|
8
|
-
import { Capabilities, chain, contributes, createIntent
|
|
10
|
+
import { ToolResult, createTool } from '@dxos/ai';
|
|
11
|
+
import { Capabilities, type PromiseIntentDispatcher, chain, contributes, createIntent } from '@dxos/app-framework';
|
|
9
12
|
import { createArtifactElement } from '@dxos/assistant';
|
|
10
13
|
import { defineArtifact } from '@dxos/blueprints';
|
|
11
14
|
import { Obj, Query } from '@dxos/echo';
|
|
12
15
|
import { invariant } from '@dxos/invariant';
|
|
13
16
|
import { SpaceAction } from '@dxos/plugin-space/types';
|
|
14
|
-
import { Filter,
|
|
17
|
+
import { Filter, type Space, fullyQualifiedId } from '@dxos/react-client/echo';
|
|
15
18
|
import { KanbanView } from '@dxos/react-ui-kanban';
|
|
16
19
|
import { DataType } from '@dxos/schema';
|
|
17
20
|
import { isNonNullable } from '@dxos/util';
|
|
@@ -49,7 +52,7 @@ export default () => {
|
|
|
49
52
|
caption: 'Creating kanban board...',
|
|
50
53
|
schema: Schema.Struct({
|
|
51
54
|
typename: Schema.String.annotations({
|
|
52
|
-
description: 'The fully qualified
|
|
55
|
+
description: 'The fully qualified name of the record type to use for the kanban cards.',
|
|
53
56
|
}),
|
|
54
57
|
pivotColumn: Schema.optional(Schema.String).annotations({
|
|
55
58
|
description: 'Optional field name to use as the column pivot.',
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Capabilities, contributes } from '@dxos/app-framework';
|
|
6
|
+
import { Blueprint, Template } from '@dxos/blueprints';
|
|
7
|
+
import { type FunctionDefinition } from '@dxos/functions';
|
|
8
|
+
import { trim } from '@dxos/util';
|
|
9
|
+
|
|
10
|
+
const functions: FunctionDefinition[] = [];
|
|
11
|
+
const tools: string[] = [];
|
|
12
|
+
|
|
13
|
+
export default () => {
|
|
14
|
+
return [
|
|
15
|
+
contributes(Capabilities.Functions, functions),
|
|
16
|
+
contributes(
|
|
17
|
+
Capabilities.BlueprintDefinition,
|
|
18
|
+
Blueprint.make({
|
|
19
|
+
key: 'dxos.org/blueprint/kanban',
|
|
20
|
+
name: 'Kanban',
|
|
21
|
+
tools: Blueprint.toolDefinitions({ functions, tools }),
|
|
22
|
+
instructions: Template.make({
|
|
23
|
+
source: trim`
|
|
24
|
+
You can create and update kanban boards to show data in sorted columns defined by schema.
|
|
25
|
+
`,
|
|
26
|
+
}),
|
|
27
|
+
}),
|
|
28
|
+
),
|
|
29
|
+
];
|
|
30
|
+
};
|
|
@@ -4,6 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|
import { lazy } from '@dxos/app-framework';
|
|
6
6
|
|
|
7
|
-
export const
|
|
7
|
+
export const BlueprintDefinition = lazy(() => import('./blueprint-definition'));
|
|
8
8
|
export const IntentResolver = lazy(() => import('./intent-resolver'));
|
|
9
9
|
export const ReactSurface = lazy(() => import('./react-surface'));
|
|
@@ -2,14 +2,15 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { Capabilities, type PluginContext, contributes, createResolver } from '@dxos/app-framework';
|
|
6
6
|
import { invariant } from '@dxos/invariant';
|
|
7
7
|
import { ClientCapabilities } from '@dxos/plugin-client';
|
|
8
8
|
import { getSpace } from '@dxos/react-client/echo';
|
|
9
|
+
import { Kanban } from '@dxos/react-ui-kanban/types';
|
|
9
10
|
import { ProjectionModel } from '@dxos/schema';
|
|
10
11
|
|
|
11
12
|
import { KANBAN_PLUGIN } from '../meta';
|
|
12
|
-
import {
|
|
13
|
+
import { KanbanAction } from '../types';
|
|
13
14
|
|
|
14
15
|
export default (context: PluginContext) =>
|
|
15
16
|
contributes(Capabilities.IntentResolver, [
|
|
@@ -17,12 +18,12 @@ export default (context: PluginContext) =>
|
|
|
17
18
|
intent: KanbanAction.Create,
|
|
18
19
|
resolve: async ({ space, name, typename, initialPivotColumn }) => {
|
|
19
20
|
const client = context.getCapability(ClientCapabilities.Client);
|
|
20
|
-
const { view } = await
|
|
21
|
+
const { view } = await Kanban.makeView({
|
|
21
22
|
client,
|
|
22
23
|
space,
|
|
23
24
|
name,
|
|
24
25
|
typename,
|
|
25
|
-
initialPivotColumn,
|
|
26
|
+
pivotFieldName: initialPivotColumn,
|
|
26
27
|
});
|
|
27
28
|
return { data: { object: view } };
|
|
28
29
|
},
|
|
@@ -9,9 +9,9 @@ import { Capabilities, contributes, createSurface, useCapabilities } from '@dxos
|
|
|
9
9
|
import { Obj, Type } from '@dxos/echo';
|
|
10
10
|
import { findAnnotation } from '@dxos/effect';
|
|
11
11
|
import { ClientCapabilities } from '@dxos/plugin-client';
|
|
12
|
-
import { getSpace, isSpace
|
|
12
|
+
import { type Space, getSpace, isSpace } from '@dxos/react-client/echo';
|
|
13
13
|
import { type InputProps, SelectInput, useFormValues } from '@dxos/react-ui-form';
|
|
14
|
-
import {
|
|
14
|
+
import { Kanban } from '@dxos/react-ui-kanban/types';
|
|
15
15
|
import { DataType } from '@dxos/schema';
|
|
16
16
|
|
|
17
17
|
import { KanbanContainer, KanbanViewEditor } from '../components';
|
|
@@ -24,7 +24,7 @@ export default () =>
|
|
|
24
24
|
id: meta.id,
|
|
25
25
|
role: ['article', 'section'],
|
|
26
26
|
filter: (data): data is { subject: DataType.View } =>
|
|
27
|
-
Obj.instanceOf(DataType.View, data.subject) && Obj.instanceOf(
|
|
27
|
+
Obj.instanceOf(DataType.View, data.subject) && Obj.instanceOf(Kanban.Kanban, data.subject.presentation.target),
|
|
28
28
|
component: ({ data, role }) => <KanbanContainer view={data.subject} role={role} />,
|
|
29
29
|
}),
|
|
30
30
|
createSurface({
|
|
@@ -32,7 +32,7 @@ export default () =>
|
|
|
32
32
|
role: 'object-settings',
|
|
33
33
|
position: 'hoist',
|
|
34
34
|
filter: (data): data is { subject: DataType.View } =>
|
|
35
|
-
Obj.instanceOf(DataType.View, data.subject) && Obj.instanceOf(
|
|
35
|
+
Obj.instanceOf(DataType.View, data.subject) && Obj.instanceOf(Kanban.Kanban, data.subject.presentation.target),
|
|
36
36
|
component: ({ data }) => <KanbanViewEditor view={data.subject} />,
|
|
37
37
|
}),
|
|
38
38
|
createSurface({
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import '@dxos-theme';
|
|
6
6
|
|
|
7
|
-
import { type
|
|
7
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
8
8
|
import React, { useCallback, useEffect, useState } from 'react';
|
|
9
9
|
|
|
10
10
|
import { IntentPlugin, SettingsPlugin } from '@dxos/app-framework';
|
|
@@ -19,16 +19,16 @@ import { StorybookLayoutPlugin } from '@dxos/plugin-storybook-layout';
|
|
|
19
19
|
import { ThemePlugin } from '@dxos/plugin-theme';
|
|
20
20
|
import { faker } from '@dxos/random';
|
|
21
21
|
import { useClient } from '@dxos/react-client';
|
|
22
|
-
import { Filter,
|
|
22
|
+
import { Filter, useQuery, useSchema, useSpaces } from '@dxos/react-client/echo';
|
|
23
23
|
import { ViewEditor } from '@dxos/react-ui-form';
|
|
24
|
-
import { Kanban
|
|
24
|
+
import { Kanban as KanbanComponent, useKanbanModel } from '@dxos/react-ui-kanban';
|
|
25
|
+
import { Kanban } from '@dxos/react-ui-kanban/types';
|
|
25
26
|
import { SyntaxHighlighter } from '@dxos/react-ui-syntax-highlighter';
|
|
26
27
|
import { defaultTx } from '@dxos/react-ui-theme';
|
|
27
28
|
import { DataType, ProjectionModel } from '@dxos/schema';
|
|
28
29
|
import { withLayout } from '@dxos/storybook-utils';
|
|
29
30
|
|
|
30
31
|
import { translations } from '../translations';
|
|
31
|
-
import { createKanban } from '../types';
|
|
32
32
|
|
|
33
33
|
faker.seed(0);
|
|
34
34
|
|
|
@@ -115,7 +115,7 @@ const StorybookKanban = () => {
|
|
|
115
115
|
|
|
116
116
|
return (
|
|
117
117
|
<div className='grow grid grid-cols-[1fr_350px]'>
|
|
118
|
-
{model ? <
|
|
118
|
+
{model ? <KanbanComponent model={model} onAddCard={handleAddCard} onRemoveCard={handleRemoveCard} /> : <div />}
|
|
119
119
|
<div className='flex flex-col bs-full border-is border-separator overflow-y-auto'>
|
|
120
120
|
<ViewEditor
|
|
121
121
|
registry={space?.db.schemaRegistry}
|
|
@@ -142,7 +142,7 @@ type StoryProps = {
|
|
|
142
142
|
// Story definitions.
|
|
143
143
|
//
|
|
144
144
|
|
|
145
|
-
const meta
|
|
145
|
+
const meta = {
|
|
146
146
|
title: 'plugins/plugin-kanban/Kanban',
|
|
147
147
|
component: StorybookKanban,
|
|
148
148
|
render: () => <StorybookKanban />,
|
|
@@ -153,16 +153,16 @@ const meta: Meta<StoryProps> = {
|
|
|
153
153
|
plugins: [
|
|
154
154
|
ThemePlugin({ tx: defaultTx }),
|
|
155
155
|
ClientPlugin({
|
|
156
|
-
types: [DataType.Organization, DataType.Person, DataType.View,
|
|
157
|
-
onClientInitialized: async (
|
|
156
|
+
types: [DataType.Organization, DataType.Person, DataType.View, Kanban.Kanban],
|
|
157
|
+
onClientInitialized: async ({ client }) => {
|
|
158
158
|
await client.halo.createIdentity();
|
|
159
159
|
const space = await client.spaces.create();
|
|
160
160
|
await space.waitUntilReady();
|
|
161
|
-
const { view } = await
|
|
161
|
+
const { view } = await Kanban.makeView({
|
|
162
162
|
client,
|
|
163
163
|
space,
|
|
164
164
|
typename: DataType.Organization.typename,
|
|
165
|
-
|
|
165
|
+
pivotFieldName: 'status',
|
|
166
166
|
});
|
|
167
167
|
space.db.add(view);
|
|
168
168
|
|
|
@@ -180,10 +180,10 @@ const meta: Meta<StoryProps> = {
|
|
|
180
180
|
],
|
|
181
181
|
}),
|
|
182
182
|
],
|
|
183
|
-
}
|
|
183
|
+
} satisfies Meta<typeof StorybookKanban>;
|
|
184
184
|
|
|
185
185
|
export default meta;
|
|
186
186
|
|
|
187
|
-
type Story = StoryObj<
|
|
187
|
+
type Story = StoryObj<typeof meta>;
|
|
188
188
|
|
|
189
189
|
export const Default: Story = {};
|
|
@@ -9,10 +9,10 @@ import { Filter, Obj, Type } from '@dxos/echo';
|
|
|
9
9
|
import { EchoSchema, type TypedObject } from '@dxos/echo-schema';
|
|
10
10
|
import { useGlobalFilteredObjects } from '@dxos/plugin-search';
|
|
11
11
|
import { useClient } from '@dxos/react-client';
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
12
|
+
import { getSpace, useQuery } from '@dxos/react-client/echo';
|
|
13
|
+
import { Kanban, useKanbanModel } from '@dxos/react-ui-kanban';
|
|
14
14
|
import { StackItem } from '@dxos/react-ui-stack';
|
|
15
|
-
import {
|
|
15
|
+
import { type DataType, ProjectionModel } from '@dxos/schema';
|
|
16
16
|
|
|
17
17
|
import { KanbanAction } from '../types';
|
|
18
18
|
|
|
@@ -8,8 +8,8 @@ import { Type } from '@dxos/echo';
|
|
|
8
8
|
import { EchoSchema, FormatEnum } from '@dxos/echo-schema';
|
|
9
9
|
import { useClient } from '@dxos/react-client';
|
|
10
10
|
import { getSpace, useSchema } from '@dxos/react-client/echo';
|
|
11
|
-
import { Form, SelectInput
|
|
12
|
-
import {
|
|
11
|
+
import { type CustomInputMap, Form, SelectInput } from '@dxos/react-ui-form';
|
|
12
|
+
import { Kanban } from '@dxos/react-ui-kanban/types';
|
|
13
13
|
import { type DataType, ProjectionModel } from '@dxos/schema';
|
|
14
14
|
|
|
15
15
|
type KanbanViewEditorProps = { view: DataType.View };
|
|
@@ -17,7 +17,6 @@ type KanbanViewEditorProps = { view: DataType.View };
|
|
|
17
17
|
export const KanbanViewEditor = ({ view }: KanbanViewEditorProps) => {
|
|
18
18
|
const client = useClient();
|
|
19
19
|
const space = getSpace(view);
|
|
20
|
-
const kanban = view.presentation.target as KanbanView;
|
|
21
20
|
const currentTypename = useMemo(() => view.query.typename, [view.query.typename]);
|
|
22
21
|
const schema = useSchema(client, space, currentTypename);
|
|
23
22
|
|
|
@@ -35,12 +34,15 @@ export const KanbanViewEditor = ({ view }: KanbanViewEditorProps) => {
|
|
|
35
34
|
|
|
36
35
|
const handleSave = useCallback(
|
|
37
36
|
(values: Partial<{ columnFieldId: string }>) => {
|
|
38
|
-
|
|
37
|
+
view.projection.pivotFieldId = values.columnFieldId;
|
|
39
38
|
},
|
|
40
|
-
[
|
|
39
|
+
[view],
|
|
41
40
|
);
|
|
42
41
|
|
|
43
|
-
const initialValues = useMemo(
|
|
42
|
+
const initialValues = useMemo(
|
|
43
|
+
() => ({ columnFieldId: view.projection.pivotFieldId }),
|
|
44
|
+
[view.projection.pivotFieldId],
|
|
45
|
+
);
|
|
44
46
|
const custom: CustomInputMap = useMemo(
|
|
45
47
|
() => ({ columnFieldId: (props) => <SelectInput {...props} options={selectFields} /> }),
|
|
46
48
|
[selectFields],
|
|
@@ -49,7 +51,7 @@ export const KanbanViewEditor = ({ view }: KanbanViewEditorProps) => {
|
|
|
49
51
|
return (
|
|
50
52
|
<Form
|
|
51
53
|
Custom={custom}
|
|
52
|
-
schema={
|
|
54
|
+
schema={Kanban.SettingsSchema}
|
|
53
55
|
values={initialValues}
|
|
54
56
|
onSave={handleSave}
|
|
55
57
|
autoSave
|
package/src/translations.ts
CHANGED
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { type Resource } from '@dxos/react-ui';
|
|
6
|
-
import {
|
|
6
|
+
import { Kanban } from '@dxos/react-ui-kanban/types';
|
|
7
7
|
|
|
8
8
|
import { meta } from './meta';
|
|
9
9
|
|
|
10
10
|
export const translations = [
|
|
11
11
|
{
|
|
12
12
|
'en-US': {
|
|
13
|
-
[
|
|
13
|
+
[Kanban.Kanban.typename]: {
|
|
14
14
|
'typename label': 'Kanban',
|
|
15
15
|
'typename label_zero': 'Kanbans',
|
|
16
16
|
'typename label_one': 'Kanban',
|
package/src/types/index.ts
CHANGED
package/src/types/schema.ts
CHANGED
|
@@ -25,8 +25,8 @@ export const CreateKanbanSchema = Schema.Struct({
|
|
|
25
25
|
name: Schema.optional(Schema.String),
|
|
26
26
|
typename: Schema.optional(
|
|
27
27
|
Schema.String.annotations({
|
|
28
|
-
[TypenameAnnotationId]: ['
|
|
29
|
-
title: 'Select card
|
|
28
|
+
[TypenameAnnotationId]: ['used-static', 'dynamic'],
|
|
29
|
+
title: 'Select card record type (leave empty to start fresh)',
|
|
30
30
|
}),
|
|
31
31
|
),
|
|
32
32
|
initialPivotColumn: Schema.optional(
|
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
KanbanAction,
|
|
3
|
-
meta
|
|
4
|
-
} from "./chunk-X44RHBZK.mjs";
|
|
5
|
-
|
|
6
|
-
// src/capabilities/artifact-definition.ts
|
|
7
|
-
import { Schema, pipe } from "effect";
|
|
8
|
-
import { createTool, ToolResult } from "@dxos/ai";
|
|
9
|
-
import { Capabilities, chain, contributes, createIntent } from "@dxos/app-framework";
|
|
10
|
-
import { createArtifactElement } from "@dxos/assistant";
|
|
11
|
-
import { defineArtifact } from "@dxos/blueprints";
|
|
12
|
-
import { Obj, Query } from "@dxos/echo";
|
|
13
|
-
import { invariant } from "@dxos/invariant";
|
|
14
|
-
import { SpaceAction } from "@dxos/plugin-space/types";
|
|
15
|
-
import { Filter, fullyQualifiedId } from "@dxos/react-client/echo";
|
|
16
|
-
import { KanbanView } from "@dxos/react-ui-kanban";
|
|
17
|
-
import { DataType } from "@dxos/schema";
|
|
18
|
-
import { isNonNullable } from "@dxos/util";
|
|
19
|
-
var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-kanban/src/capabilities/artifact-definition.ts";
|
|
20
|
-
var QualifiedId = Schema.String.annotations({
|
|
21
|
-
description: "The fully qualified ID of the kanban `spaceID:objectID`"
|
|
22
|
-
});
|
|
23
|
-
var artifact_definition_default = () => {
|
|
24
|
-
const definition = defineArtifact({
|
|
25
|
-
id: `artifact:${meta.id}`,
|
|
26
|
-
name: meta.name,
|
|
27
|
-
instructions: `
|
|
28
|
-
- Before adding items to a kanban board, inspect the board to see its schema
|
|
29
|
-
- When adding items, you must not include the 'id' field -- it is automatically generated
|
|
30
|
-
- BEFORE adding items, always make sure the board has been shown to the user!
|
|
31
|
-
`,
|
|
32
|
-
schema: KanbanView,
|
|
33
|
-
tools: [
|
|
34
|
-
createTool(meta.id, {
|
|
35
|
-
name: "create",
|
|
36
|
-
description: `
|
|
37
|
-
Create a new kanban board using an existing schema.
|
|
38
|
-
Use schema_create first to create a schema, or schema_list to choose an existing one.`,
|
|
39
|
-
caption: "Creating kanban board...",
|
|
40
|
-
schema: Schema.Struct({
|
|
41
|
-
typename: Schema.String.annotations({
|
|
42
|
-
description: "The fully qualified typename of the schema to use for the kanban cards."
|
|
43
|
-
}),
|
|
44
|
-
pivotColumn: Schema.optional(Schema.String).annotations({
|
|
45
|
-
description: "Optional field name to use as the column pivot."
|
|
46
|
-
})
|
|
47
|
-
}),
|
|
48
|
-
execute: async ({ typename, pivotColumn }, { extensions }) => {
|
|
49
|
-
invariant(extensions?.space, "No space", {
|
|
50
|
-
F: __dxlog_file,
|
|
51
|
-
L: 59,
|
|
52
|
-
S: void 0,
|
|
53
|
-
A: [
|
|
54
|
-
"extensions?.space",
|
|
55
|
-
"'No space'"
|
|
56
|
-
]
|
|
57
|
-
});
|
|
58
|
-
invariant(extensions?.dispatch, "No intent dispatcher", {
|
|
59
|
-
F: __dxlog_file,
|
|
60
|
-
L: 60,
|
|
61
|
-
S: void 0,
|
|
62
|
-
A: [
|
|
63
|
-
"extensions?.dispatch",
|
|
64
|
-
"'No intent dispatcher'"
|
|
65
|
-
]
|
|
66
|
-
});
|
|
67
|
-
const schema = await extensions.space.db.schemaRegistry.query({
|
|
68
|
-
typename
|
|
69
|
-
}).firstOrUndefined();
|
|
70
|
-
if (!schema) {
|
|
71
|
-
return ToolResult.Error(`Schema not found: ${typename}`);
|
|
72
|
-
}
|
|
73
|
-
const intent = pipe(createIntent(KanbanAction.Create, {
|
|
74
|
-
space: extensions.space,
|
|
75
|
-
typename,
|
|
76
|
-
initialPivotColumn: pivotColumn
|
|
77
|
-
}), chain(SpaceAction.AddObject, {
|
|
78
|
-
target: extensions.space
|
|
79
|
-
}));
|
|
80
|
-
const { data, error } = await extensions.dispatch(intent);
|
|
81
|
-
if (!data || error) {
|
|
82
|
-
return ToolResult.Error(error?.message ?? "Failed to create kanban board");
|
|
83
|
-
}
|
|
84
|
-
return ToolResult.Success(createArtifactElement(data.id));
|
|
85
|
-
}
|
|
86
|
-
}),
|
|
87
|
-
createTool(meta.id, {
|
|
88
|
-
name: "list",
|
|
89
|
-
description: "List all kanban boards in the current space.",
|
|
90
|
-
caption: "Listing kanban boards...",
|
|
91
|
-
schema: Schema.Struct({}),
|
|
92
|
-
execute: async (_input, { extensions }) => {
|
|
93
|
-
invariant(extensions?.space, "No space", {
|
|
94
|
-
F: __dxlog_file,
|
|
95
|
-
L: 91,
|
|
96
|
-
S: void 0,
|
|
97
|
-
A: [
|
|
98
|
-
"extensions?.space",
|
|
99
|
-
"'No space'"
|
|
100
|
-
]
|
|
101
|
-
});
|
|
102
|
-
const space = extensions.space;
|
|
103
|
-
const { objects } = await space.db.query(Filter.type(DataType.View)).run();
|
|
104
|
-
const boardInfo = await Promise.all(objects.map(async (view) => {
|
|
105
|
-
const kanban = await view.presentation.load();
|
|
106
|
-
if (!Obj.instanceOf(KanbanView, kanban)) {
|
|
107
|
-
return null;
|
|
108
|
-
}
|
|
109
|
-
return {
|
|
110
|
-
id: fullyQualifiedId(view),
|
|
111
|
-
name: view.name ?? "Unnamed Kanban",
|
|
112
|
-
typename: view.query.typename
|
|
113
|
-
};
|
|
114
|
-
}));
|
|
115
|
-
return ToolResult.Success(boardInfo.filter(isNonNullable));
|
|
116
|
-
}
|
|
117
|
-
}),
|
|
118
|
-
createTool(meta.id, {
|
|
119
|
-
name: "inspect",
|
|
120
|
-
description: "Get details about a specific kanban board.",
|
|
121
|
-
caption: "Inspecting kanban board...",
|
|
122
|
-
schema: Schema.Struct({
|
|
123
|
-
id: QualifiedId
|
|
124
|
-
}),
|
|
125
|
-
execute: async ({ id }, { extensions }) => {
|
|
126
|
-
invariant(extensions?.space, "No space", {
|
|
127
|
-
F: __dxlog_file,
|
|
128
|
-
L: 119,
|
|
129
|
-
S: void 0,
|
|
130
|
-
A: [
|
|
131
|
-
"extensions?.space",
|
|
132
|
-
"'No space'"
|
|
133
|
-
]
|
|
134
|
-
});
|
|
135
|
-
const space = extensions.space;
|
|
136
|
-
const view = await space.db.query(Query.select(Filter.and(Filter.type(DataType.View), Filter.ids(id)))).first();
|
|
137
|
-
const kanban = await view.presentation.load();
|
|
138
|
-
invariant(Obj.instanceOf(KanbanView, kanban), void 0, {
|
|
139
|
-
F: __dxlog_file,
|
|
140
|
-
L: 127,
|
|
141
|
-
S: void 0,
|
|
142
|
-
A: [
|
|
143
|
-
"Obj.instanceOf(KanbanView, kanban)",
|
|
144
|
-
""
|
|
145
|
-
]
|
|
146
|
-
});
|
|
147
|
-
const typename = view.query.typename;
|
|
148
|
-
const schema = await space.db.schemaRegistry.query({
|
|
149
|
-
typename
|
|
150
|
-
}).firstOrUndefined();
|
|
151
|
-
invariant(schema, void 0, {
|
|
152
|
-
F: __dxlog_file,
|
|
153
|
-
L: 131,
|
|
154
|
-
S: void 0,
|
|
155
|
-
A: [
|
|
156
|
-
"schema",
|
|
157
|
-
""
|
|
158
|
-
]
|
|
159
|
-
});
|
|
160
|
-
return ToolResult.Success({
|
|
161
|
-
schema,
|
|
162
|
-
columnField: kanban.columnFieldId,
|
|
163
|
-
viewFields: view.projection.fields
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
})
|
|
167
|
-
]
|
|
168
|
-
});
|
|
169
|
-
return contributes(Capabilities.ArtifactDefinition, definition);
|
|
170
|
-
};
|
|
171
|
-
export {
|
|
172
|
-
artifact_definition_default as default
|
|
173
|
-
};
|
|
174
|
-
//# sourceMappingURL=artifact-definition-WMSZK3RW.mjs.map
|