cradova 3.3.0 → 3.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -186,7 +186,7 @@ APPENDIX: How to apply the Apache License to your work.
186
186
  same "printed page" as the copyright notice for easier
187
187
  identification within third-party archives.
188
188
 
189
- Copyright 2023 friday candour
189
+ Copyright 2022 friday candour
190
190
 
191
191
  Licensed under the Apache License, Version 2.0 (the "License");
192
192
  you may not use this file except in compliance with the License.
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
@@ -8,8 +8,119 @@ License at http://www.apache.org/licenses/LICENSE-2.0
8
8
 
9
9
  See the Apache Version 2.0 License for specific language governing permissions
10
10
  and limitations under the License.
11
- ***************************************************************************** */
11
+ ********************************************************************************/
12
12
 
13
+ /**
14
+ * Cradova event
15
+ */
16
+ declare class cradovaEvent {
17
+ private listeners;
18
+ private active_listeners;
19
+ addEventListener(eventName: string, callback: () => void): Promise<void>;
20
+ addActiveEventListener(eventName: string, callback: () => void): Promise<void>;
21
+ dispatchEvent(eventName: string, eventArgs?: unknown): Promise<void>;
22
+ /**
23
+ * Active refs is a concept for delegated screens to keep their active refs alive
24
+ * even in the case of naviagtion
25
+ * @param eventName
26
+ * @param eventArgs
27
+ */
28
+ dispatchActiveEvent(eventName: string, eventArgs?: unknown): Promise<void>;
29
+ }
30
+ declare const CradovaEvent: cradovaEvent;
31
+ /**
32
+ * Cradova Ref
33
+ * -------
34
+ * create dynamic components
35
+ */
36
+ declare class Ref<Prop extends Record<string, any> = any> {
37
+ private component;
38
+ private effects;
39
+ private effectuate;
40
+ methods: Record<string, Function>;
41
+ private rendered;
42
+ private published;
43
+ private preRendered;
44
+ private reference;
45
+ Signal: createSignal<any> | undefined;
46
+ _state: Prop[];
47
+ _state_track: {
48
+ [x: number]: boolean;
49
+ };
50
+ _state_index: number;
51
+ stash: Prop | undefined;
52
+ constructor(component: (this: Ref<Prop>, data: Prop) => HTMLElement | DocumentFragment);
53
+ preRender(data?: Prop, stash?: boolean): void;
54
+ destroyPreRendered(): void;
55
+ /**
56
+ * Cradova Ref
57
+ * ---
58
+ * construct to add custom methods to Refs
59
+ * @param methodName
60
+ * @param method
61
+ * @returns void
62
+ */
63
+ define(methodName: string, method: (this: this, ...arg: any) => void): void;
64
+ /**
65
+ * Cradova Ref
66
+ * ---
67
+ * returns html with cradova reference
68
+ * @param data
69
+ * @returns () => HTMLElement
70
+ */
71
+ render(data?: Prop, stash?: boolean): HTMLElement | DocumentFragment;
72
+ instance(): HTMLElement;
73
+ _setExtra(Extra: createSignal<any>): void;
74
+ _roll_state(data: any, idx: number, get?: boolean): Prop;
75
+ _effect(fn: () => Promise<void> | void): void;
76
+ private effector;
77
+ /**
78
+ * Cradova Ref
79
+ * ---
80
+ * update ref component with new data and update the dom.
81
+ * @param data
82
+ * @returns
83
+ */
84
+ updateState(data?: Prop, stash?: boolean): void;
85
+ private Activate;
86
+ }
87
+ /**
88
+ * cradova
89
+ * ---
90
+ * lazy load a file
91
+ */
92
+ declare class lazy<Type> {
93
+ content: Type | undefined;
94
+ private _cb;
95
+ constructor(cb: () => Promise<unknown>);
96
+ load(): Promise<void>;
97
+ }
98
+ /**
99
+ * Cradova
100
+ * ---
101
+ * make reference to dom elements
102
+ */
103
+ declare class reference {
104
+ tree: Record<string, any>;
105
+ globalTree: Record<string, HTMLElement>;
106
+ /**
107
+ * Bind a DOM element to a reference name.
108
+ * @param name - The name to reference the DOM element by.
109
+ */
110
+ bindAs(name: string): reference;
111
+ /**
112
+ * Retrieve a referenced DOM element.
113
+ * @param name - The name of the referenced DOM element.
114
+ */
115
+ current<ElementType extends HTMLElement = HTMLElement>(name: string): ElementType;
116
+ /**
117
+ * Append a DOM element to the reference, overwriting any existing reference.
118
+ * @param name - The name to reference the DOM element by.
119
+ * @param element - The DOM element to reference.
120
+ */
121
+ _appendDomForce(name: string, Element: HTMLElement): void;
122
+ _appendDomForceGlobal(name: string, Element: HTMLElement): void;
123
+ }
13
124
  /**
14
125
  * Cradova Signal
15
126
  * ----
@@ -24,7 +135,7 @@ and limitations under the License.
24
135
  * - update a cradova Ref automatically
25
136
  * @constructor initial: unknown, props: {useHistory, persist}
26
137
  */
27
- declare class createSignal<Type extends Record<string, unknown>> {
138
+ declare class createSignal<Type extends Record<string, any>> {
28
139
  private callback;
29
140
  private persistName;
30
141
  private actions;
@@ -92,7 +203,7 @@ declare class createSignal<Type extends Record<string, unknown>> {
92
203
  * @param Ref component to bind to.
93
204
  * @param path a property in the object to send to attached ref
94
205
  */
95
- bindRef(ref: Partial<Ref<unknown>>, binding?: {
206
+ bindRef(ref: Partial<Ref>, binding?: {
96
207
  event?: string;
97
208
  signalProperty: string;
98
209
  _element_property: string;
@@ -112,179 +223,6 @@ declare class createSignal<Type extends Record<string, unknown>> {
112
223
  */
113
224
  clearPersist(): void;
114
225
  }
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
226
  /**
289
227
  * Cradova Screen
290
228
  * ---
@@ -292,7 +230,7 @@ and limitations under the License.
292
230
  * @param name
293
231
  * @param template
294
232
  */
295
- declare class Screen {
233
+ declare class Screen$1 {
296
234
  /**
297
235
  * used internally
298
236
  */
@@ -300,8 +238,8 @@ declare class Screen {
300
238
  /**
301
239
  * this should be a cradova screen component
302
240
  */
303
- _html: ((this: Screen, data?: unknown) => HTMLElement | DocumentFragment) | HTMLElement | DocumentFragment;
304
- private _packed;
241
+ _html: ((this: Screen$1, data?: unknown) => HTMLElement | DocumentFragment) | HTMLElement | DocumentFragment;
242
+ _packed: boolean;
305
243
  private _template;
306
244
  private _callBack;
307
245
  private _deCallBack;
@@ -320,12 +258,11 @@ declare class Screen {
320
258
  };
321
259
  _apply_derivation(derivation: {
322
260
  _name: string;
323
- _transition: string | undefined;
324
- _callBack: (() => void | Promise<void>) | undefined;
325
- _deCallBack: (() => void | Promise<void>) | undefined;
261
+ _callBack: ((cradovaScreenSet: HTMLElement) => void | Promise<void>) | undefined;
262
+ _deCallBack: ((cradovaScreenSet: HTMLElement) => void | Promise<void>) | undefined;
326
263
  }): void;
327
- get _delegatedRoutes(): boolean;
328
- set _delegatedRoutes(count: boolean);
264
+ get _delegatedRoutes(): number;
265
+ set _delegatedRoutes(count: number);
329
266
  setErrorHandler(errorHandler: (err: unknown) => void): void;
330
267
  _package(): Promise<void>;
331
268
  onActivate(cb: () => Promise<void> | void): void;
@@ -334,109 +271,6 @@ declare class Screen {
334
271
  drop(state?: boolean): boolean | undefined;
335
272
  _Activate(force?: boolean): Promise<void>;
336
273
  }
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
274
  /** cradova router
441
275
  * ---
442
276
  * Registers a route.
@@ -500,7 +334,7 @@ declare class Router {
500
334
  *
501
335
  * @param screen
502
336
  */
503
- static setLoadingScreen(screen: Screen): void;
337
+ static setLoadingScreen(screen: Screen$1): void;
504
338
  /** cradova router
505
339
  * ---
506
340
  * Listen for navigation events
@@ -515,7 +349,7 @@ declare class Router {
515
349
  * @param {string} path Route path.
516
350
  * @param data data for the screen.
517
351
  */
518
- static packageScreen(path: string, data?: Record<string, unknown>): Promise<void>;
352
+ static packageScreen(path: string): Promise<void>;
519
353
  /**
520
354
  * Cradova Router
521
355
  * ------
@@ -524,7 +358,7 @@ declare class Router {
524
358
  *
525
359
  * .
526
360
  */
527
- static getParams(): any;
361
+ static getParams(): Record<string, unknown>;
528
362
  /**
529
363
  * Cradova
530
364
  * ---
@@ -547,8 +381,150 @@ See the Apache Version 2.0 License for specific language governing permissions
547
381
  and limitations under the License.
548
382
  ***************************************************************************** */
549
383
 
384
+ type DataAttributes = {
385
+ [key: `data-${string}`]: string;
386
+ };
387
+ type AriaAttributes = {
388
+ [key: `aria-${string}`]: string;
389
+ };
390
+ type VJSType<T> = (...VJS: (undefined | string | HTMLElement | HTMLElement[] | Ref | Ref[] | DocumentFragment | DocumentFragment[] | TemplateStringsArray | Partial<T> | (() => HTMLElement) | Partial<DataAttributes> | Partial<AriaAttributes> | CSS.Properties | {
391
+ style?: CSS.Properties;
392
+ onmount?: (this: T) => void;
393
+ reference?: reference;
394
+ })[]) => T;
395
+ 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> | {
396
+ src?: string;
397
+ href?: string;
398
+ placeholder?: string;
399
+ type?: string;
400
+ action?: string;
401
+ name?: string;
402
+ alt?: string;
403
+ for?: string;
404
+ method?: string;
405
+ rows?: string;
406
+ value?: string;
407
+ target?: string;
408
+ rel?: string;
409
+ required?: string;
410
+ frameBorder?: string;
411
+ style?: CSS.Properties;
412
+ onmount?: (this: T) => void;
413
+ reference?: reference;
414
+ })[];
415
+ type VJS_Child_TYPE<T> = undefined | string | T | (() => T);
416
+ type VJS_props_TYPE = {
417
+ style?: CSS.Properties;
418
+ onmount?: () => void;
419
+ reference?: reference;
420
+ };
421
+ type CradovaScreenType<T = unknown> = {
422
+ /**
423
+ * Cradova screen
424
+ * ---
425
+ * title of the page
426
+ * .
427
+ */
428
+ name?: string;
429
+ /**
430
+ * Cradova screen
431
+ * ---
432
+ * a css className to add to screen when rendering it
433
+ * Usually for adding css transitions
434
+ * .
435
+ */
436
+ /**
437
+ * Cradova screen
438
+ * ---
439
+ * The component for the screen
440
+ * @param data
441
+ * @returns void
442
+ * .
443
+ */
444
+ template: ((this: Screen, data?: T | unknown) => HTMLElement | DocumentFragment) | HTMLElement | DocumentFragment | Ref<any>;
445
+ /**
446
+ * Cradova screen
447
+ * ---
448
+ * Allows this screen render in parallel for unique routes
449
+ *
450
+ * limit is 1000
451
+ *
452
+ * .
453
+ */
454
+ renderInParallel?: boolean;
455
+ /**
456
+ * Cradova screen
457
+ * ---
458
+ * Should this screen be cached after first render?
459
+ * you can use Route.navigate(url, null, true) to force later
460
+ *
461
+ * .
462
+ */
463
+ persist?: boolean;
464
+ };
465
+
466
+ /*! *****************************************************************************
467
+ Copyright 2022 Friday Candour. All rights reserved.
468
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
469
+ this file except in compliance with the License. You may obtain a copy of the
470
+ License at http://www.apache.org/licenses/LICENSE-2.0
471
+
472
+ See the Apache Version 2.0 License for specific language governing permissions
473
+ and limitations under the License.
474
+ ********************************************************************************/
475
+
550
476
  declare const makeElement: <E extends HTMLElement>(element: E & HTMLElement, ElementChildrenAndPropertyList: VJS_params_TYPE<E>) => E;
551
477
  declare const make: (descriptor: any) => any[];
478
+ declare const cra: <E extends HTMLElement>(tag: string) => VJSType<E>;
479
+ declare function Rhoda(l: VJSType<HTMLElement>[] | (() => any)[] | Ref[] | HTMLElement[]): DocumentFragment;
480
+ declare function css(identifier: string | TemplateStringsArray): void;
481
+ /**
482
+ *
483
+ * @param {expression} condition
484
+ * @param {function} elements[]
485
+ */
486
+ declare function $if<Type>(condition: boolean, ...elements: VJS_Child_TYPE<Type | HTMLElement>[]): HTMLElement[] | undefined;
487
+ 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>[];
488
+ declare function $case<Type>(value: any, ...elements: VJS_Child_TYPE<Type | HTMLElement>[]): (key: any) => HTMLElement[] | undefined;
489
+ declare function $switch(key: unknown, ...cases: ((key: any) => HTMLElement[] | undefined)[]): HTMLElement[] | undefined;
490
+ type LoopData<Type> = Type[];
491
+ declare function loop<Type>(datalist: LoopData<Type>, component: (value: Type, index?: number, array?: LoopData<Type>) => HTMLElement | DocumentFragment | undefined): HTMLElement[] | undefined;
492
+ /** Calculate a simple numerical representation of the URL */
493
+ declare const SNRU: {
494
+ snru: string;
495
+ memo_SNRU(): void;
496
+ };
497
+ /**
498
+ * Document fragment
499
+ * @param children
500
+ * @returns
501
+ */
502
+ declare const frag: (children: VJSType<HTMLElement>[]) => DocumentFragment;
503
+ /**
504
+ * Cradova
505
+ * ---
506
+ * Allows functional components to manage state by providing a state value and a function to update it.
507
+ * @param initialValue
508
+ * @param ActiveRef
509
+ * @returns [state, setState]
510
+ */
511
+ declare function useState<S = unknown>(initialValue: S, ActiveRef: Ref): [S, (newState: S) => void];
512
+ /**
513
+ * Cradova
514
+ * ---
515
+ Allows side effects to be performed in functional components (Refs), such as fetching data or subscribing to events.
516
+ * @param effect
517
+ * @returns
518
+ */
519
+ declare function useEffect(effect: () => void, ActiveRef: Ref): void;
520
+ /**
521
+ * Cradova
522
+ * ---
523
+ Returns a mutable reference object of dom elements that persists across component renders.
524
+ * @returns reference
525
+ */
526
+ declare function useRef(): Record<string, HTMLElement | undefined>;
527
+
552
528
  declare const a: VJSType<HTMLAnchorElement>;
553
529
  declare const article: VJSType<HTMLElement>;
554
530
  declare const audio: VJSType<HTMLAudioElement>;
@@ -611,6 +587,16 @@ declare const video: VJSType<HTMLVideoElement>;
611
587
  declare const svg: (svg: string, properties?: VJS_props_TYPE) => HTMLSpanElement;
612
588
  declare const raw: (html: string) => HTMLElement[];
613
589
 
590
+ /*! *****************************************************************************
591
+ Copyright 2022 Friday Candour. All rights reserved.
592
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
593
+ this file except in compliance with the License. You may obtain a copy of the
594
+ License at http://www.apache.org/licenses/LICENSE-2.0
595
+
596
+ See the Apache Version 2.0 License for specific language governing permissions
597
+ and limitations under the License.
598
+ ********************************************************************************/
599
+
614
600
  type TemplateType = <E extends HTMLElement>(...element_initials: VJS_params_TYPE<E | HTMLElement>) => E | HTMLElement | DocumentFragment;
615
601
  /**
616
602
  * Cradova
@@ -635,4 +621,4 @@ type TemplateType = <E extends HTMLElement>(...element_initials: VJS_params_TYPE
635
621
  */
636
622
  declare const _: TemplateType;
637
623
 
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 };
624
+ 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, 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
@@ -1,20 +1,3 @@
1
+ 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.active_listeners[e]||[];n.length&&p.memo_SNRU();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(){console.log("yoohoo 2");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);}},w=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.snru]?this.tree[p.snru][e]:null}_appendDomForce(e,t){this.tree[p.snru]?this.tree[p.snru][e]=t:(this.tree[p.snru]={},this.tree[p.snru][e]=t);}_appendDomForceGlobal(e,t){this.globalTree[e]=t;}},d=new u,T=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(p.memo_SNRU(),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}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 _=(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(L(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 T){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},H=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)=>_(document.createElement(r),t);function L(r){let e=new DocumentFragment;for(let t of r)if(Array.isArray(t))e.appendChild(L(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 C(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 P(r,...e){if(r)return e}function R(r,e,t){return r?e:t}function D(r,...e){return t=>{if(t===r)return e}}function A(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 N(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={snru:"",memo_SNRU(){let r=0,e=window.location.href;for(let t=0;t<e.length;t++)r+=e.charCodeAt(t);this.snru=r.toString();}},F=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 V(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 J(r,e){e._effect(r);}function B(){return new u}var Y=a("a"),O=a("article"),$=a("audio"),U=a("br"),G=a("button"),q=a("canvas"),K=a("caption"),Q=a("col"),W=a("colgroup"),X=a("datalist"),Z=a("details"),z=a("dialog"),ee=a("div"),te=a("em"),ne=a("embed"),re=a("figure"),oe=a("footer"),ae=a("form"),ie=a("h1"),se=a("h2"),le=a("h3"),ce=a("h4"),pe=a("h5"),ue=a("h6"),de=a("head"),fe=a("header"),he=a("hr"),me=a("i"),ge=a("iframe"),ye=a("img"),_e=a("input"),Te=a("label"),ve=a("li"),Ee=a("main"),we=a("nav"),He=a("ol"),Le=a("optgroup"),xe=a("option"),Me=a("p"),be=a("progress"),Se=a("q"),ke=a("section"),Ce=a("select"),Pe=a("source"),Re=a("span"),De=a("strong"),Ae=a("summary"),Ne=a("table"),Fe=a("tbody"),Ve=a("td"),Je=a("template"),Be=a("textarea"),Ie=a("th"),je=a("title"),Ye=a("tr"),Oe=a("track"),$e=a("u"),Ue=a("ul"),Ge=a("video"),qe=(r,e)=>{let t=document.createElement("span");return t.innerHTML=r,_(t,[e])},Ke=r=>{let e=document.createElement("div");return e.innerHTML=r,Array.from(e.children)};var x=(...r)=>{let{0:e,1:t,2:n,3:o}=H(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()),_(i,r)},Xe=x;
1
2
 
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
- */
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;
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 };
3
+ export { D as $case, P as $if, R as $ifelse, A as $switch, f as CradovaEvent, h as Ref, L as Rhoda, g as Router, p as SNRU, m as Screen, Y as a, O as article, $ as audio, U as br, G as button, q as canvas, K as caption, Q as col, W as colgroup, a as cra, T as createSignal, C as css, X as datalist, Xe as default, Z as details, z as dialog, ee as div, te as em, ne as embed, re as figure, oe as footer, ae as form, F as frag, ie as h1, se as h2, le as h3, ce as h4, pe as h5, ue as h6, de as head, fe as header, he as hr, me as i, ge as iframe, ye as img, _e as input, Te as label, w as lazy, ve as li, N as loop, Ee as main, H as make, _ as makeElement, we as nav, He as ol, Le as optgroup, xe as option, Me as p, be as progress, Se as q, Ke as raw, u as reference, ke as section, Ce as select, Pe as source, Re as span, De as strong, Ae as summary, qe as svg, Ne as table, Fe as tbody, Ve as td, Je as template, Be as textarea, Ie as th, je as title, Ye as tr, Oe as track, $e as u, Ue as ul, J as useEffect, B as useRef, V as useState, Ge 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.3",
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": [