@dxos/plugin-kanban 0.8.1 → 0.8.2-main.10c050d
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/{artifact-definition-SVNHDJQT.mjs → artifact-definition-7AVKC5KJ.mjs} +24 -23
- package/dist/lib/browser/artifact-definition-7AVKC5KJ.mjs.map +7 -0
- package/dist/lib/browser/{chunk-K5BYEZ4Z.mjs → chunk-NJ6WHYLY.mjs} +25 -40
- package/dist/lib/browser/chunk-NJ6WHYLY.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +4 -4
- package/dist/lib/browser/intent-resolver-2R6I36UA.mjs +297 -0
- package/dist/lib/browser/intent-resolver-2R6I36UA.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react-surface-W43CBHJ2.mjs +328 -0
- package/dist/lib/browser/react-surface-W43CBHJ2.mjs.map +7 -0
- package/dist/lib/browser/types.mjs +1 -3
- package/dist/lib/node/{artifact-definition-M2XAYUI2.cjs → artifact-definition-GAKXWPS3.cjs} +32 -31
- package/dist/lib/node/artifact-definition-GAKXWPS3.cjs.map +7 -0
- package/dist/lib/node/{chunk-3EUR6ZR2.cjs → chunk-3BKBOGOH.cjs} +27 -43
- package/dist/lib/node/chunk-3BKBOGOH.cjs.map +7 -0
- package/dist/lib/node/index.cjs +16 -16
- package/dist/lib/node/intent-resolver-3WEAK7UE.cjs +308 -0
- package/dist/lib/node/intent-resolver-3WEAK7UE.cjs.map +7 -0
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/react-surface-YEBNJKHD.cjs +344 -0
- package/dist/lib/node/react-surface-YEBNJKHD.cjs.map +7 -0
- package/dist/lib/node/types.cjs +6 -8
- package/dist/lib/node/types.cjs.map +2 -2
- package/dist/lib/node-esm/{artifact-definition-HQ5I2OO5.mjs → artifact-definition-RH5KY7FP.mjs} +24 -23
- package/dist/lib/node-esm/artifact-definition-RH5KY7FP.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-2N7CO3DI.mjs → chunk-4J76H6FE.mjs} +25 -40
- package/dist/lib/node-esm/chunk-4J76H6FE.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +4 -4
- package/dist/lib/node-esm/intent-resolver-XHHFK6V7.mjs +298 -0
- package/dist/lib/node-esm/intent-resolver-XHHFK6V7.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/react-surface-Q73OORPI.mjs +329 -0
- package/dist/lib/node-esm/react-surface-Q73OORPI.mjs.map +7 -0
- package/dist/lib/node-esm/types.mjs +1 -3
- package/dist/types/src/capabilities/artifact-definition.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +1 -1
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +2 -2
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/components/KanbanContainer.d.ts.map +1 -1
- package/dist/types/src/components/KanbanContainer.stories.d.ts +10 -0
- package/dist/types/src/components/KanbanContainer.stories.d.ts.map +1 -0
- package/dist/types/src/components/KanbanViewEditor.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/testing/index.d.ts +3 -0
- package/dist/types/src/testing/index.d.ts.map +1 -0
- package/dist/types/src/testing/initialize-kanban.d.ts +17 -0
- package/dist/types/src/testing/initialize-kanban.d.ts.map +1 -0
- package/dist/types/src/testing/kanban-manager.d.ts +7 -0
- package/dist/types/src/testing/kanban-manager.d.ts.map +1 -0
- package/dist/types/src/testing/playwright/smoke.spec.d.ts +2 -0
- package/dist/types/src/testing/playwright/smoke.spec.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +2 -28
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +34 -50
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +33 -26
- package/src/capabilities/artifact-definition.ts +15 -14
- package/src/capabilities/intent-resolver.ts +10 -6
- package/src/capabilities/react-surface.tsx +46 -12
- package/src/components/KanbanContainer.stories.tsx +191 -0
- package/src/components/KanbanContainer.tsx +24 -11
- package/src/components/KanbanViewEditor.tsx +12 -8
- package/src/meta.ts +1 -2
- package/src/testing/index.ts +6 -0
- package/src/testing/initialize-kanban.ts +139 -0
- package/src/testing/kanban-manager.ts +13 -0
- package/src/testing/playwright/playwright.config.cts +18 -0
- package/src/testing/playwright/smoke.spec.ts +7 -0
- package/src/types.ts +26 -43
- package/dist/lib/browser/artifact-definition-SVNHDJQT.mjs.map +0 -7
- package/dist/lib/browser/chunk-K5BYEZ4Z.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-XCDQ5N3Q.mjs +0 -132
- package/dist/lib/browser/intent-resolver-XCDQ5N3Q.mjs.map +0 -7
- package/dist/lib/browser/react-surface-5DLU7L63.mjs +0 -281
- package/dist/lib/browser/react-surface-5DLU7L63.mjs.map +0 -7
- package/dist/lib/node/artifact-definition-M2XAYUI2.cjs.map +0 -7
- package/dist/lib/node/chunk-3EUR6ZR2.cjs.map +0 -7
- package/dist/lib/node/intent-resolver-P3PSZO7H.cjs +0 -146
- package/dist/lib/node/intent-resolver-P3PSZO7H.cjs.map +0 -7
- package/dist/lib/node/react-surface-OWAYP7VQ.cjs +0 -297
- package/dist/lib/node/react-surface-OWAYP7VQ.cjs.map +0 -7
- package/dist/lib/node-esm/artifact-definition-HQ5I2OO5.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-2N7CO3DI.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-4G47V67J.mjs +0 -133
- package/dist/lib/node-esm/intent-resolver-4G47V67J.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-CLEITUUD.mjs +0 -282
- package/dist/lib/node-esm/react-surface-CLEITUUD.mjs.map +0 -7
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { type Space } from '@dxos/react-client/echo';
|
|
1
|
+
import { Schema } from 'effect';
|
|
3
2
|
import { KanbanType } from '@dxos/react-ui-kanban';
|
|
4
3
|
/**
|
|
5
4
|
* Kanban data model.
|
|
@@ -11,67 +10,58 @@ import { KanbanType } from '@dxos/react-ui-kanban';
|
|
|
11
10
|
*/
|
|
12
11
|
export declare const TypenameAnnotationId: unique symbol;
|
|
13
12
|
export declare const PivotColumnAnnotationId: unique symbol;
|
|
14
|
-
export declare const CreateKanbanSchema:
|
|
15
|
-
name:
|
|
16
|
-
typename:
|
|
17
|
-
initialPivotColumn:
|
|
13
|
+
export declare const CreateKanbanSchema: Schema.Struct<{
|
|
14
|
+
name: Schema.optional<typeof Schema.String>;
|
|
15
|
+
typename: Schema.optional<Schema.SchemaClass<string, string, never>>;
|
|
16
|
+
initialPivotColumn: Schema.optional<Schema.SchemaClass<string, string, never>>;
|
|
18
17
|
}>;
|
|
19
|
-
export type CreateKanbanType =
|
|
18
|
+
export type CreateKanbanType = Schema.Schema.Type<typeof CreateKanbanSchema>;
|
|
20
19
|
export declare namespace KanbanAction {
|
|
21
|
-
const Create_base:
|
|
22
|
-
readonly _tag:
|
|
20
|
+
const Create_base: Schema.TaggedClass<Create, "dxos.org/plugin/kanban/action/create", {
|
|
21
|
+
readonly _tag: Schema.tag<"dxos.org/plugin/kanban/action/create">;
|
|
23
22
|
} & {
|
|
24
|
-
input:
|
|
25
|
-
space:
|
|
26
|
-
}>,
|
|
27
|
-
name:
|
|
28
|
-
typename:
|
|
29
|
-
initialPivotColumn:
|
|
23
|
+
input: Schema.extend<Schema.Struct<{
|
|
24
|
+
space: Schema.Schema<import("@dxos/client-protocol").Space, import("@dxos/client-protocol").Space, never>;
|
|
25
|
+
}>, Schema.Struct<{
|
|
26
|
+
name: Schema.optional<typeof Schema.String>;
|
|
27
|
+
typename: Schema.optional<Schema.SchemaClass<string, string, never>>;
|
|
28
|
+
initialPivotColumn: Schema.optional<Schema.SchemaClass<string, string, never>>;
|
|
30
29
|
}>>;
|
|
31
|
-
output:
|
|
30
|
+
output: Schema.Struct<{
|
|
32
31
|
object: typeof KanbanType;
|
|
33
32
|
}>;
|
|
34
33
|
}>;
|
|
35
34
|
export class Create extends Create_base {
|
|
36
35
|
}
|
|
37
|
-
const DeleteCardField_base:
|
|
38
|
-
readonly _tag:
|
|
36
|
+
const DeleteCardField_base: Schema.TaggedClass<DeleteCardField, "dxos.org/plugin/kanban/action/delete-card-field", {
|
|
37
|
+
readonly _tag: Schema.tag<"dxos.org/plugin/kanban/action/delete-card-field">;
|
|
39
38
|
} & {
|
|
40
|
-
input:
|
|
39
|
+
input: Schema.Struct<{
|
|
41
40
|
kanban: typeof KanbanType;
|
|
42
|
-
fieldId: typeof
|
|
43
|
-
deletionData:
|
|
44
|
-
field:
|
|
45
|
-
id: typeof
|
|
46
|
-
path:
|
|
47
|
-
visible:
|
|
48
|
-
size:
|
|
49
|
-
|
|
50
|
-
* Kanban data model.
|
|
51
|
-
* A Kanban board is a collection of columns, each of which contains a collection of items.
|
|
52
|
-
* The layout of columns and items is controlled by models.
|
|
53
|
-
* The underlying data model may be represented by direct object relationships
|
|
54
|
-
* (e.g., a column object containing an array of ordered items) or projections constructed
|
|
55
|
-
* by the model (e.g., a query of items based on metadata within a column object).
|
|
56
|
-
*/
|
|
57
|
-
Number>;
|
|
58
|
-
referencePath: S.optional<S.Schema<import("@dxos/effect").JsonPath, import("@dxos/effect").JsonPath, never>>;
|
|
41
|
+
fieldId: typeof Schema.String;
|
|
42
|
+
deletionData: Schema.optional<Schema.Struct<{
|
|
43
|
+
field: Schema.mutable<Schema.Struct<{
|
|
44
|
+
id: typeof Schema.String;
|
|
45
|
+
path: Schema.Schema<import("@dxos/effect").JsonPath, import("@dxos/effect").JsonPath, never>;
|
|
46
|
+
visible: Schema.optional<typeof Schema.Boolean>;
|
|
47
|
+
size: Schema.optional<typeof Schema.Number>;
|
|
48
|
+
referencePath: Schema.optional<Schema.Schema<import("@dxos/effect").JsonPath, import("@dxos/effect").JsonPath, never>>;
|
|
59
49
|
}>>;
|
|
60
|
-
props: typeof
|
|
61
|
-
index: typeof
|
|
50
|
+
props: typeof Schema.Any;
|
|
51
|
+
index: typeof Schema.Number;
|
|
62
52
|
}>>;
|
|
63
53
|
}>;
|
|
64
|
-
output: typeof
|
|
54
|
+
output: typeof Schema.Void;
|
|
65
55
|
}>;
|
|
66
56
|
export class DeleteCardField extends DeleteCardField_base {
|
|
67
57
|
}
|
|
68
|
-
const DeleteCard_base:
|
|
69
|
-
readonly _tag:
|
|
58
|
+
const DeleteCard_base: Schema.TaggedClass<DeleteCard, "dxos.org/plugin/kanban/action/delete-card", {
|
|
59
|
+
readonly _tag: Schema.tag<"dxos.org/plugin/kanban/action/delete-card">;
|
|
70
60
|
} & {
|
|
71
|
-
input:
|
|
72
|
-
card: typeof
|
|
61
|
+
input: Schema.Struct<{
|
|
62
|
+
card: typeof Schema.Any;
|
|
73
63
|
}>;
|
|
74
|
-
output: typeof
|
|
64
|
+
output: typeof Schema.Void;
|
|
75
65
|
}>;
|
|
76
66
|
export class DeleteCard extends DeleteCard_base {
|
|
77
67
|
}
|
|
@@ -84,10 +74,4 @@ export type Location = {
|
|
|
84
74
|
idx?: number;
|
|
85
75
|
};
|
|
86
76
|
export declare const isKanban: (object: unknown) => object is KanbanType;
|
|
87
|
-
export declare const createKanban: ({ space, name, typename, initialPivotColumn, }: {
|
|
88
|
-
space: Space;
|
|
89
|
-
name?: string;
|
|
90
|
-
typename?: string;
|
|
91
|
-
initialPivotColumn?: string;
|
|
92
|
-
}) => Promise<KanbanType>;
|
|
93
77
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGhC,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAKnD;;;;;;;GAOG;AAGH,eAAO,MAAM,oBAAoB,eAAwD,CAAC;AAC1F,eAAO,MAAM,uBAAuB,eAA2D,CAAC;AAEhG,eAAO,MAAM,kBAAkB;;;;EAc7B,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE7E,yBAAiB,YAAY,CAAC;;;;;;;;;;;;;;;IAG5B,MAAM,OAAO,MAAO,SAAQ,WAK1B;KAAG;;;;;;;;;;;;;;;;;;;;;IAEL,MAAM,OAAO,eAAgB,SAAQ,oBAgBnC;KAAG;;;;;;;;;IAEL,MAAM,OAAO,UAAW,SAAQ,eAK9B;KAAG;;CACN;AAUD,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,UAAU,CAAC;CAClB;AAED,MAAM,MAAM,QAAQ,GAAG;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,eAAO,MAAM,QAAQ,GAAI,QAAQ,OAAO,KAAG,MAAM,IAAI,UAA4D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"5.
|
|
1
|
+
{"version":"5.8.3"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-kanban",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.2-main.10c050d",
|
|
4
4
|
"description": "Kanban DXOS Surface plugin",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -33,25 +33,29 @@
|
|
|
33
33
|
"src"
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@preact/
|
|
37
|
-
"@
|
|
38
|
-
"
|
|
39
|
-
"@dxos/
|
|
40
|
-
"@dxos/
|
|
41
|
-
"@dxos/
|
|
42
|
-
"@dxos/async": "0.8.
|
|
43
|
-
"@dxos/
|
|
44
|
-
"@dxos/
|
|
45
|
-
"@dxos/
|
|
46
|
-
"@dxos/
|
|
47
|
-
"@dxos/
|
|
48
|
-
"@dxos/
|
|
49
|
-
"@dxos/
|
|
50
|
-
"@dxos/
|
|
51
|
-
"@dxos/plugin-
|
|
52
|
-
"@dxos/
|
|
53
|
-
"@dxos/
|
|
54
|
-
"@dxos/
|
|
36
|
+
"@preact-signals/safe-react": "^0.9.0",
|
|
37
|
+
"@preact/signals-core": "^1.9.0",
|
|
38
|
+
"effect": "3.14.21",
|
|
39
|
+
"@dxos/ai": "0.8.2-main.10c050d",
|
|
40
|
+
"@dxos/app-framework": "0.8.2-main.10c050d",
|
|
41
|
+
"@dxos/assistant": "0.8.2-main.10c050d",
|
|
42
|
+
"@dxos/async": "0.8.2-main.10c050d",
|
|
43
|
+
"@dxos/artifact": "0.8.2-main.10c050d",
|
|
44
|
+
"@dxos/echo": "0.8.2-main.10c050d",
|
|
45
|
+
"@dxos/echo-schema": "0.8.2-main.10c050d",
|
|
46
|
+
"@dxos/effect": "0.8.2-main.10c050d",
|
|
47
|
+
"@dxos/invariant": "0.8.2-main.10c050d",
|
|
48
|
+
"@dxos/plugin-client": "0.8.2-main.10c050d",
|
|
49
|
+
"@dxos/plugin-search": "0.8.2-main.10c050d",
|
|
50
|
+
"@dxos/plugin-graph": "0.8.2-main.10c050d",
|
|
51
|
+
"@dxos/plugin-space": "0.8.2-main.10c050d",
|
|
52
|
+
"@dxos/random": "0.8.2-main.10c050d",
|
|
53
|
+
"@dxos/react-client": "0.8.2-main.10c050d",
|
|
54
|
+
"@dxos/react-ui-form": "0.8.2-main.10c050d",
|
|
55
|
+
"@dxos/react-ui-stack": "0.8.2-main.10c050d",
|
|
56
|
+
"@dxos/react-ui-kanban": "0.8.2-main.10c050d",
|
|
57
|
+
"@dxos/schema": "0.8.2-main.10c050d",
|
|
58
|
+
"@dxos/util": "0.8.2-main.10c050d"
|
|
55
59
|
},
|
|
56
60
|
"devDependencies": {
|
|
57
61
|
"@types/react": "~18.2.0",
|
|
@@ -59,16 +63,19 @@
|
|
|
59
63
|
"react": "~18.2.0",
|
|
60
64
|
"react-dom": "~18.2.0",
|
|
61
65
|
"vite": "5.4.7",
|
|
62
|
-
"@dxos/
|
|
63
|
-
"@dxos/
|
|
64
|
-
"@dxos/react-ui
|
|
66
|
+
"@dxos/plugin-theme": "0.8.2-main.10c050d",
|
|
67
|
+
"@dxos/react-ui-syntax-highlighter": "0.8.2-main.10c050d",
|
|
68
|
+
"@dxos/react-ui": "0.8.2-main.10c050d",
|
|
69
|
+
"@dxos/react-ui-theme": "0.8.2-main.10c050d",
|
|
70
|
+
"@dxos/plugin-preview": "0.8.2-main.10c050d",
|
|
71
|
+
"@dxos/storybook-utils": "0.8.2-main.10c050d"
|
|
65
72
|
},
|
|
66
73
|
"peerDependencies": {
|
|
67
|
-
"effect": "3.13.3",
|
|
74
|
+
"effect": "^3.13.3",
|
|
68
75
|
"react": "~18.2.0",
|
|
69
76
|
"react-dom": "~18.2.0",
|
|
70
|
-
"@dxos/react-ui": "0.8.
|
|
71
|
-
"@dxos/react-ui
|
|
77
|
+
"@dxos/react-ui-theme": "0.8.2-main.10c050d",
|
|
78
|
+
"@dxos/react-ui": "0.8.2-main.10c050d"
|
|
72
79
|
},
|
|
73
80
|
"publishConfig": {
|
|
74
81
|
"access": "public"
|
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { pipe } from 'effect';
|
|
5
|
+
import { Schema, pipe } from 'effect';
|
|
6
6
|
|
|
7
|
+
import { createTool, ToolResult } from '@dxos/ai';
|
|
7
8
|
import { Capabilities, chain, contributes, createIntent, type PromiseIntentDispatcher } from '@dxos/app-framework';
|
|
8
|
-
import { defineArtifact
|
|
9
|
+
import { defineArtifact } from '@dxos/artifact';
|
|
9
10
|
import { createArtifactElement } from '@dxos/assistant';
|
|
10
|
-
import { isInstanceOf
|
|
11
|
+
import { isInstanceOf } from '@dxos/echo-schema';
|
|
11
12
|
import { invariant } from '@dxos/invariant';
|
|
12
13
|
import { SpaceAction } from '@dxos/plugin-space/types';
|
|
13
14
|
import { Filter, fullyQualifiedId, type Space } from '@dxos/react-client/echo';
|
|
@@ -16,7 +17,7 @@ import { KanbanType } from '@dxos/react-ui-kanban';
|
|
|
16
17
|
import { meta } from '../meta';
|
|
17
18
|
import { KanbanAction } from '../types';
|
|
18
19
|
|
|
19
|
-
const QualifiedId =
|
|
20
|
+
const QualifiedId = Schema.String.annotations({
|
|
20
21
|
description: 'The fully qualified ID of the kanban `spaceID:objectID`',
|
|
21
22
|
});
|
|
22
23
|
|
|
@@ -38,17 +39,17 @@ export default () => {
|
|
|
38
39
|
`,
|
|
39
40
|
schema: KanbanType,
|
|
40
41
|
tools: [
|
|
41
|
-
|
|
42
|
+
createTool(meta.id, {
|
|
42
43
|
name: 'create',
|
|
43
44
|
description: `
|
|
44
45
|
Create a new kanban board using an existing schema.
|
|
45
46
|
Use schema_create first to create a schema, or schema_list to choose an existing one.`,
|
|
46
47
|
caption: 'Creating kanban board...',
|
|
47
|
-
schema:
|
|
48
|
-
typename:
|
|
48
|
+
schema: Schema.Struct({
|
|
49
|
+
typename: Schema.String.annotations({
|
|
49
50
|
description: 'The fully qualified typename of the schema to use for the kanban cards.',
|
|
50
51
|
}),
|
|
51
|
-
pivotColumn:
|
|
52
|
+
pivotColumn: Schema.optional(Schema.String).annotations({
|
|
52
53
|
description: 'Optional field name to use as the column pivot.',
|
|
53
54
|
}),
|
|
54
55
|
}),
|
|
@@ -79,15 +80,15 @@ export default () => {
|
|
|
79
80
|
return ToolResult.Success(createArtifactElement(data.id));
|
|
80
81
|
},
|
|
81
82
|
}),
|
|
82
|
-
|
|
83
|
+
createTool(meta.id, {
|
|
83
84
|
name: 'list',
|
|
84
85
|
description: 'List all kanban boards in the current space.',
|
|
85
86
|
caption: 'Listing kanban boards...',
|
|
86
|
-
schema:
|
|
87
|
+
schema: Schema.Struct({}),
|
|
87
88
|
execute: async (_input, { extensions }) => {
|
|
88
89
|
invariant(extensions?.space, 'No space');
|
|
89
90
|
const space = extensions.space;
|
|
90
|
-
const { objects: boards } = await space.db.query(Filter.
|
|
91
|
+
const { objects: boards } = await space.db.query(Filter.type(KanbanType)).run();
|
|
91
92
|
|
|
92
93
|
const boardInfo = await Promise.all(
|
|
93
94
|
boards.map(async (board: KanbanType) => {
|
|
@@ -102,15 +103,15 @@ export default () => {
|
|
|
102
103
|
return ToolResult.Success(boardInfo);
|
|
103
104
|
},
|
|
104
105
|
}),
|
|
105
|
-
|
|
106
|
+
createTool(meta.id, {
|
|
106
107
|
name: 'inspect',
|
|
107
108
|
description: 'Get details about a specific kanban board.',
|
|
108
109
|
caption: 'Inspecting kanban board...',
|
|
109
|
-
schema:
|
|
110
|
+
schema: Schema.Struct({ id: QualifiedId }),
|
|
110
111
|
execute: async ({ id }, { extensions }) => {
|
|
111
112
|
invariant(extensions?.space, 'No space');
|
|
112
113
|
const space = extensions.space;
|
|
113
|
-
const { objects: boards } = await space.db.query(Filter.
|
|
114
|
+
const { objects: boards } = await space.db.query(Filter.type(KanbanType)).run();
|
|
114
115
|
const board = boards.find((board: KanbanType) => fullyQualifiedId(board) === id);
|
|
115
116
|
invariant(isInstanceOf(KanbanType, board));
|
|
116
117
|
|
|
@@ -2,21 +2,25 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { contributes, Capabilities, createResolver } from '@dxos/app-framework';
|
|
5
|
+
import { contributes, Capabilities, createResolver, type PluginContext } from '@dxos/app-framework';
|
|
6
6
|
import { invariant } from '@dxos/invariant';
|
|
7
|
+
import { ClientCapabilities } from '@dxos/plugin-client';
|
|
7
8
|
import { getSpace } from '@dxos/react-client/echo';
|
|
8
9
|
import { ViewProjection } from '@dxos/schema';
|
|
9
10
|
|
|
10
11
|
import { KANBAN_PLUGIN } from '../meta';
|
|
11
|
-
import {
|
|
12
|
+
import { initializeKanban } from '../testing';
|
|
13
|
+
import { KanbanAction } from '../types';
|
|
12
14
|
|
|
13
|
-
export default () =>
|
|
15
|
+
export default (context: PluginContext) =>
|
|
14
16
|
contributes(Capabilities.IntentResolver, [
|
|
15
17
|
createResolver({
|
|
16
18
|
intent: KanbanAction.Create,
|
|
17
|
-
resolve: async ({ space, name, typename, initialPivotColumn }) =>
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
resolve: async ({ space, name, typename, initialPivotColumn }) => {
|
|
20
|
+
const client = context.getCapability(ClientCapabilities.Client);
|
|
21
|
+
const { kanban } = await initializeKanban({ client, space, name, typename, initialPivotColumn });
|
|
22
|
+
return { data: { object: kanban } };
|
|
23
|
+
},
|
|
20
24
|
}),
|
|
21
25
|
createResolver({
|
|
22
26
|
intent: KanbanAction.DeleteCardField,
|
|
@@ -2,12 +2,15 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { type Schema } from 'effect';
|
|
5
6
|
import React, { useMemo } from 'react';
|
|
6
7
|
|
|
7
|
-
import { Capabilities, contributes, createSurface } from '@dxos/app-framework';
|
|
8
|
-
import {
|
|
8
|
+
import { Capabilities, contributes, createSurface, useCapabilities } from '@dxos/app-framework';
|
|
9
|
+
import { getTypenameOrThrow, toJsonSchema } from '@dxos/echo-schema';
|
|
9
10
|
import { findAnnotation } from '@dxos/effect';
|
|
11
|
+
import { ClientCapabilities } from '@dxos/plugin-client';
|
|
10
12
|
import { type CollectionType } from '@dxos/plugin-space/types';
|
|
13
|
+
import { useClient } from '@dxos/react-client';
|
|
11
14
|
import { getSpace, isSpace, type Space } from '@dxos/react-client/echo';
|
|
12
15
|
import { type InputProps, SelectInput, useFormValues } from '@dxos/react-ui-form';
|
|
13
16
|
import { type KanbanType } from '@dxos/react-ui-kanban';
|
|
@@ -31,28 +34,53 @@ export default () =>
|
|
|
31
34
|
component: ({ data }) => <KanbanViewEditor kanban={data.subject} />,
|
|
32
35
|
}),
|
|
33
36
|
createSurface({
|
|
34
|
-
id: `${KANBAN_PLUGIN}/create-initial-schema-form
|
|
37
|
+
id: `${KANBAN_PLUGIN}/create-initial-schema-form`,
|
|
35
38
|
role: 'form-input',
|
|
36
|
-
filter: (
|
|
37
|
-
|
|
39
|
+
filter: (
|
|
40
|
+
data,
|
|
41
|
+
): data is { prop: string; schema: Schema.Schema<any>; target: Space | CollectionType | undefined } => {
|
|
42
|
+
if (data.prop !== 'typename') {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const annotation = findAnnotation<boolean>((data.schema as Schema.Schema.All).ast, TypenameAnnotationId);
|
|
38
47
|
return !!annotation;
|
|
39
48
|
},
|
|
40
49
|
component: ({ data: { target }, ...inputProps }) => {
|
|
50
|
+
const client = useClient();
|
|
41
51
|
const props = inputProps as any as InputProps;
|
|
42
52
|
const space = isSpace(target) ? target : getSpace(target);
|
|
43
53
|
if (!space) {
|
|
44
54
|
return null;
|
|
45
55
|
}
|
|
46
56
|
|
|
47
|
-
const
|
|
48
|
-
|
|
57
|
+
const schemaWhitelists = useCapabilities(ClientCapabilities.SchemaWhiteList);
|
|
58
|
+
const whitelistedTypenames = useMemo(
|
|
59
|
+
() => new Set(schemaWhitelists.flatMap((typeArray) => typeArray.map((type) => type.typename))),
|
|
60
|
+
[schemaWhitelists],
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
const fixed = client.graph.schemaRegistry.schemas.filter((schema) =>
|
|
64
|
+
whitelistedTypenames.has(getTypenameOrThrow(schema)),
|
|
65
|
+
);
|
|
66
|
+
const dynamic = space?.db.schemaRegistry.query().runSync();
|
|
67
|
+
const typenames = Array.from(
|
|
68
|
+
new Set<string>([
|
|
69
|
+
...fixed.map((schema) => getTypenameOrThrow(schema)),
|
|
70
|
+
...dynamic.map((schema) => schema.typename),
|
|
71
|
+
]),
|
|
72
|
+
).sort();
|
|
73
|
+
|
|
74
|
+
return <SelectInput {...props} options={typenames.map((typename) => ({ value: typename }))} />;
|
|
49
75
|
},
|
|
50
76
|
}),
|
|
51
77
|
createSurface({
|
|
52
78
|
id: `${KANBAN_PLUGIN}/create-initial-schema-form-[pivot-column]`,
|
|
53
79
|
role: 'form-input',
|
|
54
|
-
filter: (
|
|
55
|
-
|
|
80
|
+
filter: (
|
|
81
|
+
data,
|
|
82
|
+
): data is { prop: string; schema: Schema.Schema<any>; target: Space | CollectionType | undefined } => {
|
|
83
|
+
const annotation = findAnnotation<boolean>((data.schema as Schema.Schema.All).ast, PivotColumnAnnotationId);
|
|
56
84
|
return !!annotation;
|
|
57
85
|
},
|
|
58
86
|
component: ({ data: { target }, ...inputProps }) => {
|
|
@@ -62,14 +90,20 @@ export default () =>
|
|
|
62
90
|
return null;
|
|
63
91
|
}
|
|
64
92
|
const { typename } = useFormValues();
|
|
93
|
+
// TODO(wittjosiah): Unify this schema lookup.
|
|
94
|
+
const schemaWhitelists = useCapabilities(ClientCapabilities.SchemaWhiteList);
|
|
95
|
+
const staticSchema = schemaWhitelists.flat().find((schema) => getTypenameOrThrow(schema) === typename);
|
|
65
96
|
const [selectedSchema] = space?.db.schemaRegistry.query({ typename }).runSync();
|
|
66
97
|
|
|
67
98
|
const singleSelectColumns = useMemo(() => {
|
|
68
|
-
|
|
99
|
+
const properties = staticSchema
|
|
100
|
+
? toJsonSchema(staticSchema).properties
|
|
101
|
+
: selectedSchema?.jsonSchema?.properties;
|
|
102
|
+
if (!properties) {
|
|
69
103
|
return [];
|
|
70
104
|
}
|
|
71
105
|
|
|
72
|
-
const columns = Object.entries(
|
|
106
|
+
const columns = Object.entries(properties).reduce<string[]>((acc, [key, value]) => {
|
|
73
107
|
if (typeof value === 'object' && value?.format === 'single-select') {
|
|
74
108
|
acc.push(key);
|
|
75
109
|
}
|
|
@@ -77,7 +111,7 @@ export default () =>
|
|
|
77
111
|
}, []);
|
|
78
112
|
|
|
79
113
|
return columns;
|
|
80
|
-
}, [selectedSchema?.jsonSchema]);
|
|
114
|
+
}, [selectedSchema?.jsonSchema, staticSchema]);
|
|
81
115
|
|
|
82
116
|
if (!typename) {
|
|
83
117
|
return null;
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import '@dxos-theme';
|
|
6
|
+
import { type StoryObj, type Meta } from '@storybook/react';
|
|
7
|
+
import React, { useCallback, useEffect, useState } from 'react';
|
|
8
|
+
|
|
9
|
+
import { IntentPlugin, SettingsPlugin } from '@dxos/app-framework';
|
|
10
|
+
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
11
|
+
import { Type } from '@dxos/echo';
|
|
12
|
+
import { assertEchoSchema } from '@dxos/echo-schema';
|
|
13
|
+
import { invariant } from '@dxos/invariant';
|
|
14
|
+
import { ClientPlugin } from '@dxos/plugin-client';
|
|
15
|
+
import { PreviewPlugin } from '@dxos/plugin-preview';
|
|
16
|
+
import { useGlobalFilteredObjects } from '@dxos/plugin-search';
|
|
17
|
+
import { SpacePlugin } from '@dxos/plugin-space';
|
|
18
|
+
import { StorybookLayoutPlugin } from '@dxos/plugin-storybook-layout';
|
|
19
|
+
import { ThemePlugin } from '@dxos/plugin-theme';
|
|
20
|
+
import { faker } from '@dxos/random';
|
|
21
|
+
import { useClient } from '@dxos/react-client';
|
|
22
|
+
import { Filter, useSpaces, useQuery, useSchema, live } from '@dxos/react-client/echo';
|
|
23
|
+
import { ViewEditor } from '@dxos/react-ui-form';
|
|
24
|
+
import { Kanban, KanbanType, useKanbanModel } from '@dxos/react-ui-kanban';
|
|
25
|
+
import { SyntaxHighlighter } from '@dxos/react-ui-syntax-highlighter';
|
|
26
|
+
import { defaultTx } from '@dxos/react-ui-theme';
|
|
27
|
+
import { DataType, ViewProjection } from '@dxos/schema';
|
|
28
|
+
import { withLayout } from '@dxos/storybook-utils';
|
|
29
|
+
|
|
30
|
+
import { initializeKanban } from '../testing';
|
|
31
|
+
import translations from '../translations';
|
|
32
|
+
|
|
33
|
+
faker.seed(0);
|
|
34
|
+
|
|
35
|
+
//
|
|
36
|
+
// Story components.
|
|
37
|
+
//
|
|
38
|
+
|
|
39
|
+
const rollOrg = () => ({
|
|
40
|
+
name: faker.commerce.productName(),
|
|
41
|
+
description: faker.lorem.paragraph(),
|
|
42
|
+
image: faker.image.url(),
|
|
43
|
+
website: faker.internet.url(),
|
|
44
|
+
status: faker.helpers.arrayElement(DataType.OrganizationStatusOptions).id,
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
const StorybookKanban = () => {
|
|
48
|
+
const client = useClient();
|
|
49
|
+
const spaces = useSpaces();
|
|
50
|
+
const space = spaces[spaces.length - 1];
|
|
51
|
+
const kanbans = useQuery(space, Filter.type(KanbanType));
|
|
52
|
+
const [kanban, setKanban] = useState<KanbanType>();
|
|
53
|
+
const [projection, setProjection] = useState<ViewProjection>();
|
|
54
|
+
const schema = useSchema(client, space, kanban?.cardView?.target?.query.typename);
|
|
55
|
+
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
if (kanbans.length && !kanban) {
|
|
58
|
+
const kanban = kanbans[0];
|
|
59
|
+
setKanban(kanban);
|
|
60
|
+
}
|
|
61
|
+
}, [kanbans]);
|
|
62
|
+
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
if (kanban?.cardView?.target && schema) {
|
|
65
|
+
const jsonSchema = Type.toJsonSchema(schema);
|
|
66
|
+
setProjection(new ViewProjection(jsonSchema, kanban.cardView.target));
|
|
67
|
+
}
|
|
68
|
+
// TODO(ZaymonFC): Is there a better way to get notified about deep changes in the json schema?
|
|
69
|
+
// @dmaretskyi? Once resolved, update in multiple places (e.g., storybooks).
|
|
70
|
+
}, [kanban?.cardView?.target, schema, JSON.stringify(schema ? Type.toJsonSchema(schema) : {})]);
|
|
71
|
+
|
|
72
|
+
const objects = useQuery(space, schema ? Filter.type(schema) : Filter.nothing());
|
|
73
|
+
const filteredObjects = useGlobalFilteredObjects(objects);
|
|
74
|
+
|
|
75
|
+
const model = useKanbanModel({
|
|
76
|
+
kanban,
|
|
77
|
+
schema,
|
|
78
|
+
projection,
|
|
79
|
+
items: filteredObjects,
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
const handleAddCard = useCallback(
|
|
83
|
+
(columnValue: string | undefined) => {
|
|
84
|
+
const path = model?.columnFieldPath;
|
|
85
|
+
if (space && schema && path) {
|
|
86
|
+
const card = live(schema, {
|
|
87
|
+
...rollOrg(),
|
|
88
|
+
[path]: columnValue,
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
space.db.add(card);
|
|
92
|
+
return card.id;
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
[space, schema, model],
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
const handleRemoveCard = useCallback((card: { id: string }) => space.db.remove(card), [space]);
|
|
99
|
+
|
|
100
|
+
const handleTypenameChanged = useCallback(
|
|
101
|
+
(typename: string) => {
|
|
102
|
+
invariant(schema);
|
|
103
|
+
invariant(kanban?.cardView?.target);
|
|
104
|
+
assertEchoSchema(schema).updateTypename(typename);
|
|
105
|
+
kanban.cardView.target.query.typename = typename;
|
|
106
|
+
},
|
|
107
|
+
[kanban?.cardView?.target, schema],
|
|
108
|
+
);
|
|
109
|
+
|
|
110
|
+
if (!schema || !kanban) {
|
|
111
|
+
return null;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return (
|
|
115
|
+
<div className='grow grid grid-cols-[1fr_350px]'>
|
|
116
|
+
{model ? <Kanban model={model} onAddCard={handleAddCard} onRemoveCard={handleRemoveCard} /> : <div />}
|
|
117
|
+
<div className='flex flex-col bs-full border-is border-separator overflow-y-auto'>
|
|
118
|
+
{kanban.cardView && (
|
|
119
|
+
<ViewEditor
|
|
120
|
+
registry={space?.db.schemaRegistry}
|
|
121
|
+
schema={schema}
|
|
122
|
+
view={kanban.cardView.target!}
|
|
123
|
+
onTypenameChanged={handleTypenameChanged}
|
|
124
|
+
onDelete={(fieldId: string) => {
|
|
125
|
+
console.log('[ViewEditor]', 'onDelete', fieldId);
|
|
126
|
+
}}
|
|
127
|
+
/>
|
|
128
|
+
)}
|
|
129
|
+
<SyntaxHighlighter language='json' className='w-full text-xs'>
|
|
130
|
+
{JSON.stringify({ cardView: kanban.cardView?.target, cardSchema: schema }, null, 2)}
|
|
131
|
+
</SyntaxHighlighter>
|
|
132
|
+
</div>
|
|
133
|
+
</div>
|
|
134
|
+
);
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
type StoryProps = {
|
|
138
|
+
rows?: number;
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
//
|
|
142
|
+
// Story definitions.
|
|
143
|
+
//
|
|
144
|
+
|
|
145
|
+
const meta: Meta<StoryProps> = {
|
|
146
|
+
title: 'plugins/plugin-kanban/Kanban',
|
|
147
|
+
component: StorybookKanban,
|
|
148
|
+
render: () => <StorybookKanban />,
|
|
149
|
+
parameters: { translations },
|
|
150
|
+
decorators: [
|
|
151
|
+
withLayout({ fullscreen: true }),
|
|
152
|
+
withPluginManager({
|
|
153
|
+
plugins: [
|
|
154
|
+
ThemePlugin({ tx: defaultTx }),
|
|
155
|
+
ClientPlugin({
|
|
156
|
+
types: [DataType.Organization, DataType.Person, KanbanType],
|
|
157
|
+
onClientInitialized: async (_, client) => {
|
|
158
|
+
await client.halo.createIdentity();
|
|
159
|
+
const space = await client.spaces.create();
|
|
160
|
+
await space.waitUntilReady();
|
|
161
|
+
const { schema, kanban } = await initializeKanban({
|
|
162
|
+
space,
|
|
163
|
+
client,
|
|
164
|
+
typename: DataType.Organization.typename,
|
|
165
|
+
initialPivotColumn: 'status',
|
|
166
|
+
});
|
|
167
|
+
space.db.add(kanban);
|
|
168
|
+
|
|
169
|
+
if (schema) {
|
|
170
|
+
// TODO(burdon): Replace with sdk/schema/testing.
|
|
171
|
+
Array.from({ length: 80 }).map(() => {
|
|
172
|
+
return space.db.add(live(schema, rollOrg()));
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
}),
|
|
177
|
+
StorybookLayoutPlugin(),
|
|
178
|
+
PreviewPlugin(),
|
|
179
|
+
SpacePlugin(),
|
|
180
|
+
IntentPlugin(),
|
|
181
|
+
SettingsPlugin(),
|
|
182
|
+
],
|
|
183
|
+
}),
|
|
184
|
+
],
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
export default meta;
|
|
188
|
+
|
|
189
|
+
type Story = StoryObj<StoryProps>;
|
|
190
|
+
|
|
191
|
+
export const Default: Story = {};
|