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