data-navigator 2.2.0 → 2.2.2
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 +22 -53
- package/dist/chunk-MPFBSVCV.js +1 -0
- package/dist/{chunk-PEL3ZYDS.mjs → chunk-TZKH227U.js} +1 -1
- package/dist/consts.cjs +1 -0
- package/dist/consts.js +1 -1
- package/dist/examples/basic_list/bokeh.d.ts +1 -0
- package/dist/examples/bokeh.d.ts +1 -0
- package/dist/examples/docs.d.ts +1 -0
- package/dist/examples/force-graph.d.ts +3 -1
- package/dist/index.cjs +1453 -0
- package/dist/index.js +1262 -1375
- package/dist/input.cjs +1 -0
- package/dist/input.js +1 -1
- package/dist/rendering.cjs +1 -0
- package/dist/rendering.js +1 -1
- package/dist/structure.cjs +1 -0
- package/dist/structure.js +1 -1
- package/dist/utilities.cjs +1 -0
- package/dist/utilities.js +1 -1
- package/package.json +13 -18
- package/dist/chunk-2RRWU73A.mjs +0 -1
- package/dist/chunk-AJKFNWNF.mjs +0 -1
- package/dist/chunk-CCACYVYB.mjs +0 -1
- package/dist/chunk-CR5KNX3N.mjs +0 -1
- package/dist/chunk-FFVDZNCV.mjs +0 -1
- package/dist/chunk-GP5LYFFJ.mjs +0 -1
- package/dist/chunk-QTJ23SVE.mjs +0 -18
- package/dist/chunk-SQY245BV.mjs +0 -177
- package/dist/chunk-UIGW7IEM.mjs +0 -1
- package/dist/chunk-XICEDMQZ.mjs +0 -1
- package/dist/chunk-ZAQVAU5P.mjs +0 -1
- package/dist/consts.mjs +0 -1
- package/dist/index.mjs +0 -1339
- package/dist/input.mjs +0 -1
- package/dist/rendering.mjs +0 -1
- package/dist/structure.mjs +0 -1
- package/dist/utilities.mjs +0 -1
- /package/dist/{chunk-K476QBP2.mjs → chunk-YE5N6UCT.js} +0 -0
- /package/dist/{src/test-cases.d.ts → examples/basic_list/basic_list.d.ts} +0 -0
package/dist/input.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as c,f as g}from"./chunk-PEL3ZYDS.mjs";var v=r=>{let n={},u=c,l=g;return n.moveTo=e=>{let t=r.structure.nodes[e];if(t)return t},n.move=(e,t)=>{if(e){let o=r.structure.nodes[e];if(o.edges){let s=null,a=0,d=l[t];if(!d)return;let y=(f,i)=>{if(f!==t)return null;let p={target:typeof i.target=="string"?i.target:i.target(o,e),source:typeof i.source=="string"?i.source:i.source(o,e)};return p[d.direction]!==e?p[d.direction]:null};for(a=0;a<o.edges.length;a++){let f=r.structure.edges[o.edges[a]];if(f.navigationRules.forEach(i=>{s||(s=y(i,f))}),s)break}return s?n.moveTo(s):void 0}}},n.enter=()=>{if(r.entryPoint)return n.moveTo(r.entryPoint);console.error("No entry point was specified in InputOptions, returning undefined")},n.exit=()=>{if(r.exitPoint)return r.exitPoint;console.error("No exit point was specified in InputOptions, returning undefined")},n.keydownValidator=e=>{let t=u[e.code];if(t)return t},n.focus=e=>{let t=document.getElementById(e);t&&t.focus()},n.setNavigationKeyBindings=e=>{e?(u={},l=e,Object.keys(e).forEach(t=>{let o=e[t];u[o.key]=t})):(u=c,l=g)},n.setNavigationKeyBindings(r.navigationRules),n};export{v as default};
|
package/dist/rendering.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as m}from"./chunk-PEL3ZYDS.mjs";var I=t=>{let w=a=>{e.wrapper.setAttribute("aria-activedescendant",a.srcElement.id)},g=()=>{e.wrapper.setAttribute("aria-activedescendant","")},e={},f=!1,n={cssClass:m.cssClass,spatialProperties:{...m.spatialProperties},semantics:{...m.semantics},parentSemantics:{...m.parentSemantics},existingElement:{...m.existingElement}};return t.defaults&&(n.cssClass=t.defaults.cssClass||n.cssClass,n.spatialProperties=t.defaults.spatialProperties?{...n.spatialProperties,...t.defaults.spatialProperties}:n.spatialProperties,n.semantics=t.defaults.semantics?{...n.semantics,...t.defaults.semantics}:n.semantics,n.parentSemantics=t.defaults.parentSemantics?{...n.parentSemantics,...t.defaults.parentSemantics}:n.parentSemantics,n.existingElement=t.defaults.existingElement?{...n.existingElement,...t.defaults.existingElement}:n.existingElement),e.initialize=()=>{if(f){console.error(`The renderer wrapper has already been initialized successfully, RenderingOptions.suffixId is: ${t.suffixId}. No further action was taken.`);return}if(t.root&&document.getElementById(t.root.id))e.root=document.getElementById(t.root.id);else{console.error("No root element found, cannot build: RenderingOptions.root.id must reference an existing DOM element in order to render children.");return}if(e.root.style.position="relative",e.root.classList.add("dn-root"),!t.suffixId){console.error("No suffix id found: options.suffixId must be specified.");return}return e.wrapper=document.createElement("div"),e.wrapper.id="dn-wrapper-"+t.suffixId,e.wrapper.setAttribute("role","application"),e.wrapper.setAttribute("aria-label",t.root.description||"Data navigation structure"),e.wrapper.setAttribute("aria-activedescendant",""),e.wrapper.classList.add("dn-wrapper"),e.wrapper.style.width=t.root&&t.root.width?t.root.width:"100%",t.root&&t.root.height&&(e.wrapper.style.height=t.root.height),t.entryButton&&t.entryButton.include&&(e.entryButton=document.createElement("button"),e.entryButton.id="dn-entry-button-"+t.suffixId,e.entryButton.classList.add("dn-entry-button"),e.entryButton.innerText="Enter navigation area",t.entryButton.callbacks&&t.entryButton.callbacks.click&&e.entryButton.addEventListener("click",t.entryButton.callbacks.click),t.entryButton.callbacks&&t.entryButton.callbacks.focus&&e.entryButton.addEventListener("focus",t.entryButton.callbacks.focus),e.wrapper.appendChild(e.entryButton)),e.root.appendChild(e.wrapper),t.exitElement?.include&&(e.exitElement=document.createElement("div"),e.exitElement.id="dn-exit-"+t.suffixId,e.exitElement.classList.add("dn-exit-position"),e.exitElement.innerText="End of data structure.",e.exitElement.setAttribute("aria-label","End of data structure."),e.exitElement.setAttribute("role","note"),e.exitElement.setAttribute("tabindex","-1"),e.exitElement.style.display="none",e.exitElement.addEventListener("focus",a=>{e.exitElement.style.display="block",e.clearStructure(),t.exitElement?.callbacks?.focus&&t.exitElement.callbacks.focus(a)}),e.exitElement.addEventListener("blur",a=>{e.exitElement.style.display="none",t.exitElement?.callbacks?.blur&&t.exitElement.callbacks.blur(a)}),e.root.appendChild(e.exitElement)),f=!0,e.root},e.render=a=>{let d=a.renderId+"",u=t.elementData[d];if(!u){console.warn(`Render data not found with renderId: ${d}. Failed to render.`);return}if(!f){console.error("render() was called before initialize(), renderer must be initialized first.");return}let v=!1,A={},s=(i,o,l)=>{let c=u[i]||n[i],h=l&&v?A[o]:c[o],S=n[i][o];return typeof c=="function"?c(u,a.datum):typeof h=="function"?h(u,a.datum):h||S||(o?void 0:c)};v=s("existingElement","useForSpatialProperties"),A=s("existingElement","spatialProperties");let B=parseFloat(s("spatialProperties","width",!0)||0),k=parseFloat(s("spatialProperties","height",!0)||0),b=parseFloat(s("spatialProperties","x",!0)||0),x=parseFloat(s("spatialProperties","y",!0)||0),r=document.createElement(s("parentSemantics","elementType")),E=s("parentSemantics","attributes");typeof E=="object"&&Object.keys(E).forEach(i=>{r.setAttribute(i,E[i])}),r.setAttribute("role",s("parentSemantics","role")),r.id=d,r.classList.add("dn-node"),r.classList.add(s("cssClass")),r.style.width=B+"px",r.style.height=k+"px",r.style.left=b+"px",r.style.top=x+"px",r.setAttribute("tabindex","0"),r.addEventListener("focus",w),r.addEventListener("blur",g);let p=document.createElement(s("semantics","elementType")),y=s("semantics","attributes");typeof y=="object"&&Object.keys(y).forEach(i=>{r.setAttribute(i,y[i])}),p.setAttribute("role",s("semantics","role")),p.classList.add("dn-node-text"),u.showText&&(p.innerText=u.semantics.label);let L=s("semantics","label");L||console.error("Accessibility error: a label must be supplied to every rendered element using semantics.label."),p.setAttribute("aria-label",L),r.appendChild(p);let P=s("spatialProperties","path");if(P){let i=B+b+10,o=k+x+10,l=document.createElementNS("http://www.w3.org/2000/svg","svg");l.setAttribute("width",i+""),l.setAttribute("height",o+""),l.setAttribute("viewBox",`0 0 ${i} ${o}`),l.style.left=-b+"px",l.style.top=-x+"px",l.classList.add("dn-node-svg"),l.setAttribute("role","presentation"),l.setAttribute("focusable","false");let c=document.createElementNS("http://www.w3.org/2000/svg","path");c.setAttribute("d",P),c.classList.add("dn-node-path"),l.appendChild(c),r.appendChild(l)}return e.wrapper.appendChild(r),r},e.remove=a=>{let d=document.getElementById(a);e.wrapper.getAttribute("aria-activedescendant")===a&&e.wrapper.setAttribute("aria-activedescendant",""),d&&(d.removeEventListener("focus",w),d.removeEventListener("blur",g),d.remove())},e.clearStructure=()=>{[...e.wrapper.children].forEach(a=>{e.entryButton&&e.entryButton===a||e.remove(a.id)})},e};export{I as default};
|
package/dist/structure.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as q,b as P}from"./chunk-K476QBP2.mjs";import{a as w,c as B,e as T,f as $,g as G,i as V}from"./chunk-PEL3ZYDS.mjs";var ee=e=>e.dataType==="vega-lite"||e.dataType==="vl"||e.dataType==="Vega-Lite"?H(e):Q(e),H=e=>{let y=V,o={},u={},h={},t=0,s=e.groupInclusionCriteria?e.groupInclusionCriteria:()=>!0,g=e.itemInclusionCriteria?e.itemInclusionCriteria:()=>!0,n=e.datumInclusionCriteria?e.datumInclusionCriteria:()=>!0,l=e.vegaLiteView._renderer._origin,f=e.vegaLiteView._scenegraph.root.items[0].mark.items[0],r=(d,i)=>{if(d["data-navigator-id"])return d["data-navigator-id"];let I=`dn-node-${i}-${t}`;return t++,d["data-navigator-id"]=I,I},a=d=>{let i=o[d],I=i.index,D=i.level,x=i.parent,m=[],v=x.items[I-1];if(v){let p=r(v,D);if(o[p]){let K=`${p}-${i.id}`;m.push(K),u[K]||(u[K]={source:p,target:i.id,navigationRules:["left","right"]})}}let S=x.items[I+1];if(S){let p=r(S,D);if(o[p]){let K=`${i.id}-${p}`;m.push(K),u[K]||(u[K]={source:i.id,target:p,navigationRules:["left","right"]})}}if(D==="group"&&x.items[I].items){let K=(x.items[I].items[0].mark.items[0].items||x.items[I].items)[0],E=r(K,"item");if(o[E]){let O=`${i.id}-${E}`;m.push(O),u[O]||(u[O]={source:i.id,target:E,navigationRules:["parent","child"]})}}else if(D==="item"){let p=r(x,"group");if(o[p]){let K=`${p}-${i.id}`;m.push(K),u[K]||(u[K]={source:p,target:i.id,navigationRules:["parent","child"]})}}return e.exitFunction&&(m.push("any-exit"),u["any-exit"]||(u["any-exit"]={source:e.getCurrent,target:e.exitFunction,navigationRules:["exit"]})),m.push("any-undo"),u["any-undo"]||(u["any-undo"]={source:e.getCurrent,target:e.getPrevious,navigationRules:["undo"]}),m},b=(d,i,I,D,x)=>{let m=r(d,i),v="render-"+m,S=I||[0,0];o[m]={},o[m].d={},o[m].id=m,o[m].renderId=v,o[m].index=D,o[m].level=i,o[m].parent=x,h[v]={},h[v].renderId=v,h[v].spatialProperties={},h[v].spatialProperties.x=d.bounds.x1+S[0],h[v].spatialProperties.y=d.bounds.y1+S[1],h[v].spatialProperties.width=d.bounds.x2-d.bounds.x1,h[v].spatialProperties.height=d.bounds.y2-d.bounds.y1,h[v].cssClass="dn-vega-lite-node",d.datum&&Object.keys(d.datum).forEach(p=>{let K=d.datum[p];n(p,K,d.datum,i,e.vegaLiteSpec)&&(o[m].d[e.keyRenamingHash&&e.keyRenamingHash[p]?e.keyRenamingHash[p]:p]=K)}),h[v].semantics={},h[v].semantics.label=e.nodeDescriber?e.nodeDescriber(o[m].d,d,i):q(o[m].d)},c=0;return f.items.forEach(d=>{if(s(d,c,e.vegaLiteSpec)){b(d,"group",l,c,f);let i=0,I=d.items[0].mark.items[0].items?d.items[0].mark.items[0]:d;I.items.forEach(D=>{g(D,i,d,e.vegaLiteSpec)&&b(D,"item",l,i,I),i++})}c++}),Object.keys(o).forEach(d=>{o[d].edges=a(d)}),{nodes:o,edges:u,elementData:h,navigationRules:y}},J=e=>{let y=0,o={};e.data.forEach(u=>{let h=typeof e.idKey=="function"?e.idKey(u):e.idKey;u[h]="_"+y,e.keysForIdGeneration&&e.keysForIdGeneration.forEach(t=>{t in u&&(typeof u[t]=="string"?(o[t]||(o[t]=0),o[u[t]]||(o[u[t]]=0),u[h]+="_"+t+o[t]+"_"+u[t]+o[u[t]],o[t]++,o[u[t]]++):(o[t]||(o[t]=0),u[h]+="_"+t+o[t],o[t]++))}),y++})},U=e=>{let y={};return e.data.forEach(o=>{e.idKey||console.error("Building nodes. A key string must be supplied in options.idKey to specify the id keys of every node.");let u=typeof e.idKey=="function"?e.idKey(o):e.idKey,h=o[u];if(!h){console.error(`Building nodes. Each datum in options.data must contain an id. When matching the id key string ${u}, this datum has no id: ${JSON.stringify(o)}.`);return}if(y[h]){console.error(`Building nodes. Each id for data in options.data must be unique. This id is not unique: ${h}.`);return}else{let t=typeof e.renderIdKey=="function"?e.renderIdKey(o):e.renderIdKey;y[h]={id:h,edges:[],renderId:t?o[t]||"":o.renderIdKey||"",data:o}}}),y},W=(e,y)=>{let o={};if(e.dimensions?.parentOptions?.addLevel0){let t=e.dimensions.parentOptions.addLevel0;y[t.id]={...t,dimensionLevel:0}}let u=[...G],h=(t,s)=>{let g=s.numericalExtents[0],n=s.numericalExtents[1];s.numericalExtents[0]=g<t?g:t,s.numericalExtents[1]=n>t?n:t};return e.data.forEach(t=>{let s=e.dimensions.values||[],g=0;s.forEach(n=>{if(!n.dimensionKey){console.error(`Building nodes, parsing dimensions. Each dimension in options.dimensions must contain a dimensionKey. This dimension has no key: ${JSON.stringify(n)}.`);return}if(n.dimensionKey in t){let l=t[n.dimensionKey],f=typeof n.operations?.filterFunction=="function"?n.operations.filterFunction(t,n):!0;if(l!==void 0&&f){if(n.type||(n.type=typeof l=="bigint"||typeof l=="number"?"numerical":"categorical"),!o[n.dimensionKey]){let c=typeof n.nodeId=="function"?n.nodeId(n,e.data):n.nodeId||P(n.dimensionKey),j=typeof n.renderId=="function"?n.renderId(n,e.data):n.renderId||c;o[n.dimensionKey]={dimensionKey:n.dimensionKey,nodeId:c,divisions:{},numericalExtents:[1/0,-1/0],type:n.type,operations:{compressSparseDivisions:n.operations?.compressSparseDivisions||!1,sortFunction:n.operations?.sortFunction||void 0},behavior:n.behavior||{extents:"circular"},navigationRules:n.navigationRules||{sibling_sibling:u.length?[...u.shift()]:["previous_"+n.dimensionKey,"next_"+n.dimensionKey],parent_child:["parent_"+n.dimensionKey,"child"]}},y[c]={id:c,renderId:j,derivedNode:n.dimensionKey,edges:[],dimensionLevel:1,data:o[n.dimensionKey],renderingStrategy:n.renderingStrategy||"singleSquare"}}let r=o[n.dimensionKey],a=null;if(n.type==="categorical"){let c=typeof n.divisionOptions?.divisionNodeIds=="function"?n.divisionOptions.divisionNodeIds(n.dimensionKey,l,g):P(r.nodeId+"_"+l);if(a=r.divisions[c],!a){a=r.divisions[c]={id:c,sortFunction:n.divisionOptions?.sortFunction||void 0,values:{}};let j=typeof n.divisionOptions?.divisionRenderIds=="function"?n.divisionOptions.divisionRenderIds(n.dimensionKey,l,g):c;y[c]={id:c,renderId:j,derivedNode:n.dimensionKey,edges:[],dimensionLevel:2,data:{...a},renderingStrategy:n.divisionOptions?.renderingStrategy||"singleSquare"},y[c].data[n.dimensionKey]=l}}else{a=r.divisions[r.nodeId],a||(a=r.divisions[r.nodeId]={id:r.nodeId,sortFunction:n.divisionOptions?.sortFunction||void 0,values:{}}),n.operations||(n.operations={});let c=n.operations.createNumericalSubdivisions;r.subdivisions=typeof c=="number"&&c<1?1:c||1,c!==1&&(r.divisionOptions||(r.divisionOptions=n.divisionOptions),h(l,r))}let b=typeof e.idKey=="function"?e.idKey(t):e.idKey;a.values[t[b]]=t}}g++})}),Object.keys(o).forEach(t=>{let s=o[t],g=s.divisions;if(s.type==="numerical"){g[s.nodeId].values=Object.fromEntries(Object.entries(g[s.nodeId].values).sort((f,r)=>typeof s.operations?.sortFunction=="function"?s.operations.sortFunction(f[1],r[1],s):f[1][t]-r[1][t]));let l=g[s.nodeId].values;if(s.numericalExtents[0]!==1/0&&s.subdivisions!==1){let f=Object.keys(l),r=typeof s.subdivisions=="function"?s.subdivisions(t,l):s.subdivisions,b=(s.numericalExtents[1]-s.numericalExtents[0])/r,c=s.numericalExtents[0]+b,j=0,d=0;for(c=s.numericalExtents[0]+b;c<=s.numericalExtents[1];c+=b){let i=typeof s.divisionOptions?.divisionNodeIds=="function"?s.divisionOptions.divisionNodeIds(t,c,c):s.nodeId+"_"+c;s.divisions[i]={id:i,sortFunction:s.divisionOptions?.sortFunction||void 0,values:{}};let I=typeof s.divisionOptions?.divisionRenderIds=="function"?s.divisionOptions.divisionRenderIds(t,c,c):i;y[i]={id:i,renderId:I,derivedNode:t,edges:[],data:s.divisions[i],dimensionLevel:2,renderingStrategy:s.divisionOptions?.renderingStrategy||"singleSquare"};let D=!1;for(;!D&&d<f.length;){let x=l[f[d]];x[t]<=c?s.divisions[i].values[x.id]=x:(c+=b,D=!0),d++}j++}delete g[t]}}else typeof s.operations?.sortFunction=="function"&&(s.divisions=Object.fromEntries(Object.entries(g).sort((l,f)=>s.operations.sortFunction(l[1],f[1],s))));Object.keys(s.divisions).forEach(l=>{let f=s.divisions[l];typeof f.sortFunction=="function"&&(f.values=Object.fromEntries(Object.entries(f.values).sort((r,a)=>f.sortFunction(r[1],a[1],f))))})}),Object.keys(o).forEach(t=>{let s=o[t];if(s.operations.compressSparseDivisions){let g=Object.keys(s.divisions),n={},l=!0;if(g.forEach(f=>{let r=s.divisions[f],a=Object.keys(r.values);a.length<=1?a.forEach(b=>{n[b]={...r.values[b]}}):l=!1}),l){let f={id:s.nodeId,values:n};g.forEach(r=>{delete y[r]}),s.divisions={},s.divisions[s.nodeId]=f}}}),e.dimensions.adjustDimensions&&(o=e.dimensions.adjustDimensions(o)),o},Y=(e,y,o)=>{let u={},h=(s,g)=>{y[s].edges.indexOf(g)===-1&&y[s].edges.push(g)},t=(s,g,n,l)=>{let f=`${s}-${g}`,r=e.useDirectedEdges?`${g}-${f}`:f,a=!l||l==="source",b=!l||l==="target",c=j=>{u[j]?u[j].navigationRules.push(...n||[]):u[j]={source:s,target:g,navigationRules:n?[...n]:[]}};c(f),e.useDirectedEdges&&b&&c(r),a&&h(s,f),b&&h(g,r)};if(o&&Object.keys(o).length){let s=Object.keys(o),g=e.dimensions?.parentOptions?.level1Options?.order,n=g||s,l=0,f=e.dimensions?.parentOptions||{},r=f.level1Options?.behavior?.extents||"terminal",a=f.addLevel0,b=a?f.level1Options?.navigationRules?.parent_child||["parent","child"]:[],c=f.level1Options?.navigationRules?.sibling_sibling||["left","right"],j=typeof n[0]=="string"?g?y[n[0]]:y[o[n[0]].nodeId]:n[0];a&&t(a.id,j.id,b,"source"),n.forEach(d=>{let i=typeof d=="string"?g?y[d]:y[o[d].nodeId]:d;if(i===d&&!y[i.id]&&(y[i.id]=i),a&&(e.useDirectedEdges?t(i.id,a.id,b,"source"):t(a.id,i.id,b,"target")),l===n.length-1&&r==="circular")t(i.id,j.id,c);else if(l===n.length-1&&r==="bridgedCustom")t(i.id,f.level1Options.behavior.customBridgePost,c);else if(l<n.length-1){let I=typeof n[l+1]=="string"?g?y[n[l+1]]:y[o[n[l+1]].nodeId]:n[l+1];t(i.id,I.id,c)}!l&&r==="bridgedCustom"&&t(f.level1Options.behavior.customBridgePost,i.id,c),l++}),s.forEach(d=>{let i=o[d],I=i.behavior?.childmostNavigation||"within",D=(K,E,O,F)=>F.values[Object.keys(F.values)[K]]||void 0,x=I==="across"&&i.behavior?.childmostMatching?i.behavior?.childmostMatching:D,m=i.behavior?.extents||"circular";i.divisions||console.error(`Parsing dimensions. The dimension using the key ${d} is missing the divisions property. dimension.divisions should be supplied. ${JSON.stringify(i)}.`);let v=Object.keys(i.divisions),S=i.divisions[v[0]];if(v.length!==1)t(i.nodeId,S.id,i.navigationRules.parent_child,"source");else{let K=Object.keys(S.values),E=typeof e.idKey=="function"?e.idKey(S.values[K[0]]):e.idKey;t(i.nodeId,S.values[K[0]][E],i.navigationRules.parent_child,"source")}let p=0;v.forEach(K=>{let E=i.divisions[K];p===v.length-1&&(m==="circular"||m==="bridgedCousins"||m==="bridgedCustom")?t(E.id,i.divisions[v[0]].id,i.navigationRules.sibling_sibling):p<v.length-1&&t(E.id,i.divisions[v[p+1]].id,i.navigationRules.sibling_sibling);let O=Object.keys(E.values);e.useDirectedEdges?t(E.id,i.nodeId,i.navigationRules.parent_child,"source"):t(i.nodeId,E.id,i.navigationRules.parent_child,"target");let F=typeof e.idKey=="function"?e.idKey(E.values[O[0]]):e.idKey;t(E.id,E.values[O[0]][F],i.navigationRules.parent_child,"source");let C=0;O.length>1&&O.forEach(M=>{let R=E.values[M],N=typeof e.idKey=="function"?e.idKey(R):e.idKey,k=v.length!==1?E.id:i.nodeId;if(e.useDirectedEdges?t(R[N],k,i.navigationRules.parent_child,"source"):t(k,R[N],i.navigationRules.parent_child,"target"),I==="within"){if(C===O.length-1&&m==="circular"){let _=typeof e.idKey=="function"?e.idKey(E.values[O[0]]):e.idKey;t(R[N],E.values[O[0]][_],i.navigationRules.sibling_sibling)}else if(C===O.length-1&&m==="bridgedCousins")if(p!==v.length-1){let _=typeof e.idKey=="function"?e.idKey(i.divisions[v[p+1]].values[O[0]]):e.idKey;t(R[N],i.divisions[v[p+1]].values[O[0]][_],i.navigationRules.sibling_sibling)}else{let _=typeof e.idKey=="function"?e.idKey(i.divisions[v[0]].values[O[0]]):e.idKey;t(R[N],i.divisions[v[0]].values[O[0]][_],i.navigationRules.sibling_sibling)}else if(C===O.length-1&&m==="bridgedCustom")t(R[N],i.behavior.customBridgePost,i.navigationRules.sibling_sibling);else if(C<O.length-1){let _=typeof e.idKey=="function"?e.idKey(E.values[O[C+1]]):e.idKey;t(R[N],E.values[O[C+1]][_],i.navigationRules.sibling_sibling)}if(!C&&m==="bridgedCousins")if(p!==0){let _=typeof e.idKey=="function"?e.idKey(i.divisions[v[p-1]].values[O[O.length-1]]):e.idKey;t(i.divisions[v[p-1]].values[O[O.length-1]][_],R[N],i.navigationRules.sibling_sibling)}else{let _=typeof e.idKey=="function"?e.idKey(i.divisions[v[v.length-1]].values[O[O.length-1]]):e.idKey;t(i.divisions[v[v.length-1]].values[O[O.length-1]][_],R[N],i.navigationRules.sibling_sibling)}else!C&&m==="bridgedCustom"&&t(i.behavior.customBridgePrevious,R[N],i.navigationRules.sibling_sibling)}else if(p===v.length-1&&m==="bridgedCustom")t(R[N],i.behavior.customBridgePost,i.navigationRules.sibling_sibling);else if(!p&&m==="bridgedCustom")t(i.behavior.customBridgePrevious,R[N],i.navigationRules.sibling_sibling);else{let _=p===v.length-1&&m==="circular"?i.divisions[v[0]]:i.divisions[v[p+1]];if(_){let L=x(C,R[N],E,_);if(L){let A=typeof e.idKey=="function"?e.idKey(L):e.idKey;t(R[N],L[A],i.navigationRules.sibling_sibling)}}}C++}),p++})})}return Object.keys(y).forEach(s=>{let g=y[s];e.genericEdges?.length&&e.genericEdges.forEach(n=>{u[n.edgeId]||(u[n.edgeId]=n.edge),(!n.conditional||n.conditional&&n.conditional(g,n))&&g.edges.push(n.edgeId)})}),u},z=(e,y,o)=>{let u=e.navigationRules;if(!u){let h=Object.keys(o||{});h.length>6&&console.error(`Building navigationRules. Dimension count is too high to automatically generate key commands. It is recommend you reduce your dimensions to 6 or fewer for end-user experience. If not, you must provide your own navigation rules in options.navigationRules. Details: Count is ${h.length}. Dimensions counted: ${h.join(", ")}.`);let t={},s={},g={},n=[...T],l=[...B],f=(r,a)=>{let b=r&&a,c=!1,j=!1;if((t[r]||s[r])&&(s[r]={...t[r]},c=!0),a&&(t[a]||s[a])&&(s[a]={...t[a]},j=!0),b&&!c&&!j){n.length||console.error("Building navigationRules. Dimension count is too high to automatically generate key commands, we have run out of keyboard key pairs to assign. You must either provide your own navigation rules in options.navigationRules, provide rules when generating dimensions, or reduce dimension count.");let d=[...n.shift()];l.splice(l.indexOf(d[0]),1),l.splice(l.indexOf(d[1]),1),s[r]={direction:e.useDirectedEdges?"target":"source",key:d[0]},s[a]={direction:"target",key:d[1]}}else{if(!s[r]&&l.length){let d=l.shift(),i=[];n.forEach(I=>{d!==I[0]&&d!==I[1]&&i.push(I)}),n=i,s[r]={direction:e.useDirectedEdges?"target":"source",key:d}}if(a&&!s[a]&&l.length){let d=l.shift(),i=[];n.forEach(I=>{d!==I[0]&&d!==I[1]&&i.push(I)}),n=i,s[a]={direction:"target",key:d}}l.length||(s[r]||(g[r]=r),a&&!s[a]&&(g[a]=a))}};if(Object.keys($).forEach(r=>{let a={...$[r]};e.useDirectedEdges&&(a.direction="target"),t[r]=a}),h.length){if(e.dimensions?.parentOptions?.addLevel0){let r=e.dimensions.parentOptions.level1Options?.navigationRules?.parent_child||["parent","child"];f(r[0],r[1])}h.forEach(r=>{let a=o[r].navigationRules.parent_child,b=o[r].navigationRules.sibling_sibling;f(a[0],a[1]),f(b[0],b[1])})}if(Object.keys(y).forEach(r=>{y[r].navigationRules.forEach(a=>{s[a]||f(a)})}),Object.keys(g).length){let r={};Object.keys(s).forEach(b=>{r[s[b].key]=s[b].key}),Object.keys(t).forEach(b=>{!r[t[b].key]&&!w[t[b].key]&&l.push(t[b].key)});let a={...g};g={},Object.keys(a).forEach(b=>{f(b)}),Object.keys(g).length&&console.error(`Building navigationRules. There are no more keys left to assign automatically. Recommended fixes: use fewer dimensions, use fewer GenericEdges, or build your own navigationRules. Rules remaining without keyboard keys: ${Object.keys(g).join(", ")}.`)}u=s}return u},Q=e=>{e.addIds&&J(e);let y=U(e),o=W(e,y),u=Y(e,y,o),h=z(e,u,o);return{nodes:y,edges:u,dimensions:o,navigationRules:h}};export{J as addSimpleDataIDs,Y as buildEdges,H as buildNodeStructureFromVegaLite,U as buildNodes,z as buildRules,Q as buildStructure,ee as default,W as scaffoldDimensions};
|
package/dist/utilities.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a,b}from"./chunk-K476QBP2.mjs";export{b as createValidId,a as describeNode};
|
|
File without changes
|
|
File without changes
|