@skillre/dsh-plugin-sticky-wall 0.4.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/README.en.md +7 -4
- package/README.md +7 -4
- package/compatibility.json +8 -3
- package/docs/preview.svg +31 -24
- package/docs/preview.zh.svg +30 -23
- package/lib/client.js +512 -94
- package/lib/layout.d.ts +105 -11
- package/lib/layout.js +476 -88
- package/lib/store.d.ts +16 -4
- package/lib/store.js +32 -11
- package/lib/transport.d.ts +7 -2
- package/lib/transport.js +17 -3
- package/lib/types.d.ts +25 -6
- package/lib/types.js +13 -6
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -62,7 +62,7 @@ window.__ModuleLoader__.load({
|
|
|
62
62
|
md: 222,
|
|
63
63
|
lg: 276
|
|
64
64
|
});
|
|
65
|
-
var
|
|
65
|
+
var CENTRE_RESERVE = Object.freeze({ halfWidth: 330, halfHeight: 136 });
|
|
66
66
|
var LAYOUT_LIMITS = Object.freeze({
|
|
67
67
|
/** Absolute value of x and y, in world pixels. */
|
|
68
68
|
coord: 2e4,
|
|
@@ -94,8 +94,11 @@ window.__ModuleLoader__.load({
|
|
|
94
94
|
const value = await call({ action: "list", includeArchived, sort }, signal);
|
|
95
95
|
return Array.isArray(value?.notes) ? value.notes : [];
|
|
96
96
|
},
|
|
97
|
-
async create(input, signal) {
|
|
98
|
-
const value = await call(
|
|
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
|
+
);
|
|
99
102
|
const note = value?.changed?.[0];
|
|
100
103
|
if (!note) throw new ActionError("invalid-response", "The Host created no note.");
|
|
101
104
|
return note;
|
|
@@ -124,8 +127,11 @@ window.__ModuleLoader__.load({
|
|
|
124
127
|
if (!note) throw new ActionError("invalid-response", "The Host moved no note.");
|
|
125
128
|
return note;
|
|
126
129
|
},
|
|
127
|
-
async arrange(signal) {
|
|
128
|
-
const value = await call(
|
|
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
|
+
);
|
|
129
135
|
return Array.isArray(value?.changed) ? value.changed : [];
|
|
130
136
|
}
|
|
131
137
|
};
|
|
@@ -154,6 +160,7 @@ window.__ModuleLoader__.load({
|
|
|
154
160
|
"confirmDelete": "\u786E\u5B9A\u5220\u9664\u9009\u4E2D\u7684\u4FBF\u7B7E\uFF1F",
|
|
155
161
|
"showArchived": "\u663E\u793A\u5F52\u6863",
|
|
156
162
|
"hideArchived": "\u9690\u85CF\u5F52\u6863",
|
|
163
|
+
"sortLabel": "\u6392\u5E8F",
|
|
157
164
|
"sortPinned": "\u7F6E\u9876\u4F18\u5148",
|
|
158
165
|
"sortCreated": "\u6309\u521B\u5EFA",
|
|
159
166
|
"sortUpdated": "\u6309\u66F4\u65B0",
|
|
@@ -226,6 +233,7 @@ window.__ModuleLoader__.load({
|
|
|
226
233
|
"confirmDelete": "Delete the selected notes?",
|
|
227
234
|
"showArchived": "Show archived",
|
|
228
235
|
"hideArchived": "Hide archived",
|
|
236
|
+
"sortLabel": "Sort",
|
|
229
237
|
"sortPinned": "Pinned first",
|
|
230
238
|
"sortCreated": "By created",
|
|
231
239
|
"sortUpdated": "By updated",
|
|
@@ -360,7 +368,9 @@ window.__ModuleLoader__.load({
|
|
|
360
368
|
}
|
|
361
369
|
function previewLayout(note, index) {
|
|
362
370
|
const width = previewWidth(note.id);
|
|
363
|
-
const
|
|
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);
|
|
364
374
|
const theta = index * GOLDEN_ANGLE + (unit(`${note.id}:pa`) - 0.5) * 0.55;
|
|
365
375
|
return clampLayout({
|
|
366
376
|
x: Math.cos(theta) * radius - WIDTH_PX[width] / 2,
|
|
@@ -375,6 +385,37 @@ window.__ModuleLoader__.load({
|
|
|
375
385
|
const sin = Math.sin(radians);
|
|
376
386
|
return { width: width * cos + height * sin, height: height * cos + width * sin };
|
|
377
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
|
+
}
|
|
378
419
|
|
|
379
420
|
// src/client/markdown.tsx
|
|
380
421
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -603,16 +644,7 @@ window.__ModuleLoader__.load({
|
|
|
603
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; }
|
|
604
645
|
.skw-seg button:hover { background: var(--dsw-alias-bg-layer-2); color: var(--dsw-alias-label-primary); }
|
|
605
646
|
.skw-seg button[data-on="true"] { background: var(--dsw-alias-label-primary); color: var(--dsw-alias-bg-base); font-weight: 550; }
|
|
606
|
-
@media (max-width: 1180px) {
|
|
607
|
-
/* Narrow window: keep the row, drop the least-used groups' labels down a step. */
|
|
608
|
-
.skw-dock { gap: 6px; padding: 5px 6px; }
|
|
609
|
-
.skw-seg button { padding: 0 7px; font-size: 11.5px; }
|
|
610
|
-
}
|
|
611
647
|
.skw-seg button:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: 1px; }
|
|
612
|
-
.skw-toggle { height: 28px; padding: 0 9px; 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; }
|
|
613
|
-
.skw-toggle:hover { color: var(--dsw-alias-label-primary); border-color: var(--dsw-alias-border-l4); }
|
|
614
|
-
.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); }
|
|
615
|
-
.skw-toggle:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: 1px; }
|
|
616
648
|
.skw-count { font-size: 11.5px; color: var(--dsw-alias-label-tertiary); font-variant-numeric: tabular-nums; white-space: nowrap; padding: 0 4px; }
|
|
617
649
|
|
|
618
650
|
.skw-body { flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 18px 22px 118px; }
|
|
@@ -698,6 +730,38 @@ window.__ModuleLoader__.load({
|
|
|
698
730
|
contain: layout paint;
|
|
699
731
|
}
|
|
700
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
|
+
|
|
701
765
|
/* The hover lift belongs to the grid view only. On the canvas the card already
|
|
702
766
|
has a stored position, and a translateY(-2px) here would fight the drag's
|
|
703
767
|
own transform (the two rules would overwrite each other). */
|
|
@@ -727,50 +791,109 @@ window.__ModuleLoader__.load({
|
|
|
727
791
|
.skw-row[data-color="orange"] { --skw-note-accent: #e79a4e; }
|
|
728
792
|
|
|
729
793
|
/* The floating dock.
|
|
730
|
-
One
|
|
731
|
-
window, and the controls sit where the pointer already is after a drag.
|
|
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. */
|
|
732
801
|
.skw-dock {
|
|
733
|
-
position: absolute; left: 50%; bottom:
|
|
734
|
-
max-width: calc(100% -
|
|
735
|
-
display: flex; align-items: center; gap:
|
|
736
|
-
padding: 6px
|
|
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;
|
|
737
806
|
border: 1px solid var(--dsw-alias-border-l2);
|
|
738
|
-
background: color-mix(in srgb, var(--dsw-alias-bg-layer-1)
|
|
739
|
-
backdrop-filter: blur(
|
|
740
|
-
box-shadow: 0 8px
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
.skw-dock-
|
|
746
|
-
.skw-dock
|
|
747
|
-
.skw-
|
|
748
|
-
.skw-
|
|
749
|
-
height: 28px; padding: 0
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
.skw-
|
|
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;
|
|
839
|
+
}
|
|
840
|
+
.skw-dock-zoom { display: flex; align-items: center; gap: 0; flex: none; }
|
|
841
|
+
.skw-camera-btn {
|
|
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;
|
|
845
|
+
}
|
|
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; }
|
|
849
|
+
.skw-camera-btn:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: 1px; }
|
|
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; }
|
|
754
860
|
/* The one filled control: creating a note is the primary action. */
|
|
755
861
|
.skw-dock-new {
|
|
756
|
-
width:
|
|
862
|
+
width: 30px; height: 30px; flex: none; display: inline-flex; align-items: center; justify-content: center;
|
|
757
863
|
border: 0; border-radius: 50%; background: var(--dsw-alias-brand-primary);
|
|
758
864
|
color: var(--dsw-alias-label-primary-foreground); cursor: pointer;
|
|
759
|
-
font-size:
|
|
865
|
+
font-size: 18px; line-height: 1; font-weight: 400; padding: 0 0 2px;
|
|
760
866
|
transition: transform .12s ease, filter .12s ease;
|
|
761
867
|
}
|
|
762
868
|
.skw-dock-new:hover { filter: brightness(1.08); transform: scale(1.06); }
|
|
763
869
|
.skw-dock-new:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: 2px; }
|
|
764
870
|
.skw-dock-new[disabled] { opacity: .5; cursor: default; transform: none; }
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
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; }
|
|
774
897
|
|
|
775
898
|
/* The wall's centrepiece: greeting, tally and quick capture.
|
|
776
899
|
Screen space, not world space, so it stays put when the wall pans or zooms.
|
|
@@ -781,6 +904,20 @@ window.__ModuleLoader__.load({
|
|
|
781
904
|
width: min(560px, calc(100% - 48px)); z-index: 10;
|
|
782
905
|
display: flex; flex-direction: column; align-items: center; gap: 8px;
|
|
783
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%);
|
|
784
921
|
}
|
|
785
922
|
.skw-centre-hello {
|
|
786
923
|
margin: 0; font-size: 21px; line-height: 30px; font-weight: 650; letter-spacing: -.3px;
|
|
@@ -1056,6 +1193,8 @@ window.__ModuleLoader__.load({
|
|
|
1056
1193
|
var WIDTH_CYCLE = ["sm", "md", "lg"];
|
|
1057
1194
|
var DOT_PITCH = 22;
|
|
1058
1195
|
var WHEEL_PAN = 1;
|
|
1196
|
+
var REVEAL_MS = 340;
|
|
1197
|
+
var ARRIVAL_MS = 900;
|
|
1059
1198
|
function SidebarGlyph({ size = 18 }) {
|
|
1060
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: [
|
|
1061
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" }),
|
|
@@ -1283,7 +1422,8 @@ window.__ModuleLoader__.load({
|
|
|
1283
1422
|
surface,
|
|
1284
1423
|
t,
|
|
1285
1424
|
locale,
|
|
1286
|
-
actions
|
|
1425
|
+
actions,
|
|
1426
|
+
arrived = false
|
|
1287
1427
|
}) {
|
|
1288
1428
|
const layout = layoutOf(note, index);
|
|
1289
1429
|
const style = surface === "canvas" ? {
|
|
@@ -1309,6 +1449,7 @@ window.__ModuleLoader__.load({
|
|
|
1309
1449
|
"data-pinned": note.pinned,
|
|
1310
1450
|
"data-archived": note.archived,
|
|
1311
1451
|
"data-width": layout.width,
|
|
1452
|
+
"data-arrived": arrived,
|
|
1312
1453
|
style,
|
|
1313
1454
|
"aria-label": note.title || note.body.slice(0, 40),
|
|
1314
1455
|
tabIndex: 0,
|
|
@@ -1433,6 +1574,8 @@ window.__ModuleLoader__.load({
|
|
|
1433
1574
|
const [zoom, setZoom] = (0, import_react.useState)(1);
|
|
1434
1575
|
const [viewportTick, setViewportTick] = (0, import_react.useState)(0);
|
|
1435
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);
|
|
1436
1579
|
const [, setLocaleRevision] = (0, import_react.useState)(0);
|
|
1437
1580
|
const alive = (0, import_react.useRef)(true);
|
|
1438
1581
|
const life = (0, import_react.useRef)(new AbortController());
|
|
@@ -1440,6 +1583,9 @@ window.__ModuleLoader__.load({
|
|
|
1440
1583
|
const inFlight = (0, import_react.useRef)(false);
|
|
1441
1584
|
const viewportRefCurrent = (0, import_react.useRef)(null);
|
|
1442
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);
|
|
1443
1589
|
const detachWheel = (0, import_react.useRef)(null);
|
|
1444
1590
|
const camera = (0, import_react.useRef)({ zoom: 1, panX: 0, panY: 0 });
|
|
1445
1591
|
const centreRequest = (0, import_react.useRef)(true);
|
|
@@ -1463,6 +1609,23 @@ window.__ModuleLoader__.load({
|
|
|
1463
1609
|
});
|
|
1464
1610
|
return unsubscribe;
|
|
1465
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]);
|
|
1466
1629
|
const reload = (0, import_react.useMemo)(() => async (options) => {
|
|
1467
1630
|
const seq = ++sequence.current;
|
|
1468
1631
|
setLoading(true);
|
|
@@ -1510,7 +1673,7 @@ window.__ModuleLoader__.load({
|
|
|
1510
1673
|
}
|
|
1511
1674
|
async function tidyWall() {
|
|
1512
1675
|
const ran = await mutate(async () => {
|
|
1513
|
-
await api.arrange(life.current.signal);
|
|
1676
|
+
await api.arrange(life.current.signal, { centreReserve: centreReserve() });
|
|
1514
1677
|
});
|
|
1515
1678
|
if (!ran) return;
|
|
1516
1679
|
await new Promise((resolve) => {
|
|
@@ -1535,7 +1698,13 @@ window.__ModuleLoader__.load({
|
|
|
1535
1698
|
await mutate(async () => {
|
|
1536
1699
|
const tags = parseTags(draft.tags);
|
|
1537
1700
|
if (draft.id === null) {
|
|
1538
|
-
await api.create(
|
|
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);
|
|
1539
1708
|
} else {
|
|
1540
1709
|
await api.update(draft.id, { body, title: draft.title.trim(), tags, color: draft.color }, life.current.signal);
|
|
1541
1710
|
const current = notes.find((note) => note.id === draft.id);
|
|
@@ -1607,20 +1776,73 @@ window.__ModuleLoader__.load({
|
|
|
1607
1776
|
const world = worldRef.current;
|
|
1608
1777
|
const viewport = viewportRefCurrent.current;
|
|
1609
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
|
+
}
|
|
1610
1784
|
if (viewport !== null) {
|
|
1611
1785
|
viewport.style.backgroundSize = `${DOT_PITCH * current.zoom}px ${DOT_PITCH * current.zoom}px`;
|
|
1612
1786
|
viewport.style.backgroundPosition = `${current.panX}px ${current.panY}px`;
|
|
1613
1787
|
}
|
|
1614
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]);
|
|
1615
1834
|
const centreOn = (0, import_react.useCallback)((worldX, worldY) => {
|
|
1835
|
+
stopTween();
|
|
1616
1836
|
const viewport = viewportRefCurrent.current;
|
|
1617
1837
|
const current = camera.current;
|
|
1618
1838
|
if (viewport !== null) {
|
|
1839
|
+
const dock = dockRef.current;
|
|
1840
|
+
const bottomInset = dock === null ? 0 : dock.offsetHeight + 24;
|
|
1619
1841
|
current.panX = viewport.clientWidth / 2 - worldX * current.zoom;
|
|
1620
|
-
current.panY = viewport.clientHeight / 2 - worldY * current.zoom;
|
|
1842
|
+
current.panY = (viewport.clientHeight - bottomInset) / 2 - worldY * current.zoom;
|
|
1621
1843
|
}
|
|
1622
1844
|
applyCamera();
|
|
1623
|
-
}, [applyCamera]);
|
|
1845
|
+
}, [applyCamera, stopTween]);
|
|
1624
1846
|
(0, import_react.useEffect)(() => {
|
|
1625
1847
|
if (hasNotes) centreRequest.current = true;
|
|
1626
1848
|
setViewportTick((value) => value + 1);
|
|
@@ -1674,11 +1896,14 @@ window.__ModuleLoader__.load({
|
|
|
1674
1896
|
const centreX = measured ? (minX + maxX) / 2 : bounds.centre.x;
|
|
1675
1897
|
const centreY = measured ? (minY + maxY) / 2 : bounds.centre.y;
|
|
1676
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);
|
|
1677
1902
|
const fit = Math.min(
|
|
1678
1903
|
(availableWidth - margin * 2) / Math.max(1, boxWidth),
|
|
1679
|
-
|
|
1904
|
+
usableHeight / Math.max(1, boxHeight)
|
|
1680
1905
|
);
|
|
1681
|
-
const FIT_FLOOR = 0.
|
|
1906
|
+
const FIT_FLOOR = 0.42;
|
|
1682
1907
|
const target = clampZoom(Math.min(1, Math.max(FIT_FLOOR, fit)));
|
|
1683
1908
|
camera.current.zoom = target;
|
|
1684
1909
|
setZoom(target);
|
|
@@ -1687,6 +1912,47 @@ window.__ModuleLoader__.load({
|
|
|
1687
1912
|
const resetView = (0, import_react.useCallback)(() => {
|
|
1688
1913
|
fitWall();
|
|
1689
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]);
|
|
1690
1956
|
const onWheel = (0, import_react.useCallback)((event) => {
|
|
1691
1957
|
const node = viewportRefCurrent.current;
|
|
1692
1958
|
if (node === null) return;
|
|
@@ -1743,6 +2009,7 @@ window.__ModuleLoader__.load({
|
|
|
1743
2009
|
node.setAttribute("data-dragging", "true");
|
|
1744
2010
|
drag.current = {
|
|
1745
2011
|
id: note.id,
|
|
2012
|
+
note,
|
|
1746
2013
|
pointerId: event.pointerId,
|
|
1747
2014
|
node,
|
|
1748
2015
|
startX: event.clientX,
|
|
@@ -1852,7 +2119,11 @@ window.__ModuleLoader__.load({
|
|
|
1852
2119
|
}
|
|
1853
2120
|
const dx = (current.lastX - current.startX) / zoomNow;
|
|
1854
2121
|
const dy = (current.lastY - current.startY) / zoomNow;
|
|
1855
|
-
const layout =
|
|
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
|
+
);
|
|
1856
2127
|
if (node !== null) {
|
|
1857
2128
|
node.removeAttribute("data-dragging");
|
|
1858
2129
|
node.style.transform = `rotate(${current.rotate}deg)`;
|
|
@@ -1918,8 +2189,20 @@ window.__ModuleLoader__.load({
|
|
|
1918
2189
|
visible.map((note) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(NoteCard, { note, index: indexOf(note), surface: "grid", t, locale: activeLocale, actions }, note.id)),
|
|
1919
2190
|
visible.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "skw-list-empty", children: emptyCopy })
|
|
1920
2191
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { ref: bindViewport, className: "skw-canvas", "data-zoomed": zoom !== 1, onPointerDown: startPan, children: [
|
|
1921
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { ref: worldRef, className: "skw-world", children: visible.map((note) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1922
|
-
|
|
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,
|
|
2194
|
+
{
|
|
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: [
|
|
1923
2206
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "skw-centre-hello", children: greeting }),
|
|
1924
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 }) }),
|
|
1925
2208
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
@@ -1931,7 +2214,9 @@ window.__ModuleLoader__.load({
|
|
|
1931
2214
|
const body = capture.trim();
|
|
1932
2215
|
if (body === "" || busy) return;
|
|
1933
2216
|
void mutate(async () => {
|
|
1934
|
-
await api.create({ body }, life.current.signal);
|
|
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);
|
|
1935
2220
|
setCapture("");
|
|
1936
2221
|
});
|
|
1937
2222
|
},
|
|
@@ -1955,8 +2240,8 @@ window.__ModuleLoader__.load({
|
|
|
1955
2240
|
] })
|
|
1956
2241
|
] })
|
|
1957
2242
|
] }),
|
|
1958
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "skw-dock", role: "toolbar", "aria-label": t("title"), children: [
|
|
1959
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.
|
|
2243
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "skw-dock", ref: dockRef, role: "toolbar", "aria-label": t("title"), children: [
|
|
2244
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "skw-search-wrap", children: [
|
|
1960
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: [
|
|
1961
2246
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("circle", { cx: "10.5", cy: "10.5", r: "6.2", stroke: "currentColor", strokeWidth: "1.8" }),
|
|
1962
2247
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M15.4 15.4L20 20", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round" })
|
|
@@ -1972,49 +2257,182 @@ window.__ModuleLoader__.load({
|
|
|
1972
2257
|
onChange: (event) => setQuery(event.target.value)
|
|
1973
2258
|
}
|
|
1974
2259
|
)
|
|
1975
|
-
] }) }),
|
|
1976
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "skw-dock-group", children: [
|
|
1977
|
-
/* @__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)) }),
|
|
1978
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1979
|
-
"button",
|
|
1980
|
-
{
|
|
1981
|
-
className: "skw-toggle",
|
|
1982
|
-
type: "button",
|
|
1983
|
-
"data-on": showArchived,
|
|
1984
|
-
"aria-pressed": showArchived,
|
|
1985
|
-
onClick: () => setShowArchived((value) => !value),
|
|
1986
|
-
children: showArchived ? t("hideArchived") : t("showArchived")
|
|
1987
|
-
}
|
|
1988
|
-
)
|
|
1989
2260
|
] }),
|
|
1990
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.
|
|
1991
|
-
|
|
1992
|
-
|
|
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)(
|
|
2263
|
+
"button",
|
|
2264
|
+
{
|
|
2265
|
+
type: "button",
|
|
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
|
+
] })
|
|
1993
2359
|
] }),
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "skw-camera-value", children: [
|
|
1997
|
-
Math.round(zoom * 100),
|
|
1998
|
-
"%"
|
|
1999
|
-
] }),
|
|
2000
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { className: "skw-camera-btn", type: "button", "aria-label": t("zoomIn"), onClick: () => zoomTo(zoom + 0.15), children: "+" }),
|
|
2001
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { className: "skw-camera-btn", type: "button", "aria-label": t("zoomReset"), onClick: resetView, children: "\u2316" }),
|
|
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: [
|
|
2002
2362
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2003
2363
|
"button",
|
|
2004
2364
|
{
|
|
2005
2365
|
className: "skw-camera-btn",
|
|
2006
2366
|
type: "button",
|
|
2007
|
-
"
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
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
|
+
] })
|
|
2012
2378
|
}
|
|
2013
|
-
)
|
|
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
|
+
] })
|
|
2014
2433
|
] }),
|
|
2015
|
-
archivedCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { className: "skw-dock-quiet", type: "button", onClick: () => setConfirming("clear"), disabled: busy, children: t("clearArchived") }),
|
|
2016
2434
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "skw-count", children: t("count", { count: visible.length }) }),
|
|
2017
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { className: "skw-dock-new", type: "button", onClick: () => openComposer(), disabled: busy, "aria-label": t("new"), children: "+" })
|
|
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: "+" })
|
|
2018
2436
|
] }),
|
|
2019
2437
|
draft && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2020
2438
|
Composer,
|