@skillre/dsh-plugin-sticky-wall 0.3.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/client.js CHANGED
@@ -62,6 +62,7 @@ window.__ModuleLoader__.load({
62
62
  md: 222,
63
63
  lg: 276
64
64
  });
65
+ var CENTRE_RESERVE = Object.freeze({ halfWidth: 330, halfHeight: 136 });
65
66
  var LAYOUT_LIMITS = Object.freeze({
66
67
  /** Absolute value of x and y, in world pixels. */
67
68
  coord: 2e4,
@@ -93,8 +94,11 @@ window.__ModuleLoader__.load({
93
94
  const value = await call({ action: "list", includeArchived, sort }, signal);
94
95
  return Array.isArray(value?.notes) ? value.notes : [];
95
96
  },
96
- async create(input, signal) {
97
- const value = await call({ action: "create", note: input }, signal);
97
+ async create(input, signal, options) {
98
+ const value = await call(
99
+ options?.centreReserve === void 0 ? { action: "create", note: input } : { action: "create", note: input, centreReserve: options.centreReserve },
100
+ signal
101
+ );
98
102
  const note = value?.changed?.[0];
99
103
  if (!note) throw new ActionError("invalid-response", "The Host created no note.");
100
104
  return note;
@@ -123,8 +127,11 @@ window.__ModuleLoader__.load({
123
127
  if (!note) throw new ActionError("invalid-response", "The Host moved no note.");
124
128
  return note;
125
129
  },
126
- async arrange(signal) {
127
- const value = await call({ action: "arrange" }, signal);
130
+ async arrange(signal, options) {
131
+ const value = await call(
132
+ options?.centreReserve === void 0 ? { action: "arrange" } : { action: "arrange", centreReserve: options.centreReserve },
133
+ signal
134
+ );
128
135
  return Array.isArray(value?.changed) ? value.changed : [];
129
136
  }
130
137
  };
@@ -153,6 +160,7 @@ window.__ModuleLoader__.load({
153
160
  "confirmDelete": "\u786E\u5B9A\u5220\u9664\u9009\u4E2D\u7684\u4FBF\u7B7E\uFF1F",
154
161
  "showArchived": "\u663E\u793A\u5F52\u6863",
155
162
  "hideArchived": "\u9690\u85CF\u5F52\u6863",
163
+ "sortLabel": "\u6392\u5E8F",
156
164
  "sortPinned": "\u7F6E\u9876\u4F18\u5148",
157
165
  "sortCreated": "\u6309\u521B\u5EFA",
158
166
  "sortUpdated": "\u6309\u66F4\u65B0",
@@ -195,7 +203,14 @@ window.__ModuleLoader__.load({
195
203
  "zoomOut": "\u7F29\u5C0F",
196
204
  "zoomReset": "\u91CD\u7F6E\u89C6\u56FE",
197
205
  "dragHint": "\u62D6\u52A8\u5361\u7247\u6446\u653E\u4F4D\u7F6E\uFF0C\u2318/Ctrl + \u6EDA\u8F6E\u7F29\u653E",
198
- "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"
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
+ "greetMorning": "\u65E9\u4E0A\u597D\uFF0C\u4ECA\u5929\u60F3\u8BB0\u70B9\u4EC0\u4E48\uFF1F",
208
+ "greetAfternoon": "\u4E0B\u5348\u597D\uFF0C\u6709\u4EC0\u4E48\u60F3\u7559\u4E0B\u6765\u7684\uFF1F",
209
+ "greetEvening": "\u665A\u4E0A\u597D\uFF0C\u6536\u4E00\u4E0B\u4ECA\u5929\u7684\u788E\u7247\u3002",
210
+ "greetNight": "\u591C\u6DF1\u4E86\uFF0C\u60F3\u5230\u4EC0\u4E48\u5C31\u5148\u8BB0\u4E0B\u6765\u3002",
211
+ "centreTally": "{count} \u5F20\u4FBF\u7B7E \xB7 {archived} \u5F20\u5DF2\u5F52\u6863",
212
+ "capturePlaceholder": "\u8BB0\u4E0B\u4E00\u4E2A\u7075\u611F\uFF0C\u6216\u7C98\u8D34\u4E00\u4E2A\u94FE\u63A5",
213
+ "captureGo": "\u8BB0\u4E0B"
199
214
  };
200
215
  var en = {
201
216
  "nav": "Notes",
@@ -218,6 +233,7 @@ window.__ModuleLoader__.load({
218
233
  "confirmDelete": "Delete the selected notes?",
219
234
  "showArchived": "Show archived",
220
235
  "hideArchived": "Hide archived",
236
+ "sortLabel": "Sort",
221
237
  "sortPinned": "Pinned first",
222
238
  "sortCreated": "By created",
223
239
  "sortUpdated": "By updated",
@@ -260,7 +276,14 @@ window.__ModuleLoader__.load({
260
276
  "zoomOut": "Zoom out",
261
277
  "zoomReset": "Reset view",
262
278
  "dragHint": "Drag a card to place it \xB7 \u2318/Ctrl + wheel to zoom",
263
- "markdownHint": "The body renders Markdown: headings, lists, bold, code blocks, links, tables"
279
+ "markdownHint": "The body renders Markdown: headings, lists, bold, code blocks, links, tables",
280
+ "greetMorning": "Good morning \u2014 what is worth keeping today?",
281
+ "greetAfternoon": "Good afternoon \u2014 anything to jot down?",
282
+ "greetEvening": "Good evening \u2014 collect the loose pieces.",
283
+ "greetNight": "Late night \u2014 capture it before it goes.",
284
+ "centreTally": "{count} notes \xB7 {archived} archived",
285
+ "capturePlaceholder": "Jot an idea, or paste a link",
286
+ "captureGo": "Capture"
264
287
  };
265
288
 
266
289
  // src/client/view.tsx
@@ -345,7 +368,9 @@ window.__ModuleLoader__.load({
345
368
  }
346
369
  function previewLayout(note, index) {
347
370
  const width = previewWidth(note.id);
348
- const radius = PREVIEW_STEP * Math.sqrt(Math.max(0, index));
371
+ const reserve = CENTRE_RESERVE;
372
+ const startRadius = Math.hypot(reserve.halfWidth, reserve.halfHeight) + Math.hypot(WIDTH_PX[width], PREVIEW_NOMINAL_HEIGHT) / 2;
373
+ const radius = PREVIEW_STEP * Math.sqrt(Math.max(0, index) + (startRadius / PREVIEW_STEP) ** 2);
349
374
  const theta = index * GOLDEN_ANGLE + (unit(`${note.id}:pa`) - 0.5) * 0.55;
350
375
  return clampLayout({
351
376
  x: Math.cos(theta) * radius - WIDTH_PX[width] / 2,
@@ -360,6 +385,37 @@ window.__ModuleLoader__.load({
360
385
  const sin = Math.sin(radians);
361
386
  return { width: width * cos + height * sin, height: height * cos + width * sin };
362
387
  }
388
+ function intersectsReserve(box, reserve = CENTRE_RESERVE) {
389
+ const clear = clearsReserve(box, reserve);
390
+ return !clear;
391
+ }
392
+ var RESERVE_EPSILON = 0.05;
393
+ function clearsReserve(box, reserve) {
394
+ return !(box.x < reserve.halfWidth - RESERVE_EPSILON && box.x + box.width > -reserve.halfWidth + RESERVE_EPSILON && box.y < reserve.halfHeight - RESERVE_EPSILON && box.y + box.height > -reserve.halfHeight + RESERVE_EPSILON);
395
+ }
396
+ function pushOutOfReserve(note, layout, reserve = CENTRE_RESERVE) {
397
+ const box = footprintOf(note, layout);
398
+ if (!intersectsReserve(box, reserve)) return layout;
399
+ const moves = [
400
+ { dx: -reserve.halfWidth - (box.x + box.width), dy: 0 },
401
+ { dx: reserve.halfWidth - box.x, dy: 0 },
402
+ { dx: 0, dy: -reserve.halfHeight - (box.y + box.height) },
403
+ { dx: 0, dy: reserve.halfHeight - box.y }
404
+ ];
405
+ let best = moves[0];
406
+ for (const move of moves) {
407
+ if (Math.abs(move.dx) + Math.abs(move.dy) < Math.abs(best.dx) + Math.abs(best.dy)) best = move;
408
+ }
409
+ return clampLayout({ ...layout, x: layout.x + best.dx, y: layout.y + best.dy });
410
+ }
411
+ function footprintOf(note, layout) {
412
+ const cardWidth = WIDTH_PX[layout.width];
413
+ const cardHeight = estimateHeight(note, layout.width);
414
+ const extent = rotatedExtent(cardWidth, cardHeight, layout.rotate);
415
+ const centreX = layout.x + cardWidth / 2;
416
+ const centreY = layout.y + cardHeight / 2;
417
+ return { x: centreX - extent.width / 2, y: centreY - extent.height / 2, width: extent.width, height: extent.height };
418
+ }
363
419
 
364
420
  // src/client/markdown.tsx
365
421
  var import_jsx_runtime = require("react/jsx-runtime");
@@ -562,22 +618,11 @@ window.__ModuleLoader__.load({
562
618
  .skw-page {
563
619
  position: relative; height: 100%; display: flex; flex-direction: column;
564
620
  background-color: var(--dsw-alias-bg-base);
565
- /* A barely-there dot grid reads as paper without competing with the notes. */
566
- background-image: radial-gradient(circle at 1px 1px, var(--dsw-alias-border-l1) 1px, transparent 0);
567
- background-size: 18px 18px;
568
621
  color: var(--dsw-alias-label-primary); font-size: 13px; line-height: 20px;
569
622
  overflow: hidden; -webkit-font-smoothing: antialiased;
570
623
  }
571
624
  .skw-page *, .skw-page *::before, .skw-page *::after { box-sizing: border-box; }
572
625
  .skw-page button { font: inherit; }
573
- .skw-head { flex: 0 0 auto; display: flex; align-items: flex-start; gap: 12px; padding: 18px 22px 14px; }
574
- .skw-head-text { min-width: 0; flex: 1; }
575
- .skw-title { margin: 0; font-size: 19px; line-height: 27px; font-weight: 650; letter-spacing: -.2px; display: flex; align-items: center; gap: 9px; }
576
- /* The title mark echoes the sidebar glyph in the brand color, so the page and
577
- the sidebar entry read as the same object. */
578
- .skw-title-mark { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; flex: none; border-radius: 8px; background: var(--dsw-alias-brand-primary); color: var(--dsw-alias-label-primary-foreground); }
579
- .skw-subtitle { margin: 3px 0 0; font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-secondary); }
580
- .skw-actions { display: flex; align-items: center; gap: 6px; flex: none; }
581
626
  .skw-btn { height: 28px; padding: 0 10px; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--dsw-alias-border-l2); border-radius: 7px; background: var(--dsw-alias-bg-layer-1); color: var(--dsw-alias-label-secondary); cursor: pointer; white-space: nowrap; }
582
627
  .skw-btn:hover { background: var(--dsw-alias-bg-layer-2); color: var(--dsw-alias-label-primary); }
583
628
  .skw-btn:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: 1px; }
@@ -588,28 +633,25 @@ window.__ModuleLoader__.load({
588
633
  .skw-btn-danger { color: var(--dsw-alias-state-error-primary); border-color: transparent; background: transparent; }
589
634
  .skw-btn-danger:hover { background: var(--dsw-alias-state-error-secondary); color: var(--dsw-alias-label-primary-foreground); }
590
635
 
591
- .skw-toolbar { flex: 0 0 auto; display: flex; align-items: center; gap: 10px; padding: 0 22px 14px; flex-wrap: wrap; }
592
- .skw-search-wrap { position: relative; flex: 1 1 240px; min-width: 160px; display: flex; align-items: center; }
593
- .skw-search-icon { position: absolute; left: 10px; display: flex; color: var(--dsw-alias-label-tertiary); pointer-events: none; }
594
- .skw-search { width: 100%; height: 32px; padding: 0 11px 0 31px; border: 1px solid var(--dsw-alias-border-l2); border-radius: 9px; background: var(--dsw-alias-bg-layer-1); color: var(--dsw-alias-label-primary); transition: border-color .12s ease, box-shadow .12s ease; }
636
+ .skw-dock .skw-search-wrap { position: relative; flex: 0 1 190px; min-width: 96px; display: flex; align-items: center; }
637
+ .skw-search-icon { position: absolute; left: 9px; display: flex; color: var(--dsw-alias-label-tertiary); pointer-events: none; }
638
+ .skw-search { width: 100%; height: 30px; padding: 0 10px 0 29px; border: 1px solid var(--dsw-alias-border-l2); border-radius: 9px; background: var(--dsw-alias-bg-layer-1); color: var(--dsw-alias-label-primary); transition: border-color .12s ease, box-shadow .12s ease; }
595
639
  .skw-search::placeholder { color: var(--dsw-alias-label-tertiary); }
596
640
  .skw-search: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); }
597
641
  /* Chips: one row of quiet pills, the active one filled. No boxed segments, so
598
642
  filters, sorting and the archive toggle stop reading as three boxes. */
599
643
  .skw-seg { display: inline-flex; gap: 4px; }
600
- .skw-seg button { height: 30px; padding: 0 12px; border: 1px solid transparent; border-radius: 999px; background: transparent; color: var(--dsw-alias-label-secondary); cursor: pointer; font-size: 12.5px; transition: background .12s ease, color .12s ease; }
644
+ .skw-seg button { height: 28px; padding: 0 9px; border: 1px solid transparent; border-radius: 999px; background: transparent; color: var(--dsw-alias-label-secondary); cursor: pointer; font-size: 12.5px; transition: background .12s ease, color .12s ease; }
601
645
  .skw-seg button:hover { background: var(--dsw-alias-bg-layer-2); color: var(--dsw-alias-label-primary); }
602
646
  .skw-seg button[data-on="true"] { background: var(--dsw-alias-label-primary); color: var(--dsw-alias-bg-base); font-weight: 550; }
603
647
  .skw-seg button:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: 1px; }
604
- .skw-toolbar-sep { width: 1px; height: 18px; background: var(--dsw-alias-border-l2); flex: none; }
605
- .skw-toggle { height: 30px; padding: 0 11px; display: inline-flex; align-items: center; gap: 6px; border: 1px dashed var(--dsw-alias-border-l2); border-radius: 999px; background: transparent; color: var(--dsw-alias-label-secondary); cursor: pointer; font-size: 12.5px; transition: background .12s ease, color .12s ease, border-color .12s ease; }
606
- .skw-toggle:hover { color: var(--dsw-alias-label-primary); border-color: var(--dsw-alias-border-l4); }
607
- .skw-toggle[data-on="true"] { border-style: solid; border-color: var(--dsw-alias-border-l3); background: var(--dsw-alias-bg-layer-2); color: var(--dsw-alias-label-primary); }
608
- .skw-toggle:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: 1px; }
609
- .skw-count { margin-left: auto; font-size: 12px; color: var(--dsw-alias-label-tertiary); font-variant-numeric: tabular-nums; white-space: nowrap; }
648
+ .skw-count { font-size: 11.5px; color: var(--dsw-alias-label-tertiary); font-variant-numeric: tabular-nums; white-space: nowrap; padding: 0 4px; }
610
649
 
611
- .skw-body { flex: 1 1 auto; overflow: auto; overscroll-behavior: contain; padding: 4px 22px 40px; }
650
+ .skw-body { flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 18px 22px 118px; }
612
651
  .skw-body[data-view="canvas"] { padding: 0; overflow: hidden; position: relative; }
652
+ /* The grid and the list are scrolled under the floating dock, so their bottom
653
+ padding clears it instead of hiding the last row behind it. */
654
+ .skw-list-empty { margin: 40px auto; text-align: center; color: var(--dsw-alias-label-secondary); font-size: 13px; }
613
655
  /* Masonry-style columns, not a row grid: cards keep their natural height and
614
656
  short notes no longer sit in a tall row with dead space underneath. */
615
657
  .skw-grid { column-count: 5; column-gap: 14px; }
@@ -668,9 +710,15 @@ window.__ModuleLoader__.load({
668
710
  MAX_CARD_HEIGHT in src/layout.ts. */
669
711
  overflow: hidden;
670
712
  }
713
+ /* The card's height is written inline from the Host's own estimate, so the
714
+ rendered box IS the box the packer collision-checked. These are only the
715
+ fallback for a card rendered without that inline height. */
671
716
  .skw-canvas .skw-note[data-width="sm"] { max-height: 236px; }
672
717
  .skw-canvas .skw-note[data-width="md"] { max-height: 288px; }
673
718
  .skw-canvas .skw-note[data-width="lg"] { max-height: 336px; }
719
+ /* With a fixed height the body must absorb the remainder and clip, rather than
720
+ pushing the footer out of the card. */
721
+ .skw-canvas .skw-note .skw-note-body { min-height: 0; overflow: hidden; }
674
722
  /* While dragging: no hover lift, no text selection, a lifted shadow, and no
675
723
  pointer events on the card's own children so the drag cannot be interrupted
676
724
  by a child capturing the pointer. Containment keeps the lifted card's paint
@@ -682,6 +730,38 @@ window.__ModuleLoader__.load({
682
730
  contain: layout paint;
683
731
  }
684
732
  .skw-canvas .skw-note[data-dragging="true"] * { pointer-events: none; }
733
+ /* Arrival.
734
+ A freshly created card has to be findable: it pops in and holds a ring for a
735
+ beat, so "did my capture actually work" is answered by the wall itself instead
736
+ of by counting cards. The animation is a scale on the card's own transform \u2014
737
+ the same property the drag writes \u2014 so it must not be transitioned and must
738
+ return to exactly the stored rotation. */
739
+ @keyframes skw-arrive {
740
+ /* No overshoot past 1.
741
+ A 4.5% bounce looked nice but it inflated the card's PAINTED box, and a card
742
+ packed exactly on the reserve's edge then overlapped the capture field for
743
+ ~200ms \u2014 a real, if brief, defect that also made the overlap assertion
744
+ intermittent. Growing from .86 to exactly 1 keeps the pop and never exceeds
745
+ the footprint the packer collision-checked. */
746
+ 0% { opacity: 0; scale: .86; }
747
+ 60% { opacity: 1; scale: .985; }
748
+ 100% { opacity: 1; scale: 1; }
749
+ }
750
+ @keyframes skw-arrive-ring {
751
+ 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--skw-note-accent) 70%, transparent), 0 6px 18px -6px var(--skw-note-glow); }
752
+ 70% { box-shadow: 0 0 0 9px color-mix(in srgb, var(--skw-note-accent) 0%, transparent), 0 6px 18px -6px var(--skw-note-glow); }
753
+ 100% { box-shadow: 0 1px 2px var(--dsw-alias-bg-mask-2), 0 6px 16px -8px var(--skw-note-glow); }
754
+ }
755
+ .skw-canvas .skw-note[data-arrived="true"] {
756
+ z-index: 18;
757
+ animation: skw-arrive .42s cubic-bezier(.2, .9, .25, 1) both, skw-arrive-ring .9s ease-out both;
758
+ /* The ring needs room to draw outside the card's box. */
759
+ overflow: visible;
760
+ }
761
+ @media (prefers-reduced-motion: reduce) {
762
+ .skw-canvas .skw-note[data-arrived="true"] { animation: skw-arrive-ring .9s ease-out both; }
763
+ }
764
+
685
765
  /* The hover lift belongs to the grid view only. On the canvas the card already
686
766
  has a stored position, and a translateY(-2px) here would fight the drag's
687
767
  own transform (the two rules would overwrite each other). */
@@ -710,22 +790,171 @@ window.__ModuleLoader__.load({
710
790
  .skw-row[data-color="purple"] { --skw-note-accent: #9b81e0; }
711
791
  .skw-row[data-color="orange"] { --skw-note-accent: #e79a4e; }
712
792
 
713
- /* Floating camera control, bottom-left: it belongs to the canvas, not to the
714
- toolbar, so the toolbar stays about filtering and the view switch. */
715
- .skw-cameras {
716
- position: absolute; left: 22px; bottom: 18px; z-index: 12;
717
- display: inline-flex; align-items: center; gap: 2px;
718
- padding: 3px; border-radius: 999px; border: 1px solid var(--dsw-alias-border-l2);
719
- background: var(--dsw-alias-bg-layer-1); box-shadow: 0 4px 14px var(--dsw-alias-bg-mask-2);
793
+ /* The floating dock.
794
+ One quiet strip across the bottom of the canvas. The wall gets the whole
795
+ window, and the controls sit where the pointer already is after a drag.
796
+ Design rules that came out of the "buttons overflow the background" report:
797
+ - it is a SINGLE row that never wraps and never grows past the page;
798
+ - groups are separated by hairlines instead of boxes, so it reads as one bar;
799
+ - anything that is a mode rather than a frequent click moves into the menu, so
800
+ the strip stays short at every window width. */
801
+ .skw-dock {
802
+ position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 14;
803
+ max-width: calc(100% - 28px); box-sizing: border-box;
804
+ display: flex; align-items: center; gap: 6px;
805
+ padding: 5px 6px 5px 6px; border-radius: 15px;
806
+ border: 1px solid var(--dsw-alias-border-l2);
807
+ background: color-mix(in srgb, var(--dsw-alias-bg-layer-1) 92%, transparent);
808
+ backdrop-filter: blur(16px) saturate(1.4); -webkit-backdrop-filter: blur(16px) saturate(1.4);
809
+ box-shadow: 0 10px 30px -8px var(--dsw-alias-bg-mask-2), 0 1px 0 color-mix(in srgb, var(--dsw-alias-label-primary) 6%, transparent) inset;
810
+ flex-wrap: nowrap; justify-content: center; white-space: nowrap;
811
+ }
812
+ /* A hairline between groups. Softer than a border on every group, which made the
813
+ dock look like three boxes glued together. */
814
+ .skw-dock-divider { width: 1px; height: 18px; flex: none; background: var(--dsw-alias-border-l1); }
815
+ .skw-dock .skw-search-wrap { position: relative; flex: 0 1 168px; min-width: 84px; display: flex; align-items: center; }
816
+ .skw-search-icon { position: absolute; left: 8px; display: flex; color: var(--dsw-alias-label-tertiary); pointer-events: none; }
817
+ .skw-search {
818
+ width: 100%; height: 28px; padding: 0 8px 0 26px; border: 1px solid transparent; border-radius: 9px;
819
+ background: var(--dsw-alias-bg-layer-2); color: var(--dsw-alias-label-primary); font-size: 12.5px;
820
+ transition: border-color .12s ease, background .12s ease;
821
+ }
822
+ .skw-search::placeholder { color: var(--dsw-alias-label-tertiary); }
823
+ .skw-search:focus-visible { outline: none; border-color: var(--dsw-alias-brand-primary); background: var(--dsw-alias-bg-layer-1); }
824
+ /* Chips: one row of quiet pills, the active one filled. */
825
+ .skw-seg { display: inline-flex; gap: 2px; flex: none; }
826
+ .skw-seg button {
827
+ height: 28px; min-width: 28px; padding: 0 8px; border: 0; border-radius: 8px;
828
+ background: transparent; color: var(--dsw-alias-label-secondary); cursor: pointer;
829
+ font-size: 12px; line-height: 1; display: inline-flex; align-items: center; justify-content: center;
830
+ transition: background .12s ease, color .12s ease;
831
+ }
832
+ .skw-seg button:hover { background: var(--dsw-alias-bg-layer-2); color: var(--dsw-alias-label-primary); }
833
+ .skw-seg button[data-on="true"] { background: var(--dsw-alias-label-primary); color: var(--dsw-alias-bg-base); font-weight: 550; }
834
+ .skw-seg button:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: 1px; }
835
+ .skw-seg-icons button { width: 30px; padding: 0; }
836
+ .skw-count {
837
+ font-size: 11px; color: var(--dsw-alias-label-tertiary); font-variant-numeric: tabular-nums;
838
+ white-space: nowrap; padding: 0 2px;
720
839
  }
840
+ .skw-dock-zoom { display: flex; align-items: center; gap: 0; flex: none; }
721
841
  .skw-camera-btn {
722
- width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center;
723
- border: 0; border-radius: 50%; background: transparent; color: var(--dsw-alias-label-secondary);
724
- cursor: pointer; font-size: 13px; line-height: 1;
842
+ width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center;
843
+ border: 0; border-radius: 8px; background: transparent; color: var(--dsw-alias-label-secondary);
844
+ cursor: pointer; font-size: 14px; line-height: 1;
725
845
  }
726
846
  .skw-camera-btn:hover { background: var(--dsw-alias-bg-layer-2); color: var(--dsw-alias-label-primary); }
847
+ .skw-camera-btn[data-on="true"] { background: var(--dsw-alias-bg-layer-2); color: var(--dsw-alias-label-primary); }
848
+ .skw-camera-btn[disabled] { opacity: .38; cursor: default; background: transparent; }
727
849
  .skw-camera-btn:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: 1px; }
728
- .skw-camera-value { min-width: 38px; text-align: center; font-size: 11px; color: var(--dsw-alias-label-tertiary); font-variant-numeric: tabular-nums; }
850
+ /* The zoom readout is also the reset button: the number is the most obvious
851
+ place to click when the view is wrong, and a separate \u2316 icon was one more
852
+ glyph in a row that had too many. */
853
+ .skw-camera-value {
854
+ min-width: 40px; height: 28px; padding: 0 4px; border: 0; border-radius: 8px; background: transparent;
855
+ text-align: center; font-size: 11px; color: var(--dsw-alias-label-tertiary);
856
+ font-variant-numeric: tabular-nums; cursor: pointer;
857
+ }
858
+ .skw-camera-value:hover { background: var(--dsw-alias-bg-layer-2); color: var(--dsw-alias-label-primary); }
859
+ .skw-camera-value:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: 1px; }
860
+ /* The one filled control: creating a note is the primary action. */
861
+ .skw-dock-new {
862
+ width: 30px; height: 30px; flex: none; display: inline-flex; align-items: center; justify-content: center;
863
+ border: 0; border-radius: 50%; background: var(--dsw-alias-brand-primary);
864
+ color: var(--dsw-alias-label-primary-foreground); cursor: pointer;
865
+ font-size: 18px; line-height: 1; font-weight: 400; padding: 0 0 2px;
866
+ transition: transform .12s ease, filter .12s ease;
867
+ }
868
+ .skw-dock-new:hover { filter: brightness(1.08); transform: scale(1.06); }
869
+ .skw-dock-new:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: 2px; }
870
+ .skw-dock-new[disabled] { opacity: .5; cursor: default; transform: none; }
871
+
872
+ /* The dock's overflow menu.
873
+ Opens upward out of the dock, because the dock sits on the bottom edge. */
874
+ .skw-menu-wrap { position: relative; flex: none; display: flex; }
875
+ .skw-menu {
876
+ position: absolute; bottom: calc(100% + 8px); right: 0; z-index: 20;
877
+ min-width: 172px; padding: 5px;
878
+ display: flex; flex-direction: column; gap: 1px;
879
+ border: 1px solid var(--dsw-alias-border-l2); border-radius: 11px;
880
+ background: var(--dsw-alias-bg-layer-1);
881
+ box-shadow: 0 14px 34px -10px var(--dsw-alias-bg-mask-3), 0 1px 0 color-mix(in srgb, var(--dsw-alias-label-primary) 6%, transparent) inset;
882
+ }
883
+ .skw-menu-label { padding: 4px 8px 2px; font-size: 10.5px; letter-spacing: .4px; text-transform: uppercase; color: var(--dsw-alias-label-tertiary); }
884
+ .skw-menu button {
885
+ display: flex; align-items: center; gap: 6px; height: 28px; padding: 0 8px;
886
+ border: 0; border-radius: 7px; background: transparent; color: var(--dsw-alias-label-secondary);
887
+ cursor: pointer; font-size: 12.5px; text-align: left; white-space: nowrap;
888
+ }
889
+ .skw-menu button:hover { background: var(--dsw-alias-bg-layer-2); color: var(--dsw-alias-label-primary); }
890
+ .skw-menu button:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: -1px; }
891
+ .skw-menu button[data-on="true"] { color: var(--dsw-alias-label-primary); font-weight: 550; }
892
+ .skw-menu button[disabled] { opacity: .45; cursor: default; }
893
+ .skw-menu-tick { width: 12px; flex: none; color: var(--dsw-alias-brand-primary); font-size: 11px; }
894
+ .skw-menu-rule { height: 1px; margin: 4px 6px; background: var(--dsw-alias-border-l1); }
895
+ .skw-menu-danger { color: var(--dsw-alias-state-error-primary) !important; }
896
+ .skw-menu-danger:hover { background: var(--dsw-alias-state-error-secondary) !important; color: var(--dsw-alias-label-primary-foreground) !important; }
897
+
898
+ /* The wall's centrepiece: greeting, tally and quick capture.
899
+ Screen space, not world space, so it stays put when the wall pans or zooms.
900
+ The wrapper ignores the pointer (the paper behind it stays draggable) and only
901
+ the field itself takes input. */
902
+ .skw-centre {
903
+ position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
904
+ width: min(560px, calc(100% - 48px)); z-index: 10;
905
+ display: flex; flex-direction: column; align-items: center; gap: 8px;
906
+ pointer-events: none; text-align: center;
907
+ /* A soft plate under the block.
908
+ The reserve keeps cards out of a rectangle, but a card can still sit just
909
+ outside its edge, and bare paper behind a floating capture field made the
910
+ field look like it was hovering over text. The plate is a feathered radial
911
+ wash rather than a solid panel, so the wall still reads as one surface. */
912
+ padding: 22px 26px 26px;
913
+ }
914
+ .skw-centre::before {
915
+ content: ""; position: absolute; inset: -28px -40px; z-index: -1; pointer-events: none;
916
+ border-radius: 50%;
917
+ background: radial-gradient(ellipse at center,
918
+ color-mix(in srgb, var(--dsw-alias-bg-base) 96%, transparent) 0%,
919
+ color-mix(in srgb, var(--dsw-alias-bg-base) 88%, transparent) 46%,
920
+ color-mix(in srgb, var(--dsw-alias-bg-base) 0%, transparent) 72%);
921
+ }
922
+ .skw-centre-hello {
923
+ margin: 0; font-size: 21px; line-height: 30px; font-weight: 650; letter-spacing: -.3px;
924
+ color: var(--dsw-alias-label-primary);
925
+ }
926
+ .skw-centre-tally {
927
+ margin: 0 0 6px; font-size: 12.5px; line-height: 19px; color: var(--dsw-alias-label-tertiary);
928
+ font-variant-numeric: tabular-nums;
929
+ }
930
+ .skw-capture {
931
+ pointer-events: auto; width: 100%; display: flex; align-items: center; gap: 8px;
932
+ padding: 8px 8px 8px 14px; border-radius: 14px;
933
+ border: 1px solid var(--dsw-alias-border-l2);
934
+ background: color-mix(in srgb, var(--dsw-alias-bg-layer-1) 92%, transparent);
935
+ backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
936
+ box-shadow: 0 8px 24px var(--dsw-alias-bg-mask-2);
937
+ transition: border-color .14s ease, box-shadow .14s ease;
938
+ }
939
+ .skw-capture:focus-within {
940
+ border-color: color-mix(in srgb, var(--dsw-alias-brand-primary) 55%, var(--dsw-alias-border-l2));
941
+ box-shadow: 0 8px 24px var(--dsw-alias-bg-mask-2), 0 0 0 3px color-mix(in srgb, var(--dsw-alias-brand-primary) 14%, transparent);
942
+ }
943
+ .skw-capture-icon { flex: none; color: var(--dsw-alias-label-tertiary); font-size: 13px; line-height: 1; }
944
+ .skw-capture-input {
945
+ flex: 1; min-width: 0; height: 26px; border: 0; background: transparent;
946
+ color: var(--dsw-alias-label-primary); font-size: 13px; line-height: 26px;
947
+ }
948
+ .skw-capture-input:focus-visible { outline: none; }
949
+ .skw-capture-input::placeholder { color: var(--dsw-alias-label-tertiary); }
950
+ .skw-capture-go {
951
+ width: 30px; height: 30px; flex: none; display: inline-flex; align-items: center; justify-content: center;
952
+ border: 0; border-radius: 9px; background: var(--dsw-alias-brand-primary);
953
+ color: var(--dsw-alias-label-primary-foreground); cursor: pointer; font-size: 13px; line-height: 1;
954
+ }
955
+ .skw-capture-go[disabled] { opacity: .35; cursor: default; }
956
+ .skw-capture-go:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: 2px; }
957
+
729
958
  .skw-empty { margin: 64px auto 0; max-width: 380px; text-align: center; color: var(--dsw-alias-label-secondary); }
730
959
  .skw-empty p { margin: 0 0 14px; font-size: 13px; }
731
960
  .skw-empty-icon { font-size: 30px; line-height: 1; display: block; margin-bottom: 12px; opacity: .65; }
@@ -964,6 +1193,8 @@ window.__ModuleLoader__.load({
964
1193
  var WIDTH_CYCLE = ["sm", "md", "lg"];
965
1194
  var DOT_PITCH = 22;
966
1195
  var WHEEL_PAN = 1;
1196
+ var REVEAL_MS = 340;
1197
+ var ARRIVAL_MS = 900;
967
1198
  function SidebarGlyph({ size = 18 }) {
968
1199
  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: [
969
1200
  /* @__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" }),
@@ -1191,10 +1422,24 @@ window.__ModuleLoader__.load({
1191
1422
  surface,
1192
1423
  t,
1193
1424
  locale,
1194
- actions
1425
+ actions,
1426
+ arrived = false
1195
1427
  }) {
1196
1428
  const layout = layoutOf(note, index);
1197
- const style = surface === "canvas" ? { left: `${layout.x}px`, top: `${layout.y}px`, width: `${WIDTH_PX[layout.width]}px`, transform: `rotate(${layout.rotate}deg)` } : {};
1429
+ const style = surface === "canvas" ? {
1430
+ left: `${layout.x}px`,
1431
+ top: `${layout.y}px`,
1432
+ width: `${WIDTH_PX[layout.width]}px`,
1433
+ // The HEIGHT is the Host's own estimate, not a CSS max-height.
1434
+ //
1435
+ // This is what makes the packer's geometry exact: the collision check runs
1436
+ // on `estimateHeight`, so unless the rendered box is that same height, a
1437
+ // card whose content renders taller than its estimate overlaps its
1438
+ // neighbour — which is precisely the residual overlap this fixes (a code
1439
+ // block's padding and border are not something a line count can see).
1440
+ height: `${estimateHeight(note, layout.width)}px`,
1441
+ transform: `rotate(${layout.rotate}deg)`
1442
+ } : {};
1198
1443
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
1199
1444
  "article",
1200
1445
  {
@@ -1204,6 +1449,7 @@ window.__ModuleLoader__.load({
1204
1449
  "data-pinned": note.pinned,
1205
1450
  "data-archived": note.archived,
1206
1451
  "data-width": layout.width,
1452
+ "data-arrived": arrived,
1207
1453
  style,
1208
1454
  "aria-label": note.title || note.body.slice(0, 40),
1209
1455
  tabIndex: 0,
@@ -1327,6 +1573,9 @@ window.__ModuleLoader__.load({
1327
1573
  const [confirming, setConfirming] = (0, import_react.useState)(null);
1328
1574
  const [zoom, setZoom] = (0, import_react.useState)(1);
1329
1575
  const [viewportTick, setViewportTick] = (0, import_react.useState)(0);
1576
+ const [capture, setCapture] = (0, import_react.useState)("");
1577
+ const [arrivedId, setArrivedId] = (0, import_react.useState)(null);
1578
+ const [menuOpen, setMenuOpen] = (0, import_react.useState)(false);
1330
1579
  const [, setLocaleRevision] = (0, import_react.useState)(0);
1331
1580
  const alive = (0, import_react.useRef)(true);
1332
1581
  const life = (0, import_react.useRef)(new AbortController());
@@ -1334,6 +1583,9 @@ window.__ModuleLoader__.load({
1334
1583
  const inFlight = (0, import_react.useRef)(false);
1335
1584
  const viewportRefCurrent = (0, import_react.useRef)(null);
1336
1585
  const worldRef = (0, import_react.useRef)(null);
1586
+ const centreRef = (0, import_react.useRef)(null);
1587
+ const menuRef = (0, import_react.useRef)(null);
1588
+ const dockRef = (0, import_react.useRef)(null);
1337
1589
  const detachWheel = (0, import_react.useRef)(null);
1338
1590
  const camera = (0, import_react.useRef)({ zoom: 1, panX: 0, panY: 0 });
1339
1591
  const centreRequest = (0, import_react.useRef)(true);
@@ -1357,6 +1609,23 @@ window.__ModuleLoader__.load({
1357
1609
  });
1358
1610
  return unsubscribe;
1359
1611
  }, [locale]);
1612
+ (0, import_react.useEffect)(() => {
1613
+ if (!menuOpen) return;
1614
+ const onPointerDown = (event) => {
1615
+ const node = menuRef.current;
1616
+ if (node !== null && event.target instanceof Node && node.contains(event.target)) return;
1617
+ setMenuOpen(false);
1618
+ };
1619
+ const onKeyDown = (event) => {
1620
+ if (event.key === "Escape") setMenuOpen(false);
1621
+ };
1622
+ window.addEventListener("pointerdown", onPointerDown, true);
1623
+ window.addEventListener("keydown", onKeyDown);
1624
+ return () => {
1625
+ window.removeEventListener("pointerdown", onPointerDown, true);
1626
+ window.removeEventListener("keydown", onKeyDown);
1627
+ };
1628
+ }, [menuOpen]);
1360
1629
  const reload = (0, import_react.useMemo)(() => async (options) => {
1361
1630
  const seq = ++sequence.current;
1362
1631
  setLoading(true);
@@ -1384,7 +1653,7 @@ window.__ModuleLoader__.load({
1384
1653
  };
1385
1654
  }, [reload, includeArchived, sort]);
1386
1655
  async function mutate(run) {
1387
- if (inFlight.current) return;
1656
+ if (inFlight.current) return false;
1388
1657
  inFlight.current = true;
1389
1658
  setBusy(true);
1390
1659
  setError("");
@@ -1400,6 +1669,19 @@ window.__ModuleLoader__.load({
1400
1669
  }
1401
1670
  inFlight.current = false;
1402
1671
  }
1672
+ return true;
1673
+ }
1674
+ async function tidyWall() {
1675
+ const ran = await mutate(async () => {
1676
+ await api.arrange(life.current.signal, { centreReserve: centreReserve() });
1677
+ });
1678
+ if (!ran) return;
1679
+ await new Promise((resolve) => {
1680
+ requestAnimationFrame(() => resolve());
1681
+ });
1682
+ if (!alive.current) return;
1683
+ centreRequest.current = true;
1684
+ setViewportTick((value) => value + 1);
1403
1685
  }
1404
1686
  function openComposer(note) {
1405
1687
  setDraftError("");
@@ -1416,7 +1698,13 @@ window.__ModuleLoader__.load({
1416
1698
  await mutate(async () => {
1417
1699
  const tags = parseTags(draft.tags);
1418
1700
  if (draft.id === null) {
1419
- await api.create({ body, title: draft.title.trim(), tags, color: draft.color }, life.current.signal);
1701
+ const note = await api.create(
1702
+ { body, title: draft.title.trim(), tags, color: draft.color },
1703
+ life.current.signal,
1704
+ { centreReserve: centreReserve() }
1705
+ );
1706
+ arrival.current = { id: note.id, token: Date.now() };
1707
+ setArrivedId(note.id);
1420
1708
  } else {
1421
1709
  await api.update(draft.id, { body, title: draft.title.trim(), tags, color: draft.color }, life.current.signal);
1422
1710
  const current = notes.find((note) => note.id === draft.id);
@@ -1439,6 +1727,12 @@ window.__ModuleLoader__.load({
1439
1727
  });
1440
1728
  }, [notes, filter, query, showArchived]);
1441
1729
  const archivedCount = notes.filter((note) => note.archived).length;
1730
+ const greeting = (0, import_react.useMemo)(() => {
1731
+ const hour = (/* @__PURE__ */ new Date()).getHours();
1732
+ const key = hour < 5 ? "greetNight" : hour < 12 ? "greetMorning" : hour < 18 ? "greetAfternoon" : "greetEvening";
1733
+ return t(key);
1734
+ }, [t, activeLocale]);
1735
+ const emptyCopy = filter === "archived" ? t("emptyArchived") : query.trim() !== "" ? t("noResults") : t("empty");
1442
1736
  const wallBounds = (0, import_react.useMemo)(() => {
1443
1737
  let minX = Number.POSITIVE_INFINITY;
1444
1738
  let minY = Number.POSITIVE_INFINITY;
@@ -1464,34 +1758,91 @@ window.__ModuleLoader__.load({
1464
1758
  }
1465
1759
  if (count === 0) return { centre: { x: 0, y: 0 }, width: 0, height: 0 };
1466
1760
  return {
1467
- // The centroid, not the box's middle: an uneven disc has a centre of mass
1468
- // that reads as "the middle" to the eye even when its bounds are lopsided.
1469
- centre: { x: sumX / count, y: sumY / count },
1761
+ // The bounding box's middle, not the centroid: "frame the whole wall" means
1762
+ // the wall's outer edges are equidistant from the viewport edges, and only
1763
+ // the box middle guarantees that. A lopsided two-card wall has a centroid
1764
+ // far from its visual middle, which left one card half off screen.
1765
+ centre: { x: (minX + maxX) / 2, y: (minY + maxY) / 2 },
1470
1766
  width: maxX - minX,
1471
1767
  height: maxY - minY
1472
1768
  };
1473
1769
  }, [visible, stableIndex]);
1474
1770
  const wallCentre = wallBounds.centre;
1771
+ const boundsRef = (0, import_react.useRef)(wallBounds);
1772
+ boundsRef.current = wallBounds;
1475
1773
  const hasNotes = visible.length > 0;
1476
1774
  const applyCamera = (0, import_react.useCallback)(() => {
1477
1775
  const current = camera.current;
1478
1776
  const world = worldRef.current;
1479
1777
  const viewport = viewportRefCurrent.current;
1480
1778
  if (world !== null) world.style.transform = `translate3d(${current.panX}px, ${current.panY}px, 0) scale(${current.zoom})`;
1779
+ const centre = centreRef.current;
1780
+ if (centre !== null) {
1781
+ const scale = Math.min(1, current.zoom);
1782
+ centre.style.transform = `translate(-50%, -50%) scale(${scale})`;
1783
+ }
1481
1784
  if (viewport !== null) {
1482
1785
  viewport.style.backgroundSize = `${DOT_PITCH * current.zoom}px ${DOT_PITCH * current.zoom}px`;
1483
1786
  viewport.style.backgroundPosition = `${current.panX}px ${current.panY}px`;
1484
1787
  }
1485
1788
  }, []);
1789
+ const tween = (0, import_react.useRef)(0);
1790
+ const stopTween = (0, import_react.useCallback)(() => {
1791
+ if (tween.current !== 0) {
1792
+ cancelAnimationFrame(tween.current);
1793
+ tween.current = 0;
1794
+ }
1795
+ }, []);
1796
+ const glideTo = (0, import_react.useCallback)((zoomTarget, worldX, worldY) => {
1797
+ const viewport = viewportRefCurrent.current;
1798
+ if (viewport === null) return;
1799
+ stopTween();
1800
+ const from = { ...camera.current };
1801
+ const to = {
1802
+ zoom: clampZoom(zoomTarget),
1803
+ panX: viewport.clientWidth / 2 - worldX * clampZoom(zoomTarget),
1804
+ panY: viewport.clientHeight / 2 - worldY * clampZoom(zoomTarget)
1805
+ };
1806
+ if (typeof requestAnimationFrame !== "function") {
1807
+ camera.current = { ...to };
1808
+ setZoom(to.zoom);
1809
+ applyCamera();
1810
+ return;
1811
+ }
1812
+ const started = performance.now();
1813
+ const frame = (now) => {
1814
+ const progress = Math.min(1, (now - started) / REVEAL_MS);
1815
+ const eased = 1 - (1 - progress) ** 3;
1816
+ camera.current = {
1817
+ zoom: from.zoom + (to.zoom - from.zoom) * eased,
1818
+ panX: from.panX + (to.panX - from.panX) * eased,
1819
+ panY: from.panY + (to.panY - from.panY) * eased
1820
+ };
1821
+ applyCamera();
1822
+ if (progress < 1) {
1823
+ tween.current = requestAnimationFrame(frame);
1824
+ return;
1825
+ }
1826
+ tween.current = 0;
1827
+ camera.current = { ...to };
1828
+ setZoom(to.zoom);
1829
+ applyCamera();
1830
+ };
1831
+ tween.current = requestAnimationFrame(frame);
1832
+ setZoom(to.zoom);
1833
+ }, [applyCamera, stopTween]);
1486
1834
  const centreOn = (0, import_react.useCallback)((worldX, worldY) => {
1835
+ stopTween();
1487
1836
  const viewport = viewportRefCurrent.current;
1488
1837
  const current = camera.current;
1489
1838
  if (viewport !== null) {
1839
+ const dock = dockRef.current;
1840
+ const bottomInset = dock === null ? 0 : dock.offsetHeight + 24;
1490
1841
  current.panX = viewport.clientWidth / 2 - worldX * current.zoom;
1491
- current.panY = viewport.clientHeight / 2 - worldY * current.zoom;
1842
+ current.panY = (viewport.clientHeight - bottomInset) / 2 - worldY * current.zoom;
1492
1843
  }
1493
1844
  applyCamera();
1494
- }, [applyCamera]);
1845
+ }, [applyCamera, stopTween]);
1495
1846
  (0, import_react.useEffect)(() => {
1496
1847
  if (hasNotes) centreRequest.current = true;
1497
1848
  setViewportTick((value) => value + 1);
@@ -1518,19 +1869,90 @@ window.__ModuleLoader__.load({
1518
1869
  const fitWall = (0, import_react.useCallback)(() => {
1519
1870
  const viewport = viewportRefCurrent.current;
1520
1871
  if (viewport === null) return;
1521
- const availableWidth = viewport.clientWidth;
1522
- const availableHeight = viewport.clientHeight;
1872
+ const availableWidth = viewport.clientWidth || 960;
1873
+ const availableHeight = viewport.clientHeight || 640;
1874
+ const world = worldRef.current;
1875
+ let minX = Number.POSITIVE_INFINITY;
1876
+ let minY = Number.POSITIVE_INFINITY;
1877
+ let maxX = Number.NEGATIVE_INFINITY;
1878
+ let maxY = Number.NEGATIVE_INFINITY;
1879
+ if (world !== null) {
1880
+ for (const node of world.querySelectorAll(".skw-note")) {
1881
+ const x = node.offsetLeft;
1882
+ const y = node.offsetTop;
1883
+ const width = node.offsetWidth;
1884
+ const height = node.offsetHeight;
1885
+ if (width === 0 || height === 0) continue;
1886
+ minX = Math.min(minX, x);
1887
+ minY = Math.min(minY, y);
1888
+ maxX = Math.max(maxX, x + width);
1889
+ maxY = Math.max(maxY, y + height);
1890
+ }
1891
+ }
1892
+ const measured = Number.isFinite(minX) && Number.isFinite(minY) && maxX > minX;
1893
+ const bounds = boundsRef.current;
1894
+ const boxWidth = measured ? maxX - minX : bounds.width;
1895
+ const boxHeight = measured ? maxY - minY : bounds.height;
1896
+ const centreX = measured ? (minX + maxX) / 2 : bounds.centre.x;
1897
+ const centreY = measured ? (minY + maxY) / 2 : bounds.centre.y;
1523
1898
  const margin = 48;
1899
+ const dock = dockRef.current;
1900
+ const bottomInset = dock === null ? 0 : dock.offsetHeight + 24;
1901
+ const usableHeight = Math.max(120, availableHeight - margin - bottomInset);
1524
1902
  const fit = Math.min(
1525
- availableWidth > 0 ? (availableWidth - margin * 2) / Math.max(1, wallBounds.width) : 1,
1526
- availableHeight > 0 ? (availableHeight - margin * 2) / Math.max(1, wallBounds.height) : 1
1903
+ (availableWidth - margin * 2) / Math.max(1, boxWidth),
1904
+ usableHeight / Math.max(1, boxHeight)
1527
1905
  );
1528
- const target = clampZoom(Math.min(1, fit));
1906
+ const FIT_FLOOR = 0.42;
1907
+ const target = clampZoom(Math.min(1, Math.max(FIT_FLOOR, fit)));
1529
1908
  camera.current.zoom = target;
1530
1909
  setZoom(target);
1531
- centreOn(wallBounds.centre.x, wallBounds.centre.y);
1532
- }, [centreOn, wallBounds]);
1533
- const resetView = (0, import_react.useCallback)(() => fitWall(), [fitWall]);
1910
+ centreOn(centreX, centreY);
1911
+ }, [centreOn]);
1912
+ const resetView = (0, import_react.useCallback)(() => {
1913
+ fitWall();
1914
+ }, [fitWall]);
1915
+ const centreReserve = (0, import_react.useCallback)(() => CENTRE_RESERVE, []);
1916
+ const revealBox = (0, import_react.useCallback)((box) => {
1917
+ const viewport = viewportRefCurrent.current;
1918
+ if (viewport === null) return;
1919
+ const zoomNow = camera.current.zoom;
1920
+ const centreX = box.x + box.width / 2;
1921
+ const centreY = box.y + box.height / 2;
1922
+ const screenX = centreX * zoomNow + camera.current.panX;
1923
+ const screenY = centreY * zoomNow + camera.current.panY;
1924
+ const margin = 72;
1925
+ const visible2 = screenX > margin && screenX < viewport.clientWidth - margin && screenY > margin && screenY < viewport.clientHeight - margin;
1926
+ if (visible2) return;
1927
+ const targetZoom = Math.min(
1928
+ zoomNow,
1929
+ Math.max(ZOOM_MIN, Math.min(
1930
+ (viewport.clientWidth - margin * 2) / Math.max(1, box.width),
1931
+ (viewport.clientHeight - margin * 2) / Math.max(1, box.height)
1932
+ ))
1933
+ );
1934
+ glideTo(targetZoom, centreX, centreY);
1935
+ }, [glideTo]);
1936
+ const arrival = (0, import_react.useRef)(null);
1937
+ (0, import_react.useEffect)(() => {
1938
+ const pending = arrival.current;
1939
+ if (pending === null) return;
1940
+ const note = notes.find((candidate) => candidate.id === pending.id);
1941
+ if (note === void 0) return;
1942
+ arrival.current = null;
1943
+ const layout = layoutOf(note, stableIndex.get(note.id) ?? 0);
1944
+ const frame = requestAnimationFrame(() => {
1945
+ if (!alive.current) return;
1946
+ revealBox(footprintOf(note, layout));
1947
+ });
1948
+ const timer = setTimeout(() => {
1949
+ if (alive.current) setArrivedId((current) => current === pending.id ? null : current);
1950
+ }, ARRIVAL_MS);
1951
+ return () => {
1952
+ cancelAnimationFrame(frame);
1953
+ clearTimeout(timer);
1954
+ };
1955
+ }, [notes]);
1534
1956
  const onWheel = (0, import_react.useCallback)((event) => {
1535
1957
  const node = viewportRefCurrent.current;
1536
1958
  if (node === null) return;
@@ -1579,7 +2001,7 @@ window.__ModuleLoader__.load({
1579
2001
  return;
1580
2002
  }
1581
2003
  applyCamera();
1582
- }, [applyCamera, centreOn, fitWall, view, viewportTick]);
2004
+ }, [applyCamera, fitWall, view, viewportTick]);
1583
2005
  function startDrag(note, event) {
1584
2006
  if (event.button !== 0 || event.isPrimary === false) return;
1585
2007
  const layout = layoutOf(note, indexOf(note));
@@ -1587,6 +2009,7 @@ window.__ModuleLoader__.load({
1587
2009
  node.setAttribute("data-dragging", "true");
1588
2010
  drag.current = {
1589
2011
  id: note.id,
2012
+ note,
1590
2013
  pointerId: event.pointerId,
1591
2014
  node,
1592
2015
  startX: event.clientX,
@@ -1696,7 +2119,11 @@ window.__ModuleLoader__.load({
1696
2119
  }
1697
2120
  const dx = (current.lastX - current.startX) / zoomNow;
1698
2121
  const dy = (current.lastY - current.startY) / zoomNow;
1699
- const layout = clampLayout({ x: current.originX + dx, y: current.originY + dy, rotate: current.rotate, width: current.width });
2122
+ const layout = pushOutOfReserve(
2123
+ current.note,
2124
+ clampLayout({ x: current.originX + dx, y: current.originY + dy, rotate: current.rotate, width: current.width }),
2125
+ centreReserve()
2126
+ );
1700
2127
  if (node !== null) {
1701
2128
  node.removeAttribute("data-dragging");
1702
2129
  node.style.transform = `rotate(${current.rotate}deg)`;
@@ -1749,39 +2176,73 @@ window.__ModuleLoader__.load({
1749
2176
  }), []);
1750
2177
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("section", { className: "skw-page", "aria-label": t("title"), children: [
1751
2178
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("style", { children: WALL_CSS }),
1752
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("header", { className: "skw-head", children: [
1753
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "skw-head-text", children: [
1754
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("h1", { className: "skw-title", children: [
1755
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "skw-title-mark", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(SidebarGlyph, { size: 15 }) }),
1756
- t("title")
1757
- ] }),
1758
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "skw-subtitle", children: t("subtitle") })
2179
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "skw-body", "data-view": view, children: [
2180
+ error !== "" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("p", { className: "skw-error", role: "alert", children: [
2181
+ error,
2182
+ " ",
2183
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { className: "skw-btn skw-btn-quiet", type: "button", onClick: () => void reload({ includeArchived, sort }), children: t("retry") })
1759
2184
  ] }),
1760
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "skw-actions", children: [
1761
- archivedCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { className: "skw-btn skw-btn-quiet", type: "button", onClick: () => setConfirming("clear"), disabled: busy, children: t("clearArchived") }),
1762
- view === "canvas" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1763
- "button",
2185
+ 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: [
2186
+ visible.map((note) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(NoteRow, { note, t, locale: activeLocale, onEdit: openComposer }, note.id)),
2187
+ visible.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "skw-list-empty", children: emptyCopy })
2188
+ ] }) : view === "grid" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "skw-grid", children: [
2189
+ visible.map((note) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(NoteCard, { note, index: indexOf(note), surface: "grid", t, locale: activeLocale, actions }, note.id)),
2190
+ visible.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "skw-list-empty", children: emptyCopy })
2191
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { ref: bindViewport, className: "skw-canvas", "data-zoomed": zoom !== 1, onPointerDown: startPan, children: [
2192
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { ref: worldRef, className: "skw-world", children: visible.map((note) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2193
+ NoteCard,
1764
2194
  {
1765
- className: "skw-btn skw-btn-quiet",
1766
- type: "button",
1767
- disabled: busy || visible.length === 0,
1768
- onClick: () => void mutate(async () => {
1769
- await api.arrange(life.current.signal);
1770
- centreRequest.current = true;
1771
- setViewportTick((value) => value + 1);
1772
- }),
1773
- children: t("arrange")
1774
- }
1775
- ),
1776
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("button", { className: "skw-btn skw-btn-primary", type: "button", onClick: () => openComposer(), disabled: busy, children: [
1777
- "+ ",
1778
- t("new")
2195
+ note,
2196
+ index: indexOf(note),
2197
+ surface: "canvas",
2198
+ t,
2199
+ locale: activeLocale,
2200
+ actions,
2201
+ arrived: note.id === arrivedId
2202
+ },
2203
+ note.id
2204
+ )) }),
2205
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "skw-centre", ref: centreRef, "aria-hidden": false, children: [
2206
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "skw-centre-hello", children: greeting }),
2207
+ /* @__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 }) }),
2208
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2209
+ "form",
2210
+ {
2211
+ className: "skw-capture",
2212
+ onSubmit: (event) => {
2213
+ event.preventDefault();
2214
+ const body = capture.trim();
2215
+ if (body === "" || busy) return;
2216
+ void mutate(async () => {
2217
+ const note = await api.create({ body }, life.current.signal, { centreReserve: centreReserve() });
2218
+ arrival.current = { id: note.id, token: Date.now() };
2219
+ setArrivedId(note.id);
2220
+ setCapture("");
2221
+ });
2222
+ },
2223
+ children: [
2224
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "skw-capture-icon", "aria-hidden": "true", children: "\u270E" }),
2225
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2226
+ "input",
2227
+ {
2228
+ className: "skw-capture-input",
2229
+ value: capture,
2230
+ placeholder: t("capturePlaceholder"),
2231
+ "aria-label": t("capturePlaceholder"),
2232
+ maxLength: LIMITS.body,
2233
+ onChange: (event) => setCapture(event.target.value)
2234
+ }
2235
+ ),
2236
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { className: "skw-capture-go", type: "submit", disabled: busy || capture.trim() === "", "aria-label": t("captureGo"), children: "\u21B5" })
2237
+ ]
2238
+ }
2239
+ )
1779
2240
  ] })
1780
2241
  ] })
1781
2242
  ] }),
1782
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "skw-toolbar", children: [
2243
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "skw-dock", ref: dockRef, role: "toolbar", "aria-label": t("title"), children: [
1783
2244
  /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "skw-search-wrap", children: [
1784
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "skw-search-icon", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", children: [
2245
+ /* @__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: [
1785
2246
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("circle", { cx: "10.5", cy: "10.5", r: "6.2", stroke: "currentColor", strokeWidth: "1.8" }),
1786
2247
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M15.4 15.4L20 20", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round" })
1787
2248
  ] }) }),
@@ -1797,45 +2258,181 @@ window.__ModuleLoader__.load({
1797
2258
  }
1798
2259
  )
1799
2260
  ] }),
1800
- /* @__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)("button", { type: "button", "data-on": filter === key, onClick: () => setFilter(key), children: key === "all" ? t("all") : key === "pinned" ? t("pin") : t("archive") }, key)) }),
1801
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2261
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "skw-dock-divider", "aria-hidden": "true" }),
2262
+ /* @__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)(
1802
2263
  "button",
1803
2264
  {
1804
- className: "skw-toggle",
1805
2265
  type: "button",
1806
- "data-on": showArchived,
1807
- "aria-pressed": showArchived,
1808
- onClick: () => setShowArchived((value) => !value),
1809
- children: showArchived ? t("hideArchived") : t("showArchived")
1810
- }
1811
- ),
1812
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "skw-seg", role: "group", "aria-label": t("sortPinned"), children: ["pinned", "created", "updated"].map((key) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { type: "button", "data-on": sort === key, onClick: () => setSort(key), children: key === "pinned" ? t("sortPinned") : key === "created" ? t("sortCreated") : t("sortUpdated") }, key)) }),
1813
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "skw-seg skw-view-seg", role: "group", "aria-label": t("viewLabel"), children: ["canvas", "grid", "list"].map((mode) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { type: "button", "data-on": view === mode, onClick: () => setView(mode), "aria-label": t(`view_${mode}`), children: t(`view_${mode}`) }, mode)) }),
1814
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "skw-count", children: t("count", { count: visible.length }) })
1815
- ] }),
1816
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "skw-body", "data-view": view, children: [
1817
- error !== "" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("p", { className: "skw-error", role: "alert", children: [
1818
- error,
1819
- " ",
1820
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { className: "skw-btn skw-btn-quiet", type: "button", onClick: () => void reload({ includeArchived, sort }), children: t("retry") })
2266
+ "data-on": filter === key,
2267
+ onClick: () => setFilter(key),
2268
+ title: key === "all" ? t("all") : key === "pinned" ? t("pin") : t("archive"),
2269
+ children: key === "all" ? t("all") : key === "pinned" ? t("pin") : t("archive")
2270
+ },
2271
+ key
2272
+ )) }),
2273
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "skw-dock-divider", "aria-hidden": "true" }),
2274
+ /* @__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)(
2275
+ "button",
2276
+ {
2277
+ type: "button",
2278
+ "data-on": view === mode,
2279
+ onClick: () => setView(mode),
2280
+ "aria-label": t(`view_${mode}`),
2281
+ title: t(`view_${mode}`),
2282
+ "aria-pressed": view === mode,
2283
+ 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: [
2284
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("rect", { x: "3", y: "4", width: "8", height: "7", rx: "1.6", stroke: "currentColor", strokeWidth: "1.7" }),
2285
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("rect", { x: "13", y: "7", width: "8", height: "6", rx: "1.6", stroke: "currentColor", strokeWidth: "1.7" }),
2286
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("rect", { x: "6", y: "14", width: "8", height: "6", rx: "1.6", stroke: "currentColor", strokeWidth: "1.7" })
2287
+ ] }) : mode === "grid" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
2288
+ /* @__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" }),
2289
+ /* @__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" }),
2290
+ /* @__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" }),
2291
+ /* @__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" })
2292
+ ] }) : /* @__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" }) })
2293
+ },
2294
+ mode
2295
+ )) }),
2296
+ view === "canvas" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
2297
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "skw-dock-divider", "aria-hidden": "true" }),
2298
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "skw-dock-zoom", role: "group", "aria-label": t("zoomLabel"), children: [
2299
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2300
+ "button",
2301
+ {
2302
+ className: "skw-camera-btn",
2303
+ type: "button",
2304
+ "aria-label": t("zoomOut"),
2305
+ title: t("zoomOut"),
2306
+ onClick: () => zoomTo(zoom - 0.15),
2307
+ children: "\u2212"
2308
+ }
2309
+ ),
2310
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2311
+ "button",
2312
+ {
2313
+ className: "skw-camera-value",
2314
+ type: "button",
2315
+ "aria-label": t("zoomReset"),
2316
+ title: t("zoomReset"),
2317
+ onClick: resetView,
2318
+ children: [
2319
+ Math.round(zoom * 100),
2320
+ "%"
2321
+ ]
2322
+ }
2323
+ ),
2324
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2325
+ "button",
2326
+ {
2327
+ className: "skw-camera-btn",
2328
+ type: "button",
2329
+ "aria-label": t("zoomIn"),
2330
+ title: t("zoomIn"),
2331
+ onClick: () => zoomTo(zoom + 0.15),
2332
+ children: "+"
2333
+ }
2334
+ ),
2335
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2336
+ "button",
2337
+ {
2338
+ className: "skw-camera-btn",
2339
+ type: "button",
2340
+ "aria-label": t("arrange"),
2341
+ title: t("arrange"),
2342
+ disabled: busy || visible.length === 0,
2343
+ onClick: () => void tidyWall(),
2344
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
2345
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2346
+ "path",
2347
+ {
2348
+ 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",
2349
+ stroke: "currentColor",
2350
+ strokeWidth: "1.6",
2351
+ strokeLinejoin: "round"
2352
+ }
2353
+ ),
2354
+ /* @__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" })
2355
+ ] })
2356
+ }
2357
+ )
2358
+ ] })
1821
2359
  ] }),
1822
- 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") }) }) : visible.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "skw-empty", children: [
1823
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "skw-empty-icon", "aria-hidden": "true", children: "\u{1F5D2}\uFE0F" }),
1824
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { children: filter === "archived" ? t("emptyArchived") : query.trim() !== "" ? t("noResults") : t("empty") }),
1825
- filter !== "archived" && query.trim() === "" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { className: "skw-btn", type: "button", onClick: () => openComposer(), children: t("new") })
1826
- ] }) : view === "list" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "skw-list", children: visible.map((note) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(NoteRow, { note, t, locale: activeLocale, onEdit: openComposer }, note.id)) }) : view === "grid" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "skw-grid", children: visible.map((note) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(NoteCard, { note, index: indexOf(note), surface: "grid", t, locale: activeLocale, actions }, note.id)) }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { ref: bindViewport, className: "skw-canvas", "data-zoomed": zoom !== 1, onPointerDown: startPan, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { ref: worldRef, className: "skw-world", children: [
1827
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "skw-origin-glow", style: { left: `${wallCentre.x}px`, top: `${wallCentre.y}px` }, "aria-hidden": "true" }),
1828
- visible.map((note) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(NoteCard, { note, index: indexOf(note), surface: "canvas", t, locale: activeLocale, actions }, note.id))
1829
- ] }) })
1830
- ] }),
1831
- view === "canvas" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "skw-cameras", role: "group", "aria-label": t("zoomLabel"), children: [
1832
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { className: "skw-camera-btn", type: "button", "aria-label": t("zoomOut"), onClick: () => zoomTo(zoom - 0.15), children: "\u2212" }),
1833
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "skw-camera-value", children: [
1834
- Math.round(zoom * 100),
1835
- "%"
2360
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "skw-dock-divider", "aria-hidden": "true" }),
2361
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "skw-menu-wrap", ref: menuRef, children: [
2362
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2363
+ "button",
2364
+ {
2365
+ className: "skw-camera-btn",
2366
+ type: "button",
2367
+ "data-on": menuOpen,
2368
+ "aria-label": t("more"),
2369
+ title: t("more"),
2370
+ "aria-expanded": menuOpen,
2371
+ "aria-haspopup": "menu",
2372
+ onClick: () => setMenuOpen((value) => !value),
2373
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
2374
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("circle", { cx: "6", cy: "12", r: "1.6", fill: "currentColor" }),
2375
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("circle", { cx: "12", cy: "12", r: "1.6", fill: "currentColor" }),
2376
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("circle", { cx: "18", cy: "12", r: "1.6", fill: "currentColor" })
2377
+ ] })
2378
+ }
2379
+ ),
2380
+ menuOpen && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "skw-menu", role: "menu", "aria-label": t("more"), children: [
2381
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "skw-menu-label", children: t("sortLabel") }),
2382
+ ["pinned", "created", "updated"].map((key) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2383
+ "button",
2384
+ {
2385
+ type: "button",
2386
+ role: "menuitemradio",
2387
+ "aria-checked": sort === key,
2388
+ "data-on": sort === key,
2389
+ onClick: () => {
2390
+ setSort(key);
2391
+ setMenuOpen(false);
2392
+ },
2393
+ children: [
2394
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "skw-menu-tick", "aria-hidden": "true", children: sort === key ? "\u2713" : "" }),
2395
+ key === "pinned" ? t("sortPinned") : key === "created" ? t("sortCreated") : t("sortUpdated")
2396
+ ]
2397
+ },
2398
+ key
2399
+ )),
2400
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "skw-menu-rule", role: "separator" }),
2401
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2402
+ "button",
2403
+ {
2404
+ type: "button",
2405
+ role: "menuitemcheckbox",
2406
+ "aria-checked": showArchived,
2407
+ "data-on": showArchived,
2408
+ onClick: () => setShowArchived((value) => !value),
2409
+ children: [
2410
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "skw-menu-tick", "aria-hidden": "true", children: showArchived ? "\u2713" : "" }),
2411
+ showArchived ? t("hideArchived") : t("showArchived")
2412
+ ]
2413
+ }
2414
+ ),
2415
+ archivedCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2416
+ "button",
2417
+ {
2418
+ type: "button",
2419
+ role: "menuitem",
2420
+ className: "skw-menu-danger",
2421
+ disabled: busy,
2422
+ onClick: () => {
2423
+ setMenuOpen(false);
2424
+ setConfirming("clear");
2425
+ },
2426
+ children: [
2427
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "skw-menu-tick", "aria-hidden": "true" }),
2428
+ t("clearArchived")
2429
+ ]
2430
+ }
2431
+ )
2432
+ ] })
1836
2433
  ] }),
1837
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { className: "skw-camera-btn", type: "button", "aria-label": t("zoomIn"), onClick: () => zoomTo(zoom + 0.15), children: "+" }),
1838
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { className: "skw-camera-btn", type: "button", "aria-label": t("zoomReset"), onClick: resetView, children: "\u2316" })
2434
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "skw-count", children: t("count", { count: visible.length }) }),
2435
+ /* @__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: "+" })
1839
2436
  ] }),
1840
2437
  draft && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1841
2438
  Composer,