yvee 0.0.5 → 0.0.7
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/LICENSE +1 -1
- package/dist/index.d.ts +293 -187
- package/dist/index.js +1 -1
- package/package.json +4 -12
package/LICENSE
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,48 @@
|
|
|
1
|
+
declare const isFN: (v: any) => v is Function;
|
|
2
|
+
declare const isAsync: (v: any) => v is Function;
|
|
3
|
+
declare const isPromise: (v: any) => v is Function;
|
|
4
|
+
declare const isNumber: (value: any) => boolean;
|
|
5
|
+
declare const isPlainObject: (value: any) => boolean;
|
|
6
|
+
declare const isArraybuff: (val: any) => val is string | ArrayBuffer | Uint8Array<ArrayBufferLike>;
|
|
7
|
+
declare const isClassOrId: (k: string) => boolean;
|
|
8
|
+
declare const isBool: (v: any) => v is boolean;
|
|
9
|
+
declare const isStr: (v: any) => v is string;
|
|
10
|
+
declare const isArr: (v: any) => v is any[];
|
|
11
|
+
declare const isObj: (v: any) => v is object;
|
|
12
|
+
declare const isNum: (v: any) => v is number;
|
|
13
|
+
declare const isNull: (v: any) => v is null;
|
|
14
|
+
declare const isNotNull: <T>(v: T) => v is Exclude<T, null>;
|
|
15
|
+
declare const isUndefined: (v: any) => v is undefined;
|
|
16
|
+
declare const isDefined: <T>(v: T) => v is Exclude<T, undefined>;
|
|
17
|
+
declare const isInt: (str: string) => boolean;
|
|
18
|
+
declare const isWindow: boolean;
|
|
19
|
+
declare const isNotWindow: boolean;
|
|
20
|
+
|
|
21
|
+
declare const is_isArr: typeof isArr;
|
|
22
|
+
declare const is_isArraybuff: typeof isArraybuff;
|
|
23
|
+
declare const is_isAsync: typeof isAsync;
|
|
24
|
+
declare const is_isBool: typeof isBool;
|
|
25
|
+
declare const is_isClassOrId: typeof isClassOrId;
|
|
26
|
+
declare const is_isDefined: typeof isDefined;
|
|
27
|
+
declare const is_isFN: typeof isFN;
|
|
28
|
+
declare const is_isInt: typeof isInt;
|
|
29
|
+
declare const is_isNotNull: typeof isNotNull;
|
|
30
|
+
declare const is_isNotWindow: typeof isNotWindow;
|
|
31
|
+
declare const is_isNull: typeof isNull;
|
|
32
|
+
declare const is_isNum: typeof isNum;
|
|
33
|
+
declare const is_isNumber: typeof isNumber;
|
|
34
|
+
declare const is_isObj: typeof isObj;
|
|
35
|
+
declare const is_isPlainObject: typeof isPlainObject;
|
|
36
|
+
declare const is_isPromise: typeof isPromise;
|
|
37
|
+
declare const is_isStr: typeof isStr;
|
|
38
|
+
declare const is_isUndefined: typeof isUndefined;
|
|
39
|
+
declare const is_isWindow: typeof isWindow;
|
|
40
|
+
declare namespace is {
|
|
41
|
+
export { is_isArr as isArr, is_isArraybuff as isArraybuff, is_isAsync as isAsync, is_isBool as isBool, is_isClassOrId as isClassOrId, is_isDefined as isDefined, is_isFN as isFN, is_isInt as isInt, is_isNotNull as isNotNull, is_isNotWindow as isNotWindow, is_isNull as isNull, is_isNum as isNum, is_isNumber as isNumber, is_isObj as isObj, is_isPlainObject as isPlainObject, is_isPromise as isPromise, is_isStr as isStr, is_isUndefined as isUndefined, is_isWindow as isWindow };
|
|
42
|
+
}
|
|
43
|
+
|
|
1
44
|
type V = string | number | boolean;
|
|
2
|
-
type obj<T> = Record<string, T>;
|
|
45
|
+
type obj$1<T> = Record<string, T>;
|
|
3
46
|
|
|
4
47
|
/**
|
|
5
48
|
* A custom Map implementation that provides additional utility methods for working with objects and maps.
|
|
@@ -15,8 +58,10 @@ declare class Mapper<K, V> extends Map<K, V> {
|
|
|
15
58
|
init(key: K, val: V): V;
|
|
16
59
|
}
|
|
17
60
|
|
|
18
|
-
declare class
|
|
19
|
-
static set
|
|
61
|
+
declare class log {
|
|
62
|
+
static set i(a: any);
|
|
63
|
+
static set e(a: any);
|
|
64
|
+
static set w(a: any);
|
|
20
65
|
}
|
|
21
66
|
declare class idm {
|
|
22
67
|
_c: number;
|
|
@@ -72,7 +117,7 @@ declare class Meta {
|
|
|
72
117
|
themeColor(color: string): this;
|
|
73
118
|
openGraph(og: Omit<OG, "card">): this;
|
|
74
119
|
twitter(og: OG): this;
|
|
75
|
-
|
|
120
|
+
push(metas: meta$1<string>[]): void;
|
|
76
121
|
private set meta(value);
|
|
77
122
|
}
|
|
78
123
|
|
|
@@ -98,9 +143,9 @@ type link<T> = {
|
|
|
98
143
|
crossorigin?: T;
|
|
99
144
|
};
|
|
100
145
|
type impmap = {
|
|
101
|
-
imports?: obj<string>;
|
|
102
|
-
scopes?: obj<string>;
|
|
103
|
-
integrity?: obj<string>;
|
|
146
|
+
imports?: obj$1<string>;
|
|
147
|
+
scopes?: obj$1<string>;
|
|
148
|
+
integrity?: obj$1<string>;
|
|
104
149
|
};
|
|
105
150
|
type script<T> = {
|
|
106
151
|
async?: T;
|
|
@@ -125,6 +170,8 @@ interface headAttr {
|
|
|
125
170
|
meta?: meta<string>[] | Meta;
|
|
126
171
|
link?: link<string>[];
|
|
127
172
|
script?: script<string | boolean>[];
|
|
173
|
+
css?: string[] | string;
|
|
174
|
+
description?: string;
|
|
128
175
|
}
|
|
129
176
|
declare class head implements headAttr {
|
|
130
177
|
title?: string;
|
|
@@ -143,7 +190,7 @@ type CSSinT$1 = {
|
|
|
143
190
|
type headType = Mapper<keyof head, any>;
|
|
144
191
|
declare class htmlHead {
|
|
145
192
|
lang: string;
|
|
146
|
-
|
|
193
|
+
htmlHead: headType;
|
|
147
194
|
head: (heads?: headAttr) => void;
|
|
148
195
|
constructor();
|
|
149
196
|
}
|
|
@@ -163,6 +210,8 @@ declare class MinStorage {
|
|
|
163
210
|
*/
|
|
164
211
|
declare class Storage$1<T extends MinStorage> {
|
|
165
212
|
private _storage;
|
|
213
|
+
private CC;
|
|
214
|
+
constructor();
|
|
166
215
|
set(min: T): void;
|
|
167
216
|
get(path: string): [T | undefined, Record<string, string>];
|
|
168
217
|
}
|
|
@@ -176,8 +225,9 @@ declare class __ {
|
|
|
176
225
|
inner?: any;
|
|
177
226
|
}): HTMLElement;
|
|
178
227
|
static randFrom(arr: any[] | Object): any;
|
|
228
|
+
static randomAZ: () => string;
|
|
179
229
|
static makeID: (length: number) => string;
|
|
180
|
-
static
|
|
230
|
+
static class(a: obj$1<any>, classes: string[]): void;
|
|
181
231
|
static get O(): {
|
|
182
232
|
vals: {
|
|
183
233
|
<T>(o: {
|
|
@@ -204,6 +254,23 @@ declare class __ {
|
|
|
204
254
|
};
|
|
205
255
|
len: (obj?: {}) => number;
|
|
206
256
|
};
|
|
257
|
+
static get is(): typeof is;
|
|
258
|
+
static get return(): typeof returner;
|
|
259
|
+
static sleep: (ms?: number) => Promise<unknown>;
|
|
260
|
+
static get screen(): "xs" | "sm" | "smd" | "md" | "lg" | "xl" | "xxl" | undefined;
|
|
261
|
+
bytes(bytes: number): string;
|
|
262
|
+
static format(val: any): Formatteer;
|
|
263
|
+
}
|
|
264
|
+
declare class returner {
|
|
265
|
+
static arr(val: any): any[];
|
|
266
|
+
static num(val: any, iferr?: any): number;
|
|
267
|
+
}
|
|
268
|
+
declare class Formatteer {
|
|
269
|
+
val: any;
|
|
270
|
+
constructor(val: any);
|
|
271
|
+
get px(): string;
|
|
272
|
+
get rem(): string;
|
|
273
|
+
get pr(): string;
|
|
207
274
|
}
|
|
208
275
|
|
|
209
276
|
declare class CATT {
|
|
@@ -241,7 +308,7 @@ declare class eStream {
|
|
|
241
308
|
stream: EventSource;
|
|
242
309
|
url: string;
|
|
243
310
|
constructor(eurl: string, withCredentials: boolean);
|
|
244
|
-
on(event: obj<(a: MessageEvent) => void>): this;
|
|
311
|
+
on(event: obj$1<(a: MessageEvent) => void>): this;
|
|
245
312
|
}
|
|
246
313
|
declare function eventStream(url: string, withCredentials?: boolean): eStream;
|
|
247
314
|
|
|
@@ -254,14 +321,14 @@ declare class __I {
|
|
|
254
321
|
get bool(): boolean | null;
|
|
255
322
|
get json(): any | null;
|
|
256
323
|
}
|
|
257
|
-
|
|
324
|
+
type storeValTypes = keyof __I;
|
|
325
|
+
declare class storageInterface<T> {
|
|
258
326
|
key: string;
|
|
259
|
-
|
|
327
|
+
state: Stateful<T> | null;
|
|
260
328
|
storage: Storage;
|
|
261
|
-
constructor(item: obj<
|
|
329
|
+
constructor(item: obj$1<Stateful<T>> | string, _type?: "local" | "session", init?: storeValTypes);
|
|
262
330
|
get as(): __I;
|
|
263
331
|
get value(): string | null;
|
|
264
|
-
get save(): void;
|
|
265
332
|
set set(val: any);
|
|
266
333
|
get remove(): void;
|
|
267
334
|
}
|
|
@@ -270,45 +337,155 @@ declare class storageInterface {
|
|
|
270
337
|
* Local Storage
|
|
271
338
|
*/
|
|
272
339
|
declare const local: {
|
|
273
|
-
get: (item: obj<
|
|
340
|
+
get: <T>(item: obj$1<Stateful<T>> | string) => storageInterface<T>;
|
|
341
|
+
init: <T>(item: obj$1<Stateful<T>>, as: storeValTypes) => storageInterface<T>;
|
|
274
342
|
};
|
|
275
343
|
|
|
276
344
|
/**
|
|
277
345
|
* Session Storage
|
|
278
346
|
*/
|
|
279
347
|
declare const session: {
|
|
280
|
-
get: (item: obj<
|
|
348
|
+
get: <T>(item: obj$1<Stateful<T>> | string) => storageInterface<T>;
|
|
281
349
|
};
|
|
282
350
|
|
|
283
|
-
|
|
351
|
+
type kf = KeyframeAnimationOptions;
|
|
352
|
+
type KFType = (CSSinT | obj$1<V>)[] | CSSinT | obj$1<V>;
|
|
353
|
+
declare class anim {
|
|
354
|
+
private e;
|
|
355
|
+
opt: kf;
|
|
356
|
+
constructor(e: Elem);
|
|
357
|
+
animate(keyframes: CSSinT[] | CSSinT, options?: kf): Elem<HTMLElement>;
|
|
358
|
+
get slide(): {
|
|
359
|
+
left: (options?: kf) => anim;
|
|
360
|
+
right: (options?: kf) => anim;
|
|
361
|
+
up: (options?: kf) => anim;
|
|
362
|
+
down: (options?: kf) => anim;
|
|
363
|
+
};
|
|
364
|
+
fade(options?: kf): this;
|
|
365
|
+
shake(XorY?: string, opt?: kf): this;
|
|
366
|
+
color(c?: string[], opt?: kf): this;
|
|
367
|
+
bg(c?: string | string[], opt?: kf): this;
|
|
368
|
+
bounce(sVal?: number, opt?: kf): this;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
declare class Eget<T extends Elements = HTMLElement> {
|
|
372
|
+
e: T;
|
|
373
|
+
query?: string | undefined;
|
|
374
|
+
constructor(e: T, query?: string | undefined);
|
|
375
|
+
get a(): anim;
|
|
376
|
+
get all(): T[];
|
|
377
|
+
get attr(): {
|
|
378
|
+
has: (attr: string) => boolean;
|
|
379
|
+
get: (attr: string) => string | null;
|
|
380
|
+
del: (attr: string) => Eget<T>;
|
|
381
|
+
set: (attrs: obj$1<any>) => Eget<T>;
|
|
382
|
+
};
|
|
383
|
+
get children(): Elem<T>[];
|
|
384
|
+
get click(): this;
|
|
385
|
+
get delete(): this;
|
|
386
|
+
get disabled(): boolean;
|
|
387
|
+
get focus(): this;
|
|
388
|
+
get href(): string;
|
|
389
|
+
get id(): string;
|
|
390
|
+
get inner(): string;
|
|
391
|
+
get offsetParent(): Elem | undefined;
|
|
392
|
+
get parent(): Elem | undefined;
|
|
393
|
+
get hash(): string;
|
|
394
|
+
get path(): string;
|
|
395
|
+
get rect(): DOMRect;
|
|
396
|
+
get remove_element(): this;
|
|
397
|
+
get style(): {
|
|
398
|
+
set: (style: CSSinT | obj$1<V | null>, delayOrFN?: number | ((e?: any) => void)) => Elem<HTMLElement>;
|
|
399
|
+
get: (prop: keyof CSSStyleDeclaration | string) => string;
|
|
400
|
+
del: (...props: (keyof CSSStyleDeclaration | string)[]) => void;
|
|
401
|
+
};
|
|
402
|
+
get submit(): any;
|
|
403
|
+
get tag(): string;
|
|
404
|
+
get value(): any;
|
|
405
|
+
get unload(): () => void;
|
|
406
|
+
set append(val: any);
|
|
407
|
+
set appendfirst(val: any);
|
|
408
|
+
set inner(val: any);
|
|
409
|
+
set disabled(vl: boolean);
|
|
410
|
+
set id(did: string);
|
|
411
|
+
set value(vl: any);
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
type fn<E, T> = (e?: E) => T;
|
|
415
|
+
declare class Elem<T extends Elements = HTMLElement> extends Eget<T> {
|
|
416
|
+
constructor(e: T, query?: string);
|
|
417
|
+
add(...className: string[]): this;
|
|
418
|
+
remove(...className: string[]): this;
|
|
419
|
+
toggle(className: string | fn<any, string>, force?: boolean): this;
|
|
420
|
+
has(e: any | null): boolean;
|
|
421
|
+
insert(position: InsertPosition): {
|
|
422
|
+
HTML: (...text: string[]) => Elem<T>;
|
|
423
|
+
element: (...elem: HTMLElement[]) => Elem<T>;
|
|
424
|
+
text: (this: Elem<T>, ...text: string[]) => Elem<T>;
|
|
425
|
+
};
|
|
426
|
+
is(tp: {
|
|
427
|
+
dom?: string;
|
|
428
|
+
class?: string | string[];
|
|
429
|
+
}): boolean;
|
|
430
|
+
on(event: keyof events, handler: (e?: any) => void, useCapture?: boolean): this;
|
|
431
|
+
remove_on(event: keyof DocumentEventMap, handler: EventListenerOrEventListenerObject, useCapture?: boolean): this;
|
|
432
|
+
timed(fn: (ee?: Elem<T>) => void, timeout?: number): this;
|
|
433
|
+
animate(keyframes: KFType, options?: kf, onComplete?: fn<any, void>): this;
|
|
434
|
+
animate(keyframes: KFType, onComplete?: fn<any, void>): this;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
interface CLI {
|
|
438
|
+
id?: string;
|
|
439
|
+
class?: string;
|
|
440
|
+
}
|
|
441
|
+
declare function $<T extends Elements = HTMLElement>(query: CLI): Elem<T> | undefined;
|
|
442
|
+
declare function $<T extends Elements = HTMLElement>(query: string): Elem<T> | undefined;
|
|
443
|
+
declare function $<T extends Elements = HTMLElement>(element: T): Elem<T>;
|
|
444
|
+
type _$<T extends Elements = HTMLElement> = Elem<T> | undefined;
|
|
445
|
+
type $E<T extends Elements = HTMLElement> = Elem<T>;
|
|
446
|
+
declare class Ref<T extends Elements = HTMLElement> {
|
|
447
|
+
state: Stateful<_$<T>>;
|
|
448
|
+
constructor();
|
|
449
|
+
get element(): T | undefined;
|
|
450
|
+
set element(elem: T | undefined);
|
|
451
|
+
get $(): _$<T>;
|
|
452
|
+
}
|
|
453
|
+
declare const useRef: <T extends Elements = HTMLElement>() => Ref<T>;
|
|
454
|
+
|
|
455
|
+
declare class doc<T extends {
|
|
456
|
+
args?: Record<string, any>;
|
|
457
|
+
data?: Record<string, any>;
|
|
458
|
+
} = Record<string, any>> extends head {
|
|
284
459
|
path: string;
|
|
285
|
-
args: T;
|
|
460
|
+
args: T["args"];
|
|
286
461
|
id: string;
|
|
287
462
|
status: number;
|
|
288
463
|
lang?: string;
|
|
289
464
|
import?: any;
|
|
290
|
-
_data: T;
|
|
291
|
-
|
|
292
|
-
|
|
465
|
+
_data: T["data"];
|
|
466
|
+
static route: string;
|
|
467
|
+
constructor(path: string, args: T["args"] | undefined, id: string, status?: number);
|
|
468
|
+
fetch?(): Promise<Record<string, any>>;
|
|
293
469
|
head?(): Promise<void> | void;
|
|
294
470
|
body?(): Promise<Dom> | Dom;
|
|
295
471
|
loader(): Promise<any[]>;
|
|
296
472
|
getHeadAttr(head?: headAttr, ...toMap: headType[]): headType;
|
|
297
|
-
set data(data: obj<any>);
|
|
298
|
-
get data(): T;
|
|
473
|
+
set data(data: obj$1<any>);
|
|
474
|
+
get data(): T["data"];
|
|
299
475
|
}
|
|
300
476
|
|
|
301
|
-
declare class websocket<T = Record<string,
|
|
477
|
+
declare class websocket<T = Record<string, any>> {
|
|
302
478
|
path: string;
|
|
303
|
-
args: T;
|
|
479
|
+
protected args: T;
|
|
304
480
|
ws: WebSocket;
|
|
481
|
+
static route: string;
|
|
305
482
|
isConnected: Stateful<boolean>;
|
|
306
483
|
data: T;
|
|
307
484
|
constructor(path: string, args?: T);
|
|
308
|
-
open(event: Event): Promise<void> | void;
|
|
309
|
-
message(event: MessageEvent): Promise<void> | void;
|
|
310
|
-
close(event: CloseEvent): Promise<void> | void;
|
|
311
|
-
error(event: Event): Promise<void> | void;
|
|
485
|
+
protected open(event: Event): Promise<void> | void;
|
|
486
|
+
protected message(event: MessageEvent): Promise<void> | void;
|
|
487
|
+
protected close(event: CloseEvent): Promise<void> | void;
|
|
488
|
+
protected error(event: Event): Promise<void> | void;
|
|
312
489
|
get connect(): this;
|
|
313
490
|
get reconnect(): this;
|
|
314
491
|
get disconnect(): this;
|
|
@@ -323,54 +500,74 @@ declare class websocket<T = Record<string, string>> {
|
|
|
323
500
|
set send(message: string | ArrayBufferLike | Blob | ArrayBufferView);
|
|
324
501
|
}
|
|
325
502
|
declare class socket {
|
|
326
|
-
|
|
327
|
-
constructor(
|
|
503
|
+
protected yvee: Pager;
|
|
504
|
+
constructor(yvee: Pager);
|
|
328
505
|
load(_path: string): Promise<websocket<{}> | undefined>;
|
|
329
506
|
unload(_path: string): void;
|
|
330
507
|
}
|
|
331
508
|
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
classes?: string | string[];
|
|
335
|
-
}
|
|
336
|
-
declare class Router extends minClient {
|
|
337
|
-
private isYRA;
|
|
338
|
-
protected unload: boolean;
|
|
509
|
+
declare class Pager extends minClient {
|
|
510
|
+
protected config: routerCfg;
|
|
339
511
|
protected hook?: () => void;
|
|
340
512
|
protected root: Stateful<ctx[]>;
|
|
341
|
-
|
|
513
|
+
socket: socket;
|
|
342
514
|
id: string;
|
|
343
515
|
path: Stateful<string>;
|
|
516
|
+
lastPath: Stateful<string>;
|
|
517
|
+
loading: Stateful<boolean>;
|
|
518
|
+
mainElement?: HTMLElement;
|
|
344
519
|
A: (a: attr & {
|
|
345
520
|
href: string;
|
|
521
|
+
topRef?: Stateful<_$>;
|
|
522
|
+
top?: number | (() => number);
|
|
346
523
|
}, ...D: ctx[]) => Dom;
|
|
347
|
-
Main: (a: attr
|
|
348
|
-
load?: string;
|
|
349
|
-
}) => Dom;
|
|
524
|
+
Main: (a: attr) => Dom;
|
|
350
525
|
load: (path?: string, data?: obj<string>) => Promise<this>;
|
|
351
|
-
|
|
526
|
+
matchPath: (str: string) => boolean;
|
|
527
|
+
protected isYvee: boolean;
|
|
528
|
+
constructor(config?: routerCfg, events?: events);
|
|
352
529
|
protected hooker(): void;
|
|
353
|
-
protected class(this:
|
|
530
|
+
protected class(this: Pager, _path: string, _error: number, isError?: boolean): Promise<doc<{}>>;
|
|
354
531
|
protected fetch(CL?: doc<{}>): Promise<void>;
|
|
355
532
|
protected processHead(CL?: doc<{}>, head?: headAttr): Promise<headType>;
|
|
356
533
|
private processClassHead;
|
|
357
534
|
private processDefaultHead;
|
|
358
|
-
|
|
535
|
+
render(_path: string, _error?: number, data?: obj<string>, head?: headAttr, isClient?: boolean, isError?: boolean): Promise<{
|
|
359
536
|
lang: string;
|
|
360
537
|
heads: headType;
|
|
361
538
|
done: boolean;
|
|
362
539
|
}>;
|
|
363
540
|
}
|
|
364
|
-
|
|
541
|
+
|
|
542
|
+
declare function pushHistory(path?: string, title?: string): void;
|
|
543
|
+
|
|
544
|
+
interface routerCfg {
|
|
545
|
+
classes?: string | string[];
|
|
546
|
+
id?: string;
|
|
547
|
+
base?: string;
|
|
548
|
+
}
|
|
549
|
+
interface yveeCfg extends routerCfg {
|
|
550
|
+
pushState?: boolean;
|
|
551
|
+
}
|
|
552
|
+
declare class Yvee extends Pager {
|
|
553
|
+
protected config: yveeCfg;
|
|
554
|
+
protected isYvee: boolean;
|
|
365
555
|
protected unload: boolean;
|
|
366
|
-
constructor(
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
556
|
+
constructor(config?: yveeCfg, events?: events);
|
|
557
|
+
}
|
|
558
|
+
declare const Routes: (fn: (Yvee: Yvee) => void) => (Yvee: Yvee) => void;
|
|
559
|
+
interface headAttrPlus {
|
|
560
|
+
route?: string;
|
|
561
|
+
base?: string;
|
|
562
|
+
index?: string;
|
|
563
|
+
id?: string;
|
|
564
|
+
bodyattr?: obj$1<V>;
|
|
565
|
+
data?: Record<string, any> | (() => Promise<Record<string, any>> | Record<string, any>);
|
|
373
566
|
}
|
|
567
|
+
type headFN<T = {}> = (a: Record<string, any> & T) => Promise<headAttr> | headAttr;
|
|
568
|
+
type ND<T = Record<string, any>> = (a: renderConfig & T) => Dom | Promise<Dom>;
|
|
569
|
+
declare function Render<T = Record<string, any>>(DOM: ND<T>, head?: headAttr | headFN<T>, cfg?: headAttrPlus): Promise<({ path, data, status }: serverRender) => Promise<string>>;
|
|
570
|
+
declare function Render<T = Record<string, any>>(DOM: ND<T>, App: Yvee): Promise<({ path, data, status }: serverRender) => Promise<string>>;
|
|
374
571
|
|
|
375
572
|
declare class ClientPath extends MinStorage {
|
|
376
573
|
id: string;
|
|
@@ -383,8 +580,6 @@ declare class SocketPath extends MinStorage {
|
|
|
383
580
|
constructor(path: string, id: string, cls: typeof websocket<{}>);
|
|
384
581
|
}
|
|
385
582
|
declare class minClient extends htmlHead {
|
|
386
|
-
protected ImportMeta: ImportMeta;
|
|
387
|
-
protected config: yveeCfg;
|
|
388
583
|
protected storage: Storage$1<ClientPath>;
|
|
389
584
|
protected errorStorage: Storage$1<ClientPath>;
|
|
390
585
|
protected wssStorage: Storage$1<SocketPath>;
|
|
@@ -395,20 +590,22 @@ declare class minClient extends htmlHead {
|
|
|
395
590
|
route: (path: string) => <Q extends typeof doc<{}>>(f: Q) => Q;
|
|
396
591
|
error: (...codes: number[]) => <Q extends typeof doc<{}>>(f: Q) => Q;
|
|
397
592
|
wss: (path: string) => <Q extends typeof websocket<{}>>(f: Q) => Q;
|
|
398
|
-
|
|
593
|
+
base: string;
|
|
594
|
+
constructor(base?: string);
|
|
595
|
+
protected _base(str: string): string;
|
|
399
596
|
protected getPath(path: string): Promise<[ClientPath | undefined, Record<string, string>]>;
|
|
400
597
|
protected loadError(code: number): Promise<[ClientPath | undefined, Record<string, string>]>;
|
|
401
598
|
protected loadWSS(path: string): Promise<[SocketPath | undefined, Record<string, string>]>;
|
|
402
599
|
}
|
|
403
600
|
|
|
404
|
-
type Elements = HTMLElementTagNameMap[keyof HTMLElementTagNameMap];
|
|
601
|
+
type Elements = HTMLElementTagNameMap[keyof HTMLElementTagNameMap] | SVGElementTagNameMap[keyof SVGElementTagNameMap];
|
|
405
602
|
|
|
406
603
|
type hookFN<T extends any[]> = (...args: statefulValue<T>) => void;
|
|
407
604
|
interface stateCFG {
|
|
408
605
|
id?: string;
|
|
409
606
|
init?: boolean;
|
|
410
607
|
}
|
|
411
|
-
declare function
|
|
608
|
+
declare function StateHook<T extends any[]>(callback: hookFN<T>, statefuls: [...{
|
|
412
609
|
[K in keyof T]: Stateful<T[K]>;
|
|
413
610
|
}], { id, init }?: stateCFG): () => void;
|
|
414
611
|
|
|
@@ -429,31 +626,33 @@ declare class Stateful<T> extends EventTarget {
|
|
|
429
626
|
call<Q>(callback: (this: Elements, arg: T) => Q, entry: string): (id: string) => () => void;
|
|
430
627
|
hook<T extends any[]>(callback: hookFN<T>): (id: string) => () => void;
|
|
431
628
|
}
|
|
432
|
-
declare function State<T>(value: T): Stateful<T>;
|
|
629
|
+
declare function State<T>(value: T, options?: AddEventListenerOptions): Stateful<T>;
|
|
433
630
|
|
|
434
631
|
type X2 = V | V[];
|
|
435
|
-
type X3 = X2 | Stateful<X2
|
|
632
|
+
type X3 = X2 | Stateful<X2> | null | undefined;
|
|
436
633
|
type CSSinT = {
|
|
437
634
|
[P in keyof CSSStyleDeclaration]?: X3;
|
|
438
635
|
} & {
|
|
439
636
|
[key: string]: X3;
|
|
440
637
|
};
|
|
441
|
-
interface c_events {
|
|
442
|
-
|
|
443
|
-
ready?: (this:
|
|
444
|
-
resize?: (this:
|
|
445
|
-
beforeunload?: (this:
|
|
446
|
-
popstate?: (this:
|
|
447
|
-
winscroll?: (this:
|
|
448
|
-
winload?: (this:
|
|
449
|
-
winfocus?: (this:
|
|
450
|
-
winblur?: (this:
|
|
451
|
-
}
|
|
638
|
+
interface c_events<T extends Elements = HTMLElement> {
|
|
639
|
+
state?: (this: T, e: T) => [(...args: any[]) => void, Stateful<any>[], boolean?];
|
|
640
|
+
ready?: (this: T, e: T) => void;
|
|
641
|
+
resize?: (this: T, e: UIEvent) => void;
|
|
642
|
+
beforeunload?: (this: T, e: BeforeUnloadEvent) => void;
|
|
643
|
+
popstate?: (this: T, e: PopStateEvent) => void;
|
|
644
|
+
winscroll?: (this: T, e: Event) => void;
|
|
645
|
+
winload?: (this: T, e: Event) => void;
|
|
646
|
+
winfocus?: (this: T, e: Event) => void;
|
|
647
|
+
winblur?: (this: T, e: Event) => void;
|
|
648
|
+
}
|
|
649
|
+
type XU4 = V | undefined | XU4[];
|
|
452
650
|
interface baseAttr {
|
|
453
|
-
style?: CSSinT;
|
|
454
|
-
on?: events
|
|
651
|
+
style?: CSSinT | string;
|
|
652
|
+
on?: events<any>;
|
|
455
653
|
id?: string;
|
|
456
|
-
class?:
|
|
654
|
+
class?: XU4 | Stateful<X2>;
|
|
655
|
+
ref?: Ref;
|
|
457
656
|
}
|
|
458
657
|
declare class Dom {
|
|
459
658
|
tag: string;
|
|
@@ -469,121 +668,21 @@ declare class Dom {
|
|
|
469
668
|
declare function dom(tag: string | ((attr: attr, ...ctx: ctx[]) => Dom), attr?: attr | null, ...ctx: ctx[]): Dom;
|
|
470
669
|
declare const frag: (attr: attr, ...dom: Dom[]) => Dom[];
|
|
471
670
|
|
|
472
|
-
type kf = KeyframeAnimationOptions;
|
|
473
|
-
type KFType = (CSSinT | obj<V>)[] | CSSinT | obj<V>;
|
|
474
|
-
declare class anim {
|
|
475
|
-
private e;
|
|
476
|
-
opt: kf;
|
|
477
|
-
constructor(e: Elem);
|
|
478
|
-
animate(keyframes: CSSinT[] | CSSinT, options?: kf): Elem<HTMLElement>;
|
|
479
|
-
get slide(): {
|
|
480
|
-
left: (options?: kf) => anim;
|
|
481
|
-
right: (options?: kf) => anim;
|
|
482
|
-
up: (options?: kf) => anim;
|
|
483
|
-
down: (options?: kf) => anim;
|
|
484
|
-
};
|
|
485
|
-
fade(options?: kf): this;
|
|
486
|
-
shake(XorY?: string, opt?: kf): this;
|
|
487
|
-
color(c?: string[], opt?: kf): this;
|
|
488
|
-
bg(c?: string | string[], opt?: kf): this;
|
|
489
|
-
bounce(sVal?: number, opt?: kf): this;
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
declare class Eget<T extends TElem = HTMLElement> {
|
|
493
|
-
e: T;
|
|
494
|
-
query?: string | undefined;
|
|
495
|
-
constructor(e: T, query?: string | undefined);
|
|
496
|
-
get a(): anim;
|
|
497
|
-
get all(): T[];
|
|
498
|
-
get attr(): {
|
|
499
|
-
has: (attr: string) => boolean;
|
|
500
|
-
get: (attr: string) => string | null;
|
|
501
|
-
del: (attr: string) => Eget;
|
|
502
|
-
set: (attrs: obj<any>) => Eget;
|
|
503
|
-
};
|
|
504
|
-
get children(): Elem<T>[];
|
|
505
|
-
get click(): this;
|
|
506
|
-
get delete(): this;
|
|
507
|
-
get disabled(): boolean;
|
|
508
|
-
get focus(): this;
|
|
509
|
-
get href(): string;
|
|
510
|
-
get id(): string;
|
|
511
|
-
get inner(): string;
|
|
512
|
-
get offsetParent(): Elem | undefined;
|
|
513
|
-
get parent(): Elem | undefined;
|
|
514
|
-
get path(): string;
|
|
515
|
-
get rect(): DOMRect;
|
|
516
|
-
get remove_element(): this;
|
|
517
|
-
get style(): {
|
|
518
|
-
set: (style: CSSinT | obj<V | null>, delayOrFN?: number | ((e?: any) => void)) => Elem<HTMLElement>;
|
|
519
|
-
get: (prop: keyof CSSStyleDeclaration | string) => string;
|
|
520
|
-
del: (...props: (keyof CSSStyleDeclaration | string)[]) => void;
|
|
521
|
-
};
|
|
522
|
-
get submit(): any;
|
|
523
|
-
get tag(): string;
|
|
524
|
-
get value(): any;
|
|
525
|
-
get unload(): () => void;
|
|
526
|
-
set append(val: any);
|
|
527
|
-
set appendfirst(val: any);
|
|
528
|
-
set inner(val: any);
|
|
529
|
-
set disabled(vl: boolean);
|
|
530
|
-
set id(did: string);
|
|
531
|
-
set value(vl: any);
|
|
532
|
-
}
|
|
533
|
-
|
|
534
|
-
type TElem = HTMLElement & InstanceType<typeof Element>;
|
|
535
|
-
type fn<E, T> = (e?: E) => T;
|
|
536
|
-
declare class Elem<T extends TElem = HTMLElement> extends Eget {
|
|
537
|
-
constructor(e: T, query?: string);
|
|
538
|
-
add(...className: string[]): this;
|
|
539
|
-
remove(...className: string[]): this;
|
|
540
|
-
toggle(className: string | fn<any, string>, force?: boolean): this;
|
|
541
|
-
has(e: any | null): boolean;
|
|
542
|
-
insert(position: InsertPosition): {
|
|
543
|
-
HTML: (...text: string[]) => Elem;
|
|
544
|
-
element: (...elem: HTMLElement[]) => Elem;
|
|
545
|
-
text: (this: Elem, ...text: string[]) => Elem;
|
|
546
|
-
};
|
|
547
|
-
is(tp: {
|
|
548
|
-
dom?: string;
|
|
549
|
-
class?: string | string[];
|
|
550
|
-
}): boolean;
|
|
551
|
-
on(event: keyof events, handler: (e?: any) => void, useCapture?: boolean): this;
|
|
552
|
-
remove_on(event: keyof DocumentEventMap, handler: EventListenerOrEventListenerObject, useCapture?: boolean): this;
|
|
553
|
-
timed(fn: (ee?: Elem) => void, timeout?: number): this;
|
|
554
|
-
animate(keyframes: KFType, options?: kf, onComplete?: fn<any, void>): this;
|
|
555
|
-
animate(keyframes: KFType, onComplete?: fn<any, void>): this;
|
|
556
|
-
}
|
|
557
|
-
|
|
558
|
-
declare function $<T extends TElem = HTMLElement>(query: string): Elem<T> | undefined;
|
|
559
|
-
declare function $<T extends TElem = HTMLElement>(element: T): Elem<T>;
|
|
560
|
-
type _$ = Elem | undefined;
|
|
561
|
-
|
|
562
|
-
declare class ColorScheme {
|
|
563
|
-
state: Stateful<boolean>;
|
|
564
|
-
body?: HTMLElement;
|
|
565
|
-
click: () => void;
|
|
566
|
-
constructor({ toggle, initialState, }?: {
|
|
567
|
-
toggle?: string[];
|
|
568
|
-
initialState?: boolean;
|
|
569
|
-
});
|
|
570
|
-
private loader;
|
|
571
|
-
get isMatchMediaSupported(): boolean;
|
|
572
|
-
get isDark(): boolean;
|
|
573
|
-
toggle(clist: DOMTokenList, isDark: boolean, toggles: string[]): void;
|
|
574
|
-
}
|
|
575
|
-
|
|
576
671
|
declare global {
|
|
577
|
-
type events = {
|
|
578
|
-
[P in keyof GlobalEventHandlersEventMap]?: (this:
|
|
579
|
-
} & c_events
|
|
672
|
+
type events<T extends Elements = HTMLElement> = {
|
|
673
|
+
[P in keyof GlobalEventHandlersEventMap]?: (this: T, e: GlobalEventHandlersEventMap[P]) => void;
|
|
674
|
+
} & c_events<T>;
|
|
580
675
|
type attr = baseAttr | obj<X3>;
|
|
581
676
|
type ctx = V | Dom | Stateful<V | Dom> | ctx[];
|
|
582
677
|
type obj<T> = Record<string, T>;
|
|
583
|
-
type DomFN<T
|
|
678
|
+
type DomFN<T = {}> = (a: attr & T, ...D: ctx[]) => Dom;
|
|
679
|
+
const BASE_STRING: string;
|
|
584
680
|
namespace JSX {
|
|
585
681
|
type Element = Dom;
|
|
586
682
|
interface IntrinsicElements {
|
|
683
|
+
link: attr;
|
|
684
|
+
base: attr;
|
|
685
|
+
meta: attr;
|
|
587
686
|
p: attr;
|
|
588
687
|
br: attr;
|
|
589
688
|
hr: attr;
|
|
@@ -751,9 +850,16 @@ declare global {
|
|
|
751
850
|
}
|
|
752
851
|
}
|
|
753
852
|
declare const resolvePath: (base: string, relative: string) => string;
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
853
|
+
interface renderConfig {
|
|
854
|
+
path: string;
|
|
855
|
+
status: number;
|
|
856
|
+
base: string;
|
|
857
|
+
}
|
|
858
|
+
interface serverRender {
|
|
859
|
+
path: string;
|
|
860
|
+
data?: Record<string, any>;
|
|
861
|
+
status?: number;
|
|
862
|
+
}
|
|
863
|
+
declare const IfClient: <T>(fn: () => T) => T | undefined;
|
|
758
864
|
|
|
759
|
-
export { $,
|
|
865
|
+
export { $, type $E, Dom, IfClient, Meta, Pager, Ref, Render, Routes, State, StateHook, Stateful, Yvee, type _$, __, addCSS, cssLoader, doc, dom, eventStream, frag, type headAttr, local, log, pushHistory, type renderConfig, resolvePath, type serverRender, session, useRef, websocket };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var Ft=function(t,n,r,i){var o=arguments.length,e=o<3?n:i===null?i=Object.getOwnPropertyDescriptor(n,r):i,s;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")e=Reflect.decorate(t,n,r,i);else for(var u=t.length-1;u>=0;u--)if(s=t[u])e=(o<3?s(e):o>3?s(n,r,e):s(n,r))||e;return o>3&&e&&Object.defineProperty(n,r,e),e};var Zt=(t,n)=>{if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(t,n)};var x=(t)=>typeof t==="function";var R=(t)=>{return!isNaN(parseFloat(t))&&isFinite(t)},at=(t)=>{return typeof t==="object"&&t!==null&&!Array.isArray(t)},k=(t)=>{return typeof t==="object"&&t!==null&&Object.getPrototypeOf(t)===Object.prototype};var v=(t)=>typeof t==="boolean",tt=(t)=>typeof t==="string",a=(t)=>Array.isArray(t),w=(t)=>typeof t==="object",It=(t)=>typeof t==="number",C=(t)=>t===null,Xt=(t)=>typeof t==="undefined",Jt=(t)=>{return Number.isInteger(Number(t))},gt=typeof window!=="undefined",c=typeof window==="undefined";function nt(t,n){h(n).forEach(([r,i])=>{Ut(t,r,{value:i,writable:!1,configurable:!1,enumerable:!0})})}class H{static set p(t){if(Array.isArray(t))console.log(...t);else console.log(t)}}class d{_c=0;_id="";constructor(t){if(this._c=0,this._id=t??p(5),t?.includes("-")){let[n,r]=[t.split("-").slice(0,-1).join("-"),t.split("-").slice(-1)[0]];this._id=n,this._c=R(r)?parseInt(r):0}}get id(){return this._id+"-"+this._c}get mid(){return this._id+"-"+ ++this._c}}var vn=new RegExp(/(\d+)(\d*)/,"m"),dn=(t)=>Array.from({length:t},(n,r)=>r),pn="ABCDEFGHIJKLMNOPQRSTUVWXYZ",Tn="abcdefghijklmnopqrstuvwxyz",bn=dn(10).join("");var E=(t)=>JSON.stringify(t),Qt=(t)=>{return JSON.parse(t)},S=(t)=>{if(t.startsWith("webkit"))t="-"+t;return t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()},p=(t)=>{let n=pn+Tn;return Array.from({length:t},(r,i)=>n+(i?bn:"")).reduce((r,i)=>{return r+=i.charAt(Math.floor(Math.random()*i.length))},"")};class f extends Map{obj(t){t&&h(t).forEach(([n,r])=>this.set(n,r))}map(t){t.forEach((n,r)=>{if(n instanceof f)this.set(r,n);else if(a(n)){if(this.lacks(r))this.set(r,[]);this.get(r).push(...n)}else if(w(n))this.ass(r,n);else this.set(r,n)})}ass(t,n){if(!this.has(t))this.set(t,{});T(this.get(t),n)}lacks(t){return!this.has(t)}init(t,n){return this.has(t)?this.get(t):this.set(t,n).get(t)}}var{values:y,keys:J,entries:h}=Object;var{hasOwn:Yt,freeze:Wt,defineProperty:Ut,assign:T}=Object,$=(t)=>{return Object.keys(t).length},rt=(t,n)=>{if(!n.has(t))n.set(t,new f);return n.get(t)},G=(t,n)=>{if(!n.has(t))n.set(t,[]);return n.get(t)},lt=(t,n)=>{let r={added:{},removed:{},modified:{}},i=J(t),o=J(n);for(let e of o){let s=t[e],u=n[e];if(!(e in t))r.added[e]=u;else if(a(s)&&a(u)){if(E(s)!==E(u))r.modified[e]={old:s,new:u}}else if(w(s)&&w(u)&&!C(s)&&!C(u)){let m=lt(s,u);if($(m.added)||$(m.removed)||$(m.modified))r.modified[e]={old:s,new:u}}else if(s!==u)r.modified[e]={old:s,new:u}}for(let e of i)if(!(e in n))r.removed[e]=t[e];return r};function Bt(t,n){if(t.size!==n.size)return!1;for(let r of t)if(!n.has(r))return!1;return!0}var Ct=(t)=>{return y(t).some((n)=>{return $(n)})};function Gt(t){let n;return class extends t{constructor(...r){if(n)return n;super(...r);Wt(this),n=this}}}var F=(t,n)=>{return{name:t,content:n}},yn=(t,n)=>{return{property:t,content:n}},xn=(t,n)=>{return{"http-equiv":t,content:n}};class it{metas=[];constructor(t){t&&this.metas.push(F("description",t))}author(t){return this.meta=F("author",t),this}charset(t){return this.meta={charset:t},this}keywords(...t){return this.meta=F("keywords",t.join(", ")),this}viewport(t){let n=h(t).map(([r,i])=>[S(r),String(i)].join("="));return this.meta=F("viewport",n.join(", ")),this}httpEquiv(t){return h(t).forEach(([n,r])=>{this.meta=xn(S(n),String(r))}),this}robots(...t){return this.meta=F("robots",t.join(", ")),this}themeColor(t){return this.meta=F("theme-color",t),this}openGraph(t){return h(t).forEach(([n,r])=>{this.meta=yn("og:"+n,String(r))}),this}twitter(t){return h(t).forEach(([n,r])=>{this.meta=F("twitter:"+n,String(r))}),this}and(t){return this}set meta(t){this.metas.push(t)}}class ct{title;description;base;meta;link;script;css}var En=["charset","name","property","http-equiv"],Pt=(t,n)=>{n.forEach((r)=>{for(let i of En)if(i in r){let o=r[i];t[`${i}_${i==="charset"?"":o}`]=r}})},$n=(t,n)=>{n.forEach((r)=>{if("href"in r){let i=r.href;t[`${i}`]=r}})};class U{_head;idm;constructor(t){this._head=new f(t)}set head(t){h(t).forEach(([n,r])=>{if(n==="title"||n==="base"){if(r!==void 0)this._head.set(n,r);return}if(r instanceof it)return Pt(this._head.init("meta",{}),r.metas);if(!a(r))return;switch(n){case"meta":return Pt(this._head.init("meta",{}),r);case"link":return $n(this._head.init("link",{}),r);case"script":if(r.length){this._head.init(n,[]);let i=r.map((o)=>{if(!o.yid&&this.idm)o.yid="sc"+this.idm.mid;return o});this._head.get(n).push(...i)}return}})}get head(){return this._head}set id(t){this.idm=new d(t)}}var zt=(t)=>{return h(t).reduce((n,[r,i])=>{return n.push(v(i)&&i?r:`${r}="${i}"`),n},[""]).join(" ")},Kt=(t)=>{if(!t)return"";return[...t].reduce((n,[r,i])=>{if(r==="meta"||r==="link")i=y(i);if(tt(i))return n.push(`<${r}>${i}</${r}>`),n;if(!a(i))return n;let o=i.map((e)=>{if(r==="script"){let s={...e};if("yid"in s)return"";let u="";if("importmap"in s)s.type="importmap",u=JSON.stringify(s.importmap),delete s.importmap;else if("body"in s)u=s.body,delete s.body;return`<${r}${zt(s)}>${u}</${r}>`}return`<${r}${zt(e)}>`});return n.push(...o),n},[]).join("")};class dt{lang="en";htmlHead=new f;head;constructor(){this.head=(t={})=>{let n=new U(this.htmlHead);n.head=t,this.htmlHead=n.head}}}var pt=(t)=>{if(c)return;return new Promise((n,r)=>{let i=document.createElement("link");if(t.rel!=="stylesheet")t.rel="stylesheet",t.as="style";h(t).forEach(([o,e])=>{i.setAttribute(o,e)}),i.onload=()=>n(i),i.onerror=()=>r(new Error("Failed to load CSS")),document.head.appendChild(i)})},Nt=(t)=>{return new Promise((n,r)=>{let i=document.createElement("script"),o="";if("importmap"in t)t.type="importmap",o=JSON.stringify(t.importmap),delete t.importmap;else if("body"in t)o=t.body,delete t.body;if(o)i.innerHTML=o;h(t).forEach(([e,s])=>{i.setAttribute(e,s)}),i.onload=()=>n(i),i.onerror=()=>r(new Error("Failed to load Script")),document.head.appendChild(i)})},wn=()=>{let n=document.querySelector("#d-css")?.sheet;if(n)return n;let r=document.createElement("style");return r.id="d-css",document.head.appendChild(r),r.sheet},Hn=(t,n)=>{for(let r=0;r<t.cssRules.length;r++)if(t.cssRules[r].selectorText===n)return!0;return!1},jn=(t)=>Object.entries(t).map(([n,r])=>`${S(n)}: ${r};`).join(" ");function Dn(t,n={}){if(c)return;let r=wn();if(!r)return;if(!Hn(r,t))r.insertRule(`${t} { ${jn(n)} }`,r.cssRules.length)}var Vt=(t,n)=>{let r=n;if(t?.class)r.push(...a(t.class)?t.class:[t.class]);return delete t.class,r.filter((i)=>i)};var Ot=(t,n=!1)=>{if(R(t))return[+t,Jt(t)?"int":"float"];if(n&&/\.\w+$/.test(t))return[t,"file"];if(t==="/")return[t,"-"];if(t.length===36&&t.match(/\-/g)?.length===4)return[t,"uuid"];return[t,"string"]},ot=(t)=>{let n=t.startsWith("/")?t:"/"+t,r=n.match(/(?<=\/)[^/].*?(?=\/|$)/g)??["/"],[i,o]=r.reduce(([e,s],u)=>{if(u.includes("<")){let m=u.match(/(?<=<)[^/].*?(?=>|$)/g);if(m?.length){let[l,b]=m[0].split(":");if(l&&b)e.push(l),s.push(b)}}else e.push(u===">"?"/":u);return[e,s]},[[],[]]);if(n.endsWith("/")&&n.length>1)i.push("/");return{parsed:i,args:o}};class et{storage=new f;cache(t,n){if(this.storage.lacks(t))this.storage.set(t,n());return this.storage.get(t)}}var An=["int","float","file","uuid","string"],qn=new et;class Q{_storage=new f;set(t){let{parsed:n,path:r}=t,i=E(n);if(!this._storage.get(i))this._storage.set(i,t);else throw`path: ${r} already used.`}get(t){let{parsed:n}=qn.cache(t,()=>ot(t)),r={},i=this._storage.get(E(n));if(!i&&t!=="/")for(let o of this._storage.keys()){let e=[],s=Qt(o);if(n.length===s.length){let u=s.map((b,j)=>{let D=Ot(n[j],n.length-1===j);if(b===D[0])return D[0];if(An.includes(D[1]))return e.push(D[0]),D[1];return b}),m=E(u);if(this._storage.has(m)){i=this._storage.get(m),i?.args.forEach((b,j)=>{r[b]=e[j]});break}}}return[i,r]}}class P{path="";parsed=[];args=[];constructor(t){nt(this,{path:t,...ot(t)})}}class _t{static rand(t=6,n){if(n)return Math.floor(Math.random()*(n-t+1)+t);return Math.floor(Math.random()*t)+1-1}static fill(t,n=null){return Array(t).fill(n)}static new({dom:t,id:n,inner:r}){let i=document.createElement(t);if(n)i.id=n;if(r)i.innerHTML=r;return i}static randFrom(t){if(Array.isArray(t)){let n=t.length,r=this.rand(0,n-1);return t[r]}else if(typeof t=="object"){let n=J(t),r=n.length,i=this.rand(0,r-1);return n[i]}}static makeID=p;static reClass=Vt;static get O(){return{vals:y,keys:J,items:h,has:Yt,ass:T,len:(t={})=>J(t).length}}}var Tt={},Z={};class kt{stream;url;constructor(t,n){if(this.url=t,t in Tt)this.stream=Tt[t];else this.stream=new EventSource(t,{withCredentials:n}),Tt[t]=this.stream,Z[this.url]={}}on(t){let n=this.stream;return h(t).forEach(([r,i])=>{if(r in Z[this.url])Z[this.url][r].forEach((o)=>{this.stream.removeEventListener(r,o)}),Z[this.url][r]=[];if(n.addEventListener(r,i),!(r in Z[this.url]))Z[this.url][r]=[];Z[this.url][r].push(i)}),this}}function vt(t,n=!0){return new kt(t,n)}class tn{value;constructor(t){this.value=t}get str(){return String(this.value).toString()=="null"?null:String(this.value).toString()}get int(){if(R(this.value))return parseInt(this.value);else return null}get float(){if(R(this.value))return parseFloat(this.value);else return null}get bool(){if(this.value==="true")return!0;else if(this.value=="false")return!1;else return null}get json(){if(this.value)return JSON.parse(this.value);return null}}class z{key;func;storage;constructor(t,n="local"){if(typeof t=="object"){let[r,i]=h(t)[0];this.key=r,this.func=i}else this.key=t,this.func=null;this.storage=n=="local"?localStorage:sessionStorage}get as(){return new tn(this.storage.getItem(this.key))}get value(){return this.storage.getItem(this.key)}get save(){if(this.func)this.set=this.func();return}set set(t){if(typeof t=="object")this.storage.setItem(this.key,JSON.stringify(t));else this.storage.setItem(this.key,String(t))}get remove(){this.storage.removeItem(this.key);return}}var K={get:(t)=>new z(t)};var nn={get:(t)=>new z(t,"session")};class st extends P{id;cls;constructor(t,n,r){super(t);this.id=n;this.cls=r}}class rn extends P{id;cls;constructor(t,n,r){super(t);this.id=n;this.cls=r}}class ut extends dt{ImportMeta;config;storage=new Q;errorStorage=new Q;wssStorage=new Q;route;error;wss;constructor(t,n){super();this.ImportMeta=t;this.config=n;this.route=(r)=>{return(i)=>{return this.storage.set(new st(r,p(5),i)),i}},this.wss=(r)=>{return(i)=>{return this.wssStorage.set(new rn(r,p(5),i)),i}},this.error=(...r)=>{return(i)=>{if(r.length)r.forEach((o)=>{this.errorStorage.set(new st(o.toString(),p(5),i))});else this.errorStorage.set(new st("404",p(5),i));return i}}}async getPath(t){return this.storage.get(t)}async loadError(t){return this.errorStorage.get(t.toString())}async loadWSS(t){return this.wssStorage.get(t)}}var N=new f,V=(t)=>{if(c)return;let n=N.get(t);if(n?.isConnected)return n;N.delete(t);let r=document.getElementById(t);if(!r)return;return N.set(t,r),r};function on(){let t=[];return N.forEach((n,r)=>{if(!n.isConnected)t.push(r),N.delete(r)}),t}function Y(t,n,{id:r="state",init:i}={}){let o=[],e=()=>n.map((u)=>u.value),s=()=>{t(...e())};if(n.forEach((u)=>{o.push(u.hook(s)(r))}),i)s();return()=>{o.forEach((u)=>u())}}var en=(t)=>{t.forEach((n)=>n())};var Ln=(t,n)=>{for(let[r,i]of t){let o=V(r);if(!o){t.delete(r);continue}i.forEach((e)=>{e.call(o,n)})}};class I extends EventTarget{options;hooks=new f;states=new f;_value;listening=!1;end;constructor(t,n){super();this.options=n;this._value=t}get value(){return this._value}set value(t){if(C(t)||Xt(t))return;if(k(this._value)||a(this._value)){let n=lt(this._value,t);if(!Ct(n))return}else if(this._value instanceof Set){if(!Bt(this._value,t))return}else if(this._value===t)return;this._value=t,this.dispatchEvent(new CustomEvent("updated",{detail:this._value}))}get listen(){let t=(n)=>{if(en(this.hooks),Ln(this.states,n.detail),!this.states.size&&!this.hooks.size)this.end?.()};if(!this.listening)this.addEventListener("updated",t,this.options),this.listening=!0;return()=>{this.listening&&this.removeEventListener("updated",t,this.options),this.end=void 0,this.listening=!1}}call(t,n){return(r)=>{if(rt(r,this.states).set(n,t),!c&&!this.listening)this.end=this.listen;return()=>{if(this.states.has(r))this.states.get(r)?.delete(n)}}}hook(t){return(n)=>{if(this.hooks.set(n,t),!c&&!this.listening)this.end=this.listen;return()=>{if(this.hooks.has(n))this.hooks.delete(n)}}}}function A(t){return new I(t)}var bt=(t)=>{if(a(t))return t.join(" ");else if(w(t)){if(at(t))return E(t)}else if(x(t))return bt(t());else if(t!==void 0&&t!==null)return v(t)?t?"":"false":String(t);return""};function Mn(t,n){switch(n??t){case"style":return function(r){this.style.setProperty(t,r)};default:return function(r){this.setAttribute(t,r)}}}class yt{attr;constructor(t={}){this.attr=t}get(t,n=this.attr,r){let i=(o,e)=>{if(a(e))t.attr_push(o,bt(e));else if(e instanceof I){let s=r?`${r}_${o}`:o;t.states.push(e.call(Mn(o,r),s)),i(o,e.value)}else if(w(e)){if(at(e)&&!r)this.get(t,e,o)}else t.attr_push(o,bt(e),r)};h(n).forEach(([o,e])=>{if(["on"].includes(o))w(n.on)&&t.events.obj(n.on);else i(o,e)})}}class W{xid;IDM;map=new f;states=[];events=new f;OZ;constructor(t,n=new d,r){this.xid=t;this.IDM=n;this.OZ=r??new ft}attr_push(t,n,r){let i=r??t;if(!this.map.has(i))this.map.set(i,[]);let o=r?`${S(t)}:${n};`:n;this.map.get(i).push(o)}get attr(){let t=[""];return this.map.forEach((n,r)=>{let i=n.join("");t.push(i?`${r}="${i}"`:r)}),t.join(" ")}set id(t){if(!this.map.has("id"))this.map.set("id",[t])}get id(){return this.map.get("id")?.join("")}}var Rn=(t,n,r)=>{return t.addEventListener(n,r),()=>{t.removeEventListener(n,r)}},O={};class ft{events=new f;states=new f;winStates=new f;windowEvents=new f;resetST=new f;resetEV=new f;constructor(){}get keys(){return[...new Set([...this.states.keys(),...this.events.keys()])]}set(t){let{id:n,events:r,states:i}=t;if(n){if(r.size)this.events.set(n,r);if(i.length)this.states.set(n,i)}return this}push(t){return t.events.forEach((n,r)=>{n.forEach((i,o)=>{rt(r,this.events).set(o,i)})}),t.states.forEach((n,r)=>{G(r,this.states).push(...n)}),this}get stage(){return this.events.forEach((t,n)=>{this.events.delete(n);let r=V(n);if(!r){this.events.delete(n);return}t.forEach((i,o)=>{switch(o){case"ready":i.apply(r,[r]);break;case"resize":case"beforeunload":case"popstate":case"winscroll":case"winload":case"winfocus":case"winblur":let e=o.replace(/^win/,"");this.windowEvents.init(e,new f).set(n,i);break;case"watch":let[s,u,m]=i.apply(r,[r]),l=a(u)?u:[u],b=()=>l.map((D)=>D.value),j=()=>s(...b());if(m)j();l.forEach((D)=>G(n,this.resetST).push(D.call(j,n+"_watch")(n)));break;default:G(n,this.resetEV).push(Rn(r,o,i))}})}),this.processWindowEvents,this.states.forEach((t,n)=>{this.states.delete(n),t.forEach((r)=>{G(n,this.resetST).push(r(n))})}),this}get processWindowEvents(){let t=(n,r)=>{let i=(o)=>{r.forEach((e,s)=>{let u=V(s);if(u)e.call(u,o);else this.windowEvents.get(n)?.delete(s)})};return window.addEventListener(n,i),()=>{window.removeEventListener(n,i)}};return this.windowEvents.forEach((n,r)=>{if(n.size){if(!O[r])O[r]=t(r,n)}else if(O[r])O[r](),delete O[r]}),this}reset(t){return t.forEach((n)=>{this.windowEvents.forEach((r,i)=>{if(r.has(n))r.delete(n)}),this.resetEV.get(n)?.forEach((r)=>{r()}),this.resetST.get(n)?.forEach((r)=>{r()}),this.resetST.delete(n),this.resetEV.delete(n)}),this}RPS(t){if(t){let n=on();this.reset(n);let r=t.keys;if(r.length)this.reset(r).push(t).stage}return this}}var q=new ft;var Sn=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],Fn=(t)=>Sn.includes(t);function Zn(t){return String(t).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var mt=(t,n)=>{if(a(t))return t.map((r)=>mt(r,n)).join("");else if(t instanceof L){let r=t.__(n.IDM),{ctx:i,oz:o}=r;return n.OZ.push(o),i}else if(w(t))return E(t);else if(x(t))return mt(t(),n);else if(t!==void 0&&t!==null)return Zn(t);return""},sn=(t,n)=>{let r=new d(t),i=new W(r.id,r);return{ctx:mt(n,i),catt:i}};function In(t){let n=this.id;if(n){let{ctx:r,catt:i}=sn(n,t);if(this.innerHTML!==r)this.innerHTML=r,q.RPS(i.OZ)}}var xt=(t,n,r,i=[])=>{if(a(t))t.forEach((o)=>{xt(o,t.length,r,i)});else if(t instanceof I)if(n>1)xt(M("div",{},t),n,r,i);else{let o=t.value,e=o instanceof L?"dom":"ctx",{ctx:s,catt:u}=sn(r.xid+"-0",o);r.xid=u.xid,i.push(s),r.OZ.push(u.OZ),r.states.push(t.call(In,e))}else i.push(mt(t,r))};class Et{tag;ctx;closing;constructor(t,n){this.tag=t;this.ctx=n;let r=Fn(t);this.closing=r?"":`</${t}>`}process(t,n=this.ctx,r=[]){return n.forEach((i)=>{xt(i,n.length,t,r)}),r.join("")}get(t){let n=this.process(t);if(t.events.size||t.states.length)t.id=t.xid;return`<${this.tag}${t.attr}>${n}${this.closing}`}}class L{tag;constructor(t,n={},...r){this.tag=t;nt(this,{attr:new yt(n),ctx:new Et(t,r)})}__(t=new d){let n=t.mid,r=new W(n,t);return this.attr.get(r),{ctx:this.ctx.get(r),oz:r.OZ.set(r),id:r.id}}}function M(t,n={},...r){if(x(t))return t(n??{},...r);return new L(t,n??{},r)}var Xn=(t,...n)=>n;class $t{e;opt;constructor(t){this.e=t;this.opt={duration:500,easing:"ease-in-out",fill:"forwards"}}animate(t,n={}){return this.e.animate(t,n)}get slide(){let t=({x:n=0,y:r=0},i={})=>{T(this.opt,i);let o=[[n,r],[0,0]].map(([e,s])=>({transform:`translateX(${e}rem) translateY(${s}rem)`}));return this.e.animate(o,this.opt),this};return{left:(n={})=>{return t({x:-2},n)},right:(n={})=>{return t({x:2},n)},up:(n={})=>{return t({y:2},n)},down:(n={})=>{return t({y:-2},n)}}}fade(t={}){T(this.opt,t);let n=[0,1].map((r)=>({opacity:r}));return this.e.animate(n,this.opt),this}shake(t="Y",n={}){T(this.opt,n);let r=[0,5,-5,5,0].map((i)=>({transform:`translate${t}(${i}px)`}));return this.e.animate(r,this.opt),this}color(t=[],n={}){T(this.opt,n);let r=Array.isArray(t)?t.map((i)=>({color:i})):{color:t};return this.e.animate(r,this.opt),this}bg(t=[],n={}){T(this.opt,n);let r=Array.isArray(t)?t.map((i)=>({backgroundColor:i})):{backgroundColor:t};return this.e.animate(r,this.opt),this}bounce(t=1,n={}){T(this.opt,n);let r=[0.5,t,1].map((i)=>({transform:`scale(${i})`}));return this.e.animate(r),this}}class jt{e;query;constructor(t,n){this.e=t;this.query=n}get a(){return new $t(this)}get all(){if(this.query){let t=document.querySelectorAll(this.query);if(t.length)return Array.from(t).map((n)=>n)}return[]}get attr(){let t=this.e;return{has:(n)=>{return t.hasAttribute(n)},get:(n)=>{return t.getAttribute(n)},del:(n)=>{return t.removeAttribute(n),this},set:(n)=>{for(let r in n){let i=n[r];if(n[r]!==void 0)t.setAttribute(r,i?i:"")}return this}}}get children(){return Array.from(this.e.children).map((t)=>g(t))}get click(){return this.e.click(),this}get delete(){return this.e.remove(),this}get disabled(){return this.e.disabled??!1}get focus(){return this.e.focus(),this}get href(){return this.e?.href??""}get id(){return this.e.id}get inner(){return this.e.innerHTML}get offsetParent(){let t=this.e.offsetParent;if(t)return new X(t);return}get parent(){let t=this.e.parentElement;if(t)return new X(t);return}get path(){return this.e?.pathname??""}get rect(){return this.e.getBoundingClientRect()}get remove_element(){return this.e.remove(),this}get style(){let t=this.e.style,n=this;return{set:(r,i=0)=>{let o=t,e=()=>{h(r).forEach(([s,u])=>{if(s in o){if(o[s]!==u)o[s]=u}else if(u!==null)t.setProperty(s,String(u))})};if(x(i))n.on("transitionend",i);if(It(i))setTimeout(e,i);else e();return n},get:(r)=>{return t.getPropertyValue(r.toString())},del:(...r)=>{r.forEach((i)=>{t.removeProperty(i.toString())})}}}get submit(){let t=this.e;if("submit"in t)return t.submit();return!1}get tag(){return this.e.tagName.toLowerCase()}get value(){return this.e.value??""}get unload(){return()=>{this.e.remove()}}set append(t){let{ctx:n,oz:r}=wt(t,Ht(this.id));this.e.insertAdjacentHTML("beforeend",n),q.RPS(r)}set appendfirst(t){let{ctx:n,oz:r}=wt(t,Ht(this.id));this.e.insertAdjacentHTML("afterbegin",n),q.RPS(r)}set inner(t){let{ctx:n,oz:r}=wt(t,Ht(this.id));this.e.innerHTML=n,q.RPS(r)}set disabled(t){let n=this.e;if("disabled"in n)n.disabled=t}set id(t){this.e.id=t}set value(t){let n=this.e;n.value=t}}var wt=(t,n)=>{if(t instanceof L)return t.__(new d(n));return{ctx:t,oz:void 0}},Ht=(t)=>t?`${t}-0`:t;class X extends jt{constructor(t,n){super(t,n)}add(...t){return this.e.classList.add(...t.map((n)=>n.replace(/[^\w-]/,""))),this}remove(...t){return this.e.classList.remove(...t.map((n)=>n.replace(/[^\w-]/,""))),this}toggle(t,n){let r=typeof t!="string"?t.apply(this):t,i=this.e.classList;return r.split(" ").forEach((o)=>{i.toggle(o,n)}),this}has(t){return this.e.contains(t)}insert(t){return{HTML:(...n)=>{return n.forEach((r)=>{this.e.insertAdjacentHTML(t,r)}),this},element:(...n)=>{return n.forEach((r)=>{this.e.insertAdjacentElement(t,r)}),this},text:function(...n){return n.forEach((r)=>{this.e.insertAdjacentText(t,r)}),this}}}is(t){let n=this.e.classList.value.split(" "),r=this.e.tagName.toLocaleLowerCase(),i=!0,o=!0;if(t.dom)o=t.dom==r?!0:!1;if(t.class)if(Array.isArray(t.class))t.class.forEach((e)=>{i=i?n.includes(e):!1});else i=i?n.includes(t.class):!1;return i&&o}on(t,n,r=!1){let i=!1;if(t.indexOf("touch")>-1)i=!0;return this.e.addEventListener(t,n,{capture:r,passive:i}),this}remove_on(t,n,r=!1){return this.e.removeEventListener(t,n,r),this}timed(t,n=250){return setTimeout(()=>t(this),n),this}animate(t,n,r){let i={duration:300,easing:"ease",fill:"forwards"};if(x(n))r=n;else T(i,n);let o=this.e.animate(t,i);if(r)o.finished.then(r);return this}}function g(t){if(tt(t)){let n=document.querySelector(t);if(n)return new X(n,t);return}else return new X(t)}class ht extends ct{path;args;id;status;lang;import;_data={};constructor(t,n={},r,i=200){super();this.path=t;this.args=n;this.id=r;this.status=i}async loader(){if(this.import)try{let t=await this.import;if(t.default)this.import=await t.default({...this.args,...this.data});else this.import=void 0}catch(t){H.p=t,this.import=void 0}if(this.body){let t=await this.body();return a(t)?t:[t]}if(this.import){let t=this.import;return a(t)?t:[t]}return[]}getHeadAttr(t={},...n){let r=new U;if($(t))r.head=t;r.id=this.id;let i=r.head;return n.forEach((o)=>{i.map(o)}),Jn(r,this),i}set data(t){T(this._data,t)}get data(){return this._data}}class Dt extends ht{head(){this.title=`error ${this.status}`}body(){return M("div",{},this.path+" not found...")}}function Jn(t,n){let{link:r,script:i,meta:o,title:e,base:s,description:u,css:m}=n;if(t.head={title:e,base:s,meta:o,link:r,script:i},u)t.head={meta:[{name:"description",content:u}]};if(m){let b=(a(m)?m:[m]).map((j)=>({rel:`${c?"preload ":""}stylesheet`,href:j,as:"style"}));if(t.head.lacks("link"));t.head={link:[...b]}}}function un(t){let n=[];if(t?.length){let{href:r,target:i}=t[0],o=g("base");if(o)o.attr.set({href:r,target:i});else{let e=g(document.createElement("base"));e.attr.set({href:r,target:i}),document.head.append(e.e)}}else{let r=g("base")?.unload;r&&n.push(r)}return n}var fn=new f;async function mn(t,n=!1){let r=_.value,i={};if(g("link")?.all.forEach((o)=>{let e=g(o),s=e.attr.get("href");if(s){let u=e.attr.get("rt");if(n){let m=fn.get(r);if(m){if(!m.has(s))i[s]=e.unload}else i[s]=e.unload}else if(u)i[s]=e.unload}}),t&&$(t))for(let o of y(t)){let e=o.href;if(!(e in i))try{if(!n){o.rt=!0;let s=fn.init(r,new Set);if(!s.has(e))s.add(e)}await pt(o)}catch(s){H.p=s}else delete i[e]}return y(i)}var Un=["charset","name","property","http-equiv"];function hn(t){let n={};if(g("meta")?.all.forEach((r)=>{let i=r.attributes;for(let o of Un)if(o in i){let e=i[o].value;n[`${o}_${o==="charset"?"":e}`]=r}}),t)h(t).forEach(([r,i])=>{if(r in n)g(n[r]).attr.set(i),delete n[r];else{let o=g(document.createElement("meta"));o.attr.set(i),document.head.append(o.e)}});return y(n).map((r)=>g(r).unload)}var an=new f;async function gn(t,n=!1){let r=_.value,i={};if(g("script[yid]")?.all.forEach((o)=>{let e=g(o),s=e.attr.get("yid");if(s){let u=e.attr.get("rt");if(n){let m=an.get(r);if(m){if(!m.has(s))i[s]=e.unload}else i[s]=e.unload}else if(u)i[s]=e.unload}}),t){for(let o of t)if("yid"in o)if(o.yid in i)delete i[o.yid];else try{if(!n){o.rt=!0;let e=o.yid,s=an.init(r,new Set);if(!s.has(e))s.add(e)}await Nt(o)}catch(e){H.p=e}}return y(i)}async function ln(t,n,r=!1){let i=[];if(c)return[];let o=t.get("title")??"";if(r){let{pushState:s}=this.config,u=this.path.value;if(s)At(u,o);document.documentElement.lang=n,document.title=o}let e=this.path.value;if(r)i.push(...un(t.get("base"))),i.push(...hn(t.get("meta")));return i.push(...await mn(t.get("link"),r)),i.push(...await gn(t.get("script"),r)),i}function At(t,n){let r=window.location.pathname;if(t&&r!==t)history.pushState({},n??"",t)}class qt{lang;head="";constructor(t,n){if(this.lang=t,n)this.head=Kt(n)}body(t,n,r){return[`<!DOCTYPE html><html lang="${this.lang}">`,`<head>${this.head}</head>`,`<body id="${n??p(5)}"${r?" "+r:""}>${t}</body>`,"</html>"].join("")}}class Lt{path;args;isConnected=A(!1);data={};constructor(t,n={}){this.path=t;this.args=n}open(t){}message(t){}close(t){}error(t){}get connect(){if(this.ws&&this.ws.readyState<=1)return this;return this.ws=new WebSocket(this.path),this.ws.onopen=async(t)=>{this.isConnected.value=!0,await this.open.call(this,t)},this.ws.onmessage=async(t)=>{await this.message.call(this,t)},this.ws.onclose=async(t)=>{this.isConnected.value=!1,await this.close.call(this,t)},this.ws.onerror=async(t)=>{this.isConnected.value=this.ws.readyState<=1,await this.error.call(this,t)},this}get reconnect(){if(this.state>=2)this.connect;return this}get disconnect(){if(this.state<=1)this.ws.close();return this}get state(){return this.ws?.readyState??3}set send(t){this.ws.send(t)}}var B=new f;class Mt{yra;constructor(t){this.yra=t}async load(t){if(!B.has(t)){let[r,i]=await this.yra.loadWSS(t);if(!r)return;let{cls:o,path:e,id:s}=r,u=new o(e,i).connect;return B.set(t,u),u}let n=B.get(t);return n.reconnect,n}unload(t){if(B.has(t)){let n=B.get(t);if(!n)return;n.disconnect,B.delete(t)}}}function Qn(t,n,r){let i={...t.on??{},click(o){o.preventDefault(),r.value=g(this).path}};return delete t.on,M("a",{...t,on:{...i}},...n)}function Yn(t,n,r){let{classes:i}=t.config,{load:o,on:e,...s}=n,u={...n.on??{},...!r&&o&&{ready(m){t.load(o)}},...r&&{popstate(m){let l=m.target;t.path.value=l.location.pathname}}};return M("div",{...s,...i&&{class:i},on:u},t.root)}class Rt extends ut{isYRA;unload=!1;hook;root=A([]);socket;id=p(4);path=A("");A;Main;load;constructor(t,n={},r=!1){super(t,n);this.isYRA=r;this.socket=new Mt(this),this.A=(i,...o)=>{return Qn(i,o,this.path)},this.Main=(i)=>{return Yn(this,i,r)},this.load=async(i,o={})=>{if(this.hook)this.hook();if(i)this.path.value=i,await this.render(i,404,o),this.hooker();return this}}hooker(){let t={},n=this.path.value;if(this.hook)this.hook();this.hook=Y(async(r)=>{if(t[n]=window.scrollY,(await this.render(r,404)).done)window.scrollTo({top:t[r]??0,behavior:"instant"}),n=r},[this.path],{id:"router"})}async class(t,n,r=!1){let[i,o]=await this.getPath(t);if(i&&!r){let{cls:e,path:s,id:u}=i;return new e(s,o,u)}else return Wn.call(this,t,n)}async fetch(t){if(t)try{if(t.fetch){let n=await t.fetch();if(k(n)&&$(n))t.data=n}}catch(n){H.p=n}}async processHead(t,n={}){return t?await this.processClassHead(t,n):await this.processDefaultHead(n)}async processClassHead(t,n){if(t.head)await t.head();return t.getHeadAttr(n,this.htmlHead)}async processDefaultHead(t){let n=new U;if($(t))n.head=t;return n.head.map(this.htmlHead),n.head}async render(t,n=404,r={},i={},o=!0,e=!1){if(c)this.path.value=t;let s=await this.class(t,n??Cn(),e);s.data=r,await this.fetch(s);let u=await this.processHead(s,i);if(!s)return{lang:this.lang,heads:u,done:!1};let m=await s.loader();if(o){let l=await ln.call(this,u,s?.lang||this.lang,this.unload);if(o)l.forEach((b)=>b())}if(m.length)this.root.value=m;else await this.render(t,n,r,i,o,!0);return{heads:u,lang:s.lang??this.lang,done:!0}}}async function Wn(t,n){let[r,i]=await this.loadError(n??0);if(r){let{cls:o,id:e}=r;return new o(t,i,e,n)}else{let o=new Dt(t,i,p(5));return o.title=`error ${n}`,o}}var _=A("");class cn extends Rt{unload=!0;constructor(t,{classes:n,pushState:r=!0}={}){super(t,{classes:n,pushState:r},!0);this.path=_,this.head({meta:[{charset:"utf-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}]}),this.load=async(i=location.pathname,o={})=>{if(this.hook)this.hook();if(i)this.path.value=i;if(gt)this.render(i,404,o).then(()=>{if(i&&this.config.pushState)At(i,document.title);Bn.call(this,this.Main({})),this.hooker()});return this}}async html({path:t,data:n={},status:r=200,attr:i=""}){let o={script:[{type:"module",src:this.ImportMeta.file}]};Gn(o,r);let{lang:e,heads:s}=await this.render(t,r,n,o,!1),{ctx:u}=this.Main({}).__(new d(this.id));return new qt(e,s).body(u,this.id,i)}}function Bn(t){let n=document.body.id,{oz:r,id:i}=t.__(new d(n));if(this.id=i||this.id,!r)return;q.push(r),requestAnimationFrame(()=>{q.stage})}function Cn(){if(gt)return parseInt(g('meta[name="error-code"]')?.attr.get("content")??"404");return 404}var Gn=(t,n)=>{switch(n){case 404:t.meta=[{name:"error-code",content:n.toString()}];return;default:return}};class St{state;body;click;constructor({toggle:t=[],initialState:n=!1}={}){this.state=A(n);let r=this.state;this.click=function(){r.value=!r.value},this.loader(t)}loader(t){if(typeof window==="undefined")return;let n=K.get("LOCAL_SCHEME"),r=this.isDark,i=n.as.bool,o=K.get({IS_DARK:()=>this.state.value});if(i!=null&&i!==r)this.state.value=!i,o.save,n.set=r;if(o.as.bool!==null)this.state.value=o.as.bool;let e=this.toggle,s=document.documentElement.classList;if(e(s,this.state.value,t),Y(async(u)=>{e(s,u,t),o.save},[this.state],{id:"colorScheme"}),this.isMatchMediaSupported)window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",(u)=>{let l=(u.matches?"dark":"light")==="dark";this.state.value=l,n.set=l})}get isMatchMediaSupported(){return window.matchMedia&&typeof window.matchMedia==="function"}get isDark(){return window.matchMedia("(prefers-color-scheme: dark)").matches}toggle(t,n,r){if(n)t.add(...r);else t.remove(...r)}}St=Ft([Gt,Zt("design:paramtypes",[Object])],St);var Ve=(t,n)=>{return`${t.replace(/\/+$/,"")}/${n.replace(/^\.\/+/,"")}`},Oe=(t)=>{return(n)=>{t(n)}},_e=(t)=>{return(n)=>{t(n)}};export{Lt as websocket,Y as stateHook,nn as session,Ve as resolvePath,ut as minClient,K as local,Xn as frag,vt as eventStream,M as dom,ht as doc,pt as cssLoader,Dn as addCSS,_t as __,cn as Yvee,I as Stateful,A as State,Oe as Routes,Rt as Router,it as Meta,_e as Errors,L as Dom,St as ColorScheme,H as $$,g as $};
|
|
1
|
+
var Yr=Object.defineProperty;var Lr=(t,r)=>{for(var n in r)Yr(t,n,{get:r[n],enumerable:!0,configurable:!0,set:(i)=>r[n]=()=>i})};var At={};Lr(At,{isWindow:()=>B,isUndefined:()=>qr,isStr:()=>tt,isPromise:()=>Cr,isPlainObject:()=>D,isObj:()=>$,isNumber:()=>Z,isNum:()=>St,isNull:()=>gt,isNotWindow:()=>T,isNotNull:()=>Xr,isInt:()=>Rt,isFN:()=>w,isDefined:()=>Br,isClassOrId:()=>Fr,isBool:()=>v,isAsync:()=>Pr,isArraybuff:()=>Zr,isArr:()=>m});var w=(t)=>typeof t==="function",Pr=(t)=>t.constructor.name==="AsyncFunction",Cr=(t)=>!!t&&typeof t.then==="function",Z=(t)=>{return!isNaN(parseFloat(t))&&isFinite(t)},D=(t)=>{return typeof t==="object"&&t!==null&&Object.getPrototypeOf(t)===Object.prototype&&!Array.isArray(t)},Zr=(t)=>{return t instanceof Uint8Array||t instanceof ArrayBuffer||typeof t==="string"},Fr=(t)=>{return t.startsWith(".")||t.startsWith("#")},v=(t)=>typeof t==="boolean",tt=(t)=>typeof t==="string",m=(t)=>Array.isArray(t),$=(t)=>typeof t==="object",St=(t)=>typeof t==="number",gt=(t)=>t===null,Xr=(t)=>t===null,qr=(t)=>typeof t==="undefined",Br=(t)=>typeof t!=="undefined",Rt=(t)=>{return Number.isInteger(Number(t))},B=typeof window!=="undefined",T=typeof window==="undefined";function ct(t,r){g(r).forEach(([n,i])=>{Nt(t,n,{value:i,writable:!1,configurable:!1,enumerable:!0})})}var Ht=(t)=>{return m(t)?t:[t]};class E{static set i(t){console.info(...Ht(t))}static set e(t){console.error(...Ht(t))}static set w(t){console.info(...Ht(t))}}class H{_c=0;_id="";constructor(t){if(this._c=0,this._id=t??x(5),t?.includes("-")){let[r,n]=[t.split("-").slice(0,-1).join("-"),t.split("-").slice(-1)[0]];this._id=r,this._c=Z(n)?parseInt(n):0}}get id(){return this._id+"-"+this._c}get mid(){return this._id+"-"+ ++this._c}}var Ir=(t)=>Array.from({length:t},(r,n)=>n),_t="ABCDEFGHIJKLMNOPQRSTUVWXYZ",Ot="abcdefghijklmnopqrstuvwxyz";var S=(t)=>JSON.stringify(t),kt=(t)=>{return JSON.parse(t)};var j=(t)=>{if(t.startsWith("webkit"))t="-"+t;return t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()},x=(t)=>{let r=_t+Ot,n=Ir(10).join("");return Array.from({length:t},(i,o)=>r+(o?n:"")).reduce((i,o)=>{return i+=o.charAt(Math.floor(Math.random()*o.length))},"")},Ur=(t=6,r)=>{if(!r)return Math.floor(Math.random()*t);return Math.round(Math.random()*(r-t)+t)},vt=()=>{let t=[..._t,...Ot],r=Ur(0,t.length);return t[r]};var tr=(t,r)=>{let n=r==="/"?"":r;if(r.startsWith("#"))return t+r;return r.startsWith("/")?t+n:r};class a extends Map{obj(t){t&&g(t).forEach(([r,n])=>this.set(r,n))}map(t){t.forEach((r,n)=>{if(r instanceof a)this.set(n,r);else if(m(r)){if(this.lacks(n))this.set(n,[]);this.get(n).push(...r)}else if($(r))this.ass(n,r);else this.set(n,r)})}ass(t,r){if(!this.has(t))this.set(t,{});p(this.get(t),r)}lacks(t){return!this.has(t)}init(t,r){return this.has(t)?this.get(t):this.set(t,r).get(t)}}var{values:A,keys:W,entries:g}=Object;var{defineProperty:Nt,assign:p}=Object,rr=(t,r)=>Object.hasOwn(t,r),R=(t)=>{return Object.keys(t).length},dt=(t,r)=>{if(!r.has(t))r.set(t,new a);return r.get(t)},rt=(t,r)=>{if(!r.has(t))r.set(t,[]);return r.get(t)},Dt=(t,r)=>{let n={added:{},removed:{},modified:{}},i=W(t),o=W(r);for(let e of o){let f=t[e],s=r[e];if(!(e in t))n.added[e]=s;else if(m(f)&&m(s)){if(S(f)!==S(s))n.modified[e]={old:f,new:s}}else if($(f)&&$(s)&&!gt(f)&&!gt(s)){let u=Dt(f,s);if(R(u.added)||R(u.removed)||R(u.modified))n.modified[e]={old:f,new:s}}else if(f!==s)n.modified[e]={old:f,new:s}}for(let e of i)if(!(e in r))n.removed[e]=t[e];return n};function nr(t,r){if(t.size!==r.size)return!1;for(let n of t)if(!r.has(n))return!1;return!0}var ir=(t)=>{return A(t).some((r)=>{return R(r)})};var I=(t,r)=>{return{name:t,content:r}},Jr=(t,r)=>{return{property:t,content:r}},Wr=(t,r)=>{return{"http-equiv":t,content:r}};class nt{metas=[];constructor(t){t&&this.metas.push(I("description",t))}author(t){return this.meta=I("author",t),this}charset(t){return this.meta={charset:t},this}keywords(...t){return this.meta=I("keywords",t.join(", ")),this}viewport(t){let r=g(t).map(([n,i])=>[j(n),String(i)].join("="));return this.meta=I("viewport",r.join(", ")),this}httpEquiv(t){return g(t).forEach(([r,n])=>{this.meta=Wr(j(r),String(n))}),this}robots(...t){return this.meta=I("robots",t.join(", ")),this}themeColor(t){return this.meta=I("theme-color",t),this}openGraph(t){return g(t).forEach(([r,n])=>{this.meta=Jr("og:"+r,String(n))}),this}twitter(t){return g(t).forEach(([r,n])=>{this.meta=I("twitter:"+r,String(n))}),this}push(t){this.metas.unshift(...t)}set meta(t){this.metas.push(t)}}class jt{title;description;base;meta;link;script;css}var Qr=["charset","name","property","http-equiv"],or=(t,r)=>{r.forEach((n)=>{for(let i of Qr)if(i in n){let o=n[i];t[`${i}_${i==="charset"?"":o}`]=n}})},Gr=(t,r)=>{r.forEach((n)=>{if("href"in n){let i=n.href;t[`${i}`]=n}})};class Q{_head;idm;constructor(t){this._head=new a(t)}set head(t){g(t).forEach(([r,n])=>{if(r==="title"||r==="base"){if(n!==void 0)this._head.set(r,n);return}if(n instanceof nt)return or(this._head.init("meta",{}),n.metas);if(!m(n))return;switch(r){case"meta":return or(this._head.init("meta",{}),n);case"link":return Gr(this._head.init("link",{}),n);case"script":if(n.length){this._head.init(r,[]);let i=n.map((o)=>{if(!o.yid&&this.idm)o.yid="sc"+this.idm.mid;return o});this._head.get(r).push(...i)}return}})}get head(){return this._head}set id(t){this.idm=new H(t)}}var it=(t)=>{return g(t??{}).reduce((r,[n,i])=>{return r.push(v(i)&&i?n:`${n}="${i}"`),r},[""]).join(" ")},er=(t)=>{let r=new Set;if(!t)return"";let n=[...t].reduce((i,[o,e])=>{if(o==="meta"||o==="link")e=A(e);if(tt(e)){if(o==="title")r.add(`<${o}>${e}</${o}>`);else i.add(`<${o}>${e}</${o}>`);return i}if(!m(e))return i;if(o==="base"){let s=e.slice(-1);if(s)return r.add(`<${o}${it(s[0])}>`),i}return e.map((s)=>{if(o==="script"){let u={...s},h="";if("importmap"in u)u.type="importmap",h=JSON.stringify(u.importmap),delete u.importmap;else if("body"in u)h=u.body,delete u.body;return`<${o}${it(u)}>${h}</${o}>`}return`<${o}${it(s)}>`}).forEach((s)=>{if(s.includes('type="module"'))r.add(s);else if(s.includes("<meta"))r.add(s);else i.add(s)}),i},new Set);return[...r,...n].join("")};class ot{lang="en";htmlHead;head;constructor(){this.htmlHead=new a,this.head=(t={})=>{let r=new Q(this.htmlHead),{css:n,description:i,...o}=t;if(i)r.head={meta:[{name:"description",content:i}]};if(n){let f=(m(n)?n:[n]).map((s)=>({rel:"preload stylesheet",href:s,as:"style"}));r.head={link:[...f]}}r.head=o,this.htmlHead=r.head}}}var Mt=(t)=>{if(T)return;return new Promise((r,n)=>{let i=document.createElement("link");if(t.rel!=="stylesheet")t.rel="stylesheet",t.as="style";g(t).forEach(([o,e])=>{i.setAttribute(o,e)}),i.onload=()=>r(i),i.onerror=()=>n(new Error("Failed to load CSS")),document.head.appendChild(i)})},sr=(t)=>{if(T)return;return new Promise((r,n)=>{let i=document.createElement("script"),o="";if("importmap"in t)t.type="importmap",o=JSON.stringify(t.importmap),delete t.importmap;else if("body"in t)o=t.body,delete t.body;if(o)i.textContent=o;g(t).forEach(([e,f])=>{i.setAttribute(e,f)}),i.onload=()=>r(i),i.onerror=()=>n(new Error("Failed to load Script")),document.head.appendChild(i),requestAnimationFrame(()=>r("Script executed"))})},Kr=()=>{let r=document.querySelector("#d-css")?.sheet;if(r)return r;let n=document.createElement("style");return n.id="d-css",document.head.appendChild(n),n.sheet},zr=(t,r)=>{for(let n=0;n<t.cssRules.length;n++)if(t.cssRules[n].selectorText===r)return!0;return!1},Vr=(t)=>Object.entries(t).map(([r,n])=>`${j(r)}: ${n};`).join(" ");function Nr(t,r={}){if(T)return;let n=Kr();if(!n)return;if(!zr(n,t))n.insertRule(`${t} { ${Vr(r)} }`,n.cssRules.length)}var Yt=(t,r=!1)=>{if(Z(t))return[+t,Rt(t)?"int":"float"];if(r&&/\.\w+$/.test(t))return[t,"file"];if(t==="/")return[t,"-"];if(t.length===36&&t.match(/\-/g)?.length===4)return[t,"uuid"];return[t,"string"]},G=(t)=>{let r=t.startsWith("/")?t:"/"+t,n=r.match(/(?<=\/)[^/].*?(?=\/|$)/g)??["/"],[i,o]=n.reduce(([e,f],s)=>{if(s.includes("<")){let u=s.match(/(?<=<)[^/].*?(?=>|$)/g);if(u?.length){let[h,l]=u[0].split(":");if(h&&l)e.push(h),f.push(l)}}else e.push(s===">"?"/":s);return[e,f]},[[],[]]);if(r.endsWith("/")&&r.length>1)i.push("/");return{parsed:i,args:o}};class pt{storage;constructor(){this.storage=new a}cache(t,r){if(this.storage.lacks(t))this.storage.set(t,r());return this.storage.get(t)}}var fr=["int","float","file","uuid","string"],Tt=(t,r)=>{let n={},i=[],{parsed:o}=G(t),{parsed:e,args:f}=G(r);if(o.length===e.length)e.map((s,u)=>{let h=Yt(o[u],o.length-1===u);if(s===h[0])return h[0];if(fr.includes(h[1]))return i.push(h[0]),h[1];return s}),f.forEach((s,u)=>{n[s]=i[u]});return n};class K{_storage;CC;constructor(){this._storage=new a,this.CC=new pt}set(t){let{parsed:r,path:n}=t,i=S(r);if(!this._storage.get(i))this._storage.set(i,t);else throw`path: ${n} already used.`}get(t){let{parsed:r}=this.CC.cache(t,()=>G(t)),n={},i=this._storage.get(S(r));if(!i&&t!=="/")for(let o of this._storage.keys()){let e=[],f=kt(o);if(r.length===f.length){let s=f.map((l,b)=>{let c=Yt(r[b],r.length-1===b);if(l===c[0])return c[0];if(fr.includes(c[1]))return e.push(c[0]),c[1];return l}),u=S(s);if(this._storage.has(u)){i=this._storage.get(u),i?.args.forEach((l,b)=>{n[l]=e[b]});break}}}return[i,n]}}class et{path="";parsed=[];args=[];constructor(t){ct(this,{path:t,...G(t)})}}class ur{static rand(t=6,r){if(r)return Math.floor(Math.random()*(r-t+1)+t);return Math.floor(Math.random()*t)+1-1}static fill(t,r=null){return Array(t).fill(r)}static new({dom:t,id:r,inner:n}){let i=document.createElement(t);if(r)i.id=r;if(n)i.innerHTML=n;return i}static randFrom(t){if(Array.isArray(t)){let r=t.length,n=this.rand(0,r-1);return t[n]}else if(typeof t=="object"){let r=W(t),n=r.length,i=this.rand(0,n-1);return r[i]}}static randomAZ=vt;static makeID=x;static class(t,r){let n=r;if(t?.class)n.push(...m(t.class)?t.class:[t.class]);t.class=r}static get O(){return{vals:A,keys:W,items:g,has:rr,ass:p,len:(t={})=>W(t).length}}static get is(){return At}static get return(){return hr}static sleep=(t=1000)=>new Promise((r)=>setTimeout(r,t));static get screen(){let{innerWidth:t}=window,r={xs:t<=480,sm:t>=480,smd:t>=624,md:t>=768,lg:t>=1024,xl:t>=1280,xxl:t>=1536},n=g(r).reverse();for(let i=0;i<n.length;i++){let[o,e]=n[i];if(e)return o}return}bytes(t){if(t===0)return"0 Bytes";let r=1024,n=["Bytes","KB","MB","GB"],i=Math.floor(Math.log(t)/Math.log(r));return parseFloat((t/Math.pow(r,i)).toFixed(2))+" "+n[i]}static format(t){return new ar(t)}}class hr{static arr(t){return m(t)?t:[t]}static num(t,r=0){let n=parseFloat(t);return isNaN(n)?r:n}}class ar{val;constructor(t){this.val=t}get px(){return`${this.val}px`}get rem(){return`${this.val}rem`}get pr(){return`${this.val}%`}}var Lt={},U={};class lr{stream;url;constructor(t,r){if(this.url=t,t in Lt)this.stream=Lt[t];else this.stream=new EventSource(t,{withCredentials:r}),Lt[t]=this.stream,U[this.url]={}}on(t){let r=this.stream;return g(t).forEach(([n,i])=>{if(n in U[this.url])U[this.url][n].forEach((o)=>{this.stream.removeEventListener(n,o)}),U[this.url][n]=[];if(r.addEventListener(n,i),!(n in U[this.url]))U[this.url][n]=[];U[this.url][n].push(i)}),this}}function mr(t,r=!0){return new lr(t,r)}class gr{value;constructor(t){this.value=t}get str(){return String(this.value).toString()=="null"?null:String(this.value).toString()}get int(){if(Z(this.value))return parseInt(this.value);else return null}get float(){if(Z(this.value))return parseFloat(this.value);else return null}get bool(){if(this.value==="true")return!0;else if(this.value=="false")return!1;else return null}get json(){if(this.value)return JSON.parse(this.value);return null}}class z{key;state;storage;constructor(t,r="local",n){if(this.storage=r=="local"?localStorage:sessionStorage,typeof t=="object"){let[i,o]=g(t)[0];if(this.key=i,this.state=o,n){let e=this.as[n];this.state.value=e}V((e)=>{this.set=e},[this.state],{id:this.key})}else this.key=t,this.state=null}get as(){return new gr(this.storage.getItem(this.key))}get value(){return this.storage.getItem(this.key)}set set(t){let r=$(t)?S(t):String(t);this.storage.setItem(this.key,r)}get remove(){this.storage.removeItem(this.key);return}}var cr={get:(t)=>new z(t,"local"),init:(t,r)=>new z(t,"local",r)};var dr={get:(t)=>new z(t,"session")};class bt extends et{id;cls;constructor(t,r,n){super(t);this.id=r;this.cls=n}}class pr extends et{id;cls;constructor(t,r,n){super(t);this.id=r;this.cls=n}}class Pt extends ot{storage=new K;errorStorage=new K;wssStorage=new K;route;error;wss;base;constructor(t=""){super();this.base=t?t.startsWith("/")?t:`/${t}`:"",this.route=(r)=>{let n=this._base(r);return(i)=>{return i.route=n,this.storage.set(new bt(n,x(5),i)),i}},this.wss=(r)=>{let n=this._base(r);return(i)=>{return i.route=n,this.wssStorage.set(new pr(n,x(5),i)),i}},this.error=(...r)=>{return(n)=>{if(r.length)r.forEach((i)=>{this.errorStorage.set(new bt(i.toString(),x(5),n))});else this.errorStorage.set(new bt("404",x(5),n));return n}}}_base(t){return tr(this.base,t)}async getPath(t){return this.storage.get(t)}async loadError(t){return this.errorStorage.get(t.toString())}async loadWSS(t){return this.wssStorage.get(t)}}var st=new a,N=(t)=>{if(T)return;let r=st.get(t);if(r?.isConnected)return r;st.delete(t);let n=document.getElementById(t);if(!n)return;return st.set(t,n),n};function Tr(){let t=[];return st.forEach((r,n)=>{if(!r.isConnected)t.push(n),st.delete(n)}),t}function V(t,r,{id:n="stateHook",init:i}={}){if(T)return()=>{};let o=[],e=()=>r.map((s)=>s.value),f=()=>{t(...e())};if(r.forEach((s)=>{o.push(s.hook(f)(n))}),i)f();return()=>{o.forEach((s)=>s())}}var br=(t)=>{t.forEach((r)=>r())};var _r=(t,r)=>{for(let[n,i]of t){let o=N(n);if(!o){t.delete(n);continue}i.forEach((e)=>{e.call(o,r)})}};class Y extends EventTarget{options;hooks=new a;states=new a;_value;listening=!1;end;constructor(t,r){super();this.options=r;this._value=t}get value(){return this._value}set value(t){if(D(this._value)||m(this._value)){let r=Dt(this._value,t);if(!ir(r))return}else if(this._value instanceof Set){if(!nr(this._value,t))return}else if(this._value===t)return;this._value=t,this.dispatchEvent(new CustomEvent("updated",{detail:this._value}))}get listen(){let t=(r)=>{if(br(this.hooks),_r(this.states,r.detail),!this.states.size&&!this.hooks.size)this.end?.()};if(!this.listening)this.addEventListener("updated",t,this.options),this.listening=!0;return()=>{this.listening&&this.removeEventListener("updated",t,this.options),this.end=void 0,this.listening=!1}}call(t,r){return(n)=>{if(dt(n,this.states).set(r,t),!T&&!this.listening)this.end=this.listen;return()=>{if(this.states.has(n))this.states.get(n)?.delete(r)}}}hook(t){return(r)=>{if(this.hooks.set(r,t),!T&&!this.listening)this.end=this.listen;return()=>{if(this.hooks.has(r))this.hooks.delete(r)}}}}function M(t,r){return new Y(t,r)}var _=(t)=>{if(m(t))return t.filter((r)=>r!==void 0).join(" ");else if($(t)){if(D(t))return S(t)}else if(w(t))return _(t());else if(t!==void 0&&t!==null)return v(t)?t?"":"false":String(t);return""};function Or(t,r){switch(r??t){case"style":return function(n){this.style.setProperty(t,n)};default:return function(n){this.setAttribute(t,n)}}}class Ct{attr;constructor(t={}){this.attr=t}get(t,r=this.attr,n){let i=(o,e)=>{if(m(e))t.attr_push(o,_(e));else if(e instanceof Y){let f=n?`${n}_${o}`:o;t.states.push(e.call(Or(o,n),f)),i(o,e.value)}else if($(e)){if(D(e)&&!n)this.get(t,e,o)}else t.attr_push(o,_(e),n)};g(r).forEach(([o,e])=>{if(o==="ref"){if(e instanceof ft)t.events.obj({element(){e.element=this}})}else if(["on"].includes(o))$(r.on)&&t.events.obj(r.on);else i(o,e)})}}class F{xid;IDM;map=new a;states=[];events=new a;OZ;constructor(t,r=new H,n){this.xid=t;this.IDM=r;this.OZ=n??new yt}attr_push(t,r,n){let i=n??t;if(!this.map.has(i))this.map.set(i,[]);let o=n?`${j(t)}:${r};`:r;this.map.get(i).push(o)}get attr(){let t=[""];return this.map.forEach((r,n)=>{let i=r.join("");t.push(i?`${n}="${i}"`:n)}),t.join(" ")}set id(t){if(!this.map.has("id"))this.map.set("id",[t])}get id(){return this.map.get("id")?.join("")}}var kr=(t,r,n)=>{return t.addEventListener(r,n),()=>{t.removeEventListener(r,n)}},ut={};class yt{events=new a;states=new a;winStates=new a;windowEvents=new a;resetST=new a;resetEV=new a;constructor(){}get keys(){return[...new Set([...this.states.keys(),...this.events.keys()])]}set(t){let{id:r,events:n,states:i}=t;if(r){if(n.size)this.events.set(r,n);if(i.length)this.states.set(r,i)}return this}push(t){return t.events.forEach((r,n)=>{r.forEach((i,o)=>{dt(n,this.events).set(o,i)})}),t.states.forEach((r,n)=>{rt(n,this.states).push(...r)}),this}get stage(){return this.events.forEach((t,r)=>{this.events.delete(r);let n=N(r);if(!n){this.events.delete(r);return}t.forEach((i,o)=>{switch(o){case"ready":case"element":i.apply(n,[n]);break;case"resize":case"beforeunload":case"popstate":case"winscroll":case"winload":case"winfocus":case"winblur":let e=o.replace(/^win/,"");this.windowEvents.init(e,new a).set(r,i);break;case"state":let[f,s,u]=i.apply(n,[n]),h=m(s)?s:[s],l=()=>h.map((c)=>c.value),b=()=>f(...l());if(u)b();h.forEach((c)=>rt(r,this.resetST).push(c.call(b,r+"_state")(r)));break;default:rt(r,this.resetEV).push(kr(n,o,i))}})}),this.processWindowEvents,this.states.forEach((t,r)=>{this.states.delete(r),t.forEach((n)=>{rt(r,this.resetST).push(n(r))})}),this}get processWindowEvents(){let t=(r,n)=>{let i=0,o=!1,e=(s)=>{if(i=window.scrollY,!o)window.requestAnimationFrame(()=>{n.forEach((u,h)=>{let l=N(h);if(l)u.call(l,s);else this.windowEvents.get(r)?.delete(h)}),o=!1}),o=!0},f=(s)=>{n.forEach((u,h)=>{let l=N(h);if(l)u.call(l,s);else this.windowEvents.get(r)?.delete(h)})};return window.addEventListener(r,r==="scroll"?e:f),()=>{window.removeEventListener(r,r==="scroll"?e:f)}};return this.windowEvents.forEach((r,n)=>{if(r.size){if(!ut[n])ut[n]=t(n,r)}else if(ut[n])ut[n](),delete ut[n]}),this}reset(t){return t.forEach((r)=>{this.windowEvents.forEach((n,i)=>{if(n.has(r))n.delete(r)}),this.resetEV.get(r)?.forEach((n)=>{n()}),this.resetST.get(r)?.forEach((n)=>{n()}),this.resetST.delete(r),this.resetEV.delete(r)}),this}RPS(t){if(t){let r=Tr();this.reset(r);let n=t.keys;if(n.length)this.reset(n).push(t).stage}return this}}var L=new yt;var vr=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],tn=(t)=>vr.includes(t);function rn(t){return String(t).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var xt=(t,r)=>{if(m(t))return t.map((n)=>xt(n,r)).join("");else if(t instanceof O){let n=t.__(r.IDM),{ctx:i,oz:o}=n;return r.OZ.push(o),i}else if($(t))return S(t);else if(w(t))return xt(t(),r);else if(t!==void 0&&t!==null)return rn(t);return""},wt=(t,r)=>{let n=new H(r),i=new F(n.id,n);return{ctx:xt(t,i),catt:i}};function nn(t){let r=this.id;if(r){let{ctx:n,catt:i}=wt(t,r);if(this.innerHTML!==n)this.innerHTML=n,L.RPS(i.OZ)}}var ht=(t,r,n,i=[])=>{if(m(t))t.forEach((o)=>{ht(o,t.length,n,i)});else if(t instanceof Y)if(r>1)ht(X("div",{},t),r,n,i);else{let o=t.value,e=o instanceof O?"dom":"ctx",{ctx:f,catt:s}=wt(o,n.xid+"-0");n.xid=s.xid,i.push(f),n.OZ.push(s.OZ),n.states.push(t.call(nn,e))}else i.push(xt(t,n))};class Zt{tag;ctx;closing;constructor(t,r){this.tag=t;this.ctx=r;let n=tn(t);this.closing=n?"":`</${t}>`}process(t,r=this.ctx,n=[]){return r.forEach((i)=>{ht(i,r.length,t,n)}),n.join("")}get(t){let r=this.process(t);if(t.events.size||t.states.length)t.id=t.xid;return`<${this.tag}${t.attr}>${r}${this.closing}`}}class O{tag;constructor(t,r={},...n){this.tag=t;ct(this,{attr:new Ct(r),ctx:new Zt(t,n)})}__(t=new H){let r=t.mid,n=new F(r,t);return this.attr.get(n),{ctx:this.ctx.get(n),oz:n.OZ.set(n),id:n.id}}}function X(t,r={},...n){if(w(t))return t(r??{},...n);return new O(t,r??{},n)}var on=(t,...r)=>r;class Ft{e;opt;constructor(t){this.e=t;this.opt={duration:500,easing:"ease-in-out",fill:"forwards"}}animate(t,r={}){return this.e.animate(t,r)}get slide(){let t=({x:r=0,y:n=0},i={})=>{p(this.opt,i);let o=[[r,n],[0,0]].map(([e,f])=>({transform:`translateX(${e}rem) translateY(${f}rem)`}));return this.e.animate(o,this.opt),this};return{left:(r={})=>{return t({x:-2},r)},right:(r={})=>{return t({x:2},r)},up:(r={})=>{return t({y:2},r)},down:(r={})=>{return t({y:-2},r)}}}fade(t={}){p(this.opt,t);let r=[0,1].map((n)=>({opacity:n}));return this.e.animate(r,this.opt),this}shake(t="Y",r={}){p(this.opt,r);let n=[0,5,-5,5,0].map((i)=>({transform:`translate${t}(${i}px)`}));return this.e.animate(n,this.opt),this}color(t=[],r={}){p(this.opt,r);let n=Array.isArray(t)?t.map((i)=>({color:i})):{color:t};return this.e.animate(n,this.opt),this}bg(t=[],r={}){p(this.opt,r);let n=Array.isArray(t)?t.map((i)=>({backgroundColor:i})):{backgroundColor:t};return this.e.animate(n,this.opt),this}bounce(t=1,r={}){p(this.opt,r);let n=[0.5,t,1].map((i)=>({transform:`scale(${i})`}));return this.e.animate(n),this}}class Bt{e;query;constructor(t,r){this.e=t;this.query=r}get a(){return new Ft(this)}get all(){if(this.query){let t=document.querySelectorAll(this.query);if(t.length)return Array.from(t).map((r)=>r)}return[]}get attr(){let t=this.e;return{has:(r)=>{return t.hasAttribute(r)},get:(r)=>{return t.getAttribute(r)},del:(r)=>{return t.removeAttribute(r),this},set:(r)=>{for(let n in r){let i=r[n];if(r[n]!==void 0)t.setAttribute(n,_(i))}return this}}}get children(){return Array.from(this.e.children).map((t)=>d(t))}get click(){return this.e.click(),this}get delete(){return this.e.remove(),this}get disabled(){return this.e.disabled??!1}get focus(){return this.e.focus(),this}get href(){return this.e?.href??""}get id(){return this.e.id}get inner(){return this.e.innerHTML}get offsetParent(){let t=this.e.offsetParent;if(t)return new P(t);return}get parent(){let t=this.e.parentElement;if(t)return new P(t);return}get hash(){return this.e?.hash??""}get path(){return this.e?.pathname??""}get rect(){return this.e.getBoundingClientRect()}get remove_element(){return this.e.remove(),this}get style(){let t=this.e.style,r=this;return{set:(n,i=0)=>{let o=t,e=()=>{g(n).forEach(([f,s])=>{if(f in o){if(o[f]!==s)o[f]=s}else if(s!==null)t.setProperty(f,String(s))})};if(w(i))r.on("transitionend",i);if(St(i))setTimeout(e,i);else e();return r},get:(n)=>{let i=j(String(n));return t.getPropertyValue(i)},del:(...n)=>{n.forEach((i)=>{let o=j(String(i));t.removeProperty(o)})}}}get submit(){let t=this.e;if("submit"in t)return t.submit();return!1}get tag(){return this.e.tagName.toLowerCase()}get value(){return this.e.value??""}get unload(){return()=>{this.e.remove()}}set append(t){let{ctx:r,oz:n}=Xt(t,qt(this.id));this.e.insertAdjacentHTML("beforeend",r),L.RPS(n)}set appendfirst(t){let{ctx:r,oz:n}=Xt(t,qt(this.id));this.e.insertAdjacentHTML("afterbegin",r),L.RPS(n)}set inner(t){let{ctx:r,oz:n}=Xt(t,qt(this.id));this.e.innerHTML=r,L.RPS(n)}set disabled(t){let r=this.e;if("disabled"in r)r.disabled=t}set id(t){this.e.id=t}set value(t){let r=this.e;r.value=t}}var Xt=(t,r)=>{let{ctx:n,catt:i}=wt(t,r);return{ctx:n,oz:i.OZ}},qt=(t)=>t?`${t}-0`:t;class P extends Bt{constructor(t,r){super(t,r)}add(...t){return this.e.classList.add(...t.map((r)=>r.replace(/[^\w-]/,""))),this}remove(...t){return this.e.classList.remove(...t.map((r)=>r.replace(/[^\w-]/,""))),this}toggle(t,r){let n=typeof t!="string"?t.apply(this):t,i=this.e.classList;return n.split(" ").forEach((o)=>{i.toggle(o,r)}),this}has(t){return this.e.contains(t)}insert(t){return{HTML:(...r)=>{return r.forEach((n)=>{this.e.insertAdjacentHTML(t,n)}),this},element:(...r)=>{return r.forEach((n)=>{this.e.insertAdjacentElement(t,n)}),this},text:function(...r){return r.forEach((n)=>{this.e.insertAdjacentText(t,n)}),this}}}is(t){let r=this.e.classList.value.split(" "),n=this.e.tagName.toLocaleLowerCase(),i=!0,o=!0;if(t.dom)o=t.dom==n?!0:!1;if(t.class)if(Array.isArray(t.class))t.class.forEach((e)=>{i=i?r.includes(e):!1});else i=i?r.includes(t.class):!1;return i&&o}on(t,r,n=!1){let i=!1;if(t.indexOf("touch")>-1)i=!0;return this.e.addEventListener(t,r,{capture:n,passive:i}),this}remove_on(t,r,n=!1){return this.e.removeEventListener(t,r,n),this}timed(t,r=250){return setTimeout(()=>t(this),r),this}animate(t,r,n){let i={duration:300,easing:"ease",fill:"forwards"};if(w(r))n=r;else p(i,r);let o=this.e.animate(t,i);if(n)o.finished.then(n);return this}}function d(t){if(tt(t)){let r=document.querySelector(t);if(r)return new P(r,t);return}else if(D(t)){let[[r,n]]=g(t),o=`${r==="id"?"#":"."}${n}`,e=document.querySelector(o);if(e)return new P(e,o);return}else return new P(t)}class ft{state=new Y(void 0);constructor(){}get element(){return this.state.value?.e}set element(t){if(t)this.state.value=new P(t);else this.state.value=void 0}get $(){return this.state.value}}var en=()=>{return new ft};class It{lang;head="";constructor(t,r){if(this.lang=t,r)this.head=er(r)}body(t,r,n){return[`<!DOCTYPE html><html lang="${this.lang}">`,`<head>${this.head}</head>`,`<body id="${r??x(5)}"${n?" "+n:""}>${t}</body>`,"</html>"].join("")}}class $t extends jt{path;args;id;status;lang;import;_data={};static route="/";constructor(t,r={},n,i=200){super();this.path=t;this.args=r;this.id=n;this.status=i}async loader(){if(this.import)try{let t=await this.import;if(t.default)this.import=await t.default({...this.args,...this.data});else this.import=void 0}catch(t){return E.e=["import",{error:"loader"}],this.import=void 0,[]}if(this.body){let t=await this.body();return m(t)?t:[t]}if(this.import){let t=this.import;return m(t)?t:[t]}return[]}getHeadAttr(t={},...r){let n=new Q;if(R(t))n.head=t;n.id=this.id;let i=n.head;return r.forEach((o)=>{i.map(o)}),sn(n,this),i}set data(t){p(this._data,t)}get data(){return this._data}}class Ut extends $t{head(){this.title=`error ${this.status}`}body(){return X("div",{},this.path+" not found...")}}function sn(t,r){let{link:n,script:i,meta:o,title:e,base:f,description:s,css:u}=r;if(t.head={title:e,base:f,meta:o,link:n,script:i},s)t.head={meta:[{name:"description",content:s}]};if(u){let l=(m(u)?u:[u]).map((b)=>({rel:"preload stylesheet",href:b,as:"style"}));t.head={link:[...l]}}}function yr(t){let r=[];if(t?.length){let{href:n,target:i}=t[0],o=d("base");if(o){if(o.attr.get("href")!==n)o.attr.set({href:n,target:i})}else{let e=d(document.createElement("base"));e.attr.set({href:n,target:i}),document.head.append(e.e)}}return r}var xr=new a;async function wr(t,r={},n=!1){let i=at.value,o={};if(d("link")?.all.forEach((e)=>{let f=d(e),s=f.attr.get("href");if(s){let u=f.attr.get("rt");if(n){let h=xr.get(i);if(h){if(!h.has(s))o[s]=f.unload}else o[s]=f.unload}else if(u){if(u===t)o[s]=f.unload}}}),r&&R(r))for(let e of A(r)){let f=e.href;if(!(f in o))try{let s=void 0;if(!n){if(s=d(`link[href='${f}']`),s)s.attr.set({rt:t});e.rt=t;let u=xr.init(i,new Set);if(!u.has(f))u.add(f)}if(!s)await Mt(e)}catch(s){E.e=["link error",{error:"yvee @ link"}]}else delete o[f]}return A(o)}var fn=["charset","name","property","http-equiv"];function $r(t){let r={};if(d("meta")?.all.forEach((n)=>{let i=n.attributes;for(let o of fn)if(o in i){let e=i[o].value;r[`${o}_${o==="charset"?"":e}`]=n}}),t)g(t).forEach(([n,i])=>{if(n in r)d(r[n]).attr.set(i),delete r[n];else{let o=d(document.createElement("meta"));o.attr.set(i),document.head.append(o.e)}});return A(r).map((n)=>d(n).unload)}var Er=new a;async function Sr(t,r,n=!1){let i=at.value,o={};if(d("script[yid]")?.all.forEach((e)=>{let f=d(e),s=f.attr.get("yid");if(s){let u=f.attr.get("rt");if(n){let h=Er.get(i);if(h){if(!h.has(s))o[s]=f.unload}else o[s]=f.unload}else if(u){if(u===t)o[s]=f.unload}}}),r){for(let e of r)if("yid"in e)if(e.yid in o)delete o[e.yid];else try{if(!n){e.rt=t;let f=e.yid,s=Er.init(i,new Set);if(!s.has(f))s.add(f)}await sr(e)}catch(f){E.e=["script error",{error:"yvee @ script"}]}}return A(o)}async function Rr(t,r){let n=[];if(T)return[];let i=t.get("title")??"",{pushState:o}=this.config;if(o){let e=this.path.value,f=this.lastPath.value;if(f!==e)if(!f.startsWith(e))q(e,i);else if(e===this.base)q(e,i);else q(e,i)}if(this.isYvee)document.documentElement.lang=r,document.title=i,n.push(...yr(t.get("base"))),n.push(...$r(t.get("meta")));return n.push(...await wr(this.id,t.get("link"),this.isYvee)),n.push(...await Sr(this.id,t.get("script"),this.isYvee)),n}function q(t,r){if(T)return;let{pathname:n,hash:i}=window.location,o=n+i;if(t&&o!==t)history.pushState({},r??"",t)}class Jt{path;args;static route="/";isConnected=M(!1);data={};constructor(t,r={}){this.path=t;this.args=r;this.data=r}open(t){}message(t){}close(t){}error(t){}get connect(){if(this.ws&&this.ws.readyState<=1)return this;return this.ws=new WebSocket(this.path),this.ws.onopen=async(t)=>{this.isConnected.value=!0,await this.open.call(this,t)},this.ws.onmessage=async(t)=>{await this.message.call(this,t)},this.ws.onclose=async(t)=>{this.isConnected.value=!1,await this.close.call(this,t)},this.ws.onerror=async(t)=>{this.isConnected.value=this.ws.readyState<=1,await this.error.call(this,t)},this}get reconnect(){if(this.state>=2)this.connect;return this}get disconnect(){if(this.state<=1)this.ws.close();return this}get state(){return this.ws?.readyState??3}set send(t){if(this.isConnected.value)this.ws.send(t);else throw new Error(`websocket path ${this.path} not connected`)}}var k=new a;class Wt{yvee;constructor(t){this.yvee=t}async load(t){if(T)return;if(!k.has(t)){let[n,i]=await this.yvee.loadWSS(t);if(!n)return;let{cls:o,path:e,id:f}=n,s=new o(e,i).connect;return k.set(t,s),s}let r=k.get(t);return r.reconnect,r}unload(t){if(T)return;if(k.has(t)){let r=k.get(t);if(!r)return;r.disconnect,k.delete(t)}}}var Qt=new a;function un(t,r,n,i){let{on:o,top:e,topRef:f,...s}=t,u={...o??{},click(h){h.preventDefault();let l=d(this),b=l.path;i.value=n.value,n.value=b;let c=l.hash;if(c){let J=d(c),y=window.scrollY;if(J)y+=J.rect.top;if(f)y-=f?.value?.e.offsetHeight||0;if(e)if(typeof e==="number")y-=e;else y-=e();window.scrollTo({top:y,behavior:"smooth"}),q(b+c)}else if(i.value===n.value)window.scrollTo({top:l.rect.top||0,behavior:"smooth"}),q(window.location.pathname)}};return X("a",{...s,on:{...u}},...r)}function hn(t,r,n){let{classes:i}=t.config,{on:o,...e}=r,f={...r.on??{},...n&&{popstate(s){let h=s.target.location.pathname;t.path.value=h}},...{element(s){t.mainElement=this}}};return X("div",{...e,...i&&{class:i},on:f},t.root)}async function an(t,r){let[n,i]=await this.loadError(r??0);if(n){let{cls:o,id:e}=n;return new o(t,i,e,r)}else{let o=new Ut(t,i,x(5));return o.title=`error ${r}`,o}}function Gt(){if(B)return parseInt(d('meta[name="error"]')?.attr.get("content")??"200");return 200}class lt extends Pt{config;hook;root=M([]);socket;id=x(4);path=M("");lastPath=M("");loading=M(!1);mainElement;A;Main;load;matchPath;isYvee=!1;constructor(t={},r={}){super(t.base??"");this.config=t;if(this.socket=new Wt(this),t.id)this.id=t.id;this.A=(n,...i)=>{if(this.base){if(!n.href.startsWith(this.base))n.href=this._base(n.href)}return un(n,i,this.path,this.lastPath)},this.Main=(n)=>{if(R(r))if(!n.on)n.on=r;else p(n.on,r);return hn(this,n,this.isYvee)},this.load=async(n,i={})=>{if(this.hook)this.hook();if(n){this.path.value=n,this.lastPath.value=n;try{await this.render(n,404,i),this.hooker()}catch(o){E.e=["render error",{error:"Pager loader"}]}}return this},this.matchPath=(n)=>{let i=this._base(n),o=this.path.value,e=this.base;if(o===i)return!0;else{let f=o.replace(e,""),s=i.replace(e,"");if(s){if(f.startsWith(s))return!0}else if(!o)return!0}return!1}}hooker(){let t={},r={},n=this.path.value;if(this.hook)this.hook();this.hook=V(async(i)=>{if(r[n]=window.scrollY,t[n]=this.mainElement?.scrollTop??0,(await this.render(i,404)).done){let o=r[i]??0;if(o)window.scrollTo({top:o,behavior:"instant"});let e=t[i]??0;if(e)this.mainElement?.scrollTo({top:e,behavior:"instant"});n=i}},[this.path],{id:"router"})}async class(t,r,n=!1){let[i,o]=await this.getPath(t);if(i&&!n){let{cls:e,id:f}=i;return new e(t,o,f)}else return await an.call(this,t,404)}async fetch(t){if(t)try{if(t.fetch){let r=await t.fetch();if(D(r)&&R(r))t.data=r}}catch(r){E.e=["class fetch",{error:"fetch"}]}}async processHead(t,r={}){return t?await this.processClassHead(t,r):await this.processDefaultHead(r)}async processClassHead(t,r){if(t.head)await t.head();return t.getHeadAttr(r,this.htmlHead)}async processDefaultHead(t){let r=new Q;if(R(t))r.head=t;return r.head.map(this.htmlHead),r.head}async render(t,r=404,n={},i={},o=!0,e=!1){let f=await this.class(t,r??Gt(),e);f.data=n,await this.fetch(f);let s=await this.processHead(f,i);if(T)Qt.set(this.id,s);if(!f)return{lang:this.lang,heads:s,done:!1};let u=[];if(this.loading.value=!0,this.isYvee)u=await f.loader();let h=[];if(o)h=await Rr.call(this,s,f?.lang||this.lang);if(!this.isYvee)u=await f.loader(),h.forEach((l)=>l());if(this.isYvee)h.forEach((l)=>l());if(u.length)this.root.value=u;else await this.render(t,r,n,i,o,!0);return this.loading.value=!1,{heads:s,lang:f.lang??this.lang,done:!0}}}var at=M("");class Et extends lt{config;isYvee=!0;unload=!0;constructor(t={},r={}){super(t,r);this.config=t;this.path=at,this.load=async(n,i={})=>{if(B)n=mn()||this._base(n??"/");if(this.hook)this.hook();if(n){this.path.value=n,this.lastPath.value=n;try{await this.render(n,404,i),this.hooker()}catch(o){E.e=["render error",{error:"Yvee loader"}]}}return this}}}var ln=(t)=>{return(r)=>{t(r)}};function mn(){if(B)return d('meta[name="yvee"]')?.attr.get("content")??"/";return""}var Ar=(t,r,n,i=!1)=>{let o=[];if(o.push({charset:"utf-8"}),o.push({name:"viewport",content:"width=device-width, initial-scale=1.0"}),n)switch(n){case 404:o.push({name:"error",content:n.toString()});break;default:break}if(i)o.push({name:"yvee",content:r});if(t.meta)if(m(t.meta))t.meta.unshift(...o);else t.meta.push(o);else t.meta=o},Hr=async(t,r,n={},i=[])=>{let o=await r(n),e=m(o)?o:[o],f=new F(t,new H(t));return e.forEach((s)=>{ht(s,e.length,f,i)}),f.OZ.set(f),f.OZ};async function gn(t,r,n={}){let{bodyattr:i={},id:o,route:e,base:f="",index:s,data:u}=n;if(B){let h={},l=document.body.id;if(r)if(r instanceof Et)await r.load();else{if(u)if(w(u))h=await u();else h=u;let c=window.location.pathname;if(p(h,{path:c,status:Gt()}),e){if(e.length>1&&e.slice(-1)!=="/")c=c.replace(/^\/|\/$/g,"");p(h,Tt(c,e))}}let b=await Hr(l,t,h);L.push(b),requestAnimationFrame(()=>{L.stage})}return async({path:h,data:l={},status:b=200})=>{let c=x(4),J=new a,y={};if(o)c=o;if(i.id)c=i.id.toString();let Kt="en";if(r instanceof Et){let{base:C,path:mt,id:Dr,lang:jr}=r;if(y.base=[{href:C==="/"?C:`${C}/`,target:"_blank"}],y.script)y.script.push({type:"module",src:"./index.js"});else y.script=[{type:"module",src:"./index.js"}];mt.value=h,Ar(y,h,b,!0);let{heads:Vt}=await r.render(h,b,l,y,!1);Qt.values().forEach((Mr)=>{p(Vt.init("link",{}),Mr.get("link")??{})}),c=Dr,J=Vt,Kt=jr}else{let C=h==="/"?h:`${h}/`;if(s)C=`${s}/`;if(f)C=`${f}${C}`;if(y.base=[{href:C,target:"_self"}],y.script)y.script.push({type:"module",src:"./index.js"});else y.script=[{type:"module",src:"./index.js"}];if(e)p(l,Tt(h,e));p(l,{status:b,path:h,base:f}),p(y,w(r)?await r(l):r),Ar(y,h,b);let mt=new ot;mt.head(y),J=mt.htmlHead}let zt=[];return await Hr(c,t,l,zt),new It(Kt,J).body(zt.join(""),c,it(i))}}var Fs=(t,r)=>{return`${t.replace(/\/+$/,"")}/${r.replace(/^\.\/+/,"")}`},Xs=(t)=>{if(T)return;return t()};export{Jt as websocket,en as useRef,dr as session,Fs as resolvePath,q as pushHistory,E as log,cr as local,on as frag,mr as eventStream,X as dom,$t as doc,Mt as cssLoader,Nr as addCSS,ur as __,Et as Yvee,Y as Stateful,V as StateHook,M as State,ln as Routes,gn as Render,ft as Ref,lt as Pager,nt as Meta,Xs as IfClient,O as Dom,d as $};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "yvee",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"description": "Yvee JS framework",
|
|
5
5
|
"author": "Marky <markjotep@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -25,18 +25,10 @@
|
|
|
25
25
|
"url": "https://github.com/MARKjotep/yvee/issues"
|
|
26
26
|
},
|
|
27
27
|
"homepage": "https://github.com/MARKjotep/yvee#readme",
|
|
28
|
-
"dependencies": {
|
|
29
|
-
"dotenv": "^16.4.7",
|
|
30
|
-
"jsonwebtoken": "^9.0.2",
|
|
31
|
-
"pg": "^8.13.1",
|
|
32
|
-
"authored": "^0.0.2",
|
|
33
|
-
"rollup": "^4.31.0",
|
|
34
|
-
"rollup-plugin-dts": "^6.1.1"
|
|
35
|
-
},
|
|
28
|
+
"dependencies": {},
|
|
36
29
|
"devDependencies": {
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"@types/bun": "^1.2.2"
|
|
30
|
+
"rollup": "^4.34.8",
|
|
31
|
+
"rollup-plugin-dts": "^6.1.1"
|
|
40
32
|
},
|
|
41
33
|
"peerDependencies": {
|
|
42
34
|
"typescript": "^5.7.3"
|