@dxos/plugin-kanban 0.8.4-main.2e9d522 → 0.8.4-main.3c1ae3b
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-UYVX622Q.mjs +28 -0
- package/dist/lib/browser/blueprint-definition-UYVX622Q.mjs.map +7 -0
- package/dist/lib/browser/{chunk-X44RHBZK.mjs → chunk-PEQVHFOX.mjs} +35 -42
- package/dist/lib/browser/chunk-PEQVHFOX.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +31 -33
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/{intent-resolver-E6O3LBAB.mjs → intent-resolver-NHCWHMPW.mjs} +20 -20
- package/dist/lib/browser/intent-resolver-NHCWHMPW.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-MWNNZYMN.mjs → react-surface-NSCKM4QW.mjs} +81 -98
- package/dist/lib/browser/react-surface-NSCKM4QW.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +3 -3
- package/dist/lib/node-esm/blueprint-definition-42P47FUY.mjs +30 -0
- package/dist/lib/node-esm/blueprint-definition-42P47FUY.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-6WK5CGYY.mjs → chunk-LTCOYU73.mjs} +35 -42
- package/dist/lib/node-esm/chunk-LTCOYU73.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +31 -33
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/{intent-resolver-LPASDELU.mjs → intent-resolver-L2OEBOJW.mjs} +20 -20
- package/dist/lib/node-esm/intent-resolver-L2OEBOJW.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-surface-T52BBG45.mjs → react-surface-WXYTWOY2.mjs} +81 -98
- package/dist/lib/node-esm/react-surface-WXYTWOY2.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +3 -3
- package/dist/types/src/KanbanPlugin.d.ts +1 -1
- 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/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/components/KanbanContainer.d.ts +3 -3
- package/dist/types/src/components/KanbanContainer.d.ts.map +1 -1
- package/dist/types/src/components/KanbanContainer.stories.d.ts +50 -6
- package/dist/types/src/components/KanbanContainer.stories.d.ts.map +1 -1
- package/dist/types/src/components/KanbanViewEditor.d.ts +3 -3
- package/dist/types/src/components/KanbanViewEditor.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +0 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +21 -9
- 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 +15 -54
- package/dist/types/src/types/schema.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +43 -40
- package/src/KanbanPlugin.tsx +49 -54
- package/src/capabilities/artifact-definition.ts +15 -11
- package/src/capabilities/blueprint-definition.ts +30 -0
- package/src/capabilities/index.ts +1 -1
- package/src/capabilities/intent-resolver.ts +11 -17
- package/src/capabilities/react-surface.tsx +24 -25
- package/src/components/KanbanContainer.stories.tsx +52 -73
- package/src/components/KanbanContainer.tsx +18 -31
- package/src/components/KanbanViewEditor.tsx +31 -37
- package/src/meta.ts +7 -5
- package/src/translations.ts +6 -6
- package/src/types/index.ts +0 -1
- package/src/types/schema.ts +22 -10
- 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.3c1ae3b",
|
|
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"
|
|
@@ -34,50 +36,51 @@
|
|
|
34
36
|
],
|
|
35
37
|
"dependencies": {
|
|
36
38
|
"@preact-signals/safe-react": "^0.9.0",
|
|
37
|
-
"@preact/signals-core": "^1.
|
|
38
|
-
"effect": "3.
|
|
39
|
-
"@dxos/ai": "0.8.4-main.
|
|
40
|
-
"@dxos/
|
|
41
|
-
"@dxos/
|
|
42
|
-
"@dxos/blueprints": "0.8.4-main.
|
|
43
|
-
"@dxos/
|
|
44
|
-
"@dxos/echo
|
|
45
|
-
"@dxos/
|
|
46
|
-
"@dxos/
|
|
47
|
-
"@dxos/
|
|
48
|
-
"@dxos/plugin-client": "0.8.4-main.
|
|
49
|
-
"@dxos/
|
|
50
|
-
"@dxos/plugin-
|
|
51
|
-
"@dxos/plugin-
|
|
52
|
-
"@dxos/
|
|
53
|
-
"@dxos/
|
|
54
|
-
"@dxos/react-
|
|
55
|
-
"@dxos/react-
|
|
56
|
-
"@dxos/react-ui-form": "0.8.4-main.
|
|
57
|
-
"@dxos/react-ui-kanban": "0.8.4-main.
|
|
58
|
-
"@dxos/schema": "0.8.4-main.
|
|
59
|
-
"@dxos/react-ui-stack": "0.8.4-main.
|
|
60
|
-
"@dxos/util": "0.8.4-main.
|
|
39
|
+
"@preact/signals-core": "^1.12.1",
|
|
40
|
+
"effect": "3.18.3",
|
|
41
|
+
"@dxos/ai": "0.8.4-main.3c1ae3b",
|
|
42
|
+
"@dxos/app-framework": "0.8.4-main.3c1ae3b",
|
|
43
|
+
"@dxos/assistant": "0.8.4-main.3c1ae3b",
|
|
44
|
+
"@dxos/blueprints": "0.8.4-main.3c1ae3b",
|
|
45
|
+
"@dxos/effect": "0.8.4-main.3c1ae3b",
|
|
46
|
+
"@dxos/echo": "0.8.4-main.3c1ae3b",
|
|
47
|
+
"@dxos/async": "0.8.4-main.3c1ae3b",
|
|
48
|
+
"@dxos/invariant": "0.8.4-main.3c1ae3b",
|
|
49
|
+
"@dxos/functions": "0.8.4-main.3c1ae3b",
|
|
50
|
+
"@dxos/plugin-client": "0.8.4-main.3c1ae3b",
|
|
51
|
+
"@dxos/log": "0.8.4-main.3c1ae3b",
|
|
52
|
+
"@dxos/plugin-graph": "0.8.4-main.3c1ae3b",
|
|
53
|
+
"@dxos/plugin-search": "0.8.4-main.3c1ae3b",
|
|
54
|
+
"@dxos/plugin-space": "0.8.4-main.3c1ae3b",
|
|
55
|
+
"@dxos/random": "0.8.4-main.3c1ae3b",
|
|
56
|
+
"@dxos/react-ui": "0.8.4-main.3c1ae3b",
|
|
57
|
+
"@dxos/react-client": "0.8.4-main.3c1ae3b",
|
|
58
|
+
"@dxos/react-ui-form": "0.8.4-main.3c1ae3b",
|
|
59
|
+
"@dxos/react-ui-kanban": "0.8.4-main.3c1ae3b",
|
|
60
|
+
"@dxos/schema": "0.8.4-main.3c1ae3b",
|
|
61
|
+
"@dxos/react-ui-stack": "0.8.4-main.3c1ae3b",
|
|
62
|
+
"@dxos/util": "0.8.4-main.3c1ae3b",
|
|
63
|
+
"@dxos/types": "0.8.4-main.3c1ae3b"
|
|
61
64
|
},
|
|
62
65
|
"devDependencies": {
|
|
63
|
-
"@types/react": "~
|
|
64
|
-
"@types/react-dom": "~
|
|
65
|
-
"react": "~
|
|
66
|
-
"react-dom": "~
|
|
67
|
-
"vite": "
|
|
68
|
-
"@dxos/plugin-preview": "0.8.4-main.
|
|
69
|
-
"@dxos/plugin-theme": "0.8.4-main.
|
|
70
|
-
"@dxos/react-ui-
|
|
71
|
-
"@dxos/
|
|
72
|
-
"@dxos/
|
|
73
|
-
"@dxos/
|
|
66
|
+
"@types/react": "~19.2.2",
|
|
67
|
+
"@types/react-dom": "~19.2.2",
|
|
68
|
+
"react": "~19.2.0",
|
|
69
|
+
"react-dom": "~19.2.0",
|
|
70
|
+
"vite": "7.1.9",
|
|
71
|
+
"@dxos/plugin-preview": "0.8.4-main.3c1ae3b",
|
|
72
|
+
"@dxos/plugin-theme": "0.8.4-main.3c1ae3b",
|
|
73
|
+
"@dxos/react-ui-theme": "0.8.4-main.3c1ae3b",
|
|
74
|
+
"@dxos/react-ui-syntax-highlighter": "0.8.4-main.3c1ae3b",
|
|
75
|
+
"@dxos/storybook-utils": "0.8.4-main.3c1ae3b",
|
|
76
|
+
"@dxos/test-utils": "0.8.4-main.3c1ae3b"
|
|
74
77
|
},
|
|
75
78
|
"peerDependencies": {
|
|
76
79
|
"effect": "^3.13.3",
|
|
77
|
-
"react": "
|
|
78
|
-
"react-dom": "
|
|
79
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
80
|
-
"@dxos/react-ui-theme": "0.8.4-main.
|
|
80
|
+
"react": "^19.0.0",
|
|
81
|
+
"react-dom": "^19.0.0",
|
|
82
|
+
"@dxos/react-ui": "0.8.4-main.3c1ae3b",
|
|
83
|
+
"@dxos/react-ui-theme": "0.8.4-main.3c1ae3b"
|
|
81
84
|
},
|
|
82
85
|
"publishConfig": {
|
|
83
86
|
"access": "public"
|
package/src/KanbanPlugin.tsx
CHANGED
|
@@ -2,62 +2,57 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
5
|
+
import { Capabilities, Events, contributes, createIntent, defineModule, definePlugin } from '@dxos/app-framework';
|
|
6
|
+
import { Type } from '@dxos/echo';
|
|
7
|
+
import { ClientCapabilities, ClientEvents } from '@dxos/plugin-client';
|
|
8
|
+
import { type CreateObjectIntent } from '@dxos/plugin-space/types';
|
|
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';
|
|
15
16
|
|
|
16
|
-
export const KanbanPlugin = () =>
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
defineModule({
|
|
59
|
-
id: `${meta.id}/module/artifact-definition`,
|
|
60
|
-
activatesOn: Events.SetupArtifactDefinition,
|
|
61
|
-
activate: ArtifactDefinition,
|
|
62
|
-
}),
|
|
63
|
-
]);
|
|
17
|
+
export const KanbanPlugin = definePlugin(meta, () => [
|
|
18
|
+
defineModule({
|
|
19
|
+
id: `${meta.id}/module/translations`,
|
|
20
|
+
activatesOn: Events.SetupTranslations,
|
|
21
|
+
activate: () => contributes(Capabilities.Translations, [...translations, ...kanbanTranslations]),
|
|
22
|
+
}),
|
|
23
|
+
defineModule({
|
|
24
|
+
id: `${meta.id}/module/metadata`,
|
|
25
|
+
activatesOn: Events.SetupMetadata,
|
|
26
|
+
activate: () =>
|
|
27
|
+
contributes(Capabilities.Metadata, {
|
|
28
|
+
id: Type.getTypename(Kanban.Kanban),
|
|
29
|
+
metadata: {
|
|
30
|
+
icon: 'ph--kanban--regular',
|
|
31
|
+
iconHue: 'green',
|
|
32
|
+
inputSchema: CreateKanbanSchema,
|
|
33
|
+
createObjectIntent: ((props, options) =>
|
|
34
|
+
createIntent(KanbanAction.Create, { ...props, space: options.space })) satisfies CreateObjectIntent,
|
|
35
|
+
},
|
|
36
|
+
}),
|
|
37
|
+
}),
|
|
38
|
+
defineModule({
|
|
39
|
+
id: `${meta.id}/module/schema`,
|
|
40
|
+
activatesOn: ClientEvents.SetupSchema,
|
|
41
|
+
activate: () => contributes(ClientCapabilities.Schema, [Kanban.Kanban]),
|
|
42
|
+
}),
|
|
43
|
+
defineModule({
|
|
44
|
+
id: `${meta.id}/module/react-surface`,
|
|
45
|
+
activatesOn: Events.SetupReactSurface,
|
|
46
|
+
activate: ReactSurface,
|
|
47
|
+
}),
|
|
48
|
+
defineModule({
|
|
49
|
+
id: `${meta.id}/module/intent-resolver`,
|
|
50
|
+
activatesOn: Events.SetupIntentResolver,
|
|
51
|
+
activate: IntentResolver,
|
|
52
|
+
}),
|
|
53
|
+
defineModule({
|
|
54
|
+
id: `${meta.id}/module/blueprint`,
|
|
55
|
+
activatesOn: Events.SetupArtifactDefinition,
|
|
56
|
+
activate: BlueprintDefinition,
|
|
57
|
+
}),
|
|
58
|
+
]);
|
|
@@ -2,18 +2,22 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// ISSUE(burdon): defineArtifact
|
|
6
|
+
// @ts-nocheck
|
|
6
7
|
|
|
7
|
-
import
|
|
8
|
-
import
|
|
8
|
+
import * as Function from 'effect/Function';
|
|
9
|
+
import * as Schema from 'effect/Schema';
|
|
10
|
+
|
|
11
|
+
import { ToolResult, createTool } from '@dxos/ai';
|
|
12
|
+
import { Capabilities, type PromiseIntentDispatcher, chain, contributes, createIntent } from '@dxos/app-framework';
|
|
9
13
|
import { createArtifactElement } from '@dxos/assistant';
|
|
10
14
|
import { defineArtifact } from '@dxos/blueprints';
|
|
11
15
|
import { Obj, Query } from '@dxos/echo';
|
|
12
16
|
import { invariant } from '@dxos/invariant';
|
|
13
17
|
import { SpaceAction } from '@dxos/plugin-space/types';
|
|
14
|
-
import { Filter,
|
|
18
|
+
import { Filter, type Space } from '@dxos/react-client/echo';
|
|
15
19
|
import { KanbanView } from '@dxos/react-ui-kanban';
|
|
16
|
-
import {
|
|
20
|
+
import { View } from '@dxos/schema';
|
|
17
21
|
import { isNonNullable } from '@dxos/util';
|
|
18
22
|
|
|
19
23
|
import { meta } from '../meta';
|
|
@@ -49,7 +53,7 @@ export default () => {
|
|
|
49
53
|
caption: 'Creating kanban board...',
|
|
50
54
|
schema: Schema.Struct({
|
|
51
55
|
typename: Schema.String.annotations({
|
|
52
|
-
description: 'The fully qualified
|
|
56
|
+
description: 'The fully qualified name of the record type to use for the kanban cards.',
|
|
53
57
|
}),
|
|
54
58
|
pivotColumn: Schema.optional(Schema.String).annotations({
|
|
55
59
|
description: 'Optional field name to use as the column pivot.',
|
|
@@ -65,7 +69,7 @@ export default () => {
|
|
|
65
69
|
return ToolResult.Error(`Schema not found: ${typename}`);
|
|
66
70
|
}
|
|
67
71
|
|
|
68
|
-
const intent = pipe(
|
|
72
|
+
const intent = Function.pipe(
|
|
69
73
|
createIntent(KanbanAction.Create, {
|
|
70
74
|
space: extensions.space,
|
|
71
75
|
typename,
|
|
@@ -90,7 +94,7 @@ export default () => {
|
|
|
90
94
|
execute: async (_input, { extensions }) => {
|
|
91
95
|
invariant(extensions?.space, 'No space');
|
|
92
96
|
const space = extensions.space;
|
|
93
|
-
const { objects } = await space.db.query(Filter.type(
|
|
97
|
+
const { objects } = await space.db.query(Filter.type(View.View)).run();
|
|
94
98
|
|
|
95
99
|
const boardInfo = await Promise.all(
|
|
96
100
|
objects.map(async (view) => {
|
|
@@ -100,7 +104,7 @@ export default () => {
|
|
|
100
104
|
}
|
|
101
105
|
|
|
102
106
|
return {
|
|
103
|
-
id:
|
|
107
|
+
id: Obj.getDXN(view).toString(),
|
|
104
108
|
name: view.name ?? 'Unnamed Kanban',
|
|
105
109
|
typename: view.query.typename,
|
|
106
110
|
};
|
|
@@ -120,8 +124,8 @@ export default () => {
|
|
|
120
124
|
const space = extensions.space;
|
|
121
125
|
const view = (await space.db
|
|
122
126
|
// TODO(wittjosiah): Filter.and should aggregate type
|
|
123
|
-
.query(Query.select(Filter.and(Filter.type(
|
|
124
|
-
.first()) as
|
|
127
|
+
.query(Query.select(Filter.and(Filter.type(View.View), Filter.id(id))))
|
|
128
|
+
.first()) as View.View;
|
|
125
129
|
|
|
126
130
|
const kanban = await view.presentation.load();
|
|
127
131
|
invariant(Obj.instanceOf(KanbanView, kanban));
|
|
@@ -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,35 +2,29 @@
|
|
|
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
|
-
import { ClientCapabilities } from '@dxos/plugin-client';
|
|
8
7
|
import { getSpace } from '@dxos/react-client/echo';
|
|
9
|
-
import {
|
|
8
|
+
import { Kanban } from '@dxos/react-ui-kanban/types';
|
|
9
|
+
import { ProjectionModel, View, getTypenameFromQuery } from '@dxos/schema';
|
|
10
10
|
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
11
|
+
import { meta } from '../meta';
|
|
12
|
+
import { KanbanAction } from '../types';
|
|
13
13
|
|
|
14
14
|
export default (context: PluginContext) =>
|
|
15
15
|
contributes(Capabilities.IntentResolver, [
|
|
16
16
|
createResolver({
|
|
17
17
|
intent: KanbanAction.Create,
|
|
18
18
|
resolve: async ({ space, name, typename, initialPivotColumn }) => {
|
|
19
|
-
const
|
|
20
|
-
const { view }
|
|
21
|
-
|
|
22
|
-
space,
|
|
23
|
-
name,
|
|
24
|
-
typename,
|
|
25
|
-
initialPivotColumn,
|
|
26
|
-
});
|
|
27
|
-
return { data: { object: view } };
|
|
19
|
+
const { view } = await View.makeFromSpace({ space, typename, pivotFieldName: initialPivotColumn });
|
|
20
|
+
const kanban = Kanban.make({ name, view });
|
|
21
|
+
return { data: { object: kanban } };
|
|
28
22
|
},
|
|
29
23
|
}),
|
|
30
24
|
createResolver({
|
|
31
25
|
intent: KanbanAction.DeleteCardField,
|
|
32
26
|
resolve: async ({ view, fieldId, deletionData }, undo) => {
|
|
33
|
-
const schema = getSpace(view)?.db.schemaRegistry.getSchema(view.query.
|
|
27
|
+
const schema = getSpace(view)?.db.schemaRegistry.getSchema(getTypenameFromQuery(view.query.ast)!);
|
|
34
28
|
invariant(schema);
|
|
35
29
|
const projection = new ProjectionModel(schema.jsonSchema, view.projection);
|
|
36
30
|
|
|
@@ -38,7 +32,7 @@ export default (context: PluginContext) =>
|
|
|
38
32
|
const { deleted, index } = projection.deleteFieldProjection(fieldId);
|
|
39
33
|
return {
|
|
40
34
|
undoable: {
|
|
41
|
-
message: ['card field deleted label', { ns:
|
|
35
|
+
message: ['card field deleted label', { ns: meta.id }],
|
|
42
36
|
data: { deletionData: { ...deleted, index } },
|
|
43
37
|
},
|
|
44
38
|
};
|
|
@@ -58,7 +52,7 @@ export default (context: PluginContext) =>
|
|
|
58
52
|
space.db.remove(card);
|
|
59
53
|
return {
|
|
60
54
|
undoable: {
|
|
61
|
-
message: ['card deleted label', { ns:
|
|
55
|
+
message: ['card deleted label', { ns: meta.id }],
|
|
62
56
|
data: { card },
|
|
63
57
|
},
|
|
64
58
|
};
|
|
@@ -2,17 +2,16 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import type * as Schema from 'effect/Schema';
|
|
6
6
|
import React, { useMemo } from 'react';
|
|
7
7
|
|
|
8
|
-
import { Capabilities, contributes, createSurface
|
|
8
|
+
import { Capabilities, contributes, createSurface } from '@dxos/app-framework';
|
|
9
9
|
import { Obj, Type } from '@dxos/echo';
|
|
10
10
|
import { findAnnotation } from '@dxos/effect';
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import { DataType } from '@dxos/schema';
|
|
11
|
+
import { type Space, getSpace, isSpace } from '@dxos/react-client/echo';
|
|
12
|
+
import { type FormFieldComponentProps, SelectField, useFormValues } from '@dxos/react-ui-form';
|
|
13
|
+
import { Kanban } from '@dxos/react-ui-kanban/types';
|
|
14
|
+
import { type Collection } from '@dxos/schema';
|
|
16
15
|
|
|
17
16
|
import { KanbanContainer, KanbanViewEditor } from '../components';
|
|
18
17
|
import { meta } from '../meta';
|
|
@@ -23,43 +22,43 @@ export default () =>
|
|
|
23
22
|
createSurface({
|
|
24
23
|
id: meta.id,
|
|
25
24
|
role: ['article', 'section'],
|
|
26
|
-
filter: (data): data is { subject:
|
|
27
|
-
|
|
28
|
-
component: ({ data, role }) => <KanbanContainer view={data.subject} role={role} />,
|
|
25
|
+
filter: (data): data is { subject: Kanban.Kanban } => Obj.instanceOf(Kanban.Kanban, data.subject),
|
|
26
|
+
component: ({ data, role }) => <KanbanContainer object={data.subject} role={role} />,
|
|
29
27
|
}),
|
|
30
28
|
createSurface({
|
|
31
29
|
id: `${meta.id}/object-settings`,
|
|
32
30
|
role: 'object-settings',
|
|
33
31
|
position: 'hoist',
|
|
34
|
-
filter: (data): data is { subject:
|
|
35
|
-
|
|
36
|
-
component: ({ data }) => <KanbanViewEditor view={data.subject} />,
|
|
32
|
+
filter: (data): data is { subject: Kanban.Kanban } => Obj.instanceOf(Kanban.Kanban, data.subject),
|
|
33
|
+
component: ({ data }) => <KanbanViewEditor object={data.subject} />,
|
|
37
34
|
}),
|
|
38
35
|
createSurface({
|
|
39
36
|
id: `${meta.id}/create-initial-schema-form-[pivot-column]`,
|
|
40
37
|
role: 'form-input',
|
|
41
38
|
filter: (
|
|
42
39
|
data,
|
|
43
|
-
): data is {
|
|
40
|
+
): data is {
|
|
41
|
+
prop: string;
|
|
42
|
+
schema: Schema.Schema<any>;
|
|
43
|
+
target: Space | Collection.Collection | undefined;
|
|
44
|
+
} => {
|
|
44
45
|
const annotation = findAnnotation<boolean>((data.schema as Schema.Schema.All).ast, PivotColumnAnnotationId);
|
|
45
46
|
return !!annotation;
|
|
46
47
|
},
|
|
47
48
|
component: ({ data: { target }, ...inputProps }) => {
|
|
48
|
-
const props = inputProps as any as
|
|
49
|
+
const props = inputProps as any as FormFieldComponentProps;
|
|
49
50
|
const space = isSpace(target) ? target : getSpace(target);
|
|
50
51
|
if (!space) {
|
|
51
52
|
return null;
|
|
52
53
|
}
|
|
53
|
-
const { typename } = useFormValues();
|
|
54
|
-
// TODO(wittjosiah): Unify this schema lookup.
|
|
55
|
-
const schemaWhitelists = useCapabilities(ClientCapabilities.SchemaWhiteList);
|
|
56
|
-
const staticSchema = schemaWhitelists.flat().find((schema) => Type.getTypename(schema) === typename);
|
|
57
|
-
const [selectedSchema] = space?.db.schemaRegistry.query({ typename }).runSync();
|
|
58
54
|
|
|
55
|
+
const { typename } = useFormValues('KanbanForm');
|
|
56
|
+
const [selectedSchema] = useMemo(
|
|
57
|
+
() => space?.db.schemaRegistry.query({ location: ['database', 'runtime'], typename }).runSync(),
|
|
58
|
+
[space, typename],
|
|
59
|
+
);
|
|
59
60
|
const singleSelectColumns = useMemo(() => {
|
|
60
|
-
const properties =
|
|
61
|
-
? Type.toJsonSchema(staticSchema).properties
|
|
62
|
-
: selectedSchema?.jsonSchema?.properties;
|
|
61
|
+
const properties = Type.toJsonSchema(selectedSchema).properties;
|
|
63
62
|
if (!properties) {
|
|
64
63
|
return [];
|
|
65
64
|
}
|
|
@@ -72,13 +71,13 @@ export default () =>
|
|
|
72
71
|
}, []);
|
|
73
72
|
|
|
74
73
|
return columns;
|
|
75
|
-
}, [selectedSchema
|
|
74
|
+
}, [selectedSchema]);
|
|
76
75
|
|
|
77
76
|
if (!typename) {
|
|
78
77
|
return null;
|
|
79
78
|
}
|
|
80
79
|
|
|
81
|
-
return <
|
|
80
|
+
return <SelectField {...props} options={singleSelectColumns.map((column) => ({ value: column }))} />;
|
|
82
81
|
},
|
|
83
82
|
}),
|
|
84
83
|
]);
|