simplyview 3.4.3 → 3.4.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/dist/simply.everything.js +48 -31
- package/dist/simply.everything.min.js +1 -1
- package/dist/simply.everything.min.js.map +3 -3
- package/package.json +1 -1
- package/src/path.mjs +1 -2
- package/src/render.mjs +23 -0
|
@@ -74,8 +74,8 @@
|
|
|
74
74
|
callListeners(node);
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
|
-
var
|
|
78
|
-
|
|
77
|
+
var observer2 = new MutationObserver(handleChanges);
|
|
78
|
+
observer2.observe(document, {
|
|
79
79
|
subtree: true,
|
|
80
80
|
childList: true
|
|
81
81
|
});
|
|
@@ -401,12 +401,12 @@
|
|
|
401
401
|
options.app.container.addEventListener("change", commandHandler);
|
|
402
402
|
options.app.container.addEventListener("input", commandHandler);
|
|
403
403
|
}
|
|
404
|
-
call(command,
|
|
404
|
+
call(command, el2, value) {
|
|
405
405
|
if (!this[command]) {
|
|
406
406
|
console.error("simply.command: undefined command " + command);
|
|
407
407
|
return;
|
|
408
408
|
}
|
|
409
|
-
return this[command].call(this.app,
|
|
409
|
+
return this[command].call(this.app, el2, value);
|
|
410
410
|
}
|
|
411
411
|
action(name) {
|
|
412
412
|
console.warn("deprecated call to `this.commands.action`");
|
|
@@ -430,15 +430,15 @@
|
|
|
430
430
|
return new SimplyCommands(options);
|
|
431
431
|
}
|
|
432
432
|
function getCommand(evt, handlers) {
|
|
433
|
-
var
|
|
434
|
-
if (
|
|
433
|
+
var el2 = evt.target.closest("[data-simply-command]");
|
|
434
|
+
if (el2) {
|
|
435
435
|
for (let handler of handlers) {
|
|
436
|
-
if (
|
|
437
|
-
if (handler.check(
|
|
436
|
+
if (el2.matches(handler.match)) {
|
|
437
|
+
if (handler.check(el2, evt)) {
|
|
438
438
|
return {
|
|
439
|
-
name:
|
|
440
|
-
source:
|
|
441
|
-
value: handler.get(
|
|
439
|
+
name: el2.dataset.simplyCommand,
|
|
440
|
+
source: el2,
|
|
441
|
+
value: handler.get(el2)
|
|
442
442
|
};
|
|
443
443
|
}
|
|
444
444
|
return null;
|
|
@@ -450,36 +450,36 @@
|
|
|
450
450
|
var defaultHandlers = [
|
|
451
451
|
{
|
|
452
452
|
match: "input,select,textarea",
|
|
453
|
-
get: function(
|
|
454
|
-
if (
|
|
453
|
+
get: function(el2) {
|
|
454
|
+
if (el2.tagName === "SELECT" && el2.multiple) {
|
|
455
455
|
let values = [];
|
|
456
|
-
for (let option of
|
|
456
|
+
for (let option of el2.options) {
|
|
457
457
|
if (option.selected) {
|
|
458
458
|
values.push(option.value);
|
|
459
459
|
}
|
|
460
460
|
}
|
|
461
461
|
return values;
|
|
462
462
|
}
|
|
463
|
-
return
|
|
463
|
+
return el2.dataset.simplyValue || el2.value;
|
|
464
464
|
},
|
|
465
|
-
check: function(
|
|
466
|
-
return evt.type == "change" ||
|
|
465
|
+
check: function(el2, evt) {
|
|
466
|
+
return evt.type == "change" || el2.dataset.simplyImmediate && evt.type == "input";
|
|
467
467
|
}
|
|
468
468
|
},
|
|
469
469
|
{
|
|
470
470
|
match: "a,button",
|
|
471
|
-
get: function(
|
|
472
|
-
return
|
|
471
|
+
get: function(el2) {
|
|
472
|
+
return el2.dataset.simplyValue || el2.href || el2.value;
|
|
473
473
|
},
|
|
474
|
-
check: function(
|
|
474
|
+
check: function(el2, evt) {
|
|
475
475
|
return evt.type == "click" && evt.ctrlKey == false && evt.button == 0;
|
|
476
476
|
}
|
|
477
477
|
},
|
|
478
478
|
{
|
|
479
479
|
match: "form",
|
|
480
|
-
get: function(
|
|
480
|
+
get: function(el2) {
|
|
481
481
|
let data = {};
|
|
482
|
-
for (let input of Array.from(
|
|
482
|
+
for (let input of Array.from(el2.elements)) {
|
|
483
483
|
if (input.tagName == "INPUT" && (input.type == "checkbox" || input.type == "radio")) {
|
|
484
484
|
if (!input.checked) {
|
|
485
485
|
return;
|
|
@@ -496,16 +496,16 @@
|
|
|
496
496
|
}
|
|
497
497
|
return data;
|
|
498
498
|
},
|
|
499
|
-
check: function(
|
|
499
|
+
check: function(el2, evt) {
|
|
500
500
|
return evt.type == "submit";
|
|
501
501
|
}
|
|
502
502
|
},
|
|
503
503
|
{
|
|
504
504
|
match: "*",
|
|
505
|
-
get: function(
|
|
506
|
-
return
|
|
505
|
+
get: function(el2) {
|
|
506
|
+
return el2.dataset.simplyValue;
|
|
507
507
|
},
|
|
508
|
-
check: function(
|
|
508
|
+
check: function(el2, evt) {
|
|
509
509
|
return evt.type == "click" && evt.ctrlKey == false && evt.button == 0;
|
|
510
510
|
}
|
|
511
511
|
}
|
|
@@ -861,7 +861,7 @@
|
|
|
861
861
|
}
|
|
862
862
|
return url.href;
|
|
863
863
|
}
|
|
864
|
-
var
|
|
864
|
+
var observer3;
|
|
865
865
|
var loaded = {};
|
|
866
866
|
var head = globalThis.document.querySelector("head");
|
|
867
867
|
var currentScript = globalThis.document.currentScript;
|
|
@@ -994,8 +994,8 @@
|
|
|
994
994
|
});
|
|
995
995
|
});
|
|
996
996
|
var observe = () => {
|
|
997
|
-
|
|
998
|
-
|
|
997
|
+
observer3 = new MutationObserver(handleChanges2);
|
|
998
|
+
observer3.observe(globalThis.document, {
|
|
999
999
|
subtree: true,
|
|
1000
1000
|
childList: true
|
|
1001
1001
|
});
|
|
@@ -1012,10 +1012,9 @@
|
|
|
1012
1012
|
if (!pointer) {
|
|
1013
1013
|
return dataset;
|
|
1014
1014
|
}
|
|
1015
|
-
pointer.split(".").reduce(function(acc, name) {
|
|
1015
|
+
return pointer.split(".").reduce(function(acc, name) {
|
|
1016
1016
|
return acc && acc[name] ? acc[name] : null;
|
|
1017
1017
|
}, dataset);
|
|
1018
|
-
return dataset;
|
|
1019
1018
|
},
|
|
1020
1019
|
set: function(dataset, pointer, value) {
|
|
1021
1020
|
const parent = path.get(dataset, path.parent(pointer));
|
|
@@ -1046,6 +1045,8 @@
|
|
|
1046
1045
|
var SimplyRender = class extends HTMLElement {
|
|
1047
1046
|
constructor() {
|
|
1048
1047
|
super();
|
|
1048
|
+
}
|
|
1049
|
+
connectedCallback() {
|
|
1049
1050
|
let templateId = this.getAttribute("rel");
|
|
1050
1051
|
let template = document.getElementById(templateId);
|
|
1051
1052
|
if (template) {
|
|
@@ -1066,6 +1067,22 @@
|
|
|
1066
1067
|
if (!customElements.get("simply-render")) {
|
|
1067
1068
|
customElements.define("simply-render", SimplyRender);
|
|
1068
1069
|
}
|
|
1070
|
+
var handleChanges3 = () => {
|
|
1071
|
+
const simplyrenders = globalThis.document.querySelectorAll("simply-render[rel]");
|
|
1072
|
+
for (el of simplyrenders) {
|
|
1073
|
+
if (document.querySelector("template#" + el.getAttribute("rel"))) {
|
|
1074
|
+
el.replaceWith(el);
|
|
1075
|
+
}
|
|
1076
|
+
}
|
|
1077
|
+
};
|
|
1078
|
+
var observe2 = () => {
|
|
1079
|
+
observer = new MutationObserver(handleChanges3);
|
|
1080
|
+
observer.observe(globalThis.document, {
|
|
1081
|
+
subtree: true,
|
|
1082
|
+
childList: true
|
|
1083
|
+
});
|
|
1084
|
+
};
|
|
1085
|
+
observe2();
|
|
1069
1086
|
|
|
1070
1087
|
// src/everything.mjs
|
|
1071
1088
|
var simply = {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(()=>{Symbol.onDestroy||(Symbol.onDestroy=Symbol("onDestroy"));var u=new Map,D={addListener:(t,e)=>{u.has(t)||u.set(t,[]),u.get(t).push(e),Q(t)},removeListener:(t,e)=>{if(!u.has(t))return!1;u.set(t,u.get(t).filter(r=>r!=e))}};function Q(t){let e=document.querySelectorAll('[data-simply-activate="'+t+'"]');if(e)for(let r of e)R(r)}function R(t){let e=t?.dataset?.simplyActivate;if(e&&u.has(e))for(let r of u.get(e)){let n=r.call(t);typeof n=="function"?t[Symbol.onDestroy]=n:typeof n<"u"&&console.warn("activate listener may only return a de-activate function, instead got",n)}}function X(t){let e=[];for(let r of t)if(r.type=="childList"){for(let n of r.addedNodes)if(n.querySelectorAll){let i=Array.from(n.querySelectorAll("[data-simply-activate]"));n.matches("[data-simply-activate]")&&i.push(n),e=e.concat(i)}for(let n of r.removedNodes)if(n.querySelectorAll){let i=Array.from(n.querySelectorAll("[data-simply-activate]"));n.matches["[data-simply-activate"]&&i.push(n);for(let s of i)s[Symbol.onDestroy]&&s[Symbol.onDestroy].call(s)}}for(let r of e)R(r)}var Z=new MutationObserver(X);Z.observe(document,{subtree:!0,childList:!0});function b(t,e){if(e){let r=t;t=e,t.app=r}if(t.app){let r={apply(s,a,l){try{let c=s(...l);return c instanceof Promise?(t.app.hooks.wait(!0),c.finally(()=>{t.app.hooks.wait(!1,s)})):c}catch{}}},n={apply(s,a,l){try{let c=s(...l);return c instanceof Promise?t.app.hooks.wait?(t.app.hooks.wait(!0,s),c.catch(o=>t.app.hooks.error(o,s)).finally(()=>{t.app.hooks.wait(!1,s)})):c.catch(o=>t.app.hooks.error(o,s)):c}catch(c){return t.app.hooks.error(c,s)}}},i={get(s,a){if(s[a])return t.app.hooks?.error?new Proxy(s[a].bind(t.app),n):t.app.hooks?.wait?new Proxy(s[a].bind(t.app),r):s[a].bind(t.app)}};return new Proxy(t.actions,i)}else return t}function g(t,e){if(e){let r=t;t=e,t.app=t}return new T(t)}var T=class{constructor(e={}){this.baseURL=e.baseURL||"/",this.app=e.app||{},this.addMissingSlash=!!e.addMissingSlash,this.matchExact=!!e.matchExact,this.clear(),e.routes&&this.load(e.routes)}load(e){ee(e,this.routeInfo,this.matchExact)}clear(){this.routeInfo=[],this.listeners={match:{},call:{},goto:{},finish:{}}}match(e,r){let n={path:e,options:r};n=this.runListeners("match",n),e=n.path?n.path:e;let i;if(!e)return this.match(document.location.pathname+document.location.hash)?!0:this.match(document.location.pathname);e=f(e);for(let s of this.routeInfo)if(i=s.match.exec(e),this.addMissingSlash&&!i?.length&&e&&e[e.length-1]!="/"&&(i=s.match.exec(e+"/"),i&&(e+="/",history.replaceState({},"",j(e,this.baseURL)))),i&&i.length){let a={};s.params.forEach((c,o)=>{c=="*"&&(c="remainder"),a[c]=i[o+1]}),Object.assign(a,r),n.route=s,n.params=a,n=this.runListeners("call",n),a=n.params?n.params:a;let l=new URLSearchParams(document.location.search);return n.result=s.action.call(this.app,a,l),this.runListeners("finish",n),n.result}return!1}runListeners(e,r){if(!(!this.listeners[e]||!Object.keys(this.listeners[e])))return Object.keys(this.listeners[e]).forEach(n=>{var i=q(n);if(i.exec(r.path)){var s;for(let a of this.listeners[e][n])s=a.call(this.app,r),s&&(r=s)}}),r}handleEvents(){globalThis.addEventListener("popstate",()=>{this.match(f(document.location.pathname+document.location.hash,this.baseURL))===!1&&this.match(f(document.location.pathname,this.baseURL))}),this.app.container.addEventListener("click",e=>{if(!e.ctrlKey&&e.which==1){for(var r=e.target;r&&r.tagName!="A";)r=r.parentElement;if(r&&r.pathname&&r.hostname==globalThis.location.hostname&&!r.link&&!r.dataset.simplyCommand){let n=[r.hash,r.pathname+r.hash,r.pathname],i;do i=f(n.shift(),this.baseURL);while(n.length&&!this.has(i));if(this.has(i)){let s=this.runListeners("goto",{path:i});if(s.path&&this.goto(s.path))return e.preventDefault(),!1}}}})}goto(e){return history.pushState({},"",j(e,this.baseURL)),this.match(e)}has(e){e=f(e,this.baseURL);for(let n of this.routeInfo){var r=n.match.exec(e);if(r&&r.length)return!0}return!1}addListener(e,r,n){if(["goto","match","call","finish"].indexOf(e)==-1)throw new Error("Unknown action "+e);this.listeners[e][r]||(this.listeners[e][r]=[]),this.listeners[e][r].push(n)}removeListener(e,r,n){if(["match","call","finish"].indexOf(e)==-1)throw new Error("Unknown action "+e);this.listeners[e][r]&&(this.listeners[e][r]=this.listeners[e][r].filter(i=>i!=n))}init(e){e.baseURL&&(this.baseURL=e.baseURL)}};function f(t,e="/"){return(t.substring(0,e.length)==e||e[e.length-1]=="/"&&t.length==e.length-1&&t==e.substring(0,t.length))&&(t=t.substring(e.length)),t[0]!="/"&&t[0]!="#"&&(t="/"+t),t}function j(t,e){return t=f(t,e),e[e.length-1]==="/"&&t[0]==="/"&&(t=t.substring(1)),t[0]=="#"?t:e+t}function q(t,e=!1){return e?new RegExp("^"+t.replace(/:\w+/g,"([^/]+)").replace(/:\*/,"(.*)")+"(\\?|$)"):new RegExp("^"+t.replace(/:\w+/g,"([^/]+)").replace(/:\*/,"(.*)"))}function ee(t,e,r=!1){let n=Object.keys(t),i=/:(\w+|\*)/g;for(let s of n){let a=[],l=[];do a=i.exec(s),a&&l.push(a[1]);while(a);e.push({match:q(s,r),params:l,action:t[s]})}return e}var x=class{constructor(e={}){e.app||(e.app={}),e.app.container||(e.app.container=document.body),this.app=e.app,this.$handlers=e.handlers||re,e.commands&&Object.assign(this,e.commands);let r=n=>{let i=te(n,this.$handlers);if(!i)return;if(!this[i.name]){console.error("simply.command: undefined command "+i.name,i.source);return}if(this[i.name].call(e.app,i.source,i.value)!==!0)return n.preventDefault(),n.stopPropagation(),!1};e.app.container.addEventListener("click",r),e.app.container.addEventListener("submit",r),e.app.container.addEventListener("change",r),e.app.container.addEventListener("input",r)}call(e,r,n){if(!this[e]){console.error("simply.command: undefined command "+e);return}return this[e].call(this.app,r,n)}action(e){console.warn("deprecated call to `this.commands.action`");let r=Array.from(arguments).slice();return r.shift(),this.app.actions[e](...r)}appendHandler(e){this.$handlers.push(e)}prependHandler(e){this.$handlers.unshift(e)}};function k(t={},e){if(e){let r=t;t=e,t.app=t}return new x(t)}function te(t,e){var r=t.target.closest("[data-simply-command]");if(r){for(let n of e)if(r.matches(n.match))return n.check(r,t)?{name:r.dataset.simplyCommand,source:r,value:n.get(r)}:null}return null}var re=[{match:"input,select,textarea",get:function(t){if(t.tagName==="SELECT"&&t.multiple){let e=[];for(let r of t.options)r.selected&&e.push(r.value);return e}return t.dataset.simplyValue||t.value},check:function(t,e){return e.type=="change"||t.dataset.simplyImmediate&&e.type=="input"}},{match:"a,button",get:function(t){return t.dataset.simplyValue||t.href||t.value},check:function(t,e){return e.type=="click"&&e.ctrlKey==!1&&e.button==0}},{match:"form",get:function(t){let e={};for(let r of Array.from(t.elements)){if(r.tagName=="INPUT"&&(r.type=="checkbox"||r.type=="radio")&&!r.checked)return;e[r.name]&&!Array.isArray(e[r.name])&&(e[r.name]=[e[r.name]]),Array.isArray(e[r.name])?e[r.name].push(r.value):e[r.name]=r.value}return e},check:function(t,e){return e.type=="submit"}},{match:"*",get:function(t){return t.dataset.simplyValue},check:function(t,e){return e.type=="click"&&e.ctrlKey==!1&&e.button==0}}];var d=Object.freeze({Compose:229,Control:17,Meta:224,Alt:18,Shift:16}),E=class{constructor(e={}){e.app||(e.app={}),e.app.container||(e.app.container=document.body),Object.assign(this,e.keys);let r=n=>{if(n.isComposing||n.keyCode===d.Compose||n.defaultPrevented||!n.target)return;let i="default";n.target.closest("[data-simply-keyboard]")&&(i=n.target.closest("[data-simply-keyboard]").dataset.simplyKeyboard);let s=[];n.ctrlKey&&n.keyCode!=d.Control&&s.push("Control"),n.metaKey&&n.keyCode!=d.Meta&&s.push("Meta"),n.altKey&&n.keyCode!=d.Alt&&s.push("Alt"),n.shiftKey&&n.keyCode!=d.Shift&&s.push("Shift"),s.push(n.key.toLowerCase());let a=[],l=event.target.closest("[data-simply-keyboard]");for(;l;)a.push(l.dataset.simplyKeyboard),l=l.parentNode.closest("[data-simply-keyboard]");a.push("");let c,o,W=["+","-"];for(let Y in a){c=a[Y],c==""?o="default":(o=c,c+=".");for(let G of W){let h=s.join(G);if(this[o]&&typeof this[o][h]=="function"&&!this[o][h].call(e.app,n)){n.preventDefault();return}if(typeof this[o+h]=="function"&&!this[o+h].call(e.app,n)){n.preventDefault();return}if(this[i]&&this[i][h]){let y=e.app.container.querySelectorAll('[data-simply-accesskey="'+c+h+'"]');y.length&&(y.forEach(J=>J.click()),n.preventDefault())}}}};e.app.container.addEventListener("keydown",r)}};function v(t={},e){if(e){let r=t;t=e,t.app=t}return new E(t)}function w(t,e){if(e){let r=t;t=e,t.app=t}if(t.app){t.app.view=t.view||{};let r=()=>{let n=t.app.view,i=globalThis.editor.data.getDataPath(t.app.container||document.body);t.app.view=globalThis.editor.currentData[i],Object.assign(t.app.view,n)};return globalThis.editor&&globalThis.editor.currentData?r():document.addEventListener("simply-content-loaded",r),t.app.view}else return t.view}function A(t,...e){return e.map((n,i)=>`${t[i]}${n}`).join("")+t[t.length-1]}function H(t,...e){return A(t,...e)}var C=class{constructor(e={}){if(this.container=e.container||document.body,e.components){let r={};U(r,e.components),S(r,e),e=r}for(let r in e)switch(r){case"html":for(let s in e.html){let a=document.createElement("div");a.innerHTML=e.html[s];let l=this.container.querySelector("template#"+s);l?l.content.replaceChildren(...a.children):(l=document.createElement("template"),l.id=s,l.content.append(...a.children),this.container.appendChild(l))}break;case"css":for(let s in e.css){let a=this.container.querySelector("style#"+s);a||(a=document.createElement("style"),a.id=s,this.container.appendChild(a)),a.innerHTML=e.css[s]}break;case"commands":this.commands=k({app:this,container:this.container,commands:e.commands});break;case"keys":case"keyboard":this.keys=v({app:this,keys:e.keys});break;case"root":case"baseURL":this.baseURL=e[r];break;case"routes":this.routes=g({app:this,routes:e.routes});break;case"actions":this.actions=b({app:this,actions:e.actions}),this.action=function(s){console.warn("deprecated call to `this.action`");let a=Array.from(arguments).slice();return a.shift(),this.actions[s](...a)};break;case"view":this.view=w({app:this,view:e.view});break;case"hooks":let n={get:(s,a)=>{if(s[a])return typeof s[a]=="function"?new Proxy(s[a],i):s[a]&&typeof s[a]=="object"?new Proxy(s[a],n):s[a]}},i={apply:(s,a,l)=>s.apply(this,l)};this[r]=new Proxy(e[r],n);break;default:console.log('simply.app: unknown initialization option "'+r+'", added as-is'),this[r]=e[r];break}}get app(){return this}async start(){if(this.components)for(let e in this.components)this.components[e].hooks?.start&&await this.components[e].hooks.start.call(this,this.components[e]);this.hooks?.start&&await this.hooks.start(),this.routes&&(this.baseURL&&this.routes.init({baseURL:this.baseURL}),this.routes.handleEvents(),globalThis.setTimeout(()=>{this.routes.has(globalThis.location?.hash)?this.routes.match(globalThis.location.hash):this.routes.match(globalThis.location?.pathname+globalThis.location?.hash)}))}};function M(t={}){return new C(t)}globalThis.html||(globalThis.html=A);globalThis.css||(globalThis.css=H);function S(t,e){for(let r in e)switch(typeof e[r]){case"object":if(!e[r])continue;t[r]?S(t[r],e[r]):t[r]=e[r];break;default:t[r]=e[r]}}function U(t,e){for(let r in e){let n=e[r];n.components&&U(t,n.components),t.components||(t.components={}),t.components[r]=n;for(let i in n)switch(i){case"hooks":case"components":break;default:t[i]||(t[i]=Object.create(null)),S(t[i],n[i]);break}}}function ne(t,e){let r=0;return()=>{let n=arguments;r||(r=globalThis.setTimeout(()=>{t.apply(this,n),r=0},e))}}var ae=globalThis.requestIdleCallback?t=>{globalThis.requestIdleCallback(t,{timeout:500})}:globalThis.requestAnimationFrame;function I(t,e){let r=new URL(t,e);return m.cacheBuster&&r.searchParams.set("cb",m.cacheBuster),r.href}var O,se={},N=globalThis.document.querySelector("head"),B=globalThis.document.currentScript,K,$;B?$=B.src:(K=(()=>{var t=document.getElementsByTagName("script"),e=t.length-1,r=t[e];return()=>r?.src})(),$=K());var ie=async()=>new Promise(function(t){var e=globalThis.document.createElement("script");e.src="https://cdn.jsdelivr.net/gh/simplyedit/simplyview/dist/simply.include.next.js",e.async=!1,globalThis.document.addEventListener("simply-include-next",()=>{N.removeChild(e),t()},{once:!0,passive:!0}),N.appendChild(e)}),L=[],m={cacheBuster:null,scripts:(t,e)=>{let r=t.slice(),n=()=>{let i=r.shift();if(!i)return;let s=[].map.call(i.attributes,l=>l.name),a=globalThis.document.createElement("script");for(let l of s)a.setAttribute(l,i.getAttribute(l));if(a.removeAttribute("data-simply-location"),!a.src)a.innerHTML=i.innerHTML,ie().then(()=>{let l=L[i.dataset.simplyLocation];l.parentNode.insertBefore(a,l),l.parentNode.removeChild(l),n()});else{a.src=I(a.src,e),!a.hasAttribute("async")&&!a.hasAttribute("defer")&&(a.async=!1);let l=L[i.dataset.simplyLocation];l.parentNode.insertBefore(a,l),l.parentNode.removeChild(l),se[a.src]=!0,n()}};r.length&&n()},html:(t,e)=>{let r=globalThis.document.createRange().createContextualFragment(t),n=r.querySelectorAll('link[rel="stylesheet"],style');for(let a of n)a.href&&(a.href=I(a.href,e.href)),N.appendChild(a);let i=globalThis.document.createDocumentFragment(),s=r.querySelectorAll("script");if(s.length){for(let a of s){let l=globalThis.document.createComment(a.src||"inline script");a.parentNode.insertBefore(l,a),a.dataset.simplyLocation=L.length,L.push(l),i.appendChild(a)}globalThis.setTimeout(function(){m.scripts(Array.from(i.children),e?e.href:globalThis.location.href)},10)}e.parentNode.insertBefore(r,e||null)}},F={},le=async t=>{let e=[].reduce.call(t,(r,n)=>(n.rel=="simply-include-once"&&F[n.href]?n.parentNode.removeChild(n):(F[n.href]=!0,n.rel="simply-include-loading",r.push(n)),r),[]);for(let r of e){if(!r.href)return;let n=await fetch(r.href);if(!n.ok){console.log("simply-include: failed to load "+r.href);continue}console.log("simply-include: loaded "+r.href);let i=await n.text();m.html(i,r),r.parentNode.removeChild(r)}},_=ne(()=>{ae(()=>{var t=globalThis.document.querySelectorAll('link[rel="simply-include"],link[rel="simply-include-once"]');t.length&&le(t)})}),ce=()=>{O=new MutationObserver(_),O.observe(globalThis.document,{subtree:!0,childList:!0})};ce();_();var p={get(t,e){return typeof e!="string"?e:(e&&e.split(".").reduce(function(r,n){return r&&r[n]?r[n]:null},t),t)},set:function(t,e,r){let n=p.get(t,p.parent(e));n[p.pop(e)]=r},pop:function(t){return t.split(".").pop()},push:function(t,e){return(t?t+".":"")+e},parent:function(t,e){let r=e.split(".");return r.pop(),r.join(".")},parents:function(t,e){let r=[];for(;e;)e=p.parent(e),r.unshift(e)}},V=p;var P=class extends HTMLElement{constructor(){super();let e=this.getAttribute("rel"),r=document.getElementById(e);if(r){let n=r.content.cloneNode(!0);for(let i of n.childNodes){let s=i.cloneNode(!0);s.nodeType==document.ELEMENT_NODE&&s.querySelectorAll("template").forEach(function(a){a.setAttribute("simply-render","")}),this.parentNode.insertBefore(s,this)}this.parentNode.removeChild(this)}}};customElements.get("simply-render")||customElements.define("simply-render",P);var z={activate:D,action:b,app:M,command:k,include:m,key:v,path:V,route:g,view:w};globalThis.simply=z;var Ue=z;})();
|
|
1
|
+
(()=>{Symbol.onDestroy||(Symbol.onDestroy=Symbol("onDestroy"));var u=new Map,q={addListener:(t,e)=>{u.has(t)||u.set(t,[]),u.get(t).push(e),Q(t)},removeListener:(t,e)=>{if(!u.has(t))return!1;u.set(t,u.get(t).filter(r=>r!=e))}};function Q(t){let e=document.querySelectorAll('[data-simply-activate="'+t+'"]');if(e)for(let r of e)D(r)}function D(t){let e=t?.dataset?.simplyActivate;if(e&&u.has(e))for(let r of u.get(e)){let n=r.call(t);typeof n=="function"?t[Symbol.onDestroy]=n:typeof n<"u"&&console.warn("activate listener may only return a de-activate function, instead got",n)}}function X(t){let e=[];for(let r of t)if(r.type=="childList"){for(let n of r.addedNodes)if(n.querySelectorAll){let i=Array.from(n.querySelectorAll("[data-simply-activate]"));n.matches("[data-simply-activate]")&&i.push(n),e=e.concat(i)}for(let n of r.removedNodes)if(n.querySelectorAll){let i=Array.from(n.querySelectorAll("[data-simply-activate]"));n.matches["[data-simply-activate"]&&i.push(n);for(let s of i)s[Symbol.onDestroy]&&s[Symbol.onDestroy].call(s)}}for(let r of e)D(r)}var Z=new MutationObserver(X);Z.observe(document,{subtree:!0,childList:!0});function b(t,e){if(e){let r=t;t=e,t.app=r}if(t.app){let r={apply(s,a,l){try{let c=s(...l);return c instanceof Promise?(t.app.hooks.wait(!0),c.finally(()=>{t.app.hooks.wait(!1,s)})):c}catch{}}},n={apply(s,a,l){try{let c=s(...l);return c instanceof Promise?t.app.hooks.wait?(t.app.hooks.wait(!0,s),c.catch(o=>t.app.hooks.error(o,s)).finally(()=>{t.app.hooks.wait(!1,s)})):c.catch(o=>t.app.hooks.error(o,s)):c}catch(c){return t.app.hooks.error(c,s)}}},i={get(s,a){if(s[a])return t.app.hooks?.error?new Proxy(s[a].bind(t.app),n):t.app.hooks?.wait?new Proxy(s[a].bind(t.app),r):s[a].bind(t.app)}};return new Proxy(t.actions,i)}else return t}function g(t,e){if(e){let r=t;t=e,t.app=t}return new T(t)}var T=class{constructor(e={}){this.baseURL=e.baseURL||"/",this.app=e.app||{},this.addMissingSlash=!!e.addMissingSlash,this.matchExact=!!e.matchExact,this.clear(),e.routes&&this.load(e.routes)}load(e){ee(e,this.routeInfo,this.matchExact)}clear(){this.routeInfo=[],this.listeners={match:{},call:{},goto:{},finish:{}}}match(e,r){let n={path:e,options:r};n=this.runListeners("match",n),e=n.path?n.path:e;let i;if(!e)return this.match(document.location.pathname+document.location.hash)?!0:this.match(document.location.pathname);e=f(e);for(let s of this.routeInfo)if(i=s.match.exec(e),this.addMissingSlash&&!i?.length&&e&&e[e.length-1]!="/"&&(i=s.match.exec(e+"/"),i&&(e+="/",history.replaceState({},"",R(e,this.baseURL)))),i&&i.length){let a={};s.params.forEach((c,o)=>{c=="*"&&(c="remainder"),a[c]=i[o+1]}),Object.assign(a,r),n.route=s,n.params=a,n=this.runListeners("call",n),a=n.params?n.params:a;let l=new URLSearchParams(document.location.search);return n.result=s.action.call(this.app,a,l),this.runListeners("finish",n),n.result}return!1}runListeners(e,r){if(!(!this.listeners[e]||!Object.keys(this.listeners[e])))return Object.keys(this.listeners[e]).forEach(n=>{var i=j(n);if(i.exec(r.path)){var s;for(let a of this.listeners[e][n])s=a.call(this.app,r),s&&(r=s)}}),r}handleEvents(){globalThis.addEventListener("popstate",()=>{this.match(f(document.location.pathname+document.location.hash,this.baseURL))===!1&&this.match(f(document.location.pathname,this.baseURL))}),this.app.container.addEventListener("click",e=>{if(!e.ctrlKey&&e.which==1){for(var r=e.target;r&&r.tagName!="A";)r=r.parentElement;if(r&&r.pathname&&r.hostname==globalThis.location.hostname&&!r.link&&!r.dataset.simplyCommand){let n=[r.hash,r.pathname+r.hash,r.pathname],i;do i=f(n.shift(),this.baseURL);while(n.length&&!this.has(i));if(this.has(i)){let s=this.runListeners("goto",{path:i});if(s.path&&this.goto(s.path))return e.preventDefault(),!1}}}})}goto(e){return history.pushState({},"",R(e,this.baseURL)),this.match(e)}has(e){e=f(e,this.baseURL);for(let n of this.routeInfo){var r=n.match.exec(e);if(r&&r.length)return!0}return!1}addListener(e,r,n){if(["goto","match","call","finish"].indexOf(e)==-1)throw new Error("Unknown action "+e);this.listeners[e][r]||(this.listeners[e][r]=[]),this.listeners[e][r].push(n)}removeListener(e,r,n){if(["match","call","finish"].indexOf(e)==-1)throw new Error("Unknown action "+e);this.listeners[e][r]&&(this.listeners[e][r]=this.listeners[e][r].filter(i=>i!=n))}init(e){e.baseURL&&(this.baseURL=e.baseURL)}};function f(t,e="/"){return(t.substring(0,e.length)==e||e[e.length-1]=="/"&&t.length==e.length-1&&t==e.substring(0,t.length))&&(t=t.substring(e.length)),t[0]!="/"&&t[0]!="#"&&(t="/"+t),t}function R(t,e){return t=f(t,e),e[e.length-1]==="/"&&t[0]==="/"&&(t=t.substring(1)),t[0]=="#"?t:e+t}function j(t,e=!1){return e?new RegExp("^"+t.replace(/:\w+/g,"([^/]+)").replace(/:\*/,"(.*)")+"(\\?|$)"):new RegExp("^"+t.replace(/:\w+/g,"([^/]+)").replace(/:\*/,"(.*)"))}function ee(t,e,r=!1){let n=Object.keys(t),i=/:(\w+|\*)/g;for(let s of n){let a=[],l=[];do a=i.exec(s),a&&l.push(a[1]);while(a);e.push({match:j(s,r),params:l,action:t[s]})}return e}var x=class{constructor(e={}){e.app||(e.app={}),e.app.container||(e.app.container=document.body),this.app=e.app,this.$handlers=e.handlers||re,e.commands&&Object.assign(this,e.commands);let r=n=>{let i=te(n,this.$handlers);if(!i)return;if(!this[i.name]){console.error("simply.command: undefined command "+i.name,i.source);return}if(this[i.name].call(e.app,i.source,i.value)!==!0)return n.preventDefault(),n.stopPropagation(),!1};e.app.container.addEventListener("click",r),e.app.container.addEventListener("submit",r),e.app.container.addEventListener("change",r),e.app.container.addEventListener("input",r)}call(e,r,n){if(!this[e]){console.error("simply.command: undefined command "+e);return}return this[e].call(this.app,r,n)}action(e){console.warn("deprecated call to `this.commands.action`");let r=Array.from(arguments).slice();return r.shift(),this.app.actions[e](...r)}appendHandler(e){this.$handlers.push(e)}prependHandler(e){this.$handlers.unshift(e)}};function k(t={},e){if(e){let r=t;t=e,t.app=t}return new x(t)}function te(t,e){var r=t.target.closest("[data-simply-command]");if(r){for(let n of e)if(r.matches(n.match))return n.check(r,t)?{name:r.dataset.simplyCommand,source:r,value:n.get(r)}:null}return null}var re=[{match:"input,select,textarea",get:function(t){if(t.tagName==="SELECT"&&t.multiple){let e=[];for(let r of t.options)r.selected&&e.push(r.value);return e}return t.dataset.simplyValue||t.value},check:function(t,e){return e.type=="change"||t.dataset.simplyImmediate&&e.type=="input"}},{match:"a,button",get:function(t){return t.dataset.simplyValue||t.href||t.value},check:function(t,e){return e.type=="click"&&e.ctrlKey==!1&&e.button==0}},{match:"form",get:function(t){let e={};for(let r of Array.from(t.elements)){if(r.tagName=="INPUT"&&(r.type=="checkbox"||r.type=="radio")&&!r.checked)return;e[r.name]&&!Array.isArray(e[r.name])&&(e[r.name]=[e[r.name]]),Array.isArray(e[r.name])?e[r.name].push(r.value):e[r.name]=r.value}return e},check:function(t,e){return e.type=="submit"}},{match:"*",get:function(t){return t.dataset.simplyValue},check:function(t,e){return e.type=="click"&&e.ctrlKey==!1&&e.button==0}}];var d=Object.freeze({Compose:229,Control:17,Meta:224,Alt:18,Shift:16}),A=class{constructor(e={}){e.app||(e.app={}),e.app.container||(e.app.container=document.body),Object.assign(this,e.keys);let r=n=>{if(n.isComposing||n.keyCode===d.Compose||n.defaultPrevented||!n.target)return;let i="default";n.target.closest("[data-simply-keyboard]")&&(i=n.target.closest("[data-simply-keyboard]").dataset.simplyKeyboard);let s=[];n.ctrlKey&&n.keyCode!=d.Control&&s.push("Control"),n.metaKey&&n.keyCode!=d.Meta&&s.push("Meta"),n.altKey&&n.keyCode!=d.Alt&&s.push("Alt"),n.shiftKey&&n.keyCode!=d.Shift&&s.push("Shift"),s.push(n.key.toLowerCase());let a=[],l=event.target.closest("[data-simply-keyboard]");for(;l;)a.push(l.dataset.simplyKeyboard),l=l.parentNode.closest("[data-simply-keyboard]");a.push("");let c,o,W=["+","-"];for(let Y in a){c=a[Y],c==""?o="default":(o=c,c+=".");for(let G of W){let h=s.join(G);if(this[o]&&typeof this[o][h]=="function"&&!this[o][h].call(e.app,n)){n.preventDefault();return}if(typeof this[o+h]=="function"&&!this[o+h].call(e.app,n)){n.preventDefault();return}if(this[i]&&this[i][h]){let y=e.app.container.querySelectorAll('[data-simply-accesskey="'+c+h+'"]');y.length&&(y.forEach(J=>J.click()),n.preventDefault())}}}};e.app.container.addEventListener("keydown",r)}};function v(t={},e){if(e){let r=t;t=e,t.app=t}return new A(t)}function w(t,e){if(e){let r=t;t=e,t.app=t}if(t.app){t.app.view=t.view||{};let r=()=>{let n=t.app.view,i=globalThis.editor.data.getDataPath(t.app.container||document.body);t.app.view=globalThis.editor.currentData[i],Object.assign(t.app.view,n)};return globalThis.editor&&globalThis.editor.currentData?r():document.addEventListener("simply-content-loaded",r),t.app.view}else return t.view}function E(t,...e){return e.map((n,i)=>`${t[i]}${n}`).join("")+t[t.length-1]}function H(t,...e){return E(t,...e)}var C=class{constructor(e={}){if(this.container=e.container||document.body,e.components){let r={};U(r,e.components),S(r,e),e=r}for(let r in e)switch(r){case"html":for(let s in e.html){let a=document.createElement("div");a.innerHTML=e.html[s];let l=this.container.querySelector("template#"+s);l?l.content.replaceChildren(...a.children):(l=document.createElement("template"),l.id=s,l.content.append(...a.children),this.container.appendChild(l))}break;case"css":for(let s in e.css){let a=this.container.querySelector("style#"+s);a||(a=document.createElement("style"),a.id=s,this.container.appendChild(a)),a.innerHTML=e.css[s]}break;case"commands":this.commands=k({app:this,container:this.container,commands:e.commands});break;case"keys":case"keyboard":this.keys=v({app:this,keys:e.keys});break;case"root":case"baseURL":this.baseURL=e[r];break;case"routes":this.routes=g({app:this,routes:e.routes});break;case"actions":this.actions=b({app:this,actions:e.actions}),this.action=function(s){console.warn("deprecated call to `this.action`");let a=Array.from(arguments).slice();return a.shift(),this.actions[s](...a)};break;case"view":this.view=w({app:this,view:e.view});break;case"hooks":let n={get:(s,a)=>{if(s[a])return typeof s[a]=="function"?new Proxy(s[a],i):s[a]&&typeof s[a]=="object"?new Proxy(s[a],n):s[a]}},i={apply:(s,a,l)=>s.apply(this,l)};this[r]=new Proxy(e[r],n);break;default:console.log('simply.app: unknown initialization option "'+r+'", added as-is'),this[r]=e[r];break}}get app(){return this}async start(){if(this.components)for(let e in this.components)this.components[e].hooks?.start&&await this.components[e].hooks.start.call(this,this.components[e]);this.hooks?.start&&await this.hooks.start(),this.routes&&(this.baseURL&&this.routes.init({baseURL:this.baseURL}),this.routes.handleEvents(),globalThis.setTimeout(()=>{this.routes.has(globalThis.location?.hash)?this.routes.match(globalThis.location.hash):this.routes.match(globalThis.location?.pathname+globalThis.location?.hash)}))}};function M(t={}){return new C(t)}globalThis.html||(globalThis.html=E);globalThis.css||(globalThis.css=H);function S(t,e){for(let r in e)switch(typeof e[r]){case"object":if(!e[r])continue;t[r]?S(t[r],e[r]):t[r]=e[r];break;default:t[r]=e[r]}}function U(t,e){for(let r in e){let n=e[r];n.components&&U(t,n.components),t.components||(t.components={}),t.components[r]=n;for(let i in n)switch(i){case"hooks":case"components":break;default:t[i]||(t[i]=Object.create(null)),S(t[i],n[i]);break}}}function ne(t,e){let r=0;return()=>{let n=arguments;r||(r=globalThis.setTimeout(()=>{t.apply(this,n),r=0},e))}}var ae=globalThis.requestIdleCallback?t=>{globalThis.requestIdleCallback(t,{timeout:500})}:globalThis.requestAnimationFrame;function O(t,e){let r=new URL(t,e);return m.cacheBuster&&r.searchParams.set("cb",m.cacheBuster),r.href}var I,se={},N=globalThis.document.querySelector("head"),B=globalThis.document.currentScript,K,$;B?$=B.src:(K=(()=>{var t=document.getElementsByTagName("script"),e=t.length-1,r=t[e];return()=>r?.src})(),$=K());var ie=async()=>new Promise(function(t){var e=globalThis.document.createElement("script");e.src="https://cdn.jsdelivr.net/gh/simplyedit/simplyview/dist/simply.include.next.js",e.async=!1,globalThis.document.addEventListener("simply-include-next",()=>{N.removeChild(e),t()},{once:!0,passive:!0}),N.appendChild(e)}),L=[],m={cacheBuster:null,scripts:(t,e)=>{let r=t.slice(),n=()=>{let i=r.shift();if(!i)return;let s=[].map.call(i.attributes,l=>l.name),a=globalThis.document.createElement("script");for(let l of s)a.setAttribute(l,i.getAttribute(l));if(a.removeAttribute("data-simply-location"),!a.src)a.innerHTML=i.innerHTML,ie().then(()=>{let l=L[i.dataset.simplyLocation];l.parentNode.insertBefore(a,l),l.parentNode.removeChild(l),n()});else{a.src=O(a.src,e),!a.hasAttribute("async")&&!a.hasAttribute("defer")&&(a.async=!1);let l=L[i.dataset.simplyLocation];l.parentNode.insertBefore(a,l),l.parentNode.removeChild(l),se[a.src]=!0,n()}};r.length&&n()},html:(t,e)=>{let r=globalThis.document.createRange().createContextualFragment(t),n=r.querySelectorAll('link[rel="stylesheet"],style');for(let a of n)a.href&&(a.href=O(a.href,e.href)),N.appendChild(a);let i=globalThis.document.createDocumentFragment(),s=r.querySelectorAll("script");if(s.length){for(let a of s){let l=globalThis.document.createComment(a.src||"inline script");a.parentNode.insertBefore(l,a),a.dataset.simplyLocation=L.length,L.push(l),i.appendChild(a)}globalThis.setTimeout(function(){m.scripts(Array.from(i.children),e?e.href:globalThis.location.href)},10)}e.parentNode.insertBefore(r,e||null)}},F={},le=async t=>{let e=[].reduce.call(t,(r,n)=>(n.rel=="simply-include-once"&&F[n.href]?n.parentNode.removeChild(n):(F[n.href]=!0,n.rel="simply-include-loading",r.push(n)),r),[]);for(let r of e){if(!r.href)return;let n=await fetch(r.href);if(!n.ok){console.log("simply-include: failed to load "+r.href);continue}console.log("simply-include: loaded "+r.href);let i=await n.text();m.html(i,r),r.parentNode.removeChild(r)}},_=ne(()=>{ae(()=>{var t=globalThis.document.querySelectorAll('link[rel="simply-include"],link[rel="simply-include-once"]');t.length&&le(t)})}),ce=()=>{I=new MutationObserver(_),I.observe(globalThis.document,{subtree:!0,childList:!0})};ce();_();var p={get(t,e){return typeof e!="string"?e:e?e.split(".").reduce(function(r,n){return r&&r[n]?r[n]:null},t):t},set:function(t,e,r){let n=p.get(t,p.parent(e));n[p.pop(e)]=r},pop:function(t){return t.split(".").pop()},push:function(t,e){return(t?t+".":"")+e},parent:function(t,e){let r=e.split(".");return r.pop(),r.join(".")},parents:function(t,e){let r=[];for(;e;)e=p.parent(e),r.unshift(e)}},V=p;var P=class extends HTMLElement{constructor(){super()}connectedCallback(){let e=this.getAttribute("rel"),r=document.getElementById(e);if(r){let n=r.content.cloneNode(!0);for(let i of n.childNodes){let s=i.cloneNode(!0);s.nodeType==document.ELEMENT_NODE&&s.querySelectorAll("template").forEach(function(a){a.setAttribute("simply-render","")}),this.parentNode.insertBefore(s,this)}this.parentNode.removeChild(this)}}};customElements.get("simply-render")||customElements.define("simply-render",P);var oe=()=>{let t=globalThis.document.querySelectorAll("simply-render[rel]");for(el of t)document.querySelector("template#"+el.getAttribute("rel"))&&el.replaceWith(el)},ue=()=>{observer=new MutationObserver(oe),observer.observe(globalThis.document,{subtree:!0,childList:!0})};ue();var z={activate:q,action:b,app:M,command:k,include:m,key:v,path:V,route:g,view:w};globalThis.simply=z;var Ie=z;})();
|
|
2
2
|
//# sourceMappingURL=simply.everything.min.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/activate.mjs", "../src/action.mjs", "../src/route.mjs", "../src/command.mjs", "../src/key.mjs", "../src/view.mjs", "../src/highlight.mjs", "../src/app.mjs", "../src/include.mjs", "../src/path.mjs", "../src/render.mjs", "../src/everything.mjs"],
|
|
4
|
-
"sourcesContent": ["if (!Symbol.onDestroy) {\n Symbol.onDestroy = Symbol('onDestroy')\n}\n\nconst listeners = new Map()\n\nexport const activate = {\n addListener: (name, callback) => {\n if (!listeners.has(name)) {\n listeners.set(name, [])\n }\n listeners.get(name).push(callback)\n initialCall(name)\n },\n removeListener: (name, callback) => {\n if (!listeners.has(name)) {\n return false\n }\n listeners.set(name, listeners.get(name).filter((listener) => {\n return listener!=callback\n }))\n }\n}\n\nfunction initialCall(name) {\n const nodes = document.querySelectorAll('[data-simply-activate=\"'+name+'\"]')\n if (nodes) {\n for( let node of nodes) {\n callListeners(node)\n }\n }\n}\n\nfunction callListeners(node) {\n const activate = node?.dataset?.simplyActivate\n if (activate && listeners.has(activate)) {\n for (let callback of listeners.get(activate)) {\n const onDestroy = callback.call(node)\n if (typeof onDestroy == 'function') {\n node[Symbol.onDestroy] = onDestroy\n } else if (typeof onDestroy != 'undefined') {\n console.warn('activate listener may only return a de-activate function, instead got', onDestroy)\n }\n }\n }\n}\n\nfunction handleChanges(changes) {\n let activateNodes = []\n for (let change of changes) {\n if (change.type == 'childList') {\n for (let node of change.addedNodes) {\n if (node.querySelectorAll) {\n let toActivate = Array.from(node.querySelectorAll('[data-simply-activate]'))\n if (node.matches('[data-simply-activate]')) {\n toActivate.push(node)\n }\n activateNodes = activateNodes.concat(toActivate)\n }\n }\n for (let node of change.removedNodes) {\n if (node.querySelectorAll) {\n let toDestroy = Array.from(node.querySelectorAll('[data-simply-activate]'))\n if (node.matches['[data-simply-activate']) {\n toDestroy.push(node)\n }\n for (let child of toDestroy) {\n if (child[Symbol.onDestroy]) {\n child[Symbol.onDestroy].call(child)\n }\n }\n }\n }\n }\n }\n for (let node of activateNodes) {\n callListeners(node)\n }\n}\n\nconst observer = new MutationObserver(handleChanges)\nobserver.observe(document, {\n subtree: true,\n childList: true\n})", "export function actions(options, optionsCompat) \n{\n\tif (optionsCompat) {\n\t\tlet app = options\n\t\toptions = optionsCompat\n\t\toptions.app = app\n\t}\n\n\tif (options.app) {\n\t\tconst waitHandler = {\n\t\t\tapply(target, thisArg, argumentsList)\n\t\t\t{\n\t\t\t\ttry {\n\t\t\t\t\tconst result = target(...argumentsList)\n\t\t\t\t\tif (result instanceof Promise) {\n\t\t\t\t\t\toptions.app.hooks.wait(true)\n\t\t\t\t\t\treturn result.finally(() => {\n\t\t\t\t\t\t\toptions.app.hooks.wait(false, target)\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t\treturn result\n\t\t\t\t} catch(err) {\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst functionHandler = {\n\t\t\tapply(target, thisArg, argumentsList)\n\t\t\t{\n\t\t\t\ttry {\n\t\t\t\t\tconst result = target(...argumentsList)\n\t\t\t\t\tif (result instanceof Promise) {\n\t\t\t\t\t\tif (options.app.hooks.wait) {\n\t\t\t\t\t\t\toptions.app.hooks.wait(true, target)\n\t\t\t\t\t\t\treturn result.catch(err => {\n\t\t\t\t\t\t\t\treturn options.app.hooks.error(err, target)\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t.finally(() => {\n\t\t\t\t\t\t\t\toptions.app.hooks.wait(false, target)\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn result.catch(err => {\n\t\t\t\t\t\t\t\treturn options.app.hooks.error(err, target)\n\t\t\t\t\t\t\t})\t\t\t\t\t\t\t\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn result\n\t\t\t\t} catch(err) {\n\t\t\t\t\treturn options.app.hooks.error(err, target)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst actionHandler = {\n\t\t\tget(target, property)\n\t\t\t{\n\t\t\t\tif (!target[property]) {\n\t\t\t\t\treturn undefined\n\t\t\t\t}\n\t\t\t\tif (options.app.hooks?.error) {\n\t\t\t\t\treturn new Proxy(target[property].bind(options.app), functionHandler)\n\t\t\t\t} else if (options.app.hooks?.wait) {\n\t\t\t\t\treturn new Proxy(target[property].bind(options.app), waitHandler)\n\t\t\t\t} else {\n\t\t\t\t\treturn target[property].bind(options.app)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn new Proxy(options.actions, actionHandler)\n\t} else {\n\t\treturn options\n\t}\n}", "export function routes(options, optionsCompat)\n{\n if (optionsCompat) {\n let app = options\n options = optionsCompat\n options.app = options\n }\n return new SimplyRoute(options)\n}\n\nclass SimplyRoute\n{\n constructor(options={})\n {\n this.baseURL = options.baseURL || '/'\n this.app = options.app || {}\n this.addMissingSlash = !!options.addMissingSlash\n this.matchExact = !!options.matchExact\n this.clear()\n if (options.routes) {\n this.load(options.routes)\n }\n }\n\n load(routes)\n {\n parseRoutes(routes, this.routeInfo, this.matchExact)\n }\n\n clear()\n {\n this.routeInfo = []\n this.listeners = {\n match: {},\n call: {},\n goto: {},\n finish: {}\n }\n }\n\n match(path, options)\n {\n let args = {\n path,\n options\n }\n args = this.runListeners('match',args)\n path = args.path ? args.path : path;\n\n let matches;\n if (!path) {\n if (this.match(document.location.pathname+document.location.hash)) {\n return true;\n } else {\n return this.match(document.location.pathname);\n }\n }\n path = getPath(path);\n for ( let route of this.routeInfo) {\n matches = route.match.exec(path)\n if (this.addMissingSlash && !matches?.length) {\n if (path && path[path.length-1]!='/') {\n matches = route.match.exec(path+'/')\n if (matches) {\n path+='/'\n history.replaceState({}, '', getURL(path, this.baseURL))\n }\n }\n }\n if (matches && matches.length) {\n let params = {};\n route.params.forEach((key, i) => {\n if (key=='*') {\n key = 'remainder'\n }\n params[key] = matches[i+1]\n })\n Object.assign(params, options)\n args.route = route\n args.params = params\n args = this.runListeners('call', args)\n params = args.params ? args.params : params\n const searchParams = new URLSearchParams(document.location.search)\n args.result = route.action.call(this.app, params, searchParams)\n this.runListeners('finish', args)\n return args.result\n }\n }\n return false\n }\n\n runListeners(action, params)\n {\n if (!this.listeners[action] || !Object.keys(this.listeners[action])) {\n return\n }\n Object.keys(this.listeners[action]).forEach((route) => {\n var routeRe = getRegexpFromRoute(route);\n if (routeRe.exec(params.path)) {\n var result;\n for (let callback of this.listeners[action][route]) {\n result = callback.call(this.app, params)\n if (result) {\n params = result\n }\n }\n }\n })\n return params\n }\n\n handleEvents()\n {\n globalThis.addEventListener('popstate', () => {\n if (this.match(getPath(document.location.pathname + document.location.hash, this.baseURL)) === false) {\n this.match(getPath(document.location.pathname, this.baseURL))\n }\n })\n this.app.container.addEventListener('click', (evt) => {\n if (evt.ctrlKey) {\n return;\n }\n if (evt.which != 1) {\n return; // not a 'left' mouse click\n }\n var link = evt.target;\n while (link && link.tagName!='A') {\n link = link.parentElement;\n }\n if (link \n && link.pathname \n && link.hostname==globalThis.location.hostname \n && !link.link\n && !link.dataset.simplyCommand\n ) {\n let check = [link.hash, link.pathname+link.hash, link.pathname]\n let path\n do {\n path = getPath(check.shift(), this.baseURL);\n } while(check.length && !this.has(path))\n if ( this.has(path) ) {\n let params = this.runListeners('goto', { path: path});\n if (params.path) {\n if (this.goto(params.path)) {\n // now cancel the browser navigation, since a route handler was found\n evt.preventDefault();\n return false;\n }\n }\n }\n }\n })\n }\n\n goto(path)\n {\n history.pushState({},'',getURL(path, this.baseURL))\n return this.match(path)\n }\n\n has(path)\n {\n path = getPath(path, this.baseURL)\n for (let route of this.routeInfo) {\n var matches = route.match.exec(path)\n if (matches && matches.length) {\n return true\n }\n }\n return false\n }\n\n addListener(action, route, callback)\n {\n if (['goto','match','call','finish'].indexOf(action)==-1) {\n throw new Error('Unknown action '+action)\n }\n if (!this.listeners[action][route]) {\n this.listeners[action][route] = []\n }\n this.listeners[action][route].push(callback)\n }\n\n removeListener(action, route, callback)\n {\n if (['match','call','finish'].indexOf(action)==-1) {\n throw new Error('Unknown action '+action)\n }\n if (!this.listeners[action][route]) {\n return\n }\n this.listeners[action][route] = this.listeners[action][route].filter((listener) => {\n return listener != callback\n })\n }\n\n init(options)\n {\n if (options.baseURL) {\n this.baseURL = options.baseURL\n }\n }\n}\n\nfunction getPath(path, baseURL='/')\n{\n if (path.substring(0,baseURL.length)==baseURL\n ||\n ( baseURL[baseURL.length-1]=='/' \n && path.length==(baseURL.length-1)\n && path == baseURL.substring(0,path.length)\n )\n ) {\n path = path.substring(baseURL.length)\n }\n if (path[0]!='/' && path[0]!='#') {\n path = '/'+path\n }\n return path\n}\n\nfunction getURL(path, baseURL)\n{\n path = getPath(path, baseURL)\n if (baseURL[baseURL.length-1]==='/' && path[0]==='/') {\n path = path.substring(1)\n }\n if (path[0]=='#') {\n return path\n }\n return baseURL + path\n}\n\nfunction getRegexpFromRoute(route, exact=false)\n{\n if (exact) {\n return new RegExp('^'+route.replace(/:\\w+/g, '([^/]+)').replace(/:\\*/, '(.*)')+'(\\\\?|$)')\n }\n return new RegExp('^'+route.replace(/:\\w+/g, '([^/]+)').replace(/:\\*/, '(.*)'))\n}\n\nfunction parseRoutes(routes, routeInfo, exact=false)\n{\n const paths = Object.keys(routes)\n const matchParams = /:(\\w+|\\*)/g\n for (let path of paths) {\n let matches = []\n let params = []\n do {\n matches = matchParams.exec(path)\n if (matches) {\n params.push(matches[1])\n }\n } while(matches)\n routeInfo.push({\n match: getRegexpFromRoute(path, exact),\n params: params,\n action: routes[path]\n })\n }\n return routeInfo\n}", "class SimplyCommands {\n\tconstructor(options={}) {\n\t\tif (!options.app) {\n\t\t\toptions.app = {}\n\t\t}\n\t\tif (!options.app.container) {\n\t\t\toptions.app.container = document.body\n\t\t}\n this.app = options.app\n\t\tthis.$handlers = options.handlers || defaultHandlers\n if (options.commands) {\n \t\tObject.assign(this, options.commands)\n }\n\n\t\tconst commandHandler = (evt) => {\n\t\t\tconst command = getCommand(evt, this.$handlers)\n\t\t\tif (!command) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (!this[command.name]) {\n console.error('simply.command: undefined command '+command.name, command.source);\n return\n\t\t\t}\n const shouldContinue = this[command.name].call(options.app, command.source, command.value)\n if (shouldContinue!==true) {\n evt.preventDefault()\n evt.stopPropagation()\n return false\n }\n\t\t}\n\n options.app.container.addEventListener('click', commandHandler)\n options.app.container.addEventListener('submit', commandHandler)\n options.app.container.addEventListener('change', commandHandler)\n options.app.container.addEventListener('input', commandHandler)\n\t}\n\n call(command, el, value) {\n if (!this[command]) {\n console.error('simply.command: undefined command '+command);\n return\n }\n return this[command].call(this.app, el, value)\n }\n\n action(name) {\n console.warn('deprecated call to `this.commands.action`')\n let params = Array.from(arguments).slice()\n params.shift()\n return this.app.actions[name](...params)\n }\n\n appendHandler(handler) {\n this.$handlers.push(handler)\n }\n\n prependHandler(handler) {\n this.$handlers.unshift(handler)\n }\n}\n\nexport function commands(options={}, optionsCompat) {\n if (optionsCompat) {\n let app = options\n options = optionsCompat\n options.app = options\n }\n\treturn new SimplyCommands(options)\n}\n\nfunction getCommand(evt, handlers) {\n var el = evt.target.closest('[data-simply-command]')\n if (el) {\n for (let handler of handlers) {\n if (el.matches(handler.match)) {\n if (handler.check(el, evt)) {\n return {\n name: el.dataset.simplyCommand,\n source: el,\n value: handler.get(el)\n }\n }\n return null\n }\n }\n }\n return null\n}\n\nconst defaultHandlers = [\n {\n match: 'input,select,textarea',\n get: function(el) {\n if (el.tagName==='SELECT' && el.multiple) {\n let values = []\n for (let option of el.options) {\n if (option.selected) {\n values.push(option.value)\n }\n }\n return values\n }\n return el.dataset.simplyValue || el.value\n },\n check: function(el, evt) {\n return evt.type=='change' || (el.dataset.simplyImmediate && evt.type=='input')\n }\n },\n {\n match: 'a,button',\n get: function(el) {\n return el.dataset.simplyValue || el.href || el.value\n },\n check: function(el,evt) {\n return evt.type=='click' && evt.ctrlKey==false && evt.button==0\n }\n },\n {\n match: 'form',\n get: function(el) {\n let data = {}\n for (let input of Array.from(el.elements)) {\n if (input.tagName=='INPUT' \n && (input.type=='checkbox' || input.type=='radio')\n ) {\n if (!input.checked) {\n return;\n }\n }\n if (data[input.name] && !Array.isArray(data[input.name])) {\n data[input.name] = [data[input.name]]\n }\n if (Array.isArray(data[input.name])) {\n data[input.name].push(input.value)\n } else {\n data[input.name] = input.value\n }\n }\n return data\n },\n check: function(el,evt) {\n return evt.type=='submit'\n }\n },\n {\n \tmatch: '*',\n get: function(el) {\n return el.dataset.simplyValue\n },\n check: function(el, evt) {\n return evt.type=='click' && evt.ctrlKey==false && evt.button==0\n }\n }\n]", "const KEY = Object.freeze({\n\tCompose: 229,\n\tControl: 17,\n\tMeta: 224,\n\tAlt: 18,\n\tShift: 16\n})\n\nclass SimplyKey {\n\tconstructor(options = {}) {\n\t\tif (!options.app) {\n\t\t\toptions.app = {}\n\t\t}\n\t\tif (!options.app.container) {\n\t\t\toptions.app.container = document.body\n\t\t}\n\t\tObject.assign(this, options.keys)\n\n\t\tconst keyHandler = (e) => {\n\t\t\tif (e.isComposing || e.keyCode === KEY.Compose) {\n\t\t\t return\n\t\t\t}\n\t\t\tif (e.defaultPrevented) {\n\t\t\t return\n\t\t\t}\n\t\t\tif (!e.target) {\n\t\t\t return\n\t\t\t}\n\n\t\t\tlet selectedKeyboard = 'default'\n\t\t\tif (e.target.closest('[data-simply-keyboard]')) {\n\t\t\t selectedKeyboard = e.target.closest('[data-simply-keyboard]')\n\t\t\t \t\t\t\t\t.dataset.simplyKeyboard\n\t\t\t}\n\t\t\tlet keyCombination = []\n\t\t\tif (e.ctrlKey && e.keyCode!=KEY.Control) {\n\t\t\t keyCombination.push('Control')\n\t\t\t}\n\t\t\tif (e.metaKey && e.keyCode!=KEY.Meta) {\n\t\t\t keyCombination.push('Meta')\n\t\t\t}\n\t\t\tif (e.altKey && e.keyCode!=KEY.Alt) {\n\t\t\t keyCombination.push('Alt')\n\t\t\t}\n\t\t\tif (e.shiftKey && e.keyCode!=KEY.Shift) {\n\t\t\t keyCombination.push('Shift')\n\t\t\t}\n\t\t\tkeyCombination.push(e.key.toLowerCase())\n\n\t\t\tlet keyboards = []\n\t\t\tlet keyboardElement = event.target.closest('[data-simply-keyboard]')\n\t\t\twhile (keyboardElement) {\n\t\t\t\tkeyboards.push(keyboardElement.dataset.simplyKeyboard)\n\t\t\t\tkeyboardElement = keyboardElement.parentNode.closest('[data-simply-keyboard]')\n\t\t\t}\n\t\t\tkeyboards.push('')\n\n\t\t\tlet keyboard, subkeyboard\n\t\t\tlet separators = ['+','-']\n\n\t\t\tfor (let i in keyboards) {\n\t\t\t\tkeyboard = keyboards[i]\n\t\t\t\tif (keyboard == '') {\n\t\t\t\t\tsubkeyboard = 'default'\n\t\t\t\t} else {\n\t\t\t\t\tsubkeyboard = keyboard\n\t\t\t\t\tkeyboard += '.'\n\t\t\t\t}\n\t\t\t\tfor (let separator of separators) {\n\t\t\t\t\tlet keyString = keyCombination.join(separator)\n\n\t\t\t\t\tif (this[subkeyboard] && (typeof this[subkeyboard][keyString]=='function')) {\n\t\t\t\t\t\tlet _continue = this[subkeyboard][keyString].call(options.app, e)\n\t\t\t\t\t\tif (!_continue) {\n\t\t\t\t\t\t\te.preventDefault()\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (typeof this[subkeyboard + keyString] == 'function') {\n\t\t\t\t\t\tlet _continue = this[subkeyboard + keyString].call(options.app, e)\n\t\t\t\t\t\tif (!_continue) {\n\t\t\t\t\t\t\te.preventDefault()\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\t\t\t\t\t\n\t\t\t\t\t}\n\n\t\t\t\t\tif (this[selectedKeyboard] && this[selectedKeyboard][keyString]) {\n\t\t\t\t\t\tlet targets = options.app.container.querySelectorAll('[data-simply-accesskey=\"'\n\t\t\t\t\t\t\t+ keyboard + keyString + '\"]')\n\t\t\t\t\t\tif (targets.length) {\n\t\t\t\t\t\t\ttargets.forEach(t => t.click())\n\t\t\t\t\t\t\te.preventDefault()\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\toptions.app.container.addEventListener('keydown', keyHandler)\n\t}\n\n}\n\nexport function keys(options={}, optionsCompat) {\n\tif (optionsCompat) {\n\t\tlet app = options\n\t\toptions = optionsCompat\n\t\toptions.app = options\n\t}\n\treturn new SimplyKey(options)\n}\n\n", "export function view(options, optionsCompat) {\n\tif (optionsCompat) {\n\t\tlet app = options\n\t\toptions = optionsCompat\n\t\toptions.app = options\n\t}\n\tif (options.app) {\n\t\toptions.app.view = options.view || {}\n\n\t\tconst load = () => {\n\t\t\tconst data = options.app.view\n\t\t\tconst path = globalThis.editor.data.getDataPath(options.app.container || document.body)\n\t\t\toptions.app.view = globalThis.editor.currentData[path]\n\t\t\tObject.assign(options.app.view, data)\n\t\t}\n\t\tif (globalThis.editor && globalThis.editor.currentData) {\n\t\t\tload()\n\t\t} else {\n\t\t\tdocument.addEventListener('simply-content-loaded', load)\n\t\t}\n\t\treturn options.app.view\n\t} else {\n\t\treturn options.view\n\t}\n}", "export function html(strings, ...values) {\n const outputArray = values.map(\n (value, index) =>\n `${strings[index]}${value}`,\n );\n return outputArray.join(\"\") + strings[strings.length - 1];\n}\n\nexport function css(strings, ...values) {\n\treturn html(strings, ...values)\n}\n", "import { routes } from './route.mjs'\nimport { commands } from './command.mjs'\nimport { actions } from './action.mjs'\nimport { keys } from './key.mjs'\nimport { view } from './view.mjs'\nimport { html, css } from './highlight.mjs'\n\nclass SimplyApp\n{\n\n\tconstructor(options={})\n\t{\n\t\tthis.container = options.container || document.body\n\t\tif (options.components) {\n\t\t\tlet tempOptions = {}\n\t\t\tmergeComponents(tempOptions, options.components)\n\t\t\tmergeOptions(tempOptions, options) // make sure options to the app override components options\n\t\t\toptions = tempOptions\n\t\t}\n\t\tfor (let key in options) {\n\t\t\tswitch(key) {\n\t\t\t\tcase 'html':\n\t\t\t\t\tfor (const name in options.html) {\n\t\t\t\t\t\tconst element = document.createElement('div')\n\t\t\t\t\t\telement.innerHTML = options.html[name]\n\t\t\t\t\t\tlet template = this.container.querySelector('template#'+name)\n\t\t\t\t\t\tif (!template) {\n\t\t\t\t\t\t\ttemplate = document.createElement('template')\n\t\t\t\t\t\t\ttemplate.id=name\n\t\t\t\t\t\t\ttemplate.content.append(...element.children)\n\t\t\t\t\t\t\tthis.container.appendChild(template)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\ttemplate.content.replaceChildren(...element.children)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t\tcase 'css':\n\t\t\t\t\tfor (const name in options.css) {\n\t\t\t\t\t\tlet style = this.container.querySelector('style#'+name)\n\t\t\t\t\t\tif (!style) {\n\t\t\t\t\t\t\tstyle = document.createElement('style')\n\t\t\t\t\t\t\tstyle.id=name \n\t\t\t\t\t\t\tthis.container.appendChild(style)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tstyle.innerHTML = options.css[name]\n\t\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t\tcase 'commands':\n\t\t\t\t\tthis.commands = commands({ app: this, container: this.container, commands: options.commands})\n\t\t\t\t\tbreak\n\t\t\t\tcase 'keys':\n\t\t\t\tcase 'keyboard': // backwards compatible\n\t\t\t\t\tthis.keys = keys({ app: this, keys: options.keys })\n\t\t\t\t\tbreak\n\t\t\t\tcase 'root': // backwards compatibility\n\t\t\t\tcase 'baseURL':\n\t\t\t\t\tthis.baseURL = options[key]\n\t\t\t\t\tbreak\n\t\t\t\tcase 'routes':\n\t\t\t\t\tthis.routes = routes({ app: this, routes: options.routes})\n\t\t\t\t\tbreak\n\t\t\t\tcase 'actions':\n\t\t\t\t\tthis.actions = actions({app: this, actions: options.actions})\n\t\t\t\t\tthis.action = function(name) { // backwards compatible wiht SimplyView2\n\t\t\t\t\t\tconsole.warn('deprecated call to `this.action`')\n\t\t\t\t\t\tlet params = Array.from(arguments).slice()\n\t\t\t\t params.shift()\n\t\t\t\t return this.actions[name](...params)\n\t\t\t\t }\n\t\t\t\t\tbreak\n\t\t\t\tcase 'view':\n\t\t\t\t\tthis.view = view({app: this, view: options.view})\n\t\t\t\t\tbreak\n\t\t\t\tcase 'hooks':\n\t\t\t\t\tconst moduleHandler = {\n\t\t\t\t\t\tget: (target, property) => {\n\t\t\t\t\t\t\tif (!target[property]) {\n\t\t\t\t\t\t\t\treturn undefined\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (typeof target[property]=='function') {\n\t\t\t\t\t\t\t\treturn new Proxy(target[property], functionHandler)\n\t\t\t\t\t\t\t} else if (target[property] && typeof target[property]=='object') {\n\t\t\t\t\t\t\t\treturn new Proxy(target[property], moduleHandler)\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\treturn target[property]\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tconst functionHandler = {\n\t\t\t\t\t\tapply: (target, thisArg, argumentsList) => {\n\t\t\t\t\t\t\t// note: must use short function syntax so this is set to the app\n\t\t\t\t\t\t\treturn target.apply(this, argumentsList)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tthis[key] = new Proxy(options[key], moduleHandler)\n\t\t\t\t\tbreak\n\t\t\t\tcomponents:\n\t\t\t\t\tthis.components = components\n\t\t\t\t\tbreak\n\t\t\t\tprototype:\n\t\t\t\t__proto__:\n\t\t\t\t\t// ignore this to avoid prototype pollution\n\t\t\t\t\tbreak\n\t\t\t\tdefault:\n\t\t\t\t\tconsole.log('simply.app: unknown initialization option \"'+key+'\", added as-is')\n\t\t\t\t\tthis[key] = options[key]\n\t\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\tget app()\n\t{\n\t\treturn this\n\t}\n\n\tasync start()\n\t{\n\t\tif (this.components) {\n\t\t\tfor (const name in this.components) {\n\t\t\t\tif (this.components[name].hooks?.start) {\n\t\t\t\t\tawait this.components[name].hooks.start.call(this, this.components[name])\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (this.hooks?.start) {\n\t\t\tawait this.hooks.start()\n\t\t}\n\t\tif (this.routes) {\n\t\t\tif (this.baseURL) {\n\t\t\t\tthis.routes.init({ baseURL: this.baseURL })\n\t\t\t}\n\t\t\tthis.routes.handleEvents();\n\t\t\tglobalThis.setTimeout(() => {\n\t\t\t\tif (this.routes.has(globalThis.location?.hash)) {\n\t\t\t\t\tthis.routes.match(globalThis.location.hash)\n\t\t\t\t} else {\n\t\t\t\t\tthis.routes.match(globalThis.location?.pathname+globalThis.location?.hash)\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\n}\n\nexport function app(options={})\n{\n\treturn new SimplyApp(options)\n}\n\nif (!globalThis.html) {\n\tglobalThis.html = html\n}\nif (!globalThis.css) {\n\tglobalThis.css = css\n}\n\nfunction mergeOptions(options, otherOptions)\n{\n\tfor (const key in otherOptions) {\n\t\tswitch(typeof otherOptions[key]) {\n\t\t\tcase 'object':\n\t\t\t\tif (!otherOptions[key]) {\n\t\t\t\t\tcontinue // null\n\t\t\t\t}\n\t\t\t\tif (!options[key]) {\n\t\t\t\t\toptions[key] = otherOptions[key]\n\t\t\t\t} else {\n\t\t\t\t\t//FIXME: check that options[key] is also an object\n\t\t\t\t\tmergeOptions(options[key], otherOptions[key])\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\tdefault:\n\t\t\t\toptions[key] = otherOptions[key]\n\t\t}\n\t}\n}\n\nfunction mergeComponents(options, components) {\n\tfor (const name in components) {\n\t\tconst component = components[name]\n\t\tif (component.components) {\n\t\t\tmergeComponents(options, component.components)\n\t\t}\n\t\tif (!options.components) {\n\t\t\toptions.components = {}\n\t\t}\n\t\toptions.components[name] = component\n\t\tfor (const key in component) {\n\t\t\tswitch(key) {\n\t\t\t\tcase 'hooks':\n\t\t\t\t\t// don't merge these, app.hooks.start will trigger each components start hook\n\t\t\t\tcase 'components':\n\t\t\t\t\t// already handled\n\t\t\t\t\tbreak\n\t\t\t\tdefault:\n\t\t\t\t\tif (!options[key]) {\n\t\t\t\t\t\toptions[key] = Object.create(null)\n\t\t\t\t\t}\n\t\t\t\t\tmergeOptions(options[key], component[key])\n\t\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n}\n", "function throttle( callbackFunction, intervalTime ) {\n let eventId = 0\n return () => {\n const myArguments = arguments\n if ( eventId ) {\n return\n } else {\n eventId = globalThis.setTimeout( () => {\n callbackFunction.apply(this, myArguments)\n eventId = 0\n }, intervalTime )\n }\n }\n}\n\nconst runWhenIdle = (() => {\n if (globalThis.requestIdleCallback) {\n return (callback) => {\n globalThis.requestIdleCallback(callback, {timeout: 500})\n }\n }\n return globalThis.requestAnimationFrame\n})()\n\nfunction rebaseHref(relative, base) {\n let url = new URL(relative, base)\n if (include.cacheBuster) {\n url.searchParams.set('cb',include.cacheBuster)\n }\n return url.href\n}\n\nlet observer, loaded = {}\nlet head = globalThis.document.querySelector('head')\nlet currentScript = globalThis.document.currentScript\nlet getScriptURL, currentScriptURL\nif (!currentScript) {\n getScriptURL = (() => {\n var scripts = document.getElementsByTagName('script')\n var index = scripts.length - 1\n var myScript = scripts[index]\n return () => myScript?.src\n })()\n currentScriptURL = getScriptURL()\n} else {\n currentScriptURL = currentScript.src\n}\n\nconst waitForPreviousScripts = async () => {\n // because of the async=false attribute, this script will run after\n // the previous scripts have been loaded and run\n // simply.include.next.js only fires the simply-next-script event\n // that triggers the Promise.resolve method\n return new Promise(function(resolve) {\n var next = globalThis.document.createElement('script')\n next.src = \"https://cdn.jsdelivr.net/gh/simplyedit/simplyview/dist/simply.include.next.js\"\n next.async = false\n globalThis.document.addEventListener('simply-include-next', () => {\n head.removeChild(next)\n resolve()\n }, { once: true, passive: true})\n head.appendChild(next)\n })\n}\n\nlet scriptLocations = []\n\nexport const include = {\n cacheBuster: null,\n scripts: (scripts, base) => {\n let arr = scripts.slice()\n const importScript = () => {\n const script = arr.shift()\n if (!script) {\n return\n }\n const attrs = [].map.call(script.attributes, (attr) => {\n return attr.name\n })\n let clone = globalThis.document.createElement('script')\n for (const attr of attrs) {\n clone.setAttribute(attr, script.getAttribute(attr))\n }\n clone.removeAttribute('data-simply-location')\n if (!clone.src) {\n // this is an inline script, so copy the content and wait for previous scripts to run\n clone.innerHTML = script.innerHTML\n waitForPreviousScripts()\n .then(() => {\n const node = scriptLocations[script.dataset.simplyLocation]\n node.parentNode.insertBefore(clone, node)\n node.parentNode.removeChild(node)\n importScript()\n })\n } else {\n clone.src = rebaseHref(clone.src, base)\n if (!clone.hasAttribute('async') && !clone.hasAttribute('defer')) {\n clone.async = false //important! do not use clone.setAttribute('async', false) - it has no effect\n }\n const node = scriptLocations[script.dataset.simplyLocation]\n node.parentNode.insertBefore(clone, node)\n node.parentNode.removeChild(node)\n loaded[clone.src]=true\n importScript()\n }\n }\n if (arr.length) {\n importScript()\n }\n },\n html: (html, link) => {\n let fragment = globalThis.document.createRange().createContextualFragment(html)\n const stylesheets = fragment.querySelectorAll('link[rel=\"stylesheet\"],style')\n // add all stylesheets to head\n for (let stylesheet of stylesheets) {\n if (stylesheet.href) {\n stylesheet.href = rebaseHref(stylesheet.href, link.href)\n }\n head.appendChild(stylesheet)\n }\n // remove the scripts from the fragment, as they will not run in the\n // order in which they are defined\n let scriptsFragment = globalThis.document.createDocumentFragment()\n const scripts = fragment.querySelectorAll('script')\n if (scripts.length) {\n for (let script of scripts) {\n let placeholder = globalThis.document.createComment(script.src || 'inline script')\n script.parentNode.insertBefore(placeholder, script)\n script.dataset.simplyLocation = scriptLocations.length\n scriptLocations.push(placeholder)\n scriptsFragment.appendChild(script)\n }\n globalThis.setTimeout(function() {\n include.scripts(Array.from(scriptsFragment.children), link ? link.href : globalThis.location.href )\n }, 10)\n }\n // add the remainder before the include link\n link.parentNode.insertBefore(fragment, link ? link : null)\n\n }\n}\n\nlet included = {}\nconst includeLinks = async (links) => {\n // mark them as in progress, so handleChanges doesn't find them again\n let remainingLinks = [].reduce.call(links, (remainder, link) => {\n if (link.rel=='simply-include-once' && included[link.href]) {\n link.parentNode.removeChild(link)\n } else {\n included[link.href]=true\n link.rel = 'simply-include-loading'\n remainder.push(link)\n }\n return remainder\n }, [])\n\n for (let link of remainingLinks) {\n if (!link.href) {\n return\n }\n // fetch the html\n const response = await fetch(link.href)\n if (!response.ok) {\n console.log('simply-include: failed to load '+link.href);\n continue\n }\n console.log('simply-include: loaded '+link.href);\n const html = await response.text()\n // if succesfull import the html\n include.html(html, link)\n // remove the include link\n link.parentNode.removeChild(link)\n }\n}\n\nconst handleChanges = throttle(() => {\n runWhenIdle(() => {\n var links = globalThis.document.querySelectorAll('link[rel=\"simply-include\"],link[rel=\"simply-include-once\"]')\n if (links.length) {\n includeLinks(links)\n }\n })\n})\n\nconst observe = () => {\n observer = new MutationObserver(handleChanges)\n observer.observe(globalThis.document, {\n subtree: true,\n childList: true,\n })\n}\n\nobserve()\nhandleChanges() // check if there are include links in the dom already\n", "const path = {\n\tget(dataset, pointer) {\n\t\tif (typeof pointer !== 'string') {\n\t\t\treturn pointer\n\t\t}\n\t\tif (!pointer) {\n\t\t\treturn dataset\n\t\t}\n\t\tpointer.split('.').reduce(function(acc, name) {\n\t return (acc && acc[name] ? acc[name] : null)\n\t }, dataset)\n\t return dataset\n\t},\n\tset: function(dataset, pointer, value) {\n\t\tconst parent = path.get(dataset, path.parent(pointer))\n\t\tparent[path.pop(pointer)] = value\n\t},\n\tpop: function(pointer) {\n\t\treturn pointer.split('.').pop()\n\t},\n\tpush: function(pointer, name) {\n\t\treturn (pointer ? pointer + '.' : '') + name\n\t},\n\tparent: function(dataset, pointer) {\n\t\tconst names = pointer.split('.')\n\t\tnames.pop()\n\t\treturn names.join('.')\n\t},\n\tparents: function(dataset, pointer) {\n\t\tlet result = []\n\t\twhile (pointer) {\n\t\t\tpointer = path.parent(pointer)\n\t\t\tresult.unshift(pointer)\n\t\t}\n\t}\n}\n\nexport default path", "export class SimplyRender extends HTMLElement \n{\n constructor()\n {\n super()\n let templateId = this.getAttribute(\"rel\")\n let template = document.getElementById(templateId)\n\n if (template) {\n let content = template.content.cloneNode(true)\n for (const node of content.childNodes) {\n const clone = node.cloneNode(true)\n if (clone.nodeType == document.ELEMENT_NODE) {\n clone.querySelectorAll(\"template\").forEach(function(t) {\n t.setAttribute(\"simply-render\", \"\")\n })\n }\n this.parentNode.insertBefore(clone, this)\n }\n this.parentNode.removeChild(this)\n }\n }\n}\n\nif (!customElements.get('simply-render')) {\n customElements.define('simply-render', SimplyRender);\n}\n", "import { activate } from './activate.mjs'\nimport { actions as action } from './action.mjs'\nimport { app } from './app.mjs'\nimport { commands as command } from './command.mjs'\nimport { include } from './include.mjs'\nimport { keys as key } from './key.mjs'\nimport path from './path.mjs'\nimport { routes as route } from './route.mjs'\nimport { view } from './view.mjs'\nimport { SimplyRender } from './render.mjs'\n\nconst simply = {\n\tactivate,\n\taction,\n\tapp,\n\tcommand,\n\tinclude,\n\tkey,\n\tpath,\n\troute,\n\tview\n}\n\nglobalThis.simply = simply\n\nexport default simply"],
|
|
5
|
-
"mappings": "MAAK,OAAO,YACR,OAAO,UAAY,OAAO,WAAW,GAGzC,IAAMA,EAAY,IAAI,IAETC,EAAW,CACpB,YAAa,CAACC,EAAMC,IAAa,CACxBH,EAAU,IAAIE,CAAI,GACnBF,EAAU,IAAIE,EAAM,CAAC,CAAC,EAE1BF,EAAU,IAAIE,CAAI,EAAE,KAAKC,CAAQ,EACjCC,EAAYF,CAAI,CACpB,EACA,eAAgB,CAACA,EAAMC,IAAa,CAChC,GAAI,CAACH,EAAU,IAAIE,CAAI,EACnB,MAAO,GAEXF,EAAU,IAAIE,EAAMF,EAAU,IAAIE,CAAI,EAAE,OAAQG,GACrCA,GAAUF,CACpB,CAAC,CACN,CACJ,EAEA,SAASC,EAAYF,EAAM,CACvB,IAAMI,EAAQ,SAAS,iBAAiB,0BAA0BJ,EAAK,IAAI,EAC3E,GAAII,EACA,QAASC,KAAQD,EACbE,EAAcD,CAAI,CAG9B,CAEA,SAASC,EAAcD,EAAM,CACzB,IAAMN,EAAWM,GAAM,SAAS,eAChC,GAAIN,GAAYD,EAAU,IAAIC,CAAQ,EAClC,QAASE,KAAYH,EAAU,IAAIC,CAAQ,EAAG,CAC1C,IAAMQ,EAAYN,EAAS,KAAKI,CAAI,EAChC,OAAOE,GAAa,WACpBF,EAAK,OAAO,SAAS,EAAIE,EAClB,OAAOA,EAAa,KAC3B,QAAQ,KAAK,wEAAyEA,CAAS,CAEvG,CAER,CAEA,SAAS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A,QAAAC,EACA,QAAAC,EACA,IAAAC,EACA,KAAAC,EACA,MAAAC,EACA,KAAAC,CACD,EAEA,WAAW,OAAST,EAEpB,IAAOU,GAAQV",
|
|
6
|
-
"names": ["listeners", "activate", "name", "callback", "initialCall", "listener", "nodes", "node", "callListeners", "onDestroy", "handleChanges", "changes", "activateNodes", "change", "toActivate", "toDestroy", "child", "observer", "actions", "options", "optionsCompat", "app", "waitHandler", "target", "thisArg", "argumentsList", "result", "functionHandler", "err", "actionHandler", "property", "routes", "options", "optionsCompat", "app", "SimplyRoute", "parseRoutes", "path", "args", "matches", "getPath", "route", "getURL", "params", "key", "i", "searchParams", "action", "routeRe", "getRegexpFromRoute", "result", "callback", "evt", "link", "check", "listener", "baseURL", "exact", "routeInfo", "paths", "matchParams", "SimplyCommands", "options", "defaultHandlers", "commandHandler", "evt", "command", "getCommand", "el", "value", "name", "params", "handler", "commands", "optionsCompat", "app", "handlers", "values", "option", "data", "input", "KEY", "SimplyKey", "options", "keyHandler", "e", "selectedKeyboard", "keyCombination", "keyboards", "keyboardElement", "keyboard", "subkeyboard", "separators", "i", "separator", "keyString", "targets", "t", "keys", "optionsCompat", "app", "view", "options", "optionsCompat", "app", "load", "data", "path", "html", "strings", "values", "value", "index", "css", "SimplyApp", "options", "tempOptions", "mergeComponents", "mergeOptions", "key", "name", "element", "template", "style", "commands", "keys", "routes", "actions", "params", "view", "moduleHandler", "target", "property", "functionHandler", "thisArg", "argumentsList", "app", "html", "css", "otherOptions", "components", "component", "throttle", "callbackFunction", "intervalTime", "eventId", "myArguments", "runWhenIdle", "callback", "rebaseHref", "relative", "base", "url", "include", "observer", "loaded", "head", "currentScript", "getScriptURL", "currentScriptURL", "scripts", "index", "myScript", "waitForPreviousScripts", "resolve", "next", "scriptLocations", "arr", "importScript", "script", "attrs", "attr", "clone", "node", "html", "link", "fragment", "stylesheets", "stylesheet", "scriptsFragment", "placeholder", "included", "includeLinks", "links", "remainingLinks", "remainder", "response", "handleChanges", "observe", "path", "dataset", "pointer", "acc", "name", "value", "parent", "names", "result", "path_default", "SimplyRender", "templateId", "template", "content", "node", "clone", "t", "simply", "activate", "actions", "app", "commands", "include", "keys", "path_default", "routes", "view", "everything_default"]
|
|
4
|
+
"sourcesContent": ["if (!Symbol.onDestroy) {\n Symbol.onDestroy = Symbol('onDestroy')\n}\n\nconst listeners = new Map()\n\nexport const activate = {\n addListener: (name, callback) => {\n if (!listeners.has(name)) {\n listeners.set(name, [])\n }\n listeners.get(name).push(callback)\n initialCall(name)\n },\n removeListener: (name, callback) => {\n if (!listeners.has(name)) {\n return false\n }\n listeners.set(name, listeners.get(name).filter((listener) => {\n return listener!=callback\n }))\n }\n}\n\nfunction initialCall(name) {\n const nodes = document.querySelectorAll('[data-simply-activate=\"'+name+'\"]')\n if (nodes) {\n for( let node of nodes) {\n callListeners(node)\n }\n }\n}\n\nfunction callListeners(node) {\n const activate = node?.dataset?.simplyActivate\n if (activate && listeners.has(activate)) {\n for (let callback of listeners.get(activate)) {\n const onDestroy = callback.call(node)\n if (typeof onDestroy == 'function') {\n node[Symbol.onDestroy] = onDestroy\n } else if (typeof onDestroy != 'undefined') {\n console.warn('activate listener may only return a de-activate function, instead got', onDestroy)\n }\n }\n }\n}\n\nfunction handleChanges(changes) {\n let activateNodes = []\n for (let change of changes) {\n if (change.type == 'childList') {\n for (let node of change.addedNodes) {\n if (node.querySelectorAll) {\n let toActivate = Array.from(node.querySelectorAll('[data-simply-activate]'))\n if (node.matches('[data-simply-activate]')) {\n toActivate.push(node)\n }\n activateNodes = activateNodes.concat(toActivate)\n }\n }\n for (let node of change.removedNodes) {\n if (node.querySelectorAll) {\n let toDestroy = Array.from(node.querySelectorAll('[data-simply-activate]'))\n if (node.matches['[data-simply-activate']) {\n toDestroy.push(node)\n }\n for (let child of toDestroy) {\n if (child[Symbol.onDestroy]) {\n child[Symbol.onDestroy].call(child)\n }\n }\n }\n }\n }\n }\n for (let node of activateNodes) {\n callListeners(node)\n }\n}\n\nconst observer = new MutationObserver(handleChanges)\nobserver.observe(document, {\n subtree: true,\n childList: true\n})", "export function actions(options, optionsCompat) \n{\n\tif (optionsCompat) {\n\t\tlet app = options\n\t\toptions = optionsCompat\n\t\toptions.app = app\n\t}\n\n\tif (options.app) {\n\t\tconst waitHandler = {\n\t\t\tapply(target, thisArg, argumentsList)\n\t\t\t{\n\t\t\t\ttry {\n\t\t\t\t\tconst result = target(...argumentsList)\n\t\t\t\t\tif (result instanceof Promise) {\n\t\t\t\t\t\toptions.app.hooks.wait(true)\n\t\t\t\t\t\treturn result.finally(() => {\n\t\t\t\t\t\t\toptions.app.hooks.wait(false, target)\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t\treturn result\n\t\t\t\t} catch(err) {\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst functionHandler = {\n\t\t\tapply(target, thisArg, argumentsList)\n\t\t\t{\n\t\t\t\ttry {\n\t\t\t\t\tconst result = target(...argumentsList)\n\t\t\t\t\tif (result instanceof Promise) {\n\t\t\t\t\t\tif (options.app.hooks.wait) {\n\t\t\t\t\t\t\toptions.app.hooks.wait(true, target)\n\t\t\t\t\t\t\treturn result.catch(err => {\n\t\t\t\t\t\t\t\treturn options.app.hooks.error(err, target)\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t.finally(() => {\n\t\t\t\t\t\t\t\toptions.app.hooks.wait(false, target)\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn result.catch(err => {\n\t\t\t\t\t\t\t\treturn options.app.hooks.error(err, target)\n\t\t\t\t\t\t\t})\t\t\t\t\t\t\t\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn result\n\t\t\t\t} catch(err) {\n\t\t\t\t\treturn options.app.hooks.error(err, target)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst actionHandler = {\n\t\t\tget(target, property)\n\t\t\t{\n\t\t\t\tif (!target[property]) {\n\t\t\t\t\treturn undefined\n\t\t\t\t}\n\t\t\t\tif (options.app.hooks?.error) {\n\t\t\t\t\treturn new Proxy(target[property].bind(options.app), functionHandler)\n\t\t\t\t} else if (options.app.hooks?.wait) {\n\t\t\t\t\treturn new Proxy(target[property].bind(options.app), waitHandler)\n\t\t\t\t} else {\n\t\t\t\t\treturn target[property].bind(options.app)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn new Proxy(options.actions, actionHandler)\n\t} else {\n\t\treturn options\n\t}\n}", "export function routes(options, optionsCompat)\n{\n if (optionsCompat) {\n let app = options\n options = optionsCompat\n options.app = options\n }\n return new SimplyRoute(options)\n}\n\nclass SimplyRoute\n{\n constructor(options={})\n {\n this.baseURL = options.baseURL || '/'\n this.app = options.app || {}\n this.addMissingSlash = !!options.addMissingSlash\n this.matchExact = !!options.matchExact\n this.clear()\n if (options.routes) {\n this.load(options.routes)\n }\n }\n\n load(routes)\n {\n parseRoutes(routes, this.routeInfo, this.matchExact)\n }\n\n clear()\n {\n this.routeInfo = []\n this.listeners = {\n match: {},\n call: {},\n goto: {},\n finish: {}\n }\n }\n\n match(path, options)\n {\n let args = {\n path,\n options\n }\n args = this.runListeners('match',args)\n path = args.path ? args.path : path;\n\n let matches;\n if (!path) {\n if (this.match(document.location.pathname+document.location.hash)) {\n return true;\n } else {\n return this.match(document.location.pathname);\n }\n }\n path = getPath(path);\n for ( let route of this.routeInfo) {\n matches = route.match.exec(path)\n if (this.addMissingSlash && !matches?.length) {\n if (path && path[path.length-1]!='/') {\n matches = route.match.exec(path+'/')\n if (matches) {\n path+='/'\n history.replaceState({}, '', getURL(path, this.baseURL))\n }\n }\n }\n if (matches && matches.length) {\n let params = {};\n route.params.forEach((key, i) => {\n if (key=='*') {\n key = 'remainder'\n }\n params[key] = matches[i+1]\n })\n Object.assign(params, options)\n args.route = route\n args.params = params\n args = this.runListeners('call', args)\n params = args.params ? args.params : params\n const searchParams = new URLSearchParams(document.location.search)\n args.result = route.action.call(this.app, params, searchParams)\n this.runListeners('finish', args)\n return args.result\n }\n }\n return false\n }\n\n runListeners(action, params)\n {\n if (!this.listeners[action] || !Object.keys(this.listeners[action])) {\n return\n }\n Object.keys(this.listeners[action]).forEach((route) => {\n var routeRe = getRegexpFromRoute(route);\n if (routeRe.exec(params.path)) {\n var result;\n for (let callback of this.listeners[action][route]) {\n result = callback.call(this.app, params)\n if (result) {\n params = result\n }\n }\n }\n })\n return params\n }\n\n handleEvents()\n {\n globalThis.addEventListener('popstate', () => {\n if (this.match(getPath(document.location.pathname + document.location.hash, this.baseURL)) === false) {\n this.match(getPath(document.location.pathname, this.baseURL))\n }\n })\n this.app.container.addEventListener('click', (evt) => {\n if (evt.ctrlKey) {\n return;\n }\n if (evt.which != 1) {\n return; // not a 'left' mouse click\n }\n var link = evt.target;\n while (link && link.tagName!='A') {\n link = link.parentElement;\n }\n if (link \n && link.pathname \n && link.hostname==globalThis.location.hostname \n && !link.link\n && !link.dataset.simplyCommand\n ) {\n let check = [link.hash, link.pathname+link.hash, link.pathname]\n let path\n do {\n path = getPath(check.shift(), this.baseURL);\n } while(check.length && !this.has(path))\n if ( this.has(path) ) {\n let params = this.runListeners('goto', { path: path});\n if (params.path) {\n if (this.goto(params.path)) {\n // now cancel the browser navigation, since a route handler was found\n evt.preventDefault();\n return false;\n }\n }\n }\n }\n })\n }\n\n goto(path)\n {\n history.pushState({},'',getURL(path, this.baseURL))\n return this.match(path)\n }\n\n has(path)\n {\n path = getPath(path, this.baseURL)\n for (let route of this.routeInfo) {\n var matches = route.match.exec(path)\n if (matches && matches.length) {\n return true\n }\n }\n return false\n }\n\n addListener(action, route, callback)\n {\n if (['goto','match','call','finish'].indexOf(action)==-1) {\n throw new Error('Unknown action '+action)\n }\n if (!this.listeners[action][route]) {\n this.listeners[action][route] = []\n }\n this.listeners[action][route].push(callback)\n }\n\n removeListener(action, route, callback)\n {\n if (['match','call','finish'].indexOf(action)==-1) {\n throw new Error('Unknown action '+action)\n }\n if (!this.listeners[action][route]) {\n return\n }\n this.listeners[action][route] = this.listeners[action][route].filter((listener) => {\n return listener != callback\n })\n }\n\n init(options)\n {\n if (options.baseURL) {\n this.baseURL = options.baseURL\n }\n }\n}\n\nfunction getPath(path, baseURL='/')\n{\n if (path.substring(0,baseURL.length)==baseURL\n ||\n ( baseURL[baseURL.length-1]=='/' \n && path.length==(baseURL.length-1)\n && path == baseURL.substring(0,path.length)\n )\n ) {\n path = path.substring(baseURL.length)\n }\n if (path[0]!='/' && path[0]!='#') {\n path = '/'+path\n }\n return path\n}\n\nfunction getURL(path, baseURL)\n{\n path = getPath(path, baseURL)\n if (baseURL[baseURL.length-1]==='/' && path[0]==='/') {\n path = path.substring(1)\n }\n if (path[0]=='#') {\n return path\n }\n return baseURL + path\n}\n\nfunction getRegexpFromRoute(route, exact=false)\n{\n if (exact) {\n return new RegExp('^'+route.replace(/:\\w+/g, '([^/]+)').replace(/:\\*/, '(.*)')+'(\\\\?|$)')\n }\n return new RegExp('^'+route.replace(/:\\w+/g, '([^/]+)').replace(/:\\*/, '(.*)'))\n}\n\nfunction parseRoutes(routes, routeInfo, exact=false)\n{\n const paths = Object.keys(routes)\n const matchParams = /:(\\w+|\\*)/g\n for (let path of paths) {\n let matches = []\n let params = []\n do {\n matches = matchParams.exec(path)\n if (matches) {\n params.push(matches[1])\n }\n } while(matches)\n routeInfo.push({\n match: getRegexpFromRoute(path, exact),\n params: params,\n action: routes[path]\n })\n }\n return routeInfo\n}", "class SimplyCommands {\n\tconstructor(options={}) {\n\t\tif (!options.app) {\n\t\t\toptions.app = {}\n\t\t}\n\t\tif (!options.app.container) {\n\t\t\toptions.app.container = document.body\n\t\t}\n this.app = options.app\n\t\tthis.$handlers = options.handlers || defaultHandlers\n if (options.commands) {\n \t\tObject.assign(this, options.commands)\n }\n\n\t\tconst commandHandler = (evt) => {\n\t\t\tconst command = getCommand(evt, this.$handlers)\n\t\t\tif (!command) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (!this[command.name]) {\n console.error('simply.command: undefined command '+command.name, command.source);\n return\n\t\t\t}\n const shouldContinue = this[command.name].call(options.app, command.source, command.value)\n if (shouldContinue!==true) {\n evt.preventDefault()\n evt.stopPropagation()\n return false\n }\n\t\t}\n\n options.app.container.addEventListener('click', commandHandler)\n options.app.container.addEventListener('submit', commandHandler)\n options.app.container.addEventListener('change', commandHandler)\n options.app.container.addEventListener('input', commandHandler)\n\t}\n\n call(command, el, value) {\n if (!this[command]) {\n console.error('simply.command: undefined command '+command);\n return\n }\n return this[command].call(this.app, el, value)\n }\n\n action(name) {\n console.warn('deprecated call to `this.commands.action`')\n let params = Array.from(arguments).slice()\n params.shift()\n return this.app.actions[name](...params)\n }\n\n appendHandler(handler) {\n this.$handlers.push(handler)\n }\n\n prependHandler(handler) {\n this.$handlers.unshift(handler)\n }\n}\n\nexport function commands(options={}, optionsCompat) {\n if (optionsCompat) {\n let app = options\n options = optionsCompat\n options.app = options\n }\n\treturn new SimplyCommands(options)\n}\n\nfunction getCommand(evt, handlers) {\n var el = evt.target.closest('[data-simply-command]')\n if (el) {\n for (let handler of handlers) {\n if (el.matches(handler.match)) {\n if (handler.check(el, evt)) {\n return {\n name: el.dataset.simplyCommand,\n source: el,\n value: handler.get(el)\n }\n }\n return null\n }\n }\n }\n return null\n}\n\nconst defaultHandlers = [\n {\n match: 'input,select,textarea',\n get: function(el) {\n if (el.tagName==='SELECT' && el.multiple) {\n let values = []\n for (let option of el.options) {\n if (option.selected) {\n values.push(option.value)\n }\n }\n return values\n }\n return el.dataset.simplyValue || el.value\n },\n check: function(el, evt) {\n return evt.type=='change' || (el.dataset.simplyImmediate && evt.type=='input')\n }\n },\n {\n match: 'a,button',\n get: function(el) {\n return el.dataset.simplyValue || el.href || el.value\n },\n check: function(el,evt) {\n return evt.type=='click' && evt.ctrlKey==false && evt.button==0\n }\n },\n {\n match: 'form',\n get: function(el) {\n let data = {}\n for (let input of Array.from(el.elements)) {\n if (input.tagName=='INPUT' \n && (input.type=='checkbox' || input.type=='radio')\n ) {\n if (!input.checked) {\n return;\n }\n }\n if (data[input.name] && !Array.isArray(data[input.name])) {\n data[input.name] = [data[input.name]]\n }\n if (Array.isArray(data[input.name])) {\n data[input.name].push(input.value)\n } else {\n data[input.name] = input.value\n }\n }\n return data\n },\n check: function(el,evt) {\n return evt.type=='submit'\n }\n },\n {\n \tmatch: '*',\n get: function(el) {\n return el.dataset.simplyValue\n },\n check: function(el, evt) {\n return evt.type=='click' && evt.ctrlKey==false && evt.button==0\n }\n }\n]", "const KEY = Object.freeze({\n\tCompose: 229,\n\tControl: 17,\n\tMeta: 224,\n\tAlt: 18,\n\tShift: 16\n})\n\nclass SimplyKey {\n\tconstructor(options = {}) {\n\t\tif (!options.app) {\n\t\t\toptions.app = {}\n\t\t}\n\t\tif (!options.app.container) {\n\t\t\toptions.app.container = document.body\n\t\t}\n\t\tObject.assign(this, options.keys)\n\n\t\tconst keyHandler = (e) => {\n\t\t\tif (e.isComposing || e.keyCode === KEY.Compose) {\n\t\t\t return\n\t\t\t}\n\t\t\tif (e.defaultPrevented) {\n\t\t\t return\n\t\t\t}\n\t\t\tif (!e.target) {\n\t\t\t return\n\t\t\t}\n\n\t\t\tlet selectedKeyboard = 'default'\n\t\t\tif (e.target.closest('[data-simply-keyboard]')) {\n\t\t\t selectedKeyboard = e.target.closest('[data-simply-keyboard]')\n\t\t\t \t\t\t\t\t.dataset.simplyKeyboard\n\t\t\t}\n\t\t\tlet keyCombination = []\n\t\t\tif (e.ctrlKey && e.keyCode!=KEY.Control) {\n\t\t\t keyCombination.push('Control')\n\t\t\t}\n\t\t\tif (e.metaKey && e.keyCode!=KEY.Meta) {\n\t\t\t keyCombination.push('Meta')\n\t\t\t}\n\t\t\tif (e.altKey && e.keyCode!=KEY.Alt) {\n\t\t\t keyCombination.push('Alt')\n\t\t\t}\n\t\t\tif (e.shiftKey && e.keyCode!=KEY.Shift) {\n\t\t\t keyCombination.push('Shift')\n\t\t\t}\n\t\t\tkeyCombination.push(e.key.toLowerCase())\n\n\t\t\tlet keyboards = []\n\t\t\tlet keyboardElement = event.target.closest('[data-simply-keyboard]')\n\t\t\twhile (keyboardElement) {\n\t\t\t\tkeyboards.push(keyboardElement.dataset.simplyKeyboard)\n\t\t\t\tkeyboardElement = keyboardElement.parentNode.closest('[data-simply-keyboard]')\n\t\t\t}\n\t\t\tkeyboards.push('')\n\n\t\t\tlet keyboard, subkeyboard\n\t\t\tlet separators = ['+','-']\n\n\t\t\tfor (let i in keyboards) {\n\t\t\t\tkeyboard = keyboards[i]\n\t\t\t\tif (keyboard == '') {\n\t\t\t\t\tsubkeyboard = 'default'\n\t\t\t\t} else {\n\t\t\t\t\tsubkeyboard = keyboard\n\t\t\t\t\tkeyboard += '.'\n\t\t\t\t}\n\t\t\t\tfor (let separator of separators) {\n\t\t\t\t\tlet keyString = keyCombination.join(separator)\n\n\t\t\t\t\tif (this[subkeyboard] && (typeof this[subkeyboard][keyString]=='function')) {\n\t\t\t\t\t\tlet _continue = this[subkeyboard][keyString].call(options.app, e)\n\t\t\t\t\t\tif (!_continue) {\n\t\t\t\t\t\t\te.preventDefault()\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (typeof this[subkeyboard + keyString] == 'function') {\n\t\t\t\t\t\tlet _continue = this[subkeyboard + keyString].call(options.app, e)\n\t\t\t\t\t\tif (!_continue) {\n\t\t\t\t\t\t\te.preventDefault()\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\t\t\t\t\t\n\t\t\t\t\t}\n\n\t\t\t\t\tif (this[selectedKeyboard] && this[selectedKeyboard][keyString]) {\n\t\t\t\t\t\tlet targets = options.app.container.querySelectorAll('[data-simply-accesskey=\"'\n\t\t\t\t\t\t\t+ keyboard + keyString + '\"]')\n\t\t\t\t\t\tif (targets.length) {\n\t\t\t\t\t\t\ttargets.forEach(t => t.click())\n\t\t\t\t\t\t\te.preventDefault()\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\toptions.app.container.addEventListener('keydown', keyHandler)\n\t}\n\n}\n\nexport function keys(options={}, optionsCompat) {\n\tif (optionsCompat) {\n\t\tlet app = options\n\t\toptions = optionsCompat\n\t\toptions.app = options\n\t}\n\treturn new SimplyKey(options)\n}\n\n", "export function view(options, optionsCompat) {\n\tif (optionsCompat) {\n\t\tlet app = options\n\t\toptions = optionsCompat\n\t\toptions.app = options\n\t}\n\tif (options.app) {\n\t\toptions.app.view = options.view || {}\n\n\t\tconst load = () => {\n\t\t\tconst data = options.app.view\n\t\t\tconst path = globalThis.editor.data.getDataPath(options.app.container || document.body)\n\t\t\toptions.app.view = globalThis.editor.currentData[path]\n\t\t\tObject.assign(options.app.view, data)\n\t\t}\n\t\tif (globalThis.editor && globalThis.editor.currentData) {\n\t\t\tload()\n\t\t} else {\n\t\t\tdocument.addEventListener('simply-content-loaded', load)\n\t\t}\n\t\treturn options.app.view\n\t} else {\n\t\treturn options.view\n\t}\n}", "export function html(strings, ...values) {\n const outputArray = values.map(\n (value, index) =>\n `${strings[index]}${value}`,\n );\n return outputArray.join(\"\") + strings[strings.length - 1];\n}\n\nexport function css(strings, ...values) {\n\treturn html(strings, ...values)\n}\n", "import { routes } from './route.mjs'\nimport { commands } from './command.mjs'\nimport { actions } from './action.mjs'\nimport { keys } from './key.mjs'\nimport { view } from './view.mjs'\nimport { html, css } from './highlight.mjs'\n\nclass SimplyApp\n{\n\n\tconstructor(options={})\n\t{\n\t\tthis.container = options.container || document.body\n\t\tif (options.components) {\n\t\t\tlet tempOptions = {}\n\t\t\tmergeComponents(tempOptions, options.components)\n\t\t\tmergeOptions(tempOptions, options) // make sure options to the app override components options\n\t\t\toptions = tempOptions\n\t\t}\n\t\tfor (let key in options) {\n\t\t\tswitch(key) {\n\t\t\t\tcase 'html':\n\t\t\t\t\tfor (const name in options.html) {\n\t\t\t\t\t\tconst element = document.createElement('div')\n\t\t\t\t\t\telement.innerHTML = options.html[name]\n\t\t\t\t\t\tlet template = this.container.querySelector('template#'+name)\n\t\t\t\t\t\tif (!template) {\n\t\t\t\t\t\t\ttemplate = document.createElement('template')\n\t\t\t\t\t\t\ttemplate.id=name\n\t\t\t\t\t\t\ttemplate.content.append(...element.children)\n\t\t\t\t\t\t\tthis.container.appendChild(template)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\ttemplate.content.replaceChildren(...element.children)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t\tcase 'css':\n\t\t\t\t\tfor (const name in options.css) {\n\t\t\t\t\t\tlet style = this.container.querySelector('style#'+name)\n\t\t\t\t\t\tif (!style) {\n\t\t\t\t\t\t\tstyle = document.createElement('style')\n\t\t\t\t\t\t\tstyle.id=name \n\t\t\t\t\t\t\tthis.container.appendChild(style)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tstyle.innerHTML = options.css[name]\n\t\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t\tcase 'commands':\n\t\t\t\t\tthis.commands = commands({ app: this, container: this.container, commands: options.commands})\n\t\t\t\t\tbreak\n\t\t\t\tcase 'keys':\n\t\t\t\tcase 'keyboard': // backwards compatible\n\t\t\t\t\tthis.keys = keys({ app: this, keys: options.keys })\n\t\t\t\t\tbreak\n\t\t\t\tcase 'root': // backwards compatibility\n\t\t\t\tcase 'baseURL':\n\t\t\t\t\tthis.baseURL = options[key]\n\t\t\t\t\tbreak\n\t\t\t\tcase 'routes':\n\t\t\t\t\tthis.routes = routes({ app: this, routes: options.routes})\n\t\t\t\t\tbreak\n\t\t\t\tcase 'actions':\n\t\t\t\t\tthis.actions = actions({app: this, actions: options.actions})\n\t\t\t\t\tthis.action = function(name) { // backwards compatible wiht SimplyView2\n\t\t\t\t\t\tconsole.warn('deprecated call to `this.action`')\n\t\t\t\t\t\tlet params = Array.from(arguments).slice()\n\t\t\t\t params.shift()\n\t\t\t\t return this.actions[name](...params)\n\t\t\t\t }\n\t\t\t\t\tbreak\n\t\t\t\tcase 'view':\n\t\t\t\t\tthis.view = view({app: this, view: options.view})\n\t\t\t\t\tbreak\n\t\t\t\tcase 'hooks':\n\t\t\t\t\tconst moduleHandler = {\n\t\t\t\t\t\tget: (target, property) => {\n\t\t\t\t\t\t\tif (!target[property]) {\n\t\t\t\t\t\t\t\treturn undefined\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (typeof target[property]=='function') {\n\t\t\t\t\t\t\t\treturn new Proxy(target[property], functionHandler)\n\t\t\t\t\t\t\t} else if (target[property] && typeof target[property]=='object') {\n\t\t\t\t\t\t\t\treturn new Proxy(target[property], moduleHandler)\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\treturn target[property]\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tconst functionHandler = {\n\t\t\t\t\t\tapply: (target, thisArg, argumentsList) => {\n\t\t\t\t\t\t\t// note: must use short function syntax so this is set to the app\n\t\t\t\t\t\t\treturn target.apply(this, argumentsList)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tthis[key] = new Proxy(options[key], moduleHandler)\n\t\t\t\t\tbreak\n\t\t\t\tcomponents:\n\t\t\t\t\tthis.components = components\n\t\t\t\t\tbreak\n\t\t\t\tprototype:\n\t\t\t\t__proto__:\n\t\t\t\t\t// ignore this to avoid prototype pollution\n\t\t\t\t\tbreak\n\t\t\t\tdefault:\n\t\t\t\t\tconsole.log('simply.app: unknown initialization option \"'+key+'\", added as-is')\n\t\t\t\t\tthis[key] = options[key]\n\t\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\tget app()\n\t{\n\t\treturn this\n\t}\n\n\tasync start()\n\t{\n\t\tif (this.components) {\n\t\t\tfor (const name in this.components) {\n\t\t\t\tif (this.components[name].hooks?.start) {\n\t\t\t\t\tawait this.components[name].hooks.start.call(this, this.components[name])\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (this.hooks?.start) {\n\t\t\tawait this.hooks.start()\n\t\t}\n\t\tif (this.routes) {\n\t\t\tif (this.baseURL) {\n\t\t\t\tthis.routes.init({ baseURL: this.baseURL })\n\t\t\t}\n\t\t\tthis.routes.handleEvents();\n\t\t\tglobalThis.setTimeout(() => {\n\t\t\t\tif (this.routes.has(globalThis.location?.hash)) {\n\t\t\t\t\tthis.routes.match(globalThis.location.hash)\n\t\t\t\t} else {\n\t\t\t\t\tthis.routes.match(globalThis.location?.pathname+globalThis.location?.hash)\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\n}\n\nexport function app(options={})\n{\n\treturn new SimplyApp(options)\n}\n\nif (!globalThis.html) {\n\tglobalThis.html = html\n}\nif (!globalThis.css) {\n\tglobalThis.css = css\n}\n\nfunction mergeOptions(options, otherOptions)\n{\n\tfor (const key in otherOptions) {\n\t\tswitch(typeof otherOptions[key]) {\n\t\t\tcase 'object':\n\t\t\t\tif (!otherOptions[key]) {\n\t\t\t\t\tcontinue // null\n\t\t\t\t}\n\t\t\t\tif (!options[key]) {\n\t\t\t\t\toptions[key] = otherOptions[key]\n\t\t\t\t} else {\n\t\t\t\t\t//FIXME: check that options[key] is also an object\n\t\t\t\t\tmergeOptions(options[key], otherOptions[key])\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\tdefault:\n\t\t\t\toptions[key] = otherOptions[key]\n\t\t}\n\t}\n}\n\nfunction mergeComponents(options, components) {\n\tfor (const name in components) {\n\t\tconst component = components[name]\n\t\tif (component.components) {\n\t\t\tmergeComponents(options, component.components)\n\t\t}\n\t\tif (!options.components) {\n\t\t\toptions.components = {}\n\t\t}\n\t\toptions.components[name] = component\n\t\tfor (const key in component) {\n\t\t\tswitch(key) {\n\t\t\t\tcase 'hooks':\n\t\t\t\t\t// don't merge these, app.hooks.start will trigger each components start hook\n\t\t\t\tcase 'components':\n\t\t\t\t\t// already handled\n\t\t\t\t\tbreak\n\t\t\t\tdefault:\n\t\t\t\t\tif (!options[key]) {\n\t\t\t\t\t\toptions[key] = Object.create(null)\n\t\t\t\t\t}\n\t\t\t\t\tmergeOptions(options[key], component[key])\n\t\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n}\n", "function throttle( callbackFunction, intervalTime ) {\n let eventId = 0\n return () => {\n const myArguments = arguments\n if ( eventId ) {\n return\n } else {\n eventId = globalThis.setTimeout( () => {\n callbackFunction.apply(this, myArguments)\n eventId = 0\n }, intervalTime )\n }\n }\n}\n\nconst runWhenIdle = (() => {\n if (globalThis.requestIdleCallback) {\n return (callback) => {\n globalThis.requestIdleCallback(callback, {timeout: 500})\n }\n }\n return globalThis.requestAnimationFrame\n})()\n\nfunction rebaseHref(relative, base) {\n let url = new URL(relative, base)\n if (include.cacheBuster) {\n url.searchParams.set('cb',include.cacheBuster)\n }\n return url.href\n}\n\nlet observer, loaded = {}\nlet head = globalThis.document.querySelector('head')\nlet currentScript = globalThis.document.currentScript\nlet getScriptURL, currentScriptURL\nif (!currentScript) {\n getScriptURL = (() => {\n var scripts = document.getElementsByTagName('script')\n var index = scripts.length - 1\n var myScript = scripts[index]\n return () => myScript?.src\n })()\n currentScriptURL = getScriptURL()\n} else {\n currentScriptURL = currentScript.src\n}\n\nconst waitForPreviousScripts = async () => {\n // because of the async=false attribute, this script will run after\n // the previous scripts have been loaded and run\n // simply.include.next.js only fires the simply-next-script event\n // that triggers the Promise.resolve method\n return new Promise(function(resolve) {\n var next = globalThis.document.createElement('script')\n next.src = \"https://cdn.jsdelivr.net/gh/simplyedit/simplyview/dist/simply.include.next.js\"\n next.async = false\n globalThis.document.addEventListener('simply-include-next', () => {\n head.removeChild(next)\n resolve()\n }, { once: true, passive: true})\n head.appendChild(next)\n })\n}\n\nlet scriptLocations = []\n\nexport const include = {\n cacheBuster: null,\n scripts: (scripts, base) => {\n let arr = scripts.slice()\n const importScript = () => {\n const script = arr.shift()\n if (!script) {\n return\n }\n const attrs = [].map.call(script.attributes, (attr) => {\n return attr.name\n })\n let clone = globalThis.document.createElement('script')\n for (const attr of attrs) {\n clone.setAttribute(attr, script.getAttribute(attr))\n }\n clone.removeAttribute('data-simply-location')\n if (!clone.src) {\n // this is an inline script, so copy the content and wait for previous scripts to run\n clone.innerHTML = script.innerHTML\n waitForPreviousScripts()\n .then(() => {\n const node = scriptLocations[script.dataset.simplyLocation]\n node.parentNode.insertBefore(clone, node)\n node.parentNode.removeChild(node)\n importScript()\n })\n } else {\n clone.src = rebaseHref(clone.src, base)\n if (!clone.hasAttribute('async') && !clone.hasAttribute('defer')) {\n clone.async = false //important! do not use clone.setAttribute('async', false) - it has no effect\n }\n const node = scriptLocations[script.dataset.simplyLocation]\n node.parentNode.insertBefore(clone, node)\n node.parentNode.removeChild(node)\n loaded[clone.src]=true\n importScript()\n }\n }\n if (arr.length) {\n importScript()\n }\n },\n html: (html, link) => {\n let fragment = globalThis.document.createRange().createContextualFragment(html)\n const stylesheets = fragment.querySelectorAll('link[rel=\"stylesheet\"],style')\n // add all stylesheets to head\n for (let stylesheet of stylesheets) {\n if (stylesheet.href) {\n stylesheet.href = rebaseHref(stylesheet.href, link.href)\n }\n head.appendChild(stylesheet)\n }\n // remove the scripts from the fragment, as they will not run in the\n // order in which they are defined\n let scriptsFragment = globalThis.document.createDocumentFragment()\n const scripts = fragment.querySelectorAll('script')\n if (scripts.length) {\n for (let script of scripts) {\n let placeholder = globalThis.document.createComment(script.src || 'inline script')\n script.parentNode.insertBefore(placeholder, script)\n script.dataset.simplyLocation = scriptLocations.length\n scriptLocations.push(placeholder)\n scriptsFragment.appendChild(script)\n }\n globalThis.setTimeout(function() {\n include.scripts(Array.from(scriptsFragment.children), link ? link.href : globalThis.location.href )\n }, 10)\n }\n // add the remainder before the include link\n link.parentNode.insertBefore(fragment, link ? link : null)\n\n }\n}\n\nlet included = {}\nconst includeLinks = async (links) => {\n // mark them as in progress, so handleChanges doesn't find them again\n let remainingLinks = [].reduce.call(links, (remainder, link) => {\n if (link.rel=='simply-include-once' && included[link.href]) {\n link.parentNode.removeChild(link)\n } else {\n included[link.href]=true\n link.rel = 'simply-include-loading'\n remainder.push(link)\n }\n return remainder\n }, [])\n\n for (let link of remainingLinks) {\n if (!link.href) {\n return\n }\n // fetch the html\n const response = await fetch(link.href)\n if (!response.ok) {\n console.log('simply-include: failed to load '+link.href);\n continue\n }\n console.log('simply-include: loaded '+link.href);\n const html = await response.text()\n // if succesfull import the html\n include.html(html, link)\n // remove the include link\n link.parentNode.removeChild(link)\n }\n}\n\nconst handleChanges = throttle(() => {\n runWhenIdle(() => {\n var links = globalThis.document.querySelectorAll('link[rel=\"simply-include\"],link[rel=\"simply-include-once\"]')\n if (links.length) {\n includeLinks(links)\n }\n })\n})\n\nconst observe = () => {\n observer = new MutationObserver(handleChanges)\n observer.observe(globalThis.document, {\n subtree: true,\n childList: true,\n })\n}\n\nobserve()\nhandleChanges() // check if there are include links in the dom already\n", "const path = {\n\tget(dataset, pointer) {\n\t\tif (typeof pointer !== 'string') {\n\t\t\treturn pointer\n\t\t}\n\t\tif (!pointer) {\n\t\t\treturn dataset\n\t\t}\n\t\treturn pointer.split('.').reduce(function(acc, name) {\n\t return (acc && acc[name] ? acc[name] : null)\n\t }, dataset)\n\t},\n\tset: function(dataset, pointer, value) {\n\t\tconst parent = path.get(dataset, path.parent(pointer))\n\t\tparent[path.pop(pointer)] = value\n\t},\n\tpop: function(pointer) {\n\t\treturn pointer.split('.').pop()\n\t},\n\tpush: function(pointer, name) {\n\t\treturn (pointer ? pointer + '.' : '') + name\n\t},\n\tparent: function(dataset, pointer) {\n\t\tconst names = pointer.split('.')\n\t\tnames.pop()\n\t\treturn names.join('.')\n\t},\n\tparents: function(dataset, pointer) {\n\t\tlet result = []\n\t\twhile (pointer) {\n\t\t\tpointer = path.parent(pointer)\n\t\t\tresult.unshift(pointer)\n\t\t}\n\t}\n}\n\nexport default path", "export class SimplyRender extends HTMLElement \n{\n constructor()\n {\n super()\n }\n\n connectedCallback()\n {\n let templateId = this.getAttribute(\"rel\")\n let template = document.getElementById(templateId)\n\n if (template) {\n let content = template.content.cloneNode(true)\n for (const node of content.childNodes) {\n const clone = node.cloneNode(true)\n if (clone.nodeType == document.ELEMENT_NODE) {\n clone.querySelectorAll(\"template\").forEach(function(t) {\n t.setAttribute(\"simply-render\", \"\")\n })\n }\n this.parentNode.insertBefore(clone, this)\n }\n this.parentNode.removeChild(this)\n }\n }\n}\n\nif (!customElements.get('simply-render')) {\n customElements.define('simply-render', SimplyRender);\n}\n\nconst handleChanges = () => {\n const simplyrenders = globalThis.document.querySelectorAll('simply-render[rel]')\n for (el of simplyrenders) {\n if (document.querySelector('template#'+el.getAttribute('rel'))) {\n el.replaceWith(el) // trigger connectedCallback?\n }\n }\n}\n\nconst observe = () => {\n observer = new MutationObserver(handleChanges)\n observer.observe(globalThis.document, {\n subtree: true,\n childList: true,\n })\n}\n\nobserve()", "import { activate } from './activate.mjs'\nimport { actions as action } from './action.mjs'\nimport { app } from './app.mjs'\nimport { commands as command } from './command.mjs'\nimport { include } from './include.mjs'\nimport { keys as key } from './key.mjs'\nimport path from './path.mjs'\nimport { routes as route } from './route.mjs'\nimport { view } from './view.mjs'\nimport { SimplyRender } from './render.mjs'\n\nconst simply = {\n\tactivate,\n\taction,\n\tapp,\n\tcommand,\n\tinclude,\n\tkey,\n\tpath,\n\troute,\n\tview\n}\n\nglobalThis.simply = simply\n\nexport default simply"],
|
|
5
|
+
"mappings": "MAAK,OAAO,YACR,OAAO,UAAY,OAAO,WAAW,GAGzC,IAAMA,EAAY,IAAI,IAETC,EAAW,CACpB,YAAa,CAACC,EAAMC,IAAa,CACxBH,EAAU,IAAIE,CAAI,GACnBF,EAAU,IAAIE,EAAM,CAAC,CAAC,EAE1BF,EAAU,IAAIE,CAAI,EAAE,KAAKC,CAAQ,EACjCC,EAAYF,CAAI,CACpB,EACA,eAAgB,CAACA,EAAMC,IAAa,CAChC,GAAI,CAACH,EAAU,IAAIE,CAAI,EACnB,MAAO,GAEXF,EAAU,IAAIE,EAAMF,EA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ACA,CACI,IAAIC,EAAa,KAAK,aAAa,KAAK,EACpCC,EAAW,SAAS,eAAeD,CAAU,EAEjD,GAAIC,EAAU,CACV,IAAIC,EAAUD,EAAS,QAAQ,UAAU,EAAI,EAC7C,QAAWE,KAAQD,EAAQ,WAAY,CACnC,IAAME,EAAQD,EAAK,UAAU,EAAI,EAC7BC,EAAM,UAAY,SAAS,cAC3BA,EAAM,iBAAiB,UAAU,EAAE,QAAQ,SAASC,EAAG,CACnDA,EAAE,aAAa,gBAAiB,EAAE,CACtC,CAAC,EAEL,KAAK,WAAW,aAAaD,EAAO,IAAI,CAC5C,CACA,KAAK,WAAW,YAAY,IAAI,CACpC,CACJ,CACJ,EAEK,eAAe,IAAI,eAAe,GACnC,eAAe,OAAO,gBAAiBL,CAAY,EAGvD,IAAMO,GAAgB,IAAM,CACxB,IAAMC,EAAgB,WAAW,SAAS,iBAAiB,oBAAoB,EAC/E,IAAK,MAAMA,EACH,SAAS,cAAc,YAAY,GAAG,aAAa,KAAK,CAAC,GACzD,GAAG,YAAY,EAAE,CAG7B,EAEMC,GAAU,IAAM,CAClB,SAAW,IAAI,iBAAiBF,EAAa,EAC7C,SAAS,QAAQ,WAAW,SAAU,CAClC,QAAS,GACT,UAAW,EACf,CAAC,CACL,EAEAE,GAAQ,ECtCR,IAAMC,EAAS,CACd,SAAAC,EACA,OAAAC,EACA,IAAAC,EACA,QAAAC,EACA,QAAAC,EACA,IAAAC,EACA,KAAAC,EACA,MAAAC,EACA,KAAAC,CACD,EAEA,WAAW,OAAST,EAEpB,IAAOU,GAAQV",
|
|
6
|
+
"names": ["listeners", "activate", "name", "callback", "initialCall", "listener", "nodes", "node", "callListeners", "onDestroy", "handleChanges", "changes", "activateNodes", "change", "toActivate", "toDestroy", "child", "observer", "actions", "options", "optionsCompat", "app", "waitHandler", "target", "thisArg", "argumentsList", "result", "functionHandler", "err", "actionHandler", "property", "routes", "options", "optionsCompat", "app", "SimplyRoute", "parseRoutes", "path", "args", "matches", "getPath", "route", "getURL", "params", "key", "i", "searchParams", "action", "routeRe", "getRegexpFromRoute", "result", "callback", "evt", "link", "check", "listener", "baseURL", "exact", "routeInfo", "paths", "matchParams", "SimplyCommands", "options", "defaultHandlers", "commandHandler", "evt", "command", "getCommand", "el", "value", "name", "params", "handler", "commands", "optionsCompat", "app", "handlers", "values", "option", "data", "input", "KEY", "SimplyKey", "options", "keyHandler", "e", "selectedKeyboard", "keyCombination", "keyboards", "keyboardElement", "keyboard", "subkeyboard", "separators", "i", "separator", "keyString", "targets", "t", "keys", "optionsCompat", "app", "view", "options", "optionsCompat", "app", "load", "data", "path", "html", "strings", "values", "value", "index", "css", "SimplyApp", "options", "tempOptions", "mergeComponents", "mergeOptions", "key", "name", "element", "template", "style", "commands", "keys", "routes", "actions", "params", "view", "moduleHandler", "target", "property", "functionHandler", "thisArg", "argumentsList", "app", "html", "css", "otherOptions", "components", "component", "throttle", "callbackFunction", "intervalTime", "eventId", "myArguments", "runWhenIdle", "callback", "rebaseHref", "relative", "base", "url", "include", "observer", "loaded", "head", "currentScript", "getScriptURL", "currentScriptURL", "scripts", "index", "myScript", "waitForPreviousScripts", "resolve", "next", "scriptLocations", "arr", "importScript", "script", "attrs", "attr", "clone", "node", "html", "link", "fragment", "stylesheets", "stylesheet", "scriptsFragment", "placeholder", "included", "includeLinks", "links", "remainingLinks", "remainder", "response", "handleChanges", "observe", "path", "dataset", "pointer", "acc", "name", "value", "parent", "names", "result", "path_default", "SimplyRender", "templateId", "template", "content", "node", "clone", "t", "handleChanges", "simplyrenders", "observe", "simply", "activate", "actions", "app", "commands", "include", "keys", "path_default", "routes", "view", "everything_default"]
|
|
7
7
|
}
|
package/package.json
CHANGED
package/src/path.mjs
CHANGED
|
@@ -6,10 +6,9 @@ const path = {
|
|
|
6
6
|
if (!pointer) {
|
|
7
7
|
return dataset
|
|
8
8
|
}
|
|
9
|
-
pointer.split('.').reduce(function(acc, name) {
|
|
9
|
+
return pointer.split('.').reduce(function(acc, name) {
|
|
10
10
|
return (acc && acc[name] ? acc[name] : null)
|
|
11
11
|
}, dataset)
|
|
12
|
-
return dataset
|
|
13
12
|
},
|
|
14
13
|
set: function(dataset, pointer, value) {
|
|
15
14
|
const parent = path.get(dataset, path.parent(pointer))
|
package/src/render.mjs
CHANGED
|
@@ -3,6 +3,10 @@ export class SimplyRender extends HTMLElement
|
|
|
3
3
|
constructor()
|
|
4
4
|
{
|
|
5
5
|
super()
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
connectedCallback()
|
|
9
|
+
{
|
|
6
10
|
let templateId = this.getAttribute("rel")
|
|
7
11
|
let template = document.getElementById(templateId)
|
|
8
12
|
|
|
@@ -25,3 +29,22 @@ export class SimplyRender extends HTMLElement
|
|
|
25
29
|
if (!customElements.get('simply-render')) {
|
|
26
30
|
customElements.define('simply-render', SimplyRender);
|
|
27
31
|
}
|
|
32
|
+
|
|
33
|
+
const handleChanges = () => {
|
|
34
|
+
const simplyrenders = globalThis.document.querySelectorAll('simply-render[rel]')
|
|
35
|
+
for (el of simplyrenders) {
|
|
36
|
+
if (document.querySelector('template#'+el.getAttribute('rel'))) {
|
|
37
|
+
el.replaceWith(el) // trigger connectedCallback?
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const observe = () => {
|
|
43
|
+
observer = new MutationObserver(handleChanges)
|
|
44
|
+
observer.observe(globalThis.document, {
|
|
45
|
+
subtree: true,
|
|
46
|
+
childList: true,
|
|
47
|
+
})
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
observe()
|