@edc4it/reveal.js-external-code 1.0.2 → 1.0.4
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 +2 -0
- package/dist/external-code.es.js +34 -30
- package/dist/external-code.umd.js +4 -4
- package/dist/util/url-util.d.ts +1 -0
- package/package.json +2 -1
package/README.md
CHANGED
package/dist/external-code.es.js
CHANGED
|
@@ -175,8 +175,8 @@ var dt = Object.defineProperty, d = function(e, t) {
|
|
|
175
175
|
lt(this, e), this.notifyOut = d(function(z) {
|
|
176
176
|
z(s);
|
|
177
177
|
}, "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,
|
|
179
|
-
if (this.customWrapper = K, this.status = l, this.title =
|
|
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()) {
|
|
180
180
|
console.error("You must specify 'title' or 'text' at least.");
|
|
181
181
|
return;
|
|
182
182
|
}
|
|
@@ -278,19 +278,23 @@ d(j, "Notify");
|
|
|
278
278
|
var P = j;
|
|
279
279
|
globalThis.Notify = P;
|
|
280
280
|
function Nt(e, t) {
|
|
281
|
+
const s = window.location.href, n = new URL(s);
|
|
282
|
+
return `${n.port ? `${n.protocol}//${n.hostname}:${n.port}` : `${n.protocol}//${n.hostname}`}${e === "/" ? "" : e}/${t}`;
|
|
283
|
+
}
|
|
284
|
+
function yt(e, t) {
|
|
281
285
|
const { range: s, lines: n, annotated: i } = et(e), a = t ? M(t, i) : void 0, o = s ?? a;
|
|
282
286
|
return (o ? st(n, o) : n).join(`
|
|
283
287
|
`);
|
|
284
288
|
}
|
|
285
|
-
async function
|
|
289
|
+
async function gt(e, t) {
|
|
286
290
|
const s = e.querySelectorAll("object[type='reveal.js/code']"), n = Array.from(s).map(async (i) => {
|
|
287
291
|
const a = i.getAttribute("data-src"), o = i.getAttribute("data-lines");
|
|
288
292
|
if (a) {
|
|
289
|
-
const c =
|
|
293
|
+
const c = Nt(t.basePath, a);
|
|
290
294
|
try {
|
|
291
295
|
const l = await ct(c, t);
|
|
292
296
|
if (l) {
|
|
293
|
-
const u =
|
|
297
|
+
const u = yt(l, o), O = new at(i.attributes, a, c, u, t).create();
|
|
294
298
|
it(i, O);
|
|
295
299
|
}
|
|
296
300
|
} catch (l) {
|
|
@@ -302,47 +306,47 @@ async function yt(e, t) {
|
|
|
302
306
|
});
|
|
303
307
|
return Promise.all(n);
|
|
304
308
|
}
|
|
305
|
-
function
|
|
309
|
+
function wt(e) {
|
|
306
310
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
307
311
|
}
|
|
308
312
|
var Tt = function(t) {
|
|
309
|
-
return
|
|
313
|
+
return bt(t) && !Lt(t);
|
|
310
314
|
};
|
|
311
|
-
function
|
|
315
|
+
function bt(e) {
|
|
312
316
|
return !!e && typeof e == "object";
|
|
313
317
|
}
|
|
314
|
-
function
|
|
318
|
+
function Lt(e) {
|
|
315
319
|
var t = Object.prototype.toString.call(e);
|
|
316
|
-
return t === "[object RegExp]" || t === "[object Date]" ||
|
|
317
|
-
}
|
|
318
|
-
var Lt = typeof Symbol == "function" && Symbol.for, Ct = Lt ? Symbol.for("react.element") : 60103;
|
|
319
|
-
function St(e) {
|
|
320
|
-
return e.$$typeof === Ct;
|
|
320
|
+
return t === "[object RegExp]" || t === "[object Date]" || _t(e);
|
|
321
321
|
}
|
|
322
|
+
var Ct = typeof Symbol == "function" && Symbol.for, St = Ct ? Symbol.for("react.element") : 60103;
|
|
322
323
|
function _t(e) {
|
|
324
|
+
return e.$$typeof === St;
|
|
325
|
+
}
|
|
326
|
+
function Ft(e) {
|
|
323
327
|
return Array.isArray(e) ? [] : {};
|
|
324
328
|
}
|
|
325
329
|
function v(e, t) {
|
|
326
|
-
return t.clone !== !1 && t.isMergeableObject(e) ? h(
|
|
330
|
+
return t.clone !== !1 && t.isMergeableObject(e) ? h(Ft(e), e, t) : e;
|
|
327
331
|
}
|
|
328
|
-
function
|
|
332
|
+
function Rt(e, t, s) {
|
|
329
333
|
return e.concat(t).map(function(n) {
|
|
330
334
|
return v(n, s);
|
|
331
335
|
});
|
|
332
336
|
}
|
|
333
|
-
function
|
|
337
|
+
function At(e, t) {
|
|
334
338
|
if (!t.customMerge)
|
|
335
339
|
return h;
|
|
336
340
|
var s = t.customMerge(e);
|
|
337
341
|
return typeof s == "function" ? s : h;
|
|
338
342
|
}
|
|
339
|
-
function
|
|
343
|
+
function Yt(e) {
|
|
340
344
|
return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(e).filter(function(t) {
|
|
341
345
|
return Object.propertyIsEnumerable.call(e, t);
|
|
342
346
|
}) : [];
|
|
343
347
|
}
|
|
344
348
|
function x(e) {
|
|
345
|
-
return Object.keys(e).concat(
|
|
349
|
+
return Object.keys(e).concat(Yt(e));
|
|
346
350
|
}
|
|
347
351
|
function D(e, t) {
|
|
348
352
|
try {
|
|
@@ -351,21 +355,21 @@ function D(e, t) {
|
|
|
351
355
|
return !1;
|
|
352
356
|
}
|
|
353
357
|
}
|
|
354
|
-
function
|
|
358
|
+
function xt(e, t) {
|
|
355
359
|
return D(e, t) && !(Object.hasOwnProperty.call(e, t) && Object.propertyIsEnumerable.call(e, t));
|
|
356
360
|
}
|
|
357
|
-
function
|
|
361
|
+
function Mt(e, t, s) {
|
|
358
362
|
var n = {};
|
|
359
363
|
return s.isMergeableObject(e) && x(e).forEach(function(i) {
|
|
360
364
|
n[i] = v(e[i], s);
|
|
361
365
|
}), x(t).forEach(function(i) {
|
|
362
|
-
|
|
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));
|
|
363
367
|
}), n;
|
|
364
368
|
}
|
|
365
369
|
function h(e, t, s) {
|
|
366
|
-
s = s || {}, s.arrayMerge = s.arrayMerge ||
|
|
370
|
+
s = s || {}, s.arrayMerge = s.arrayMerge || Rt, s.isMergeableObject = s.isMergeableObject || Tt, s.cloneUnlessOtherwiseSpecified = v;
|
|
367
371
|
var n = Array.isArray(t), i = Array.isArray(e), a = n === i;
|
|
368
|
-
return a ? n ? s.arrayMerge(e, t, s) :
|
|
372
|
+
return a ? n ? s.arrayMerge(e, t, s) : Mt(e, t, s) : v(t, s);
|
|
369
373
|
}
|
|
370
374
|
h.all = function(t, s) {
|
|
371
375
|
if (!Array.isArray(t))
|
|
@@ -374,8 +378,8 @@ h.all = function(t, s) {
|
|
|
374
378
|
return h(n, i, s);
|
|
375
379
|
}, {});
|
|
376
380
|
};
|
|
377
|
-
var
|
|
378
|
-
const
|
|
381
|
+
var jt = h, Pt = jt;
|
|
382
|
+
const Dt = /* @__PURE__ */ wt(Pt), Ut = {
|
|
379
383
|
basePath: "/",
|
|
380
384
|
enableNotify: !0,
|
|
381
385
|
codeBlock: {
|
|
@@ -385,18 +389,18 @@ const Pt = /* @__PURE__ */ gt(jt), Dt = {
|
|
|
385
389
|
local: {
|
|
386
390
|
scheme: "vscode://file//"
|
|
387
391
|
}
|
|
388
|
-
},
|
|
392
|
+
}, $t = () => ({
|
|
389
393
|
id: "external-code",
|
|
390
394
|
init: (e) => {
|
|
391
395
|
const t = e.getRevealElement();
|
|
392
396
|
if (!t)
|
|
393
397
|
console.error("Cannot find reveal element");
|
|
394
398
|
else {
|
|
395
|
-
const n = e.getConfig().externalCode ?? {}, i =
|
|
396
|
-
return
|
|
399
|
+
const n = e.getConfig().externalCode ?? {}, i = Dt(Ut, n);
|
|
400
|
+
return gt(t, i);
|
|
397
401
|
}
|
|
398
402
|
}
|
|
399
403
|
});
|
|
400
404
|
export {
|
|
401
|
-
|
|
405
|
+
$t as default
|
|
402
406
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
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
|
|
3
|
-
`),
|
|
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">
|
|
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
6
|
`,J=`<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
@@ -15,5 +15,5 @@
|
|
|
15
15
|
`,et=`<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
|
-
`,
|
|
19
|
-
`)}async function
|
|
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)}}})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getAbsUrl(basePath: string, relUrl: string): string;
|
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"syntax",
|
|
11
11
|
"diagrams"
|
|
12
12
|
],
|
|
13
|
-
"version": "1.0.
|
|
13
|
+
"version": "1.0.4",
|
|
14
14
|
"files": [
|
|
15
15
|
"dist"
|
|
16
16
|
],
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
},
|
|
22
22
|
"main": "./dist/external-code.umd.js",
|
|
23
23
|
"module": "./dist/external-code.es.js",
|
|
24
|
+
"types": "./dist/plugin.d.ts",
|
|
24
25
|
"scripts": {
|
|
25
26
|
"dev": "vite",
|
|
26
27
|
"build": "tsc && vite build",
|