diff --git a/.gitignore b/.gitignore index 657842b..ef88793 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,6 @@ node_modules/ .pnp.js # Build output -dist/ build/ *.tsbuildinfo diff --git a/dist/components/index.d.ts b/dist/components/index.d.ts new file mode 100644 index 0000000..9ac89fe --- /dev/null +++ b/dist/components/index.d.ts @@ -0,0 +1,2 @@ +export { D3Config, Graph, GraphOptions } from '../index.js'; +import '@quartz-community/types'; diff --git a/dist/components/index.js b/dist/components/index.js new file mode 100644 index 0000000..bdf56c4 --- /dev/null +++ b/dist/components/index.js @@ -0,0 +1,100 @@ +import { jsxs, jsx } from 'preact/jsx-runtime'; + +// src/util/lang.ts +function classNames(...classes) { + return classes.filter(Boolean).join(" "); +} + +// src/i18n/locales/en-US.ts +var en_US_default = { + components: { + graph: { + title: "Graph View" + } + } +}; + +// src/i18n/index.ts +var locales = { + "en-US": en_US_default +}; +function i18n(locale) { + return locales[locale] || en_US_default; +} + +// src/components/styles/graph.scss +var graph_default = ".graph > h3 {\n font-size: 1rem;\n margin: 0;\n}\n.graph > .graph-outer {\n border-radius: 5px;\n border: 1px solid var(--lightgray);\n box-sizing: border-box;\n height: 250px;\n margin: 0.5em 0;\n position: relative;\n overflow: hidden;\n}\n.graph > .graph-outer > .global-graph-icon {\n cursor: pointer;\n background: none;\n border: none;\n color: var(--dark);\n opacity: 0.5;\n width: 24px;\n height: 24px;\n position: absolute;\n padding: 0.2rem;\n margin: 0.3rem;\n top: 0;\n right: 0;\n border-radius: 4px;\n background-color: transparent;\n transition: background-color 0.5s ease;\n}\n.graph > .graph-outer > .global-graph-icon:hover {\n background-color: var(--lightgray);\n}\n.graph > .global-graph-outer {\n position: fixed;\n z-index: 9999;\n left: 0;\n top: 0;\n width: 100vw;\n height: 100%;\n backdrop-filter: blur(4px);\n display: none;\n overflow: hidden;\n}\n.graph > .global-graph-outer.active {\n display: inline-block;\n}\n.graph > .global-graph-outer > .global-graph-container {\n border: 1px solid var(--lightgray);\n background-color: var(--light);\n border-radius: 5px;\n box-sizing: border-box;\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n height: 80vh;\n width: 80vw;\n}\n@media all and (max-width: 800px) {\n .graph > .global-graph-outer > .global-graph-container {\n width: 90%;\n }\n}\n\n.graph-container {\n width: 100%;\n height: 100%;\n}"; + +// src/components/scripts/graph.inline.ts +var graph_inline_default = 'var st=Object.hasOwnProperty;var se,B,ce,Xe,Y,ae,fe,_e,de,Mu,ju,Pu,Ye,Tu={},he=[],Ze=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,mu=Array.isArray;function H(u,e){for(var t in e)u[t]=e[t];return u}function Ru(u){u&&u.parentNode&&u.parentNode.removeChild(u)}function Lu(u,e,t,o,a){var n={type:u,props:e,key:t,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:a??++ce,__i:-1,__u:0};return a==null&&B.vnode!=null&&B.vnode(n),n}function iu(u){return u.children}function Au(u,e){this.props=u,this.context=e}function au(u,e){if(e==null)return u.__?au(u.__,u.__i+1):null;for(var t;ec&&Y.sort(_e),u=Y.shift(),c=Y.length,u.__d&&(t=void 0,o=void 0,a=(o=(e=u).__v).__e,n=[],F=[],e.__P&&((t=H({},o)).__v=o.__v+1,B.vnode&&B.vnode(t),Ee(e.__P,t,o,e.__n,e.__P.namespaceURI,32&o.__u?[a]:null,n,a??au(o),!!(32&o.__u),F),t.__v=o.__v,t.__.__k[t.__i]=t,et(n,t,F),o.__e=o.__=null,t.__e!=a&&Ce(t)));gu.__r=0}function pe(u,e,t,o,a,n,F,c,C,i,d){var r,g,s,m,j,y,p,v=o&&o.__k||he,M=e.length;for(C=Qe(t,e,v,C,M),r=0;r0?F=u.__k[n]=Lu(F.type,F.props,F.key,F.ref?F.ref:null,F.__v):u.__k[n]=F,C=n+g,F.__=u,F.__b=u.__b+1,c=null,(i=F.__i=ut(F,t,C,r))!=-1&&(r--,(c=t[i])&&(c.__u|=2)),c==null||c.__v==null?(i==-1&&(a>d?g--:aC?g--:g++,F.__u|=4))):u.__k[n]=null;if(r)for(n=0;n(d?1:0)){for(a=t-1,n=t+1;a>=0||n=0?a--:n++])!=null&&(2&i.__u)==0&&c==i.key&&C==i.type)return F}return-1}function le(u,e,t){e[0]=="-"?u.setProperty(e,t??""):u[e]=t==null?"":typeof t!="number"||Ze.test(e)?t:t+"px"}function Eu(u,e,t,o,a){var n,F;u:if(e=="style")if(typeof t=="string")u.style.cssText=t;else{if(typeof o=="string"&&(u.style.cssText=o=""),o)for(e in o)t&&e in t||le(u.style,e,"");if(t)for(e in t)o&&t[e]==o[e]||le(u.style,e,t[e])}else if(e[0]=="o"&&e[1]=="n")n=e!=(e=e.replace(de,"$1")),F=e.toLowerCase(),e=F in u||e=="onFocusOut"||e=="onFocusIn"?F.slice(2):e.slice(2),u.l||(u.l={}),u.l[e+n]=t,t?o?t.u=o.u:(t.u=Mu,u.addEventListener(e,n?Pu:ju,n)):u.removeEventListener(e,n?Pu:ju,n);else{if(a=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in u)try{u[e]=t??"";break u}catch{}typeof t=="function"||(t==null||t===!1&&e[4]!="-"?u.removeAttribute(e):u.setAttribute(e,e=="popover"&&t==1?"":t))}}function Fe(u){return function(e){if(this.l){var t=this.l[e.type+u];if(e.t==null)e.t=Mu++;else if(e.t0?u:mu(u)?u.map(Ae):H({},u)}function tt(u,e,t,o,a,n,F,c,C){var i,d,r,g,s,m,j,y=t.props||Tu,p=e.props,v=e.type;if(v=="svg"?a="http://www.w3.org/2000/svg":v=="math"?a="http://www.w3.org/1998/Math/MathML":a||(a="http://www.w3.org/1999/xhtml"),n!=null){for(i=0;i=0)for(var _u=[h],du=new Set([h]),$u=0;$u<=Gu&&_u.length>0;$u++){for(var Bu=[],yu=0;yu<_u.length;yu++){var bu=_u[yu];uu.add(bu);for(var xu=0;xu { + const Graph = ({ displayClass, cfg }) => { + const localGraph = { ...defaultOptions.localGraph, ...userOpts?.localGraph }; + const globalGraph = { ...defaultOptions.globalGraph, ...userOpts?.globalGraph }; + return /* @__PURE__ */ jsxs("div", { class: classNames(displayClass, "graph"), children: [ + /* @__PURE__ */ jsx("h3", { children: i18n(cfg.locale ?? "en-US").components.graph.title }), + /* @__PURE__ */ jsxs("div", { class: "graph-outer", children: [ + /* @__PURE__ */ jsx("div", { class: "graph-container", "data-cfg": JSON.stringify(localGraph) }), + /* @__PURE__ */ jsx("button", { class: "global-graph-icon", "aria-label": "Global Graph", children: /* @__PURE__ */ jsx( + "svg", + { + version: "1.1", + xmlns: "http://www.w3.org/2000/svg", + xmlnsXlink: "http://www.w3.org/1999/xlink", + x: "0px", + y: "0px", + viewBox: "0 0 55 55", + fill: "currentColor", + xmlSpace: "preserve", + children: /* @__PURE__ */ jsx( + "path", + { + d: "M49,0c-3.309,0-6,2.691-6,6c0,1.035,0.263,2.009,0.726,2.86l-9.829,9.829C32.542,17.634,30.846,17,29,17\n s-3.542,0.634-4.898,1.688l-7.669-7.669C16.785,10.424,17,9.74,17,9c0-2.206-1.794-4-4-4S9,6.794,9,9s1.794,4,4,4\n c0.74,0,1.424-0.215,2.019-0.567l7.669,7.669C21.634,21.458,21,23.154,21,25s0.634,3.542,1.688,4.897L10.024,42.562\n C8.958,41.595,7.549,41,6,41c-3.309,0-6,2.691-6,6s2.691,6,6,6s6-2.691,6-6c0-1.035-0.263-2.009-0.726-2.86l12.829-12.829\n c1.106,0.86,2.44,1.436,3.898,1.619v10.16c-2.833,0.478-5,2.942-5,5.91c0,3.309,2.691,6,6,6s6-2.691,6-6c0-2.967-2.167-5.431-5-5.91\n v-10.16c1.458-0.183,2.792-0.759,3.898-1.619l7.669,7.669C41.215,39.576,41,40.26,41,41c0,2.206,1.794,4,4,4s4-1.794,4-4\n s-1.794-4-4-4c-0.74,0-1.424,0.215-2.019,0.567l-7.669-7.669C36.366,28.542,37,26.846,37,25s-0.634-3.542-1.688-4.897l9.665-9.665\n C46.042,11.405,47.451,12,49,12c3.309,0,6-2.691,6-6S52.309,0,49,0z M11,9c0-1.103,0.897-2,2-2s2,0.897,2,2s-0.897,2-2,2\n S11,10.103,11,9z M6,51c-2.206,0-4-1.794-4-4s1.794-4,4-4s4,1.794,4,4S8.206,51,6,51z M33,49c0,2.206-1.794,4-4,4s-4-1.794-4-4\n s1.794-4,4-4S33,46.794,33,49z M29,31c-3.309,0-6-2.691-6-6s2.691-6,6-6s6,2.691,6,6S32.309,31,29,31z M47,41c0,1.103-0.897,2-2,2\n s-2-0.897-2-2s0.897-2,2-2S47,39.897,47,41z M49,10c-2.206,0-4-1.794-4-4s1.794-4,4-4s4,1.794,4,4S51.206,10,49,10z" + } + ) + } + ) }) + ] }), + /* @__PURE__ */ jsx("div", { class: "global-graph-outer", children: /* @__PURE__ */ jsx("div", { class: "global-graph-container", "data-cfg": JSON.stringify(globalGraph) }) }) + ] }); + }; + Graph.css = graph_default; + Graph.afterDOMLoaded = graph_inline_default; + return Graph; +}); + +export { Graph_default as Graph }; +//# sourceMappingURL=index.js.map +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/components/index.js.map b/dist/components/index.js.map new file mode 100644 index 0000000..6e385f5 --- /dev/null +++ b/dist/components/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/util/lang.ts","../../src/i18n/locales/en-US.ts","../../src/i18n/index.ts","../../src/components/styles/graph.scss","../../src/components/scripts/graph.inline.ts","../../src/components/Graph.tsx"],"names":[],"mappings":";;;AAAO,SAAS,cAAc,OAAA,EAAwD;AACpF,EAAA,OAAO,OAAA,CAAQ,MAAA,CAAO,OAAO,CAAA,CAAE,KAAK,GAAG,CAAA;AACzC;;;ACFA,IAAO,aAAA,GAAQ;AAAA,EACb,UAAA,EAAY;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AAA,EAAyB,UAAA,EAAU,IAAA,CAAK,SAAA,CAAU,WAAW,GAAG,CAAA,EAC7E;AAAA,KAAA,EACF,CAAA;AAAA,EAEJ,CAAA;AAEA,EAAA,KAAA,CAAM,GAAA,GAAM,aAAA;AACZ,EAAA,KAAA,CAAM,cAAA,GAAiB,oBAAA;AAEvB,EAAA,OAAO,KAAA;AACT,CAAA","file":"index.js","sourcesContent":["export function classNames(...classes: (string | undefined | null | false)[]): string {\n return classes.filter(Boolean).join(\" \");\n}\n","export default {\n components: {\n graph: {\n title: \"Graph View\",\n },\n },\n};\n","import enUS from \"./locales/en-US\";\n\nconst locales: Record = {\n \"en-US\": enUS,\n};\n\nexport function i18n(locale: string) {\n return locales[locale] || enUS;\n}\n",".graph > h3 {\n font-size: 1rem;\n margin: 0;\n}\n.graph > .graph-outer {\n border-radius: 5px;\n border: 1px solid var(--lightgray);\n box-sizing: border-box;\n height: 250px;\n margin: 0.5em 0;\n position: relative;\n overflow: hidden;\n}\n.graph > .graph-outer > .global-graph-icon {\n cursor: pointer;\n background: none;\n border: none;\n color: var(--dark);\n opacity: 0.5;\n width: 24px;\n height: 24px;\n position: absolute;\n padding: 0.2rem;\n margin: 0.3rem;\n top: 0;\n right: 0;\n border-radius: 4px;\n background-color: transparent;\n transition: background-color 0.5s ease;\n}\n.graph > .graph-outer > .global-graph-icon:hover {\n background-color: var(--lightgray);\n}\n.graph > .global-graph-outer {\n position: fixed;\n z-index: 9999;\n left: 0;\n top: 0;\n width: 100vw;\n height: 100%;\n backdrop-filter: blur(4px);\n display: none;\n overflow: hidden;\n}\n.graph > .global-graph-outer.active {\n display: inline-block;\n}\n.graph > .global-graph-outer > .global-graph-container {\n border: 1px solid var(--lightgray);\n background-color: var(--light);\n border-radius: 5px;\n box-sizing: border-box;\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n height: 80vh;\n width: 80vw;\n}\n@media all and (max-width: 800px) {\n .graph > .global-graph-outer > .global-graph-container {\n width: 90%;\n }\n}\n\n.graph-container {\n width: 100%;\n height: 100%;\n}","var st=Object.hasOwnProperty;var se,B,ce,Xe,Y,ae,fe,_e,de,Mu,ju,Pu,Ye,Tu={},he=[],Ze=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,mu=Array.isArray;function H(u,e){for(var t in e)u[t]=e[t];return u}function Ru(u){u&&u.parentNode&&u.parentNode.removeChild(u)}function Lu(u,e,t,o,a){var n={type:u,props:e,key:t,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:a??++ce,__i:-1,__u:0};return a==null&&B.vnode!=null&&B.vnode(n),n}function iu(u){return u.children}function Au(u,e){this.props=u,this.context=e}function au(u,e){if(e==null)return u.__?au(u.__,u.__i+1):null;for(var t;ec&&Y.sort(_e),u=Y.shift(),c=Y.length,u.__d&&(t=void 0,o=void 0,a=(o=(e=u).__v).__e,n=[],F=[],e.__P&&((t=H({},o)).__v=o.__v+1,B.vnode&&B.vnode(t),Ee(e.__P,t,o,e.__n,e.__P.namespaceURI,32&o.__u?[a]:null,n,a??au(o),!!(32&o.__u),F),t.__v=o.__v,t.__.__k[t.__i]=t,et(n,t,F),o.__e=o.__=null,t.__e!=a&&Ce(t)));gu.__r=0}function pe(u,e,t,o,a,n,F,c,C,i,d){var r,g,s,m,j,y,p,v=o&&o.__k||he,M=e.length;for(C=Qe(t,e,v,C,M),r=0;r0?F=u.__k[n]=Lu(F.type,F.props,F.key,F.ref?F.ref:null,F.__v):u.__k[n]=F,C=n+g,F.__=u,F.__b=u.__b+1,c=null,(i=F.__i=ut(F,t,C,r))!=-1&&(r--,(c=t[i])&&(c.__u|=2)),c==null||c.__v==null?(i==-1&&(a>d?g--:aC?g--:g++,F.__u|=4))):u.__k[n]=null;if(r)for(n=0;n(d?1:0)){for(a=t-1,n=t+1;a>=0||n=0?a--:n++])!=null&&(2&i.__u)==0&&c==i.key&&C==i.type)return F}return-1}function le(u,e,t){e[0]==\"-\"?u.setProperty(e,t??\"\"):u[e]=t==null?\"\":typeof t!=\"number\"||Ze.test(e)?t:t+\"px\"}function Eu(u,e,t,o,a){var n,F;u:if(e==\"style\")if(typeof t==\"string\")u.style.cssText=t;else{if(typeof o==\"string\"&&(u.style.cssText=o=\"\"),o)for(e in o)t&&e in t||le(u.style,e,\"\");if(t)for(e in t)o&&t[e]==o[e]||le(u.style,e,t[e])}else if(e[0]==\"o\"&&e[1]==\"n\")n=e!=(e=e.replace(de,\"$1\")),F=e.toLowerCase(),e=F in u||e==\"onFocusOut\"||e==\"onFocusIn\"?F.slice(2):e.slice(2),u.l||(u.l={}),u.l[e+n]=t,t?o?t.u=o.u:(t.u=Mu,u.addEventListener(e,n?Pu:ju,n)):u.removeEventListener(e,n?Pu:ju,n);else{if(a==\"http://www.w3.org/2000/svg\")e=e.replace(/xlink(H|:h)/,\"h\").replace(/sName$/,\"s\");else if(e!=\"width\"&&e!=\"height\"&&e!=\"href\"&&e!=\"list\"&&e!=\"form\"&&e!=\"tabIndex\"&&e!=\"download\"&&e!=\"rowSpan\"&&e!=\"colSpan\"&&e!=\"role\"&&e!=\"popover\"&&e in u)try{u[e]=t??\"\";break u}catch{}typeof t==\"function\"||(t==null||t===!1&&e[4]!=\"-\"?u.removeAttribute(e):u.setAttribute(e,e==\"popover\"&&t==1?\"\":t))}}function Fe(u){return function(e){if(this.l){var t=this.l[e.type+u];if(e.t==null)e.t=Mu++;else if(e.t0?u:mu(u)?u.map(Ae):H({},u)}function tt(u,e,t,o,a,n,F,c,C){var i,d,r,g,s,m,j,y=t.props||Tu,p=e.props,v=e.type;if(v==\"svg\"?a=\"http://www.w3.org/2000/svg\":v==\"math\"?a=\"http://www.w3.org/1998/Math/MathML\":a||(a=\"http://www.w3.org/1999/xhtml\"),n!=null){for(i=0;i=0)for(var _u=[h],du=new Set([h]),$u=0;$u<=Gu&&_u.length>0;$u++){for(var Bu=[],yu=0;yu<_u.length;yu++){var bu=_u[yu];uu.add(bu);for(var xu=0;xu;\n globalGraph?: Partial;\n}\n\nconst defaultOptions: GraphOptions = {\n localGraph: {\n drag: true,\n zoom: true,\n depth: 1,\n scale: 1.1,\n repelForce: 0.5,\n centerForce: 0.3,\n linkDistance: 30,\n fontSize: 0.6,\n opacityScale: 1,\n showTags: true,\n removeTags: [],\n focusOnHover: false,\n enableRadial: false,\n },\n globalGraph: {\n drag: true,\n zoom: true,\n depth: -1,\n scale: 0.9,\n repelForce: 0.5,\n centerForce: 0.2,\n linkDistance: 30,\n fontSize: 0.6,\n opacityScale: 1,\n showTags: true,\n removeTags: [],\n focusOnHover: true,\n enableRadial: true,\n },\n};\n\nexport default ((userOpts?: Partial) => {\n const Graph: QuartzComponent = ({ displayClass, cfg }: QuartzComponentProps) => {\n const localGraph = { ...defaultOptions.localGraph, ...userOpts?.localGraph };\n const globalGraph = { ...defaultOptions.globalGraph, ...userOpts?.globalGraph };\n\n return (\n
\n

{i18n(cfg.locale ?? \"en-US\").components.graph.title}

\n
\n
\n \n
\n
\n
\n
\n
\n );\n };\n\n Graph.css = style;\n Graph.afterDOMLoaded = script;\n\n return Graph;\n}) satisfies QuartzComponentConstructor;\n"]} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts new file mode 100644 index 0000000..d55957b --- /dev/null +++ b/dist/index.d.ts @@ -0,0 +1,24 @@ +import { QuartzComponent } from '@quartz-community/types'; + +interface D3Config { + drag: boolean; + zoom: boolean; + depth: number; + scale: number; + repelForce: number; + centerForce: number; + linkDistance: number; + fontSize: number; + opacityScale: number; + removeTags: string[]; + showTags: boolean; + focusOnHover?: boolean; + enableRadial?: boolean; +} +interface GraphOptions { + localGraph?: Partial; + globalGraph?: Partial; +} +declare const _default: (userOpts?: Partial) => QuartzComponent; + +export { type D3Config, _default as Graph, type GraphOptions }; diff --git a/dist/index.js b/dist/index.js new file mode 100644 index 0000000..bdf56c4 --- /dev/null +++ b/dist/index.js @@ -0,0 +1,100 @@ +import { jsxs, jsx } from 'preact/jsx-runtime'; + +// src/util/lang.ts +function classNames(...classes) { + return classes.filter(Boolean).join(" "); +} + +// src/i18n/locales/en-US.ts +var en_US_default = { + components: { + graph: { + title: "Graph View" + } + } +}; + +// src/i18n/index.ts +var locales = { + "en-US": en_US_default +}; +function i18n(locale) { + return locales[locale] || en_US_default; +} + +// src/components/styles/graph.scss +var graph_default = ".graph > h3 {\n font-size: 1rem;\n margin: 0;\n}\n.graph > .graph-outer {\n border-radius: 5px;\n border: 1px solid var(--lightgray);\n box-sizing: border-box;\n height: 250px;\n margin: 0.5em 0;\n position: relative;\n overflow: hidden;\n}\n.graph > .graph-outer > .global-graph-icon {\n cursor: pointer;\n background: none;\n border: none;\n color: var(--dark);\n opacity: 0.5;\n width: 24px;\n height: 24px;\n position: absolute;\n padding: 0.2rem;\n margin: 0.3rem;\n top: 0;\n right: 0;\n border-radius: 4px;\n background-color: transparent;\n transition: background-color 0.5s ease;\n}\n.graph > .graph-outer > .global-graph-icon:hover {\n background-color: var(--lightgray);\n}\n.graph > .global-graph-outer {\n position: fixed;\n z-index: 9999;\n left: 0;\n top: 0;\n width: 100vw;\n height: 100%;\n backdrop-filter: blur(4px);\n display: none;\n overflow: hidden;\n}\n.graph > .global-graph-outer.active {\n display: inline-block;\n}\n.graph > .global-graph-outer > .global-graph-container {\n border: 1px solid var(--lightgray);\n background-color: var(--light);\n border-radius: 5px;\n box-sizing: border-box;\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n height: 80vh;\n width: 80vw;\n}\n@media all and (max-width: 800px) {\n .graph > .global-graph-outer > .global-graph-container {\n width: 90%;\n }\n}\n\n.graph-container {\n width: 100%;\n height: 100%;\n}"; + +// src/components/scripts/graph.inline.ts +var graph_inline_default = 'var st=Object.hasOwnProperty;var se,B,ce,Xe,Y,ae,fe,_e,de,Mu,ju,Pu,Ye,Tu={},he=[],Ze=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,mu=Array.isArray;function H(u,e){for(var t in e)u[t]=e[t];return u}function Ru(u){u&&u.parentNode&&u.parentNode.removeChild(u)}function Lu(u,e,t,o,a){var n={type:u,props:e,key:t,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:a??++ce,__i:-1,__u:0};return a==null&&B.vnode!=null&&B.vnode(n),n}function iu(u){return u.children}function Au(u,e){this.props=u,this.context=e}function au(u,e){if(e==null)return u.__?au(u.__,u.__i+1):null;for(var t;ec&&Y.sort(_e),u=Y.shift(),c=Y.length,u.__d&&(t=void 0,o=void 0,a=(o=(e=u).__v).__e,n=[],F=[],e.__P&&((t=H({},o)).__v=o.__v+1,B.vnode&&B.vnode(t),Ee(e.__P,t,o,e.__n,e.__P.namespaceURI,32&o.__u?[a]:null,n,a??au(o),!!(32&o.__u),F),t.__v=o.__v,t.__.__k[t.__i]=t,et(n,t,F),o.__e=o.__=null,t.__e!=a&&Ce(t)));gu.__r=0}function pe(u,e,t,o,a,n,F,c,C,i,d){var r,g,s,m,j,y,p,v=o&&o.__k||he,M=e.length;for(C=Qe(t,e,v,C,M),r=0;r0?F=u.__k[n]=Lu(F.type,F.props,F.key,F.ref?F.ref:null,F.__v):u.__k[n]=F,C=n+g,F.__=u,F.__b=u.__b+1,c=null,(i=F.__i=ut(F,t,C,r))!=-1&&(r--,(c=t[i])&&(c.__u|=2)),c==null||c.__v==null?(i==-1&&(a>d?g--:aC?g--:g++,F.__u|=4))):u.__k[n]=null;if(r)for(n=0;n(d?1:0)){for(a=t-1,n=t+1;a>=0||n=0?a--:n++])!=null&&(2&i.__u)==0&&c==i.key&&C==i.type)return F}return-1}function le(u,e,t){e[0]=="-"?u.setProperty(e,t??""):u[e]=t==null?"":typeof t!="number"||Ze.test(e)?t:t+"px"}function Eu(u,e,t,o,a){var n,F;u:if(e=="style")if(typeof t=="string")u.style.cssText=t;else{if(typeof o=="string"&&(u.style.cssText=o=""),o)for(e in o)t&&e in t||le(u.style,e,"");if(t)for(e in t)o&&t[e]==o[e]||le(u.style,e,t[e])}else if(e[0]=="o"&&e[1]=="n")n=e!=(e=e.replace(de,"$1")),F=e.toLowerCase(),e=F in u||e=="onFocusOut"||e=="onFocusIn"?F.slice(2):e.slice(2),u.l||(u.l={}),u.l[e+n]=t,t?o?t.u=o.u:(t.u=Mu,u.addEventListener(e,n?Pu:ju,n)):u.removeEventListener(e,n?Pu:ju,n);else{if(a=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in u)try{u[e]=t??"";break u}catch{}typeof t=="function"||(t==null||t===!1&&e[4]!="-"?u.removeAttribute(e):u.setAttribute(e,e=="popover"&&t==1?"":t))}}function Fe(u){return function(e){if(this.l){var t=this.l[e.type+u];if(e.t==null)e.t=Mu++;else if(e.t0?u:mu(u)?u.map(Ae):H({},u)}function tt(u,e,t,o,a,n,F,c,C){var i,d,r,g,s,m,j,y=t.props||Tu,p=e.props,v=e.type;if(v=="svg"?a="http://www.w3.org/2000/svg":v=="math"?a="http://www.w3.org/1998/Math/MathML":a||(a="http://www.w3.org/1999/xhtml"),n!=null){for(i=0;i=0)for(var _u=[h],du=new Set([h]),$u=0;$u<=Gu&&_u.length>0;$u++){for(var Bu=[],yu=0;yu<_u.length;yu++){var bu=_u[yu];uu.add(bu);for(var xu=0;xu { + const Graph = ({ displayClass, cfg }) => { + const localGraph = { ...defaultOptions.localGraph, ...userOpts?.localGraph }; + const globalGraph = { ...defaultOptions.globalGraph, ...userOpts?.globalGraph }; + return /* @__PURE__ */ jsxs("div", { class: classNames(displayClass, "graph"), children: [ + /* @__PURE__ */ jsx("h3", { children: i18n(cfg.locale ?? "en-US").components.graph.title }), + /* @__PURE__ */ jsxs("div", { class: "graph-outer", children: [ + /* @__PURE__ */ jsx("div", { class: "graph-container", "data-cfg": JSON.stringify(localGraph) }), + /* @__PURE__ */ jsx("button", { class: "global-graph-icon", "aria-label": "Global Graph", children: /* @__PURE__ */ jsx( + "svg", + { + version: "1.1", + xmlns: "http://www.w3.org/2000/svg", + xmlnsXlink: "http://www.w3.org/1999/xlink", + x: "0px", + y: "0px", + viewBox: "0 0 55 55", + fill: "currentColor", + xmlSpace: "preserve", + children: /* @__PURE__ */ jsx( + "path", + { + d: "M49,0c-3.309,0-6,2.691-6,6c0,1.035,0.263,2.009,0.726,2.86l-9.829,9.829C32.542,17.634,30.846,17,29,17\n s-3.542,0.634-4.898,1.688l-7.669-7.669C16.785,10.424,17,9.74,17,9c0-2.206-1.794-4-4-4S9,6.794,9,9s1.794,4,4,4\n c0.74,0,1.424-0.215,2.019-0.567l7.669,7.669C21.634,21.458,21,23.154,21,25s0.634,3.542,1.688,4.897L10.024,42.562\n C8.958,41.595,7.549,41,6,41c-3.309,0-6,2.691-6,6s2.691,6,6,6s6-2.691,6-6c0-1.035-0.263-2.009-0.726-2.86l12.829-12.829\n c1.106,0.86,2.44,1.436,3.898,1.619v10.16c-2.833,0.478-5,2.942-5,5.91c0,3.309,2.691,6,6,6s6-2.691,6-6c0-2.967-2.167-5.431-5-5.91\n v-10.16c1.458-0.183,2.792-0.759,3.898-1.619l7.669,7.669C41.215,39.576,41,40.26,41,41c0,2.206,1.794,4,4,4s4-1.794,4-4\n s-1.794-4-4-4c-0.74,0-1.424,0.215-2.019,0.567l-7.669-7.669C36.366,28.542,37,26.846,37,25s-0.634-3.542-1.688-4.897l9.665-9.665\n C46.042,11.405,47.451,12,49,12c3.309,0,6-2.691,6-6S52.309,0,49,0z M11,9c0-1.103,0.897-2,2-2s2,0.897,2,2s-0.897,2-2,2\n S11,10.103,11,9z M6,51c-2.206,0-4-1.794-4-4s1.794-4,4-4s4,1.794,4,4S8.206,51,6,51z M33,49c0,2.206-1.794,4-4,4s-4-1.794-4-4\n s1.794-4,4-4S33,46.794,33,49z M29,31c-3.309,0-6-2.691-6-6s2.691-6,6-6s6,2.691,6,6S32.309,31,29,31z M47,41c0,1.103-0.897,2-2,2\n s-2-0.897-2-2s0.897-2,2-2S47,39.897,47,41z M49,10c-2.206,0-4-1.794-4-4s1.794-4,4-4s4,1.794,4,4S51.206,10,49,10z" + } + ) + } + ) }) + ] }), + /* @__PURE__ */ jsx("div", { class: "global-graph-outer", children: /* @__PURE__ */ jsx("div", { class: "global-graph-container", "data-cfg": JSON.stringify(globalGraph) }) }) + ] }); + }; + Graph.css = graph_default; + Graph.afterDOMLoaded = graph_inline_default; + return Graph; +}); + +export { Graph_default as Graph }; +//# sourceMappingURL=index.js.map +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/index.js.map b/dist/index.js.map new file mode 100644 index 0000000..b9239bd --- /dev/null +++ b/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/util/lang.ts","../src/i18n/locales/en-US.ts","../src/i18n/index.ts","../src/components/styles/graph.scss","../src/components/scripts/graph.inline.ts","../src/components/Graph.tsx"],"names":[],"mappings":";;;AAAO,SAAS,cAAc,OAAA,EAAwD;AACpF,EAAA,OAAO,OAAA,CAAQ,MAAA,CAAO,OAAO,CAAA,CAAE,KAAK,GAAG,CAAA;AACzC;;;ACFA,IAAO,aAAA,GAAQ;AAAA,EACb,UAAA,EAAY;AAAA,IACV,KAAA,EAAO;AAAA,MACL,KAAA,EAAO;AAAA;AACT;AAEJ,CAAA;;;ACJA,IAAM,OAAA,GAAuC;AAAA,EAC3C,OAAA,EAAS;AACX,CAAA;AAEO,SAAS,KAAK,MAAA,EAAgB;AACnC,EAAA,OAAO,OAAA,CAAQ,MAAM,CAAA,IAAK,aAAA;AAC5B;;;ACRA,IAAA,aAAA,GAAA,q7CAAA;;;ACAA,IAAA,oBAAA,GAAA,05mBAAA;ACgCA,IAAM,cAAA,GAA+B;AAAA,EACnC,UAAA,EAAY;AAAA,IACV,IAAA,EAAM,IAAA;AAAA,IACN,IAAA,EAAM,IAAA;AAAA,I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,IAAA,CAAC,KAAA,EAAA,EAAI,KAAA,EAAM,aAAA,EACT,QAAA,EAAA;AAAA,wBAAA,GAAA,CAAC,SAAI,KAAA,EAAM,iBAAA,EAAkB,YAAU,IAAA,CAAK,SAAA,CAAU,UAAU,CAAA,EAAG,CAAA;AAAA,wBACnE,GAAA,CAAC,QAAA,EAAA,EAAO,KAAA,EAAM,mBAAA,EAAoB,cAAW,cAAA,EAC3C,QAAA,kBAAA,GAAA;AAAA,UAAC,KAAA;AAAA,UAAA;AAAA,YACC,OAAA,EAAQ,KAAA;AAAA,YACR,KAAA,EAAM,4BAAA;AAAA,YACN,UAAA,EAAW,8BAAA;AAAA,YACX,CAAA,EAAE,KAAA;AAAA,YACF,CAAA,EAAE,KAAA;AAAA,YACF,OAAA,EAAQ,WAAA;AAAA,YACR,IAAA,EAAK,cAAA;AAAA,YACL,QAAA,EAAS,UAAA;AAAA,YAET,QAAA,kBAAA,GAAA;AAAA,cAAC,MAAA;AAAA,cAAA;AAAA,gBACC,CAAA,EAAE;AAAA;AAAA;AAWJ;AAAA,SACF,EACF;AAAA,OAAA,EACF,CAAA;AAAA,sBACA,GAAA,CAAC,KAAA,EAAA,EAAI,KAAA,EAAM,oBAAA,EACT,QAAA,kBAAA,GAAA,CAAC,KAAA,EAAA,EAAI,KAAA,EAAM,wBAAA,EAAyB,UAAA,EAAU,IAAA,CAAK,SAAA,CAAU,WAAW,GAAG,CAAA,EAC7E;AAAA,KAAA,EACF,CAAA;AAAA,EAEJ,CAAA;AAEA,EAAA,KAAA,CAAM,GAAA,GAAM,aAAA;AACZ,EAAA,KAAA,CAAM,cAAA,GAAiB,oBAAA;AAEvB,EAAA,OAAO,KAAA;AACT,CAAA","file":"index.js","sourcesContent":["export function classNames(...classes: (string | undefined | null | false)[]): string {\n return classes.filter(Boolean).join(\" \");\n}\n","export default {\n components: {\n graph: {\n title: \"Graph View\",\n },\n },\n};\n","import enUS from \"./locales/en-US\";\n\nconst locales: Record = {\n \"en-US\": enUS,\n};\n\nexport function i18n(locale: string) {\n return locales[locale] || enUS;\n}\n",".graph > h3 {\n font-size: 1rem;\n margin: 0;\n}\n.graph > .graph-outer {\n border-radius: 5px;\n border: 1px solid var(--lightgray);\n box-sizing: border-box;\n height: 250px;\n margin: 0.5em 0;\n position: relative;\n overflow: hidden;\n}\n.graph > .graph-outer > .global-graph-icon {\n cursor: pointer;\n background: none;\n border: none;\n color: var(--dark);\n opacity: 0.5;\n width: 24px;\n height: 24px;\n position: absolute;\n padding: 0.2rem;\n margin: 0.3rem;\n top: 0;\n right: 0;\n border-radius: 4px;\n background-color: transparent;\n transition: background-color 0.5s ease;\n}\n.graph > .graph-outer > .global-graph-icon:hover {\n background-color: var(--lightgray);\n}\n.graph > .global-graph-outer {\n position: fixed;\n z-index: 9999;\n left: 0;\n top: 0;\n width: 100vw;\n height: 100%;\n backdrop-filter: blur(4px);\n display: none;\n overflow: hidden;\n}\n.graph > .global-graph-outer.active {\n display: inline-block;\n}\n.graph > .global-graph-outer > .global-graph-container {\n border: 1px solid var(--lightgray);\n background-color: var(--light);\n border-radius: 5px;\n box-sizing: border-box;\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n height: 80vh;\n width: 80vw;\n}\n@media all and (max-width: 800px) {\n .graph > .global-graph-outer > .global-graph-container {\n width: 90%;\n }\n}\n\n.graph-container {\n width: 100%;\n height: 100%;\n}","var st=Object.hasOwnProperty;var se,B,ce,Xe,Y,ae,fe,_e,de,Mu,ju,Pu,Ye,Tu={},he=[],Ze=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,mu=Array.isArray;function H(u,e){for(var t in e)u[t]=e[t];return u}function Ru(u){u&&u.parentNode&&u.parentNode.removeChild(u)}function Lu(u,e,t,o,a){var n={type:u,props:e,key:t,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:a??++ce,__i:-1,__u:0};return a==null&&B.vnode!=null&&B.vnode(n),n}function iu(u){return u.children}function Au(u,e){this.props=u,this.context=e}function au(u,e){if(e==null)return u.__?au(u.__,u.__i+1):null;for(var t;ec&&Y.sort(_e),u=Y.shift(),c=Y.length,u.__d&&(t=void 0,o=void 0,a=(o=(e=u).__v).__e,n=[],F=[],e.__P&&((t=H({},o)).__v=o.__v+1,B.vnode&&B.vnode(t),Ee(e.__P,t,o,e.__n,e.__P.namespaceURI,32&o.__u?[a]:null,n,a??au(o),!!(32&o.__u),F),t.__v=o.__v,t.__.__k[t.__i]=t,et(n,t,F),o.__e=o.__=null,t.__e!=a&&Ce(t)));gu.__r=0}function pe(u,e,t,o,a,n,F,c,C,i,d){var r,g,s,m,j,y,p,v=o&&o.__k||he,M=e.length;for(C=Qe(t,e,v,C,M),r=0;r0?F=u.__k[n]=Lu(F.type,F.props,F.key,F.ref?F.ref:null,F.__v):u.__k[n]=F,C=n+g,F.__=u,F.__b=u.__b+1,c=null,(i=F.__i=ut(F,t,C,r))!=-1&&(r--,(c=t[i])&&(c.__u|=2)),c==null||c.__v==null?(i==-1&&(a>d?g--:aC?g--:g++,F.__u|=4))):u.__k[n]=null;if(r)for(n=0;n(d?1:0)){for(a=t-1,n=t+1;a>=0||n=0?a--:n++])!=null&&(2&i.__u)==0&&c==i.key&&C==i.type)return F}return-1}function le(u,e,t){e[0]==\"-\"?u.setProperty(e,t??\"\"):u[e]=t==null?\"\":typeof t!=\"number\"||Ze.test(e)?t:t+\"px\"}function Eu(u,e,t,o,a){var n,F;u:if(e==\"style\")if(typeof t==\"string\")u.style.cssText=t;else{if(typeof o==\"string\"&&(u.style.cssText=o=\"\"),o)for(e in o)t&&e in t||le(u.style,e,\"\");if(t)for(e in t)o&&t[e]==o[e]||le(u.style,e,t[e])}else if(e[0]==\"o\"&&e[1]==\"n\")n=e!=(e=e.replace(de,\"$1\")),F=e.toLowerCase(),e=F in u||e==\"onFocusOut\"||e==\"onFocusIn\"?F.slice(2):e.slice(2),u.l||(u.l={}),u.l[e+n]=t,t?o?t.u=o.u:(t.u=Mu,u.addEventListener(e,n?Pu:ju,n)):u.removeEventListener(e,n?Pu:ju,n);else{if(a==\"http://www.w3.org/2000/svg\")e=e.replace(/xlink(H|:h)/,\"h\").replace(/sName$/,\"s\");else if(e!=\"width\"&&e!=\"height\"&&e!=\"href\"&&e!=\"list\"&&e!=\"form\"&&e!=\"tabIndex\"&&e!=\"download\"&&e!=\"rowSpan\"&&e!=\"colSpan\"&&e!=\"role\"&&e!=\"popover\"&&e in u)try{u[e]=t??\"\";break u}catch{}typeof t==\"function\"||(t==null||t===!1&&e[4]!=\"-\"?u.removeAttribute(e):u.setAttribute(e,e==\"popover\"&&t==1?\"\":t))}}function Fe(u){return function(e){if(this.l){var t=this.l[e.type+u];if(e.t==null)e.t=Mu++;else if(e.t0?u:mu(u)?u.map(Ae):H({},u)}function tt(u,e,t,o,a,n,F,c,C){var i,d,r,g,s,m,j,y=t.props||Tu,p=e.props,v=e.type;if(v==\"svg\"?a=\"http://www.w3.org/2000/svg\":v==\"math\"?a=\"http://www.w3.org/1998/Math/MathML\":a||(a=\"http://www.w3.org/1999/xhtml\"),n!=null){for(i=0;i=0)for(var _u=[h],du=new Set([h]),$u=0;$u<=Gu&&_u.length>0;$u++){for(var Bu=[],yu=0;yu<_u.length;yu++){var bu=_u[yu];uu.add(bu);for(var xu=0;xu;\n globalGraph?: Partial;\n}\n\nconst defaultOptions: GraphOptions = {\n localGraph: {\n drag: true,\n zoom: true,\n depth: 1,\n scale: 1.1,\n repelForce: 0.5,\n centerForce: 0.3,\n linkDistance: 30,\n fontSize: 0.6,\n opacityScale: 1,\n showTags: true,\n removeTags: [],\n focusOnHover: false,\n enableRadial: false,\n },\n globalGraph: {\n drag: true,\n zoom: true,\n depth: -1,\n scale: 0.9,\n repelForce: 0.5,\n centerForce: 0.2,\n linkDistance: 30,\n fontSize: 0.6,\n opacityScale: 1,\n showTags: true,\n removeTags: [],\n focusOnHover: true,\n enableRadial: true,\n },\n};\n\nexport default ((userOpts?: Partial) => {\n const Graph: QuartzComponent = ({ displayClass, cfg }: QuartzComponentProps) => {\n const localGraph = { ...defaultOptions.localGraph, ...userOpts?.localGraph };\n const globalGraph = { ...defaultOptions.globalGraph, ...userOpts?.globalGraph };\n\n return (\n
\n

{i18n(cfg.locale ?? \"en-US\").components.graph.title}

\n
\n
\n \n
\n
\n
\n
\n
\n );\n };\n\n Graph.css = style;\n Graph.afterDOMLoaded = script;\n\n return Graph;\n}) satisfies QuartzComponentConstructor;\n"]} \ No newline at end of file diff --git a/dist/types.d.ts b/dist/types.d.ts new file mode 100644 index 0000000..c2903f8 --- /dev/null +++ b/dist/types.d.ts @@ -0,0 +1,42 @@ +export { BuildCtx, CSSResource, ChangeEvent, JSResource, ProcessedContent, QuartzEmitterPlugin, QuartzEmitterPluginInstance, QuartzFilterPlugin, QuartzFilterPluginInstance, QuartzPluginData, QuartzTransformerPlugin, QuartzTransformerPluginInstance, StaticResources } from '@quartz-community/types'; + +interface ExampleTransformerOptions { + /** Token used to highlight text, defaults to ==highlight== */ + highlightToken: string; + /** Add a CSS class to all headings in the rendered HTML. */ + headingClass: string; + /** Enable remark-gfm for tables/task lists. */ + enableGfm: boolean; + /** Enable adding slug IDs to headings. */ + addHeadingSlugs: boolean; +} +interface ExampleFilterOptions { + /** Allow pages marked draft: true to publish. */ + allowDrafts: boolean; + /** Exclude pages that contain any of these frontmatter tags. */ + excludeTags: string[]; + /** Exclude paths that start with any of these prefixes (relative to content root). */ + excludePathPrefixes: string[]; +} +interface ExampleEmitterOptions { + /** Filename to emit at the site root. */ + manifestSlug: string; + /** Whether to include the frontmatter block in the manifest. */ + includeFrontmatter: boolean; + /** Extra metadata to write at the top level of the manifest. */ + metadata: Record; + /** Optional hook to transform the emitted manifest JSON string. */ + transformManifest?: (json: string) => string; + /** Add a custom class to the emitted manifest