@edc4it/reveal.js-railroad 1.0.0

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.
@@ -0,0 +1,110 @@
1
+ (function(){"use strict";try{if(typeof document<"u"){var r=document.createElement("style");r.appendChild(document.createTextNode("svg.railroad-diagram{background-color:#f5f2f0}svg.railroad-diagram path{stroke-width:3;stroke:#000;fill:#0000}svg.railroad-diagram text{font:700 14px monospace;text-anchor:middle;white-space:pre}svg.railroad-diagram text.diagram-text{font-size:12px}svg.railroad-diagram text.diagram-arrow{font-size:16px}svg.railroad-diagram text.label{text-anchor:start}svg.railroad-diagram text.comment{font:italic 12px monospace}svg.railroad-diagram rect{stroke-width:3;stroke:#000;fill:#cfc}svg.railroad-diagram rect.group-box{stroke:gray;stroke-dasharray:10 5;fill:none}svg.railroad-diagram path.diagram-text{stroke-width:3;stroke:#000;fill:#fff;cursor:help}svg.railroad-diagram g.diagram-text:hover path.diagram-text{fill:#eee}:root{--rr-bg: ;--rr-textFill: ;--rr-pathStroke: ;--rr-rectFill: ;--rr-rectStroke: }svg.railroad-diagram{background-color:var(--rr-bg);width:100%;height:100%;max-height:100%}svg.railroad-diagram path{stroke:var(--rr-pathStroke)}svg.railroad-diagram rect{stroke-width:2;stroke:var(--rr-rectStroke);fill:var(--rr-rectFill)}svg.railroad-diagram text{fill:var(--rr-textFill)}")),document.head.appendChild(r)}}catch(a){console.error("vite-plugin-css-injected-by-js",a)}})();
2
+ function applyStyle(e, t) {
3
+ e.style.setProperty("--rr-bg", t.bg), e.style.setProperty("--rr-textFill", t.textFill), e.style.setProperty("--rr-pathStroke", t.pathStroke), e.style.setProperty("--rr-rectFill", t.rectFill), e.style.setProperty("--rr-rectStroke", t.rectStroke);
4
+ }
5
+ function run(revealElement, options) {
6
+ applyStyle(revealElement, options), import("./railroad-D1NexFHb.mjs").then((rr) => {
7
+ Object.assign(window, rr.default), document.querySelectorAll("script[type='application/railroad']").forEach((s) => {
8
+ try {
9
+ const r = eval(s.innerHTML), div = document.createElement("div");
10
+ div.classList.add("railroad-diagram"), r.addTo(div), s.replaceWith(div);
11
+ } catch (e) {
12
+ console.error("error with railroad diagrams: ", e);
13
+ }
14
+ });
15
+ });
16
+ }
17
+ function getDefaultExportFromCjs(e) {
18
+ return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
19
+ }
20
+ var isMergeableObject = function e(t) {
21
+ return isNonNullObject(t) && !isSpecial(t);
22
+ };
23
+ function isNonNullObject(e) {
24
+ return !!e && typeof e == "object";
25
+ }
26
+ function isSpecial(e) {
27
+ var t = Object.prototype.toString.call(e);
28
+ return t === "[object RegExp]" || t === "[object Date]" || isReactElement(e);
29
+ }
30
+ var canUseSymbol = typeof Symbol == "function" && Symbol.for, REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for("react.element") : 60103;
31
+ function isReactElement(e) {
32
+ return e.$$typeof === REACT_ELEMENT_TYPE;
33
+ }
34
+ function emptyTarget(e) {
35
+ return Array.isArray(e) ? [] : {};
36
+ }
37
+ function cloneUnlessOtherwiseSpecified(e, t) {
38
+ return t.clone !== !1 && t.isMergeableObject(e) ? deepmerge(emptyTarget(e), e, t) : e;
39
+ }
40
+ function defaultArrayMerge(e, t, n) {
41
+ return e.concat(t).map(function(l) {
42
+ return cloneUnlessOtherwiseSpecified(l, n);
43
+ });
44
+ }
45
+ function getMergeFunction(e, t) {
46
+ if (!t.customMerge)
47
+ return deepmerge;
48
+ var n = t.customMerge(e);
49
+ return typeof n == "function" ? n : deepmerge;
50
+ }
51
+ function getEnumerableOwnPropertySymbols(e) {
52
+ return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(e).filter(function(t) {
53
+ return Object.propertyIsEnumerable.call(e, t);
54
+ }) : [];
55
+ }
56
+ function getKeys(e) {
57
+ return Object.keys(e).concat(getEnumerableOwnPropertySymbols(e));
58
+ }
59
+ function propertyIsOnObject(e, t) {
60
+ try {
61
+ return t in e;
62
+ } catch {
63
+ return !1;
64
+ }
65
+ }
66
+ function propertyIsUnsafe(e, t) {
67
+ return propertyIsOnObject(e, t) && !(Object.hasOwnProperty.call(e, t) && Object.propertyIsEnumerable.call(e, t));
68
+ }
69
+ function mergeObject(e, t, n) {
70
+ var l = {};
71
+ return n.isMergeableObject(e) && getKeys(e).forEach(function(c) {
72
+ l[c] = cloneUnlessOtherwiseSpecified(e[c], n);
73
+ }), getKeys(t).forEach(function(c) {
74
+ propertyIsUnsafe(e, c) || (propertyIsOnObject(e, c) && n.isMergeableObject(t[c]) ? l[c] = getMergeFunction(c, n)(e[c], t[c], n) : l[c] = cloneUnlessOtherwiseSpecified(t[c], n));
75
+ }), l;
76
+ }
77
+ function deepmerge(e, t, n) {
78
+ n = n || {}, n.arrayMerge = n.arrayMerge || defaultArrayMerge, n.isMergeableObject = n.isMergeableObject || isMergeableObject, n.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
79
+ var l = Array.isArray(t), c = Array.isArray(e), i = l === c;
80
+ return i ? l ? n.arrayMerge(e, t, n) : mergeObject(e, t, n) : cloneUnlessOtherwiseSpecified(t, n);
81
+ }
82
+ deepmerge.all = function e(t, n) {
83
+ if (!Array.isArray(t))
84
+ throw new Error("first argument should be an array");
85
+ return t.reduce(function(l, c) {
86
+ return deepmerge(l, c, n);
87
+ }, {});
88
+ };
89
+ var deepmerge_1 = deepmerge, cjs = deepmerge_1;
90
+ const merge = /* @__PURE__ */ getDefaultExportFromCjs(cjs), defaultOptions = {
91
+ bg: "unset",
92
+ pathStroke: "#82e4ff",
93
+ rectFill: "#00a6ff",
94
+ rectStroke: "white",
95
+ textFill: "white"
96
+ }, plugin = () => ({
97
+ id: "railroad",
98
+ init: (e) => {
99
+ const t = e.getRevealElement();
100
+ if (!t)
101
+ console.error("Cannot find reveal element");
102
+ else {
103
+ const l = e.getConfig().railroad ?? {}, c = merge(defaultOptions, l);
104
+ run(t, c);
105
+ }
106
+ }
107
+ });
108
+ export {
109
+ plugin as default
110
+ };
@@ -0,0 +1,57 @@
1
+ (function(){"use strict";try{if(typeof document<"u"){var r=document.createElement("style");r.appendChild(document.createTextNode("svg.railroad-diagram{background-color:#f5f2f0}svg.railroad-diagram path{stroke-width:3;stroke:#000;fill:#0000}svg.railroad-diagram text{font:700 14px monospace;text-anchor:middle;white-space:pre}svg.railroad-diagram text.diagram-text{font-size:12px}svg.railroad-diagram text.diagram-arrow{font-size:16px}svg.railroad-diagram text.label{text-anchor:start}svg.railroad-diagram text.comment{font:italic 12px monospace}svg.railroad-diagram rect{stroke-width:3;stroke:#000;fill:#cfc}svg.railroad-diagram rect.group-box{stroke:gray;stroke-dasharray:10 5;fill:none}svg.railroad-diagram path.diagram-text{stroke-width:3;stroke:#000;fill:#fff;cursor:help}svg.railroad-diagram g.diagram-text:hover path.diagram-text{fill:#eee}:root{--rr-bg: ;--rr-textFill: ;--rr-pathStroke: ;--rr-rectFill: ;--rr-rectStroke: }svg.railroad-diagram{background-color:var(--rr-bg);width:100%;height:100%;max-height:100%}svg.railroad-diagram path{stroke:var(--rr-pathStroke)}svg.railroad-diagram rect{stroke-width:2;stroke:var(--rr-rectStroke);fill:var(--rr-rectFill)}svg.railroad-diagram text{fill:var(--rr-textFill)}")),document.head.appendChild(r)}}catch(a){console.error("vite-plugin-css-injected-by-js",a)}})();
2
+ (function(_,n){typeof exports=="object"&&typeof module<"u"?module.exports=n():typeof define=="function"&&define.amd?define(n):(_=typeof globalThis<"u"?globalThis:_||self,_.ClipCode=n())})(this,function(){"use strict";var k=Object.defineProperty;var E=(_,n,t)=>n in _?k(_,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):_[n]=t;var P=(_,n,t)=>(E(_,typeof n!="symbol"?n+"":n,t),t);function applyStyle(n,t){n.style.setProperty("--rr-bg",t.bg),n.style.setProperty("--rr-textFill",t.textFill),n.style.setProperty("--rr-pathStroke",t.pathStroke),n.style.setProperty("--rr-rectFill",t.rectFill),n.style.setProperty("--rr-rectStroke",t.rectStroke)}function run(revealElement,options){applyStyle(revealElement,options),Promise.resolve().then(()=>railroad).then(rr=>{Object.assign(window,rr.default),document.querySelectorAll("script[type='application/railroad']").forEach(s=>{try{const r=eval(s.innerHTML),div=document.createElement("div");div.classList.add("railroad-diagram"),r.addTo(div),s.replaceWith(div)}catch(n){console.error("error with railroad diagrams: ",n)}})})}function getDefaultExportFromCjs(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var isMergeableObject=function n(t){return isNonNullObject(t)&&!isSpecial(t)};function isNonNullObject(n){return!!n&&typeof n=="object"}function isSpecial(n){var t=Object.prototype.toString.call(n);return t==="[object RegExp]"||t==="[object Date]"||isReactElement(n)}var canUseSymbol=typeof Symbol=="function"&&Symbol.for,REACT_ELEMENT_TYPE=canUseSymbol?Symbol.for("react.element"):60103;function isReactElement(n){return n.$$typeof===REACT_ELEMENT_TYPE}function emptyTarget(n){return Array.isArray(n)?[]:{}}function cloneUnlessOtherwiseSpecified(n,t){return t.clone!==!1&&t.isMergeableObject(n)?deepmerge(emptyTarget(n),n,t):n}function defaultArrayMerge(n,t,e){return n.concat(t).map(function(h){return cloneUnlessOtherwiseSpecified(h,e)})}function getMergeFunction(n,t){if(!t.customMerge)return deepmerge;var e=t.customMerge(n);return typeof e=="function"?e:deepmerge}function getEnumerableOwnPropertySymbols(n){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(n).filter(function(t){return Object.propertyIsEnumerable.call(n,t)}):[]}function getKeys(n){return Object.keys(n).concat(getEnumerableOwnPropertySymbols(n))}function propertyIsOnObject(n,t){try{return t in n}catch{return!1}}function propertyIsUnsafe(n,t){return propertyIsOnObject(n,t)&&!(Object.hasOwnProperty.call(n,t)&&Object.propertyIsEnumerable.call(n,t))}function mergeObject(n,t,e){var h={};return e.isMergeableObject(n)&&getKeys(n).forEach(function(i){h[i]=cloneUnlessOtherwiseSpecified(n[i],e)}),getKeys(t).forEach(function(i){propertyIsUnsafe(n,i)||(propertyIsOnObject(n,i)&&e.isMergeableObject(t[i])?h[i]=getMergeFunction(i,e)(n[i],t[i],e):h[i]=cloneUnlessOtherwiseSpecified(t[i],e))}),h}function deepmerge(n,t,e){e=e||{},e.arrayMerge=e.arrayMerge||defaultArrayMerge,e.isMergeableObject=e.isMergeableObject||isMergeableObject,e.cloneUnlessOtherwiseSpecified=cloneUnlessOtherwiseSpecified;var h=Array.isArray(t),i=Array.isArray(n),a=h===i;return a?h?e.arrayMerge(n,t,e):mergeObject(n,t,e):cloneUnlessOtherwiseSpecified(t,e)}deepmerge.all=function n(t,e){if(!Array.isArray(t))throw new Error("first argument should be an array");return t.reduce(function(h,i){return deepmerge(h,i,e)},{})};var deepmerge_1=deepmerge,cjs=deepmerge_1;const merge=getDefaultExportFromCjs(cjs),defaultOptions={bg:"unset",pathStroke:"#82e4ff",rectFill:"#00a6ff",rectStroke:"white",textFill:"white"},plugin=()=>({id:"railroad",init:n=>{const t=n.getRevealElement();if(!t)console.error("Cannot find reveal element");else{const h=n.getConfig().railroad??{},i=merge(defaultOptions,h);run(t,i)}}}),funcs={},Options={DEBUG:!1,VS:8,AR:10,DIAGRAM_CLASS:"railroad-diagram",STROKE_ODD_PIXEL_LENGTH:!0,INTERNAL_ALIGNMENT:"center",CHAR_WIDTH:8.5,COMMENT_CHAR_WIDTH:7,ESCAPE_HTML:!0},defaultCSS=`
3
+ svg {
4
+ background-color: hsl(30,20%,95%);
5
+ }
6
+ path {
7
+ stroke-width: 3;
8
+ stroke: black;
9
+ fill: rgba(0,0,0,0);
10
+ }
11
+ text {
12
+ font: bold 14px monospace;
13
+ text-anchor: middle;
14
+ white-space: pre;
15
+ }
16
+ text.diagram-text {
17
+ font-size: 12px;
18
+ }
19
+ text.diagram-arrow {
20
+ font-size: 16px;
21
+ }
22
+ text.label {
23
+ text-anchor: start;
24
+ }
25
+ text.comment {
26
+ font: italic 12px monospace;
27
+ }
28
+ g.non-terminal text {
29
+ /*font-style: italic;*/
30
+ }
31
+ rect {
32
+ stroke-width: 3;
33
+ stroke: black;
34
+ fill: hsl(120,100%,90%);
35
+ }
36
+ rect.group-box {
37
+ stroke: gray;
38
+ stroke-dasharray: 10 5;
39
+ fill: none;
40
+ }
41
+ path.diagram-text {
42
+ stroke-width: 3;
43
+ stroke: black;
44
+ fill: white;
45
+ cursor: help;
46
+ }
47
+ g.diagram-text:hover path.diagram-text {
48
+ fill: #eee;
49
+ }`;class FakeSVG{constructor(t,e,h){h?this.children=h:this.children=[],this.tagName=t,this.attrs=unnull(e,{})}format(t,e,h){}addTo(t){if(t instanceof FakeSVG)return t.children.push(this),this;var e=this.toSVG();return t.appendChild(e),e}toSVG(){var t=SVG(this.tagName,this.attrs);return typeof this.children=="string"?t.textContent=this.children:this.children.forEach(function(e){t.appendChild(e.toSVG())}),t}toString(){var t="<"+this.tagName,e=this.tagName=="g"||this.tagName=="svg";for(var h in this.attrs)t+=" "+h+'="'+(this.attrs[h]+"").replace(/&/g,"&amp;").replace(/"/g,"&quot;")+'"';return t+=">",e&&(t+=`
50
+ `),typeof this.children=="string"?t+=escapeString(this.children):this.children.forEach(function(i){t+=i}),t+="</"+this.tagName+`>
51
+ `,t}toTextDiagram(){return new TextDiagram(0,0,[])}toText(){var t=this.toTextDiagram(),e=t.lines.join(`
52
+ `)+`
53
+ `;return Options.ESCAPE_HTML&&(e=e.replace("&","&amp;").replace("<","&lt;").replace(">","&gt;").replace('"',"&quot;")),e}walk(t){t(this)}}class Path extends FakeSVG{constructor(t,e){super("path"),this.attrs.d="M"+t+" "+e}m(t,e){return this.attrs.d+="m"+t+" "+e,this}h(t){return this.attrs.d+="h"+t,this}right(t){return this.h(Math.max(0,t))}left(t){return this.h(-Math.max(0,t))}v(t){return this.attrs.d+="v"+t,this}down(t){return this.v(Math.max(0,t))}up(t){return this.v(-Math.max(0,t))}arc(t){var e=Options.AR,h=Options.AR;(t[0]=="e"||t[1]=="w")&&(e*=-1),(t[0]=="s"||t[1]=="n")&&(h*=-1);var i;return t=="ne"||t=="es"||t=="sw"||t=="wn"?i=1:i=0,this.attrs.d+="a"+Options.AR+" "+Options.AR+" 0 0 "+i+" "+e+" "+h,this}arc_8(t,e){const h=Options.AR,i=1/Math.sqrt(2)*h,a=h-i;let d="a "+h+" "+h+" 0 0 "+(e=="cw"?"1":"0")+" ";const p=t+e,w=p=="ncw"?[i,a]:p=="necw"?[a,i]:p=="ecw"?[-a,i]:p=="secw"?[-i,a]:p=="scw"?[-i,-a]:p=="swcw"?[-a,-i]:p=="wcw"?[a,-i]:p=="nwcw"?[i,-a]:p=="nccw"?[-i,a]:p=="nwccw"?[-a,i]:p=="wccw"?[a,i]:p=="swccw"?[i,a]:p=="sccw"?[i,-a]:p=="seccw"?[a,-i]:p=="eccw"?[-a,-i]:p=="neccw"?[-i,-a]:null;return d+=w.join(" "),this.attrs.d+=d,this}l(t,e){return this.attrs.d+="l"+t+" "+e,this}format(){return this.attrs.d+="h.5",this}toTextDiagram(){return new TextDiagram(0,0,[])}}class DiagramMultiContainer extends FakeSVG{constructor(t,e,h,i){super(t,h,i),this.items=e.map(wrapString)}walk(t){t(this),this.items.forEach(e=>e.walk(t))}}class Diagram extends DiagramMultiContainer{constructor(...t){super("svg",t,{class:Options.DIAGRAM_CLASS}),this.items[0]instanceof Start||this.items.unshift(new Start),this.items[this.items.length-1]instanceof End||this.items.push(new End),this.up=this.down=this.height=this.width=0;for(const e of this.items)this.width+=e.width+(e.needsSpace?20:0),this.up=Math.max(this.up,e.up-this.height),this.height+=e.height,this.down=Math.max(this.down-e.height,e.down);this.formatted=!1}format(t,e,h,i){t=unnull(t,20),e=unnull(e,t,20),h=unnull(h,t,20),i=unnull(i,e,20);var a=i,d=t;d+=this.up;for(var p=new FakeSVG("g",Options.STROKE_ODD_PIXEL_LENGTH?{transform:"translate(.5 .5)"}:{}),w=0;w<this.items.length;w++){var l=this.items[w];l.needsSpace&&(new Path(a,d).h(10).addTo(p),a+=10),l.format(a,d,l.width).addTo(p),a+=l.width,d+=l.height,l.needsSpace&&(new Path(a,d).h(10).addTo(p),a+=10)}return this.attrs.width=this.width+i+e,this.attrs.height=this.up+this.height+this.down+t+h,this.attrs.viewBox="0 0 "+this.attrs.width+" "+this.attrs.height,p.addTo(this),this.formatted=!0,this}addTo(t){if(!t){var e=document.getElementsByTagName("script");e=e[e.length-1],t=e.parentNode}return super.addTo.call(this,t)}toSVG(){return this.formatted||this.format(),super.toSVG.call(this)}toString(){return this.formatted||this.format(),super.toString.call(this)}toStandalone(t){this.formatted||this.format();const e=new FakeSVG("style",{},t||defaultCSS);this.children.push(e),this.attrs.xmlns="http://www.w3.org/2000/svg",this.attrs["xmlns:xlink"]="http://www.w3.org/1999/xlink";const h=super.toString.call(this);return this.children.pop(),delete this.attrs.xmlns,h}toTextDiagram(){var[t]=TextDiagram._getParts(["separator"]),e=this.items[0].toTextDiagram();for(const i of this.items.slice(1)){var h=i.toTextDiagram();i.needsSpace&&(h=h.expand(1,1,0,0)),e=e.appendRight(h,t)}return e}}funcs.Diagram=(...n)=>new Diagram(...n);class ComplexDiagram extends FakeSVG{constructor(...t){var e=new Diagram(...t);return e.items[0]=new Start({type:"complex"}),e.items[e.items.length-1]=new End({type:"complex"}),e}}funcs.ComplexDiagram=(...n)=>new ComplexDiagram(...n);class Sequence extends DiagramMultiContainer{constructor(...t){super("g",t),this.items.length,this.needsSpace=!0,this.up=this.down=this.height=this.width=0;for(var e=0;e<this.items.length;e++){var h=this.items[e];this.width+=h.width+(h.needsSpace?20:0),this.up=Math.max(this.up,h.up-this.height),this.height+=h.height,this.down=Math.max(this.down-h.height,h.down)}this.items[0].needsSpace&&(this.width-=10),this.items[this.items.length-1].needsSpace&&(this.width-=10),Options.DEBUG&&(this.attrs["data-updown"]=this.up+" "+this.height+" "+this.down,this.attrs["data-type"]="sequence")}format(t,e,h){var i=determineGaps(h,this.width);new Path(t,e).h(i[0]).addTo(this),new Path(t+i[0]+this.width,e+this.height).h(i[1]).addTo(this),t+=i[0];for(var a=0;a<this.items.length;a++){var d=this.items[a];d.needsSpace&&a>0&&(new Path(t,e).h(10).addTo(this),t+=10),d.format(t,e,d.width).addTo(this),t+=d.width,e+=d.height,d.needsSpace&&a<this.items.length-1&&(new Path(t,e).h(10).addTo(this),t+=10)}return this}toTextDiagram(){var[t]=TextDiagram._getParts(["separator"]),e=new TextDiagram(0,0,[""]);for(const i of this.items){var h=i.toTextDiagram();i.needsSpace&&(h=h.expand(1,1,0,0)),e=e.appendRight(h,t)}return e}}funcs.Sequence=(...n)=>new Sequence(...n);class Stack extends DiagramMultiContainer{constructor(...t){if(super("g",t),t.length===0)throw new RangeError("Stack() must have at least one child.");this.width=Math.max.apply(null,this.items.map(function(a){return a.width+(a.needsSpace?20:0)})),this.items.length>1&&(this.width+=Options.AR*2),this.needsSpace=!0,this.up=this.items[0].up,this.down=this.items[this.items.length-1].down,this.height=0;for(var e=this.items.length-1,h=0;h<this.items.length;h++){var i=this.items[h];this.height+=i.height,h>0&&(this.height+=Math.max(Options.AR*2,i.up+Options.VS)),h<e&&(this.height+=Math.max(Options.AR*2,i.down+Options.VS))}Options.DEBUG&&(this.attrs["data-updown"]=this.up+" "+this.height+" "+this.down,this.attrs["data-type"]="stack")}format(t,e,h){var i=determineGaps(h,this.width);new Path(t,e).h(i[0]).addTo(this),t+=i[0];var a=t;this.items.length>1&&(new Path(t,e).h(Options.AR).addTo(this),t+=Options.AR);for(var d=0;d<this.items.length;d++){var p=this.items[d],w=this.width-(this.items.length>1?Options.AR*2:0);p.format(t,e,w).addTo(this),t+=w,e+=p.height,d!==this.items.length-1&&(new Path(t,e).arc("ne").down(Math.max(0,p.down+Options.VS-Options.AR*2)).arc("es").left(w).arc("nw").down(Math.max(0,this.items[d+1].up+Options.VS-Options.AR*2)).arc("ws").addTo(this),e+=Math.max(p.down+Options.VS,Options.AR*2)+Math.max(this.items[d+1].up+Options.VS,Options.AR*2),t=a+Options.AR)}return this.items.length>1&&(new Path(t,e).h(Options.AR).addTo(this),t+=Options.AR),new Path(t,e).h(i[1]).addTo(this),this}toTextDiagram(){var[t,e,h,i,a,d]=TextDiagram._getParts(["corner_bot_left","corner_bot_right","corner_top_left","corner_top_right","line","line_vertical"]),p=[];for(const x of this.items)p.push(x.toTextDiagram());var w=Math.max(...p.map(function(x){return x.width})),l=[],g=[],c=new TextDiagram(0,0,[a.repeat(w)]),o=null;for(var[u,f]of enumerate(p)){if(u==0){l.push(a+a);for(var v=0;v<f.height-f.entry-1;v++)l.push(" ")}else{for(o=o.appendBelow(c,[]),l.push(h+a),v=0;v<f.entry;v++)l.push(d+" ");for(l.push(t+a),v=0;v<f.height-f.entry-1;v++)l.push(" ");for(v=0;v<f.exit;v++)g.push(" ")}if(u<p.length-1){for(g.push(a+i),v=0;v<f.height-f.exit-1;v++)g.push(" "+d);g.push(a+e)}else g.push(a+a);var[T,m]=TextDiagram._gaps(w,f.width);f=f.expand(T,m,0,0),u==0?o=f:o=o.appendBelow(f,[])}var O=new TextDiagram(0,0,l);o=O.appendRight(o,"");var M=new TextDiagram(0,g.length-1,g);return o=o.appendRight(M,""),o}}funcs.Stack=(...n)=>new Stack(...n);class OptionalSequence extends DiagramMultiContainer{constructor(...t){if(super("g",t),t.length===0)throw new RangeError("OptionalSequence() must have at least one child.");if(t.length===1)return new Sequence(t);var e=Options.AR;this.needsSpace=!1,this.width=0,this.up=0,this.height=sum(this.items,function(p){return p.height}),this.down=this.items[0].down;for(var h=0,i=0;i<this.items.length;i++){var a=this.items[i];this.up=Math.max(this.up,Math.max(e*2,a.up+Options.VS)-h),h+=a.height,i>0&&(this.down=Math.max(this.height+this.down,h+Math.max(e*2,a.down+Options.VS))-this.height);var d=(a.needsSpace?10:0)+a.width;i===0?this.width+=e+Math.max(d,e):this.width+=e*2+Math.max(d,e)+e}Options.DEBUG&&(this.attrs["data-updown"]=this.up+" "+this.height+" "+this.down,this.attrs["data-type"]="optseq")}format(t,e,h){var i=Options.AR,a=determineGaps(h,this.width);new Path(t,e).right(a[0]).addTo(this),new Path(t+a[0]+this.width,e+this.height).right(a[1]).addTo(this),t+=a[0];for(var d=e-this.up,p=this.items.length-1,w=0;w<this.items.length;w++){var l=this.items[w],g=l.needsSpace?10:0,c=l.width+g;w===0?(new Path(t,e).arc("se").up(e-d-i*2).arc("wn").right(c-i).arc("ne").down(e+l.height-d-i*2).arc("ws").addTo(this),new Path(t,e).right(g+i).addTo(this),l.format(t+g+i,e,l.width).addTo(this),t+=c+i,e+=l.height):w<p?(new Path(t,d).right(i*2+Math.max(c,i)+i).arc("ne").down(e-d+l.height-i*2).arc("ws").addTo(this),new Path(t,e).right(i*2).addTo(this),l.format(t+i*2,e,l.width).addTo(this),new Path(t+l.width+i*2,e+l.height).right(g+i).addTo(this),new Path(t,e).arc("ne").down(l.height+Math.max(l.down+Options.VS,i*2)-i*2).arc("ws").right(c-i).arc("se").up(l.down+Options.VS-i*2).arc("wn").addTo(this),t+=i*2+Math.max(c,i)+i,e+=l.height):(new Path(t,e).right(i*2).addTo(this),l.format(t+i*2,e,l.width).addTo(this),new Path(t+i*2+l.width,e+l.height).right(g+i).addTo(this),new Path(t,e).arc("ne").down(l.height+Math.max(l.down+Options.VS,i*2)-i*2).arc("ws").right(c-i).arc("se").up(l.down+Options.VS-i*2).arc("wn").addTo(this))}return this}toTextDiagram(){var[t,e,h,i,a,d]=TextDiagram._getParts(["line","line_vertical","roundcorner_bot_left","roundcorner_bot_right","roundcorner_top_left","roundcorner_top_right"]),p=[];for(const S of this.items)p.push(S.toTextDiagram());for(var w=Math.max(...p.map(function(S){return S.entry})),l=Math.max(...p.slice(0,-1).map(function(S){return S.entry})),g=w-l,c=[],o=0;o<g;o++)c.push(" ");for(c.push(a+t),o=0;o<l;o++)c.push(e+" ");c.push(i+t);var u=new TextDiagram(c.length-1,c.length-1,c);for(const[S,b]of enumerate(p)){if(S>0){for(c=[],o=0;o<g;o++)c.push(" ");for(c.push(t+t),o=0;o<u.exit-g-1;o++)c.push(" ");for(c.push(t+d),o=0;o<b.height-b.entry-1;o++)c.push(" "+e);c.push(" "+h);var f=new TextDiagram(u.exit,u.exit,c);for(u=u.appendRight(f,""),c=[],o=0;o<g;o++)c.push(" ");var v=S<p.length-1?t:" ";for(c.push(t+d+v),o=0;o<u.exit-g-1;o++)c.push(" "+e+" ");for(c.push(t+h+t),o=0;o<b.height-b.entry-1;o++)c.push(" ");c.push(t+t+t);var T=new TextDiagram(u.exit,u.exit,c);u=u.appendRight(T,"")}var m=new TextDiagram(0,0,[]);if(S<p.length-1){for(c=[],c.push(t.repeat(b.width)),o=0;o<l-b.entry;o++)c.push(" ".repeat(b.width));var O=new TextDiagram(0,0,c);m=m.appendBelow(O,[])}if(m=m.appendBelow(b,[],!0,!0),S>0){var M=new TextDiagram(0,0,[t.repeat(b.width)]);m=m.appendBelow(M,[])}if(u=u.appendRight(m,""),0<S){for(c=[],o=0;o<g;o++)c.push(" ");var x=S<p.length-1?t:" ";for(c.push(x.repeat(2)),o=0;o<u.exit-g-1;o++)c.push(" ");for(c.push(t+a),o=0;o<m.height-m.exit-2;o++)c.push(" "+e);c.push(t+i);var A=new TextDiagram(u.exit,u.exit,c);u=u.appendRight(A,"")}}return u}}funcs.OptionalSequence=(...n)=>new OptionalSequence(...n);class AlternatingSequence extends DiagramMultiContainer{constructor(...t){if(super("g",t),t.length===1)return new Sequence(t);if(t.length!==2)throw new RangeError("AlternatingSequence() must have one or two children.");this.needsSpace=!1;const e=Options.AR,h=Options.VS,i=Math.max,a=this.items[0],d=this.items[1],p=1/Math.sqrt(2)*e*2,w=(1-1/Math.sqrt(2))*e*2,l=Math.max(e,Options.VS),g=l-w+p,c=i(e+e,l/2+e+e,l/2+h+a.down);this.up=c+a.height+a.up;const o=i(e+e,l/2+e+e,l/2+h+d.up);this.down=o+d.height+d.down,this.height=0;const u=2*(a.needsSpace?10:0)+a.width,f=2*(d.needsSpace?10:0)+d.width;this.width=2*e+i(u,g,f)+2*e,Options.DEBUG&&(this.attrs["data-updown"]=this.up+" "+this.height+" "+this.down,this.attrs["data-type"]="altseq")}format(t,e,h){const i=Options.AR,a=determineGaps(h,this.width);new Path(t,e).right(a[0]).addTo(this),t+=a[0],new Path(t+this.width,e).right(a[1]).addTo(this);const d=this.items[0],p=this.items[1],w=this.up-d.up,l=this.up-d.up-d.height;new Path(t,e).arc("se").up(w-2*i).arc("wn").addTo(this),d.format(t+2*i,e-w,this.width-4*i).addTo(this),new Path(t+this.width-2*i,e-l).arc("ne").down(l-2*i).arc("ws").addTo(this);const g=this.down-p.down-p.height,c=this.down-p.down;new Path(t,e).arc("ne").down(g-2*i).arc("ws").addTo(this),p.format(t+2*i,e+g,this.width-4*i).addTo(this),new Path(t+this.width-2*i,e+c).arc("se").up(c-2*i).arc("wn").addTo(this);const o=1/Math.sqrt(2)*i*2,u=(1-1/Math.sqrt(2))*i*2,f=Math.max(i,Options.VS),v=f-u+o,T=(this.width-4*i-v)/2;return new Path(t+i,e-f/2-i).arc("ws").right(T).arc_8("n","cw").l(v-o,f-u).arc_8("sw","ccw").right(T).arc("ne").addTo(this),new Path(t+i,e+f/2+i).arc("wn").right(T).arc_8("s","ccw").l(v-o,-(f-u)).arc_8("nw","cw").right(T).arc("se").addTo(this),this}toTextDiagram(){for(var[t,e,h,i,a,d,p,w,l]=TextDiagram._getParts(["cross_diag","roundcorner_bot_left","roundcorner_bot_right","roundcorner_top_left","roundcorner_top_right","line","line_vertical","tee_left","tee_right"]),g=this.items[0].toTextDiagram(),c=this.items[1].toTextDiagram(),o=TextDiagram._maxWidth(g,c),[u,f]=TextDiagram._gaps(o,0),v=[],T=[],m=[],[O,M]=TextDiagram._gaps(g.width,0),x=g.expand(u-O,f-M,0,0),A=0;A<x.entry;A++)v.push(" ");for(v.push(i+d),A=0;A<x.height-x.entry-1;A++)v.push(p+" ");for(v.push(e+d),A=0;A<x.exit;A++)T.push(" ");for(T.push(d+a),A=0;A<x.height-x.exit-1;A++)T.push(" "+p);for(T.push(d+h),m.push(d.repeat(u-1)+a+" "+i+d.repeat(f-2)),m.push(" ".repeat(u-1)+" "+t+" "+" ".repeat(f-2)),m.push(d.repeat(u-1)+h+" "+e+d.repeat(f-2)),v.push(" "),T.push(" "),[O,M]=TextDiagram._gaps(c.width,0),c=c.expand(u-O,f-M,0,0),x=x.appendBelow(c,m,!0,!0),v.push(i+d),A=0;A<c.entry;A++)v.push(p+" ");for(v.push(e+d),T.push(d+a),A=0;A<c.exit;A++)T.push(" "+p);T.push(d+h),x=x.alter(g.height+Math.trunc(m.length/2),g.height+Math.trunc(m.length/2));var S=new TextDiagram(g.height+Math.trunc(m.length/2),g.height+Math.trunc(m.length/2),v),b=new TextDiagram(g.height+Math.trunc(m.length/2),g.height+Math.trunc(m.length/2),T);return x=S.appendRight(x,"").appendRight(b,""),x=new TextDiagram(1,1,[i,w,e]).appendRight(x,"").appendRight(new TextDiagram(1,1,[a,l,h]),""),x}}funcs.AlternatingSequence=(...n)=>new AlternatingSequence(...n);class Choice extends DiagramMultiContainer{constructor(t,...e){if(super("g",e),typeof t!="number"||t!==Math.floor(t))throw new TypeError("The first argument of Choice() must be an integer.");if(t<0||t>=e.length)throw new RangeError("The first argument of Choice() must be an index for one of the items.");this.normal=t,this.width=max(this.items,w=>w.width)+Options.AR*4;var h=this.items[0],i=this.items[e.length-1],a=this.items[t];this.separators=Array.from({length:e.length-1},w=>0),this.up=0;for(var d,p=t-1;p>=0;p--){p==t-1?d=Options.AR*2:d=Options.AR;let w=this.items[p],l=this.items[p+1],g=l.up+Options.VS+w.down+w.height,c=l.height+l.up+Options.VS+w.down,o=Options.VS;(c<d||g<d)&&(o+=Math.max(d-g,d-c)),this.separators[p]=o,this.up+=l.up+o+w.down+w.height}this.up+=h.up,this.height=a.height,this.down=0;for(var p=t+1;p<this.items.length;p++){p==t+1?d=Options.AR*2:d=Options.AR;let l=this.items[p],g=this.items[p-1],c=g.height+g.down+Options.VS+l.up,o=g.down+Options.VS+l.up+l.height,u=Options.VS;(c<d||o<d)&&(u+=Math.max(d-c,d-o)),this.separators[p-1]=u,this.down+=g.down+u+l.up+l.height}this.down+=i.down,Options.DEBUG&&(this.attrs["data-updown"]=this.up+" "+this.height+" "+this.down,this.attrs["data-type"]="choice")}format(t,e,h){var i=determineGaps(h,this.width);new Path(t,e).h(i[0]).addTo(this),new Path(t+i[0]+this.width,e+this.height).h(i[1]).addTo(this),t+=i[0];for(var a=this.items.length-1,d=this.width-Options.AR*4,w=0,p=this.normal-1;p>=0;p--){let l=this.items[p],g=this.items[p+1];w+=g.up+this.separators[p]+l.down+l.height,new Path(t,e).arc("se").up(w-Options.AR*2).arc("wn").addTo(this),l.format(t+Options.AR*2,e-w,d).addTo(this),new Path(t+Options.AR*2+d,e-w+l.height).arc("ne").down(w-l.height+this.height-Options.AR*2).arc("ws").addTo(this)}new Path(t,e).right(Options.AR*2).addTo(this),this.items[this.normal].format(t+Options.AR*2,e,d).addTo(this),new Path(t+Options.AR*2+d,e+this.height).right(Options.AR*2).addTo(this);for(var w=0,p=this.normal+1;p<=a;p++){let g=this.items[p],c=this.items[p-1];w+=c.height+c.down+this.separators[p-1]+g.up,new Path(t,e).arc("ne").down(w-Options.AR*2).arc("ws").addTo(this),g.format||console.log(g),g.format(t+Options.AR*2,e+w,d).addTo(this),new Path(t+Options.AR*2+d,e+w+g.height).arc("se").up(w-Options.AR*2+g.height-this.height).arc("wn").addTo(this)}return this}toTextDiagram(){var[t,e,h,i,a,d,p]=TextDiagram._getParts(["cross","line","line_vertical","roundcorner_bot_left","roundcorner_bot_right","roundcorner_top_left","roundcorner_top_right"]),w=[];for(const R of this.items)w.push(R.toTextDiagram().expand(1,1,0,0));var l=Math.max(...w.map(function(R){return R.width})),g=new TextDiagram(0,0,[]);for(var[c,o]of enumerate(w)){var[u,f]=TextDiagram._gaps(l,o.width);o=o.expand(u,f,0,0);for(var v=!0,T=[],m=[],O=0;O<o.height;O++)T.push(h),m.push(h);var M=!1,x=!1;if(c<=this.normal&&(T[o.entry]=d,m[o.exit]=p,c==0)){for(v=!1,O=0;O<o.entry;O++)T[O]=" ";for(O=0;O<o.exit;O++)m[O]=" "}if(c>=this.normal&&(T[o.entry]=i,m[o.exit]=a,c==0&&(v=!1),c==this.items.length-1)){for(O=o.entry+1;O<o.height;O++)T[O]=" ";for(O=o.exit+1;O<o.height;O++)m[O]=" "}c==this.normal&&(T[o.entry]=t,m[o.exit]=t,M=!0,x=!0,c==0&&c==this.items.length-1?(T[o.entry]=e,m[o.exit]=e):c==0?(T[o.entry]=p,m[o.exit]=d):c==this.items.length-1&&(T[o.entry]=a,m[o.exit]=i));var A=new TextDiagram(o.entry,o.entry,T),S=new TextDiagram(o.exit,o.exit,m);o=A.appendRight(o,"").appendRight(S,"");var b=v?[h+" ".repeat(TextDiagram._maxWidth(g,o)-2)+h]:[];g=g.appendBelow(o,b,M,x)}return g}}funcs.Choice=(...n)=>new Choice(...n);class HorizontalChoice extends DiagramMultiContainer{constructor(...t){if(super("g",t),t.length===0)throw new RangeError("HorizontalChoice() must have at least one child.");if(t.length===1)return new Sequence(t);const e=this.items.slice(0,-1),h=this.items.slice(1,-1),i=this.items[0],a=this.items[this.items.length-1];this.needsSpace=!1,this.width=Options.AR,this.width+=Options.AR*2*(this.items.length-1),this.width+=sum(this.items,d=>d.width+(d.needsSpace?20:0)),this.width+=a.height>0?Options.AR:0,this.width+=Options.AR,this.height=0,this._upperTrack=Math.max(Options.AR*2,Options.VS,max(e,d=>d.up)+Options.VS),this.up=Math.max(this._upperTrack,a.up),this._lowerTrack=Math.max(Options.VS,max(h,d=>d.height+Math.max(d.down+Options.VS,Options.AR*2)),a.height+a.down+Options.VS),i.height<this._lowerTrack&&(this._lowerTrack=Math.max(this._lowerTrack,i.height+Options.AR*2)),this.down=Math.max(this._lowerTrack,i.height+i.down),Options.DEBUG&&(this.attrs["data-updown"]=this.up+" "+this.height+" "+this.down,this.attrs["data-type"]="horizontalchoice")}format(t,e,h){var i=determineGaps(h,this.width);new Path(t,e).h(i[0]).addTo(this),new Path(t+i[0]+this.width,e+this.height).h(i[1]).addTo(this),t+=i[0];const a=this.items[0],d=this.items[this.items.length-1],p=this.items.slice(1),w=this.items.slice(0,-1);var l=sum(w,u=>u.width+(u.needsSpace?20:0))+(this.items.length-2)*Options.AR*2-Options.AR;new Path(t,e).arc("se").v(-(this._upperTrack-Options.AR*2)).arc("wn").h(l).addTo(this);var g=sum(p,u=>u.width+(u.needsSpace?20:0))+(this.items.length-2)*Options.AR*2+(d.height>0?Options.AR:0)-Options.AR,c=t+Options.AR+a.width+(a.needsSpace?20:0)+Options.AR*2;new Path(c,e+this._lowerTrack).h(g).arc("se").v(-(this._lowerTrack-Options.AR*2)).arc("wn").addTo(this);for(const[u,f]of enumerate(this.items)){u===0?(new Path(t,e).h(Options.AR).addTo(this),t+=Options.AR):(new Path(t,e-this._upperTrack).arc("ne").v(this._upperTrack-Options.AR*2).arc("ws").addTo(this),t+=Options.AR*2);var o=f.width+(f.needsSpace?20:0);f.format(t,e,o).addTo(this),t+=o,u===this.items.length-1?f.height===0?new Path(t,e).h(Options.AR).addTo(this):new Path(t,e+f.height).arc("se").addTo(this):u===0&&f.height>this._lowerTrack?f.height-this._lowerTrack>=Options.AR*2?new Path(t,e+f.height).arc("se").v(this._lowerTrack-f.height+Options.AR*2).arc("wn").addTo(this):new Path(t,e+f.height).l(Options.AR*2,this._lowerTrack-f.height).addTo(this):new Path(t,e+f.height).arc("ne").v(this._lowerTrack-f.height-Options.AR*2).arc("ws").addTo(this)}return this}toTextDiagram(){var[t,e,h,i,a,d]=TextDiagram._getParts(["line","line_vertical","roundcorner_bot_left","roundcorner_bot_right","roundcorner_top_left","roundcorner_top_right"]),p=[];for(const R of this.items)p.push(R.toTextDiagram());for(var w=Math.max(...p.map(function(R){return R.entry})),l=Math.max(...p.slice(0,-1).map(function(R){return R.entry})),g=w-l,c=Math.max(...p.slice(1).map(function(R){return R.height-Math.min(R.entry,R.exit)-1})),o=[],u=0;u<g;u++)o.push(" ");for(o.push(a+t),u=0;u<l;u++)o.push(e+" ");o.push(i+t);var f=new TextDiagram(o.length-1,o.length-1,o);for(const[R,D]of enumerate(p)){if(R>0){for(o=[],u=0;u<g;u++)o.push(" ");var v=R==p.length-1?" ":t;for(o.push(d+v),u=0;u<l;u++)o.push(e+" ");for(o.push(h+t),u=0;u<c;u++)o.push(e+" ");o.push(t+t);var T=new TextDiagram(f.exit,f.exit,o);f=f.appendRight(T,"")}var m=new TextDiagram(0,0,[]);if(R<p.length-1){for(o=[],o.push(t.repeat(D.width)),u=0;u<l-D.entry;u++)o.push(" ".repeat(D.width));var O=new TextDiagram(0,0,o);m=m.appendBelow(O,[])}if(m=m.appendBelow(D,[],!0,!0),R>0){for(o=[],u=0;u<c-(D.height-D.entry)+1;u++)o.push(" ".repeat(D.width));o.push(t.repeat(D.width));var M=new TextDiagram(0,0,o);m=m.appendBelow(M,[])}if(f=f.appendRight(m,""),R<p.length-1){for(o=[],u=0;u<g;u++)o.push(" ");for(o.push(t+t),u=0;u<f.exit-g-1;u++)o.push(" ");for(o.push(t+d),u=0;u<c-(f.exit-f.entry);u++)o.push(" "+e);var x=R>0?t:" ";o.push(x+h);var A=w+1+(f.exit-f.entry),S=new TextDiagram(A,w+1,o);f=f.appendRight(S,"")}else{o=[];var b=f.exit!=f.entry?" ":t;for(o.push(b+a),u=0;u<f.exit-f.entry-1;u++)o.push(" "+e);for(f.exit!=f.entry&&o.push(t+i),u=0;u<c-(f.exit-f.entry);u++)o.push(" "+e);o.push(t+i),S=new TextDiagram(f.exit-f.entry,0,o),f=f.appendRight(S,"")}}return f}}funcs.HorizontalChoice=(...n)=>new HorizontalChoice(...n);class MultipleChoice extends DiagramMultiContainer{constructor(t,e,...h){if(super("g",h),typeof t!="number"||t!==Math.floor(t))throw new TypeError("The first argument of MultipleChoice() must be an integer.");if(t<0||t>=h.length)throw new RangeError("The first argument of MultipleChoice() must be an index for one of the items.");if(this.normal=t,e!="any"&&e!="all")throw new SyntaxError("The second argument of MultipleChoice must be 'any' or 'all'.");this.type=e,this.needsSpace=!0,this.innerWidth=max(this.items,function(a){return a.width}),this.width=30+Options.AR+this.innerWidth+Options.AR+20,this.up=this.items[0].up,this.down=this.items[this.items.length-1].down,this.height=this.items[t].height;for(var i=0;i<this.items.length;i++){let a=this.items[i],d;i==t-1||i==t+1?d=10+Options.AR:d=Options.AR,i<t?this.up+=Math.max(d,a.height+a.down+Options.VS+this.items[i+1].up):i>t&&(this.down+=Math.max(d,a.up+Options.VS+this.items[i-1].down+this.items[i-1].height))}this.down-=this.items[t].height,Options.DEBUG&&(this.attrs["data-updown"]=this.up+" "+this.height+" "+this.down,this.attrs["data-type"]="multiplechoice")}format(t,e,h){var i=determineGaps(h,this.width);new Path(t,e).right(i[0]).addTo(this),new Path(t+i[0]+this.width,e+this.height).right(i[1]).addTo(this),t+=i[0];for(var a=this.items[this.normal],d,p=this.normal-1;p>=0;p--){var w=this.items[p];p==this.normal-1&&(d=Math.max(10+Options.AR,a.up+Options.VS+w.down+w.height)),new Path(t+30,e).up(d-Options.AR).arc("wn").addTo(this),w.format(t+30+Options.AR,e-d,this.innerWidth).addTo(this),new Path(t+30+Options.AR+this.innerWidth,e-d+w.height).arc("ne").down(d-w.height+this.height-Options.AR-10).addTo(this),p!==0&&(d+=Math.max(Options.AR,w.up+Options.VS+this.items[p-1].down+this.items[p-1].height))}for(new Path(t+30,e).right(Options.AR).addTo(this),a.format(t+30+Options.AR,e,this.innerWidth).addTo(this),new Path(t+30+Options.AR+this.innerWidth,e+this.height).right(Options.AR).addTo(this),p=this.normal+1;p<this.items.length;p++){let g=this.items[p];p==this.normal+1&&(d=Math.max(10+Options.AR,a.height+a.down+Options.VS+g.up)),new Path(t+30,e).down(d-Options.AR).arc("ws").addTo(this),g.format(t+30+Options.AR,e+d,this.innerWidth).addTo(this),new Path(t+30+Options.AR+this.innerWidth,e+d+g.height).arc("se").up(d-Options.AR+g.height-a.height).addTo(this),p!=this.items.length-1&&(d+=Math.max(Options.AR,g.height+g.down+Options.VS+this.items[p+1].up))}var l=new FakeSVG("g",{class:"diagram-text"}).addTo(this);return new FakeSVG("title",{},this.type=="any"?"take one or more branches, once each, in any order":"take all branches, once each, in any order").addTo(l),new FakeSVG("path",{d:"M "+(t+30)+" "+(e-10)+" h -26 a 4 4 0 0 0 -4 4 v 12 a 4 4 0 0 0 4 4 h 26 z",class:"diagram-text"}).addTo(l),new FakeSVG("text",{x:t+15,y:e+4,class:"diagram-text"},this.type=="any"?"1+":"all").addTo(l),new FakeSVG("path",{d:"M "+(t+this.width-20)+" "+(e-10)+" h 16 a 4 4 0 0 1 4 4 v 12 a 4 4 0 0 1 -4 4 h -16 z",class:"diagram-text"}).addTo(l),new FakeSVG("path",{d:"M "+(t+this.width-13)+" "+(e-2)+" a 4 4 0 1 0 6 -1 m 2.75 -1 h -4 v 4 m 0 -3 h 2",style:"stroke-width: 1.75"}).addTo(l),this}toTextDiagram(){var[t]=TextDiagram._getParts(["multi_repeat"]);if(this.type=="any")var e=TextDiagram.rect("1+");else e=TextDiagram.rect("all");var h=Choice.prototype.toTextDiagram.call(this),i=TextDiagram.rect(t);return h=e.appendRight(h,""),h=h.appendRight(i,""),h}}funcs.MultipleChoice=(...n)=>new MultipleChoice(...n);class Optional extends FakeSVG{constructor(t,e){if(e===void 0)return new Choice(1,new Skip,t);if(e==="skip")return new Choice(0,new Skip,t);throw"Unknown value for Optional()'s 'skip' argument."}}funcs.Optional=(...n)=>new Optional(...n);class OneOrMore extends FakeSVG{constructor(t,e){super("g"),e=e||new Skip,this.item=wrapString(t),this.rep=wrapString(e),this.width=Math.max(this.item.width,this.rep.width)+Options.AR*2,this.height=this.item.height,this.up=this.item.up,this.down=Math.max(Options.AR*2,this.item.down+Options.VS+this.rep.up+this.rep.height+this.rep.down),this.needsSpace=!0,Options.DEBUG&&(this.attrs["data-updown"]=this.up+" "+this.height+" "+this.down,this.attrs["data-type"]="oneormore")}format(t,e,h){var i=determineGaps(h,this.width);new Path(t,e).h(i[0]).addTo(this),new Path(t+i[0]+this.width,e+this.height).h(i[1]).addTo(this),t+=i[0],new Path(t,e).right(Options.AR).addTo(this),this.item.format(t+Options.AR,e,this.width-Options.AR*2).addTo(this),new Path(t+this.width-Options.AR,e+this.height).right(Options.AR).addTo(this);var a=Math.max(Options.AR*2,this.item.height+this.item.down+Options.VS+this.rep.up);return new Path(t+Options.AR,e).arc("nw").down(a-Options.AR*2).arc("ws").addTo(this),this.rep.format(t+Options.AR,e+a,this.width-Options.AR*2).addTo(this),new Path(t+this.width-Options.AR,e+a+this.rep.height).arc("se").up(a-Options.AR*2+this.rep.height-this.item.height).arc("en").addTo(this),this}toTextDiagram(){var[t,e,h,i,a,d,p]=TextDiagram._getParts(["line","repeat_top_left","repeat_left","repeat_bot_left","repeat_top_right","repeat_right","repeat_bot_right"]),w=this.item.toTextDiagram(),l=this.rep.toTextDiagram(),g=TextDiagram._maxWidth(w,l);l=l.expand(0,g-l.width,0,0),w=w.expand(0,g-w.width,0,0);var c=w.appendBelow(l,[]),o=[];o.push(e+t);for(var u=0;u<w.height-w.entry+l.entry-1;u++)o.push(h+" ");o.push(i+t);var f=new TextDiagram(0,0,o);f=f.appendRight(c,"");var v=[];for(v.push(t+a),u=0;u<w.height-w.exit+l.exit-1;u++)v.push(" "+d);v.push(t+p);var T=new TextDiagram(0,0,v),m=f.appendRight(T,"");return m}walk(t){t(this),this.item.walk(t),this.rep.walk(t)}}funcs.OneOrMore=(...n)=>new OneOrMore(...n);class ZeroOrMore extends FakeSVG{constructor(t,e,h){return new Optional(new OneOrMore(t,e),h)}}funcs.ZeroOrMore=(...n)=>new ZeroOrMore(...n);class Group extends FakeSVG{constructor(t,e){super("g"),this.item=wrapString(t),this.label=e instanceof FakeSVG?e:e?new Comment(e):void 0,this.width=Math.max(this.item.width+(this.item.needsSpace?20:0),this.label?this.label.width:0,Options.AR*2),this.height=this.item.height,this.boxUp=this.up=Math.max(this.item.up+Options.VS,Options.AR),this.label&&(this.up+=this.label.up+this.label.height+this.label.down),this.down=Math.max(this.item.down+Options.VS,Options.AR),this.needsSpace=!0,Options.DEBUG&&(this.attrs["data-updown"]=this.up+" "+this.height+" "+this.down,this.attrs["data-type"]="group")}format(t,e,h){var i=determineGaps(h,this.width);return new Path(t,e).h(i[0]).addTo(this),new Path(t+i[0]+this.width,e+this.height).h(i[1]).addTo(this),t+=i[0],new FakeSVG("rect",{x:t,y:e-this.boxUp,width:this.width,height:this.boxUp+this.height+this.down,rx:Options.AR,ry:Options.AR,class:"group-box"}).addTo(this),this.item.format(t,e,this.width).addTo(this),this.label&&this.label.format(t,e-(this.boxUp+this.label.down+this.label.height),this.label.width).addTo(this),this}toTextDiagram(){var t=TextDiagram.roundrect(this.item.toTextDiagram(),!0);if(this.label!=null){var e=this.label.toTextDiagram();t=e.appendBelow(t,[],!0,!0).expand(0,0,1,0)}return t}walk(t){t(this),this.item.walk(t),this.label.walk(t)}}funcs.Group=(...n)=>new Group(...n);class Start extends FakeSVG{constructor({type:t="simple",label:e}={}){super("g"),this.width=20,this.height=0,this.up=10,this.down=10,this.type=t,e&&(this.label=""+e,this.width=Math.max(20,this.label.length*Options.CHAR_WIDTH+10)),Options.DEBUG&&(this.attrs["data-updown"]=this.up+" "+this.height+" "+this.down,this.attrs["data-type"]="start")}format(t,e){let h=new Path(t,e-10);return this.type==="complex"?h.down(20).m(0,-10).right(this.width).addTo(this):h.down(20).m(10,-20).down(20).m(-10,-10).right(this.width).addTo(this),this.label&&new FakeSVG("text",{x:t,y:e-15,style:"text-anchor:start"},this.label).addTo(this),this}toTextDiagram(){var[t,e,h]=TextDiagram._getParts(["cross","line","tee_right"]);if(this.type==="simple")var i=h+t+e;else i=h+e;var a=new TextDiagram(0,0,[]);this.label!=null&&(a=new TextDiagram(0,0,[this.label]),i=TextDiagram._padR(i,a.width,e));var d=new TextDiagram(0,0,[i]);return a.appendBelow(d,[],!0,!0)}}funcs.Start=(...n)=>new Start(...n);class End extends FakeSVG{constructor({type:t="simple"}={}){super("path"),this.width=20,this.height=0,this.up=10,this.down=10,this.type=t,Options.DEBUG&&(this.attrs["data-updown"]=this.up+" "+this.height+" "+this.down,this.attrs["data-type"]="end")}format(t,e){return this.type==="complex"?this.attrs.d="M "+t+" "+e+" h 20 m 0 -10 v 20":this.attrs.d="M "+t+" "+e+" h 20 m -10 -10 v 20 m 10 -20 v 20",this}toTextDiagram(){var[t,e,h]=TextDiagram._getParts(["cross","line","tee_left"]);if(this.type==="simple")var i=e+t+h;else i=e+h;return new TextDiagram(0,0,[i])}}funcs.End=(...n)=>new End(...n);class Terminal extends FakeSVG{constructor(t,{href:e,title:h,cls:i}={}){super("g",{class:["terminal",i].join(" ")}),this.text=""+t,this.href=e,this.title=h,this.cls=i,this.width=this.text.length*Options.CHAR_WIDTH+20,this.height=0,this.up=11,this.down=11,this.needsSpace=!0,Options.DEBUG&&(this.attrs["data-updown"]=this.up+" "+this.height+" "+this.down,this.attrs["data-type"]="terminal")}format(t,e,h){var i=determineGaps(h,this.width);new Path(t,e).h(i[0]).addTo(this),new Path(t+i[0]+this.width,e).h(i[1]).addTo(this),t+=i[0],new FakeSVG("rect",{x:t,y:e-11,width:this.width,height:this.up+this.down,rx:10,ry:10}).addTo(this);var a=new FakeSVG("text",{x:t+this.width/2,y:e+4},this.text);return this.href?new FakeSVG("a",{"xlink:href":this.href},[a]).addTo(this):a.addTo(this),this.title&&new FakeSVG("title",{},[this.title]).addTo(this),this}toTextDiagram(){return TextDiagram.roundrect(this.text)}}funcs.Terminal=(...n)=>new Terminal(...n);class NonTerminal extends FakeSVG{constructor(t,{href:e,title:h,cls:i=""}={}){super("g",{class:["non-terminal",i].join(" ")}),this.text=""+t,this.href=e,this.title=h,this.cls=i,this.width=this.text.length*Options.CHAR_WIDTH+20,this.height=0,this.up=11,this.down=11,this.needsSpace=!0,Options.DEBUG&&(this.attrs["data-updown"]=this.up+" "+this.height+" "+this.down,this.attrs["data-type"]="nonterminal")}format(t,e,h){var i=determineGaps(h,this.width);new Path(t,e).h(i[0]).addTo(this),new Path(t+i[0]+this.width,e).h(i[1]).addTo(this),t+=i[0],new FakeSVG("rect",{x:t,y:e-11,width:this.width,height:this.up+this.down}).addTo(this);var a=new FakeSVG("text",{x:t+this.width/2,y:e+4},this.text);return this.href?new FakeSVG("a",{"xlink:href":this.href},[a]).addTo(this):a.addTo(this),this.title&&new FakeSVG("title",{},[this.title]).addTo(this),this}toTextDiagram(){return TextDiagram.rect(this.text)}}funcs.NonTerminal=(...n)=>new NonTerminal(...n);class Comment extends FakeSVG{constructor(t,{href:e,title:h,cls:i=""}={}){super("g",{class:["comment",i].join(" ")}),this.text=""+t,this.href=e,this.title=h,this.cls=i,this.width=this.text.length*Options.COMMENT_CHAR_WIDTH+10,this.height=0,this.up=8,this.down=8,this.needsSpace=!0,Options.DEBUG&&(this.attrs["data-updown"]=this.up+" "+this.height+" "+this.down,this.attrs["data-type"]="comment")}format(t,e,h){var i=determineGaps(h,this.width);new Path(t,e).h(i[0]).addTo(this),new Path(t+i[0]+this.width,e+this.height).h(i[1]).addTo(this),t+=i[0];var a=new FakeSVG("text",{x:t+this.width/2,y:e+5,class:"comment"},this.text);return this.href?new FakeSVG("a",{"xlink:href":this.href},[a]).addTo(this):a.addTo(this),this.title&&new FakeSVG("title",{},this.title).addTo(this),this}toTextDiagram(){return new TextDiagram(0,0,[this.text])}}funcs.Comment=(...n)=>new Comment(...n);class Skip extends FakeSVG{constructor(){super("g"),this.width=0,this.height=0,this.up=0,this.down=0,this.needsSpace=!1,Options.DEBUG&&(this.attrs["data-updown"]=this.up+" "+this.height+" "+this.down,this.attrs["data-type"]="skip")}format(t,e,h){return new Path(t,e).right(h).addTo(this),this}toTextDiagram(){var[t]=TextDiagram._getParts(["line"]);return new TextDiagram(0,0,[t])}}funcs.Skip=(...n)=>new Skip(...n);class Block extends FakeSVG{constructor({width:t=50,up:e=15,height:h=25,down:i=15,needsSpace:a=!0}={}){super("g"),this.width=t,this.height=h,this.up=e,this.down=i,this.needsSpace=!0,Options.DEBUG&&(this.attrs["data-updown"]=this.up+" "+this.height+" "+this.down,this.attrs["data-type"]="block")}format(t,e,h){var i=determineGaps(h,this.width);return new Path(t,e).h(i[0]).addTo(this),new Path(t+i[0]+this.width,e).h(i[1]).addTo(this),t+=i[0],new FakeSVG("rect",{x:t,y:e-this.up,width:this.width,height:this.up+this.height+this.down}).addTo(this),this}toTextDiagram(){return TextDiagram.rect("")}}funcs.Block=(...n)=>new Block(...n);const _=class _{constructor(t,e,h){if(this.entry=t,this.exit=e,this.height=h.length,this.lines=Array.from(h),this.width=h.length>0?h[0].length:0,t>h.length)throw new Error(`Entry is not within diagram vertically:
54
+ `+this._dump(!1));if(e>h.length)throw new Error(`Exit is not within diagram vertically:
55
+ `+this._dump(!1));for(var i=0;i<h.length;i++)if(h[0].length!=h[i].length)throw new Error(`Diagram data is not rectangular:
56
+ `+this._dump(!1))}alter(t=null,e=null,h=null){var i=t||this.entry,a=e||this.exit,d=h||this.lines;return new _(i,a,Array.from(d))}appendBelow(t,e,h=!1,i=!1){var a=Math.max(this.width,t.width),d=[],p=this.center(a," ").lines;for(const g of p)d.push(g);for(const g of e)d.push(_._padR(g,a," "));p=t.center(a," ").lines;for(const g of p)d.push(g);var w=h?this.height+e.length+t.entry:this.entry,l=i?this.height+e.length+t.exit:this.exit;return new _(w,l,d)}appendRight(t,e){for(var h=Math.max(this.exit,t.entry),i=Math.max(this.height-this.exit,t.height-t.entry)+h,a=h-this.exit,d=i-this.height-a,p=h-t.entry,w=i-t.height-p,l=this.expand(0,0,a,d),g=t.expand(0,0,p,w),c=[],o=0;o<i;o++){var u=o!=h?" ".repeat(e.length):e;c.push(l.lines[o]+u+g.lines[o])}var f=this.entry+a,v=t.exit+p;return new _(f,v,c)}center(t,e){if(t<this.width)throw new Error("Cannot center into smaller width");if(t===this.width)return this.copy();for(var h=t-this.width,i=Math.trunc(h/2),a=[],d=0;d<this.height;d++)a.push(e.repeat(i));var p=[];for(d=0;d<this.height;d++)p.push(e.repeat(h-i));return new _(this.entry,this.exit,_._encloseLines(this.lines,a,p))}copy(){return new _(this.entry,this.exit,Array.from(this.lines))}expand(t,e,h,i){if(t<0||e<0||h<0||i<0)throw new Error("Expansion values cannot be negative");if(t+e+h+i===0)return this.copy();for(var a=_.parts.line,d=[],p=0;p<h;p++)d.push(" ".repeat(this.width+t+e));for(p=0;p<this.height;p++){var w=p===this.entry?a:" ",l=p===this.exit?a:" ";d.push(w.repeat(t)+this.lines[p]+l.repeat(e))}for(p=0;p<i;p++)d.push(" ".repeat(this.width+t+e));return new _(this.entry+h,this.exit+h,d)}static rect(t,e=!1){return _._rectish("rect",t,e)}static roundrect(t,e=!1){return _._rectish("roundrect",t,e)}static setFormatting(t=null,e=null){t!==null&&(_.parts={},e!==null&&(_.parts={..._.parts,...e}),_.parts={..._.parts,...t});for(const[h,i]of _.parts)i.length!=1}_dump(t=!0){var e=`
57
+ `,h="height="+this.height+" lines.length="+this.lines.length;this.entry>this.lines.length&&(h+="; entry outside diagram: entry="+this.entry),this.exit>this.lines.length&&(h+="; exit outside diagram: exit="+this.exit);for(var i=0;i<Math.max(this.lines.length,this.entry+1,this.exit+1);i++)h=h+e+"["+("00"+i).slice(-3)+"]",i<this.lines.length&&(h+=" '"+this.lines[i]+"' len="+this.lines[i].length),i===this.entry&&i===this.exit?h+=" <- entry, exit":i===this.entry?h+=" <- entry":i===this.exit&&(h+=" <- exit");return t&&console.log(h),h}static _encloseLines(t,e,h){if(t.length!=e.length)throw new Error("All arguments must be the same length");if(t.length!=h.length)throw new Error("All arguments must be the same length");for(var i=[],a=0;a<t.length;a++)i.push(e[a]+t[a]+h[a]);return i}static _gaps(t,e){var h=t-e;if(Options.INTERNAL_ALIGNMENT==="left")return[0,h];if(Options.INTERNAL_ALIGNMENT==="right")return[h,0];var i=Math.trunc(h/2),a=h-i;return[i,a]}static _getParts(t){var e=[];for(const h of t){if(_.parts[h]==null)throw new Error("Text diagram part "+h+"not found.");e.push(_.parts[h])}return e}static _maxWidth(...t){var e=0;for(const i of t){if(i instanceof _)var h=i.width;else i instanceof Array?h=Math.max(i.map(function(a){return a.length})):Number.isInteger(i)?h=Number.toString(i).length:h=i.length;e=h>e?h:e}return e}static _padL(t,e,h){if((e-t.length)%h.length!=0)throw new Error("Gap "+(e-t.length)+" must be a multiple of pad string '"+h+"'");return h.repeat(Math.trunc(e-t.length/h.length))+t}static _padR(t,e,h){if((e-t.length)%h.length!=0)throw new Error("Gap "+(e-t.length)+" must be a multiple of pad string '"+h+"'");return t+h.repeat(Math.trunc(e-t.length/h.length))}static _rectish(t,e,h=!1){var i=h?"_dashed":"",[a,d,p,w,l,g,c,o,u,f]=_._getParts([t+"_top_left",t+"_left"+i,t+"_bot_left",t+"_top_right",t+"_right"+i,t+"_bot_right",t+"_top"+i,t+"_bot"+i,"line","cross"]),v=e instanceof _;if(v)var T=e;else T=new _(0,0,[e]);var m=[];if(m.push(c.repeat(T.width+2)),v)m+=T.expand(1,1,0,0).lines;else for(var O=0;O<T.lines.length;O++)m.push(" "+T.lines[O]+" ");m.push(o.repeat(T.width+2));var M=T.entry+1,x=T.exit+1,A=_._maxWidth(a,d,p),S=[];for(S.push(_._padR(a,A,c)),O=1;O<m.length-1;O++)S.push(_._padR(d,A," "));S.push(_._padR(p,A,o)),v&&(S[M]=f);var b=_._maxWidth(w,l,g),R=[];for(R.push(_._padL(w,b,c)),O=1;O<m.length-1;O++)R.push(_._padL(l,b," "));for(R.push(_._padL(g,b,o)),v&&(R[x]=f),m=_._encloseLines(m,S,R),S=[],O=0;O<m.length;O++)S.push(" ");for(S[M]=u,R=[],O=0;O<m.length;O++)R.push(" ");return R[x]=u,m=_._encloseLines(m,S,R),new _(M,x,m)}};P(_,"PARTS_UNICODE",{cross_diag:"╳",corner_bot_left:"└",corner_bot_right:"┘",corner_top_left:"┌",corner_top_right:"┐",cross:"┼",left:"│",line:"─",line_vertical:"│",multi_repeat:"↺",rect_bot:"─",rect_bot_dashed:"┄",rect_bot_left:"└",rect_bot_right:"┘",rect_left:"│",rect_left_dashed:"┆",rect_right:"│",rect_right_dashed:"┆",rect_top:"─",rect_top_dashed:"┄",rect_top_left:"┌",rect_top_right:"┐",repeat_bot_left:"╰",repeat_bot_right:"╯",repeat_left:"│",repeat_right:"│",repeat_top_left:"╭",repeat_top_right:"╮",right:"│",roundcorner_bot_left:"╰",roundcorner_bot_right:"╯",roundcorner_top_left:"╭",roundcorner_top_right:"╮",roundrect_bot:"─",roundrect_bot_dashed:"┄",roundrect_bot_left:"╰",roundrect_bot_right:"╯",roundrect_left:"│",roundrect_left_dashed:"┆",roundrect_right:"│",roundrect_right_dashed:"┆",roundrect_top:"─",roundrect_top_dashed:"┄",roundrect_top_left:"╭",roundrect_top_right:"╮",separator:"─",tee_left:"┤",tee_right:"├"}),P(_,"PARTS_ASCII",{cross_diag:"X",corner_bot_left:"\\",corner_bot_right:"/",corner_top_left:"/",corner_top_right:"\\",cross:"+",left:"|",line:"-",line_vertical:"|",multi_repeat:"&",rect_bot:"-",rect_bot_dashed:"-",rect_bot_left:"+",rect_bot_right:"+",rect_left:"|",rect_left_dashed:"|",rect_right:"|",rect_right_dashed:"|",rect_top_dashed:"-",rect_top:"-",rect_top_left:"+",rect_top_right:"+",repeat_bot_left:"\\",repeat_bot_right:"/",repeat_left:"|",repeat_right:"|",repeat_top_left:"/",repeat_top_right:"\\",right:"|",roundcorner_bot_left:"\\",roundcorner_bot_right:"/",roundcorner_top_left:"/",roundcorner_top_right:"\\",roundrect_bot:"-",roundrect_bot_dashed:"-",roundrect_bot_left:"\\",roundrect_bot_right:"/",roundrect_left:"|",roundrect_left_dashed:"|",roundrect_right:"|",roundrect_right_dashed:"|",roundrect_top:"-",roundrect_top_dashed:"-",roundrect_top_left:"/",roundrect_top_right:"\\",separator:"-",tee_left:"|",tee_right:"|"}),P(_,"parts",_.PARTS_UNICODE);let TextDiagram=_;function unnull(...n){return n.reduce(function(t,e){return t!==void 0?t:e})}function determineGaps(n,t){var e=n-t;switch(Options.INTERNAL_ALIGNMENT){case"left":return[0,e];case"right":return[e,0];default:return[e/2,e/2]}}function wrapString(n){return n instanceof FakeSVG?n:new Terminal(""+n)}function sum(n,t){return t||(t=function(e){return e}),n.map(t).reduce(function(e,h){return e+h},0)}function max(n,t=e=>e){return Math.max.apply(null,n.map(t))}function SVG(n,t,e){t=t||{},e=e||"";var h=document.createElementNS("http://www.w3.org/2000/svg",n);for(var i in t)i==="xlink:href"?h.setAttributeNS("http://www.w3.org/1999/xlink","href",t[i]):h.setAttribute(i,t[i]);return h.textContent=e,h}function escapeString(n){return n.replace(/[*_\`\[\]<&]/g,function(t){return"&#"+t.charCodeAt(0)+";"})}function*enumerate(n){var t=0;for(const e of n)yield[t,e],t++}const railroad=Object.freeze(Object.defineProperty({__proto__:null,AlternatingSequence,Block,Choice,Comment,ComplexDiagram,Diagram,DiagramMultiContainer,End,FakeSVG,Group,HorizontalChoice,MultipleChoice,NonTerminal,OneOrMore,Optional,OptionalSequence,Options,Path,Sequence,Skip,Stack,Start,Terminal,TextDiagram,ZeroOrMore,default:funcs,defaultCSS},Symbol.toStringTag,{value:"Module"}));return plugin});
@@ -0,0 +1,3 @@
1
+ export type DeepPartial<T> = T extends object ? {
2
+ [P in keyof T]?: DeepPartial<T[P]>;
3
+ } : T;
package/package.json ADDED
@@ -0,0 +1,63 @@
1
+ {
2
+ "name": "@edc4it/reveal.js-railroad",
3
+ "license": "MIT",
4
+ "keywords": [
5
+ "reveal",
6
+ "reveal.js",
7
+ "reveal-plugin",
8
+ "plugin",
9
+ "railroad",
10
+ "syntax",
11
+ "diagrams"
12
+ ],
13
+ "version": "1.0.0",
14
+ "files": [
15
+ "dist"
16
+ ],
17
+ "author": "Raphaël Parrée <rparree@edc4it.com> (https://www.edc4it.com/)",
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "git+https://github.com/edc4it/reveal.js-railroad.git"
21
+ },
22
+ "main": "./dist/clipcode.umd.js",
23
+ "module": "./dist/clipcode.es.js",
24
+ "scripts": {
25
+ "dev": "vite",
26
+ "build": "tsc && vite build",
27
+ "preview": "vite preview",
28
+ "lint": "eslint . --ext .ts,.tsx",
29
+ "prepare": "husky"
30
+ },
31
+ "lint-staged": {
32
+ "*.ts": "eslint --cache --fix",
33
+ "**/*": "prettier --write --ignore-unknown"
34
+ },
35
+ "devDependencies": {
36
+ "@types/reveal.js": "^5.0.1",
37
+ "@typescript-eslint/eslint-plugin": "^7.4.0",
38
+ "@typescript-eslint/parser": "^7.4.0",
39
+ "autoprefixer": "^10.4.19",
40
+ "eslint": "^8.57.0",
41
+ "eslint-config-prettier": "^9.1.0",
42
+ "eslint-plugin-import": "^2.29.1",
43
+ "husky": "^9.0.11",
44
+ "lint-staged": "^15.2.2",
45
+ "postcss-nesting": "^12.1.0",
46
+ "prettier": "^3.2.5",
47
+ "typescript": "^5.2.2",
48
+ "vite": "^5.2.0",
49
+ "vite-plugin-css-injected-by-js": "^3.5.0",
50
+ "vite-plugin-dts": "^3.8.0",
51
+ "vite-plugin-remove-console": "^2.2.0"
52
+ },
53
+ "dependencies": {
54
+ "deepmerge": "^4.3.1",
55
+ "reveal.js": "^5.0.5",
56
+ "railroad-diagrams": "https://github.com/tabatkins/railroad-diagrams.git#ea9a12393bbaa2c802b0449fd5bdf34b6868b83c"
57
+ },
58
+ "bugs": {
59
+ "url": "https://github.com/edc4it/reveal.js-railroad/issues"
60
+ },
61
+ "homepage": "https://github.com/edc4it/reveal.js-railroad#readme",
62
+ "description": ""
63
+ }