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.
- package/README.md +55 -59
- package/ai/artifact-surface-inventory.json +1 -1
- package/ai/componentMetadata.cjs +3 -1
- package/ai/dist/mcp-server.js +45 -45
- package/ai/examples.md +67 -0
- package/ai/reference.md +75 -1
- package/ai/schema.json +5199 -1
- package/ai/surface-manifest.json +24 -3
- package/ai/task-packets/compare-category-totals.json +6 -6
- package/ai/task-packets/compare-category-totals.md +3 -3
- package/ai/task-packets/correct-published-chart.json +6 -6
- package/ai/task-packets/correct-published-chart.md +3 -3
- package/ai/task-packets/index.json +6 -6
- package/ai/task-packets/update-live-chart.json +6 -6
- package/ai/task-packets/update-live-chart.md +3 -3
- package/dist/c-2RL2QPZJ.min.js +1 -0
- package/dist/c-45CQWZZ6.min.js +1 -0
- package/dist/{c-PP6VY3QU.min.js → c-4BRHKVKV.min.js} +1 -1
- package/dist/c-7DVPSB5C.min.js +1 -0
- package/dist/{c-XDQKXPX4.min.js → c-A7OGOFSL.min.js} +1 -1
- package/dist/{c-AZKPVBOC.min.js → c-AH5HWZWS.min.js} +1 -1
- package/dist/c-B7GW7IHJ.min.js +1 -0
- package/dist/{c-ROEHCIGV.min.js → c-C3TZLTZK.min.js} +1 -1
- package/dist/c-CGQAQWBV.min.js +1 -0
- package/dist/c-DIPEYUOW.min.js +1 -0
- package/dist/{c-WNGH47HF.min.js → c-E72OTUZU.min.js} +1 -1
- package/dist/{c-DY2676CR.min.js → c-EUMPMDCS.min.js} +1 -1
- package/dist/c-EZZT2WAE.min.js +1 -0
- package/dist/c-FHBVFCQB.min.js +1 -0
- package/dist/{c-E32M6XW5.min.js → c-G4HCO2IQ.min.js} +1 -1
- package/dist/{c-ZYPXQF7B.min.js → c-G5VIJEOK.min.js} +1 -1
- package/dist/c-GHVOXAYH.min.js +1 -0
- package/dist/{c-EBOQ7ER7.min.js → c-HP4ZFM47.min.js} +1 -1
- package/dist/{c-IDJV3CZK.min.js → c-HYDTS5OP.min.js} +1 -1
- package/dist/c-IK33LNZ6.min.js +1 -0
- package/dist/c-IK3PZHRY.min.js +1 -0
- package/dist/{c-JO2UGTCP.min.js → c-J6DVC236.min.js} +1 -1
- package/dist/{c-MXCP7GNZ.min.js → c-JIMJF6F6.min.js} +1 -1
- package/dist/{c-4FN7Q6VQ.min.js → c-KKPMHAZC.min.js} +1 -1
- package/dist/c-L6WNDBHV.min.js +1 -0
- package/dist/c-LDEX5OFW.min.js +1 -0
- package/dist/{c-CPSPZH6A.min.js → c-LESEUVC5.min.js} +1 -1
- package/dist/c-MB6CV5NC.min.js +1 -0
- package/dist/{c-OO5QLMJC.min.js → c-MOKJOIPE.min.js} +1 -1
- package/dist/{c-BNG5ECK5.min.js → c-N3FXLRNT.min.js} +1 -1
- package/dist/c-N5NPTJVJ.min.js +1 -0
- package/dist/{c-DE5Q3U2X.min.js → c-NHBL4J67.min.js} +1 -1
- package/dist/{c-LMGSSD2E.min.js → c-ODG6TFSY.min.js} +1 -1
- package/dist/{c-HXDKPIKR.min.js → c-PSKKFZNP.min.js} +1 -1
- package/dist/{c-NYZ2QNAM.min.js → c-R2P4RR7Q.min.js} +1 -1
- package/dist/{c-KCRJGUHP.min.js → c-RFC7UAG7.min.js} +1 -1
- package/dist/c-SGAURYHG.min.js +1 -0
- package/dist/{c-DK662R77.min.js → c-SJMWU6UX.min.js} +1 -1
- package/dist/c-STIIGQOD.min.js +1 -0
- package/dist/c-T2ASIJVZ.min.js +1 -0
- package/dist/c-TX3THUTO.min.js +1 -0
- package/dist/{c-55BAJ333.min.js → c-TX7XJM3Z.min.js} +1 -1
- package/dist/c-UMXSJIOV.min.js +1 -0
- package/dist/{c-JLGRHXGZ.min.js → c-VRSXMLYF.min.js} +1 -1
- package/dist/c-VSLWSAN2.min.js +1 -0
- package/dist/{c-33QOXEUG.min.js → c-WCBRPILW.min.js} +1 -1
- package/dist/{c-WH2O53VI.min.js → c-WGHT7OCY.min.js} +1 -1
- package/dist/c-WWCW3APR.min.js +1 -0
- package/dist/c-Y6PYUMFU.min.js +1 -0
- package/dist/c-ZIVPFTOC.min.js +1 -0
- package/dist/components/charts/shared/chartDataProps.d.ts +3 -0
- package/dist/components/charts/shared/chartSpecAtlasSchemas.d.ts +5 -0
- package/dist/components/charts/shared/chartSpecCore.d.ts +4 -0
- package/dist/components/charts/shared/chartSpecsAtlas.d.ts +2 -0
- package/dist/components/charts/shared/hooks.d.ts +3 -1
- package/dist/components/charts/shared/knownChartComponents.d.ts +1 -1
- package/dist/components/recipes/atlas/DependencyForestChart.d.ts +20 -0
- package/dist/components/recipes/atlas/DependencyMatrix.d.ts +7 -0
- package/dist/components/recipes/atlas/FlowCircuitChart.d.ts +20 -0
- package/dist/components/recipes/atlas/MotifBraidChart.d.ts +17 -0
- package/dist/components/recipes/atlas/atlasChartOptions.d.ts +11 -0
- package/dist/components/recipes/atlas/braid.d.ts +62 -0
- package/dist/components/recipes/atlas/capsules.d.ts +18 -0
- package/dist/components/recipes/atlas/compare.d.ts +4 -0
- package/dist/components/recipes/atlas/completeness.d.ts +2 -0
- package/dist/components/recipes/atlas/dependencyForest.d.ts +32 -0
- package/dist/components/recipes/atlas/dependencyForestChartProps.d.ts +58 -0
- package/dist/components/recipes/atlas/dependencyForestLayout.d.ts +17 -0
- package/dist/components/recipes/atlas/dependencyQueries.d.ts +20 -0
- package/dist/components/recipes/atlas/dependencyTypes.d.ts +21 -0
- package/dist/components/recipes/atlas/directedGraph.d.ts +9 -0
- package/dist/components/recipes/atlas/entityCounts.d.ts +3 -0
- package/dist/components/recipes/atlas/flowCircuit.d.ts +32 -0
- package/dist/components/recipes/atlas/flowCircuitChartProps.d.ts +72 -0
- package/dist/components/recipes/atlas/flowCircuitChrome.d.ts +18 -0
- package/dist/components/recipes/atlas/flowCircuitGeometry.d.ts +11 -0
- package/dist/components/recipes/atlas/flowCircuitLayout.d.ts +20 -0
- package/dist/components/recipes/atlas/flowCircuitSemantics.d.ts +26 -0
- package/dist/components/recipes/atlas/flowCircuitTape.d.ts +22 -0
- package/dist/components/recipes/atlas/flowCircuitTypes.d.ts +144 -0
- package/dist/components/recipes/atlas/forests.d.ts +11 -0
- package/dist/components/recipes/atlas/ids.d.ts +6 -0
- package/dist/components/recipes/atlas/index.d.ts +26 -0
- package/dist/components/recipes/atlas/ledger.d.ts +7 -0
- package/dist/components/recipes/atlas/motifBraidChartProps.d.ts +51 -0
- package/dist/components/recipes/atlas/motifBraidGeometry.d.ts +5 -0
- package/dist/components/recipes/atlas/motifBraidLayout.d.ts +11 -0
- package/dist/components/recipes/atlas/motifs.d.ts +3 -0
- package/dist/components/recipes/atlas/prefixForest.d.ts +9 -0
- package/dist/components/recipes/atlas/prepare.d.ts +14 -0
- package/dist/components/recipes/atlas/prepareAsync.d.ts +7 -0
- package/dist/components/recipes/atlas/profile.d.ts +19 -0
- package/dist/components/recipes/atlas/publish.d.ts +10 -0
- package/dist/components/recipes/atlas/queries.d.ts +34 -0
- package/dist/components/recipes/atlas/requiredPaths.d.ts +9 -0
- package/dist/components/recipes/atlas/rootedForest.d.ts +4 -0
- package/dist/components/recipes/atlas/sections.d.ts +3 -0
- package/dist/components/recipes/atlas/support.d.ts +7 -0
- package/dist/components/recipes/atlas/types.d.ts +278 -0
- package/dist/components/recipes/atlas/validate.d.ts +12 -0
- package/dist/components/semiotic-atlas-core.d.ts +20 -0
- package/dist/components/semiotic-atlas.d.ts +8 -0
- package/dist/components/semiotic-recipes-core.d.ts +9 -0
- package/dist/components/server/serverChartConfigs.d.ts +3 -0
- package/dist/components/server/serverChartConfigsAtlas.d.ts +4 -0
- package/dist/components/stream/NetworkPipelineStore.d.ts +1 -0
- package/dist/components/stream/canvasSetup.d.ts +1 -2
- package/dist/components/stream/fontLoading.d.ts +4 -0
- package/dist/components/stream/networkCustomLayout.d.ts +8 -0
- package/dist/components/stream/networkCustomLayoutCache.d.ts +12 -0
- package/dist/components/stream/networkPipelineConfig.d.ts +0 -7
- package/dist/components/stream/physics/physicsSemanticUI.d.ts +2 -0
- package/dist/components/stream/physics/usePhysicsCanvasPointer.d.ts +3 -1
- package/dist/components/stream/physics/usePhysicsSemanticNavigation.d.ts +2 -0
- package/dist/components/stream/shallowEqual.d.ts +2 -0
- package/dist/components/stream/useEnsureCustomXYRenderers.d.ts +4 -2
- package/dist/geo.min.js +1 -1
- package/dist/geo.module.min.js +1 -1
- package/dist/network.module.min.js +1 -1
- package/dist/ordinal.module.min.js +1 -1
- package/dist/physics.module.min.js +1 -1
- package/dist/rough.module.min.js +1 -1
- package/dist/semiotic-access.module.min.js +1 -1
- package/dist/semiotic-ai-core.min.js +1 -1
- package/dist/semiotic-ai-core.module.min.js +1 -1
- package/dist/semiotic-ai.module.min.js +1 -1
- package/dist/semiotic-artifact.min.js +1 -1
- package/dist/semiotic-artifact.module.min.js +1 -1
- package/dist/semiotic-atlas-core.d.ts +20 -0
- package/dist/semiotic-atlas-core.min.js +1 -0
- package/dist/semiotic-atlas-core.module.min.js +1 -0
- package/dist/semiotic-atlas-selection.module.min.js +2 -0
- package/dist/semiotic-atlas.d.ts +8 -0
- package/dist/semiotic-atlas.min.js +2 -0
- package/dist/semiotic-atlas.module.min.js +2 -0
- package/dist/semiotic-client-cjs-shared.min.js +1 -1
- package/dist/semiotic-evidence.min.js +1 -1
- package/dist/semiotic-evidence.module.min.js +1 -1
- package/dist/semiotic-experimental-auxiliary.module.min.js +1 -1
- package/dist/semiotic-experimental-node-auxiliary.module.min.js +1 -1
- package/dist/semiotic-experimental-react-shared.module.min.js +1 -1
- package/dist/semiotic-experimental-vacp.min.js +1 -1
- package/dist/semiotic-experimental-vacp.module.min.js +1 -1
- package/dist/semiotic-line.module.min.js +1 -1
- package/dist/semiotic-realtime-core.module.min.js +1 -1
- package/dist/semiotic-recipes-core-cjs-base.min.js +1 -1
- package/dist/semiotic-recipes-core.d.ts +9 -0
- package/dist/semiotic-recipes-core.module.min.js +1 -1
- package/dist/semiotic-server-edge-node.module.min.js +1 -1
- package/dist/semiotic-server-edge.min.js +1 -1
- package/dist/semiotic-server-edge.module.min.js +1 -1
- package/dist/semiotic-server-node.min.js +1 -1
- package/dist/semiotic-server-node.module.min.js +1 -1
- package/dist/semiotic-text.min.js +1 -1
- package/dist/semiotic-text.module.min.js +1 -1
- package/dist/semiotic-utils-core.min.js +1 -1
- package/dist/semiotic-utils-core.module.min.js +1 -1
- package/dist/semiotic.module.min.js +1 -1
- package/dist/server.min.js +1 -1
- package/dist/server.module.min.js +1 -1
- package/dist/xy.module.min.js +1 -1
- package/package.json +16 -1
- package/dist/c-447VIMRO.min.js +0 -1
- package/dist/c-553QUDKA.min.js +0 -1
- package/dist/c-7HP7MB2I.min.js +0 -1
- package/dist/c-7NBU5ZKS.min.js +0 -1
- package/dist/c-CCTGN5CK.min.js +0 -1
- package/dist/c-GSZRZRD6.min.js +0 -1
- package/dist/c-GWX7JGMF.min.js +0 -1
- package/dist/c-ITKX3RC5.min.js +0 -1
- package/dist/c-JG2JCQLP.min.js +0 -1
- package/dist/c-LYVKDBQJ.min.js +0 -1
- package/dist/c-NG7BLZTR.min.js +0 -1
- package/dist/c-PYNW54D2.min.js +0 -1
- package/dist/c-TIXX5CAU.min.js +0 -1
- /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
|
|
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=()
|
|
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,
|
|
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};
|