@skillre/dsh-plugin-sticky-wall 0.8.0 → 0.9.1

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
@@ -261,7 +261,11 @@ window.__ModuleLoader__.load({
261
261
  // never a silent loss.
262
262
  "discardDraft": "\u653E\u5F03\u672A\u4FDD\u5B58\u7684\u5185\u5BB9\uFF1F",
263
263
  "keepEditing": "\u7EE7\u7EED\u7F16\u8F91",
264
- "discard": "\u653E\u5F03"
264
+ "discard": "\u653E\u5F03",
265
+ // The composer sheet is resizable; the grip needs a name for screen readers
266
+ // and a hint for everyone else.
267
+ "resizeSheet": "\u8C03\u6574\u4FBF\u7B7E\u7EB8\u5927\u5C0F",
268
+ "resizeSheetHint": "\u62D6\u52A8\u8C03\u6574\u5927\u5C0F \xB7 \u65B9\u5411\u952E\u5FAE\u8C03\uFF08Shift \u52A0\u5927\u6B65\u957F\uFF09\xB7 0 \u6216\u53CC\u51FB\u6062\u590D\u9ED8\u8BA4"
265
269
  };
266
270
  var en = {
267
271
  "nav": "Notes",
@@ -359,11 +363,13 @@ window.__ModuleLoader__.load({
359
363
  "longNote": "Long note",
360
364
  "discardDraft": "Discard unsaved changes?",
361
365
  "keepEditing": "Keep editing",
362
- "discard": "Discard"
366
+ "discard": "Discard",
367
+ "resizeSheet": "Resize note sheet",
368
+ "resizeSheetHint": "Drag to resize \xB7 Arrow keys to fine-tune (Shift for a bigger step) \xB7 0 or double-click to reset"
363
369
  };
364
370
 
365
371
  // src/client/view.tsx
366
- var import_react2 = require("react");
372
+ var import_react3 = require("react");
367
373
 
368
374
  // src/layout.ts
369
375
  var GOLDEN_ANGLE = Math.PI * (3 - Math.sqrt(5));
@@ -1023,6 +1029,7 @@ window.__ModuleLoader__.load({
1023
1029
  label,
1024
1030
  toolbar = true,
1025
1031
  autoFocus = true,
1032
+ fill = false,
1026
1033
  disabled = false,
1027
1034
  locale = "zh"
1028
1035
  } = props;
@@ -1085,6 +1092,11 @@ window.__ModuleLoader__.load({
1085
1092
  const measure = (0, import_react.useCallback)(() => {
1086
1093
  const node = areaRef.current;
1087
1094
  if (node === null) return;
1095
+ if (fill) {
1096
+ node.style.height = "";
1097
+ node.style.overflowY = "";
1098
+ return;
1099
+ }
1088
1100
  const view = node.ownerDocument.defaultView;
1089
1101
  const cap = Math.max(MIN_HEIGHT_PX, Math.round((view === null ? 0 : view.innerHeight) * VIEWPORT_SHARE));
1090
1102
  node.style.height = "auto";
@@ -1092,13 +1104,13 @@ window.__ModuleLoader__.load({
1092
1104
  const wanted = node.scrollHeight + border;
1093
1105
  node.style.height = `${Math.min(Math.max(wanted, MIN_HEIGHT_PX), cap)}px`;
1094
1106
  node.style.overflowY = wanted > cap ? "auto" : "hidden";
1095
- }, []);
1107
+ }, [fill]);
1096
1108
  (0, import_react.useLayoutEffect)(() => {
1097
1109
  measure();
1098
1110
  }, [measure, value, disabled]);
1099
1111
  (0, import_react.useEffect)(() => {
1100
1112
  const node = areaRef.current;
1101
- if (node === null) return;
1113
+ if (node === null || fill) return;
1102
1114
  let lastWidth = 0;
1103
1115
  const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver((entries) => {
1104
1116
  const width = Math.round(entries[0]?.contentRect.width ?? 0);
@@ -1112,7 +1124,7 @@ window.__ModuleLoader__.load({
1112
1124
  observer?.disconnect();
1113
1125
  window.removeEventListener("resize", measure);
1114
1126
  };
1115
- }, [measure]);
1127
+ }, [fill, measure]);
1116
1128
  (0, import_react.useLayoutEffect)(() => {
1117
1129
  if (!autoFocus) return;
1118
1130
  const node = areaRef.current;
@@ -1185,7 +1197,7 @@ window.__ModuleLoader__.load({
1185
1197
  if (node === null) return;
1186
1198
  commit(action.run({ value, start: node.selectionStart, end: node.selectionEnd, locale }));
1187
1199
  }
1188
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "skw-ed-root", "data-disabled": disabled ? "true" : void 0, children: [
1200
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "skw-ed-root", "data-disabled": disabled ? "true" : void 0, "data-fill": fill ? "true" : void 0, children: [
1189
1201
  toolbar && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1190
1202
  "div",
1191
1203
  {
@@ -1236,6 +1248,10 @@ window.__ModuleLoader__.load({
1236
1248
  .skw-ed-root { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
1237
1249
  .skw-ed-root *, .skw-ed-root *::before, .skw-ed-root *::after { box-sizing: border-box; }
1238
1250
  .skw-ed-root[data-disabled="true"] { opacity: .7; }
1251
+ /* Fill mode: the sheet gives the editor a box and the editor fills it, so a
1252
+ taller sheet means more visible text instead of more empty sheet. */
1253
+ .skw-ed-root[data-fill="true"] { flex: 1 1 auto; min-height: 0; }
1254
+ .skw-ed-root[data-fill="true"] .skw-ed-input { flex: 1 1 auto; min-height: 96px; }
1239
1255
  .skw-ed-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 1px; padding: 2px; border: 1px solid var(--dsw-alias-border-l2); border-radius: 8px; background: var(--dsw-alias-bg-layer-1); }
1240
1256
  .skw-ed-group { display: inline-flex; align-items: center; gap: 1px; padding: 0 2px; }
1241
1257
  .skw-ed-group + .skw-ed-group { border-left: 1px solid var(--dsw-alias-border-l1); }
@@ -1252,6 +1268,223 @@ window.__ModuleLoader__.load({
1252
1268
  .skw-ed-input:disabled { opacity: .7; }
1253
1269
  `;
1254
1270
 
1271
+ // src/client/use-sheet-size.ts
1272
+ var import_react2 = require("react");
1273
+
1274
+ // src/client/sheet-size.ts
1275
+ var SHEET_DEFAULT = { width: 880, height: 680 };
1276
+ var SHEET_MIN = { width: 460, height: 380 };
1277
+ var SHEET_MARGIN = 24;
1278
+ var SHEET_STORAGE_KEY = "skillre-sticky-wall.sheet-size";
1279
+ var SHEET_KEY_STEP = 16;
1280
+ var SHEET_KEY_STEP_LARGE = 64;
1281
+ function clampAxis(value, min, max) {
1282
+ const hi = Number.isFinite(max) ? Math.max(1, Math.round(max)) : Math.max(1, Math.round(min));
1283
+ const lo = Math.min(Math.round(min), hi);
1284
+ if (Number.isNaN(value)) return lo;
1285
+ if (value === Number.POSITIVE_INFINITY) return hi;
1286
+ if (value === Number.NEGATIVE_INFINITY) return lo;
1287
+ return Math.min(hi, Math.max(lo, Math.round(value)));
1288
+ }
1289
+ function clampSheetSize(size, viewport) {
1290
+ return {
1291
+ width: clampAxis(size.width, SHEET_MIN.width, viewport.width - SHEET_MARGIN * 2),
1292
+ height: clampAxis(size.height, SHEET_MIN.height, viewport.height - SHEET_MARGIN * 2)
1293
+ };
1294
+ }
1295
+ function resizeSheet(start, delta, viewport) {
1296
+ return clampSheetSize({ width: start.width + delta.dx, height: start.height + delta.dy }, viewport);
1297
+ }
1298
+ function mergePreference(previous, applied, next) {
1299
+ return {
1300
+ width: next.width === applied.width ? previous.width : next.width,
1301
+ height: next.height === applied.height ? previous.height : next.height
1302
+ };
1303
+ }
1304
+ function arrowDelta(key, large) {
1305
+ const step = large ? SHEET_KEY_STEP_LARGE : SHEET_KEY_STEP;
1306
+ switch (key) {
1307
+ case "ArrowLeft":
1308
+ return { dx: -step, dy: 0 };
1309
+ case "ArrowRight":
1310
+ return { dx: step, dy: 0 };
1311
+ case "ArrowUp":
1312
+ return { dx: 0, dy: -step };
1313
+ case "ArrowDown":
1314
+ return { dx: 0, dy: step };
1315
+ default:
1316
+ return null;
1317
+ }
1318
+ }
1319
+ function parseSheetSize(raw) {
1320
+ if (raw === null) return null;
1321
+ const text = raw.trim();
1322
+ if (text === "") return null;
1323
+ let parsed;
1324
+ try {
1325
+ parsed = JSON.parse(text);
1326
+ } catch {
1327
+ return null;
1328
+ }
1329
+ if (typeof parsed !== "object" || parsed === null) return null;
1330
+ const record = parsed;
1331
+ const width = record.width;
1332
+ const height = record.height;
1333
+ if (typeof width !== "number" || typeof height !== "number") return null;
1334
+ if (!Number.isFinite(width) || !Number.isFinite(height)) return null;
1335
+ if (width <= 0 || height <= 0) return null;
1336
+ return { width: Math.round(width), height: Math.round(height) };
1337
+ }
1338
+ function serializeSheetSize(size) {
1339
+ return JSON.stringify({ width: Math.round(size.width), height: Math.round(size.height) });
1340
+ }
1341
+ function readSheetSize(storage) {
1342
+ if (storage === null || storage === void 0) return null;
1343
+ try {
1344
+ return parseSheetSize(storage.getItem(SHEET_STORAGE_KEY));
1345
+ } catch {
1346
+ return null;
1347
+ }
1348
+ }
1349
+ function writeSheetSize(storage, size) {
1350
+ if (storage === null || storage === void 0) return;
1351
+ try {
1352
+ storage.setItem(SHEET_STORAGE_KEY, serializeSheetSize(size));
1353
+ } catch {
1354
+ }
1355
+ }
1356
+
1357
+ // src/client/use-sheet-size.ts
1358
+ function browserStorage() {
1359
+ try {
1360
+ return globalThis.localStorage ?? null;
1361
+ } catch {
1362
+ return null;
1363
+ }
1364
+ }
1365
+ function viewportNow() {
1366
+ const width = typeof globalThis.innerWidth === "number" ? globalThis.innerWidth : 0;
1367
+ const height = typeof globalThis.innerHeight === "number" ? globalThis.innerHeight : 0;
1368
+ return { width: Math.max(1, width), height: Math.max(1, height) };
1369
+ }
1370
+ function useSheetSize() {
1371
+ const [preferred, setPreferred] = (0, import_react2.useState)(() => readSheetSize(browserStorage()) ?? { ...SHEET_DEFAULT });
1372
+ const [viewport, setViewport] = (0, import_react2.useState)(viewportNow);
1373
+ const latest = (0, import_react2.useRef)({ preferred, viewport });
1374
+ latest.current = { preferred, viewport };
1375
+ const storage = (0, import_react2.useRef)(null);
1376
+ storage.current ??= browserStorage();
1377
+ const persist = (0, import_react2.useCallback)((size) => {
1378
+ writeSheetSize(storage.current, size);
1379
+ }, []);
1380
+ const commit = (0, import_react2.useCallback)(
1381
+ (size) => {
1382
+ latest.current = { ...latest.current, preferred: size };
1383
+ setPreferred(size);
1384
+ persist(size);
1385
+ },
1386
+ [persist]
1387
+ );
1388
+ const reset = (0, import_react2.useCallback)(() => {
1389
+ commit({ ...SHEET_DEFAULT });
1390
+ }, [commit]);
1391
+ (0, import_react2.useLayoutEffect)(() => {
1392
+ const sync = () => {
1393
+ const next = viewportNow();
1394
+ const current = latest.current.viewport;
1395
+ if (next.width === current.width && next.height === current.height) return;
1396
+ latest.current = { ...latest.current, viewport: next };
1397
+ setViewport(next);
1398
+ };
1399
+ globalThis.addEventListener?.("resize", sync);
1400
+ return () => {
1401
+ globalThis.removeEventListener?.("resize", sync);
1402
+ };
1403
+ }, []);
1404
+ const drag = (0, import_react2.useRef)(null);
1405
+ const onPointerDown = (0, import_react2.useCallback)((event) => {
1406
+ if (event.button !== 0) return;
1407
+ event.preventDefault();
1408
+ try {
1409
+ event.currentTarget.focus();
1410
+ } catch {
1411
+ }
1412
+ drag.current = {
1413
+ pointerId: event.pointerId,
1414
+ start: clampSheetSize(latest.current.preferred, latest.current.viewport),
1415
+ startPreference: latest.current.preferred,
1416
+ x: event.clientX,
1417
+ y: event.clientY,
1418
+ moved: false
1419
+ };
1420
+ try {
1421
+ event.currentTarget.setPointerCapture?.(event.pointerId);
1422
+ } catch {
1423
+ }
1424
+ }, []);
1425
+ const onPointerMove = (0, import_react2.useCallback)((event) => {
1426
+ const current = drag.current;
1427
+ if (current === null || current.pointerId !== event.pointerId) return;
1428
+ const dx = event.clientX - current.x;
1429
+ const dy = event.clientY - current.y;
1430
+ if (dx === 0 && dy === 0) return;
1431
+ current.moved = true;
1432
+ const next = resizeSheet(current.start, { dx, dy }, latest.current.viewport);
1433
+ latest.current = { ...latest.current, preferred: next };
1434
+ setPreferred(next);
1435
+ }, []);
1436
+ const finish = (0, import_react2.useCallback)(
1437
+ (event) => {
1438
+ const current = drag.current;
1439
+ if (current === null || current.pointerId !== event.pointerId) return;
1440
+ drag.current = null;
1441
+ try {
1442
+ event.currentTarget.releasePointerCapture?.(current.pointerId);
1443
+ } catch {
1444
+ }
1445
+ if (!current.moved) return;
1446
+ const applied = clampSheetSize(current.startPreference, latest.current.viewport);
1447
+ commit(mergePreference(current.startPreference, applied, latest.current.preferred));
1448
+ },
1449
+ [commit]
1450
+ );
1451
+ const onKeyDown = (0, import_react2.useCallback)(
1452
+ (event) => {
1453
+ if (event.metaKey || event.ctrlKey || event.altKey) return;
1454
+ if (event.repeat) return;
1455
+ if (event.key === "0") {
1456
+ event.preventDefault();
1457
+ event.stopPropagation();
1458
+ reset();
1459
+ return;
1460
+ }
1461
+ const delta = arrowDelta(event.key, event.shiftKey);
1462
+ if (delta === null) return;
1463
+ event.preventDefault();
1464
+ event.stopPropagation();
1465
+ const applied = clampSheetSize(latest.current.preferred, latest.current.viewport);
1466
+ const next = resizeSheet(applied, delta, latest.current.viewport);
1467
+ commit(mergePreference(latest.current.preferred, applied, next));
1468
+ },
1469
+ [commit, reset]
1470
+ );
1471
+ return {
1472
+ size: clampSheetSize(preferred, viewport),
1473
+ bounds: {
1474
+ min: clampSheetSize({ width: 0, height: 0 }, viewport),
1475
+ max: clampSheetSize({ width: Number.POSITIVE_INFINITY, height: Number.POSITIVE_INFINITY }, viewport)
1476
+ },
1477
+ grip: {
1478
+ onPointerDown,
1479
+ onPointerMove,
1480
+ onPointerUp: finish,
1481
+ onPointerCancel: finish,
1482
+ onKeyDown,
1483
+ onDoubleClick: reset
1484
+ }
1485
+ };
1486
+ }
1487
+
1255
1488
  // src/client/styles.ts
1256
1489
  var WALL_CSS = `
1257
1490
  .skw-page {
@@ -1802,7 +2035,44 @@ window.__ModuleLoader__.load({
1802
2035
 
1803
2036
  /* Composer sheet */
1804
2037
  .skw-scrim { position: fixed; inset: 0; background: var(--dsw-alias-bg-mask-2); display: flex; align-items: center; justify-content: center; padding: 24px; z-index: 40; }
1805
- .skw-sheet { width: min(560px, 100%); max-height: 86vh; display: flex; flex-direction: column; border-radius: 12px; border: 1px solid var(--dsw-alias-border-l2); background: var(--dsw-alias-bg-base); box-shadow: 0 12px 40px var(--dsw-alias-bg-mask-3); overflow: hidden; }
2038
+ .skw-sheet { position: relative; width: min(560px, 100%); max-height: 86vh; display: flex; flex-direction: column; border-radius: 12px; border: 1px solid var(--dsw-alias-border-l2); background: var(--dsw-alias-bg-base); box-shadow: 0 12px 40px var(--dsw-alias-bg-mask-3); overflow: hidden; }
2039
+ /* The composer sheet: large by default and sized by the user. These are the
2040
+ FALLBACKS only \u2014 the hook writes an explicit width/height inline, already
2041
+ clamped to the current window. They matter for the one frame before the
2042
+ client script runs, and for a user whose stored size has no viewport to fit.
2043
+ The 48px is SHEET_MARGIN * 2 (24px per side): if the two ever disagree, this
2044
+ max-height silently caps the sheet below the size the hook thinks it has,
2045
+ which shows up as the last few pixels of a downward drag doing nothing. It
2046
+ must stay in step with sheet-size.ts. */
2047
+ .skw-sheet-composer { width: min(880px, 100%); height: min(680px, calc(100vh - 48px)); max-height: calc(100vh - 48px); }
2048
+ /* Fill mode: the sheet's own fields keep their natural height and the editor
2049
+ takes everything left, so a taller sheet means MORE VISIBLE TEXT rather than
2050
+ more empty sheet. */
2051
+ .skw-sheet-body[data-fill="true"] { flex: 1 1 auto; min-height: 0; overflow: auto; }
2052
+ .skw-sheet-body[data-fill="true"] > .skw-input,
2053
+ .skw-sheet-body[data-fill="true"] > .skw-sheet-row { flex: 0 0 auto; }
2054
+ .skw-preview-fill { flex: 1 1 auto; min-height: 96px; max-height: none; }
2055
+ /* A hint exposed to assistive technology only: a title attribute is not an
2056
+ accessible description, so the keyboard contract lives in real DOM text. */
2057
+ .skw-sr-only {
2058
+ position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
2059
+ overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
2060
+ }
2061
+ /* The resize grip: a 22px corner, reachable by pointer, keyboard and double
2062
+ click. touch-action: none is what lets a touch drag resize instead of
2063
+ scrolling the page behind the scrim. */
2064
+ .skw-sheet-grip {
2065
+ position: absolute; right: 2px; bottom: 2px; width: 22px; height: 22px;
2066
+ display: flex; align-items: center; justify-content: center;
2067
+ color: var(--dsw-alias-label-tertiary); cursor: nwse-resize;
2068
+ touch-action: none; border-radius: 4px; user-select: none;
2069
+ }
2070
+ .skw-sheet-grip:hover { color: var(--dsw-alias-label-secondary); }
2071
+ .skw-sheet-grip:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: -2px; color: var(--dsw-alias-label-primary); }
2072
+ /* The footer's buttons must never sit under the grip: the grip is 22px wide at
2073
+ right: 2px, so it occupies the rightmost 24px and 30px leaves 6px of air.
2074
+ Change the grip's size and this number together. */
2075
+ .skw-sheet-composer .skw-sheet-foot { padding-right: 30px; }
1806
2076
  .skw-sheet-head { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--dsw-alias-border-l1); font-weight: 600; }
1807
2077
  .skw-sheet-body { padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; overflow: auto; }
1808
2078
  .skw-input, .skw-textarea { width: 100%; border: 1px solid var(--dsw-alias-border-l2); border-radius: 8px; background: var(--dsw-alias-bg-layer-1); color: var(--dsw-alias-label-primary); padding: 7px 10px; }
@@ -1900,9 +2170,11 @@ window.__ModuleLoader__.load({
1900
2170
  onSave,
1901
2171
  onCancel
1902
2172
  }) {
1903
- const [preview, setPreview] = (0, import_react2.useState)(false);
1904
- const [confirmDiscard, setConfirmDiscard] = (0, import_react2.useState)(false);
1905
- const initial = (0, import_react2.useRef)(JSON.stringify(draft));
2173
+ const [preview, setPreview] = (0, import_react3.useState)(false);
2174
+ const [confirmDiscard, setConfirmDiscard] = (0, import_react3.useState)(false);
2175
+ const sheet = useSheetSize();
2176
+ const hintId = (0, import_react3.useId)();
2177
+ const initial = (0, import_react3.useRef)(JSON.stringify(draft));
1906
2178
  const dirty = JSON.stringify(draft) !== initial.current;
1907
2179
  const requestClose = () => {
1908
2180
  if (busy) return;
@@ -1922,10 +2194,11 @@ window.__ModuleLoader__.load({
1922
2194
  /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
1923
2195
  "div",
1924
2196
  {
1925
- className: "skw-sheet",
2197
+ className: "skw-sheet skw-sheet-composer",
1926
2198
  role: "dialog",
1927
2199
  "aria-modal": "true",
1928
2200
  "aria-label": draft.id ? t("edit") : t("new"),
2201
+ style: { width: `${sheet.size.width}px`, height: `${sheet.size.height}px` },
1929
2202
  onKeyDown: (event) => {
1930
2203
  if (event.repeat) return;
1931
2204
  if (isComposingEvent(event.nativeEvent)) return;
@@ -1936,6 +2209,7 @@ window.__ModuleLoader__.load({
1936
2209
  }
1937
2210
  },
1938
2211
  children: [
2212
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { id: hintId, className: "skw-sr-only", children: t("resizeSheetHint") }),
1939
2213
  /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "skw-sheet-head", children: [
1940
2214
  draft.id ? t("edit") : t("new"),
1941
2215
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "skw-spacer" }),
@@ -1951,7 +2225,7 @@ window.__ModuleLoader__.load({
1951
2225
  }
1952
2226
  )
1953
2227
  ] }),
1954
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "skw-sheet-body", children: [
2228
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "skw-sheet-body", "data-fill": "true", children: [
1955
2229
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1956
2230
  "input",
1957
2231
  {
@@ -1963,10 +2237,11 @@ window.__ModuleLoader__.load({
1963
2237
  "aria-label": t("titlePlaceholder")
1964
2238
  }
1965
2239
  ),
1966
- preview ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "skw-preview-box", children: draft.body.trim() === "" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "skw-preview-empty", children: t("bodyPlaceholder") }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Markdown, { source: draft.body }) }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2240
+ preview ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "skw-preview-box skw-preview-fill", children: draft.body.trim() === "" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "skw-preview-empty", children: t("bodyPlaceholder") }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Markdown, { source: draft.body }) }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1967
2241
  MarkdownEditor,
1968
2242
  {
1969
2243
  value: draft.body,
2244
+ fill: true,
1970
2245
  onChange: (body) => onChange({ body }),
1971
2246
  onSave: save,
1972
2247
  onEscape: requestClose,
@@ -2022,7 +2297,24 @@ window.__ModuleLoader__.load({
2022
2297
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "skw-spacer" }),
2023
2298
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { className: "skw-btn", type: "button", onClick: requestClose, disabled: busy, children: t("cancel") }),
2024
2299
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { className: "skw-btn skw-btn-primary", type: "button", onClick: save, disabled: busy, children: t("save") })
2025
- ] })
2300
+ ] }),
2301
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2302
+ "div",
2303
+ {
2304
+ className: "skw-sheet-grip",
2305
+ role: "separator",
2306
+ "aria-label": t("resizeSheet"),
2307
+ "aria-valuenow": sheet.size.width,
2308
+ "aria-valuemin": sheet.bounds.min.width,
2309
+ "aria-valuemax": sheet.bounds.max.width,
2310
+ "aria-valuetext": `${sheet.size.width}\xD7${sheet.size.height}px`,
2311
+ "aria-describedby": hintId,
2312
+ tabIndex: 0,
2313
+ title: t("resizeSheetHint"),
2314
+ ...sheet.grip,
2315
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { width: "10", height: "10", viewBox: "0 0 10 10", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M9 1 1 9M9 5 5 9", stroke: "currentColor", strokeWidth: "1.2", strokeLinecap: "round" }) })
2316
+ }
2317
+ )
2026
2318
  ]
2027
2319
  }
2028
2320
  ),
@@ -2052,8 +2344,8 @@ window.__ModuleLoader__.load({
2052
2344
  onConfirm,
2053
2345
  onCancel
2054
2346
  }) {
2055
- const cancelRef = (0, import_react2.useRef)(null);
2056
- (0, import_react2.useEffect)(() => {
2347
+ const cancelRef = (0, import_react3.useRef)(null);
2348
+ (0, import_react3.useEffect)(() => {
2057
2349
  const previous = typeof document === "undefined" ? null : document.activeElement;
2058
2350
  cancelRef.current?.focus();
2059
2351
  return () => {
@@ -2097,7 +2389,7 @@ window.__ModuleLoader__.load({
2097
2389
  }
2098
2390
  );
2099
2391
  }
2100
- var NoteCard = (0, import_react2.memo)(function NoteCard2({
2392
+ var NoteCard = (0, import_react3.memo)(function NoteCard2({
2101
2393
  note,
2102
2394
  index,
2103
2395
  surface,
@@ -2243,63 +2535,63 @@ window.__ModuleLoader__.load({
2243
2535
  ] });
2244
2536
  }
2245
2537
  function WallPage({ api, locale, t }) {
2246
- const [notes, setNotes] = (0, import_react2.useState)([]);
2247
- const [filter, setFilter] = (0, import_react2.useState)("all");
2248
- const [sort, setSort] = (0, import_react2.useState)("pinned");
2249
- const [view, setView] = (0, import_react2.useState)("canvas");
2250
- const [query, setQuery] = (0, import_react2.useState)("");
2251
- const [showArchived, setShowArchived] = (0, import_react2.useState)(false);
2252
- const [loading, setLoading] = (0, import_react2.useState)(true);
2253
- const [busy, setBusy] = (0, import_react2.useState)(false);
2254
- const [error, setError] = (0, import_react2.useState)("");
2255
- const [draft, setDraft] = (0, import_react2.useState)(null);
2256
- const [draftError, setDraftError] = (0, import_react2.useState)("");
2257
- const [draftStatus, setDraftStatus] = (0, import_react2.useState)("idle");
2258
- const [notesDir, setNotesDir] = (0, import_react2.useState)("");
2259
- const [confirming, setConfirming] = (0, import_react2.useState)(null);
2260
- const [zoom, setZoom] = (0, import_react2.useState)(1);
2261
- const [viewportTick, setViewportTick] = (0, import_react2.useState)(0);
2262
- const [capture, setCapture] = (0, import_react2.useState)("");
2263
- const [arrivedId, setArrivedId] = (0, import_react2.useState)(null);
2264
- const [menuOpen, setMenuOpen] = (0, import_react2.useState)(false);
2265
- const [, setLocaleRevision] = (0, import_react2.useState)(0);
2266
- const alive = (0, import_react2.useRef)(true);
2267
- const life = (0, import_react2.useRef)(new AbortController());
2268
- const sequence = (0, import_react2.useRef)(0);
2269
- const inFlight = (0, import_react2.useRef)(false);
2270
- const queue = (0, import_react2.useRef)(Promise.resolve());
2271
- const revision = (0, import_react2.useRef)(0);
2272
- const draftOpen = (0, import_react2.useRef)(false);
2273
- const viewportRefCurrent = (0, import_react2.useRef)(null);
2274
- const worldRef = (0, import_react2.useRef)(null);
2275
- const centreRef = (0, import_react2.useRef)(null);
2276
- const menuRef = (0, import_react2.useRef)(null);
2277
- const dockRef = (0, import_react2.useRef)(null);
2278
- const detachWheel = (0, import_react2.useRef)(null);
2279
- const camera = (0, import_react2.useRef)({ zoom: 1, panX: 0, panY: 0 });
2280
- const centreRequest = (0, import_react2.useRef)(true);
2281
- const drag = (0, import_react2.useRef)(null);
2282
- const pan = (0, import_react2.useRef)(null);
2283
- const live = (0, import_react2.useRef)({ mutate: (_run) => {
2538
+ const [notes, setNotes] = (0, import_react3.useState)([]);
2539
+ const [filter, setFilter] = (0, import_react3.useState)("all");
2540
+ const [sort, setSort] = (0, import_react3.useState)("pinned");
2541
+ const [view, setView] = (0, import_react3.useState)("canvas");
2542
+ const [query, setQuery] = (0, import_react3.useState)("");
2543
+ const [showArchived, setShowArchived] = (0, import_react3.useState)(false);
2544
+ const [loading, setLoading] = (0, import_react3.useState)(true);
2545
+ const [busy, setBusy] = (0, import_react3.useState)(false);
2546
+ const [error, setError] = (0, import_react3.useState)("");
2547
+ const [draft, setDraft] = (0, import_react3.useState)(null);
2548
+ const [draftError, setDraftError] = (0, import_react3.useState)("");
2549
+ const [draftStatus, setDraftStatus] = (0, import_react3.useState)("idle");
2550
+ const [notesDir, setNotesDir] = (0, import_react3.useState)("");
2551
+ const [confirming, setConfirming] = (0, import_react3.useState)(null);
2552
+ const [zoom, setZoom] = (0, import_react3.useState)(1);
2553
+ const [viewportTick, setViewportTick] = (0, import_react3.useState)(0);
2554
+ const [capture, setCapture] = (0, import_react3.useState)("");
2555
+ const [arrivedId, setArrivedId] = (0, import_react3.useState)(null);
2556
+ const [menuOpen, setMenuOpen] = (0, import_react3.useState)(false);
2557
+ const [, setLocaleRevision] = (0, import_react3.useState)(0);
2558
+ const alive = (0, import_react3.useRef)(true);
2559
+ const life = (0, import_react3.useRef)(new AbortController());
2560
+ const sequence = (0, import_react3.useRef)(0);
2561
+ const inFlight = (0, import_react3.useRef)(false);
2562
+ const queue = (0, import_react3.useRef)(Promise.resolve());
2563
+ const revision = (0, import_react3.useRef)(0);
2564
+ const draftOpen = (0, import_react3.useRef)(false);
2565
+ const viewportRefCurrent = (0, import_react3.useRef)(null);
2566
+ const worldRef = (0, import_react3.useRef)(null);
2567
+ const centreRef = (0, import_react3.useRef)(null);
2568
+ const menuRef = (0, import_react3.useRef)(null);
2569
+ const dockRef = (0, import_react3.useRef)(null);
2570
+ const detachWheel = (0, import_react3.useRef)(null);
2571
+ const camera = (0, import_react3.useRef)({ zoom: 1, panX: 0, panY: 0 });
2572
+ const centreRequest = (0, import_react3.useRef)(true);
2573
+ const drag = (0, import_react3.useRef)(null);
2574
+ const pan = (0, import_react3.useRef)(null);
2575
+ const live = (0, import_react3.useRef)({ mutate: (_run) => {
2284
2576
  } });
2285
2577
  live.current.mutate = (run) => {
2286
2578
  void mutate(run);
2287
2579
  };
2288
2580
  const activeLocale = locale.getSnapshot().active;
2289
2581
  draftOpen.current = draft !== null;
2290
- const stableIndex = (0, import_react2.useMemo)(() => {
2582
+ const stableIndex = (0, import_react3.useMemo)(() => {
2291
2583
  const map = /* @__PURE__ */ new Map();
2292
2584
  notes.forEach((note, index) => map.set(note.id, index));
2293
2585
  return map;
2294
2586
  }, [notes]);
2295
2587
  const indexOf = (note) => stableIndex.get(note.id) ?? 0;
2296
- (0, import_react2.useEffect)(() => {
2588
+ (0, import_react3.useEffect)(() => {
2297
2589
  const unsubscribe = locale.subscribe(() => {
2298
2590
  if (alive.current) setLocaleRevision((value) => value + 1);
2299
2591
  });
2300
2592
  return unsubscribe;
2301
2593
  }, [locale]);
2302
- (0, import_react2.useEffect)(() => {
2594
+ (0, import_react3.useEffect)(() => {
2303
2595
  if (!menuOpen) return;
2304
2596
  const onPointerDown = (event) => {
2305
2597
  const node = menuRef.current;
@@ -2316,7 +2608,7 @@ window.__ModuleLoader__.load({
2316
2608
  window.removeEventListener("keydown", onKeyDown);
2317
2609
  };
2318
2610
  }, [menuOpen]);
2319
- const reload = (0, import_react2.useMemo)(() => async (options) => {
2611
+ const reload = (0, import_react3.useMemo)(() => async (options) => {
2320
2612
  const seq = ++sequence.current;
2321
2613
  setLoading(true);
2322
2614
  try {
@@ -2334,7 +2626,7 @@ window.__ModuleLoader__.load({
2334
2626
  }
2335
2627
  }, [api, t]);
2336
2628
  const includeArchived = showArchived || filter === "archived";
2337
- (0, import_react2.useEffect)(() => {
2629
+ (0, import_react3.useEffect)(() => {
2338
2630
  alive.current = true;
2339
2631
  life.current = new AbortController();
2340
2632
  void reload({ includeArchived, sort });
@@ -2344,7 +2636,7 @@ window.__ModuleLoader__.load({
2344
2636
  sequence.current += 1;
2345
2637
  };
2346
2638
  }, [reload, includeArchived, sort]);
2347
- (0, import_react2.useEffect)(() => {
2639
+ (0, import_react3.useEffect)(() => {
2348
2640
  let timer = 0;
2349
2641
  const check = async () => {
2350
2642
  if (!alive.current || life.current.signal.aborted) return;
@@ -2455,7 +2747,7 @@ window.__ModuleLoader__.load({
2455
2747
  setDraftStatus("idle");
2456
2748
  });
2457
2749
  }
2458
- const visible = (0, import_react2.useMemo)(() => {
2750
+ const visible = (0, import_react3.useMemo)(() => {
2459
2751
  const needle = query.trim().toLowerCase();
2460
2752
  return notes.filter((note) => {
2461
2753
  if (filter === "archived" && !note.archived) return false;
@@ -2466,13 +2758,13 @@ window.__ModuleLoader__.load({
2466
2758
  });
2467
2759
  }, [notes, filter, query, showArchived]);
2468
2760
  const archivedCount = notes.filter((note) => note.archived).length;
2469
- const greeting = (0, import_react2.useMemo)(() => {
2761
+ const greeting = (0, import_react3.useMemo)(() => {
2470
2762
  const hour = (/* @__PURE__ */ new Date()).getHours();
2471
2763
  const key = hour < 5 ? "greetNight" : hour < 12 ? "greetMorning" : hour < 18 ? "greetAfternoon" : "greetEvening";
2472
2764
  return t(key);
2473
2765
  }, [t, activeLocale]);
2474
2766
  const emptyCopy = filter === "archived" ? t("emptyArchived") : query.trim() !== "" ? t("noResults") : t("empty");
2475
- const wallBounds = (0, import_react2.useMemo)(() => {
2767
+ const wallBounds = (0, import_react3.useMemo)(() => {
2476
2768
  let minX = Number.POSITIVE_INFINITY;
2477
2769
  let minY = Number.POSITIVE_INFINITY;
2478
2770
  let maxX = Number.NEGATIVE_INFINITY;
@@ -2507,10 +2799,10 @@ window.__ModuleLoader__.load({
2507
2799
  };
2508
2800
  }, [visible, stableIndex]);
2509
2801
  const wallCentre = wallBounds.centre;
2510
- const boundsRef = (0, import_react2.useRef)(wallBounds);
2802
+ const boundsRef = (0, import_react3.useRef)(wallBounds);
2511
2803
  boundsRef.current = wallBounds;
2512
2804
  const hasNotes = visible.length > 0;
2513
- const applyCamera = (0, import_react2.useCallback)(() => {
2805
+ const applyCamera = (0, import_react3.useCallback)(() => {
2514
2806
  const current = camera.current;
2515
2807
  const world = worldRef.current;
2516
2808
  const viewport = viewportRefCurrent.current;
@@ -2525,14 +2817,14 @@ window.__ModuleLoader__.load({
2525
2817
  viewport.style.backgroundPosition = `${current.panX}px ${current.panY}px`;
2526
2818
  }
2527
2819
  }, []);
2528
- const tween = (0, import_react2.useRef)(0);
2529
- const stopTween = (0, import_react2.useCallback)(() => {
2820
+ const tween = (0, import_react3.useRef)(0);
2821
+ const stopTween = (0, import_react3.useCallback)(() => {
2530
2822
  if (tween.current !== 0) {
2531
2823
  cancelAnimationFrame(tween.current);
2532
2824
  tween.current = 0;
2533
2825
  }
2534
2826
  }, []);
2535
- const glideCameraTo = (0, import_react2.useCallback)((zoomTarget, panX, panY) => {
2827
+ const glideCameraTo = (0, import_react3.useCallback)((zoomTarget, panX, panY) => {
2536
2828
  const target = clampZoom(zoomTarget);
2537
2829
  const to = { zoom: target, panX, panY };
2538
2830
  stopTween();
@@ -2565,13 +2857,13 @@ window.__ModuleLoader__.load({
2565
2857
  tween.current = requestAnimationFrame(frame);
2566
2858
  setZoom(to.zoom);
2567
2859
  }, [applyCamera, stopTween]);
2568
- const glideTo = (0, import_react2.useCallback)((zoomTarget, worldX, worldY) => {
2860
+ const glideTo = (0, import_react3.useCallback)((zoomTarget, worldX, worldY) => {
2569
2861
  const viewport = viewportRefCurrent.current;
2570
2862
  if (viewport === null) return;
2571
2863
  const target = clampZoom(zoomTarget);
2572
2864
  glideCameraTo(target, viewport.clientWidth / 2 - worldX * target, viewport.clientHeight / 2 - worldY * target);
2573
2865
  }, [glideCameraTo]);
2574
- const centreOn = (0, import_react2.useCallback)((worldX, worldY) => {
2866
+ const centreOn = (0, import_react3.useCallback)((worldX, worldY) => {
2575
2867
  stopTween();
2576
2868
  const viewport = viewportRefCurrent.current;
2577
2869
  const current = camera.current;
@@ -2583,11 +2875,11 @@ window.__ModuleLoader__.load({
2583
2875
  }
2584
2876
  applyCamera();
2585
2877
  }, [applyCamera, stopTween]);
2586
- (0, import_react2.useEffect)(() => {
2878
+ (0, import_react3.useEffect)(() => {
2587
2879
  if (hasNotes) centreRequest.current = true;
2588
2880
  setViewportTick((value) => value + 1);
2589
2881
  }, [hasNotes, view]);
2590
- const zoomTo = (0, import_react2.useCallback)((next, anchor) => {
2882
+ const zoomTo = (0, import_react3.useCallback)((next, anchor) => {
2591
2883
  const viewport = viewportRefCurrent.current;
2592
2884
  const current = camera.current;
2593
2885
  const target = clampZoom(next);
@@ -2606,7 +2898,7 @@ window.__ModuleLoader__.load({
2606
2898
  setZoom(target);
2607
2899
  applyCamera();
2608
2900
  }, [applyCamera]);
2609
- const fitWall = (0, import_react2.useCallback)(() => {
2901
+ const fitWall = (0, import_react3.useCallback)(() => {
2610
2902
  const viewport = viewportRefCurrent.current;
2611
2903
  if (viewport === null) return;
2612
2904
  const availableWidth = viewport.clientWidth || 960;
@@ -2649,10 +2941,10 @@ window.__ModuleLoader__.load({
2649
2941
  setZoom(target);
2650
2942
  centreOn(centreX, centreY);
2651
2943
  }, [centreOn]);
2652
- const resetView = (0, import_react2.useCallback)(() => {
2944
+ const resetView = (0, import_react3.useCallback)(() => {
2653
2945
  fitWall();
2654
2946
  }, [fitWall]);
2655
- const centreReserve = (0, import_react2.useCallback)(() => {
2947
+ const centreReserve = (0, import_react3.useCallback)(() => {
2656
2948
  const base = CENTRE_RESERVE;
2657
2949
  const viewport = viewportRefCurrent.current;
2658
2950
  const centre = centreRef.current;
@@ -2670,7 +2962,7 @@ window.__ModuleLoader__.load({
2670
2962
  halfHeight: base.halfHeight
2671
2963
  };
2672
2964
  }, []);
2673
- const revealBox = (0, import_react2.useCallback)((box) => {
2965
+ const revealBox = (0, import_react3.useCallback)((box) => {
2674
2966
  const viewport = viewportRefCurrent.current;
2675
2967
  if (viewport === null) return;
2676
2968
  const width = viewport.clientWidth || 960;
@@ -2736,8 +3028,8 @@ window.__ModuleLoader__.load({
2736
3028
  const y = fieldY + halfH + gap + box.height * targetZoom / 2;
2737
3029
  glideCameraTo(targetZoom, width / 2 - cardX * targetZoom, y - cardY * targetZoom);
2738
3030
  }, [glideCameraTo]);
2739
- const arrival = (0, import_react2.useRef)(null);
2740
- (0, import_react2.useEffect)(() => {
3031
+ const arrival = (0, import_react3.useRef)(null);
3032
+ (0, import_react3.useEffect)(() => {
2741
3033
  const pending = arrival.current;
2742
3034
  if (pending === null) return;
2743
3035
  const note = notes.find((candidate) => candidate.id === pending.id);
@@ -2756,7 +3048,7 @@ window.__ModuleLoader__.load({
2756
3048
  clearTimeout(timer);
2757
3049
  };
2758
3050
  }, [notes]);
2759
- const onWheel = (0, import_react2.useCallback)((event) => {
3051
+ const onWheel = (0, import_react3.useCallback)((event) => {
2760
3052
  const node = viewportRefCurrent.current;
2761
3053
  if (node === null) return;
2762
3054
  if (event.ctrlKey || event.metaKey) {
@@ -2770,7 +3062,7 @@ window.__ModuleLoader__.load({
2770
3062
  camera.current.panY -= event.deltaY * WHEEL_PAN;
2771
3063
  applyCamera();
2772
3064
  }, [applyCamera, zoomTo]);
2773
- const bindViewport = (0, import_react2.useCallback)((node) => {
3065
+ const bindViewport = (0, import_react3.useCallback)((node) => {
2774
3066
  viewportRefCurrent.current = node;
2775
3067
  detachWheel.current?.();
2776
3068
  detachWheel.current = null;
@@ -2778,14 +3070,14 @@ window.__ModuleLoader__.load({
2778
3070
  node.addEventListener("wheel", onWheel, { passive: false });
2779
3071
  detachWheel.current = () => node.removeEventListener("wheel", onWheel);
2780
3072
  }, [onWheel]);
2781
- (0, import_react2.useEffect)(() => {
3073
+ (0, import_react3.useEffect)(() => {
2782
3074
  const node = viewportRefCurrent.current;
2783
3075
  if (node === null) return;
2784
3076
  detachWheel.current?.();
2785
3077
  node.addEventListener("wheel", onWheel, { passive: false });
2786
3078
  detachWheel.current = () => node.removeEventListener("wheel", onWheel);
2787
3079
  }, [onWheel]);
2788
- (0, import_react2.useEffect)(() => {
3080
+ (0, import_react3.useEffect)(() => {
2789
3081
  const node = viewportRefCurrent.current;
2790
3082
  if (node === null || typeof ResizeObserver === "undefined") return;
2791
3083
  const observer = new ResizeObserver(() => {
@@ -2796,7 +3088,7 @@ window.__ModuleLoader__.load({
2796
3088
  observer.observe(node);
2797
3089
  return () => observer.disconnect();
2798
3090
  }, [view]);
2799
- (0, import_react2.useLayoutEffect)(() => {
3091
+ (0, import_react3.useLayoutEffect)(() => {
2800
3092
  if (view !== "canvas") return;
2801
3093
  if (centreRequest.current) {
2802
3094
  centreRequest.current = false;
@@ -2852,7 +3144,7 @@ window.__ModuleLoader__.load({
2852
3144
  lastY: event.clientY
2853
3145
  };
2854
3146
  }
2855
- (0, import_react2.useEffect)(() => {
3147
+ (0, import_react3.useEffect)(() => {
2856
3148
  const paintDrag = (current) => {
2857
3149
  current.frame = 0;
2858
3150
  const node = current.node;
@@ -2953,7 +3245,7 @@ window.__ModuleLoader__.load({
2953
3245
  pan.current?.node?.removeAttribute("data-panning");
2954
3246
  };
2955
3247
  }, [api, applyCamera]);
2956
- const latestActions = (0, import_react2.useRef)(null);
3248
+ const latestActions = (0, import_react3.useRef)(null);
2957
3249
  latestActions.current = {
2958
3250
  edit: openComposer,
2959
3251
  patch: (note, patch) => {
@@ -2970,7 +3262,7 @@ window.__ModuleLoader__.load({
2970
3262
  },
2971
3263
  drag: startDrag
2972
3264
  };
2973
- const actions = (0, import_react2.useMemo)(() => ({
3265
+ const actions = (0, import_react3.useMemo)(() => ({
2974
3266
  edit: (note) => latestActions.current?.edit(note),
2975
3267
  patch: (note, patch) => latestActions.current?.patch(note, patch),
2976
3268
  remove: (note) => latestActions.current?.remove(note),