@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/README.md +17 -3
- 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.js +297 -283
- package/dist/style.css +1 -1
- package/dist/timeline.js +141 -135
- package/dist/ui/EndedHabits.d.ts +41 -0
- package/package.json +1 -1
- package/dist/chunks/JumpBar-DMnykrl0.js +0 -904
|
@@ -0,0 +1,1173 @@
|
|
|
1
|
+
import { HORIZON_NAME as e, PERIOD_NAME as t, PLACED_MARK as n, PLACE_LABEL as r, PRIORITIES as i, PRIORITY_NAME as a, bringToToday as o, dayKey as s, dayLabel as c, daysUntil as l, dueLabel as u, dueLabelWeekday as d, endHabit as f, goalDueNextWeek as p, habitPlaceTargets as m, habitRecord as h, habitToTask as g, horizonForDue as _, isForTomorrow as v, isMonthOnly as y, parseYearDay as b, periodHorizon as x, placeDown as S, placeHabitDown as C, placeTargets as w, postponeToTomorrow as T, quickTarget as ee, removeTask as E, resumeHabit as D, returnUp as O, setDue as k, setPriority as A, shortDueLabel as j, toggleDone as te, toggleHabitAll as M, whenLabel as ne, withDay as N, withWhen as P } from "../core.js";
|
|
2
|
+
import { createContext as F, useContext as I, useEffect as L, useLayoutEffect as R, useRef as z, useState as B } from "react";
|
|
3
|
+
import { Fragment as V, jsx as H, jsxs as U } from "react/jsx-runtime";
|
|
4
|
+
import { CalendarPlus as re, Check as ie, CornerUpLeft as ae, FileText as W, GraduationCap as oe, Moon as se, MoreHorizontal as ce, X as le } from "lucide-react";
|
|
5
|
+
import { SortableContext as ue, sortableKeyboardCoordinates as de, useSortable as fe } from "@dnd-kit/sortable";
|
|
6
|
+
import { DndContext as pe, KeyboardSensor as me, closestCenter as he, useSensor as ge, useSensors as _e } from "@dnd-kit/core";
|
|
7
|
+
import { CSS as ve } from "@dnd-kit/utilities";
|
|
8
|
+
import { useDragSensors as ye } from "linkshelf";
|
|
9
|
+
import { createPortal as be } from "react-dom";
|
|
10
|
+
// src/ui/display.tsx
|
|
11
|
+
var xe = F({ simple: !1 }), G = () => I(xe);
|
|
12
|
+
// src/ui/Root.tsx
|
|
13
|
+
function Se({ simple: e = !1, theme: t = "system", className: n, children: r }) {
|
|
14
|
+
return /* @__PURE__ */ H(xe.Provider, {
|
|
15
|
+
value: { simple: e },
|
|
16
|
+
children: /* @__PURE__ */ H("div", {
|
|
17
|
+
className: [
|
|
18
|
+
"planner",
|
|
19
|
+
e ? "pl-simple" : "",
|
|
20
|
+
n ?? ""
|
|
21
|
+
].filter(Boolean).join(" "),
|
|
22
|
+
"data-theme": t,
|
|
23
|
+
children: r
|
|
24
|
+
})
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
// src/ui/dnd.tsx
|
|
28
|
+
function Ce({ ids: e, strategy: t, onMove: n, children: r }) {
|
|
29
|
+
let i = we();
|
|
30
|
+
return /* @__PURE__ */ H(pe, {
|
|
31
|
+
sensors: i,
|
|
32
|
+
collisionDetection: he,
|
|
33
|
+
onDragEnd: ({ active: e, over: t }) => {
|
|
34
|
+
t && e.id !== t.id && n(String(e.id), String(t.id));
|
|
35
|
+
},
|
|
36
|
+
children: /* @__PURE__ */ H(ue, {
|
|
37
|
+
items: e,
|
|
38
|
+
strategy: t,
|
|
39
|
+
children: r
|
|
40
|
+
})
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
function K(e, t = !1) {
|
|
44
|
+
let { attributes: n, listeners: r, setNodeRef: i, setActivatorNodeRef: a, transform: o, transition: s, isDragging: c } = fe({
|
|
45
|
+
id: e,
|
|
46
|
+
disabled: t
|
|
47
|
+
});
|
|
48
|
+
return {
|
|
49
|
+
ref: i,
|
|
50
|
+
activatorRef: a,
|
|
51
|
+
style: {
|
|
52
|
+
transform: ve.Translate.toString(o),
|
|
53
|
+
transition: s,
|
|
54
|
+
...c ? {
|
|
55
|
+
position: "relative",
|
|
56
|
+
zIndex: 5
|
|
57
|
+
} : {}
|
|
58
|
+
},
|
|
59
|
+
isDragging: c,
|
|
60
|
+
handleProps: {
|
|
61
|
+
...n,
|
|
62
|
+
...r,
|
|
63
|
+
role: void 0,
|
|
64
|
+
"aria-disabled": void 0
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
function we() {
|
|
69
|
+
return _e(...ye(), ge(me, { coordinateGetter: de }));
|
|
70
|
+
}
|
|
71
|
+
// src/ui/Menu.tsx
|
|
72
|
+
var Te = {
|
|
73
|
+
position: "fixed",
|
|
74
|
+
top: 0,
|
|
75
|
+
left: 0,
|
|
76
|
+
right: "auto",
|
|
77
|
+
visibility: "hidden"
|
|
78
|
+
};
|
|
79
|
+
function q({ label: e, items: t, header: n }) {
|
|
80
|
+
let [r, i] = B(!1), a = z(null), o = z(null), [s, c] = B(Te);
|
|
81
|
+
return L(() => {
|
|
82
|
+
if (!r) return;
|
|
83
|
+
let e = (e) => {
|
|
84
|
+
let t = e.target;
|
|
85
|
+
a.current?.contains(t) || o.current?.contains(t) || i(!1);
|
|
86
|
+
}, t = (e) => {
|
|
87
|
+
e.key === "Escape" && i(!1);
|
|
88
|
+
}, n = (e) => {
|
|
89
|
+
o.current?.contains(e.target) || i(!1);
|
|
90
|
+
};
|
|
91
|
+
return document.addEventListener("pointerdown", e), document.addEventListener("keydown", t), window.addEventListener("scroll", n, !0), window.addEventListener("resize", n), () => {
|
|
92
|
+
document.removeEventListener("pointerdown", e), document.removeEventListener("keydown", t), window.removeEventListener("scroll", n, !0), window.removeEventListener("resize", n);
|
|
93
|
+
};
|
|
94
|
+
}, [r]), R(() => {
|
|
95
|
+
if (!r) {
|
|
96
|
+
c(Te);
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
let e = a.current?.getBoundingClientRect(), t = o.current;
|
|
100
|
+
if (!e || !t) return;
|
|
101
|
+
let n = window.innerWidth, i = window.innerHeight, s = t.offsetHeight, l = t.offsetWidth, u = i - e.bottom - 8, d = e.top - 8, f = s > u && d > u, p = Math.min(s, Math.max(160, (f ? d : u) - 4)), m = Math.min(Math.max(8, e.right - l), n - l - 8), h = f ? Math.max(8, e.top - 4 - p) : e.bottom + 4;
|
|
102
|
+
c({
|
|
103
|
+
position: "fixed",
|
|
104
|
+
top: h,
|
|
105
|
+
left: m,
|
|
106
|
+
right: "auto",
|
|
107
|
+
maxHeight: p,
|
|
108
|
+
overflowY: s > p ? "auto" : void 0
|
|
109
|
+
});
|
|
110
|
+
}, [r]), /* @__PURE__ */ U("div", {
|
|
111
|
+
className: "pl-menu",
|
|
112
|
+
ref: a,
|
|
113
|
+
children: [/* @__PURE__ */ H("button", {
|
|
114
|
+
type: "button",
|
|
115
|
+
className: "pl-row-button",
|
|
116
|
+
"aria-label": e,
|
|
117
|
+
title: e,
|
|
118
|
+
"aria-haspopup": "menu",
|
|
119
|
+
"aria-expanded": r,
|
|
120
|
+
onClick: () => i((e) => !e),
|
|
121
|
+
children: /* @__PURE__ */ H(ce, { "aria-hidden": "true" })
|
|
122
|
+
}), r && be(/* @__PURE__ */ H("div", {
|
|
123
|
+
className: Ee(a.current)?.className ?? "planner",
|
|
124
|
+
"data-theme": Ee(a.current)?.dataset.theme,
|
|
125
|
+
children: /* @__PURE__ */ U("div", {
|
|
126
|
+
className: "pl-menu-list",
|
|
127
|
+
role: "menu",
|
|
128
|
+
ref: o,
|
|
129
|
+
style: s,
|
|
130
|
+
children: [n, t.map((e, t) => e === "separator" ? /* @__PURE__ */ H("div", {
|
|
131
|
+
className: "pl-menu-separator",
|
|
132
|
+
role: "separator"
|
|
133
|
+
}, `s${t}`) : /* @__PURE__ */ H("button", {
|
|
134
|
+
type: "button",
|
|
135
|
+
role: "menuitem",
|
|
136
|
+
disabled: e.disabled,
|
|
137
|
+
className: e.danger ? "pl-menu-item pl-menu-danger" : "pl-menu-item",
|
|
138
|
+
onClick: () => {
|
|
139
|
+
i(!1), e.onSelect();
|
|
140
|
+
},
|
|
141
|
+
children: e.label
|
|
142
|
+
}, e.label))]
|
|
143
|
+
})
|
|
144
|
+
}), document.body)]
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
function Ee(e) {
|
|
148
|
+
return e?.closest(".planner") ?? null;
|
|
149
|
+
}
|
|
150
|
+
// src/ui/DueChip.tsx
|
|
151
|
+
function De({ due: t, now: n, done: r, label: i, onChange: a, variant: o = "goal", opener: s }) {
|
|
152
|
+
let c = z(null), u = () => {
|
|
153
|
+
let e = c.current;
|
|
154
|
+
if (e) try {
|
|
155
|
+
e.showPicker();
|
|
156
|
+
} catch {
|
|
157
|
+
e.focus();
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
s?.(u);
|
|
161
|
+
let f = t ? l(t, n) : null, m = t ? p(t, n) ? "来週" : f === 1 ? "明日" : e[_(t, n)] : void 0, h = t ? `${d(t, n)} ${f === null || r ? "" : f > 0 ? `あと ${f} 日` : f === 0 ? "今日" : `${-f} 日過ぎ`}(時間軸の「${m}」に出ます)` : o === "goal" ? "期日を決めると、時間軸に出ます" : void 0, g = f !== null && f <= (o === "inline" ? 0 : 7) && !r, v = o === "inline" && !t;
|
|
162
|
+
return /* @__PURE__ */ U("span", {
|
|
163
|
+
className: `pl-due${o === "inline" ? " pl-due-inline" : ""}${t ? "" : " pl-due-empty"}${g ? " pl-due-soon" : ""}${v ? " pl-due-hidden" : ""}`,
|
|
164
|
+
title: h,
|
|
165
|
+
children: [!v && /* @__PURE__ */ H("button", {
|
|
166
|
+
type: "button",
|
|
167
|
+
className: "pl-due-button",
|
|
168
|
+
"aria-label": `${i}${t ? `(${t})` : "(未定)"}を変える`,
|
|
169
|
+
onClick: u,
|
|
170
|
+
children: t ? o === "inline" ? d(t, n) : j(t, n) : /* @__PURE__ */ H(re, { "aria-hidden": "true" })
|
|
171
|
+
}), /* @__PURE__ */ H("input", {
|
|
172
|
+
ref: c,
|
|
173
|
+
type: "date",
|
|
174
|
+
className: "pl-due-input",
|
|
175
|
+
value: t ?? "",
|
|
176
|
+
tabIndex: -1,
|
|
177
|
+
"aria-hidden": "true",
|
|
178
|
+
onChange: (e) => a(e.target.value)
|
|
179
|
+
})]
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
// src/ui/DaySelect.tsx
|
|
183
|
+
var Oe = [
|
|
184
|
+
1,
|
|
185
|
+
2,
|
|
186
|
+
3,
|
|
187
|
+
4,
|
|
188
|
+
"L"
|
|
189
|
+
], ke = [
|
|
190
|
+
1,
|
|
191
|
+
2,
|
|
192
|
+
3,
|
|
193
|
+
4,
|
|
194
|
+
5,
|
|
195
|
+
6,
|
|
196
|
+
0
|
|
197
|
+
];
|
|
198
|
+
function Ae({ value: e, label: t, onChange: n, onBlur: r, autoFocus: i, className: a = "pl-select pl-select-quiet" }) {
|
|
199
|
+
return /* @__PURE__ */ U("select", {
|
|
200
|
+
className: a,
|
|
201
|
+
autoFocus: i,
|
|
202
|
+
"aria-label": t,
|
|
203
|
+
value: e === void 0 ? "" : String(e),
|
|
204
|
+
onBlur: r,
|
|
205
|
+
onChange: (e) => n(je(e.target.value)),
|
|
206
|
+
children: [
|
|
207
|
+
/* @__PURE__ */ H("option", {
|
|
208
|
+
value: "",
|
|
209
|
+
children: "決めない"
|
|
210
|
+
}),
|
|
211
|
+
/* @__PURE__ */ H("optgroup", {
|
|
212
|
+
label: "曜日(第何週)",
|
|
213
|
+
children: Oe.map((e) => ke.map((t) => {
|
|
214
|
+
let n = `w${e}-${t}`;
|
|
215
|
+
return /* @__PURE__ */ U("option", {
|
|
216
|
+
value: n,
|
|
217
|
+
children: [c(n), "曜"]
|
|
218
|
+
}, n);
|
|
219
|
+
}))
|
|
220
|
+
}),
|
|
221
|
+
/* @__PURE__ */ U("optgroup", {
|
|
222
|
+
label: "日にち",
|
|
223
|
+
children: [Array.from({ length: 31 }, (e, t) => /* @__PURE__ */ U("option", {
|
|
224
|
+
value: String(t + 1),
|
|
225
|
+
children: [t + 1, "日"]
|
|
226
|
+
}, t + 1)), /* @__PURE__ */ H("option", {
|
|
227
|
+
value: "end",
|
|
228
|
+
children: "月末"
|
|
229
|
+
})]
|
|
230
|
+
})
|
|
231
|
+
]
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
function je(e) {
|
|
235
|
+
if (e === "") return;
|
|
236
|
+
if (e === "end") return "end";
|
|
237
|
+
if (/^w[1-5L]-[0-6]$/.test(e)) return e;
|
|
238
|
+
let t = Number(e);
|
|
239
|
+
return Number.isInteger(t) && t >= 1 && t <= 31 ? t : void 0;
|
|
240
|
+
}
|
|
241
|
+
// src/ui/WhenSelect.tsx
|
|
242
|
+
var Me = [
|
|
243
|
+
1,
|
|
244
|
+
2,
|
|
245
|
+
3,
|
|
246
|
+
4,
|
|
247
|
+
5,
|
|
248
|
+
6,
|
|
249
|
+
0
|
|
250
|
+
], Ne = [
|
|
251
|
+
"日",
|
|
252
|
+
"月",
|
|
253
|
+
"火",
|
|
254
|
+
"水",
|
|
255
|
+
"木",
|
|
256
|
+
"金",
|
|
257
|
+
"土"
|
|
258
|
+
], J = (e) => String(e).padStart(2, "0");
|
|
259
|
+
function Pe({ habit: e, onChange: t, onBlur: n, autoFocus: r, className: i = "pl-select pl-select-quiet" }) {
|
|
260
|
+
if (e.period === "month") return /* @__PURE__ */ H(Ae, {
|
|
261
|
+
className: i,
|
|
262
|
+
autoFocus: r,
|
|
263
|
+
label: `「${e.title}」の毎月の日`,
|
|
264
|
+
value: e.day,
|
|
265
|
+
onBlur: n,
|
|
266
|
+
onChange: (n) => t(N(e, n))
|
|
267
|
+
});
|
|
268
|
+
if (e.period === "week") return /* @__PURE__ */ U("select", {
|
|
269
|
+
className: i,
|
|
270
|
+
autoFocus: r,
|
|
271
|
+
"aria-label": `「${e.title}」の毎週の曜日`,
|
|
272
|
+
value: e.weekday === void 0 ? "" : String(e.weekday),
|
|
273
|
+
onBlur: n,
|
|
274
|
+
onChange: (n) => t(P(e, n.target.value === "" ? void 0 : Number(n.target.value))),
|
|
275
|
+
children: [/* @__PURE__ */ H("option", {
|
|
276
|
+
value: "",
|
|
277
|
+
children: "曜日を決めない"
|
|
278
|
+
}), Me.map((e) => /* @__PURE__ */ U("option", {
|
|
279
|
+
value: e,
|
|
280
|
+
children: [Ne[e], "曜"]
|
|
281
|
+
}, e))]
|
|
282
|
+
});
|
|
283
|
+
if (e.period === "year") {
|
|
284
|
+
let a = b(e.yearDay), o = (n, r) => t(P(e, n ? r ? `${J(n)}-${J(r)}` : J(n) : void 0));
|
|
285
|
+
return /* @__PURE__ */ U("span", {
|
|
286
|
+
className: "pl-when-year",
|
|
287
|
+
onBlur: n,
|
|
288
|
+
children: [/* @__PURE__ */ U("select", {
|
|
289
|
+
className: i,
|
|
290
|
+
autoFocus: r,
|
|
291
|
+
"aria-label": `「${e.title}」の毎年の月`,
|
|
292
|
+
value: a ? String(a.month) : "",
|
|
293
|
+
onChange: (e) => o(e.target.value ? Number(e.target.value) : void 0, a?.day),
|
|
294
|
+
children: [/* @__PURE__ */ H("option", {
|
|
295
|
+
value: "",
|
|
296
|
+
children: "月を決めない"
|
|
297
|
+
}), Array.from({ length: 12 }, (e, t) => /* @__PURE__ */ U("option", {
|
|
298
|
+
value: t + 1,
|
|
299
|
+
children: [t + 1, "月"]
|
|
300
|
+
}, t + 1))]
|
|
301
|
+
}), a && /* @__PURE__ */ U("select", {
|
|
302
|
+
className: i,
|
|
303
|
+
"aria-label": `「${e.title}」の毎年の日`,
|
|
304
|
+
value: a.day ? String(a.day) : "",
|
|
305
|
+
onChange: (e) => o(a.month, e.target.value ? Number(e.target.value) : void 0),
|
|
306
|
+
children: [/* @__PURE__ */ H("option", {
|
|
307
|
+
value: "",
|
|
308
|
+
children: "月だけ"
|
|
309
|
+
}), Array.from({ length: new Date(2024, a.month, 0).getDate() }, (e, t) => /* @__PURE__ */ U("option", {
|
|
310
|
+
value: t + 1,
|
|
311
|
+
children: [t + 1, "日"]
|
|
312
|
+
}, t + 1))]
|
|
313
|
+
})]
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
return null;
|
|
317
|
+
}
|
|
318
|
+
// src/ui/Dialog.tsx
|
|
319
|
+
var Y = (e) => e.stopPropagation();
|
|
320
|
+
function X({ open: e, onClose: t, title: n, children: r, dismissible: i = !0, wide: a = !1 }) {
|
|
321
|
+
let o = z(null);
|
|
322
|
+
return L(() => {
|
|
323
|
+
let t = o.current;
|
|
324
|
+
t && (e && !t.open && t.showModal?.(), !e && t.open && t.close?.());
|
|
325
|
+
}, [e]), /* @__PURE__ */ H("dialog", {
|
|
326
|
+
ref: o,
|
|
327
|
+
className: a ? "pl-dialog pl-dialog-wide" : "pl-dialog",
|
|
328
|
+
"aria-label": n,
|
|
329
|
+
onCancel: (e) => {
|
|
330
|
+
e.preventDefault(), i && t();
|
|
331
|
+
},
|
|
332
|
+
onClick: (e) => {
|
|
333
|
+
e.stopPropagation(), i && e.target === e.currentTarget && t();
|
|
334
|
+
},
|
|
335
|
+
onPointerDown: Y,
|
|
336
|
+
onMouseDown: Y,
|
|
337
|
+
onTouchStart: Y,
|
|
338
|
+
onKeyDown: Y,
|
|
339
|
+
onDoubleClick: Y,
|
|
340
|
+
children: e && /* @__PURE__ */ U("div", {
|
|
341
|
+
className: "pl-dialog-body",
|
|
342
|
+
children: [/* @__PURE__ */ U("header", {
|
|
343
|
+
className: "pl-dialog-header",
|
|
344
|
+
children: [/* @__PURE__ */ H("h2", { children: n }), i && /* @__PURE__ */ H("button", {
|
|
345
|
+
type: "button",
|
|
346
|
+
className: "pl-icon-button",
|
|
347
|
+
onClick: t,
|
|
348
|
+
"aria-label": "閉じる",
|
|
349
|
+
children: /* @__PURE__ */ H(le, { "aria-hidden": "true" })
|
|
350
|
+
})]
|
|
351
|
+
}), r]
|
|
352
|
+
})
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
// src/ui/NoteDialog.tsx
|
|
356
|
+
var Fe = 2e4;
|
|
357
|
+
function Z({ open: e, title: t, note: n, onSave: r, onClose: i }) {
|
|
358
|
+
let [a, o] = B(!1), [s, c] = B(""), l = z(null);
|
|
359
|
+
L(() => {
|
|
360
|
+
e && (c(n), o(!n));
|
|
361
|
+
}, [e, n]), L(() => {
|
|
362
|
+
e && a && requestAnimationFrame(() => l.current?.focus());
|
|
363
|
+
}, [e, a]);
|
|
364
|
+
let u = () => {
|
|
365
|
+
r(s.trim() ? s.replace(/\s+$/, "") : ""), o(!1), s.trim() || i();
|
|
366
|
+
};
|
|
367
|
+
return /* @__PURE__ */ H(X, {
|
|
368
|
+
open: e,
|
|
369
|
+
onClose: i,
|
|
370
|
+
title: t,
|
|
371
|
+
children: a ? /* @__PURE__ */ U("form", {
|
|
372
|
+
className: "pl-stack",
|
|
373
|
+
onSubmit: (e) => {
|
|
374
|
+
e.preventDefault(), u();
|
|
375
|
+
},
|
|
376
|
+
children: [/* @__PURE__ */ H("textarea", {
|
|
377
|
+
ref: l,
|
|
378
|
+
className: "pl-input pl-note-input",
|
|
379
|
+
value: s,
|
|
380
|
+
maxLength: Fe,
|
|
381
|
+
rows: 10,
|
|
382
|
+
placeholder: "メモ(やり方・読む文章・手順など)",
|
|
383
|
+
"aria-label": `「${t}」のメモ`,
|
|
384
|
+
onChange: (e) => c(e.target.value),
|
|
385
|
+
onKeyDown: (e) => {
|
|
386
|
+
e.key === "Enter" && (e.metaKey || e.ctrlKey) && (e.preventDefault(), u());
|
|
387
|
+
}
|
|
388
|
+
}), /* @__PURE__ */ U("div", {
|
|
389
|
+
className: "pl-row pl-row-end",
|
|
390
|
+
children: [
|
|
391
|
+
/* @__PURE__ */ H("span", {
|
|
392
|
+
className: "pl-note pl-note-hint",
|
|
393
|
+
children: "⌘Enter で保存"
|
|
394
|
+
}),
|
|
395
|
+
/* @__PURE__ */ H("button", {
|
|
396
|
+
type: "button",
|
|
397
|
+
className: "pl-button",
|
|
398
|
+
onClick: () => {
|
|
399
|
+
n ? (c(n), o(!1)) : i();
|
|
400
|
+
},
|
|
401
|
+
children: "やめる"
|
|
402
|
+
}),
|
|
403
|
+
/* @__PURE__ */ H("button", {
|
|
404
|
+
type: "submit",
|
|
405
|
+
className: "pl-button pl-button-primary",
|
|
406
|
+
children: "保存"
|
|
407
|
+
})
|
|
408
|
+
]
|
|
409
|
+
})]
|
|
410
|
+
}) : /* @__PURE__ */ U("div", {
|
|
411
|
+
className: "pl-stack",
|
|
412
|
+
children: [/* @__PURE__ */ H("div", {
|
|
413
|
+
className: "pl-note-view",
|
|
414
|
+
children: n
|
|
415
|
+
}), /* @__PURE__ */ U("div", {
|
|
416
|
+
className: "pl-row pl-row-end",
|
|
417
|
+
children: [/* @__PURE__ */ H("button", {
|
|
418
|
+
type: "button",
|
|
419
|
+
className: "pl-button",
|
|
420
|
+
onClick: () => o(!0),
|
|
421
|
+
children: "書き換える"
|
|
422
|
+
}), /* @__PURE__ */ H("button", {
|
|
423
|
+
type: "button",
|
|
424
|
+
className: "pl-button pl-button-primary",
|
|
425
|
+
onClick: i,
|
|
426
|
+
children: "閉じる"
|
|
427
|
+
})]
|
|
428
|
+
})]
|
|
429
|
+
})
|
|
430
|
+
});
|
|
431
|
+
}
|
|
432
|
+
function Q(e, t) {
|
|
433
|
+
let n = z(void 0);
|
|
434
|
+
return L(() => () => clearTimeout(n.current), []), {
|
|
435
|
+
onClick: () => {
|
|
436
|
+
clearTimeout(n.current), n.current = setTimeout(e, 250);
|
|
437
|
+
},
|
|
438
|
+
onDoubleClick: () => {
|
|
439
|
+
clearTimeout(n.current), window.getSelection?.()?.removeAllRanges(), t();
|
|
440
|
+
}
|
|
441
|
+
};
|
|
442
|
+
}
|
|
443
|
+
function Ie({ title: e, note: t, wrap: n = !1, renameLabel: r, onRename: i, onSaveNote: a, menuOpener: o }) {
|
|
444
|
+
let [s, c] = B(!1), [l, u] = B(!1), d = Q(() => u(!0), () => c(!0));
|
|
445
|
+
return o?.({
|
|
446
|
+
note: () => u(!0),
|
|
447
|
+
rename: () => c(!0)
|
|
448
|
+
}), /* @__PURE__ */ U(V, { children: [s ? /* @__PURE__ */ H($, {
|
|
449
|
+
initial: e,
|
|
450
|
+
label: r,
|
|
451
|
+
onDone: (t) => {
|
|
452
|
+
c(!1), t && t !== e && i(t);
|
|
453
|
+
}
|
|
454
|
+
}) : /* @__PURE__ */ U("button", {
|
|
455
|
+
type: "button",
|
|
456
|
+
className: `pl-task-title pl-title-button${n ? " pl-title-wrap" : ""}`,
|
|
457
|
+
title: t ? `${e}(押すとメモ)` : e,
|
|
458
|
+
...d,
|
|
459
|
+
children: [/* @__PURE__ */ H("span", {
|
|
460
|
+
className: "pl-title-text",
|
|
461
|
+
children: e
|
|
462
|
+
}), t && /* @__PURE__ */ H(W, {
|
|
463
|
+
className: "pl-note-mark",
|
|
464
|
+
"aria-label": "メモあり"
|
|
465
|
+
})]
|
|
466
|
+
}), /* @__PURE__ */ H(Z, {
|
|
467
|
+
open: l,
|
|
468
|
+
title: e,
|
|
469
|
+
note: t ?? "",
|
|
470
|
+
onClose: () => u(!1),
|
|
471
|
+
onSave: a
|
|
472
|
+
})] });
|
|
473
|
+
}
|
|
474
|
+
var Le = [{
|
|
475
|
+
value: "graduated",
|
|
476
|
+
name: "卒業",
|
|
477
|
+
sub: "身についた",
|
|
478
|
+
Icon: oe
|
|
479
|
+
}, {
|
|
480
|
+
value: "paused",
|
|
481
|
+
name: "お休み",
|
|
482
|
+
sub: "続かなかった・今はやめる",
|
|
483
|
+
Icon: se
|
|
484
|
+
}], Re = {
|
|
485
|
+
day: {
|
|
486
|
+
name: "日",
|
|
487
|
+
count: "日"
|
|
488
|
+
},
|
|
489
|
+
week: {
|
|
490
|
+
name: "週",
|
|
491
|
+
count: "週"
|
|
492
|
+
},
|
|
493
|
+
month: {
|
|
494
|
+
name: "月",
|
|
495
|
+
count: "か月"
|
|
496
|
+
},
|
|
497
|
+
year: {
|
|
498
|
+
name: "年",
|
|
499
|
+
count: "年"
|
|
500
|
+
}
|
|
501
|
+
};
|
|
502
|
+
function ze(e, t, n) {
|
|
503
|
+
let [r, i] = B(!1), [a, o] = B(!1);
|
|
504
|
+
return {
|
|
505
|
+
items: [{
|
|
506
|
+
label: e.endedAt ? "卒業・お休みを変える…" : "卒業・お休みにする…",
|
|
507
|
+
onSelect: () => i(!0)
|
|
508
|
+
}, {
|
|
509
|
+
label: "完全に消す",
|
|
510
|
+
danger: !0,
|
|
511
|
+
onSelect: () => e.history?.length ? o(!0) : n({ deleteHabitIds: [e.id] })
|
|
512
|
+
}],
|
|
513
|
+
dialogs: /* @__PURE__ */ U(V, { children: [/* @__PURE__ */ H(Be, {
|
|
514
|
+
open: r,
|
|
515
|
+
habit: e,
|
|
516
|
+
onClose: () => i(!1),
|
|
517
|
+
onEnd: (r, a) => {
|
|
518
|
+
i(!1), n(f(t, e, r, a, /* @__PURE__ */ new Date()));
|
|
519
|
+
}
|
|
520
|
+
}), /* @__PURE__ */ H(Ve, {
|
|
521
|
+
open: a,
|
|
522
|
+
habit: e,
|
|
523
|
+
onClose: () => o(!1),
|
|
524
|
+
onRemove: () => {
|
|
525
|
+
o(!1), n({ deleteHabitIds: [e.id] });
|
|
526
|
+
}
|
|
527
|
+
})] })
|
|
528
|
+
};
|
|
529
|
+
}
|
|
530
|
+
function Be({ open: e, habit: t, onClose: n, onEnd: r }) {
|
|
531
|
+
let [i, a] = B(void 0), [o, s] = B(""), c = !!t.endedAt;
|
|
532
|
+
return L(() => {
|
|
533
|
+
e && (a(t.endedAs), s(t.endNote ?? ""));
|
|
534
|
+
}, [
|
|
535
|
+
e,
|
|
536
|
+
t.endedAs,
|
|
537
|
+
t.endNote
|
|
538
|
+
]), /* @__PURE__ */ H(X, {
|
|
539
|
+
open: e,
|
|
540
|
+
onClose: n,
|
|
541
|
+
title: c ? `「${t.title}」の終え方を変える` : `「${t.title}」を終える`,
|
|
542
|
+
children: /* @__PURE__ */ U("form", {
|
|
543
|
+
className: "pl-stack",
|
|
544
|
+
onSubmit: (e) => {
|
|
545
|
+
e.preventDefault(), i && r(i, o);
|
|
546
|
+
},
|
|
547
|
+
children: [
|
|
548
|
+
!c && /* @__PURE__ */ H("p", {
|
|
549
|
+
className: "pl-note",
|
|
550
|
+
children: "チェックの記録は消えません。習慣の一番下の「これまでの習慣」に残り、また始めることもできます。"
|
|
551
|
+
}),
|
|
552
|
+
/* @__PURE__ */ H("div", {
|
|
553
|
+
className: "pl-end-choices",
|
|
554
|
+
role: "radiogroup",
|
|
555
|
+
"aria-label": "終え方",
|
|
556
|
+
children: Le.map(({ value: e, name: t, sub: n, Icon: r }) => /* @__PURE__ */ U("button", {
|
|
557
|
+
type: "button",
|
|
558
|
+
role: "radio",
|
|
559
|
+
"aria-checked": i === e,
|
|
560
|
+
className: `pl-end-choice pl-end-${e}${i === e ? " pl-end-choice-on" : ""}`,
|
|
561
|
+
onClick: () => a(e),
|
|
562
|
+
children: [
|
|
563
|
+
/* @__PURE__ */ H(r, { "aria-hidden": "true" }),
|
|
564
|
+
/* @__PURE__ */ H("span", {
|
|
565
|
+
className: "pl-end-choice-name",
|
|
566
|
+
children: t
|
|
567
|
+
}),
|
|
568
|
+
/* @__PURE__ */ H("span", {
|
|
569
|
+
className: "pl-end-choice-sub",
|
|
570
|
+
children: n
|
|
571
|
+
})
|
|
572
|
+
]
|
|
573
|
+
}, e))
|
|
574
|
+
}),
|
|
575
|
+
/* @__PURE__ */ H("input", {
|
|
576
|
+
className: "pl-input",
|
|
577
|
+
value: o,
|
|
578
|
+
maxLength: 200,
|
|
579
|
+
placeholder: "ひとこと(なくてもよい)例: 朝が忙しかった",
|
|
580
|
+
"aria-label": "ひとこと",
|
|
581
|
+
onChange: (e) => s(e.target.value)
|
|
582
|
+
}),
|
|
583
|
+
/* @__PURE__ */ U("div", {
|
|
584
|
+
className: "pl-row pl-row-end",
|
|
585
|
+
children: [/* @__PURE__ */ H("button", {
|
|
586
|
+
type: "button",
|
|
587
|
+
className: "pl-button",
|
|
588
|
+
onClick: n,
|
|
589
|
+
children: "やめる"
|
|
590
|
+
}), /* @__PURE__ */ H("button", {
|
|
591
|
+
type: "submit",
|
|
592
|
+
className: "pl-button pl-button-primary",
|
|
593
|
+
disabled: !i,
|
|
594
|
+
children: c ? "変える" : i === "paused" ? "お休みにする" : i === "graduated" ? "卒業する" : "選んでください"
|
|
595
|
+
})]
|
|
596
|
+
})
|
|
597
|
+
]
|
|
598
|
+
})
|
|
599
|
+
});
|
|
600
|
+
}
|
|
601
|
+
function Ve({ open: e, habit: t, onClose: n, onRemove: r }) {
|
|
602
|
+
let i = t.history?.length ?? 0;
|
|
603
|
+
return /* @__PURE__ */ H(X, {
|
|
604
|
+
open: e,
|
|
605
|
+
onClose: n,
|
|
606
|
+
title: `「${t.title}」を完全に消す`,
|
|
607
|
+
children: /* @__PURE__ */ U("div", {
|
|
608
|
+
className: "pl-stack",
|
|
609
|
+
children: [/* @__PURE__ */ U("p", {
|
|
610
|
+
className: "pl-text",
|
|
611
|
+
children: [
|
|
612
|
+
"チェックの記録(",
|
|
613
|
+
i,
|
|
614
|
+
" 日分)も消え、元に戻せません。記録を残したいときは「卒業・お休みにする」を使ってください。"
|
|
615
|
+
]
|
|
616
|
+
}), /* @__PURE__ */ U("div", {
|
|
617
|
+
className: "pl-row pl-row-end",
|
|
618
|
+
children: [/* @__PURE__ */ H("button", {
|
|
619
|
+
type: "button",
|
|
620
|
+
className: "pl-button",
|
|
621
|
+
onClick: n,
|
|
622
|
+
children: "やめる"
|
|
623
|
+
}), /* @__PURE__ */ H("button", {
|
|
624
|
+
type: "button",
|
|
625
|
+
className: "pl-button pl-button-danger",
|
|
626
|
+
onClick: r,
|
|
627
|
+
children: "完全に消す"
|
|
628
|
+
})]
|
|
629
|
+
})]
|
|
630
|
+
})
|
|
631
|
+
});
|
|
632
|
+
}
|
|
633
|
+
function He({ habits: e, data: t, store: n, now: r, label: i = "これまでの習慣" }) {
|
|
634
|
+
if (e.length === 0) return null;
|
|
635
|
+
let a = (e) => void n.apply(e);
|
|
636
|
+
return /* @__PURE__ */ U("details", {
|
|
637
|
+
className: "pl-ended",
|
|
638
|
+
children: [/* @__PURE__ */ U("summary", {
|
|
639
|
+
className: "pl-ended-summary",
|
|
640
|
+
children: [
|
|
641
|
+
i,
|
|
642
|
+
"(",
|
|
643
|
+
e.length,
|
|
644
|
+
")"
|
|
645
|
+
]
|
|
646
|
+
}), /* @__PURE__ */ H("ul", {
|
|
647
|
+
className: "pl-list",
|
|
648
|
+
children: e.map((e) => /* @__PURE__ */ H(Ue, {
|
|
649
|
+
habit: e,
|
|
650
|
+
data: t,
|
|
651
|
+
apply: a,
|
|
652
|
+
now: r
|
|
653
|
+
}, e.id))
|
|
654
|
+
})]
|
|
655
|
+
});
|
|
656
|
+
}
|
|
657
|
+
function Ue({ habit: e, data: t, apply: n, now: r }) {
|
|
658
|
+
let { items: i, dialogs: a } = ze(e, t, n), o = {}, c = e.endedAs === "graduated", l = c ? oe : se, d = e.projectId ? t.projects.find((t) => t.id === e.projectId) : void 0, f = h(e, r), p = Re[e.period], m = `${u(s(f.start), r)}〜${f.end ? u(s(f.end), r) : ""}`, g = () => (/* @__PURE__ */ new Date()).toISOString();
|
|
659
|
+
return /* @__PURE__ */ U("li", {
|
|
660
|
+
className: `pl-ended-habit pl-ended-${c ? "graduated" : "paused"}`,
|
|
661
|
+
children: [
|
|
662
|
+
/* @__PURE__ */ H("span", {
|
|
663
|
+
className: "pl-ended-mark",
|
|
664
|
+
role: "img",
|
|
665
|
+
"aria-label": c ? "卒業" : "お休み",
|
|
666
|
+
title: c ? "卒業(身についた)" : "お休み(続かなかった・今はやめる)",
|
|
667
|
+
children: /* @__PURE__ */ H(l, { "aria-hidden": "true" })
|
|
668
|
+
}),
|
|
669
|
+
/* @__PURE__ */ U("div", {
|
|
670
|
+
className: "pl-ended-body",
|
|
671
|
+
children: [
|
|
672
|
+
/* @__PURE__ */ U("div", {
|
|
673
|
+
className: "pl-ended-line",
|
|
674
|
+
children: [d && /* @__PURE__ */ H(Ze, {
|
|
675
|
+
name: Xe(t, d),
|
|
676
|
+
color: d.color
|
|
677
|
+
}), /* @__PURE__ */ H(Ie, {
|
|
678
|
+
title: e.title,
|
|
679
|
+
note: e.note,
|
|
680
|
+
wrap: !0,
|
|
681
|
+
renameLabel: "習慣の名前",
|
|
682
|
+
menuOpener: (e) => Object.assign(o, e),
|
|
683
|
+
onRename: (t) => n({ habits: [{
|
|
684
|
+
...e,
|
|
685
|
+
title: t,
|
|
686
|
+
updatedAt: g()
|
|
687
|
+
}] }),
|
|
688
|
+
onSaveNote: (t) => {
|
|
689
|
+
let { note: r, ...i } = e;
|
|
690
|
+
n({ habits: [{
|
|
691
|
+
...i,
|
|
692
|
+
...t ? { note: t } : {},
|
|
693
|
+
updatedAt: g()
|
|
694
|
+
}] });
|
|
695
|
+
}
|
|
696
|
+
})]
|
|
697
|
+
}),
|
|
698
|
+
/* @__PURE__ */ U("div", {
|
|
699
|
+
className: "pl-ended-meta",
|
|
700
|
+
children: [/* @__PURE__ */ H("span", { children: m }), f.total > 0 && /* @__PURE__ */ U("span", {
|
|
701
|
+
title: `${f.total} ${p.count}のうち ${f.done} ${p.count}`,
|
|
702
|
+
children: [
|
|
703
|
+
"できた",
|
|
704
|
+
p.name,
|
|
705
|
+
" ",
|
|
706
|
+
Math.round(f.done / f.total * 100),
|
|
707
|
+
"%"
|
|
708
|
+
]
|
|
709
|
+
})]
|
|
710
|
+
}),
|
|
711
|
+
e.endNote && /* @__PURE__ */ U("p", {
|
|
712
|
+
className: "pl-ended-note",
|
|
713
|
+
children: [
|
|
714
|
+
"「",
|
|
715
|
+
e.endNote,
|
|
716
|
+
"」"
|
|
717
|
+
]
|
|
718
|
+
})
|
|
719
|
+
]
|
|
720
|
+
}),
|
|
721
|
+
/* @__PURE__ */ H(q, {
|
|
722
|
+
label: `「${e.title}」の操作`,
|
|
723
|
+
items: [
|
|
724
|
+
{
|
|
725
|
+
label: "また始める",
|
|
726
|
+
onSelect: () => n(D(t, e, /* @__PURE__ */ new Date()))
|
|
727
|
+
},
|
|
728
|
+
i[0],
|
|
729
|
+
{
|
|
730
|
+
label: "名前を変える",
|
|
731
|
+
onSelect: () => o.rename?.()
|
|
732
|
+
},
|
|
733
|
+
{
|
|
734
|
+
label: e.note ? "メモを見る" : "メモを書く",
|
|
735
|
+
onSelect: () => o.note?.()
|
|
736
|
+
},
|
|
737
|
+
"separator",
|
|
738
|
+
i[1]
|
|
739
|
+
]
|
|
740
|
+
}),
|
|
741
|
+
a
|
|
742
|
+
]
|
|
743
|
+
});
|
|
744
|
+
}
|
|
745
|
+
// src/ui/Rows.tsx
|
|
746
|
+
function We({ view: t, data: s, store: c, now: l }) {
|
|
747
|
+
let { task: u, label: f, done: p, faded: m, placedTo: h, from: g, project: _ } = t, { simple: y } = G(), [b, x] = B(!1), [C, D] = B(!1), j = K(u.id, b), M = !u.parentId && !u.habitId, ne = z(null), N = Q(() => D(!0), () => x(!0)), P = w(t.horizon), F = ee(t.horizon), I = (e) => void c.apply(e), L = t.horizon === "today" && !p && !m, R = L && v(u, l), V = [
|
|
748
|
+
...L ? [R ? {
|
|
749
|
+
label: "今日やる(今日にもどす)",
|
|
750
|
+
onSelect: () => I(o(u, l))
|
|
751
|
+
} : {
|
|
752
|
+
label: "明日にまわす",
|
|
753
|
+
onSelect: () => I(T(u, l))
|
|
754
|
+
}] : [],
|
|
755
|
+
...P.map((e) => ({
|
|
756
|
+
label: r[e],
|
|
757
|
+
onSelect: () => I(S(s, u, e, l)),
|
|
758
|
+
disabled: p
|
|
759
|
+
})),
|
|
760
|
+
...P.length ? ["separator"] : [],
|
|
761
|
+
{
|
|
762
|
+
label: "名前を変える",
|
|
763
|
+
onSelect: () => x(!0)
|
|
764
|
+
},
|
|
765
|
+
...M ? [{
|
|
766
|
+
label: u.due ? "日付を変える" : "日付を決める",
|
|
767
|
+
onSelect: () => ne.current?.()
|
|
768
|
+
}, ...u.due ? [{
|
|
769
|
+
label: "日付を外す",
|
|
770
|
+
onSelect: () => I(k(u, ""))
|
|
771
|
+
}] : []] : [],
|
|
772
|
+
{
|
|
773
|
+
label: u.note ? "メモを見る" : "メモを書く",
|
|
774
|
+
onSelect: () => D(!0)
|
|
775
|
+
},
|
|
776
|
+
"separator",
|
|
777
|
+
...u.parentId || u.habitId ? [{
|
|
778
|
+
label: `${g ? e[g] ?? "元" : "元"}に戻す`,
|
|
779
|
+
onSelect: () => I(O(s, u, l))
|
|
780
|
+
}] : [],
|
|
781
|
+
{
|
|
782
|
+
label: "消す",
|
|
783
|
+
danger: !0,
|
|
784
|
+
onSelect: () => I(E(s, u, l))
|
|
785
|
+
}
|
|
786
|
+
];
|
|
787
|
+
return /* @__PURE__ */ U("li", {
|
|
788
|
+
ref: j.ref,
|
|
789
|
+
style: j.style,
|
|
790
|
+
className: `pl-task pl-p-${u.priority}${m ? " pl-faded" : ""}${p ? " pl-done" : ""}${j.isDragging ? " pl-dragging" : ""}`,
|
|
791
|
+
...j.handleProps,
|
|
792
|
+
children: [
|
|
793
|
+
/* @__PURE__ */ H("span", {
|
|
794
|
+
className: "pl-task-label",
|
|
795
|
+
children: f
|
|
796
|
+
}),
|
|
797
|
+
/* @__PURE__ */ H("button", {
|
|
798
|
+
type: "button",
|
|
799
|
+
role: "checkbox",
|
|
800
|
+
"aria-checked": p,
|
|
801
|
+
"aria-label": p ? `「${u.title}」を終えたのを取り消す` : `「${u.title}」を終える`,
|
|
802
|
+
className: "pl-circle",
|
|
803
|
+
onClick: () => I(te(s, u, l)),
|
|
804
|
+
children: p && /* @__PURE__ */ H(ie, { "aria-hidden": "true" })
|
|
805
|
+
}),
|
|
806
|
+
/* @__PURE__ */ U("div", {
|
|
807
|
+
className: "pl-task-main",
|
|
808
|
+
children: [b ? /* @__PURE__ */ H($, {
|
|
809
|
+
initial: u.title,
|
|
810
|
+
label: "名前",
|
|
811
|
+
onDone: (e) => {
|
|
812
|
+
x(!1), e && e !== u.title && I({ tasks: [{
|
|
813
|
+
...u,
|
|
814
|
+
title: e,
|
|
815
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
816
|
+
}] });
|
|
817
|
+
}
|
|
818
|
+
}) : /* @__PURE__ */ U("button", {
|
|
819
|
+
type: "button",
|
|
820
|
+
className: "pl-task-title pl-title-button",
|
|
821
|
+
title: u.note ? `${u.title}(押すとメモ)` : u.title,
|
|
822
|
+
...N,
|
|
823
|
+
children: [
|
|
824
|
+
_ && /* @__PURE__ */ H(Ze, {
|
|
825
|
+
name: Xe(s, _),
|
|
826
|
+
color: _.color
|
|
827
|
+
}),
|
|
828
|
+
/* @__PURE__ */ H("span", {
|
|
829
|
+
className: "pl-title-text",
|
|
830
|
+
children: u.title
|
|
831
|
+
}),
|
|
832
|
+
u.note && /* @__PURE__ */ H(W, {
|
|
833
|
+
className: "pl-note-mark",
|
|
834
|
+
"aria-label": "メモあり"
|
|
835
|
+
})
|
|
836
|
+
]
|
|
837
|
+
}), !b && /* @__PURE__ */ U("span", {
|
|
838
|
+
className: "pl-task-meta",
|
|
839
|
+
children: [
|
|
840
|
+
!y && h && /* @__PURE__ */ U("span", {
|
|
841
|
+
className: "pl-chip",
|
|
842
|
+
children: ["→", n[h]]
|
|
843
|
+
}),
|
|
844
|
+
!y && g && g !== "pool" && /* @__PURE__ */ U("span", {
|
|
845
|
+
className: "pl-chip",
|
|
846
|
+
children: ["←", e[g]]
|
|
847
|
+
}),
|
|
848
|
+
M ? /* @__PURE__ */ H(De, {
|
|
849
|
+
variant: "inline",
|
|
850
|
+
due: u.due,
|
|
851
|
+
now: l,
|
|
852
|
+
done: p,
|
|
853
|
+
label: `「${u.title}」の日付`,
|
|
854
|
+
opener: (e) => ne.current = e,
|
|
855
|
+
onChange: (e) => I(k(u, e))
|
|
856
|
+
}) : u.due && /* @__PURE__ */ H("span", {
|
|
857
|
+
className: "pl-chip",
|
|
858
|
+
children: d(u.due, l)
|
|
859
|
+
})
|
|
860
|
+
]
|
|
861
|
+
})]
|
|
862
|
+
}),
|
|
863
|
+
/* @__PURE__ */ U("div", {
|
|
864
|
+
className: "pl-task-actions",
|
|
865
|
+
children: [
|
|
866
|
+
(u.parentId || u.habitId) && /* @__PURE__ */ H("button", {
|
|
867
|
+
type: "button",
|
|
868
|
+
className: "pl-row-button",
|
|
869
|
+
"aria-label": `「${u.title}」を${g ? e[g] : "元"}に戻す`,
|
|
870
|
+
title: `${g ? e[g] : "元"}に戻す`,
|
|
871
|
+
onClick: () => I(O(s, u, l)),
|
|
872
|
+
children: /* @__PURE__ */ H(ae, { "aria-hidden": "true" })
|
|
873
|
+
}),
|
|
874
|
+
F && !p && !m && /* @__PURE__ */ U("button", {
|
|
875
|
+
type: "button",
|
|
876
|
+
className: "pl-place-button",
|
|
877
|
+
onClick: () => I(S(s, u, F, l)),
|
|
878
|
+
title: r[F],
|
|
879
|
+
children: [n[F], "↓"]
|
|
880
|
+
}),
|
|
881
|
+
L && /* @__PURE__ */ H("button", {
|
|
882
|
+
type: "button",
|
|
883
|
+
className: "pl-place-button",
|
|
884
|
+
onClick: () => I(R ? o(u, l) : T(u, l)),
|
|
885
|
+
title: R ? "今日やる(今日にもどす)" : "明日にまわす",
|
|
886
|
+
"aria-label": R ? `「${u.title}」を今日にもどす` : `「${u.title}」を明日にまわす`,
|
|
887
|
+
children: R ? "今日↑" : "明日→"
|
|
888
|
+
}),
|
|
889
|
+
/* @__PURE__ */ H(q, {
|
|
890
|
+
label: `「${u.title}」の操作`,
|
|
891
|
+
items: V,
|
|
892
|
+
header: /* @__PURE__ */ H("div", {
|
|
893
|
+
className: "pl-menu-priorities",
|
|
894
|
+
role: "group",
|
|
895
|
+
"aria-label": "優先度",
|
|
896
|
+
children: i.map((e) => /* @__PURE__ */ H("button", {
|
|
897
|
+
type: "button",
|
|
898
|
+
className: `pl-pchip pl-p-${e}`,
|
|
899
|
+
"aria-pressed": u.priority === e,
|
|
900
|
+
title: a[e],
|
|
901
|
+
onClick: () => I(A(s, u, e, l)),
|
|
902
|
+
children: e
|
|
903
|
+
}, e))
|
|
904
|
+
})
|
|
905
|
+
})
|
|
906
|
+
]
|
|
907
|
+
}),
|
|
908
|
+
/* @__PURE__ */ H(Z, {
|
|
909
|
+
open: C,
|
|
910
|
+
title: u.title,
|
|
911
|
+
note: u.note ?? "",
|
|
912
|
+
onClose: () => D(!1),
|
|
913
|
+
onSave: (e) => {
|
|
914
|
+
let { note: t, ...n } = u;
|
|
915
|
+
I({ tasks: [{
|
|
916
|
+
...n,
|
|
917
|
+
...e ? { note: e } : {},
|
|
918
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
919
|
+
}] });
|
|
920
|
+
}
|
|
921
|
+
})
|
|
922
|
+
]
|
|
923
|
+
});
|
|
924
|
+
}
|
|
925
|
+
var Ge = {
|
|
926
|
+
week: "毎週の曜日",
|
|
927
|
+
month: "毎月の日",
|
|
928
|
+
year: "毎年の日付・月"
|
|
929
|
+
};
|
|
930
|
+
function Ke({ view: e, data: i, store: a, now: o }) {
|
|
931
|
+
let { habit: c, checked: l, project: u, faded: d, placedTo: f, auto: p, dueDay: h } = e, { simple: _ } = G(), [v, b] = B(!1), [S, w] = B(!1), [T, E] = B(!1), D = K(p ? `auto-${c.id}` : c.id, v || p), O = Q(() => w(!0), () => b(!0)), k = (e) => void a.apply(e), A = p ? [] : m(c), j = p ? void 0 : ee(x(c.period)), te = p && h && !y(c) && s(h) < s(o), N = ne(c), P = ze(c, i, k);
|
|
932
|
+
return /* @__PURE__ */ U("li", {
|
|
933
|
+
ref: D.ref,
|
|
934
|
+
style: D.style,
|
|
935
|
+
className: `pl-habit${l ? " pl-done" : ""}${d ? " pl-faded" : ""}${p ? " pl-habit-auto" : ""}${D.isDragging ? " pl-dragging" : ""}`,
|
|
936
|
+
...D.handleProps,
|
|
937
|
+
children: [
|
|
938
|
+
/* @__PURE__ */ H("button", {
|
|
939
|
+
type: "button",
|
|
940
|
+
role: "checkbox",
|
|
941
|
+
"aria-checked": l,
|
|
942
|
+
"aria-label": l ? `「${c.title}」のチェックを外す` : `「${c.title}」をチェック`,
|
|
943
|
+
className: "pl-square",
|
|
944
|
+
onClick: () => k(M(i, c, o)),
|
|
945
|
+
children: l && /* @__PURE__ */ H(ie, { "aria-hidden": "true" })
|
|
946
|
+
}),
|
|
947
|
+
v ? /* @__PURE__ */ H($, {
|
|
948
|
+
initial: c.title,
|
|
949
|
+
label: "習慣の名前",
|
|
950
|
+
onDone: (e) => {
|
|
951
|
+
b(!1), e && e !== c.title && k({ habits: [{
|
|
952
|
+
...c,
|
|
953
|
+
title: e,
|
|
954
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
955
|
+
}] });
|
|
956
|
+
}
|
|
957
|
+
}) : /* @__PURE__ */ U("button", {
|
|
958
|
+
type: "button",
|
|
959
|
+
className: "pl-task-title pl-title-button",
|
|
960
|
+
title: c.note ? `${c.title}(押すとメモ)` : c.title,
|
|
961
|
+
...O,
|
|
962
|
+
children: [
|
|
963
|
+
u && /* @__PURE__ */ H(Ze, {
|
|
964
|
+
name: Xe(i, u),
|
|
965
|
+
color: u.color
|
|
966
|
+
}),
|
|
967
|
+
/* @__PURE__ */ H("span", {
|
|
968
|
+
className: "pl-title-text",
|
|
969
|
+
children: c.title
|
|
970
|
+
}),
|
|
971
|
+
c.note && /* @__PURE__ */ H(W, {
|
|
972
|
+
className: "pl-note-mark",
|
|
973
|
+
"aria-label": "メモあり"
|
|
974
|
+
})
|
|
975
|
+
]
|
|
976
|
+
}),
|
|
977
|
+
T ? /* @__PURE__ */ H(Pe, {
|
|
978
|
+
autoFocus: !0,
|
|
979
|
+
habit: c,
|
|
980
|
+
onBlur: c.period === "year" ? void 0 : () => E(!1),
|
|
981
|
+
onChange: (e) => {
|
|
982
|
+
k({ habits: [e] }), c.period !== "year" && E(!1);
|
|
983
|
+
}
|
|
984
|
+
}) : N && /* @__PURE__ */ H("span", {
|
|
985
|
+
className: `pl-day${te && !l ? " pl-day-over" : ""}`,
|
|
986
|
+
title: `${t[c.period]}${N}${p && h ? `(${h.getMonth() + 1}/${h.getDate()})` : ""}`,
|
|
987
|
+
children: N
|
|
988
|
+
}),
|
|
989
|
+
T && c.period === "year" && /* @__PURE__ */ H("button", {
|
|
990
|
+
type: "button",
|
|
991
|
+
className: "pl-place-button",
|
|
992
|
+
onClick: () => E(!1),
|
|
993
|
+
children: "決定"
|
|
994
|
+
}),
|
|
995
|
+
!_ && f && /* @__PURE__ */ U("span", {
|
|
996
|
+
className: "pl-chip",
|
|
997
|
+
children: ["→", n[f]]
|
|
998
|
+
}),
|
|
999
|
+
j && !l && !d && /* @__PURE__ */ U("button", {
|
|
1000
|
+
type: "button",
|
|
1001
|
+
className: "pl-place-button",
|
|
1002
|
+
onClick: () => k(C(i, c, j, o)),
|
|
1003
|
+
title: r[j],
|
|
1004
|
+
children: [n[j], "↓"]
|
|
1005
|
+
}),
|
|
1006
|
+
/* @__PURE__ */ H(q, {
|
|
1007
|
+
label: `「${c.title}」の操作`,
|
|
1008
|
+
items: [
|
|
1009
|
+
...A.map((e) => ({
|
|
1010
|
+
label: r[e],
|
|
1011
|
+
onSelect: () => k(C(i, c, e, o)),
|
|
1012
|
+
disabled: l
|
|
1013
|
+
})),
|
|
1014
|
+
...A.length ? ["separator"] : [],
|
|
1015
|
+
{
|
|
1016
|
+
label: "名前を変える",
|
|
1017
|
+
onSelect: () => b(!0)
|
|
1018
|
+
},
|
|
1019
|
+
{
|
|
1020
|
+
label: c.note ? "メモを見る" : "メモを書く",
|
|
1021
|
+
onSelect: () => w(!0)
|
|
1022
|
+
},
|
|
1023
|
+
...c.period === "day" ? [] : [{
|
|
1024
|
+
label: N ? `${Ge[c.period]}を変える(${N})` : `${Ge[c.period]}を決める`,
|
|
1025
|
+
onSelect: () => E(!0)
|
|
1026
|
+
}],
|
|
1027
|
+
{
|
|
1028
|
+
label: "やることに移す(1 回で終わるもの)",
|
|
1029
|
+
onSelect: () => k(g(i, c, o))
|
|
1030
|
+
},
|
|
1031
|
+
P.items[0],
|
|
1032
|
+
"separator",
|
|
1033
|
+
P.items[1]
|
|
1034
|
+
]
|
|
1035
|
+
}),
|
|
1036
|
+
P.dialogs,
|
|
1037
|
+
/* @__PURE__ */ H(Z, {
|
|
1038
|
+
open: S,
|
|
1039
|
+
title: c.title,
|
|
1040
|
+
note: c.note ?? "",
|
|
1041
|
+
onClose: () => w(!1),
|
|
1042
|
+
onSave: (e) => {
|
|
1043
|
+
let { note: t, ...n } = c;
|
|
1044
|
+
k({ habits: [{
|
|
1045
|
+
...n,
|
|
1046
|
+
...e ? { note: e } : {},
|
|
1047
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
1048
|
+
}] });
|
|
1049
|
+
}
|
|
1050
|
+
})
|
|
1051
|
+
]
|
|
1052
|
+
});
|
|
1053
|
+
}
|
|
1054
|
+
function $({ initial: e, label: t, onDone: n }) {
|
|
1055
|
+
let [r, i] = B(e), a = z(null), o = z(!1);
|
|
1056
|
+
L(() => {
|
|
1057
|
+
a.current?.focus(), a.current?.select();
|
|
1058
|
+
}, []);
|
|
1059
|
+
let s = (e) => {
|
|
1060
|
+
o.current || (o.current = !0, n(e.trim()));
|
|
1061
|
+
};
|
|
1062
|
+
return /* @__PURE__ */ H("input", {
|
|
1063
|
+
ref: a,
|
|
1064
|
+
className: "pl-inline-input",
|
|
1065
|
+
value: r,
|
|
1066
|
+
"aria-label": t,
|
|
1067
|
+
onChange: (e) => i(e.target.value),
|
|
1068
|
+
onKeyDown: (t) => {
|
|
1069
|
+
t.key === "Enter" && !t.nativeEvent.isComposing && s(r), t.key === "Escape" && s(e);
|
|
1070
|
+
},
|
|
1071
|
+
onBlur: () => s(r)
|
|
1072
|
+
});
|
|
1073
|
+
}
|
|
1074
|
+
function qe({ placeholder: e, label: t, onAdd: n, priority: r, onPriority: o }) {
|
|
1075
|
+
let s = `planner:draft:${t}`, [c, l] = B(() => Je(s)), u = (e) => {
|
|
1076
|
+
l(e), Ye(s, e);
|
|
1077
|
+
}, { simple: d } = G();
|
|
1078
|
+
return /* @__PURE__ */ U("form", {
|
|
1079
|
+
className: "pl-add",
|
|
1080
|
+
onSubmit: (e) => {
|
|
1081
|
+
e.preventDefault();
|
|
1082
|
+
let t = c.trim();
|
|
1083
|
+
t && (n(t), u(""));
|
|
1084
|
+
},
|
|
1085
|
+
children: [r && o && /* @__PURE__ */ H("div", {
|
|
1086
|
+
className: "pl-add-priorities",
|
|
1087
|
+
role: "radiogroup",
|
|
1088
|
+
"aria-label": "優先度",
|
|
1089
|
+
children: i.map((e) => /* @__PURE__ */ H("button", {
|
|
1090
|
+
type: "button",
|
|
1091
|
+
role: "radio",
|
|
1092
|
+
"aria-checked": r === e,
|
|
1093
|
+
title: a[e],
|
|
1094
|
+
className: `pl-pchip pl-p-${e}`,
|
|
1095
|
+
onClick: () => o(e),
|
|
1096
|
+
children: e
|
|
1097
|
+
}, e))
|
|
1098
|
+
}), /* @__PURE__ */ U("div", {
|
|
1099
|
+
className: "pl-add-line",
|
|
1100
|
+
children: [/* @__PURE__ */ H("input", {
|
|
1101
|
+
className: "pl-add-input",
|
|
1102
|
+
value: c,
|
|
1103
|
+
placeholder: d ? "+" : e,
|
|
1104
|
+
"aria-label": t,
|
|
1105
|
+
enterKeyHint: "done",
|
|
1106
|
+
onChange: (e) => u(e.target.value),
|
|
1107
|
+
onKeyDown: (e) => {
|
|
1108
|
+
e.key === "Enter" && e.nativeEvent.isComposing && e.preventDefault();
|
|
1109
|
+
}
|
|
1110
|
+
}), c.trim() && /* @__PURE__ */ H("button", {
|
|
1111
|
+
type: "submit",
|
|
1112
|
+
className: "pl-add-submit",
|
|
1113
|
+
"aria-label": `${t}(追加)`,
|
|
1114
|
+
children: "追加"
|
|
1115
|
+
})]
|
|
1116
|
+
})]
|
|
1117
|
+
});
|
|
1118
|
+
}
|
|
1119
|
+
function Je(e) {
|
|
1120
|
+
try {
|
|
1121
|
+
return sessionStorage.getItem(e) ?? "";
|
|
1122
|
+
} catch {
|
|
1123
|
+
return "";
|
|
1124
|
+
}
|
|
1125
|
+
}
|
|
1126
|
+
function Ye(e, t) {
|
|
1127
|
+
try {
|
|
1128
|
+
t ? sessionStorage.setItem(e, t) : sessionStorage.removeItem(e);
|
|
1129
|
+
} catch {}
|
|
1130
|
+
}
|
|
1131
|
+
function Xe(e, t) {
|
|
1132
|
+
let n = t.parentId ? e.projects.find((e) => e.id === t.parentId) : void 0;
|
|
1133
|
+
return n ? `${n.name}・${t.name}` : t.name;
|
|
1134
|
+
}
|
|
1135
|
+
function Ze({ name: e, color: t }) {
|
|
1136
|
+
return /* @__PURE__ */ H("span", {
|
|
1137
|
+
className: `pl-pdot pl-color-${t}`,
|
|
1138
|
+
role: "img",
|
|
1139
|
+
"aria-label": e,
|
|
1140
|
+
title: e
|
|
1141
|
+
});
|
|
1142
|
+
}
|
|
1143
|
+
// src/ui/JumpBar.tsx
|
|
1144
|
+
function Qe({ label: e, items: t, active: n, onJump: r, className: i }) {
|
|
1145
|
+
return t.length < 2 ? null : /* @__PURE__ */ H("nav", {
|
|
1146
|
+
className: `pl-jump ${i ?? ""}`,
|
|
1147
|
+
"aria-label": e,
|
|
1148
|
+
children: /* @__PURE__ */ H("ul", { children: t.map((e) => /* @__PURE__ */ H("li", { children: /* @__PURE__ */ U("button", {
|
|
1149
|
+
type: "button",
|
|
1150
|
+
className: "pl-jump-chip",
|
|
1151
|
+
"aria-current": n === e.id ? "true" : void 0,
|
|
1152
|
+
onClick: () => r(e.id),
|
|
1153
|
+
children: [e.color && /* @__PURE__ */ H("span", {
|
|
1154
|
+
className: `pl-dot pl-color-${e.color}`,
|
|
1155
|
+
"aria-hidden": "true"
|
|
1156
|
+
}), /* @__PURE__ */ H("span", {
|
|
1157
|
+
className: "pl-jump-label",
|
|
1158
|
+
children: e.label
|
|
1159
|
+
})]
|
|
1160
|
+
}) }, e.id)) })
|
|
1161
|
+
});
|
|
1162
|
+
}
|
|
1163
|
+
function $e(e, t = !1) {
|
|
1164
|
+
e?.scrollIntoView?.(t ? {
|
|
1165
|
+
behavior: "smooth",
|
|
1166
|
+
inline: "start",
|
|
1167
|
+
block: "nearest"
|
|
1168
|
+
} : {
|
|
1169
|
+
behavior: "smooth",
|
|
1170
|
+
block: "start"
|
|
1171
|
+
});
|
|
1172
|
+
}
|
|
1173
|
+
export { $ as a, ze as c, De as d, q as f, Se as g, K as h, Ke as i, Ie as l, we as m, $e as n, We as o, Ce as p, qe as r, He as s, Qe as t, Pe as u };
|