@shiodome47/sekisho 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +33 -0
- package/README.md +142 -2
- package/dist/Sekisho-BgZdhYqq.d.ts +181 -0
- package/dist/chunk-7YUKMUSF.js +452 -0
- package/dist/chunk-7YUKMUSF.js.map +1 -0
- package/dist/chunk-IQYSUTRQ.js +125 -0
- package/dist/chunk-IQYSUTRQ.js.map +1 -0
- package/dist/chunk-PO4XY43G.js +222 -0
- package/dist/chunk-PO4XY43G.js.map +1 -0
- package/dist/core/index.d.ts +202 -0
- package/dist/core/index.js +82 -0
- package/dist/core/index.js.map +1 -0
- package/dist/editor/index.d.ts +12 -0
- package/dist/editor/index.js +258 -0
- package/dist/editor/index.js.map +1 -0
- package/dist/index.d.ts +53 -0
- package/dist/index.js +552 -0
- package/dist/index.js.map +1 -0
- package/dist/style.css +809 -0
- package/dist/types-73liizfJ.d.ts +168 -0
- package/package.json +82 -4
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import {
|
|
3
|
+
JA_LABELS,
|
|
4
|
+
Stamp,
|
|
5
|
+
stampOf
|
|
6
|
+
} from "../chunk-PO4XY43G.js";
|
|
7
|
+
import {
|
|
8
|
+
newGate,
|
|
9
|
+
newItem
|
|
10
|
+
} from "../chunk-IQYSUTRQ.js";
|
|
11
|
+
|
|
12
|
+
// src/editor/CourseEditor.tsx
|
|
13
|
+
import { CardBoard, flattenCards } from "linkshelf";
|
|
14
|
+
import { useMemo, useState } from "react";
|
|
15
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
16
|
+
var MAX_COUNT = 999;
|
|
17
|
+
function CourseEditor({ course, onSave, onCancel, targets, labels: labelsPatch }) {
|
|
18
|
+
const labels = useMemo(() => ({ ...JA_LABELS, ...labelsPatch }), [labelsPatch]);
|
|
19
|
+
const [draft, setDraft] = useState(course);
|
|
20
|
+
const setGates = (fn) => setDraft((d) => ({ ...d, gates: fn(d.gates) }));
|
|
21
|
+
const setGate = (gateId, fn) => setGates((gs) => gs.map((g) => g.id === gateId ? fn(g) : g));
|
|
22
|
+
const cards = draft.gates.map((g, i) => ({ ...g, order: g.board?.order ?? i, column: g.board?.column, size: g.items.length + 4 }));
|
|
23
|
+
const onMove = (places) => {
|
|
24
|
+
const byId = new Map(places.map((p) => [p.id, p]));
|
|
25
|
+
const placed = cards.map((c) => {
|
|
26
|
+
const p = byId.get(c.id);
|
|
27
|
+
return p ? { ...c, order: p.order, column: p.column } : c;
|
|
28
|
+
});
|
|
29
|
+
const order = flattenCards(placed).map((c) => c.id);
|
|
30
|
+
setGates(
|
|
31
|
+
(gs) => order.map((id) => gs.find((g) => g.id === id)).map((g) => {
|
|
32
|
+
const p = byId.get(g.id);
|
|
33
|
+
return p ? { ...g, board: { order: p.order, ...p.column !== void 0 ? { column: p.column } : {} } } : g;
|
|
34
|
+
})
|
|
35
|
+
);
|
|
36
|
+
};
|
|
37
|
+
const addGate = () => setGates((gs) => [...gs, newGate({ title: labels.newGateTitle(gs.length + 1) })]);
|
|
38
|
+
const save = () => {
|
|
39
|
+
const at = (/* @__PURE__ */ new Date()).toISOString();
|
|
40
|
+
onSave({
|
|
41
|
+
...draft,
|
|
42
|
+
title: draft.title.trim() || labels.untitled,
|
|
43
|
+
description: draft.description?.trim() || void 0,
|
|
44
|
+
gates: draft.gates.map((g) => ({ ...g, title: g.title.trim() || labels.gateTitle, items: g.items.filter((i) => i.title.trim()) })),
|
|
45
|
+
revision: course.revision + 1,
|
|
46
|
+
updatedAt: at
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
const route = draft.route ?? "free";
|
|
50
|
+
return /* @__PURE__ */ jsxs("div", { className: "sk-editor", children: [
|
|
51
|
+
/* @__PURE__ */ jsxs("div", { className: "sk-toolbar", children: [
|
|
52
|
+
/* @__PURE__ */ jsx("button", { type: "button", className: "sk-btn sk-btn--ghost", onClick: onCancel, children: labels.cancel }),
|
|
53
|
+
/* @__PURE__ */ jsx("button", { type: "button", className: "sk-btn sk-btn--primary", onClick: save, children: labels.save })
|
|
54
|
+
] }),
|
|
55
|
+
/* @__PURE__ */ jsxs("div", { className: "sk-card sk-editor__course", children: [
|
|
56
|
+
/* @__PURE__ */ jsxs("label", { className: "sk-field", children: [
|
|
57
|
+
/* @__PURE__ */ jsx("span", { className: "sk-field__label", children: labels.courseTitle }),
|
|
58
|
+
/* @__PURE__ */ jsx("input", { className: "sk-input", value: draft.title, onChange: (e) => setDraft({ ...draft, title: e.target.value }), autoFocus: !course.title })
|
|
59
|
+
] }),
|
|
60
|
+
/* @__PURE__ */ jsxs("label", { className: "sk-field", children: [
|
|
61
|
+
/* @__PURE__ */ jsx("span", { className: "sk-field__label", children: labels.courseDescription }),
|
|
62
|
+
/* @__PURE__ */ jsx("textarea", { className: "sk-input", rows: 2, value: draft.description ?? "", onChange: (e) => setDraft({ ...draft, description: e.target.value }) })
|
|
63
|
+
] }),
|
|
64
|
+
/* @__PURE__ */ jsxs("div", { className: "sk-field", children: [
|
|
65
|
+
/* @__PURE__ */ jsx("span", { className: "sk-field__label", children: labels.route }),
|
|
66
|
+
/* @__PURE__ */ jsx("div", { className: "sk-segmented", role: "radiogroup", "aria-label": labels.route, children: ["free", "ordered"].map((r) => /* @__PURE__ */ jsx(
|
|
67
|
+
"button",
|
|
68
|
+
{
|
|
69
|
+
type: "button",
|
|
70
|
+
role: "radio",
|
|
71
|
+
"aria-checked": route === r,
|
|
72
|
+
className: route === r ? "is-on" : "",
|
|
73
|
+
onClick: () => setDraft({ ...draft, route: r }),
|
|
74
|
+
children: r === "free" ? labels.routeFree : labels.routeOrdered
|
|
75
|
+
},
|
|
76
|
+
r
|
|
77
|
+
)) })
|
|
78
|
+
] })
|
|
79
|
+
] }),
|
|
80
|
+
/* @__PURE__ */ jsx(
|
|
81
|
+
CardBoard,
|
|
82
|
+
{
|
|
83
|
+
cards,
|
|
84
|
+
onMove,
|
|
85
|
+
minColumnWidth: 320,
|
|
86
|
+
gap: 12,
|
|
87
|
+
addon: /* @__PURE__ */ jsxs("button", { type: "button", className: "sk-btn sk-add-gate", onClick: addGate, children: [
|
|
88
|
+
"\uFF0B ",
|
|
89
|
+
labels.addGate
|
|
90
|
+
] }),
|
|
91
|
+
renderCard: (card, { dragHandle, isDragging }) => {
|
|
92
|
+
const gate = draft.gates.find((g) => g.id === card.id);
|
|
93
|
+
const index = draft.gates.indexOf(gate);
|
|
94
|
+
return /* @__PURE__ */ jsx(
|
|
95
|
+
GateEditor,
|
|
96
|
+
{
|
|
97
|
+
gate,
|
|
98
|
+
index,
|
|
99
|
+
color: draft.color,
|
|
100
|
+
labels,
|
|
101
|
+
dragHandle,
|
|
102
|
+
isDragging,
|
|
103
|
+
canPick: !!targets?.pick,
|
|
104
|
+
onPick: async () => {
|
|
105
|
+
const picked = await targets.pick();
|
|
106
|
+
if (picked) setGate(gate.id, (g) => ({ ...g, items: [...g.items, newItem({ title: picked.title, target: picked.target })] }));
|
|
107
|
+
},
|
|
108
|
+
renderBadge: targets?.renderBadge,
|
|
109
|
+
onChange: (fn) => setGate(gate.id, fn),
|
|
110
|
+
onRemove: () => {
|
|
111
|
+
if (gate.items.length === 0 || window.confirm(labels.removeGateConfirm(gate.title))) setGates((gs) => gs.filter((g) => g.id !== gate.id));
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
)
|
|
118
|
+
] });
|
|
119
|
+
}
|
|
120
|
+
function GateEditor({
|
|
121
|
+
gate,
|
|
122
|
+
index,
|
|
123
|
+
color,
|
|
124
|
+
labels,
|
|
125
|
+
dragHandle,
|
|
126
|
+
isDragging,
|
|
127
|
+
canPick,
|
|
128
|
+
onPick,
|
|
129
|
+
renderBadge,
|
|
130
|
+
onChange,
|
|
131
|
+
onRemove
|
|
132
|
+
}) {
|
|
133
|
+
const [text, setText] = useState("");
|
|
134
|
+
const s = stampOf(gate, color);
|
|
135
|
+
const setItem = (itemId, patch) => onChange((g) => ({ ...g, items: g.items.map((i) => i.id === itemId ? { ...i, ...patch } : i) }));
|
|
136
|
+
const moveItem = (from, to) => onChange((g) => {
|
|
137
|
+
if (to < 0 || to >= g.items.length) return g;
|
|
138
|
+
const items = g.items.slice();
|
|
139
|
+
const [x] = items.splice(from, 1);
|
|
140
|
+
items.splice(to, 0, x);
|
|
141
|
+
return { ...g, items };
|
|
142
|
+
});
|
|
143
|
+
const addText = () => {
|
|
144
|
+
const title = text.trim();
|
|
145
|
+
if (!title) return;
|
|
146
|
+
const m = title.match(/(\d{1,3})\s*(回|times|x)|[×x]\s*(\d{1,3})/i);
|
|
147
|
+
const count = m ? Number(m[1] ?? m[3]) : void 0;
|
|
148
|
+
onChange((g) => ({ ...g, items: [...g.items, newItem({ title, count })] }));
|
|
149
|
+
setText("");
|
|
150
|
+
};
|
|
151
|
+
const message = gate.reward?.type === "message" ? String(gate.reward.text ?? "") : "";
|
|
152
|
+
return /* @__PURE__ */ jsxs("section", { className: "sk-card sk-gate-editor", style: { opacity: isDragging ? 0.5 : 1 }, children: [
|
|
153
|
+
/* @__PURE__ */ jsxs("div", { className: "sk-gate-editor__head", children: [
|
|
154
|
+
/* @__PURE__ */ jsx("button", { type: "button", className: "sk-handle", "aria-label": labels.moveGate(gate.title), ...dragHandle, children: "\u22EE\u22EE" }),
|
|
155
|
+
/* @__PURE__ */ jsx("span", { className: "sk-gate-editor__number", children: labels.gateNumber(index + 1) }),
|
|
156
|
+
/* @__PURE__ */ jsx("button", { type: "button", className: "sk-icon-btn sk-icon-btn--danger", "aria-label": labels.removeGate, title: labels.removeGate, onClick: onRemove, children: "\xD7" })
|
|
157
|
+
] }),
|
|
158
|
+
/* @__PURE__ */ jsxs("div", { className: "sk-gate-editor__title", children: [
|
|
159
|
+
/* @__PURE__ */ jsx(Stamp, { text: s.text, color: s.color, size: 44 }),
|
|
160
|
+
/* @__PURE__ */ jsxs("label", { className: "sk-field sk-grow", children: [
|
|
161
|
+
/* @__PURE__ */ jsx("span", { className: "sk-field__label", children: labels.gateTitle }),
|
|
162
|
+
/* @__PURE__ */ jsx("input", { className: "sk-input", value: gate.title, onChange: (e) => onChange((g) => ({ ...g, title: e.target.value })) })
|
|
163
|
+
] }),
|
|
164
|
+
/* @__PURE__ */ jsxs("label", { className: "sk-field sk-field--narrow", children: [
|
|
165
|
+
/* @__PURE__ */ jsx("span", { className: "sk-field__label", children: labels.stampText }),
|
|
166
|
+
/* @__PURE__ */ jsx(
|
|
167
|
+
"input",
|
|
168
|
+
{
|
|
169
|
+
className: "sk-input",
|
|
170
|
+
value: gate.stamp?.text ?? "",
|
|
171
|
+
placeholder: [...gate.title.trim()][0] ?? "",
|
|
172
|
+
title: "1\u301C2 \u6587\u5B57",
|
|
173
|
+
maxLength: 4,
|
|
174
|
+
onChange: (e) => onChange((g) => ({ ...g, stamp: { ...g.stamp, text: [...e.target.value].slice(0, 2).join("") } }))
|
|
175
|
+
}
|
|
176
|
+
)
|
|
177
|
+
] })
|
|
178
|
+
] }),
|
|
179
|
+
/* @__PURE__ */ jsx("ul", { className: "sk-edit-items", children: gate.items.map((item, i) => /* @__PURE__ */ jsxs("li", { className: "sk-edit-item", children: [
|
|
180
|
+
item.target && renderBadge ? /* @__PURE__ */ jsx("span", { className: "sk-item__badge", children: renderBadge(item.target, item) }) : null,
|
|
181
|
+
/* @__PURE__ */ jsx("input", { className: "sk-input sk-grow", "aria-label": labels.itemTitle, value: item.title, onChange: (e) => setItem(item.id, { title: e.target.value }) }),
|
|
182
|
+
/* @__PURE__ */ jsxs("span", { className: "sk-edit-item__tools", children: [
|
|
183
|
+
/* @__PURE__ */ jsxs("label", { className: "sk-count-field", children: [
|
|
184
|
+
/* @__PURE__ */ jsx(
|
|
185
|
+
"input",
|
|
186
|
+
{
|
|
187
|
+
className: "sk-input",
|
|
188
|
+
type: "number",
|
|
189
|
+
min: 1,
|
|
190
|
+
max: MAX_COUNT,
|
|
191
|
+
"aria-label": labels.itemCount,
|
|
192
|
+
value: item.count ?? 1,
|
|
193
|
+
onChange: (e) => {
|
|
194
|
+
const n = Math.max(1, Math.min(MAX_COUNT, Math.floor(Number(e.target.value) || 1)));
|
|
195
|
+
setItem(item.id, { count: n > 1 ? n : void 0 });
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
),
|
|
199
|
+
/* @__PURE__ */ jsx("span", { children: labels.itemCount })
|
|
200
|
+
] }),
|
|
201
|
+
/* @__PURE__ */ jsxs("span", { className: "sk-edit-item__moves", children: [
|
|
202
|
+
/* @__PURE__ */ jsx("button", { type: "button", className: "sk-icon-btn", "aria-label": labels.moveUp(item.title), disabled: i === 0, onClick: () => moveItem(i, i - 1), children: "\u2191" }),
|
|
203
|
+
/* @__PURE__ */ jsx("button", { type: "button", className: "sk-icon-btn", "aria-label": labels.moveDown(item.title), disabled: i === gate.items.length - 1, onClick: () => moveItem(i, i + 1), children: "\u2193" }),
|
|
204
|
+
/* @__PURE__ */ jsx(
|
|
205
|
+
"button",
|
|
206
|
+
{
|
|
207
|
+
type: "button",
|
|
208
|
+
className: "sk-icon-btn sk-icon-btn--danger",
|
|
209
|
+
"aria-label": labels.removeItem(item.title),
|
|
210
|
+
onClick: () => onChange((g) => ({ ...g, items: g.items.filter((x) => x.id !== item.id) })),
|
|
211
|
+
children: "\xD7"
|
|
212
|
+
}
|
|
213
|
+
)
|
|
214
|
+
] })
|
|
215
|
+
] })
|
|
216
|
+
] }, item.id)) }),
|
|
217
|
+
/* @__PURE__ */ jsxs(
|
|
218
|
+
"form",
|
|
219
|
+
{
|
|
220
|
+
className: "sk-add-item",
|
|
221
|
+
onSubmit: (e) => {
|
|
222
|
+
e.preventDefault();
|
|
223
|
+
addText();
|
|
224
|
+
},
|
|
225
|
+
children: [
|
|
226
|
+
/* @__PURE__ */ jsx("input", { className: "sk-input sk-grow", "aria-label": labels.addItem, placeholder: labels.addItemPlaceholder, value: text, onChange: (e) => setText(e.target.value) }),
|
|
227
|
+
/* @__PURE__ */ jsx("button", { type: "submit", className: "sk-btn", disabled: !text.trim(), children: labels.addItem })
|
|
228
|
+
]
|
|
229
|
+
}
|
|
230
|
+
),
|
|
231
|
+
canPick ? /* @__PURE__ */ jsxs("button", { type: "button", className: "sk-btn sk-btn--ghost sk-pick", onClick: onPick, children: [
|
|
232
|
+
"\uFF0B ",
|
|
233
|
+
labels.pickTarget
|
|
234
|
+
] }) : null,
|
|
235
|
+
gate.reward && gate.reward.type !== "message" ? /* @__PURE__ */ jsxs("p", { className: "sk-reward-chip", children: [
|
|
236
|
+
labels.rewardOther(gate.reward.type),
|
|
237
|
+
/* @__PURE__ */ jsx("button", { type: "button", className: "sk-icon-btn sk-icon-btn--danger", "aria-label": labels.removeReward, onClick: () => onChange(({ reward: _r, ...g }) => g), children: "\xD7" })
|
|
238
|
+
] }) : /* @__PURE__ */ jsxs("label", { className: "sk-field", children: [
|
|
239
|
+
/* @__PURE__ */ jsx("span", { className: "sk-field__label", children: labels.rewardMessage }),
|
|
240
|
+
/* @__PURE__ */ jsx(
|
|
241
|
+
"textarea",
|
|
242
|
+
{
|
|
243
|
+
className: "sk-input",
|
|
244
|
+
rows: 2,
|
|
245
|
+
value: message,
|
|
246
|
+
onChange: (e) => {
|
|
247
|
+
const t = e.target.value;
|
|
248
|
+
onChange(({ reward: _r, ...g }) => t ? { ...g, reward: { type: "message", text: t } } : g);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
)
|
|
252
|
+
] })
|
|
253
|
+
] });
|
|
254
|
+
}
|
|
255
|
+
export {
|
|
256
|
+
CourseEditor
|
|
257
|
+
};
|
|
258
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/editor/CourseEditor.tsx"],"sourcesContent":["import { CardBoard, flattenCards, type CardBoardCardState, type CardPlace } from 'linkshelf'\nimport { useMemo, useState } from 'react'\nimport { newGate, newItem } from '../core/course'\nimport type { CheckItem, Course, Gate } from '../core/types'\nimport { stampOf, type TargetAdapter } from '../ui/connectors'\nimport { JA_LABELS } from '../ui/labels'\nimport type { CourseEditorProps } from '../ui/Sekisho'\nimport { Stamp } from '../ui/Stamp'\n\nexport type { CourseEditorProps }\n\nconst MAX_COUNT = 999\n\n/**\n * コースを作る・直す画面。自分のコースにも、管理者が配るコースにも使う。\n * 関所はカードにして段組みで並べ、ドラッグで動かす(linkshelf の <CardBoard>)。\n * 保存するまでは、手元の下書きだけを変える\n */\nexport function CourseEditor({ course, onSave, onCancel, targets, labels: labelsPatch }: CourseEditorProps) {\n const labels = useMemo(() => ({ ...JA_LABELS, ...labelsPatch }), [labelsPatch])\n const [draft, setDraft] = useState<Course>(course)\n const setGates = (fn: (gates: Gate[]) => Gate[]) => setDraft((d) => ({ ...d, gates: fn(d.gates) }))\n const setGate = (gateId: string, fn: (g: Gate) => Gate) => setGates((gs) => gs.map((g) => (g.id === gateId ? fn(g) : g)))\n\n const cards = draft.gates.map((g, i) => ({ ...g, order: g.board?.order ?? i, column: g.board?.column, size: g.items.length + 4 }))\n\n const onMove = (places: CardPlace[]) => {\n const byId = new Map(places.map((p) => [p.id, p]))\n const placed = cards.map((c) => {\n const p = byId.get(c.id)\n return p ? { ...c, order: p.order, column: p.column } : c\n })\n // 左上から読む順を、回る順(関所の並び)にする\n const order = flattenCards(placed).map((c) => c.id)\n setGates((gs) =>\n order\n .map((id) => gs.find((g) => g.id === id)!)\n .map((g) => {\n const p = byId.get(g.id)\n return p ? { ...g, board: { order: p.order, ...(p.column !== undefined ? { column: p.column } : {}) } } : g\n }),\n )\n }\n\n const addGate = () => setGates((gs) => [...gs, newGate({ title: labels.newGateTitle(gs.length + 1) })])\n\n const save = () => {\n const at = new Date().toISOString()\n onSave({\n ...draft,\n title: draft.title.trim() || labels.untitled,\n description: draft.description?.trim() || undefined,\n gates: draft.gates.map((g) => ({ ...g, title: g.title.trim() || labels.gateTitle, items: g.items.filter((i) => i.title.trim()) })),\n revision: course.revision + 1,\n updatedAt: at,\n })\n }\n\n const route = draft.route ?? 'free'\n return (\n <div className=\"sk-editor\">\n <div className=\"sk-toolbar\">\n <button type=\"button\" className=\"sk-btn sk-btn--ghost\" onClick={onCancel}>\n {labels.cancel}\n </button>\n <button type=\"button\" className=\"sk-btn sk-btn--primary\" onClick={save}>\n {labels.save}\n </button>\n </div>\n\n <div className=\"sk-card sk-editor__course\">\n <label className=\"sk-field\">\n <span className=\"sk-field__label\">{labels.courseTitle}</span>\n <input className=\"sk-input\" value={draft.title} onChange={(e) => setDraft({ ...draft, title: e.target.value })} autoFocus={!course.title} />\n </label>\n <label className=\"sk-field\">\n <span className=\"sk-field__label\">{labels.courseDescription}</span>\n <textarea className=\"sk-input\" rows={2} value={draft.description ?? ''} onChange={(e) => setDraft({ ...draft, description: e.target.value })} />\n </label>\n <div className=\"sk-field\">\n <span className=\"sk-field__label\">{labels.route}</span>\n <div className=\"sk-segmented\" role=\"radiogroup\" aria-label={labels.route}>\n {(['free', 'ordered'] as const).map((r) => (\n <button\n key={r}\n type=\"button\"\n role=\"radio\"\n aria-checked={route === r}\n className={route === r ? 'is-on' : ''}\n onClick={() => setDraft({ ...draft, route: r })}\n >\n {r === 'free' ? labels.routeFree : labels.routeOrdered}\n </button>\n ))}\n </div>\n </div>\n </div>\n\n <CardBoard\n cards={cards}\n onMove={onMove}\n minColumnWidth={320}\n gap={12}\n addon={\n <button type=\"button\" className=\"sk-btn sk-add-gate\" onClick={addGate}>\n + {labels.addGate}\n </button>\n }\n renderCard={(card, { dragHandle, isDragging }) => {\n const gate = draft.gates.find((g) => g.id === card.id)!\n const index = draft.gates.indexOf(gate)\n return (\n <GateEditor\n gate={gate}\n index={index}\n color={draft.color}\n labels={labels}\n dragHandle={dragHandle}\n isDragging={isDragging}\n canPick={!!targets?.pick}\n onPick={async () => {\n const picked = await targets!.pick!()\n if (picked) setGate(gate.id, (g) => ({ ...g, items: [...g.items, newItem({ title: picked.title, target: picked.target })] }))\n }}\n renderBadge={targets?.renderBadge}\n onChange={(fn) => setGate(gate.id, fn)}\n onRemove={() => {\n if (gate.items.length === 0 || window.confirm(labels.removeGateConfirm(gate.title))) setGates((gs) => gs.filter((g) => g.id !== gate.id))\n }}\n />\n )\n }}\n />\n </div>\n )\n}\n\ntype L = typeof JA_LABELS\n\nfunction GateEditor({\n gate,\n index,\n color,\n labels,\n dragHandle,\n isDragging,\n canPick,\n onPick,\n renderBadge,\n onChange,\n onRemove,\n}: {\n gate: Gate\n index: number\n color?: string\n labels: L\n dragHandle: CardBoardCardState['dragHandle']\n isDragging: boolean\n canPick: boolean\n onPick: () => void\n renderBadge?: TargetAdapter['renderBadge']\n onChange: (fn: (g: Gate) => Gate) => void\n onRemove: () => void\n}) {\n const [text, setText] = useState('')\n const s = stampOf(gate, color)\n const setItem = (itemId: string, patch: Partial<CheckItem>) =>\n onChange((g) => ({ ...g, items: g.items.map((i) => (i.id === itemId ? { ...i, ...patch } : i)) }))\n const moveItem = (from: number, to: number) =>\n onChange((g) => {\n if (to < 0 || to >= g.items.length) return g\n const items = g.items.slice()\n const [x] = items.splice(from, 1)\n items.splice(to, 0, x)\n return { ...g, items }\n })\n const addText = () => {\n const title = text.trim()\n if (!title) return\n // 「10 回」「×10」「x10」が文にあれば、回数にする\n const m = title.match(/(\\d{1,3})\\s*(回|times|x)|[×x]\\s*(\\d{1,3})/i)\n const count = m ? Number(m[1] ?? m[3]) : undefined\n onChange((g) => ({ ...g, items: [...g.items, newItem({ title, count })] }))\n setText('')\n }\n const message = gate.reward?.type === 'message' ? String(gate.reward.text ?? '') : ''\n return (\n <section className=\"sk-card sk-gate-editor\" style={{ opacity: isDragging ? 0.5 : 1 }}>\n <div className=\"sk-gate-editor__head\">\n <button type=\"button\" className=\"sk-handle\" aria-label={labels.moveGate(gate.title)} {...dragHandle}>\n ⋮⋮\n </button>\n <span className=\"sk-gate-editor__number\">{labels.gateNumber(index + 1)}</span>\n <button type=\"button\" className=\"sk-icon-btn sk-icon-btn--danger\" aria-label={labels.removeGate} title={labels.removeGate} onClick={onRemove}>\n ×\n </button>\n </div>\n <div className=\"sk-gate-editor__title\">\n <Stamp text={s.text} color={s.color} size={44} />\n <label className=\"sk-field sk-grow\">\n <span className=\"sk-field__label\">{labels.gateTitle}</span>\n <input className=\"sk-input\" value={gate.title} onChange={(e) => onChange((g) => ({ ...g, title: e.target.value }))} />\n </label>\n <label className=\"sk-field sk-field--narrow\">\n <span className=\"sk-field__label\">{labels.stampText}</span>\n <input\n className=\"sk-input\"\n value={gate.stamp?.text ?? ''}\n placeholder={[...gate.title.trim()][0] ?? ''}\n title=\"1〜2 文字\"\n maxLength={4}\n onChange={(e) => onChange((g) => ({ ...g, stamp: { ...g.stamp, text: [...e.target.value].slice(0, 2).join('') } }))}\n />\n </label>\n </div>\n\n <ul className=\"sk-edit-items\">\n {gate.items.map((item, i) => (\n <li key={item.id} className=\"sk-edit-item\">\n {item.target && renderBadge ? <span className=\"sk-item__badge\">{renderBadge(item.target, item)}</span> : null}\n <input className=\"sk-input sk-grow\" aria-label={labels.itemTitle} value={item.title} onChange={(e) => setItem(item.id, { title: e.target.value })} />\n <span className=\"sk-edit-item__tools\">\n <label className=\"sk-count-field\">\n <input\n className=\"sk-input\"\n type=\"number\"\n min={1}\n max={MAX_COUNT}\n aria-label={labels.itemCount}\n value={item.count ?? 1}\n onChange={(e) => {\n const n = Math.max(1, Math.min(MAX_COUNT, Math.floor(Number(e.target.value) || 1)))\n setItem(item.id, { count: n > 1 ? n : undefined })\n }}\n />\n <span>{labels.itemCount}</span>\n </label>\n <span className=\"sk-edit-item__moves\">\n <button type=\"button\" className=\"sk-icon-btn\" aria-label={labels.moveUp(item.title)} disabled={i === 0} onClick={() => moveItem(i, i - 1)}>\n ↑\n </button>\n <button type=\"button\" className=\"sk-icon-btn\" aria-label={labels.moveDown(item.title)} disabled={i === gate.items.length - 1} onClick={() => moveItem(i, i + 1)}>\n ↓\n </button>\n <button\n type=\"button\"\n className=\"sk-icon-btn sk-icon-btn--danger\"\n aria-label={labels.removeItem(item.title)}\n onClick={() => onChange((g) => ({ ...g, items: g.items.filter((x) => x.id !== item.id) }))}\n >\n ×\n </button>\n </span>\n </span>\n </li>\n ))}\n </ul>\n\n <form\n className=\"sk-add-item\"\n onSubmit={(e) => {\n e.preventDefault()\n addText()\n }}\n >\n <input className=\"sk-input sk-grow\" aria-label={labels.addItem} placeholder={labels.addItemPlaceholder} value={text} onChange={(e) => setText(e.target.value)} />\n <button type=\"submit\" className=\"sk-btn\" disabled={!text.trim()}>\n {labels.addItem}\n </button>\n </form>\n {canPick ? (\n <button type=\"button\" className=\"sk-btn sk-btn--ghost sk-pick\" onClick={onPick}>\n + {labels.pickTarget}\n </button>\n ) : null}\n\n {gate.reward && gate.reward.type !== 'message' ? (\n <p className=\"sk-reward-chip\">\n {labels.rewardOther(gate.reward.type)}\n <button type=\"button\" className=\"sk-icon-btn sk-icon-btn--danger\" aria-label={labels.removeReward} onClick={() => onChange(({ reward: _r, ...g }) => g)}>\n ×\n </button>\n </p>\n ) : (\n <label className=\"sk-field\">\n <span className=\"sk-field__label\">{labels.rewardMessage}</span>\n <textarea\n className=\"sk-input\"\n rows={2}\n value={message}\n onChange={(e) => {\n const t = e.target.value\n onChange(({ reward: _r, ...g }) => (t ? { ...g, reward: { type: 'message', text: t } } : g))\n }}\n />\n </label>\n )}\n </section>\n )\n}\n"],"mappings":";;;;;;;;;;;;AAAA,SAAS,WAAW,oBAA6D;AACjF,SAAS,SAAS,gBAAgB;AA4D5B,SACE,KADF;AAlDN,IAAM,YAAY;AAOX,SAAS,aAAa,EAAE,QAAQ,QAAQ,UAAU,SAAS,QAAQ,YAAY,GAAsB;AAC1G,QAAM,SAAS,QAAQ,OAAO,EAAE,GAAG,WAAW,GAAG,YAAY,IAAI,CAAC,WAAW,CAAC;AAC9E,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAiB,MAAM;AACjD,QAAM,WAAW,CAAC,OAAkC,SAAS,CAAC,OAAO,E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M,SAAS,CAAC,EAAE,QAAQ,IAAI,GAAG,EAAE,MAAM,CAAC,GAAG,kBAEzJ;AAAA,OACF,IAEA,qBAAC,WAAM,WAAU,YACf;AAAA,0BAAC,UAAK,WAAU,mBAAmB,iBAAO,eAAc;AAAA,MACxD;AAAA,QAAC;AAAA;AAAA,UACC,WAAU;AAAA,UACV,MAAM;AAAA,UACN,OAAO;AAAA,UACP,UAAU,CAAC,MAAM;AACf,kBAAM,IAAI,EAAE,OAAO;AACnB,qBAAS,CAAC,EAAE,QAAQ,IAAI,GAAG,EAAE,MAAO,IAAI,EAAE,GAAG,GAAG,QAAQ,EAAE,MAAM,WAAW,MAAM,EAAE,EAAE,IAAI,CAAE;AAAA,UAC7F;AAAA;AAAA,MACF;AAAA,OACF;AAAA,KAEJ;AAEJ;","names":[]}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { C as ClearEvent } from './types-73liizfJ.js';
|
|
2
|
+
export { A as Activity, a as Changes, b as CheckItem, c as Clear, d as Course, G as Gate, I as ItemProgress, L as Lap, R as RewardRef, e as Route, S as SekishoData, T as TargetRef } from './types-73liizfJ.js';
|
|
3
|
+
export { CourseView, GateView, ImportResult, ItemView, SekishoFile, addGate, addItem, addOne, applyChanges, checkItem, clearId, currentLap, deleteCourse, duplicateCourse, exportCourses, importCourses, isGateOpen, itemGoal, lapId, moveGate, moveItem, newCourse, newGate, newItem, newerProgress, nextLap, parseCourses, progressId, readCourse, removeGate, removeItem, removeOne, report, restartCourse, sameTarget, settleClears, toggleItem, uncheckItem, updateCourse, updateGate, updateItem, viewCourse } from './core/index.js';
|
|
4
|
+
import { R as RewardConnector, S as StampRenderProps, L as Labels } from './Sekisho-BgZdhYqq.js';
|
|
5
|
+
export { C as CourseEditorProps, D as DEFAULT_STAMP_COLOR, E as EN_LABELS, J as JA_LABELS, a as RewardRenderProps, b as Sekisho, c as SekishoProps, T as TargetAdapter, s as stampOf } from './Sekisho-BgZdhYqq.js';
|
|
6
|
+
import * as react from 'react';
|
|
7
|
+
import { ReactNode } from 'react';
|
|
8
|
+
|
|
9
|
+
/** 部品に入っているご褒美: ひみつの一言({ type: 'message', text: '…' }) */
|
|
10
|
+
declare const messageReward: RewardConnector;
|
|
11
|
+
interface CelebrationProps {
|
|
12
|
+
/** 見せるクリアの知らせ(古いものから)。空なら何も出さない */
|
|
13
|
+
events: ClearEvent[];
|
|
14
|
+
/** 全部見せ終えたとき(閉じたとき)。アプリは events を空にする */
|
|
15
|
+
onDone: () => void;
|
|
16
|
+
/** ご褒美のコネクタ(部品に入っている message に足す・差し替える) */
|
|
17
|
+
rewards?: RewardConnector[];
|
|
18
|
+
/** スタンプの演出を差し替える */
|
|
19
|
+
renderStamp?: (props: StampRenderProps) => ReactNode;
|
|
20
|
+
/** 演出を減らす。無ければ端末の設定(prefers-reduced-motion)に従う */
|
|
21
|
+
reducedMotion?: boolean;
|
|
22
|
+
/** 音を出さない(コネクタに渡す)。既定は true */
|
|
23
|
+
muted?: boolean;
|
|
24
|
+
labels?: Partial<Labels>;
|
|
25
|
+
theme?: 'light' | 'dark' | 'system';
|
|
26
|
+
className?: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* クリアの演出。知らせ 1 つにつき「スタンプ → ご褒美(あれば)」の順に見せる。
|
|
30
|
+
* 画面いっぱいに重ねて出す。<Sekisho> の中でも使っているが、自動のチェック(report)の知らせを
|
|
31
|
+
* 練習の画面の上で見せたいときは、アプリがこれを置く
|
|
32
|
+
*/
|
|
33
|
+
declare function Celebration({ events, onDone, rewards, renderStamp, reducedMotion: forceReduced, muted, labels: labelsPatch, theme, className, }: CelebrationProps): react.JSX.Element | null;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* 丸い印(スタンプ)。押した印・まだの印(点線の丸)・鍵のかかった印。
|
|
37
|
+
* 色は朱肉のように、少しかすれた二重の丸で描く
|
|
38
|
+
*/
|
|
39
|
+
declare function Stamp({ text, color, state, size, tilt, label, }: {
|
|
40
|
+
text: string;
|
|
41
|
+
color: string;
|
|
42
|
+
state?: 'pressed' | 'empty' | 'locked';
|
|
43
|
+
size?: number;
|
|
44
|
+
/** 傾き(度)。押した印だけ */
|
|
45
|
+
tilt?: number;
|
|
46
|
+
/** 読み上げ用の名前 */
|
|
47
|
+
label?: string;
|
|
48
|
+
}): react.JSX.Element;
|
|
49
|
+
/** 端末の「視差効果を減らす」(prefers-reduced-motion)に合わせる。force を渡せば、それに従う */
|
|
50
|
+
declare function useReducedMotion(force?: boolean): boolean;
|
|
51
|
+
|
|
52
|
+
export { Celebration, ClearEvent, Labels, RewardConnector, Stamp, StampRenderProps, messageReward, useReducedMotion };
|
|
53
|
+
export type { CelebrationProps };
|