@inkandswitch/patchwork-pkg-base 0.0.49 → 0.0.51

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inkandswitch/patchwork-pkg-base",
3
- "version": "0.0.49",
3
+ "version": "0.0.51",
4
4
  "type": "module",
5
5
  "description": "Base packages for the Patchwork system",
6
6
  "repository": {
@@ -553,12 +553,15 @@
553
553
  }
554
554
 
555
555
  /* The gutter spans the whole history: top = latest change, bottom = first.
556
- Purely a visual track — scrubbing starts from the indicator's handles. */
556
+ Pressing anywhere in it jumps the head there and scrubs from that point;
557
+ the indicator's handles sit on top of it and drag from where they're held. */
557
558
  .draft-scrubber {
558
559
  position: relative;
559
560
  flex: none;
560
561
  width: 16px;
561
562
  border-radius: var(--drafts-radius-sm);
563
+ cursor: pointer;
564
+ touch-action: none;
562
565
  }
563
566
 
564
567
  /* The indicator sits at the head like a calendar's now-line: a dot in the
@@ -1272,7 +1275,7 @@ function subscribeDoc(element, selector) {
1272
1275
  const doc = () => ready() ? store : void 0;
1273
1276
  return [doc, handle];
1274
1277
  }
1275
- var _tmpl$ = /* @__PURE__ */ template(`<div class=drafts-list>`), _tmpl$2 = /* @__PURE__ */ template(`<div class=drafts-panel><div class=drafts-version>v0.0.45`), _tmpl$3 = /* @__PURE__ */ template(`<div class=drafts-empty>No document selected.`), _tmpl$4 = /* @__PURE__ */ template(`<button type=button class=draft-card-return title="Return to the latest version">Return to latest`), _tmpl$5 = /* @__PURE__ */ template(`<span class=draft-card-tools>`), _tmpl$6 = /* @__PURE__ */ template(`<div class=draft-card><div class=draft-card-header title="Main version (host document)"><div class=draft-card-title>`), _tmpl$7 = /* @__PURE__ */ template(`<div class=draft-card><div class=draft-card-header title="Open draft"><div class=draft-card-title>`), _tmpl$8 = /* @__PURE__ */ template(`<div class=draft-menu-backdrop>`), _tmpl$9 = /* @__PURE__ */ template(`<div class=draft-menu-list><button type=button class=draft-menu-item>Fork`), _tmpl$0 = /* @__PURE__ */ template(`<span class=draft-menu><button type=button class=draft-card-action title="Draft actions">`), _tmpl$1 = /* @__PURE__ */ template(`<button type=button class=draft-menu-item title="Fork a new draft from the version you're viewing">`), _tmpl$10 = /* @__PURE__ */ template(`<div class=draft-menu-separator>`), _tmpl$11 = /* @__PURE__ */ template(`<button type=button class=draft-menu-item title="Merge this draft into the highlighted card and hide it">`), _tmpl$12 = /* @__PURE__ */ template(`<button type=button class="draft-menu-item draft-menu-item--danger"title="Deletes this draft and any drafts forked from it">Delete draft`), _tmpl$13 = /* @__PURE__ */ template(`<svg width=14 height=14 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><line x1=6 x2=6 y1=3 y2=15></line><circle cx=18 cy=6 r=3></circle><circle cx=6 cy=18 r=3></circle><path d="M18 9a9 9 0 0 1-9 9">`), _tmpl$14 = /* @__PURE__ */ template(`<svg width=14 height=14 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><circle cx=18 cy=18 r=3></circle><circle cx=6 cy=6 r=3></circle><path d="M6 21V9a9 9 0 0 0 9 9">`), _tmpl$15 = /* @__PURE__ */ template(`<svg width=14 height=14 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><circle cx=12 cy=12 r=1></circle><circle cx=19 cy=12 r=1></circle><circle cx=5 cy=12 r=1>`), _tmpl$16 = /* @__PURE__ */ template(`<svg width=14 height=14 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path d="M3 6h18"></path><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"></path><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"></path><line x1=10 x2=10 y1=11 y2=17></line><line x1=14 x2=14 y1=11 y2=17>`), _tmpl$17 = /* @__PURE__ */ template(`<svg width=14 height=14 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"></path><path d="M3 3v5h5"></path><path d="M12 7v5l4 2">`), _tmpl$18 = /* @__PURE__ */ template(`<input class=draft-name-input>`), _tmpl$19 = /* @__PURE__ */ template(`<span class=draft-name title="Double-click to rename">`), _tmpl$20 = /* @__PURE__ */ template(`<button type=button class=draft-card-eye>`), _tmpl$21 = /* @__PURE__ */ template(`<svg width=14 height=14 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"></path><circle cx=12 cy=12 r=3>`), _tmpl$22 = /* @__PURE__ */ template(`<svg width=14 height=14 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path d="M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"></path><line x1=1 y1=1 x2=23 y2=23>`), _tmpl$23 = /* @__PURE__ */ template(`<div class=draft-changes-building><span class=draft-building-spinner></span>Building history…`), _tmpl$24 = /* @__PURE__ */ template(`<div class=draft-scrubber-token><div class=draft-scrubber-line></div><div class=draft-scrubber-edge title="Drag to scrub through history — drop at the top to return to the latest version"></div><div class=draft-scrubber-dot title="Drag to scrub through history — drop at the top to return to the latest version">`), _tmpl$25 = /* @__PURE__ */ template(`<div class=draft-scrubber-connector>`), _tmpl$26 = /* @__PURE__ */ template(`<div class="draft-scrubber-token draft-scrubber-token--baseline"><div class=draft-scrubber-line></div><div class=draft-scrubber-edge title="Drag to move the diff baseline"></div><div class=draft-scrubber-baseline title="Drag to move the diff baseline">`), _tmpl$27 = /* @__PURE__ */ template(`<div class=draft-changes-body><div class=draft-scrubber></div><div class=draft-changes-rows>`), _tmpl$28 = /* @__PURE__ */ template(`<div class=draft-card-changes>`), _tmpl$29 = /* @__PURE__ */ template(`<div class=draft-changes-empty>No changes yet.`), _tmpl$30 = /* @__PURE__ */ template(`<div class=draft-scrubber-sticker title="The version being viewed — Fork below to branch from here"><span class=draft-sticker-time></span><span class=draft-sticker-spacer>`), _tmpl$31 = /* @__PURE__ */ template(`<button type=button class=draft-group-row title="View the draft as of this group"><span class=draft-group-time></span><span class=draft-group-spacer>`), _tmpl$32 = /* @__PURE__ */ template(`<div class="draft-avatar draft-avatar--extra">+`), _tmpl$33 = /* @__PURE__ */ template(`<div class=draft-avatars>`), _tmpl$34 = /* @__PURE__ */ template(`<patchwork-view tool-id=contact-inline>`, true, false, false), _tmpl$35 = /* @__PURE__ */ template(`<div class=draft-avatar>`), _tmpl$36 = /* @__PURE__ */ template(`<span class="draft-count draft-count--add">+`), _tmpl$37 = /* @__PURE__ */ template(`<span class="draft-count draft-count--del">-`), _tmpl$38 = /* @__PURE__ */ template(`<span class=draft-counts>`);
1278
+ var _tmpl$ = /* @__PURE__ */ template(`<div class=drafts-list>`), _tmpl$2 = /* @__PURE__ */ template(`<div class=drafts-panel><div class=drafts-version>v0.0.45`), _tmpl$3 = /* @__PURE__ */ template(`<div class=drafts-empty>No document selected.`), _tmpl$4 = /* @__PURE__ */ template(`<button type=button class=draft-card-return title="Return to the latest version">Return to latest`), _tmpl$5 = /* @__PURE__ */ template(`<span class=draft-card-tools>`), _tmpl$6 = /* @__PURE__ */ template(`<div class=draft-card><div class=draft-card-header title="Main version (host document)"><div class=draft-card-title>`), _tmpl$7 = /* @__PURE__ */ template(`<div class=draft-card><div class=draft-card-header title="Open draft"><div class=draft-card-title>`), _tmpl$8 = /* @__PURE__ */ template(`<div class=draft-menu-backdrop>`), _tmpl$9 = /* @__PURE__ */ template(`<div class=draft-menu-list><button type=button class=draft-menu-item>Fork`), _tmpl$0 = /* @__PURE__ */ template(`<span class=draft-menu><button type=button class=draft-card-action title="Draft actions">`), _tmpl$1 = /* @__PURE__ */ template(`<button type=button class=draft-menu-item title="Fork a new draft from the version you're viewing">`), _tmpl$10 = /* @__PURE__ */ template(`<div class=draft-menu-separator>`), _tmpl$11 = /* @__PURE__ */ template(`<button type=button class=draft-menu-item title="Merge this draft into the highlighted card and hide it">`), _tmpl$12 = /* @__PURE__ */ template(`<button type=button class="draft-menu-item draft-menu-item--danger"title="Deletes this draft and any drafts forked from it">Delete draft`), _tmpl$13 = /* @__PURE__ */ template(`<svg width=14 height=14 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><line x1=6 x2=6 y1=3 y2=15></line><circle cx=18 cy=6 r=3></circle><circle cx=6 cy=18 r=3></circle><path d="M18 9a9 9 0 0 1-9 9">`), _tmpl$14 = /* @__PURE__ */ template(`<svg width=14 height=14 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><circle cx=18 cy=18 r=3></circle><circle cx=6 cy=6 r=3></circle><path d="M6 21V9a9 9 0 0 0 9 9">`), _tmpl$15 = /* @__PURE__ */ template(`<svg width=14 height=14 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><circle cx=12 cy=12 r=1></circle><circle cx=19 cy=12 r=1></circle><circle cx=5 cy=12 r=1>`), _tmpl$16 = /* @__PURE__ */ template(`<svg width=14 height=14 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path d="M3 6h18"></path><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"></path><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"></path><line x1=10 x2=10 y1=11 y2=17></line><line x1=14 x2=14 y1=11 y2=17>`), _tmpl$17 = /* @__PURE__ */ template(`<svg width=14 height=14 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"></path><path d="M3 3v5h5"></path><path d="M12 7v5l4 2">`), _tmpl$18 = /* @__PURE__ */ template(`<input class=draft-name-input>`), _tmpl$19 = /* @__PURE__ */ template(`<span class=draft-name title="Double-click to rename">`), _tmpl$20 = /* @__PURE__ */ template(`<button type=button class=draft-card-eye>`), _tmpl$21 = /* @__PURE__ */ template(`<svg width=14 height=14 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"></path><circle cx=12 cy=12 r=3>`), _tmpl$22 = /* @__PURE__ */ template(`<svg width=14 height=14 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path d="M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"></path><line x1=1 y1=1 x2=23 y2=23>`), _tmpl$23 = /* @__PURE__ */ template(`<div class=draft-changes-building><span class=draft-building-spinner></span>Building history…`), _tmpl$24 = /* @__PURE__ */ template(`<div class=draft-scrubber-token><div class=draft-scrubber-line></div><div class=draft-scrubber-edge title="Drag to scrub through history — drop at the top to return to the latest version"></div><div class=draft-scrubber-dot title="Drag to scrub through history — drop at the top to return to the latest version">`), _tmpl$25 = /* @__PURE__ */ template(`<div class=draft-scrubber-connector>`), _tmpl$26 = /* @__PURE__ */ template(`<div class="draft-scrubber-token draft-scrubber-token--baseline"><div class=draft-scrubber-line></div><div class=draft-scrubber-edge title="Drag to move the diff baseline"></div><div class=draft-scrubber-baseline title="Drag to move the diff baseline">`), _tmpl$27 = /* @__PURE__ */ template(`<div class=draft-changes-body><div class=draft-scrubber title="Click or drag anywhere in the gutter to scrub through history"></div><div class=draft-changes-rows>`), _tmpl$28 = /* @__PURE__ */ template(`<div class=draft-card-changes>`), _tmpl$29 = /* @__PURE__ */ template(`<div class=draft-changes-empty>No changes yet.`), _tmpl$30 = /* @__PURE__ */ template(`<div class=draft-scrubber-sticker title="The version being viewed — Fork below to branch from here"><span class=draft-sticker-time></span><span class=draft-sticker-spacer>`), _tmpl$31 = /* @__PURE__ */ template(`<button type=button class=draft-group-row title="View the draft as of this group"><span class=draft-group-time></span><span class=draft-group-spacer>`), _tmpl$32 = /* @__PURE__ */ template(`<div class="draft-avatar draft-avatar--extra">+`), _tmpl$33 = /* @__PURE__ */ template(`<div class=draft-avatars>`), _tmpl$34 = /* @__PURE__ */ template(`<patchwork-view tool-id=contact-inline>`, true, false, false), _tmpl$35 = /* @__PURE__ */ template(`<div class=draft-avatar>`), _tmpl$36 = /* @__PURE__ */ template(`<span class="draft-count draft-count--add">+`), _tmpl$37 = /* @__PURE__ */ template(`<span class="draft-count draft-count--del">-`), _tmpl$38 = /* @__PURE__ */ template(`<span class=draft-counts>`);
1276
1279
  const EMPTY_DRAFT_LIST = {
1277
1280
  main: {
1278
1281
  url: "",
@@ -2293,8 +2296,8 @@ function CardMenu(props) {
2293
2296
  return _el$13;
2294
2297
  })();
2295
2298
  }
2296
- function formatVersionTime(ms2) {
2297
- const date = new Date(ms2);
2299
+ function formatVersionTime(timeSeconds) {
2300
+ const date = new Date(timeSeconds * 1e3);
2298
2301
  const sameYear = date.getFullYear() === (/* @__PURE__ */ new Date()).getFullYear();
2299
2302
  return date.toLocaleString(void 0, {
2300
2303
  month: "short",
@@ -2672,11 +2675,11 @@ function DraftChangesList(props) {
2672
2675
  const rect = trackEl.getBoundingClientRect();
2673
2676
  return ev.clientY - rect.top;
2674
2677
  };
2675
- const beginDrag = (ev) => {
2678
+ const beginDrag = (ev, jumpToPointer = false) => {
2676
2679
  if (!trackEl || bands().length === 0) return;
2677
2680
  ev.preventDefault();
2678
2681
  ev.stopPropagation();
2679
- const grabOffset = yInTrack(ev) - (tokenGeometry()?.top ?? 0);
2682
+ const grabOffset = jumpToPointer ? 0 : yInTrack(ev) - (tokenGeometry()?.top ?? 0);
2680
2683
  const s = props.scrubber();
2681
2684
  let last = s ? `${s.groupId}:${s.offset}` : null;
2682
2685
  const onMove = (e) => {
@@ -2692,6 +2695,7 @@ function DraftChangesList(props) {
2692
2695
  scrubTo(pos.group, pos.offset);
2693
2696
  }
2694
2697
  };
2698
+ if (jumpToPointer) onMove(ev);
2695
2699
  const target = ev.currentTarget;
2696
2700
  target.setPointerCapture(ev.pointerId);
2697
2701
  const onUp = () => {
@@ -2789,6 +2793,7 @@ function DraftChangesList(props) {
2789
2793
  },
2790
2794
  get children() {
2791
2795
  var _el$36 = _tmpl$27(), _el$37 = _el$36.firstChild, _el$38 = _el$37.nextSibling;
2796
+ _el$37.$$pointerdown = (ev) => beginDrag(ev, true);
2792
2797
  var _ref$ = trackEl;
2793
2798
  typeof _ref$ === "function" ? use(_ref$, _el$37) : trackEl = _el$37;
2794
2799
  use(setRowsEl, _el$38);
@@ -3102,4 +3107,4 @@ const renderDraftsSidebar = (_handle, element) => {
3102
3107
  export {
3103
3108
  renderDraftsSidebar
3104
3109
  };
3105
- //# sourceMappingURL=main-BR_tW0sp.js.map
3110
+ //# sourceMappingURL=main-CCEftK7X.js.map