@edc4it/reveal.js-railroad 1.0.1 → 1.0.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/impl/main.d.ts +1 -1
- package/dist/options.d.ts +2 -1
- package/dist/railroad.es.js +12 -12
- package/dist/railroad.umd.js +1 -1
- package/package.json +2 -1
package/dist/impl/main.d.ts
CHANGED
package/dist/options.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DeepPartial } from './util/utility-types.ts';
|
|
1
2
|
import { Options as RevealOptions } from 'reveal.js';
|
|
2
3
|
|
|
3
4
|
export type Options = {
|
|
@@ -9,5 +10,5 @@ export type Options = {
|
|
|
9
10
|
};
|
|
10
11
|
export declare const defaultOptions: Options;
|
|
11
12
|
export type AugmentedRevealOptions = RevealOptions & {
|
|
12
|
-
railroad?: Options
|
|
13
|
+
railroad?: DeepPartial<Options>;
|
|
13
14
|
};
|
package/dist/railroad.es.js
CHANGED
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
function applyStyle(e, t) {
|
|
3
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
4
|
}
|
|
5
|
-
function run(revealElement, options) {
|
|
6
|
-
applyStyle(revealElement, options)
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
5
|
+
async function run(revealElement, options) {
|
|
6
|
+
applyStyle(revealElement, options);
|
|
7
|
+
const rr = await import("./railroad-D1NexFHb.mjs");
|
|
8
|
+
Object.assign(window, rr.default), document.querySelectorAll("script[type='application/railroad']").forEach((s) => {
|
|
9
|
+
try {
|
|
10
|
+
const r = eval(s.innerHTML), div = document.createElement("div");
|
|
11
|
+
div.classList.add("railroad-diagram"), r.addTo(div), s.replaceWith(div);
|
|
12
|
+
} catch (e) {
|
|
13
|
+
console.error("error with railroad diagrams: ", e);
|
|
14
|
+
}
|
|
15
15
|
});
|
|
16
16
|
}
|
|
17
17
|
function getDefaultExportFromCjs(e) {
|
|
@@ -76,8 +76,8 @@ function mergeObject(e, t, n) {
|
|
|
76
76
|
}
|
|
77
77
|
function deepmerge(e, t, n) {
|
|
78
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),
|
|
80
|
-
return
|
|
79
|
+
var l = Array.isArray(t), c = Array.isArray(e), a = l === c;
|
|
80
|
+
return a ? l ? n.arrayMerge(e, t, n) : mergeObject(e, t, n) : cloneUnlessOtherwiseSpecified(t, n);
|
|
81
81
|
}
|
|
82
82
|
deepmerge.all = function e(t, n) {
|
|
83
83
|
if (!Array.isArray(t))
|
package/dist/railroad.umd.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
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)
|
|
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)}async function run(revealElement,options){applyStyle(revealElement,options);const rr=await Promise.resolve().then(()=>railroad);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
3
|
svg {
|
|
4
4
|
background-color: hsl(30,20%,95%);
|
|
5
5
|
}
|
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"syntax",
|
|
11
11
|
"diagrams"
|
|
12
12
|
],
|
|
13
|
-
"version": "1.0.
|
|
13
|
+
"version": "1.0.2",
|
|
14
14
|
"files": [
|
|
15
15
|
"dist"
|
|
16
16
|
],
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
},
|
|
22
22
|
"main": "./dist/railroad.umd.js",
|
|
23
23
|
"module": "./dist/railroad.es.js",
|
|
24
|
+
"types": "./dist/plugin.d.ts",
|
|
24
25
|
"scripts": {
|
|
25
26
|
"dev": "vite",
|
|
26
27
|
"build": "tsc && vite build",
|