@shiodome47/planner 0.1.0 → 0.3.0
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/README.md +71 -5
- package/dist/chunks/JumpBar-DLj7SMVP.js +1173 -0
- package/dist/core/logic.d.ts +19 -1
- package/dist/core/review.d.ts +20 -0
- package/dist/core/types.d.ts +21 -0
- package/dist/core.js +146 -76
- package/dist/projects/Projects.d.ts +12 -0
- package/dist/projects/ProjectsPage.d.ts +13 -0
- package/dist/projects/colors.d.ts +3 -0
- package/dist/projects/index.d.ts +8 -0
- package/dist/projects/projectCards.d.ts +18 -0
- package/dist/projects.js +657 -0
- package/dist/style.css +2 -0
- package/dist/timeline/Board.d.ts +11 -0
- package/dist/timeline/Timeline.d.ts +12 -0
- package/dist/timeline/index.d.ts +6 -0
- package/dist/timeline.js +285 -0
- package/dist/ui/DaySelect.d.ts +15 -0
- package/dist/ui/Dialog.d.ts +12 -0
- package/dist/ui/DueChip.d.ts +16 -0
- package/dist/ui/EndedHabits.d.ts +41 -0
- package/dist/ui/JumpBar.d.ts +18 -0
- package/dist/ui/Menu.d.ts +17 -0
- package/dist/ui/NoteDialog.d.ts +38 -0
- package/dist/ui/Root.d.ts +12 -0
- package/dist/ui/Rows.d.ts +39 -0
- package/dist/ui/WhenSelect.d.ts +12 -0
- package/dist/ui/display.d.ts +9 -0
- package/dist/ui/dnd.d.ts +37 -0
- package/dist/ui/storage.d.ts +6 -0
- package/dist/ui/types.d.ts +5 -0
- package/package.json +26 -4
package/dist/projects.js
ADDED
|
@@ -0,0 +1,657 @@
|
|
|
1
|
+
import { a as e, c as t, d as n, f as r, g as i, h as a, l as o, m as s, n as c, p as l, r as u, s as d, t as f, u as p } from "./chunks/JumpBar-DLj7SMVP.js";
|
|
2
|
+
import { PERIOD_NAME as m, childProjects as h, endedHabits as g, inSamePeriod as _, isProjectGoal as v, moveProject as y, newHabit as b, newProject as x, newTask as S, nextGoalOrder as C, projectGoals as w, removeProject as T, removeTask as E, reorderGoals as D, reorderProjects as O, toggleDone as k, toggleHabit as A, topProjects as j } from "./core.js";
|
|
3
|
+
import { useMemo as M, useState as N } from "react";
|
|
4
|
+
import { Fragment as P, jsx as F, jsxs as I } from "react/jsx-runtime";
|
|
5
|
+
import { Check as L, GripVertical as R, Plus as z } from "lucide-react";
|
|
6
|
+
import { verticalListSortingStrategy as B } from "@dnd-kit/sortable";
|
|
7
|
+
import { CardBoard as V, flattenCards as H } from "linkshelf";
|
|
8
|
+
// src/projects/projectCards.ts
|
|
9
|
+
function U(e, t) {
|
|
10
|
+
let n = (t) => {
|
|
11
|
+
let n = e.habits.filter((e) => e.projectId === t.id), r = n.filter((e) => !e.endedAt).length;
|
|
12
|
+
return e.tasks.filter((e) => v(e) && e.projectId === t.id).length + r + +(r < n.length);
|
|
13
|
+
};
|
|
14
|
+
return n(t) + h(e, t.id).reduce((e, t) => e + 3 + n(t), 0);
|
|
15
|
+
}
|
|
16
|
+
function W(e, t) {
|
|
17
|
+
return t.map((t) => ({
|
|
18
|
+
id: t.id,
|
|
19
|
+
order: t.order,
|
|
20
|
+
column: t.column,
|
|
21
|
+
size: U(e, t),
|
|
22
|
+
project: t
|
|
23
|
+
}));
|
|
24
|
+
}
|
|
25
|
+
function G(e) {
|
|
26
|
+
return H(e).map((e) => e.project);
|
|
27
|
+
}
|
|
28
|
+
function K(e, t, n) {
|
|
29
|
+
let r = new Map(e.map((e) => [e.id, e.project])), i = n.toISOString();
|
|
30
|
+
return t.flatMap((e) => {
|
|
31
|
+
let t = r.get(e.id);
|
|
32
|
+
if (!t || t.column === e.column && t.order === e.order) return [];
|
|
33
|
+
let { column: n, ...a } = t;
|
|
34
|
+
return [{
|
|
35
|
+
...a,
|
|
36
|
+
order: e.order,
|
|
37
|
+
...e.column === void 0 ? {} : { column: e.column },
|
|
38
|
+
updatedAt: i
|
|
39
|
+
}];
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
// src/projects/colors.ts
|
|
43
|
+
var q = [
|
|
44
|
+
"teal",
|
|
45
|
+
"blue",
|
|
46
|
+
"purple",
|
|
47
|
+
"pink",
|
|
48
|
+
"orange",
|
|
49
|
+
"red",
|
|
50
|
+
"yellow",
|
|
51
|
+
"green"
|
|
52
|
+
], J = [
|
|
53
|
+
"day",
|
|
54
|
+
"week",
|
|
55
|
+
"month",
|
|
56
|
+
"year"
|
|
57
|
+
], Y = 290, ee = 10;
|
|
58
|
+
function te({ data: e, store: t, now: n }) {
|
|
59
|
+
let [r, i] = N(!1), a = W(e, j(e)), o = s(), l = r ? /* @__PURE__ */ I("section", {
|
|
60
|
+
className: "pl-project pl-project-new",
|
|
61
|
+
children: [/* @__PURE__ */ F(u, {
|
|
62
|
+
placeholder: "名前(例: そろばん・英語・自治会)",
|
|
63
|
+
label: "新しいプロジェクトの名前",
|
|
64
|
+
onAdd: (r) => {
|
|
65
|
+
let a = q[e.projects.length % q.length];
|
|
66
|
+
t.apply({ projects: [x(e, {
|
|
67
|
+
name: r,
|
|
68
|
+
color: a
|
|
69
|
+
}, n)] }), i(!1);
|
|
70
|
+
}
|
|
71
|
+
}), /* @__PURE__ */ F("button", {
|
|
72
|
+
type: "button",
|
|
73
|
+
className: "pl-button",
|
|
74
|
+
onClick: () => i(!1),
|
|
75
|
+
children: "やめる"
|
|
76
|
+
})]
|
|
77
|
+
}) : /* @__PURE__ */ I("button", {
|
|
78
|
+
type: "button",
|
|
79
|
+
className: "pl-project-add",
|
|
80
|
+
onClick: () => i(!0),
|
|
81
|
+
children: [/* @__PURE__ */ F(z, { "aria-hidden": "true" }), " プロジェクト・テーマを足す"]
|
|
82
|
+
});
|
|
83
|
+
return /* @__PURE__ */ I(P, { children: [/* @__PURE__ */ F(f, {
|
|
84
|
+
className: "pl-jump-projects",
|
|
85
|
+
label: "プロジェクトへ移動",
|
|
86
|
+
items: G(a).map((e) => ({
|
|
87
|
+
id: e.id,
|
|
88
|
+
label: e.name,
|
|
89
|
+
color: e.color
|
|
90
|
+
})),
|
|
91
|
+
onJump: (e) => c(document.querySelector(`[data-project="${CSS.escape(e)}"]`))
|
|
92
|
+
}), /* @__PURE__ */ F(V, {
|
|
93
|
+
className: "pl-projects",
|
|
94
|
+
columnClassName: "pl-projects-col",
|
|
95
|
+
cards: a,
|
|
96
|
+
minColumnWidth: Y,
|
|
97
|
+
gap: ee,
|
|
98
|
+
columnEndHeight: 40,
|
|
99
|
+
dropLineColor: "var(--accent)",
|
|
100
|
+
sensors: o,
|
|
101
|
+
addon: l,
|
|
102
|
+
onMove: (e) => {
|
|
103
|
+
let n = K(a, e, /* @__PURE__ */ new Date());
|
|
104
|
+
n.length && t.apply({ projects: n });
|
|
105
|
+
},
|
|
106
|
+
renderCard: (r, i) => /* @__PURE__ */ F(ne, {
|
|
107
|
+
project: r.project,
|
|
108
|
+
data: e,
|
|
109
|
+
store: t,
|
|
110
|
+
now: n,
|
|
111
|
+
drag: i
|
|
112
|
+
})
|
|
113
|
+
})] });
|
|
114
|
+
}
|
|
115
|
+
function ne({ project: t, data: n, store: i, now: a, drag: o }) {
|
|
116
|
+
let [s, c] = N(!1), [d, f] = N(!1), [p, m] = N(!1), g = (e) => void i.apply(e), _ = h(n, t.id), v = _.length === 0 ? j(n).filter((e) => e.id !== t.id) : [];
|
|
117
|
+
return /* @__PURE__ */ I("section", {
|
|
118
|
+
className: `pl-project${o.isDragging ? " pl-dragging" : ""}`,
|
|
119
|
+
"aria-label": t.name,
|
|
120
|
+
"data-project": t.id,
|
|
121
|
+
children: [
|
|
122
|
+
/* @__PURE__ */ I("header", {
|
|
123
|
+
className: "pl-project-header",
|
|
124
|
+
children: [
|
|
125
|
+
/* @__PURE__ */ F("button", {
|
|
126
|
+
type: "button",
|
|
127
|
+
className: "pl-grip",
|
|
128
|
+
"aria-label": `「${t.name}」を並べ替える(左ほど優先)`,
|
|
129
|
+
title: "ドラッグで並べ替え(左ほど優先)",
|
|
130
|
+
...s ? {} : o.dragHandle,
|
|
131
|
+
children: /* @__PURE__ */ F(R, { "aria-hidden": "true" })
|
|
132
|
+
}),
|
|
133
|
+
/* @__PURE__ */ F("span", {
|
|
134
|
+
className: `pl-dot pl-color-${t.color}`,
|
|
135
|
+
"aria-hidden": "true"
|
|
136
|
+
}),
|
|
137
|
+
s ? /* @__PURE__ */ F(e, {
|
|
138
|
+
initial: t.name,
|
|
139
|
+
label: "プロジェクトの名前",
|
|
140
|
+
onDone: (e) => {
|
|
141
|
+
c(!1), e && e !== t.name && g({ projects: [{
|
|
142
|
+
...t,
|
|
143
|
+
name: e,
|
|
144
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
145
|
+
}] });
|
|
146
|
+
}
|
|
147
|
+
}) : /* @__PURE__ */ F("h2", {
|
|
148
|
+
onDoubleClick: () => c(!0),
|
|
149
|
+
children: t.name
|
|
150
|
+
}),
|
|
151
|
+
/* @__PURE__ */ F(r, {
|
|
152
|
+
label: `「${t.name}」の操作`,
|
|
153
|
+
items: [
|
|
154
|
+
{
|
|
155
|
+
label: "名前を変える",
|
|
156
|
+
onSelect: () => c(!0)
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
label: "中にプロジェクトを足す",
|
|
160
|
+
onSelect: () => m(!0)
|
|
161
|
+
},
|
|
162
|
+
...Z(t, g),
|
|
163
|
+
...v.length ? ["separator"] : [],
|
|
164
|
+
...v.map((e) => ({
|
|
165
|
+
label: `「${e.name}」の中に入れる`,
|
|
166
|
+
onSelect: () => g(y(n, t, e.id, /* @__PURE__ */ new Date()))
|
|
167
|
+
})),
|
|
168
|
+
"separator",
|
|
169
|
+
{
|
|
170
|
+
label: _.length ? "テーマを消す" : "プロジェクトを消す",
|
|
171
|
+
danger: !0,
|
|
172
|
+
onSelect: () => f(!0)
|
|
173
|
+
}
|
|
174
|
+
]
|
|
175
|
+
})
|
|
176
|
+
]
|
|
177
|
+
}),
|
|
178
|
+
d && /* @__PURE__ */ F(X, {
|
|
179
|
+
project: t,
|
|
180
|
+
extra: _.length ? `中のプロジェクト(${_.map((e) => e.name).join("・")})も消えます。` : "",
|
|
181
|
+
onCancel: () => f(!1),
|
|
182
|
+
onRemove: () => g(T(n, t))
|
|
183
|
+
}),
|
|
184
|
+
/* @__PURE__ */ F(Q, {
|
|
185
|
+
project: t,
|
|
186
|
+
data: n,
|
|
187
|
+
apply: g,
|
|
188
|
+
now: a,
|
|
189
|
+
compact: _.length > 0
|
|
190
|
+
}),
|
|
191
|
+
_.length > 0 && /* @__PURE__ */ F(l, {
|
|
192
|
+
ids: _.map((e) => e.id),
|
|
193
|
+
strategy: B,
|
|
194
|
+
onMove: (e, t) => g(O(n, e, t, /* @__PURE__ */ new Date())),
|
|
195
|
+
children: _.map((e) => /* @__PURE__ */ F(re, {
|
|
196
|
+
project: e,
|
|
197
|
+
parent: t,
|
|
198
|
+
data: n,
|
|
199
|
+
apply: g,
|
|
200
|
+
now: a
|
|
201
|
+
}, e.id))
|
|
202
|
+
}),
|
|
203
|
+
p ? /* @__PURE__ */ I("div", {
|
|
204
|
+
className: "pl-subproject pl-subproject-new",
|
|
205
|
+
children: [/* @__PURE__ */ F(u, {
|
|
206
|
+
placeholder: "中のプロジェクトの名前(例: 防災イベントの開催)",
|
|
207
|
+
label: `${t.name}の中にプロジェクトを足す`,
|
|
208
|
+
onAdd: (e) => {
|
|
209
|
+
g({ projects: [x(n, {
|
|
210
|
+
name: e,
|
|
211
|
+
color: t.color,
|
|
212
|
+
parentId: t.id
|
|
213
|
+
}, a)] }), m(!1);
|
|
214
|
+
}
|
|
215
|
+
}), /* @__PURE__ */ F("button", {
|
|
216
|
+
type: "button",
|
|
217
|
+
className: "pl-button",
|
|
218
|
+
onClick: () => m(!1),
|
|
219
|
+
children: "やめる"
|
|
220
|
+
})]
|
|
221
|
+
}) : _.length > 0 && /* @__PURE__ */ I("button", {
|
|
222
|
+
type: "button",
|
|
223
|
+
className: "pl-subproject-add",
|
|
224
|
+
onClick: () => m(!0),
|
|
225
|
+
children: [/* @__PURE__ */ F(z, { "aria-hidden": "true" }), " 中にプロジェクトを足す"]
|
|
226
|
+
})
|
|
227
|
+
]
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
function re({ project: t, parent: n, data: i, apply: o, now: s }) {
|
|
231
|
+
let [c, l] = N(!1), [u, d] = N(!1), f = a(t.id, c), p = j(i).filter((e) => e.id !== n.id);
|
|
232
|
+
return /* @__PURE__ */ I("section", {
|
|
233
|
+
ref: f.ref,
|
|
234
|
+
style: f.style,
|
|
235
|
+
className: `pl-subproject${f.isDragging ? " pl-dragging" : ""}`,
|
|
236
|
+
"aria-label": `${n.name}・${t.name}`,
|
|
237
|
+
children: [
|
|
238
|
+
/* @__PURE__ */ I("header", {
|
|
239
|
+
className: "pl-subproject-header",
|
|
240
|
+
children: [
|
|
241
|
+
/* @__PURE__ */ F("button", {
|
|
242
|
+
type: "button",
|
|
243
|
+
ref: f.activatorRef,
|
|
244
|
+
className: "pl-grip",
|
|
245
|
+
"aria-label": `「${t.name}」を並べ替える`,
|
|
246
|
+
title: "ドラッグで並べ替え",
|
|
247
|
+
...f.handleProps,
|
|
248
|
+
children: /* @__PURE__ */ F(R, { "aria-hidden": "true" })
|
|
249
|
+
}),
|
|
250
|
+
/* @__PURE__ */ F("span", {
|
|
251
|
+
className: `pl-dot pl-color-${t.color}`,
|
|
252
|
+
"aria-hidden": "true"
|
|
253
|
+
}),
|
|
254
|
+
c ? /* @__PURE__ */ F(e, {
|
|
255
|
+
initial: t.name,
|
|
256
|
+
label: "プロジェクトの名前",
|
|
257
|
+
onDone: (e) => {
|
|
258
|
+
l(!1), e && e !== t.name && o({ projects: [{
|
|
259
|
+
...t,
|
|
260
|
+
name: e,
|
|
261
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
262
|
+
}] });
|
|
263
|
+
}
|
|
264
|
+
}) : /* @__PURE__ */ F("h3", {
|
|
265
|
+
onDoubleClick: () => l(!0),
|
|
266
|
+
children: t.name
|
|
267
|
+
}),
|
|
268
|
+
/* @__PURE__ */ F(r, {
|
|
269
|
+
label: `「${t.name}」の操作`,
|
|
270
|
+
items: [
|
|
271
|
+
{
|
|
272
|
+
label: "名前を変える",
|
|
273
|
+
onSelect: () => l(!0)
|
|
274
|
+
},
|
|
275
|
+
...Z(t, o),
|
|
276
|
+
"separator",
|
|
277
|
+
{
|
|
278
|
+
label: `「${n.name}」から出す`,
|
|
279
|
+
onSelect: () => o(y(i, t, void 0, /* @__PURE__ */ new Date()))
|
|
280
|
+
},
|
|
281
|
+
...p.map((e) => ({
|
|
282
|
+
label: `「${e.name}」の中に移す`,
|
|
283
|
+
onSelect: () => o(y(i, t, e.id, /* @__PURE__ */ new Date()))
|
|
284
|
+
})),
|
|
285
|
+
"separator",
|
|
286
|
+
{
|
|
287
|
+
label: "プロジェクトを消す",
|
|
288
|
+
danger: !0,
|
|
289
|
+
onSelect: () => d(!0)
|
|
290
|
+
}
|
|
291
|
+
]
|
|
292
|
+
})
|
|
293
|
+
]
|
|
294
|
+
}),
|
|
295
|
+
u && /* @__PURE__ */ F(X, {
|
|
296
|
+
project: t,
|
|
297
|
+
extra: "",
|
|
298
|
+
onCancel: () => d(!1),
|
|
299
|
+
onRemove: () => o(T(i, t))
|
|
300
|
+
}),
|
|
301
|
+
/* @__PURE__ */ F(Q, {
|
|
302
|
+
project: t,
|
|
303
|
+
data: i,
|
|
304
|
+
apply: o,
|
|
305
|
+
now: s
|
|
306
|
+
})
|
|
307
|
+
]
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
function X({ project: e, extra: t, onCancel: n, onRemove: r }) {
|
|
311
|
+
return /* @__PURE__ */ I("div", {
|
|
312
|
+
className: "pl-confirm",
|
|
313
|
+
role: "alertdialog",
|
|
314
|
+
"aria-label": "プロジェクトを消す",
|
|
315
|
+
children: [/* @__PURE__ */ I("p", {
|
|
316
|
+
className: "pl-text",
|
|
317
|
+
children: [
|
|
318
|
+
"「",
|
|
319
|
+
e.name,
|
|
320
|
+
"」と、その期日目標・ルーチン目標(列に置いたものも)を消します。",
|
|
321
|
+
t,
|
|
322
|
+
"取り消せません。"
|
|
323
|
+
]
|
|
324
|
+
}), /* @__PURE__ */ I("div", {
|
|
325
|
+
className: "pl-row pl-row-end",
|
|
326
|
+
children: [/* @__PURE__ */ F("button", {
|
|
327
|
+
type: "button",
|
|
328
|
+
className: "pl-button",
|
|
329
|
+
onClick: n,
|
|
330
|
+
children: "キャンセル"
|
|
331
|
+
}), /* @__PURE__ */ F("button", {
|
|
332
|
+
type: "button",
|
|
333
|
+
className: "pl-button pl-button-danger",
|
|
334
|
+
onClick: r,
|
|
335
|
+
children: "消す"
|
|
336
|
+
})]
|
|
337
|
+
})]
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
function Z(e, t) {
|
|
341
|
+
return q.filter((t) => t !== e.color).map((n) => ({
|
|
342
|
+
label: `色: ${ae[n]}`,
|
|
343
|
+
onSelect: () => t({ projects: [{
|
|
344
|
+
...e,
|
|
345
|
+
color: n,
|
|
346
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
347
|
+
}] })
|
|
348
|
+
}));
|
|
349
|
+
}
|
|
350
|
+
function Q({ project: e, data: t, apply: r, now: i, compact: a = !1 }) {
|
|
351
|
+
let [o, s] = N(!1), c = `planner:draftDue:${e.id}`, [f, p] = N(() => {
|
|
352
|
+
try {
|
|
353
|
+
return sessionStorage.getItem(c) ?? "";
|
|
354
|
+
} catch {
|
|
355
|
+
return "";
|
|
356
|
+
}
|
|
357
|
+
}), h = (e) => {
|
|
358
|
+
p(e);
|
|
359
|
+
try {
|
|
360
|
+
e ? sessionStorage.setItem(c, e) : sessionStorage.removeItem(c);
|
|
361
|
+
} catch {}
|
|
362
|
+
}, [_, v] = N("day"), y = {}, { open: x, done: T } = w(t, e.id), E = t.habits.filter((t) => t.projectId === e.id), O = E.filter((e) => !e.endedAt).sort((e, t) => J.indexOf(e.period) - J.indexOf(t.period) || e.order - t.order), k = g(E), A = x.length + T.length + E.length === 0;
|
|
363
|
+
return a && A && !o ? /* @__PURE__ */ I("button", {
|
|
364
|
+
type: "button",
|
|
365
|
+
className: "pl-subproject-add pl-own-add",
|
|
366
|
+
onClick: () => s(!0),
|
|
367
|
+
children: [
|
|
368
|
+
/* @__PURE__ */ F(z, { "aria-hidden": "true" }),
|
|
369
|
+
" 「",
|
|
370
|
+
e.name,
|
|
371
|
+
"」に目標を足す"
|
|
372
|
+
]
|
|
373
|
+
}) : /* @__PURE__ */ I(P, { children: [/* @__PURE__ */ I("div", {
|
|
374
|
+
className: "pl-block",
|
|
375
|
+
children: [
|
|
376
|
+
/* @__PURE__ */ F("h3", {
|
|
377
|
+
className: "pl-block-title",
|
|
378
|
+
children: "期日目標"
|
|
379
|
+
}),
|
|
380
|
+
/* @__PURE__ */ I("ul", {
|
|
381
|
+
className: "pl-list",
|
|
382
|
+
children: [/* @__PURE__ */ F(l, {
|
|
383
|
+
ids: x.map((e) => e.id),
|
|
384
|
+
strategy: B,
|
|
385
|
+
onMove: (e, n) => r(D(t, x.map((e) => e.id), e, n, /* @__PURE__ */ new Date())),
|
|
386
|
+
children: x.map((e) => /* @__PURE__ */ F($, {
|
|
387
|
+
g: e,
|
|
388
|
+
data: t,
|
|
389
|
+
apply: r,
|
|
390
|
+
now: i,
|
|
391
|
+
openers: y,
|
|
392
|
+
sortable: e.due ? "drop" : "drag"
|
|
393
|
+
}, e.id))
|
|
394
|
+
}), T.map((e) => /* @__PURE__ */ F($, {
|
|
395
|
+
g: e,
|
|
396
|
+
data: t,
|
|
397
|
+
apply: r,
|
|
398
|
+
now: i,
|
|
399
|
+
openers: y
|
|
400
|
+
}, e.id))]
|
|
401
|
+
}),
|
|
402
|
+
/* @__PURE__ */ I("div", {
|
|
403
|
+
className: "pl-goal pl-goal-add",
|
|
404
|
+
children: [
|
|
405
|
+
/* @__PURE__ */ F("span", {
|
|
406
|
+
className: "pl-goal-add-mark",
|
|
407
|
+
"aria-hidden": "true",
|
|
408
|
+
children: /* @__PURE__ */ F(z, {})
|
|
409
|
+
}),
|
|
410
|
+
/* @__PURE__ */ F(n, {
|
|
411
|
+
due: f || void 0,
|
|
412
|
+
now: i,
|
|
413
|
+
done: !1,
|
|
414
|
+
label: "足す期日目標の期日",
|
|
415
|
+
onChange: h
|
|
416
|
+
}),
|
|
417
|
+
/* @__PURE__ */ F(u, {
|
|
418
|
+
placeholder: "期日目標を足す",
|
|
419
|
+
label: `${e.name}の期日目標を足す`,
|
|
420
|
+
onAdd: (n) => {
|
|
421
|
+
r({ tasks: [{
|
|
422
|
+
...S(t, {
|
|
423
|
+
title: n,
|
|
424
|
+
horizon: "pool",
|
|
425
|
+
priority: "C",
|
|
426
|
+
projectId: e.id,
|
|
427
|
+
due: f || void 0
|
|
428
|
+
}, i),
|
|
429
|
+
goalOrder: C(t, e.id)
|
|
430
|
+
}] }), h("");
|
|
431
|
+
}
|
|
432
|
+
})
|
|
433
|
+
]
|
|
434
|
+
})
|
|
435
|
+
]
|
|
436
|
+
}), /* @__PURE__ */ I("div", {
|
|
437
|
+
className: "pl-block",
|
|
438
|
+
children: [
|
|
439
|
+
/* @__PURE__ */ F("h3", {
|
|
440
|
+
className: "pl-block-title",
|
|
441
|
+
children: "ルーチン目標"
|
|
442
|
+
}),
|
|
443
|
+
/* @__PURE__ */ F("ul", {
|
|
444
|
+
className: "pl-list",
|
|
445
|
+
children: O.map((e) => /* @__PURE__ */ F(ie, {
|
|
446
|
+
r: e,
|
|
447
|
+
data: t,
|
|
448
|
+
apply: r,
|
|
449
|
+
now: i
|
|
450
|
+
}, e.id))
|
|
451
|
+
}),
|
|
452
|
+
/* @__PURE__ */ I("div", {
|
|
453
|
+
className: "pl-add-row",
|
|
454
|
+
children: [/* @__PURE__ */ F(u, {
|
|
455
|
+
placeholder: "+ ルーチン目標を足す",
|
|
456
|
+
label: `${e.name}のルーチン目標を足す`,
|
|
457
|
+
onAdd: (n) => r({ habits: [b(t, {
|
|
458
|
+
title: n,
|
|
459
|
+
period: _,
|
|
460
|
+
projectId: e.id
|
|
461
|
+
}, i)] })
|
|
462
|
+
}), /* @__PURE__ */ F("select", {
|
|
463
|
+
className: "pl-select",
|
|
464
|
+
value: _,
|
|
465
|
+
onChange: (e) => v(e.target.value),
|
|
466
|
+
"aria-label": "足すルーチン目標のくり返し",
|
|
467
|
+
children: J.map((e) => /* @__PURE__ */ F("option", {
|
|
468
|
+
value: e,
|
|
469
|
+
children: m[e]
|
|
470
|
+
}, e))
|
|
471
|
+
})]
|
|
472
|
+
}),
|
|
473
|
+
/* @__PURE__ */ F(d, {
|
|
474
|
+
habits: k,
|
|
475
|
+
data: t,
|
|
476
|
+
store: { apply: r },
|
|
477
|
+
now: i,
|
|
478
|
+
label: "これまでのルーチン目標"
|
|
479
|
+
})
|
|
480
|
+
]
|
|
481
|
+
})] });
|
|
482
|
+
}
|
|
483
|
+
function ie({ r: e, data: n, apply: i, now: a }) {
|
|
484
|
+
let s = () => (/* @__PURE__ */ new Date()).toISOString(), c = {}, l = t(e, n, i), u = _(e.period, e.checkedAt, a);
|
|
485
|
+
return /* @__PURE__ */ I("li", {
|
|
486
|
+
className: `pl-habit${u ? " pl-done" : ""}`,
|
|
487
|
+
children: [
|
|
488
|
+
/* @__PURE__ */ F("button", {
|
|
489
|
+
type: "button",
|
|
490
|
+
role: "checkbox",
|
|
491
|
+
"aria-checked": u,
|
|
492
|
+
"aria-label": u ? `「${e.title}」のチェックを外す` : `「${e.title}」をチェック`,
|
|
493
|
+
className: "pl-square",
|
|
494
|
+
onClick: () => i({ habits: [A(e, a)] }),
|
|
495
|
+
children: u && /* @__PURE__ */ F(L, { "aria-hidden": "true" })
|
|
496
|
+
}),
|
|
497
|
+
/* @__PURE__ */ F(o, {
|
|
498
|
+
title: e.title,
|
|
499
|
+
note: e.note,
|
|
500
|
+
wrap: !0,
|
|
501
|
+
renameLabel: "ルーチン目標の名前",
|
|
502
|
+
menuOpener: (e) => Object.assign(c, e),
|
|
503
|
+
onRename: (t) => i({ habits: [{
|
|
504
|
+
...e,
|
|
505
|
+
title: t,
|
|
506
|
+
updatedAt: s()
|
|
507
|
+
}] }),
|
|
508
|
+
onSaveNote: (t) => {
|
|
509
|
+
let { note: n, ...r } = e;
|
|
510
|
+
i({ habits: [{
|
|
511
|
+
...r,
|
|
512
|
+
...t ? { note: t } : {},
|
|
513
|
+
updatedAt: s()
|
|
514
|
+
}] });
|
|
515
|
+
}
|
|
516
|
+
}),
|
|
517
|
+
/* @__PURE__ */ F("select", {
|
|
518
|
+
className: "pl-select",
|
|
519
|
+
value: e.period,
|
|
520
|
+
"aria-label": `「${e.title}」のくり返し`,
|
|
521
|
+
onChange: (t) => i({ habits: [{
|
|
522
|
+
...e,
|
|
523
|
+
period: t.target.value,
|
|
524
|
+
updatedAt: s()
|
|
525
|
+
}] }),
|
|
526
|
+
children: J.map((e) => /* @__PURE__ */ F("option", {
|
|
527
|
+
value: e,
|
|
528
|
+
children: m[e]
|
|
529
|
+
}, e))
|
|
530
|
+
}),
|
|
531
|
+
e.period !== "day" && /* @__PURE__ */ F(p, {
|
|
532
|
+
className: "pl-select pl-select-day",
|
|
533
|
+
habit: e,
|
|
534
|
+
onChange: (e) => i({ habits: [e] })
|
|
535
|
+
}),
|
|
536
|
+
/* @__PURE__ */ F(r, {
|
|
537
|
+
label: `「${e.title}」の操作`,
|
|
538
|
+
items: [
|
|
539
|
+
{
|
|
540
|
+
label: "名前を変える",
|
|
541
|
+
onSelect: () => c.rename?.()
|
|
542
|
+
},
|
|
543
|
+
{
|
|
544
|
+
label: e.note ? "メモを見る" : "メモを書く",
|
|
545
|
+
onSelect: () => c.note?.()
|
|
546
|
+
},
|
|
547
|
+
l.items[0],
|
|
548
|
+
"separator",
|
|
549
|
+
l.items[1]
|
|
550
|
+
]
|
|
551
|
+
}),
|
|
552
|
+
l.dialogs
|
|
553
|
+
]
|
|
554
|
+
});
|
|
555
|
+
}
|
|
556
|
+
function $({ g: e, data: t, apply: i, now: s, openers: c, sortable: l }) {
|
|
557
|
+
let u = () => (/* @__PURE__ */ new Date()).toISOString(), d = a(e.id, l === "drag" ? !1 : l !== "drop" || {
|
|
558
|
+
draggable: !0,
|
|
559
|
+
droppable: !1
|
|
560
|
+
});
|
|
561
|
+
return /* @__PURE__ */ I("li", {
|
|
562
|
+
ref: l ? d.ref : void 0,
|
|
563
|
+
style: l ? d.style : void 0,
|
|
564
|
+
className: `pl-goal${e.doneAt ? " pl-done" : ""}${l === "drag" ? " pl-goal-free" : ""}${d.isDragging ? " pl-dragging" : ""}`,
|
|
565
|
+
...l === "drag" ? d.handleProps : {},
|
|
566
|
+
children: [
|
|
567
|
+
/* @__PURE__ */ F("button", {
|
|
568
|
+
type: "button",
|
|
569
|
+
role: "checkbox",
|
|
570
|
+
"aria-checked": !!e.doneAt,
|
|
571
|
+
"aria-label": e.doneAt ? `「${e.title}」を終えたのを取り消す` : `「${e.title}」を終える`,
|
|
572
|
+
className: "pl-circle",
|
|
573
|
+
onClick: () => i(k(t, e, s)),
|
|
574
|
+
children: e.doneAt && /* @__PURE__ */ F(L, { "aria-hidden": "true" })
|
|
575
|
+
}),
|
|
576
|
+
/* @__PURE__ */ F(n, {
|
|
577
|
+
due: e.due,
|
|
578
|
+
now: s,
|
|
579
|
+
done: !!e.doneAt,
|
|
580
|
+
label: `「${e.title}」の期日`,
|
|
581
|
+
onChange: (t) => {
|
|
582
|
+
let { due: n, ...r } = e;
|
|
583
|
+
i({ tasks: [t ? {
|
|
584
|
+
...r,
|
|
585
|
+
due: t,
|
|
586
|
+
updatedAt: u()
|
|
587
|
+
} : {
|
|
588
|
+
...r,
|
|
589
|
+
updatedAt: u()
|
|
590
|
+
}] });
|
|
591
|
+
}
|
|
592
|
+
}),
|
|
593
|
+
/* @__PURE__ */ F(o, {
|
|
594
|
+
title: e.title,
|
|
595
|
+
note: e.note,
|
|
596
|
+
wrap: !0,
|
|
597
|
+
renameLabel: "期日目標の名前",
|
|
598
|
+
menuOpener: (t) => c[e.id] = t,
|
|
599
|
+
onRename: (t) => i({ tasks: [{
|
|
600
|
+
...e,
|
|
601
|
+
title: t,
|
|
602
|
+
updatedAt: u()
|
|
603
|
+
}] }),
|
|
604
|
+
onSaveNote: (t) => {
|
|
605
|
+
let { note: n, ...r } = e;
|
|
606
|
+
i({ tasks: [{
|
|
607
|
+
...r,
|
|
608
|
+
...t ? { note: t } : {},
|
|
609
|
+
updatedAt: u()
|
|
610
|
+
}] });
|
|
611
|
+
}
|
|
612
|
+
}),
|
|
613
|
+
/* @__PURE__ */ F(r, {
|
|
614
|
+
label: `「${e.title}」の操作`,
|
|
615
|
+
items: [
|
|
616
|
+
{
|
|
617
|
+
label: "名前を変える",
|
|
618
|
+
onSelect: () => c[e.id]?.rename()
|
|
619
|
+
},
|
|
620
|
+
{
|
|
621
|
+
label: e.note ? "メモを見る" : "メモを書く",
|
|
622
|
+
onSelect: () => c[e.id]?.note()
|
|
623
|
+
},
|
|
624
|
+
"separator",
|
|
625
|
+
{
|
|
626
|
+
label: "消す",
|
|
627
|
+
danger: !0,
|
|
628
|
+
onSelect: () => i(E(t, e, s))
|
|
629
|
+
}
|
|
630
|
+
]
|
|
631
|
+
})
|
|
632
|
+
]
|
|
633
|
+
});
|
|
634
|
+
}
|
|
635
|
+
var ae = {
|
|
636
|
+
teal: "ティール",
|
|
637
|
+
blue: "ブルー",
|
|
638
|
+
purple: "パープル",
|
|
639
|
+
pink: "ピンク",
|
|
640
|
+
orange: "オレンジ",
|
|
641
|
+
red: "レッド",
|
|
642
|
+
yellow: "イエロー",
|
|
643
|
+
green: "グリーン"
|
|
644
|
+
};
|
|
645
|
+
// src/projects/Projects.tsx
|
|
646
|
+
function oe({ data: e, now: t, onChange: n, ...r }) {
|
|
647
|
+
let a = M(() => ({ apply: n }), [n]);
|
|
648
|
+
return /* @__PURE__ */ F(i, {
|
|
649
|
+
...r,
|
|
650
|
+
children: /* @__PURE__ */ F(te, {
|
|
651
|
+
data: e,
|
|
652
|
+
store: a,
|
|
653
|
+
now: t
|
|
654
|
+
})
|
|
655
|
+
});
|
|
656
|
+
}
|
|
657
|
+
export { q as PROJECT_COLORS, oe as Projects, U as cardSize, K as changedProjects, W as projectCards, G as projectsInReadingOrder };
|