sigpro 1.1.20 → 1.2.39

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.
@@ -1,437 +0,0 @@
1
- // sigpro/index.js
2
- var activeEffect = null;
3
- var currentOwner = null;
4
- var effectQueue = new Set;
5
- var isFlushing = false;
6
- var MOUNTED_NODES = new WeakMap;
7
- var flush = () => {
8
- if (isFlushing)
9
- return;
10
- isFlushing = true;
11
- while (effectQueue.size > 0) {
12
- const sorted = Array.from(effectQueue).sort((a, b) => (a.depth || 0) - (b.depth || 0));
13
- effectQueue.clear();
14
- for (const eff of sorted)
15
- if (!eff._deleted)
16
- eff();
17
- }
18
- isFlushing = false;
19
- };
20
- var track = (subs) => {
21
- if (activeEffect && !activeEffect._deleted) {
22
- subs.add(activeEffect);
23
- activeEffect._deps.add(subs);
24
- }
25
- };
26
- var trigger = (subs) => {
27
- for (const eff of subs) {
28
- if (eff === activeEffect || eff._deleted)
29
- continue;
30
- if (eff._isComputed) {
31
- eff.markDirty();
32
- if (eff._subs)
33
- trigger(eff._subs);
34
- } else {
35
- effectQueue.add(eff);
36
- }
37
- }
38
- if (!isFlushing)
39
- queueMicrotask(flush);
40
- };
41
- var sweep = (node) => {
42
- if (node._cleanups) {
43
- node._cleanups.forEach((f) => f());
44
- node._cleanups.clear();
45
- }
46
- node.childNodes?.forEach(sweep);
47
- };
48
- var _view = (fn) => {
49
- const cleanups = new Set;
50
- const prev = currentOwner;
51
- const container = document.createElement("div");
52
- container.style.display = "contents";
53
- currentOwner = { cleanups };
54
- try {
55
- const res = fn({ onCleanup: (f) => cleanups.add(f) });
56
- const process = (n) => {
57
- if (!n)
58
- return;
59
- if (n._isRuntime) {
60
- cleanups.add(n.destroy);
61
- container.appendChild(n.container);
62
- } else if (Array.isArray(n))
63
- n.forEach(process);
64
- else
65
- container.appendChild(n instanceof Node ? n : document.createTextNode(String(n)));
66
- };
67
- process(res);
68
- } finally {
69
- currentOwner = prev;
70
- }
71
- return {
72
- _isRuntime: true,
73
- container,
74
- destroy: () => {
75
- cleanups.forEach((f) => f());
76
- sweep(container);
77
- container.remove();
78
- }
79
- };
80
- };
81
- var $ = (initial, key = null) => {
82
- if (typeof initial === "function") {
83
- const subs2 = new Set;
84
- let cached, dirty = true;
85
- const effect = () => {
86
- if (effect._deleted)
87
- return;
88
- effect._deps.forEach((s) => s.delete(effect));
89
- effect._deps.clear();
90
- const prev = activeEffect;
91
- activeEffect = effect;
92
- try {
93
- const val = initial();
94
- if (!Object.is(cached, val) || dirty) {
95
- cached = val;
96
- dirty = false;
97
- trigger(subs2);
98
- }
99
- } finally {
100
- activeEffect = prev;
101
- }
102
- };
103
- effect._deps = new Set;
104
- effect._isComputed = true;
105
- effect._subs = subs2;
106
- effect._deleted = false;
107
- effect.markDirty = () => dirty = true;
108
- effect.stop = () => {
109
- effect._deleted = true;
110
- effect._deps.forEach((s) => s.delete(effect));
111
- subs2.clear();
112
- };
113
- if (currentOwner)
114
- currentOwner.cleanups.add(effect.stop);
115
- return () => {
116
- if (dirty)
117
- effect();
118
- track(subs2);
119
- return cached;
120
- };
121
- }
122
- let value = initial;
123
- if (key) {
124
- try {
125
- const saved = localStorage.getItem(key);
126
- if (saved !== null)
127
- value = JSON.parse(saved);
128
- } catch (e) {
129
- console.warn("SigPro: LocalStorage locked", e);
130
- }
131
- }
132
- const subs = new Set;
133
- return (...args) => {
134
- if (args.length) {
135
- const next = typeof args[0] === "function" ? args[0](value) : args[0];
136
- if (!Object.is(value, next)) {
137
- value = next;
138
- if (key)
139
- localStorage.setItem(key, JSON.stringify(value));
140
- trigger(subs);
141
- }
142
- }
143
- track(subs);
144
- return value;
145
- };
146
- };
147
- var $watch = (target, fn) => {
148
- const isExplicit = Array.isArray(target);
149
- const callback = isExplicit ? fn : target;
150
- const depsInput = isExplicit ? target : null;
151
- if (typeof callback !== "function")
152
- return () => {};
153
- const owner = currentOwner;
154
- const runner = () => {
155
- if (runner._deleted)
156
- return;
157
- runner._deps.forEach((s) => s.delete(runner));
158
- runner._deps.clear();
159
- runner._cleanups.forEach((c) => c());
160
- runner._cleanups.clear();
161
- const prevEffect = activeEffect;
162
- const prevOwner = currentOwner;
163
- activeEffect = runner;
164
- currentOwner = { cleanups: runner._cleanups };
165
- runner.depth = prevEffect ? prevEffect.depth + 1 : 0;
166
- try {
167
- if (isExplicit) {
168
- activeEffect = null;
169
- callback();
170
- activeEffect = runner;
171
- depsInput.forEach((d) => typeof d === "function" && d());
172
- } else {
173
- callback();
174
- }
175
- } finally {
176
- activeEffect = prevEffect;
177
- currentOwner = prevOwner;
178
- }
179
- };
180
- runner._deps = new Set;
181
- runner._cleanups = new Set;
182
- runner._deleted = false;
183
- runner.stop = () => {
184
- if (runner._deleted)
185
- return;
186
- runner._deleted = true;
187
- effectQueue.delete(runner);
188
- runner._deps.forEach((s) => s.delete(runner));
189
- runner._cleanups.forEach((c) => c());
190
- if (owner)
191
- owner.cleanups.delete(runner.stop);
192
- };
193
- if (owner)
194
- owner.cleanups.add(runner.stop);
195
- runner();
196
- return runner.stop;
197
- };
198
- var $html = (tag, props = {}, content = []) => {
199
- if (props instanceof Node || Array.isArray(props) || typeof props !== "object") {
200
- content = props;
201
- props = {};
202
- }
203
- const svgTags = ["svg", "path", "circle", "rect", "line", "polyline", "polygon", "g", "defs", "text", "tspan", "use"];
204
- const isSVG = svgTags.includes(tag);
205
- const el = isSVG ? document.createElementNS("http://www.w3.org/2000/svg", tag) : document.createElement(tag);
206
- const _sanitize = (key, val) => (key === "src" || key === "href") && String(val).toLowerCase().includes("javascript:") ? "#" : val;
207
- el._cleanups = new Set;
208
- const boolAttrs = ["disabled", "checked", "required", "readonly", "selected", "multiple", "autofocus"];
209
- for (let [key, val] of Object.entries(props)) {
210
- if (key === "ref") {
211
- typeof val === "function" ? val(el) : val.current = el;
212
- continue;
213
- }
214
- const isSignal = typeof val === "function", isInput = ["INPUT", "TEXTAREA", "SELECT"].includes(el.tagName), isBindAttr = key === "value" || key === "checked";
215
- if (isInput && isBindAttr && isSignal) {
216
- el._cleanups.add($watch(() => {
217
- const currentVal = val();
218
- if (el[key] !== currentVal)
219
- el[key] = currentVal;
220
- }));
221
- const eventName = key === "checked" ? "change" : "input", handler = (event) => val(event.target[key]);
222
- el.addEventListener(eventName, handler);
223
- el._cleanups.add(() => el.removeEventListener(eventName, handler));
224
- } else if (key.startsWith("on")) {
225
- const eventName = key.slice(2).toLowerCase().split(".")[0], handler = (event) => val(event);
226
- el.addEventListener(eventName, handler);
227
- el._cleanups.add(() => el.removeEventListener(eventName, handler));
228
- } else if (isSignal) {
229
- el._cleanups.add($watch(() => {
230
- const currentVal = _sanitize(key, val());
231
- if (key === "class") {
232
- el.className = currentVal || "";
233
- } else if (boolAttrs.includes(key)) {
234
- if (currentVal) {
235
- el.setAttribute(key, "");
236
- el[key] = true;
237
- } else {
238
- el.removeAttribute(key);
239
- el[key] = false;
240
- }
241
- } else {
242
- if (currentVal == null) {
243
- el.removeAttribute(key);
244
- } else if (isSVG && typeof currentVal === "number") {
245
- el.setAttribute(key, currentVal);
246
- } else {
247
- el.setAttribute(key, currentVal);
248
- }
249
- }
250
- }));
251
- } else {
252
- if (boolAttrs.includes(key)) {
253
- if (val) {
254
- el.setAttribute(key, "");
255
- el[key] = true;
256
- } else {
257
- el.removeAttribute(key);
258
- el[key] = false;
259
- }
260
- } else {
261
- el.setAttribute(key, _sanitize(key, val));
262
- }
263
- }
264
- }
265
- const append = (child) => {
266
- if (Array.isArray(child))
267
- return child.forEach(append);
268
- if (child instanceof Node) {
269
- el.appendChild(child);
270
- } else if (typeof child === "function") {
271
- const marker = document.createTextNode("");
272
- el.appendChild(marker);
273
- let nodes = [];
274
- el._cleanups.add($watch(() => {
275
- const res = child(), next = (Array.isArray(res) ? res : [res]).map((i) => i?._isRuntime ? i.container : i instanceof Node ? i : document.createTextNode(i ?? ""));
276
- nodes.forEach((n) => {
277
- sweep?.(n);
278
- n.remove();
279
- });
280
- next.forEach((n) => marker.parentNode?.insertBefore(n, marker));
281
- nodes = next;
282
- }));
283
- } else
284
- el.appendChild(document.createTextNode(child ?? ""));
285
- };
286
- append(content);
287
- return el;
288
- };
289
- var $if = (condition, thenVal, otherwiseVal = null, transition = null) => {
290
- const marker = document.createTextNode("");
291
- const container = $html("div", { style: "display:contents" }, [marker]);
292
- let current = null, last = null;
293
- $watch(() => {
294
- const state = !!(typeof condition === "function" ? condition() : condition);
295
- if (state === last)
296
- return;
297
- last = state;
298
- if (current && !state && transition?.out) {
299
- transition.out(current.container, () => {
300
- current.destroy();
301
- current = null;
302
- });
303
- } else {
304
- if (current)
305
- current.destroy();
306
- current = null;
307
- }
308
- if (state || !state && otherwiseVal) {
309
- const branch = state ? thenVal : otherwiseVal;
310
- if (branch) {
311
- current = _view(() => typeof branch === "function" ? branch() : branch);
312
- container.insertBefore(current.container, marker);
313
- if (state && transition?.in)
314
- transition.in(current.container);
315
- }
316
- }
317
- });
318
- return container;
319
- };
320
- $if.not = (condition, thenVal, otherwiseVal) => $if(() => !(typeof condition === "function" ? condition() : condition), thenVal, otherwiseVal);
321
- var $for = (source, render, keyFn, tag = "div", props = { style: "display:contents" }) => {
322
- const marker = document.createTextNode("");
323
- const container = $html(tag, props, [marker]);
324
- let cache = new Map;
325
- $watch(() => {
326
- const items = (typeof source === "function" ? source() : source) || [];
327
- const newCache = new Map;
328
- const newOrder = [];
329
- for (let i = 0;i < items.length; i++) {
330
- const item = items[i];
331
- const key = keyFn ? keyFn(item, i) : i;
332
- let run = cache.get(key);
333
- if (!run) {
334
- run = _view(() => render(item, i));
335
- } else {
336
- cache.delete(key);
337
- }
338
- newCache.set(key, run);
339
- newOrder.push(key);
340
- }
341
- cache.forEach((run) => {
342
- run.destroy();
343
- run.container.remove();
344
- });
345
- let anchor = marker;
346
- for (let i = newOrder.length - 1;i >= 0; i--) {
347
- const run = newCache.get(newOrder[i]);
348
- if (run.container.nextSibling !== anchor) {
349
- container.insertBefore(run.container, anchor);
350
- }
351
- anchor = run.container;
352
- }
353
- cache = newCache;
354
- });
355
- return container;
356
- };
357
- var $router = (routes) => {
358
- const sPath = $(window.location.hash.replace(/^#/, "") || "/");
359
- window.addEventListener("hashchange", () => sPath(window.location.hash.replace(/^#/, "") || "/"));
360
- const outlet = $html("div", { class: "router-outlet" });
361
- let current = null;
362
- $watch([sPath], async () => {
363
- const path = sPath();
364
- const route = routes.find((r) => {
365
- const rp = r.path.split("/").filter(Boolean), pp = path.split("/").filter(Boolean);
366
- return rp.length === pp.length && rp.every((p, i) => p.startsWith(":") || p === pp[i]);
367
- }) || routes.find((r) => r.path === "*");
368
- if (route) {
369
- let comp = route.component;
370
- if (typeof comp === "function" && comp.toString().includes("import")) {
371
- comp = (await comp()).default || await comp();
372
- }
373
- const params = {};
374
- route.path.split("/").filter(Boolean).forEach((p, i) => {
375
- if (p.startsWith(":"))
376
- params[p.slice(1)] = path.split("/").filter(Boolean)[i];
377
- });
378
- if (current)
379
- current.destroy();
380
- if ($router.params)
381
- $router.params(params);
382
- current = _view(() => {
383
- try {
384
- return typeof comp === "function" ? comp(params) : comp;
385
- } catch (e) {
386
- return $html("div", { class: "p-4 text-error" }, "Error loading view");
387
- }
388
- });
389
- outlet.appendChild(current.container);
390
- }
391
- });
392
- return outlet;
393
- };
394
- $router.params = $({});
395
- $router.to = (path) => window.location.hash = path.replace(/^#?\/?/, "#/");
396
- $router.back = () => window.history.back();
397
- $router.path = () => window.location.hash.replace(/^#/, "") || "/";
398
- var $mount = (component, target) => {
399
- const el = typeof target === "string" ? document.querySelector(target) : target;
400
- if (!el)
401
- return;
402
- if (MOUNTED_NODES.has(el))
403
- MOUNTED_NODES.get(el).destroy();
404
- const instance = _view(typeof component === "function" ? component : () => component);
405
- el.replaceChildren(instance.container);
406
- MOUNTED_NODES.set(el, instance);
407
- return instance;
408
- };
409
- var Fragment = ({ children }) => children;
410
- var SigProCore = { $, $watch, $html, $if, $for, $router, $mount, Fragment };
411
- if (typeof window !== "undefined") {
412
- const install = (registry) => {
413
- Object.keys(registry).forEach((key) => {
414
- window[key] = registry[key];
415
- });
416
- const tags = `div span p h1 h2 h3 h4 h5 h6 br hr section article aside nav main header footer address ul ol li dl dt dd a em strong small i b u mark time sub sup pre code blockquote details summary dialog form label input textarea select button option fieldset legend table thead tbody tfoot tr th td caption img video audio canvas svg iframe picture source progress meter`.split(/\s+/);
417
- tags.forEach((tagName) => {
418
- const helperName = tagName.charAt(0).toUpperCase() + tagName.slice(1);
419
- if (!(helperName in window)) {
420
- window[helperName] = (props, content) => $html(tagName, props, content);
421
- }
422
- });
423
- window.Fragment = Fragment;
424
- window.SigPro = Object.freeze(registry);
425
- };
426
- install(SigProCore);
427
- }
428
- export {
429
- Fragment,
430
- $watch,
431
- $router,
432
- $mount,
433
- $if,
434
- $html,
435
- $for,
436
- $
437
- };
@@ -1 +0,0 @@
1
- var p=null,w=null,b=new Set,S=!1,N=new WeakMap,L=()=>{if(S)return;S=!0;while(b.size>0){let s=Array.from(b).sort((r,a)=>(r.depth||0)-(a.depth||0));b.clear();for(let r of s)if(!r._deleted)r()}S=!1},k=(s)=>{if(p&&!p._deleted)s.add(p),p._deps.add(s)},x=(s)=>{for(let r of s){if(r===p||r._deleted)continue;if(r._isComputed){if(r.markDirty(),r._subs)x(r._subs)}else b.add(r)}if(!S)queueMicrotask(L)},O=(s)=>{if(s._cleanups)s._cleanups.forEach((r)=>r()),s._cleanups.clear();s.childNodes?.forEach(O)},A=(s)=>{let r=new Set,a=w,c=document.createElement("div");c.style.display="contents",w={cleanups:r};try{let i=s({onCleanup:(e)=>r.add(e)}),n=(e)=>{if(!e)return;if(e._isRuntime)r.add(e.destroy),c.appendChild(e.container);else if(Array.isArray(e))e.forEach(n);else c.appendChild(e instanceof Node?e:document.createTextNode(String(e)))};n(i)}finally{w=a}return{_isRuntime:!0,container:c,destroy:()=>{r.forEach((i)=>i()),O(c),c.remove()}}},T=(s,r=null)=>{if(typeof s==="function"){let i=new Set,n,e=!0,o=()=>{if(o._deleted)return;o._deps.forEach((t)=>t.delete(o)),o._deps.clear();let f=p;p=o;try{let t=s();if(!Object.is(n,t)||e)n=t,e=!1,x(i)}finally{p=f}};if(o._deps=new Set,o._isComputed=!0,o._subs=i,o._deleted=!1,o.markDirty=()=>e=!0,o.stop=()=>{o._deleted=!0,o._deps.forEach((f)=>f.delete(o)),i.clear()},w)w.cleanups.add(o.stop);return()=>{if(e)o();return k(i),n}}let a=s;if(r)try{let i=localStorage.getItem(r);if(i!==null)a=JSON.parse(i)}catch(i){console.warn("SigPro: LocalStorage locked",i)}let c=new Set;return(...i)=>{if(i.length){let n=typeof i[0]==="function"?i[0](a):i[0];if(!Object.is(a,n)){if(a=n,r)localStorage.setItem(r,JSON.stringify(a));x(c)}}return k(c),a}};var _=(s,r)=>{let a=Array.isArray(s),c=a?r:s,i=a?s:null;if(typeof c!=="function")return()=>{};let n=w,e=()=>{if(e._deleted)return;e._deps.forEach((t)=>t.delete(e)),e._deps.clear(),e._cleanups.forEach((t)=>t()),e._cleanups.clear();let o=p,f=w;p=e,w={cleanups:e._cleanups},e.depth=o?o.depth+1:0;try{if(a)p=null,c(),p=e,i.forEach((t)=>typeof t==="function"&&t());else c()}finally{p=o,w=f}};if(e._deps=new Set,e._cleanups=new Set,e._deleted=!1,e.stop=()=>{if(e._deleted)return;if(e._deleted=!0,b.delete(e),e._deps.forEach((o)=>o.delete(e)),e._cleanups.forEach((o)=>o()),n)n.cleanups.delete(e.stop)},n)n.cleanups.add(e.stop);return e(),e.stop},E=(s,r={},a=[])=>{if(r instanceof Node||Array.isArray(r)||typeof r!=="object")a=r,r={};let i=["svg","path","circle","rect","line","polyline","polygon","g","defs","text","tspan","use"].includes(s),n=i?document.createElementNS("http://www.w3.org/2000/svg",s):document.createElement(s),e=(t,d)=>(t==="src"||t==="href")&&String(d).toLowerCase().includes("javascript:")?"#":d;n._cleanups=new Set;let o=["disabled","checked","required","readonly","selected","multiple","autofocus"];for(let[t,d]of Object.entries(r)){if(t==="ref"){typeof d==="function"?d(n):d.current=n;continue}let m=typeof d==="function";if(["INPUT","TEXTAREA","SELECT"].includes(n.tagName)&&(t==="value"||t==="checked")&&m){n._cleanups.add(_(()=>{let g=d();if(n[t]!==g)n[t]=g}));let l=t==="checked"?"change":"input",y=(g)=>d(g.target[t]);n.addEventListener(l,y),n._cleanups.add(()=>n.removeEventListener(l,y))}else if(t.startsWith("on")){let l=t.slice(2).toLowerCase().split(".")[0],y=(g)=>d(g);n.addEventListener(l,y),n._cleanups.add(()=>n.removeEventListener(l,y))}else if(m)n._cleanups.add(_(()=>{let l=e(t,d());if(t==="class")n.className=l||"";else if(o.includes(t))if(l)n.setAttribute(t,""),n[t]=!0;else n.removeAttribute(t),n[t]=!1;else if(l==null)n.removeAttribute(t);else if(i&&typeof l==="number")n.setAttribute(t,l);else n.setAttribute(t,l)}));else if(o.includes(t))if(d)n.setAttribute(t,""),n[t]=!0;else n.removeAttribute(t),n[t]=!1;else n.setAttribute(t,e(t,d))}let f=(t)=>{if(Array.isArray(t))return t.forEach(f);if(t instanceof Node)n.appendChild(t);else if(typeof t==="function"){let d=document.createTextNode("");n.appendChild(d);let m=[];n._cleanups.add(_(()=>{let u=t(),h=(Array.isArray(u)?u:[u]).map((l)=>l?._isRuntime?l.container:l instanceof Node?l:document.createTextNode(l??""));m.forEach((l)=>{O?.(l),l.remove()}),h.forEach((l)=>d.parentNode?.insertBefore(l,d)),m=h}))}else n.appendChild(document.createTextNode(t??""))};return f(a),n},C=(s,r,a=null,c=null)=>{let i=document.createTextNode(""),n=E("div",{style:"display:contents"},[i]),e=null,o=null;return _(()=>{let f=!!(typeof s==="function"?s():s);if(f===o)return;if(o=f,e&&!f&&c?.out)c.out(e.container,()=>{e.destroy(),e=null});else{if(e)e.destroy();e=null}if(f||!f&&a){let t=f?r:a;if(t){if(e=A(()=>typeof t==="function"?t():t),n.insertBefore(e.container,i),f&&c?.in)c.in(e.container)}}}),n};C.not=(s,r,a)=>C(()=>!(typeof s==="function"?s():s),r,a);var $=(s,r,a,c="div",i={style:"display:contents"})=>{let n=document.createTextNode(""),e=E(c,i,[n]),o=new Map;return _(()=>{let f=(typeof s==="function"?s():s)||[],t=new Map,d=[];for(let u=0;u<f.length;u++){let h=f[u],l=a?a(h,u):u,y=o.get(l);if(!y)y=A(()=>r(h,u));else o.delete(l);t.set(l,y),d.push(l)}o.forEach((u)=>{u.destroy(),u.container.remove()});let m=n;for(let u=d.length-1;u>=0;u--){let h=t.get(d[u]);if(h.container.nextSibling!==m)e.insertBefore(h.container,m);m=h.container}o=t}),e},v=(s)=>{let r=T(window.location.hash.replace(/^#/,"")||"/");window.addEventListener("hashchange",()=>r(window.location.hash.replace(/^#/,"")||"/"));let a=E("div",{class:"router-outlet"}),c=null;return _([r],async()=>{let i=r(),n=s.find((e)=>{let o=e.path.split("/").filter(Boolean),f=i.split("/").filter(Boolean);return o.length===f.length&&o.every((t,d)=>t.startsWith(":")||t===f[d])})||s.find((e)=>e.path==="*");if(n){let e=n.component;if(typeof e==="function"&&e.toString().includes("import"))e=(await e()).default||await e();let o={};if(n.path.split("/").filter(Boolean).forEach((f,t)=>{if(f.startsWith(":"))o[f.slice(1)]=i.split("/").filter(Boolean)[t]}),c)c.destroy();if(v.params)v.params(o);c=A(()=>{try{return typeof e==="function"?e(o):e}catch(f){return E("div",{class:"p-4 text-error"},"Error loading view")}}),a.appendChild(c.container)}}),a};v.params=T({});v.to=(s)=>window.location.hash=s.replace(/^#?\/?/,"#/");v.back=()=>window.history.back();v.path=()=>window.location.hash.replace(/^#/,"")||"/";var P=(s,r)=>{let a=typeof r==="string"?document.querySelector(r):r;if(!a)return;if(N.has(a))N.get(a).destroy();let c=A(typeof s==="function"?s:()=>s);return a.replaceChildren(c.container),N.set(a,c),c},B=({children:s})=>s,I={$:T,$watch:_,$html:E,$if:C,$for:$,$router:v,$mount:P,Fragment:B};if(typeof window<"u")((r)=>{Object.keys(r).forEach((c)=>{window[c]=r[c]}),"div span p h1 h2 h3 h4 h5 h6 br hr section article aside nav main header footer address ul ol li dl dt dd a em strong small i b u mark time sub sup pre code blockquote details summary dialog form label input textarea select button option fieldset legend table thead tbody tfoot tr th td caption img video audio canvas svg iframe picture source progress meter".split(/\s+/).forEach((c)=>{let i=c.charAt(0).toUpperCase()+c.slice(1);if(!(i in window))window[i]=(n,e)=>E(c,n,e)}),window.Fragment=B,window.SigPro=Object.freeze(r)})(I);export{B as Fragment,_ as $watch,v as $router,P as $mount,C as $if,E as $html,$ as $for,T as $};
@@ -1 +0,0 @@
1
- (()=>{var{defineProperty:C,getOwnPropertyNames:M,getOwnPropertyDescriptor:R}=Object,j=Object.prototype.hasOwnProperty;function W(t){return this[t]}var q=(t)=>{var n=(L??=new WeakMap).get(t),o;if(n)return n;if(n=C({},"__esModule",{value:!0}),t&&typeof t==="object"||typeof t==="function"){for(var c of M(t))if(!j.call(n,c))C(n,c,{get:W.bind(t,c),enumerable:!(o=R(t,c))||o.enumerable})}return L.set(t,n),n},L;var D=(t)=>t;function z(t,n){this[t]=D.bind(null,n)}var U=(t,n)=>{for(var o in n)C(t,o,{get:n[o],enumerable:!0,configurable:!0,set:z.bind(n,o)})};var V={};U(V,{Fragment:()=>B,$watch:()=>_,$router:()=>v,$mount:()=>I,$if:()=>A,$html:()=>g,$for:()=>P,$:()=>x});var p=null,w=null,b=new Set,S=!1,O=new WeakMap,F=()=>{if(S)return;S=!0;while(b.size>0){let t=Array.from(b).sort((n,o)=>(n.depth||0)-(o.depth||0));b.clear();for(let n of t)if(!n._deleted)n()}S=!1},$=(t)=>{if(p&&!p._deleted)t.add(p),p._deps.add(t)},T=(t)=>{for(let n of t){if(n===p||n._deleted)continue;if(n._isComputed){if(n.markDirty(),n._subs)T(n._subs)}else b.add(n)}if(!S)queueMicrotask(F)},k=(t)=>{if(t._cleanups)t._cleanups.forEach((n)=>n()),t._cleanups.clear();t.childNodes?.forEach(k)},N=(t)=>{let n=new Set,o=w,c=document.createElement("div");c.style.display="contents",w={cleanups:n};try{let i=t({onCleanup:(e)=>n.add(e)}),s=(e)=>{if(!e)return;if(e._isRuntime)n.add(e.destroy),c.appendChild(e.container);else if(Array.isArray(e))e.forEach(s);else c.appendChild(e instanceof Node?e:document.createTextNode(String(e)))};s(i)}finally{w=o}return{_isRuntime:!0,container:c,destroy:()=>{n.forEach((i)=>i()),k(c),c.remove()}}},x=(t,n=null)=>{if(typeof t==="function"){let i=new Set,s,e=!0,a=()=>{if(a._deleted)return;a._deps.forEach((r)=>r.delete(a)),a._deps.clear();let f=p;p=a;try{let r=t();if(!Object.is(s,r)||e)s=r,e=!1,T(i)}finally{p=f}};if(a._deps=new Set,a._isComputed=!0,a._subs=i,a._deleted=!1,a.markDirty=()=>e=!0,a.stop=()=>{a._deleted=!0,a._deps.forEach((f)=>f.delete(a)),i.clear()},w)w.cleanups.add(a.stop);return()=>{if(e)a();return $(i),s}}let o=t;if(n)try{let i=localStorage.getItem(n);if(i!==null)o=JSON.parse(i)}catch(i){console.warn("SigPro: LocalStorage locked",i)}let c=new Set;return(...i)=>{if(i.length){let s=typeof i[0]==="function"?i[0](o):i[0];if(!Object.is(o,s)){if(o=s,n)localStorage.setItem(n,JSON.stringify(o));T(c)}}return $(c),o}};var _=(t,n)=>{let o=Array.isArray(t),c=o?n:t,i=o?t:null;if(typeof c!=="function")return()=>{};let s=w,e=()=>{if(e._deleted)return;e._deps.forEach((r)=>r.delete(e)),e._deps.clear(),e._cleanups.forEach((r)=>r()),e._cleanups.clear();let a=p,f=w;p=e,w={cleanups:e._cleanups},e.depth=a?a.depth+1:0;try{if(o)p=null,c(),p=e,i.forEach((r)=>typeof r==="function"&&r());else c()}finally{p=a,w=f}};if(e._deps=new Set,e._cleanups=new Set,e._deleted=!1,e.stop=()=>{if(e._deleted)return;if(e._deleted=!0,b.delete(e),e._deps.forEach((a)=>a.delete(e)),e._cleanups.forEach((a)=>a()),s)s.cleanups.delete(e.stop)},s)s.cleanups.add(e.stop);return e(),e.stop},g=(t,n={},o=[])=>{if(n instanceof Node||Array.isArray(n)||typeof n!=="object")o=n,n={};let i=["svg","path","circle","rect","line","polyline","polygon","g","defs","text","tspan","use"].includes(t),s=i?document.createElementNS("http://www.w3.org/2000/svg",t):document.createElement(t),e=(r,d)=>(r==="src"||r==="href")&&String(d).toLowerCase().includes("javascript:")?"#":d;s._cleanups=new Set;let a=["disabled","checked","required","readonly","selected","multiple","autofocus"];for(let[r,d]of Object.entries(n)){if(r==="ref"){typeof d==="function"?d(s):d.current=s;continue}let m=typeof d==="function";if(["INPUT","TEXTAREA","SELECT"].includes(s.tagName)&&(r==="value"||r==="checked")&&m){s._cleanups.add(_(()=>{let E=d();if(s[r]!==E)s[r]=E}));let l=r==="checked"?"change":"input",y=(E)=>d(E.target[r]);s.addEventListener(l,y),s._cleanups.add(()=>s.removeEventListener(l,y))}else if(r.startsWith("on")){let l=r.slice(2).toLowerCase().split(".")[0],y=(E)=>d(E);s.addEventListener(l,y),s._cleanups.add(()=>s.removeEventListener(l,y))}else if(m)s._cleanups.add(_(()=>{let l=e(r,d());if(r==="class")s.className=l||"";else if(a.includes(r))if(l)s.setAttribute(r,""),s[r]=!0;else s.removeAttribute(r),s[r]=!1;else if(l==null)s.removeAttribute(r);else if(i&&typeof l==="number")s.setAttribute(r,l);else s.setAttribute(r,l)}));else if(a.includes(r))if(d)s.setAttribute(r,""),s[r]=!0;else s.removeAttribute(r),s[r]=!1;else s.setAttribute(r,e(r,d))}let f=(r)=>{if(Array.isArray(r))return r.forEach(f);if(r instanceof Node)s.appendChild(r);else if(typeof r==="function"){let d=document.createTextNode("");s.appendChild(d);let m=[];s._cleanups.add(_(()=>{let u=r(),h=(Array.isArray(u)?u:[u]).map((l)=>l?._isRuntime?l.container:l instanceof Node?l:document.createTextNode(l??""));m.forEach((l)=>{k?.(l),l.remove()}),h.forEach((l)=>d.parentNode?.insertBefore(l,d)),m=h}))}else s.appendChild(document.createTextNode(r??""))};return f(o),s},A=(t,n,o=null,c=null)=>{let i=document.createTextNode(""),s=g("div",{style:"display:contents"},[i]),e=null,a=null;return _(()=>{let f=!!(typeof t==="function"?t():t);if(f===a)return;if(a=f,e&&!f&&c?.out)c.out(e.container,()=>{e.destroy(),e=null});else{if(e)e.destroy();e=null}if(f||!f&&o){let r=f?n:o;if(r){if(e=N(()=>typeof r==="function"?r():r),s.insertBefore(e.container,i),f&&c?.in)c.in(e.container)}}}),s};A.not=(t,n,o)=>A(()=>!(typeof t==="function"?t():t),n,o);var P=(t,n,o,c="div",i={style:"display:contents"})=>{let s=document.createTextNode(""),e=g(c,i,[s]),a=new Map;return _(()=>{let f=(typeof t==="function"?t():t)||[],r=new Map,d=[];for(let u=0;u<f.length;u++){let h=f[u],l=o?o(h,u):u,y=a.get(l);if(!y)y=N(()=>n(h,u));else a.delete(l);r.set(l,y),d.push(l)}a.forEach((u)=>{u.destroy(),u.container.remove()});let m=s;for(let u=d.length-1;u>=0;u--){let h=r.get(d[u]);if(h.container.nextSibling!==m)e.insertBefore(h.container,m);m=h.container}a=r}),e},v=(t)=>{let n=x(window.location.hash.replace(/^#/,"")||"/");window.addEventListener("hashchange",()=>n(window.location.hash.replace(/^#/,"")||"/"));let o=g("div",{class:"router-outlet"}),c=null;return _([n],async()=>{let i=n(),s=t.find((e)=>{let a=e.path.split("/").filter(Boolean),f=i.split("/").filter(Boolean);return a.length===f.length&&a.every((r,d)=>r.startsWith(":")||r===f[d])})||t.find((e)=>e.path==="*");if(s){let e=s.component;if(typeof e==="function"&&e.toString().includes("import"))e=(await e()).default||await e();let a={};if(s.path.split("/").filter(Boolean).forEach((f,r)=>{if(f.startsWith(":"))a[f.slice(1)]=i.split("/").filter(Boolean)[r]}),c)c.destroy();if(v.params)v.params(a);c=N(()=>{try{return typeof e==="function"?e(a):e}catch(f){return g("div",{class:"p-4 text-error"},"Error loading view")}}),o.appendChild(c.container)}}),o};v.params=x({});v.to=(t)=>window.location.hash=t.replace(/^#?\/?/,"#/");v.back=()=>window.history.back();v.path=()=>window.location.hash.replace(/^#/,"")||"/";var I=(t,n)=>{let o=typeof n==="string"?document.querySelector(n):n;if(!o)return;if(O.has(o))O.get(o).destroy();let c=N(typeof t==="function"?t:()=>t);return o.replaceChildren(c.container),O.set(o,c),c},B=({children:t})=>t,J={$:x,$watch:_,$html:g,$if:A,$for:P,$router:v,$mount:I,Fragment:B};if(typeof window<"u")((n)=>{Object.keys(n).forEach((c)=>{window[c]=n[c]}),"div span p h1 h2 h3 h4 h5 h6 br hr section article aside nav main header footer address ul ol li dl dt dd a em strong small i b u mark time sub sup pre code blockquote details summary dialog form label input textarea select button option fieldset legend table thead tbody tfoot tr th td caption img video audio canvas svg iframe picture source progress meter".split(/\s+/).forEach((c)=>{let i=c.charAt(0).toUpperCase()+c.slice(1);if(!(i in window))window[i]=(s,e)=>g(c,s,e)}),window.Fragment=B,window.SigPro=Object.freeze(n)})(J);})();
package/index.js DELETED
@@ -1,2 +0,0 @@
1
- // index.js
2
- export * from './sigpro/index.js';