@popmelt.com/core 0.39.0 → 0.40.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.
Files changed (137) hide show
  1. package/README.md +1 -29
  2. package/claude-plugin/.claude-plugin/plugin.json +1 -1
  3. package/claude-plugin/skills/popmelt-core/SKILL.md +5 -1
  4. package/codex-plugin/.codex-plugin/plugin.json +1 -1
  5. package/codex-plugin/skills/popmelt-core/SKILL.md +5 -1
  6. package/dist/{ExploreAttachment-OA2PUTNR.mjs → ExploreAttachment-ZPC5AR5V.mjs} +1 -1
  7. package/dist/{PagePreviewLayer-HKADULHD.mjs → PagePreviewLayer-C7WBS7IX.mjs} +1 -1
  8. package/dist/ParticipantRuntime-CWE62D2G.mjs +1 -0
  9. package/dist/PhoneHostGate-NWJXZBBP.mjs +1 -0
  10. package/dist/PopmeltTasteConnectedPane-2BNDKMMB.mjs +1 -0
  11. package/dist/{PreviewRuntime-3ANAJNFO.mjs → PreviewRuntime-7EQNIOF5.mjs} +1 -1
  12. package/dist/SamplePlacementOverlay-ULOV22WR.mjs +1 -0
  13. package/dist/ShareProjectPane-KEE7EYMP.mjs +1 -0
  14. package/dist/SuppliedContext-IT25WBGQ.mjs +1 -0
  15. package/dist/ThreadErrorCard-SUFOXXLG.mjs +1 -0
  16. package/dist/ThreadPanel-NNJHQQSD.mjs +1 -0
  17. package/dist/adapter-react-three-fiber.d.mts +4 -37
  18. package/dist/adapter-react-three-fiber.mjs +1 -1
  19. package/dist/adapter-three.d.mts +14 -220
  20. package/dist/adapter-three.mjs +1 -45
  21. package/dist/bridge-entry.mjs +1 -1
  22. package/dist/browser-runtime-G6AEOA4X.mjs +1 -0
  23. package/dist/browser.d.mts +4 -4
  24. package/dist/browser.mjs +1 -1
  25. package/dist/canvas-text.d.mts +38 -0
  26. package/dist/canvas-text.mjs +1 -0
  27. package/dist/{checkFixture-I2ALOQTM.mjs → checkFixture-LBDNT3M5.mjs} +1 -1
  28. package/dist/chunk-2FHGLE7G.mjs +1 -0
  29. package/dist/chunk-32TDB3N4.mjs +1 -0
  30. package/dist/{chunk-W62YY5IT.mjs → chunk-44NLL6X3.mjs} +1 -1
  31. package/dist/chunk-4EDMISUV.mjs +1 -0
  32. package/dist/{chunk-UFUH63SR.mjs → chunk-4MLXPN7W.mjs} +1 -1
  33. package/dist/{chunk-4B6HUJCH.mjs → chunk-53QOGFAT.mjs} +1 -1
  34. package/dist/{chunk-MSWRCFPJ.mjs → chunk-6DU4ITXT.mjs} +1 -1
  35. package/dist/chunk-A4GARXVQ.mjs +1 -0
  36. package/dist/{chunk-6RMM7JB6.mjs → chunk-ADRWR5GI.mjs} +1 -1
  37. package/dist/chunk-AKEVJPGD.mjs +1 -0
  38. package/dist/{chunk-W5JUAOLA.mjs → chunk-BD7DW4UK.mjs} +1 -1
  39. package/dist/{chunk-QDFQPABM.mjs → chunk-CUVWMYUV.mjs} +1 -1
  40. package/dist/{chunk-4LN72RDZ.mjs → chunk-DBCCE7BA.mjs} +1 -1
  41. package/dist/chunk-DSTHM3V5.mjs +30 -0
  42. package/dist/{chunk-V56MNQLF.mjs → chunk-ECWY6Z6K.mjs} +1 -1
  43. package/dist/chunk-EHM2ZBQU.mjs +1 -0
  44. package/dist/{chunk-P3IOAIYB.mjs → chunk-EUFK7B6S.mjs} +1 -1
  45. package/dist/chunk-FR6VIGJ2.mjs +1 -0
  46. package/dist/chunk-HVDJYNQ6.mjs +1 -0
  47. package/dist/{chunk-TVIKC33M.mjs → chunk-KF35YUNZ.mjs} +1 -1
  48. package/dist/{chunk-D3BHAI37.mjs → chunk-KN4GC34I.mjs} +1 -1
  49. package/dist/{chunk-BDUWFDBP.mjs → chunk-KUILFVXZ.mjs} +1 -1
  50. package/dist/{chunk-FD6IIFJC.mjs → chunk-L3QE62SE.mjs} +1 -1
  51. package/dist/{chunk-IWF42SDV.mjs → chunk-MHTX52KW.mjs} +1 -1
  52. package/dist/chunk-N37INB4D.mjs +1 -0
  53. package/dist/chunk-NFPUOL4J.mjs +1 -0
  54. package/dist/{chunk-CPFVBR6Q.mjs → chunk-OECEYJNK.mjs} +1 -1
  55. package/dist/chunk-PRPXMDZ7.mjs +1 -0
  56. package/dist/chunk-Q5MIJ5F2.mjs +1 -0
  57. package/dist/chunk-QYNW5LE2.mjs +1 -0
  58. package/dist/chunk-RAABZFBD.mjs +1 -0
  59. package/dist/{chunk-OL7RDZ2R.mjs → chunk-REPKQAJK.mjs} +1 -1
  60. package/dist/chunk-RIGP4DAV.mjs +1 -0
  61. package/dist/chunk-RXC7B7SX.mjs +1 -0
  62. package/dist/{chunk-VWFST2IX.mjs → chunk-TVS2ZIAW.mjs} +1 -1
  63. package/dist/{chunk-SKM4ZXV5.mjs → chunk-UFU5IA3G.mjs} +1 -1
  64. package/dist/chunk-V7AOJQXQ.mjs +1 -0
  65. package/dist/chunk-VBH2YQLG.mjs +1 -0
  66. package/dist/{chunk-RJWFSAKE.mjs → chunk-VLTK7KWK.mjs} +1 -1
  67. package/dist/chunk-WKQGWQ3P.mjs +1 -0
  68. package/dist/chunk-WPU4472Z.mjs +1 -0
  69. package/dist/chunk-WYQZ7DAK.mjs +1 -0
  70. package/dist/chunk-X6I6KQDG.mjs +1 -0
  71. package/dist/{chunk-G6ITTTFD.mjs → chunk-XVQAHYF2.mjs} +1 -1
  72. package/dist/{chunk-3LZQLRZ2.mjs → chunk-YTIDSDPP.mjs} +1 -1
  73. package/dist/{chunk-ML7YV4RV.mjs → chunk-ZQMKLODZ.mjs} +1 -1
  74. package/dist/cli.mjs +1 -1
  75. package/dist/codex-note-context-GXC2474A.mjs +1 -0
  76. package/dist/codex-project-HVK7FSWQ.mjs +1 -0
  77. package/dist/{codex-store-mount-MNIL3VK6.mjs → codex-store-mount-KHTSSESB.mjs} +1 -1
  78. package/dist/dev-server-QMA23NJQ.mjs +1 -0
  79. package/dist/{focus-inspection-LGIRFL2T.mjs → focus-inspection-FVQ6TVGA.mjs} +1 -1
  80. package/dist/guest-admission.mjs +1 -1
  81. package/dist/guest-live-canvas.mjs +1 -1
  82. package/dist/index.d.mts +5 -5
  83. package/dist/index.mjs +1 -1
  84. package/dist/media.d.mts +3 -3
  85. package/dist/memory-legacy.d.mts +43 -1
  86. package/dist/memory-store.d.mts +5 -162
  87. package/dist/memory.d.mts +3 -531
  88. package/dist/{page-interaction-GC2UN47Y.mjs → page-interaction-YXHXEYOT.mjs} +1 -1
  89. package/dist/{page-planes-9GVbnVZa.d.mts → page-planes-Jz2yR_Wk.d.mts} +6 -1
  90. package/dist/{participantBootstrap-BTcD7XgB.d.mts → participantBootstrap-DDOxY-Cy.d.mts} +2 -2
  91. package/dist/{peer-client-XNTMFSOV.mjs → peer-client-JL754ZR7.mjs} +1 -1
  92. package/dist/plugin-astro.d.mts +1 -1
  93. package/dist/plugin-astro.mjs +1 -1
  94. package/dist/plugin-nuxt.mjs +1 -1
  95. package/dist/plugin-vite.d.mts +1 -1
  96. package/dist/plugin-vite.mjs +1 -1
  97. package/dist/server.d.mts +4 -4
  98. package/dist/server.mjs +1 -1
  99. package/dist/shared-page-QN2XRXUE.mjs +1 -0
  100. package/dist/{subjects-D_yanOQ2.d.mts → subjects-cLtt9-iK.d.mts} +12 -0
  101. package/dist/{types-CggBG-H6.d.mts → types-XKO-uva0.d.mts} +1 -1
  102. package/dist/{index-D6bSXWNT.d.mts → validate-0kt2EgVe.d.mts} +7 -40
  103. package/dist/{video-adapter-CWpR4NSt.d.mts → video-adapter-xL95wukX.d.mts} +1 -1
  104. package/package.json +7 -3
  105. package/dist/ParticipantRuntime-IU2STHIT.mjs +0 -1
  106. package/dist/PhoneHostGate-CS3KFCP5.mjs +0 -1
  107. package/dist/PopmeltTasteConnectedPane-TRQCY5SM.mjs +0 -1
  108. package/dist/SamplePlacementOverlay-SNA4WB6Z.mjs +0 -1
  109. package/dist/ShareProjectPane-QLHMNZNU.mjs +0 -1
  110. package/dist/SuppliedContext-SFOM3R3K.mjs +0 -1
  111. package/dist/ThreadErrorCard-NJUVLWMU.mjs +0 -1
  112. package/dist/ThreadPanel-RVCNMX7B.mjs +0 -1
  113. package/dist/browser-runtime-BUC4RUD7.mjs +0 -1
  114. package/dist/chunk-25EXQOPI.mjs +0 -1
  115. package/dist/chunk-742KV4YS.mjs +0 -1
  116. package/dist/chunk-ADOCYY5I.mjs +0 -1
  117. package/dist/chunk-B3RA4XAR.mjs +0 -1
  118. package/dist/chunk-B4ZKGIGU.mjs +0 -1
  119. package/dist/chunk-CHK24QU5.mjs +0 -1
  120. package/dist/chunk-DKBVNKIG.mjs +0 -24
  121. package/dist/chunk-EOAWCUFT.mjs +0 -1
  122. package/dist/chunk-FPSR4NAR.mjs +0 -1
  123. package/dist/chunk-H4GG2RS4.mjs +0 -1
  124. package/dist/chunk-K2OUXYDM.mjs +0 -1
  125. package/dist/chunk-KY4YVZ3O.mjs +0 -1
  126. package/dist/chunk-LSKP5UC6.mjs +0 -1
  127. package/dist/chunk-MLNC5TMP.mjs +0 -1
  128. package/dist/chunk-RALP6ENI.mjs +0 -30
  129. package/dist/chunk-RRB5IHBT.mjs +0 -1
  130. package/dist/chunk-WNOLXY3Y.mjs +0 -1
  131. package/dist/codex-note-context-4ORRY4CH.mjs +0 -1
  132. package/dist/codex-project-LMAR3FMS.mjs +0 -1
  133. package/dist/dev-server-ZLT7TAUF.mjs +0 -1
  134. package/dist/shared-page-JN7T4DDQ.mjs +0 -1
  135. /package/dist/{chunk-CZJILD7T.mjs → chunk-6RC7JZ73.mjs} +0 -0
  136. /package/dist/{toolbarFonts-JAGSN3DN.mjs → toolbarFonts-33BI56VQ.mjs} +0 -0
  137. /package/dist/{webpEncoder-QJRHTWUU.mjs → webpEncoder-JVMGDKHV.mjs} +0 -0
@@ -3,7 +3,7 @@ import { popmelt as popmelt$1 } from './plugin-vite.mjs';
3
3
  import 'node:http';
4
4
  import './participantBootstrap-BuTrTQbo.mjs';
5
5
  import 'vite';
6
- import './page-planes-9GVbnVZa.mjs';
6
+ import './page-planes-Jz2yR_Wk.mjs';
7
7
 
8
8
  type PopmeltAstroOptions = PopmeltPluginOptions & {
9
9
  /** Set false when an existing provider mounts the UI. */
@@ -1 +1 @@
1
- import{b as t}from"./chunk-W5JUAOLA.mjs";import"./chunk-LUTP7QBD.mjs";import"./chunk-LLVF422C.mjs";import"./chunk-4B6HUJCH.mjs";import"./chunk-HKHZBKAN.mjs";import"./chunk-CIKFUS7J.mjs";import"./chunk-PQKSXNIZ.mjs";import"./chunk-K22VZV3V.mjs";import"./chunk-YMWXWXPV.mjs";import"./chunk-UIADZXVT.mjs";import"./chunk-CZJILD7T.mjs";import"./chunk-NOHXTT24.mjs";import{fileURLToPath as e}from"url";function n(n={}){return{name:"popmelt",hooks:{"astro:config:setup"({command:r,config:i,updateConfig:s,injectScript:a}){if("dev"!==r||"1"===process.env.POPMELT_PLANE_RENDERER)return;let{client:m=!0,...d}=n;s({vite:{plugins:[t({...d,projectRoot:n.projectRoot??e(i.root)},"astro")],optimizeDeps:{include:m?["react","react/jsx-runtime","react/jsx-dev-runtime","react-dom","react-dom/client"]:[]}}}),a("page",m?o:"\nimport { bridgeUrl, projectId } from 'virtual:popmelt/bridge';\nif (bridgeUrl) window.__POPMELT_BRIDGE_URL__ = bridgeUrl;\nif (projectId) window.__POPMELT_PROJECT_ID__ = projectId;\n")}}}}var o="\nimport { bridgeUrl, projectId } from 'virtual:popmelt/bridge';\nimport { navigate } from 'astro:transitions/client';\nlet disposed = false;\nlet mounting;\nconst start = () => {\n if (disposed || mounting || !bridgeUrl || !projectId) return;\n mounting = Promise.resolve(import.meta.hot?.data.cleanup).then(async () => {\n if (disposed) return;\n const { mountPopmelt } = await import('@popmelt.com/core/browser');\n if (disposed) return;\n const handle = await mountPopmelt({ enabled: true, bridgeUrl, projectId, navigate });\n return handle;\n }).catch(error => { console.warn('[popmelt] startup failed:', error); });\n};\n// The standalone hosts live outside body, so Astro's body swaps retain them.\ndocument.addEventListener('astro:page-load', start);\nif (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', start, { once: true });\nelse start();\nimport.meta.hot?.dispose(data => {\n if (disposed) return;\n disposed = true;\n document.removeEventListener('astro:page-load', start);\n document.removeEventListener('DOMContentLoaded', start);\n data.cleanup = mounting?.then(handle => handle?.unmount());\n});\n";export{n as popmelt};
1
+ import{b as t}from"./chunk-BD7DW4UK.mjs";import"./chunk-LUTP7QBD.mjs";import"./chunk-LLVF422C.mjs";import"./chunk-53QOGFAT.mjs";import"./chunk-HKHZBKAN.mjs";import"./chunk-CIKFUS7J.mjs";import"./chunk-PQKSXNIZ.mjs";import"./chunk-K22VZV3V.mjs";import"./chunk-YMWXWXPV.mjs";import"./chunk-UIADZXVT.mjs";import"./chunk-6RC7JZ73.mjs";import"./chunk-NOHXTT24.mjs";import{fileURLToPath as e}from"url";function n(n={}){return{name:"popmelt",hooks:{"astro:config:setup"({command:r,config:i,updateConfig:s,injectScript:a}){if("dev"!==r||"1"===process.env.POPMELT_PLANE_RENDERER)return;let{client:m=!0,...d}=n;s({vite:{plugins:[t({...d,projectRoot:n.projectRoot??e(i.root)},"astro")],optimizeDeps:{include:m?["react","react/jsx-runtime","react/jsx-dev-runtime","react-dom","react-dom/client"]:[]}}}),a("page",m?o:"\nimport { bridgeUrl, projectId } from 'virtual:popmelt/bridge';\nif (bridgeUrl) window.__POPMELT_BRIDGE_URL__ = bridgeUrl;\nif (projectId) window.__POPMELT_PROJECT_ID__ = projectId;\n")}}}}var o="\nimport { bridgeUrl, projectId } from 'virtual:popmelt/bridge';\nimport { navigate } from 'astro:transitions/client';\nlet disposed = false;\nlet mounting;\nconst start = () => {\n if (disposed || mounting || !bridgeUrl || !projectId) return;\n mounting = Promise.resolve(import.meta.hot?.data.cleanup).then(async () => {\n if (disposed) return;\n const { mountPopmelt } = await import('@popmelt.com/core/browser');\n if (disposed) return;\n const handle = await mountPopmelt({ enabled: true, bridgeUrl, projectId, navigate });\n return handle;\n }).catch(error => { console.warn('[popmelt] startup failed:', error); });\n};\n// The standalone hosts live outside body, so Astro's body swaps retain them.\ndocument.addEventListener('astro:page-load', start);\nif (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', start, { once: true });\nelse start();\nimport.meta.hot?.dispose(data => {\n if (disposed) return;\n disposed = true;\n document.removeEventListener('astro:page-load', start);\n document.removeEventListener('DOMContentLoaded', start);\n data.cleanup = mounting?.then(handle => handle?.unmount());\n});\n";export{n as popmelt};
@@ -1 +1 @@
1
- import{b as e,c as t}from"./chunk-CZJILD7T.mjs";import{b as o}from"./chunk-NOHXTT24.mjs";import{addPluginTemplate as n,defineNuxtModule as r}from"nuxt/kit";var p=r({meta:{name:"@popmelt.com/core/nuxt",configKey:"popmelt"},async setup(r,p){if(!p.options.dev||"1"===process.env.POPMELT_PLANE_RENDERER)return;let s={config:{server:p.options.devServer},middlewares:{use(){}}},i=await e({...r,projectRoot:r.projectRoot??p.options.rootDir},s,3e3,void 0,"nuxt");if(null===i.port)return;i.updateOrigin&&p.hook("listen",async(e,t)=>{let o=e.address();if(!o||"string"==typeof o)return;let n="127.0.0.1"===o.address?"127.0.0.1":"::1"===o.address?"[::1]":"localhost";await i.updateOrigin(`${t.https?"https":"http"}://${n}:${o.port}`)}),p.hook("nitro:config",e=>{e.routeRules??={},Object.assign(e.routeRules,{...i.bootstrap?.planeApps&&{"/__popmelt/planes/**":{proxy:{to:`http://127.0.0.1:${i.port}/__popmelt/planes/**`,headers:{"x-popmelt-project-id":i.projectId}}}},...i.bootstrap&&{"/__popmelt/host":{proxy:`http://127.0.0.1:${i.port}/__popmelt/host?projectId=${encodeURIComponent(i.projectId)}`}},"/popmelt/phone":{proxy:`http://127.0.0.1:${i.port}/phone-host`}})}),p.hook("vite:extend",({config:e})=>{e.server??={},e.server.fs??={},e.server.fs.strict=!0,e.server.fs.deny=[...e.server.fs.deny??[".env",".env.*","*.{crt,pem}","**/.git/**"],"**/.popmelt","**/.popmelt/**"],e.server.watch??={};let t=e.server.watch.ignored;e.server.watch.ignored=[...Array.isArray(t)?t:t?[t]:[],"**/.popmelt/**"],e.optimizeDeps??={},e.optimizeDeps.include=[...new Set([...e.optimizeDeps.include??[],"react","react/jsx-runtime","react/jsx-dev-runtime","react-dom","react-dom/client"])]});let d=await t(i,s),a=d?o(d):void 0;p.hook("close",async()=>{a?.(),await(d?.release())}),n({filename:"popmelt.client.mjs",mode:"client",getContents:()=>`import { defineNuxtPlugin } from '#app';\nexport default defineNuxtPlugin((nuxtApp) => {\n let disposed = false;\n let mounting;\n const bridgeUrl = ${JSON.stringify(`http://localhost:${i.port}`)};\n const projectId = ${JSON.stringify(i.projectId)};\n ${i.bootstrap?`window.__POPMELT_PARTICIPANTS__=${JSON.stringify(i.bootstrap)};`:""}\n const dispose = () => {\n if (disposed) return;\n disposed = true;\n void mounting?.then(handle => handle?.unmount());\n };\n nuxtApp.hook('app:mounted', () => {\n if (disposed || mounting) return;\n mounting = import('@popmelt.com/core/browser').then(({ mountPopmelt }) => {\n if (disposed) return;\n return mountPopmelt({\n enabled: true,\n bridgeUrl,\n projectId,\n navigate: (url) => nuxtApp.$router.push(url),\n });\n }).then(handle => {\n if (disposed) handle?.unmount();\n return handle;\n }).catch(error => { console.warn('[popmelt] startup failed:', error); });\n });\n nuxtApp.vueApp.onUnmount(dispose);\n import.meta.hot?.dispose(dispose);\n});`})}});export{p as default};
1
+ import{b as e,c as t}from"./chunk-6RC7JZ73.mjs";import{b as o}from"./chunk-NOHXTT24.mjs";import{addPluginTemplate as n,defineNuxtModule as r}from"nuxt/kit";var p=r({meta:{name:"@popmelt.com/core/nuxt",configKey:"popmelt"},async setup(r,p){if(!p.options.dev||"1"===process.env.POPMELT_PLANE_RENDERER)return;let s={config:{server:p.options.devServer},middlewares:{use(){}}},i=await e({...r,projectRoot:r.projectRoot??p.options.rootDir},s,3e3,void 0,"nuxt");if(null===i.port)return;i.updateOrigin&&p.hook("listen",async(e,t)=>{let o=e.address();if(!o||"string"==typeof o)return;let n="127.0.0.1"===o.address?"127.0.0.1":"::1"===o.address?"[::1]":"localhost";await i.updateOrigin(`${t.https?"https":"http"}://${n}:${o.port}`)}),p.hook("nitro:config",e=>{e.routeRules??={},Object.assign(e.routeRules,{...i.bootstrap?.planeApps&&{"/__popmelt/planes/**":{proxy:{to:`http://127.0.0.1:${i.port}/__popmelt/planes/**`,headers:{"x-popmelt-project-id":i.projectId}}}},...i.bootstrap&&{"/__popmelt/host":{proxy:`http://127.0.0.1:${i.port}/__popmelt/host?projectId=${encodeURIComponent(i.projectId)}`}},"/popmelt/phone":{proxy:`http://127.0.0.1:${i.port}/phone-host`}})}),p.hook("vite:extend",({config:e})=>{e.server??={},e.server.fs??={},e.server.fs.strict=!0,e.server.fs.deny=[...e.server.fs.deny??[".env",".env.*","*.{crt,pem}","**/.git/**"],"**/.popmelt","**/.popmelt/**"],e.server.watch??={};let t=e.server.watch.ignored;e.server.watch.ignored=[...Array.isArray(t)?t:t?[t]:[],"**/.popmelt/**"],e.optimizeDeps??={},e.optimizeDeps.include=[...new Set([...e.optimizeDeps.include??[],"react","react/jsx-runtime","react/jsx-dev-runtime","react-dom","react-dom/client"])]});let d=await t(i,s),a=d?o(d):void 0;p.hook("close",async()=>{a?.(),await(d?.release())}),n({filename:"popmelt.client.mjs",mode:"client",getContents:()=>`import { defineNuxtPlugin } from '#app';\nexport default defineNuxtPlugin((nuxtApp) => {\n let disposed = false;\n let mounting;\n const bridgeUrl = ${JSON.stringify(`http://localhost:${i.port}`)};\n const projectId = ${JSON.stringify(i.projectId)};\n ${i.bootstrap?`window.__POPMELT_PARTICIPANTS__=${JSON.stringify(i.bootstrap)};`:""}\n const dispose = () => {\n if (disposed) return;\n disposed = true;\n void mounting?.then(handle => handle?.unmount());\n };\n nuxtApp.hook('app:mounted', () => {\n if (disposed || mounting) return;\n mounting = import('@popmelt.com/core/browser').then(({ mountPopmelt }) => {\n if (disposed) return;\n return mountPopmelt({\n enabled: true,\n bridgeUrl,\n projectId,\n navigate: (url) => nuxtApp.$router.push(url),\n });\n }).then(handle => {\n if (disposed) handle?.unmount();\n return handle;\n }).catch(error => { console.warn('[popmelt] startup failed:', error); });\n });\n nuxtApp.vueApp.onUnmount(dispose);\n import.meta.hot?.dispose(dispose);\n});`})}});export{p as default};
@@ -1,7 +1,7 @@
1
1
  import { P as PopmeltPluginOptions, D as DevServerLike } from './dev-server-BRrhkH5t.mjs';
2
2
  import * as vite from 'vite';
3
3
  import { createServer, ViteDevServer, Plugin as Plugin$1 } from 'vite';
4
- import { s as startParticipantLan, P as PopmeltHandle, c as createParticipantPlaneApps } from './page-planes-9GVbnVZa.mjs';
4
+ import { s as startParticipantLan, P as PopmeltHandle, c as createParticipantPlaneApps } from './page-planes-Jz2yR_Wk.mjs';
5
5
  import 'node:http';
6
6
  import './participantBootstrap-BuTrTQbo.mjs';
7
7
 
@@ -1 +1 @@
1
- import{a as m,b as p}from"./chunk-W5JUAOLA.mjs";import"./chunk-LUTP7QBD.mjs";import"./chunk-LLVF422C.mjs";import"./chunk-4B6HUJCH.mjs";import"./chunk-HKHZBKAN.mjs";import"./chunk-CIKFUS7J.mjs";import"./chunk-PQKSXNIZ.mjs";import"./chunk-K22VZV3V.mjs";import"./chunk-YMWXWXPV.mjs";import"./chunk-UIADZXVT.mjs";import"./chunk-CZJILD7T.mjs";import"./chunk-NOHXTT24.mjs";export{m as participantPlanes,p as popmelt};
1
+ import{a as m,b as p}from"./chunk-BD7DW4UK.mjs";import"./chunk-LUTP7QBD.mjs";import"./chunk-LLVF422C.mjs";import"./chunk-53QOGFAT.mjs";import"./chunk-HKHZBKAN.mjs";import"./chunk-CIKFUS7J.mjs";import"./chunk-PQKSXNIZ.mjs";import"./chunk-K22VZV3V.mjs";import"./chunk-YMWXWXPV.mjs";import"./chunk-UIADZXVT.mjs";import"./chunk-6RC7JZ73.mjs";import"./chunk-NOHXTT24.mjs";export{m as participantPlanes,p as popmelt};
package/dist/server.d.mts CHANGED
@@ -1,10 +1,10 @@
1
- import { a as ParticipantAgentAdapter, b as ParticipantCredential, P as PopmeltHandle, d as ParticipantPlaneApps, e as PopmeltOptions, f as PageFramework, N as NextBundlerFlag, G as GuestAppRequest, g as PeerSessions, h as PeerShape } from './page-planes-9GVbnVZa.mjs';
2
- export { i as ParticipantAgentView, j as createParticipantGuestAccess, c as createParticipantPlaneApps } from './page-planes-9GVbnVZa.mjs';
1
+ import { a as ParticipantAgentAdapter, b as ParticipantCredential, P as PopmeltHandle, d as ParticipantPlaneApps, e as PopmeltOptions, f as PageFramework, N as NextBundlerFlag, G as GuestAppRequest, g as PeerSessions, h as PeerShape } from './page-planes-Jz2yR_Wk.mjs';
2
+ export { i as ParticipantAgentView, j as createParticipantGuestAccess, c as createParticipantPlaneApps } from './page-planes-Jz2yR_Wk.mjs';
3
3
  import { P as ParticipantBootstrapConfig } from './participantBootstrap-BuTrTQbo.mjs';
4
4
  import * as node_http from 'node:http';
5
5
  import { IncomingMessage, ServerResponse } from 'node:http';
6
- import { I as ImprintGraph, a as ImprintTransaction, b as ImprintMutation, c as ImprintContext, d as ImprintSummaryKind, e as ImprintExplanationKind, f as ImprintScope, g as ImprintTopologyRelationType, h as ImprintExplanationRef, i as ImprintThreadSummary, j as ImprintGroundingAction, k as ImprintRelation, Q as QualifiedImprintRelation } from './types-CggBG-H6.mjs';
7
- export { l as ImprintConcrete, m as ImprintEvidence, n as ImprintExplanation, o as ImprintExplanationState, p as ImprintRelationType } from './types-CggBG-H6.mjs';
6
+ import { c as ImprintGraph, d as ImprintTransaction, e as ImprintMutation, f as ImprintContext, g as ImprintSummaryKind, h as ImprintExplanationKind, i as ImprintScope, j as ImprintTopologyRelationType, k as ImprintExplanationRef, I as ImprintThreadSummary, a as ImprintGroundingAction, l as ImprintRelation, Q as QualifiedImprintRelation } from './types-XKO-uva0.mjs';
7
+ export { m as ImprintConcrete, n as ImprintEvidence, o as ImprintExplanation, p as ImprintExplanationState, q as ImprintRelationType } from './types-XKO-uva0.mjs';
8
8
  import 'vite';
9
9
 
10
10
  /** One disposable, local Chrome profile per agent. Never attaches to a user's browser. */
package/dist/server.mjs CHANGED
@@ -1 +1 @@
1
- import{a as t,b as s,c as a}from"./chunk-QDFQPABM.mjs";import"./chunk-CPFVBR6Q.mjs";import"./chunk-MPEVFQ43.mjs";import"./chunk-IWF42SDV.mjs";import{i as m,j as r,k as i,l as p}from"./chunk-RALP6ENI.mjs";import"./chunk-PYGRFSUU.mjs";import"./chunk-6EO73WJN.mjs";import{a as n,b as o}from"./chunk-NC7YXD7Q.mjs";import"./chunk-KOHR4LAQ.mjs";import{b as c,d as e,e as u}from"./chunk-LLVF422C.mjs";import{b as j}from"./chunk-4B6HUJCH.mjs";import"./chunk-HKHZBKAN.mjs";import"./chunk-CIKFUS7J.mjs";import"./chunk-PQKSXNIZ.mjs";import"./chunk-K22VZV3V.mjs";import"./chunk-YMWXWXPV.mjs";import"./chunk-UIADZXVT.mjs";import"./chunk-NOHXTT24.mjs";export{p as ImprintService,m as ImprintStore,u as createParticipantDevBootstrap,c as createParticipantGuestAccess,e as createParticipantHostEntry,j as createParticipantPlaneApps,i as formatImprintPrompt,n as imprintExplanationRef,t as managedParticipantBrowser,r as parseImprintDraft,o as qualifyImprintRelation,a as startDevelopmentSession,s as startPopmelt};
1
+ import{a as t,b as s,c as a}from"./chunk-CUVWMYUV.mjs";import"./chunk-OECEYJNK.mjs";import"./chunk-MPEVFQ43.mjs";import"./chunk-MHTX52KW.mjs";import{i as m,j as r,k as i,l as p}from"./chunk-DSTHM3V5.mjs";import"./chunk-PYGRFSUU.mjs";import"./chunk-6EO73WJN.mjs";import{a as n,b as o}from"./chunk-NC7YXD7Q.mjs";import"./chunk-KOHR4LAQ.mjs";import{b as c,d as e,e as u}from"./chunk-LLVF422C.mjs";import{b as j}from"./chunk-53QOGFAT.mjs";import"./chunk-HKHZBKAN.mjs";import"./chunk-CIKFUS7J.mjs";import"./chunk-PQKSXNIZ.mjs";import"./chunk-K22VZV3V.mjs";import"./chunk-YMWXWXPV.mjs";import"./chunk-UIADZXVT.mjs";import"./chunk-NOHXTT24.mjs";export{p as ImprintService,m as ImprintStore,u as createParticipantDevBootstrap,c as createParticipantGuestAccess,e as createParticipantHostEntry,j as createParticipantPlaneApps,i as formatImprintPrompt,n as imprintExplanationRef,t as managedParticipantBrowser,r as parseImprintDraft,o as qualifyImprintRelation,a as startDevelopmentSession,s as startPopmelt};
@@ -0,0 +1 @@
1
+ import{c as a,d as r}from"./chunk-MHTX52KW.mjs";import"./chunk-HKHZBKAN.mjs";import"./chunk-CIKFUS7J.mjs";import"./chunk-UIADZXVT.mjs";export{r as createSharedPageReader,a as sharedPagePath};
@@ -249,6 +249,7 @@ type StyleModification = {
249
249
  pathname?: string;
250
250
  };
251
251
  type TextModification = {
252
+ target?: OpaqueTargetReference;
252
253
  /** Whole-field preview for an edit stored as individual inline text runs. */
253
254
  canvasLabel?: string;
254
255
  paragraphs?: ParagraphChange;
@@ -530,6 +531,17 @@ type PopmeltSubjectAdapter = {
530
531
  y: number;
531
532
  }): PopmeltSubject | null;
532
533
  resolve(key: string): PopmeltSubject | null;
534
+ /** Editable copy by stable key, including while its view is hidden. value is
535
+ * the authored source. preview(null) releases Core's temporary override. */
536
+ getEditableText?(key: string): {
537
+ value: string;
538
+ font?: string;
539
+ /** Use a readable source editor for wrapped, projected, or partially revealed copy. */
540
+ sourceEditor?: boolean;
541
+ /** Optionally hold renderer playback while editing and return its release. */
542
+ beginEdit?(): void | (() => void);
543
+ preview(value: string | null): void;
544
+ } | null;
533
545
  /** Recreate a missing durable subject from annotation-captured context. */
534
546
  restoreSubject?(key: string, elementInfo: ElementInfo): PopmeltSubject | null;
535
547
  /** Paint a live hover accent on this subject. Release it when hover ends. */
@@ -232,4 +232,4 @@ type ImprintView = {
232
232
  explanations: ImprintViewExplanation[];
233
233
  };
234
234
 
235
- export type { ImprintGraph as I, QualifiedImprintRelation as Q, ImprintTransaction as a, ImprintMutation as b, ImprintContext as c, ImprintSummaryKind as d, ImprintExplanationKind as e, ImprintScope as f, ImprintTopologyRelationType as g, ImprintExplanationRef as h, ImprintThreadSummary as i, ImprintGroundingAction as j, ImprintRelation as k, ImprintConcrete as l, ImprintEvidence as m, ImprintExplanation as n, ImprintExplanationState as o, ImprintRelationType as p, ImprintView as q };
235
+ export type { ImprintThreadSummary as I, QualifiedImprintRelation as Q, ImprintGroundingAction as a, ImprintView as b, ImprintGraph as c, ImprintTransaction as d, ImprintMutation as e, ImprintContext as f, ImprintSummaryKind as g, ImprintExplanationKind as h, ImprintScope as i, ImprintTopologyRelationType as j, ImprintExplanationRef as k, ImprintRelation as l, ImprintConcrete as m, ImprintEvidence as n, ImprintExplanation as o, ImprintExplanationState as p, ImprintRelationType as q };
@@ -521,45 +521,12 @@ type SchemaIssue = {
521
521
  message: string;
522
522
  severity: 'error' | 'warning';
523
523
  };
524
-
525
- type LegacyImportIssue = {
526
- severity: 'info' | 'warning' | 'error';
527
- code: string;
528
- source?: string;
529
- message: string;
530
- };
531
- type LegacyImportReport = {
532
- projectRoot: string;
533
- source: {
534
- threads: number;
535
- messages: number;
536
- decisionEnvelopes: number;
537
- modelEntries: number;
538
- artifactsReferenced: number;
539
- };
540
- imported: Record<string, number>;
541
- unresolvedAcceptance: number;
542
- deferredModelEntries: number;
543
- proofCases: Array<{
544
- legacyId: string;
545
- threadFound: boolean;
546
- decisionEnvelopeFound: boolean;
547
- recordIds: string[];
548
- }>;
549
- issues: LegacyImportIssue[];
550
- schemaIssues: SchemaIssue[];
551
- };
552
- type LegacyImportResult = {
553
- bundle: ProjectMemoryBundle;
554
- report: LegacyImportReport;
555
- };
556
- type LegacyImportOptions = {
557
- projectRoot: string;
558
- projectKey?: string;
559
- proofCaseIds?: string[];
560
- writerVersion?: string;
524
+ type SchemaValidationResult = {
525
+ valid: boolean;
526
+ issues: SchemaIssue[];
561
527
  };
562
- declare function legacyUuidV7(namespace: string, kind: string, legacyId: string, occurredAt: number): string;
563
- declare function importLegacyProject(options: LegacyImportOptions): Promise<LegacyImportResult>;
528
+ declare function isUuidV7(value: string): boolean;
529
+ declare function validateProjectMemoryBundle(bundle: ProjectMemoryBundle): SchemaValidationResult;
530
+ declare function validateRetrievalPacket(packet: RetrievalPacket): SchemaValidationResult;
564
531
 
565
- export { type AuthorityContext as A, type CanonicalRecord as C, type DecisionKind as D, type IterationOutcome as I, type JsonValue as J, type LifecycleEvent as L, type MemoryId as M, type ProjectMemoryBundle as P, type RetrievalPacket as R, type SourceReference as S, type Timestamp as T, type ProposalRecord as a, type DecisionRecord as b, type DecisionSubject as c, type ProposalDeferralContext as d, type RelationshipRecord as e, type ArtifactManifestEntry as f, type Tombstone as g, type IterationRecord as h, type LegacyImportOptions as i, type LegacyImportReport as j, type ModelEntryRecord as k, type LegacyImportIssue as l, type LegacyImportResult as m, importLegacyProject as n, legacyUuidV7 as o };
532
+ export { type MemoryObjectType as $, type ArtifactManifestEntry as A, type EvalSpecRecord as B, type CanonicalRecord as C, type DecisionKind as D, type EntityReference as E, type EvalSpecState as F, type EvidenceKind as G, type EvidenceRecord as H, type IterationOutcome as I, type JsonValue as J, type ExecutionContext as K, type LifecycleEvent as L, type ModelEntryRecord as M, type FreshnessSignalRecord as N, type FreshnessSignalType as O, type ProjectMemoryBundle as P, type FreshnessTargetKind as Q, type RelationshipRecord as R, type SourceReference as S, type Tombstone as T, type ImplementationAttemptRecord as U, type ImplementationState as V, type JsonPrimitive as W, MEMORY_FORMAT_VERSION as X, MEMORY_SCHEMA_VERSION as Y, type MemoryFeature as Z, type MemoryFormatVersion as _, type ProposalRecord as a, type MemorySchemaVersion as a0, type ModelProjectionRecord as a1, type ObservationRecord as a2, type ObservationState as a3, type ParticipantKind as a4, type ParticipantRecord as a5, type ParticipantStance as a6, type ProjectMemoryManifest as a7, type ProposalState as a8, type Provenance as a9, type RelationshipType as aa, type RetrievalConflict as ab, type RetrievalDecision as ac, type RetrievalEvidenceSummary as ad, type RetrievalUncertainty as ae, type SchemaIssue as af, type SourceReferenceKind as ag, type SubjectLocator as ah, type SubjectLocatorKind as ai, type SubjectMatch as aj, type SubjectRecord as ak, type SubjectType as al, type ThreadOutcome as am, type ThreadRecord as an, type VerificationAttemptRecord as ao, type VerificationState as ap, type VerificationTarget as aq, isUuidV7 as ar, validateProjectMemoryBundle as as, validateRetrievalPacket as at, type IterationRecord as b, type DecisionRecord as c, type MemoryId as d, type Timestamp as e, type RetrievalPacket as f, type AuthorityContext as g, type ProposalDeferralContext as h, type DecisionSubject as i, type SchemaValidationResult as j, type AdvisoryConcreteBinding as k, type AdvisoryExplanationKind as l, type AdvisoryExplanationRecord as m, type AdvisoryExplanationScope as n, type AdvisoryExplanationState as o, type ArtifactKind as p, type AssertionOrigin as q, type AuthorityGrantRecord as r, type AuthorityLevel as s, type AuthorityMode as t, type CaptureContext as u, type CoverageClaim as v, type DecisionState as w, type EntityType as x, type EvalDependency as y, type EvalScenario as z };
@@ -1,4 +1,4 @@
1
- import { P as PopmeltSubjectAdapter, b as PopmeltSubject, E as ElementInfo, c as PopmeltSubjectCreationSession, a as PopmeltSubjectBounds, d as PopmeltSubjectOutlinePoint, e as PopmeltSubjectTrackingAnchor } from './subjects-D_yanOQ2.mjs';
1
+ import { P as PopmeltSubjectAdapter, b as PopmeltSubject, E as ElementInfo, c as PopmeltSubjectCreationSession, a as PopmeltSubjectBounds, d as PopmeltSubjectOutlinePoint, e as PopmeltSubjectTrackingAnchor } from './subjects-cLtt9-iK.mjs';
2
2
 
3
3
  /** Geometry is normalized against the loaded image, not its rendered size. */
4
4
  type ImageObjectBox = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@popmelt.com/core",
3
- "version": "0.39.0",
3
+ "version": "0.40.1",
4
4
  "description": "A tiny, powerful design layer for humans and AI",
5
5
  "license": "PolyForm-Shield-1.0.0",
6
6
  "author": "Popmelt <reb@popmelt.com> (https://popmelt.com)",
@@ -117,6 +117,10 @@
117
117
  "types": "./dist/media.d.mts",
118
118
  "import": "./dist/media.mjs"
119
119
  },
120
+ "./canvas-text": {
121
+ "types": "./dist/canvas-text.d.mts",
122
+ "import": "./dist/canvas-text.mjs"
123
+ },
120
124
  "./three": {
121
125
  "types": "./dist/adapter-three.d.mts",
122
126
  "import": "./dist/adapter-three.mjs"
@@ -175,7 +179,7 @@
175
179
  "devDependencies": {
176
180
  "@jsquash/webp": "1.5.0",
177
181
  "qrcode-generator": "2.0.4",
178
- "nuxt": "4.6.3",
182
+ "nuxt": "4.6.4",
179
183
  "@kit/eslint-config": "workspace:^",
180
184
  "@react-three/fiber": "9.7.0",
181
185
  "@tanstack/react-router": "1.120.5",
@@ -189,7 +193,7 @@
189
193
  "eslint": "^9.24.0",
190
194
  "geist": "1.7.2",
191
195
  "jsdom": "26.1.0",
192
- "next": "15.5.28",
196
+ "next": "15.5.29",
193
197
  "prettier": "3.5.3",
194
198
  "react": "19.1.0",
195
199
  "react-dom": "19.1.0",
@@ -1 +0,0 @@
1
- "use client";import{d as t,b as e,c as o,a as r}from"./chunk-D3BHAI37.mjs";import"./chunk-SKM4ZXV5.mjs";import"./chunk-MLNC5TMP.mjs";import{f as i}from"./chunk-DKBVNKIG.mjs";import"./chunk-BDUWFDBP.mjs";import"./chunk-MSWRCFPJ.mjs";import"./chunk-OL7RDZ2R.mjs";import"./chunk-B4RLDY5H.mjs";import"./chunk-PH2MLB3T.mjs";import"./chunk-XTOCFTVW.mjs";import"./chunk-G6ITTTFD.mjs";import"./chunk-SOGN7S54.mjs";import"./chunk-4LN72RDZ.mjs";import"./chunk-WNOLXY3Y.mjs";import{a as n}from"./chunk-V56MNQLF.mjs";import{i as a,Y as s}from"./chunk-RRB5IHBT.mjs";import"./chunk-B3RA4XAR.mjs";import"./chunk-ADOCYY5I.mjs";import"./chunk-G2ZHJXHZ.mjs";import"./chunk-TMSGNHXH.mjs";import"./chunk-53SKVMWR.mjs";import"./chunk-3LZQLRZ2.mjs";import"./chunk-RJWFSAKE.mjs";import"./chunk-EOAWCUFT.mjs";import"./chunk-2F2BVGFH.mjs";import"./chunk-RWZ7SVMO.mjs";import"./chunk-RK6UROPO.mjs";import"./chunk-5IZHN3A7.mjs";import"./chunk-AOTDTBQO.mjs";import"./chunk-HAZXZ5TU.mjs";import"./chunk-TVIKC33M.mjs";import"./chunk-25EXQOPI.mjs";import"./chunk-VXRRHXUP.mjs";import"./chunk-WP2SHSCG.mjs";import{e as c,g as l,f as p}from"./chunk-AAMUU2QA.mjs";import"./chunk-LH7HKUCK.mjs";import{a as m}from"./chunk-B4ZKGIGU.mjs";import{b as h,f as u,c as d,d as f}from"./chunk-5TCWBNV4.mjs";import{p as j}from"./chunk-742KV4YS.mjs";import"./chunk-CHK24QU5.mjs";import"./chunk-ATLUO4G7.mjs";import"./chunk-H4GG2RS4.mjs";import"./chunk-C2ZSNUXQ.mjs";import"./chunk-FPSR4NAR.mjs";import"./chunk-EILBHZDX.mjs";import"./chunk-HQVWOBYH.mjs";import"./chunk-OREALBUO.mjs";import"./chunk-B4DYUYX4.mjs";import"./chunk-CK3CDA3L.mjs";import"./chunk-ZVDKW7TO.mjs";import"./chunk-Q6C7ZA3H.mjs";import{c as k,a as g}from"./chunk-7D4BUDKG.mjs";import"./chunk-OEJXPUAR.mjs";import"./chunk-HM6EBJVO.mjs";import{U as w}from"./chunk-OA63PYHZ.mjs";import"./chunk-6RMM7JB6.mjs";import{b as y}from"./chunk-SUAHDXJZ.mjs";import"./chunk-YGP6PPOZ.mjs";import{useState as S,useSyncExternalStore as v,useEffect as I}from"react";import{jsx as O,jsxs as P}from"react/jsx-runtime";function A(t,i){let n,a={phase:"starting"},m=0,j=!1,k=!1,g=0,w=new Set,S=`popmelt-participant:${t.projectId}`,v=new h(t.url,t.projectId),I=t=>{if(!k){a=t;for(let t of w)t()}},O=()=>history.state?.popmeltGuestEntry===t.projectId,P=e=>history.replaceState({...history.state,popmeltGuestEntry:t.projectId},"",e),A=t=>fetch("/__popmelt/host",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify(t),redirect:"error"}),H=async(e={},o=!1,r)=>{if(y(t.url))return null;let i=await A(e);if(403===i.status){let e=i.headers.get("X-Popmelt-Host-Origin"),n=i.headers.get("X-Popmelt-Session"),a=new URL(location.href);if(!o||!n||window.top!==window||!["localhost","127.0.0.1","[::1]"].includes(a.hostname)||a.pathname.startsWith("/__popmelt/")||a.searchParams.has("__popmelt_code_preview")||a.hash.includes("popmelt-")||O())return null;let s=localStorage.getItem(`popmelt-admission:${t.projectId}`);if(s)try{if(JSON.parse(s)?.receipt)return null}catch{return null}if(e&&function(t,e){try{let o=new URL(t),r=new URL(e),i=["localhost","127.0.0.1","[::1]"];return o.origin===t&&r.origin===e&&t!==e&&["http:","https:"].includes(o.protocol)&&o.protocol===r.protocol&&o.port===r.port&&i.includes(o.hostname)&&i.includes(r.hostname)}catch{return!1}}(location.origin,e)){let t=await fetch(e+"/__popmelt/host",{method:"HEAD",credentials:"omit",redirect:"error",referrerPolicy:"no-referrer",signal:AbortSignal.timeout(2e3)}).catch(()=>null);if(!k&&204===t?.status&&t.headers.get("X-Popmelt-Session")===n)throw a.host=new URL(e).host,location.replace(a.href),R;return null}let c=i.headers.get("X-Popmelt-Local-Port");if(!c||!/^[1-9]\d{0,4}$/.test(c)||Number(c)>65535)return null;let l=await fetch("http://127.0.0.1:"+c+"/",{method:"POST",headers:{"X-Popmelt-Session":n},credentials:"omit",cache:"no-store",redirect:"error",referrerPolicy:"no-referrer",signal:AbortSignal.timeout(6500)}).catch(()=>null);if(!l?.ok||k)return null;let p=await l.json().catch(()=>null);if("string"!=typeof p?.proof||(i=await A({localProof:p.proof,previousId:r}),403===i.status))return null}if(!i.ok)throw new Error(`Host entry unavailable (${i.status}).`);let n=`popmelt-before-participants:${t.projectId}`;return null===localStorage.getItem(n)&&localStorage.setItem(n,JSON.stringify(Object.fromEntries(Object.values(s(t.projectId)).map(t=>[t,localStorage.getItem(t)])))),await i.json()},R=Symbol("navigating"),b=async(a,s=g)=>{if(k||s!==g)return;let m=await r({bridgeUrl:t.url,projectId:t.projectId,credential:a,runtimeStorage:sessionStorage,observedSource:{sourceId:t.projectId,revision:t.revision},loadOwnSource:i,prepareApplication:t.planeApps?async r=>{if(k||s!==g)throw R;let i=c(location.pathname);if(r.author.id===a.participantId&&"host"===r.author.relationship&&!y(t.url)){if("/"!==i){let t=new URL(location.href);throw t.pathname=p(t.pathname),location.replace(t.href),R}return("/"===r.ownWorkspace?.basePath?r.ownWorkspace.revision:void 0)??r.draft.source?.revision??t.revision}let n=await e(a,a.participantId,void 0,location.pathname);if(k||s!==g)throw R;let m=o(n.application);if(t.appVersion??(t.appVersion=n.application.version),m!==l(location.pathname)||t.appVersion&&t.appVersion!==n.application.version)throw localStorage.setItem(S,JSON.stringify(a)),location.replace(m+location.search+location.hash),R;return n.application.basis??t.revision}:void 0}).catch(t=>{if(t!==R)throw t});if(m){if(k||s!==g)return void m.dispose();try{localStorage.setItem(S,JSON.stringify(a))}catch(t){throw m.dispose(),t}if(n?.dispose(),O()){let t={...history.state};delete t.popmeltGuestEntry,history.replaceState(t,"")}n=m,I({phase:"connected",connection:m}),H({credential:a}).catch(()=>{})}},U=()=>{P(location.href),g++,n?.dispose(),n=void 0,function(t,e){t.removeItem(`popmelt-participant:${e}`);let o,r=`popmelt-admission:${e}`;try{o=JSON.parse(t.getItem(r)??"null")}catch{return void t.removeItem(r)}o&&"object"==typeof o&&t.setItem(r,JSON.stringify({name:o.name,colorIdentity:o.colorIdentity??o.receipt}))}(localStorage,t.projectId),I({phase:"entry",invitation:null})};return{client:v,getSnapshot:()=>a,subscribe:t=>(w.add(t),()=>{w.delete(t)}),retain(){if(k)throw new Error("Participant lifecycle is disposed");m++,j||(j=!0,(async()=>{let t=u(location.href),e=new URL(t.cleanUrl),o=new URLSearchParams(e.hash.slice(1)),r=o.get("popmelt-host");o.delete("popmelt-host"),r&&(e.hash=o.toString()),t.token?P(e.href):e.href!==location.href&&history.replaceState(history.state,"",e);let i=null;if(r){if(i=await H({token:r}),!i&&!t.token&&(i=await H({},!0)),!i)throw new Error("Host entry expired. Use the current private host link.")}else if(!t.token&&!O()){try{i=JSON.parse(localStorage.getItem(S)??"null")}catch{}i??(i=await H({},!0))}if(k)return;if(!i)return void I({phase:"entry",invitation:t.token??null});let n=g;for(let e=1;!k&&n===g;e++)try{return void await b(i,n)}catch(o){if(k||n!==g)return;if(d(o)){I({phase:"error",message:o.message}),await new Promise(t=>setTimeout(t,f(e)));continue}if("access_removed"===o.code)return void U();if(401!==o.status)throw o;let a=await H({},!r&&!t.token,i.participantId);return void(a?await b(a):U())}})().catch(t=>{t!==R&&I({phase:"error",message:t.message})}));let t=!1;return()=>{t||(t=!0,m--,queueMicrotask(()=>{m||k||(k=!0,g++,n?.dispose(),n=void 0,w.clear())}))}},removed:U,async join(e,o){if("entry"!==a.phase||!a.invitation||k)throw new Error("No active invitation");if(!o)throw new Error("Peer identity is not ready");let r=g,i=await v.joinOrRequestAdmission(a.invitation,e,o);if(!k&&r===g){if("admission"in i)return localStorage.setItem(`popmelt-admission:${t.projectId}`,JSON.stringify({name:i.admission.name,receipt:o,colorIdentity:o})),void I({phase:"entry",invitation:null});await b(i.joined.credential,r)}},admit:t=>b(t)}}function H({config:r,loadOwnSource:s,children:p}){let[h]=S(()=>A(r,s)),u=a(),d=v(h.subscribe,h.getSnapshot,h.getSnapshot);I(()=>h.retain(),[h]);let[f,H,R]=k(),b="connected"===d.phase?d.connection:null;if(I(()=>{if(!b||!r.planeApps)return;let t,i=new AbortController,n=b.isHost&&!y(r.url)&&"/"===c(location.pathname),a=n?void 0:r.appVersion,s=async()=>{try{let t=await e(b.credential,b.credential.participantId,i.signal,location.pathname);if(n&&"/"!==t.application.basePath)throw new Error("Host checkout unavailable");let s=o(t.application);if(a??(a=t.application.version),!i.signal.aborted&&(s!==l(location.pathname)||t.application.version!==a)){if(b.isHost&&!y(r.url)){let t=await fetch(s+location.search,{method:"HEAD",headers:{Accept:"text/html"},mode:"same-origin",cache:"no-store",signal:i.signal});if(!t.ok||!t.headers.get("content-type")?.includes("text/html")||l(new URL(t.url).pathname)!==s)throw new Error("Host plane document unavailable")}return await b.state.flush(),void(i.signal.aborted||(s===l(location.pathname)?location.reload():location.replace(s+location.search+location.hash)))}}catch{}i.signal.aborted||(t=setTimeout(s,1500))};return s(),()=>{i.abort(),clearTimeout(t)}},[r.planeApps,r.appVersion,r.url,b,u]),b)return O(t,{connection:b,codePreviewUrl:location.href,planeApps:r.planeApps,onAccessRemoved:h.removed,children:p});let U="starting"===d.phase||"error"===d.phase,L="entry"===d.phase?d.invitation:null;return O(n,{children:O("div",{"data-devtools":"participant-entry",style:{display:"contents",pointerEvents:"auto"},children:U?O(i,{entry:{theme:f,themePreference:R,onThemePreferenceChange:H,ariaLabel:"starting"===d.phase?"Popmelt connecting":"Popmelt disconnected",action:null,logoOnly:!0,connected:!1,connection:P("span",{"data-popmelt-entry-content":!0,role:"status",style:{...j(g[f],!1),cursor:"default"},children:[O(w,{size:14,strokeWidth:1.5,"aria-hidden":"true"}),"starting"===d.phase?"Connecting…":"Disconnected"]})}}):O(m,{showHostLinkHelp:window.top===window&&["localhost","127.0.0.1","[::1]"].includes(location.hostname)&&!y(r.url)&&"/"===c(location.pathname),client:h.client,storage:localStorage,storageKey:`popmelt-admission:${r.projectId}`,theme:f,themePreference:R,onThemePreferenceChange:H,onAdmitted:h.admit,onJoin:L?h.join:void 0},L??"request-access")})})}export{H as default};
@@ -1 +0,0 @@
1
- "use client";import{a as r,d as t}from"./chunk-D3BHAI37.mjs";import"./chunk-SKM4ZXV5.mjs";import"./chunk-MLNC5TMP.mjs";import"./chunk-G6ITTTFD.mjs";import"./chunk-SOGN7S54.mjs";import"./chunk-4LN72RDZ.mjs";import"./chunk-WNOLXY3Y.mjs";import"./chunk-RRB5IHBT.mjs";import"./chunk-B3RA4XAR.mjs";import"./chunk-ADOCYY5I.mjs";import"./chunk-G2ZHJXHZ.mjs";import"./chunk-TMSGNHXH.mjs";import"./chunk-53SKVMWR.mjs";import"./chunk-3LZQLRZ2.mjs";import"./chunk-RJWFSAKE.mjs";import"./chunk-EOAWCUFT.mjs";import"./chunk-2F2BVGFH.mjs";import"./chunk-RWZ7SVMO.mjs";import"./chunk-RK6UROPO.mjs";import"./chunk-5IZHN3A7.mjs";import"./chunk-AOTDTBQO.mjs";import"./chunk-HAZXZ5TU.mjs";import"./chunk-TVIKC33M.mjs";import"./chunk-25EXQOPI.mjs";import"./chunk-VXRRHXUP.mjs";import"./chunk-WP2SHSCG.mjs";import"./chunk-AAMUU2QA.mjs";import"./chunk-LH7HKUCK.mjs";import"./chunk-5TCWBNV4.mjs";import"./chunk-EILBHZDX.mjs";import"./chunk-HQVWOBYH.mjs";import"./chunk-OREALBUO.mjs";import"./chunk-B4DYUYX4.mjs";import"./chunk-CK3CDA3L.mjs";import"./chunk-ZVDKW7TO.mjs";import"./chunk-Q6C7ZA3H.mjs";import"./chunk-7D4BUDKG.mjs";import{b as o}from"./chunk-OEJXPUAR.mjs";import{d as n,f as i,c as m,a as e}from"./chunk-HM6EBJVO.mjs";import"./chunk-OA63PYHZ.mjs";import"./chunk-6RMM7JB6.mjs";import"./chunk-SUAHDXJZ.mjs";import"./chunk-YGP6PPOZ.mjs";import{useState as c,useEffect as s,cloneElement as p}from"react";import{jsxs as h,jsx as u}from"react/jsx-runtime";function j({children:j,projectId:k,participantConfig:a}){let[l,d]=c(null),[I,H]=c("");if(s(()=>{let t,m,c=!1;return d(null),H(""),n(k).then(async n=>{if(c)return;let s=location.origin+e;m=i(s,n);let p=await o(s+"/status",{signal:AbortSignal.timeout(6e3)}),h=p.ok?await p.json():null;if(h?.projectId!==n.projectId)throw new Error("Phone access expired. Create a fresh pairing link in the project terminal.");if(!c){if(h.phoneParticipantId)t=await r({projectId:n.projectId,bridgeUrl:s,credential:{participantId:h.phoneParticipantId,token:""},runtimeStorage:sessionStorage,observedSource:{sourceId:n.projectId,revision:a?.revision??"unversioned"}});else if(a)throw new Error("This phone is not connected to the multiplayer host.");c?t?.dispose():d({bridgeUrl:s,projectId:n.projectId,connection:t})}}).catch(r=>{m?.(),c||H(r instanceof Error?r.message:"Phone pairing failed.")}),()=>{c=!0,t?.dispose(),m?.()}},[k,a]),I)return h("p",{role:"alert","data-devtools":"phone-pairing-error",children:[I," ",u("button",{type:"button",onClick:m,children:"Forget this pairing"})]});if(!l)return null;let A=p(j,{bridgeUrl:l.bridgeUrl,projectId:l.projectId});return l.connection?u(t,{connection:l.connection,onAccessRemoved:m,children:A}):A}export{j as PhoneHostGate};