@edc4it/reveal.js-external-code 1.0.5 → 1.1.7

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 CHANGED
@@ -64,6 +64,24 @@ Any known [fragments](https://revealjs.com/fragments/) classes on the `object` a
64
64
  </object>
65
65
  ```
66
66
 
67
+ ## Escaping HTML Content
68
+
69
+ When including code that contains HTML special characters (`<`, `>`, `&`, `'`, `"`), you can use the `data-escape-code` attribute to automatically escape these characters.
70
+
71
+ ```html
72
+ <object type="reveal.js/code"
73
+ data-src="code-samples/html-example.html"
74
+ data-escape-code>
75
+ </object>
76
+ ```
77
+ With `data-escape-code` added, special characters will be converted to their HTML entity equivalents:
78
+ - `&` becomes `&amp;`
79
+ - `<` becomes `&lt;`
80
+ - `>` becomes `&gt;`
81
+ - `'` becomes `&#39;`
82
+ - `"` becomes `&quot;`
83
+
84
+
67
85
  ## Limit lines
68
86
 
69
87
  By default, all lines in the `data-src` are displayed (except the one with an optional `@reveal.js/code` annotation, see below).
@@ -156,5 +174,3 @@ Reveal.initialize({
156
174
  - `codeBlock`
157
175
  - `trim`: set to `false` to keep whitespace before first character/after last character
158
176
  - `additionalClasses`: array of additional css classes to add to the `code` element
159
-
160
-
@@ -0,0 +1,7 @@
1
+ # syntax = docker/dockerfile:1
2
+ FROM alpine
3
+ RUN --mount=type=secret,id=somesecret,required=true <<EOF
4
+ echo "Performing operations with the secret:"
5
+ echo -n "Secret: "
6
+ cat /run/secrets/somesecret
7
+ EOF
@@ -1,17 +1,17 @@
1
- (function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".reveal pre,.external-code-wrapper{width:100%}.external-code-wrapper footer.demo-ref{font-size:14px;margin-top:-18px;color:#0d99a5;text-align:right;cursor:help;transition:font-size .4s .1s}.external-code-wrapper footer.demo-ref:before{color:#0d99a5;margin-right:.3em}.external-code-wrapper footer.demo-ref:hover{font-size:28px;cursor:none}")),document.head.appendChild(e)}}catch(r){console.error("vite-plugin-css-injected-by-js",r)}})();
2
- var J = Object.defineProperty;
3
- var Q = (e, t, s) => t in e ? J(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s;
4
- var _ = (e, t, s) => (Q(e, typeof t != "symbol" ? t + "" : t, s), s);
5
- class tt extends Error {
1
+ (function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".reveal pre,.external-code-wrapper{width:100%}:is(.external-code-wrapper footer.demo-ref):before{color:#0d99a5;margin-right:.3em}.external-code-wrapper footer.demo-ref{font-size:14px;margin-top:-18px;color:#0d99a5;text-align:right;cursor:help;transition:font-size .4s .1s}:is(.external-code-wrapper footer.demo-ref):hover{font-size:28px;cursor:none}")),document.head.appendChild(e)}}catch(r){console.error("vite-plugin-css-injected-by-js",r)}})();
2
+ var z = Object.defineProperty;
3
+ var J = (e, t, s) => t in e ? z(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s;
4
+ var A = (e, t, s) => J(e, typeof t != "symbol" ? t + "" : t, s);
5
+ class Q extends Error {
6
6
  constructor(t) {
7
7
  super(t);
8
8
  }
9
9
  }
10
- function M(e, t = !1) {
10
+ function P(e, t = !1) {
11
11
  const s = t ? -1 : 0;
12
12
  return e.replace(/\s/g, "").split(",").map((i) => {
13
13
  if (/^[\d-]+$/.test(i)) {
14
- const [o, c] = i.split("-").map((u) => Number.parseInt(u, 10) + s);
14
+ const [o, c] = i.split("-").map((l) => Number.parseInt(l, 10) + s);
15
15
  return isNaN(c) ? {
16
16
  start: o,
17
17
  end: o
@@ -19,21 +19,20 @@ function M(e, t = !1) {
19
19
  start: o,
20
20
  end: c
21
21
  };
22
- } else
23
- throw new tt(`could not parse ${i}`);
22
+ } else throw new Q(`could not parse ${i}`);
24
23
  });
25
24
  }
26
- function et(e) {
25
+ function tt(e) {
27
26
  var n, i;
28
27
  const t = e.split(`
29
28
  `), s = t[0];
30
29
  if (s.includes("@reveal.js/code")) {
31
30
  const o = (i = (n = s.match(/lines=(['"]?(?<range>[\d,\s-]+)['"]?)/)) == null ? void 0 : n.groups) == null ? void 0 : i.range, c = t.slice(1);
32
31
  if (o) {
33
- const l = M(o, !0);
32
+ const f = P(o, !0);
34
33
  return {
35
34
  lines: c,
36
- range: l,
35
+ range: f,
37
36
  annotated: !0
38
37
  };
39
38
  } else
@@ -47,32 +46,32 @@ function et(e) {
47
46
  annotated: !1
48
47
  };
49
48
  }
50
- function st(e, t) {
51
- return e.map((s, n) => nt(n + 1, t) ? s : "…").filter((s, n, i) => !(s === "…" && i[n - 1] === "…"));
49
+ function et(e, t) {
50
+ return e.map((s, n) => st(n + 1, t) ? s : "…").filter((s, n, i) => !(s === "…" && i[n - 1] === "…"));
52
51
  }
53
- function nt(e, t) {
52
+ function st(e, t) {
54
53
  return t.find((s) => e >= s.start && e <= s.end) !== void 0;
55
54
  }
56
- function it(e, t) {
55
+ function nt(e, t) {
57
56
  e.parentNode ? e.replaceWith(t) : console.error("The element to be replaced is not attached to the DOM.");
58
57
  }
59
- function rt(e, t) {
58
+ function it(e, t) {
60
59
  e.forEach((s) => {
61
60
  t.setAttribute(s.nodeName, s.nodeValue ?? "");
62
61
  });
63
62
  }
64
- function ot(e) {
63
+ function rt(e) {
65
64
  return e.split(".").pop();
66
65
  }
67
- class at {
66
+ class ot {
68
67
  constructor(t, s, n, i, a) {
69
- _(this, "providedLanguage");
68
+ A(this, "providedLanguage");
70
69
  var o;
71
70
  this.attributes = t, this.src = s, this.href = n, this.codeStr = i, this.options = a, this.providedLanguage = (o = this.attributes.getNamedItem("data-lang")) == null ? void 0 : o.value;
72
71
  }
73
72
  create() {
74
73
  const { wrapper: t, codeElement: s } = this._createElements(), n = this._codeClasses();
75
- return s.classList.add(...n), rt([...this.attributes].filter((i) => i.nodeName !== "class"), s), s.innerHTML = this.codeStr, t;
74
+ return s.classList.add(...n), it([...this.attributes].filter((i) => i.nodeName !== "class"), s), s.innerHTML = this.codeStr, t;
76
75
  }
77
76
  /**
78
77
  * Create the required elements
@@ -88,7 +87,7 @@ class at {
88
87
  * @private
89
88
  */
90
89
  _codeClasses() {
91
- const t = ot(this.src), s = this.providedLanguage ?? t ?? "";
90
+ const t = rt(this.src), s = this.providedLanguage ?? t ?? "";
92
91
  return [...this.options.codeBlock.additionalClasses, s];
93
92
  }
94
93
  /**
@@ -110,7 +109,7 @@ class at {
110
109
  return t.classList.add("external-code-wrapper"), t.classList.add(...((s = this.attributes.getNamedItem("class")) == null ? void 0 : s.value.split(" ")) ?? []), t;
111
110
  }
112
111
  }
113
- async function ct(e, t) {
112
+ async function at(e, t) {
114
113
  const s = await fetch(e);
115
114
  if (s.ok) {
116
115
  const n = await s.text();
@@ -118,20 +117,20 @@ async function ct(e, t) {
118
117
  } else
119
118
  throw new Error(s.statusText);
120
119
  }
121
- function lt(e, t) {
120
+ function ct(e, t) {
122
121
  if (!(e instanceof t))
123
122
  throw new TypeError("Cannot call a class as a function");
124
123
  }
125
- function F(e, t) {
124
+ function lt(e, t) {
126
125
  for (var s = 0; s < t.length; s++) {
127
126
  var n = t[s];
128
127
  n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n);
129
128
  }
130
129
  }
131
130
  function ut(e, t, s) {
132
- return t && F(e.prototype, t), s && F(e, s), e;
131
+ return t && lt(e.prototype, t), e;
133
132
  }
134
- var dt = Object.defineProperty, d = function(e, t) {
133
+ var dt = Object.defineProperty, u = function(e, t) {
135
134
  return dt(e, "name", { value: t, configurable: !0 });
136
135
  }, ft = `<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
137
136
  <path d="m8.94 8 4.2-4.193a.67.67 0 0 0-.947-.947L8 7.06l-4.193-4.2a.67.67 0 1 0-.947.947L7.06 8l-4.2 4.193a.667.667 0 0 0 .217 1.093.666.666 0 0 0 .73-.146L8 8.94l4.193 4.2a.666.666 0 0 0 1.094-.217.665.665 0 0 0-.147-.73L8.94 8Z" fill="currentColor"/>
@@ -148,35 +147,35 @@ var dt = Object.defineProperty, d = function(e, t) {
148
147
  `, vt = `<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
149
148
  <path d="M16.334 17.667a1.334 1.334 0 0 0 1.334-1.333v-5.333a1.333 1.333 0 0 0-2.665 0v5.333a1.333 1.333 0 0 0 1.33 1.333Zm-.508 5.227c.325.134.69.134 1.014 0 .165-.064.314-.159.44-.28a1.56 1.56 0 0 0 .28-.44c.076-.158.112-.332.107-.507a1.332 1.332 0 0 0-.387-.946 1.532 1.532 0 0 0-.44-.28 1.334 1.334 0 0 0-1.838 1.226 1.4 1.4 0 0 0 .385.947c.127.121.277.216.44.28Zm.508 6.773a13.333 13.333 0 1 0 0-26.667 13.333 13.333 0 0 0 0 26.667Zm0-24A10.667 10.667 0 1 1 16.54 27a10.667 10.667 0 0 1-.206-21.333Z" fill="currentColor"/>
150
149
  </svg>
151
- `, Ot = d(function(e) {
150
+ `, Ot = u(function(e) {
152
151
  return new DOMParser().parseFromString(e, "text/html").body.childNodes[0];
153
- }, "stringToHTML"), p = d(function(e) {
152
+ }, "stringToHTML"), m = u(function(e) {
154
153
  var t = new DOMParser().parseFromString(e, "application/xml");
155
154
  return document.importNode(t.documentElement, !0).outerHTML;
156
- }, "getSvgNode"), r = { CONTAINER: "sn-notifications-container", NOTIFY: "sn-notify", NOTIFY_CONTENT: "sn-notify-content", NOTIFY_ICON: "sn-notify-icon", NOTIFY_CLOSE: "sn-notify-close", NOTIFY_TITLE: "sn-notify-title", NOTIFY_TEXT: "sn-notify-text", IS_X_CENTER: "sn-is-x-center", IS_Y_CENTER: "sn-is-y-center", IS_CENTER: "sn-is-center", IS_LEFT: "sn-is-left", IS_RIGHT: "sn-is-right", IS_TOP: "sn-is-top", IS_BOTTOM: "sn-is-bottom", NOTIFY_OUTLINE: "sn-notify-outline", NOTIFY_FILLED: "sn-notify-filled", NOTIFY_ERROR: "sn-notify-error", NOTIFY_WARNING: "sn-notify-warning", NOTIFY_SUCCESS: "sn-notify-success", NOTIFY_INFO: "sn-notify-info", NOTIFY_FADE: "sn-notify-fade", NOTIFY_FADE_IN: "sn-notify-fade-in", NOTIFY_SLIDE: "sn-notify-slide", NOTIFY_SLIDE_IN: "sn-notify-slide-in", NOTIFY_AUTOCLOSE: "sn-notify-autoclose" }, f = { ERROR: "error", WARNING: "warning", SUCCESS: "success", INFO: "info" }, R = { OUTLINE: "outline", FILLED: "filled" }, I = { FADE: "fade", SLIDE: "slide" }, m = { CLOSE: p(ft), SUCCESS: p(mt), ERROR: p(ht), WARNING: p(vt), INFO: p(pt) }, A = d(function(e) {
155
+ }, "getSvgNode"), r = { CONTAINER: "sn-notifications-container", NOTIFY: "sn-notify", NOTIFY_CONTENT: "sn-notify-content", NOTIFY_ICON: "sn-notify-icon", NOTIFY_CLOSE: "sn-notify-close", NOTIFY_TITLE: "sn-notify-title", NOTIFY_TEXT: "sn-notify-text", IS_X_CENTER: "sn-is-x-center", IS_Y_CENTER: "sn-is-y-center", IS_CENTER: "sn-is-center", IS_LEFT: "sn-is-left", IS_RIGHT: "sn-is-right", IS_TOP: "sn-is-top", IS_BOTTOM: "sn-is-bottom", NOTIFY_OUTLINE: "sn-notify-outline", NOTIFY_FILLED: "sn-notify-filled", NOTIFY_ERROR: "sn-notify-error", NOTIFY_WARNING: "sn-notify-warning", NOTIFY_SUCCESS: "sn-notify-success", NOTIFY_INFO: "sn-notify-info", NOTIFY_FADE: "sn-notify-fade", NOTIFY_FADE_IN: "sn-notify-fade-in", NOTIFY_SLIDE: "sn-notify-slide", NOTIFY_SLIDE_IN: "sn-notify-slide-in", NOTIFY_AUTOCLOSE: "sn-notify-autoclose" }, d = { ERROR: "error", WARNING: "warning", SUCCESS: "success", INFO: "info" }, Y = { OUTLINE: "outline", FILLED: "filled" }, y = { FADE: "fade", SLIDE: "slide" }, v = { CLOSE: m(ft), SUCCESS: m(mt), ERROR: m(ht), WARNING: m(vt), INFO: m(pt) }, x = u(function(e) {
157
156
  e.wrapper.classList.add(r.NOTIFY_FADE), setTimeout(function() {
158
157
  e.wrapper.classList.add(r.NOTIFY_FADE_IN);
159
158
  }, 100);
160
- }, "fadeIn"), Y = d(function(e) {
159
+ }, "fadeIn"), M = u(function(e) {
161
160
  e.wrapper.classList.remove(r.NOTIFY_FADE_IN), setTimeout(function() {
162
161
  e.wrapper.remove();
163
162
  }, e.speed);
164
- }, "fadeOut"), It = d(function(e) {
163
+ }, "fadeOut"), It = u(function(e) {
165
164
  e.wrapper.classList.add(r.NOTIFY_SLIDE), setTimeout(function() {
166
165
  e.wrapper.classList.add(r.NOTIFY_SLIDE_IN);
167
166
  }, 100);
168
- }, "slideIn"), Et = d(function(e) {
167
+ }, "slideIn"), Et = u(function(e) {
169
168
  e.wrapper.classList.remove(r.NOTIFY_SLIDE_IN), setTimeout(function() {
170
169
  e.wrapper.remove();
171
170
  }, e.speed);
172
- }, "slideOut"), j = function() {
171
+ }, "slideOut"), D = function() {
173
172
  function e(t) {
174
173
  var s = this;
175
- lt(this, e), this.notifyOut = d(function(z) {
176
- z(s);
174
+ ct(this, e), this.notifyOut = u(function(K) {
175
+ K(s);
177
176
  }, "notifyOut");
178
- var n = t.notificationsGap, i = n === void 0 ? 20 : n, a = t.notificationsPadding, o = a === void 0 ? 20 : a, c = t.status, l = c === void 0 ? "success" : c, u = t.effect, E = u === void 0 ? I.FADE : u, O = t.type, U = O === void 0 ? "outline" : O, k = t.title, $ = t.text, N = t.showIcon, B = N === void 0 ? !0 : N, y = t.customIcon, W = y === void 0 ? "" : y, g = t.customClass, Z = g === void 0 ? "" : g, w = t.speed, G = w === void 0 ? 500 : w, T = t.showCloseButton, H = T === void 0 ? !0 : T, b = t.autoclose, q = b === void 0 ? !0 : b, L = t.autotimeout, X = L === void 0 ? 3e3 : L, C = t.position, V = C === void 0 ? "right top" : C, S = t.customWrapper, K = S === void 0 ? "" : S;
179
- if (this.customWrapper = K, this.status = l, this.title = k, this.text = $, this.showIcon = B, this.customIcon = W, this.customClass = Z, this.speed = G, this.effect = E, this.showCloseButton = H, this.autoclose = q, this.autotimeout = X, this.notificationsGap = i, this.notificationsPadding = o, this.type = U, this.position = V, !this.checkRequirements()) {
177
+ var n = t.notificationsGap, i = n === void 0 ? 20 : n, a = t.notificationsPadding, o = a === void 0 ? 20 : a, c = t.status, f = c === void 0 ? "success" : c, l = t.effect, h = l === void 0 ? y.FADE : l, I = t.type, g = I === void 0 ? "outline" : I, N = t.title, E = t.text, w = t.showIcon, $ = w === void 0 ? !0 : w, T = t.customIcon, B = T === void 0 ? "" : T, b = t.customClass, W = b === void 0 ? "" : b, L = t.speed, Z = L === void 0 ? 500 : L, C = t.showCloseButton, G = C === void 0 ? !0 : C, S = t.autoclose, H = S === void 0 ? !0 : S, _ = t.autotimeout, q = _ === void 0 ? 3e3 : _, F = t.position, X = F === void 0 ? "right top" : F, R = t.customWrapper, V = R === void 0 ? "" : R;
178
+ if (this.customWrapper = V, this.status = f, this.title = N, this.text = E, this.showIcon = $, this.customIcon = B, this.customClass = W, this.speed = Z, this.effect = h, this.showCloseButton = G, this.autoclose = H, this.autotimeout = q, this.notificationsGap = i, this.notificationsPadding = o, this.type = g, this.position = X, !this.checkRequirements()) {
180
179
  console.error("You must specify 'title' or 'text' at least.");
181
180
  return;
182
181
  }
@@ -191,32 +190,32 @@ var dt = Object.defineProperty, d = function(e, t) {
191
190
  this.container.classList[this.position === "center" ? "add" : "remove"](r.IS_CENTER), this.container.classList[this.position.includes("left") ? "add" : "remove"](r.IS_LEFT), this.container.classList[this.position.includes("right") ? "add" : "remove"](r.IS_RIGHT), this.container.classList[this.position.includes("top") ? "add" : "remove"](r.IS_TOP), this.container.classList[this.position.includes("bottom") ? "add" : "remove"](r.IS_BOTTOM), this.container.classList[this.position.includes("x-center") ? "add" : "remove"](r.IS_X_CENTER), this.container.classList[this.position.includes("y-center") ? "add" : "remove"](r.IS_Y_CENTER);
192
191
  } }, { key: "setCloseButton", value: function() {
193
192
  var s = this, n = document.createElement("div");
194
- n.classList.add(r.NOTIFY_CLOSE), n.innerHTML = m.CLOSE, this.wrapper.appendChild(n), n.addEventListener("click", function() {
193
+ n.classList.add(r.NOTIFY_CLOSE), n.innerHTML = v.CLOSE, this.wrapper.appendChild(n), n.addEventListener("click", function() {
195
194
  s.close();
196
195
  });
197
196
  } }, { key: "setWrapper", value: function() {
198
197
  var s = this;
199
198
  switch (this.customWrapper ? this.wrapper = Ot(this.customWrapper) : this.wrapper = document.createElement("div"), this.wrapper.style.setProperty("--sn-notify-transition-duration", "".concat(this.speed, "ms")), this.wrapper.classList.add(r.NOTIFY), this.type) {
200
- case R.OUTLINE:
199
+ case Y.OUTLINE:
201
200
  this.wrapper.classList.add(r.NOTIFY_OUTLINE);
202
201
  break;
203
- case R.FILLED:
202
+ case Y.FILLED:
204
203
  this.wrapper.classList.add(r.NOTIFY_FILLED);
205
204
  break;
206
205
  default:
207
206
  this.wrapper.classList.add(r.NOTIFY_OUTLINE);
208
207
  }
209
208
  switch (this.status) {
210
- case f.SUCCESS:
209
+ case d.SUCCESS:
211
210
  this.wrapper.classList.add(r.NOTIFY_SUCCESS);
212
211
  break;
213
- case f.ERROR:
212
+ case d.ERROR:
214
213
  this.wrapper.classList.add(r.NOTIFY_ERROR);
215
214
  break;
216
- case f.WARNING:
215
+ case d.WARNING:
217
216
  this.wrapper.classList.add(r.NOTIFY_WARNING);
218
217
  break;
219
- case f.INFO:
218
+ case d.INFO:
220
219
  this.wrapper.classList.add(r.NOTIFY_INFO);
221
220
  break;
222
221
  }
@@ -229,25 +228,23 @@ var dt = Object.defineProperty, d = function(e, t) {
229
228
  var n, i;
230
229
  this.title && (n = document.createElement("div"), n.classList.add(r.NOTIFY_TITLE), n.textContent = this.title.trim(), this.showCloseButton || (n.style.paddingRight = "0")), this.text && (i = document.createElement("div"), i.classList.add(r.NOTIFY_TEXT), i.innerHTML = this.text.trim(), this.title || (i.style.marginTop = "0")), this.wrapper.appendChild(s), this.title && s.appendChild(n), this.text && s.appendChild(i);
231
230
  } }, { key: "setIcon", value: function() {
232
- var s = d(function(i) {
231
+ var s = u(function(i) {
233
232
  switch (i) {
234
- case f.SUCCESS:
235
- return m.SUCCESS;
236
- case f.ERROR:
237
- return m.ERROR;
238
- case f.WARNING:
239
- return m.WARNING;
240
- case f.INFO:
241
- return m.INFO;
233
+ case d.SUCCESS:
234
+ return v.SUCCESS;
235
+ case d.ERROR:
236
+ return v.ERROR;
237
+ case d.WARNING:
238
+ return v.WARNING;
239
+ case d.INFO:
240
+ return v.INFO;
242
241
  }
243
242
  }, "computedIcon"), n = document.createElement("div");
244
243
  n.classList.add(r.NOTIFY_ICON), n.innerHTML = this.customIcon || s(this.status), (this.status || this.customIcon) && this.wrapper.appendChild(n);
245
244
  } }, { key: "setObserver", value: function() {
246
245
  var s = this, n = new IntersectionObserver(function(i) {
247
- if (i[0].intersectionRatio <= 0)
248
- s.close();
249
- else
250
- return;
246
+ if (i[0].intersectionRatio <= 0) s.close();
247
+ else return;
251
248
  }, { threshold: 0 });
252
249
  setTimeout(function() {
253
250
  n.observe(s.wrapper);
@@ -263,43 +260,49 @@ var dt = Object.defineProperty, d = function(e, t) {
263
260
  this.notifyOut(this.selectedNotifyOutEffect);
264
261
  } }, { key: "setEffect", value: function() {
265
262
  switch (this.effect) {
266
- case I.FADE:
267
- this.selectedNotifyInEffect = A, this.selectedNotifyOutEffect = Y;
263
+ case y.FADE:
264
+ this.selectedNotifyInEffect = x, this.selectedNotifyOutEffect = M;
268
265
  break;
269
- case I.SLIDE:
266
+ case y.SLIDE:
270
267
  this.selectedNotifyInEffect = It, this.selectedNotifyOutEffect = Et;
271
268
  break;
272
269
  default:
273
- this.selectedNotifyInEffect = A, this.selectedNotifyOutEffect = Y;
270
+ this.selectedNotifyInEffect = x, this.selectedNotifyOutEffect = M;
274
271
  }
275
272
  } }]), e;
276
273
  }();
277
- d(j, "Notify");
278
- var P = j;
279
- globalThis.Notify = P;
274
+ u(D, "Notify");
275
+ var U = D;
276
+ globalThis.Notify = U;
280
277
  function Nt(e, t) {
281
278
  const s = window.location.href, n = new URL(s);
282
279
  return `${n.port ? `${n.protocol}//${n.hostname}:${n.port}` : `${n.protocol}//${n.hostname}`}${e === "/" ? "" : e}/${t}`;
283
280
  }
284
281
  function yt(e, t) {
285
- const { range: s, lines: n, annotated: i } = et(e), a = t ? M(t, i) : void 0, o = s ?? a;
286
- return (o ? st(n, o) : n).join(`
282
+ const { range: s, lines: n, annotated: i } = tt(e), a = t ? P(t, i) : void 0, o = s ?? a;
283
+ return (o ? et(n, o) : n).join(`
287
284
  `);
288
285
  }
289
286
  async function gt(e, t) {
290
287
  const s = e.querySelectorAll("object[type='reveal.js/code']"), n = Array.from(s).map(async (i) => {
291
- const a = i.getAttribute("data-src"), o = i.getAttribute("data-lines");
288
+ const a = i.getAttribute("data-src"), o = i.getAttribute("data-lines"), c = i.hasAttribute("data-escape-code");
292
289
  if (a) {
293
- const c = Nt(t.basePath, a);
290
+ const f = Nt(t.basePath, a);
294
291
  try {
295
- const l = await ct(c, t);
292
+ const l = await at(f, t);
296
293
  if (l) {
297
- const u = yt(l, o), O = new at(i.attributes, a, c, u, t).create();
298
- it(i, O);
294
+ const h = c ? l.replace(/[&<>'"]/g, (E) => ({
295
+ "&": "&amp;",
296
+ "<": "&lt;",
297
+ ">": "&gt;",
298
+ "'": "&#39;",
299
+ '"': "&quot;"
300
+ })[E] || E) : l, I = yt(h, o), N = new ot(i.attributes, a, f, I, t).create();
301
+ nt(i, N);
299
302
  }
300
303
  } catch (l) {
301
- const u = `exception while processing external code ${a}`;
302
- t.enableNotify && new P({ text: u }), console.error(u, l);
304
+ const h = `exception while processing external code ${a}`;
305
+ t.enableNotify && new U({ text: h }), console.error(h, l);
303
306
  }
304
307
  } else
305
308
  console.error("object[type='reveal.js/code'] has no src attribute", i);
@@ -326,29 +329,29 @@ function _t(e) {
326
329
  function Ft(e) {
327
330
  return Array.isArray(e) ? [] : {};
328
331
  }
329
- function v(e, t) {
330
- return t.clone !== !1 && t.isMergeableObject(e) ? h(Ft(e), e, t) : e;
332
+ function O(e, t) {
333
+ return t.clone !== !1 && t.isMergeableObject(e) ? p(Ft(e), e, t) : e;
331
334
  }
332
335
  function Rt(e, t, s) {
333
336
  return e.concat(t).map(function(n) {
334
- return v(n, s);
337
+ return O(n, s);
335
338
  });
336
339
  }
337
340
  function At(e, t) {
338
341
  if (!t.customMerge)
339
- return h;
342
+ return p;
340
343
  var s = t.customMerge(e);
341
- return typeof s == "function" ? s : h;
344
+ return typeof s == "function" ? s : p;
342
345
  }
343
346
  function Yt(e) {
344
347
  return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(e).filter(function(t) {
345
348
  return Object.propertyIsEnumerable.call(e, t);
346
349
  }) : [];
347
350
  }
348
- function x(e) {
351
+ function j(e) {
349
352
  return Object.keys(e).concat(Yt(e));
350
353
  }
351
- function D(e, t) {
354
+ function k(e, t) {
352
355
  try {
353
356
  return t in e;
354
357
  } catch {
@@ -356,29 +359,29 @@ function D(e, t) {
356
359
  }
357
360
  }
358
361
  function xt(e, t) {
359
- return D(e, t) && !(Object.hasOwnProperty.call(e, t) && Object.propertyIsEnumerable.call(e, t));
362
+ return k(e, t) && !(Object.hasOwnProperty.call(e, t) && Object.propertyIsEnumerable.call(e, t));
360
363
  }
361
364
  function Mt(e, t, s) {
362
365
  var n = {};
363
- return s.isMergeableObject(e) && x(e).forEach(function(i) {
364
- n[i] = v(e[i], s);
365
- }), x(t).forEach(function(i) {
366
- xt(e, i) || (D(e, i) && s.isMergeableObject(t[i]) ? n[i] = At(i, s)(e[i], t[i], s) : n[i] = v(t[i], s));
366
+ return s.isMergeableObject(e) && j(e).forEach(function(i) {
367
+ n[i] = O(e[i], s);
368
+ }), j(t).forEach(function(i) {
369
+ xt(e, i) || (k(e, i) && s.isMergeableObject(t[i]) ? n[i] = At(i, s)(e[i], t[i], s) : n[i] = O(t[i], s));
367
370
  }), n;
368
371
  }
369
- function h(e, t, s) {
370
- s = s || {}, s.arrayMerge = s.arrayMerge || Rt, s.isMergeableObject = s.isMergeableObject || Tt, s.cloneUnlessOtherwiseSpecified = v;
372
+ function p(e, t, s) {
373
+ s = s || {}, s.arrayMerge = s.arrayMerge || Rt, s.isMergeableObject = s.isMergeableObject || Tt, s.cloneUnlessOtherwiseSpecified = O;
371
374
  var n = Array.isArray(t), i = Array.isArray(e), a = n === i;
372
- return a ? n ? s.arrayMerge(e, t, s) : Mt(e, t, s) : v(t, s);
375
+ return a ? n ? s.arrayMerge(e, t, s) : Mt(e, t, s) : O(t, s);
373
376
  }
374
- h.all = function(t, s) {
377
+ p.all = function(t, s) {
375
378
  if (!Array.isArray(t))
376
379
  throw new Error("first argument should be an array");
377
380
  return t.reduce(function(n, i) {
378
- return h(n, i, s);
381
+ return p(n, i, s);
379
382
  }, {});
380
383
  };
381
- var jt = h, Pt = jt;
384
+ var jt = p, Pt = jt;
382
385
  const Dt = /* @__PURE__ */ wt(Pt), Ut = {
383
386
  basePath: "/",
384
387
  enableNotify: !0,
@@ -1,19 +1,19 @@
1
- (function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".reveal pre,.external-code-wrapper{width:100%}.external-code-wrapper footer.demo-ref{font-size:14px;margin-top:-18px;color:#0d99a5;text-align:right;cursor:help;transition:font-size .4s .1s}.external-code-wrapper footer.demo-ref:before{color:#0d99a5;margin-right:.3em}.external-code-wrapper footer.demo-ref:hover{font-size:28px;cursor:none}")),document.head.appendChild(e)}}catch(r){console.error("vite-plugin-css-injected-by-js",r)}})();
2
- (function(u,c){typeof exports=="object"&&typeof module<"u"?module.exports=c():typeof define=="function"&&define.amd?define(c):(u=typeof globalThis<"u"?globalThis:u||self,u.ClipCode=c())})(this,function(){"use strict";var Dt=Object.defineProperty;var Ut=(u,c,m)=>c in u?Dt(u,c,{enumerable:!0,configurable:!0,writable:!0,value:m}):u[c]=m;var k=(u,c,m)=>(Ut(u,typeof c!="symbol"?c+"":c,m),m);class u extends Error{constructor(t){super(t)}}function c(e,t=!1){const n=t?-1:0;return e.replace(/\s/g,"").split(",").map(i=>{if(/^[\d-]+$/.test(i)){const[o,l]=i.split("-").map(h=>Number.parseInt(h,10)+n);return isNaN(l)?{start:o,end:o}:{start:o,end:l}}else throw new u(`could not parse ${i}`)})}function m(e){var s,i;const t=e.split(`
3
- `),n=t[0];if(n.includes("@reveal.js/code")){const o=(i=(s=n.match(/lines=(['"]?(?<range>[\d,\s-]+)['"]?)/))==null?void 0:s.groups)==null?void 0:i.range,l=t.slice(1);if(o){const f=c(o,!0);return{lines:l,range:f,annotated:!0}}else return{lines:l,annotated:!0}}else return{lines:t,annotated:!1}}function $(e,t){return e.map((n,s)=>B(s+1,t)?n:"…").filter((n,s,i)=>!(n==="…"&&i[s-1]==="…"))}function B(e,t){return t.find(n=>e>=n.start&&e<=n.end)!==void 0}function W(e,t){e.parentNode?e.replaceWith(t):console.error("The element to be replaced is not attached to the DOM.")}function Z(e,t){e.forEach(n=>{t.setAttribute(n.nodeName,n.nodeValue??"")})}function G(e){return e.split(".").pop()}class H{constructor(t,n,s,i,a){k(this,"providedLanguage");var o;this.attributes=t,this.src=n,this.href=s,this.codeStr=i,this.options=a,this.providedLanguage=(o=this.attributes.getNamedItem("data-lang"))==null?void 0:o.value}create(){const{wrapper:t,codeElement:n}=this._createElements(),s=this._codeClasses();return n.classList.add(...s),Z([...this.attributes].filter(i=>i.nodeName!=="class"),n),n.innerHTML=this.codeStr,t}_createElements(){const t=this._createWrapper(),n=document.createElement("pre"),s=document.createElement("code"),i=this._footerHtml();return t.appendChild(n),n.appendChild(s),n.insertAdjacentHTML("afterend",i),{wrapper:t,codeElement:s}}_codeClasses(){const t=G(this.src),n=this.providedLanguage??t??"";return[...this.options.codeBlock.additionalClasses,n]}_footerHtml(){var n,s;return`<footer class="demo-ref"><a href="${(n=this.options)!=null&&n.local.absPath?`${this.options.local.scheme}${(s=this.options)==null?void 0:s.local.absPath}/${this.src}`:this.href}">${this.src}</a></footer>`}_createWrapper(){var n;const t=document.createElement("div");return t.classList.add("external-code-wrapper"),t.classList.add(...((n=this.attributes.getNamedItem("class"))==null?void 0:n.value.split(" "))??[]),t}}async function q(e,t){const n=await fetch(e);if(n.ok){const s=await n.text();return t.codeBlock.trim?s.trim():s}else throw new Error(n.statusText)}function X(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function g(e,t){for(var n=0;n<t.length;n++){var s=t[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}function V(e,t,n){return t&&g(e.prototype,t),n&&g(e,n),e}var K=Object.defineProperty,d=function(e,t){return K(e,"name",{value:t,configurable:!0})},z=`<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
1
+ (function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".reveal pre,.external-code-wrapper{width:100%}:is(.external-code-wrapper footer.demo-ref):before{color:#0d99a5;margin-right:.3em}.external-code-wrapper footer.demo-ref{font-size:14px;margin-top:-18px;color:#0d99a5;text-align:right;cursor:help;transition:font-size .4s .1s}:is(.external-code-wrapper footer.demo-ref):hover{font-size:28px;cursor:none}")),document.head.appendChild(e)}}catch(r){console.error("vite-plugin-css-injected-by-js",r)}})();
2
+ (function(l,c){typeof exports=="object"&&typeof module<"u"?module.exports=c():typeof define=="function"&&define.amd?define(c):(l=typeof globalThis<"u"?globalThis:l||self,l.ClipCode=c())})(this,function(){"use strict";var Dt=Object.defineProperty;var Ut=(l,c,m)=>c in l?Dt(l,c,{enumerable:!0,configurable:!0,writable:!0,value:m}):l[c]=m;var B=(l,c,m)=>Ut(l,typeof c!="symbol"?c+"":c,m);class l extends Error{constructor(t){super(t)}}function c(e,t=!1){const s=t?-1:0;return e.replace(/\s/g,"").split(",").map(i=>{if(/^[\d-]+$/.test(i)){const[o,u]=i.split("-").map(d=>Number.parseInt(d,10)+s);return isNaN(u)?{start:o,end:o}:{start:o,end:u}}else throw new l(`could not parse ${i}`)})}function m(e){var n,i;const t=e.split(`
3
+ `),s=t[0];if(s.includes("@reveal.js/code")){const o=(i=(n=s.match(/lines=(['"]?(?<range>[\d,\s-]+)['"]?)/))==null?void 0:n.groups)==null?void 0:i.range,u=t.slice(1);if(o){const p=c(o,!0);return{lines:u,range:p,annotated:!0}}else return{lines:u,annotated:!0}}else return{lines:t,annotated:!1}}function W(e,t){return e.map((s,n)=>Z(n+1,t)?s:"…").filter((s,n,i)=>!(s==="…"&&i[n-1]==="…"))}function Z(e,t){return t.find(s=>e>=s.start&&e<=s.end)!==void 0}function G(e,t){e.parentNode?e.replaceWith(t):console.error("The element to be replaced is not attached to the DOM.")}function H(e,t){e.forEach(s=>{t.setAttribute(s.nodeName,s.nodeValue??"")})}function q(e){return e.split(".").pop()}class X{constructor(t,s,n,i,a){B(this,"providedLanguage");var o;this.attributes=t,this.src=s,this.href=n,this.codeStr=i,this.options=a,this.providedLanguage=(o=this.attributes.getNamedItem("data-lang"))==null?void 0:o.value}create(){const{wrapper:t,codeElement:s}=this._createElements(),n=this._codeClasses();return s.classList.add(...n),H([...this.attributes].filter(i=>i.nodeName!=="class"),s),s.innerHTML=this.codeStr,t}_createElements(){const t=this._createWrapper(),s=document.createElement("pre"),n=document.createElement("code"),i=this._footerHtml();return t.appendChild(s),s.appendChild(n),s.insertAdjacentHTML("afterend",i),{wrapper:t,codeElement:n}}_codeClasses(){const t=q(this.src),s=this.providedLanguage??t??"";return[...this.options.codeBlock.additionalClasses,s]}_footerHtml(){var s,n;return`<footer class="demo-ref"><a href="${(s=this.options)!=null&&s.local.absPath?`${this.options.local.scheme}${(n=this.options)==null?void 0:n.local.absPath}/${this.src}`:this.href}">${this.src}</a></footer>`}_createWrapper(){var s;const t=document.createElement("div");return t.classList.add("external-code-wrapper"),t.classList.add(...((s=this.attributes.getNamedItem("class"))==null?void 0:s.value.split(" "))??[]),t}}async function V(e,t){const s=await fetch(e);if(s.ok){const n=await s.text();return t.codeBlock.trim?n.trim():n}else throw new Error(s.statusText)}function K(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function z(e,t){for(var s=0;s<t.length;s++){var n=t[s];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function J(e,t,s){return t&&z(e.prototype,t),e}var Q=Object.defineProperty,f=function(e,t){return Q(e,"name",{value:t,configurable:!0})},tt=`<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
4
4
  <path d="m8.94 8 4.2-4.193a.67.67 0 0 0-.947-.947L8 7.06l-4.193-4.2a.67.67 0 1 0-.947.947L7.06 8l-4.2 4.193a.667.667 0 0 0 .217 1.093.666.666 0 0 0 .73-.146L8 8.94l4.193 4.2a.666.666 0 0 0 1.094-.217.665.665 0 0 0-.147-.73L8.94 8Z" fill="currentColor"/>
5
5
  </svg>
6
- `,J=`<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
6
+ `,et=`<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
7
7
  <path d="M16 2.667a13.333 13.333 0 1 0 0 26.666 13.333 13.333 0 0 0 0-26.666Zm0 24A10.667 10.667 0 0 1 5.333 16a10.56 10.56 0 0 1 2.254-6.533l14.946 14.946A10.56 10.56 0 0 1 16 26.667Zm8.413-4.134L9.467 7.587A10.56 10.56 0 0 1 16 5.333 10.667 10.667 0 0 1 26.667 16a10.56 10.56 0 0 1-2.254 6.533Z" fill="currentColor"/>
8
8
  </svg>
9
- `,Q=`<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
9
+ `,st=`<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
10
10
  <path d="M16 14.667A1.333 1.333 0 0 0 14.667 16v5.333a1.333 1.333 0 0 0 2.666 0V16A1.333 1.333 0 0 0 16 14.667Zm.507-5.227a1.333 1.333 0 0 0-1.014 0 1.334 1.334 0 0 0-.44.28 1.56 1.56 0 0 0-.28.44c-.075.158-.11.332-.106.507a1.332 1.332 0 0 0 .386.946c.13.118.279.213.44.28a1.334 1.334 0 0 0 1.84-1.226 1.4 1.4 0 0 0-.386-.947 1.334 1.334 0 0 0-.44-.28ZM16 2.667a13.333 13.333 0 1 0 0 26.666 13.333 13.333 0 0 0 0-26.666Zm0 24a10.666 10.666 0 1 1 0-21.333 10.666 10.666 0 0 1 0 21.333Z" fill="currentColor"/>
11
11
  </svg>
12
- `,tt=`<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
12
+ `,nt=`<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
13
13
  <path d="m19.627 11.72-5.72 5.733-2.2-2.2a1.334 1.334 0 1 0-1.88 1.881l3.133 3.146a1.333 1.333 0 0 0 1.88 0l6.667-6.667a1.333 1.333 0 1 0-1.88-1.893ZM16 2.667a13.333 13.333 0 1 0 0 26.666 13.333 13.333 0 0 0 0-26.666Zm0 24a10.666 10.666 0 1 1 0-21.333 10.666 10.666 0 0 1 0 21.333Z" fill="currentColor"/>
14
14
  </svg>
15
- `,et=`<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
15
+ `,it=`<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
16
16
  <path d="M16.334 17.667a1.334 1.334 0 0 0 1.334-1.333v-5.333a1.333 1.333 0 0 0-2.665 0v5.333a1.333 1.333 0 0 0 1.33 1.333Zm-.508 5.227c.325.134.69.134 1.014 0 .165-.064.314-.159.44-.28a1.56 1.56 0 0 0 .28-.44c.076-.158.112-.332.107-.507a1.332 1.332 0 0 0-.387-.946 1.532 1.532 0 0 0-.44-.28 1.334 1.334 0 0 0-1.838 1.226 1.4 1.4 0 0 0 .385.947c.127.121.277.216.44.28Zm.508 6.773a13.333 13.333 0 1 0 0-26.667 13.333 13.333 0 0 0 0 26.667Zm0-24A10.667 10.667 0 1 1 16.54 27a10.667 10.667 0 0 1-.206-21.333Z" fill="currentColor"/>
17
17
  </svg>
18
- `,nt=d(function(e){return new DOMParser().parseFromString(e,"text/html").body.childNodes[0]},"stringToHTML"),O=d(function(e){var t=new DOMParser().parseFromString(e,"application/xml");return document.importNode(t.documentElement,!0).outerHTML},"getSvgNode"),r={CONTAINER:"sn-notifications-container",NOTIFY:"sn-notify",NOTIFY_CONTENT:"sn-notify-content",NOTIFY_ICON:"sn-notify-icon",NOTIFY_CLOSE:"sn-notify-close",NOTIFY_TITLE:"sn-notify-title",NOTIFY_TEXT:"sn-notify-text",IS_X_CENTER:"sn-is-x-center",IS_Y_CENTER:"sn-is-y-center",IS_CENTER:"sn-is-center",IS_LEFT:"sn-is-left",IS_RIGHT:"sn-is-right",IS_TOP:"sn-is-top",IS_BOTTOM:"sn-is-bottom",NOTIFY_OUTLINE:"sn-notify-outline",NOTIFY_FILLED:"sn-notify-filled",NOTIFY_ERROR:"sn-notify-error",NOTIFY_WARNING:"sn-notify-warning",NOTIFY_SUCCESS:"sn-notify-success",NOTIFY_INFO:"sn-notify-info",NOTIFY_FADE:"sn-notify-fade",NOTIFY_FADE_IN:"sn-notify-fade-in",NOTIFY_SLIDE:"sn-notify-slide",NOTIFY_SLIDE_IN:"sn-notify-slide-in",NOTIFY_AUTOCLOSE:"sn-notify-autoclose"},p={ERROR:"error",WARNING:"warning",SUCCESS:"success",INFO:"info"},w={OUTLINE:"outline",FILLED:"filled"},y={FADE:"fade",SLIDE:"slide"},I={CLOSE:O(z),SUCCESS:O(tt),ERROR:O(J),WARNING:O(et),INFO:O(Q)},T=d(function(e){e.wrapper.classList.add(r.NOTIFY_FADE),setTimeout(function(){e.wrapper.classList.add(r.NOTIFY_FADE_IN)},100)},"fadeIn"),b=d(function(e){e.wrapper.classList.remove(r.NOTIFY_FADE_IN),setTimeout(function(){e.wrapper.remove()},e.speed)},"fadeOut"),st=d(function(e){e.wrapper.classList.add(r.NOTIFY_SLIDE),setTimeout(function(){e.wrapper.classList.add(r.NOTIFY_SLIDE_IN)},100)},"slideIn"),it=d(function(e){e.wrapper.classList.remove(r.NOTIFY_SLIDE_IN),setTimeout(function(){e.wrapper.remove()},e.speed)},"slideOut"),L=function(){function e(t){var n=this;X(this,e),this.notifyOut=d(function(Pt){Pt(n)},"notifyOut");var s=t.notificationsGap,i=s===void 0?20:s,a=t.notificationsPadding,o=a===void 0?20:a,l=t.status,f=l===void 0?"success":l,h=t.effect,F=h===void 0?y.FADE:h,N=t.type,bt=N===void 0?"outline":N,Lt=t.title,Ct=t.text,R=t.showIcon,St=R===void 0?!0:R,A=t.customIcon,_t=A===void 0?"":A,Y=t.customClass,Ft=Y===void 0?"":Y,x=t.speed,Rt=x===void 0?500:x,j=t.showCloseButton,At=j===void 0?!0:j,M=t.autoclose,Yt=M===void 0?!0:M,P=t.autotimeout,xt=P===void 0?3e3:P,D=t.position,jt=D===void 0?"right top":D,U=t.customWrapper,Mt=U===void 0?"":U;if(this.customWrapper=Mt,this.status=f,this.title=Lt,this.text=Ct,this.showIcon=St,this.customIcon=_t,this.customClass=Ft,this.speed=Rt,this.effect=F,this.showCloseButton=At,this.autoclose=Yt,this.autotimeout=xt,this.notificationsGap=i,this.notificationsPadding=o,this.type=bt,this.position=jt,!this.checkRequirements()){console.error("You must specify 'title' or 'text' at least.");return}this.setContainer(),this.setWrapper(),this.setPosition(),this.showIcon&&this.setIcon(),this.showCloseButton&&this.setCloseButton(),this.setContent(),this.container.prepend(this.wrapper),this.setEffect(),this.notifyIn(this.selectedNotifyInEffect),this.autoclose&&this.autoClose(),this.setObserver()}return V(e,[{key:"checkRequirements",value:function(){return!!(this.title||this.text)}},{key:"setContainer",value:function(){var n=document.querySelector(".".concat(r.CONTAINER));n?this.container=n:(this.container=document.createElement("div"),this.container.classList.add(r.CONTAINER),document.body.appendChild(this.container)),this.notificationsPadding&&this.container.style.setProperty("--sn-notifications-padding","".concat(this.notificationsPadding,"px")),this.notificationsGap&&this.container.style.setProperty("--sn-notifications-gap","".concat(this.notificationsGap,"px"))}},{key:"setPosition",value:function(){this.container.classList[this.position==="center"?"add":"remove"](r.IS_CENTER),this.container.classList[this.position.includes("left")?"add":"remove"](r.IS_LEFT),this.container.classList[this.position.includes("right")?"add":"remove"](r.IS_RIGHT),this.container.classList[this.position.includes("top")?"add":"remove"](r.IS_TOP),this.container.classList[this.position.includes("bottom")?"add":"remove"](r.IS_BOTTOM),this.container.classList[this.position.includes("x-center")?"add":"remove"](r.IS_X_CENTER),this.container.classList[this.position.includes("y-center")?"add":"remove"](r.IS_Y_CENTER)}},{key:"setCloseButton",value:function(){var n=this,s=document.createElement("div");s.classList.add(r.NOTIFY_CLOSE),s.innerHTML=I.CLOSE,this.wrapper.appendChild(s),s.addEventListener("click",function(){n.close()})}},{key:"setWrapper",value:function(){var n=this;switch(this.customWrapper?this.wrapper=nt(this.customWrapper):this.wrapper=document.createElement("div"),this.wrapper.style.setProperty("--sn-notify-transition-duration","".concat(this.speed,"ms")),this.wrapper.classList.add(r.NOTIFY),this.type){case w.OUTLINE:this.wrapper.classList.add(r.NOTIFY_OUTLINE);break;case w.FILLED:this.wrapper.classList.add(r.NOTIFY_FILLED);break;default:this.wrapper.classList.add(r.NOTIFY_OUTLINE)}switch(this.status){case p.SUCCESS:this.wrapper.classList.add(r.NOTIFY_SUCCESS);break;case p.ERROR:this.wrapper.classList.add(r.NOTIFY_ERROR);break;case p.WARNING:this.wrapper.classList.add(r.NOTIFY_WARNING);break;case p.INFO:this.wrapper.classList.add(r.NOTIFY_INFO);break}this.autoclose&&(this.wrapper.classList.add(r.NOTIFY_AUTOCLOSE),this.wrapper.style.setProperty("--sn-notify-autoclose-timeout","".concat(this.autotimeout+this.speed,"ms"))),this.customClass&&this.customClass.split(" ").forEach(function(s){n.wrapper.classList.add(s)})}},{key:"setContent",value:function(){var n=document.createElement("div");n.classList.add(r.NOTIFY_CONTENT);var s,i;this.title&&(s=document.createElement("div"),s.classList.add(r.NOTIFY_TITLE),s.textContent=this.title.trim(),this.showCloseButton||(s.style.paddingRight="0")),this.text&&(i=document.createElement("div"),i.classList.add(r.NOTIFY_TEXT),i.innerHTML=this.text.trim(),this.title||(i.style.marginTop="0")),this.wrapper.appendChild(n),this.title&&n.appendChild(s),this.text&&n.appendChild(i)}},{key:"setIcon",value:function(){var n=d(function(i){switch(i){case p.SUCCESS:return I.SUCCESS;case p.ERROR:return I.ERROR;case p.WARNING:return I.WARNING;case p.INFO:return I.INFO}},"computedIcon"),s=document.createElement("div");s.classList.add(r.NOTIFY_ICON),s.innerHTML=this.customIcon||n(this.status),(this.status||this.customIcon)&&this.wrapper.appendChild(s)}},{key:"setObserver",value:function(){var n=this,s=new IntersectionObserver(function(i){if(i[0].intersectionRatio<=0)n.close();else return},{threshold:0});setTimeout(function(){s.observe(n.wrapper)},this.speed)}},{key:"notifyIn",value:function(t){t(this)}},{key:"autoClose",value:function(){var n=this;setTimeout(function(){n.close()},this.autotimeout+this.speed)}},{key:"close",value:function(){this.notifyOut(this.selectedNotifyOutEffect)}},{key:"setEffect",value:function(){switch(this.effect){case y.FADE:this.selectedNotifyInEffect=T,this.selectedNotifyOutEffect=b;break;case y.SLIDE:this.selectedNotifyInEffect=st,this.selectedNotifyOutEffect=it;break;default:this.selectedNotifyInEffect=T,this.selectedNotifyOutEffect=b}}}]),e}();d(L,"Notify");var C=L;globalThis.Notify=C;function rt(e,t){const n=window.location.href,s=new URL(n);return`${s.port?`${s.protocol}//${s.hostname}:${s.port}`:`${s.protocol}//${s.hostname}`}${e==="/"?"":e}/${t}`}function ot(e,t){const{range:n,lines:s,annotated:i}=m(e),a=t?c(t,i):void 0,o=n??a;return(o?$(s,o):s).join(`
19
- `)}async function at(e,t){const n=e.querySelectorAll("object[type='reveal.js/code']"),s=Array.from(n).map(async i=>{const a=i.getAttribute("data-src"),o=i.getAttribute("data-lines");if(a){const l=rt(t.basePath,a);try{const f=await q(l,t);if(f){const h=ot(f,o),N=new H(i.attributes,a,l,h,t).create();W(i,N)}}catch(f){const h=`exception while processing external code ${a}`;t.enableNotify&&new C({text:h}),console.error(h,f)}}else console.error("object[type='reveal.js/code'] has no src attribute",i)});return Promise.all(s)}function ct(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var lt=function(t){return ut(t)&&!dt(t)};function ut(e){return!!e&&typeof e=="object"}function dt(e){var t=Object.prototype.toString.call(e);return t==="[object RegExp]"||t==="[object Date]"||pt(e)}var ft=typeof Symbol=="function"&&Symbol.for,ht=ft?Symbol.for("react.element"):60103;function pt(e){return e.$$typeof===ht}function mt(e){return Array.isArray(e)?[]:{}}function E(e,t){return t.clone!==!1&&t.isMergeableObject(e)?v(mt(e),e,t):e}function vt(e,t,n){return e.concat(t).map(function(s){return E(s,n)})}function Ot(e,t){if(!t.customMerge)return v;var n=t.customMerge(e);return typeof n=="function"?n:v}function It(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(t){return Object.propertyIsEnumerable.call(e,t)}):[]}function S(e){return Object.keys(e).concat(It(e))}function _(e,t){try{return t in e}catch{return!1}}function Et(e,t){return _(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))}function Nt(e,t,n){var s={};return n.isMergeableObject(e)&&S(e).forEach(function(i){s[i]=E(e[i],n)}),S(t).forEach(function(i){Et(e,i)||(_(e,i)&&n.isMergeableObject(t[i])?s[i]=Ot(i,n)(e[i],t[i],n):s[i]=E(t[i],n))}),s}function v(e,t,n){n=n||{},n.arrayMerge=n.arrayMerge||vt,n.isMergeableObject=n.isMergeableObject||lt,n.cloneUnlessOtherwiseSpecified=E;var s=Array.isArray(t),i=Array.isArray(e),a=s===i;return a?s?n.arrayMerge(e,t,n):Nt(e,t,n):E(t,n)}v.all=function(t,n){if(!Array.isArray(t))throw new Error("first argument should be an array");return t.reduce(function(s,i){return v(s,i,n)},{})};var yt=v,gt=yt;const wt=ct(gt),Tt={basePath:"/",enableNotify:!0,codeBlock:{trim:!0,additionalClasses:[]},local:{scheme:"vscode://file//"}};return()=>({id:"external-code",init:e=>{const t=e.getRevealElement();if(!t)console.error("Cannot find reveal element");else{const s=e.getConfig().externalCode??{},i=wt(Tt,s);return at(t,i)}}})});
18
+ `,rt=f(function(e){return new DOMParser().parseFromString(e,"text/html").body.childNodes[0]},"stringToHTML"),I=f(function(e){var t=new DOMParser().parseFromString(e,"application/xml");return document.importNode(t.documentElement,!0).outerHTML},"getSvgNode"),r={CONTAINER:"sn-notifications-container",NOTIFY:"sn-notify",NOTIFY_CONTENT:"sn-notify-content",NOTIFY_ICON:"sn-notify-icon",NOTIFY_CLOSE:"sn-notify-close",NOTIFY_TITLE:"sn-notify-title",NOTIFY_TEXT:"sn-notify-text",IS_X_CENTER:"sn-is-x-center",IS_Y_CENTER:"sn-is-y-center",IS_CENTER:"sn-is-center",IS_LEFT:"sn-is-left",IS_RIGHT:"sn-is-right",IS_TOP:"sn-is-top",IS_BOTTOM:"sn-is-bottom",NOTIFY_OUTLINE:"sn-notify-outline",NOTIFY_FILLED:"sn-notify-filled",NOTIFY_ERROR:"sn-notify-error",NOTIFY_WARNING:"sn-notify-warning",NOTIFY_SUCCESS:"sn-notify-success",NOTIFY_INFO:"sn-notify-info",NOTIFY_FADE:"sn-notify-fade",NOTIFY_FADE_IN:"sn-notify-fade-in",NOTIFY_SLIDE:"sn-notify-slide",NOTIFY_SLIDE_IN:"sn-notify-slide-in",NOTIFY_AUTOCLOSE:"sn-notify-autoclose"},h={ERROR:"error",WARNING:"warning",SUCCESS:"success",INFO:"info"},b={OUTLINE:"outline",FILLED:"filled"},w={FADE:"fade",SLIDE:"slide"},E={CLOSE:I(tt),SUCCESS:I(nt),ERROR:I(et),WARNING:I(it),INFO:I(st)},L=f(function(e){e.wrapper.classList.add(r.NOTIFY_FADE),setTimeout(function(){e.wrapper.classList.add(r.NOTIFY_FADE_IN)},100)},"fadeIn"),C=f(function(e){e.wrapper.classList.remove(r.NOTIFY_FADE_IN),setTimeout(function(){e.wrapper.remove()},e.speed)},"fadeOut"),ot=f(function(e){e.wrapper.classList.add(r.NOTIFY_SLIDE),setTimeout(function(){e.wrapper.classList.add(r.NOTIFY_SLIDE_IN)},100)},"slideIn"),at=f(function(e){e.wrapper.classList.remove(r.NOTIFY_SLIDE_IN),setTimeout(function(){e.wrapper.remove()},e.speed)},"slideOut"),S=function(){function e(t){var s=this;K(this,e),this.notifyOut=f(function(Pt){Pt(s)},"notifyOut");var n=t.notificationsGap,i=n===void 0?20:n,a=t.notificationsPadding,o=a===void 0?20:a,u=t.status,p=u===void 0?"success":u,d=t.effect,O=d===void 0?w.FADE:d,y=t.type,A=y===void 0?"outline":y,T=t.title,g=t.text,Y=t.showIcon,St=Y===void 0?!0:Y,x=t.customIcon,_t=x===void 0?"":x,j=t.customClass,Ft=j===void 0?"":j,M=t.speed,Rt=M===void 0?500:M,P=t.showCloseButton,At=P===void 0?!0:P,D=t.autoclose,Yt=D===void 0?!0:D,U=t.autotimeout,xt=U===void 0?3e3:U,k=t.position,jt=k===void 0?"right top":k,$=t.customWrapper,Mt=$===void 0?"":$;if(this.customWrapper=Mt,this.status=p,this.title=T,this.text=g,this.showIcon=St,this.customIcon=_t,this.customClass=Ft,this.speed=Rt,this.effect=O,this.showCloseButton=At,this.autoclose=Yt,this.autotimeout=xt,this.notificationsGap=i,this.notificationsPadding=o,this.type=A,this.position=jt,!this.checkRequirements()){console.error("You must specify 'title' or 'text' at least.");return}this.setContainer(),this.setWrapper(),this.setPosition(),this.showIcon&&this.setIcon(),this.showCloseButton&&this.setCloseButton(),this.setContent(),this.container.prepend(this.wrapper),this.setEffect(),this.notifyIn(this.selectedNotifyInEffect),this.autoclose&&this.autoClose(),this.setObserver()}return J(e,[{key:"checkRequirements",value:function(){return!!(this.title||this.text)}},{key:"setContainer",value:function(){var s=document.querySelector(".".concat(r.CONTAINER));s?this.container=s:(this.container=document.createElement("div"),this.container.classList.add(r.CONTAINER),document.body.appendChild(this.container)),this.notificationsPadding&&this.container.style.setProperty("--sn-notifications-padding","".concat(this.notificationsPadding,"px")),this.notificationsGap&&this.container.style.setProperty("--sn-notifications-gap","".concat(this.notificationsGap,"px"))}},{key:"setPosition",value:function(){this.container.classList[this.position==="center"?"add":"remove"](r.IS_CENTER),this.container.classList[this.position.includes("left")?"add":"remove"](r.IS_LEFT),this.container.classList[this.position.includes("right")?"add":"remove"](r.IS_RIGHT),this.container.classList[this.position.includes("top")?"add":"remove"](r.IS_TOP),this.container.classList[this.position.includes("bottom")?"add":"remove"](r.IS_BOTTOM),this.container.classList[this.position.includes("x-center")?"add":"remove"](r.IS_X_CENTER),this.container.classList[this.position.includes("y-center")?"add":"remove"](r.IS_Y_CENTER)}},{key:"setCloseButton",value:function(){var s=this,n=document.createElement("div");n.classList.add(r.NOTIFY_CLOSE),n.innerHTML=E.CLOSE,this.wrapper.appendChild(n),n.addEventListener("click",function(){s.close()})}},{key:"setWrapper",value:function(){var s=this;switch(this.customWrapper?this.wrapper=rt(this.customWrapper):this.wrapper=document.createElement("div"),this.wrapper.style.setProperty("--sn-notify-transition-duration","".concat(this.speed,"ms")),this.wrapper.classList.add(r.NOTIFY),this.type){case b.OUTLINE:this.wrapper.classList.add(r.NOTIFY_OUTLINE);break;case b.FILLED:this.wrapper.classList.add(r.NOTIFY_FILLED);break;default:this.wrapper.classList.add(r.NOTIFY_OUTLINE)}switch(this.status){case h.SUCCESS:this.wrapper.classList.add(r.NOTIFY_SUCCESS);break;case h.ERROR:this.wrapper.classList.add(r.NOTIFY_ERROR);break;case h.WARNING:this.wrapper.classList.add(r.NOTIFY_WARNING);break;case h.INFO:this.wrapper.classList.add(r.NOTIFY_INFO);break}this.autoclose&&(this.wrapper.classList.add(r.NOTIFY_AUTOCLOSE),this.wrapper.style.setProperty("--sn-notify-autoclose-timeout","".concat(this.autotimeout+this.speed,"ms"))),this.customClass&&this.customClass.split(" ").forEach(function(n){s.wrapper.classList.add(n)})}},{key:"setContent",value:function(){var s=document.createElement("div");s.classList.add(r.NOTIFY_CONTENT);var n,i;this.title&&(n=document.createElement("div"),n.classList.add(r.NOTIFY_TITLE),n.textContent=this.title.trim(),this.showCloseButton||(n.style.paddingRight="0")),this.text&&(i=document.createElement("div"),i.classList.add(r.NOTIFY_TEXT),i.innerHTML=this.text.trim(),this.title||(i.style.marginTop="0")),this.wrapper.appendChild(s),this.title&&s.appendChild(n),this.text&&s.appendChild(i)}},{key:"setIcon",value:function(){var s=f(function(i){switch(i){case h.SUCCESS:return E.SUCCESS;case h.ERROR:return E.ERROR;case h.WARNING:return E.WARNING;case h.INFO:return E.INFO}},"computedIcon"),n=document.createElement("div");n.classList.add(r.NOTIFY_ICON),n.innerHTML=this.customIcon||s(this.status),(this.status||this.customIcon)&&this.wrapper.appendChild(n)}},{key:"setObserver",value:function(){var s=this,n=new IntersectionObserver(function(i){if(i[0].intersectionRatio<=0)s.close();else return},{threshold:0});setTimeout(function(){n.observe(s.wrapper)},this.speed)}},{key:"notifyIn",value:function(t){t(this)}},{key:"autoClose",value:function(){var s=this;setTimeout(function(){s.close()},this.autotimeout+this.speed)}},{key:"close",value:function(){this.notifyOut(this.selectedNotifyOutEffect)}},{key:"setEffect",value:function(){switch(this.effect){case w.FADE:this.selectedNotifyInEffect=L,this.selectedNotifyOutEffect=C;break;case w.SLIDE:this.selectedNotifyInEffect=ot,this.selectedNotifyOutEffect=at;break;default:this.selectedNotifyInEffect=L,this.selectedNotifyOutEffect=C}}}]),e}();f(S,"Notify");var _=S;globalThis.Notify=_;function ct(e,t){const s=window.location.href,n=new URL(s);return`${n.port?`${n.protocol}//${n.hostname}:${n.port}`:`${n.protocol}//${n.hostname}`}${e==="/"?"":e}/${t}`}function lt(e,t){const{range:s,lines:n,annotated:i}=m(e),a=t?c(t,i):void 0,o=s??a;return(o?W(n,o):n).join(`
19
+ `)}async function ut(e,t){const s=e.querySelectorAll("object[type='reveal.js/code']"),n=Array.from(s).map(async i=>{const a=i.getAttribute("data-src"),o=i.getAttribute("data-lines"),u=i.hasAttribute("data-escape-code");if(a){const p=ct(t.basePath,a);try{const d=await V(p,t);if(d){const O=u?d.replace(/[&<>'"]/g,g=>({"&":"&amp;","<":"&lt;",">":"&gt;","'":"&#39;",'"':"&quot;"})[g]||g):d,y=lt(O,o),T=new X(i.attributes,a,p,y,t).create();G(i,T)}}catch(d){const O=`exception while processing external code ${a}`;t.enableNotify&&new _({text:O}),console.error(O,d)}}else console.error("object[type='reveal.js/code'] has no src attribute",i)});return Promise.all(n)}function dt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ft=function(t){return ht(t)&&!pt(t)};function ht(e){return!!e&&typeof e=="object"}function pt(e){var t=Object.prototype.toString.call(e);return t==="[object RegExp]"||t==="[object Date]"||Ot(e)}var mt=typeof Symbol=="function"&&Symbol.for,vt=mt?Symbol.for("react.element"):60103;function Ot(e){return e.$$typeof===vt}function It(e){return Array.isArray(e)?[]:{}}function N(e,t){return t.clone!==!1&&t.isMergeableObject(e)?v(It(e),e,t):e}function Et(e,t,s){return e.concat(t).map(function(n){return N(n,s)})}function Nt(e,t){if(!t.customMerge)return v;var s=t.customMerge(e);return typeof s=="function"?s:v}function yt(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(t){return Object.propertyIsEnumerable.call(e,t)}):[]}function F(e){return Object.keys(e).concat(yt(e))}function R(e,t){try{return t in e}catch{return!1}}function gt(e,t){return R(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))}function wt(e,t,s){var n={};return s.isMergeableObject(e)&&F(e).forEach(function(i){n[i]=N(e[i],s)}),F(t).forEach(function(i){gt(e,i)||(R(e,i)&&s.isMergeableObject(t[i])?n[i]=Nt(i,s)(e[i],t[i],s):n[i]=N(t[i],s))}),n}function v(e,t,s){s=s||{},s.arrayMerge=s.arrayMerge||Et,s.isMergeableObject=s.isMergeableObject||ft,s.cloneUnlessOtherwiseSpecified=N;var n=Array.isArray(t),i=Array.isArray(e),a=n===i;return a?n?s.arrayMerge(e,t,s):wt(e,t,s):N(t,s)}v.all=function(t,s){if(!Array.isArray(t))throw new Error("first argument should be an array");return t.reduce(function(n,i){return v(n,i,s)},{})};var Tt=v,bt=Tt;const Lt=dt(bt),Ct={basePath:"/",enableNotify:!0,codeBlock:{trim:!0,additionalClasses:[]},local:{scheme:"vscode://file//"}};return()=>({id:"external-code",init:e=>{const t=e.getRevealElement();if(!t)console.error("Cannot find reveal element");else{const n=e.getConfig().externalCode??{},i=Lt(Ct,n);return ut(t,i)}}})});
@@ -1,5 +1,4 @@
1
1
  import { Options } from '../options.ts';
2
-
3
2
  /**
4
3
  * fetch the code from the server
5
4
  * @throws an Error when res.ok is false (and passes on native fetch errors)
@@ -1,3 +1,2 @@
1
1
  import { Options } from '../options.ts';
2
-
3
2
  export declare function run(revealElement: HTMLElement, options: Options): Promise<void[]>;
@@ -1,5 +1,4 @@
1
1
  import { Range } from './range-parser.ts';
2
-
3
2
  export interface ParseResult {
4
3
  lines: string[];
5
4
  range?: Range[];
@@ -1,5 +1,4 @@
1
1
  import { Range } from './parsers/range-parser.ts';
2
-
3
2
  /**
4
3
  * strips lines using the provided range
5
4
  * @param lines
@@ -1,5 +1,4 @@
1
1
  import { Options } from '../../options.ts';
2
-
3
2
  export declare class Structure {
4
3
  private readonly attributes;
5
4
  private readonly src;
package/dist/options.d.ts CHANGED
@@ -1,6 +1,5 @@
1
- import { DeepPartial } from './util/utility-types.ts';
2
1
  import { Options as RevealOptions } from 'reveal.js';
3
-
2
+ import { DeepPartial } from './util/utility-types.ts';
4
3
  export type CodeBlockOptions = {
5
4
  trim: boolean;
6
5
  additionalClasses: string[];
package/dist/plugin.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import { Api as RevealAPI } from 'reveal.js';
2
-
3
2
  declare const _default: () => {
4
3
  id: string;
5
4
  init: (deck: RevealAPI) => Promise<void[]> | undefined;
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "syntax",
11
11
  "diagrams"
12
12
  ],
13
- "version": "1.0.5",
13
+ "version": "1.1.7",
14
14
  "files": [
15
15
  "dist"
16
16
  ],
@@ -46,7 +46,7 @@
46
46
  "typescript": "^5.2.2",
47
47
  "vite": "^5.2.0",
48
48
  "vite-plugin-css-injected-by-js": "^3.5.0",
49
- "vite-plugin-dts": "^3.8.0",
49
+ "vite-plugin-dts": "^4.5.4",
50
50
  "vite-plugin-remove-console": "^2.2.0",
51
51
  "vitest": "^2.0.5"
52
52
  },