@skillre/dsh-plugin-sticky-wall 0.7.0 → 0.8.2

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/lib/client.js CHANGED
@@ -34,8 +34,15 @@ window.__ModuleLoader__.load({
34
34
  var ENDPOINT = "skillre-sticky-wall/execute";
35
35
  var PANEL_ID = "skillre-sticky-wall";
36
36
  var LIMITS = Object.freeze({
37
- /** One note's body, in characters. */
38
- body: 4e3,
37
+ /**
38
+ * One note's body, in characters.
39
+ *
40
+ * 0.8.0 lifted the old 4000-character cap, because the body now lives in a
41
+ * plain `.md` file rather than a JSON record and a note is allowed to be a
42
+ * real document. This is a resource guard against a pathological file, not a
43
+ * product limit: at 200k characters a note is a short book.
44
+ */
45
+ body: 2e5,
39
46
  /** One note's title, in characters. */
40
47
  title: 120,
41
48
  /** A note's free-form tag list. */
@@ -45,7 +52,11 @@ window.__ModuleLoader__.load({
45
52
  /** Live (non-archived) notes a wall may hold. */
46
53
  notes: 400,
47
54
  /** Note ids accepted in one request. */
48
- bulk: 200
55
+ bulk: 200,
56
+ /** One note file's size on disk, in bytes; larger files are refused unread. */
57
+ fileBytes: 4 * 1024 * 1024,
58
+ /** Newest notes the agent `list` action returns. */
59
+ listLimit: 50
49
60
  });
50
61
  var COLORS = Object.freeze([
51
62
  "yellow",
@@ -92,7 +103,16 @@ window.__ModuleLoader__.load({
92
103
  return {
93
104
  async list(includeArchived, sort, signal) {
94
105
  const value = await call({ action: "list", includeArchived, sort }, signal);
95
- return Array.isArray(value?.notes) ? value.notes : [];
106
+ return {
107
+ notes: Array.isArray(value?.notes) ? value.notes : [],
108
+ revision: typeof value?.revision === "number" ? value.revision : 0,
109
+ notesDir: typeof value?.notesDir === "string" ? value.notesDir : "",
110
+ domain: value?.domain ?? { name: "", version: 0 }
111
+ };
112
+ },
113
+ async revision(signal) {
114
+ const value = await call({ action: "revision" }, signal);
115
+ return typeof value?.revision === "number" ? value.revision : -1;
96
116
  },
97
117
  async create(input, signal, options) {
98
118
  const value = await call(
@@ -142,13 +162,11 @@ window.__ModuleLoader__.load({
142
162
  var zh = {
143
163
  "nav": "\u4FBF\u7B7E\u5899",
144
164
  "title": "\u4FBF\u7B7E\u5899",
145
- "subtitle": "\u968F\u624B\u8BB0\u4E0B\u4E00\u95EA\u800C\u8FC7\u7684\u7075\u611F\uFF0C\u548C\u4E34\u65F6\u7684\u6D3B\u513F\uFF1B\u62D6\u4E00\u62D6\uFF0C\u628A\u5B83\u4EEC\u6446\u6210\u4F60\u81EA\u5DF1\u7684\u6837\u5B50\u3002",
146
165
  "empty": "\u8FD8\u6CA1\u6709\u4FBF\u7B7E\u3002\u70B9\u300C\u65B0\u5EFA\u300D\u5199\u4E0B\u7B2C\u4E00\u6761\u3002",
147
166
  "emptyArchived": "\u5F52\u6863\u533A\u662F\u7A7A\u7684\u3002",
148
167
  "new": "\u65B0\u5EFA",
149
168
  "save": "\u4FDD\u5B58",
150
169
  "cancel": "\u53D6\u6D88",
151
- "close": "\u5173\u95ED",
152
170
  "edit": "\u7F16\u8F91",
153
171
  "pin": "\u7F6E\u9876",
154
172
  "unpin": "\u53D6\u6D88\u7F6E\u9876",
@@ -173,20 +191,13 @@ window.__ModuleLoader__.load({
173
191
  "colorLabel": "\u989C\u8272",
174
192
  "saveHint": "\u2318/Ctrl + Enter \u4FDD\u5B58 \xB7 Esc \u53D6\u6D88",
175
193
  "count": "{count} \u5F20\u4FBF\u7B7E",
176
- "countArchived": "{count} \u5F20\u5DF2\u5F52\u6863",
177
- "updated": "\u66F4\u65B0\u4E8E {time}",
178
- "created": "\u521B\u5EFA\u4E8E {time}",
179
194
  "loading": "\u52A0\u8F7D\u4E2D\u2026",
180
- "failed": "\u64CD\u4F5C\u5931\u8D25",
181
195
  "noResults": "\u6CA1\u6709\u5339\u914D\u7684\u4FBF\u7B7E",
182
196
  "retry": "\u91CD\u8BD5",
183
197
  "tooLong": "\u5185\u5BB9\u592A\u957F\u4E86",
184
198
  "emptyBody": "\u4FBF\u7B7E\u4E0D\u80FD\u4E3A\u7A7A",
185
199
  "wallFull": "\u4FBF\u7B7E\u5899\u6EE1\u4E86\uFF0C\u8BF7\u5148\u5F52\u6863\u6216\u5220\u9664\u4E00\u4E9B\u4FBF\u7B7E",
186
- "emptyTags": "\u8FD8\u6CA1\u6709\u6807\u7B7E",
187
- "pinHint": "\u7F6E\u9876\u7684\u4FBF\u7B7E\u6392\u5728\u6700\u524D",
188
200
  "more": "\u66F4\u591A",
189
- "agentHint": "\u4E5F\u53EF\u4EE5\u8BA9\u6211\u5E2E\u4F60\u8BB0\uFF1A\u76F4\u63A5\u8BF4\u300C\u8BB0\u4E00\u4E0B\u2026\u2026\u300D",
190
201
  "preview": "\u9884\u89C8",
191
202
  "widthLabel": "\u5361\u7247\u5BBD\u5EA6",
192
203
  "width_sm": "\u5C0F",
@@ -202,26 +213,64 @@ window.__ModuleLoader__.load({
202
213
  "zoomIn": "\u653E\u5927",
203
214
  "zoomOut": "\u7F29\u5C0F",
204
215
  "zoomReset": "\u91CD\u7F6E\u89C6\u56FE",
205
- "dragHint": "\u62D6\u52A8\u5361\u7247\u6446\u653E\u4F4D\u7F6E\uFF0C\u2318/Ctrl + \u6EDA\u8F6E\u7F29\u653E",
206
- "markdownHint": "\u6B63\u6587\u652F\u6301 Markdown\uFF1A\u6807\u9898\u3001\u5217\u8868\u3001\u7C97\u4F53\u3001\u4EE3\u7801\u5757\u3001\u94FE\u63A5\u3001\u8868\u683C",
207
216
  "greetMorning": "\u65E9\u4E0A\u597D\uFF0C\u4ECA\u5929\u60F3\u8BB0\u70B9\u4EC0\u4E48\uFF1F",
208
217
  "greetAfternoon": "\u4E0B\u5348\u597D\uFF0C\u6709\u4EC0\u4E48\u60F3\u7559\u4E0B\u6765\u7684\uFF1F",
209
218
  "greetEvening": "\u665A\u4E0A\u597D\uFF0C\u6536\u4E00\u4E0B\u4ECA\u5929\u7684\u788E\u7247\u3002",
210
219
  "greetNight": "\u591C\u6DF1\u4E86\uFF0C\u60F3\u5230\u4EC0\u4E48\u5C31\u5148\u8BB0\u4E0B\u6765\u3002",
211
220
  "centreTally": "{count} \u5F20\u4FBF\u7B7E \xB7 {archived} \u5F20\u5DF2\u5F52\u6863",
212
221
  "capturePlaceholder": "\u8BB0\u4E0B\u4E00\u4E2A\u7075\u611F\uFF0C\u6216\u7C98\u8D34\u4E00\u4E2A\u94FE\u63A5",
213
- "captureGo": "\u8BB0\u4E0B"
222
+ "captureGo": "\u8BB0\u4E0B",
223
+ // The Markdown body editor and its toolbar. The toolbar groups are ordered
224
+ // from structure to inline so the buttons read as a document outline.
225
+ "editorTitle": "\u7F16\u8F91\u6B63\u6587",
226
+ "editorPreview": "\u9884\u89C8",
227
+ "editorSource": "\u6E90\u7801",
228
+ "editorSaved": "\u5DF2\u4FDD\u5B58",
229
+ "editorSaving": "\u4FDD\u5B58\u4E2D\u2026",
230
+ "editorUnsaved": "\u672A\u4FDD\u5B58",
231
+ "editorSaveFailed": "\u4FDD\u5B58\u5931\u8D25\uFF1A{message}",
232
+ "toolbarStructure": "\u7ED3\u6784",
233
+ "toolbarList": "\u5217\u8868",
234
+ "toolbarTable": "\u8868\u683C",
235
+ "toolbarInline": "\u884C\u5185",
236
+ "toolbarOther": "\u5176\u4ED6",
237
+ "mdH1": "\u6807\u9898 1",
238
+ "mdH2": "\u6807\u9898 2",
239
+ "mdH3": "\u6807\u9898 3",
240
+ "mdQuote": "\u5F15\u7528",
241
+ "mdHr": "\u5206\u5272\u7EBF",
242
+ "mdCodeBlock": "\u4EE3\u7801\u5757",
243
+ "mdBullet": "\u65E0\u5E8F\u5217\u8868",
244
+ "mdOrdered": "\u6709\u5E8F\u5217\u8868",
245
+ "mdTodo": "\u5F85\u529E",
246
+ "mdTable": "\u8868\u683C",
247
+ "mdBold": "\u7C97\u4F53",
248
+ "mdItalic": "\u659C\u4F53",
249
+ "mdStrike": "\u5220\u9664\u7EBF",
250
+ "mdCode": "\u884C\u5185\u4EE3\u7801",
251
+ "mdLink": "\u94FE\u63A5",
252
+ "mdTimestamp": "\u5F53\u524D\u65F6\u95F4",
253
+ // File-level metadata the wall surfaces instead of hiding: a note written by
254
+ // a newer DSH line may carry fields this build cannot honour.
255
+ "metaErrorBadge": "\u5143\u6570\u636E\u5F02\u5E38",
256
+ "metaErrorNewer": "\u7531\u8F83\u65B0\u7248\u672C\u5199\u5165",
257
+ "revealPath": "\u590D\u5236\u6587\u4EF6\u8DEF\u5F84",
258
+ "pathCopied": "\u8DEF\u5F84\u5DF2\u590D\u5236",
259
+ "longNote": "\u957F\u6587",
260
+ // The leave-guard for an unsaved draft: an explicit keep-or-discard choice,
261
+ // never a silent loss.
262
+ "discardDraft": "\u653E\u5F03\u672A\u4FDD\u5B58\u7684\u5185\u5BB9\uFF1F",
263
+ "keepEditing": "\u7EE7\u7EED\u7F16\u8F91",
264
+ "discard": "\u653E\u5F03"
214
265
  };
215
266
  var en = {
216
267
  "nav": "Notes",
217
268
  "title": "Sticky wall",
218
- "subtitle": "Jot down a passing idea or a piece of temporary work \u2014 then drag the cards into your own arrangement.",
219
269
  "empty": 'No notes yet. Hit "New" to write the first one.',
220
270
  "emptyArchived": "Nothing archived yet.",
221
271
  "new": "New",
222
272
  "save": "Save",
223
273
  "cancel": "Cancel",
224
- "close": "Close",
225
274
  "edit": "Edit",
226
275
  "pin": "Pin",
227
276
  "unpin": "Unpin",
@@ -246,20 +295,13 @@ window.__ModuleLoader__.load({
246
295
  "colorLabel": "Color",
247
296
  "saveHint": "\u2318/Ctrl + Enter to save \xB7 Esc to cancel",
248
297
  "count": "{count} notes",
249
- "countArchived": "{count} archived",
250
- "updated": "Updated {time}",
251
- "created": "Created {time}",
252
298
  "loading": "Loading\u2026",
253
- "failed": "Something went wrong",
254
299
  "noResults": "No matching notes",
255
300
  "retry": "Retry",
256
301
  "tooLong": "Too long",
257
302
  "emptyBody": "A note cannot be empty",
258
303
  "wallFull": "The wall is full \u2014 archive or delete a note first",
259
- "emptyTags": "No tags yet",
260
- "pinHint": "Pinned notes stay on top",
261
304
  "more": "More",
262
- "agentHint": 'You can also ask me to note it: say "note that \u2026"',
263
305
  "preview": "Preview",
264
306
  "widthLabel": "Card width",
265
307
  "width_sm": "S",
@@ -275,19 +317,53 @@ window.__ModuleLoader__.load({
275
317
  "zoomIn": "Zoom in",
276
318
  "zoomOut": "Zoom out",
277
319
  "zoomReset": "Reset view",
278
- "dragHint": "Drag a card to place it \xB7 \u2318/Ctrl + wheel to zoom",
279
- "markdownHint": "The body renders Markdown: headings, lists, bold, code blocks, links, tables",
280
320
  "greetMorning": "Good morning \u2014 what is worth keeping today?",
281
321
  "greetAfternoon": "Good afternoon \u2014 anything to jot down?",
282
322
  "greetEvening": "Good evening \u2014 collect the loose pieces.",
283
323
  "greetNight": "Late night \u2014 capture it before it goes.",
284
324
  "centreTally": "{count} notes \xB7 {archived} archived",
285
325
  "capturePlaceholder": "Jot an idea, or paste a link",
286
- "captureGo": "Capture"
326
+ "captureGo": "Capture",
327
+ "editorTitle": "Edit body",
328
+ "editorPreview": "Preview",
329
+ "editorSource": "Source",
330
+ "editorSaved": "Saved",
331
+ "editorSaving": "Saving\u2026",
332
+ "editorUnsaved": "Unsaved",
333
+ "editorSaveFailed": "Save failed: {message}",
334
+ "toolbarStructure": "Structure",
335
+ "toolbarList": "Lists",
336
+ "toolbarTable": "Table",
337
+ "toolbarInline": "Inline",
338
+ "toolbarOther": "Other",
339
+ "mdH1": "Heading 1",
340
+ "mdH2": "Heading 2",
341
+ "mdH3": "Heading 3",
342
+ "mdQuote": "Quote",
343
+ "mdHr": "Divider",
344
+ "mdCodeBlock": "Code block",
345
+ "mdBullet": "Bullet list",
346
+ "mdOrdered": "Ordered list",
347
+ "mdTodo": "To-do",
348
+ "mdTable": "Table",
349
+ "mdBold": "Bold",
350
+ "mdItalic": "Italic",
351
+ "mdStrike": "Strikethrough",
352
+ "mdCode": "Inline code",
353
+ "mdLink": "Link",
354
+ "mdTimestamp": "Now",
355
+ "metaErrorBadge": "Metadata issue",
356
+ "metaErrorNewer": "Written by a newer version",
357
+ "revealPath": "Copy file path",
358
+ "pathCopied": "Path copied",
359
+ "longNote": "Long note",
360
+ "discardDraft": "Discard unsaved changes?",
361
+ "keepEditing": "Keep editing",
362
+ "discard": "Discard"
287
363
  };
288
364
 
289
365
  // src/client/view.tsx
290
- var import_react = require("react");
366
+ var import_react2 = require("react");
291
367
 
292
368
  // src/layout.ts
293
369
  var GOLDEN_ANGLE = Math.PI * (3 - Math.sqrt(5));
@@ -533,6 +609,56 @@ window.__ModuleLoader__.load({
533
609
  }
534
610
  return blocks;
535
611
  }
612
+ function stripInlineMarkdown(text) {
613
+ let out = text;
614
+ out = out.replace(/!\[([^\]]*)\]\([^)\s]*\)/g, "$1");
615
+ out = out.replace(/\[([^\]]*)\]\([^)\s]*\)/g, "$1");
616
+ out = out.replace(/`+([^`]*)`+/g, "$1");
617
+ out = out.replace(/\*\*\*([^*]+)\*\*\*/g, "$1");
618
+ out = out.replace(/\*\*([^*]+)\*\*/g, "$1");
619
+ out = out.replace(/\*([^*]+)\*/g, "$1");
620
+ out = out.replace(/~~([^~]+)~~/g, "$1");
621
+ out = out.replace(/(^|[^A-Za-z0-9])__([^_]+)__(?![A-Za-z0-9])/g, "$1$2");
622
+ out = out.replace(/(^|[^A-Za-z0-9])_([^_]+)_(?![A-Za-z0-9])/g, "$1$2");
623
+ return out;
624
+ }
625
+ function flattenWhitespace(text) {
626
+ return text.replace(/\s+/g, " ").trim();
627
+ }
628
+ function truncateDigest(text, limit) {
629
+ if (text.length <= limit) return text;
630
+ let cut = limit;
631
+ const code = text.charCodeAt(cut - 1);
632
+ if (code >= 55296 && code <= 56319) cut -= 1;
633
+ return `${text.slice(0, cut).replace(/\s+$/, "")}\u2026`;
634
+ }
635
+ function plainTextSummary(source, max = 90) {
636
+ const limit = Number.isFinite(max) ? Math.floor(max) : 0;
637
+ if (limit <= 0) return "";
638
+ const raw = typeof source === "string" ? source : "";
639
+ let blocks;
640
+ try {
641
+ blocks = parseBlocks(raw);
642
+ } catch {
643
+ return truncateDigest(flattenWhitespace(stripInlineMarkdown(raw)), limit);
644
+ }
645
+ for (const block of blocks) {
646
+ if (block.kind === "rule") continue;
647
+ let candidate;
648
+ if (block.kind === "code") {
649
+ candidate = block.text.split("\n")[0] ?? "";
650
+ } else if (block.kind === "list") {
651
+ candidate = (block.items[0] ?? "").replace(/^\[[ xX]\]\s*/, "");
652
+ } else if (block.kind === "table") {
653
+ candidate = block.header.join(" ");
654
+ } else {
655
+ candidate = block.text;
656
+ }
657
+ const digest = flattenWhitespace(stripInlineMarkdown(candidate));
658
+ if (digest !== "") return truncateDigest(digest, limit);
659
+ }
660
+ return "";
661
+ }
536
662
  function safeHref(raw) {
537
663
  const value = raw.trim();
538
664
  if (value === "") return void 0;
@@ -630,6 +756,502 @@ window.__ModuleLoader__.load({
630
756
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "skw-md", "data-compact": compact, children: blocks.map((block, index) => renderBlock(block, `b${index}`)) });
631
757
  }
632
758
 
759
+ // src/client/editor.tsx
760
+ var import_react = require("react");
761
+ var import_jsx_runtime2 = require("react/jsx-runtime");
762
+ var INDENT = " ";
763
+ var MIN_HEIGHT_PX = 88;
764
+ var VIEWPORT_SHARE = 0.6;
765
+ function clampRange(value, start, end) {
766
+ const length = value.length;
767
+ const from = Math.min(Math.max(0, start), length);
768
+ const to = Math.min(Math.max(from, end), length);
769
+ return { start: from, end: to };
770
+ }
771
+ function lineBounds(value, position) {
772
+ const at = Math.min(Math.max(0, position), value.length);
773
+ const from = value.lastIndexOf("\n", at - 1) + 1;
774
+ const next = value.indexOf("\n", at);
775
+ return { from, to: next === -1 ? value.length : next };
776
+ }
777
+ function touchedLines(value, start, end) {
778
+ const first = lineBounds(value, start);
779
+ const tail = end > start && value[end - 1] === "\n" ? end - 1 : end;
780
+ const last = lineBounds(value, tail);
781
+ return { from: first.from, to: last.to };
782
+ }
783
+ function rewriteLines(value, start, end, rewrite) {
784
+ const range = touchedLines(value, start, end);
785
+ const lines = value.slice(range.from, range.to).split("\n");
786
+ const spans = [];
787
+ const out = [];
788
+ let consumed = 0;
789
+ lines.forEach((line, index) => {
790
+ const next = rewrite(line, index);
791
+ const from = range.from + consumed;
792
+ spans.push({ from, to: from + line.length, delta: next.length - line.length });
793
+ consumed += line.length + 1;
794
+ out.push(next);
795
+ });
796
+ const collapsed = start === end;
797
+ const mapPosition = (position) => {
798
+ let shift = 0;
799
+ for (const span of spans) {
800
+ if (position > span.to) {
801
+ shift += span.delta;
802
+ continue;
803
+ }
804
+ if (position >= span.from) {
805
+ shift += position === span.from ? collapsed ? Math.max(span.delta, 0) : 0 : span.delta;
806
+ }
807
+ break;
808
+ }
809
+ return position + shift;
810
+ };
811
+ const nextValue = value.slice(0, range.from) + out.join("\n") + value.slice(range.to);
812
+ const caret = clampRange(nextValue, mapPosition(start), mapPosition(end));
813
+ return { value: nextValue, start: caret.start, end: caret.end };
814
+ }
815
+ function leadingSpace(line) {
816
+ return /^[ \t]*/.exec(line)?.[0] ?? "";
817
+ }
818
+ var HEADING_MARKER = /^([ \t]*)(#{1,4})[ \t]+/;
819
+ var TODO_MARKER = /^([ \t]*)([-*+])[ \t]+\[[ xX]\][ \t]+/;
820
+ var ORDERED_MARKER = /^([ \t]*)(\d{1,3})([.)])[ \t]+/;
821
+ var BULLET_MARKER = /^([ \t]*)([-*+])[ \t]+/;
822
+ var QUOTE_MARKER = /^([ \t]*)>[ \t]?/;
823
+ function stripBlockMarker(line) {
824
+ for (const marker of [HEADING_MARKER, TODO_MARKER, ORDERED_MARKER, BULLET_MARKER, QUOTE_MARKER]) {
825
+ const match = marker.exec(line);
826
+ if (match !== null) return line.slice(match[0].length);
827
+ }
828
+ return line.slice(leadingSpace(line).length);
829
+ }
830
+ function wrapSelection(ctx, open, close) {
831
+ const selected = ctx.value.slice(ctx.start, ctx.end);
832
+ const inner = ctx.start + open.length;
833
+ return {
834
+ value: `${ctx.value.slice(0, ctx.start)}${open}${selected}${close}${ctx.value.slice(ctx.end)}`,
835
+ // An empty selection leaves the caret BETWEEN the markers, which is where
836
+ // the user is about to type; a selection stays selected so it can be
837
+ // wrapped again or typed over.
838
+ start: inner,
839
+ end: inner + selected.length
840
+ };
841
+ }
842
+ function applyHeading(level) {
843
+ return (ctx) => rewriteLines(ctx.value, ctx.start, ctx.end, (line) => {
844
+ const indent = leadingSpace(line);
845
+ return `${indent}${"#".repeat(level)} ${stripBlockMarker(line)}`;
846
+ });
847
+ }
848
+ function applyList(kind) {
849
+ return (ctx) => {
850
+ let nextNumber = null;
851
+ return rewriteLines(ctx.value, ctx.start, ctx.end, (line) => {
852
+ const indent = leadingSpace(line);
853
+ const body = stripBlockMarker(line);
854
+ if (kind === "bullet") return `${indent}- ${body}`;
855
+ if (kind === "todo") return `${indent}- [ ] ${body}`;
856
+ if (nextNumber === null) {
857
+ const existing = ORDERED_MARKER.exec(line);
858
+ nextNumber = existing === null ? 1 : Number(existing[2]);
859
+ }
860
+ const number = nextNumber;
861
+ nextNumber += 1;
862
+ return `${indent}${number}. ${body}`;
863
+ });
864
+ };
865
+ }
866
+ function applyQuote(ctx) {
867
+ const range = touchedLines(ctx.value, ctx.start, ctx.end);
868
+ const lines = ctx.value.slice(range.from, range.to).split("\n");
869
+ const quoted = lines.every((line) => line.trim() === "" || QUOTE_MARKER.test(line));
870
+ return rewriteLines(ctx.value, ctx.start, ctx.end, (line) => {
871
+ if (line.trim() === "") return line;
872
+ if (!quoted) return QUOTE_MARKER.test(line) ? line : `> ${line}`;
873
+ const match = QUOTE_MARKER.exec(line);
874
+ return match === null ? line : `${match[1] ?? ""}${line.slice(match[0].length)}`;
875
+ });
876
+ }
877
+ function insertBlock(ctx, block, caretInBlock) {
878
+ const before = ctx.value.slice(0, ctx.start);
879
+ const after = ctx.value.slice(ctx.end);
880
+ const lead = before === "" || before.endsWith("\n") ? "" : "\n";
881
+ const trail = after.startsWith("\n") ? "" : "\n";
882
+ const position = before.length + lead.length;
883
+ return {
884
+ value: `${before}${lead}${block}${trail}${after}`,
885
+ start: position + caretInBlock,
886
+ end: position + caretInBlock
887
+ };
888
+ }
889
+ function tableSkeleton(locale) {
890
+ const cell = (index) => locale === "zh" ? `\u5217 ${index}` : `Column ${index}`;
891
+ const header = `| ${cell(1)} | ${cell(2)} | ${cell(3)} |`;
892
+ const divider = "| --- | --- | --- |";
893
+ const empty = "| | | |";
894
+ const rows = [header, divider, empty, empty];
895
+ return {
896
+ block: rows.join("\n"),
897
+ // Park the caret in the first empty body cell: the header labels are
898
+ // placeholders to overwrite, the body is what the user came to fill in.
899
+ caretInBlock: header.length + 1 + divider.length + 1 + 2
900
+ };
901
+ }
902
+ function pad2(value) {
903
+ return String(value).padStart(2, "0");
904
+ }
905
+ function stamp(date) {
906
+ return `${date.getFullYear()}-${pad2(date.getMonth() + 1)}-${pad2(date.getDate())} ${pad2(date.getHours())}:${pad2(date.getMinutes())}`;
907
+ }
908
+ function insertStamp(ctx) {
909
+ const text = stamp(/* @__PURE__ */ new Date());
910
+ const position = ctx.start + text.length;
911
+ return {
912
+ value: `${ctx.value.slice(0, ctx.start)}${text}${ctx.value.slice(ctx.end)}`,
913
+ start: position,
914
+ end: position
915
+ };
916
+ }
917
+ function insertCodeBlock(ctx) {
918
+ const body = ctx.value.slice(ctx.start, ctx.end);
919
+ const block = `\`\`\`
920
+ ${body}
921
+ \`\`\``;
922
+ return insertBlock(ctx, block, 4 + body.length);
923
+ }
924
+ var TOOLBAR_LABEL = { zh: "\u7F16\u8F91\u5DE5\u5177\u680F", en: "Formatting toolbar" };
925
+ var TOOLBAR = [
926
+ {
927
+ id: "structure",
928
+ zh: "\u7ED3\u6784",
929
+ en: "Structure",
930
+ actions: [
931
+ { id: "h1", zh: "\u4E00\u7EA7\u6807\u9898", en: "Heading 1", glyph: "H1", run: applyHeading(1) },
932
+ { id: "h2", zh: "\u4E8C\u7EA7\u6807\u9898", en: "Heading 2", glyph: "H2", run: applyHeading(2) },
933
+ { id: "h3", zh: "\u4E09\u7EA7\u6807\u9898", en: "Heading 3", glyph: "H3", run: applyHeading(3) },
934
+ { id: "quote", zh: "\u5F15\u7528", en: "Blockquote", glyph: "\u275D", run: applyQuote },
935
+ { id: "rule", zh: "\u5206\u5272\u7EBF", en: "Divider", glyph: "\u2014", run: (ctx) => insertBlock(ctx, "---", 4) },
936
+ { id: "code-block", zh: "\u4EE3\u7801\u5757", en: "Code block", glyph: "{ }", run: insertCodeBlock }
937
+ ]
938
+ },
939
+ {
940
+ id: "lists",
941
+ zh: "\u5217\u8868",
942
+ en: "Lists",
943
+ actions: [
944
+ { id: "bullet", zh: "\u65E0\u5E8F\u5217\u8868", en: "Bullet list", glyph: "\u2022", run: applyList("bullet") },
945
+ { id: "ordered", zh: "\u6709\u5E8F\u5217\u8868", en: "Numbered list", glyph: "1.", run: applyList("ordered") },
946
+ { id: "todo", zh: "\u5F85\u529E", en: "Todo", glyph: "\u2611", run: applyList("todo") }
947
+ ]
948
+ },
949
+ {
950
+ id: "table",
951
+ zh: "\u8868\u683C",
952
+ en: "Table",
953
+ actions: [
954
+ {
955
+ id: "table",
956
+ zh: "\u63D2\u5165\u8868\u683C",
957
+ en: "Insert table",
958
+ glyph: "\u25A6",
959
+ run: (ctx) => {
960
+ const { block, caretInBlock } = tableSkeleton(ctx.locale);
961
+ return insertBlock(ctx, block, caretInBlock);
962
+ }
963
+ }
964
+ ]
965
+ },
966
+ {
967
+ id: "inline",
968
+ zh: "\u884C\u5185",
969
+ en: "Inline",
970
+ actions: [
971
+ { id: "bold", zh: "\u7C97\u4F53", en: "Bold", glyph: "B", style: "bold", run: (ctx) => wrapSelection(ctx, "**", "**") },
972
+ { id: "italic", zh: "\u659C\u4F53", en: "Italic", glyph: "I", style: "italic", run: (ctx) => wrapSelection(ctx, "_", "_") },
973
+ { id: "strike", zh: "\u5220\u9664\u7EBF", en: "Strikethrough", glyph: "S", style: "strike", run: (ctx) => wrapSelection(ctx, "~~", "~~") },
974
+ { id: "code", zh: "\u884C\u5185\u4EE3\u7801", en: "Inline code", glyph: "<>", run: (ctx) => wrapSelection(ctx, "`", "`") },
975
+ { id: "link", zh: "\u94FE\u63A5", en: "Link", glyph: "\u26D3", run: (ctx) => wrapSelection(ctx, "[", "](https://)") }
976
+ ]
977
+ },
978
+ {
979
+ id: "other",
980
+ zh: "\u5176\u4ED6",
981
+ en: "Other",
982
+ actions: [{ id: "timestamp", zh: "\u65E5\u671F\u65F6\u95F4", en: "Date and time", glyph: "\u231A", run: insertStamp }]
983
+ }
984
+ ];
985
+ function indentSelection(value, start, end, direction) {
986
+ return rewriteLines(value, start, end, (line) => {
987
+ if (direction === 1) return `${INDENT}${line}`;
988
+ if (line.startsWith(INDENT)) return line.slice(INDENT.length);
989
+ if (line.startsWith(" ")) return line.slice(1);
990
+ return line.replace(/^ {1,2}/, "");
991
+ });
992
+ }
993
+ var CONTINUE_TODO = /^([ \t]*)([-*+])[ \t]+\[[ xX]\][ \t]+/;
994
+ var CONTINUE_BULLET = /^([ \t]*)([-*+])[ \t]+/;
995
+ var CONTINUE_ORDERED = /^([ \t]*)(\d{1,3})([.)])[ \t]+/;
996
+ function continueList(value, start, end) {
997
+ const line = lineBounds(value, start);
998
+ const text = value.slice(line.from, line.to);
999
+ const todo = CONTINUE_TODO.exec(text);
1000
+ const bullet = todo === null ? CONTINUE_BULLET.exec(text) : null;
1001
+ const ordered = todo === null && bullet === null ? CONTINUE_ORDERED.exec(text) : null;
1002
+ const marker = (todo ?? bullet ?? ordered)?.[0];
1003
+ if (marker === void 0) return null;
1004
+ if (start - line.from < marker.length) return null;
1005
+ const body = text.slice(marker.length);
1006
+ if (body.trim() === "") {
1007
+ return { value: value.slice(0, line.from) + value.slice(line.to), start: line.from, end: line.from };
1008
+ }
1009
+ const nextMarker = todo !== null ? `${todo[1] ?? ""}${todo[2] ?? "-"} [ ] ` : bullet !== null ? `${bullet[1] ?? ""}${bullet[2] ?? "-"} ` : `${ordered?.[1] ?? ""}${Number(ordered?.[2] ?? "1") + 1}${ordered?.[3] ?? "."} `;
1010
+ const insert = `
1011
+ ${nextMarker}`;
1012
+ const caret = start + insert.length;
1013
+ return { value: value.slice(0, start) + insert + value.slice(end), start: caret, end: caret };
1014
+ }
1015
+ function MarkdownEditor(props) {
1016
+ const {
1017
+ value,
1018
+ onChange,
1019
+ onSave,
1020
+ onEscape,
1021
+ maxLength,
1022
+ placeholder,
1023
+ label,
1024
+ toolbar = true,
1025
+ autoFocus = true,
1026
+ disabled = false,
1027
+ locale = "zh"
1028
+ } = props;
1029
+ const areaRef = (0, import_react.useRef)(null);
1030
+ const composing = (0, import_react.useRef)(false);
1031
+ const justEnded = (0, import_react.useRef)(false);
1032
+ const tabEscape = (0, import_react.useRef)(false);
1033
+ const pending = (0, import_react.useRef)(null);
1034
+ const guarded = (0, import_react.useCallback)((event) => {
1035
+ const native = event.nativeEvent;
1036
+ return composing.current || justEnded.current || native.isComposing || native.keyCode === 229;
1037
+ }, []);
1038
+ (0, import_react.useEffect)(() => {
1039
+ const node = areaRef.current;
1040
+ if (node === null) return;
1041
+ const open = () => {
1042
+ composing.current = true;
1043
+ justEnded.current = false;
1044
+ };
1045
+ const close = () => {
1046
+ composing.current = false;
1047
+ justEnded.current = true;
1048
+ tabEscape.current = false;
1049
+ };
1050
+ const settle = () => {
1051
+ justEnded.current = false;
1052
+ };
1053
+ const reset = () => {
1054
+ composing.current = false;
1055
+ justEnded.current = false;
1056
+ tabEscape.current = false;
1057
+ };
1058
+ node.addEventListener("compositionstart", open);
1059
+ node.addEventListener("compositionend", close);
1060
+ node.addEventListener("keyup", settle);
1061
+ window.addEventListener("blur", reset);
1062
+ return () => {
1063
+ node.removeEventListener("compositionstart", open);
1064
+ node.removeEventListener("compositionend", close);
1065
+ node.removeEventListener("keyup", settle);
1066
+ window.removeEventListener("blur", reset);
1067
+ };
1068
+ }, []);
1069
+ const applyPending = (0, import_react.useCallback)(() => {
1070
+ const node = areaRef.current;
1071
+ const slot = pending.current;
1072
+ if (node === null || slot === null) return;
1073
+ if (node.value !== slot.expected) {
1074
+ pending.current = null;
1075
+ return;
1076
+ }
1077
+ pending.current = null;
1078
+ if (composing.current) return;
1079
+ if (slot.focus && node.ownerDocument.activeElement !== node) node.focus();
1080
+ node.setSelectionRange(slot.start, slot.end);
1081
+ }, []);
1082
+ (0, import_react.useLayoutEffect)(() => {
1083
+ applyPending();
1084
+ }, [applyPending, value]);
1085
+ const measure = (0, import_react.useCallback)(() => {
1086
+ const node = areaRef.current;
1087
+ if (node === null) return;
1088
+ const view = node.ownerDocument.defaultView;
1089
+ const cap = Math.max(MIN_HEIGHT_PX, Math.round((view === null ? 0 : view.innerHeight) * VIEWPORT_SHARE));
1090
+ node.style.height = "auto";
1091
+ const border = Math.max(0, node.offsetHeight - node.clientHeight);
1092
+ const wanted = node.scrollHeight + border;
1093
+ node.style.height = `${Math.min(Math.max(wanted, MIN_HEIGHT_PX), cap)}px`;
1094
+ node.style.overflowY = wanted > cap ? "auto" : "hidden";
1095
+ }, []);
1096
+ (0, import_react.useLayoutEffect)(() => {
1097
+ measure();
1098
+ }, [measure, value, disabled]);
1099
+ (0, import_react.useEffect)(() => {
1100
+ const node = areaRef.current;
1101
+ if (node === null) return;
1102
+ let lastWidth = 0;
1103
+ const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver((entries) => {
1104
+ const width = Math.round(entries[0]?.contentRect.width ?? 0);
1105
+ if (width === lastWidth) return;
1106
+ lastWidth = width;
1107
+ measure();
1108
+ });
1109
+ observer?.observe(node.parentElement ?? node);
1110
+ window.addEventListener("resize", measure);
1111
+ return () => {
1112
+ observer?.disconnect();
1113
+ window.removeEventListener("resize", measure);
1114
+ };
1115
+ }, [measure]);
1116
+ (0, import_react.useLayoutEffect)(() => {
1117
+ if (!autoFocus) return;
1118
+ const node = areaRef.current;
1119
+ if (node === null) return;
1120
+ node.focus();
1121
+ const end = node.value.length;
1122
+ if (!composing.current) node.setSelectionRange(end, end);
1123
+ }, [autoFocus]);
1124
+ const commit = (0, import_react.useCallback)(
1125
+ (edit) => {
1126
+ if (edit === null) return;
1127
+ const node = areaRef.current;
1128
+ if (node === null) return;
1129
+ if (maxLength !== void 0 && edit.value.length > maxLength) return;
1130
+ if (edit.value === value) {
1131
+ if (!composing.current) node.setSelectionRange(edit.start, edit.end);
1132
+ return;
1133
+ }
1134
+ pending.current = {
1135
+ expected: edit.value,
1136
+ start: edit.start,
1137
+ end: edit.end,
1138
+ focus: node.ownerDocument.activeElement === node
1139
+ };
1140
+ onChange(edit.value);
1141
+ },
1142
+ [maxLength, onChange, value]
1143
+ );
1144
+ function onKeyDown(event) {
1145
+ if (guarded(event)) return;
1146
+ const node = event.currentTarget;
1147
+ const modifier = event.metaKey || event.ctrlKey;
1148
+ if (event.key !== "Tab" && event.key !== "Escape") tabEscape.current = false;
1149
+ if (modifier && (event.key === "s" || event.key === "S")) {
1150
+ event.preventDefault();
1151
+ if (!event.repeat) onSave?.();
1152
+ return;
1153
+ }
1154
+ if (modifier && event.key === "Enter") {
1155
+ event.preventDefault();
1156
+ if (!event.repeat) onSave?.();
1157
+ return;
1158
+ }
1159
+ if (event.key === "Escape") {
1160
+ tabEscape.current = true;
1161
+ onEscape?.();
1162
+ return;
1163
+ }
1164
+ if (event.key === "Tab") {
1165
+ if (tabEscape.current) {
1166
+ tabEscape.current = false;
1167
+ return;
1168
+ }
1169
+ event.preventDefault();
1170
+ commit(indentSelection(value, node.selectionStart, node.selectionEnd, event.shiftKey ? -1 : 1));
1171
+ return;
1172
+ }
1173
+ if (event.key === "Enter" && !modifier && !event.shiftKey && !event.altKey) {
1174
+ const continuation = continueList(value, node.selectionStart, node.selectionEnd);
1175
+ if (continuation === null) return;
1176
+ event.preventDefault();
1177
+ commit(continuation);
1178
+ }
1179
+ }
1180
+ function onToolbarMouseDown(event) {
1181
+ event.preventDefault();
1182
+ }
1183
+ function runAction(action) {
1184
+ const node = areaRef.current;
1185
+ if (node === null) return;
1186
+ commit(action.run({ value, start: node.selectionStart, end: node.selectionEnd, locale }));
1187
+ }
1188
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "skw-ed-root", "data-disabled": disabled ? "true" : void 0, children: [
1189
+ toolbar && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1190
+ "div",
1191
+ {
1192
+ className: "skw-ed-toolbar",
1193
+ role: "toolbar",
1194
+ "aria-label": TOOLBAR_LABEL[locale],
1195
+ onMouseDown: onToolbarMouseDown,
1196
+ children: TOOLBAR.map((group) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "skw-ed-group", role: "group", "aria-label": group[locale], children: group.actions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1197
+ "button",
1198
+ {
1199
+ type: "button",
1200
+ className: "skw-ed-btn",
1201
+ "data-action": action.id,
1202
+ "data-style": action.style,
1203
+ "aria-label": action[locale],
1204
+ title: action[locale],
1205
+ disabled,
1206
+ onClick: () => {
1207
+ runAction(action);
1208
+ },
1209
+ children: action.glyph
1210
+ },
1211
+ action.id
1212
+ )) }, group.id))
1213
+ }
1214
+ ),
1215
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1216
+ "textarea",
1217
+ {
1218
+ ref: areaRef,
1219
+ className: "skw-ed-input",
1220
+ value,
1221
+ onChange: (event) => {
1222
+ onChange(event.target.value);
1223
+ },
1224
+ onKeyDown,
1225
+ placeholder,
1226
+ maxLength,
1227
+ disabled,
1228
+ "aria-label": label,
1229
+ autoComplete: "off",
1230
+ spellCheck: true
1231
+ }
1232
+ )
1233
+ ] });
1234
+ }
1235
+ var EDITOR_CSS = `
1236
+ .skw-ed-root { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
1237
+ .skw-ed-root *, .skw-ed-root *::before, .skw-ed-root *::after { box-sizing: border-box; }
1238
+ .skw-ed-root[data-disabled="true"] { opacity: .7; }
1239
+ .skw-ed-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 1px; padding: 2px; border: 1px solid var(--dsw-alias-border-l2); border-radius: 8px; background: var(--dsw-alias-bg-layer-1); }
1240
+ .skw-ed-group { display: inline-flex; align-items: center; gap: 1px; padding: 0 2px; }
1241
+ .skw-ed-group + .skw-ed-group { border-left: 1px solid var(--dsw-alias-border-l1); }
1242
+ .skw-ed-btn { min-width: 24px; height: 24px; padding: 0 5px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 5px; background: transparent; color: var(--dsw-alias-label-secondary); font: inherit; font-size: 12px; line-height: 1; cursor: pointer; }
1243
+ .skw-ed-btn:hover { background: var(--dsw-alias-interactive-bg-hover); color: var(--dsw-alias-label-primary); }
1244
+ .skw-ed-btn:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: 1px; }
1245
+ .skw-ed-btn[data-style="bold"] { font-weight: 650; }
1246
+ .skw-ed-btn[data-style="italic"] { font-style: italic; }
1247
+ .skw-ed-btn[data-style="strike"] { text-decoration: line-through; }
1248
+ .skw-ed-btn[disabled] { opacity: .45; cursor: default; }
1249
+ .skw-ed-input { width: 100%; min-height: ${MIN_HEIGHT_PX}px; padding: 8px 10px; border: 1px solid var(--dsw-alias-border-l2); border-radius: 8px; background: var(--dsw-alias-bg-layer-1); color: var(--dsw-alias-label-primary); font: inherit; font-size: 13px; line-height: 20px; resize: none; overflow-y: auto; overflow-x: hidden; }
1250
+ .skw-ed-input::placeholder { color: var(--dsw-alias-label-tertiary); }
1251
+ .skw-ed-input:focus-visible { outline: none; border-color: var(--dsw-alias-brand-primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--dsw-alias-brand-primary) 18%, transparent); }
1252
+ .skw-ed-input:disabled { opacity: .7; }
1253
+ `;
1254
+
633
1255
  // src/client/styles.ts
634
1256
  var WALL_CSS = `
635
1257
  .skw-page {
@@ -1028,6 +1650,10 @@ window.__ModuleLoader__.load({
1028
1650
  .skw-note-foot { display: flex; align-items: center; gap: 5px; font-size: 11px; line-height: 16px; color: var(--skw-note-ink); opacity: .58; margin-top: 2px; }
1029
1651
  .skw-note-foot .skw-spacer { flex: 1; }
1030
1652
  .skw-note-badge { display: inline-flex; align-items: center; gap: 3px; padding: 0 6px; height: 17px; border-radius: 999px; background: color-mix(in srgb, var(--skw-note-accent) 26%, transparent); font-weight: 550; opacity: 1; }
1653
+ /* A note whose frontmatter could not be read stays visible with defaults, so the
1654
+ card has to WARN. The app's own error colour makes it read as a fault rather
1655
+ than as another decorative badge. */
1656
+ .skw-note-badge[data-warn="true"] { background: color-mix(in srgb, var(--dsw-alias-state-error-primary) 20%, transparent); color: var(--skw-note-ink); font-weight: 600; }
1031
1657
  /* In-flow, never absolute: the buttons can no longer sit on top of the text.
1032
1658
  They fade in on hover/focus for calm cards, and stay visible where hover is
1033
1659
  not a thing (touch/coarse pointers) so the actions remain reachable. */
@@ -1203,7 +1829,11 @@ window.__ModuleLoader__.load({
1203
1829
  ];
1204
1830
 
1205
1831
  // src/client/view.tsx
1206
- var import_jsx_runtime2 = require("react/jsx-runtime");
1832
+ var import_jsx_runtime3 = require("react/jsx-runtime");
1833
+ function isComposingEvent(event) {
1834
+ const native = "nativeEvent" in event ? event.nativeEvent : event;
1835
+ return native.isComposing === true || native.keyCode === 229;
1836
+ }
1207
1837
  var ZOOM_MIN = 0.35;
1208
1838
  var ZOOM_MAX = 2;
1209
1839
  var DRAG_THRESHOLD = 3;
@@ -1212,18 +1842,19 @@ window.__ModuleLoader__.load({
1212
1842
  var WHEEL_PAN = 1;
1213
1843
  var REVEAL_MS = 340;
1214
1844
  var ARRIVAL_MS = 900;
1845
+ var REFRESH_MS = 4e3;
1215
1846
  function SidebarGlyph({ size = 18 }) {
1216
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("svg", { className: "skw-glyph", width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
1217
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("rect", { x: "4", y: "7.5", width: "11.5", height: "11.5", rx: "2", stroke: "currentColor", strokeWidth: "1.6" }),
1218
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M8.5 5.2h8.2a2.4 2.4 0 0 1 2.4 2.4v8.2", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round" }),
1219
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M6.9 11h5.7M6.9 14.4h4", stroke: "currentColor", strokeWidth: "1.4", strokeLinecap: "round", opacity: "0.75" })
1847
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("svg", { className: "skw-glyph", width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
1848
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("rect", { x: "4", y: "7.5", width: "11.5", height: "11.5", rx: "2", stroke: "currentColor", strokeWidth: "1.6" }),
1849
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M8.5 5.2h8.2a2.4 2.4 0 0 1 2.4 2.4v8.2", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round" }),
1850
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M6.9 11h5.7M6.9 14.4h4", stroke: "currentColor", strokeWidth: "1.4", strokeLinecap: "round", opacity: "0.75" })
1220
1851
  ] });
1221
1852
  }
1222
1853
  function formatTime(iso, locale) {
1223
- const stamp = new Date(iso);
1224
- if (Number.isNaN(stamp.getTime())) return iso;
1854
+ const stamp2 = new Date(iso);
1855
+ if (Number.isNaN(stamp2.getTime())) return iso;
1225
1856
  const now = Date.now();
1226
- const minutes = Math.round((now - stamp.getTime()) / 6e4);
1857
+ const minutes = Math.round((now - stamp2.getTime()) / 6e4);
1227
1858
  const zh2 = locale.toLowerCase().startsWith("zh");
1228
1859
  if (minutes < 1) return zh2 ? "\u521A\u521A" : "just now";
1229
1860
  if (minutes < 60) return zh2 ? `${minutes} \u5206\u949F\u524D` : `${minutes}m ago`;
@@ -1231,7 +1862,7 @@ window.__ModuleLoader__.load({
1231
1862
  if (hours < 24) return zh2 ? `${hours} \u5C0F\u65F6\u524D` : `${hours}h ago`;
1232
1863
  const days = Math.round(hours / 24);
1233
1864
  if (days < 7) return zh2 ? `${days} \u5929\u524D` : `${days}d ago`;
1234
- return stamp.toLocaleDateString(zh2 ? "zh-CN" : "en-US", { month: "short", day: "numeric" });
1865
+ return stamp2.toLocaleDateString(zh2 ? "zh-CN" : "en-US", { month: "short", day: "numeric" });
1235
1866
  }
1236
1867
  function parseTags(raw) {
1237
1868
  return raw.split(/[,,\s]+/).map((tag) => tag.trim()).filter((tag) => tag !== "");
@@ -1261,123 +1892,156 @@ window.__ModuleLoader__.load({
1261
1892
  function Composer({
1262
1893
  draft,
1263
1894
  t,
1895
+ locale,
1264
1896
  busy,
1265
1897
  error,
1898
+ status,
1266
1899
  onChange,
1267
1900
  onSave,
1268
1901
  onCancel
1269
1902
  }) {
1270
- const bodyRef = (0, import_react.useRef)(null);
1271
- const [preview, setPreview] = (0, import_react.useState)(false);
1272
- (0, import_react.useEffect)(() => {
1273
- bodyRef.current?.focus();
1274
- }, []);
1275
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "skw-scrim", role: "presentation", onMouseDown: (event) => {
1276
- if (event.target === event.currentTarget && !busy) onCancel();
1277
- }, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
1278
- "div",
1279
- {
1280
- className: "skw-sheet",
1281
- role: "dialog",
1282
- "aria-modal": "true",
1283
- "aria-label": draft.id ? t("edit") : t("new"),
1284
- onKeyDown: (event) => {
1285
- if (event.repeat) return;
1286
- if (event.key === "Escape" && !busy) onCancel();
1287
- if (event.key === "Enter" && (event.metaKey || event.ctrlKey) && !busy) {
1288
- event.preventDefault();
1289
- onSave();
1290
- }
1291
- },
1292
- children: [
1293
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "skw-sheet-head", children: [
1294
- draft.id ? t("edit") : t("new"),
1295
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "skw-spacer" }),
1296
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1297
- "button",
1298
- {
1299
- className: "skw-btn skw-btn-quiet",
1300
- type: "button",
1301
- "data-on": preview,
1302
- "aria-pressed": preview,
1303
- onClick: () => setPreview((value) => !value),
1304
- children: preview ? t("edit") : t("preview")
1305
- }
1306
- )
1307
- ] }),
1308
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "skw-sheet-body", children: [
1309
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1310
- "input",
1311
- {
1312
- className: "skw-input",
1313
- value: draft.title,
1314
- placeholder: t("titlePlaceholder"),
1315
- maxLength: LIMITS.title,
1316
- onChange: (event) => onChange({ title: event.target.value }),
1317
- "aria-label": t("titlePlaceholder")
1318
- }
1319
- ),
1320
- preview ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "skw-preview-box", children: draft.body.trim() === "" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "skw-preview-empty", children: t("bodyPlaceholder") }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Markdown, { source: draft.body }) }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1321
- "textarea",
1322
- {
1323
- ref: bodyRef,
1324
- className: "skw-textarea",
1325
- value: draft.body,
1326
- placeholder: t("bodyPlaceholder"),
1327
- maxLength: LIMITS.body,
1328
- onChange: (event) => onChange({ body: event.target.value }),
1329
- "aria-label": t("bodyPlaceholder")
1330
- }
1331
- ),
1332
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1333
- "input",
1334
- {
1335
- className: "skw-input",
1336
- value: draft.tags,
1337
- placeholder: t("tagsPlaceholder"),
1338
- onChange: (event) => onChange({ tags: event.target.value }),
1339
- "aria-label": t("tagsPlaceholder")
1340
- }
1341
- ),
1342
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "skw-sheet-row", children: [
1343
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "skw-swatches", role: "group", "aria-label": t("colorLabel"), children: SWATCHES.map((swatch) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1903
+ const [preview, setPreview] = (0, import_react2.useState)(false);
1904
+ const [confirmDiscard, setConfirmDiscard] = (0, import_react2.useState)(false);
1905
+ const initial = (0, import_react2.useRef)(JSON.stringify(draft));
1906
+ const dirty = JSON.stringify(draft) !== initial.current;
1907
+ const requestClose = () => {
1908
+ if (busy) return;
1909
+ if (dirty) {
1910
+ setConfirmDiscard(true);
1911
+ return;
1912
+ }
1913
+ onCancel();
1914
+ };
1915
+ const save = () => {
1916
+ if (busy) return;
1917
+ onSave();
1918
+ };
1919
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "skw-scrim", role: "presentation", onMouseDown: (event) => {
1920
+ if (event.target === event.currentTarget) requestClose();
1921
+ }, children: [
1922
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
1923
+ "div",
1924
+ {
1925
+ className: "skw-sheet",
1926
+ role: "dialog",
1927
+ "aria-modal": "true",
1928
+ "aria-label": draft.id ? t("edit") : t("new"),
1929
+ onKeyDown: (event) => {
1930
+ if (event.repeat) return;
1931
+ if (isComposingEvent(event.nativeEvent)) return;
1932
+ if (event.key === "Escape") requestClose();
1933
+ if (event.key === "Enter" && (event.metaKey || event.ctrlKey)) {
1934
+ event.preventDefault();
1935
+ save();
1936
+ }
1937
+ },
1938
+ children: [
1939
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "skw-sheet-head", children: [
1940
+ draft.id ? t("edit") : t("new"),
1941
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "skw-spacer" }),
1942
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1344
1943
  "button",
1345
1944
  {
1945
+ className: "skw-btn skw-btn-quiet",
1346
1946
  type: "button",
1347
- className: "skw-swatch",
1348
- "data-on": draft.color === swatch.key,
1349
- style: { background: swatch.css },
1350
- "aria-label": swatch.key,
1351
- "aria-pressed": draft.color === swatch.key,
1352
- onClick: () => onChange({ color: swatch.key })
1353
- },
1354
- swatch.key
1355
- )) }),
1356
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "skw-spacer" }),
1357
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "skw-sizes", role: "group", "aria-label": t("widthLabel"), children: WIDTH_CYCLE.map((width) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1358
- "button",
1947
+ "data-on": preview,
1948
+ "aria-pressed": preview,
1949
+ onClick: () => setPreview((value) => !value),
1950
+ children: preview ? t("editorSource") : t("editorPreview")
1951
+ }
1952
+ )
1953
+ ] }),
1954
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "skw-sheet-body", children: [
1955
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1956
+ "input",
1359
1957
  {
1360
- type: "button",
1361
- className: "skw-size",
1362
- "data-on": draft.width === width,
1363
- "aria-pressed": draft.width === width,
1364
- onClick: () => onChange({ width }),
1365
- children: t(`width_${width}`)
1366
- },
1367
- width
1368
- )) })
1958
+ className: "skw-input",
1959
+ value: draft.title,
1960
+ placeholder: t("titlePlaceholder"),
1961
+ maxLength: LIMITS.title,
1962
+ onChange: (event) => onChange({ title: event.target.value }),
1963
+ "aria-label": t("titlePlaceholder")
1964
+ }
1965
+ ),
1966
+ preview ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "skw-preview-box", children: draft.body.trim() === "" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "skw-preview-empty", children: t("bodyPlaceholder") }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Markdown, { source: draft.body }) }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1967
+ MarkdownEditor,
1968
+ {
1969
+ value: draft.body,
1970
+ onChange: (body) => onChange({ body }),
1971
+ onSave: save,
1972
+ onEscape: requestClose,
1973
+ maxLength: LIMITS.body,
1974
+ placeholder: t("bodyPlaceholder"),
1975
+ label: t("bodyPlaceholder"),
1976
+ locale: locale.toLowerCase().startsWith("zh") ? "zh" : "en",
1977
+ disabled: busy
1978
+ }
1979
+ ),
1980
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1981
+ "input",
1982
+ {
1983
+ className: "skw-input",
1984
+ value: draft.tags,
1985
+ placeholder: t("tagsPlaceholder"),
1986
+ onChange: (event) => onChange({ tags: event.target.value }),
1987
+ "aria-label": t("tagsPlaceholder")
1988
+ }
1989
+ ),
1990
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "skw-sheet-row", children: [
1991
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "skw-swatches", role: "group", "aria-label": t("colorLabel"), children: SWATCHES.map((swatch) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1992
+ "button",
1993
+ {
1994
+ type: "button",
1995
+ className: "skw-swatch",
1996
+ "data-on": draft.color === swatch.key,
1997
+ style: { background: swatch.css },
1998
+ "aria-label": swatch.key,
1999
+ "aria-pressed": draft.color === swatch.key,
2000
+ onClick: () => onChange({ color: swatch.key })
2001
+ },
2002
+ swatch.key
2003
+ )) }),
2004
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "skw-spacer" }),
2005
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "skw-sizes", role: "group", "aria-label": t("widthLabel"), children: WIDTH_CYCLE.map((width) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2006
+ "button",
2007
+ {
2008
+ type: "button",
2009
+ className: "skw-size",
2010
+ "data-on": draft.width === width,
2011
+ "aria-pressed": draft.width === width,
2012
+ onClick: () => onChange({ width }),
2013
+ children: t(`width_${width}`)
2014
+ },
2015
+ width
2016
+ )) })
2017
+ ] }),
2018
+ error !== "" && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "skw-error", role: "alert", children: error })
1369
2019
  ] }),
1370
- error !== "" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "skw-error", role: "alert", children: error })
1371
- ] }),
1372
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "skw-sheet-foot", children: [
1373
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "skw-hint", children: t("saveHint") }),
1374
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "skw-spacer" }),
1375
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { className: "skw-btn", type: "button", onClick: onCancel, disabled: busy, children: t("cancel") }),
1376
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { className: "skw-btn skw-btn-primary", type: "button", onClick: onSave, disabled: busy, children: t("save") })
1377
- ] })
1378
- ]
1379
- }
1380
- ) });
2020
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "skw-sheet-foot", children: [
2021
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "skw-hint", "data-status": status, children: status === "saving" ? t("editorSaving") : status === "saved" ? t("editorSaved") : dirty ? t("editorUnsaved") : t("saveHint") }),
2022
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "skw-spacer" }),
2023
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { className: "skw-btn", type: "button", onClick: requestClose, disabled: busy, children: t("cancel") }),
2024
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { className: "skw-btn skw-btn-primary", type: "button", onClick: save, disabled: busy, children: t("save") })
2025
+ ] })
2026
+ ]
2027
+ }
2028
+ ),
2029
+ confirmDiscard && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2030
+ ConfirmDialog,
2031
+ {
2032
+ title: t("discardDraft"),
2033
+ message: t("discardDraft"),
2034
+ confirmLabel: t("discard"),
2035
+ cancelLabel: t("keepEditing"),
2036
+ busy: false,
2037
+ onConfirm: () => {
2038
+ setConfirmDiscard(false);
2039
+ onCancel();
2040
+ },
2041
+ onCancel: () => setConfirmDiscard(false)
2042
+ }
2043
+ )
2044
+ ] });
1381
2045
  }
1382
2046
  function ConfirmDialog({
1383
2047
  title,
@@ -1388,15 +2052,15 @@ window.__ModuleLoader__.load({
1388
2052
  onConfirm,
1389
2053
  onCancel
1390
2054
  }) {
1391
- const cancelRef = (0, import_react.useRef)(null);
1392
- (0, import_react.useEffect)(() => {
2055
+ const cancelRef = (0, import_react2.useRef)(null);
2056
+ (0, import_react2.useEffect)(() => {
1393
2057
  const previous = typeof document === "undefined" ? null : document.activeElement;
1394
2058
  cancelRef.current?.focus();
1395
2059
  return () => {
1396
2060
  if (previous !== null && typeof previous.focus === "function") previous.focus();
1397
2061
  };
1398
2062
  }, []);
1399
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2063
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1400
2064
  "div",
1401
2065
  {
1402
2066
  className: "skw-scrim",
@@ -1404,7 +2068,7 @@ window.__ModuleLoader__.load({
1404
2068
  onMouseDown: (event) => {
1405
2069
  if (event.target === event.currentTarget && !busy) onCancel();
1406
2070
  },
1407
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2071
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
1408
2072
  "div",
1409
2073
  {
1410
2074
  className: "skw-sheet",
@@ -1420,12 +2084,12 @@ window.__ModuleLoader__.load({
1420
2084
  }
1421
2085
  },
1422
2086
  children: [
1423
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "skw-sheet-head", children: title }),
1424
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "skw-sheet-body", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { style: { margin: 0 }, children: message }) }),
1425
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "skw-sheet-foot", children: [
1426
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "skw-spacer" }),
1427
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { ref: cancelRef, className: "skw-btn", type: "button", onClick: onCancel, disabled: busy, children: cancelLabel }),
1428
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { className: "skw-btn skw-btn-danger", type: "button", onClick: onConfirm, disabled: busy, children: confirmLabel })
2087
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "skw-sheet-head", children: title }),
2088
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "skw-sheet-body", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { style: { margin: 0 }, children: message }) }),
2089
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "skw-sheet-foot", children: [
2090
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "skw-spacer" }),
2091
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { ref: cancelRef, className: "skw-btn", type: "button", onClick: onCancel, disabled: busy, children: cancelLabel }),
2092
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { className: "skw-btn skw-btn-danger", type: "button", onClick: onConfirm, disabled: busy, children: confirmLabel })
1429
2093
  ] })
1430
2094
  ]
1431
2095
  }
@@ -1433,7 +2097,7 @@ window.__ModuleLoader__.load({
1433
2097
  }
1434
2098
  );
1435
2099
  }
1436
- var NoteCard = (0, import_react.memo)(function NoteCard2({
2100
+ var NoteCard = (0, import_react2.memo)(function NoteCard2({
1437
2101
  note,
1438
2102
  index,
1439
2103
  surface,
@@ -1443,6 +2107,7 @@ window.__ModuleLoader__.load({
1443
2107
  arrived = false
1444
2108
  }) {
1445
2109
  const layout = layoutOf(note, index);
2110
+ const metaIssue = note.metaError === void 0 ? void 0 : note.metaError.startsWith("newer-schema") ? "newer" : note.metaError;
1446
2111
  const style = surface === "canvas" ? {
1447
2112
  left: `${layout.x}px`,
1448
2113
  top: `${layout.y}px`,
@@ -1457,7 +2122,7 @@ window.__ModuleLoader__.load({
1457
2122
  height: `${estimateHeight(note, layout.width)}px`,
1458
2123
  transform: `rotate(${layout.rotate}deg)`
1459
2124
  } : {};
1460
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2125
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
1461
2126
  "article",
1462
2127
  {
1463
2128
  className: "skw-note",
@@ -1468,7 +2133,7 @@ window.__ModuleLoader__.load({
1468
2133
  "data-width": layout.width,
1469
2134
  "data-arrived": arrived,
1470
2135
  style,
1471
- "aria-label": note.title || note.body.slice(0, 40),
2136
+ "aria-label": note.title || plainTextSummary(note.body, 60),
1472
2137
  tabIndex: 0,
1473
2138
  onPointerDown: (event) => actions.drag(note, event),
1474
2139
  onDoubleClick: () => actions.edit(note),
@@ -1479,11 +2144,11 @@ window.__ModuleLoader__.load({
1479
2144
  }
1480
2145
  },
1481
2146
  children: [
1482
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "skw-note-bar", children: [
1483
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "skw-note-dot", "aria-hidden": "true" }),
1484
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "skw-spacer" }),
1485
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "skw-note-tools", children: [
1486
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2147
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "skw-note-bar", children: [
2148
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "skw-note-dot", "aria-hidden": "true" }),
2149
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "skw-spacer" }),
2150
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "skw-note-tools", children: [
2151
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1487
2152
  "button",
1488
2153
  {
1489
2154
  className: "skw-icon-btn",
@@ -1493,10 +2158,10 @@ window.__ModuleLoader__.load({
1493
2158
  "aria-label": note.pinned ? t("unpin") : t("pin"),
1494
2159
  onPointerDown: (event) => event.stopPropagation(),
1495
2160
  onClick: () => actions.patch(note, { pinned: !note.pinned }),
1496
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "skw-pin", "aria-hidden": "true", children: note.pinned ? "\u2605" : "\u2606" })
2161
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "skw-pin", "aria-hidden": "true", children: note.pinned ? "\u2605" : "\u2606" })
1497
2162
  }
1498
2163
  ),
1499
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2164
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1500
2165
  "button",
1501
2166
  {
1502
2167
  className: "skw-icon-btn",
@@ -1508,7 +2173,7 @@ window.__ModuleLoader__.load({
1508
2173
  children: "\u2922"
1509
2174
  }
1510
2175
  ),
1511
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2176
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1512
2177
  "button",
1513
2178
  {
1514
2179
  className: "skw-icon-btn",
@@ -1520,7 +2185,7 @@ window.__ModuleLoader__.load({
1520
2185
  children: "\u270E"
1521
2186
  }
1522
2187
  ),
1523
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2188
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1524
2189
  "button",
1525
2190
  {
1526
2191
  className: "skw-icon-btn",
@@ -1532,7 +2197,7 @@ window.__ModuleLoader__.load({
1532
2197
  children: note.archived ? "\u21A9" : "\u25A4"
1533
2198
  }
1534
2199
  ),
1535
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2200
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1536
2201
  "button",
1537
2202
  {
1538
2203
  className: "skw-icon-btn",
@@ -1546,17 +2211,18 @@ window.__ModuleLoader__.load({
1546
2211
  )
1547
2212
  ] })
1548
2213
  ] }),
1549
- note.title !== "" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "skw-note-head", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "skw-note-title", children: note.title }) }),
1550
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "skw-note-body is-clamped", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Markdown, { source: note.body, compact: true }) }),
1551
- note.tags.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "skw-note-tags", children: note.tags.map((tag) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "skw-tag", children: [
2214
+ note.title !== "" && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "skw-note-head", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "skw-note-title", children: note.title }) }),
2215
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "skw-note-body is-clamped", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Markdown, { source: note.body, compact: true }) }),
2216
+ note.tags.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "skw-note-tags", children: note.tags.map((tag) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: "skw-tag", children: [
1552
2217
  "#",
1553
2218
  tag
1554
2219
  ] }, tag)) }),
1555
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "skw-note-foot", children: [
1556
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: formatTime(note.updatedAt, locale) }),
1557
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "skw-spacer" }),
1558
- note.archived && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "skw-note-badge", children: t("archive") }),
1559
- note.pinned && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "skw-note-badge", "aria-hidden": "true", children: [
2220
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "skw-note-foot", children: [
2221
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: formatTime(note.updatedAt, locale) }),
2222
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "skw-spacer" }),
2223
+ metaIssue !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "skw-note-badge", "data-warn": "true", title: metaIssue, children: metaIssue === "newer" ? t("metaErrorNewer") : t("metaErrorBadge") }),
2224
+ note.archived && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "skw-note-badge", children: t("archive") }),
2225
+ note.pinned && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: "skw-note-badge", "aria-hidden": "true", children: [
1560
2226
  "\u2605 ",
1561
2227
  t("pin")
1562
2228
  ] })
@@ -1566,67 +2232,74 @@ window.__ModuleLoader__.load({
1566
2232
  );
1567
2233
  });
1568
2234
  function NoteRow({ note, t, locale, onEdit }) {
1569
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("button", { className: "skw-row", type: "button", "data-color": note.color, "data-archived": note.archived, onClick: () => onEdit(note), children: [
1570
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "skw-row-dot", "aria-hidden": "true" }),
1571
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "skw-row-title", children: note.title || note.body.split("\n")[0] }),
1572
- note.tags.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "skw-row-tags", children: note.tags.map((tag) => `#${tag}`).join(" ") }),
1573
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "skw-spacer" }),
1574
- note.pinned && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "skw-row-badge", "aria-hidden": "true", children: "\u2605" }),
1575
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "skw-row-time", children: formatTime(note.updatedAt, locale) })
2235
+ const summary = plainTextSummary(note.body, 80);
2236
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("button", { className: "skw-row", type: "button", "data-color": note.color, "data-archived": note.archived, onClick: () => onEdit(note), children: [
2237
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "skw-row-dot", "aria-hidden": "true" }),
2238
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "skw-row-title", children: note.title || summary }),
2239
+ note.tags.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "skw-row-tags", children: note.tags.map((tag) => `#${tag}`).join(" ") }),
2240
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "skw-spacer" }),
2241
+ note.pinned && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "skw-row-badge", "aria-hidden": "true", children: "\u2605" }),
2242
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "skw-row-time", children: formatTime(note.updatedAt, locale) })
1576
2243
  ] });
1577
2244
  }
1578
2245
  function WallPage({ api, locale, t }) {
1579
- const [notes, setNotes] = (0, import_react.useState)([]);
1580
- const [filter, setFilter] = (0, import_react.useState)("all");
1581
- const [sort, setSort] = (0, import_react.useState)("pinned");
1582
- const [view, setView] = (0, import_react.useState)("canvas");
1583
- const [query, setQuery] = (0, import_react.useState)("");
1584
- const [showArchived, setShowArchived] = (0, import_react.useState)(false);
1585
- const [loading, setLoading] = (0, import_react.useState)(true);
1586
- const [busy, setBusy] = (0, import_react.useState)(false);
1587
- const [error, setError] = (0, import_react.useState)("");
1588
- const [draft, setDraft] = (0, import_react.useState)(null);
1589
- const [draftError, setDraftError] = (0, import_react.useState)("");
1590
- const [confirming, setConfirming] = (0, import_react.useState)(null);
1591
- const [zoom, setZoom] = (0, import_react.useState)(1);
1592
- const [viewportTick, setViewportTick] = (0, import_react.useState)(0);
1593
- const [capture, setCapture] = (0, import_react.useState)("");
1594
- const [arrivedId, setArrivedId] = (0, import_react.useState)(null);
1595
- const [menuOpen, setMenuOpen] = (0, import_react.useState)(false);
1596
- const [, setLocaleRevision] = (0, import_react.useState)(0);
1597
- const alive = (0, import_react.useRef)(true);
1598
- const life = (0, import_react.useRef)(new AbortController());
1599
- const sequence = (0, import_react.useRef)(0);
1600
- const inFlight = (0, import_react.useRef)(false);
1601
- const viewportRefCurrent = (0, import_react.useRef)(null);
1602
- const worldRef = (0, import_react.useRef)(null);
1603
- const centreRef = (0, import_react.useRef)(null);
1604
- const menuRef = (0, import_react.useRef)(null);
1605
- const dockRef = (0, import_react.useRef)(null);
1606
- const detachWheel = (0, import_react.useRef)(null);
1607
- const camera = (0, import_react.useRef)({ zoom: 1, panX: 0, panY: 0 });
1608
- const centreRequest = (0, import_react.useRef)(true);
1609
- const drag = (0, import_react.useRef)(null);
1610
- const pan = (0, import_react.useRef)(null);
1611
- const live = (0, import_react.useRef)({ mutate: (_run) => {
2246
+ const [notes, setNotes] = (0, import_react2.useState)([]);
2247
+ const [filter, setFilter] = (0, import_react2.useState)("all");
2248
+ const [sort, setSort] = (0, import_react2.useState)("pinned");
2249
+ const [view, setView] = (0, import_react2.useState)("canvas");
2250
+ const [query, setQuery] = (0, import_react2.useState)("");
2251
+ const [showArchived, setShowArchived] = (0, import_react2.useState)(false);
2252
+ const [loading, setLoading] = (0, import_react2.useState)(true);
2253
+ const [busy, setBusy] = (0, import_react2.useState)(false);
2254
+ const [error, setError] = (0, import_react2.useState)("");
2255
+ const [draft, setDraft] = (0, import_react2.useState)(null);
2256
+ const [draftError, setDraftError] = (0, import_react2.useState)("");
2257
+ const [draftStatus, setDraftStatus] = (0, import_react2.useState)("idle");
2258
+ const [notesDir, setNotesDir] = (0, import_react2.useState)("");
2259
+ const [confirming, setConfirming] = (0, import_react2.useState)(null);
2260
+ const [zoom, setZoom] = (0, import_react2.useState)(1);
2261
+ const [viewportTick, setViewportTick] = (0, import_react2.useState)(0);
2262
+ const [capture, setCapture] = (0, import_react2.useState)("");
2263
+ const [arrivedId, setArrivedId] = (0, import_react2.useState)(null);
2264
+ const [menuOpen, setMenuOpen] = (0, import_react2.useState)(false);
2265
+ const [, setLocaleRevision] = (0, import_react2.useState)(0);
2266
+ const alive = (0, import_react2.useRef)(true);
2267
+ const life = (0, import_react2.useRef)(new AbortController());
2268
+ const sequence = (0, import_react2.useRef)(0);
2269
+ const inFlight = (0, import_react2.useRef)(false);
2270
+ const queue = (0, import_react2.useRef)(Promise.resolve());
2271
+ const revision = (0, import_react2.useRef)(0);
2272
+ const draftOpen = (0, import_react2.useRef)(false);
2273
+ const viewportRefCurrent = (0, import_react2.useRef)(null);
2274
+ const worldRef = (0, import_react2.useRef)(null);
2275
+ const centreRef = (0, import_react2.useRef)(null);
2276
+ const menuRef = (0, import_react2.useRef)(null);
2277
+ const dockRef = (0, import_react2.useRef)(null);
2278
+ const detachWheel = (0, import_react2.useRef)(null);
2279
+ const camera = (0, import_react2.useRef)({ zoom: 1, panX: 0, panY: 0 });
2280
+ const centreRequest = (0, import_react2.useRef)(true);
2281
+ const drag = (0, import_react2.useRef)(null);
2282
+ const pan = (0, import_react2.useRef)(null);
2283
+ const live = (0, import_react2.useRef)({ mutate: (_run) => {
1612
2284
  } });
1613
2285
  live.current.mutate = (run) => {
1614
2286
  void mutate(run);
1615
2287
  };
1616
2288
  const activeLocale = locale.getSnapshot().active;
1617
- const stableIndex = (0, import_react.useMemo)(() => {
2289
+ draftOpen.current = draft !== null;
2290
+ const stableIndex = (0, import_react2.useMemo)(() => {
1618
2291
  const map = /* @__PURE__ */ new Map();
1619
2292
  notes.forEach((note, index) => map.set(note.id, index));
1620
2293
  return map;
1621
2294
  }, [notes]);
1622
2295
  const indexOf = (note) => stableIndex.get(note.id) ?? 0;
1623
- (0, import_react.useEffect)(() => {
2296
+ (0, import_react2.useEffect)(() => {
1624
2297
  const unsubscribe = locale.subscribe(() => {
1625
2298
  if (alive.current) setLocaleRevision((value) => value + 1);
1626
2299
  });
1627
2300
  return unsubscribe;
1628
2301
  }, [locale]);
1629
- (0, import_react.useEffect)(() => {
2302
+ (0, import_react2.useEffect)(() => {
1630
2303
  if (!menuOpen) return;
1631
2304
  const onPointerDown = (event) => {
1632
2305
  const node = menuRef.current;
@@ -1643,13 +2316,15 @@ window.__ModuleLoader__.load({
1643
2316
  window.removeEventListener("keydown", onKeyDown);
1644
2317
  };
1645
2318
  }, [menuOpen]);
1646
- const reload = (0, import_react.useMemo)(() => async (options) => {
2319
+ const reload = (0, import_react2.useMemo)(() => async (options) => {
1647
2320
  const seq = ++sequence.current;
1648
2321
  setLoading(true);
1649
2322
  try {
1650
- const next = await api.list(options.includeArchived, options.sort, life.current.signal);
2323
+ const snapshot = await api.list(options.includeArchived, options.sort, life.current.signal);
1651
2324
  if (alive.current && seq === sequence.current) {
1652
- setNotes((previous) => reconcileNotes(previous, next));
2325
+ setNotes((previous) => reconcileNotes(previous, snapshot.notes));
2326
+ if (snapshot.revision > 0) revision.current = snapshot.revision;
2327
+ if (snapshot.notesDir !== "") setNotesDir(snapshot.notesDir);
1653
2328
  if (options.clearError !== false) setError("");
1654
2329
  }
1655
2330
  } catch (cause) {
@@ -1659,7 +2334,7 @@ window.__ModuleLoader__.load({
1659
2334
  }
1660
2335
  }, [api, t]);
1661
2336
  const includeArchived = showArchived || filter === "archived";
1662
- (0, import_react.useEffect)(() => {
2337
+ (0, import_react2.useEffect)(() => {
1663
2338
  alive.current = true;
1664
2339
  life.current = new AbortController();
1665
2340
  void reload({ includeArchived, sort });
@@ -1669,24 +2344,67 @@ window.__ModuleLoader__.load({
1669
2344
  sequence.current += 1;
1670
2345
  };
1671
2346
  }, [reload, includeArchived, sort]);
1672
- async function mutate(run) {
1673
- if (inFlight.current) return false;
1674
- inFlight.current = true;
1675
- setBusy(true);
1676
- setError("");
1677
- try {
1678
- await run();
1679
- } catch (cause) {
1680
- if (alive.current && !life.current.signal.aborted) setError(errorText(cause, t));
1681
- } finally {
1682
- if (alive.current) {
1683
- await reload({ includeArchived, sort, clearError: false }).catch(() => {
1684
- });
1685
- setBusy(false);
2347
+ (0, import_react2.useEffect)(() => {
2348
+ let timer = 0;
2349
+ const check = async () => {
2350
+ if (!alive.current || life.current.signal.aborted) return;
2351
+ if (typeof document !== "undefined" && document.hidden) return;
2352
+ if (inFlight.current) return;
2353
+ try {
2354
+ const next = await api.revision(life.current.signal);
2355
+ if (!alive.current) return;
2356
+ if (next === -1 || next !== revision.current) {
2357
+ if (next !== -1) revision.current = next;
2358
+ await reload({ includeArchived, sort, clearError: false });
2359
+ }
2360
+ } catch {
1686
2361
  }
1687
- inFlight.current = false;
1688
- }
1689
- return true;
2362
+ };
2363
+ const onFocus = () => {
2364
+ void check();
2365
+ };
2366
+ const onVisible = () => {
2367
+ if (!document.hidden) void check();
2368
+ };
2369
+ window.addEventListener("focus", onFocus);
2370
+ document.addEventListener("visibilitychange", onVisible);
2371
+ timer = window.setInterval(() => {
2372
+ void check();
2373
+ }, REFRESH_MS);
2374
+ return () => {
2375
+ window.removeEventListener("focus", onFocus);
2376
+ document.removeEventListener("visibilitychange", onVisible);
2377
+ window.clearInterval(timer);
2378
+ };
2379
+ }, [api, reload, includeArchived, sort]);
2380
+ function mutate(run) {
2381
+ queue.current = queue.current.then(async () => {
2382
+ if (!alive.current) return;
2383
+ inFlight.current = true;
2384
+ setBusy(true);
2385
+ setError("");
2386
+ try {
2387
+ await run();
2388
+ } catch (cause) {
2389
+ if (alive.current && !life.current.signal.aborted) {
2390
+ const message = errorText(cause, t);
2391
+ if (draftOpen.current) {
2392
+ setDraftError(message);
2393
+ setDraftStatus("failed");
2394
+ } else {
2395
+ setError(message);
2396
+ }
2397
+ }
2398
+ } finally {
2399
+ if (alive.current) {
2400
+ await reload({ includeArchived, sort, clearError: false }).catch(() => {
2401
+ });
2402
+ setBusy(false);
2403
+ }
2404
+ inFlight.current = false;
2405
+ }
2406
+ });
2407
+ return queue.current.then(() => true, () => false);
1690
2408
  }
1691
2409
  async function tidyWall() {
1692
2410
  const ran = await mutate(async () => {
@@ -1702,6 +2420,7 @@ window.__ModuleLoader__.load({
1702
2420
  }
1703
2421
  function openComposer(note) {
1704
2422
  setDraftError("");
2423
+ setDraftStatus("idle");
1705
2424
  setDraft(note ? { id: note.id, title: note.title, body: note.body, tags: note.tags.join(" "), color: note.color, width: layoutOf(note, 0).width } : { id: null, title: "", body: "", tags: "", color: "yellow", width: "md" });
1706
2425
  }
1707
2426
  async function saveDraft() {
@@ -1709,9 +2428,11 @@ window.__ModuleLoader__.load({
1709
2428
  const body = draft.body.trim();
1710
2429
  if (body === "") {
1711
2430
  setDraftError(t("emptyBody"));
2431
+ setDraftStatus("failed");
1712
2432
  return;
1713
2433
  }
1714
2434
  setDraftError("");
2435
+ setDraftStatus("saving");
1715
2436
  await mutate(async () => {
1716
2437
  const tags = parseTags(draft.tags);
1717
2438
  if (draft.id === null) {
@@ -1731,9 +2452,10 @@ window.__ModuleLoader__.load({
1731
2452
  }
1732
2453
  }
1733
2454
  setDraft(null);
2455
+ setDraftStatus("idle");
1734
2456
  });
1735
2457
  }
1736
- const visible = (0, import_react.useMemo)(() => {
2458
+ const visible = (0, import_react2.useMemo)(() => {
1737
2459
  const needle = query.trim().toLowerCase();
1738
2460
  return notes.filter((note) => {
1739
2461
  if (filter === "archived" && !note.archived) return false;
@@ -1744,13 +2466,13 @@ window.__ModuleLoader__.load({
1744
2466
  });
1745
2467
  }, [notes, filter, query, showArchived]);
1746
2468
  const archivedCount = notes.filter((note) => note.archived).length;
1747
- const greeting = (0, import_react.useMemo)(() => {
2469
+ const greeting = (0, import_react2.useMemo)(() => {
1748
2470
  const hour = (/* @__PURE__ */ new Date()).getHours();
1749
2471
  const key = hour < 5 ? "greetNight" : hour < 12 ? "greetMorning" : hour < 18 ? "greetAfternoon" : "greetEvening";
1750
2472
  return t(key);
1751
2473
  }, [t, activeLocale]);
1752
2474
  const emptyCopy = filter === "archived" ? t("emptyArchived") : query.trim() !== "" ? t("noResults") : t("empty");
1753
- const wallBounds = (0, import_react.useMemo)(() => {
2475
+ const wallBounds = (0, import_react2.useMemo)(() => {
1754
2476
  let minX = Number.POSITIVE_INFINITY;
1755
2477
  let minY = Number.POSITIVE_INFINITY;
1756
2478
  let maxX = Number.NEGATIVE_INFINITY;
@@ -1785,10 +2507,10 @@ window.__ModuleLoader__.load({
1785
2507
  };
1786
2508
  }, [visible, stableIndex]);
1787
2509
  const wallCentre = wallBounds.centre;
1788
- const boundsRef = (0, import_react.useRef)(wallBounds);
2510
+ const boundsRef = (0, import_react2.useRef)(wallBounds);
1789
2511
  boundsRef.current = wallBounds;
1790
2512
  const hasNotes = visible.length > 0;
1791
- const applyCamera = (0, import_react.useCallback)(() => {
2513
+ const applyCamera = (0, import_react2.useCallback)(() => {
1792
2514
  const current = camera.current;
1793
2515
  const world = worldRef.current;
1794
2516
  const viewport = viewportRefCurrent.current;
@@ -1803,14 +2525,14 @@ window.__ModuleLoader__.load({
1803
2525
  viewport.style.backgroundPosition = `${current.panX}px ${current.panY}px`;
1804
2526
  }
1805
2527
  }, []);
1806
- const tween = (0, import_react.useRef)(0);
1807
- const stopTween = (0, import_react.useCallback)(() => {
2528
+ const tween = (0, import_react2.useRef)(0);
2529
+ const stopTween = (0, import_react2.useCallback)(() => {
1808
2530
  if (tween.current !== 0) {
1809
2531
  cancelAnimationFrame(tween.current);
1810
2532
  tween.current = 0;
1811
2533
  }
1812
2534
  }, []);
1813
- const glideCameraTo = (0, import_react.useCallback)((zoomTarget, panX, panY) => {
2535
+ const glideCameraTo = (0, import_react2.useCallback)((zoomTarget, panX, panY) => {
1814
2536
  const target = clampZoom(zoomTarget);
1815
2537
  const to = { zoom: target, panX, panY };
1816
2538
  stopTween();
@@ -1843,13 +2565,13 @@ window.__ModuleLoader__.load({
1843
2565
  tween.current = requestAnimationFrame(frame);
1844
2566
  setZoom(to.zoom);
1845
2567
  }, [applyCamera, stopTween]);
1846
- const glideTo = (0, import_react.useCallback)((zoomTarget, worldX, worldY) => {
2568
+ const glideTo = (0, import_react2.useCallback)((zoomTarget, worldX, worldY) => {
1847
2569
  const viewport = viewportRefCurrent.current;
1848
2570
  if (viewport === null) return;
1849
2571
  const target = clampZoom(zoomTarget);
1850
2572
  glideCameraTo(target, viewport.clientWidth / 2 - worldX * target, viewport.clientHeight / 2 - worldY * target);
1851
2573
  }, [glideCameraTo]);
1852
- const centreOn = (0, import_react.useCallback)((worldX, worldY) => {
2574
+ const centreOn = (0, import_react2.useCallback)((worldX, worldY) => {
1853
2575
  stopTween();
1854
2576
  const viewport = viewportRefCurrent.current;
1855
2577
  const current = camera.current;
@@ -1861,11 +2583,11 @@ window.__ModuleLoader__.load({
1861
2583
  }
1862
2584
  applyCamera();
1863
2585
  }, [applyCamera, stopTween]);
1864
- (0, import_react.useEffect)(() => {
2586
+ (0, import_react2.useEffect)(() => {
1865
2587
  if (hasNotes) centreRequest.current = true;
1866
2588
  setViewportTick((value) => value + 1);
1867
2589
  }, [hasNotes, view]);
1868
- const zoomTo = (0, import_react.useCallback)((next, anchor) => {
2590
+ const zoomTo = (0, import_react2.useCallback)((next, anchor) => {
1869
2591
  const viewport = viewportRefCurrent.current;
1870
2592
  const current = camera.current;
1871
2593
  const target = clampZoom(next);
@@ -1884,7 +2606,7 @@ window.__ModuleLoader__.load({
1884
2606
  setZoom(target);
1885
2607
  applyCamera();
1886
2608
  }, [applyCamera]);
1887
- const fitWall = (0, import_react.useCallback)(() => {
2609
+ const fitWall = (0, import_react2.useCallback)(() => {
1888
2610
  const viewport = viewportRefCurrent.current;
1889
2611
  if (viewport === null) return;
1890
2612
  const availableWidth = viewport.clientWidth || 960;
@@ -1927,10 +2649,10 @@ window.__ModuleLoader__.load({
1927
2649
  setZoom(target);
1928
2650
  centreOn(centreX, centreY);
1929
2651
  }, [centreOn]);
1930
- const resetView = (0, import_react.useCallback)(() => {
2652
+ const resetView = (0, import_react2.useCallback)(() => {
1931
2653
  fitWall();
1932
2654
  }, [fitWall]);
1933
- const centreReserve = (0, import_react.useCallback)(() => {
2655
+ const centreReserve = (0, import_react2.useCallback)(() => {
1934
2656
  const base = CENTRE_RESERVE;
1935
2657
  const viewport = viewportRefCurrent.current;
1936
2658
  const centre = centreRef.current;
@@ -1948,7 +2670,7 @@ window.__ModuleLoader__.load({
1948
2670
  halfHeight: base.halfHeight
1949
2671
  };
1950
2672
  }, []);
1951
- const revealBox = (0, import_react.useCallback)((box) => {
2673
+ const revealBox = (0, import_react2.useCallback)((box) => {
1952
2674
  const viewport = viewportRefCurrent.current;
1953
2675
  if (viewport === null) return;
1954
2676
  const width = viewport.clientWidth || 960;
@@ -2014,8 +2736,8 @@ window.__ModuleLoader__.load({
2014
2736
  const y = fieldY + halfH + gap + box.height * targetZoom / 2;
2015
2737
  glideCameraTo(targetZoom, width / 2 - cardX * targetZoom, y - cardY * targetZoom);
2016
2738
  }, [glideCameraTo]);
2017
- const arrival = (0, import_react.useRef)(null);
2018
- (0, import_react.useEffect)(() => {
2739
+ const arrival = (0, import_react2.useRef)(null);
2740
+ (0, import_react2.useEffect)(() => {
2019
2741
  const pending = arrival.current;
2020
2742
  if (pending === null) return;
2021
2743
  const note = notes.find((candidate) => candidate.id === pending.id);
@@ -2034,7 +2756,7 @@ window.__ModuleLoader__.load({
2034
2756
  clearTimeout(timer);
2035
2757
  };
2036
2758
  }, [notes]);
2037
- const onWheel = (0, import_react.useCallback)((event) => {
2759
+ const onWheel = (0, import_react2.useCallback)((event) => {
2038
2760
  const node = viewportRefCurrent.current;
2039
2761
  if (node === null) return;
2040
2762
  if (event.ctrlKey || event.metaKey) {
@@ -2048,7 +2770,7 @@ window.__ModuleLoader__.load({
2048
2770
  camera.current.panY -= event.deltaY * WHEEL_PAN;
2049
2771
  applyCamera();
2050
2772
  }, [applyCamera, zoomTo]);
2051
- const bindViewport = (0, import_react.useCallback)((node) => {
2773
+ const bindViewport = (0, import_react2.useCallback)((node) => {
2052
2774
  viewportRefCurrent.current = node;
2053
2775
  detachWheel.current?.();
2054
2776
  detachWheel.current = null;
@@ -2056,14 +2778,14 @@ window.__ModuleLoader__.load({
2056
2778
  node.addEventListener("wheel", onWheel, { passive: false });
2057
2779
  detachWheel.current = () => node.removeEventListener("wheel", onWheel);
2058
2780
  }, [onWheel]);
2059
- (0, import_react.useEffect)(() => {
2781
+ (0, import_react2.useEffect)(() => {
2060
2782
  const node = viewportRefCurrent.current;
2061
2783
  if (node === null) return;
2062
2784
  detachWheel.current?.();
2063
2785
  node.addEventListener("wheel", onWheel, { passive: false });
2064
2786
  detachWheel.current = () => node.removeEventListener("wheel", onWheel);
2065
2787
  }, [onWheel]);
2066
- (0, import_react.useEffect)(() => {
2788
+ (0, import_react2.useEffect)(() => {
2067
2789
  const node = viewportRefCurrent.current;
2068
2790
  if (node === null || typeof ResizeObserver === "undefined") return;
2069
2791
  const observer = new ResizeObserver(() => {
@@ -2074,7 +2796,7 @@ window.__ModuleLoader__.load({
2074
2796
  observer.observe(node);
2075
2797
  return () => observer.disconnect();
2076
2798
  }, [view]);
2077
- (0, import_react.useLayoutEffect)(() => {
2799
+ (0, import_react2.useLayoutEffect)(() => {
2078
2800
  if (view !== "canvas") return;
2079
2801
  if (centreRequest.current) {
2080
2802
  centreRequest.current = false;
@@ -2130,7 +2852,7 @@ window.__ModuleLoader__.load({
2130
2852
  lastY: event.clientY
2131
2853
  };
2132
2854
  }
2133
- (0, import_react.useEffect)(() => {
2855
+ (0, import_react2.useEffect)(() => {
2134
2856
  const paintDrag = (current) => {
2135
2857
  current.frame = 0;
2136
2858
  const node = current.node;
@@ -2231,7 +2953,7 @@ window.__ModuleLoader__.load({
2231
2953
  pan.current?.node?.removeAttribute("data-panning");
2232
2954
  };
2233
2955
  }, [api, applyCamera]);
2234
- const latestActions = (0, import_react.useRef)(null);
2956
+ const latestActions = (0, import_react2.useRef)(null);
2235
2957
  latestActions.current = {
2236
2958
  edit: openComposer,
2237
2959
  patch: (note, patch) => {
@@ -2248,29 +2970,30 @@ window.__ModuleLoader__.load({
2248
2970
  },
2249
2971
  drag: startDrag
2250
2972
  };
2251
- const actions = (0, import_react.useMemo)(() => ({
2973
+ const actions = (0, import_react2.useMemo)(() => ({
2252
2974
  edit: (note) => latestActions.current?.edit(note),
2253
2975
  patch: (note, patch) => latestActions.current?.patch(note, patch),
2254
2976
  remove: (note) => latestActions.current?.remove(note),
2255
2977
  resize: (note, width) => latestActions.current?.resize(note, width),
2256
2978
  drag: (note, event) => latestActions.current?.drag(note, event)
2257
2979
  }), []);
2258
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("section", { className: "skw-page", "aria-label": t("title"), children: [
2259
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("style", { children: WALL_CSS }),
2260
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "skw-body", "data-view": view, children: [
2261
- error !== "" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("p", { className: "skw-error", role: "alert", children: [
2980
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("section", { className: "skw-page", "aria-label": t("title"), children: [
2981
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("style", { children: WALL_CSS }),
2982
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("style", { children: EDITOR_CSS }),
2983
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "skw-body", "data-view": view, children: [
2984
+ error !== "" && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("p", { className: "skw-error", role: "alert", children: [
2262
2985
  error,
2263
2986
  " ",
2264
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { className: "skw-btn skw-btn-quiet", type: "button", onClick: () => void reload({ includeArchived, sort }), children: t("retry") })
2987
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { className: "skw-btn skw-btn-quiet", type: "button", onClick: () => void reload({ includeArchived, sort }), children: t("retry") })
2265
2988
  ] }),
2266
- loading && notes.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "skw-empty", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { children: t("loading") }) }) : view === "list" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "skw-list", children: [
2267
- visible.map((note) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(NoteRow, { note, t, locale: activeLocale, onEdit: openComposer }, note.id)),
2268
- visible.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "skw-list-empty", children: emptyCopy })
2269
- ] }) : view === "grid" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "skw-grid", children: [
2270
- visible.map((note) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(NoteCard, { note, index: indexOf(note), surface: "grid", t, locale: activeLocale, actions }, note.id)),
2271
- visible.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "skw-list-empty", children: emptyCopy })
2272
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { ref: bindViewport, className: "skw-canvas", "data-zoomed": zoom !== 1, onPointerDown: startPan, children: [
2273
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { ref: worldRef, className: "skw-world", children: visible.map((note) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2989
+ loading && notes.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "skw-empty", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { children: t("loading") }) }) : view === "list" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "skw-list", children: [
2990
+ visible.map((note) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(NoteRow, { note, t, locale: activeLocale, onEdit: openComposer }, note.id)),
2991
+ visible.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "skw-list-empty", children: emptyCopy })
2992
+ ] }) : view === "grid" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "skw-grid", children: [
2993
+ visible.map((note) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(NoteCard, { note, index: indexOf(note), surface: "grid", t, locale: activeLocale, actions }, note.id)),
2994
+ visible.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "skw-list-empty", children: emptyCopy })
2995
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { ref: bindViewport, className: "skw-canvas", "data-zoomed": zoom !== 1, onPointerDown: startPan, children: [
2996
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { ref: worldRef, className: "skw-world", children: visible.map((note) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2274
2997
  NoteCard,
2275
2998
  {
2276
2999
  note,
@@ -2283,10 +3006,10 @@ window.__ModuleLoader__.load({
2283
3006
  },
2284
3007
  note.id
2285
3008
  )) }),
2286
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "skw-centre", ref: centreRef, "aria-hidden": false, children: [
2287
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "skw-centre-hello", children: greeting }),
2288
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "skw-centre-tally", "data-empty": visible.length === 0, children: visible.length === 0 ? emptyCopy : t("centreTally", { count: visible.length, archived: archivedCount }) }),
2289
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
3009
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "skw-centre", ref: centreRef, "aria-hidden": false, children: [
3010
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "skw-centre-hello", children: greeting }),
3011
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "skw-centre-tally", "data-empty": visible.length === 0, children: visible.length === 0 ? emptyCopy : t("centreTally", { count: visible.length, archived: archivedCount }) }),
3012
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
2290
3013
  "form",
2291
3014
  {
2292
3015
  className: "skw-capture",
@@ -2302,8 +3025,8 @@ window.__ModuleLoader__.load({
2302
3025
  });
2303
3026
  },
2304
3027
  children: [
2305
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "skw-capture-icon", "aria-hidden": "true", children: "\u270E" }),
2306
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
3028
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "skw-capture-icon", "aria-hidden": "true", children: "\u270E" }),
3029
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2307
3030
  "input",
2308
3031
  {
2309
3032
  className: "skw-capture-input",
@@ -2314,20 +3037,20 @@ window.__ModuleLoader__.load({
2314
3037
  onChange: (event) => setCapture(event.target.value)
2315
3038
  }
2316
3039
  ),
2317
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { className: "skw-capture-go", type: "submit", disabled: busy || capture.trim() === "", "aria-label": t("captureGo"), children: "\u21B5" })
3040
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { className: "skw-capture-go", type: "submit", disabled: busy || capture.trim() === "", "aria-label": t("captureGo"), children: "\u21B5" })
2318
3041
  ]
2319
3042
  }
2320
3043
  )
2321
3044
  ] })
2322
3045
  ] })
2323
3046
  ] }),
2324
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "skw-dock", ref: dockRef, role: "toolbar", "aria-label": t("title"), children: [
2325
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "skw-search-wrap", children: [
2326
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "skw-search-icon", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("svg", { width: "13", height: "13", viewBox: "0 0 24 24", fill: "none", children: [
2327
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("circle", { cx: "10.5", cy: "10.5", r: "6.2", stroke: "currentColor", strokeWidth: "1.8" }),
2328
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M15.4 15.4L20 20", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round" })
3047
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "skw-dock", ref: dockRef, role: "toolbar", "aria-label": t("title"), children: [
3048
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "skw-search-wrap", children: [
3049
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "skw-search-icon", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("svg", { width: "13", height: "13", viewBox: "0 0 24 24", fill: "none", children: [
3050
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("circle", { cx: "10.5", cy: "10.5", r: "6.2", stroke: "currentColor", strokeWidth: "1.8" }),
3051
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M15.4 15.4L20 20", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round" })
2329
3052
  ] }) }),
2330
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
3053
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2331
3054
  "input",
2332
3055
  {
2333
3056
  className: "skw-search",
@@ -2339,8 +3062,8 @@ window.__ModuleLoader__.load({
2339
3062
  }
2340
3063
  )
2341
3064
  ] }),
2342
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "skw-dock-divider", "aria-hidden": "true" }),
2343
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "skw-seg", role: "group", "aria-label": t("filters"), children: ["all", "pinned", "archived"].map((key) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
3065
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "skw-dock-divider", "aria-hidden": "true" }),
3066
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "skw-seg", role: "group", "aria-label": t("filters"), children: ["all", "pinned", "archived"].map((key) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2344
3067
  "button",
2345
3068
  {
2346
3069
  type: "button",
@@ -2351,8 +3074,8 @@ window.__ModuleLoader__.load({
2351
3074
  },
2352
3075
  key
2353
3076
  )) }),
2354
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "skw-dock-divider", "aria-hidden": "true" }),
2355
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "skw-seg skw-seg-icons", role: "group", "aria-label": t("viewLabel"), children: ["canvas", "grid", "list"].map((mode) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
3077
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "skw-dock-divider", "aria-hidden": "true" }),
3078
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "skw-seg skw-seg-icons", role: "group", "aria-label": t("viewLabel"), children: ["canvas", "grid", "list"].map((mode) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2356
3079
  "button",
2357
3080
  {
2358
3081
  type: "button",
@@ -2361,23 +3084,23 @@ window.__ModuleLoader__.load({
2361
3084
  "aria-label": t(`view_${mode}`),
2362
3085
  title: t(`view_${mode}`),
2363
3086
  "aria-pressed": view === mode,
2364
- children: mode === "canvas" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
2365
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("rect", { x: "3", y: "4", width: "8", height: "7", rx: "1.6", stroke: "currentColor", strokeWidth: "1.7" }),
2366
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("rect", { x: "13", y: "7", width: "8", height: "6", rx: "1.6", stroke: "currentColor", strokeWidth: "1.7" }),
2367
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("rect", { x: "6", y: "14", width: "8", height: "6", rx: "1.6", stroke: "currentColor", strokeWidth: "1.7" })
2368
- ] }) : mode === "grid" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
2369
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("rect", { x: "3.5", y: "3.5", width: "7", height: "7", rx: "1.6", stroke: "currentColor", strokeWidth: "1.7" }),
2370
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("rect", { x: "13.5", y: "3.5", width: "7", height: "7", rx: "1.6", stroke: "currentColor", strokeWidth: "1.7" }),
2371
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("rect", { x: "3.5", y: "13.5", width: "7", height: "7", rx: "1.6", stroke: "currentColor", strokeWidth: "1.7" }),
2372
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("rect", { x: "13.5", y: "13.5", width: "7", height: "7", rx: "1.6", stroke: "currentColor", strokeWidth: "1.7" })
2373
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M4 6.5h16M4 12h16M4 17.5h11", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round" }) })
3087
+ children: mode === "canvas" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
3088
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("rect", { x: "3", y: "4", width: "8", height: "7", rx: "1.6", stroke: "currentColor", strokeWidth: "1.7" }),
3089
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("rect", { x: "13", y: "7", width: "8", height: "6", rx: "1.6", stroke: "currentColor", strokeWidth: "1.7" }),
3090
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("rect", { x: "6", y: "14", width: "8", height: "6", rx: "1.6", stroke: "currentColor", strokeWidth: "1.7" })
3091
+ ] }) : mode === "grid" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
3092
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("rect", { x: "3.5", y: "3.5", width: "7", height: "7", rx: "1.6", stroke: "currentColor", strokeWidth: "1.7" }),
3093
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("rect", { x: "13.5", y: "3.5", width: "7", height: "7", rx: "1.6", stroke: "currentColor", strokeWidth: "1.7" }),
3094
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("rect", { x: "3.5", y: "13.5", width: "7", height: "7", rx: "1.6", stroke: "currentColor", strokeWidth: "1.7" }),
3095
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("rect", { x: "13.5", y: "13.5", width: "7", height: "7", rx: "1.6", stroke: "currentColor", strokeWidth: "1.7" })
3096
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M4 6.5h16M4 12h16M4 17.5h11", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round" }) })
2374
3097
  },
2375
3098
  mode
2376
3099
  )) }),
2377
- view === "canvas" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
2378
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "skw-dock-divider", "aria-hidden": "true" }),
2379
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "skw-dock-zoom", role: "group", "aria-label": t("zoomLabel"), children: [
2380
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
3100
+ view === "canvas" && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
3101
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "skw-dock-divider", "aria-hidden": "true" }),
3102
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "skw-dock-zoom", role: "group", "aria-label": t("zoomLabel"), children: [
3103
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2381
3104
  "button",
2382
3105
  {
2383
3106
  className: "skw-camera-btn",
@@ -2388,7 +3111,7 @@ window.__ModuleLoader__.load({
2388
3111
  children: "\u2212"
2389
3112
  }
2390
3113
  ),
2391
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
3114
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
2392
3115
  "button",
2393
3116
  {
2394
3117
  className: "skw-camera-value",
@@ -2402,7 +3125,7 @@ window.__ModuleLoader__.load({
2402
3125
  ]
2403
3126
  }
2404
3127
  ),
2405
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
3128
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2406
3129
  "button",
2407
3130
  {
2408
3131
  className: "skw-camera-btn",
@@ -2413,7 +3136,7 @@ window.__ModuleLoader__.load({
2413
3136
  children: "+"
2414
3137
  }
2415
3138
  ),
2416
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
3139
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2417
3140
  "button",
2418
3141
  {
2419
3142
  className: "skw-camera-btn",
@@ -2422,8 +3145,8 @@ window.__ModuleLoader__.load({
2422
3145
  title: t("arrange"),
2423
3146
  disabled: busy || visible.length === 0,
2424
3147
  onClick: () => void tidyWall(),
2425
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
2426
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
3148
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
3149
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2427
3150
  "path",
2428
3151
  {
2429
3152
  d: "M12 3.5l1.9 5.1 5.1 1.9-5.1 1.9L12 17.5l-1.9-5.1L5 10.5l5.1-1.9L12 3.5Z",
@@ -2432,15 +3155,15 @@ window.__ModuleLoader__.load({
2432
3155
  strokeLinejoin: "round"
2433
3156
  }
2434
3157
  ),
2435
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M18.5 16.5l.8 2 2 .8-2 .8-.8 2-.8-2-2-.8 2-.8.8-2Z", fill: "currentColor" })
3158
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M18.5 16.5l.8 2 2 .8-2 .8-.8 2-.8-2-2-.8 2-.8.8-2Z", fill: "currentColor" })
2436
3159
  ] })
2437
3160
  }
2438
3161
  )
2439
3162
  ] })
2440
3163
  ] }),
2441
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "skw-dock-divider", "aria-hidden": "true" }),
2442
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "skw-menu-wrap", ref: menuRef, children: [
2443
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
3164
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "skw-dock-divider", "aria-hidden": "true" }),
3165
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "skw-menu-wrap", ref: menuRef, children: [
3166
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2444
3167
  "button",
2445
3168
  {
2446
3169
  className: "skw-camera-btn",
@@ -2451,16 +3174,16 @@ window.__ModuleLoader__.load({
2451
3174
  "aria-expanded": menuOpen,
2452
3175
  "aria-haspopup": "menu",
2453
3176
  onClick: () => setMenuOpen((value) => !value),
2454
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
2455
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("circle", { cx: "6", cy: "12", r: "1.6", fill: "currentColor" }),
2456
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("circle", { cx: "12", cy: "12", r: "1.6", fill: "currentColor" }),
2457
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("circle", { cx: "18", cy: "12", r: "1.6", fill: "currentColor" })
3177
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
3178
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("circle", { cx: "6", cy: "12", r: "1.6", fill: "currentColor" }),
3179
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("circle", { cx: "12", cy: "12", r: "1.6", fill: "currentColor" }),
3180
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("circle", { cx: "18", cy: "12", r: "1.6", fill: "currentColor" })
2458
3181
  ] })
2459
3182
  }
2460
3183
  ),
2461
- menuOpen && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "skw-menu", role: "menu", "aria-label": t("more"), children: [
2462
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "skw-menu-label", children: t("sortLabel") }),
2463
- ["pinned", "created", "updated"].map((key) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
3184
+ menuOpen && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "skw-menu", role: "menu", "aria-label": t("more"), children: [
3185
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "skw-menu-label", children: t("sortLabel") }),
3186
+ ["pinned", "created", "updated"].map((key) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
2464
3187
  "button",
2465
3188
  {
2466
3189
  type: "button",
@@ -2472,14 +3195,14 @@ window.__ModuleLoader__.load({
2472
3195
  setMenuOpen(false);
2473
3196
  },
2474
3197
  children: [
2475
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "skw-menu-tick", "aria-hidden": "true", children: sort === key ? "\u2713" : "" }),
3198
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "skw-menu-tick", "aria-hidden": "true", children: sort === key ? "\u2713" : "" }),
2476
3199
  key === "pinned" ? t("sortPinned") : key === "created" ? t("sortCreated") : t("sortUpdated")
2477
3200
  ]
2478
3201
  },
2479
3202
  key
2480
3203
  )),
2481
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "skw-menu-rule", role: "separator" }),
2482
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
3204
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "skw-menu-rule", role: "separator" }),
3205
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
2483
3206
  "button",
2484
3207
  {
2485
3208
  type: "button",
@@ -2488,12 +3211,12 @@ window.__ModuleLoader__.load({
2488
3211
  "data-on": showArchived,
2489
3212
  onClick: () => setShowArchived((value) => !value),
2490
3213
  children: [
2491
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "skw-menu-tick", "aria-hidden": "true", children: showArchived ? "\u2713" : "" }),
3214
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "skw-menu-tick", "aria-hidden": "true", children: showArchived ? "\u2713" : "" }),
2492
3215
  showArchived ? t("hideArchived") : t("showArchived")
2493
3216
  ]
2494
3217
  }
2495
3218
  ),
2496
- archivedCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
3219
+ archivedCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
2497
3220
  "button",
2498
3221
  {
2499
3222
  type: "button",
@@ -2505,23 +3228,25 @@ window.__ModuleLoader__.load({
2505
3228
  setConfirming("clear");
2506
3229
  },
2507
3230
  children: [
2508
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "skw-menu-tick", "aria-hidden": "true" }),
3231
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "skw-menu-tick", "aria-hidden": "true" }),
2509
3232
  t("clearArchived")
2510
3233
  ]
2511
3234
  }
2512
3235
  )
2513
3236
  ] })
2514
3237
  ] }),
2515
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "skw-count", children: t("count", { count: visible.length }) }),
2516
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { className: "skw-dock-new", type: "button", onClick: () => openComposer(), disabled: busy, "aria-label": t("new"), title: t("new"), children: "+" })
3238
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "skw-count", children: t("count", { count: visible.length }) }),
3239
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { className: "skw-dock-new", type: "button", onClick: () => openComposer(), disabled: busy, "aria-label": t("new"), title: t("new"), children: "+" })
2517
3240
  ] }),
2518
- draft && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
3241
+ draft && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2519
3242
  Composer,
2520
3243
  {
2521
3244
  draft,
2522
3245
  t,
3246
+ locale: activeLocale,
2523
3247
  busy,
2524
3248
  error: draftError,
3249
+ status: draftStatus,
2525
3250
  onChange: (patch) => setDraft((current) => current === null ? current : { ...current, ...patch }),
2526
3251
  onSave: () => void saveDraft(),
2527
3252
  onCancel: () => {
@@ -2532,7 +3257,7 @@ window.__ModuleLoader__.load({
2532
3257
  }
2533
3258
  }
2534
3259
  ),
2535
- confirming !== null && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
3260
+ confirming !== null && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2536
3261
  ConfirmDialog,
2537
3262
  {
2538
3263
  title: confirming === "clear" ? t("clearArchived") : t("delete"),
@@ -2568,7 +3293,7 @@ window.__ModuleLoader__.load({
2568
3293
  }
2569
3294
 
2570
3295
  // src/client/index.tsx
2571
- var import_jsx_runtime3 = require("react/jsx-runtime");
3296
+ var import_jsx_runtime4 = require("react/jsx-runtime");
2572
3297
  var inject = ["slots", "locale", "connection"];
2573
3298
  var SIDEBAR_SLOT = "sidebar.panellist";
2574
3299
  var MAIN_SLOT = "main";
@@ -2601,7 +3326,7 @@ window.__ModuleLoader__.load({
2601
3326
  "skillre-sticky-wall sidebar entry"
2602
3327
  );
2603
3328
  ctx.effect(
2604
- () => ctx.slots.inject(MAIN_SLOT, () => ctx.slots.register({ name: MAIN_SLOT, key: PANEL_ID }, () => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(WallPage, { api, locale: ctx.locale, t }))),
3329
+ () => ctx.slots.inject(MAIN_SLOT, () => ctx.slots.register({ name: MAIN_SLOT, key: PANEL_ID }, () => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(WallPage, { api, locale: ctx.locale, t }))),
2605
3330
  "skillre-sticky-wall wall page"
2606
3331
  );
2607
3332
  }