@pixelmatters/markup 1.32.1 → 1.32.3

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
@@ -37,9 +37,9 @@ CDN drop-in, no build step. Paste this just before `</body>`:
37
37
  ```html
38
38
  <script type="module">
39
39
  // Pin the exact version; esm.sh resolves it from npm
40
- import { init } from 'https://esm.sh/@pixelmatters/markup@1.32.1'
40
+ import { init } from 'https://esm.sh/@pixelmatters/markup@1.32.3'
41
41
  // or
42
- // import { init } from 'https://esm.run/@pixelmatters/markup@1.32.1'
42
+ // import { init } from 'https://esm.run/@pixelmatters/markup@1.32.3'
43
43
 
44
44
  init({
45
45
  apiUrl: 'https://your-deployment.convex.site',
@@ -50,14 +50,14 @@ CDN drop-in, no build step. Paste this just before `</body>`:
50
50
  </script>
51
51
  ```
52
52
 
53
- > **Why pin the version?** CDN URLs without a version (`@pixelmatters/markup`) resolve to whatever's `latest` on npm, so a future major release will break your page with no warning. Always pin (`@pixelmatters/markup@1.32.1`).
53
+ > **Why pin the version?** CDN URLs without a version (`@pixelmatters/markup`) resolve to whatever's `latest` on npm, so a future major release will break your page with no warning. Always pin (`@pixelmatters/markup@1.32.3`).
54
54
 
55
55
  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:
56
56
 
57
57
  ```html
58
58
  <script
59
59
  type="module"
60
- src="https://esm.sh/@pixelmatters/markup@1.32.1"
60
+ src="https://esm.sh/@pixelmatters/markup@1.32.3"
61
61
  data-markup-widget="true"
62
62
  data-api-url="https://your-deployment.convex.site"
63
63
  data-api-key="markup_..."
@@ -501,7 +501,7 @@ For a `<script>` tag drop-in (no bundler), use the inline ESM form and **pin the
501
501
 
502
502
  ```html
503
503
  <script type="module">
504
- import { init } from 'https://esm.sh/@pixelmatters/markup@1.32.1'
504
+ import { init } from 'https://esm.sh/@pixelmatters/markup@1.32.3'
505
505
 
506
506
  init({
507
507
  apiUrl: '...',
@@ -517,7 +517,7 @@ If inline JS is disallowed (some CMS / page-builder editors), use the auto-init
517
517
  ```html
518
518
  <script
519
519
  type="module"
520
- src="https://esm.sh/@pixelmatters/markup@1.32.1"
520
+ src="https://esm.sh/@pixelmatters/markup@1.32.3"
521
521
  data-markup-widget="true"
522
522
  data-api-url="..."
523
523
  data-api-key="..."
@@ -554,7 +554,7 @@ If the host page ships a CSP, the widget needs:
554
554
  | `script-src` | `https://esm.sh` | CDN path only; a bundled install needs nothing here |
555
555
  | `style-src` | `'unsafe-inline'` | the widget appends its stylesheet as a `<style>` element inside its own shadow root |
556
556
 
557
- Only `img-src` and the sprite entry degrade gracefully: a blocked avatar falls back to initials, and a blocked image or sprite in a capture comes through blank. A missing `connect-src` entry stops the widget working at all, and a missing `style-src` one leaves it unstyled.
557
+ Only `img-src` and the sprite entry degrade gracefully: a blocked avatar falls back to initials, and a blocked image or sprite in a capture comes through blank. A missing `https://…convex.site` entry stops the widget working at all. A missing `wss://…convex.cloud` entry leaves the toolbar up and posting working, but threads never load; the widget reports that once rather than retrying. A missing `style-src` entry leaves it unstyled.
558
558
 
559
559
  ## Browser support
560
560
 
package/dist/react.js CHANGED
@@ -1,2 +1,2 @@
1
- "use client";import{init as e,n as t,t as n}from"./widget.js";import{t as r}from"./shared-mount-B9ij4vuL.js";import{useEffect as i}from"react";function a(a){let{enabled:o=!0,...s}=a,c=o?n(s):null;i(()=>{if(c!==null)return t(`react`),r(c,e)},[c])}export{a as useMarkup};
1
+ "use client";import{init as e,n as t,t as n}from"./widget.js";import{t as r}from"./shared-mount-BfuEGDyD.js";import{useEffect as i}from"react";function a(a){let{enabled:o=!0,...s}=a,c=o?n(s):null;i(()=>{if(c!==null)return t(`react`),r(c,e)},[c])}export{a as useMarkup};
2
2
  //# sourceMappingURL=react.js.map
@@ -0,0 +1,2 @@
1
+ var e=new Map;function t(t,n){let r=n(JSON.parse(t)),i=(e.get(t)?.count??0)+1;e.delete(t),e.set(t,{count:i,dispose:r});let a=!1;return()=>{if(a)return;a=!0;let r=e.get(t);if(!r||(--r.count,r.count>0))return;e.delete(t),r.dispose();let i=[...e.entries()].at(-1);if(i)try{i[1].dispose=n(JSON.parse(i[0]))}catch(e){i[1].dispose=()=>{},console.warn(`[markup] could not remount the widget`,e)}}}export{t};
2
+ //# sourceMappingURL=shared-mount-BfuEGDyD.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"shared-mount-B9ij4vuL.js","names":[],"sources":["../src/runtime/shared-mount.ts"],"sourcesContent":["import type { WidgetConfig } from '../widget'\n\ntype Holder = { count: number; dispose: () => void }\n\nconst holders = new Map<string, Holder>()\n\n/**\n * Counts hook holders per config, so the first of two components to unmount\n * doesn't take the widget away from the other. `init` still runs on every\n * acquire: it is a no-op for the live config, and it remounts one that a\n * different config has since replaced.\n *\n * Holders of different configs contend for the one widget, and the latest to\n * acquire wins. When it lets go, the most recent remaining config is mounted\n * again, so no holder is left without a widget while it still wants one.\n */\nexport function acquireMount(key: string, init: (config: WidgetConfig) => () => void): () => void {\n const dispose = init(JSON.parse(key) as WidgetConfig)\n const count = (holders.get(key)?.count ?? 0) + 1\n // Re-inserted so the map's order is recency, which the release path reads.\n holders.delete(key)\n holders.set(key, { count, dispose })\n\n let isReleased = false\n return () => {\n if (isReleased) return\n isReleased = true\n const current = holders.get(key)\n if (!current) return\n current.count -= 1\n if (current.count > 0) return\n holders.delete(key)\n current.dispose()\n const survivor = [...holders.entries()].at(-1)\n if (!survivor) return\n // This runs inside some other component's cleanup; a failure to bring\n // the survivor back must not surface as that component's error.\n try {\n survivor[1].dispose = init(JSON.parse(survivor[0]) as WidgetConfig)\n } catch (error) {\n survivor[1].dispose = () => {}\n console.warn('[markup] could not remount the widget', error)\n }\n }\n}\n"],"mappings":"AAIA,IAAM,kBAAU,IAAI,IAYpB,SAAgB,EAAa,EAAa,EAAwD,CAChG,IAAM,EAAU,EAAK,KAAK,MAAM,CAAG,CAAiB,EAC9C,GAAS,EAAQ,IAAI,CAAG,CAAC,EAAE,OAAS,GAAK,EAE/C,EAAQ,OAAO,CAAG,EAClB,EAAQ,IAAI,EAAK,CAAE,QAAO,SAAQ,CAAC,EAEnC,IAAI,EAAa,GACjB,UAAa,CACX,GAAI,EAAY,OAChB,EAAa,GACb,IAAM,EAAU,EAAQ,IAAI,CAAG,EAG/B,GAFI,CAAC,IACL,IAAQ,MACJ,EAAQ,MAAQ,GAAG,OACvB,EAAQ,OAAO,CAAG,EAClB,EAAQ,QAAQ,EAChB,IAAM,EAAW,CAAC,GAAG,EAAQ,QAAQ,CAAC,CAAC,CAAC,GAAG,EAAE,EACxC,KAGL,GAAI,CACF,EAAS,EAAE,CAAC,QAAU,EAAK,KAAK,MAAM,EAAS,EAAE,CAAiB,CACpE,OAAS,EAAO,CACd,EAAS,EAAE,CAAC,YAAgB,CAAC,EAC7B,QAAQ,KAAK,wCAAyC,CAAK,CAC7D,CACF,CACF"}
1
+ {"version":3,"file":"shared-mount-BfuEGDyD.js","names":[],"sources":["../src/runtime/shared-mount.ts"],"sourcesContent":["import type { WidgetConfig } from '../widget'\n\ntype Holder = { count: number; dispose: () => void }\n\nconst holders = new Map<string, Holder>()\n\n/**\n * Counts hook holders per config, so the first of two components to unmount\n * doesn't take the widget away from the other. `init` still runs on every\n * acquire: it is a no-op for the live config, and it remounts one that a\n * different config has since replaced.\n *\n * Holders of different configs contend for the one widget, and the latest to\n * acquire wins. When it lets go, the most recent remaining config is mounted\n * again, so no holder is left without a widget while it still wants one.\n */\nexport function acquireMount(key: string, init: (config: WidgetConfig) => () => void): () => void {\n const dispose = init(JSON.parse(key) as WidgetConfig)\n const count = (holders.get(key)?.count ?? 0) + 1\n // Re-inserted so the map's order is recency, which the release path reads.\n holders.delete(key)\n holders.set(key, { count, dispose })\n\n let isReleased = false\n return () => {\n if (isReleased) return\n isReleased = true\n const current = holders.get(key)\n if (!current) return\n current.count -= 1\n if (current.count > 0) return\n holders.delete(key)\n current.dispose()\n const survivor = [...holders.entries()].at(-1)\n if (!survivor) return\n // This runs inside some other component's cleanup; a failure to bring\n // the survivor back must not surface as that component's error.\n try {\n survivor[1].dispose = init(JSON.parse(survivor[0]) as WidgetConfig)\n } catch (error) {\n survivor[1].dispose = () => {}\n console.warn('[markup] could not remount the widget', error)\n }\n }\n}\n"],"mappings":"AAIA,IAAM,EAAU,IAAI,IAYpB,SAAgB,EAAa,EAAa,EAAwD,CAChG,IAAM,EAAU,EAAK,KAAK,MAAM,CAAG,CAAiB,EAC9C,GAAS,EAAQ,IAAI,CAAG,CAAC,EAAE,OAAS,GAAK,EAE/C,EAAQ,OAAO,CAAG,EAClB,EAAQ,IAAI,EAAK,CAAE,QAAO,SAAQ,CAAC,EAEnC,IAAI,EAAa,GACjB,UAAa,CACX,GAAI,EAAY,OAChB,EAAa,GACb,IAAM,EAAU,EAAQ,IAAI,CAAG,EAG/B,GAFI,CAAC,IACL,IAAQ,MACJ,EAAQ,MAAQ,GAAG,OACvB,EAAQ,OAAO,CAAG,EAClB,EAAQ,QAAQ,EAChB,IAAM,EAAW,CAAC,GAAG,EAAQ,QAAQ,CAAC,CAAC,CAAC,GAAG,EAAE,EACxC,KAGL,GAAI,CACF,EAAS,EAAE,CAAC,QAAU,EAAK,KAAK,MAAM,EAAS,EAAE,CAAiB,CACpE,OAAS,EAAO,CACd,EAAS,EAAE,CAAC,YAAgB,CAAC,EAC7B,QAAQ,KAAK,wCAAyC,CAAK,CAC7D,CACF,CACF"}
package/dist/vue.js CHANGED
@@ -1,2 +1,2 @@
1
- import{init as e,n as t,t as n}from"./widget.js";import{t as r}from"./shared-mount-B9ij4vuL.js";import{computed as i,onBeforeUnmount as a,onMounted as o,toValue as s,watch as c}from"vue";function l(l){let u=i(()=>{let{enabled:e=!0,...t}=s(l);return e?n(t):null}),d=null,f=n=>{d?.(),n!==null&&t(`vue`),d=n===null?null:r(n,e)},p=null;o(()=>{f(u.value),p=c(u,f)}),a(()=>{p?.(),f(null)})}export{l as useMarkup};
1
+ import{init as e,n as t,t as n}from"./widget.js";import{t as r}from"./shared-mount-BfuEGDyD.js";import{computed as i,onBeforeUnmount as a,onMounted as o,toValue as s,watch as c}from"vue";function l(l){let u=i(()=>{let{enabled:e=!0,...t}=s(l);return e?n(t):null}),d=null,f=n=>{d?.(),n!==null&&t(`vue`),d=n===null?null:r(n,e)},p=null;o(()=>{f(u.value),p=c(u,f)}),a(()=>{p?.(),f(null)})}export{l as useMarkup};
2
2
  //# sourceMappingURL=vue.js.map