@pixelmatters/markup 1.3.8 → 1.3.10

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.md CHANGED
@@ -35,9 +35,9 @@ CDN drop-in (no build step) — paste this just before `</body>`:
35
35
  ```html
36
36
  <script type="module">
37
37
  // Pin the exact version — esm.sh resolves it from npm
38
- import { init } from 'https://esm.sh/@pixelmatters/markup@1.3.8'
38
+ import { init } from 'https://esm.sh/@pixelmatters/markup@1.3.10'
39
39
  // or
40
- // import { init } from 'https://esm.run/@pixelmatters/markup@1.3.8'
40
+ // import { init } from 'https://esm.run/@pixelmatters/markup@1.3.10'
41
41
 
42
42
  init({
43
43
  apiUrl: 'https://your-deployment.convex.site',
@@ -48,14 +48,14 @@ CDN drop-in (no build step) — paste this just before `</body>`:
48
48
  </script>
49
49
  ```
50
50
 
51
- > **Why pin the version?** CDN URLs without a version (`@pixelmatters/markup`) resolve to whatever's `latest` on npm — a future major release will break your page silently. Always pin (`@pixelmatters/markup@1.3.8`).
51
+ > **Why pin the version?** CDN URLs without a version (`@pixelmatters/markup`) resolve to whatever's `latest` on npm — a future major release will break your page silently. Always pin (`@pixelmatters/markup@1.3.10`).
52
52
 
53
53
  If your platform doesn't allow inline JS (some CMS / page-builder editors), use the auto-init form instead — point a `<script src=…>` at the bundle and pass config via `data-*` attributes:
54
54
 
55
55
  ```html
56
56
  <script
57
57
  type="module"
58
- src="https://esm.sh/@pixelmatters/markup@1.3.8"
58
+ src="https://esm.sh/@pixelmatters/markup@1.3.10"
59
59
  data-markup-widget="true"
60
60
  data-api-url="https://your-deployment.convex.site"
61
61
  data-api-key="markup_..."
@@ -231,7 +231,7 @@ For a `<script>` tag drop-in (no bundler), use the inline ESM form and **pin the
231
231
 
232
232
  ```html
233
233
  <script type="module">
234
- import { init } from 'https://esm.sh/@pixelmatters/markup@1.3.8'
234
+ import { init } from 'https://esm.sh/@pixelmatters/markup@1.3.10'
235
235
 
236
236
  init({
237
237
  apiUrl: '...',
@@ -247,7 +247,7 @@ If inline JS is disallowed (some CMS / page-builder editors), use the auto-init
247
247
  ```html
248
248
  <script
249
249
  type="module"
250
- src="https://esm.sh/@pixelmatters/markup@1.3.8"
250
+ src="https://esm.sh/@pixelmatters/markup@1.3.10"
251
251
  data-markup-widget="true"
252
252
  data-api-url="..."
253
253
  data-api-key="..."
package/dist/widget.js CHANGED
@@ -3454,19 +3454,19 @@ function aa(e, t) {
3454
3454
  }
3455
3455
  function oa(e, t, n, r) {
3456
3456
  let i = r, a = 28 * i, o = a / 2, s = t * i, c = n * i;
3457
- e.save(), e.translate(s, c), e.rotate(-Math.PI / 4);
3457
+ e.save();
3458
3458
  let l = 2 * i;
3459
- e.beginPath(), e.roundRect(-o - l, -o - l, a + l * 2, a + l * 2, [
3459
+ e.beginPath(), e.roundRect(s - l, c - a - l, a + l * 2, a + l * 2, [
3460
3460
  14 * i + l,
3461
3461
  14 * i + l,
3462
3462
  14 * i + l,
3463
3463
  4 * i + l
3464
- ]), e.fillStyle = "#ffffff", e.fill(), e.beginPath(), e.roundRect(-o, -o, a, a, [
3464
+ ]), e.fillStyle = "#ffffff", e.fill(), e.beginPath(), e.roundRect(s, c - a, a, a, [
3465
3465
  14 * i,
3466
3466
  14 * i,
3467
3467
  14 * i,
3468
3468
  4 * i
3469
- ]), e.fillStyle = "#1a1614", e.fill(), e.rotate(Math.PI / 4), e.beginPath(), e.arc(0, 0, 3 * i, 0, Math.PI * 2), e.fillStyle = "rgba(255, 255, 255, 0.85)", e.fill(), e.restore();
3469
+ ]), e.fillStyle = "#1a1614", e.fill(), e.beginPath(), e.arc(s + o, c - o, 3 * i, 0, Math.PI * 2), e.fillStyle = "#e35d2a", e.fill(), e.restore();
3470
3470
  }
3471
3471
  //#endregion
3472
3472
  //#region src/runtime/utils.ts
@@ -3482,7 +3482,7 @@ function sa(e) {
3482
3482
  return {
3483
3483
  onPointerDown: V((e) => {
3484
3484
  let n = t.current;
3485
- if (n.stopPropagation && e.stopPropagation(), e.button !== 0 || n.shouldStart && !n.shouldStart(e)) return;
3485
+ if (n.preventDefault && e.preventDefault(), n.stopPropagation && e.stopPropagation(), e.button !== 0 || n.shouldStart && !n.shouldStart(e)) return;
3486
3486
  let a = e.currentTarget;
3487
3487
  if (!a) return;
3488
3488
  let o = (n.targetRef?.current ?? a).getBoundingClientRect(), s = e.clientX, c = e.clientY, l = o.left, u = o.top, d = o.width, f = o.height, p = n.threshold ?? 4, m = n.margin ?? 8, h = e.pointerId, g = !1, _ = null;
@@ -3632,6 +3632,7 @@ function ga({ size: e = 16 }) {
3632
3632
  //#region src/runtime/ui/fab.tsx
3633
3633
  function _a({ active: e, onToggle: t, onHide: n, position: r = "bottom-right", onPositionChange: i }) {
3634
3634
  let a = r === "bottom-left" ? "markup-fab-left" : "markup-fab-right", [o, s] = R(null), { onPointerDown: c, isDragging: l, consumeClickIfDragged: u } = sa({
3635
+ preventDefault: !0,
3635
3636
  stopPropagation: !0,
3636
3637
  onMove: s,
3637
3638
  onEnd: (e, t) => {
@@ -4365,11 +4366,6 @@ function Aa({ thread: e, authorName: t, currentClientId: n, isVerified: r, ident
4365
4366
  children: [" ", "(edited)"]
4366
4367
  })]
4367
4368
  }),
4368
- !l && t.reactions.length > 0 ? /* @__PURE__ */ $(Ma, {
4369
- comment: t,
4370
- isResolved: k,
4371
- onToggle: (e) => g(t._id, e)
4372
- }) : null,
4373
4369
  r === 0 && e.screenshotUrl ? /* @__PURE__ */ $("button", {
4374
4370
  type: "button",
4375
4371
  class: "markup-comment-screenshot",
@@ -4378,6 +4374,11 @@ function Aa({ thread: e, authorName: t, currentClientId: n, isVerified: r, ident
4378
4374
  src: e.screenshotUrl,
4379
4375
  alt: "Screenshot"
4380
4376
  })
4377
+ }) : null,
4378
+ !l && t.reactions.length > 0 ? /* @__PURE__ */ $(Ma, {
4379
+ comment: t,
4380
+ isResolved: k,
4381
+ onToggle: (e) => g(t._id, e)
4381
4382
  }) : null
4382
4383
  ]
4383
4384
  }, t._id);
@@ -4530,8 +4531,11 @@ function La(e) {
4530
4531
  email: e.identity.email
4531
4532
  };
4532
4533
  }
4533
- function Ra({ apiUrl: e, apiKey: t, position: n = "bottom-right" }) {
4534
- let [r, i] = R(() => window.location.pathname), [a, o] = R([]), [s, c] = R(!1), [l, u] = R({ kind: "unresolved" }), [d, f] = R(n), p = B(l);
4534
+ function Ra() {
4535
+ return window.location.host + window.location.pathname;
4536
+ }
4537
+ function za({ apiUrl: e, apiKey: t, position: n = "bottom-right" }) {
4538
+ let [r, i] = R(Ra), [a, o] = R([]), [s, c] = R(!1), [l, u] = R({ kind: "unresolved" }), [d, f] = R(n), p = B(l);
4535
4539
  p.current = l;
4536
4540
  let [m, h] = R(0), g = Ce(() => Or({
4537
4541
  apiUrl: e,
@@ -4642,7 +4646,7 @@ function Ra({ apiUrl: e, apiKey: t, position: n = "bottom-right" }) {
4642
4646
  }, [a, s]), z(() => {
4643
4647
  let e = !0;
4644
4648
  function t() {
4645
- e && i(window.location.pathname);
4649
+ e && i(Ra());
4646
4650
  }
4647
4651
  window.addEventListener("popstate", t);
4648
4652
  let n = history.pushState, r = history.replaceState;
@@ -4968,11 +4972,11 @@ function Ra({ apiUrl: e, apiKey: t, position: n = "bottom-right" }) {
4968
4972
  position: d,
4969
4973
  onPositionChange: f
4970
4974
  }) : null,
4971
- C && T ? /* @__PURE__ */ $(za, { position: d }) : null
4975
+ C && T ? /* @__PURE__ */ $(Ba, { position: d }) : null
4972
4976
  ]
4973
4977
  });
4974
4978
  }
4975
- function za({ position: e }) {
4979
+ function Ba({ position: e }) {
4976
4980
  let t = /Mac|iPhone|iPad/.test(navigator.platform || navigator.userAgent) ? "⌘" : "Ctrl";
4977
4981
  return /* @__PURE__ */ $("div", {
4978
4982
  class: Q("markup-hud-hidden-toast", e === "bottom-left" ? "markup-hud-hidden-toast-left" : "markup-hud-hidden-toast-right"),
@@ -4994,7 +4998,7 @@ function za({ position: e }) {
4994
4998
  }
4995
4999
  //#endregion
4996
5000
  //#region src/runtime/mount.tsx
4997
- function Ba(e, t) {
5001
+ function Va(e, t) {
4998
5002
  e.style.position = "fixed", e.style.inset = "0", e.style.zIndex = "2147483647", e.style.pointerEvents = "none";
4999
5003
  let n = t.theme ?? "auto";
5000
5004
  n !== "auto" && (e.dataset.theme = n);
@@ -5003,23 +5007,24 @@ function Ba(e, t) {
5003
5007
  let a = document.createElement("div");
5004
5008
  a.className = "markup-shadow-root", r.appendChild(a);
5005
5009
  let { theme: o, ...s } = t;
5006
- return le(/* @__PURE__ */ $(Ra, { ...s }), a), () => le(null, a);
5010
+ return le(/* @__PURE__ */ $(za, { ...s }), a), () => le(null, a);
5007
5011
  }
5008
5012
  //#endregion
5009
5013
  //#region src/widget.ts
5010
- var Va = null, Ha = null;
5011
- function Ua(e) {
5012
- Wa();
5014
+ var Ha = null, Ua = null;
5015
+ function Wa(e) {
5016
+ if (!e.apiUrl || !e.apiKey) return console.warn("[markup] init() requires both apiUrl and apiKey — widget not mounted"), () => {};
5017
+ Ga();
5013
5018
  let t = document.createElement("div");
5014
- return t.id = "markup-widget", document.body.appendChild(t), Ha = t, Va = Ba(t, e), Wa;
5019
+ return t.id = "markup-widget", document.body.appendChild(t), Ua = t, Ha = Va(t, e), Ga;
5015
5020
  }
5016
- function Wa() {
5017
- Va &&= (Va(), null), Ha?.parentNode && Ha.parentNode.removeChild(Ha), Ha = null;
5021
+ function Ga() {
5022
+ Ha &&= (Ha(), null), Ua?.parentNode && Ua.parentNode.removeChild(Ua), Ua = null;
5018
5023
  }
5019
5024
  if (typeof document < "u") {
5020
5025
  let e = document.currentScript ?? document.querySelector("script[data-markup-widget=\"true\"]"), t = e?.dataset.apiUrl, n = e?.dataset.apiKey;
5021
5026
  if (t && n) {
5022
- let r = e?.dataset.position, i = e?.dataset.theme, a = () => Ua({
5027
+ let r = e?.dataset.position, i = e?.dataset.theme, a = () => Wa({
5023
5028
  apiUrl: t,
5024
5029
  apiKey: n,
5025
5030
  position: r,
@@ -5029,4 +5034,4 @@ if (typeof document < "u") {
5029
5034
  }
5030
5035
  }
5031
5036
  //#endregion
5032
- export { Wa as destroy, Ua as init };
5037
+ export { Ga as destroy, Wa as init };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pixelmatters/markup",
3
- "version": "1.3.8",
3
+ "version": "1.3.10",
4
4
  "description": "Embeddable feedback widget for collecting visual bug reports, screenshots, and comments on live web apps.",
5
5
  "keywords": [
6
6
  "annotation",