@edc4it/reveal.js-railroad 1.0.4 → 2.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.
- package/README.md +10 -1
- package/dist/impl/main.d.ts +0 -1
- package/dist/impl/styles.d.ts +0 -1
- package/dist/options.d.ts +1 -2
- package/dist/plugin.d.ts +1 -2
- package/dist/{railroad-D1NexFHb.mjs → railroad-EtZhWkdY.mjs} +4 -5
- package/dist/railroad.es.js +1 -1
- package/dist/railroad.umd.js +1 -1
- package/package.json +4 -5
package/README.md
CHANGED
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
[](#)
|
|
4
4
|
|
|
5
|
+
## Compatibility
|
|
6
|
+
|
|
7
|
+
| Plugin version | reveal.js |
|
|
8
|
+
| -------------- | --------- |
|
|
9
|
+
| `2.x` | `6.x` |
|
|
10
|
+
| `1.x` | `5.x` |
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
5
14
|
A [reveal.js](https://revealjs.com/) plugin that adds support for Railroad-diagrams.
|
|
6
15
|
It is a thin wrapper around the amazing [Railroad-diagram Generator](https://github.com/tabatkins/railroad-diagrams) project.
|
|
7
16
|
|
|
@@ -22,7 +31,7 @@ It is a thin wrapper around the amazing [Railroad-diagram Generator](https://git
|
|
|
22
31
|
**Important** notes:
|
|
23
32
|
|
|
24
33
|
- We chose the "holder" to be `<script type="application/railroad">`
|
|
25
|
-
- The
|
|
34
|
+
- The contained script is **executed** using [`eval`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval). This could be an enormous security risk if you don't know the authors of your slides.
|
|
26
35
|
|
|
27
36
|
## Quickstart
|
|
28
37
|
|
package/dist/impl/main.d.ts
CHANGED
package/dist/impl/styles.d.ts
CHANGED
package/dist/options.d.ts
CHANGED
package/dist/plugin.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var Z = Object.defineProperty;
|
|
2
2
|
var J = (c, t, e) => t in c ? Z(c, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : c[t] = e;
|
|
3
|
-
var N = (c, t, e) =>
|
|
3
|
+
var N = (c, t, e) => J(c, typeof t != "symbol" ? t + "" : t, e);
|
|
4
4
|
const k = {}, s = {
|
|
5
5
|
DEBUG: !1,
|
|
6
6
|
// if true, writes some debug information into attributes
|
|
@@ -977,10 +977,9 @@ const R = class R {
|
|
|
977
977
|
for (const h of t) {
|
|
978
978
|
if (h instanceof R)
|
|
979
979
|
var r = h.width;
|
|
980
|
-
else
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
})) : Number.isInteger(h) ? r = Number.toString(h).length : r = h.length;
|
|
980
|
+
else h instanceof Array ? r = Math.max(h.map(function(i) {
|
|
981
|
+
return i.length;
|
|
982
|
+
})) : Number.isInteger(h) ? r = Number.toString(h).length : r = h.length;
|
|
984
983
|
e = r > e ? r : e;
|
|
985
984
|
}
|
|
986
985
|
return e;
|
package/dist/railroad.es.js
CHANGED
|
@@ -4,7 +4,7 @@ function applyStyle(e, t) {
|
|
|
4
4
|
}
|
|
5
5
|
async function run(revealElement, options) {
|
|
6
6
|
applyStyle(revealElement, options);
|
|
7
|
-
const rr = await import("./railroad-
|
|
7
|
+
const rr = await import("./railroad-EtZhWkdY.mjs");
|
|
8
8
|
Object.assign(window, rr.default), document.querySelectorAll("script[type='application/railroad']").forEach((s) => {
|
|
9
9
|
try {
|
|
10
10
|
const r = eval(s.innerHTML), div = document.createElement("div");
|
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)=>
|
|
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);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": "
|
|
13
|
+
"version": "2.0.0",
|
|
14
14
|
"files": [
|
|
15
15
|
"dist"
|
|
16
16
|
],
|
|
@@ -27,19 +27,18 @@
|
|
|
27
27
|
"build": "tsc && vite build",
|
|
28
28
|
"preview": "vite preview",
|
|
29
29
|
"lint": "eslint . --ext .ts,.tsx",
|
|
30
|
-
"prepare": "husky"
|
|
30
|
+
"prepare": "husky || true && yarn build"
|
|
31
31
|
},
|
|
32
32
|
"lint-staged": {
|
|
33
33
|
"*.ts": "eslint --cache --fix",
|
|
34
34
|
"**/*": "prettier --write --ignore-unknown"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@types/reveal.js": "^5.0.1",
|
|
38
37
|
"@typescript-eslint/eslint-plugin": "^7.4.0",
|
|
39
38
|
"@typescript-eslint/parser": "^7.4.0",
|
|
40
39
|
"autoprefixer": "^10.4.19",
|
|
41
40
|
"eslint": "^8.57.0",
|
|
42
|
-
"eslint-config-prettier": "^
|
|
41
|
+
"eslint-config-prettier": "^10.0.1",
|
|
43
42
|
"eslint-plugin-import": "^2.29.1",
|
|
44
43
|
"husky": "^9.0.11",
|
|
45
44
|
"lint-staged": "^15.2.2",
|
|
@@ -54,7 +53,7 @@
|
|
|
54
53
|
"dependencies": {
|
|
55
54
|
"deepmerge": "^4.3.1",
|
|
56
55
|
"railroad-diagrams": "https://github.com/tabatkins/railroad-diagrams.git#ea9a12393bbaa2c802b0449fd5bdf34b6868b83c",
|
|
57
|
-
"reveal.js": "^
|
|
56
|
+
"reveal.js": "^6.0.1"
|
|
58
57
|
},
|
|
59
58
|
"bugs": {
|
|
60
59
|
"url": "https://github.com/edc4it/reveal.js-railroad/issues"
|