semiotic 3.10.0 → 3.10.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 (191) hide show
  1. package/README.md +55 -59
  2. package/ai/artifact-surface-inventory.json +1 -1
  3. package/ai/componentMetadata.cjs +3 -1
  4. package/ai/dist/mcp-server.js +45 -45
  5. package/ai/examples.md +67 -0
  6. package/ai/reference.md +75 -1
  7. package/ai/schema.json +5199 -1
  8. package/ai/surface-manifest.json +24 -3
  9. package/ai/task-packets/compare-category-totals.json +6 -6
  10. package/ai/task-packets/compare-category-totals.md +3 -3
  11. package/ai/task-packets/correct-published-chart.json +6 -6
  12. package/ai/task-packets/correct-published-chart.md +3 -3
  13. package/ai/task-packets/index.json +6 -6
  14. package/ai/task-packets/update-live-chart.json +6 -6
  15. package/ai/task-packets/update-live-chart.md +3 -3
  16. package/dist/c-2RL2QPZJ.min.js +1 -0
  17. package/dist/c-45CQWZZ6.min.js +1 -0
  18. package/dist/{c-PP6VY3QU.min.js → c-4BRHKVKV.min.js} +1 -1
  19. package/dist/c-7DVPSB5C.min.js +1 -0
  20. package/dist/{c-XDQKXPX4.min.js → c-A7OGOFSL.min.js} +1 -1
  21. package/dist/{c-AZKPVBOC.min.js → c-AH5HWZWS.min.js} +1 -1
  22. package/dist/c-B7GW7IHJ.min.js +1 -0
  23. package/dist/{c-ROEHCIGV.min.js → c-C3TZLTZK.min.js} +1 -1
  24. package/dist/c-CGQAQWBV.min.js +1 -0
  25. package/dist/c-DIPEYUOW.min.js +1 -0
  26. package/dist/{c-WNGH47HF.min.js → c-E72OTUZU.min.js} +1 -1
  27. package/dist/{c-DY2676CR.min.js → c-EUMPMDCS.min.js} +1 -1
  28. package/dist/c-EZZT2WAE.min.js +1 -0
  29. package/dist/c-FHBVFCQB.min.js +1 -0
  30. package/dist/{c-E32M6XW5.min.js → c-G4HCO2IQ.min.js} +1 -1
  31. package/dist/{c-ZYPXQF7B.min.js → c-G5VIJEOK.min.js} +1 -1
  32. package/dist/c-GHVOXAYH.min.js +1 -0
  33. package/dist/{c-EBOQ7ER7.min.js → c-HP4ZFM47.min.js} +1 -1
  34. package/dist/{c-IDJV3CZK.min.js → c-HYDTS5OP.min.js} +1 -1
  35. package/dist/c-IK33LNZ6.min.js +1 -0
  36. package/dist/c-IK3PZHRY.min.js +1 -0
  37. package/dist/{c-JO2UGTCP.min.js → c-J6DVC236.min.js} +1 -1
  38. package/dist/{c-MXCP7GNZ.min.js → c-JIMJF6F6.min.js} +1 -1
  39. package/dist/{c-4FN7Q6VQ.min.js → c-KKPMHAZC.min.js} +1 -1
  40. package/dist/c-L6WNDBHV.min.js +1 -0
  41. package/dist/c-LDEX5OFW.min.js +1 -0
  42. package/dist/{c-CPSPZH6A.min.js → c-LESEUVC5.min.js} +1 -1
  43. package/dist/c-MB6CV5NC.min.js +1 -0
  44. package/dist/{c-OO5QLMJC.min.js → c-MOKJOIPE.min.js} +1 -1
  45. package/dist/{c-BNG5ECK5.min.js → c-N3FXLRNT.min.js} +1 -1
  46. package/dist/c-N5NPTJVJ.min.js +1 -0
  47. package/dist/{c-DE5Q3U2X.min.js → c-NHBL4J67.min.js} +1 -1
  48. package/dist/{c-LMGSSD2E.min.js → c-ODG6TFSY.min.js} +1 -1
  49. package/dist/{c-HXDKPIKR.min.js → c-PSKKFZNP.min.js} +1 -1
  50. package/dist/{c-NYZ2QNAM.min.js → c-R2P4RR7Q.min.js} +1 -1
  51. package/dist/{c-KCRJGUHP.min.js → c-RFC7UAG7.min.js} +1 -1
  52. package/dist/c-SGAURYHG.min.js +1 -0
  53. package/dist/{c-DK662R77.min.js → c-SJMWU6UX.min.js} +1 -1
  54. package/dist/c-STIIGQOD.min.js +1 -0
  55. package/dist/c-T2ASIJVZ.min.js +1 -0
  56. package/dist/c-TX3THUTO.min.js +1 -0
  57. package/dist/{c-55BAJ333.min.js → c-TX7XJM3Z.min.js} +1 -1
  58. package/dist/c-UMXSJIOV.min.js +1 -0
  59. package/dist/{c-JLGRHXGZ.min.js → c-VRSXMLYF.min.js} +1 -1
  60. package/dist/c-VSLWSAN2.min.js +1 -0
  61. package/dist/{c-33QOXEUG.min.js → c-WCBRPILW.min.js} +1 -1
  62. package/dist/{c-WH2O53VI.min.js → c-WGHT7OCY.min.js} +1 -1
  63. package/dist/c-WWCW3APR.min.js +1 -0
  64. package/dist/c-Y6PYUMFU.min.js +1 -0
  65. package/dist/c-ZIVPFTOC.min.js +1 -0
  66. package/dist/components/charts/shared/chartDataProps.d.ts +3 -0
  67. package/dist/components/charts/shared/chartSpecAtlasSchemas.d.ts +5 -0
  68. package/dist/components/charts/shared/chartSpecCore.d.ts +4 -0
  69. package/dist/components/charts/shared/chartSpecsAtlas.d.ts +2 -0
  70. package/dist/components/charts/shared/hooks.d.ts +3 -1
  71. package/dist/components/charts/shared/knownChartComponents.d.ts +1 -1
  72. package/dist/components/recipes/atlas/DependencyForestChart.d.ts +20 -0
  73. package/dist/components/recipes/atlas/DependencyMatrix.d.ts +7 -0
  74. package/dist/components/recipes/atlas/FlowCircuitChart.d.ts +20 -0
  75. package/dist/components/recipes/atlas/MotifBraidChart.d.ts +17 -0
  76. package/dist/components/recipes/atlas/atlasChartOptions.d.ts +11 -0
  77. package/dist/components/recipes/atlas/braid.d.ts +62 -0
  78. package/dist/components/recipes/atlas/capsules.d.ts +18 -0
  79. package/dist/components/recipes/atlas/compare.d.ts +4 -0
  80. package/dist/components/recipes/atlas/completeness.d.ts +2 -0
  81. package/dist/components/recipes/atlas/dependencyForest.d.ts +32 -0
  82. package/dist/components/recipes/atlas/dependencyForestChartProps.d.ts +58 -0
  83. package/dist/components/recipes/atlas/dependencyForestLayout.d.ts +17 -0
  84. package/dist/components/recipes/atlas/dependencyQueries.d.ts +20 -0
  85. package/dist/components/recipes/atlas/dependencyTypes.d.ts +21 -0
  86. package/dist/components/recipes/atlas/directedGraph.d.ts +9 -0
  87. package/dist/components/recipes/atlas/entityCounts.d.ts +3 -0
  88. package/dist/components/recipes/atlas/flowCircuit.d.ts +32 -0
  89. package/dist/components/recipes/atlas/flowCircuitChartProps.d.ts +72 -0
  90. package/dist/components/recipes/atlas/flowCircuitChrome.d.ts +18 -0
  91. package/dist/components/recipes/atlas/flowCircuitGeometry.d.ts +11 -0
  92. package/dist/components/recipes/atlas/flowCircuitLayout.d.ts +20 -0
  93. package/dist/components/recipes/atlas/flowCircuitSemantics.d.ts +26 -0
  94. package/dist/components/recipes/atlas/flowCircuitTape.d.ts +22 -0
  95. package/dist/components/recipes/atlas/flowCircuitTypes.d.ts +144 -0
  96. package/dist/components/recipes/atlas/forests.d.ts +11 -0
  97. package/dist/components/recipes/atlas/ids.d.ts +6 -0
  98. package/dist/components/recipes/atlas/index.d.ts +26 -0
  99. package/dist/components/recipes/atlas/ledger.d.ts +7 -0
  100. package/dist/components/recipes/atlas/motifBraidChartProps.d.ts +51 -0
  101. package/dist/components/recipes/atlas/motifBraidGeometry.d.ts +5 -0
  102. package/dist/components/recipes/atlas/motifBraidLayout.d.ts +11 -0
  103. package/dist/components/recipes/atlas/motifs.d.ts +3 -0
  104. package/dist/components/recipes/atlas/prefixForest.d.ts +9 -0
  105. package/dist/components/recipes/atlas/prepare.d.ts +14 -0
  106. package/dist/components/recipes/atlas/prepareAsync.d.ts +7 -0
  107. package/dist/components/recipes/atlas/profile.d.ts +19 -0
  108. package/dist/components/recipes/atlas/publish.d.ts +10 -0
  109. package/dist/components/recipes/atlas/queries.d.ts +34 -0
  110. package/dist/components/recipes/atlas/requiredPaths.d.ts +9 -0
  111. package/dist/components/recipes/atlas/rootedForest.d.ts +4 -0
  112. package/dist/components/recipes/atlas/sections.d.ts +3 -0
  113. package/dist/components/recipes/atlas/support.d.ts +7 -0
  114. package/dist/components/recipes/atlas/types.d.ts +278 -0
  115. package/dist/components/recipes/atlas/validate.d.ts +12 -0
  116. package/dist/components/semiotic-atlas-core.d.ts +20 -0
  117. package/dist/components/semiotic-atlas.d.ts +8 -0
  118. package/dist/components/semiotic-recipes-core.d.ts +9 -0
  119. package/dist/components/server/serverChartConfigs.d.ts +3 -0
  120. package/dist/components/server/serverChartConfigsAtlas.d.ts +4 -0
  121. package/dist/components/stream/NetworkPipelineStore.d.ts +1 -0
  122. package/dist/components/stream/canvasSetup.d.ts +1 -2
  123. package/dist/components/stream/fontLoading.d.ts +4 -0
  124. package/dist/components/stream/networkCustomLayout.d.ts +8 -0
  125. package/dist/components/stream/networkCustomLayoutCache.d.ts +12 -0
  126. package/dist/components/stream/networkPipelineConfig.d.ts +0 -7
  127. package/dist/components/stream/physics/physicsSemanticUI.d.ts +2 -0
  128. package/dist/components/stream/physics/usePhysicsCanvasPointer.d.ts +3 -1
  129. package/dist/components/stream/physics/usePhysicsSemanticNavigation.d.ts +2 -0
  130. package/dist/components/stream/shallowEqual.d.ts +2 -0
  131. package/dist/components/stream/useEnsureCustomXYRenderers.d.ts +4 -2
  132. package/dist/geo.min.js +1 -1
  133. package/dist/geo.module.min.js +1 -1
  134. package/dist/network.module.min.js +1 -1
  135. package/dist/ordinal.module.min.js +1 -1
  136. package/dist/physics.module.min.js +1 -1
  137. package/dist/rough.module.min.js +1 -1
  138. package/dist/semiotic-access.module.min.js +1 -1
  139. package/dist/semiotic-ai-core.min.js +1 -1
  140. package/dist/semiotic-ai-core.module.min.js +1 -1
  141. package/dist/semiotic-ai.module.min.js +1 -1
  142. package/dist/semiotic-artifact.min.js +1 -1
  143. package/dist/semiotic-artifact.module.min.js +1 -1
  144. package/dist/semiotic-atlas-core.d.ts +20 -0
  145. package/dist/semiotic-atlas-core.min.js +1 -0
  146. package/dist/semiotic-atlas-core.module.min.js +1 -0
  147. package/dist/semiotic-atlas-selection.module.min.js +2 -0
  148. package/dist/semiotic-atlas.d.ts +8 -0
  149. package/dist/semiotic-atlas.min.js +2 -0
  150. package/dist/semiotic-atlas.module.min.js +2 -0
  151. package/dist/semiotic-client-cjs-shared.min.js +1 -1
  152. package/dist/semiotic-evidence.min.js +1 -1
  153. package/dist/semiotic-evidence.module.min.js +1 -1
  154. package/dist/semiotic-experimental-auxiliary.module.min.js +1 -1
  155. package/dist/semiotic-experimental-node-auxiliary.module.min.js +1 -1
  156. package/dist/semiotic-experimental-react-shared.module.min.js +1 -1
  157. package/dist/semiotic-experimental-vacp.min.js +1 -1
  158. package/dist/semiotic-experimental-vacp.module.min.js +1 -1
  159. package/dist/semiotic-line.module.min.js +1 -1
  160. package/dist/semiotic-realtime-core.module.min.js +1 -1
  161. package/dist/semiotic-recipes-core-cjs-base.min.js +1 -1
  162. package/dist/semiotic-recipes-core.d.ts +9 -0
  163. package/dist/semiotic-recipes-core.module.min.js +1 -1
  164. package/dist/semiotic-server-edge-node.module.min.js +1 -1
  165. package/dist/semiotic-server-edge.min.js +1 -1
  166. package/dist/semiotic-server-edge.module.min.js +1 -1
  167. package/dist/semiotic-server-node.min.js +1 -1
  168. package/dist/semiotic-server-node.module.min.js +1 -1
  169. package/dist/semiotic-text.min.js +1 -1
  170. package/dist/semiotic-text.module.min.js +1 -1
  171. package/dist/semiotic-utils-core.min.js +1 -1
  172. package/dist/semiotic-utils-core.module.min.js +1 -1
  173. package/dist/semiotic.module.min.js +1 -1
  174. package/dist/server.min.js +1 -1
  175. package/dist/server.module.min.js +1 -1
  176. package/dist/xy.module.min.js +1 -1
  177. package/package.json +16 -1
  178. package/dist/c-447VIMRO.min.js +0 -1
  179. package/dist/c-553QUDKA.min.js +0 -1
  180. package/dist/c-7HP7MB2I.min.js +0 -1
  181. package/dist/c-7NBU5ZKS.min.js +0 -1
  182. package/dist/c-CCTGN5CK.min.js +0 -1
  183. package/dist/c-GSZRZRD6.min.js +0 -1
  184. package/dist/c-GWX7JGMF.min.js +0 -1
  185. package/dist/c-ITKX3RC5.min.js +0 -1
  186. package/dist/c-JG2JCQLP.min.js +0 -1
  187. package/dist/c-LYVKDBQJ.min.js +0 -1
  188. package/dist/c-NG7BLZTR.min.js +0 -1
  189. package/dist/c-PYNW54D2.min.js +0 -1
  190. package/dist/c-TIXX5CAU.min.js +0 -1
  191. /package/dist/{c-OOVX2JPQ.min.js → c-UC7SIU2W.min.js} +0 -0
@@ -1 +1 @@
1
- import{generateFrameSVGs as m,generateFrameSequence as i,generatePhysicsFrameSVGs as o,renderChart as r,renderChartWithEvidence as p,renderDashboard as t,renderGeoToStaticSVG as c,renderNetworkToStaticSVG as j,renderOrdinalToStaticSVG as n,renderPhysicsToAnimatedGif as s,renderToAnimatedGif as G,renderToImage as e,renderToStaticSVG as f,renderXYToStaticSVG as x,resolveTheme as D,serializeSvgPrecision as H,themeStyles as J}from"./c-PYNW54D2.min.js";import"./c-JLGRHXGZ.min.js";export{m as generateFrameSVGs,i as generateFrameSequence,o as generatePhysicsFrameSVGs,r as renderChart,p as renderChartWithEvidence,t as renderDashboard,c as renderGeoToStaticSVG,j as renderNetworkToStaticSVG,n as renderOrdinalToStaticSVG,s as renderPhysicsToAnimatedGif,G as renderToAnimatedGif,e as renderToImage,f as renderToStaticSVG,x as renderXYToStaticSVG,D as resolveTheme,H as serializeSvgPrecision,J as themeStyles};
1
+ import{generateFrameSVGs as m,generateFrameSequence as i,generatePhysicsFrameSVGs as o,renderChart as r,renderChartWithEvidence as p,renderDashboard as t,renderGeoToStaticSVG as T,renderNetworkToStaticSVG as c,renderOrdinalToStaticSVG as j,renderPhysicsToAnimatedGif as n,renderToAnimatedGif as s,renderToImage as X,renderToStaticSVG as e,renderXYToStaticSVG as f,resolveTheme as x,serializeSvgPrecision as F,themeStyles as H}from"./c-TX3THUTO.min.js";import"./c-VRSXMLYF.min.js";export{m as generateFrameSVGs,i as generateFrameSequence,o as generatePhysicsFrameSVGs,r as renderChart,p as renderChartWithEvidence,t as renderDashboard,T as renderGeoToStaticSVG,c as renderNetworkToStaticSVG,j as renderOrdinalToStaticSVG,n as renderPhysicsToAnimatedGif,s as renderToAnimatedGif,X as renderToImage,e as renderToStaticSVG,f as renderXYToStaticSVG,x as resolveTheme,F as serializeSvgPrecision,H as themeStyles};
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- function e(e){return[e.fontWeight,e.titleFontWeight].map(t=>`${t} ${e.fontSize}px ${e.fontFamily}`)}function t(e,t,n){return c>e.size||e.delete(e.keys().next().value),e.set(t,n),n}function n(n,i={}){const r=!1!==i.enabled,o=function(e){const t=Number.isFinite(e.fontSize)&&e.fontSize>0?e.fontSize:12;return{fontFamily:e.fontFamily||"Arial, sans-serif",fontSize:t,lineHeight:Number.isFinite(e.lineHeight)&&e.lineHeight>0?e.lineHeight:Math.max(16,1.35*t),fontWeight:e.fontWeight??400,titleFontWeight:e.titleFontWeight??700}}(i),l=JSON.stringify(o),a=n.filter(e=>h.has(e.type)).map(e=>`${e.title||""} ${e.label||""}`).join(" "),[s,m]=(0,f.useState)(),p=(0,f.useRef)(void 0);return(0,f.useEffect)(()=>{if(!r||"undefined"==typeof document||"function"!=typeof Intl.Segmenter)return p.current=void 0,void m(void 0);let n=!0,i=0;const o=JSON.parse(l),s=e(o),f=document.fonts,h=async(r=!1)=>{const h=++i;try{if(f&&await Promise.all(s.map(e=>f.load(e,a||"M"))),!n||h!==i)return;if(!r&&p.current===l)return;(0,u.clearCache)(),(0,u.prepareWithSegments)("M","1px serif"),(0,u.prepareWithSegments)("M","2px serif"),g=0;const d=function(n){function i(e,i,a){if(!e)return[];const s=JSON.stringify([i,e]);let f=l.get(s);f||(++g<c||((0,u.clearCache)(),g=0),f=t(l,s,(0,u.prepareWithSegments)(e,i)));const h=(0,u.layoutWithLines)(f,a,n.lineHeight).lines;r.font=i;const m=[];for(const e of h){if(r.measureText(e.text).width<=a+.25){m.push(e.text);continue}const t=Array.from(o.segment(e.text),e=>e.segment);let n=0;for(;t.length>n;){let e=1,i=t.length-n;for(;i>e;){const o=Math.ceil((e+i)/2);r.measureText(t.slice(n,n+o).join("")).width>a?i=o-1:e=o}const o=t.slice(n,n+e).lastIndexOf(" ");for(o>0&&t.length>n+e&&(e=o),m.push(t.slice(n,n+e).join("")),n+=e;" "===t[n];)n++}}return m}if("undefined"==typeof document||"function"!=typeof Intl.Segmenter)return;const r=document.createElement("canvas").getContext("2d");if(!r)return;const o=new Intl.Segmenter(void 0,{granularity:"grapheme"}),l=new Map,a=new Map,[s,f]=e(n),h={"data-text-layout":"pretext",fontFamily:n.fontFamily,fontSize:n.fontSize,fontWeight:n.fontWeight,fontStyle:"normal"};return e=>{const o="string"==typeof e.label?e.label:"",l="string"==typeof e.title?e.title:"",u=e.noWrap?1/0:Number.isFinite(e.wrap)&&e.wrap>0?e.wrap:120,c=JSON.stringify([o,l,u,!!e.noWrap]),g=a.get(c);if(g)return g;const m=i(o,s,u),p=i(l,f,u);let d=0;for(const[e,t]of[[m,s],[p,f]]){r.font=t;for(const t of e)d=Math.max(d,r.measureText(t).width)}return t(a,c,{textProps:h,lineHeight:n.lineHeight,titleFontWeight:n.titleFontWeight,labelLines:m,titleLines:p,width:d,height:(m.length+p.length)*n.lineHeight+(m.length&&p.length?2:0)})}}(o);p.current=d?l:void 0,m(d?{key:l,measure:d}:void 0)}catch{n&&h===i&&(p.current=void 0,m(void 0))}},d=()=>{h(!0)};return f?.addEventListener("loadingdone",d),h(),()=>{n=!1,f?.removeEventListener("loadingdone",d)}},[r,l,a]),(0,f.useMemo)(()=>n.map(e=>r&&s?.key===l&&h.has(e.type)?{...e,_noteLayout:s.measure}:e),[n,r,l,s])}var i,r=Object.defineProperty,o=Object.getOwnPropertyDescriptor,l=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,s={};((e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})})(s,{usePretextAnnotations:()=>n}),module.exports=(i=s,((e,t,n,i)=>{if(t)for(let n of l(t))a.call(e,n)||void 0===n||r(e,n,{get:()=>t[n],enumerable:!(i=o(t,n))||i.enumerable});return e})(r({},"__esModule",{value:!0}),i));var f=require("react"),u=require("@chenglou/pretext"),c=128,g=0,h=new Set(["label","callout","callout-circle","callout-rect","bracket"]);
2
+ function e(e){return[e.fontWeight,e.titleFontWeight].map(t=>`${t} ${e.fontSize}px ${e.fontFamily}`)}function t(e,t,n){return c>e.size||e.delete(e.keys().next().value),e.set(t,n),n}function n(n,i={}){const r=!1!==i.enabled,o=function(e){const t=Number.isFinite(e.fontSize)&&e.fontSize>0?e.fontSize:12;return{fontFamily:e.fontFamily||"Arial, sans-serif",fontSize:t,lineHeight:Number.isFinite(e.lineHeight)&&e.lineHeight>0?e.lineHeight:Math.max(16,1.35*t),fontWeight:e.fontWeight??400,titleFontWeight:e.titleFontWeight??700}}(i),l=JSON.stringify(o),a=n.filter(e=>h.has(e.type)).map(e=>`${e.title||""} ${e.label||""}`).join(" "),[s,m]=(0,f.useState)(),p=(0,f.useRef)(void 0);return(0,f.useEffect)(()=>{if(!r||"undefined"==typeof document||"function"!=typeof Intl.Segmenter)return p.current=void 0,void m(void 0);let n=!0,i=0;const o=JSON.parse(l),s=e(o),f=document.fonts,h=async(r=!1)=>{const h=++i;try{if(f&&await Promise.all(s.map(e=>f.load(e,a||"M"))),!n||h!==i)return;if(!r&&p.current===l)return;(0,u.clearCache)(),(0,u.prepareWithSegments)("M","1px serif"),(0,u.prepareWithSegments)("M","2px serif"),g=0;const d=function(n){function i(e,i,a){if(!e)return[];const s=JSON.stringify([i,e]);let f=l.get(s);f||(++g<c||((0,u.clearCache)(),g=0),f=t(l,s,(0,u.prepareWithSegments)(e,i)));const h=(0,u.layoutWithLines)(f,a,n.lineHeight).lines;r.font=i;const m=[];for(const e of h){if(r.measureText(e.text).width<=a+.25){m.push(e.text);continue}const t=Array.from(o.segment(e.text),e=>e.segment);let n=0;for(;t.length>n;){let e=1,i=t.length-n;for(;i>e;){const o=Math.ceil((e+i)/2);r.measureText(t.slice(n,n+o).join("")).width>a?i=o-1:e=o}const o=t.slice(n,n+e).lastIndexOf(" ");for(o>0&&t.length>n+e&&(e=o),m.push(t.slice(n,n+e).join("")),n+=e;" "===t[n];)n++}}return m}if("undefined"==typeof document||"function"!=typeof Intl.Segmenter)return;const r=document.createElement("canvas").getContext("2d");if(!r)return;const o=new Intl.Segmenter(void 0,{granularity:"grapheme"}),l=new Map,a=new Map,[s,f]=e(n),h={"data-text-layout":"pretext",fontFamily:n.fontFamily,fontSize:n.fontSize,fontWeight:n.fontWeight,fontStyle:"normal"};return e=>{const o="string"==typeof e.label?e.label:"",l="string"==typeof e.title?e.title:"",u=e.noWrap?1/0:Number.isFinite(e.wrap)&&e.wrap>0?e.wrap:120,c=JSON.stringify([o,l,u,!!e.noWrap]),g=a.get(c);if(g)return g;const m=i(o,s,u),p=i(l,f,u);let d=0;for(const[e,t]of[[m,s],[p,f]]){r.font=t;for(const t of e)d=Math.max(d,r.measureText(t).width)}return t(a,c,{textProps:h,lineHeight:n.lineHeight,titleFontWeight:n.titleFontWeight,labelLines:m,titleLines:p,width:d,height:(m.length+p.length)*n.lineHeight+(m.length&&p.length?2:0)})}}(o);p.current=d?l:void 0,m(d?{key:l,measure:d}:void 0)}catch{n&&h===i&&(p.current=void 0,m(void 0))}},d=e=>{(function(e){return 0!==e.fontfaces?.length})(e)&&h(!0)};return f?.addEventListener("loadingdone",d),h(),()=>{n=!1,f?.removeEventListener("loadingdone",d)}},[r,l,a]),(0,f.useMemo)(()=>n.map(e=>r&&s?.key===l&&h.has(e.type)?{...e,_noteLayout:s.measure}:e),[n,r,l,s])}var i,r=Object.defineProperty,o=Object.getOwnPropertyDescriptor,l=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,s={};((e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})})(s,{usePretextAnnotations:()=>n}),module.exports=(i=s,((e,t,n,i)=>{if(t)for(let n of l(t))a.call(e,n)||void 0===n||r(e,n,{get:()=>t[n],enumerable:!(i=o(t,n))||i.enumerable});return e})(r({},"__esModule",{value:!0}),i));var f=require("react"),u=require("@chenglou/pretext"),c=128,g=0,h=new Set(["label","callout","callout-circle","callout-rect","bracket"]);
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- function e(e){return[e.fontWeight,e.titleFontWeight].map(t=>`${t} ${e.fontSize}px ${e.fontFamily}`)}function t(e,t,n){return e.size>=128&&e.delete(e.keys().next().value),e.set(t,n),n}function n(n,h={}){let m=!1!==h.enabled,c=function(e){let t=Number.isFinite(e.fontSize)&&e.fontSize>0?e.fontSize:12;return{fontFamily:e.fontFamily||"Arial, sans-serif",fontSize:t,lineHeight:Number.isFinite(e.lineHeight)&&e.lineHeight>0?e.lineHeight:Math.max(16,1.35*t),fontWeight:e.fontWeight??400,titleFontWeight:e.titleFontWeight??700}}(h),p=JSON.stringify(c),d=n.filter(e=>s.has(e.type)).map(e=>`${e.title||""} ${e.label||""}`).join(" "),[y,x]=l(),S=o(void 0);return i(()=>{if(!m||typeof document>"u"||"function"!=typeof Intl.Segmenter)return S.current=void 0,void x(void 0);let n=!0,i=0,r=JSON.parse(p),o=e(r),l=document.fonts,s=async(s=!1)=>{let h=++i;try{if(l&&await Promise.all(o.map(e=>l.load(e,d||"M"))),!n||h!==i||!s&&S.current===p)return;a(),f("M","1px serif"),f("M","2px serif"),g=0;let m=function(n){function i(e,i,s){if(!e)return[];let h=JSON.stringify([i,e]),m=l.get(h);m||(++g>=128&&(a(),g=0),m=t(l,h,f(e,i)));let c=u(m,s,n.lineHeight).lines;r.font=i;let p=[];for(let e of c){if(r.measureText(e.text).width<=s+.25){p.push(e.text);continue}let t=Array.from(o.segment(e.text),e=>e.segment),n=0;for(;t.length>n;){let e=1,i=t.length-n;for(;i>e;){let o=Math.ceil((e+i)/2);r.measureText(t.slice(n,n+o).join("")).width>s?i=o-1:e=o}let o=t.slice(n,n+e).lastIndexOf(" ");for(o>0&&t.length>n+e&&(e=o),p.push(t.slice(n,n+e).join("")),n+=e;" "===t[n];)n++}}return p}if(typeof document>"u"||"function"!=typeof Intl.Segmenter)return;let r=document.createElement("canvas").getContext("2d");if(!r)return;let o=new Intl.Segmenter(void 0,{granularity:"grapheme"}),l=new Map,s=new Map,[h,m]=e(n),c={"data-text-layout":"pretext",fontFamily:n.fontFamily,fontSize:n.fontSize,fontWeight:n.fontWeight,fontStyle:"normal"};return e=>{let o="string"==typeof e.label?e.label:"",l="string"==typeof e.title?e.title:"",a=e.noWrap?1/0:Number.isFinite(e.wrap)&&e.wrap>0?e.wrap:120,f=JSON.stringify([o,l,a,!!e.noWrap]),u=s.get(f);if(u)return u;let g=i(o,h,a),p=i(l,m,a),d=0;for(let[e,t]of[[g,h],[p,m]]){r.font=t;for(let t of e)d=Math.max(d,r.measureText(t).width)}return t(s,f,{textProps:c,lineHeight:n.lineHeight,titleFontWeight:n.titleFontWeight,labelLines:g,titleLines:p,width:d,height:(g.length+p.length)*n.lineHeight+(g.length&&p.length?2:0)})}}(r);S.current=m?p:void 0,x(m?{key:p,measure:m}:void 0)}catch{n&&h===i&&(S.current=void 0,x(void 0))}},h=()=>{s(!0)};return l?.addEventListener("loadingdone",h),s(),()=>{n=!1,l?.removeEventListener("loadingdone",h)}},[m,p,d]),r(()=>n.map(e=>m&&y?.key===p&&s.has(e.type)?{...e,_noteLayout:y.measure}:e),[n,m,p,y])}import{useEffect as i,useMemo as r,useRef as o,useState as l}from"react";import{clearCache as a,prepareWithSegments as f,layoutWithLines as u}from"@chenglou/pretext";var g=0,s=new Set(["label","callout","callout-circle","callout-rect","bracket"]);export{n as usePretextAnnotations};
2
+ function e(e){return[e.fontWeight,e.titleFontWeight].map(t=>`${t} ${e.fontSize}px ${e.fontFamily}`)}function t(e,t,n){return e.size>=128&&e.delete(e.keys().next().value),e.set(t,n),n}function n(n,m={}){let c=!1!==m.enabled,p=function(e){let t=Number.isFinite(e.fontSize)&&e.fontSize>0?e.fontSize:12;return{fontFamily:e.fontFamily||"Arial, sans-serif",fontSize:t,lineHeight:Number.isFinite(e.lineHeight)&&e.lineHeight>0?e.lineHeight:Math.max(16,1.35*t),fontWeight:e.fontWeight??400,titleFontWeight:e.titleFontWeight??700}}(m),d=JSON.stringify(p),y=n.filter(e=>h.has(e.type)).map(e=>`${e.title||""} ${e.label||""}`).join(" "),[x,S]=a(),v=l(void 0);return r(()=>{if(!c||typeof document>"u"||"function"!=typeof Intl.Segmenter)return v.current=void 0,void S(void 0);let n=!0,r=0,o=JSON.parse(d),l=e(o),a=document.fonts,h=async(i=!1)=>{let h=++r;try{if(a&&await Promise.all(l.map(e=>a.load(e,y||"M"))),!n||h!==r||!i&&v.current===d)return;f(),u("M","1px serif"),u("M","2px serif"),s=0;let m=function(n){function i(e,i,a){if(!e)return[];let h=JSON.stringify([i,e]),m=l.get(h);m||(++s>=128&&(f(),s=0),m=t(l,h,u(e,i)));let c=g(m,a,n.lineHeight).lines;r.font=i;let p=[];for(let e of c){if(r.measureText(e.text).width<=a+.25){p.push(e.text);continue}let t=Array.from(o.segment(e.text),e=>e.segment),n=0;for(;t.length>n;){let e=1,i=t.length-n;for(;i>e;){let o=Math.ceil((e+i)/2);r.measureText(t.slice(n,n+o).join("")).width>a?i=o-1:e=o}let o=t.slice(n,n+e).lastIndexOf(" ");for(o>0&&t.length>n+e&&(e=o),p.push(t.slice(n,n+e).join("")),n+=e;" "===t[n];)n++}}return p}if(typeof document>"u"||"function"!=typeof Intl.Segmenter)return;let r=document.createElement("canvas").getContext("2d");if(!r)return;let o=new Intl.Segmenter(void 0,{granularity:"grapheme"}),l=new Map,a=new Map,[h,m]=e(n),c={"data-text-layout":"pretext",fontFamily:n.fontFamily,fontSize:n.fontSize,fontWeight:n.fontWeight,fontStyle:"normal"};return e=>{let o="string"==typeof e.label?e.label:"",l="string"==typeof e.title?e.title:"",f=e.noWrap?1/0:Number.isFinite(e.wrap)&&e.wrap>0?e.wrap:120,u=JSON.stringify([o,l,f,!!e.noWrap]),g=a.get(u);if(g)return g;let s=i(o,h,f),p=i(l,m,f),d=0;for(let[e,t]of[[s,h],[p,m]]){r.font=t;for(let t of e)d=Math.max(d,r.measureText(t).width)}return t(a,u,{textProps:c,lineHeight:n.lineHeight,titleFontWeight:n.titleFontWeight,labelLines:s,titleLines:p,width:d,height:(s.length+p.length)*n.lineHeight+(s.length&&p.length?2:0)})}}(o);v.current=m?d:void 0,S(m?{key:d,measure:m}:void 0)}catch{n&&h===r&&(v.current=void 0,S(void 0))}},m=e=>{i(e)&&h(!0)};return a?.addEventListener("loadingdone",m),h(),()=>{n=!1,a?.removeEventListener("loadingdone",m)}},[c,d,y]),o(()=>n.map(e=>c&&x?.key===d&&h.has(e.type)?{...e,_noteLayout:x.measure}:e),[n,c,d,x])}import{hasLoadedFontFaces as i}from"./c-STIIGQOD.min.js";import{useEffect as r,useMemo as o,useRef as l,useState as a}from"react";import{clearCache as f,prepareWithSegments as u,layoutWithLines as g}from"@chenglou/pretext";var s=0,h=new Set(["label","callout","callout-circle","callout-rect","bracket"]);export{n as usePretextAnnotations};