@pixelmatters/markup 1.3.9 → 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.9'
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.9'
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.9`).
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.9"
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.9'
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.9"
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
@@ -4366,11 +4366,6 @@ function Aa({ thread: e, authorName: t, currentClientId: n, isVerified: r, ident
4366
4366
  children: [" ", "(edited)"]
4367
4367
  })]
4368
4368
  }),
4369
- !l && t.reactions.length > 0 ? /* @__PURE__ */ $(Ma, {
4370
- comment: t,
4371
- isResolved: k,
4372
- onToggle: (e) => g(t._id, e)
4373
- }) : null,
4374
4369
  r === 0 && e.screenshotUrl ? /* @__PURE__ */ $("button", {
4375
4370
  type: "button",
4376
4371
  class: "markup-comment-screenshot",
@@ -4379,6 +4374,11 @@ function Aa({ thread: e, authorName: t, currentClientId: n, isVerified: r, ident
4379
4374
  src: e.screenshotUrl,
4380
4375
  alt: "Screenshot"
4381
4376
  })
4377
+ }) : null,
4378
+ !l && t.reactions.length > 0 ? /* @__PURE__ */ $(Ma, {
4379
+ comment: t,
4380
+ isResolved: k,
4381
+ onToggle: (e) => g(t._id, e)
4382
4382
  }) : null
4383
4383
  ]
4384
4384
  }, t._id);
@@ -4531,8 +4531,11 @@ function La(e) {
4531
4531
  email: e.identity.email
4532
4532
  };
4533
4533
  }
4534
- function Ra({ apiUrl: e, apiKey: t, position: n = "bottom-right" }) {
4535
- 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);
4536
4539
  p.current = l;
4537
4540
  let [m, h] = R(0), g = Ce(() => Or({
4538
4541
  apiUrl: e,
@@ -4643,7 +4646,7 @@ function Ra({ apiUrl: e, apiKey: t, position: n = "bottom-right" }) {
4643
4646
  }, [a, s]), z(() => {
4644
4647
  let e = !0;
4645
4648
  function t() {
4646
- e && i(window.location.pathname);
4649
+ e && i(Ra());
4647
4650
  }
4648
4651
  window.addEventListener("popstate", t);
4649
4652
  let n = history.pushState, r = history.replaceState;
@@ -4969,11 +4972,11 @@ function Ra({ apiUrl: e, apiKey: t, position: n = "bottom-right" }) {
4969
4972
  position: d,
4970
4973
  onPositionChange: f
4971
4974
  }) : null,
4972
- C && T ? /* @__PURE__ */ $(za, { position: d }) : null
4975
+ C && T ? /* @__PURE__ */ $(Ba, { position: d }) : null
4973
4976
  ]
4974
4977
  });
4975
4978
  }
4976
- function za({ position: e }) {
4979
+ function Ba({ position: e }) {
4977
4980
  let t = /Mac|iPhone|iPad/.test(navigator.platform || navigator.userAgent) ? "⌘" : "Ctrl";
4978
4981
  return /* @__PURE__ */ $("div", {
4979
4982
  class: Q("markup-hud-hidden-toast", e === "bottom-left" ? "markup-hud-hidden-toast-left" : "markup-hud-hidden-toast-right"),
@@ -4995,7 +4998,7 @@ function za({ position: e }) {
4995
4998
  }
4996
4999
  //#endregion
4997
5000
  //#region src/runtime/mount.tsx
4998
- function Ba(e, t) {
5001
+ function Va(e, t) {
4999
5002
  e.style.position = "fixed", e.style.inset = "0", e.style.zIndex = "2147483647", e.style.pointerEvents = "none";
5000
5003
  let n = t.theme ?? "auto";
5001
5004
  n !== "auto" && (e.dataset.theme = n);
@@ -5004,23 +5007,24 @@ function Ba(e, t) {
5004
5007
  let a = document.createElement("div");
5005
5008
  a.className = "markup-shadow-root", r.appendChild(a);
5006
5009
  let { theme: o, ...s } = t;
5007
- return le(/* @__PURE__ */ $(Ra, { ...s }), a), () => le(null, a);
5010
+ return le(/* @__PURE__ */ $(za, { ...s }), a), () => le(null, a);
5008
5011
  }
5009
5012
  //#endregion
5010
5013
  //#region src/widget.ts
5011
- var Va = null, Ha = null;
5012
- function Ua(e) {
5013
- 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();
5014
5018
  let t = document.createElement("div");
5015
- 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;
5016
5020
  }
5017
- function Wa() {
5018
- 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;
5019
5023
  }
5020
5024
  if (typeof document < "u") {
5021
5025
  let e = document.currentScript ?? document.querySelector("script[data-markup-widget=\"true\"]"), t = e?.dataset.apiUrl, n = e?.dataset.apiKey;
5022
5026
  if (t && n) {
5023
- let r = e?.dataset.position, i = e?.dataset.theme, a = () => Ua({
5027
+ let r = e?.dataset.position, i = e?.dataset.theme, a = () => Wa({
5024
5028
  apiUrl: t,
5025
5029
  apiKey: n,
5026
5030
  position: r,
@@ -5030,4 +5034,4 @@ if (typeof document < "u") {
5030
5034
  }
5031
5035
  }
5032
5036
  //#endregion
5033
- 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.9",
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",