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/dist/input.cjs ADDED
@@ -0,0 +1 @@
1
+ function e(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}var r=Object.defineProperty;var t=Object.getOwnPropertyDescriptor;var n=Object.getOwnPropertyNames;var o=Object.prototype.hasOwnProperty;var i=function e(e,t){for(var n in t)r(e,n,{get:t[n],enumerable:!0})},u=function i(i,u,a,c){var f=true,d=false,s=undefined;if(u&&(typeof u==="undefined"?"undefined":e(u))=="object"||typeof u=="function")try{var y=function(){var e=v.value;!o.call(i,e)&&e!==a&&r(i,e,{get:function r(){return u[e]},enumerable:!(c=t(u,e))||c.enumerable})};for(var l=n(u)[Symbol.iterator](),v;!(f=(v=l.next()).done);f=true)y()}catch(e){d=true;s=e}finally{try{if(!f&&l.return!=null){l.return()}}finally{if(d){throw s}}}return i};var a=function e(e){return u(r({},"__esModule",{value:!0}),e)};var c={};i(c,{default:function e(){return s}});module.exports=a(c);var f={ArrowLeft:"left",ArrowRight:"right",ArrowUp:"up",ArrowDown:"down",Period:"forward",Comma:"backward",Escape:"parent",Enter:"child"};var d={left:{key:"ArrowLeft",direction:"source"},right:{key:"ArrowRight",direction:"target"},up:{key:"ArrowUp",direction:"source"},down:{key:"ArrowDown",direction:"target"},child:{key:"Enter",direction:"target"},parent:{key:"Backspace",direction:"source"},backward:{key:"Comma",direction:"source"},forward:{key:"Period",direction:"target"},previous:{key:"Semicolon",direction:"source"},next:{key:"Quote",direction:"target"},exit:{key:"Escape",direction:"target"},help:{key:"KeyY",direction:"target"},undo:{key:"KeyZ",direction:"target"}};var s=function e(e){var r={},t=f,n=d;return r.moveTo=function(r){var t=e.structure.nodes[r];if(t)return t},r.move=function(t,o){if(t){var i=e.structure.nodes[t];if(i.edges){var u=function(){var r=e.structure.edges[i.edges[c]];if(r.navigationRules.forEach(function(e){a||(a=d(e,r))}),a)return"break"};var a=null,c=0,f=n[o];if(!f)return;var d=function e(e,r){if(e!==o)return null;var n={target:typeof r.target=="string"?r.target:r.target(i,t),source:typeof r.source=="string"?r.source:r.source(i,t)};return n[f.direction]!==t?n[f.direction]:null};for(c=0;c<i.edges.length;c++){var s=u();if(s==="break")break}return a?r.moveTo(a):void 0}}},r.enter=function(){if(e.entryPoint)return r.moveTo(e.entryPoint);console.error("No entry point was specified in InputOptions, returning undefined")},r.exit=function(){if(e.exitPoint)return e.exitPoint;console.error("No exit point was specified in InputOptions, returning undefined")},r.keydownValidator=function(e){var r=t[e.code];if(r)return r},r.focus=function(e){var r=document.getElementById(e);r&&r.focus()},r.setNavigationKeyBindings=function(e){e?(t={},n=e,Object.keys(e).forEach(function(r){var n=e[r];t[n.key]=r})):(t=f,n=d)},r.setNavigationKeyBindings(e.navigationRules),r};
package/dist/input.js CHANGED
@@ -1 +1 @@
1
- var e=Object.defineProperty;var r=Object.getOwnPropertyDescriptor;var t=Object.getOwnPropertyNames;var n=Object.prototype.hasOwnProperty;var o=function(r,t){for(var n in t)e(r,n,{get:t[n],enumerable:!0})},i=function(o,i,a,u){var c=true,f=false,d=undefined;if(i&&typeof i=="object"||typeof i=="function")try{var s=function(){var t=y.value;!n.call(o,t)&&t!==a&&e(o,t,{get:function(){return i[t]},enumerable:!(u=r(i,t))||u.enumerable})};for(var v=t(i)[Symbol.iterator](),y;!(c=(y=v.next()).done);c=true)s()}catch(e){f=true;d=e}finally{try{if(!c&&v.return!=null){v.return()}}finally{if(f){throw d}}}return o};var a=function(r){return i(e({},"__esModule",{value:!0}),r)};var u={};o(u,{default:function(){return d}});module.exports=a(u);var c={ArrowLeft:"left",ArrowRight:"right",ArrowUp:"up",ArrowDown:"down",Period:"forward",Comma:"backward",Escape:"parent",Enter:"child"};var f={left:{key:"ArrowLeft",direction:"source"},right:{key:"ArrowRight",direction:"target"},up:{key:"ArrowUp",direction:"source"},down:{key:"ArrowDown",direction:"target"},child:{key:"Enter",direction:"target"},parent:{key:"Backspace",direction:"source"},backward:{key:"Comma",direction:"source"},forward:{key:"Period",direction:"target"},previous:{key:"Semicolon",direction:"source"},next:{key:"Quote",direction:"target"},exit:{key:"Escape",direction:"target"},help:{key:"KeyY",direction:"target"},undo:{key:"KeyZ",direction:"target"}};var d=function(e){var r={},t=c,n=f;return r.moveTo=function(r){var t=e.structure.nodes[r];if(t)return t},r.move=function(t,o){if(t){var i=e.structure.nodes[t];if(i.edges){var a=function(){var r=e.structure.edges[i.edges[c]];if(r.navigationRules.forEach(function(e){u||(u=d(e,r))}),u)return"break"};var u=null,c=0,f=n[o];if(!f)return;var d=function(e,r){if(e!==o)return null;var n={target:typeof r.target=="string"?r.target:r.target(i,t),source:typeof r.source=="string"?r.source:r.source(i,t)};return n[f.direction]!==t?n[f.direction]:null};for(c=0;c<i.edges.length;c++){var s=a();if(s==="break")break}return u?r.moveTo(u):void 0}}},r.enter=function(){if(e.entryPoint)return r.moveTo(e.entryPoint);console.error("No entry point was specified in InputOptions, returning undefined")},r.exit=function(){if(e.exitPoint)return e.exitPoint;console.error("No exit point was specified in InputOptions, returning undefined")},r.keydownValidator=function(e){var r=t[e.code];if(r)return r},r.focus=function(e){var r=document.getElementById(e);r&&r.focus()},r.setNavigationKeyBindings=function(e){e?(t={},n=e,Object.keys(e).forEach(function(r){var n=e[r];t[n.key]=r})):(t=c,n=f)},r.setNavigationKeyBindings(e.navigationRules),r};
1
+ import{b as c,f as g}from"./chunk-MPFBSVCV.js";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};
@@ -0,0 +1 @@
1
+ function e(e,t){if(t==null||t>e.length)t=e.length;for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function t(t){if(Array.isArray(t))return e(t)}function r(e,t,r){if(t in e){Object.defineProperty(e,t,{value:r,enumerable:true,configurable:true,writable:true})}else{e[t]=r}return e}function n(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function i(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function a(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};var i=Object.keys(n);if(typeof Object.getOwnPropertySymbols==="function"){i=i.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))}i.forEach(function(t){r(e,t,n[t])})}return e}function o(e){return t(e)||n(e)||l(e)||i()}function s(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function l(t,r){if(!t)return;if(typeof t==="string")return e(t,r);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor)n=t.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return e(t,r)}var u=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var f=function e(e,t){for(var r in t)u(e,r,{get:t[r],enumerable:!0})},m=function e(e,t,r,n){var i=true,a=false,o=undefined;if(t&&(typeof t==="undefined"?"undefined":s(t))=="object"||typeof t=="function")try{var l=function(){var i=m.value;!p.call(e,i)&&i!==r&&u(e,i,{get:function e(){return t[i]},enumerable:!(n=c(t,i))||n.enumerable})};for(var f=d(t)[Symbol.iterator](),m;!(i=(m=f.next()).done);i=true)l()}catch(e){a=true;o=e}finally{try{if(!i&&f.return!=null){f.return()}}finally{if(a){throw o}}}return e};var b=function e(e){return m(u({},"__esModule",{value:!0}),e)};var y={};f(y,{default:function e(){return x}});module.exports=b(y);var v={cssClass:void 0,spatialProperties:{x:0,y:0,width:0,height:0,path:""},semantics:{label:"",elementType:"div",role:"image",attributes:void 0},parentSemantics:{label:"",elementType:"figure",role:"figure",attributes:void 0},existingElement:{useForSpatialProperties:!1,spatialProperties:void 0}};var x=function e(e){var t=function e(e){n.wrapper.setAttribute("aria-activedescendant",e.srcElement.id)},r=function e(){n.wrapper.setAttribute("aria-activedescendant","")},n={},i=!1,l={cssClass:v.cssClass,spatialProperties:a({},v.spatialProperties),semantics:a({},v.semantics),parentSemantics:a({},v.parentSemantics),existingElement:a({},v.existingElement)};return e.defaults&&(l.cssClass=e.defaults.cssClass||l.cssClass,l.spatialProperties=e.defaults.spatialProperties?a({},l.spatialProperties,e.defaults.spatialProperties):l.spatialProperties,l.semantics=e.defaults.semantics?a({},l.semantics,e.defaults.semantics):l.semantics,l.parentSemantics=e.defaults.parentSemantics?a({},l.parentSemantics,e.defaults.parentSemantics):l.parentSemantics,l.existingElement=e.defaults.existingElement?a({},l.existingElement,e.defaults.existingElement):l.existingElement),n.initialize=function(){var t;if(i){console.error("The renderer wrapper has already been initialized successfully, RenderingOptions.suffixId is: ".concat(e.suffixId,". No further action was taken."));return}if(e.root&&document.getElementById(e.root.id))n.root=document.getElementById(e.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(n.root.style.position="relative",n.root.classList.add("dn-root"),!e.suffixId){console.error("No suffix id found: options.suffixId must be specified.");return}return n.wrapper=document.createElement("div"),n.wrapper.id="dn-wrapper-"+e.suffixId,n.wrapper.setAttribute("role","application"),n.wrapper.setAttribute("aria-label",e.root.description||"Data navigation structure"),n.wrapper.setAttribute("aria-activedescendant",""),n.wrapper.classList.add("dn-wrapper"),n.wrapper.style.width=e.root&&e.root.width?e.root.width:"100%",e.root&&e.root.height&&(n.wrapper.style.height=e.root.height),e.entryButton&&e.entryButton.include&&(n.entryButton=document.createElement("button"),n.entryButton.id="dn-entry-button-"+e.suffixId,n.entryButton.classList.add("dn-entry-button"),n.entryButton.innerText="Enter navigation area",e.entryButton.callbacks&&e.entryButton.callbacks.click&&n.entryButton.addEventListener("click",e.entryButton.callbacks.click),e.entryButton.callbacks&&e.entryButton.callbacks.focus&&n.entryButton.addEventListener("focus",e.entryButton.callbacks.focus),n.wrapper.appendChild(n.entryButton)),n.root.appendChild(n.wrapper),((t=e.exitElement)===null||t===void 0?void 0:t.include)&&(n.exitElement=document.createElement("div"),n.exitElement.id="dn-exit-"+e.suffixId,n.exitElement.classList.add("dn-exit-position"),n.exitElement.innerText="End of data structure.",n.exitElement.setAttribute("aria-label","End of data structure."),n.exitElement.setAttribute("role","note"),n.exitElement.setAttribute("tabindex","-1"),n.exitElement.style.display="none",n.exitElement.addEventListener("focus",function(t){var r,i;n.exitElement.style.display="block",n.clearStructure(),((i=e.exitElement)===null||i===void 0?void 0:(r=i.callbacks)===null||r===void 0?void 0:r.focus)&&e.exitElement.callbacks.focus(t)}),n.exitElement.addEventListener("blur",function(t){var r,i;n.exitElement.style.display="none",((i=e.exitElement)===null||i===void 0?void 0:(r=i.callbacks)===null||r===void 0?void 0:r.blur)&&e.exitElement.callbacks.blur(t)}),n.root.appendChild(n.exitElement)),i=!0,n.root},n.render=function(a){var o=a.renderId+"",u=e.elementData[o];if(!u){console.warn("Render data not found with renderId: ".concat(o,". Failed to render."));return}if(!i){console.error("render() was called before initialize(), renderer must be initialized first.");return}var c=!1,d={},p=function e(e,t,r){var n;var i=u[e]||l[e],o=r&&c?d[t]:i===null||i===void 0?void 0:i[t],s=(n=l[e])===null||n===void 0?void 0:n[t];return typeof i=="function"?i(u,a.datum):typeof o=="function"?o(u,a.datum):o||s||(t?void 0:i)};c=p("existingElement","useForSpatialProperties"),d=p("existingElement","spatialProperties");var f=parseFloat(p("spatialProperties","width",!0)||0),m=parseFloat(p("spatialProperties","height",!0)||0),b=parseFloat(p("spatialProperties","x",!0)||0),y=parseFloat(p("spatialProperties","y",!0)||0),v=document.createElement(p("parentSemantics","elementType")),x=p("parentSemantics","attributes");(typeof x==="undefined"?"undefined":s(x))=="object"&&Object.keys(x).forEach(function(e){v.setAttribute(e,x[e])}),v.setAttribute("role",p("parentSemantics","role")),v.id=o,v.classList.add("dn-node"),v.classList.add(p("cssClass")),v.style.width=f+"px",v.style.height=m+"px",v.style.left=b+"px",v.style.top=y+"px",v.setAttribute("tabindex","0"),v.addEventListener("focus",t),v.addEventListener("blur",r);var h=document.createElement(p("semantics","elementType")),E=p("semantics","attributes");(typeof E==="undefined"?"undefined":s(E))=="object"&&Object.keys(E).forEach(function(e){v.setAttribute(e,E[e])}),h.setAttribute("role",p("semantics","role")),h.classList.add("dn-node-text"),u.showText&&(h.innerText=u.semantics.label);var w=p("semantics","label");w||console.error("Accessibility error: a label must be supplied to every rendered element using semantics.label."),h.setAttribute("aria-label",w),v.appendChild(h);var g=p("spatialProperties","path");if(g){var A=f+b+10,S=m+y+10,P=document.createElementNS("http://www.w3.org/2000/svg","svg");P.setAttribute("width",A+""),P.setAttribute("height",S+""),P.setAttribute("viewBox","0 0 ".concat(A," ").concat(S)),P.style.left=-b+"px",P.style.top=-y+"px",P.classList.add("dn-node-svg"),P.setAttribute("role","presentation"),P.setAttribute("focusable","false");var O=document.createElementNS("http://www.w3.org/2000/svg","path");O.setAttribute("d",g),O.classList.add("dn-node-path"),P.appendChild(O),v.appendChild(P)}return n.wrapper.appendChild(v),v},n.remove=function(e){var i=document.getElementById(e);n.wrapper.getAttribute("aria-activedescendant")===e&&n.wrapper.setAttribute("aria-activedescendant",""),i&&(i.removeEventListener("focus",t),i.removeEventListener("blur",r),i.remove())},n.clearStructure=function(){o(n.wrapper.children).forEach(function(e){n.entryButton&&n.entryButton===e||n.remove(e.id)})},n};
package/dist/rendering.js CHANGED
@@ -1 +1 @@
1
- function e(e,t){if(t==null||t>e.length)t=e.length;for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function t(t){if(Array.isArray(t))return e(t)}function r(e,t,r){if(t in e){Object.defineProperty(e,t,{value:r,enumerable:true,configurable:true,writable:true})}else{e[t]=r}return e}function n(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function i(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function a(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};var i=Object.keys(n);if(typeof Object.getOwnPropertySymbols==="function"){i=i.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))}i.forEach(function(t){r(e,t,n[t])})}return e}function s(e){return t(e)||n(e)||o(e)||i()}function o(t,r){if(!t)return;if(typeof t==="string")return e(t,r);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor)n=t.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return e(t,r)}var l=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var p=function(e,t){for(var r in t)l(e,r,{get:t[r],enumerable:!0})},f=function(e,t,r,n){var i=true,a=false,s=undefined;if(t&&typeof t=="object"||typeof t=="function")try{var o=function(){var i=f.value;!d.call(e,i)&&i!==r&&l(e,i,{get:function(){return t[i]},enumerable:!(n=u(t,i))||n.enumerable})};for(var p=c(t)[Symbol.iterator](),f;!(i=(f=p.next()).done);i=true)o()}catch(e){a=true;s=e}finally{try{if(!i&&p.return!=null){p.return()}}finally{if(a){throw s}}}return e};var m=function(e){return f(l({},"__esModule",{value:!0}),e)};var b={};p(b,{default:function(){return v}});module.exports=m(b);var y={cssClass:"",spatialProperties:{x:0,y:0,width:0,height:0,path:""},semantics:{label:"",elementType:"div",role:"image",attributes:void 0},parentSemantics:{label:"",elementType:"figure",role:"figure",attributes:void 0},existingElement:{useForSpatialProperties:!1,spatialProperties:void 0}};var v=function(e){var t=function(e){n.wrapper.setAttribute("aria-activedescendant",e.srcElement.id)},r=function(){n.wrapper.setAttribute("aria-activedescendant","")},n={},i=!1,o={cssClass:y.cssClass,spatialProperties:a({},y.spatialProperties),semantics:a({},y.semantics),parentSemantics:a({},y.parentSemantics),existingElement:a({},y.existingElement)};return e.defaults&&(o.cssClass=e.defaults.cssClass||o.cssClass,o.spatialProperties=e.defaults.spatialProperties?a({},o.spatialProperties,e.defaults.spatialProperties):o.spatialProperties,o.semantics=e.defaults.semantics?a({},o.semantics,e.defaults.semantics):o.semantics,o.parentSemantics=e.defaults.parentSemantics?a({},o.parentSemantics,e.defaults.parentSemantics):o.parentSemantics,o.existingElement=e.defaults.existingElement?a({},o.existingElement,e.defaults.existingElement):o.existingElement),n.initialize=function(){var t;if(i){console.error("The renderer wrapper has already been initialized successfully, RenderingOptions.suffixId is: ".concat(e.suffixId,". No further action was taken."));return}if(e.root&&document.getElementById(e.root.id))n.root=document.getElementById(e.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(n.root.style.position="relative",n.root.classList.add("dn-root"),!e.suffixId){console.error("No suffix id found: options.suffixId must be specified.");return}return n.wrapper=document.createElement("div"),n.wrapper.id="dn-wrapper-"+e.suffixId,n.wrapper.setAttribute("role","application"),n.wrapper.setAttribute("aria-label",e.root.description||"Data navigation structure"),n.wrapper.setAttribute("aria-activedescendant",""),n.wrapper.classList.add("dn-wrapper"),n.wrapper.style.width=e.root&&e.root.width?e.root.width:"100%",e.root&&e.root.height&&(n.wrapper.style.height=e.root.height),e.entryButton&&e.entryButton.include&&(n.entryButton=document.createElement("button"),n.entryButton.id="dn-entry-button-"+e.suffixId,n.entryButton.classList.add("dn-entry-button"),n.entryButton.innerText="Enter navigation area",e.entryButton.callbacks&&e.entryButton.callbacks.click&&n.entryButton.addEventListener("click",e.entryButton.callbacks.click),e.entryButton.callbacks&&e.entryButton.callbacks.focus&&n.entryButton.addEventListener("focus",e.entryButton.callbacks.focus),n.wrapper.appendChild(n.entryButton)),n.root.appendChild(n.wrapper),((t=e.exitElement)===null||t===void 0?void 0:t.include)&&(n.exitElement=document.createElement("div"),n.exitElement.id="dn-exit-"+e.suffixId,n.exitElement.classList.add("dn-exit-position"),n.exitElement.innerText="End of data structure.",n.exitElement.setAttribute("aria-label","End of data structure."),n.exitElement.setAttribute("role","note"),n.exitElement.setAttribute("tabindex","-1"),n.exitElement.style.display="none",n.exitElement.addEventListener("focus",function(t){var r,i;n.exitElement.style.display="block",n.clearStructure(),((i=e.exitElement)===null||i===void 0?void 0:(r=i.callbacks)===null||r===void 0?void 0:r.focus)&&e.exitElement.callbacks.focus(t)}),n.exitElement.addEventListener("blur",function(t){var r,i;n.exitElement.style.display="none",((i=e.exitElement)===null||i===void 0?void 0:(r=i.callbacks)===null||r===void 0?void 0:r.blur)&&e.exitElement.callbacks.blur(t)}),n.root.appendChild(n.exitElement)),i=!0,n.root},n.render=function(a){var s=a.renderId+"",l=e.elementData[s];if(!l){console.warn("Render data not found with renderId: ".concat(s,". Failed to render."));return}if(!i){console.error("render() was called before initialize(), renderer must be initialized first.");return}var u=!1,c={},d=function(e,t,r){var n=l[e]||o[e],i=r&&u?c[t]:n[t],s=o[e][t];return typeof n=="function"?n(l,a.datum):typeof i=="function"?i(l,a.datum):i||s||(t?void 0:n)};u=d("existingElement","useForSpatialProperties"),c=d("existingElement","spatialProperties");var p=parseFloat(d("spatialProperties","width",!0)||0),f=parseFloat(d("spatialProperties","height",!0)||0),m=parseFloat(d("spatialProperties","x",!0)||0),b=parseFloat(d("spatialProperties","y",!0)||0),y=document.createElement(d("parentSemantics","elementType")),v=d("parentSemantics","attributes");typeof v=="object"&&Object.keys(v).forEach(function(e){y.setAttribute(e,v[e])}),y.setAttribute("role",d("parentSemantics","role")),y.id=s,y.classList.add("dn-node"),y.classList.add(d("cssClass")),y.style.width=p+"px",y.style.height=f+"px",y.style.left=m+"px",y.style.top=b+"px",y.setAttribute("tabindex","0"),y.addEventListener("focus",t),y.addEventListener("blur",r);var x=document.createElement(d("semantics","elementType")),E=d("semantics","attributes");typeof E=="object"&&Object.keys(E).forEach(function(e){y.setAttribute(e,E[e])}),x.setAttribute("role",d("semantics","role")),x.classList.add("dn-node-text"),l.showText&&(x.innerText=l.semantics.label);var h=d("semantics","label");h||console.error("Accessibility error: a label must be supplied to every rendered element using semantics.label."),x.setAttribute("aria-label",h),y.appendChild(x);var w=d("spatialProperties","path");if(w){var g=p+m+10,A=f+b+10,P=document.createElementNS("http://www.w3.org/2000/svg","svg");P.setAttribute("width",g+""),P.setAttribute("height",A+""),P.setAttribute("viewBox","0 0 ".concat(g," ").concat(A)),P.style.left=-m+"px",P.style.top=-b+"px",P.classList.add("dn-node-svg"),P.setAttribute("role","presentation"),P.setAttribute("focusable","false");var S=document.createElementNS("http://www.w3.org/2000/svg","path");S.setAttribute("d",w),S.classList.add("dn-node-path"),P.appendChild(S),y.appendChild(P)}return n.wrapper.appendChild(y),y},n.remove=function(e){var i=document.getElementById(e);n.wrapper.getAttribute("aria-activedescendant")===e&&n.wrapper.setAttribute("aria-activedescendant",""),i&&(i.removeEventListener("focus",t),i.removeEventListener("blur",r),i.remove())},n.clearStructure=function(){s(n.wrapper.children).forEach(function(e){n.entryButton&&n.entryButton===e||n.remove(e.id)})},n};
1
+ import{j as m}from"./chunk-MPFBSVCV.js";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};
@@ -0,0 +1 @@
1
+ function e(e,i){if(i==null||i>e.length)i=e.length;for(var n=0,t=new Array(i);n<i;n++)t[n]=e[n];return t}function i(i){if(Array.isArray(i))return e(i)}function n(e,i,n){if(i in e){Object.defineProperty(e,i,{value:n,enumerable:true,configurable:true,writable:true})}else{e[i]=n}return e}function t(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function o(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function r(e){for(var i=1;i<arguments.length;i++){var t=arguments[i]!=null?arguments[i]:{};var o=Object.keys(t);if(typeof Object.getOwnPropertySymbols==="function"){o=o.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))}o.forEach(function(i){n(e,i,t[i])})}return e}function s(e,i){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);if(i){t=t.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})}n.push.apply(n,t)}return n}function a(e,i){i=i!=null?i:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(e,Object.getOwnPropertyDescriptors(i))}else{s(Object(i)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(i,n))})}return e}function d(e){return i(e)||t(e)||c(e)||o()}function u(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function c(i,n){if(!i)return;if(typeof i==="string")return e(i,n);var t=Object.prototype.toString.call(i).slice(8,-1);if(t==="Object"&&i.constructor)t=i.constructor.name;if(t==="Map"||t==="Set")return Array.from(t);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return e(i,n)}var l=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var y=function e(e,i){for(var n in i)l(e,n,{get:i[n],enumerable:!0})},p=function e(e,i,n,t){var o=true,r=false,s=undefined;if(i&&(typeof i==="undefined"?"undefined":u(i))=="object"||typeof i=="function")try{var a=function(){var o=c.value;!g.call(e,o)&&o!==n&&l(e,o,{get:function e(){return i[o]},enumerable:!(t=v(i,o))||t.enumerable})};for(var d=f(i)[Symbol.iterator](),c;!(o=(c=d.next()).done);o=true)a()}catch(e){r=true;s=e}finally{try{if(!o&&d.return!=null){d.return()}}finally{if(r){throw s}}}return e};var m=function e(e){return p(l({},"__esModule",{value:!0}),e)};var h={};y(h,{addSimpleDataIDs:function e(){return S},buildEdges:function e(){return P},buildNodeStructureFromVegaLite:function e(){return _},buildNodes:function e(){return x},buildRules:function e(){return L},buildStructure:function e(){return F},default:function e(){return w},scaffoldDimensions:function e(){return D}});module.exports=m(h);var b={Escape:!0,Enter:!0,Backspace:!0,ArrowLeft:!0,ArrowRight:!0,ArrowUp:!0,ArrowDown:!0};var O=["KeyW","KeyJ","LeftBracket","RightBracket","Slash","Backslash"];var k=[["LeftBracket","RightBracket"],["Slash","Backslash"]],E={left:{key:"ArrowLeft",direction:"source"},right:{key:"ArrowRight",direction:"target"},up:{key:"ArrowUp",direction:"source"},down:{key:"ArrowDown",direction:"target"},child:{key:"Enter",direction:"target"},parent:{key:"Backspace",direction:"source"},backward:{key:"Comma",direction:"source"},forward:{key:"Period",direction:"target"},previous:{key:"Semicolon",direction:"source"},next:{key:"Quote",direction:"target"},exit:{key:"Escape",direction:"target"},help:{key:"KeyY",direction:"target"},undo:{key:"KeyZ",direction:"target"}},K=[["left","right"],["up","down"],["backward","forward"],["previous","next"]];var I={right:{key:"ArrowRight",direction:"target"},left:{key:"ArrowLeft",direction:"source"},down:{key:"ArrowDown",direction:"target"},up:{key:"ArrowUp",direction:"source"},child:{key:"Enter",direction:"target"},parent:{key:"Backspace",direction:"source"},exit:{key:"Escape",direction:"target"},undo:{key:"Period",direction:"target"},legend:{key:"KeyL",direction:"target"}};var R=function e(e,i){var n=Object.keys(e),t="";return n.forEach(function(n){t+="".concat(i&&i.omitKeyNames?"":n+": ").concat(e[n],". ")}),t+=i&&i.semanticLabel||"Data point.",t},j=function e(e){return"_"+e.replace(/[^a-zA-Z0-9_-]+/g,"_")};var w=function e(e){return e.dataType==="vega-lite"||e.dataType==="vl"||e.dataType==="Vega-Lite"?_(e):F(e)},_=function e(e){var i=I,n={},t={},o={},r=0,s=e.groupInclusionCriteria?e.groupInclusionCriteria:function(){return!0},a=e.itemInclusionCriteria?e.itemInclusionCriteria:function(){return!0},d=e.datumInclusionCriteria?e.datumInclusionCriteria:function(){return!0},u=e.vegaLiteView._renderer._origin,c=e.vegaLiteView._scenegraph.root.items[0].mark.items[0],l=function e(e,i){if(e["data-navigator-id"])return e["data-navigator-id"];var n="dn-node-".concat(i,"-").concat(r);return r++,e["data-navigator-id"]=n,n},v=function i(i){var o=n[i],r=o.index,s=o.level,a=o.parent,d=[],u=a.items[r-1];if(u){var c=l(u,s);if(n[c]){var v="".concat(c,"-").concat(o.id);d.push(v),t[v]||(t[v]={source:c,target:o.id,navigationRules:["left","right"]})}}var f=a.items[r+1];if(f){var g=l(f,s);if(n[g]){var y="".concat(o.id,"-").concat(g);d.push(y),t[y]||(t[y]={source:o.id,target:g,navigationRules:["left","right"]})}}if(s==="group"&&a.items[r].items){var p=(a.items[r].items[0].mark.items[0].items||a.items[r].items)[0],m=l(p,"item");if(n[m]){var h="".concat(o.id,"-").concat(m);d.push(h),t[h]||(t[h]={source:o.id,target:m,navigationRules:["parent","child"]})}}else if(s==="item"){var b=l(a,"group");if(n[b]){var O="".concat(b,"-").concat(o.id);d.push(O),t[O]||(t[O]={source:b,target:o.id,navigationRules:["parent","child"]})}}return e.exitFunction&&(d.push("any-exit"),t["any-exit"]||(t["any-exit"]={source:e.getCurrent,target:e.exitFunction,navigationRules:["exit"]})),d.push("any-undo"),t["any-undo"]||(t["any-undo"]={source:e.getCurrent,target:e.getPrevious,navigationRules:["undo"]}),d},f=function i(i,t,r,s,a){var u=l(i,t),c="render-"+u,v=r||[0,0];n[u]={},n[u].d={},n[u].id=u,n[u].renderId=c,n[u].index=s,n[u].level=t,n[u].parent=a,o[c]={},o[c].renderId=c,o[c].spatialProperties={},o[c].spatialProperties.x=i.bounds.x1+v[0],o[c].spatialProperties.y=i.bounds.y1+v[1],o[c].spatialProperties.width=i.bounds.x2-i.bounds.x1,o[c].spatialProperties.height=i.bounds.y2-i.bounds.y1,o[c].cssClass="dn-vega-lite-node",i.datum&&Object.keys(i.datum).forEach(function(o){var r=i.datum[o];d(o,r,i.datum,t,e.vegaLiteSpec)&&(n[u].d[e.keyRenamingHash&&e.keyRenamingHash[o]?e.keyRenamingHash[o]:o]=r)}),o[c].semantics={},o[c].semantics.label=e.nodeDescriber?e.nodeDescriber(n[u].d,i,t):R(n[u].d)},g=0;return c.items.forEach(function(i){if(s(i,g,e.vegaLiteSpec)){f(i,"group",u,g,c);var n=0,t=i.items[0].mark.items[0].items?i.items[0].mark.items[0]:i;t.items.forEach(function(o){a(o,n,i,e.vegaLiteSpec)&&f(o,"item",u,n,t),n++})}g++}),Object.keys(n).forEach(function(e){n[e].edges=v(e)}),{nodes:n,edges:t,elementData:o,navigationRules:i}},S=function e(e){var i=0,n={};e.data.forEach(function(t){var o=typeof e.idKey=="function"?e.idKey(t):e.idKey;t[o]="_"+i,e.keysForIdGeneration&&e.keysForIdGeneration.forEach(function(e){e in t&&(typeof t[e]=="string"?(n[e]||(n[e]=0),n[t[e]]||(n[t[e]]=0),t[o]+="_"+e+n[e]+"_"+t[e]+n[t[e]],n[e]++,n[t[e]]++):(n[e]||(n[e]=0),t[o]+="_"+e+n[e],n[e]++))}),i++})},x=function e(e){var i={};return e.data.forEach(function(n){e.idKey||console.error("Building nodes. A key string must be supplied in options.idKey to specify the id keys of every node.");var t=typeof e.idKey=="function"?e.idKey(n):e.idKey,o=n[t];if(!o){console.error("Building nodes. Each datum in options.data must contain an id. When matching the id key string ".concat(t,", this datum has no id: ").concat(JSON.stringify(n),"."));return}if(i[o]){console.error("Building nodes. Each id for data in options.data must be unique. This id is not unique: ".concat(o,"."));return}else{var r=typeof e.renderIdKey=="function"?e.renderIdKey(n):e.renderIdKey;i[o]={id:o,edges:[],renderId:r?n[r]||"":n.renderIdKey||"",data:n}}}),i},D=function e(e,i){var n,t;var o={};if((t=e.dimensions)===null||t===void 0?void 0:(n=t.parentOptions)===null||n===void 0?void 0:n.addLevel0){var s=e.dimensions.parentOptions.addLevel0;i[s.id]=a(r({},s),{dimensionLevel:0})}var c=d(K),l=function e(e,i){var n=i.numericalExtents[0],t=i.numericalExtents[1];i.numericalExtents[0]=n<e?n:e,i.numericalExtents[1]=t>e?t:e};return e.data.forEach(function(n){var t=e.dimensions.values||[],s=0;t.forEach(function(t){if(!t.dimensionKey){console.error("Building nodes, parsing dimensions. Each dimension in options.dimensions must contain a dimensionKey. This dimension has no key: ".concat(JSON.stringify(t),"."));return}if(t.dimensionKey in n){var a;var v=n[t.dimensionKey],f=typeof((a=t.operations)===null||a===void 0?void 0:a.filterFunction)=="function"?t.operations.filterFunction(n,t):!0;if(v!==void 0&&f){if(t.type||(t.type=(typeof v==="undefined"?"undefined":u(v))=="bigint"||typeof v=="number"?"numerical":"categorical"),!o[t.dimensionKey]){var g,y;var p=typeof t.nodeId=="function"?t.nodeId(t,e.data):t.nodeId||j(t.dimensionKey),m=typeof t.renderId=="function"?t.renderId(t,e.data):t.renderId||p;o[t.dimensionKey]={dimensionKey:t.dimensionKey,nodeId:p,divisions:{},numericalExtents:[1/0,-1/0],type:t.type,operations:{compressSparseDivisions:((g=t.operations)===null||g===void 0?void 0:g.compressSparseDivisions)||!1,sortFunction:((y=t.operations)===null||y===void 0?void 0:y.sortFunction)||void 0},behavior:t.behavior||{extents:"circular"},navigationRules:t.navigationRules||{sibling_sibling:c.length?d(c.shift()):["previous_"+t.dimensionKey,"next_"+t.dimensionKey],parent_child:["parent_"+t.dimensionKey,"child"]}},i[p]={id:p,renderId:m,derivedNode:t.dimensionKey,edges:[],dimensionLevel:1,data:o[t.dimensionKey],renderingStrategy:t.renderingStrategy||"singleSquare"}}var h=o[t.dimensionKey],b=null;if(t.type==="categorical"){var O;var k=typeof((O=t.divisionOptions)===null||O===void 0?void 0:O.divisionNodeIds)=="function"?t.divisionOptions.divisionNodeIds(t.dimensionKey,v,s):j(h.nodeId+"_"+v);if(b=h.divisions[k],!b){var E,K,I;b=h.divisions[k]={id:k,sortFunction:((E=t.divisionOptions)===null||E===void 0?void 0:E.sortFunction)||void 0,values:{}};var R=typeof((K=t.divisionOptions)===null||K===void 0?void 0:K.divisionRenderIds)=="function"?t.divisionOptions.divisionRenderIds(t.dimensionKey,v,s):k;i[k]={id:k,renderId:R,derivedNode:t.dimensionKey,edges:[],dimensionLevel:2,data:r({},b),renderingStrategy:((I=t.divisionOptions)===null||I===void 0?void 0:I.renderingStrategy)||"singleSquare"},i[k].data[t.dimensionKey]=v}}else{var w;b=h.divisions[h.nodeId],b||(b=h.divisions[h.nodeId]={id:h.nodeId,sortFunction:((w=t.divisionOptions)===null||w===void 0?void 0:w.sortFunction)||void 0,values:{}}),t.operations||(t.operations={});var _=t.operations.createNumericalSubdivisions;h.subdivisions=typeof _=="number"&&_<1?1:_||1,_!==1&&(h.divisionOptions||(h.divisionOptions=t.divisionOptions),l(v,h))}var S=typeof e.idKey=="function"?e.idKey(n):e.idKey;b.values[n[S]]=n}}s++})}),Object.keys(o).forEach(function(e){var n;var t=o[e],r=t.divisions;if(t.type==="numerical"){r[t.nodeId].values=Object.fromEntries(Object.entries(r[t.nodeId].values).sort(function(i,n){var o;return typeof((o=t.operations)===null||o===void 0?void 0:o.sortFunction)=="function"?t.operations.sortFunction(i[1],n[1],t):i[1][e]-n[1][e]}));var s=r[t.nodeId].values;if(t.numericalExtents[0]!==1/0&&t.subdivisions!==1){var a=Object.keys(s),d=typeof t.subdivisions=="function"?t.subdivisions(e,s):t.subdivisions,u=(t.numericalExtents[1]-t.numericalExtents[0])/d,c=t.numericalExtents[0]+u,l=0,v=0;for(c=t.numericalExtents[0]+u;c<=t.numericalExtents[1];c+=u){var f,g,y,p;var m=typeof((f=t.divisionOptions)===null||f===void 0?void 0:f.divisionNodeIds)=="function"?t.divisionOptions.divisionNodeIds(e,c,c):t.nodeId+"_"+c;t.divisions[m]={id:m,sortFunction:((g=t.divisionOptions)===null||g===void 0?void 0:g.sortFunction)||void 0,values:{}};var h=typeof((y=t.divisionOptions)===null||y===void 0?void 0:y.divisionRenderIds)=="function"?t.divisionOptions.divisionRenderIds(e,c,c):m;i[m]={id:m,renderId:h,derivedNode:e,edges:[],data:t.divisions[m],dimensionLevel:2,renderingStrategy:((p=t.divisionOptions)===null||p===void 0?void 0:p.renderingStrategy)||"singleSquare"};var b=!1;for(;!b&&v<a.length;){var O=s[a[v]];O[e]<=c?t.divisions[m].values[O.id]=O:(c+=u,b=!0),v++}l++}delete r[e]}}else typeof((n=t.operations)===null||n===void 0?void 0:n.sortFunction)=="function"&&(t.divisions=Object.fromEntries(Object.entries(r).sort(function(e,i){return t.operations.sortFunction(e[1],i[1],t)})));Object.keys(t.divisions).forEach(function(e){var i=t.divisions[e];typeof i.sortFunction=="function"&&(i.values=Object.fromEntries(Object.entries(i.values).sort(function(e,n){return i.sortFunction(e[1],n[1],i)})))})}),Object.keys(o).forEach(function(e){var n=o[e];if(n.operations.compressSparseDivisions){var t=Object.keys(n.divisions),s={},a=!0;if(t.forEach(function(e){var i=n.divisions[e],t=Object.keys(i.values);t.length<=1?t.forEach(function(e){s[e]=r({},i.values[e])}):a=!1}),a){var d={id:n.nodeId,values:s};t.forEach(function(e){delete i[e]}),n.divisions={},n.divisions[n.nodeId]=d}}}),e.dimensions.adjustDimensions&&(o=e.dimensions.adjustDimensions(o)),o},P=function e(e,i,n){var t={},o=function e(e,n){i[e].edges.indexOf(n)===-1&&i[e].edges.push(n)},r=function i(i,n,r,s){var a="".concat(i,"-").concat(n),u=e.useDirectedEdges?"".concat(n,"-").concat(a):a,c=!s||s==="source",l=!s||s==="target",v=function e(e){var o;t[e]?(o=t[e].navigationRules).push.apply(o,d(r||[])):t[e]={source:i,target:n,navigationRules:r?d(r):[]}};v(a),e.useDirectedEdges&&l&&v(u),c&&o(i,a),l&&o(n,u)};if(n&&Object.keys(n).length){var s,a,u,c,l,v,f,g,y,p;var m=Object.keys(n),h=(u=e.dimensions)===null||u===void 0?void 0:(a=u.parentOptions)===null||a===void 0?void 0:(s=a.level1Options)===null||s===void 0?void 0:s.order,b=h||m,O=0,k=((c=e.dimensions)===null||c===void 0?void 0:c.parentOptions)||{},E=((v=k.level1Options)===null||v===void 0?void 0:(l=v.behavior)===null||l===void 0?void 0:l.extents)||"terminal",K=k.addLevel0,I=K?((g=k.level1Options)===null||g===void 0?void 0:(f=g.navigationRules)===null||f===void 0?void 0:f.parent_child)||["parent","child"]:[],R=((p=k.level1Options)===null||p===void 0?void 0:(y=p.navigationRules)===null||y===void 0?void 0:y.sibling_sibling)||["left","right"],j=typeof b[0]=="string"?h?i[b[0]]:i[n[b[0]].nodeId]:b[0];K&&r(K.id,j.id,I,"source"),b.forEach(function(t){var o=typeof t=="string"?h?i[t]:i[n[t].nodeId]:t;if(o===t&&!i[o.id]&&(i[o.id]=o),K&&(e.useDirectedEdges?r(o.id,K.id,I,"source"):r(K.id,o.id,I,"target")),O===b.length-1&&E==="circular")r(o.id,j.id,R);else if(O===b.length-1&&E==="bridgedCustom")r(o.id,k.level1Options.behavior.customBridgePost,R);else if(O<b.length-1){var s=typeof b[O+1]=="string"?h?i[b[O+1]]:i[n[b[O+1]].nodeId]:b[O+1];r(o.id,s.id,R)}!O&&E==="bridgedCustom"&&r(k.level1Options.behavior.customBridgePost,o.id,R),O++}),m.forEach(function(i){var t,o,s,a;var d=n[i],u=((t=d.behavior)===null||t===void 0?void 0:t.childmostNavigation)||"within",c=function e(e,i,n,t){return t.values[Object.keys(t.values)[e]]||void 0},l=u==="across"&&((o=d.behavior)===null||o===void 0?void 0:o.childmostMatching)?(s=d.behavior)===null||s===void 0?void 0:s.childmostMatching:c,v=((a=d.behavior)===null||a===void 0?void 0:a.extents)||"circular";d.divisions||console.error("Parsing dimensions. The dimension using the key ".concat(i," is missing the divisions property. dimension.divisions should be supplied. ").concat(JSON.stringify(d),"."));var f=Object.keys(d.divisions),g=d.divisions[f[0]];if(f.length!==1)r(d.nodeId,g.id,d.navigationRules.parent_child,"source");else{var y=Object.keys(g.values),p=typeof e.idKey=="function"?e.idKey(g.values[y[0]]):e.idKey;r(d.nodeId,g.values[y[0]][p],d.navigationRules.parent_child,"source")}var m=0;f.forEach(function(i){var n=d.divisions[i];m===f.length-1&&(v==="circular"||v==="bridgedCousins"||v==="bridgedCustom")?r(n.id,d.divisions[f[0]].id,d.navigationRules.sibling_sibling):m<f.length-1&&r(n.id,d.divisions[f[m+1]].id,d.navigationRules.sibling_sibling);var t=Object.keys(n.values);e.useDirectedEdges?r(n.id,d.nodeId,d.navigationRules.parent_child,"source"):r(d.nodeId,n.id,d.navigationRules.parent_child,"target");var o=typeof e.idKey=="function"?e.idKey(n.values[t[0]]):e.idKey;r(n.id,n.values[t[0]][o],d.navigationRules.parent_child,"source");var s=0;t.length>1&&t.forEach(function(i){var o=n.values[i],a=typeof e.idKey=="function"?e.idKey(o):e.idKey,c=f.length!==1?n.id:d.nodeId;if(e.useDirectedEdges?r(o[a],c,d.navigationRules.parent_child,"source"):r(c,o[a],d.navigationRules.parent_child,"target"),u==="within"){if(s===t.length-1&&v==="circular"){var g=typeof e.idKey=="function"?e.idKey(n.values[t[0]]):e.idKey;r(o[a],n.values[t[0]][g],d.navigationRules.sibling_sibling)}else if(s===t.length-1&&v==="bridgedCousins")if(m!==f.length-1){var y=typeof e.idKey=="function"?e.idKey(d.divisions[f[m+1]].values[t[0]]):e.idKey;r(o[a],d.divisions[f[m+1]].values[t[0]][y],d.navigationRules.sibling_sibling)}else{var p=typeof e.idKey=="function"?e.idKey(d.divisions[f[0]].values[t[0]]):e.idKey;r(o[a],d.divisions[f[0]].values[t[0]][p],d.navigationRules.sibling_sibling)}else if(s===t.length-1&&v==="bridgedCustom")r(o[a],d.behavior.customBridgePost,d.navigationRules.sibling_sibling);else if(s<t.length-1){var h=typeof e.idKey=="function"?e.idKey(n.values[t[s+1]]):e.idKey;r(o[a],n.values[t[s+1]][h],d.navigationRules.sibling_sibling)}if(!s&&v==="bridgedCousins")if(m!==0){var b=typeof e.idKey=="function"?e.idKey(d.divisions[f[m-1]].values[t[t.length-1]]):e.idKey;r(d.divisions[f[m-1]].values[t[t.length-1]][b],o[a],d.navigationRules.sibling_sibling)}else{var O=typeof e.idKey=="function"?e.idKey(d.divisions[f[f.length-1]].values[t[t.length-1]]):e.idKey;r(d.divisions[f[f.length-1]].values[t[t.length-1]][O],o[a],d.navigationRules.sibling_sibling)}else!s&&v==="bridgedCustom"&&r(d.behavior.customBridgePrevious,o[a],d.navigationRules.sibling_sibling)}else if(m===f.length-1&&v==="bridgedCustom")r(o[a],d.behavior.customBridgePost,d.navigationRules.sibling_sibling);else if(!m&&v==="bridgedCustom")r(d.behavior.customBridgePrevious,o[a],d.navigationRules.sibling_sibling);else{var k=m===f.length-1&&v==="circular"?d.divisions[f[0]]:d.divisions[f[m+1]];if(k){var E=l(s,o[a],n,k);if(E){var K=typeof e.idKey=="function"?e.idKey(E):e.idKey;r(o[a],E[K],d.navigationRules.sibling_sibling)}}}s++}),m++})})}return Object.keys(i).forEach(function(n){var o;var r=i[n];((o=e.genericEdges)===null||o===void 0?void 0:o.length)&&e.genericEdges.forEach(function(e){t[e.edgeId]||(t[e.edgeId]=e.edge),(!e.conditional||e.conditional&&e.conditional(r,e))&&r.edges.push(e.edgeId)})}),t},L=function e(e,i,n){var t=e.navigationRules;if(!t){var o=Object.keys(n||{});o.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 ".concat(o.length,". Dimensions counted: ").concat(o.join(", "),"."));var s={},a={},u={},c=d(k),l=d(O),v=function i(i,n){var t=i&&n,o=!1,v=!1;if((s[i]||a[i])&&(a[i]=r({},s[i]),o=!0),n&&(s[n]||a[n])&&(a[n]=r({},s[n]),v=!0),t&&!o&&!v){c.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.");var f=d(c.shift());l.splice(l.indexOf(f[0]),1),l.splice(l.indexOf(f[1]),1),a[i]={direction:e.useDirectedEdges?"target":"source",key:f[0]},a[n]={direction:"target",key:f[1]}}else{if(!a[i]&&l.length){var g=l.shift(),y=[];c.forEach(function(e){g!==e[0]&&g!==e[1]&&y.push(e)}),c=y,a[i]={direction:e.useDirectedEdges?"target":"source",key:g}}if(n&&!a[n]&&l.length){var p=l.shift(),m=[];c.forEach(function(e){p!==e[0]&&p!==e[1]&&m.push(e)}),c=m,a[n]={direction:"target",key:p}}l.length||(a[i]||(u[i]=i),n&&!a[n]&&(u[n]=n))}};if(Object.keys(E).forEach(function(i){var n=r({},E[i]);e.useDirectedEdges&&(n.direction="target"),s[i]=n}),o.length){var f,g;if((g=e.dimensions)===null||g===void 0?void 0:(f=g.parentOptions)===null||f===void 0?void 0:f.addLevel0){var y,p;var m=((p=e.dimensions.parentOptions.level1Options)===null||p===void 0?void 0:(y=p.navigationRules)===null||y===void 0?void 0:y.parent_child)||["parent","child"];v(m[0],m[1])}o.forEach(function(e){var i=n[e].navigationRules.parent_child,t=n[e].navigationRules.sibling_sibling;v(i[0],i[1]),v(t[0],t[1])})}if(Object.keys(i).forEach(function(e){i[e].navigationRules.forEach(function(e){a[e]||v(e)})}),Object.keys(u).length){var h={};Object.keys(a).forEach(function(e){h[a[e].key]=a[e].key}),Object.keys(s).forEach(function(e){!h[s[e].key]&&!b[s[e].key]&&l.push(s[e].key)});var K=r({},u);u={},Object.keys(K).forEach(function(e){v(e)}),Object.keys(u).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: ".concat(Object.keys(u).join(", "),"."))}t=a}return t},F=function e(e){e.addIds&&S(e);var i=x(e),n=D(e,i),t=P(e,i,n),o=L(e,t,n);return{nodes:i,edges:t,dimensions:n,navigationRules:o}};0&&(module.exports={addSimpleDataIDs:addSimpleDataIDs,buildEdges:buildEdges,buildNodeStructureFromVegaLite:buildNodeStructureFromVegaLite,buildNodes:buildNodes,buildRules:buildRules,buildStructure:buildStructure,scaffoldDimensions:scaffoldDimensions});
package/dist/structure.js CHANGED
@@ -1 +1 @@
1
- function e(e,i){if(i==null||i>e.length)i=e.length;for(var n=0,t=new Array(i);n<i;n++)t[n]=e[n];return t}function i(i){if(Array.isArray(i))return e(i)}function n(e,i,n){if(i in e){Object.defineProperty(e,i,{value:n,enumerable:true,configurable:true,writable:true})}else{e[i]=n}return e}function t(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function o(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function r(e){for(var i=1;i<arguments.length;i++){var t=arguments[i]!=null?arguments[i]:{};var o=Object.keys(t);if(typeof Object.getOwnPropertySymbols==="function"){o=o.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))}o.forEach(function(i){n(e,i,t[i])})}return e}function s(e,i){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);if(i){t=t.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})}n.push.apply(n,t)}return n}function a(e,i){i=i!=null?i:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(e,Object.getOwnPropertyDescriptors(i))}else{s(Object(i)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(i,n))})}return e}function d(e){return i(e)||t(e)||c(e)||o()}function u(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function c(i,n){if(!i)return;if(typeof i==="string")return e(i,n);var t=Object.prototype.toString.call(i).slice(8,-1);if(t==="Object"&&i.constructor)t=i.constructor.name;if(t==="Map"||t==="Set")return Array.from(t);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return e(i,n)}var l=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var y=function(e,i){for(var n in i)l(e,n,{get:i[n],enumerable:!0})},p=function(e,i,n,t){var o=true,r=false,s=undefined;if(i&&typeof i=="object"||typeof i=="function")try{var a=function(){var o=u.value;!g.call(e,o)&&o!==n&&l(e,o,{get:function(){return i[o]},enumerable:!(t=v(i,o))||t.enumerable})};for(var d=f(i)[Symbol.iterator](),u;!(o=(u=d.next()).done);o=true)a()}catch(e){r=true;s=e}finally{try{if(!o&&d.return!=null){d.return()}}finally{if(r){throw s}}}return e};var m=function(e){return p(l({},"__esModule",{value:!0}),e)};var h={};y(h,{addSimpleDataIDs:function(){return S},buildEdges:function(){return P},buildNodeStructureFromVegaLite:function(){return _},buildNodes:function(){return x},buildRules:function(){return L},buildStructure:function(){return F},default:function(){return w},scaffoldDimensions:function(){return D}});module.exports=m(h);var b={Escape:!0,Enter:!0,Backspace:!0,ArrowLeft:!0,ArrowRight:!0,ArrowUp:!0,ArrowDown:!0};var O=["KeyW","KeyJ","LeftBracket","RightBracket","Slash","Backslash"];var k=[["LeftBracket","RightBracket"],["Slash","Backslash"]],E={left:{key:"ArrowLeft",direction:"source"},right:{key:"ArrowRight",direction:"target"},up:{key:"ArrowUp",direction:"source"},down:{key:"ArrowDown",direction:"target"},child:{key:"Enter",direction:"target"},parent:{key:"Backspace",direction:"source"},backward:{key:"Comma",direction:"source"},forward:{key:"Period",direction:"target"},previous:{key:"Semicolon",direction:"source"},next:{key:"Quote",direction:"target"},exit:{key:"Escape",direction:"target"},help:{key:"KeyY",direction:"target"},undo:{key:"KeyZ",direction:"target"}},K=[["left","right"],["up","down"],["backward","forward"],["previous","next"]];var I={right:{key:"ArrowRight",direction:"target"},left:{key:"ArrowLeft",direction:"source"},down:{key:"ArrowDown",direction:"target"},up:{key:"ArrowUp",direction:"source"},child:{key:"Enter",direction:"target"},parent:{key:"Backspace",direction:"source"},exit:{key:"Escape",direction:"target"},undo:{key:"Period",direction:"target"},legend:{key:"KeyL",direction:"target"}};var R=function(e,i){var n=Object.keys(e),t="";return n.forEach(function(n){t+="".concat(i&&i.omitKeyNames?"":n+": ").concat(e[n],". ")}),t+=i&&i.semanticLabel||"Data point.",t},j=function(e){return"_"+e.replace(/[^a-zA-Z0-9_-]+/g,"_")};var w=function(e){return e.dataType==="vega-lite"||e.dataType==="vl"||e.dataType==="Vega-Lite"?_(e):F(e)},_=function(e){var i=I,n={},t={},o={},r=0,s=e.groupInclusionCriteria?e.groupInclusionCriteria:function(){return!0},a=e.itemInclusionCriteria?e.itemInclusionCriteria:function(){return!0},d=e.datumInclusionCriteria?e.datumInclusionCriteria:function(){return!0},u=e.vegaLiteView._renderer._origin,c=e.vegaLiteView._scenegraph.root.items[0].mark.items[0],l=function(e,i){if(e["data-navigator-id"])return e["data-navigator-id"];var n="dn-node-".concat(i,"-").concat(r);return r++,e["data-navigator-id"]=n,n},v=function(i){var o=n[i],r=o.index,s=o.level,a=o.parent,d=[],u=a.items[r-1];if(u){var c=l(u,s);if(n[c]){var v="".concat(c,"-").concat(o.id);d.push(v),t[v]||(t[v]={source:c,target:o.id,navigationRules:["left","right"]})}}var f=a.items[r+1];if(f){var g=l(f,s);if(n[g]){var y="".concat(o.id,"-").concat(g);d.push(y),t[y]||(t[y]={source:o.id,target:g,navigationRules:["left","right"]})}}if(s==="group"&&a.items[r].items){var p=(a.items[r].items[0].mark.items[0].items||a.items[r].items)[0],m=l(p,"item");if(n[m]){var h="".concat(o.id,"-").concat(m);d.push(h),t[h]||(t[h]={source:o.id,target:m,navigationRules:["parent","child"]})}}else if(s==="item"){var b=l(a,"group");if(n[b]){var O="".concat(b,"-").concat(o.id);d.push(O),t[O]||(t[O]={source:b,target:o.id,navigationRules:["parent","child"]})}}return e.exitFunction&&(d.push("any-exit"),t["any-exit"]||(t["any-exit"]={source:e.getCurrent,target:e.exitFunction,navigationRules:["exit"]})),d.push("any-undo"),t["any-undo"]||(t["any-undo"]={source:e.getCurrent,target:e.getPrevious,navigationRules:["undo"]}),d},f=function(i,t,r,s,a){var u=l(i,t),c="render-"+u,v=r||[0,0];n[u]={},n[u].d={},n[u].id=u,n[u].renderId=c,n[u].index=s,n[u].level=t,n[u].parent=a,o[c]={},o[c].renderId=c,o[c].spatialProperties={},o[c].spatialProperties.x=i.bounds.x1+v[0],o[c].spatialProperties.y=i.bounds.y1+v[1],o[c].spatialProperties.width=i.bounds.x2-i.bounds.x1,o[c].spatialProperties.height=i.bounds.y2-i.bounds.y1,o[c].cssClass="dn-vega-lite-node",i.datum&&Object.keys(i.datum).forEach(function(o){var r=i.datum[o];d(o,r,i.datum,t,e.vegaLiteSpec)&&(n[u].d[e.keyRenamingHash&&e.keyRenamingHash[o]?e.keyRenamingHash[o]:o]=r)}),o[c].semantics={},o[c].semantics.label=e.nodeDescriber?e.nodeDescriber(n[u].d,i,t):R(n[u].d)},g=0;return c.items.forEach(function(i){if(s(i,g,e.vegaLiteSpec)){f(i,"group",u,g,c);var n=0,t=i.items[0].mark.items[0].items?i.items[0].mark.items[0]:i;t.items.forEach(function(o){a(o,n,i,e.vegaLiteSpec)&&f(o,"item",u,n,t),n++})}g++}),Object.keys(n).forEach(function(e){n[e].edges=v(e)}),{nodes:n,edges:t,elementData:o,navigationRules:i}},S=function(e){var i=0,n={};e.data.forEach(function(t){var o=typeof e.idKey=="function"?e.idKey(t):e.idKey;t[o]="_"+i,e.keysForIdGeneration&&e.keysForIdGeneration.forEach(function(e){e in t&&(typeof t[e]=="string"?(n[e]||(n[e]=0),n[t[e]]||(n[t[e]]=0),t[o]+="_"+e+n[e]+"_"+t[e]+n[t[e]],n[e]++,n[t[e]]++):(n[e]||(n[e]=0),t[o]+="_"+e+n[e],n[e]++))}),i++})},x=function(e){var i={};return e.data.forEach(function(n){e.idKey||console.error("Building nodes. A key string must be supplied in options.idKey to specify the id keys of every node.");var t=typeof e.idKey=="function"?e.idKey(n):e.idKey,o=n[t];if(!o){console.error("Building nodes. Each datum in options.data must contain an id. When matching the id key string ".concat(t,", this datum has no id: ").concat(JSON.stringify(n),"."));return}if(i[o]){console.error("Building nodes. Each id for data in options.data must be unique. This id is not unique: ".concat(o,"."));return}else{var r=typeof e.renderIdKey=="function"?e.renderIdKey(n):e.renderIdKey;i[o]={id:o,edges:[],renderId:r?n[r]||"":n.renderIdKey||"",data:n}}}),i},D=function(e,i){var n,t;var o={};if((t=e.dimensions)===null||t===void 0?void 0:(n=t.parentOptions)===null||n===void 0?void 0:n.addLevel0){var s=e.dimensions.parentOptions.addLevel0;i[s.id]=a(r({},s),{dimensionLevel:0})}var c=d(K),l=function(e,i){var n=i.numericalExtents[0],t=i.numericalExtents[1];i.numericalExtents[0]=n<e?n:e,i.numericalExtents[1]=t>e?t:e};return e.data.forEach(function(n){var t=e.dimensions.values||[],s=0;t.forEach(function(t){if(!t.dimensionKey){console.error("Building nodes, parsing dimensions. Each dimension in options.dimensions must contain a dimensionKey. This dimension has no key: ".concat(JSON.stringify(t),"."));return}if(t.dimensionKey in n){var a;var v=n[t.dimensionKey],f=typeof((a=t.operations)===null||a===void 0?void 0:a.filterFunction)=="function"?t.operations.filterFunction(n,t):!0;if(v!==void 0&&f){if(t.type||(t.type=(typeof v==="undefined"?"undefined":u(v))=="bigint"||typeof v=="number"?"numerical":"categorical"),!o[t.dimensionKey]){var g,y;var p=typeof t.nodeId=="function"?t.nodeId(t,e.data):t.nodeId||j(t.dimensionKey),m=typeof t.renderId=="function"?t.renderId(t,e.data):t.renderId||p;o[t.dimensionKey]={dimensionKey:t.dimensionKey,nodeId:p,divisions:{},numericalExtents:[1/0,-1/0],type:t.type,operations:{compressSparseDivisions:((g=t.operations)===null||g===void 0?void 0:g.compressSparseDivisions)||!1,sortFunction:((y=t.operations)===null||y===void 0?void 0:y.sortFunction)||void 0},behavior:t.behavior||{extents:"circular"},navigationRules:t.navigationRules||{sibling_sibling:c.length?d(c.shift()):["previous_"+t.dimensionKey,"next_"+t.dimensionKey],parent_child:["parent_"+t.dimensionKey,"child"]}},i[p]={id:p,renderId:m,derivedNode:t.dimensionKey,edges:[],dimensionLevel:1,data:o[t.dimensionKey],renderingStrategy:t.renderingStrategy||"singleSquare"}}var h=o[t.dimensionKey],b=null;if(t.type==="categorical"){var O;var k=typeof((O=t.divisionOptions)===null||O===void 0?void 0:O.divisionNodeIds)=="function"?t.divisionOptions.divisionNodeIds(t.dimensionKey,v,s):j(h.nodeId+"_"+v);if(b=h.divisions[k],!b){var E,K,I;b=h.divisions[k]={id:k,sortFunction:((E=t.divisionOptions)===null||E===void 0?void 0:E.sortFunction)||void 0,values:{}};var R=typeof((K=t.divisionOptions)===null||K===void 0?void 0:K.divisionRenderIds)=="function"?t.divisionOptions.divisionRenderIds(t.dimensionKey,v,s):k;i[k]={id:k,renderId:R,derivedNode:t.dimensionKey,edges:[],dimensionLevel:2,data:r({},b),renderingStrategy:((I=t.divisionOptions)===null||I===void 0?void 0:I.renderingStrategy)||"singleSquare"},i[k].data[t.dimensionKey]=v}}else{var w;b=h.divisions[h.nodeId],b||(b=h.divisions[h.nodeId]={id:h.nodeId,sortFunction:((w=t.divisionOptions)===null||w===void 0?void 0:w.sortFunction)||void 0,values:{}}),t.operations||(t.operations={});var _=t.operations.createNumericalSubdivisions;h.subdivisions=typeof _=="number"&&_<1?1:_||1,_!==1&&(h.divisionOptions||(h.divisionOptions=t.divisionOptions),l(v,h))}var S=typeof e.idKey=="function"?e.idKey(n):e.idKey;b.values[n[S]]=n}}s++})}),Object.keys(o).forEach(function(e){var n;var t=o[e],r=t.divisions;if(t.type==="numerical"){r[t.nodeId].values=Object.fromEntries(Object.entries(r[t.nodeId].values).sort(function(i,n){var o;return typeof((o=t.operations)===null||o===void 0?void 0:o.sortFunction)=="function"?t.operations.sortFunction(i[1],n[1],t):i[1][e]-n[1][e]}));var s=r[t.nodeId].values;if(t.numericalExtents[0]!==1/0&&t.subdivisions!==1){var a=Object.keys(s),d=typeof t.subdivisions=="function"?t.subdivisions(e,s):t.subdivisions,u=(t.numericalExtents[1]-t.numericalExtents[0])/d,c=t.numericalExtents[0]+u,l=0,v=0;for(c=t.numericalExtents[0]+u;c<=t.numericalExtents[1];c+=u){var f,g,y,p;var m=typeof((f=t.divisionOptions)===null||f===void 0?void 0:f.divisionNodeIds)=="function"?t.divisionOptions.divisionNodeIds(e,c,c):t.nodeId+"_"+c;t.divisions[m]={id:m,sortFunction:((g=t.divisionOptions)===null||g===void 0?void 0:g.sortFunction)||void 0,values:{}};var h=typeof((y=t.divisionOptions)===null||y===void 0?void 0:y.divisionRenderIds)=="function"?t.divisionOptions.divisionRenderIds(e,c,c):m;i[m]={id:m,renderId:h,derivedNode:e,edges:[],data:t.divisions[m],dimensionLevel:2,renderingStrategy:((p=t.divisionOptions)===null||p===void 0?void 0:p.renderingStrategy)||"singleSquare"};var b=!1;for(;!b&&v<a.length;){var O=s[a[v]];O[e]<=c?t.divisions[m].values[O.id]=O:(c+=u,b=!0),v++}l++}delete r[e]}}else typeof((n=t.operations)===null||n===void 0?void 0:n.sortFunction)=="function"&&(t.divisions=Object.fromEntries(Object.entries(r).sort(function(e,i){return t.operations.sortFunction(e[1],i[1],t)})));Object.keys(t.divisions).forEach(function(e){var i=t.divisions[e];typeof i.sortFunction=="function"&&(i.values=Object.fromEntries(Object.entries(i.values).sort(function(e,n){return i.sortFunction(e[1],n[1],i)})))})}),Object.keys(o).forEach(function(e){var n=o[e];if(n.operations.compressSparseDivisions){var t=Object.keys(n.divisions),s={},a=!0;if(t.forEach(function(e){var i=n.divisions[e],t=Object.keys(i.values);t.length<=1?t.forEach(function(e){s[e]=r({},i.values[e])}):a=!1}),a){var d={id:n.nodeId,values:s};t.forEach(function(e){delete i[e]}),n.divisions={},n.divisions[n.nodeId]=d}}}),e.dimensions.adjustDimensions&&(o=e.dimensions.adjustDimensions(o)),o},P=function(e,i,n){var t={},o=function(e,n){i[e].edges.indexOf(n)===-1&&i[e].edges.push(n)},r=function(i,n,r,s){var a="".concat(i,"-").concat(n),u=e.useDirectedEdges?"".concat(n,"-").concat(a):a,c=!s||s==="source",l=!s||s==="target",v=function(e){var o;t[e]?(o=t[e].navigationRules).push.apply(o,d(r||[])):t[e]={source:i,target:n,navigationRules:r?d(r):[]}};v(a),e.useDirectedEdges&&l&&v(u),c&&o(i,a),l&&o(n,u)};if(n&&Object.keys(n).length){var s,a,u,c,l,v,f,g,y,p;var m=Object.keys(n),h=(u=e.dimensions)===null||u===void 0?void 0:(a=u.parentOptions)===null||a===void 0?void 0:(s=a.level1Options)===null||s===void 0?void 0:s.order,b=h||m,O=0,k=((c=e.dimensions)===null||c===void 0?void 0:c.parentOptions)||{},E=((v=k.level1Options)===null||v===void 0?void 0:(l=v.behavior)===null||l===void 0?void 0:l.extents)||"terminal",K=k.addLevel0,I=K?((g=k.level1Options)===null||g===void 0?void 0:(f=g.navigationRules)===null||f===void 0?void 0:f.parent_child)||["parent","child"]:[],R=((p=k.level1Options)===null||p===void 0?void 0:(y=p.navigationRules)===null||y===void 0?void 0:y.sibling_sibling)||["left","right"],j=typeof b[0]=="string"?h?i[b[0]]:i[n[b[0]].nodeId]:b[0];K&&r(K.id,j.id,I,"source"),b.forEach(function(t){var o=typeof t=="string"?h?i[t]:i[n[t].nodeId]:t;if(o===t&&!i[o.id]&&(i[o.id]=o),K&&(e.useDirectedEdges?r(o.id,K.id,I,"source"):r(K.id,o.id,I,"target")),O===b.length-1&&E==="circular")r(o.id,j.id,R);else if(O===b.length-1&&E==="bridgedCustom")r(o.id,k.level1Options.behavior.customBridgePost,R);else if(O<b.length-1){var s=typeof b[O+1]=="string"?h?i[b[O+1]]:i[n[b[O+1]].nodeId]:b[O+1];r(o.id,s.id,R)}!O&&E==="bridgedCustom"&&r(k.level1Options.behavior.customBridgePost,o.id,R),O++}),m.forEach(function(i){var t,o,s,a;var d=n[i],u=((t=d.behavior)===null||t===void 0?void 0:t.childmostNavigation)||"within",c=function(e,i,n,t){return t.values[Object.keys(t.values)[e]]||void 0},l=u==="across"&&((o=d.behavior)===null||o===void 0?void 0:o.childmostMatching)?(s=d.behavior)===null||s===void 0?void 0:s.childmostMatching:c,v=((a=d.behavior)===null||a===void 0?void 0:a.extents)||"circular";d.divisions||console.error("Parsing dimensions. The dimension using the key ".concat(i," is missing the divisions property. dimension.divisions should be supplied. ").concat(JSON.stringify(d),"."));var f=Object.keys(d.divisions),g=d.divisions[f[0]];if(f.length!==1)r(d.nodeId,g.id,d.navigationRules.parent_child,"source");else{var y=Object.keys(g.values),p=typeof e.idKey=="function"?e.idKey(g.values[y[0]]):e.idKey;r(d.nodeId,g.values[y[0]][p],d.navigationRules.parent_child,"source")}var m=0;f.forEach(function(i){var n=d.divisions[i];m===f.length-1&&(v==="circular"||v==="bridgedCousins"||v==="bridgedCustom")?r(n.id,d.divisions[f[0]].id,d.navigationRules.sibling_sibling):m<f.length-1&&r(n.id,d.divisions[f[m+1]].id,d.navigationRules.sibling_sibling);var t=Object.keys(n.values);e.useDirectedEdges?r(n.id,d.nodeId,d.navigationRules.parent_child,"source"):r(d.nodeId,n.id,d.navigationRules.parent_child,"target");var o=typeof e.idKey=="function"?e.idKey(n.values[t[0]]):e.idKey;r(n.id,n.values[t[0]][o],d.navigationRules.parent_child,"source");var s=0;t.length>1&&t.forEach(function(i){var o=n.values[i],a=typeof e.idKey=="function"?e.idKey(o):e.idKey,c=f.length!==1?n.id:d.nodeId;if(e.useDirectedEdges?r(o[a],c,d.navigationRules.parent_child,"source"):r(c,o[a],d.navigationRules.parent_child,"target"),u==="within"){if(s===t.length-1&&v==="circular"){var g=typeof e.idKey=="function"?e.idKey(n.values[t[0]]):e.idKey;r(o[a],n.values[t[0]][g],d.navigationRules.sibling_sibling)}else if(s===t.length-1&&v==="bridgedCousins")if(m!==f.length-1){var y=typeof e.idKey=="function"?e.idKey(d.divisions[f[m+1]].values[t[0]]):e.idKey;r(o[a],d.divisions[f[m+1]].values[t[0]][y],d.navigationRules.sibling_sibling)}else{var p=typeof e.idKey=="function"?e.idKey(d.divisions[f[0]].values[t[0]]):e.idKey;r(o[a],d.divisions[f[0]].values[t[0]][p],d.navigationRules.sibling_sibling)}else if(s===t.length-1&&v==="bridgedCustom")r(o[a],d.behavior.customBridgePost,d.navigationRules.sibling_sibling);else if(s<t.length-1){var h=typeof e.idKey=="function"?e.idKey(n.values[t[s+1]]):e.idKey;r(o[a],n.values[t[s+1]][h],d.navigationRules.sibling_sibling)}if(!s&&v==="bridgedCousins")if(m!==0){var b=typeof e.idKey=="function"?e.idKey(d.divisions[f[m-1]].values[t[t.length-1]]):e.idKey;r(d.divisions[f[m-1]].values[t[t.length-1]][b],o[a],d.navigationRules.sibling_sibling)}else{var O=typeof e.idKey=="function"?e.idKey(d.divisions[f[f.length-1]].values[t[t.length-1]]):e.idKey;r(d.divisions[f[f.length-1]].values[t[t.length-1]][O],o[a],d.navigationRules.sibling_sibling)}else!s&&v==="bridgedCustom"&&r(d.behavior.customBridgePrevious,o[a],d.navigationRules.sibling_sibling)}else if(m===f.length-1&&v==="bridgedCustom")r(o[a],d.behavior.customBridgePost,d.navigationRules.sibling_sibling);else if(!m&&v==="bridgedCustom")r(d.behavior.customBridgePrevious,o[a],d.navigationRules.sibling_sibling);else{var k=m===f.length-1&&v==="circular"?d.divisions[f[0]]:d.divisions[f[m+1]];if(k){var E=l(s,o[a],n,k);if(E){var K=typeof e.idKey=="function"?e.idKey(E):e.idKey;r(o[a],E[K],d.navigationRules.sibling_sibling)}}}s++}),m++})})}return Object.keys(i).forEach(function(n){var o;var r=i[n];((o=e.genericEdges)===null||o===void 0?void 0:o.length)&&e.genericEdges.forEach(function(e){t[e.edgeId]||(t[e.edgeId]=e.edge),(!e.conditional||e.conditional&&e.conditional(r,e))&&r.edges.push(e.edgeId)})}),t},L=function(e,i,n){var t=e.navigationRules;if(!t){var o=Object.keys(n||{});o.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 ".concat(o.length,". Dimensions counted: ").concat(o.join(", "),"."));var s={},a={},u={},c=d(k),l=d(O),v=function(i,n){var t=i&&n,o=!1,v=!1;if((s[i]||a[i])&&(a[i]=r({},s[i]),o=!0),n&&(s[n]||a[n])&&(a[n]=r({},s[n]),v=!0),t&&!o&&!v){c.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.");var f=d(c.shift());l.splice(l.indexOf(f[0]),1),l.splice(l.indexOf(f[1]),1),a[i]={direction:e.useDirectedEdges?"target":"source",key:f[0]},a[n]={direction:"target",key:f[1]}}else{if(!a[i]&&l.length){var g=l.shift(),y=[];c.forEach(function(e){g!==e[0]&&g!==e[1]&&y.push(e)}),c=y,a[i]={direction:e.useDirectedEdges?"target":"source",key:g}}if(n&&!a[n]&&l.length){var p=l.shift(),m=[];c.forEach(function(e){p!==e[0]&&p!==e[1]&&m.push(e)}),c=m,a[n]={direction:"target",key:p}}l.length||(a[i]||(u[i]=i),n&&!a[n]&&(u[n]=n))}};if(Object.keys(E).forEach(function(i){var n=r({},E[i]);e.useDirectedEdges&&(n.direction="target"),s[i]=n}),o.length){var f,g;if((g=e.dimensions)===null||g===void 0?void 0:(f=g.parentOptions)===null||f===void 0?void 0:f.addLevel0){var y,p;var m=((p=e.dimensions.parentOptions.level1Options)===null||p===void 0?void 0:(y=p.navigationRules)===null||y===void 0?void 0:y.parent_child)||["parent","child"];v(m[0],m[1])}o.forEach(function(e){var i=n[e].navigationRules.parent_child,t=n[e].navigationRules.sibling_sibling;v(i[0],i[1]),v(t[0],t[1])})}if(Object.keys(i).forEach(function(e){i[e].navigationRules.forEach(function(e){a[e]||v(e)})}),Object.keys(u).length){var h={};Object.keys(a).forEach(function(e){h[a[e].key]=a[e].key}),Object.keys(s).forEach(function(e){!h[s[e].key]&&!b[s[e].key]&&l.push(s[e].key)});var K=r({},u);u={},Object.keys(K).forEach(function(e){v(e)}),Object.keys(u).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: ".concat(Object.keys(u).join(", "),"."))}t=a}return t},F=function(e){e.addIds&&S(e);var i=x(e),n=D(e,i),t=P(e,i,n),o=L(e,t,n);return{nodes:i,edges:t,dimensions:n,navigationRules:o}};0&&(module.exports={addSimpleDataIDs:addSimpleDataIDs,buildEdges:buildEdges,buildNodeStructureFromVegaLite:buildNodeStructureFromVegaLite,buildNodes:buildNodes,buildRules:buildRules,buildStructure:buildStructure,scaffoldDimensions:scaffoldDimensions});
1
+ import{a as q,b as P}from"./chunk-YE5N6UCT.js";import{a as w,c as B,e as T,f as $,g as G,i as V}from"./chunk-MPFBSVCV.js";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};
@@ -0,0 +1 @@
1
+ function e(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}var r=Object.defineProperty;var t=Object.getOwnPropertyDescriptor;var n=Object.getOwnPropertyNames;var o=Object.prototype.hasOwnProperty;var a=function e(e,t){for(var n in t)r(e,n,{get:t[n],enumerable:!0})},u=function a(a,u,c,i){var f=true,l=false,d=undefined;if(u&&(typeof u==="undefined"?"undefined":e(u))=="object"||typeof u=="function")try{var y=function(){var e=p.value;!o.call(a,e)&&e!==c&&r(a,e,{get:function r(){return u[e]},enumerable:!(i=t(u,e))||i.enumerable})};for(var b=n(u)[Symbol.iterator](),p;!(f=(p=b.next()).done);f=true)y()}catch(e){l=true;d=e}finally{try{if(!f&&b.return!=null){b.return()}}finally{if(l){throw d}}}return a};var c=function e(e){return u(r({},"__esModule",{value:!0}),e)};var i={};a(i,{createValidId:function e(){return l},describeNode:function e(){return f}});module.exports=c(i);var f=function e(e,r){var t=Object.keys(e),n="";return t.forEach(function(t){n+="".concat(r&&r.omitKeyNames?"":t+": ").concat(e[t],". ")}),n+=r&&r.semanticLabel||"Data point.",n},l=function e(e){return"_"+e.replace(/[^a-zA-Z0-9_-]+/g,"_")};0&&(module.exports={createValidId:createValidId,describeNode:describeNode});
package/dist/utilities.js CHANGED
@@ -1 +1 @@
1
- var e=Object.defineProperty;var r=Object.getOwnPropertyDescriptor;var t=Object.getOwnPropertyNames;var n=Object.prototype.hasOwnProperty;var a=function(r,t){for(var n in t)e(r,n,{get:t[n],enumerable:!0})},o=function(a,o,c,u){var i=true,f=false,l=undefined;if(o&&typeof o=="object"||typeof o=="function")try{var d=function(){var t=b.value;!n.call(a,t)&&t!==c&&e(a,t,{get:function(){return o[t]},enumerable:!(u=r(o,t))||u.enumerable})};for(var v=t(o)[Symbol.iterator](),b;!(i=(b=v.next()).done);i=true)d()}catch(e){f=true;l=e}finally{try{if(!i&&v.return!=null){v.return()}}finally{if(f){throw l}}}return a};var c=function(r){return o(e({},"__esModule",{value:!0}),r)};var u={};a(u,{createValidId:function(){return f},describeNode:function(){return i}});module.exports=c(u);var i=function(e,r){var t=Object.keys(e),n="";return t.forEach(function(t){n+="".concat(r&&r.omitKeyNames?"":t+": ").concat(e[t],". ")}),n+=r&&r.semanticLabel||"Data point.",n},f=function(e){return"_"+e.replace(/[^a-zA-Z0-9_-]+/g,"_")};0&&(module.exports={createValidId:createValidId,describeNode:describeNode});
1
+ import{a,b}from"./chunk-YE5N6UCT.js";export{b as createValidId,a as describeNode};
package/package.json CHANGED
@@ -1,12 +1,15 @@
1
1
  {
2
2
  "name": "data-navigator",
3
3
  "author": "Frank Elavsky",
4
- "version": "2.2.0",
5
- "main": "./dist/index.jsm",
6
- "module": "./dist/index",
4
+ "version": "2.2.2",
5
+ "type": "module",
6
+ "main": "./dist/index.cjs",
7
+ "module": "./dist/index.js",
7
8
  "types": "./dist/src/index.d.ts",
8
9
  "files": [
9
- "dist/**/*"
10
+ "dist/**/*",
11
+ "README.md",
12
+ "LICENSE"
10
13
  ],
11
14
  "exports": {
12
15
  ".": {
@@ -16,7 +19,7 @@
16
19
  },
17
20
  "require": {
18
21
  "types": "./dist/src/index.d.ts",
19
- "default": "./dist/index.mjs"
22
+ "default": "./dist/index.cjs"
20
23
  }
21
24
  }
22
25
  },
@@ -28,23 +31,15 @@
28
31
  ],
29
32
  "description": "Data-navigator is a JavaScript library that allows for serial navigation of data structures using a variety of input modalities and assistive technologies.",
30
33
  "scripts": {
31
- "clean": "rm -rf ./dist && rm -rf ./app",
32
- "build": "yarn build:app && yarn build:index && yarn build:modules",
33
- "build:app": "webpack",
34
+ "clean": "rm -rf ./dist",
35
+ "build": "yarn build:index && yarn build:modules",
34
36
  "build:index": "tsup src/index.ts --format cjs,esm",
35
- "build:modules": "tsup src/structure.ts src/input.ts src/rendering.ts src/utilities.ts src/consts.ts --format cjs,esm --minify",
36
- "server": "python -m http.server",
37
- "prettier-all-check": "prettier --config ./.prettierrc --ignore ./.prettierignore --debug-check \"**/*.{js,jsx,ts,tsx,html,jsx,json,css,scss,md}\"",
38
- "prettier-all": "prettier --config ./.prettierrc --ignore ./.prettierignore --write \"**/*.{js,jsx,ts,tsx,html,jsx,json,css,scss,md}\""
37
+ "build:modules": "tsup src/structure.ts src/input.ts src/rendering.ts src/utilities.ts src/consts.ts --format cjs,esm --minify",
38
+ "prepublishOnly": "cp ../../README.md ../../LICENSE ."
39
39
  },
40
40
  "devDependencies": {
41
41
  "@swc/core": "^1.3.75",
42
- "prettier": "^2.6.2",
43
- "source-map-loader": "^4.0.1",
44
- "ts-loader": "^9.4.4",
45
42
  "tsup": "^7.2.0",
46
- "typescript": "^5.1.6",
47
- "webpack": "^5.76.0",
48
- "webpack-cli": "^4.9.2"
43
+ "typescript": "^5.1.6"
49
44
  }
50
45
  }
@@ -1 +0,0 @@
1
- var e={ArrowLeft:"left",ArrowRight:"right",ArrowUp:"up",ArrowDown:"down",Period:"forward",Comma:"backward",Escape:"parent",Enter:"child"},t=["KeyW","KeyJ","LeftBracket","RightBracket","Slash","Backslash"],r=["KeyW","KeyJ"],i=[["LeftBracket","RightBracket"],["Slash","Backslash"]],o={left:{key:"ArrowLeft",direction:"source"},right:{key:"ArrowRight",direction:"target"},up:{key:"ArrowUp",direction:"source"},down:{key:"ArrowDown",direction:"target"},child:{key:"Enter",direction:"target"},parent:{key:"Backspace",direction:"source"},backward:{key:"Comma",direction:"source"},forward:{key:"Period",direction:"target"},previous:{key:"Semicolon",direction:"source"},next:{key:"Quote",direction:"target"},exit:{key:"Escape",direction:"target"},help:{key:"KeyY",direction:"target"},undo:{key:"KeyZ",direction:"target"}},a=[["left","right"],["up","down"],["backward","forward"],["previous","next"]],n={left:["left","right"],right:["left","right"],up:["up","down"],down:["up","down"],backward:["backward","forward"],forward:["backward","forward"],previous:["previous","next"],next:["previous","next"],parent:["parent","child"],child:["parent","child"],exit:["exit","undo"],undo:["undo","undo"]},c={right:{key:"ArrowRight",direction:"target"},left:{key:"ArrowLeft",direction:"source"},down:{key:"ArrowDown",direction:"target"},up:{key:"ArrowUp",direction:"source"},child:{key:"Enter",direction:"target"},parent:{key:"Backspace",direction:"source"},exit:{key:"Escape",direction:"target"},undo:{key:"Period",direction:"target"},legend:{key:"KeyL",direction:"target"}},d={cssClass:"",spatialProperties:{x:0,y:0,width:0,height:0,path:""},semantics:{label:"",elementType:"div",role:"image",attributes:void 0},parentSemantics:{label:"",elementType:"figure",role:"figure",attributes:void 0},existingElement:{useForSpatialProperties:!1,spatialProperties:void 0}};export{e as a,t as b,r as c,i as d,o as e,a as f,n as g,c as h,d as i};
@@ -1 +0,0 @@
1
- var e={ArrowLeft:"left",ArrowRight:"right",ArrowUp:"up",ArrowDown:"down",Period:"forward",Comma:"backward",Escape:"parent",Enter:"child"},t={down:{keyCode:"ArrowDown",direction:"target"},left:{keyCode:"ArrowLeft",direction:"source"},right:{keyCode:"ArrowRight",direction:"target"},up:{keyCode:"ArrowUp",direction:"source"},backward:{keyCode:"Comma",direction:"source"},child:{keyCode:"Enter",direction:"target"},parent:{keyCode:"Backspace",direction:"source"},forward:{keyCode:"Period",direction:"target"},exit:{keyCode:"Escape",direction:"target"},undo:{keyCode:"KeyZ",direction:"target"}},r=[["left","right"],["up","down"],["backward","forward"],["parent","child"]],i={left:["left","right"],right:["left","right"],up:["up","down"],down:["up","down"],backward:["backward","forward"],forward:["backward","forward"],parent:["parent","child"],child:["parent","child"],exit:["exit","undo"],undo:["undo","undo"]},o={right:{key:"ArrowRight",direction:"target"},left:{key:"ArrowLeft",direction:"source"},down:{key:"ArrowDown",direction:"target"},up:{key:"ArrowUp",direction:"source"},child:{key:"Enter",direction:"target"},parent:{key:"Backspace",direction:"source"},exit:{key:"Escape",direction:"target"},undo:{key:"Period",direction:"target"},legend:{key:"KeyL",direction:"target"}},a={cssClass:"",spatialProperties:{x:0,y:0,width:0,height:0,path:""},semantics:{label:"",elementType:"div",role:"image",attributes:void 0},parentSemantics:{label:"",elementType:"figure",role:"figure",attributes:void 0},existingElement:{useForSpatialProperties:!1,spatialProperties:void 0}};export{e as a,t as b,r as c,i as d,o as e,a as f};
@@ -1 +0,0 @@
1
- var m=(a,e)=>{let o=Object.keys(a),t="";return o.forEach(c=>{t+=`${e&&e.omitKeyNames?"":c+": "}${a[c]}. `}),t+=e&&e.semanticLabel||"Data point.",t};export{m as a};
@@ -1 +0,0 @@
1
- var e={ArrowLeft:"left",ArrowRight:"right",ArrowUp:"up",ArrowDown:"down",Period:"forward",Comma:"backward",Escape:"parent",Enter:"child"},t={down:{key:"ArrowDown",direction:"target"},left:{key:"ArrowLeft",direction:"source"},right:{key:"ArrowRight",direction:"target"},up:{key:"ArrowUp",direction:"source"},backward:{key:"Comma",direction:"source"},child:{key:"Enter",direction:"target"},parent:{key:"Backspace",direction:"source"},forward:{key:"Period",direction:"target"},exit:{key:"Escape",direction:"target"},undo:{key:"KeyZ",direction:"target"}},r=[["left","right"],["up","down"],["backward","forward"],["previous","next"]],i={left:["left","right"],right:["left","right"],up:["up","down"],down:["up","down"],backward:["backward","forward"],forward:["backward","forward"],previous:["previous","next"],next:["previous","next"],parent:["parent","child"],child:["parent","child"],exit:["exit","undo"],undo:["undo","undo"]},o={right:{key:"ArrowRight",direction:"target"},left:{key:"ArrowLeft",direction:"source"},down:{key:"ArrowDown",direction:"target"},up:{key:"ArrowUp",direction:"source"},child:{key:"Enter",direction:"target"},parent:{key:"Backspace",direction:"source"},exit:{key:"Escape",direction:"target"},undo:{key:"Period",direction:"target"},legend:{key:"KeyL",direction:"target"}},a={cssClass:"",spatialProperties:{x:0,y:0,width:0,height:0,path:""},semantics:{label:"",elementType:"div",role:"image",attributes:void 0},parentSemantics:{label:"",elementType:"figure",role:"figure",attributes:void 0},existingElement:{useForSpatialProperties:!1,spatialProperties:void 0}};export{e as a,t as b,r as c,i as d,o as e,a as f};
@@ -1 +0,0 @@
1
- var e={ArrowLeft:"left",ArrowRight:"right",ArrowUp:"up",ArrowDown:"down",Period:"forward",Comma:"backward",Escape:"parent",Enter:"child"},t=[{key:"KeyW"},{key:"KeyJ"},{key:"LeftBracket"},{key:"RightBracket"},{key:"Slash"},{key:"Backslash"}],r=[[{key:"LeftBracket"},{key:"RightBracket"}],[{key:"Slash"},{key:"Backslash"}]],i={left:{key:"ArrowLeft",direction:"source"},right:{key:"ArrowRight",direction:"target"},up:{key:"ArrowUp",direction:"source"},down:{key:"ArrowDown",direction:"target"},child:{key:"Enter",direction:"target"},parent:{key:"Backspace",direction:"source"},backward:{key:"Comma",direction:"source"},forward:{key:"Period",direction:"target"},previous:{key:"Semicolon",direction:"source"},next:{key:"Quote",direction:"target"},exit:{key:"Escape",direction:"target"},help:{key:"KeyY",direction:"target"},undo:{key:"KeyZ",direction:"target"}},o=[["left","right"],["up","down"],["backward","forward"],["previous","next"]],a={left:["left","right"],right:["left","right"],up:["up","down"],down:["up","down"],backward:["backward","forward"],forward:["backward","forward"],previous:["previous","next"],next:["previous","next"],parent:["parent","child"],child:["parent","child"],exit:["exit","undo"],undo:["undo","undo"]},n={right:{key:"ArrowRight",direction:"target"},left:{key:"ArrowLeft",direction:"source"},down:{key:"ArrowDown",direction:"target"},up:{key:"ArrowUp",direction:"source"},child:{key:"Enter",direction:"target"},parent:{key:"Backspace",direction:"source"},exit:{key:"Escape",direction:"target"},undo:{key:"Period",direction:"target"},legend:{key:"KeyL",direction:"target"}},c={cssClass:"",spatialProperties:{x:0,y:0,width:0,height:0,path:""},semantics:{label:"",elementType:"div",role:"image",attributes:void 0},parentSemantics:{label:"",elementType:"figure",role:"figure",attributes:void 0},existingElement:{useForSpatialProperties:!1,spatialProperties:void 0}};export{e as a,t as b,r as c,i as d,o as e,a as f,n as g,c as h};
@@ -1 +0,0 @@
1
- var e={ArrowLeft:"left",ArrowRight:"right",ArrowUp:"up",ArrowDown:"down",Period:"forward",Comma:"backward",Escape:"parent",Enter:"child"},t={down:{keyCode:"ArrowDown",direction:"target"},left:{keyCode:"ArrowLeft",direction:"source"},right:{keyCode:"ArrowRight",direction:"target"},up:{keyCode:"ArrowUp",direction:"source"},backward:{keyCode:"Comma",direction:"source"},child:{keyCode:"Enter",direction:"target"},parent:{keyCode:"Backspace",direction:"source"},forward:{keyCode:"Period",direction:"target"},exit:{keyCode:"Escape",direction:"target"}},r={right:{key:"ArrowRight",direction:"target"},left:{key:"ArrowLeft",direction:"source"},down:{key:"ArrowDown",direction:"target"},up:{key:"ArrowUp",direction:"source"},child:{key:"Enter",direction:"target"},parent:{key:"Backspace",direction:"source"},exit:{key:"Escape",direction:"target"},undo:{key:"Period",direction:"target"},legend:{key:"KeyL",direction:"target"}},i={cssClass:"",dimensions:{x:0,y:0,width:0,height:0,path:""},semantics:{label:"",elementType:"div",role:"image",attributes:void 0},parentSemantics:{label:"",elementType:"figure",role:"figure",attributes:void 0},existingElement:{useForDimensions:!1,dimensions:void 0}};export{e as a,t as b,r as c,i as d};
@@ -1,18 +0,0 @@
1
- // src/utilities.ts
2
- var describeNode = (d, descriptionOptions) => {
3
- const keys = Object.keys(d);
4
- let description = "";
5
- keys.forEach((key) => {
6
- description += `${descriptionOptions && descriptionOptions.omitKeyNames ? "" : key + ": "}${d[key]}. `;
7
- });
8
- description += descriptionOptions && descriptionOptions.semanticLabel || "Data point.";
9
- return description;
10
- };
11
- var createValidId = (s) => {
12
- return "_" + s.replace(/[^a-zA-Z0-9_-]+/g, "_");
13
- };
14
-
15
- export {
16
- describeNode,
17
- createValidId
18
- };
@@ -1,177 +0,0 @@
1
- // src/consts.ts
2
- var SemanticKeys = {
3
- Escape: true,
4
- Enter: true,
5
- Backspace: true,
6
- ArrowLeft: true,
7
- ArrowRight: true,
8
- ArrowUp: true,
9
- ArrowDown: true
10
- };
11
- var defaultKeyBindings = {
12
- ArrowLeft: "left",
13
- ArrowRight: "right",
14
- ArrowUp: "up",
15
- ArrowDown: "down",
16
- Period: "forward",
17
- Comma: "backward",
18
- Escape: "parent",
19
- Enter: "child"
20
- };
21
- var TypicallyUnreservedKeys = ["KeyW", "KeyJ", "LeftBracket", "RightBracket", "Slash", "Backslash"];
22
- var TypicallyUnreservedSoloKeys = ["KeyW", "KeyJ"];
23
- var TypicallyUnreservedKeyPairs = [
24
- ["LeftBracket", "RightBracket"],
25
- ["Slash", "Backslash"]
26
- ];
27
- var GenericFullNavigationRules = {
28
- left: {
29
- key: "ArrowLeft",
30
- direction: "source"
31
- },
32
- right: {
33
- key: "ArrowRight",
34
- direction: "target"
35
- },
36
- up: {
37
- key: "ArrowUp",
38
- direction: "source"
39
- },
40
- down: {
41
- key: "ArrowDown",
42
- direction: "target"
43
- },
44
- child: {
45
- key: "Enter",
46
- direction: "target"
47
- },
48
- parent: {
49
- key: "Backspace",
50
- direction: "source"
51
- },
52
- backward: {
53
- key: "Comma",
54
- direction: "source"
55
- },
56
- forward: {
57
- key: "Period",
58
- direction: "target"
59
- },
60
- previous: {
61
- key: "Semicolon",
62
- direction: "source"
63
- },
64
- next: {
65
- key: "Quote",
66
- direction: "target"
67
- },
68
- exit: {
69
- key: "Escape",
70
- direction: "target"
71
- },
72
- help: {
73
- key: "KeyY",
74
- direction: "target"
75
- },
76
- undo: {
77
- key: "KeyZ",
78
- direction: "target"
79
- }
80
- };
81
- var GenericFullNavigationDimensions = [
82
- ["left", "right"],
83
- ["up", "down"],
84
- ["backward", "forward"],
85
- ["previous", "next"]
86
- ];
87
- var GenericFullNavigationPairs = {
88
- left: ["left", "right"],
89
- right: ["left", "right"],
90
- up: ["up", "down"],
91
- down: ["up", "down"],
92
- backward: ["backward", "forward"],
93
- forward: ["backward", "forward"],
94
- previous: ["previous", "next"],
95
- next: ["previous", "next"],
96
- parent: ["parent", "child"],
97
- child: ["parent", "child"],
98
- exit: ["exit", "undo"],
99
- undo: ["undo", "undo"]
100
- };
101
- var GenericLimitedNavigationRules = {
102
- right: {
103
- key: "ArrowRight",
104
- direction: "target"
105
- },
106
- left: {
107
- key: "ArrowLeft",
108
- direction: "source"
109
- },
110
- down: {
111
- key: "ArrowDown",
112
- direction: "target"
113
- },
114
- up: {
115
- key: "ArrowUp",
116
- direction: "source"
117
- },
118
- child: {
119
- key: "Enter",
120
- direction: "target"
121
- },
122
- parent: {
123
- key: "Backspace",
124
- direction: "source"
125
- },
126
- exit: {
127
- key: "Escape",
128
- direction: "target"
129
- },
130
- undo: {
131
- key: "Period",
132
- direction: "target"
133
- },
134
- legend: {
135
- key: "KeyL",
136
- direction: "target"
137
- }
138
- };
139
- var NodeElementDefaults = {
140
- cssClass: "",
141
- spatialProperties: {
142
- x: 0,
143
- y: 0,
144
- width: 0,
145
- height: 0,
146
- path: ""
147
- },
148
- semantics: {
149
- label: "",
150
- elementType: "div",
151
- role: "image",
152
- attributes: void 0
153
- },
154
- parentSemantics: {
155
- label: "",
156
- elementType: "figure",
157
- role: "figure",
158
- attributes: void 0
159
- },
160
- existingElement: {
161
- useForSpatialProperties: false,
162
- spatialProperties: void 0
163
- }
164
- };
165
-
166
- export {
167
- SemanticKeys,
168
- defaultKeyBindings,
169
- TypicallyUnreservedKeys,
170
- TypicallyUnreservedSoloKeys,
171
- TypicallyUnreservedKeyPairs,
172
- GenericFullNavigationRules,
173
- GenericFullNavigationDimensions,
174
- GenericFullNavigationPairs,
175
- GenericLimitedNavigationRules,
176
- NodeElementDefaults
177
- };
@@ -1 +0,0 @@
1
- var e={ArrowLeft:"left",ArrowRight:"right",ArrowUp:"up",ArrowDown:"down",Period:"forward",Comma:"backward",Escape:"parent",Enter:"child"},t={down:{keyCode:"ArrowDown",direction:"target"},left:{keyCode:"ArrowLeft",direction:"source"},right:{keyCode:"ArrowRight",direction:"target"},up:{keyCode:"ArrowUp",direction:"source"},backward:{keyCode:"Comma",direction:"source"},child:{keyCode:"Enter",direction:"target"},parent:{keyCode:"Backspace",direction:"source"},forward:{keyCode:"Period",direction:"target"},exit:{keyCode:"Escape",direction:"target"},undo:{keyCode:"KeyZ",direction:"target"}},r={right:{key:"ArrowRight",direction:"target"},left:{key:"ArrowLeft",direction:"source"},down:{key:"ArrowDown",direction:"target"},up:{key:"ArrowUp",direction:"source"},child:{key:"Enter",direction:"target"},parent:{key:"Backspace",direction:"source"},exit:{key:"Escape",direction:"target"},undo:{key:"Period",direction:"target"},legend:{key:"KeyL",direction:"target"}},i={cssClass:"",spatialProperties:{x:0,y:0,width:0,height:0,path:""},semantics:{label:"",elementType:"div",role:"image",attributes:void 0},parentSemantics:{label:"",elementType:"figure",role:"figure",attributes:void 0},existingElement:{useForSpatialProperties:!1,spatialProperties:void 0}};export{e as a,t as b,r as c,i as d};
@@ -1 +0,0 @@
1
- var e={ArrowLeft:"left",ArrowRight:"right",ArrowUp:"up",ArrowDown:"down",Period:"forward",Comma:"backward",Escape:"parent",Enter:"child"},t={down:{keyCode:"ArrowDown",direction:"target"},left:{keyCode:"ArrowLeft",direction:"source"},right:{keyCode:"ArrowRight",direction:"target"},up:{keyCode:"ArrowUp",direction:"source"},backward:{keyCode:"Comma",direction:"source"},child:{keyCode:"Enter",direction:"target"},parent:{keyCode:"Backspace",direction:"source"},forward:{keyCode:"Period",direction:"target"},exit:{keyCode:"Escape",direction:"target"},undo:{keyCode:"KeyZ",direction:"target"}},r=[["left","right"],["up","down"],["backward","forward"],["previous","next"]],i={left:["left","right"],right:["left","right"],up:["up","down"],down:["up","down"],backward:["backward","forward"],forward:["backward","forward"],previous:["previous","next"],next:["previous","next"],parent:["parent","child"],child:["parent","child"],exit:["exit","undo"],undo:["undo","undo"]},o={right:{key:"ArrowRight",direction:"target"},left:{key:"ArrowLeft",direction:"source"},down:{key:"ArrowDown",direction:"target"},up:{key:"ArrowUp",direction:"source"},child:{key:"Enter",direction:"target"},parent:{key:"Backspace",direction:"source"},exit:{key:"Escape",direction:"target"},undo:{key:"Period",direction:"target"},legend:{key:"KeyL",direction:"target"}},a={cssClass:"",spatialProperties:{x:0,y:0,width:0,height:0,path:""},semantics:{label:"",elementType:"div",role:"image",attributes:void 0},parentSemantics:{label:"",elementType:"figure",role:"figure",attributes:void 0},existingElement:{useForSpatialProperties:!1,spatialProperties:void 0}};export{e as a,t as b,r as c,i as d,o as e,a as f};
@@ -1 +0,0 @@
1
- var e={ArrowLeft:"left",ArrowRight:"right",ArrowUp:"up",ArrowDown:"down",Period:"forward",Comma:"backward",Escape:"parent",Enter:"child"},t=[{key:"KeyW"},{key:"KeyJ"},{key:"LeftBracket"},{key:"RightBracket"},{key:"Slash"},{key:"Backslash"}],r=[{key:"KeyW"},{key:"KeyJ"}],i=[[{key:"LeftBracket"},{key:"RightBracket"}],[{key:"Slash"},{key:"Backslash"}]],o={left:{key:"ArrowLeft",direction:"source"},right:{key:"ArrowRight",direction:"target"},up:{key:"ArrowUp",direction:"source"},down:{key:"ArrowDown",direction:"target"},child:{key:"Enter",direction:"target"},parent:{key:"Backspace",direction:"source"},backward:{key:"Comma",direction:"source"},forward:{key:"Period",direction:"target"},previous:{key:"Semicolon",direction:"source"},next:{key:"Quote",direction:"target"},exit:{key:"Escape",direction:"target"},help:{key:"KeyY",direction:"target"},undo:{key:"KeyZ",direction:"target"}},a=[["left","right"],["up","down"],["backward","forward"],["previous","next"]],n={left:["left","right"],right:["left","right"],up:["up","down"],down:["up","down"],backward:["backward","forward"],forward:["backward","forward"],previous:["previous","next"],next:["previous","next"],parent:["parent","child"],child:["parent","child"],exit:["exit","undo"],undo:["undo","undo"]},c={right:{key:"ArrowRight",direction:"target"},left:{key:"ArrowLeft",direction:"source"},down:{key:"ArrowDown",direction:"target"},up:{key:"ArrowUp",direction:"source"},child:{key:"Enter",direction:"target"},parent:{key:"Backspace",direction:"source"},exit:{key:"Escape",direction:"target"},undo:{key:"Period",direction:"target"},legend:{key:"KeyL",direction:"target"}},d={cssClass:"",spatialProperties:{x:0,y:0,width:0,height:0,path:""},semantics:{label:"",elementType:"div",role:"image",attributes:void 0},parentSemantics:{label:"",elementType:"figure",role:"figure",attributes:void 0},existingElement:{useForSpatialProperties:!1,spatialProperties:void 0}};export{e as a,t as b,r as c,i as d,o as e,a as f,n as g,c as h,d as i};
package/dist/consts.mjs DELETED
@@ -1 +0,0 @@
1
- import{a,b,c,d,e,f,g,h,i,j}from"./chunk-PEL3ZYDS.mjs";export{g as GenericFullNavigationDimensions,h as GenericFullNavigationPairs,f as GenericFullNavigationRules,i as GenericLimitedNavigationRules,j as NodeElementDefaults,a as SemanticKeys,e as TypicallyUnreservedKeyPairs,c as TypicallyUnreservedKeys,d as TypicallyUnreservedSoloKeys,b as defaultKeyBindings};