sigpro 1.1.20 → 2.0.3

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/sigpro.js CHANGED
@@ -1,480 +1 @@
1
- (() => {
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- function __accessProp(key) {
7
- return this[key];
8
- }
9
- var __toCommonJS = (from) => {
10
- var entry = (__moduleCache ??= new WeakMap).get(from), desc;
11
- if (entry)
12
- return entry;
13
- entry = __defProp({}, "__esModule", { value: true });
14
- if (from && typeof from === "object" || typeof from === "function") {
15
- for (var key of __getOwnPropNames(from))
16
- if (!__hasOwnProp.call(entry, key))
17
- __defProp(entry, key, {
18
- get: __accessProp.bind(from, key),
19
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
20
- });
21
- }
22
- __moduleCache.set(from, entry);
23
- return entry;
24
- };
25
- var __moduleCache;
26
- var __returnValue = (v) => v;
27
- function __exportSetter(name, newValue) {
28
- this[name] = __returnValue.bind(null, newValue);
29
- }
30
- var __export = (target, all) => {
31
- for (var name in all)
32
- __defProp(target, name, {
33
- get: all[name],
34
- enumerable: true,
35
- configurable: true,
36
- set: __exportSetter.bind(all, name)
37
- });
38
- };
39
-
40
- // index.js
41
- var exports_sigpro = {};
42
- __export(exports_sigpro, {
43
- Fragment: () => Fragment,
44
- $watch: () => $watch,
45
- $router: () => $router,
46
- $mount: () => $mount,
47
- $if: () => $if,
48
- $html: () => $html,
49
- $for: () => $for,
50
- $: () => $
51
- });
52
-
53
- // sigpro/index.js
54
- var activeEffect = null;
55
- var currentOwner = null;
56
- var effectQueue = new Set;
57
- var isFlushing = false;
58
- var MOUNTED_NODES = new WeakMap;
59
- var flush = () => {
60
- if (isFlushing)
61
- return;
62
- isFlushing = true;
63
- while (effectQueue.size > 0) {
64
- const sorted = Array.from(effectQueue).sort((a, b) => (a.depth || 0) - (b.depth || 0));
65
- effectQueue.clear();
66
- for (const eff of sorted)
67
- if (!eff._deleted)
68
- eff();
69
- }
70
- isFlushing = false;
71
- };
72
- var track = (subs) => {
73
- if (activeEffect && !activeEffect._deleted) {
74
- subs.add(activeEffect);
75
- activeEffect._deps.add(subs);
76
- }
77
- };
78
- var trigger = (subs) => {
79
- for (const eff of subs) {
80
- if (eff === activeEffect || eff._deleted)
81
- continue;
82
- if (eff._isComputed) {
83
- eff.markDirty();
84
- if (eff._subs)
85
- trigger(eff._subs);
86
- } else {
87
- effectQueue.add(eff);
88
- }
89
- }
90
- if (!isFlushing)
91
- queueMicrotask(flush);
92
- };
93
- var sweep = (node) => {
94
- if (node._cleanups) {
95
- node._cleanups.forEach((f) => f());
96
- node._cleanups.clear();
97
- }
98
- node.childNodes?.forEach(sweep);
99
- };
100
- var _view = (fn) => {
101
- const cleanups = new Set;
102
- const prev = currentOwner;
103
- const container = document.createElement("div");
104
- container.style.display = "contents";
105
- currentOwner = { cleanups };
106
- try {
107
- const res = fn({ onCleanup: (f) => cleanups.add(f) });
108
- const process = (n) => {
109
- if (!n)
110
- return;
111
- if (n._isRuntime) {
112
- cleanups.add(n.destroy);
113
- container.appendChild(n.container);
114
- } else if (Array.isArray(n))
115
- n.forEach(process);
116
- else
117
- container.appendChild(n instanceof Node ? n : document.createTextNode(String(n)));
118
- };
119
- process(res);
120
- } finally {
121
- currentOwner = prev;
122
- }
123
- return {
124
- _isRuntime: true,
125
- container,
126
- destroy: () => {
127
- cleanups.forEach((f) => f());
128
- sweep(container);
129
- container.remove();
130
- }
131
- };
132
- };
133
- var $ = (initial, key = null) => {
134
- if (typeof initial === "function") {
135
- const subs2 = new Set;
136
- let cached, dirty = true;
137
- const effect = () => {
138
- if (effect._deleted)
139
- return;
140
- effect._deps.forEach((s) => s.delete(effect));
141
- effect._deps.clear();
142
- const prev = activeEffect;
143
- activeEffect = effect;
144
- try {
145
- const val = initial();
146
- if (!Object.is(cached, val) || dirty) {
147
- cached = val;
148
- dirty = false;
149
- trigger(subs2);
150
- }
151
- } finally {
152
- activeEffect = prev;
153
- }
154
- };
155
- effect._deps = new Set;
156
- effect._isComputed = true;
157
- effect._subs = subs2;
158
- effect._deleted = false;
159
- effect.markDirty = () => dirty = true;
160
- effect.stop = () => {
161
- effect._deleted = true;
162
- effect._deps.forEach((s) => s.delete(effect));
163
- subs2.clear();
164
- };
165
- if (currentOwner)
166
- currentOwner.cleanups.add(effect.stop);
167
- return () => {
168
- if (dirty)
169
- effect();
170
- track(subs2);
171
- return cached;
172
- };
173
- }
174
- let value = initial;
175
- if (key) {
176
- try {
177
- const saved = localStorage.getItem(key);
178
- if (saved !== null)
179
- value = JSON.parse(saved);
180
- } catch (e) {
181
- console.warn("SigPro: LocalStorage locked", e);
182
- }
183
- }
184
- const subs = new Set;
185
- return (...args) => {
186
- if (args.length) {
187
- const next = typeof args[0] === "function" ? args[0](value) : args[0];
188
- if (!Object.is(value, next)) {
189
- value = next;
190
- if (key)
191
- localStorage.setItem(key, JSON.stringify(value));
192
- trigger(subs);
193
- }
194
- }
195
- track(subs);
196
- return value;
197
- };
198
- };
199
- var $watch = (target, fn) => {
200
- const isExplicit = Array.isArray(target);
201
- const callback = isExplicit ? fn : target;
202
- const depsInput = isExplicit ? target : null;
203
- if (typeof callback !== "function")
204
- return () => {};
205
- const owner = currentOwner;
206
- const runner = () => {
207
- if (runner._deleted)
208
- return;
209
- runner._deps.forEach((s) => s.delete(runner));
210
- runner._deps.clear();
211
- runner._cleanups.forEach((c) => c());
212
- runner._cleanups.clear();
213
- const prevEffect = activeEffect;
214
- const prevOwner = currentOwner;
215
- activeEffect = runner;
216
- currentOwner = { cleanups: runner._cleanups };
217
- runner.depth = prevEffect ? prevEffect.depth + 1 : 0;
218
- try {
219
- if (isExplicit) {
220
- activeEffect = null;
221
- callback();
222
- activeEffect = runner;
223
- depsInput.forEach((d) => typeof d === "function" && d());
224
- } else {
225
- callback();
226
- }
227
- } finally {
228
- activeEffect = prevEffect;
229
- currentOwner = prevOwner;
230
- }
231
- };
232
- runner._deps = new Set;
233
- runner._cleanups = new Set;
234
- runner._deleted = false;
235
- runner.stop = () => {
236
- if (runner._deleted)
237
- return;
238
- runner._deleted = true;
239
- effectQueue.delete(runner);
240
- runner._deps.forEach((s) => s.delete(runner));
241
- runner._cleanups.forEach((c) => c());
242
- if (owner)
243
- owner.cleanups.delete(runner.stop);
244
- };
245
- if (owner)
246
- owner.cleanups.add(runner.stop);
247
- runner();
248
- return runner.stop;
249
- };
250
- var $html = (tag, props = {}, content = []) => {
251
- if (props instanceof Node || Array.isArray(props) || typeof props !== "object") {
252
- content = props;
253
- props = {};
254
- }
255
- const svgTags = ["svg", "path", "circle", "rect", "line", "polyline", "polygon", "g", "defs", "text", "tspan", "use"];
256
- const isSVG = svgTags.includes(tag);
257
- const el = isSVG ? document.createElementNS("http://www.w3.org/2000/svg", tag) : document.createElement(tag);
258
- const _sanitize = (key, val) => (key === "src" || key === "href") && String(val).toLowerCase().includes("javascript:") ? "#" : val;
259
- el._cleanups = new Set;
260
- const boolAttrs = ["disabled", "checked", "required", "readonly", "selected", "multiple", "autofocus"];
261
- for (let [key, val] of Object.entries(props)) {
262
- if (key === "ref") {
263
- typeof val === "function" ? val(el) : val.current = el;
264
- continue;
265
- }
266
- const isSignal = typeof val === "function", isInput = ["INPUT", "TEXTAREA", "SELECT"].includes(el.tagName), isBindAttr = key === "value" || key === "checked";
267
- if (isInput && isBindAttr && isSignal) {
268
- el._cleanups.add($watch(() => {
269
- const currentVal = val();
270
- if (el[key] !== currentVal)
271
- el[key] = currentVal;
272
- }));
273
- const eventName = key === "checked" ? "change" : "input", handler = (event) => val(event.target[key]);
274
- el.addEventListener(eventName, handler);
275
- el._cleanups.add(() => el.removeEventListener(eventName, handler));
276
- } else if (key.startsWith("on")) {
277
- const eventName = key.slice(2).toLowerCase().split(".")[0], handler = (event) => val(event);
278
- el.addEventListener(eventName, handler);
279
- el._cleanups.add(() => el.removeEventListener(eventName, handler));
280
- } else if (isSignal) {
281
- el._cleanups.add($watch(() => {
282
- const currentVal = _sanitize(key, val());
283
- if (key === "class") {
284
- el.className = currentVal || "";
285
- } else if (boolAttrs.includes(key)) {
286
- if (currentVal) {
287
- el.setAttribute(key, "");
288
- el[key] = true;
289
- } else {
290
- el.removeAttribute(key);
291
- el[key] = false;
292
- }
293
- } else {
294
- if (currentVal == null) {
295
- el.removeAttribute(key);
296
- } else if (isSVG && typeof currentVal === "number") {
297
- el.setAttribute(key, currentVal);
298
- } else {
299
- el.setAttribute(key, currentVal);
300
- }
301
- }
302
- }));
303
- } else {
304
- if (boolAttrs.includes(key)) {
305
- if (val) {
306
- el.setAttribute(key, "");
307
- el[key] = true;
308
- } else {
309
- el.removeAttribute(key);
310
- el[key] = false;
311
- }
312
- } else {
313
- el.setAttribute(key, _sanitize(key, val));
314
- }
315
- }
316
- }
317
- const append = (child) => {
318
- if (Array.isArray(child))
319
- return child.forEach(append);
320
- if (child instanceof Node) {
321
- el.appendChild(child);
322
- } else if (typeof child === "function") {
323
- const marker = document.createTextNode("");
324
- el.appendChild(marker);
325
- let nodes = [];
326
- el._cleanups.add($watch(() => {
327
- const res = child(), next = (Array.isArray(res) ? res : [res]).map((i) => i?._isRuntime ? i.container : i instanceof Node ? i : document.createTextNode(i ?? ""));
328
- nodes.forEach((n) => {
329
- sweep?.(n);
330
- n.remove();
331
- });
332
- next.forEach((n) => marker.parentNode?.insertBefore(n, marker));
333
- nodes = next;
334
- }));
335
- } else
336
- el.appendChild(document.createTextNode(child ?? ""));
337
- };
338
- append(content);
339
- return el;
340
- };
341
- var $if = (condition, thenVal, otherwiseVal = null, transition = null) => {
342
- const marker = document.createTextNode("");
343
- const container = $html("div", { style: "display:contents" }, [marker]);
344
- let current = null, last = null;
345
- $watch(() => {
346
- const state = !!(typeof condition === "function" ? condition() : condition);
347
- if (state === last)
348
- return;
349
- last = state;
350
- if (current && !state && transition?.out) {
351
- transition.out(current.container, () => {
352
- current.destroy();
353
- current = null;
354
- });
355
- } else {
356
- if (current)
357
- current.destroy();
358
- current = null;
359
- }
360
- if (state || !state && otherwiseVal) {
361
- const branch = state ? thenVal : otherwiseVal;
362
- if (branch) {
363
- current = _view(() => typeof branch === "function" ? branch() : branch);
364
- container.insertBefore(current.container, marker);
365
- if (state && transition?.in)
366
- transition.in(current.container);
367
- }
368
- }
369
- });
370
- return container;
371
- };
372
- $if.not = (condition, thenVal, otherwiseVal) => $if(() => !(typeof condition === "function" ? condition() : condition), thenVal, otherwiseVal);
373
- var $for = (source, render, keyFn, tag = "div", props = { style: "display:contents" }) => {
374
- const marker = document.createTextNode("");
375
- const container = $html(tag, props, [marker]);
376
- let cache = new Map;
377
- $watch(() => {
378
- const items = (typeof source === "function" ? source() : source) || [];
379
- const newCache = new Map;
380
- const newOrder = [];
381
- for (let i = 0;i < items.length; i++) {
382
- const item = items[i];
383
- const key = keyFn ? keyFn(item, i) : i;
384
- let run = cache.get(key);
385
- if (!run) {
386
- run = _view(() => render(item, i));
387
- } else {
388
- cache.delete(key);
389
- }
390
- newCache.set(key, run);
391
- newOrder.push(key);
392
- }
393
- cache.forEach((run) => {
394
- run.destroy();
395
- run.container.remove();
396
- });
397
- let anchor = marker;
398
- for (let i = newOrder.length - 1;i >= 0; i--) {
399
- const run = newCache.get(newOrder[i]);
400
- if (run.container.nextSibling !== anchor) {
401
- container.insertBefore(run.container, anchor);
402
- }
403
- anchor = run.container;
404
- }
405
- cache = newCache;
406
- });
407
- return container;
408
- };
409
- var $router = (routes) => {
410
- const sPath = $(window.location.hash.replace(/^#/, "") || "/");
411
- window.addEventListener("hashchange", () => sPath(window.location.hash.replace(/^#/, "") || "/"));
412
- const outlet = $html("div", { class: "router-outlet" });
413
- let current = null;
414
- $watch([sPath], async () => {
415
- const path = sPath();
416
- const route = routes.find((r) => {
417
- const rp = r.path.split("/").filter(Boolean), pp = path.split("/").filter(Boolean);
418
- return rp.length === pp.length && rp.every((p, i) => p.startsWith(":") || p === pp[i]);
419
- }) || routes.find((r) => r.path === "*");
420
- if (route) {
421
- let comp = route.component;
422
- if (typeof comp === "function" && comp.toString().includes("import")) {
423
- comp = (await comp()).default || await comp();
424
- }
425
- const params = {};
426
- route.path.split("/").filter(Boolean).forEach((p, i) => {
427
- if (p.startsWith(":"))
428
- params[p.slice(1)] = path.split("/").filter(Boolean)[i];
429
- });
430
- if (current)
431
- current.destroy();
432
- if ($router.params)
433
- $router.params(params);
434
- current = _view(() => {
435
- try {
436
- return typeof comp === "function" ? comp(params) : comp;
437
- } catch (e) {
438
- return $html("div", { class: "p-4 text-error" }, "Error loading view");
439
- }
440
- });
441
- outlet.appendChild(current.container);
442
- }
443
- });
444
- return outlet;
445
- };
446
- $router.params = $({});
447
- $router.to = (path) => window.location.hash = path.replace(/^#?\/?/, "#/");
448
- $router.back = () => window.history.back();
449
- $router.path = () => window.location.hash.replace(/^#/, "") || "/";
450
- var $mount = (component, target) => {
451
- const el = typeof target === "string" ? document.querySelector(target) : target;
452
- if (!el)
453
- return;
454
- if (MOUNTED_NODES.has(el))
455
- MOUNTED_NODES.get(el).destroy();
456
- const instance = _view(typeof component === "function" ? component : () => component);
457
- el.replaceChildren(instance.container);
458
- MOUNTED_NODES.set(el, instance);
459
- return instance;
460
- };
461
- var Fragment = ({ children }) => children;
462
- var SigProCore = { $, $watch, $html, $if, $for, $router, $mount, Fragment };
463
- if (typeof window !== "undefined") {
464
- const install = (registry) => {
465
- Object.keys(registry).forEach((key) => {
466
- window[key] = registry[key];
467
- });
468
- 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+/);
469
- tags.forEach((tagName) => {
470
- const helperName = tagName.charAt(0).toUpperCase() + tagName.slice(1);
471
- if (!(helperName in window)) {
472
- window[helperName] = (props, content) => $html(tagName, props, content);
473
- }
474
- });
475
- window.Fragment = Fragment;
476
- window.SigPro = Object.freeze(registry);
477
- };
478
- install(SigProCore);
479
- }
480
- })();
1
+ function t({update:z,notify:B,unwatched:F}){return{link:J,unlink:Q,propagate:H,checkDirty:N,shallowPropagate:W};function J(K,X,Z){let E=X.depsTail;if(E!==void 0&&E.dep===K)return;let U=E!==void 0?E.nextDep:X.deps;if(U!==void 0&&U.dep===K){U.version=Z,X.depsTail=U;return}let $=K.subsTail;if($!==void 0&&$.version===Z&&$.sub===X)return;let _=X.depsTail=K.subsTail={version:Z,dep:K,sub:X,prevDep:E,nextDep:U,prevSub:$,nextSub:void 0};if(U!==void 0)U.prevDep=_;if(E!==void 0)E.nextDep=_;else X.deps=_;if($!==void 0)$.nextSub=_;else K.subs=_}function Q(K,X=K.sub){let{dep:Z,prevDep:E,nextDep:U,nextSub:$,prevSub:_}=K;if(U!==void 0)U.prevDep=E;else X.depsTail=E;if(E!==void 0)E.nextDep=U;else X.deps=U;if($!==void 0)$.prevSub=_;else Z.subsTail=_;if(_!==void 0)_.nextSub=$;else if((Z.subs=$)===void 0)F(Z);return U}function H(K,X){let Z=K.nextSub,E;z:do{let U=K.sub,$=U.flags;if(!($&60)){if(U.flags=$|32,X)U.flags|=8}else if(!($&12))$=0;else if(!($&4))U.flags=$&-9|32;else if(!($&48)&&Y(K,U))U.flags=$|8|32,$&=1;else $=0;if($&2)B(U);if($&1){let _=U.subs;if(_!==void 0){let R=(K=_).nextSub;if(R!==void 0)E={value:Z,prev:E},Z=R;continue}}if((K=Z)!==void 0){Z=K.nextSub;continue}while(E!==void 0)if(K=E.value,E=E.prev,K!==void 0){Z=K.nextSub;continue z}break}while(!0)}function N(K,X){let Z,E=0,U=!1;z:do{let $=K.dep,_=$.flags;if(X.flags&16)U=!0;else if((_&17)===17){let R=$.subs;if(z($)){if(R.nextSub!==void 0)W(R);U=!0}}else if((_&33)===33){Z={value:K,prev:Z},K=$.deps,X=$,++E;continue}if(!U){let R=K.nextDep;if(R!==void 0){K=R;continue}}while(E--){if(K=Z.value,Z=Z.prev,U){let b=X.subs;if(z(X)){if(b.nextSub!==void 0)W(b);X=K.sub;continue}U=!1}else X.flags&=-33;X=K.sub;let R=K.nextDep;if(R!==void 0){K=R;continue z}}return U&&!!X.flags}while(!0)}function W(K){do{let X=K.sub,Z=X.flags;if((Z&48)===32){if(X.flags=Z|16,(Z&6)===2)B(X)}}while((K=K.nextSub)!==void 0)}function Y(K,X){let Z=X.depsTail;while(Z!==void 0){if(Z===K)return!0;Z=Z.prevDep}return!1}}var m=0,O=0,S=0,C=0,G=0,M,A=[],j=[];function n(z,B){let F=j[j.length-1];if(F)F.set(z,B)}function e(z,B){for(let F=j.length-1;F>=0;F--)if(j[F].has(z))return j[F].get(z);return B}var{link:D,unlink:I,propagate:zz,checkDirty:k,shallowPropagate:d}=t({update(z){if("getter"in z)return o(z);if("currentValue"in z)return c(z);return z.flags=1,!0},notify(z){let B=G,F=B;do if(A[B++]=z,z.flags&=-3,z=z.subs?.sub,z===void 0||!(z.flags&2))break;while(!0);G=B;while(F<--B){let J=A[F];A[F++]=A[B],A[B]=J}},unwatched(z){if("getter"in z){if(z.depsTail!==void 0)z.flags=17,r(z)}else if("currentValue"in z);else if("fn"in z)u.call(z);else f.call(z)}});function L(z){return Qz.bind({currentValue:z,pendingValue:z,subs:void 0,subsTail:void 0,flags:1})}function Bz(z){return Kz.bind({value:void 0,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:0,getter:z})}function T(z){let B={fn:z,cleanup:void 0,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:6},F=M;if(M=B,F!==void 0)D(B,F,0),F.flags|=64;j.push(new Map);try{++O;let J=B.fn();B.cleanup=typeof J==="function"?J:void 0}finally{--O,M=F,j.pop(),B.flags&=-5}return u.bind(B)}function x(z){let B={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:1},F=M;if(M=B,F!==void 0)D(B,F,0),F.flags|=64;j.push(new Map);try{z()}finally{j.pop(),M=F}return f.bind(B)}function Fz(z){++S;try{return z()}finally{if(!--S)p()}}function o(z){if(z.flags&64){let F=z.depsTail;while(F!==void 0){let{prevDep:J,dep:Q}=F;if(!("getter"in Q)&&!("currentValue"in Q))I(F,z);F=J}}z.depsTail=void 0,z.flags=5;let B=M;M=z;try{++m;let F=z.value;return F!==(z.value=z.getter(F))}finally{M=B,z.flags&=-5,a(z)}}function c(z){return z.flags=1,z.currentValue!==(z.currentValue=z.pendingValue)}function Jz(z){let B=z.flags;if(B&16||B&32&&k(z.deps,z)){if(B&64){let J=z.depsTail;while(J!==void 0){let{prevDep:Q,dep:H}=J;if(!("getter"in H)&&!("currentValue"in H))I(J,z);J=Q}}if(z.cleanup){if(i(z),!z.flags)return}z.depsTail=void 0,z.flags=6;let F=M;M=z,j.push(new Map);try{++m,++O;let J=z.fn();z.cleanup=typeof J==="function"?J:void 0}finally{--O,M=F,j.pop(),z.flags&=-5,a(z)}}else if(z.deps!==void 0)z.flags=2|B&64}function p(){try{while(C<G){let z=A[C];A[C++]=void 0,Jz(z)}}finally{while(C<G){let z=A[C];A[C++]=void 0,z.flags|=10}C=0,G=0}}function Kz(){let z=this.flags;if(z&16||z&32&&(k(this.deps,this)||(this.flags=z&-33,!1))){if(o(this)){let F=this.subs;if(F!==void 0)d(F)}}else if(!z){this.flags=5;let F=M;M=this;try{this.value=this.getter()}finally{M=F,this.flags&=-5}}let B=M;if(B!==void 0)D(this,B,m);return this.value}function Qz(...z){if(z.length){if(this.pendingValue!==(this.pendingValue=z[0])){this.flags=17;let B=this.subs;if(B!==void 0){if(zz(B,!!O),!S)p()}}}else{if(this.flags&16){if(c(this)){let F=this.subs;if(F!==void 0)d(F)}}let B=M;if(B!==void 0)D(this,B,m);return this.currentValue}}function i(z){let B=z.cleanup;z.cleanup=void 0;let F=M;M=void 0;try{B()}finally{M=F}}function u(){if(f.call(this),this.cleanup)i(this)}function f(){this.flags=0,r(this);let z=this.subs;if(z!==void 0)I(z)}function r(z){let B=z.depsTail;while(B!==void 0){let F=B.prevDep;I(B,z),B=F}}function a(z){let B=z.depsTail,F=B!==void 0?B.nextDep:z.deps;while(F!==void 0)F=I(F,z)}function v(z){let B=M;M=void 0;try{return z()}finally{M=B}}function Uz(z,B,{immediate:F=!1}={}){let J,Q=!0;return T(()=>{let H=z();if(Q){if(Q=!1,J=H,F)v(()=>B(H,void 0));return}if(Object.is(J,H))return;let N=J;J=H,v(()=>B(H,N))})}function Xz(z,B){let F=B;if(typeof localStorage<"u")try{let Q=localStorage.getItem(z);if(Q!==null)F=JSON.parse(Q)}catch{}let J=L(F);return T(()=>{let Q=J();if(typeof localStorage<"u")try{let H=JSON.stringify(Q);if(localStorage.getItem(z)!==H)localStorage.setItem(z,H)}catch{}}),J}var P=typeof document<"u"?document:null,Yz="http://www.w3.org/2000/svg",Zz=new Set("svg path circle rect line polyline polygon g defs text textPath tspan use symbol image marker ellipse foreignObject clipPath mask linearGradient radialGradient pattern filter stop animate animateMotion animateTransform view desc metadata title switch feGaussianBlur feOffset feBlend feColorMatrix feComponentTransfer feComposite feConvolveMatrix feDiffuseLighting feDisplacementMap feDistantLight feFlood feFuncA feFuncB feFuncG feFuncR feImage feMerge feMergeNode feMorphology fePointLight feSpecularLighting feSpotLight feTile feTurbulence".split(" "));function V(z,B,F,J){if(B==="class"||B==="className"){if(J)if(F==null||F===!1)z.removeAttribute("class");else z.setAttribute("class",F===!0?"":F);else z.className=F??"";return}if(F==null||F===!1){z.removeAttribute(B);return}if(B==="style"&&typeof F==="string"){z.setAttribute("style",F);return}if(J){z.setAttribute(B,F===!0?"":F);return}if(B in z&&typeof z[B]!=="function")z[B]=F;else z.setAttribute(B,F===!0?"":F)}function l(z){let B=[z];while(B.length){let F=B.pop();if(F._stopScope)F._stopScope(),F._stopScope=null;if(F._cln){for(let J of F._cln)J();F._cln=null}for(let J=0;J<F.childNodes.length;J++)B.push(F.childNodes[J])}}function q(z,B={},...F){if(typeof z==="function"){let W,Y=x(()=>{W=z(B,F)}),K=(X)=>{if(X instanceof Node)X._stopScope=Y;else if(Array.isArray(X))X.forEach(K)};return K(W),W}if(B instanceof Node||Array.isArray(B)||B!==null&&typeof B!=="object"||B===void 0)F=[B,...F],B={};let J=Zz.has(z),Q=J?P.createElementNS(Yz,z):P.createElement(z),H,N=!1;for(let W in B){let Y=B[W];if(W==="ref"){if(typeof Y==="function")Y(Q);else if(Y!=null&&typeof Y==="object")Y.current=Q;continue}if(z==="select"&&W==="value"){H=Y;continue}if(W==="html"){if(N=!0,typeof Y==="function")T(()=>{Q.innerHTML=Y()??""});else Q.innerHTML=Y??"";continue}if(W.startsWith("on")&&typeof Y==="function"){let K=W.slice(2).toLowerCase();Q.addEventListener(K,Y),(Q._cln||(Q._cln=[])).push(()=>Q.removeEventListener(K,Y))}else if(typeof Y==="function")T(()=>V(Q,W,Y(),J));else V(Q,W,Y,J)}if(!N){let W=(Y)=>{if(Array.isArray(Y)){for(let K of Y)W(K);return}if(Y==null||Y===!1||Y===!0)return;if(typeof Y==="function"){let K=P.createComment("");Q.appendChild(K),T(()=>{let X=Y(),Z=Array.isArray(X)?X:[X],E=[];for(let U of Z){if(U==null||U===!1||U===!0)continue;E.push(U instanceof Node?U:P.createTextNode(String(U)))}for(let U of E)Q.insertBefore(U,K);return()=>{for(let U of E)l(U),U.remove()}});return}Q.appendChild(Y instanceof Node?Y:P.createTextNode(String(Y)))};W(F)}if(H!==void 0)if(typeof H==="function")T(()=>V(Q,"value",H(),J));else V(Q,"value",H,J);return Q}var $z=(z,{prop:B="value",onEvent:F="onInput",parse:J=(Q)=>Q}={})=>({[B]:()=>z(),[F]:(Q)=>z(J(Q.target[B]))});function Ez(z,B){let F=typeof B==="string"?P.querySelector(B):B;if(!F)return()=>{};let J,Q=x(()=>{J=q(z,{})}),H=Array.isArray(J)?J.filter(Boolean):J?[J]:[];return F.replaceChildren(...H),()=>{Q(),F.replaceChildren()}}function Hz(z){if(!(z instanceof Node))return;if(l(z),z.parentNode)z.parentNode.removeChild(z)}var Mz="a abbr article aside audio b blockquote br button canvas caption cite code col colgroup datalist dd del details dfn dialog div dl dt em embed fieldset figcaption figure footer form h1 h2 h3 h4 h5 h6 header hr i iframe img input ins kbd label legend li main mark meter nav object ol optgroup option output p picture pre progress section select slot small source span strong sub summary sup table tbody td template textarea tfoot th thead time tr u ul video",Wz=(z=typeof window<"u"?window:null)=>{if(!z)return;for(let B of Mz.split(" "))z[B]=(F,...J)=>q(B,F,...J)},h=L(typeof window<"u"?window.location.hash.slice(1)||"/":"/"),s=L({});if(typeof window<"u")window.addEventListener("hashchange",()=>{h(window.location.hash.slice(1)||"/")});var y=(z)=>()=>{let B=q("div",{class:"router-hook"});return T(()=>{let J=h().split("/").filter(Boolean);return x(()=>{let Q=z.find((Y)=>{let K=Y.path.split("/").filter(Boolean);return K.length===J.length&&K.every((X,Z)=>X[0]===":"||X===J[Z])})||z.find((Y)=>Y.path==="*");if(!Q){B.replaceChildren();return}let H={};Q.path.split("/").filter(Boolean).forEach((Y,K)=>{if(Y[0]===":")H[Y.slice(1)]=J[K]}),s(H);let N=typeof Q.component==="function"?q(Q.component,H):Q.component,W=N==null?[]:Array.isArray(N)?N:[N];B.replaceChildren(...W)})}),B};y.to=(z)=>{if(typeof window<"u")window.location.hash=z.replace(/^#?\/?/,"#/")};y.back=()=>{if(typeof window<"u")window.history.back()};y.path=()=>h();var g=L("en"),w={},_z=(z)=>{for(let B in z)w[B]||={},Object.assign(w[B],z[B])},Nz=(z)=>{if(z&&w[z])g(z)},Rz=(z)=>()=>w[g()]?.[z]??z,jz=(z)=>w[g()]?.[z]??z,Az=async(z,B=null,F=null,J=null)=>{if(F)F(!0);try{let Q=await fetch(z,{method:B?"POST":"GET",headers:{"Content-Type":"application/json"},body:B?JSON.stringify(B):void 0,credentials:"include",signal:J});if(!Q.ok)throw Error(`Error ${Q.status}: ${await Q.text()}`);return await Q.json()}finally{if(F)F(!1)}},Tz={signal:L,computed:Bz,effect:T,effectScope:x,batch:Fz,untrack:v,watch:Uz,local:Xz,provide:n,inject:e,h:q,bind:$z,mount:Ez,unmount:Hz,exposeTags:Wz,router:y,currentPath:h,routerParams:s,currentLocale:g,addLang:_z,setLocale:Nz,t:Rz,tt:jz,db:Az};export{Uz as watch,v as untrack,Hz as unmount,jz as tt,Rz as t,L as signal,Nz as setLocale,s as routerParams,y as router,n as provide,Ez as mount,Xz as local,e as inject,q as h,Wz as exposeTags,x as effectScope,T as effect,Az as db,h as currentPath,g as currentLocale,Bz as computed,$z as bind,Fz as batch,_z as addLang,Tz as SigPro};
@@ -0,0 +1,6 @@
1
+ var{default:y}=(()=>({}));function d(e){if(typeof e!=="string")throw TypeError("Path must be a string. Received "+JSON.stringify(e))}function b(e,r){var n="",i=0,o=-1,t=0,s;for(var l=0;l<=e.length;++l){if(l<e.length)s=e.charCodeAt(l);else if(s===47)break;else s=47;if(s===47){if(o===l-1||t===1);else if(o!==l-1&&t===2){if(n.length<2||i!==2||n.charCodeAt(n.length-1)!==46||n.charCodeAt(n.length-2)!==46){if(n.length>2){var u=n.lastIndexOf("/");if(u!==n.length-1){if(u===-1)n="",i=0;else n=n.slice(0,u),i=n.length-1-n.lastIndexOf("/");o=l,t=0;continue}}else if(n.length===2||n.length===1){n="",i=0,o=l,t=0;continue}}if(r){if(n.length>0)n+="/..";else n="..";i=2}}else{if(n.length>0)n+="/"+e.slice(o+1,l);else n=e.slice(o+1,l);i=l-o-1}o=l,t=0}else if(s===46&&t!==-1)++t;else t=-1}return n}function k(e,r){var n=r.dir||r.root,i=r.base||(r.name||"")+(r.ext||"");if(!n)return i;if(n===r.root)return n+i;return n+e+i}function A(){var e="",r=!1,n;for(var i=arguments.length-1;i>=-1&&!r;i--){var o;if(i>=0)o=arguments[i];else{if(n===void 0)n=process.cwd();o=n}if(d(o),o.length===0)continue;e=o+"/"+e,r=o.charCodeAt(0)===47}if(e=b(e,!r),r)if(e.length>0)return"/"+e;else return"/";else if(e.length>0)return e;else return"."}function $(e){if(d(e),e.length===0)return".";var r=e.charCodeAt(0)===47,n=e.charCodeAt(e.length-1)===47;if(e=b(e,!r),e.length===0&&!r)e=".";if(e.length>0&&n)e+="/";if(r)return"/"+e;return e}function S(e){return d(e),e.length>0&&e.charCodeAt(0)===47}function w(){if(arguments.length===0)return".";var e;for(var r=0;r<arguments.length;++r){var n=arguments[r];if(d(n),n.length>0)if(e===void 0)e=n;else e+="/"+n}if(e===void 0)return".";return $(e)}function P(e,r){if(d(e),d(r),e===r)return"";if(e=A(e),r=A(r),e===r)return"";var n=1;for(;n<e.length;++n)if(e.charCodeAt(n)!==47)break;var i=e.length,o=i-n,t=1;for(;t<r.length;++t)if(r.charCodeAt(t)!==47)break;var s=r.length,l=s-t,u=o<l?o:l,c=-1,f=0;for(;f<=u;++f){if(f===u){if(l>u){if(r.charCodeAt(t+f)===47)return r.slice(t+f+1);else if(f===0)return r.slice(t+f)}else if(o>u){if(e.charCodeAt(n+f)===47)c=f;else if(f===0)c=0}break}var g=e.charCodeAt(n+f),m=r.charCodeAt(t+f);if(g!==m)break;else if(g===47)c=f}var a="";for(f=n+c+1;f<=i;++f)if(f===i||e.charCodeAt(f)===47)if(a.length===0)a+="..";else a+="/..";if(a.length>0)return a+r.slice(t+c);else{if(t+=c,r.charCodeAt(t)===47)++t;return r.slice(t)}}function T(e){return e}function x(e){if(d(e),e.length===0)return".";var r=e.charCodeAt(0),n=r===47,i=-1,o=!0;for(var t=e.length-1;t>=1;--t)if(r=e.charCodeAt(t),r===47){if(!o){i=t;break}}else o=!1;if(i===-1)return n?"/":".";if(n&&i===1)return"//";return e.slice(0,i)}function D(e,r){if(r!==void 0&&typeof r!=="string")throw TypeError('"ext" argument must be a string');d(e);var n=0,i=-1,o=!0,t;if(r!==void 0&&r.length>0&&r.length<=e.length){if(r.length===e.length&&r===e)return"";var s=r.length-1,l=-1;for(t=e.length-1;t>=0;--t){var u=e.charCodeAt(t);if(u===47){if(!o){n=t+1;break}}else{if(l===-1)o=!1,l=t+1;if(s>=0)if(u===r.charCodeAt(s)){if(--s===-1)i=t}else s=-1,i=l}}if(n===i)i=l;else if(i===-1)i=e.length;return e.slice(n,i)}else{for(t=e.length-1;t>=0;--t)if(e.charCodeAt(t)===47){if(!o){n=t+1;break}}else if(i===-1)o=!1,i=t+1;if(i===-1)return"";return e.slice(n,i)}}function E(e){d(e);var r=-1,n=0,i=-1,o=!0,t=0;for(var s=e.length-1;s>=0;--s){var l=e.charCodeAt(s);if(l===47){if(!o){n=s+1;break}continue}if(i===-1)o=!1,i=s+1;if(l===46){if(r===-1)r=s;else if(t!==1)t=1}else if(r!==-1)t=-1}if(r===-1||i===-1||t===0||t===1&&r===i-1&&r===n+1)return"";return e.slice(r,i)}function L(e){if(e===null||typeof e!=="object")throw TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return k("/",e)}function M(e){d(e);var r={root:"",dir:"",base:"",ext:"",name:""};if(e.length===0)return r;var n=e.charCodeAt(0),i=n===47,o;if(i)r.root="/",o=1;else o=0;var t=-1,s=0,l=-1,u=!0,c=e.length-1,f=0;for(;c>=o;--c){if(n=e.charCodeAt(c),n===47){if(!u){s=c+1;break}continue}if(l===-1)u=!1,l=c+1;if(n===46){if(t===-1)t=c;else if(f!==1)f=1}else if(t!==-1)f=-1}if(t===-1||l===-1||f===0||f===1&&t===l-1&&t===s+1){if(l!==-1)if(s===0&&i)r.base=r.name=e.slice(1,l);else r.base=r.name=e.slice(s,l)}else{if(s===0&&i)r.name=e.slice(1,t),r.base=e.slice(1,l);else r.name=e.slice(s,t),r.base=e.slice(s,l);r.ext=e.slice(t,l)}if(s>0)r.dir=e.slice(0,s-1);else if(i)r.dir="/";return r}var R="/",_=":",z=((e)=>(e.posix=e,e))({resolve:A,normalize:$,isAbsolute:S,join:w,relative:P,_makeLong:T,dirname:x,basename:D,extname:E,format:L,parse:M,sep:R,delimiter:_,win32:null,posix:null}),v=z;function B({pagesDir:e="src/pages"}={}){let n="\x00virtual:sigpro-routes",i=(t)=>{if(!y.existsSync(t))return[];return y.readdirSync(t,{recursive:!0}).filter((s)=>/\.(js|jsx)$/.test(s)&&!v.basename(s).startsWith("_")).map((s)=>v.resolve(t,s))},o=(t,s)=>{return("/"+v.relative(t,s).replace(/\\/g,"/").replace(/\.(js|jsx)$/,"").replace(/\/index$/,"").replace(/^index$/,"")).replace(/\/+/g,"/").replace(/\[\.\.\.([^\]]+)\]/g,"*").replace(/\[([^\]]+)\]/g,":$1").replace(/\/$/,"")||"/"};return{name:"sigpro-router",resolveId(t){if(t==="virtual:sigpro-routes")return n},load(t){if(t!==n)return;let s=process.cwd(),l=v.resolve(s,e),u=i(l).sort((g,m)=>{let a=o(l,g),h=o(l,m);if(a.includes(":")&&!h.includes(":"))return 1;if(!a.includes(":")&&h.includes(":"))return-1;return h.length-a.length}),c="",f="";return u.forEach((g,m)=>{let a=o(l,g),h="/"+v.relative(s,g).replace(/\\/g,"/"),C=`Page${m}`;c+=`import ${C} from '${h}';
2
+ `,f+=` { path: '${a}', component: ${C} },
3
+ `}),f+=` { path: '*', component: () => { const d = document.createElement('div'); d.className = 'not-found'; d.textContent = '404 - Not Found'; return d; } },
4
+ `,`${c}
5
+ export const routes = [
6
+ ${f}];`}}}export{B as sigproRouter};
package/package.json CHANGED
@@ -1,56 +1,85 @@
1
1
  {
2
2
  "name": "sigpro",
3
- "version": "1.1.20",
3
+ "version": "2.0.3",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
- "main": "./dist/sigpro.esm.min.js",
7
- "module": "./dist/sigpro.esm.min.js",
8
- "unpkg": "./dist/sigpro.min.js",
9
- "jsdelivr": "./dist/sigpro.min.js",
6
+ "author": {
7
+ "name": "NatxoCC",
8
+ "email": "sigpro@natxocc.com",
9
+ "url": "https://sigpro.natxocc.com"
10
+ },
11
+ "main": "./dist/sigpro.js",
12
+ "module": "./dist/sigpro.js",
13
+ "unpkg": "./dist/sigpro.js",
14
+ "jsdelivr": "./dist/sigpro.js",
15
+ "types": "./sigpro.d.ts",
10
16
  "exports": {
11
17
  ".": {
12
- "development": "./index.js",
13
- "import": "./dist/sigpro.esm.min.js",
14
- "script": "./dist/sigpro.js",
15
- "types": "./sigpro/sigpro.d.ts"
18
+ "types": "./sigpro.d.ts",
19
+ "import": "./dist/sigpro.js",
20
+ "default": "./dist/sigpro.js"
21
+ },
22
+ "./grid": {
23
+ "import": "./dist/sigpro.grid.js",
24
+ "default": "./dist/sigpro.grid.js"
16
25
  },
17
- "./vite": "./vite/index.js",
18
- "./vite/*": "./vite/*.js"
26
+ "./editor": {
27
+ "import": "./dist/sigpro.editor.js",
28
+ "default": "./dist/sigpro.editor.js"
29
+ },
30
+ "./vite": {
31
+ "import": "./dist/sigpro.vite.js",
32
+ "default": "./dist/sigpro.vite.js"
33
+ }
19
34
  },
20
35
  "files": [
21
- "index.js",
22
- "dist",
23
- "sigpro",
24
- "vite",
36
+ "dist/",
25
37
  "README.md",
26
- "LICENSE"
38
+ "LICENSE",
39
+ "sigpro.d.ts"
27
40
  ],
28
- "homepage": "https://natxocc.github.io/sigpro/",
41
+ "homepage": "https://sigpro.natxocc.com/#/",
29
42
  "repository": {
30
43
  "type": "git",
31
- "url": "https://github.com/natxocc/sigpro.git"
44
+ "url": "https://github.com/natxocc/sigpro"
32
45
  },
33
46
  "bugs": {
34
- "url": "https://github.com/natxocc/sigpro/issues"
47
+ "url": "https://github.com/natxocc/sigpro/issues",
48
+ "email": "sigpro@natxocc.com"
35
49
  },
36
50
  "scripts": {
37
- "clean": "rm -rf dist",
38
- "prebuild": "npm run clean",
39
- "build:iife": "bun build ./index.js --bundle --outfile=./dist/sigpro.js --format=iife --global-name=SigPro",
40
- "build:iife:min": "bun build ./index.js --bundle --outfile=./dist/sigpro.min.js --format=iife --global-name=SigPro --minify",
41
- "build:esm": "bun build ./index.js --bundle --outfile=./dist/sigpro.esm.js --format=esm",
42
- "build:esm:min": "bun build ./index.js --bundle --outfile=./dist/sigpro.esm.min.js --format=esm --minify",
43
- "build": "npm run build:iife && npm run build:iife:min && npm run build:esm && npm run build:esm:min",
44
- "docs": "bun x serve docs",
45
- "prepublishOnly": "npm run build"
51
+ "del": "bun pm cache rm && rm -f bun.lockb && rm -f bun.lock",
52
+ "clean": "rm -rf dist docs/*.js",
53
+ "prebuild": "bun run clean",
54
+ "build:core": "bun build ./src/sigpro.js --bundle --outfile=./dist/sigpro.js --format=esm --minify",
55
+ "build:grid": "bun build ./src/sigpro.grid.js --bundle --outfile=./dist/sigpro.grid.js --format=esm --minify",
56
+ "build:editor": "bun build ./src/sigpro.editor.js --bundle --outfile=./dist/sigpro.editor.js --format=esm --minify",
57
+ "build:vite": "bun build ./src/sigpro.vite.js --bundle --outfile=./dist/sigpro.vite.js --format=esm --external fs --external path --minify",
58
+ "build:convert": "bun build ./src/sigpro.convert.js --bundle --outfile=./dist/sigpro.convert.js --format=esm --minify",
59
+ "build": "mkdir -p docs && bun run build:core && bun run build:grid && bun run build:editor && bun run build:vite && bun run build:convert && cp ./dist/*.js ./docs/",
60
+ "docs": "bun x serve docs"
61
+ },
62
+ "devDependencies": {
63
+ "@iconify/json": "^2.2.473",
64
+ "@iconify/tailwind4": "^1.2.3",
65
+ "@tailwindcss/cli": "^4.3.0",
66
+ "daisyui": "^5.5.19",
67
+ "tailwindcss": "^4.3.0",
68
+ "ag-grid-community": "^35.3.0"
46
69
  },
47
70
  "keywords": [
48
71
  "signals",
72
+ "reactivity",
49
73
  "reactive",
50
- "web-components",
51
- "vanilla-js",
52
- "reactive-programming",
53
- "signals-library",
54
- "fine-grained-reactivity"
74
+ "pure",
75
+ "vanilla",
76
+ "js",
77
+ "ui",
78
+ "dom",
79
+ "state",
80
+ "frontend",
81
+ "spa",
82
+ "lightweight",
83
+ "sigpro"
55
84
  ]
56
85
  }