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