@dxos/plugin-kanban 0.6.8-main.046e6cf
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/LICENSE +8 -0
- package/README.md +15 -0
- package/dist/lib/browser/KanbanMain-OVUL576T.mjs +444 -0
- package/dist/lib/browser/KanbanMain-OVUL576T.mjs.map +7 -0
- package/dist/lib/browser/chunk-DMDAZVOX.mjs +21 -0
- package/dist/lib/browser/chunk-DMDAZVOX.mjs.map +7 -0
- package/dist/lib/browser/chunk-LEPZRV4E.mjs +47 -0
- package/dist/lib/browser/chunk-LEPZRV4E.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +176 -0
- package/dist/lib/browser/index.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -0
- package/dist/lib/browser/meta.mjs +9 -0
- package/dist/lib/browser/meta.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +14 -0
- package/dist/lib/browser/types/index.mjs.map +7 -0
- package/dist/lib/node/KanbanMain-RSRZLAM5.cjs +453 -0
- package/dist/lib/node/KanbanMain-RSRZLAM5.cjs.map +7 -0
- package/dist/lib/node/chunk-CJTEPA5Z.cjs +54 -0
- package/dist/lib/node/chunk-CJTEPA5Z.cjs.map +7 -0
- package/dist/lib/node/chunk-RYK4NJNG.cjs +67 -0
- package/dist/lib/node/chunk-RYK4NJNG.cjs.map +7 -0
- package/dist/lib/node/index.cjs +192 -0
- package/dist/lib/node/index.cjs.map +7 -0
- package/dist/lib/node/meta.cjs +30 -0
- package/dist/lib/node/meta.cjs.map +7 -0
- package/dist/lib/node/meta.json +1 -0
- package/dist/lib/node/types/index.cjs +36 -0
- package/dist/lib/node/types/index.cjs.map +7 -0
- package/dist/types/src/KanbanPlugin.d.ts +4 -0
- package/dist/types/src/KanbanPlugin.d.ts.map +1 -0
- package/dist/types/src/components/KanbanBoard.d.ts +6 -0
- package/dist/types/src/components/KanbanBoard.d.ts.map +1 -0
- package/dist/types/src/components/KanbanCard.d.ts +9 -0
- package/dist/types/src/components/KanbanCard.d.ts.map +1 -0
- package/dist/types/src/components/KanbanColumn.d.ts +14 -0
- package/dist/types/src/components/KanbanColumn.d.ts.map +1 -0
- package/dist/types/src/components/KanbanMain.d.ts +7 -0
- package/dist/types/src/components/KanbanMain.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +5 -0
- package/dist/types/src/components/index.d.ts.map +1 -0
- package/dist/types/src/components/util.d.ts +7 -0
- package/dist/types/src/components/util.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +4 -0
- package/dist/types/src/index.d.ts.map +1 -0
- package/dist/types/src/meta.d.ts +15 -0
- package/dist/types/src/meta.d.ts.map +1 -0
- package/dist/types/src/sanity.test.d.ts +2 -0
- package/dist/types/src/sanity.test.d.ts.map +1 -0
- package/dist/types/src/stories/testing.d.ts +19 -0
- package/dist/types/src/stories/testing.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +20 -0
- package/dist/types/src/translations.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +3 -0
- package/dist/types/src/types/index.d.ts.map +1 -0
- package/dist/types/src/types/kanban.d.ts +76 -0
- package/dist/types/src/types/kanban.d.ts.map +1 -0
- package/dist/types/src/types/types.d.ts +18 -0
- package/dist/types/src/types/types.d.ts.map +1 -0
- package/package.json +85 -0
- package/src/KanbanPlugin.tsx +112 -0
- package/src/components/KanbanBoard.tsx +195 -0
- package/src/components/KanbanCard.tsx +82 -0
- package/src/components/KanbanColumn.tsx +143 -0
- package/src/components/KanbanMain.tsx +37 -0
- package/src/components/index.ts +8 -0
- package/src/components/util.ts +38 -0
- package/src/index.ts +9 -0
- package/src/meta.tsx +19 -0
- package/src/sanity.test.ts +13 -0
- package/src/stories/testing.ts +29 -0
- package/src/translations.ts +26 -0
- package/src/types/index.ts +6 -0
- package/src/types/kanban.ts +22 -0
- package/src/types/types.ts +57 -0
|
@@ -0,0 +1,453 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var KanbanMain_RSRZLAM5_exports = {};
|
|
30
|
+
__export(KanbanMain_RSRZLAM5_exports, {
|
|
31
|
+
default: () => KanbanMain_default
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(KanbanMain_RSRZLAM5_exports);
|
|
34
|
+
var import_chunk_RYK4NJNG = require("./chunk-RYK4NJNG.cjs");
|
|
35
|
+
var import_chunk_CJTEPA5Z = require("./chunk-CJTEPA5Z.cjs");
|
|
36
|
+
var import_react = __toESM(require("react"));
|
|
37
|
+
var import_echo_schema = require("@dxos/echo-schema");
|
|
38
|
+
var import_echo = require("@dxos/react-client/echo");
|
|
39
|
+
var import_react_ui = require("@dxos/react-ui");
|
|
40
|
+
var import_react_ui_theme = require("@dxos/react-ui-theme");
|
|
41
|
+
var import_core = require("@dnd-kit/core");
|
|
42
|
+
var import_sortable = require("@dnd-kit/sortable");
|
|
43
|
+
var import_react2 = __toESM(require("react"));
|
|
44
|
+
var import_echo2 = require("@dxos/react-client/echo");
|
|
45
|
+
var import_util = require("@dxos/util");
|
|
46
|
+
var import_sortable2 = require("@dnd-kit/sortable");
|
|
47
|
+
var import_utilities = require("@dnd-kit/utilities");
|
|
48
|
+
var import_react3 = require("@phosphor-icons/react");
|
|
49
|
+
var import_react4 = __toESM(require("react"));
|
|
50
|
+
var import_echo3 = require("@dxos/react-client/echo");
|
|
51
|
+
var import_react_ui2 = require("@dxos/react-ui");
|
|
52
|
+
var import_react_ui_editor = require("@dxos/react-ui-editor");
|
|
53
|
+
var import_react_ui_theme2 = require("@dxos/react-ui-theme");
|
|
54
|
+
var import_core2 = require("@dnd-kit/core");
|
|
55
|
+
var import_sortable3 = require("@dnd-kit/sortable");
|
|
56
|
+
var import_utilities2 = require("@dnd-kit/utilities");
|
|
57
|
+
var import_react5 = require("@phosphor-icons/react");
|
|
58
|
+
var import_react6 = __toESM(require("react"));
|
|
59
|
+
var import_react_ui3 = require("@dxos/react-ui");
|
|
60
|
+
var import_react_ui_theme3 = require("@dxos/react-ui-theme");
|
|
61
|
+
var import_util2 = require("@dxos/util");
|
|
62
|
+
var import_react7 = require("react");
|
|
63
|
+
var import_echo4 = require("@dxos/react-client/echo");
|
|
64
|
+
var import_util3 = require("@dxos/util");
|
|
65
|
+
var DeleteItem = ({ onClick }) => {
|
|
66
|
+
const { t } = (0, import_react_ui2.useTranslation)(import_chunk_CJTEPA5Z.KANBAN_PLUGIN);
|
|
67
|
+
return /* @__PURE__ */ import_react4.default.createElement(import_react_ui2.Button, {
|
|
68
|
+
variant: "ghost",
|
|
69
|
+
onClick,
|
|
70
|
+
classNames: "plb-0 pli-0.5 -mlb-1"
|
|
71
|
+
}, /* @__PURE__ */ import_react4.default.createElement("span", {
|
|
72
|
+
className: "sr-only"
|
|
73
|
+
}, t("delete item label")), /* @__PURE__ */ import_react4.default.createElement(import_react3.X, {
|
|
74
|
+
className: (0, import_react_ui_theme2.getSize)(4)
|
|
75
|
+
}));
|
|
76
|
+
};
|
|
77
|
+
var KanbanCardComponent = ({ column, item, debug = false, onDelete }) => {
|
|
78
|
+
const { themeMode } = (0, import_react_ui2.useThemeContext)();
|
|
79
|
+
const { t } = (0, import_react_ui2.useTranslation)(import_chunk_CJTEPA5Z.KANBAN_PLUGIN);
|
|
80
|
+
const { isDragging, attributes, listeners, transform, transition, setNodeRef } = (0, import_sortable2.useSortable)({
|
|
81
|
+
id: item.id,
|
|
82
|
+
data: {
|
|
83
|
+
type: "item",
|
|
84
|
+
column
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
const tx = transform ? Object.assign(transform, {
|
|
88
|
+
scaleY: 1
|
|
89
|
+
}) : null;
|
|
90
|
+
const { parentRef, focusAttributes } = (0, import_react_ui_editor.useTextEditor)(() => ({
|
|
91
|
+
initialValue: item.name,
|
|
92
|
+
extensions: [
|
|
93
|
+
(0, import_react_ui_editor.createDataExtensions)({
|
|
94
|
+
id: item.id,
|
|
95
|
+
text: (0, import_echo3.createDocAccessor)(item, [
|
|
96
|
+
"name"
|
|
97
|
+
])
|
|
98
|
+
}),
|
|
99
|
+
(0, import_react_ui_editor.createBasicExtensions)({
|
|
100
|
+
placeholder: t("item title placeholder")
|
|
101
|
+
}),
|
|
102
|
+
(0, import_react_ui_editor.createThemeExtensions)({
|
|
103
|
+
themeMode
|
|
104
|
+
})
|
|
105
|
+
]
|
|
106
|
+
}), [
|
|
107
|
+
item,
|
|
108
|
+
themeMode
|
|
109
|
+
]);
|
|
110
|
+
return /* @__PURE__ */ import_react4.default.createElement("div", {
|
|
111
|
+
ref: setNodeRef,
|
|
112
|
+
style: {
|
|
113
|
+
transform: import_utilities.CSS.Transform.toString(tx),
|
|
114
|
+
transition
|
|
115
|
+
},
|
|
116
|
+
className: (0, import_react_ui_theme2.mx)("flex grow", isDragging && "border border-neutral-400 dark:border-neutral-800")
|
|
117
|
+
}, /* @__PURE__ */ import_react4.default.createElement("div", {
|
|
118
|
+
className: (0, import_react_ui_theme2.mx)("flex items-start grow p-1", import_react_ui_theme2.attentionSurface, isDragging && "opacity-10")
|
|
119
|
+
}, /* @__PURE__ */ import_react4.default.createElement("button", {
|
|
120
|
+
className: "flex h-[40px] items-center",
|
|
121
|
+
...attributes,
|
|
122
|
+
...listeners
|
|
123
|
+
}, /* @__PURE__ */ import_react4.default.createElement(import_react3.DotsSixVertical, {
|
|
124
|
+
className: (0, import_react_ui_theme2.getSize)(5)
|
|
125
|
+
})), /* @__PURE__ */ import_react4.default.createElement("div", {
|
|
126
|
+
className: "flex flex-col grow pt-1"
|
|
127
|
+
}, /* @__PURE__ */ import_react4.default.createElement("div", {
|
|
128
|
+
...focusAttributes,
|
|
129
|
+
className: (0, import_react_ui_theme2.mx)(import_react_ui_theme2.focusRing, "rounded-sm p-1"),
|
|
130
|
+
ref: parentRef
|
|
131
|
+
}), debug && /* @__PURE__ */ import_react4.default.createElement("div", {
|
|
132
|
+
className: "text-xs text-red-800"
|
|
133
|
+
}, item.id.slice(0, 9))), onDelete && /* @__PURE__ */ import_react4.default.createElement("div", {
|
|
134
|
+
className: "flex h-[40px] items-center"
|
|
135
|
+
}, /* @__PURE__ */ import_react4.default.createElement(DeleteItem, {
|
|
136
|
+
onClick: onDelete
|
|
137
|
+
}))));
|
|
138
|
+
};
|
|
139
|
+
var useSubscription = (data) => {
|
|
140
|
+
const [_, setIter] = (0, import_react7.useState)([]);
|
|
141
|
+
(0, import_react7.useEffect)(() => {
|
|
142
|
+
const handle = (0, import_echo4.createSubscription)(() => setIter([]));
|
|
143
|
+
handle.update(data);
|
|
144
|
+
return () => handle.unsubscribe();
|
|
145
|
+
}, []);
|
|
146
|
+
};
|
|
147
|
+
var findLocation = (columns, id) => {
|
|
148
|
+
for (const column of columns) {
|
|
149
|
+
if (column.id === id) {
|
|
150
|
+
return {
|
|
151
|
+
column
|
|
152
|
+
};
|
|
153
|
+
} else {
|
|
154
|
+
const idx = column.items.filter(import_util3.nonNullable).findIndex((item) => item.id === id);
|
|
155
|
+
if (idx !== -1) {
|
|
156
|
+
return {
|
|
157
|
+
column,
|
|
158
|
+
item: column.items[idx],
|
|
159
|
+
idx
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
var DeleteColumn = ({ onClick }) => {
|
|
166
|
+
const { t } = (0, import_react_ui3.useTranslation)(import_chunk_CJTEPA5Z.KANBAN_PLUGIN);
|
|
167
|
+
return /* @__PURE__ */ import_react6.default.createElement(import_react_ui3.Button, {
|
|
168
|
+
variant: "ghost",
|
|
169
|
+
onClick,
|
|
170
|
+
classNames: "plb-0 pli-0.5 -mlb-1"
|
|
171
|
+
}, /* @__PURE__ */ import_react6.default.createElement("span", {
|
|
172
|
+
className: "sr-only"
|
|
173
|
+
}, t("delete column label")), /* @__PURE__ */ import_react6.default.createElement(import_react5.X, {
|
|
174
|
+
className: (0, import_react_ui_theme3.getSize)(4)
|
|
175
|
+
}));
|
|
176
|
+
};
|
|
177
|
+
var AddItem = ({ onClick }) => {
|
|
178
|
+
const { t } = (0, import_react_ui3.useTranslation)(import_chunk_CJTEPA5Z.KANBAN_PLUGIN);
|
|
179
|
+
return /* @__PURE__ */ import_react6.default.createElement(import_react_ui3.Button, {
|
|
180
|
+
variant: "ghost",
|
|
181
|
+
onClick,
|
|
182
|
+
classNames: "plb-0 pli-0.5 -mlb-1"
|
|
183
|
+
}, /* @__PURE__ */ import_react6.default.createElement("span", {
|
|
184
|
+
className: "sr-only"
|
|
185
|
+
}, t("add item label")), /* @__PURE__ */ import_react6.default.createElement(import_react5.Plus, {
|
|
186
|
+
className: (0, import_react_ui_theme3.getSize)(4)
|
|
187
|
+
}));
|
|
188
|
+
};
|
|
189
|
+
var KanbanColumnComponentPlaceholder = ({ onAdd }) => {
|
|
190
|
+
const { t } = (0, import_react_ui3.useTranslation)(import_chunk_CJTEPA5Z.KANBAN_PLUGIN);
|
|
191
|
+
return /* @__PURE__ */ import_react6.default.createElement("div", {
|
|
192
|
+
className: (0, import_react_ui_theme3.mx)("flex flex-col justify-center shadow rounded w-[300px] h-[300px]", import_react_ui_theme3.groupSurface)
|
|
193
|
+
}, /* @__PURE__ */ import_react6.default.createElement(import_react_ui3.Button, {
|
|
194
|
+
variant: "ghost",
|
|
195
|
+
onClick: onAdd,
|
|
196
|
+
classNames: "plb-0 pli-0.5 -mlb-1"
|
|
197
|
+
}, /* @__PURE__ */ import_react6.default.createElement("span", {
|
|
198
|
+
className: "sr-only"
|
|
199
|
+
}, t("add column label")), /* @__PURE__ */ import_react6.default.createElement(import_react5.Plus, {
|
|
200
|
+
className: (0, import_react_ui_theme3.getSize)(6)
|
|
201
|
+
})));
|
|
202
|
+
};
|
|
203
|
+
var KanbanColumnComponent = ({ column, itemMapper, debug = false, onCreate, onDelete }) => {
|
|
204
|
+
const { t } = (0, import_react_ui3.useTranslation)(import_chunk_CJTEPA5Z.KANBAN_PLUGIN);
|
|
205
|
+
useSubscription([
|
|
206
|
+
column.items
|
|
207
|
+
]);
|
|
208
|
+
const items = itemMapper?.(column.id, column.items.filter(import_util2.nonNullable)) ?? column.items;
|
|
209
|
+
const { setNodeRef: setDroppableNodeRef } = (0, import_core2.useDroppable)({
|
|
210
|
+
id: column.id
|
|
211
|
+
});
|
|
212
|
+
const { isDragging, attributes, listeners, transform, transition, setNodeRef } = (0, import_sortable3.useSortable)({
|
|
213
|
+
id: column.id,
|
|
214
|
+
data: {
|
|
215
|
+
type: "column"
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
const tx = transform ? Object.assign(transform, {
|
|
219
|
+
scaleY: 1
|
|
220
|
+
}) : null;
|
|
221
|
+
const handleAddItem = onCreate ? () => {
|
|
222
|
+
const item = onCreate(column);
|
|
223
|
+
column.items.splice(column.items.length, 0, item);
|
|
224
|
+
} : void 0;
|
|
225
|
+
const handleDeleteItem = (id) => {
|
|
226
|
+
const index = column.items.filter(import_util2.nonNullable).findIndex((column2) => column2.id === id);
|
|
227
|
+
if (index >= 0) {
|
|
228
|
+
column.items.splice(index, 1);
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
return /* @__PURE__ */ import_react6.default.createElement("div", {
|
|
232
|
+
ref: setNodeRef,
|
|
233
|
+
style: {
|
|
234
|
+
transform: import_utilities2.CSS.Transform.toString(tx),
|
|
235
|
+
transition
|
|
236
|
+
},
|
|
237
|
+
className: (0, import_react_ui_theme3.mx)("flex flex-col snap-center overflow-y-hidden", isDragging && "relative z-10")
|
|
238
|
+
}, /* @__PURE__ */ import_react6.default.createElement("div", {
|
|
239
|
+
className: (0, import_react_ui_theme3.mx)("flex flex-col py-2 overflow-hidden shadow rounded w-[300px] min-h-[300px]", isDragging ? import_react_ui_theme3.modalSurface : import_react_ui_theme3.groupSurface)
|
|
240
|
+
}, /* @__PURE__ */ import_react6.default.createElement("div", {
|
|
241
|
+
className: "flex items-center mb-2 px-2"
|
|
242
|
+
}, /* @__PURE__ */ import_react6.default.createElement("button", {
|
|
243
|
+
...attributes,
|
|
244
|
+
...listeners
|
|
245
|
+
}, /* @__PURE__ */ import_react6.default.createElement(import_react5.DotsSixVertical, {
|
|
246
|
+
className: (0, import_react_ui_theme3.getSize)(5)
|
|
247
|
+
})), /* @__PURE__ */ import_react6.default.createElement(import_react_ui3.Input.Root, null, /* @__PURE__ */ import_react6.default.createElement(import_react_ui3.Input.Label, {
|
|
248
|
+
srOnly: true
|
|
249
|
+
}, t("column title label")), /* @__PURE__ */ import_react6.default.createElement(import_react_ui3.Input.TextInput, {
|
|
250
|
+
variant: "subdued",
|
|
251
|
+
classNames: "px-2",
|
|
252
|
+
placeholder: t("column title placeholder"),
|
|
253
|
+
defaultValue: column.name,
|
|
254
|
+
onChange: ({ target: { value } }) => column.name = value
|
|
255
|
+
})), onDelete && /* @__PURE__ */ import_react6.default.createElement(DeleteColumn, {
|
|
256
|
+
onClick: onDelete
|
|
257
|
+
})), /* @__PURE__ */ import_react6.default.createElement(import_sortable3.SortableContext, {
|
|
258
|
+
strategy: import_sortable3.verticalListSortingStrategy,
|
|
259
|
+
items: items.filter(import_util2.nonNullable).map(({ id }) => id)
|
|
260
|
+
}, /* @__PURE__ */ import_react6.default.createElement("div", {
|
|
261
|
+
ref: setDroppableNodeRef,
|
|
262
|
+
className: "flex flex-col grow overflow-y-scroll space-y-2 pr-4"
|
|
263
|
+
}, items.filter(import_util2.nonNullable).map((item) => /* @__PURE__ */ import_react6.default.createElement("div", {
|
|
264
|
+
key: item.id,
|
|
265
|
+
id: item.id,
|
|
266
|
+
className: "flex pl-2"
|
|
267
|
+
}, /* @__PURE__ */ import_react6.default.createElement(KanbanCardComponent, {
|
|
268
|
+
column,
|
|
269
|
+
item,
|
|
270
|
+
onDelete: () => handleDeleteItem(item.id)
|
|
271
|
+
}))))), handleAddItem && /* @__PURE__ */ import_react6.default.createElement("div", {
|
|
272
|
+
className: "flex justify-center mt-2"
|
|
273
|
+
}, /* @__PURE__ */ import_react6.default.createElement(AddItem, {
|
|
274
|
+
onClick: handleAddItem
|
|
275
|
+
})), debug && /* @__PURE__ */ import_react6.default.createElement("div", {
|
|
276
|
+
className: "px-2 text-xs text-red-800"
|
|
277
|
+
}, column.id.slice(0, 9))));
|
|
278
|
+
};
|
|
279
|
+
var KanbanBoard = ({ model }) => {
|
|
280
|
+
const kanban = model.root;
|
|
281
|
+
useSubscription(kanban.columns);
|
|
282
|
+
const [_, setIter] = (0, import_react2.useState)([]);
|
|
283
|
+
(0, import_react2.useEffect)(() => {
|
|
284
|
+
const handle = (0, import_echo2.createSubscription)(() => setIter([]));
|
|
285
|
+
handle.update([
|
|
286
|
+
kanban.columns
|
|
287
|
+
]);
|
|
288
|
+
return () => handle.unsubscribe();
|
|
289
|
+
}, []);
|
|
290
|
+
const mouseSensor = (0, import_core.useSensor)(import_core.MouseSensor, {
|
|
291
|
+
activationConstraint: {
|
|
292
|
+
distance: 8
|
|
293
|
+
}
|
|
294
|
+
});
|
|
295
|
+
const [draggingColumn, setDraggingColumn] = (0, import_react2.useState)();
|
|
296
|
+
const [draggingItem, setDraggingItem] = (0, import_react2.useState)();
|
|
297
|
+
const itemMapper = (column, items) => {
|
|
298
|
+
const { source, target } = draggingItem ?? {};
|
|
299
|
+
if (source && target) {
|
|
300
|
+
if (source?.column.id !== target?.column.id && (column === source?.column.id || column === target?.column.id)) {
|
|
301
|
+
const modified = [
|
|
302
|
+
...items
|
|
303
|
+
];
|
|
304
|
+
if (column === source.column.id) {
|
|
305
|
+
modified.splice(source.idx, 1);
|
|
306
|
+
} else if (column === target.column.id) {
|
|
307
|
+
modified.splice(target.idx ?? modified.length, 0, source.item);
|
|
308
|
+
}
|
|
309
|
+
return modified;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
return items;
|
|
313
|
+
};
|
|
314
|
+
const handleDragStart = ({ active }) => {
|
|
315
|
+
kanban.columns.filter(import_util.nonNullable).forEach((column) => {
|
|
316
|
+
if (column.id === active.id) {
|
|
317
|
+
setDraggingColumn(column);
|
|
318
|
+
} else {
|
|
319
|
+
const idx = column.items.filter(import_util.nonNullable).findIndex((item) => item.id === active.id);
|
|
320
|
+
if (idx !== -1) {
|
|
321
|
+
setDraggingItem({
|
|
322
|
+
source: {
|
|
323
|
+
column,
|
|
324
|
+
item: column.items[idx],
|
|
325
|
+
idx
|
|
326
|
+
}
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
});
|
|
331
|
+
};
|
|
332
|
+
const handleDragMove = (event) => {
|
|
333
|
+
};
|
|
334
|
+
const handleDragOver = ({ active, over }) => {
|
|
335
|
+
if (draggingItem) {
|
|
336
|
+
const { source } = draggingItem;
|
|
337
|
+
const target = findLocation(kanban.columns.filter(import_util.nonNullable), over?.id);
|
|
338
|
+
if (active.id !== over?.id) {
|
|
339
|
+
setDraggingItem({
|
|
340
|
+
source,
|
|
341
|
+
target
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
};
|
|
346
|
+
const handleDragEnd = (event) => {
|
|
347
|
+
if (draggingColumn) {
|
|
348
|
+
const { active, over } = event;
|
|
349
|
+
const oldIndex = kanban.columns.filter(import_util.nonNullable).findIndex((column) => column.id === active.id);
|
|
350
|
+
const newIndex = kanban.columns.filter(import_util.nonNullable).findIndex((column) => column.id === over?.id);
|
|
351
|
+
(0, import_util.arrayMove)(kanban.columns, oldIndex, newIndex);
|
|
352
|
+
} else if (draggingItem) {
|
|
353
|
+
const { source, target } = draggingItem;
|
|
354
|
+
if (source.column.id === target.column.id) {
|
|
355
|
+
if (target.idx !== void 0) {
|
|
356
|
+
(0, import_util.arrayMove)(source.column.items, source.idx, target.idx);
|
|
357
|
+
}
|
|
358
|
+
} else {
|
|
359
|
+
source.column.items.splice(source.idx, 1);
|
|
360
|
+
target.column.items.splice(target.idx ?? target.column.items.length, 0, source.item);
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
setDraggingColumn(void 0);
|
|
364
|
+
setDraggingItem(void 0);
|
|
365
|
+
};
|
|
366
|
+
const handleDragCancel = () => {
|
|
367
|
+
setDraggingColumn(void 0);
|
|
368
|
+
setDraggingItem(void 0);
|
|
369
|
+
};
|
|
370
|
+
const handleCreateColumn = () => {
|
|
371
|
+
const column = model.createColumn();
|
|
372
|
+
kanban.columns.splice(kanban.columns.length, 0, column);
|
|
373
|
+
};
|
|
374
|
+
const handleDeleteColumn = (id) => {
|
|
375
|
+
const index = kanban.columns.filter(import_util.nonNullable).findIndex((column) => column.id === id);
|
|
376
|
+
if (index >= 0) {
|
|
377
|
+
kanban.columns.splice(index, 1);
|
|
378
|
+
}
|
|
379
|
+
};
|
|
380
|
+
const customModifier = ({ transform }) => {
|
|
381
|
+
if (draggingColumn) {
|
|
382
|
+
return {
|
|
383
|
+
...transform,
|
|
384
|
+
y: 0
|
|
385
|
+
};
|
|
386
|
+
} else {
|
|
387
|
+
return transform;
|
|
388
|
+
}
|
|
389
|
+
};
|
|
390
|
+
return /* @__PURE__ */ import_react2.default.createElement("div", {
|
|
391
|
+
className: "flex overflow-x-scroll"
|
|
392
|
+
}, /* @__PURE__ */ import_react2.default.createElement("div", {
|
|
393
|
+
className: "flex m-4 space-x-4 snap-x"
|
|
394
|
+
}, /* @__PURE__ */ import_react2.default.createElement(import_core.DndContext, {
|
|
395
|
+
sensors: [
|
|
396
|
+
mouseSensor
|
|
397
|
+
],
|
|
398
|
+
modifiers: [
|
|
399
|
+
customModifier
|
|
400
|
+
],
|
|
401
|
+
onDragStart: handleDragStart,
|
|
402
|
+
onDragMove: handleDragMove,
|
|
403
|
+
onDragOver: handleDragOver,
|
|
404
|
+
onDragEnd: handleDragEnd,
|
|
405
|
+
onDragCancel: handleDragCancel
|
|
406
|
+
}, /* @__PURE__ */ import_react2.default.createElement(import_sortable.SortableContext, {
|
|
407
|
+
strategy: import_sortable.horizontalListSortingStrategy,
|
|
408
|
+
items: kanban.columns.filter(import_util.nonNullable).map(({ id }) => id)
|
|
409
|
+
}, kanban.columns.filter(import_util.nonNullable).map((column) => /* @__PURE__ */ import_react2.default.createElement(KanbanColumnComponent, {
|
|
410
|
+
key: column.id,
|
|
411
|
+
column,
|
|
412
|
+
itemMapper,
|
|
413
|
+
onCreate: (column2) => model.createItem(column2),
|
|
414
|
+
onDelete: () => handleDeleteColumn(column.id)
|
|
415
|
+
}))), draggingItem && /* @__PURE__ */ import_react2.default.createElement(import_core.DragOverlay, {
|
|
416
|
+
style: {
|
|
417
|
+
margin: 0
|
|
418
|
+
}
|
|
419
|
+
}, /* @__PURE__ */ import_react2.default.createElement(KanbanCardComponent, {
|
|
420
|
+
item: draggingItem.source.item,
|
|
421
|
+
onDelete: () => {
|
|
422
|
+
}
|
|
423
|
+
})), handleCreateColumn && /* @__PURE__ */ import_react2.default.createElement(KanbanColumnComponentPlaceholder, {
|
|
424
|
+
onAdd: handleCreateColumn
|
|
425
|
+
}))));
|
|
426
|
+
};
|
|
427
|
+
var KanbanMain = ({ kanban }) => {
|
|
428
|
+
const space = (0, import_echo.getSpace)(kanban);
|
|
429
|
+
if (!space) {
|
|
430
|
+
return null;
|
|
431
|
+
}
|
|
432
|
+
const model = {
|
|
433
|
+
root: kanban,
|
|
434
|
+
createColumn: () => space.db.add((0, import_echo_schema.create)(import_chunk_RYK4NJNG.KanbanColumnType, {
|
|
435
|
+
items: []
|
|
436
|
+
})),
|
|
437
|
+
// TODO(burdon): Add metadata from column in the case of projections.
|
|
438
|
+
createItem: (column) => space.db.add((0, import_echo_schema.create)(import_chunk_RYK4NJNG.KanbanItemType, {
|
|
439
|
+
name: ""
|
|
440
|
+
}))
|
|
441
|
+
};
|
|
442
|
+
return /* @__PURE__ */ import_react.default.createElement(import_react_ui.Main.Content, {
|
|
443
|
+
classNames: [
|
|
444
|
+
import_react_ui_theme.fixedInsetFlexLayout,
|
|
445
|
+
import_react_ui_theme.topbarBlockPaddingStart,
|
|
446
|
+
import_react_ui_theme.bottombarBlockPaddingEnd
|
|
447
|
+
]
|
|
448
|
+
}, /* @__PURE__ */ import_react.default.createElement(KanbanBoard, {
|
|
449
|
+
model
|
|
450
|
+
}));
|
|
451
|
+
};
|
|
452
|
+
var KanbanMain_default = KanbanMain;
|
|
453
|
+
//# sourceMappingURL=KanbanMain-RSRZLAM5.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/KanbanMain.tsx", "../../../src/components/KanbanBoard.tsx", "../../../src/components/KanbanCard.tsx", "../../../src/components/KanbanColumn.tsx", "../../../src/components/util.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { type FC } from 'react';\n\nimport { create } from '@dxos/echo-schema';\nimport { getSpace } from '@dxos/react-client/echo';\nimport { Main } from '@dxos/react-ui';\nimport { topbarBlockPaddingStart, fixedInsetFlexLayout, bottombarBlockPaddingEnd } from '@dxos/react-ui-theme';\n\nimport { KanbanBoard } from './KanbanBoard';\nimport { type KanbanType, KanbanColumnType, KanbanItemType, type KanbanModel } from '../types';\n\nconst KanbanMain: FC<{ kanban: KanbanType }> = ({ kanban }) => {\n // const { t } = useTranslation(KANBAN_PLUGIN);\n const space = getSpace(kanban);\n if (!space) {\n return null;\n }\n\n // TODO(burdon): Should plugin create and pass in model?\n const model: KanbanModel = {\n root: kanban, // TODO(burdon): How to keep pure?\n createColumn: () => space.db.add(create(KanbanColumnType, { items: [] })),\n // TODO(burdon): Add metadata from column in the case of projections.\n createItem: (column) => space.db.add(create(KanbanItemType, { name: '' })),\n };\n\n return (\n <Main.Content classNames={[fixedInsetFlexLayout, topbarBlockPaddingStart, bottombarBlockPaddingEnd]}>\n <KanbanBoard model={model} />\n </Main.Content>\n );\n};\n\nexport default KanbanMain;\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport {\n DndContext,\n type DragEndEvent,\n type DragMoveEvent,\n type DragOverEvent,\n DragOverlay,\n type DragStartEvent,\n type Modifier,\n MouseSensor,\n useSensor,\n} from '@dnd-kit/core';\nimport { horizontalListSortingStrategy, SortableContext } from '@dnd-kit/sortable';\nimport React, { type FC, useEffect, useState } from 'react';\n\nimport { createSubscription } from '@dxos/react-client/echo';\nimport { arrayMove, nonNullable } from '@dxos/util';\n\nimport { KanbanCardComponent } from './KanbanCard';\nimport { type ItemsMapper, KanbanColumnComponent, KanbanColumnComponentPlaceholder } from './KanbanColumn';\nimport { findLocation, useSubscription } from './util';\nimport type { KanbanColumnType, KanbanItemType, Location, KanbanModel } from '../types';\n\n// TODO(burdon): Touch sensors.\n// TODO(burdon): Prevent browser nav back when swiping left/right.\n// TODO(burdon): Consistently use FC?\nexport const KanbanBoard: FC<{ model: KanbanModel }> = ({ model }) => {\n const kanban = model.root;\n // TODO(wittjosiah): Remove?\n useSubscription(kanban.columns);\n\n // TODO(burdon): Remove since now uses ECHO.\n const [_, setIter] = useState([]);\n\n useEffect(() => {\n const handle = createSubscription(() => setIter([]));\n handle.update([kanban.columns]);\n return () => handle.unsubscribe();\n }, []);\n\n const mouseSensor = useSensor(MouseSensor, {\n activationConstraint: {\n distance: 8,\n },\n });\n\n // Dragging column.\n // TODO(burdon): Dragging column causes flickering when dragging left to first column.\n const [draggingColumn, setDraggingColumn] = useState<KanbanColumnType | undefined>();\n\n // Dragging item.\n const [draggingItem, setDraggingItem] = useState<{ source: Location; target?: Location }>();\n // While dragging, temporarily remap which items should be visible inside each column.\n const itemMapper: ItemsMapper = (column: string, items: KanbanItemType[]) => {\n const { source, target } = draggingItem ?? {};\n if (source && target) {\n if (source?.column.id !== target?.column.id && (column === source?.column.id || column === target?.column.id)) {\n const modified = [...items];\n if (column === source.column.id) {\n // Temporarily remove from old column.\n modified.splice(source.idx!, 1);\n } else if (column === target.column.id) {\n // Temporarily insert into new column.\n // TODO(burdon): Use ref to track item being temporarily moved.\n modified.splice(target.idx ?? modified.length, 0, source.item!);\n }\n\n return modified;\n }\n }\n\n return items;\n };\n\n const handleDragStart = ({ active }: DragStartEvent) => {\n kanban.columns.filter(nonNullable).forEach((column) => {\n if (column.id === active.id) {\n setDraggingColumn(column);\n } else {\n const idx = column.items.filter(nonNullable).findIndex((item) => item.id === active.id);\n if (idx !== -1) {\n setDraggingItem({ source: { column, item: column.items![idx], idx } });\n }\n }\n });\n };\n\n const handleDragMove = (event: DragMoveEvent) => {};\n\n const handleDragOver = ({ active, over }: DragOverEvent) => {\n if (draggingItem) {\n const { source } = draggingItem;\n const target = findLocation(kanban.columns.filter(nonNullable), over?.id as string);\n if (active.id !== over?.id) {\n setDraggingItem({ source, target });\n }\n }\n };\n\n // TODO(burdon): Call model to update.\n const handleDragEnd = (event: DragEndEvent) => {\n if (draggingColumn) {\n const { active, over } = event;\n const oldIndex = kanban.columns.filter(nonNullable).findIndex((column) => column.id === active.id);\n const newIndex = kanban.columns.filter(nonNullable).findIndex((column) => column.id === over?.id);\n arrayMove(kanban.columns, oldIndex, newIndex);\n } else if (draggingItem) {\n const { source, target } = draggingItem;\n if (source.column.id === target!.column.id) {\n if (target!.idx !== undefined) {\n arrayMove(source.column.items!, source.idx!, target!.idx);\n }\n } else {\n source.column.items!.splice(source.idx!, 1);\n // TODO(burdon): Incorrect position when moving to new column.\n target!.column.items!.splice(target!.idx ?? target!.column.items!.length, 0, source.item!);\n }\n }\n\n setDraggingColumn(undefined);\n setDraggingItem(undefined);\n };\n\n const handleDragCancel = () => {\n setDraggingColumn(undefined);\n setDraggingItem(undefined);\n };\n\n const handleCreateColumn = () => {\n const column = model.createColumn();\n kanban.columns.splice(kanban.columns.length, 0, column);\n };\n\n // TODO(burdon): Move to model.\n const handleDeleteColumn = (id: string) => {\n const index = kanban.columns.filter(nonNullable).findIndex((column) => column.id === id);\n if (index >= 0) {\n kanban.columns.splice(index, 1);\n }\n };\n\n const customModifier: Modifier = ({ transform }) => {\n if (draggingColumn) {\n return {\n ...transform,\n y: 0,\n };\n } else {\n return transform;\n }\n };\n\n return (\n <div className='flex overflow-x-scroll'>\n <div className='flex m-4 space-x-4 snap-x'>\n <DndContext\n sensors={[mouseSensor]}\n modifiers={[customModifier]}\n onDragStart={handleDragStart}\n onDragMove={handleDragMove}\n onDragOver={handleDragOver}\n onDragEnd={handleDragEnd}\n onDragCancel={handleDragCancel}\n >\n <SortableContext\n strategy={horizontalListSortingStrategy}\n items={kanban.columns.filter(nonNullable).map(({ id }) => id!)}\n >\n {kanban.columns.filter(nonNullable).map((column) => (\n <KanbanColumnComponent\n key={column.id}\n column={column}\n itemMapper={itemMapper}\n onCreate={(column: KanbanColumnType) => model.createItem(column)}\n onDelete={() => handleDeleteColumn(column.id!)}\n />\n ))}\n </SortableContext>\n\n {/* Overlay required to drag across columns. */}\n {draggingItem && (\n <DragOverlay style={{ margin: 0 }}>\n <KanbanCardComponent item={draggingItem.source.item!} onDelete={() => {}} />\n </DragOverlay>\n )}\n\n {handleCreateColumn && <KanbanColumnComponentPlaceholder onAdd={handleCreateColumn} />}\n </DndContext>\n </div>\n </div>\n );\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { useSortable } from '@dnd-kit/sortable';\nimport { CSS } from '@dnd-kit/utilities';\nimport { DotsSixVertical, X } from '@phosphor-icons/react';\nimport React, { type FC } from 'react';\n\nimport { createDocAccessor } from '@dxos/react-client/echo';\nimport { Button, useThemeContext, useTranslation } from '@dxos/react-ui';\nimport {\n createBasicExtensions,\n createDataExtensions,\n createThemeExtensions,\n useTextEditor,\n} from '@dxos/react-ui-editor';\nimport { getSize, mx, attentionSurface, focusRing } from '@dxos/react-ui-theme';\n\nimport { KANBAN_PLUGIN } from '../meta';\nimport { type KanbanColumnType, type KanbanItemType } from '../types';\n\nconst DeleteItem = ({ onClick }: { onClick: () => void }) => {\n const { t } = useTranslation(KANBAN_PLUGIN);\n return (\n <Button variant='ghost' onClick={onClick} classNames='plb-0 pli-0.5 -mlb-1'>\n <span className='sr-only'>{t('delete item label')}</span>\n <X className={getSize(4)} />\n </Button>\n );\n};\n\nexport const KanbanCardComponent: FC<{\n column?: KanbanColumnType;\n item: KanbanItemType;\n debug?: boolean;\n onDelete?: () => void;\n}> = ({ column, item, debug = false, onDelete }) => {\n const { themeMode } = useThemeContext();\n const { t } = useTranslation(KANBAN_PLUGIN);\n const { isDragging, attributes, listeners, transform, transition, setNodeRef } = useSortable({\n id: item.id,\n data: { type: 'item', column },\n });\n const tx = transform ? Object.assign(transform, { scaleY: 1 }) : null;\n\n const { parentRef, focusAttributes } = useTextEditor(\n () => ({\n initialValue: item.name,\n extensions: [\n createDataExtensions({ id: item.id, text: createDocAccessor(item, ['name']) }),\n createBasicExtensions({ placeholder: t('item title placeholder') }),\n createThemeExtensions({ themeMode }),\n ],\n }),\n [item, themeMode],\n );\n\n return (\n <div\n ref={setNodeRef}\n style={{ transform: CSS.Transform.toString(tx), transition }}\n className={mx('flex grow', isDragging && 'border border-neutral-400 dark:border-neutral-800')}\n >\n <div className={mx('flex items-start grow p-1', attentionSurface, isDragging && 'opacity-10')}>\n {/* TODO(burdon): Standardize height (and below); e.g., via toolbar. */}\n <button className='flex h-[40px] items-center' {...attributes} {...listeners}>\n <DotsSixVertical className={getSize(5)} />\n </button>\n <div className='flex flex-col grow pt-1'>\n <div {...focusAttributes} className={mx(focusRing, 'rounded-sm p-1')} ref={parentRef} />\n {debug && <div className='text-xs text-red-800'>{item.id.slice(0, 9)}</div>}\n </div>\n {onDelete && (\n <div className='flex h-[40px] items-center'>\n <DeleteItem onClick={onDelete} />\n </div>\n )}\n </div>\n </div>\n );\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { useDroppable } from '@dnd-kit/core';\nimport { SortableContext, useSortable, verticalListSortingStrategy } from '@dnd-kit/sortable';\nimport { CSS } from '@dnd-kit/utilities';\nimport { DotsSixVertical, X, Plus } from '@phosphor-icons/react';\nimport React, { type FC } from 'react';\n\nimport { Button, Input, useTranslation } from '@dxos/react-ui';\nimport { modalSurface, getSize, groupSurface, mx } from '@dxos/react-ui-theme';\nimport { nonNullable } from '@dxos/util';\n\nimport { KanbanCardComponent } from './KanbanCard';\nimport { useSubscription } from './util';\nimport { KANBAN_PLUGIN } from '../meta';\nimport { type KanbanColumnType, type KanbanItemType } from '../types';\n\nexport type ItemsMapper = (column: string, items: KanbanItemType[]) => KanbanItemType[];\n\nconst DeleteColumn = ({ onClick }: { onClick: () => void }) => {\n const { t } = useTranslation(KANBAN_PLUGIN);\n return (\n <Button variant='ghost' onClick={onClick} classNames='plb-0 pli-0.5 -mlb-1'>\n <span className='sr-only'>{t('delete column label')}</span>\n <X className={getSize(4)} />\n </Button>\n );\n};\n\nconst AddItem = ({ onClick }: { onClick: () => void }) => {\n const { t } = useTranslation(KANBAN_PLUGIN);\n return (\n <Button variant='ghost' onClick={onClick} classNames='plb-0 pli-0.5 -mlb-1'>\n <span className='sr-only'>{t('add item label')}</span>\n <Plus className={getSize(4)} />\n </Button>\n );\n};\n\n// TODO(burdon): Factor out container.\nexport const KanbanColumnComponentPlaceholder: FC<{ onAdd: () => void }> = ({ onAdd }) => {\n const { t } = useTranslation(KANBAN_PLUGIN);\n return (\n <div className={mx('flex flex-col justify-center shadow rounded w-[300px] h-[300px]', groupSurface)}>\n <Button variant='ghost' onClick={onAdd} classNames='plb-0 pli-0.5 -mlb-1'>\n <span className='sr-only'>{t('add column label')}</span>\n <Plus className={getSize(6)} />\n </Button>\n </div>\n );\n};\n\nexport const KanbanColumnComponent: FC<{\n column: KanbanColumnType;\n itemMapper?: ItemsMapper;\n debug?: boolean; // TODO(burdon): Context.\n onCreate?: (column: KanbanColumnType) => KanbanItemType;\n onDelete?: () => void;\n}> = ({ column, itemMapper, debug = false, onCreate, onDelete }) => {\n const { t } = useTranslation(KANBAN_PLUGIN);\n\n // TODO(wittjosiah): Remove?\n useSubscription([column.items]);\n const items = itemMapper?.(column.id!, column.items.filter(nonNullable)) ?? column.items!;\n\n const { setNodeRef: setDroppableNodeRef } = useDroppable({ id: column.id! });\n const { isDragging, attributes, listeners, transform, transition, setNodeRef } = useSortable({\n id: column.id!,\n data: { type: 'column' },\n });\n const tx = transform ? Object.assign(transform, { scaleY: 1 }) : null;\n\n const handleAddItem = onCreate\n ? () => {\n const item = onCreate(column);\n column.items!.splice(column.items!.length, 0, item);\n }\n : undefined;\n\n const handleDeleteItem = (id: string) => {\n const index = column.items.filter(nonNullable).findIndex((column) => column.id === id);\n if (index >= 0) {\n column.items!.splice(index, 1);\n }\n };\n\n return (\n <div\n ref={setNodeRef}\n style={{ transform: CSS.Transform.toString(tx), transition }}\n className={mx('flex flex-col snap-center overflow-y-hidden', isDragging && 'relative z-10')}\n >\n {/* TODO(burdon): Width approx mobile phone width. */}\n <div\n className={mx(\n 'flex flex-col py-2 overflow-hidden shadow rounded w-[300px] min-h-[300px]',\n isDragging ? modalSurface : groupSurface,\n )}\n >\n <div className='flex items-center mb-2 px-2'>\n <button {...attributes} {...listeners}>\n <DotsSixVertical className={getSize(5)} />\n </button>\n\n <Input.Root>\n <Input.Label srOnly>{t('column title label')}</Input.Label>\n <Input.TextInput\n variant='subdued'\n classNames='px-2'\n placeholder={t('column title placeholder')}\n defaultValue={column.name}\n onChange={({ target: { value } }) => (column.name = value)}\n />\n </Input.Root>\n\n {/* TODO(burdon): Menu. */}\n {onDelete && <DeleteColumn onClick={onDelete} />}\n </div>\n\n {/* TODO(burdon): Scrolling (radix; see kai/mosaic). */}\n <SortableContext strategy={verticalListSortingStrategy} items={items.filter(nonNullable).map(({ id }) => id)}>\n <div ref={setDroppableNodeRef} className='flex flex-col grow overflow-y-scroll space-y-2 pr-4'>\n {items.filter(nonNullable).map((item) => (\n <div key={item.id} id={item.id} className='flex pl-2'>\n <KanbanCardComponent column={column} item={item} onDelete={() => handleDeleteItem(item.id)} />\n </div>\n ))}\n </div>\n </SortableContext>\n\n {handleAddItem && (\n <div className='flex justify-center mt-2'>\n <AddItem onClick={handleAddItem} />\n </div>\n )}\n\n {debug && <div className='px-2 text-xs text-red-800'>{column.id!.slice(0, 9)}</div>}\n </div>\n </div>\n );\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { useEffect, useState } from 'react';\n\nimport { createSubscription } from '@dxos/react-client/echo';\nimport { nonNullable } from '@dxos/util';\n\nimport { type KanbanColumnType, type Location } from '../types';\n\n// TODO(burdon): Factor out.\nexport const useSubscription = (data: any) => {\n const [_, setIter] = useState([]);\n useEffect(() => {\n const handle = createSubscription(() => setIter([]));\n handle.update(data);\n return () => handle.unsubscribe();\n }, []);\n};\n\n/**\n * Find the column or item within the model.\n */\n// TODO(burdon): Move to model.\nexport const findLocation = (columns: KanbanColumnType[], id: string): Location | undefined => {\n for (const column of columns) {\n // TODO(burdon): Need transient ID for UX.\n if (column.id === id) {\n return { column };\n } else {\n const idx = column.items.filter(nonNullable).findIndex((item) => item.id === id);\n if (idx !== -1) {\n return { column, item: column.items![idx], idx };\n }\n }\n }\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,mBAA+B;AAE/B,yBAAuB;AACvB,kBAAyB;AACzB,sBAAqB;AACrB,4BAAwF;ACLxF,kBAUO;AACP,sBAA+D;AAC/D,IAAAA,gBAAoD;AAEpD,IAAAC,eAAmC;AACnC,kBAAuC;ACfvC,IAAAC,mBAA4B;AAC5B,uBAAoB;AACpB,IAAAF,gBAAmC;AACnC,IAAAA,gBAA+B;AAE/B,IAAAC,eAAkC;AAClC,IAAAE,mBAAwD;AACxD,6BAKO;AACP,IAAAC,yBAAyD;ACbzD,IAAAC,eAA6B;AAC7B,IAAAH,mBAA0E;AAC1E,IAAAI,oBAAoB;AACpB,IAAAN,gBAAyC;AACzC,IAAAA,gBAA+B;AAE/B,IAAAG,mBAA8C;AAC9C,IAAAC,yBAAwD;AACxD,IAAAG,eAA4B;ACR5B,IAAAP,gBAAoC;AAEpC,IAAAC,eAAmC;AACnC,IAAAM,eAA4B;AFe5B,IAAMC,aAAa,CAAC,EAAEC,QAAO,MAA2B;AACtD,QAAM,EAAEC,EAAC,QAAKC,iCAAeC,mCAAAA;AAC7B,SACE,8BAAAC,QAAA,cAACC,yBAAAA;IAAOC,SAAQ;IAAQN;IAAkBO,YAAW;KACnD,8BAAAH,QAAA,cAACI,QAAAA;IAAKC,WAAU;KAAWR,EAAE,mBAAA,CAAA,GAC7B,8BAAAG,QAAA,cAACM,iBAAAA;IAAED,eAAWE,gCAAQ,CAAA;;AAG5B;AAEO,IAAMC,sBAKR,CAAC,EAAEC,QAAQC,MAAMC,QAAQ,OAAOC,SAAQ,MAAE;AAC7C,QAAM,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pE,YAA6B6F,MAAMwC,WAAWrI,OAAAA;IACzDG,UAAU,MAAMsH,mBAAmBzH,OAAOa,EAAE;QAMjD0F,gBACChH,8BAAAA,QAAA,cAAC+I,yBAAAA;IAAYpG,OAAO;MAAEqG,QAAQ;IAAE;KAC9BhJ,8BAAAA,QAAA,cAACQ,qBAAAA;IAAoBE,MAAMsG,aAAaE,OAAOxG;IAAOE,UAAU,MAAA;IAAO;OAI1EoH,sBAAsBhI,8BAAAA,QAAA,cAACwE,kCAAAA;IAAiCC,OAAOuD;;AAK1E;ADpLA,IAAMiB,aAAyC,CAAC,EAAE1C,OAAM,MAAE;AAExD,QAAM2C,YAAQC,sBAAS5C,MAAAA;AACvB,MAAI,CAAC2C,OAAO;AACV,WAAO;EACT;AAGA,QAAM5C,QAAqB;IACzBE,MAAMD;IACN0B,cAAc,MAAMiB,MAAME,GAAGC,QAAIC,2BAAOC,wCAAkB;MAAEtF,OAAO,CAAA;IAAG,CAAA,CAAA;;IAEtE6E,YAAY,CAACrI,WAAWyI,MAAME,GAAGC,QAAIC,2BAAOE,sCAAgB;MAAEvH,MAAM;IAAG,CAAA,CAAA;EACzE;AAEA,SACEjC,6BAAAA,QAAA,cAACyJ,qBAAKC,SAAO;IAACvJ,YAAY;MAACwJ;MAAsBC;MAAyBC;;KACxE7J,6BAAAA,QAAA,cAACqG,aAAAA;IAAYC;;AAGnB;AAEA,IAAA,qBAAe2C;",
|
|
6
|
+
"names": ["import_react", "import_echo", "import_sortable", "import_react_ui", "import_react_ui_theme", "import_core", "import_utilities", "import_util", "DeleteItem", "onClick", "t", "useTranslation", "KANBAN_PLUGIN", "React", "Button", "variant", "classNames", "span", "className", "X", "getSize", "KanbanCardComponent", "column", "item", "debug", "onDelete", "themeMode", "useThemeContext", "isDragging", "attributes", "listeners", "transform", "transition", "setNodeRef", "useSortable", "id", "data", "type", "tx", "Object", "assign", "scaleY", "parentRef", "focusAttributes", "useTextEditor", "initialValue", "name", "extensions", "createDataExtensions", "text", "createDocAccessor", "createBasicExtensions", "placeholder", "createThemeExtensions", "div", "ref", "style", "CSS", "Transform", "toString", "mx", "attentionSurface", "button", "DotsSixVertical", "focusRing", "slice", "useSubscription", "_", "setIter", "useState", "useEffect", "handle", "createSubscription", "update", "unsubscribe", "findLocation", "columns", "idx", "items", "filter", "nonNullable", "findIndex", "DeleteColumn", "AddItem", "Plus", "KanbanColumnComponentPlaceholder", "onAdd", "groupSurface", "KanbanColumnComponent", "itemMapper", "onCreate", "setDroppableNodeRef", "useDroppable", "handleAddItem", "splice", "length", "undefined", "handleDeleteItem", "index", "modalSurface", "Input", "Root", "Label", "srOnly", "TextInput", "defaultValue", "onChange", "target", "value", "SortableContext", "strategy", "verticalListSortingStrategy", "map", "key", "KanbanBoard", "model", "kanban", "root", "mouseSensor", "useSensor", "MouseSensor", "activationConstraint", "distance", "draggingColumn", "setDraggingColumn", "draggingItem", "setDraggingItem", "source", "modified", "handleDragStart", "active", "forEach", "handleDragMove", "event", "handleDragOver", "over", "handleDragEnd", "oldIndex", "newIndex", "arrayMove", "handleDragCancel", "handleCreateColumn", "createColumn", "handleDeleteColumn", "customModifier", "y", "DndContext", "sensors", "modifiers", "onDragStart", "onDragMove", "onDragOver", "onDragEnd", "onDragCancel", "horizontalListSortingStrategy", "createItem", "DragOverlay", "margin", "KanbanMain", "space", "getSpace", "db", "add", "create", "KanbanColumnType", "KanbanItemType", "Main", "Content", "fixedInsetFlexLayout", "topbarBlockPaddingStart", "bottombarBlockPaddingEnd"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var chunk_CJTEPA5Z_exports = {};
|
|
30
|
+
__export(chunk_CJTEPA5Z_exports, {
|
|
31
|
+
KANBAN_PLUGIN: () => KANBAN_PLUGIN,
|
|
32
|
+
meta_default: () => meta_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(chunk_CJTEPA5Z_exports);
|
|
35
|
+
var import_react = require("@phosphor-icons/react");
|
|
36
|
+
var import_react2 = __toESM(require("react"));
|
|
37
|
+
var import_app_framework = require("@dxos/app-framework");
|
|
38
|
+
var KANBAN_PLUGIN = "dxos.org/plugin/kanban";
|
|
39
|
+
var meta_default = (0, import_app_framework.pluginMeta)({
|
|
40
|
+
id: KANBAN_PLUGIN,
|
|
41
|
+
name: "Kanban",
|
|
42
|
+
description: "Kanban board for managing tasks.",
|
|
43
|
+
tags: [
|
|
44
|
+
"experimental"
|
|
45
|
+
],
|
|
46
|
+
iconComponent: (props) => /* @__PURE__ */ import_react2.default.createElement(import_react.Kanban, props),
|
|
47
|
+
iconSymbol: "ph--kanban--regular"
|
|
48
|
+
});
|
|
49
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
50
|
+
0 && (module.exports = {
|
|
51
|
+
KANBAN_PLUGIN,
|
|
52
|
+
meta_default
|
|
53
|
+
});
|
|
54
|
+
//# sourceMappingURL=chunk-CJTEPA5Z.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/meta.tsx"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { Kanban, type IconProps } from '@phosphor-icons/react';\nimport React from 'react';\n\nimport { pluginMeta } from '@dxos/app-framework';\n\nexport const KANBAN_PLUGIN = 'dxos.org/plugin/kanban';\n\nexport default pluginMeta({\n id: KANBAN_PLUGIN,\n name: 'Kanban',\n description: 'Kanban board for managing tasks.',\n tags: ['experimental'],\n iconComponent: (props: IconProps) => <Kanban {...props} />,\n iconSymbol: 'ph--kanban--regular',\n});\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,mBAAuC;AACvC,IAAAA,gBAAkB;AAElB,2BAA2B;AAEpB,IAAMC,gBAAgB;AAE7B,IAAA,mBAAeC,iCAAW;EACxBC,IAAIF;EACJG,MAAM;EACNC,aAAa;EACbC,MAAM;IAAC;;EACPC,eAAe,CAACC,UAAqB,8BAAAC,QAAA,cAACC,qBAAWF,KAAAA;EACjDG,YAAY;AACd,CAAA;",
|
|
6
|
+
"names": ["import_react", "KANBAN_PLUGIN", "pluginMeta", "id", "name", "description", "tags", "iconComponent", "props", "React", "Kanban", "iconSymbol"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var chunk_RYK4NJNG_exports = {};
|
|
20
|
+
__export(chunk_RYK4NJNG_exports, {
|
|
21
|
+
KanbanAction: () => KanbanAction,
|
|
22
|
+
KanbanColumnType: () => KanbanColumnType,
|
|
23
|
+
KanbanItemType: () => KanbanItemType,
|
|
24
|
+
KanbanType: () => KanbanType
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(chunk_RYK4NJNG_exports);
|
|
27
|
+
var import_chunk_CJTEPA5Z = require("./chunk-CJTEPA5Z.cjs");
|
|
28
|
+
var import_echo_schema = require("@dxos/echo-schema");
|
|
29
|
+
var KanbanItemType = class extends (0, import_echo_schema.TypedObject)({
|
|
30
|
+
typename: "dxos.org/type/KanbanItem",
|
|
31
|
+
version: "0.1.0"
|
|
32
|
+
})({
|
|
33
|
+
object: import_echo_schema.S.optional((0, import_echo_schema.ref)(import_echo_schema.Expando)),
|
|
34
|
+
name: import_echo_schema.S.optional(import_echo_schema.S.String),
|
|
35
|
+
index: import_echo_schema.S.optional(import_echo_schema.S.String)
|
|
36
|
+
}) {
|
|
37
|
+
};
|
|
38
|
+
var KanbanColumnType = class extends (0, import_echo_schema.TypedObject)({
|
|
39
|
+
typename: "dxos.org/type/KanbanColumn",
|
|
40
|
+
version: "0.1.0"
|
|
41
|
+
})({
|
|
42
|
+
name: import_echo_schema.S.optional(import_echo_schema.S.String),
|
|
43
|
+
index: import_echo_schema.S.optional(import_echo_schema.S.String),
|
|
44
|
+
items: import_echo_schema.S.mutable(import_echo_schema.S.Array((0, import_echo_schema.ref)(KanbanItemType)))
|
|
45
|
+
}) {
|
|
46
|
+
};
|
|
47
|
+
var KanbanType = class extends (0, import_echo_schema.TypedObject)({
|
|
48
|
+
typename: "dxos.org/type/Kanban",
|
|
49
|
+
version: "0.1.0"
|
|
50
|
+
})({
|
|
51
|
+
name: import_echo_schema.S.optional(import_echo_schema.S.String),
|
|
52
|
+
columns: import_echo_schema.S.mutable(import_echo_schema.S.Array((0, import_echo_schema.ref)(KanbanColumnType)))
|
|
53
|
+
}) {
|
|
54
|
+
};
|
|
55
|
+
var KANBAN_ACTION = `${import_chunk_CJTEPA5Z.KANBAN_PLUGIN}/action`;
|
|
56
|
+
var KanbanAction;
|
|
57
|
+
(function(KanbanAction2) {
|
|
58
|
+
KanbanAction2[KanbanAction2["CREATE"] = `${KANBAN_ACTION}/create`] = "CREATE";
|
|
59
|
+
})(KanbanAction || (KanbanAction = {}));
|
|
60
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
61
|
+
0 && (module.exports = {
|
|
62
|
+
KanbanAction,
|
|
63
|
+
KanbanColumnType,
|
|
64
|
+
KanbanItemType,
|
|
65
|
+
KanbanType
|
|
66
|
+
});
|
|
67
|
+
//# sourceMappingURL=chunk-RYK4NJNG.cjs.map
|