simplyview 3.1.3 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/simply.app.js +115 -43
- package/dist/simply.app.min.js +1 -1
- package/dist/simply.app.min.js.map +3 -3
- package/dist/simply.everything.js +138 -45
- package/dist/simply.everything.min.js +1 -1
- package/dist/simply.everything.min.js.map +3 -3
- package/package.json +1 -1
- package/src/action.mjs +52 -19
- package/src/activate.mjs +24 -2
- package/src/app.mjs +47 -5
- package/src/key.mjs +1 -1
- package/src/route.mjs +27 -23
package/dist/simply.app.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
}
|
|
11
11
|
var SimplyRoute = class {
|
|
12
12
|
constructor(options = {}) {
|
|
13
|
-
this.
|
|
13
|
+
this.baseURL = options.baseURL || "/";
|
|
14
14
|
this.app = options.app || {};
|
|
15
15
|
this.addMissingSlash = !!options.addMissingSlash;
|
|
16
16
|
this.matchExact = !!options.matchExact;
|
|
@@ -54,17 +54,17 @@
|
|
|
54
54
|
matches = route.match.exec(path + "/");
|
|
55
55
|
if (matches) {
|
|
56
56
|
path += "/";
|
|
57
|
-
history.replaceState({}, "", getURL(path, this.
|
|
57
|
+
history.replaceState({}, "", getURL(path, this.baseURL));
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
if (matches && matches.length) {
|
|
62
62
|
let params = {};
|
|
63
|
-
route.params.forEach((key,
|
|
63
|
+
route.params.forEach((key, i) => {
|
|
64
64
|
if (key == "*") {
|
|
65
65
|
key = "remainder";
|
|
66
66
|
}
|
|
67
|
-
params[key] = matches[
|
|
67
|
+
params[key] = matches[i + 1];
|
|
68
68
|
});
|
|
69
69
|
Object.assign(params, options);
|
|
70
70
|
args.route = route;
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
return false;
|
|
81
81
|
}
|
|
82
82
|
runListeners(action, params) {
|
|
83
|
-
if (!Object.keys(this.listeners[action])) {
|
|
83
|
+
if (!this.listeners[action] || !Object.keys(this.listeners[action])) {
|
|
84
84
|
return;
|
|
85
85
|
}
|
|
86
86
|
Object.keys(this.listeners[action]).forEach((route) => {
|
|
@@ -99,8 +99,8 @@
|
|
|
99
99
|
}
|
|
100
100
|
handleEvents() {
|
|
101
101
|
globalThis.addEventListener("popstate", () => {
|
|
102
|
-
if (this.match(getPath(document.location.pathname + document.location.hash, this.
|
|
103
|
-
this.match(getPath(document.location.pathname, this.
|
|
102
|
+
if (this.match(getPath(document.location.pathname + document.location.hash, this.baseURL)) === false) {
|
|
103
|
+
this.match(getPath(document.location.pathname, this.baseURL));
|
|
104
104
|
}
|
|
105
105
|
});
|
|
106
106
|
this.app.container.addEventListener("click", (evt) => {
|
|
@@ -115,10 +115,11 @@
|
|
|
115
115
|
link = link.parentElement;
|
|
116
116
|
}
|
|
117
117
|
if (link && link.pathname && link.hostname == globalThis.location.hostname && !link.link && !link.dataset.simplyCommand) {
|
|
118
|
-
let
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
118
|
+
let check = [link.hash, link.pathname + link.hash, link.pathname];
|
|
119
|
+
let path;
|
|
120
|
+
do {
|
|
121
|
+
path = getPath(check.shift(), this.baseURL);
|
|
122
|
+
} while (check.length && !this.has(path));
|
|
122
123
|
if (this.has(path)) {
|
|
123
124
|
let params = this.runListeners("goto", { path });
|
|
124
125
|
if (params.path) {
|
|
@@ -132,11 +133,11 @@
|
|
|
132
133
|
});
|
|
133
134
|
}
|
|
134
135
|
goto(path) {
|
|
135
|
-
history.pushState({}, "", getURL(path, this.
|
|
136
|
+
history.pushState({}, "", getURL(path, this.baseURL));
|
|
136
137
|
return this.match(path);
|
|
137
138
|
}
|
|
138
139
|
has(path) {
|
|
139
|
-
path = getPath(path, this.
|
|
140
|
+
path = getPath(path, this.baseURL);
|
|
140
141
|
for (let route of this.routeInfo) {
|
|
141
142
|
var matches = route.match.exec(path);
|
|
142
143
|
if (matches && matches.length) {
|
|
@@ -166,26 +167,29 @@
|
|
|
166
167
|
});
|
|
167
168
|
}
|
|
168
169
|
init(options) {
|
|
169
|
-
if (options.
|
|
170
|
-
this.
|
|
170
|
+
if (options.baseURL) {
|
|
171
|
+
this.baseURL = options.baseURL;
|
|
171
172
|
}
|
|
172
173
|
}
|
|
173
174
|
};
|
|
174
|
-
function getPath(path,
|
|
175
|
-
if (path.substring(0,
|
|
176
|
-
path = path.substring(
|
|
175
|
+
function getPath(path, baseURL = "/") {
|
|
176
|
+
if (path.substring(0, baseURL.length) == baseURL || baseURL[baseURL.length - 1] == "/" && path.length == baseURL.length - 1 && path == baseURL.substring(0, path.length)) {
|
|
177
|
+
path = path.substring(baseURL.length);
|
|
177
178
|
}
|
|
178
179
|
if (path[0] != "/" && path[0] != "#") {
|
|
179
180
|
path = "/" + path;
|
|
180
181
|
}
|
|
181
182
|
return path;
|
|
182
183
|
}
|
|
183
|
-
function getURL(path,
|
|
184
|
-
path = getPath(path,
|
|
185
|
-
if (
|
|
184
|
+
function getURL(path, baseURL) {
|
|
185
|
+
path = getPath(path, baseURL);
|
|
186
|
+
if (baseURL[baseURL.length - 1] === "/" && path[0] === "/") {
|
|
186
187
|
path = path.substring(1);
|
|
187
188
|
}
|
|
188
|
-
|
|
189
|
+
if (path[0] == "#") {
|
|
190
|
+
return path;
|
|
191
|
+
}
|
|
192
|
+
return baseURL + path;
|
|
189
193
|
}
|
|
190
194
|
function getRegexpFromRoute(route, exact = false) {
|
|
191
195
|
if (exact) {
|
|
@@ -367,13 +371,54 @@
|
|
|
367
371
|
options.app = app2;
|
|
368
372
|
}
|
|
369
373
|
if (options.app) {
|
|
374
|
+
const waitHandler = {
|
|
375
|
+
apply(target, thisArg, argumentsList) {
|
|
376
|
+
try {
|
|
377
|
+
const result = target(...argumentsList);
|
|
378
|
+
if (result instanceof Promise) {
|
|
379
|
+
options.app.hooks.wait(true);
|
|
380
|
+
return result.finally(() => {
|
|
381
|
+
options.app.hooks.wait(false, target);
|
|
382
|
+
});
|
|
383
|
+
}
|
|
384
|
+
return result;
|
|
385
|
+
} catch (err) {
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
};
|
|
389
|
+
const functionHandler = {
|
|
390
|
+
apply(target, thisArg, argumentsList) {
|
|
391
|
+
try {
|
|
392
|
+
const result = target(...argumentsList);
|
|
393
|
+
if (result instanceof Promise) {
|
|
394
|
+
if (options.app.hooks.wait) {
|
|
395
|
+
options.app.hooks.wait(true, target);
|
|
396
|
+
return result.catch((err) => {
|
|
397
|
+
return options.app.hooks.error(err, target);
|
|
398
|
+
}).finally(() => {
|
|
399
|
+
options.app.hooks.wait(false, target);
|
|
400
|
+
});
|
|
401
|
+
} else {
|
|
402
|
+
return result.catch((err) => {
|
|
403
|
+
return options.app.hooks.error(err, target);
|
|
404
|
+
});
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
return result;
|
|
408
|
+
} catch (err) {
|
|
409
|
+
return options.app.hooks.error(err, target);
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
};
|
|
370
413
|
const actionHandler = {
|
|
371
414
|
get(target, property) {
|
|
372
415
|
if (!target[property]) {
|
|
373
416
|
return void 0;
|
|
374
417
|
}
|
|
375
|
-
if (
|
|
418
|
+
if (options.app.hooks?.error) {
|
|
376
419
|
return new Proxy(target[property].bind(options.app), functionHandler);
|
|
420
|
+
} else if (options.app.hooks?.wait) {
|
|
421
|
+
return new Proxy(target[property].bind(options.app), waitHandler);
|
|
377
422
|
} else {
|
|
378
423
|
return target[property].bind(options.app);
|
|
379
424
|
}
|
|
@@ -384,21 +429,6 @@
|
|
|
384
429
|
return options;
|
|
385
430
|
}
|
|
386
431
|
}
|
|
387
|
-
var functionHandler = {
|
|
388
|
-
apply(target, thisArg, argumentsList) {
|
|
389
|
-
try {
|
|
390
|
-
const result = target(...argumentsList);
|
|
391
|
-
if (result instanceof Promise) {
|
|
392
|
-
return result.catch((err) => {
|
|
393
|
-
return thisArg.catch(err);
|
|
394
|
-
});
|
|
395
|
-
}
|
|
396
|
-
return result;
|
|
397
|
-
} catch (err) {
|
|
398
|
-
return thisArg.catch(err);
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
};
|
|
402
432
|
|
|
403
433
|
// src/key.mjs
|
|
404
434
|
var KEY = Object.freeze({
|
|
@@ -454,7 +484,7 @@
|
|
|
454
484
|
keyboards.push("");
|
|
455
485
|
let keyboard, subkeyboard;
|
|
456
486
|
let separators = ["+", "-"];
|
|
457
|
-
for (i in keyboards) {
|
|
487
|
+
for (let i in keyboards) {
|
|
458
488
|
keyboard = keyboards[i];
|
|
459
489
|
if (keyboard == "") {
|
|
460
490
|
subkeyboard = "default";
|
|
@@ -539,12 +569,13 @@
|
|
|
539
569
|
case "keyboard":
|
|
540
570
|
this.keys = keys({ app: this, keys: options.keys });
|
|
541
571
|
break;
|
|
572
|
+
case "root":
|
|
573
|
+
// backwards compatibility
|
|
574
|
+
case "baseURL":
|
|
575
|
+
this.baseURL = options[key];
|
|
576
|
+
break;
|
|
542
577
|
case "routes":
|
|
543
578
|
this.routes = routes({ app: this, routes: options.routes });
|
|
544
|
-
this.routes.handleEvents();
|
|
545
|
-
globalThis.setTimeout(() => {
|
|
546
|
-
this.routes.match(globalThis.location?.pathname + globalThis.location?.hash);
|
|
547
|
-
});
|
|
548
579
|
break;
|
|
549
580
|
case "actions":
|
|
550
581
|
this.actions = actions({ app: this, actions: options.actions });
|
|
@@ -558,7 +589,30 @@
|
|
|
558
589
|
case "view":
|
|
559
590
|
this.view = view({ app: this, view: options.view });
|
|
560
591
|
break;
|
|
592
|
+
case "hooks":
|
|
593
|
+
const moduleHandler = {
|
|
594
|
+
get: (target, property) => {
|
|
595
|
+
if (!target[property]) {
|
|
596
|
+
return void 0;
|
|
597
|
+
}
|
|
598
|
+
if (typeof target[property] == "function") {
|
|
599
|
+
return new Proxy(target[property], functionHandler);
|
|
600
|
+
} else if (target[property] && typeof target[property] == "object") {
|
|
601
|
+
return new Proxy(target[property], moduleHandler);
|
|
602
|
+
} else {
|
|
603
|
+
return target[property];
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
};
|
|
607
|
+
const functionHandler = {
|
|
608
|
+
apply: (target, thisArg, argumentsList) => {
|
|
609
|
+
return target.apply(this, argumentsList);
|
|
610
|
+
}
|
|
611
|
+
};
|
|
612
|
+
this[key] = new Proxy(options[key], moduleHandler);
|
|
613
|
+
break;
|
|
561
614
|
default:
|
|
615
|
+
console.log('simply.app: unknown initialization option "' + key + '", added as-is');
|
|
562
616
|
this[key] = options[key];
|
|
563
617
|
break;
|
|
564
618
|
}
|
|
@@ -567,6 +621,24 @@
|
|
|
567
621
|
get app() {
|
|
568
622
|
return this;
|
|
569
623
|
}
|
|
624
|
+
async start() {
|
|
625
|
+
if (this.hooks?.start) {
|
|
626
|
+
await this.hooks.start();
|
|
627
|
+
}
|
|
628
|
+
if (this.routes) {
|
|
629
|
+
if (this.baseURL) {
|
|
630
|
+
this.routes.init({ baseURL: this.baseURL });
|
|
631
|
+
}
|
|
632
|
+
this.routes.handleEvents();
|
|
633
|
+
globalThis.setTimeout(() => {
|
|
634
|
+
if (this.routes.has(globalThis.location?.hash)) {
|
|
635
|
+
this.routes.match(globalThis.location.hash);
|
|
636
|
+
} else {
|
|
637
|
+
this.routes.match(globalThis.location?.pathname + globalThis.location?.hash);
|
|
638
|
+
}
|
|
639
|
+
});
|
|
640
|
+
}
|
|
641
|
+
}
|
|
570
642
|
};
|
|
571
643
|
function app(options = {}) {
|
|
572
644
|
return new SimplyApp(options);
|
package/dist/simply.app.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(()=>{function
|
|
1
|
+
(()=>{function g(t,e){if(e){let a=t;t=e,t.app=t}return new m(t)}var m=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){C(e,this.routeInfo,this.matchExact)}clear(){this.routeInfo=[],this.listeners={match:{},call:{},goto:{},finish:{}}}match(e,a){let r={path:e,options:a};r=this.runListeners("match",r),e=r.path?r.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({},"",b(e,this.baseURL)))),i&&i.length){let n={};s.params.forEach((l,h)=>{l=="*"&&(l="remainder"),n[l]=i[h+1]}),Object.assign(n,a),r.route=s,r.params=n,r=this.runListeners("call",r),n=r.params?r.params:n;let c=new URLSearchParams(document.location.search);return r.result=s.action.call(this.app,n,c),this.runListeners("finish",r),r.result}return!1}runListeners(e,a){if(!(!this.listeners[e]||!Object.keys(this.listeners[e])))return Object.keys(this.listeners[e]).forEach(r=>{var i=w(r);if(i.exec(a.path)){var s;for(let n of this.listeners[e][r])s=n.call(this.app,a),s&&(a=s)}}),a}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 a=e.target;a&&a.tagName!="A";)a=a.parentElement;if(a&&a.pathname&&a.hostname==globalThis.location.hostname&&!a.link&&!a.dataset.simplyCommand){let r=[a.hash,a.pathname+a.hash,a.pathname],i;do i=f(r.shift(),this.baseURL);while(r.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({},"",b(e,this.baseURL)),this.match(e)}has(e){e=f(e,this.baseURL);for(let r of this.routeInfo){var a=r.match.exec(e);if(a&&a.length)return!0}return!1}addListener(e,a,r){if(["goto","match","call","finish"].indexOf(e)==-1)throw new Error("Unknown action "+e);this.listeners[e][a]||(this.listeners[e][a]=[]),this.listeners[e][a].push(r)}removeListener(e,a,r){if(["match","call","finish"].indexOf(e)==-1)throw new Error("Unknown action "+e);this.listeners[e][a]&&(this.listeners[e][a]=this.listeners[e][a].filter(i=>i!=r))}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 b(t,e){return t=f(t,e),e[e.length-1]==="/"&&t[0]==="/"&&(t=t.substring(1)),t[0]=="#"?t:e+t}function w(t,e=!1){return e?new RegExp("^"+t.replace(/:\w+/g,"([^/]+)").replace(/:\*/,"(.*)")+"(\\?|$)"):new RegExp("^"+t.replace(/:\w+/g,"([^/]+)").replace(/:\*/,"(.*)"))}function C(t,e,a=!1){let r=Object.keys(t),i=/:(\w+|\*)/g;for(let s of r){let n=[],c=[];do n=i.exec(s),n&&c.push(n[1]);while(n);e.push({match:w(s,a),params:c,action:t[s]})}return e}var p=class{constructor(e={}){e.app||(e.app={}),e.app.container||(e.app.container=document.body),this.app=e.app,this.$handlers=e.handlers||j,e.commands&&Object.assign(this,e.commands);let a=r=>{let i=U(r,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 r.preventDefault(),r.stopPropagation(),!1};e.app.container.addEventListener("click",a),e.app.container.addEventListener("submit",a),e.app.container.addEventListener("change",a),e.app.container.addEventListener("input",a)}call(e,a,r){if(!this[e]){console.error("simply.command: undefined command "+e);return}return this[e].call(this.app,a,r)}action(e){console.warn("deprecated call to `this.commands.action`");let a=Array.from(arguments).slice();return a.shift(),this.app.actions[e](...a)}appendHandler(e){this.$handlers.push(e)}prependHandler(e){this.$handlers.unshift(e)}};function v(t={},e){if(e){let a=t;t=e,t.app=t}return new p(t)}function U(t,e){var a=t.target.closest("[data-simply-command]");if(a){for(let r of e)if(a.matches(r.match))return r.check(a,t)?{name:a.dataset.simplyCommand,source:a,value:r.get(a)}:null}return null}var j=[{match:"input,select,textarea",get:function(t){if(t.tagName==="SELECT"&&t.multiple){let e=[];for(let a of t.options)a.selected&&e.push(a.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 a of Array.from(t.elements)){if(a.tagName=="INPUT"&&(a.type=="checkbox"||a.type=="radio")&&!a.checked)return;e[a.name]&&!Array.isArray(e[a.name])&&(e[a.name]=[e[a.name]]),Array.isArray(e[a.name])?e[a.name].push(a.value):e[a.name]=a.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}}];function x(t,e){if(e){let a=t;t=e,t.app=a}if(t.app){let a={apply(s,n,c){try{let l=s(...c);return l instanceof Promise?(t.app.hooks.wait(!0),l.finally(()=>{t.app.hooks.wait(!1,s)})):l}catch{}}},r={apply(s,n,c){try{let l=s(...c);return l instanceof Promise?t.app.hooks.wait?(t.app.hooks.wait(!0,s),l.catch(h=>t.app.hooks.error(h,s)).finally(()=>{t.app.hooks.wait(!1,s)})):l.catch(h=>t.app.hooks.error(h,s)):l}catch(l){return t.app.hooks.error(l,s)}}},i={get(s,n){if(s[n])return t.app.hooks?.error?new Proxy(s[n].bind(t.app),r):t.app.hooks?.wait?new Proxy(s[n].bind(t.app),a):s[n].bind(t.app)}};return new Proxy(t.actions,i)}else return t}var o=Object.freeze({Compose:229,Control:17,Meta:224,Alt:18,Shift:16}),y=class{constructor(e={}){e.app||(e.app={}),e.app.container||(e.app.container=document.body),Object.assign(this,e.keys);let a=r=>{if(r.isComposing||r.keyCode===o.Compose||r.defaultPrevented||!r.target)return;let i="default";r.target.closest("[data-simply-keyboard]")&&(i=r.target.closest("[data-simply-keyboard]").dataset.simplyKeyboard);let s=[];r.ctrlKey&&r.keyCode!=o.Control&&s.push("Control"),r.metaKey&&r.keyCode!=o.Meta&&s.push("Meta"),r.altKey&&r.keyCode!=o.Alt&&s.push("Alt"),r.shiftKey&&r.keyCode!=o.Shift&&s.push("Shift"),s.push(r.key.toLowerCase());let n=[],c=event.target.closest("[data-simply-keyboard]");for(;c;)n.push(c.dataset.simplyKeyboard),c=c.parentNode.closest("[data-simply-keyboard]");n.push("");let l,h,P=["+","-"];for(let A in n){l=n[A],l==""?h="default":(h=l,l+=".");for(let R of P){let u=s.join(R);if(this[h]&&typeof this[h][u]=="function"&&!this[h][u].call(e.app,r)){r.preventDefault();return}if(typeof this[h+u]=="function"&&!this[h+u].call(e.app,r)){r.preventDefault();return}if(this[i]&&this[i][u]){let d=e.app.container.querySelectorAll('[data-simply-accesskey="'+l+u+'"]');d.length&&(d.forEach(T=>T.click()),r.preventDefault())}}}};e.app.container.addEventListener("keydown",a)}};function L(t={},e){if(e){let a=t;t=e,t.app=t}return new y(t)}function E(t,e){if(e){let a=t;t=e,t.app=t}if(t.app){t.app.view=t.view||{};let a=()=>{let r=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,r)};return globalThis.editor&&globalThis.editor.currentData?a():document.addEventListener("simply-content-loaded",a),t.app.view}else return t.view}var k=class{constructor(e={}){this.container=e.container||document.body;for(let a in e)switch(a){case"commands":this.commands=v({app:this,container:this.container,commands:e.commands});break;case"keys":case"keyboard":this.keys=L({app:this,keys:e.keys});break;case"root":case"baseURL":this.baseURL=e[a];break;case"routes":this.routes=g({app:this,routes:e.routes});break;case"actions":this.actions=x({app:this,actions:e.actions}),this.action=function(s){console.warn("deprecated call to `this.action`");let n=Array.from(arguments).slice();return n.shift(),this.actions[s](...n)};break;case"view":this.view=E({app:this,view:e.view});break;case"hooks":let r={get:(s,n)=>{if(s[n])return typeof s[n]=="function"?new Proxy(s[n],i):s[n]&&typeof s[n]=="object"?new Proxy(s[n],r):s[n]}},i={apply:(s,n,c)=>s.apply(this,c)};this[a]=new Proxy(e[a],r);break;default:console.log('simply.app: unknown initialization option "'+a+'", added as-is'),this[a]=e[a];break}}get app(){return this}async start(){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 V(t={}){return new k(t)}})();
|
|
2
2
|
//# sourceMappingURL=simply.app.min.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/route.mjs", "../src/command.mjs", "../src/action.mjs", "../src/key.mjs", "../src/view.mjs", "../src/app.mjs"],
|
|
4
|
-
"sourcesContent": ["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.root = options.root || '/'\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.root))\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 (!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.root)) === false) {\n this.match(getPath(document.location.pathname, this.root))\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 path = getPath(link.pathname+link.hash, this.root);\n if ( !this.has(path) ) {\n path = getPath(link.pathname, this.root);\n }\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.root))\n return this.match(path)\n }\n\n has(path)\n {\n path = getPath(path, this.root)\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.root) {\n this.root = options.root\n }\n }\n}\n\nfunction getPath(path, root='/')\n{\n if (path.substring(0,root.length)==root\n ||\n ( root[root.length-1]=='/' \n && path.length==(root.length-1)\n && path == root.substring(0,path.length)\n )\n ) {\n path = path.substring(root.length)\n }\n if (path[0]!='/' && path[0]!='#') {\n path = '/'+path\n }\n return path\n}\n\nfunction getURL(path, root)\n{\n path = getPath(path, root)\n if (root[root.length-1]==='/' && path[0]==='/') {\n path = path.substring(1)\n }\n return root + 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]", "export function actions(options, optionsCompat) {\n\tif (optionsCompat) {\n\t\tlet app = options\n\t\toptions = optionsCompat\n\t\toptions.app = app\n\t}\n\tif (options.app) {\n\t\tconst actionHandler = {\n\t\t\tget(target, property) {\n\t\t\t\tif (!target[property]) {\n\t\t\t\t\treturn undefined\n\t\t\t\t}\n\t\t\t\tif (target.catch) {\n\t\t\t\t\treturn new Proxy(target[property].bind(options.app), functionHandler)\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}\n\nconst functionHandler = {\n\tapply(target, thisArg, argumentsList) {\n\t\ttry {\n\t\t\tconst result = target(...argumentsList)\n\t\t\tif (result instanceof Promise) {\n\t\t\t\treturn result.catch(err => {\n\t\t\t\t\treturn thisArg.catch(err)\n\t\t\t\t})\n\t\t\t}\n\t\t\treturn result\n\t\t} catch(err) {\n\t\t\treturn thisArg.catch(err)\n\t\t}\n\t}\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 (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}", "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'\n\nclass SimplyApp {\n\tconstructor(options={}) {\n\t\tthis.container = options.container || document.body\n\t\tfor (let key in options) {\n\t\t\tswitch(key) {\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 'routes':\n\t\t\t\t\tthis.routes = routes({ app: this, routes: options.routes})\n\t\t\t\t\tthis.routes.handleEvents();\n\t\t\t\t\tglobalThis.setTimeout(() => {\n\t\t\t\t\t\tthis.routes.match(globalThis.location?.pathname+globalThis.location?.hash);\n\t\t\t\t\t});\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\tdefault:\n\t\t\t\t\tthis[key] = options[key] // allows easy additions\n\t\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\tget app() {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AS,EAAE,MAAM,EACnC,OAAAA,EAAO,MAAM,EACN,KAAK,QAAQD,CAAI,EAAE,GAAGC,CAAM,CACvC,EACH,MACD,IAAK,OACJ,KAAK,KAAOC,EAAK,CAAC,IAAK,KAAM,KAAMR,EAAQ,IAAI,CAAC,EAChD,MACD,QACC,KAAKC,CAAG,EAAID,EAAQC,CAAG,EACvB,KACF,CAEF,CACA,IAAI,KAAM,CACT,OAAO,IACR,CACD,EAEO,SAASQ,EAAIT,EAAQ,CAAC,EAAG,CAC/B,OAAO,IAAID,EAAUC,CAAO,CAC7B",
|
|
6
|
-
"names": ["routes", "options", "optionsCompat", "app", "SimplyRoute", "parseRoutes", "path", "args", "matches", "getPath", "route", "getURL", "params", "key", "i", "searchParams", "action", "routeRe", "getRegexpFromRoute", "result", "callback", "evt", "link", "listener", "
|
|
4
|
+
"sourcesContent": ["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]", "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}", "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}", "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'\n\nclass SimplyApp {\n\tconstructor(options={}) {\n\t\tthis.container = options.container || document.body\n\t\tfor (let key in options) {\n\t\t\tswitch(key) {\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\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\tget app() {\n\t\treturn this\n\t}\n\tasync start() {\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\nexport function app(options={}) {\n\treturn new SimplyApp(options)\n}"],
|
|
5
|
+
"mappings": "MAAO,SAASA,EAAOC,EAASC,EAChC,CACI,GAAIA,EAAe,CACf,IAAIC,EAAMF,EACVA,EAAUC,EACVD,EAAQ,IAAMA,CAClB,CACA,OAAO,IAAIG,EAAYH,CAAO,CAClC,CAEA,IAAMG,EAAN,KACA,CACI,YAAYH,EAAQ,CAAC,EACrB,CACI,KAAK,QAAUA,EAAQ,SAAW,IAClC,KAAK,IAAMA,EAAQ,KAAO,CAAC,EAC3B,KAAK,gBAAkB,CAAC,CAACA,EAAQ,gBACjC,KAAK,WAAa,CAAC,CAACA,EAAQ,WAC5B,KAAK,MAAM,EACPA,EAAQ,QACR,KAAK,KAAKA,EAAQ,MAAM,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WAAW,UAAU,IAAI,EAC5C,KAAK,OAAO,MAAM,WAAW,SAAS,IAAI,EAE1C,KAAK,OAAO,MAAM,WAAW,UAAU,SAAS,WAAW,UAAU,IAAI,CAE3E,CAAC,EAEH,CACD,EAEO,SAASc,EAAIf,EAAQ,CAAC,EAAG,CAC/B,OAAO,IAAID,EAAUC,CAAO,CAC7B",
|
|
6
|
+
"names": ["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", "actions", "options", "optionsCompat", "app", "waitHandler", "target", "thisArg", "argumentsList", "result", "functionHandler", "err", "actionHandler", "property", "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", "SimplyApp", "options", "key", "commands", "keys", "routes", "actions", "name", "params", "view", "moduleHandler", "target", "property", "functionHandler", "thisArg", "argumentsList", "app"]
|
|
7
7
|
}
|