@shiodome47/planner 0.2.0 → 0.3.1
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 +19 -4
- package/dist/chunks/JumpBar-43r8C8G3.js +1175 -0
- package/dist/core/logic.d.ts +29 -1
- package/dist/core/review.d.ts +20 -0
- package/dist/core/types.d.ts +21 -0
- package/dist/core.js +234 -156
- package/dist/projects.js +297 -283
- package/dist/style.css +1 -1
- package/dist/timeline.js +193 -140
- package/dist/ui/EndedHabits.d.ts +41 -0
- package/dist/ui/dnd.d.ts +4 -1
- package/package.json +1 -1
- package/dist/chunks/JumpBar-DMnykrl0.js +0 -904
package/dist/projects.js
CHANGED
|
@@ -1,28 +1,31 @@
|
|
|
1
|
-
import { a as e, c as t, d as n, f as r,
|
|
2
|
-
import { PERIOD_NAME as
|
|
3
|
-
import { useMemo as
|
|
4
|
-
import { Fragment as
|
|
5
|
-
import { Check as
|
|
6
|
-
import { verticalListSortingStrategy as
|
|
7
|
-
import { CardBoard as
|
|
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-43r8C8G3.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
|
|
10
|
-
let n = (t) =>
|
|
11
|
-
|
|
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
|
|
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:
|
|
21
|
+
size: U(e, t),
|
|
19
22
|
project: t
|
|
20
23
|
}));
|
|
21
24
|
}
|
|
22
|
-
function
|
|
23
|
-
return
|
|
25
|
+
function G(e) {
|
|
26
|
+
return H(e).map((e) => e.project);
|
|
24
27
|
}
|
|
25
|
-
function
|
|
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
|
|
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
|
-
],
|
|
52
|
+
], J = [
|
|
50
53
|
"day",
|
|
51
54
|
"week",
|
|
52
55
|
"month",
|
|
53
56
|
"year"
|
|
54
|
-
],
|
|
55
|
-
function
|
|
56
|
-
let [
|
|
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__ */
|
|
61
|
+
children: [/* @__PURE__ */ F(u, {
|
|
59
62
|
placeholder: "名前(例: そろばん・英語・自治会)",
|
|
60
63
|
label: "新しいプロジェクトの名前",
|
|
61
64
|
onAdd: (r) => {
|
|
62
|
-
let
|
|
63
|
-
t.apply({ projects: [
|
|
65
|
+
let a = q[e.projects.length % q.length];
|
|
66
|
+
t.apply({ projects: [x(e, {
|
|
64
67
|
name: r,
|
|
65
|
-
color:
|
|
66
|
-
}, n)] }),
|
|
68
|
+
color: a
|
|
69
|
+
}, n)] }), i(!1);
|
|
67
70
|
}
|
|
68
|
-
}), /* @__PURE__ */
|
|
71
|
+
}), /* @__PURE__ */ F("button", {
|
|
69
72
|
type: "button",
|
|
70
73
|
className: "pl-button",
|
|
71
|
-
onClick: () =>
|
|
74
|
+
onClick: () => i(!1),
|
|
72
75
|
children: "やめる"
|
|
73
76
|
})]
|
|
74
|
-
}) : /* @__PURE__ */
|
|
77
|
+
}) : /* @__PURE__ */ I("button", {
|
|
75
78
|
type: "button",
|
|
76
79
|
className: "pl-project-add",
|
|
77
|
-
onClick: () =>
|
|
78
|
-
children: [/* @__PURE__ */
|
|
80
|
+
onClick: () => i(!0),
|
|
81
|
+
children: [/* @__PURE__ */ F(z, { "aria-hidden": "true" }), " プロジェクト・テーマを足す"]
|
|
79
82
|
});
|
|
80
|
-
return /* @__PURE__ */
|
|
83
|
+
return /* @__PURE__ */ I(P, { children: [/* @__PURE__ */ F(f, {
|
|
81
84
|
className: "pl-jump-projects",
|
|
82
85
|
label: "プロジェクトへ移動",
|
|
83
|
-
items:
|
|
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) =>
|
|
89
|
-
}), /* @__PURE__ */
|
|
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:
|
|
93
|
-
minColumnWidth:
|
|
94
|
-
gap:
|
|
95
|
+
cards: a,
|
|
96
|
+
minColumnWidth: Y,
|
|
97
|
+
gap: ee,
|
|
95
98
|
columnEndHeight: 40,
|
|
96
99
|
dropLineColor: "var(--accent)",
|
|
97
|
-
sensors:
|
|
98
|
-
addon:
|
|
100
|
+
sensors: o,
|
|
101
|
+
addon: l,
|
|
99
102
|
onMove: (e) => {
|
|
100
|
-
let n =
|
|
103
|
+
let n = K(a, e, /* @__PURE__ */ new Date());
|
|
101
104
|
n.length && t.apply({ projects: n });
|
|
102
105
|
},
|
|
103
|
-
renderCard: (r, i) => /* @__PURE__ */
|
|
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
|
|
113
|
-
let [s,
|
|
114
|
-
return /* @__PURE__ */
|
|
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__ */
|
|
122
|
+
/* @__PURE__ */ I("header", {
|
|
120
123
|
className: "pl-project-header",
|
|
121
124
|
children: [
|
|
122
|
-
/* @__PURE__ */
|
|
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__ */
|
|
131
|
+
children: /* @__PURE__ */ F(R, { "aria-hidden": "true" })
|
|
129
132
|
}),
|
|
130
|
-
/* @__PURE__ */
|
|
133
|
+
/* @__PURE__ */ F("span", {
|
|
131
134
|
className: `pl-dot pl-color-${t.color}`,
|
|
132
135
|
"aria-hidden": "true"
|
|
133
136
|
}),
|
|
134
|
-
s ? /* @__PURE__ */
|
|
137
|
+
s ? /* @__PURE__ */ F(e, {
|
|
135
138
|
initial: t.name,
|
|
136
139
|
label: "プロジェクトの名前",
|
|
137
140
|
onDone: (e) => {
|
|
138
|
-
|
|
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__ */
|
|
145
|
-
onDoubleClick: () =>
|
|
147
|
+
}) : /* @__PURE__ */ F("h2", {
|
|
148
|
+
onDoubleClick: () => c(!0),
|
|
146
149
|
children: t.name
|
|
147
150
|
}),
|
|
148
|
-
/* @__PURE__ */
|
|
151
|
+
/* @__PURE__ */ F(r, {
|
|
149
152
|
label: `「${t.name}」の操作`,
|
|
150
153
|
items: [
|
|
151
154
|
{
|
|
152
155
|
label: "名前を変える",
|
|
153
|
-
onSelect: () =>
|
|
156
|
+
onSelect: () => c(!0)
|
|
154
157
|
},
|
|
155
158
|
{
|
|
156
159
|
label: "中にプロジェクトを足す",
|
|
157
|
-
onSelect: () =>
|
|
160
|
+
onSelect: () => m(!0)
|
|
158
161
|
},
|
|
159
|
-
...Z(t,
|
|
160
|
-
...
|
|
161
|
-
...
|
|
162
|
+
...Z(t, g),
|
|
163
|
+
...v.length ? ["separator"] : [],
|
|
164
|
+
...v.map((e) => ({
|
|
162
165
|
label: `「${e.name}」の中に入れる`,
|
|
163
|
-
onSelect: () =>
|
|
166
|
+
onSelect: () => g(y(n, t, e.id, /* @__PURE__ */ new Date()))
|
|
164
167
|
})),
|
|
165
168
|
"separator",
|
|
166
169
|
{
|
|
167
|
-
label:
|
|
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
|
-
|
|
178
|
+
d && /* @__PURE__ */ F(X, {
|
|
176
179
|
project: t,
|
|
177
|
-
extra:
|
|
180
|
+
extra: _.length ? `中のプロジェクト(${_.map((e) => e.name).join("・")})も消えます。` : "",
|
|
178
181
|
onCancel: () => f(!1),
|
|
179
|
-
onRemove: () =>
|
|
182
|
+
onRemove: () => g(T(n, t))
|
|
180
183
|
}),
|
|
181
|
-
/* @__PURE__ */
|
|
184
|
+
/* @__PURE__ */ F(Q, {
|
|
182
185
|
project: t,
|
|
183
|
-
data:
|
|
184
|
-
apply:
|
|
186
|
+
data: n,
|
|
187
|
+
apply: g,
|
|
185
188
|
now: a,
|
|
186
|
-
compact:
|
|
189
|
+
compact: _.length > 0
|
|
187
190
|
}),
|
|
188
|
-
|
|
189
|
-
ids:
|
|
190
|
-
strategy:
|
|
191
|
-
onMove: (e, t) =>
|
|
192
|
-
children:
|
|
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:
|
|
196
|
-
apply:
|
|
198
|
+
data: n,
|
|
199
|
+
apply: g,
|
|
197
200
|
now: a
|
|
198
201
|
}, e.id))
|
|
199
202
|
}),
|
|
200
|
-
|
|
203
|
+
p ? /* @__PURE__ */ I("div", {
|
|
201
204
|
className: "pl-subproject pl-subproject-new",
|
|
202
|
-
children: [/* @__PURE__ */
|
|
205
|
+
children: [/* @__PURE__ */ F(u, {
|
|
203
206
|
placeholder: "中のプロジェクトの名前(例: 防災イベントの開催)",
|
|
204
207
|
label: `${t.name}の中にプロジェクトを足す`,
|
|
205
208
|
onAdd: (e) => {
|
|
206
|
-
|
|
209
|
+
g({ projects: [x(n, {
|
|
207
210
|
name: e,
|
|
208
211
|
color: t.color,
|
|
209
212
|
parentId: t.id
|
|
210
|
-
}, a)] }),
|
|
213
|
+
}, a)] }), m(!1);
|
|
211
214
|
}
|
|
212
|
-
}), /* @__PURE__ */
|
|
215
|
+
}), /* @__PURE__ */ F("button", {
|
|
213
216
|
type: "button",
|
|
214
217
|
className: "pl-button",
|
|
215
|
-
onClick: () =>
|
|
218
|
+
onClick: () => m(!1),
|
|
216
219
|
children: "やめる"
|
|
217
220
|
})]
|
|
218
|
-
}) :
|
|
221
|
+
}) : _.length > 0 && /* @__PURE__ */ I("button", {
|
|
219
222
|
type: "button",
|
|
220
223
|
className: "pl-subproject-add",
|
|
221
|
-
onClick: () =>
|
|
222
|
-
children: [/* @__PURE__ */
|
|
224
|
+
onClick: () => m(!0),
|
|
225
|
+
children: [/* @__PURE__ */ F(z, { "aria-hidden": "true" }), " 中にプロジェクトを足す"]
|
|
223
226
|
})
|
|
224
227
|
]
|
|
225
228
|
});
|
|
226
229
|
}
|
|
227
|
-
function
|
|
228
|
-
let [
|
|
229
|
-
return /* @__PURE__ */
|
|
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__ */
|
|
238
|
+
/* @__PURE__ */ I("header", {
|
|
236
239
|
className: "pl-subproject-header",
|
|
237
240
|
children: [
|
|
238
|
-
/* @__PURE__ */
|
|
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__ */
|
|
248
|
+
children: /* @__PURE__ */ F(R, { "aria-hidden": "true" })
|
|
246
249
|
}),
|
|
247
|
-
/* @__PURE__ */
|
|
250
|
+
/* @__PURE__ */ F("span", {
|
|
248
251
|
className: `pl-dot pl-color-${t.color}`,
|
|
249
252
|
"aria-hidden": "true"
|
|
250
253
|
}),
|
|
251
|
-
|
|
254
|
+
c ? /* @__PURE__ */ F(e, {
|
|
252
255
|
initial: t.name,
|
|
253
256
|
label: "プロジェクトの名前",
|
|
254
257
|
onDone: (e) => {
|
|
255
|
-
|
|
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__ */
|
|
262
|
-
onDoubleClick: () =>
|
|
264
|
+
}) : /* @__PURE__ */ F("h3", {
|
|
265
|
+
onDoubleClick: () => l(!0),
|
|
263
266
|
children: t.name
|
|
264
267
|
}),
|
|
265
|
-
/* @__PURE__ */
|
|
268
|
+
/* @__PURE__ */ F(r, {
|
|
266
269
|
label: `「${t.name}」の操作`,
|
|
267
270
|
items: [
|
|
268
271
|
{
|
|
269
272
|
label: "名前を変える",
|
|
270
|
-
onSelect: () =>
|
|
273
|
+
onSelect: () => l(!0)
|
|
271
274
|
},
|
|
272
|
-
...Z(t,
|
|
275
|
+
...Z(t, o),
|
|
273
276
|
"separator",
|
|
274
277
|
{
|
|
275
278
|
label: `「${n.name}」から出す`,
|
|
276
|
-
onSelect: () =>
|
|
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: () =>
|
|
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: () =>
|
|
289
|
+
onSelect: () => d(!0)
|
|
287
290
|
}
|
|
288
291
|
]
|
|
289
292
|
})
|
|
290
293
|
]
|
|
291
294
|
}),
|
|
292
|
-
|
|
295
|
+
u && /* @__PURE__ */ F(X, {
|
|
293
296
|
project: t,
|
|
294
297
|
extra: "",
|
|
295
|
-
onCancel: () =>
|
|
296
|
-
onRemove: () =>
|
|
298
|
+
onCancel: () => d(!1),
|
|
299
|
+
onRemove: () => o(T(i, t))
|
|
297
300
|
}),
|
|
298
|
-
/* @__PURE__ */
|
|
301
|
+
/* @__PURE__ */ F(Q, {
|
|
299
302
|
project: t,
|
|
300
|
-
data:
|
|
301
|
-
apply:
|
|
302
|
-
now:
|
|
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__ */
|
|
311
|
+
return /* @__PURE__ */ I("div", {
|
|
309
312
|
className: "pl-confirm",
|
|
310
313
|
role: "alertdialog",
|
|
311
314
|
"aria-label": "プロジェクトを消す",
|
|
312
|
-
children: [/* @__PURE__ */
|
|
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__ */
|
|
324
|
+
}), /* @__PURE__ */ I("div", {
|
|
322
325
|
className: "pl-row pl-row-end",
|
|
323
|
-
children: [/* @__PURE__ */
|
|
326
|
+
children: [/* @__PURE__ */ F("button", {
|
|
324
327
|
type: "button",
|
|
325
328
|
className: "pl-button",
|
|
326
329
|
onClick: n,
|
|
327
330
|
children: "キャンセル"
|
|
328
|
-
}), /* @__PURE__ */
|
|
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
|
|
339
|
-
label: `色: ${
|
|
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:
|
|
348
|
-
let [
|
|
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(
|
|
353
|
+
return sessionStorage.getItem(c) ?? "";
|
|
351
354
|
} catch {
|
|
352
355
|
return "";
|
|
353
356
|
}
|
|
354
|
-
}),
|
|
355
|
-
|
|
357
|
+
}), h = (e) => {
|
|
358
|
+
p(e);
|
|
356
359
|
try {
|
|
357
|
-
e ? sessionStorage.setItem(
|
|
360
|
+
e ? sessionStorage.setItem(c, e) : sessionStorage.removeItem(c);
|
|
358
361
|
} catch {}
|
|
359
|
-
}, [
|
|
360
|
-
return
|
|
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: () =>
|
|
366
|
+
onClick: () => s(!0),
|
|
364
367
|
children: [
|
|
365
|
-
/* @__PURE__ */
|
|
368
|
+
/* @__PURE__ */ F(z, { "aria-hidden": "true" }),
|
|
366
369
|
" 「",
|
|
367
370
|
e.name,
|
|
368
371
|
"」に目標を足す"
|
|
369
372
|
]
|
|
370
|
-
}) : /* @__PURE__ */
|
|
373
|
+
}) : /* @__PURE__ */ I(P, { children: [/* @__PURE__ */ I("div", {
|
|
371
374
|
className: "pl-block",
|
|
372
375
|
children: [
|
|
373
|
-
/* @__PURE__ */
|
|
376
|
+
/* @__PURE__ */ F("h3", {
|
|
374
377
|
className: "pl-block-title",
|
|
375
378
|
children: "期日目標"
|
|
376
379
|
}),
|
|
377
|
-
/* @__PURE__ */
|
|
380
|
+
/* @__PURE__ */ I("ul", {
|
|
378
381
|
className: "pl-list",
|
|
379
|
-
children: [/* @__PURE__ */
|
|
380
|
-
ids:
|
|
381
|
-
strategy:
|
|
382
|
-
onMove: (e,
|
|
383
|
-
children:
|
|
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:
|
|
386
|
-
apply:
|
|
387
|
-
now:
|
|
388
|
-
openers:
|
|
388
|
+
data: t,
|
|
389
|
+
apply: r,
|
|
390
|
+
now: i,
|
|
391
|
+
openers: y,
|
|
389
392
|
sortable: e.due ? "drop" : "drag"
|
|
390
393
|
}, e.id))
|
|
391
|
-
}),
|
|
394
|
+
}), T.map((e) => /* @__PURE__ */ F($, {
|
|
392
395
|
g: e,
|
|
393
|
-
data:
|
|
394
|
-
apply:
|
|
395
|
-
now:
|
|
396
|
-
openers:
|
|
396
|
+
data: t,
|
|
397
|
+
apply: r,
|
|
398
|
+
now: i,
|
|
399
|
+
openers: y
|
|
397
400
|
}, e.id))]
|
|
398
401
|
}),
|
|
399
|
-
/* @__PURE__ */
|
|
402
|
+
/* @__PURE__ */ I("div", {
|
|
400
403
|
className: "pl-goal pl-goal-add",
|
|
401
404
|
children: [
|
|
402
|
-
/* @__PURE__ */
|
|
405
|
+
/* @__PURE__ */ F("span", {
|
|
403
406
|
className: "pl-goal-add-mark",
|
|
404
407
|
"aria-hidden": "true",
|
|
405
|
-
children: /* @__PURE__ */
|
|
408
|
+
children: /* @__PURE__ */ F(z, {})
|
|
406
409
|
}),
|
|
407
|
-
/* @__PURE__ */
|
|
408
|
-
due:
|
|
409
|
-
now:
|
|
410
|
+
/* @__PURE__ */ F(n, {
|
|
411
|
+
due: f || void 0,
|
|
412
|
+
now: i,
|
|
410
413
|
done: !1,
|
|
411
414
|
label: "足す期日目標の期日",
|
|
412
|
-
onChange:
|
|
415
|
+
onChange: h
|
|
413
416
|
}),
|
|
414
|
-
/* @__PURE__ */
|
|
417
|
+
/* @__PURE__ */ F(u, {
|
|
415
418
|
placeholder: "期日目標を足す",
|
|
416
419
|
label: `${e.name}の期日目標を足す`,
|
|
417
|
-
onAdd: (
|
|
418
|
-
|
|
419
|
-
...
|
|
420
|
-
title:
|
|
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:
|
|
425
|
-
},
|
|
426
|
-
goalOrder:
|
|
427
|
-
}] }),
|
|
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__ */
|
|
436
|
+
}), /* @__PURE__ */ I("div", {
|
|
434
437
|
className: "pl-block",
|
|
435
438
|
children: [
|
|
436
|
-
/* @__PURE__ */
|
|
439
|
+
/* @__PURE__ */ F("h3", {
|
|
437
440
|
className: "pl-block-title",
|
|
438
441
|
children: "ルーチン目標"
|
|
439
442
|
}),
|
|
440
|
-
/* @__PURE__ */
|
|
443
|
+
/* @__PURE__ */ F("ul", {
|
|
441
444
|
className: "pl-list",
|
|
442
|
-
children:
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
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__ */
|
|
452
|
+
/* @__PURE__ */ I("div", {
|
|
519
453
|
className: "pl-add-row",
|
|
520
|
-
children: [/* @__PURE__ */
|
|
454
|
+
children: [/* @__PURE__ */ F(u, {
|
|
521
455
|
placeholder: "+ ルーチン目標を足す",
|
|
522
456
|
label: `${e.name}のルーチン目標を足す`,
|
|
523
|
-
onAdd: (
|
|
524
|
-
title:
|
|
525
|
-
period:
|
|
457
|
+
onAdd: (n) => r({ habits: [b(t, {
|
|
458
|
+
title: n,
|
|
459
|
+
period: _,
|
|
526
460
|
projectId: e.id
|
|
527
|
-
},
|
|
528
|
-
}), /* @__PURE__ */
|
|
461
|
+
}, i)] })
|
|
462
|
+
}), /* @__PURE__ */ F("select", {
|
|
529
463
|
className: "pl-select",
|
|
530
|
-
value:
|
|
531
|
-
onChange: (e) =>
|
|
464
|
+
value: _,
|
|
465
|
+
onChange: (e) => v(e.target.value),
|
|
532
466
|
"aria-label": "足すルーチン目標のくり返し",
|
|
533
|
-
children:
|
|
467
|
+
children: J.map((e) => /* @__PURE__ */ F("option", {
|
|
534
468
|
value: e,
|
|
535
|
-
children:
|
|
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
|
|
543
|
-
let
|
|
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__ */
|
|
548
|
-
ref:
|
|
549
|
-
style:
|
|
550
|
-
className: `pl-goal${e.doneAt ? " pl-done" : ""}${
|
|
551
|
-
...
|
|
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__ */
|
|
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: () =>
|
|
560
|
-
children: e.doneAt && /* @__PURE__ */
|
|
573
|
+
onClick: () => i(k(t, e, s)),
|
|
574
|
+
children: e.doneAt && /* @__PURE__ */ F(L, { "aria-hidden": "true" })
|
|
561
575
|
}),
|
|
562
|
-
/* @__PURE__ */
|
|
576
|
+
/* @__PURE__ */ F(n, {
|
|
563
577
|
due: e.due,
|
|
564
|
-
now:
|
|
578
|
+
now: s,
|
|
565
579
|
done: !!e.doneAt,
|
|
566
580
|
label: `「${e.title}」の期日`,
|
|
567
581
|
onChange: (t) => {
|
|
568
|
-
let { due:
|
|
569
|
-
|
|
570
|
-
...
|
|
582
|
+
let { due: n, ...r } = e;
|
|
583
|
+
i({ tasks: [t ? {
|
|
584
|
+
...r,
|
|
571
585
|
due: t,
|
|
572
|
-
updatedAt:
|
|
586
|
+
updatedAt: u()
|
|
573
587
|
} : {
|
|
574
|
-
...
|
|
575
|
-
updatedAt:
|
|
588
|
+
...r,
|
|
589
|
+
updatedAt: u()
|
|
576
590
|
}] });
|
|
577
591
|
}
|
|
578
592
|
}),
|
|
579
|
-
/* @__PURE__ */
|
|
593
|
+
/* @__PURE__ */ F(o, {
|
|
580
594
|
title: e.title,
|
|
581
595
|
note: e.note,
|
|
582
596
|
wrap: !0,
|
|
583
597
|
renameLabel: "期日目標の名前",
|
|
584
|
-
menuOpener: (t) =>
|
|
585
|
-
onRename: (t) =>
|
|
598
|
+
menuOpener: (t) => c[e.id] = t,
|
|
599
|
+
onRename: (t) => i({ tasks: [{
|
|
586
600
|
...e,
|
|
587
601
|
title: t,
|
|
588
|
-
updatedAt:
|
|
602
|
+
updatedAt: u()
|
|
589
603
|
}] }),
|
|
590
604
|
onSaveNote: (t) => {
|
|
591
|
-
let { note:
|
|
592
|
-
|
|
593
|
-
...
|
|
605
|
+
let { note: n, ...r } = e;
|
|
606
|
+
i({ tasks: [{
|
|
607
|
+
...r,
|
|
594
608
|
...t ? { note: t } : {},
|
|
595
|
-
updatedAt:
|
|
609
|
+
updatedAt: u()
|
|
596
610
|
}] });
|
|
597
611
|
}
|
|
598
612
|
}),
|
|
599
|
-
/* @__PURE__ */
|
|
613
|
+
/* @__PURE__ */ F(r, {
|
|
600
614
|
label: `「${e.title}」の操作`,
|
|
601
615
|
items: [
|
|
602
616
|
{
|
|
603
617
|
label: "名前を変える",
|
|
604
|
-
onSelect: () =>
|
|
618
|
+
onSelect: () => c[e.id]?.rename()
|
|
605
619
|
},
|
|
606
620
|
{
|
|
607
621
|
label: e.note ? "メモを見る" : "メモを書く",
|
|
608
|
-
onSelect: () =>
|
|
622
|
+
onSelect: () => c[e.id]?.note()
|
|
609
623
|
},
|
|
610
624
|
"separator",
|
|
611
625
|
{
|
|
612
626
|
label: "消す",
|
|
613
627
|
danger: !0,
|
|
614
|
-
onSelect: () =>
|
|
628
|
+
onSelect: () => i(E(t, e, s))
|
|
615
629
|
}
|
|
616
630
|
]
|
|
617
631
|
})
|
|
618
632
|
]
|
|
619
633
|
});
|
|
620
634
|
}
|
|
621
|
-
var
|
|
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
|
|
633
|
-
let
|
|
634
|
-
return /* @__PURE__ */
|
|
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__ */
|
|
650
|
+
children: /* @__PURE__ */ F(te, {
|
|
637
651
|
data: e,
|
|
638
|
-
store:
|
|
652
|
+
store: a,
|
|
639
653
|
now: t
|
|
640
654
|
})
|
|
641
655
|
});
|
|
642
656
|
}
|
|
643
|
-
export {
|
|
657
|
+
export { q as PROJECT_COLORS, oe as Projects, U as cardSize, K as changedProjects, W as projectCards, G as projectsInReadingOrder };
|