cradova 3.3.0 → 3.3.1

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/README.md CHANGED
@@ -27,7 +27,28 @@
27
27
  [![npm Downloads](https://img.shields.io/npm/dm/cradova.svg)](https://www.npmjs.com/package/cradova)
28
28
  [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/cradova/cradova.js/blob/next/contributing.md)![Forks](https://img.shields.io/github/forks/uiedbook/cradova?style=social) ![Stargazers](https://img.shields.io/github/stars/uiedbook/cradova?style=social)
29
29
 
30
- ## What's New? Conditionals!
30
+ ## 2024 - What's New? Ref methods!
31
+
32
+ ```js
33
+ type dataType = { year: string, age: string };
34
+
35
+ const Header =
36
+ new Ref() <
37
+ dataType >
38
+ function (data = { year: "2023", age: "2" }) {
39
+ return header(h1("Cradova is " + data.age + " yrs old in " + data.year));
40
+ };
41
+
42
+ Header.define("increase", function (isNewYear) {
43
+ if (isNewYear) {
44
+ this.updateState({ year: "2024", age: "3" });
45
+ }
46
+ });
47
+ document.body.appendChild(Header.render());
48
+ Header.methods.increase(true);
49
+ ```
50
+
51
+ ## 2023 - What's New? Conditionals!
31
52
 
32
53
  ```js
33
54
  import { div, h1, $if, $ifelse, $case, $switch } from "cradova";
@@ -72,7 +93,7 @@ Cradova is a web development framework for building Single Page Applications and
72
93
 
73
94
  It's a fast and simple framework, it provides an easy to use state management and router system.
74
95
 
75
- Cradova follows the [VJS specification](https://github.com/uiedbook/cradova/blob/main/VJS_spec/spec.md)
96
+ Cradova follows the [VJS specification](https://github.com/uiedbook/cradova/blob/main/VJS_spec/specification.md)
76
97
 
77
98
  ## What's the benefit?
78
99
 
@@ -129,10 +150,9 @@ const html = div(Hello("peter"), Hello("joe"));
129
150
  document.body.append(html);
130
151
  ```
131
152
 
132
- ## working with state:
153
+ ## Basic Samples:
133
154
 
134
- this a collection of basic examples
135
- you can choose any that best suite what problem you want to solve
155
+ this a collection of basic examples that can give you some ideas
136
156
 
137
157
  ```js
138
158
  import _, { button, createSignal, Ref, reference, h1, br, div } from "cradova";
@@ -225,7 +245,7 @@ Let's see a simple TodoList example
225
245
 
226
246
  ```js
227
247
  import _, {
228
- // elements
248
+ // tags
229
249
  div,
230
250
  button,
231
251
  main,
@@ -235,8 +255,6 @@ import _, {
235
255
  createSignal,
236
256
  // dom ref
237
257
  useRef(),
238
- // useState
239
- // useEffect
240
258
  // dynamic component class
241
259
  Ref,
242
260
  css,
@@ -468,7 +486,7 @@ We are currently working to [set](https://github.com/uiedbook/cradova/blob/main/
468
486
 
469
487
  - building Cradova CLI (in progress)
470
488
  - Cradova Documentation Website
471
- - UI component libraries for cradova
489
+ - UI component libraries for cradova (The Sacho Project)
472
490
  - Sample projects
473
491
  - maintenance and promotion
474
492
 
@@ -481,12 +499,23 @@ We are currently working to [set](https://github.com/uiedbook/cradova/blob/main/
481
499
  ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚══════╝ ╚════╝ ╚══╝ ╚═╝ ╚═╝
482
500
  ```
483
501
 
484
- ## Sponsor
502
+ ## Apache Lincenced
503
+
504
+ Opensourced And Free.
505
+
506
+ Uiedbook is an open source team of web focused engineers, Our vision is to make the web better, improving and innovating infrastructures for a better web experience.
507
+
508
+ Join Us on [telegram](https://t.me/UiedbookHQ).
485
509
 
486
- Your contribution(s) is a good force for change anytime you do it, you can ensure Cradova's growth and improvement by contributing a re-occuring or fixed donations to:
510
+ ### Contribution and License Agreement
487
511
 
488
- https://www.buymeacoffee.com/fridaycandour
512
+ If you contribute code to this project, you are implicitly allowing your code to be distributed under same license. You are also implicitly verifying that all code is your original work.
489
513
 
490
- Or Click.
514
+ ## Supporting Exabase development
491
515
 
492
- <a href="https://www.buymeacoffee.com/fridaycandour"><img src="https://img.buymeacoffee.com/button-api/?text=Buy us a coffee&emoji=&slug=fridaycandour&button_colour=FFDD00&font_colour=000000&outline_colour=000000&coffee_colour=ffffff" /></a>
516
+ Your Support is a good force for change anytime you do it, you can ensure Our projects, growth, Cradova, Exabase, JetPath etc, growth and improvement by making a re-occuring or fixed sponsorship
517
+ to [github sponsors](https://github.com/sponsors/FridayCandour):
518
+ or crypto using
519
+ etheruen: `0xD7DDD4312A4e514751A582AF725238C7E6dF206c`,
520
+ Bitcoin: `bc1q5548kdanwyd3y07nyjjzt5zkdxqec4nqqrd760` or
521
+ LTC: `ltc1qgqn6nqq6x555rpj3pw847402aw6kw7a25dc29w`.
package/dist/index.d.ts CHANGED
@@ -1,3 +1,20 @@
1
+
2
+ /*
3
+ ============================================================================="
4
+ ██████╗ ██████╗ █████═╗ ███████╗ ███████╗ ██╗ ██╗ █████╗
5
+ ██╔════╝ ██╔══██╗ ██╔═╗██║ █ ██ ██╔═════╝█ ██║ ██║ ██╔═╗██
6
+ ██║ ██████╔╝ ███████║ █ ██ ██║ ██ ██║ ██║ ██████╗
7
+ ██║ ██╔══██╗ ██║ ██║ █ ██ ██║ ██ ╚██╗ ██╔╝ ██║ ██╗
8
+ ╚██████╗ ██║ ██║ ██║ ██║ ███████╔╝ ████████ ╚███╔╝ ██║ ██║
9
+ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚══════╝ ╚════╝ ╚══╝ ╚═╝ ╚═╝
10
+ =============================================================================
11
+ Cradova
12
+ @version 3.3.0
13
+ License: Apache V2
14
+ Copyright 2022 Friday Candour.
15
+ Repository - https://github.com/fridaycandour/cradova
16
+ =============================================================================
17
+ */
1
18
  import * as CSS from 'csstype';
2
19
 
3
20
  /*! *****************************************************************************
@@ -8,8 +25,119 @@ License at http://www.apache.org/licenses/LICENSE-2.0
8
25
 
9
26
  See the Apache Version 2.0 License for specific language governing permissions
10
27
  and limitations under the License.
11
- ***************************************************************************** */
28
+ ********************************************************************************/
12
29
 
30
+ /**
31
+ * Cradova event
32
+ */
33
+ declare class cradovaEvent {
34
+ private listeners;
35
+ private active_listeners;
36
+ addEventListener(eventName: string, callback: () => void): Promise<void>;
37
+ addActiveEventListener(eventName: string, callback: () => void): Promise<void>;
38
+ dispatchEvent(eventName: string, eventArgs?: unknown): Promise<void>;
39
+ /**
40
+ * Active refs is a concept for delegated screens to keep their active refs alive
41
+ * even in the case of naviagtion
42
+ * @param eventName
43
+ * @param eventArgs
44
+ */
45
+ dispatchActiveEvent(eventName: string, eventArgs?: unknown): Promise<void>;
46
+ }
47
+ declare const CradovaEvent: cradovaEvent;
48
+ /**
49
+ * Cradova Ref
50
+ * -------
51
+ * create dynamic components
52
+ */
53
+ declare class Ref<Prop extends Record<string, any> = any> {
54
+ private component;
55
+ private effects;
56
+ private effectuate;
57
+ methods: Record<string, Function>;
58
+ private rendered;
59
+ private published;
60
+ private preRendered;
61
+ private reference;
62
+ Signal: createSignal<any> | undefined;
63
+ _state: Prop[];
64
+ _state_track: {
65
+ [x: number]: boolean;
66
+ };
67
+ _state_index: number;
68
+ stash: Prop | undefined;
69
+ constructor(component: (this: Ref<Prop>, data: Prop) => HTMLElement | DocumentFragment);
70
+ preRender(data?: Prop, stash?: boolean): void;
71
+ destroyPreRendered(): void;
72
+ /**
73
+ * Cradova Ref
74
+ * ---
75
+ * construct to add custom methods to Refs
76
+ * @param methodName
77
+ * @param method
78
+ * @returns void
79
+ */
80
+ define(methodName: string, method: (this: this, ...arg: any) => void): void;
81
+ /**
82
+ * Cradova Ref
83
+ * ---
84
+ * returns html with cradova reference
85
+ * @param data
86
+ * @returns () => HTMLElement
87
+ */
88
+ render(data?: Prop, stash?: boolean): HTMLElement | DocumentFragment;
89
+ instance(): HTMLElement;
90
+ _setExtra(Extra: createSignal<any>): void;
91
+ _roll_state(data: any, idx: number, get?: boolean): Prop;
92
+ _effect(fn: () => Promise<void> | void): void;
93
+ private effector;
94
+ /**
95
+ * Cradova Ref
96
+ * ---
97
+ * update ref component with new data and update the dom.
98
+ * @param data
99
+ * @returns
100
+ */
101
+ updateState(data?: Prop, stash?: boolean): void;
102
+ private Activate;
103
+ }
104
+ /**
105
+ * cradova
106
+ * ---
107
+ * lazy load a file
108
+ */
109
+ declare class lazy<Type> {
110
+ content: Type | undefined;
111
+ private _cb;
112
+ constructor(cb: () => Promise<unknown>);
113
+ load(): Promise<void>;
114
+ }
115
+ /**
116
+ * Cradova
117
+ * ---
118
+ * make reference to dom elements
119
+ */
120
+ declare class reference {
121
+ tree: Record<string, any>;
122
+ globalTree: Record<string, HTMLElement>;
123
+ /**
124
+ * Bind a DOM element to a reference name.
125
+ * @param name - The name to reference the DOM element by.
126
+ */
127
+ bindAs(name: string): reference;
128
+ /**
129
+ * Retrieve a referenced DOM element.
130
+ * @param name - The name of the referenced DOM element.
131
+ */
132
+ current<ElementType extends HTMLElement = HTMLElement>(name: string): ElementType;
133
+ /**
134
+ * Append a DOM element to the reference, overwriting any existing reference.
135
+ * @param name - The name to reference the DOM element by.
136
+ * @param element - The DOM element to reference.
137
+ */
138
+ _appendDomForce(name: string, Element: HTMLElement): void;
139
+ _appendDomForceGlobal(name: string, Element: HTMLElement): void;
140
+ }
13
141
  /**
14
142
  * Cradova Signal
15
143
  * ----
@@ -24,7 +152,7 @@ and limitations under the License.
24
152
  * - update a cradova Ref automatically
25
153
  * @constructor initial: unknown, props: {useHistory, persist}
26
154
  */
27
- declare class createSignal<Type extends Record<string, unknown>> {
155
+ declare class createSignal<Type extends Record<string, any>> {
28
156
  private callback;
29
157
  private persistName;
30
158
  private actions;
@@ -92,7 +220,7 @@ declare class createSignal<Type extends Record<string, unknown>> {
92
220
  * @param Ref component to bind to.
93
221
  * @param path a property in the object to send to attached ref
94
222
  */
95
- bindRef(ref: Partial<Ref<unknown>>, binding?: {
223
+ bindRef(ref: Partial<Ref>, binding?: {
96
224
  event?: string;
97
225
  signalProperty: string;
98
226
  _element_property: string;
@@ -112,179 +240,6 @@ declare class createSignal<Type extends Record<string, unknown>> {
112
240
  */
113
241
  clearPersist(): void;
114
242
  }
115
-
116
- /*! *****************************************************************************
117
- Copyright 2022 Friday Candour. All rights reserved.
118
- Licensed under the Apache License, Version 2.0 (the "License"); you may not use
119
- this file except in compliance with the License. You may obtain a copy of the
120
- License at http://www.apache.org/licenses/LICENSE-2.0
121
-
122
- See the Apache Version 2.0 License for specific language governing permissions
123
- and limitations under the License.
124
- ***************************************************************************** */
125
-
126
- declare const isNode: (element: unknown) => boolean;
127
- /**
128
- * Cradova event
129
- */
130
- declare class cradovaEvent {
131
- private listeners;
132
- private active_listeners;
133
- addEventListener(eventName: string, callback: () => void): Promise<void>;
134
- addActiveEventListener(eventName: string, callback: () => void): Promise<void>;
135
- dispatchEvent(eventName: string, eventArgs?: unknown): Promise<void>;
136
- dispatchActiveEvent(eventName: string, eventArgs?: unknown): Promise<void>;
137
- }
138
- declare const CradovaEvent: cradovaEvent;
139
- declare function Rhoda(l: VJSType<HTMLElement>[] | (() => any)[] | Ref<unknown>[] | HTMLElement[]): DocumentFragment;
140
- declare function css(identifier: string | TemplateStringsArray): void;
141
- /**
142
- *
143
- * @param {expression} condition
144
- * @param {function} elements[]
145
- */
146
- declare function $if<Type>(condition: boolean, ...elements: VJS_Child_TYPE<Type | HTMLElement>[]): HTMLElement[] | undefined;
147
- declare function $ifelse<Type>(condition: boolean, ifTrue: VJS_Child_TYPE<Type | HTMLElement>, ifFalse: VJS_Child_TYPE<Type | HTMLElement>): VJS_Child_TYPE<HTMLElement | Type>;
148
- declare function $case<Type>(value: any, ...elements: VJS_Child_TYPE<Type | HTMLElement>[]): (key: any) => HTMLElement[] | undefined;
149
- declare function $switch(key: unknown, ...cases: ((key: any) => HTMLElement[] | undefined)[]): HTMLElement[] | undefined;
150
- type LoopData<Type> = Type[];
151
- declare function loop<Type>(datalist: LoopData<Type>, component: (value: Type, index?: number, array?: LoopData<Type>) => HTMLElement | DocumentFragment | undefined): HTMLElement[] | undefined;
152
- declare function memo_SNRU(): void;
153
- /**
154
- * Cradova Ref
155
- * -------
156
- * create dynamic components
157
- */
158
- declare class Ref<D> {
159
- private component;
160
- private effects;
161
- private effectuate;
162
- private rendered;
163
- private published;
164
- private preRendered;
165
- private reference;
166
- Signal: createSignal<any> | undefined;
167
- _state: D[];
168
- _state_track: {
169
- [x: number]: boolean;
170
- };
171
- _state_index: number;
172
- stash: D | undefined;
173
- constructor(component: (this: Ref<D>, data: D) => HTMLElement | DocumentFragment, options?: {
174
- active: boolean;
175
- } | boolean);
176
- preRender(data?: D, stash?: boolean): void;
177
- destroyPreRendered(): void;
178
- /**
179
- * Cradova Ref
180
- * ---
181
- * construct to add custom methods to Refs
182
- * @param methodName
183
- * @param method
184
- * @returns void
185
- */
186
- define(methodName: string, method: () => void): void;
187
- /**
188
- * Cradova Ref
189
- * ---
190
- * returns html with cradova reference
191
- * @param data
192
- * @returns () => HTMLElement
193
- */
194
- render(data?: D, stash?: boolean): HTMLElement | DocumentFragment;
195
- instance(): HTMLElement;
196
- _setExtra(Extra: createSignal<any>): void;
197
- _roll_state(data: D, idx: number, get?: boolean): D;
198
- _effect(fn: () => Promise<void> | void): void;
199
- private effector;
200
- /**
201
- * Cradova Ref
202
- * ---
203
- * update ref component with new data and update the dom.
204
- * @param data
205
- * @returns
206
- */
207
- updateState(data?: D, stash?: boolean): void;
208
- private Activate;
209
- }
210
- /**
211
- * Document fragment
212
- * @param children
213
- * @returns
214
- */
215
- declare const frag: (children: VJSType<HTMLElement>[]) => DocumentFragment;
216
- /**
217
- * cradova
218
- * ---
219
- * lazy load a file
220
- */
221
- declare class lazy<Type> {
222
- content: Type | undefined;
223
- private _cb;
224
- constructor(cb: () => Promise<unknown>);
225
- load(): Promise<void>;
226
- }
227
- /**
228
- * Cradova
229
- * ---
230
- * make reference to dom elements
231
- */
232
- declare class reference {
233
- tree: Record<string, any>;
234
- globalTree: Record<string, HTMLElement>;
235
- /**
236
- * Bind a DOM element to a reference name.
237
- * @param name - The name to reference the DOM element by.
238
- */
239
- bindAs(name: string): reference;
240
- /**
241
- * Retrieve a referenced DOM element.
242
- * @param name - The name of the referenced DOM element.
243
- */
244
- current<ElementType extends HTMLElement = HTMLElement>(name: string): ElementType;
245
- /**
246
- * Append a DOM element to the reference, overwriting any existing reference.
247
- * @param name - The name to reference the DOM element by.
248
- * @param element - The DOM element to reference.
249
- */
250
- _appendDomForce(name: string, Element: HTMLElement): void;
251
- _appendDomForceGlobal(name: string, Element: HTMLElement): void;
252
- }
253
- /**
254
- * Cradova
255
- * ---
256
- * Allows functional components to manage state by providing a state value and a function to update it.
257
- * @param initialValue
258
- * @param ActiveRef
259
- * @returns [state, setState]
260
- */
261
- declare function useState<S = unknown>(initialValue: S, ActiveRef: Ref<unknown>): [S, (newState: S) => void];
262
- /**
263
- * Cradova
264
- * ---
265
- Allows side effects to be performed in functional components (Refs), such as fetching data or subscribing to events.
266
- * @param effect
267
- * @returns
268
- */
269
- declare function useEffect(effect: () => void, ActiveRef: Ref<unknown>): void;
270
- /**
271
- * Cradova
272
- * ---
273
- Returns a mutable reference object of dom elements that persists across component renders.
274
- * @returns reference
275
- */
276
- declare function useRef(): Record<string, HTMLElement | undefined>;
277
-
278
- /*! *****************************************************************************
279
- Copyright 2022 Friday Candour. All rights reserved.
280
- Licensed under the Apache License, Version 2.0 (the "License"); you may not use
281
- this file except in compliance with the License. You may obtain a copy of the
282
- License at http://www.apache.org/licenses/LICENSE-2.0
283
-
284
- See the Apache Version 2.0 License for specific language governing permissions
285
- and limitations under the License.
286
- ***************************************************************************** */
287
-
288
243
  /**
289
244
  * Cradova Screen
290
245
  * ---
@@ -292,7 +247,7 @@ and limitations under the License.
292
247
  * @param name
293
248
  * @param template
294
249
  */
295
- declare class Screen {
250
+ declare class Screen$1 {
296
251
  /**
297
252
  * used internally
298
253
  */
@@ -300,8 +255,8 @@ declare class Screen {
300
255
  /**
301
256
  * this should be a cradova screen component
302
257
  */
303
- _html: ((this: Screen, data?: unknown) => HTMLElement | DocumentFragment) | HTMLElement | DocumentFragment;
304
- private _packed;
258
+ _html: ((this: Screen$1, data?: unknown) => HTMLElement | DocumentFragment) | HTMLElement | DocumentFragment;
259
+ _packed: boolean;
305
260
  private _template;
306
261
  private _callBack;
307
262
  private _deCallBack;
@@ -320,12 +275,11 @@ declare class Screen {
320
275
  };
321
276
  _apply_derivation(derivation: {
322
277
  _name: string;
323
- _transition: string | undefined;
324
- _callBack: (() => void | Promise<void>) | undefined;
325
- _deCallBack: (() => void | Promise<void>) | undefined;
278
+ _callBack: ((cradovaScreenSet: HTMLElement) => void | Promise<void>) | undefined;
279
+ _deCallBack: ((cradovaScreenSet: HTMLElement) => void | Promise<void>) | undefined;
326
280
  }): void;
327
- get _delegatedRoutes(): boolean;
328
- set _delegatedRoutes(count: boolean);
281
+ get _delegatedRoutes(): number;
282
+ set _delegatedRoutes(count: number);
329
283
  setErrorHandler(errorHandler: (err: unknown) => void): void;
330
284
  _package(): Promise<void>;
331
285
  onActivate(cb: () => Promise<void> | void): void;
@@ -334,109 +288,6 @@ declare class Screen {
334
288
  drop(state?: boolean): boolean | undefined;
335
289
  _Activate(force?: boolean): Promise<void>;
336
290
  }
337
-
338
- /*! *****************************************************************************
339
- Copyright 2022 Friday Candour. All rights reserved.
340
- Licensed under the Apache License, Version 2.0 (the "License"); you may not use
341
- this file except in compliance with the License. You may obtain a copy of the
342
- License at http://www.apache.org/licenses/LICENSE-2.0
343
-
344
- See the Apache Version 2.0 License for specific language governing permissions
345
- and limitations under the License.
346
- ***************************************************************************** */
347
-
348
- type DataAttributes = {
349
- [key: `data-${string}`]: string;
350
- };
351
- type AriaAttributes = {
352
- [key: `aria-${string}`]: string;
353
- };
354
- type VJSType<T> = (...VJS: (undefined | string | HTMLElement | HTMLElement[] | Ref<unknown> | Ref<unknown>[] | DocumentFragment | DocumentFragment[] | TemplateStringsArray | Partial<T> | (() => HTMLElement) | Partial<DataAttributes> | Partial<AriaAttributes> | CSS.Properties | {
355
- style?: CSS.Properties;
356
- onmount?: (this: T) => void;
357
- reference?: reference;
358
- })[]) => T;
359
- type VJS_params_TYPE<T> = (undefined | string | HTMLElement | HTMLElement[] | Ref<unknown> | Ref<unknown>[] | DocumentFragment | DocumentFragment[] | TemplateStringsArray | Partial<T> | (() => HTMLElement) | Partial<DataAttributes> | Partial<AriaAttributes> | CSS.Properties<string | number> | {
360
- src?: string;
361
- href?: string;
362
- placeholder?: string;
363
- type?: string;
364
- action?: string;
365
- name?: string;
366
- alt?: string;
367
- for?: string;
368
- method?: string;
369
- rows?: string;
370
- value?: string;
371
- target?: string;
372
- rel?: string;
373
- required?: string;
374
- frameBorder?: string;
375
- style?: CSS.Properties;
376
- onmount?: (this: T) => void;
377
- reference?: reference;
378
- })[];
379
- type VJS_Child_TYPE<T> = undefined | string | T | (() => T);
380
- type VJS_props_TYPE = {
381
- style?: CSS.Properties;
382
- onmount?: () => void;
383
- reference?: reference;
384
- };
385
- type CradovaScreenType<T = unknown> = {
386
- /**
387
- * Cradova screen
388
- * ---
389
- * title of the page
390
- * .
391
- */
392
- name?: string;
393
- /**
394
- * Cradova screen
395
- * ---
396
- * a css className to add to screen when rendering it
397
- * Usually for adding css transitions
398
- * .
399
- */
400
- /**
401
- * Cradova screen
402
- * ---
403
- * The component for the screen
404
- * @param data
405
- * @returns void
406
- * .
407
- */
408
- template: ((this: Screen, data?: T | unknown) => HTMLElement | DocumentFragment) | HTMLElement | DocumentFragment;
409
- /**
410
- * Cradova screen
411
- * ---
412
- * Allows this screen render in parallel for unique routes
413
- *
414
- * limit is 1000
415
- *
416
- * .
417
- */
418
- renderInParallel?: boolean;
419
- /**
420
- * Cradova screen
421
- * ---
422
- * Should this screen be cached after first render?
423
- * you can use Route.navigate(url, null, true) to force later
424
- *
425
- * .
426
- */
427
- persist?: boolean;
428
- };
429
-
430
- /*! *****************************************************************************
431
- Copyright 2022 Friday Candour. All rights reserved.
432
- Licensed under the Apache License, Version 2.0 (the "License"); you may not use
433
- this file except in compliance with the License. You may obtain a copy of the
434
- License at http://www.apache.org/licenses/LICENSE-2.0
435
-
436
- See the Apache Version 2.0 License for specific language governing permissions
437
- and limitations under the License.
438
- ***************************************************************************** */
439
-
440
291
  /** cradova router
441
292
  * ---
442
293
  * Registers a route.
@@ -500,7 +351,7 @@ declare class Router {
500
351
  *
501
352
  * @param screen
502
353
  */
503
- static setLoadingScreen(screen: Screen): void;
354
+ static setLoadingScreen(screen: Screen$1): void;
504
355
  /** cradova router
505
356
  * ---
506
357
  * Listen for navigation events
@@ -515,7 +366,7 @@ declare class Router {
515
366
  * @param {string} path Route path.
516
367
  * @param data data for the screen.
517
368
  */
518
- static packageScreen(path: string, data?: Record<string, unknown>): Promise<void>;
369
+ static packageScreen(path: string): Promise<void>;
519
370
  /**
520
371
  * Cradova Router
521
372
  * ------
@@ -524,7 +375,7 @@ declare class Router {
524
375
  *
525
376
  * .
526
377
  */
527
- static getParams(): any;
378
+ static getParams(): Record<string, unknown>;
528
379
  /**
529
380
  * Cradova
530
381
  * ---
@@ -547,8 +398,148 @@ See the Apache Version 2.0 License for specific language governing permissions
547
398
  and limitations under the License.
548
399
  ***************************************************************************** */
549
400
 
401
+ type DataAttributes = {
402
+ [key: `data-${string}`]: string;
403
+ };
404
+ type AriaAttributes = {
405
+ [key: `aria-${string}`]: string;
406
+ };
407
+ type VJSType<T> = (...VJS: (undefined | string | HTMLElement | HTMLElement[] | Ref | Ref[] | DocumentFragment | DocumentFragment[] | TemplateStringsArray | Partial<T> | (() => HTMLElement) | Partial<DataAttributes> | Partial<AriaAttributes> | CSS.Properties | {
408
+ style?: CSS.Properties;
409
+ onmount?: (this: T) => void;
410
+ reference?: reference;
411
+ })[]) => T;
412
+ type VJS_params_TYPE<T> = (undefined | string | HTMLElement | HTMLElement[] | Ref | Ref[] | DocumentFragment | DocumentFragment[] | TemplateStringsArray | Partial<T> | (() => HTMLElement) | Partial<DataAttributes> | Partial<AriaAttributes> | CSS.Properties<string | number> | {
413
+ src?: string;
414
+ href?: string;
415
+ placeholder?: string;
416
+ type?: string;
417
+ action?: string;
418
+ name?: string;
419
+ alt?: string;
420
+ for?: string;
421
+ method?: string;
422
+ rows?: string;
423
+ value?: string;
424
+ target?: string;
425
+ rel?: string;
426
+ required?: string;
427
+ frameBorder?: string;
428
+ style?: CSS.Properties;
429
+ onmount?: (this: T) => void;
430
+ reference?: reference;
431
+ })[];
432
+ type VJS_Child_TYPE<T> = undefined | string | T | (() => T);
433
+ type VJS_props_TYPE = {
434
+ style?: CSS.Properties;
435
+ onmount?: () => void;
436
+ reference?: reference;
437
+ };
438
+ type CradovaScreenType<T = unknown> = {
439
+ /**
440
+ * Cradova screen
441
+ * ---
442
+ * title of the page
443
+ * .
444
+ */
445
+ name?: string;
446
+ /**
447
+ * Cradova screen
448
+ * ---
449
+ * a css className to add to screen when rendering it
450
+ * Usually for adding css transitions
451
+ * .
452
+ */
453
+ /**
454
+ * Cradova screen
455
+ * ---
456
+ * The component for the screen
457
+ * @param data
458
+ * @returns void
459
+ * .
460
+ */
461
+ template: ((this: Screen, data?: T | unknown) => HTMLElement | DocumentFragment) | HTMLElement | DocumentFragment | Ref<any>;
462
+ /**
463
+ * Cradova screen
464
+ * ---
465
+ * Allows this screen render in parallel for unique routes
466
+ *
467
+ * limit is 1000
468
+ *
469
+ * .
470
+ */
471
+ renderInParallel?: boolean;
472
+ /**
473
+ * Cradova screen
474
+ * ---
475
+ * Should this screen be cached after first render?
476
+ * you can use Route.navigate(url, null, true) to force later
477
+ *
478
+ * .
479
+ */
480
+ persist?: boolean;
481
+ };
482
+
483
+ /*! *****************************************************************************
484
+ Copyright 2022 Friday Candour. All rights reserved.
485
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
486
+ this file except in compliance with the License. You may obtain a copy of the
487
+ License at http://www.apache.org/licenses/LICENSE-2.0
488
+
489
+ See the Apache Version 2.0 License for specific language governing permissions
490
+ and limitations under the License.
491
+ ********************************************************************************/
492
+
550
493
  declare const makeElement: <E extends HTMLElement>(element: E & HTMLElement, ElementChildrenAndPropertyList: VJS_params_TYPE<E>) => E;
551
494
  declare const make: (descriptor: any) => any[];
495
+ declare const cra: <E extends HTMLElement>(tag: string) => VJSType<E>;
496
+ declare function Rhoda(l: VJSType<HTMLElement>[] | (() => any)[] | Ref[] | HTMLElement[]): DocumentFragment;
497
+ declare function css(identifier: string | TemplateStringsArray): void;
498
+ /**
499
+ *
500
+ * @param {expression} condition
501
+ * @param {function} elements[]
502
+ */
503
+ declare function $if<Type>(condition: boolean, ...elements: VJS_Child_TYPE<Type | HTMLElement>[]): HTMLElement[] | undefined;
504
+ declare function $ifelse<Type>(condition: boolean, ifTrue: VJS_Child_TYPE<Type | HTMLElement> | VJS_Child_TYPE<Type | HTMLElement>[], ifFalse: VJS_Child_TYPE<Type | HTMLElement> | VJS_Child_TYPE<Type | HTMLElement>[]): VJS_Child_TYPE<HTMLElement | Type> | VJS_Child_TYPE<HTMLElement | Type>[];
505
+ declare function $case<Type>(value: any, ...elements: VJS_Child_TYPE<Type | HTMLElement>[]): (key: any) => HTMLElement[] | undefined;
506
+ declare function $switch(key: unknown, ...cases: ((key: any) => HTMLElement[] | undefined)[]): HTMLElement[] | undefined;
507
+ type LoopData<Type> = Type[];
508
+ declare function loop<Type>(datalist: LoopData<Type>, component: (value: Type, index?: number, array?: LoopData<Type>) => HTMLElement | DocumentFragment | undefined): HTMLElement[] | undefined;
509
+ /** Calculate a simple numerical representation of the URL */
510
+ declare let SNRU: string;
511
+ declare function memo_SNRU(): void;
512
+ /**
513
+ * Document fragment
514
+ * @param children
515
+ * @returns
516
+ */
517
+ declare const frag: (children: VJSType<HTMLElement>[]) => DocumentFragment;
518
+ /**
519
+ * Cradova
520
+ * ---
521
+ * Allows functional components to manage state by providing a state value and a function to update it.
522
+ * @param initialValue
523
+ * @param ActiveRef
524
+ * @returns [state, setState]
525
+ */
526
+ declare function useState<S = unknown>(initialValue: S, ActiveRef: Ref): [S, (newState: S) => void];
527
+ /**
528
+ * Cradova
529
+ * ---
530
+ Allows side effects to be performed in functional components (Refs), such as fetching data or subscribing to events.
531
+ * @param effect
532
+ * @returns
533
+ */
534
+ declare function useEffect(effect: () => void, ActiveRef: Ref): void;
535
+ /**
536
+ * Cradova
537
+ * ---
538
+ Returns a mutable reference object of dom elements that persists across component renders.
539
+ * @returns reference
540
+ */
541
+ declare function useRef(): Record<string, HTMLElement | undefined>;
542
+
552
543
  declare const a: VJSType<HTMLAnchorElement>;
553
544
  declare const article: VJSType<HTMLElement>;
554
545
  declare const audio: VJSType<HTMLAudioElement>;
@@ -611,6 +602,16 @@ declare const video: VJSType<HTMLVideoElement>;
611
602
  declare const svg: (svg: string, properties?: VJS_props_TYPE) => HTMLSpanElement;
612
603
  declare const raw: (html: string) => HTMLElement[];
613
604
 
605
+ /*! *****************************************************************************
606
+ Copyright 2022 Friday Candour. All rights reserved.
607
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
608
+ this file except in compliance with the License. You may obtain a copy of the
609
+ License at http://www.apache.org/licenses/LICENSE-2.0
610
+
611
+ See the Apache Version 2.0 License for specific language governing permissions
612
+ and limitations under the License.
613
+ ********************************************************************************/
614
+
614
615
  type TemplateType = <E extends HTMLElement>(...element_initials: VJS_params_TYPE<E | HTMLElement>) => E | HTMLElement | DocumentFragment;
615
616
  /**
616
617
  * Cradova
@@ -635,4 +636,4 @@ type TemplateType = <E extends HTMLElement>(...element_initials: VJS_params_TYPE
635
636
  */
636
637
  declare const _: TemplateType;
637
638
 
638
- export { $case, $if, $ifelse, $switch, CradovaEvent, Ref, Rhoda, Router, Screen, a, article, audio, br, button, canvas, caption, col, colgroup, createSignal, css, datalist, _ as default, details, dialog, div, em, embed, figure, footer, form, frag, h1, h2, h3, h4, h5, h6, head, header, hr, i, iframe, img, input, isNode, label, lazy, li, loop, main, make, makeElement, memo_SNRU, nav, ol, optgroup, option, p, progress, q, raw, reference, section, select, source, span, strong, summary, svg, table, tbody, td, template, textarea, th, title, tr, track, u, ul, useEffect, useRef, useState, video };
639
+ export { $case, $if, $ifelse, $switch, CradovaEvent, Ref, Rhoda, Router, SNRU, Screen$1 as Screen, a, article, audio, br, button, canvas, caption, col, colgroup, cra, createSignal, css, datalist, _ as default, details, dialog, div, em, embed, figure, footer, form, frag, h1, h2, h3, h4, h5, h6, head, header, hr, i, iframe, img, input, label, lazy, li, loop, main, make, makeElement, memo_SNRU, nav, ol, optgroup, option, p, progress, q, raw, reference, section, select, source, span, strong, summary, svg, table, tbody, td, template, textarea, th, title, tr, track, u, ul, useEffect, useRef, useState, video };
package/dist/index.js CHANGED
@@ -15,6 +15,6 @@ Copyright 2022 Friday Candour.
15
15
  Repository - https://github.com/fridaycandour/cradova
16
16
  =============================================================================
17
17
  */
18
- var p=r=>r instanceof HTMLElement||r instanceof DocumentFragment,T=class{constructor(){this.listeners={};this.active_listeners={};}async addEventListener(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t);}async addActiveEventListener(e,t){this.listeners[e]||(this.listeners[e]=[]),this.active_listeners[e].push(t);}async dispatchEvent(e,t){let n=this.listeners[e]||[];for(;n.length!==0;)n.shift()(t);}async dispatchActiveEvent(e,t){let n=this.listeners[e]||[];n.length&&w();for(let o=0;o<n.length;o++)n[o](t);}},f=new T;function E(r){let e=new DocumentFragment;for(let t of r)if(Array.isArray(t))e.appendChild(E(t));else {if(t instanceof v&&(t=t.render(void 0)),typeof t=="function"&&(t=t(),typeof t=="function"&&(t=t())),typeof t=="string"||typeof t=="number"){e.appendChild(document.createTextNode(t));continue}if(p(t))e.appendChild(t);else if(typeof t<"u")throw new Error(" \u2718 Cradova err: invalid child type: "+t+" ("+typeof t+")")}return e}function k(r){if(Array.isArray(r)&&(r=r[0]),typeof r=="string"){let e=document.querySelector("style");if(e!==null){e.textContent=r+e.textContent;return}e=document.createElement("style"),e.textContent=r,document.head.appendChild(e);}}function S(r,...e){if(r)return e}function C(r,e,t){return r?e:t}function R(r,...e){return t=>{if(t===r)return e}}function D(r,...e){if(e.length)for(let t=0;t<e.length;t++){let n=e[t],o=n(r);if(o)return o}}function P(r,e){if(typeof e!="function")throw new Error(" \u2718 Cradova err : Invalid component type, must be a function that returns html ");return Array.isArray(r)?r.map(e):void 0}var d;function w(){let r=0,e=window.location.href;for(let t=0;t<e.length;t++)r+=e.charCodeAt(t);d=r.toString();}var v=class{constructor(e,t){this.effects=[];this.effectuate=null;this.rendered=!1;this.published=!1;this.preRendered=null;this.reference=new u;this._state=[];this._state_track={};this._state_index=0;this.component=e.bind(this),t&&(t===!0||t.active)&&f.addActiveEventListener("active-Refs",()=>{this.updateState(this.stash);});}preRender(e,t){this.reference._appendDomForce("html",this.render(e,t));}destroyPreRendered(){this.preRendered=null;}define(e,t){typeof e=="string"&&typeof t=="function"&&!Object.prototype.hasOwnProperty.call(this,e)?this[e]=t.bind(this):console.error(" \u2718 Cradova err : Invalid Ref.define parameters");}render(e,t){this.effects=[],this.rendered=!1;let n=this.component(e);return typeof n=="function"&&(n=n()),n||(n=this.preRendered),t&&(this.stash=e),p(n)?(this.reference._appendDomForce("html",n),this.effector.apply(this),this.rendered=!0,this.published=!0):console.error(" \u2718 Cradova err : Invalid html content, got - "+n),n}instance(){return this.reference.current("html")}_setExtra(e){this.Signal=e;}_roll_state(e,t,n=!1){return n||(this._state[t]=e),this._state[t]}_effect(e){this.rendered||this.effects.push(e.bind(this));}async effector(){if(!this.rendered){for(let e=0;e<this.effects.length;e++)await this.effects[e].apply(this);this.effects=[];}this.effectuate&&(this.effectuate(),this.effectuate=null);}updateState(e,t){this.rendered?this.published&&this.Activate(e):this.effectuate=()=>{this.published&&this.Activate(e);},t&&(this.stash=e);}async Activate(e){if(this._state_index=0,this.published=!1,!this.rendered)return;let t=this.component(e);if(typeof t=="function"&&(t=t()),p(t)){let n=this.reference.current("html");n&&(n.insertAdjacentElement("beforebegin",t),n.remove()),this.published=!0,this.reference._appendDomForce("html",t),f.dispatchEvent("onmountEvent");}else console.error(" \u2718 Cradova err : Invalid html content, got - "+t);}},A=function(r){let e=document.createDocumentFragment();for(let t=0;t<r.length;t++){let n=r[t];if(typeof n=="function"&&(n=n()),p(n)){e.appendChild(n);continue}if(n instanceof String){e.appendChild(document.createTextNode(n));continue}throw console.error(" \u2718 Cradova err: wrong element type"+n),new TypeError(" \u2718 Cradova err: invalid element")}return e},H=class{constructor(e){this._cb=e;}async load(){let e=await this._cb();typeof e=="function"?e=await e():e=await e;let t=e;t.default&&(this.content=t?.default);}},u=class{constructor(){this.tree={};this.globalTree={};}bindAs(e){return [this,e]}current(e){return this.tree[d]?this.tree[d][e]:null}_appendDomForce(e,t){this.tree[d]?this.tree[d][e]=t:(this.tree[d]={},this.tree[d][e]=t);}_appendDomForceGlobal(e,t){this.globalTree[e]=t;}};function N(r,e){e._state_index+=1;let t=e._state_index;e._state_track[t]||(e._roll_state(r,t),e._state_track[t]=!0);function n(o){e._roll_state(o,t),e.updateState(o);}return [e._roll_state(null,t,!0),n]}function F(r,e){e._effect(r);}function V(){return new u}var y=class{constructor(e,t){this.persistName="";this.actions={};this.ref=[];if(this.value=e,t&&t.persistName){this.persistName=t.persistName;let n=localStorage.getItem(t.persistName);if(n&&n!=="undefined"&&(this.value=JSON.parse(n)),typeof e=="object")for(let o in e)Object.prototype.hasOwnProperty.call(this.value,o)||(this.value[o]=e[o]);}}set(e,t){typeof e=="function"?this.value=e(this.value):this.value=e,this.persistName&&localStorage.setItem(this.persistName,JSON.stringify(this.value)),this.ref.length&&t!==!1&&this._updateState(),this.callback&&this.callback(this.value);}setKey(e,t,n){if(typeof this.value=="object"&&!Array.isArray(this.value))this.value[e]=t,this.persistName&&localStorage.setItem(this.persistName,JSON.stringify(this.value)),this.ref.length&&n!==!1&&this._updateState(),this.callback&&this.callback(this.value);else throw new Error(`\u2718 Cradova err : can't set key ${String(e)} . store.value is not a javascript object`)}createAction(e,t){if(typeof e=="string"&&typeof t=="function")this.actions[e]=t;else throw new Error(`\u2718 Cradova err : can't create action, ${e} is not a function`)}createActions(e){for(let[t,n]of Object.entries(e))if(typeof t=="string"&&typeof n=="function")this.actions[t]=n;else throw new Error(`\u2718 Cradova err : can't create action, ${t} is not a function`)}fireAction(e,t){if(this._updateState(e,t),typeof this.actions[e]=="function")return this.actions[e].call(this,t);throw Error("\u2718 Cradova err : action "+e+" does not exist!")}bind(e){if(typeof this.value=="object"&&typeof this.value[e]<"u")return [this,e];throw new Error("\u2718 Cradova err : can't bind an unavailable property! "+e)}_updateState(e,t){if(e&&t)this.ref.map(n=>{if(n._event===e){if(n._element_property&&n._signalProperty){n.ref?.updateState({[n._element_property]:t[n._signalProperty]});return}if(n._element_property){n.ref.updateState({[n._element_property]:t});return}if(n._signalProperty){n.ref.updateState(t[n._signalProperty]);return}}});else for(let n=0;n<this.ref.length;n++){let o=this.ref[n];if(o._element_property&&o._signalProperty){o.ref.updateState({[o._element_property]:this.value[o._signalProperty]});continue}if(o._element_property){o.ref.updateState({[o._element_property]:this.value});continue}if(o._signalProperty){o.ref.updateState(this.value[o._signalProperty]);continue}if(!o._element_property&&!o._signalProperty){o.ref.updateState(this.value);continue}}}bindRef(e,t={signalProperty:"",_element_property:""}){if(e.render&&(e.render=e.render.bind(e,this.value)),e._setExtra&&e._setExtra(this),e&&e.updateState){this.ref.push({ref:e,_signalProperty:t.signalProperty,_element_property:t._element_property,_event:t.event});return}throw new Error("\u2718 Cradova err : Invalid parameters for binding ref to Signal")}listen(e){this.callback=e;}clearPersist(){this.persistName&&localStorage.removeItem(this.persistName);}};var m=new u,h=class{constructor(e){this._packed=!1;this._template=document.createElement("div");this._persist=!0;this._delegatedRoutesCount=-1;this._dropped=!1;this._errorHandler=null;let{template:t,name:n,persist:o,renderInParallel:s}=e;this._html=t,this._name=n||"Document",this._template.setAttribute("id","cradova-screen-set"),s===!0?(this._delegatedRoutesCount=0,this._persist=!1):typeof o=="boolean"&&(this._persist=o);}_derive(){return {_name:this._name,_callBack:this._callBack,_deCallBack:this._deCallBack}}_apply_derivation(e){this._name=e._name,this._callBack=e._callBack,this._deCallBack=e._deCallBack;}get _delegatedRoutes(){return this._delegatedRoutesCount>100?-1:this._delegatedRoutesCount}set _delegatedRoutes(e){e&&(this._delegatedRoutesCount+=1);}setErrorHandler(e){this._errorHandler=e;}async _package(){if(typeof this._html=="function"){let e=await this._html.apply(this);if(typeof e=="function")e=e(),p(e)&&(this._template.innerHTML="",this._template.appendChild(e));else if(p(e))this._template.innerHTML="",this._template.appendChild(e);else throw new Error(` \u2718 Cradova err: template function for the screen with name '${this._name}' returned ${e} instead of html`)}}onActivate(e){this._callBack=e;}onDeactivate(e){this._deCallBack=e;}async _deActivate(){this._deCallBack&&await this._deCallBack(m.globalTree.doc);}drop(e){if(typeof e=="boolean"){this._dropped=e;return}else return this._dropped}async _Activate(e=!1){if(this._dropped){history.go(-1);return}!this._persist||e||!this._packed?(w(),await this._package(),this._packed=!0):f.dispatchActiveEvent("active-Refs"),document.title=this._name,m.globalTree.doc.innerHTML="",m.globalTree.doc.appendChild(this._template),f.dispatchEvent("onmountEvent"),window.scrollTo({top:0,left:0,behavior:"instant"}),this._callBack&&await this._callBack(m.globalTree.doc);}};var a={};a.lastNavigatedRouteController=null;a.nextRouteController=null;a.lastNavigatedRoute=null;a.pageShow=null;a.pageHide=null;a.errorHandler=null;a.loadingScreen=null;a.params={};a.routes={};a.pageevents=[];a.paused=!1;a.start_pageevents=async function(r){setTimeout(()=>{for(let e=0;e<a.pageevents.length;e++)a.pageevents[e](r);},100);};var L=r=>{if(a.routes[r])return [a.routes[r],{path:r}];if(a.routes[r+"/"])return [a.routes[r],{path:r}];for(let e in a.routes){if(!e.includes(":"))continue;let t=r.split("/"),n=e.split("/");r.endsWith("/")&&t.pop();let o=0,s=0;if(t.shift(),n.shift(),n.length===t.length){let l={_path:""};for(let c=0;c<n.length;c++){if(n[c].includes(":")){s++;continue}t[c]===n[c]&&o++;}if(o+s===n.length){for(let c=0;c<n.length;c++)n[c].includes(":")&&(l[n[c].split(":")[1]]=t[c]);return l._path=e,[a.routes[e],l]}}}return []};a.route=(r,e)=>{if(typeof e<"u"){if(e&&!e._Activate)throw console.error(" \u2718 Cradova err: not a valid screen ",e),new Error(" \u2718 Cradova err: Not a valid cradova screen component");return a.routes[r]=e}};a.router=async function(r,e){let t=window.location.pathname,n,o;if(a.paused){window.location.hash="paused";return}if(t!==a.lastNavigatedRoute)if(a.nextRouteController?(n=a.nextRouteController,a.nextRouteController=null):[n,o]=L(t),typeof n<"u")try{if(typeof n=="function"&&(a.LoadingScreen&&a.LoadingScreen._Activate&&await a.LoadingScreen._Activate(),n=await n(),!n)){a.lastNavigatedRoute&&history.pushState({},t,a.lastNavigatedRoute);return}if(n._delegatedRoutes!==-1){n._delegatedRoutes=!0;let s=n._derive();n=new h({template:n._html}),n._apply_derivation(s),a.routes[t]=n;}o&&(a.params.params=o),await n._Activate(e),a.start_pageevents(t),a.lastNavigatedRouteController&&a.lastNavigatedRouteController._deActivate(),a.lastNavigatedRoute=t,a.lastNavigatedRouteController=n;}catch(s){if(n&&n._errorHandler)n._errorHandler(s);else if(a.errorHandler)a.errorHandler(s);else throw console.error(s),new Error(" \u2718 Cradova err: consider adding error boundary to the specific screen ")}else a.routes["*"]&&await a.routes["*"]._Activate(e);};var g=class{static BrowserRoutes(e){for(let t in e){let n=e[t];typeof n=="object"&&typeof n.then=="function"||typeof n=="function"?a.routes[t]=async()=>(n=await(typeof n=="function"?await n():await n),a.route(t,n?.default||n)):a.route(t,n);}g._mount();}static back(){history.go(-1);}static forward(){history.go(1);}static pauseNaviagtion(){a.paused=!0,window.location.hash="paused";}static resumeNaviagtion(){a.paused=!1,window.location.replace(window.location.pathname+window.location.search),history.go(-1);}static navigate(e,t=null,n=!1){if(typeof e!="string")throw new TypeError(" \u2718 Cradova err: href must be a defined path but got "+e+" instead");let o=null,s;if(e.includes("://"))window.location.href=e;else {if(e===window.location.pathname)return;[o,s]=L(e),o&&(a.nextRouteController=o,window.history.pushState({},"",e)),a.params.params=s,a.params.data=t,a.router(null,n);}}static navigateNauturally(e){if(typeof e!="string")throw new TypeError(" \u2718 Cradova err: pathname must be a defined path but got "+e+" instead");window.location.pathname=e;}static setLoadingScreen(e){if(e instanceof h)a.LoadingScreen=e;else throw new Error(" \u2718 Cradova err: Loading Screen should be a cradova screen class")}static onPageEvent(e){if(typeof e=="function")a.pageevents.push(e);else throw new Error(" \u2718 Cradova err: callback for pageShow event is not a function")}static async packageScreen(e,t={}){if(!a.routes[e])throw console.error(" \u2718 Cradova err: no screen with path "+e),new Error(" \u2718 Cradova err: cradova err: Not a defined screen path");let[n,o]=L(e);!n._Activate&&typeof n=="function"&&(n=await n()),n._delegatedRoutes!==-1&&(n._delegatedRoutes=!0,n=new h({name:n._name,template:n._html}),a.routes[e]=n),n._package(Object.assign(t,o||{})),n._packed=!0;}static getParams(){return a.params}static addErrorHandler(e){if(typeof e=="function")a.errorHandler=e;else throw new Error(" \u2718 Cradova err: callback for error event is not a function")}static _mount(){let e=document.querySelector("[data-wrapper=app]");e?m._appendDomForceGlobal("doc",e):(e=document.createElement("div"),e.setAttribute("data-wrapper","app"),document.body.appendChild(e),m._appendDomForceGlobal("doc",e)),window.addEventListener("pageshow",a.router),window.addEventListener("popstate",t=>{t.preventDefault(),a.router();});}};var _=(r,e)=>{let t={},n=null;if(e.length!==0)for(let o=0;o<e.length;o++){let s=e[o];if(typeof s=="function"&&(s=s()),s instanceof v&&(s=s.render()),p(s)){r.appendChild(s);continue}if(Array.isArray(s)){r.appendChild(E(s));continue}if(typeof s=="string"||typeof s=="number"){n=s;continue}if(typeof s=="object"){t=Object.assign(t,s);continue}}else return r;if(typeof t=="object"&&r)for(let[o,s]of Object.entries(t)){if(o==="style"&&typeof s=="object"){Object.assign(r.style,s);continue}if(Array.isArray(s)){if(o=="reference"&&s[0]instanceof u){s[0]._appendDomForce(s[1],r);continue}if(s[0]instanceof y){s[0].bindRef(r,{_element_property:o,signalProperty:s[1]});continue}}if(o==="onmount"&&typeof t.onmount=="function"){let l=()=>{t.onmount?.apply(r),t.onmount=void 0;};f.addEventListener("onmountEvent",l);continue}if(o.includes("data-")){r.setAttribute(o,s);continue}if(o.includes("aria-")){r.setAttribute(o,s);continue}if(o==="href"&&typeof s=="string"){let l=s||"";l.includes("://")||r.addEventListener("click",c=>{c.preventDefault(),g.navigate(r.pathname);if(l.includes("#")){let b=l.split("#").at(-1);document.getElementById("#"+b)?.scrollIntoView();}}),r.setAttribute(o,s);continue}if(typeof r.style[o]<"u"&&o!=="src"){r.style[o]=s;continue}r[o]=s;}return n&&r.appendChild(document.createTextNode(n)),r},x=function(r){if(typeof r!="string")return [];Array.isArray(r)&&(r=r[0]);let e="";if(r.includes("|")&&([r,e]=r.split("|"),!r))return ["P",void 0,void 0,e];let t;if(r.includes("#")){if(!r.includes("."))return r=r.split("#"),t=r.shift(),t||(t="DIV"),r[0].includes(" ")&&(r=[r[0].split(" ")[1]]),[t,r[0],void 0,e]}else return r=r.split("."),t=r.shift(),t||(t="DIV"),[t,void 0,r.join(" "),e];r=r.split(".");let n=[],o=[];t=!r[0].includes("#")&&r.shift(),t||(t="DIV");for(let s=0;s<r.length;s++){if(r[s].includes("#")){let l=r[s].split("#");if(o.push(l[1]),s===0){t=l[0];continue}n.push(l[0]);continue}n.push(r[s]);}return [t,o[0],n.join(" "),e]},i=r=>(...t)=>_(document.createElement(r),t),Q=i("a"),W=i("article"),X=i("audio"),Z=i("br"),z=i("button"),ee=i("canvas"),te=i("caption"),ne=i("col"),re=i("colgroup"),oe=i("datalist"),ae=i("details"),ie=i("dialog"),se=i("div"),le=i("em"),ce=i("embed"),pe=i("figure"),ue=i("footer"),de=i("form"),fe=i("h1"),me=i("h2"),he=i("h3"),ge=i("h4"),ve=i("h5"),ye=i("h6"),_e=i("head"),Te=i("header"),Ee=i("hr"),we=i("i"),Le=i("iframe"),He=i("img"),xe=i("input"),be=i("label"),Me=i("li"),ke=i("main"),Se=i("nav"),Ce=i("ol"),Re=i("optgroup"),De=i("option"),Pe=i("p"),Ae=i("progress"),Ne=i("q"),Fe=i("section"),Ve=i("select"),Be=i("source"),Je=i("span"),Ie=i("strong"),je=i("summary"),Oe=i("table"),Ye=i("tbody"),$e=i("td"),Ge=i("template"),Ue=i("textarea"),qe=i("th"),Ke=i("title"),Qe=i("tr"),We=i("track"),Xe=i("u"),Ze=i("ul"),ze=i("video"),et=(r,e)=>{let t=document.createElement("span");return t.innerHTML=r,_(t,[e])},tt=r=>{let e=document.createElement("div");return e.innerHTML=r,Array.from(e.children)};var M=(...r)=>{let{0:e,1:t,2:n,3:o}=x(r[0]),s=e?document.createElement(e):new DocumentFragment;return e&&(n&&(s.className=n),t&&(s.id=t),o&&(s.innerText=o),r.shift()),_(s,r)},ot=M;
18
+ var v=class{constructor(){this.listeners={};this.active_listeners={};}async addEventListener(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t);}async addActiveEventListener(e,t){this.active_listeners[e]||(this.active_listeners[e]=[]),this.active_listeners[e].push(t);}async dispatchEvent(e,t){let n=this.listeners[e]||[];for(;n.length!==0;)n.shift()(t);}async dispatchActiveEvent(e,t){let n=this.listeners[e]||[];n.length&&w();for(let o=0;o<n.length;o++)n[o](t);}},f=new v,h=class{constructor(e){this.effects=[];this.effectuate=null;this.methods={};this.rendered=!1;this.published=!1;this.preRendered=null;this.reference=new u;this._state=[];this._state_track={};this._state_index=0;this.component=e.bind(this),f.addActiveEventListener("active-Refs",()=>{this._state_index=0,this.published=!1;});}preRender(e,t){this.preRendered=this.render(e,t);}destroyPreRendered(){this.preRendered=null;}define(e,t){typeof e=="string"&&typeof t=="function"&&!Object.prototype.hasOwnProperty.call(this,e)?this.methods[e]=t.bind(this):console.error(" \u2718 Cradova err : Invalid Ref.define parameters");}render(e,t){if(this.effects=[],this.rendered=!1,t&&(this.stash=e),this.preRendered)return this.preRendered;{let n=this.component(e);return n instanceof HTMLElement||n instanceof DocumentFragment?(this.reference._appendDomForce("html",n),this.effector.apply(this),this.rendered=!0,this.published=!0):console.error(" \u2718 Cradova err : Invalid html content, got - "+n),n}}instance(){return this.reference.current("html")}_setExtra(e){this.Signal=e;}_roll_state(e,t,n=!1){return n||(this._state[t]=e),this._state[t]}_effect(e){this.rendered||this.effects.push(e.bind(this));}async effector(){if(!this.rendered){for(let e=0;e<this.effects.length;e++)await this.effects[e].apply(this);this.effects=[];}this.effectuate&&(this.effectuate(),this.effectuate=null);}updateState(e,t){this.rendered?this.published&&this.Activate(e):this.effectuate=()=>{this.published&&this.Activate(e);},t&&(this.stash=e);}async Activate(e){if(this._state_index=0,this.published=!1,!this.rendered)return;let t=this.component(e);if(t instanceof HTMLElement||t instanceof DocumentFragment){let n=this.reference.current("html");n&&(n.insertAdjacentElement("beforebegin",t),n.remove()),this.published=!0,this.reference._appendDomForce("html",t),f.dispatchEvent("onmountEvent");}else console.error(" \u2718 Cradova err : Invalid html content, got - "+t);}},H=class{constructor(e){this._cb=e;}async load(){let e=await this._cb();typeof e=="function"?e=await e():e=await e;let t=e;t.default&&(this.content=t?.default);}},u=class{constructor(){this.tree={};this.globalTree={};}bindAs(e){return [this,e]}current(e){return this.tree[p]?this.tree[p][e]:null}_appendDomForce(e,t){this.tree[p]?this.tree[p][e]=t:(this.tree[p]={},this.tree[p][e]=t);}_appendDomForceGlobal(e,t){this.globalTree[e]=t;}},d=new u,_=class{constructor(e,t){this.persistName="";this.actions={};this.ref=[];if(this.value=e,t&&t.persistName){this.persistName=t.persistName;let n=localStorage.getItem(t.persistName);if(n&&n!=="undefined"&&(this.value=JSON.parse(n)),typeof e=="object")for(let o in e)Object.prototype.hasOwnProperty.call(this.value,o)||(this.value[o]=e[o]);}}set(e,t){typeof e=="function"?this.value=e(this.value):this.value=e,this.persistName&&localStorage.setItem(this.persistName,JSON.stringify(this.value)),this.ref.length&&t!==!1&&this._updateState(),this.callback&&this.callback(this.value);}setKey(e,t,n){if(typeof this.value=="object"&&!Array.isArray(this.value))this.value[e]=t,this.persistName&&localStorage.setItem(this.persistName,JSON.stringify(this.value)),this.ref.length&&n!==!1&&this._updateState(),this.callback&&this.callback(this.value);else throw new Error(`\u2718 Cradova err : can't set key ${String(e)} . store.value is not a javascript object`)}createAction(e,t){if(typeof e=="string"&&typeof t=="function")this.actions[e]=t;else throw new Error(`\u2718 Cradova err : can't create action, ${e} is not a function`)}createActions(e){for(let[t,n]of Object.entries(e))if(typeof t=="string"&&typeof n=="function")this.actions[t]=n;else throw new Error(`\u2718 Cradova err : can't create action, ${t} is not a function`)}fireAction(e,t){if(this._updateState(e,t),typeof this.actions[e]=="function")return this.actions[e].call(this,t);throw Error("\u2718 Cradova err : action "+e+" does not exist!")}bind(e){if(typeof this.value=="object"&&typeof this.value[e]<"u")return [this,e];throw new Error("\u2718 Cradova err : can't bind an unavailable property! "+e)}_updateState(e,t){if(e&&t)this.ref.map(n=>{if(n._event===e){if(n._element_property&&n._signalProperty){n.ref?.updateState({[n._element_property]:t[n._signalProperty]});return}if(n._element_property){n.ref.updateState({[n._element_property]:t});return}if(n._signalProperty){n.ref.updateState(t[n._signalProperty]);return}}});else for(let n=0;n<this.ref.length;n++){let o=this.ref[n];if(o._element_property&&o._signalProperty){o.ref.updateState({[o._element_property]:this.value[o._signalProperty]});continue}if(o._element_property){o.ref.updateState({[o._element_property]:this.value});continue}if(o._signalProperty){o.ref.updateState(this.value[o._signalProperty]);continue}if(!o._element_property&&!o._signalProperty){o.ref.updateState(this.value);continue}}}bindRef(e,t={signalProperty:"",_element_property:""}){if(e.render&&(e.render=e.render.bind(e,this.value)),e._setExtra&&e._setExtra(this),e&&e.updateState){this.ref.push({ref:e,_signalProperty:t.signalProperty,_element_property:t._element_property,_event:t.event});return}throw new Error("\u2718 Cradova err : Invalid parameters for binding ref to Signal")}listen(e){this.callback=e;}clearPersist(){this.persistName&&localStorage.removeItem(this.persistName);}},m=class{constructor(e){this._packed=!1;this._template=document.createElement("div");this._persist=!0;this._delegatedRoutesCount=-1;this._dropped=!1;this._errorHandler=null;let{template:t,name:n,persist:o,renderInParallel:i}=e;t instanceof h?this._html=()=>t.render({}):this._html=t,this._name=n||"Document",this._template.setAttribute("id","cradova-screen-set"),i===!0?(this._delegatedRoutesCount=0,this._persist=!1):typeof o=="boolean"&&(this._persist=o);}_derive(){return {_name:this._name,_callBack:this._callBack,_deCallBack:this._deCallBack}}_apply_derivation(e){this._name=e._name,this._callBack=e._callBack,this._deCallBack=e._deCallBack;}get _delegatedRoutes(){return this._delegatedRoutesCount>100?-1:this._delegatedRoutesCount}set _delegatedRoutes(e){e&&(this._delegatedRoutesCount+=1);}setErrorHandler(e){this._errorHandler=e;}async _package(){if(typeof this._html=="function"){let e=await this._html.apply(this);if(typeof e=="function")e=e(),(e instanceof HTMLElement||e instanceof DocumentFragment)&&(this._template.innerHTML="",this._template.appendChild(e));else if(e instanceof HTMLElement||e instanceof DocumentFragment)this._template.innerHTML="",this._template.appendChild(e);else throw new Error(` \u2718 Cradova err: template function for the screen with name '${this._name}' returned ${e} instead of html`)}}onActivate(e){this._callBack=e;}onDeactivate(e){this._deCallBack=e;}async _deActivate(){this._deCallBack&&await this._deCallBack(d.globalTree.doc);}drop(e){if(typeof e=="boolean"){this._dropped=e;return}else return this._dropped}async _Activate(e=!1){if(this._dropped){history.go(-1);return}w(),f.dispatchActiveEvent("active-Refs"),(!this._persist||e||!this._packed)&&(await this._package(),this._packed=!0),document.title=this._name,d.globalTree.doc.innerHTML="",d.globalTree.doc.appendChild(this._template),f.dispatchEvent("onmountEvent"),window.scrollTo({top:0,left:0,behavior:"instant"}),this._callBack&&await this._callBack(d.globalTree.doc);}},E=class{constructor(){this.pageShow=null;this.pageHide=null;this.loadingScreen=null;this.params={};this.routes={};this.pageevents=[];this.paused=!1;}async start_pageevents(e){setTimeout(()=>{for(let t=0;t<this.pageevents.length;t++)this.pageevents[t](e);},100);}route(e,t){if(typeof t<"u"){if(t&&!t)throw console.error(" \u2718 Cradova err: not a valid screen ",t),new Error(" \u2718 Cradova err: Not a valid cradova screen component");return this.routes[e]=t}}async router(e,t){let n=window.location.pathname,o,i;if(this.paused){window.location.hash="paused";return}if(n!==this.lastNavigatedRoute)if(this.nextRouteController?(o=this.nextRouteController,this.nextRouteController=void 0):[o,i]=this.checker(n),typeof o<"u")try{if(typeof o=="function"&&(this.loadingScreen instanceof m&&await this.loadingScreen._Activate(),o=await o(),!o)){this.lastNavigatedRoute&&history.pushState({},n,this.lastNavigatedRoute);return}if(o._delegatedRoutes!==-1){o._delegatedRoutes=1;let l=o._derive();o=new m({template:o._html}),o._apply_derivation(l),this.routes[n]=o;}i&&(this.params.params=i),await o._Activate(t),this.start_pageevents(n),this.lastNavigatedRouteController&&this.lastNavigatedRouteController._deActivate(),this.lastNavigatedRoute=n,this.lastNavigatedRouteController=o;}catch(l){if(o&&o._errorHandler)o._errorHandler(l);else if(typeof this.errorHandler=="function")this.errorHandler(Error);else throw console.error(l),new Error(" \u2718 Cradova err: consider adding error boundary to the specific screen ")}else this.routes["*"]&&await this.routes["*"]._Activate(t);}checker(e){if(this.routes[e])return [this.routes[e],{path:e}];if(this.routes[e+"/"])return [this.routes[e],{path:e}];for(let t in this.routes){if(!t.includes(":"))continue;let n=e.split("/"),o=t.split("/");e.endsWith("/")&&n.pop();let i=0,l=0;if(n.shift(),o.shift(),o.length===n.length){let y={_path:""};for(let c=0;c<o.length;c++){if(o[c].includes(":")){l++;continue}n[c]===o[c]&&i++;}if(i+l===o.length){for(let c=0;c<o.length;c++)o[c].includes(":")&&(y[o[c].split(":")[1]]=n[c]);return y._path=t,[this.routes[t],y]}}}return []}},s=new E,g=class{static BrowserRoutes(e){for(let t in e){let n=e[t];typeof n=="object"&&typeof n.then=="function"||typeof n=="function"?s.routes[t]=async()=>(n=await(typeof n=="function"?await n():await n),s.route(t,n?.default||n)):s.route(t,n);}g._mount();}static back(){history.go(-1);}static forward(){history.go(1);}static pauseNaviagtion(){s.paused=!0,window.location.hash="paused";}static resumeNaviagtion(){s.paused=!1,window.location.replace(window.location.pathname+window.location.search),history.go(-1);}static navigate(e,t=null,n=!1){if(typeof e!="string")throw new TypeError(" \u2718 Cradova err: href must be a defined path but got "+e+" instead");let o=null,i;if(e.includes("://"))window.location.href=e;else {if(e===window.location.pathname)return;[o,i]=s.checker(e),o&&(s.nextRouteController=o,window.history.pushState({},"",e)),s.params.params=i,s.params.data=t,s.router(null,n);}}static navigateNauturally(e){if(typeof e!="string")throw new TypeError(" \u2718 Cradova err: pathname must be a defined path but got "+e+" instead");window.location.pathname=e;}static setLoadingScreen(e){if(e instanceof m)s.loadingScreen=e;else throw new Error(" \u2718 Cradova err: Loading Screen should be a cradova screen class")}static onPageEvent(e){if(typeof e=="function")s.pageevents.push(e);else throw new Error(" \u2718 Cradova err: callback for pageShow event is not a function")}static async packageScreen(e){if(!s.routes[e])throw console.error(" \u2718 Cradova err: no screen with path "+e),new Error(" \u2718 Cradova err: cradova err: Not a defined screen path");let[t]=s.checker(e);if(typeof t=="function"&&(t=await t()),t._delegatedRoutes!==-1){t._delegatedRoutes=1;let n=t._derive();t=new m({template:t._html}),t._apply_derivation(n),s.routes[e]=t;}t._package(),t._packed=!0;}static getParams(){return s.params}static addErrorHandler(e){if(typeof e=="function")s.errorHandler=e;else throw new Error(" \u2718 Cradova err: callback for error event is not a function")}static _mount(){let e=document.querySelector("[data-wrapper=app]");e||(e=document.createElement("div"),e.setAttribute("data-wrapper","app"),document.body.appendChild(e)),d._appendDomForceGlobal("doc",e),window.addEventListener("pageshow",()=>s.router()),window.addEventListener("popstate",t=>{t.preventDefault(),s.router();});}};var T=(r,e)=>{let t={},n=null;if(e.length!==0)for(let o=0;o<e.length;o++){let i=e[o];if(typeof i=="function"&&(i=i()),i instanceof h&&(i=i.render()),i instanceof HTMLElement||i instanceof DocumentFragment){r.appendChild(i);continue}if(Array.isArray(i)){r.appendChild(x(i));continue}if(typeof i=="string"||typeof i=="number"){n=i;continue}if(typeof i=="object"){t=Object.assign(t,i);continue}}else return r;if(typeof t=="object"&&r)for(let[o,i]of Object.entries(t)){if(o==="style"&&typeof i=="object"){Object.assign(r.style,i);continue}if(Array.isArray(i)){if(o=="reference"&&i[0]instanceof u){i[0]._appendDomForce(i[1],r);continue}if(i[0]instanceof _){i[0].bindRef(r,{_element_property:o,signalProperty:i[1]});continue}}if(o==="onmount"&&typeof t.onmount=="function"){let l=()=>{t.onmount?.apply(r),t.onmount=void 0;};f.addEventListener("onmountEvent",l);continue}if(o.includes("data-")){r.setAttribute(o,i);continue}if(o.includes("aria-")){r.setAttribute(o,i);continue}if(o==="href"&&typeof i=="string"){let l=i||"";l.includes("://")||r.addEventListener("click",y=>{y.preventDefault(),g.navigate(r.pathname);if(l.includes("#")){let c=l.split("#").at(-1);document.getElementById("#"+c)?.scrollIntoView();}}),r.setAttribute(o,i);continue}if(typeof r.style[o]<"u"&&o!=="src"){r.style[o]=i;continue}r[o]=i;}return n&&r.appendChild(document.createTextNode(n)),r},L=function(r){if(Array.isArray(r)&&(r=r[0]),typeof r!="string")return [];let e="";if(r.includes("|")&&([r,e]=r.split("|"),!r))return ["P",void 0,void 0,e];let t;if(r.includes("#")){if(!r.includes("."))return r=r.split("#"),t=r.shift(),t||(t="DIV"),r[0].includes(" ")&&(r=[r[0].split(" ")[1]]),[t,r[0],void 0,e]}else return r=r.split("."),t=r.shift(),t||(t="DIV"),[t,void 0,r.join(" "),e];r=r.split(".");let n=[],o=[];t=!r[0].includes("#")&&r.shift(),t||(t="DIV");for(let i=0;i<r.length;i++){if(r[i].includes("#")){let l=r[i].split("#");if(o.push(l[1]),i===0){t=l[0];continue}n.push(l[0]);continue}n.push(r[i]);}return [t,o[0],n.join(" "),e]},a=r=>(...t)=>T(document.createElement(r),t);function x(r){let e=new DocumentFragment;for(let t of r)if(Array.isArray(t))e.appendChild(x(t));else {if(t instanceof h&&(t=t.render(void 0)),typeof t=="function"&&(t=t(),typeof t=="function"&&(t=t())),typeof t=="string"||typeof t=="number"){e.appendChild(document.createTextNode(t));continue}if(t instanceof HTMLElement||t instanceof DocumentFragment)e.appendChild(t);else if(typeof t<"u")throw new Error(" \u2718 Cradova err: invalid child type: "+t+" ("+typeof t+")")}return e}function P(r){if(Array.isArray(r)&&(r=r[0]),typeof r=="string"){let e=document.querySelector("style");if(e!==null){e.textContent=r+e.textContent;return}e=document.createElement("style"),e.textContent=r,document.head.appendChild(e);}}function R(r,...e){if(r)return e}function D(r,e,t){return r?e:t}function A(r,...e){return t=>{if(t===r)return e}}function N(r,...e){if(e.length)for(let t=0;t<e.length;t++){let n=e[t],o=n(r);if(o)return o}}function F(r,e){if(typeof e!="function")throw new Error(" \u2718 Cradova err : Invalid component type, must be a function that returns html ");return Array.isArray(r)?r.map(e):void 0}var p;function w(){let r=0,e=window.location.href;for(let t=0;t<e.length;t++)r+=e.charCodeAt(t);p=r.toString();}var V=function(r){let e=document.createDocumentFragment();for(let t=0;t<r.length;t++){let n=r[t];if(typeof n=="function"&&(n=n()),n instanceof HTMLElement||n instanceof DocumentFragment){e.appendChild(n);continue}if(n instanceof String){e.appendChild(document.createTextNode(n));continue}throw console.error(" \u2718 Cradova err: wrong element type"+n),new TypeError(" \u2718 Cradova err: invalid element")}return e};function J(r,e){e._state_index+=1;let t=e._state_index;e._state_track[t]||(e._roll_state(r,t),e._state_track[t]=!0);function n(o){e._roll_state(o,t),e.updateState();}return [e._roll_state(null,t,!0),n]}function B(r,e){e._effect(r);}function I(){return new u}var O=a("a"),$=a("article"),U=a("audio"),G=a("br"),q=a("button"),K=a("canvas"),Q=a("caption"),W=a("col"),X=a("colgroup"),Z=a("datalist"),z=a("details"),ee=a("dialog"),te=a("div"),ne=a("em"),re=a("embed"),oe=a("figure"),ae=a("footer"),ie=a("form"),se=a("h1"),le=a("h2"),ce=a("h3"),pe=a("h4"),ue=a("h5"),de=a("h6"),fe=a("head"),he=a("header"),me=a("hr"),ge=a("i"),ye=a("iframe"),Te=a("img"),_e=a("input"),ve=a("label"),Ee=a("li"),we=a("main"),He=a("nav"),Le=a("ol"),xe=a("optgroup"),Me=a("option"),be=a("p"),Se=a("progress"),ke=a("q"),Ce=a("section"),Pe=a("select"),Re=a("source"),De=a("span"),Ae=a("strong"),Ne=a("summary"),Fe=a("table"),Ve=a("tbody"),Je=a("td"),Be=a("template"),Ie=a("textarea"),je=a("th"),Ye=a("title"),Oe=a("tr"),$e=a("track"),Ue=a("u"),Ge=a("ul"),qe=a("video"),Ke=(r,e)=>{let t=document.createElement("span");return t.innerHTML=r,T(t,[e])},Qe=r=>{let e=document.createElement("div");return e.innerHTML=r,Array.from(e.children)};var M=(...r)=>{let{0:e,1:t,2:n,3:o}=L(r[0]),i=e?document.createElement(e):new DocumentFragment;return e&&(n&&(i.className=n),t&&(i.id=t),o&&(i.innerText=o),r.shift()),T(i,r)},Ze=M;
19
19
 
20
- export { R as $case, S as $if, C as $ifelse, D as $switch, f as CradovaEvent, v as Ref, E as Rhoda, g as Router, h as Screen, Q as a, W as article, X as audio, Z as br, z as button, ee as canvas, te as caption, ne as col, re as colgroup, y as createSignal, k as css, oe as datalist, ot as default, ae as details, ie as dialog, se as div, le as em, ce as embed, pe as figure, ue as footer, de as form, A as frag, fe as h1, me as h2, he as h3, ge as h4, ve as h5, ye as h6, _e as head, Te as header, Ee as hr, we as i, Le as iframe, He as img, xe as input, p as isNode, be as label, H as lazy, Me as li, P as loop, ke as main, x as make, _ as makeElement, w as memo_SNRU, Se as nav, Ce as ol, Re as optgroup, De as option, Pe as p, Ae as progress, Ne as q, tt as raw, u as reference, Fe as section, Ve as select, Be as source, Je as span, Ie as strong, je as summary, et as svg, Oe as table, Ye as tbody, $e as td, Ge as template, Ue as textarea, qe as th, Ke as title, Qe as tr, We as track, Xe as u, Ze as ul, F as useEffect, V as useRef, N as useState, ze as video };
20
+ export { A as $case, R as $if, D as $ifelse, N as $switch, f as CradovaEvent, h as Ref, x as Rhoda, g as Router, p as SNRU, m as Screen, O as a, $ as article, U as audio, G as br, q as button, K as canvas, Q as caption, W as col, X as colgroup, a as cra, _ as createSignal, P as css, Z as datalist, Ze as default, z as details, ee as dialog, te as div, ne as em, re as embed, oe as figure, ae as footer, ie as form, V as frag, se as h1, le as h2, ce as h3, pe as h4, ue as h5, de as h6, fe as head, he as header, me as hr, ge as i, ye as iframe, Te as img, _e as input, ve as label, H as lazy, Ee as li, F as loop, we as main, L as make, T as makeElement, w as memo_SNRU, He as nav, Le as ol, xe as optgroup, Me as option, be as p, Se as progress, ke as q, Qe as raw, u as reference, Ce as section, Pe as select, Re as source, De as span, Ae as strong, Ne as summary, Ke as svg, Fe as table, Ve as tbody, Je as td, Be as template, Ie as textarea, je as th, Ye as title, Oe as tr, $e as track, Ue as u, Ge as ul, B as useEffect, I as useRef, J as useState, qe as video };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cradova",
3
- "version": "3.3.0",
3
+ "version": "3.3.1",
4
4
  "description": "Web framework for building powerful web apps",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -13,8 +13,8 @@
13
13
  "url": "git+https://github.com/FridayCandour/cradova.git"
14
14
  },
15
15
  "scripts": {
16
- "build": "tsup lib/index.ts",
17
- "pub": "tsup lib/index.ts && npm publish",
16
+ "build": "tsup src/index.ts",
17
+ "pub": "tsup src/index.ts && npm publish",
18
18
  "lint": "eslint . --fix"
19
19
  },
20
20
  "keywords": [