@dxos/plugin-kanban 0.8.3 → 0.8.4-main.28f8d3d
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/{chunk-6JEDX6HA.mjs → chunk-5BR6HNHI.mjs} +35 -12
- package/dist/lib/browser/chunk-5BR6HNHI.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +17 -23
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/intent-resolver-65UVYRI2.mjs +111 -0
- package/dist/lib/browser/intent-resolver-65UVYRI2.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-HJL2JRJP.mjs → react-surface-KX5U6PJ2.mjs} +42 -91
- package/dist/lib/browser/react-surface-KX5U6PJ2.mjs.map +7 -0
- package/dist/lib/browser/{types.mjs → types/index.mjs} +4 -4
- package/dist/lib/node-esm/{chunk-7DHZSNGQ.mjs → chunk-WLFZKRIJ.mjs} +35 -12
- package/dist/lib/node-esm/chunk-WLFZKRIJ.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +17 -23
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/intent-resolver-R3MYQATZ.mjs +112 -0
- package/dist/lib/node-esm/intent-resolver-R3MYQATZ.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-surface-257WTPQZ.mjs → react-surface-BAMERRU5.mjs} +42 -91
- package/dist/lib/node-esm/react-surface-BAMERRU5.mjs.map +7 -0
- package/dist/lib/node-esm/{types.mjs → types/index.mjs} +4 -4
- 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/index.d.ts +0 -1
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- 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 +3 -3
- package/dist/types/src/components/KanbanContainer.d.ts.map +1 -1
- package/dist/types/src/components/KanbanContainer.stories.d.ts +1 -1
- 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/index.d.ts +1 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +24 -53
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/index.d.ts +4 -0
- package/dist/types/src/types/index.d.ts.map +1 -0
- package/dist/types/src/types/kanban.d.ts +11 -0
- package/dist/types/src/types/kanban.d.ts.map +1 -0
- package/dist/types/src/types/schema.d.ts +110 -0
- package/dist/types/src/types/schema.d.ts.map +1 -0
- package/dist/types/src/types/types.d.ts +4 -0
- package/dist/types/src/types/types.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +34 -30
- package/src/KanbanPlugin.tsx +7 -11
- package/src/capabilities/artifact-definition.ts +32 -21
- package/src/capabilities/index.ts +0 -1
- package/src/capabilities/intent-resolver.ts +14 -15
- package/src/capabilities/react-surface.tsx +16 -13
- package/src/components/KanbanContainer.stories.tsx +44 -47
- package/src/components/KanbanContainer.tsx +12 -12
- package/src/components/KanbanViewEditor.tsx +21 -65
- package/src/index.ts +2 -1
- package/src/translations.ts +7 -7
- package/src/types/index.ts +7 -0
- package/src/types/kanban.ts +29 -0
- package/src/{types.ts → types/schema.ts} +6 -27
- package/src/types/types.ts +7 -0
- package/dist/lib/browser/artifact-definition-6HNQFL2M.mjs +0 -178
- package/dist/lib/browser/artifact-definition-6HNQFL2M.mjs.map +0 -7
- package/dist/lib/browser/chunk-6JEDX6HA.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-QQOH5EV2.mjs +0 -297
- package/dist/lib/browser/intent-resolver-QQOH5EV2.mjs.map +0 -7
- package/dist/lib/browser/react-surface-HJL2JRJP.mjs.map +0 -7
- package/dist/lib/node/artifact-definition-GRCAYCVG.cjs +0 -193
- package/dist/lib/node/artifact-definition-GRCAYCVG.cjs.map +0 -7
- package/dist/lib/node/chunk-ATDUVDIE.cjs +0 -108
- package/dist/lib/node/chunk-ATDUVDIE.cjs.map +0 -7
- package/dist/lib/node/index.cjs +0 -128
- package/dist/lib/node/index.cjs.map +0 -7
- package/dist/lib/node/intent-resolver-6ZNOIHKY.cjs +0 -308
- package/dist/lib/node/intent-resolver-6ZNOIHKY.cjs.map +0 -7
- package/dist/lib/node/meta.json +0 -1
- package/dist/lib/node/react-surface-G2J6F7U5.cjs +0 -322
- package/dist/lib/node/react-surface-G2J6F7U5.cjs.map +0 -7
- package/dist/lib/node/types.cjs +0 -35
- package/dist/lib/node/types.cjs.map +0 -7
- package/dist/lib/node-esm/artifact-definition-FA2IAAUQ.mjs +0 -179
- package/dist/lib/node-esm/artifact-definition-FA2IAAUQ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-7DHZSNGQ.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-4TYFDM4E.mjs +0 -298
- package/dist/lib/node-esm/intent-resolver-4TYFDM4E.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-257WTPQZ.mjs.map +0 -7
- package/dist/types/src/testing/index.d.ts +0 -3
- package/dist/types/src/testing/index.d.ts.map +0 -1
- package/dist/types/src/testing/initialize-kanban.d.ts +0 -17
- package/dist/types/src/testing/initialize-kanban.d.ts.map +0 -1
- package/dist/types/src/testing/kanban-manager.d.ts +0 -7
- package/dist/types/src/testing/kanban-manager.d.ts.map +0 -1
- package/dist/types/src/testing/playwright/smoke.spec.d.ts +0 -2
- package/dist/types/src/testing/playwright/smoke.spec.d.ts.map +0 -1
- package/dist/types/src/types.d.ts +0 -76
- package/dist/types/src/types.d.ts.map +0 -1
- package/src/testing/index.ts +0 -6
- package/src/testing/initialize-kanban.ts +0 -128
- package/src/testing/kanban-manager.ts +0 -13
- package/src/testing/playwright/playwright.config.cts +0 -18
- package/src/testing/playwright/smoke.spec.ts +0 -7
- /package/dist/lib/browser/{types.mjs.map → types/index.mjs.map} +0 -0
- /package/dist/lib/node-esm/{types.mjs.map → types/index.mjs.map} +0 -0
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2024 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { Schema } from 'effect';
|
|
6
|
-
|
|
7
|
-
import { Obj, Ref, Type } from '@dxos/echo';
|
|
8
|
-
import { TypedObject, FormatEnum, TypeEnum, type JsonProp } from '@dxos/echo-schema';
|
|
9
|
-
import { invariant } from '@dxos/invariant';
|
|
10
|
-
import { type Client, PublicKey } from '@dxos/react-client';
|
|
11
|
-
import { type Space } from '@dxos/react-client/echo';
|
|
12
|
-
import { KanbanType } from '@dxos/react-ui-kanban';
|
|
13
|
-
import { createView, ViewProjection, createFieldId, getSchemaProperties } from '@dxos/schema';
|
|
14
|
-
import { capitalize } from '@dxos/util';
|
|
15
|
-
|
|
16
|
-
// TODO(wittjosiah): UI package shouldn't depend on client.
|
|
17
|
-
|
|
18
|
-
type InitializeKanbanProps = {
|
|
19
|
-
client: Client;
|
|
20
|
-
space: Space;
|
|
21
|
-
name?: string;
|
|
22
|
-
typename?: string;
|
|
23
|
-
initialPivotColumn?: string;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
const createDefaultTaskSchema = () => {
|
|
27
|
-
const stateOptions = [
|
|
28
|
-
{ id: PublicKey.random().truncate(), title: 'Draft', color: 'indigo' },
|
|
29
|
-
{ id: PublicKey.random().truncate(), title: 'Active', color: 'cyan' },
|
|
30
|
-
{ id: PublicKey.random().truncate(), title: 'Completed', color: 'emerald' },
|
|
31
|
-
];
|
|
32
|
-
|
|
33
|
-
const schema = TypedObject({
|
|
34
|
-
typename: `example.com/type/${PublicKey.random().truncate()}`,
|
|
35
|
-
version: '0.1.0',
|
|
36
|
-
})({
|
|
37
|
-
title: Schema.optional(Schema.String).annotations({ title: 'Title' }),
|
|
38
|
-
description: Schema.optional(Schema.String).annotations({ title: 'Description' }),
|
|
39
|
-
state: Schema.optional(Schema.String),
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
return { schema, stateOptions };
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
export const initializeKanban = async ({
|
|
46
|
-
client,
|
|
47
|
-
space,
|
|
48
|
-
name,
|
|
49
|
-
typename,
|
|
50
|
-
initialPivotColumn,
|
|
51
|
-
}: InitializeKanbanProps): Promise<{ kanban: KanbanType; schema?: Type.Schema }> => {
|
|
52
|
-
if (typename) {
|
|
53
|
-
const staticSchema = client.graph.schemaRegistry.schemas.find((schema) => Type.getTypename(schema) === typename);
|
|
54
|
-
const schema = await space.db.schemaRegistry.query({ typename }).firstOrUndefined();
|
|
55
|
-
|
|
56
|
-
const ast = staticSchema?.ast ?? schema?.ast;
|
|
57
|
-
const jsonSchema = staticSchema ? Type.toJsonSchema(staticSchema) : schema?.jsonSchema;
|
|
58
|
-
invariant(ast, `Schema not found: ${typename}`);
|
|
59
|
-
invariant(jsonSchema, `Schema not found: ${typename}`);
|
|
60
|
-
|
|
61
|
-
const fields = getSchemaProperties(ast)
|
|
62
|
-
.filter((prop) => prop.type !== 'object' || prop.format === FormatEnum.Ref)
|
|
63
|
-
.map((prop) => prop.name);
|
|
64
|
-
|
|
65
|
-
const view = createView({
|
|
66
|
-
name: "Kanban's card view",
|
|
67
|
-
typename,
|
|
68
|
-
jsonSchema,
|
|
69
|
-
fields,
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
const kanban = Obj.make(KanbanType, { cardView: Ref.make(view), columnFieldId: undefined, name });
|
|
73
|
-
if (initialPivotColumn) {
|
|
74
|
-
const viewProjection = new ViewProjection(jsonSchema, view);
|
|
75
|
-
const fieldId = viewProjection.getFieldId(initialPivotColumn);
|
|
76
|
-
if (fieldId) {
|
|
77
|
-
kanban.columnFieldId = fieldId;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
return { kanban, schema };
|
|
81
|
-
} else {
|
|
82
|
-
const { schema: taskSchema, stateOptions } = createDefaultTaskSchema();
|
|
83
|
-
const [schema] = await space.db.schemaRegistry.register([taskSchema]);
|
|
84
|
-
|
|
85
|
-
const view = createView({
|
|
86
|
-
name: "Kanban's card view",
|
|
87
|
-
typename: schema.typename,
|
|
88
|
-
jsonSchema: schema.jsonSchema,
|
|
89
|
-
fields: ['title', 'description'],
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
const viewProjection = new ViewProjection(schema.jsonSchema, view);
|
|
93
|
-
|
|
94
|
-
// Set description field to Markdown format.
|
|
95
|
-
const descriptionFieldId = viewProjection.getFieldId('description');
|
|
96
|
-
if (descriptionFieldId) {
|
|
97
|
-
const fieldProjection = viewProjection.getFieldProjection(descriptionFieldId);
|
|
98
|
-
if (fieldProjection) {
|
|
99
|
-
viewProjection.setFieldProjection({
|
|
100
|
-
...fieldProjection,
|
|
101
|
-
props: { ...fieldProjection.props, format: FormatEnum.Markdown },
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
const initialPivotField = 'state';
|
|
107
|
-
viewProjection.setFieldProjection({
|
|
108
|
-
field: {
|
|
109
|
-
id: createFieldId(),
|
|
110
|
-
path: initialPivotField as JsonProp,
|
|
111
|
-
size: 150,
|
|
112
|
-
},
|
|
113
|
-
props: {
|
|
114
|
-
property: initialPivotField as JsonProp,
|
|
115
|
-
type: TypeEnum.String,
|
|
116
|
-
format: FormatEnum.SingleSelect,
|
|
117
|
-
title: capitalize(initialPivotField),
|
|
118
|
-
options: stateOptions,
|
|
119
|
-
},
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
const fieldId = viewProjection.getFieldId(initialPivotField);
|
|
123
|
-
invariant(fieldId);
|
|
124
|
-
|
|
125
|
-
const kanban = Obj.make(KanbanType, { cardView: Ref.make(view), columnFieldId: fieldId });
|
|
126
|
-
return { kanban, schema };
|
|
127
|
-
}
|
|
128
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { nxE2EPreset } from '@nx/playwright/preset';
|
|
6
|
-
import { defineConfig } from '@playwright/test';
|
|
7
|
-
|
|
8
|
-
import { e2ePreset } from '@dxos/test-utils/playwright';
|
|
9
|
-
|
|
10
|
-
export default defineConfig({
|
|
11
|
-
...nxE2EPreset(__filename, { testDir: __dirname }),
|
|
12
|
-
...e2ePreset(__dirname),
|
|
13
|
-
webServer: {
|
|
14
|
-
command: 'pnpm -w nx storybook-e2e stories',
|
|
15
|
-
port: 9009,
|
|
16
|
-
reuseExistingServer: !process.env.CI,
|
|
17
|
-
},
|
|
18
|
-
});
|
|
File without changes
|
|
File without changes
|