gyosjs 0.1.0
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.md +21 -0
- package/README.md +131 -0
- package/dist/auto-init.d.ts +3 -0
- package/dist/auto-init.d.ts.map +1 -0
- package/dist/core/component.d.ts +15 -0
- package/dist/core/component.d.ts.map +1 -0
- package/dist/core/composables.d.ts +113 -0
- package/dist/core/composables.d.ts.map +1 -0
- package/dist/core/di.d.ts +56 -0
- package/dist/core/di.d.ts.map +1 -0
- package/dist/core/directive.d.ts +52 -0
- package/dist/core/directive.d.ts.map +1 -0
- package/dist/core/events.d.ts +88 -0
- package/dist/core/events.d.ts.map +1 -0
- package/dist/core/hydration.d.ts +96 -0
- package/dist/core/hydration.d.ts.map +1 -0
- package/dist/core/pipe.d.ts +34 -0
- package/dist/core/pipe.d.ts.map +1 -0
- package/dist/core/portal.d.ts +37 -0
- package/dist/core/portal.d.ts.map +1 -0
- package/dist/core/reactive.d.ts +15 -0
- package/dist/core/reactive.d.ts.map +1 -0
- package/dist/core/router/diff-nodes.d.ts +2 -0
- package/dist/core/router/diff-nodes.d.ts.map +1 -0
- package/dist/core/router/persist.d.ts +4 -0
- package/dist/core/router/persist.d.ts.map +1 -0
- package/dist/core/router/router.d.ts +43 -0
- package/dist/core/router/router.d.ts.map +1 -0
- package/dist/core/router/script.d.ts +18 -0
- package/dist/core/router/script.d.ts.map +1 -0
- package/dist/core/router/scroll.d.ts +6 -0
- package/dist/core/router/scroll.d.ts.map +1 -0
- package/dist/core/router/swap.d.ts +8 -0
- package/dist/core/router/swap.d.ts.map +1 -0
- package/dist/core/scope-registry.d.ts +36 -0
- package/dist/core/scope-registry.d.ts.map +1 -0
- package/dist/core/store.d.ts +32 -0
- package/dist/core/store.d.ts.map +1 -0
- package/dist/core/transition.d.ts +130 -0
- package/dist/core/transition.d.ts.map +1 -0
- package/dist/form/form-validation.d.ts +36 -0
- package/dist/form/form-validation.d.ts.map +1 -0
- package/dist/form/validator.d.ts +124 -0
- package/dist/form/validator.d.ts.map +1 -0
- package/dist/gyos.auto.esm.js +7890 -0
- package/dist/gyos.auto.esm.js.map +1 -0
- package/dist/gyos.auto.js +7900 -0
- package/dist/gyos.auto.js.map +1 -0
- package/dist/gyos.auto.min.js +6 -0
- package/dist/gyos.esm.js +7872 -0
- package/dist/gyos.esm.js.map +1 -0
- package/dist/gyos.js +7942 -0
- package/dist/gyos.js.map +1 -0
- package/dist/gyos.min.js +6 -0
- package/dist/index.d.ts +86 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/reactivity/signal.d.ts +224 -0
- package/dist/reactivity/signal.d.ts.map +1 -0
- package/dist/template/bindings.d.ts +21 -0
- package/dist/template/bindings.d.ts.map +1 -0
- package/dist/template/cleanup.d.ts +9 -0
- package/dist/template/cleanup.d.ts.map +1 -0
- package/dist/template/directives.d.ts +22 -0
- package/dist/template/directives.d.ts.map +1 -0
- package/dist/template/effect-queue.d.ts +18 -0
- package/dist/template/effect-queue.d.ts.map +1 -0
- package/dist/template/events.d.ts +2 -0
- package/dist/template/events.d.ts.map +1 -0
- package/dist/template/expression.d.ts +25 -0
- package/dist/template/expression.d.ts.map +1 -0
- package/dist/template/model.d.ts +19 -0
- package/dist/template/model.d.ts.map +1 -0
- package/dist/template/parser.d.ts +9 -0
- package/dist/template/parser.d.ts.map +1 -0
- package/dist/template/process.d.ts +3 -0
- package/dist/template/process.d.ts.map +1 -0
- package/dist/template/structurals/structural.d.ts +41 -0
- package/dist/template/structurals/structural.d.ts.map +1 -0
- package/dist/template/structurals/transition-helpers.d.ts +60 -0
- package/dist/template/structurals/transition-helpers.d.ts.map +1 -0
- package/dist/template/text.d.ts +19 -0
- package/dist/template/text.d.ts.map +1 -0
- package/dist/types.d.ts +97 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/utils/helpers.d.ts +54 -0
- package/dist/utils/helpers.d.ts.map +1 -0
- package/dist/utils/progress-bar.d.ts +20 -0
- package/dist/utils/progress-bar.d.ts.map +1 -0
- package/dist/utils/target-spinner.d.ts +13 -0
- package/dist/utils/target-spinner.d.ts.map +1 -0
- package/package.json +94 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interpolate {expression} in template strings
|
|
3
|
+
*
|
|
4
|
+
* @param template - Template string with {expr} placeholders
|
|
5
|
+
* @param scope - Scope object for evaluation
|
|
6
|
+
* @returns Interpolated string
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* interpolate('Hello {name}!', { name: 'World' }) // 'Hello World!'
|
|
10
|
+
*/
|
|
11
|
+
export declare function interpolate(template: string, scope: any): string;
|
|
12
|
+
/**
|
|
13
|
+
* Evaluate expression with optional pipe support
|
|
14
|
+
*
|
|
15
|
+
* @param expr - Expression to evaluate
|
|
16
|
+
* @param scope - Scope object
|
|
17
|
+
* @param allowPipes - Whether to process pipes (default: true)
|
|
18
|
+
* @returns Evaluated value
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* evaluateExpression('name | uppercase', scope) // 'JOHN'
|
|
22
|
+
* evaluateExpression('count > 5', scope, false) // true
|
|
23
|
+
*/
|
|
24
|
+
export declare function evaluateExpression(expr: string, scope: any, allowPipes?: boolean): any;
|
|
25
|
+
//# sourceMappingURL=expression.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expression.d.ts","sourceRoot":"","sources":["../../src/template/expression.ts"],"names":[],"mappings":"AAMA;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,MAAM,CAUhE;AAqCD;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAC9B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,GAAG,EACV,UAAU,GAAE,OAAc,GAC3B,GAAG,CAgBL"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Process g-model directive for two-way data binding
|
|
3
|
+
*
|
|
4
|
+
* Supports modifiers:
|
|
5
|
+
* - debounce.300: Debounce input with custom delay
|
|
6
|
+
* - number: Convert value to number
|
|
7
|
+
* - trim: Trim whitespace
|
|
8
|
+
*
|
|
9
|
+
* @param el - Root element to process
|
|
10
|
+
* @param scope - Scope object for evaluation
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* <input g-model="name">
|
|
14
|
+
* <input g-model.debounce.500="search">
|
|
15
|
+
* <input g-model.number="age">
|
|
16
|
+
* <input type="checkbox" g-model="accepted">
|
|
17
|
+
*/
|
|
18
|
+
export declare function processModel(element: HTMLElement, scope: any, root: HTMLElement): void;
|
|
19
|
+
//# sourceMappingURL=model.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/template/model.ts"],"names":[],"mappings":"AA4EA;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,WAAW,GAAG,IAAI,CA+FtF"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Template Parser - Orchestrator
|
|
3
|
+
* Coordinates all template processing modules
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Parse and bind template to scope
|
|
7
|
+
*/
|
|
8
|
+
export declare function parseTemplate(el: HTMLElement, scope: any, onReady?: () => void): void;
|
|
9
|
+
//# sourceMappingURL=parser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../src/template/parser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH;;GAEG;AACH,wBAAgB,aAAa,CAAC,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,MAAM,IAAI,GAAG,IAAI,CAWrF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process.d.ts","sourceRoot":"","sources":["../../src/template/process.ts"],"names":[],"mappings":"AAgBA,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE,WAAW,KAAK,IAAI,GAAG,IAAI,CAEpE;AAiFD,wBAAgB,YAAY,CAAC,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,GAAG,EAAE,cAAc,UAAQ,GAAG,IAAI,CAgE3F"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export declare function setProcessFunction(fn: (element: HTMLElement, scope: any, fromStructural?: boolean) => void): void;
|
|
2
|
+
/**
|
|
3
|
+
* Process single *for directive
|
|
4
|
+
*/
|
|
5
|
+
export declare function processForDirective(element: HTMLElement, currentScope: any): void;
|
|
6
|
+
/**
|
|
7
|
+
* Process *if chain with *elseif and *else support
|
|
8
|
+
* Example:
|
|
9
|
+
* <div *if="x > 5">Greater than 5</div>
|
|
10
|
+
* <div *elseif="x > 0">Greater than 0</div>
|
|
11
|
+
* <div *else>Zero or negative</div>
|
|
12
|
+
*/
|
|
13
|
+
export declare function processIfChain(element: HTMLElement, currentScope: any): void;
|
|
14
|
+
/**
|
|
15
|
+
* Process *switch directive with *case and *default
|
|
16
|
+
* Example:
|
|
17
|
+
* <div *switch="status">
|
|
18
|
+
* <div *case="'pending'">Pending...</div>
|
|
19
|
+
* <div *case="'success'">Success!</div>
|
|
20
|
+
* <div *case="'error'">Error occurred</div>
|
|
21
|
+
* <div *default>Unknown status</div>
|
|
22
|
+
* </div>
|
|
23
|
+
*/
|
|
24
|
+
export declare function processSwitchDirective(element: HTMLElement, currentScope: any): void;
|
|
25
|
+
/**
|
|
26
|
+
* Process *await directive for async data handling
|
|
27
|
+
*
|
|
28
|
+
* Handles Promise-based async operations with pending/then/catch states.
|
|
29
|
+
* Children elements with *pending, *then, and *catch are shown conditionally.
|
|
30
|
+
*
|
|
31
|
+
* Example:
|
|
32
|
+
* <div *await="fetchUsers()">
|
|
33
|
+
* <div *pending>Loading...</div>
|
|
34
|
+
* <div *then="users">
|
|
35
|
+
* <div *for="user in users">{user.name}</div>
|
|
36
|
+
* </div>
|
|
37
|
+
* <div *catch="error">Error: {error.message}</div>
|
|
38
|
+
* </div>
|
|
39
|
+
*/
|
|
40
|
+
export declare function processAwaitDirective(element: HTMLElement, currentScope: any): void;
|
|
41
|
+
//# sourceMappingURL=structural.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"structural.d.ts","sourceRoot":"","sources":["../../../src/template/structurals/structural.ts"],"names":[],"mappings":"AAoBA,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,CAAC,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,GAAG,EAAE,cAAc,CAAC,EAAE,OAAO,KAAK,IAAI,GAAG,IAAI,CAEjH;AAyFD;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,GAAG,GAAG,IAAI,CAqDjF;AA8LD;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,GAAG,GAAG,IAAI,CAoI5E;AAED;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,GAAG,GAAG,IAAI,CAgIpF;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,GAAG,GAAG,IAAI,CAoJnF"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parse transition name from attribute value
|
|
3
|
+
* Handles:
|
|
4
|
+
* 1. Literal string: "fade" or "slide-down"
|
|
5
|
+
* 2. Expression with {}: "{transition}"
|
|
6
|
+
* 3. Expression without {}: "transition" (evaluate as variable)
|
|
7
|
+
*
|
|
8
|
+
* @param attrValue - The g-transition attribute value
|
|
9
|
+
* @param scope - Current scope for expression evaluation
|
|
10
|
+
* @returns The transition name (string)
|
|
11
|
+
*/
|
|
12
|
+
export declare function parseTransitionName(attrValue: string, scope: any): string;
|
|
13
|
+
/**
|
|
14
|
+
* Parse transition config from element's g-transition attribute
|
|
15
|
+
* Extracts transition name and custom duration modifier
|
|
16
|
+
*
|
|
17
|
+
* @param element - Element with g-transition attribute
|
|
18
|
+
* @param scope - Current scope for expression evaluation
|
|
19
|
+
* @returns { name: string, duration?: number } or null if no transition
|
|
20
|
+
*/
|
|
21
|
+
export declare function parseTransitionConfig(element: HTMLElement, scope: any): {
|
|
22
|
+
name: string;
|
|
23
|
+
duration?: number;
|
|
24
|
+
} | null;
|
|
25
|
+
/**
|
|
26
|
+
* Find all elements with g-transition attribute
|
|
27
|
+
* Searches root element and all descendants
|
|
28
|
+
*
|
|
29
|
+
* @param root - Root element to search from
|
|
30
|
+
* @returns Array of elements with g-transition
|
|
31
|
+
*/
|
|
32
|
+
export declare function findElementsWithTransition(root: HTMLElement): HTMLElement[];
|
|
33
|
+
/**
|
|
34
|
+
* Propagate scope to element and all descendants
|
|
35
|
+
* Only sets scope if not already set (preserves existing scopes)
|
|
36
|
+
*
|
|
37
|
+
* @param element - Root element to propagate scope to
|
|
38
|
+
* @param scope - Scope object to propagate
|
|
39
|
+
* @param skipIfExists - If true, don't overwrite existing scopes (default: true)
|
|
40
|
+
*/
|
|
41
|
+
export declare function propagateScopeToTree(element: Element, scope: any, skipIfExists?: boolean): void;
|
|
42
|
+
/**
|
|
43
|
+
* Apply enter transition to an element
|
|
44
|
+
* Handles transition config parsing and application
|
|
45
|
+
*
|
|
46
|
+
* @param element - Element to apply transition to
|
|
47
|
+
* @param scope - Current scope for expression evaluation
|
|
48
|
+
* @returns Promise that resolves when transition completes
|
|
49
|
+
*/
|
|
50
|
+
export declare function applyEnterTransition(element: HTMLElement, scope: any): Promise<void>;
|
|
51
|
+
/**
|
|
52
|
+
* Apply leave transition to an element
|
|
53
|
+
* Handles transition config parsing and application
|
|
54
|
+
*
|
|
55
|
+
* @param element - Element to apply transition to
|
|
56
|
+
* @param scope - Current scope for expression evaluation
|
|
57
|
+
* @returns Promise that resolves when transition completes
|
|
58
|
+
*/
|
|
59
|
+
export declare function applyLeaveTransition(element: HTMLElement, scope: any): Promise<void>;
|
|
60
|
+
//# sourceMappingURL=transition-helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transition-helpers.d.ts","sourceRoot":"","sources":["../../../src/template/structurals/transition-helpers.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,MAAM,CAqBzE;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,GAAG,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAiBlH;AAED;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,WAAW,GAAG,WAAW,EAAE,CAkB3E;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,YAAY,GAAE,OAAc,GAAG,IAAI,CAarG;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,CAYpF;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,CAYpF"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Process text nodes with {expression} interpolation
|
|
3
|
+
*
|
|
4
|
+
* @param el - Root element to process
|
|
5
|
+
* @param scope - Scope object for evaluation
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* // <div>Hello {name}!</div>
|
|
9
|
+
* processTextNodes(div, { name: 'World' })
|
|
10
|
+
*/
|
|
11
|
+
export declare function processTextNodes(el: HTMLElement, scope: any): void;
|
|
12
|
+
/**
|
|
13
|
+
* Process static text nodes (no reactivity, one-time interpolation)
|
|
14
|
+
*
|
|
15
|
+
* @param el - Root element to process
|
|
16
|
+
* @param scope - Scope object for evaluation
|
|
17
|
+
*/
|
|
18
|
+
export declare function processTextNodesStatic(el: HTMLElement, scope: any): void;
|
|
19
|
+
//# sourceMappingURL=text.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../src/template/text.ts"],"names":[],"mappings":"AASA;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,GAAG,GAAG,IAAI,CA4ClE;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,GAAG,GAAG,IAAI,CAyBxE"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Signal - Reactive primitive (callable)
|
|
3
|
+
* Can be called as function: signal() = read, signal(value) = write
|
|
4
|
+
*/
|
|
5
|
+
export interface Signal<T = any> {
|
|
6
|
+
(): T;
|
|
7
|
+
(value: T): T;
|
|
8
|
+
value: T;
|
|
9
|
+
readonly peek: T;
|
|
10
|
+
update(fn: (value: T) => T): void;
|
|
11
|
+
subscribe(fn: () => void): () => void;
|
|
12
|
+
__gyos_signal__: true;
|
|
13
|
+
__gyos_debug_id__?: number;
|
|
14
|
+
__gyos_debug_label__?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface SignalOptions<T = any> {
|
|
17
|
+
debugLabel?: string;
|
|
18
|
+
equals?: (a: T, b: T) => boolean;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Computed - Derived reactive value (callable, read-only)
|
|
22
|
+
* Can be called as function: computed() = read value
|
|
23
|
+
*/
|
|
24
|
+
export interface Computed<T = any> {
|
|
25
|
+
(): T;
|
|
26
|
+
readonly value: T;
|
|
27
|
+
readonly peek: T;
|
|
28
|
+
subscribe(fn: () => void): () => void;
|
|
29
|
+
__gyos_computed__: true;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Scope definition
|
|
33
|
+
*/
|
|
34
|
+
export interface Scope {
|
|
35
|
+
[key: string]: any;
|
|
36
|
+
onMount?(): void | Promise<void>;
|
|
37
|
+
onUnmount?(): void;
|
|
38
|
+
onUpdate?(): void;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Component context
|
|
42
|
+
*/
|
|
43
|
+
export interface ComponentContext {
|
|
44
|
+
inject<T = any>(key: string): T;
|
|
45
|
+
provide(key: string, value: any): void;
|
|
46
|
+
$refs: Record<string, HTMLElement>;
|
|
47
|
+
$emit(event: string, ...args: any[]): void;
|
|
48
|
+
$on(event: string, handler: Function): () => void;
|
|
49
|
+
$watch(key: string, handler: WatchCallback, options?: WatchOptions): () => void;
|
|
50
|
+
$effect(fn: () => void | (() => void)): () => void;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Watch callback
|
|
54
|
+
*/
|
|
55
|
+
export type WatchCallback<T = any> = (newValue: T, oldValue: T) => void;
|
|
56
|
+
/**
|
|
57
|
+
* Watch options
|
|
58
|
+
*/
|
|
59
|
+
export interface WatchOptions {
|
|
60
|
+
immediate?: boolean;
|
|
61
|
+
debounce?: number;
|
|
62
|
+
deep?: boolean;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Directive definition
|
|
66
|
+
*/
|
|
67
|
+
export interface Directive {
|
|
68
|
+
mounted?(el: HTMLElement, binding: DirectiveBinding, scope?: Scope): void;
|
|
69
|
+
updated?(el: HTMLElement, binding: DirectiveBinding, scope?: Scope): void;
|
|
70
|
+
unmounted?(el: HTMLElement): void;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Directive binding
|
|
74
|
+
*/
|
|
75
|
+
export interface DirectiveBinding {
|
|
76
|
+
value: any;
|
|
77
|
+
oldValue: any;
|
|
78
|
+
arg?: string[];
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Pipe function
|
|
82
|
+
*/
|
|
83
|
+
export type PipeFn<T = any, R = any> = (value: T, ...args: any[]) => R;
|
|
84
|
+
/**
|
|
85
|
+
* Validator function
|
|
86
|
+
*/
|
|
87
|
+
export type ValidatorFn = (value: any, ...args: any[]) => boolean | string | Promise<boolean | string>;
|
|
88
|
+
/**
|
|
89
|
+
* Hydration strategy
|
|
90
|
+
*/
|
|
91
|
+
export type HydrationStrategy = 'idle' | 'visible' | 'interaction' | `media(${string})`;
|
|
92
|
+
export interface StructuralElement {
|
|
93
|
+
element: HTMLElement;
|
|
94
|
+
type: 'if' | 'for' | 'switch' | 'await';
|
|
95
|
+
depth: number;
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,MAAM,CAAC,CAAC,GAAG,GAAG;IAC9B,IAAI,CAAC,CAAC;IACN,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,CAAC;IACd,KAAK,EAAE,CAAC,CAAC;IACT,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;IACjB,MAAM,CAAC,EAAE,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;IAClC,SAAS,CAAC,EAAE,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC;IACtC,eAAe,EAAE,IAAI,CAAC;IACtB,iB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AM,GAAG,OAAO,CAAC,OAAO,GAAG,MAAM,CAAC,CAAC;AAEvG;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,SAAS,GAAG,aAAa,GAAG,SAAS,MAAM,GAAG,CAAC;AAExF,MAAM,WAAW,iBAAiB;IACjC,OAAO,EAAE,WAAW,CAAC;IACrB,IAAI,EAAE,IAAI,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,CAAC;IACxC,KAAK,EAAE,MAAM,CAAA;CACb"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility helpers
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Next tick - Execute callback after DOM updates
|
|
6
|
+
*/
|
|
7
|
+
export declare function nextTick(callback: () => void): void;
|
|
8
|
+
/**
|
|
9
|
+
* Execute callback when DOM is ready
|
|
10
|
+
*/
|
|
11
|
+
export declare function ready(callback: () => void): void;
|
|
12
|
+
/**
|
|
13
|
+
* Debounce function
|
|
14
|
+
*/
|
|
15
|
+
export declare function debounce<T extends (...args: any[]) => any>(fn: T, delay: number): (...args: Parameters<T>) => void;
|
|
16
|
+
/**
|
|
17
|
+
* Throttle function
|
|
18
|
+
*/
|
|
19
|
+
export declare function throttle<T extends (...args: any[]) => any>(fn: T, delay: number): (...args: Parameters<T>) => void;
|
|
20
|
+
/**
|
|
21
|
+
* Deep clone object
|
|
22
|
+
*/
|
|
23
|
+
export declare function clone<T>(obj: T): T;
|
|
24
|
+
/**
|
|
25
|
+
* Check if value is object
|
|
26
|
+
*/
|
|
27
|
+
export declare function isObject(value: any): value is Record<string, any>;
|
|
28
|
+
/**
|
|
29
|
+
* Check if running in browser
|
|
30
|
+
*/
|
|
31
|
+
export declare function isBrowser(): boolean;
|
|
32
|
+
export declare function uniqueId(prefix?: string): string;
|
|
33
|
+
export declare function deepEqual(a: any, b: any): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Check if element is inside a g-static parent
|
|
36
|
+
*/
|
|
37
|
+
export declare function isInStaticParent(element: Element, root: HTMLElement): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Check whether GyosJS must leave an element and its subtree untouched.
|
|
40
|
+
*/
|
|
41
|
+
export declare function isInIgnoredTree(element: Element): boolean;
|
|
42
|
+
export declare function hasUnsafePropertyPath(path: string): boolean;
|
|
43
|
+
export declare const DEBUG: () => any;
|
|
44
|
+
export declare const DEBUG_VERBOSE: () => any;
|
|
45
|
+
/**
|
|
46
|
+
* Walk through DOM tree and return elements that match callback
|
|
47
|
+
*/
|
|
48
|
+
export declare function walkerDOM(el: HTMLElement, acceptFn: (el: HTMLElement) => boolean, skip?: number): HTMLElement[];
|
|
49
|
+
export declare function log(...args: unknown[]): void;
|
|
50
|
+
/**
|
|
51
|
+
* Check if element or any ancestor has structural directive
|
|
52
|
+
*/
|
|
53
|
+
export declare function hasStructuralParent(el: Element): boolean;
|
|
54
|
+
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/utils/helpers.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI,CAEnD;AAED;;GAEG;AACH,wBAAgB,KAAK,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI,CAUhD;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EACzD,EAAE,EAAE,CAAC,EACL,KAAK,EAAE,MAAM,GACX,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,IAAI,CAYlC;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EACzD,EAAE,EAAE,CAAC,EACL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4
|
+
*/
|
|
5
|
+
export declare class ProgressBar {
|
|
6
|
+
private element;
|
|
7
|
+
private animationFrame;
|
|
8
|
+
private hideTimer;
|
|
9
|
+
private resetTimer;
|
|
10
|
+
private currentProgress;
|
|
11
|
+
private progressBarEnabled;
|
|
12
|
+
constructor(progressBarEnabled?: boolean);
|
|
13
|
+
getCurrentProgress(): number;
|
|
14
|
+
private createBar;
|
|
15
|
+
start(): void;
|
|
16
|
+
setProgress(percent: number): void;
|
|
17
|
+
complete(): void;
|
|
18
|
+
hide(): void;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=progress-bar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progress-bar.d.ts","sourceRoot":"","sources":["../../src/utils/progress-bar.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,qBAAa,WAAW;IACpB,OAAO,CAAC,OAAO,CAA4B;IAC3C,OAAO,CAAC,cAAc,CAAuB;IAC7C,OAAO,CAAC,SAAS,CAAuB;IACxC,OAAO,CAAC,UAAU,CAAuB;IACzC,OAAO,CAAC,eAAe,CAAa;IACpC,OAAO,CAAC,kBAAkB,CAAiB;gBAE/B,kBAAkB,GAAE,OAAc;IAK9C,kBAAkB,IAAI,MAAM;IAI5B,OAAO,CAAC,SAAS;IA8BjB,KAAK,IAAI,IAAI;IAqBb,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAiBlC,QAAQ,IAAI,IAAI;IAahB,IAAI,IAAI,IAAI;CAaf"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Target Spinner Utility
|
|
3
|
+
* Creates and manages inline spinner for target elements during navigation
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Show spinner in target element
|
|
7
|
+
*/
|
|
8
|
+
export declare function showTargetSpinner(target: HTMLElement, swapMode: string): HTMLElement;
|
|
9
|
+
/**
|
|
10
|
+
* Hide and remove spinner from target
|
|
11
|
+
*/
|
|
12
|
+
export declare function hideTargetSpinner(spinner: HTMLElement | null): void;
|
|
13
|
+
//# sourceMappingURL=target-spinner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"target-spinner.d.ts","sourceRoot":"","sources":["../../src/utils/target-spinner.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAmDH;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,GAAG,WAAW,CAQpF;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,GAAG,IAAI,CAInE"}
|
package/package.json
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "gyosjs",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Reactive HTML for server-rendered websites, with signals, template directives, and MPA boost navigation",
|
|
6
|
+
"engines": {
|
|
7
|
+
"node": ">=18"
|
|
8
|
+
},
|
|
9
|
+
"main": "./dist/gyos.esm.js",
|
|
10
|
+
"module": "./dist/gyos.esm.js",
|
|
11
|
+
"unpkg": "./dist/gyos.auto.min.js",
|
|
12
|
+
"jsdelivr": "./dist/gyos.auto.min.js",
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"import": "./dist/gyos.esm.js",
|
|
18
|
+
"default": "./dist/gyos.esm.js"
|
|
19
|
+
},
|
|
20
|
+
"./auto": {
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"import": "./dist/gyos.auto.esm.js",
|
|
23
|
+
"default": "./dist/gyos.auto.esm.js"
|
|
24
|
+
},
|
|
25
|
+
"./package.json": "./package.json"
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"dist"
|
|
29
|
+
],
|
|
30
|
+
"sideEffects": [
|
|
31
|
+
"./dist/gyos.auto.js",
|
|
32
|
+
"./dist/gyos.auto.min.js",
|
|
33
|
+
"./dist/gyos.auto.esm.js"
|
|
34
|
+
],
|
|
35
|
+
"overrides": {
|
|
36
|
+
"form-data": "4.0.6",
|
|
37
|
+
"postcss": "8.5.25",
|
|
38
|
+
"ws": "8.21.2"
|
|
39
|
+
},
|
|
40
|
+
"scripts": {
|
|
41
|
+
"dev": "vite",
|
|
42
|
+
"dev:e2e": "vite --host 127.0.0.1 --port 4173",
|
|
43
|
+
"build": "rollup -c",
|
|
44
|
+
"build:watch": "rollup -c -w",
|
|
45
|
+
"test": "vitest run",
|
|
46
|
+
"test:unit": "vitest run",
|
|
47
|
+
"test:watch": "vitest",
|
|
48
|
+
"test:e2e": "playwright test",
|
|
49
|
+
"test:e2e:headed": "playwright test --headed",
|
|
50
|
+
"test:ui": "vitest --ui",
|
|
51
|
+
"preview": "vite preview",
|
|
52
|
+
"typecheck": "tsc --noEmit",
|
|
53
|
+
"pack:check": "node scripts/verify-package.mjs",
|
|
54
|
+
"check": "npm run typecheck && npm run test:unit && npm run pack:check",
|
|
55
|
+
"release:check": "npm run check && npm run test:e2e",
|
|
56
|
+
"export:public": "node scripts/export-public-source.mjs",
|
|
57
|
+
"sync:public": "node scripts/export-public-source.mjs --sync",
|
|
58
|
+
"sync:public:check": "node scripts/export-public-source.mjs --sync --dry-run",
|
|
59
|
+
"prepack": "npm run build"
|
|
60
|
+
},
|
|
61
|
+
"keywords": [
|
|
62
|
+
"reactive-html",
|
|
63
|
+
"signals",
|
|
64
|
+
"mpa",
|
|
65
|
+
"progressive-enhancement",
|
|
66
|
+
"server-rendered",
|
|
67
|
+
"alpinejs",
|
|
68
|
+
"html-first",
|
|
69
|
+
"router",
|
|
70
|
+
"hydration"
|
|
71
|
+
],
|
|
72
|
+
"author": "Ho Hoang Phu",
|
|
73
|
+
"repository": {
|
|
74
|
+
"type": "git",
|
|
75
|
+
"url": "git+https://github.com/gyosjs/gyosjs.git"
|
|
76
|
+
},
|
|
77
|
+
"homepage": "https://github.com/gyosjs/gyosjs#readme",
|
|
78
|
+
"bugs": {
|
|
79
|
+
"url": "https://github.com/gyosjs/gyosjs/issues"
|
|
80
|
+
},
|
|
81
|
+
"license": "MIT",
|
|
82
|
+
"devDependencies": {
|
|
83
|
+
"@playwright/test": "1.55.1",
|
|
84
|
+
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
85
|
+
"@rollup/plugin-typescript": "^11.1.6",
|
|
86
|
+
"jsdom": "^24.0.0",
|
|
87
|
+
"rollup": "^4.62.4",
|
|
88
|
+
"terser": "^5.49.0",
|
|
89
|
+
"tslib": "^2.8.1",
|
|
90
|
+
"typescript": "^5.3.3",
|
|
91
|
+
"vite": "^6.4.3",
|
|
92
|
+
"vitest": "^3.2.4"
|
|
93
|
+
}
|
|
94
|
+
}
|