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.
Files changed (91) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +131 -0
  3. package/dist/auto-init.d.ts +3 -0
  4. package/dist/auto-init.d.ts.map +1 -0
  5. package/dist/core/component.d.ts +15 -0
  6. package/dist/core/component.d.ts.map +1 -0
  7. package/dist/core/composables.d.ts +113 -0
  8. package/dist/core/composables.d.ts.map +1 -0
  9. package/dist/core/di.d.ts +56 -0
  10. package/dist/core/di.d.ts.map +1 -0
  11. package/dist/core/directive.d.ts +52 -0
  12. package/dist/core/directive.d.ts.map +1 -0
  13. package/dist/core/events.d.ts +88 -0
  14. package/dist/core/events.d.ts.map +1 -0
  15. package/dist/core/hydration.d.ts +96 -0
  16. package/dist/core/hydration.d.ts.map +1 -0
  17. package/dist/core/pipe.d.ts +34 -0
  18. package/dist/core/pipe.d.ts.map +1 -0
  19. package/dist/core/portal.d.ts +37 -0
  20. package/dist/core/portal.d.ts.map +1 -0
  21. package/dist/core/reactive.d.ts +15 -0
  22. package/dist/core/reactive.d.ts.map +1 -0
  23. package/dist/core/router/diff-nodes.d.ts +2 -0
  24. package/dist/core/router/diff-nodes.d.ts.map +1 -0
  25. package/dist/core/router/persist.d.ts +4 -0
  26. package/dist/core/router/persist.d.ts.map +1 -0
  27. package/dist/core/router/router.d.ts +43 -0
  28. package/dist/core/router/router.d.ts.map +1 -0
  29. package/dist/core/router/script.d.ts +18 -0
  30. package/dist/core/router/script.d.ts.map +1 -0
  31. package/dist/core/router/scroll.d.ts +6 -0
  32. package/dist/core/router/scroll.d.ts.map +1 -0
  33. package/dist/core/router/swap.d.ts +8 -0
  34. package/dist/core/router/swap.d.ts.map +1 -0
  35. package/dist/core/scope-registry.d.ts +36 -0
  36. package/dist/core/scope-registry.d.ts.map +1 -0
  37. package/dist/core/store.d.ts +32 -0
  38. package/dist/core/store.d.ts.map +1 -0
  39. package/dist/core/transition.d.ts +130 -0
  40. package/dist/core/transition.d.ts.map +1 -0
  41. package/dist/form/form-validation.d.ts +36 -0
  42. package/dist/form/form-validation.d.ts.map +1 -0
  43. package/dist/form/validator.d.ts +124 -0
  44. package/dist/form/validator.d.ts.map +1 -0
  45. package/dist/gyos.auto.esm.js +7890 -0
  46. package/dist/gyos.auto.esm.js.map +1 -0
  47. package/dist/gyos.auto.js +7900 -0
  48. package/dist/gyos.auto.js.map +1 -0
  49. package/dist/gyos.auto.min.js +6 -0
  50. package/dist/gyos.esm.js +7872 -0
  51. package/dist/gyos.esm.js.map +1 -0
  52. package/dist/gyos.js +7942 -0
  53. package/dist/gyos.js.map +1 -0
  54. package/dist/gyos.min.js +6 -0
  55. package/dist/index.d.ts +86 -0
  56. package/dist/index.d.ts.map +1 -0
  57. package/dist/reactivity/signal.d.ts +224 -0
  58. package/dist/reactivity/signal.d.ts.map +1 -0
  59. package/dist/template/bindings.d.ts +21 -0
  60. package/dist/template/bindings.d.ts.map +1 -0
  61. package/dist/template/cleanup.d.ts +9 -0
  62. package/dist/template/cleanup.d.ts.map +1 -0
  63. package/dist/template/directives.d.ts +22 -0
  64. package/dist/template/directives.d.ts.map +1 -0
  65. package/dist/template/effect-queue.d.ts +18 -0
  66. package/dist/template/effect-queue.d.ts.map +1 -0
  67. package/dist/template/events.d.ts +2 -0
  68. package/dist/template/events.d.ts.map +1 -0
  69. package/dist/template/expression.d.ts +25 -0
  70. package/dist/template/expression.d.ts.map +1 -0
  71. package/dist/template/model.d.ts +19 -0
  72. package/dist/template/model.d.ts.map +1 -0
  73. package/dist/template/parser.d.ts +9 -0
  74. package/dist/template/parser.d.ts.map +1 -0
  75. package/dist/template/process.d.ts +3 -0
  76. package/dist/template/process.d.ts.map +1 -0
  77. package/dist/template/structurals/structural.d.ts +41 -0
  78. package/dist/template/structurals/structural.d.ts.map +1 -0
  79. package/dist/template/structurals/transition-helpers.d.ts +60 -0
  80. package/dist/template/structurals/transition-helpers.d.ts.map +1 -0
  81. package/dist/template/text.d.ts +19 -0
  82. package/dist/template/text.d.ts.map +1 -0
  83. package/dist/types.d.ts +97 -0
  84. package/dist/types.d.ts.map +1 -0
  85. package/dist/utils/helpers.d.ts +54 -0
  86. package/dist/utils/helpers.d.ts.map +1 -0
  87. package/dist/utils/progress-bar.d.ts +20 -0
  88. package/dist/utils/progress-bar.d.ts.map +1 -0
  89. package/dist/utils/target-spinner.d.ts +13 -0
  90. package/dist/utils/target-spinner.d.ts.map +1 -0
  91. package/package.json +94 -0
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Portal/Teleport System - Render content in different DOM location
3
+ * Useful for modals, tooltips, notifications that need to break out of parent containers
4
+ *
5
+ * @example
6
+ * // Portal to body (for modals)
7
+ * <div g-portal="body">
8
+ * <div class="modal">Modal content</div>
9
+ * </div>
10
+ *
11
+ * @example
12
+ * // Portal to specific element
13
+ * <div g-portal="#notifications">
14
+ * <div class="toast">Toast message</div>
15
+ * </div>
16
+ */
17
+ /**
18
+ * Create a portal - Move element to target location
19
+ *
20
+ * @param sourceEl - Element to teleport
21
+ * @param targetSelector - CSS selector for destination
22
+ *
23
+ * @example
24
+ * portalCreate(modalEl, 'body');
25
+ * portalCreate(tooltipEl, '#tooltip-container');
26
+ */
27
+ export declare function portalCreate(sourceEl: HTMLElement, targetSelector: string): void;
28
+ /**
29
+ * Destroy a portal - Restore element to original position
30
+ *
31
+ * @param sourceEl - Element to restore
32
+ *
33
+ * @example
34
+ * portalDestroy(modalEl); // Returns modal to original location
35
+ */
36
+ export declare function portalDestroy(sourceEl: HTMLElement): void;
37
+ //# sourceMappingURL=portal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"portal.d.ts","sourceRoot":"","sources":["../../src/core/portal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,GAAG,IAAI,CAoBhF;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,WAAW,GAAG,IAAI,CAczD"}
@@ -0,0 +1,15 @@
1
+ import { Signal } from "../types";
2
+ export declare const SCOPE_VERSION: unique symbol;
3
+ export declare function markStore<T extends object>(obj: T): T;
4
+ export declare function isStoreObject(val: any): boolean;
5
+ export declare function markRaw<T extends object>(obj: T): T;
6
+ export declare function shallow<T extends object>(obj: T): T;
7
+ export declare function reactive<T extends object>(raw: T): T;
8
+ export declare function makeReactive<T extends object>(source: T): T;
9
+ /**
10
+ * Internal helper to read the shared scope version for any reactive object/array.
11
+ * Allows structural renderers to depend on list-level changes without subscribing
12
+ * to every item/index signal.
13
+ */
14
+ export declare function getScopeVersion(target: any): Signal<number> | undefined;
15
+ //# sourceMappingURL=reactive.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reactive.d.ts","sourceRoot":"","sources":["../../src/core/reactive.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAUlC,eAAO,MAAM,aAAa,eAAmC,CAAC;AA0D9D,wBAAgB,SAAS,CAAC,CAAC,SAAS,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAOrD;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAE/C;AAKD,wBAAgB,OAAO,CAAC,CAAC,SAAS,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAOnD;AASD,wBAAgB,OAAO,CAAC,CAAC,SAAS,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAOnD;AAiCD,wBAAgB,QAAQ,CAAC,CAAC,SAAS,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAgMpD;AAED,wBAAgB,YAAY,CAAC,CAAC,SAAS,MAAM,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC,CAgB3D;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,SAAS,CAEvE"}
@@ -0,0 +1,2 @@
1
+ export declare function diffNodes(currentNodes: Element[], nextNodes: Element[], container?: HTMLElement, signal?: AbortSignal): Promise<void>;
2
+ //# sourceMappingURL=diff-nodes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diff-nodes.d.ts","sourceRoot":"","sources":["../../../src/core/router/diff-nodes.ts"],"names":[],"mappings":"AAiCA,wBAAsB,SAAS,CAC9B,YAAY,EAAE,OAAO,EAAE,EACvB,SAAS,EAAE,OAAO,EAAE,EACpB,SAAS,GAAE,WAA2B,EACtC,MAAM,CAAC,EAAE,WAAW,GAClB,OAAO,CAAC,IAAI,CAAC,CAyCf"}
@@ -0,0 +1,4 @@
1
+ export declare function detachPersist(root?: ParentNode): void;
2
+ export declare function mergePersistIntoLive(root: ParentNode): void;
3
+ export declare function resetPersistState(): void;
4
+ //# sourceMappingURL=persist.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"persist.d.ts","sourceRoot":"","sources":["../../../src/core/router/persist.ts"],"names":[],"mappings":"AAmDA,wBAAgB,aAAa,CAAC,IAAI,GAAE,UAAqB,GAAG,IAAI,CAU/D;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,CA2C3D;AAED,wBAAgB,iBAAiB,IAAI,IAAI,CAIxC"}
@@ -0,0 +1,43 @@
1
+ export interface RouterOptions {
2
+ showProgress?: boolean;
3
+ }
4
+ interface NavigateOptions {
5
+ url: string;
6
+ method: string;
7
+ trigger?: Element | null;
8
+ form?: HTMLFormElement | null;
9
+ formData?: FormData | null;
10
+ jsonData?: Record<string, any> | null;
11
+ replace?: boolean;
12
+ changeState?: boolean;
13
+ popstate?: boolean;
14
+ savedScroll?: {
15
+ x: number;
16
+ y: number;
17
+ };
18
+ targetSelector?: string | null;
19
+ targetOutletIndex?: number | null;
20
+ swapMode?: string;
21
+ currentHead?: boolean;
22
+ historyFragment?: HTMLElement;
23
+ historyEntryId?: string | null;
24
+ scrollSourceEntryId?: string | null;
25
+ }
26
+ interface Snapshot {
27
+ html: string;
28
+ }
29
+ export declare function onBeforeNavigate(callback: (url: string) => void): void;
30
+ export declare function onAfterNavigate(callback: (url: string) => void): void;
31
+ export declare function startRouter(options?: RouterOptions): void;
32
+ declare function saveSnapshot(url: string, html: string): void;
33
+ declare function navigate(opts: NavigateOptions): Promise<void>;
34
+ declare function resetRouterState(): void;
35
+ export declare const __routerTest: {
36
+ navigate: typeof navigate;
37
+ saveSnapshot: typeof saveSnapshot;
38
+ snapshots: Map<string, Snapshot>;
39
+ preloadCache: Map<string, Promise<Response>>;
40
+ resetRouterState: typeof resetRouterState;
41
+ };
42
+ export {};
43
+ //# sourceMappingURL=router.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../../src/core/router/router.ts"],"names":[],"mappings":"AAkBA,MAAM,WAAW,aAAa;IAC7B,YAAY,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,UAAU,eAAe;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IACzB,IAAI,CAAC,EAAE,eAAe,GAAG,IAAI,CAAC;IAC9B,QAAQ,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;IACtC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACvC,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,eAAe,CAAC,EAAE,WAAW,CAAC;IAC9B,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,mBAAmB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACpC;AAgBD,UAAU,QAAQ;IACjB,IAAI,EAAE,MAAM,CAAC;CACb;AAiCD,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI,CAEtE;AAED,wBAAgB,eAAe,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI,CAErE;AAED,wBAAgB,WAAW,CAAC,OAAO,CAAC,EAAE,aAAa,GAAG,IAAI,CA2BzD;AA8CD,iBAAS,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAarD;AA8QD,iBAAe,QAAQ,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAmT5D;AA8JD,iBAAS,gBAAgB,IAAI,IAAI,CAsBhC;AAGD,eAAO,MAAM,YAAY;;;;;;CAMxB,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Cache all scripts from the initial page load
3
+ * This prevents them from re-executing when navigating back to the first page
4
+ */
5
+ export declare function cacheInitialPageScripts(): void;
6
+ /**
7
+ * Check if script should be executed
8
+ * Scripts are not cached and always re-run by default
9
+ * Use g-script-once attribute to mark scripts that should only run once
10
+ */
11
+ export declare function shouldExecuteScript(script: HTMLScriptElement): boolean;
12
+ export declare function getScriptExecutionKey(script: HTMLScriptElement): string | null;
13
+ export declare function forgetExecutedScript(script: HTMLScriptElement, executionKey?: string | null): void;
14
+ export declare function waitForScriptLoad(script: HTMLScriptElement, signal?: AbortSignal, executionKey?: string | null): Promise<void>;
15
+ export declare function executeScriptsInNodes(nodes: Iterable<Node>, signal?: AbortSignal): Promise<void>;
16
+ export declare function executeScripts(container: HTMLElement, signal?: AbortSignal): Promise<void>;
17
+ export declare function wrapScriptExecution(scriptContent: string): string;
18
+ //# sourceMappingURL=script.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"script.d.ts","sourceRoot":"","sources":["../../../src/core/router/script.ts"],"names":[],"mappings":"AAiBA;;;GAGG;AACH,wBAAgB,uBAAuB,IAAI,IAAI,CAiB9C;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAkBtE;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM,GAAG,IAAI,CAG9E;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,iBAAiB,EAAE,YAAY,gBAAgC,GAAG,IAAI,CAGlH;AAED,wBAAgB,iBAAiB,CAChC,MAAM,EAAE,iBAAiB,EACzB,MAAM,CAAC,EAAE,WAAW,EACpB,YAAY,gBAAgC,GAC1C,OAAO,CAAC,IAAI,CAAC,CAwBf;AA4BD,wBAAsB,qBAAqB,CAAC,KAAK,EAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAYtG;AAED,wBAAsB,cAAc,CAAC,SAAS,EAAE,WAAW,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAEhG;AAED,wBAAgB,mBAAmB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAGjE"}
@@ -0,0 +1,6 @@
1
+ export declare function saveScrollPosition(): void;
2
+ export declare function handleScroll(url: string, trigger?: Element | null, savedScroll?: {
3
+ x: number;
4
+ y: number;
5
+ }): void;
6
+ //# sourceMappingURL=scroll.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scroll.d.ts","sourceRoot":"","sources":["../../../src/core/router/scroll.ts"],"names":[],"mappings":"AAAA,wBAAgB,kBAAkB,IAAI,IAAI,CAIzC;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,IAAI,EAAE,WAAW,CAAC,EAAE;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAqBhH"}
@@ -0,0 +1,8 @@
1
+ interface SwapOptions {
2
+ syncRootAttributes?: boolean;
3
+ signal?: AbortSignal;
4
+ beforeScripts?: () => Promise<void>;
5
+ }
6
+ export declare function performSwap(target: HTMLElement, src: HTMLElement, mode: string, options?: SwapOptions): Promise<HTMLElement>;
7
+ export {};
8
+ //# sourceMappingURL=swap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"swap.d.ts","sourceRoot":"","sources":["../../../src/core/router/swap.ts"],"names":[],"mappings":"AAGA,UAAU,WAAW;IACpB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACpC;AAiBD,wBAAsB,WAAW,CAChC,MAAM,EAAE,WAAW,EACnB,GAAG,EAAE,WAAW,EAChB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,WAAgB,GACvB,OAAO,CAAC,WAAW,CAAC,CAwDtB"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Scope Registry
3
+ * Manages mounted scope instances
4
+ * Extracted to avoid circular dependencies
5
+ */
6
+ /**
7
+ * Cache of mounted scopes by name
8
+ */
9
+ export declare const scopeCached: Map<string, any>;
10
+ /**
11
+ * Register a mounted scope
12
+ */
13
+ export declare function registerMountedScope(el: HTMLElement, instance: any): void;
14
+ /**
15
+ * Get mounted scope instance
16
+ */
17
+ export declare function getMountedScope(el: HTMLElement): any;
18
+ /**
19
+ * Get all mounted scopes
20
+ */
21
+ export declare function getAllMountedScopes(): Map<HTMLElement, any>;
22
+ /**
23
+ * Unmount a scope
24
+ * Handles effect cleanup, lifecycle hooks, and registry removal
25
+ */
26
+ export declare function unmountScope(el: HTMLElement): void;
27
+ /**
28
+ * Get scope from element or nearest parent (lazy lookup)
29
+ * More efficient than pre-setting on all descendants
30
+ */
31
+ export declare function getScopeFromElement(element: HTMLElement): any;
32
+ /**
33
+ * Unmount all child scopes of a given element
34
+ */
35
+ export declare function unmountChildScopes(element: HTMLElement): void;
36
+ //# sourceMappingURL=scope-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scope-registry.d.ts","sourceRoot":"","sources":["../../src/core/scope-registry.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAOH;;GAEG;AACH,eAAO,MAAM,WAAW,kBAAyB,CAAC;AAElD;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,WAAW,EAAE,QAAQ,EAAE,GAAG,GAAG,IAAI,CAEzE;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,EAAE,EAAE,WAAW,GAAG,GAAG,CAEpD;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,GAAG,CAAC,WAAW,EAAE,GAAG,CAAC,CAE3D;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,EAAE,EAAE,WAAW,GAAG,IAAI,CA2BlD;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,WAAW,GAAG,GAAG,CAS7D;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,CAM7D"}
@@ -0,0 +1,32 @@
1
+ export declare function store<T extends Record<string, any>>(name: string, definition?: T): T;
2
+ /**
3
+ * Check if store exists
4
+ *
5
+ * @param name - Store name to check
6
+ * @returns True if store exists
7
+ *
8
+ * @example
9
+ * if (Gyos.hasStore('user')) {
10
+ * const user = Gyos.store('user');
11
+ * }
12
+ */
13
+ export declare function hasStore(name: string): boolean;
14
+ /**
15
+ * Remove a store
16
+ *
17
+ * @param name - Store name to remove
18
+ *
19
+ * @example
20
+ * Gyos.removeStore('user'); // Clear user store
21
+ */
22
+ export declare function removeStore(name: string): void;
23
+ /**
24
+ * Get all store names (for debugging)
25
+ *
26
+ * @returns Array of store names
27
+ *
28
+ * @example
29
+ * console.log('Active stores:', Gyos.getStoreNames());
30
+ */
31
+ export declare function getStoreNames(): string[];
32
+ //# sourceMappingURL=store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/core/store.ts"],"names":[],"mappings":"AAoCA,wBAAgB,KAAK,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,CAAC,GAAG,CAAC,CAcpF;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE9C;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAE9C;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,IAAI,MAAM,EAAE,CAExC"}
@@ -0,0 +1,130 @@
1
+ /**
2
+ * Transitions System - Smooth animations for enter/leave
3
+ *
4
+ * Provides built-in transitions and custom transition support for elements.
5
+ * Works with conditional rendering (*if, *for) to animate element appearance.
6
+ *
7
+ * @example Basic usage
8
+ * ```html
9
+ * <div *if="show" g-transition="fade">Content</div>
10
+ * <div *if="show" g-transition.500="slide-down">Slower slide</div>
11
+ * ```
12
+ */
13
+ export interface TransitionConfig {
14
+ /** CSS animation name for enter (e.g., 'gyos-fade-in 250ms') */
15
+ enter?: string;
16
+ /** CSS animation name for leave (e.g., 'gyos-fade-out 250ms') */
17
+ leave?: string;
18
+ /** CSS classes to apply at the start of enter transition */
19
+ enterFrom?: string;
20
+ /** CSS classes to apply at the end of enter transition */
21
+ enterTo?: string;
22
+ /** CSS classes to apply at the start of leave transition */
23
+ leaveFrom?: string;
24
+ /** CSS classes to apply at the end of leave transition */
25
+ leaveTo?: string;
26
+ /** Transition duration in milliseconds (default: 250) */
27
+ duration?: number;
28
+ /** Hook called before enter transition starts */
29
+ onBeforeEnter?: (el: HTMLElement) => void;
30
+ /** Hook called after enter transition completes */
31
+ onAfterEnter?: (el: HTMLElement) => void;
32
+ /** Hook called before leave transition starts */
33
+ onBeforeLeave?: (el: HTMLElement) => void;
34
+ /** Hook called after leave transition completes */
35
+ onAfterLeave?: (el: HTMLElement) => void;
36
+ }
37
+ /**
38
+ * Register a custom transition
39
+ *
40
+ * @param name - Transition name
41
+ * @param config - Transition configuration
42
+ *
43
+ * @example
44
+ * ```javascript
45
+ * Gyos.registerTransition('bounce-in', {
46
+ * enter: 'bounce-in 500ms cubic-bezier(0.68, -0.55, 0.265, 1.55)',
47
+ * leave: 'bounce-out 250ms ease-in',
48
+ * duration: 500
49
+ * });
50
+ * ```
51
+ */
52
+ export declare function registerTransition(name: string, config: TransitionConfig): void;
53
+ /**
54
+ * Transition manager - Handles enter/leave animations
55
+ */
56
+ declare class TransitionManager {
57
+ private leavingElements;
58
+ /**
59
+ * Enter transition - Animates element appearing
60
+ *
61
+ * @param el - Element to animate
62
+ * @param config - Transition configuration
63
+ */
64
+ enter(el: HTMLElement, config: TransitionConfig): Promise<void>;
65
+ /**
66
+ * Leave transition - Animates element disappearing
67
+ *
68
+ * @param el - Element to animate
69
+ * @param config - Transition configuration
70
+ */
71
+ leave(el: HTMLElement, config: TransitionConfig): Promise<void>;
72
+ /**
73
+ * Apply CSS classes
74
+ */
75
+ private applyClasses;
76
+ /**
77
+ * Remove CSS classes
78
+ */
79
+ private removeClasses;
80
+ /**
81
+ * Wait for transition to complete
82
+ */
83
+ private waitForTransition;
84
+ /**
85
+ * Get transition config by name or return custom config
86
+ *
87
+ * @param name - Transition name or custom config object
88
+ * @returns Transition configuration
89
+ */
90
+ getConfig(name: string | TransitionConfig): TransitionConfig;
91
+ /**
92
+ * Get all available transition names
93
+ *
94
+ * @returns Array of transition names
95
+ */
96
+ getAvailableTransitions(): string[];
97
+ }
98
+ export declare const transitionManager: TransitionManager;
99
+ /**
100
+ * Get transition config from element attribute
101
+ *
102
+ * Supports:
103
+ * - `g-transition="fade"` - Built-in transition
104
+ * - `g-transition.500="fade"` - Custom duration (500ms)
105
+ *
106
+ * @param source - Registered transition name or element containing a transition attribute
107
+ * @returns Transition configuration or null
108
+ *
109
+ * @example
110
+ * ```html
111
+ * <div g-transition="fade">Default 250ms fade</div>
112
+ * <div g-transition.500="slide-down">500ms slide</div>
113
+ * ```
114
+ */
115
+ export declare function getTransitionConfig(source: HTMLElement | string): TransitionConfig | null;
116
+ /**
117
+ * Apply built-in transition utility styles to document
118
+ *
119
+ * Called automatically on component mount. Adds CSS classes and keyframes
120
+ * used by built-in transitions (opacity, transform, scale, etc.)
121
+ *
122
+ * @example
123
+ * ```javascript
124
+ * // Usually called automatically, but can be called manually:
125
+ * Gyos.applyTransitionStyles();
126
+ * ```
127
+ */
128
+ export declare function applyTransitionStyles(): void;
129
+ export {};
130
+ //# sourceMappingURL=transition.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transition.d.ts","sourceRoot":"","sources":["../../src/core/transition.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,MAAM,WAAW,gBAAgB;IAChC,gEAAgE;IAChE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iEAAiE;IACjE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4DAA4D;IAC5D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0DAA0D;IAC1D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,4DAA4D;IAC5D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0DAA0D;IAC1D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,yDAAyD;IACzD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iDAAiD;IACjD,aAAa,CAAC,EAAE,CAAC,EAAE,EAAE,WAAW,KAAK,IAAI,CAAC;IAC1C,mDAAmD;IACnD,YAAY,CAAC,EAAE,CAAC,EAAE,EAAE,WAAW,KAAK,IAAI,CAAC;IACzC,iDAAiD;IACjD,aAAa,CAAC,EAAE,CAAC,EAAE,EAAE,WAAW,KAAK,IAAI,CAAC;IAC1C,mDAAmD;IACnD,YAAY,CAAC,EAAE,CAAC,EAAE,EAAE,WAAW,KAAK,IAAI,CAAC;CACzC;AA2DD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,gBAAgB,GAAG,IAAI,CAE/E;AAED;;GAEG;AACH,cAAM,iBAAiB;IACtB,OAAO,CAAC,eAAe,CAA8B;IAErD;;;;;OAKG;IACG,KAAK,CAAC,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IAsDrE;;;;;OAKG;IACG,KAAK,CAAC,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IAqDrE;;OAEG;IACH,OAAO,CAAC,YAAY;IAMpB;;OAEG;IACH,OAAO,CAAC,aAAa;IAMrB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAwBzB;;;;;OAKG;IACH,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB,GAAG,gBAAgB;IAQ5D;;;;OAIG;IACH,uBAAuB,IAAI,MAAM,EAAE;CAGnC;AAGD,eAAO,MAAM,iBAAiB,mBAA0B,CAAC;AAEzD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,GAAG,gBAAgB,GAAG,IAAI,CAoCzF;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,IAAI,IAAI,CAgE5C"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Process g-form directive
3
+ * Binds form validation state to scope
4
+ *
5
+ * @example
6
+ * <form g-form="formData">
7
+ * <button :disabled="formData.$invalid">Submit</button>
8
+ * </form>
9
+ */
10
+ export declare function processFormDirective(form: HTMLFormElement, scope: any): void;
11
+ /**
12
+ * Process g-validate directive on input elements
13
+ * Validates input value against rules and updates form state
14
+ *
15
+ * @example
16
+ * <input g-model="email" g-validate="required|email">
17
+ * <input g-model="password" g-validate="required|minLength(8)|password">
18
+ */
19
+ export declare function processValidateDirective(el: HTMLElement): void;
20
+ /**
21
+ * Process g-errors directive
22
+ * Displays validation errors for a specific field or all fields
23
+ *
24
+ * @example
25
+ * <!-- Show errors for specific field -->
26
+ * <span g-errors="email" class="error"></span>
27
+ *
28
+ * <!-- Show all form errors -->
29
+ * <div g-errors class="error-summary"></div>
30
+ */
31
+ export declare function processErrorsDirective(el: HTMLElement): void;
32
+ /**
33
+ * Process all form validation directives in an element tree
34
+ */
35
+ export declare function processFormValidation(root: HTMLElement, scope: any): void;
36
+ //# sourceMappingURL=form-validation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form-validation.d.ts","sourceRoot":"","sources":["../../src/form/form-validation.ts"],"names":[],"mappings":"AA8EA;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,eAAe,EAAE,KAAK,EAAE,GAAG,GAAG,IAAI,CAiF5E;AAED;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CAAC,EAAE,EAAE,WAAW,GAAG,IAAI,CA6F9D;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CAAC,EAAE,EAAE,WAAW,GAAG,IAAI,CAiD5D;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,GAAG,GAAG,IAAI,CAqBzE"}
@@ -0,0 +1,124 @@
1
+ /**
2
+ * Form Validation System
3
+ *
4
+ * Provides a flexible validation system with built-in validators and custom validator support.
5
+ * Validators can be chained using pipe syntax and support both sync and async validation.
6
+ *
7
+ * @example Basic usage
8
+ * ```javascript
9
+ * // Register custom validator
10
+ * Gyos.validator('username', (value) => {
11
+ * return value.length >= 3 || 'Username must be at least 3 characters';
12
+ * });
13
+ *
14
+ * // Validate with rules
15
+ * const error = await Gyos.validate(value, 'required|email|minLength(5)');
16
+ * if (error) {
17
+ * console.log(error); // "Invalid email address"
18
+ * }
19
+ * ```
20
+ *
21
+ * @example Async validator
22
+ * ```javascript
23
+ * Gyos.validator('uniqueEmail', async (value) => {
24
+ * const exists = await checkEmailExists(value);
25
+ * return !exists || 'Email already taken';
26
+ * });
27
+ * ```
28
+ *
29
+ * @example In component
30
+ * ```javascript
31
+ * Gyos.scope('LoginForm', {
32
+ * email: '',
33
+ * emailError: '',
34
+ *
35
+ * async validateEmail() {
36
+ * this.emailError = await Gyos.validate(this.email, 'required|email');
37
+ * }
38
+ * });
39
+ * ```
40
+ */
41
+ import { ValidatorFn } from "../types";
42
+ export interface ValidationContext {
43
+ field?: string;
44
+ form?: Record<string, any>;
45
+ messages?: Record<string, string>;
46
+ }
47
+ /**
48
+ * Register a custom validator
49
+ *
50
+ * @param name - Validator name
51
+ * @param fn - Validator function (return true for valid, string for error message)
52
+ *
53
+ * @example
54
+ * ```javascript
55
+ * Gyos.validator('even', (value) => {
56
+ * return value % 2 === 0 || 'Must be an even number';
57
+ * });
58
+ * ```
59
+ */
60
+ export declare function validator(name: string, fn: ValidatorFn): void;
61
+ /**
62
+ * Get registered validator by name
63
+ *
64
+ * @param name - Validator name
65
+ * @returns Validator function or undefined
66
+ */
67
+ export declare function getValidator(name: string): ValidatorFn | undefined;
68
+ /**
69
+ * Get all registered validator names
70
+ *
71
+ * @returns Array of validator names
72
+ *
73
+ * @example
74
+ * ```javascript
75
+ * console.log('Available validators:', Gyos.getValidatorNames());
76
+ * // ['required', 'email', 'minLength', ...]
77
+ * ```
78
+ */
79
+ export declare function getValidatorNames(): string[];
80
+ /**
81
+ * Validate a value against validation rules
82
+ *
83
+ * Supports custom error messages in two ways:
84
+ * 1. Inline: "required:Custom message|email:Invalid email"
85
+ * 2. Via context: { messages: { required: "Custom message" } }
86
+ *
87
+ * @param value - Value to validate
88
+ * @param rules - Validation rules (pipe-separated: "required|email|minLength(5)")
89
+ * @param context - Optional context with form data and custom messages
90
+ * @returns Error message or null if valid
91
+ *
92
+ * @example Basic validation
93
+ * ```javascript
94
+ * const error = await Gyos.validate('test@', 'required|email');
95
+ * // Returns: "Invalid email address"
96
+ * ```
97
+ *
98
+ * @example Inline custom messages
99
+ * ```javascript
100
+ * const error = await Gyos.validate('', 'required:This field is mandatory|email:Enter valid email');
101
+ * // Returns: "This field is mandatory"
102
+ * ```
103
+ *
104
+ * @example Custom messages via context
105
+ * ```javascript
106
+ * const error = await Gyos.validate('abc', 'required|minLength(5)', {
107
+ * messages: {
108
+ * required: 'Please fill this field',
109
+ * minLength: 'Too short! Need at least 5 characters'
110
+ * }
111
+ * });
112
+ * // Returns: "Too short! Need at least 5 characters"
113
+ * ```
114
+ *
115
+ * @example With form context
116
+ * ```javascript
117
+ * const error = await Gyos.validate(confirmPw, 'required|same(password)', {
118
+ * form: { password: 'MyPass123' },
119
+ * messages: { same: 'Passwords do not match' }
120
+ * });
121
+ * ```
122
+ */
123
+ export declare function validate(value: any, rules: string, context?: ValidationContext): Promise<string | null>;
124
+ //# sourceMappingURL=validator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../src/form/validator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,MAAM,WAAW,iBAAiB;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAOD;;;;;;;;;;;;GAYG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,WAAW,GAAG,IAAI,CAE7D;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CAElE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,EAAE,CAE5C;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,wBAAsB,QAAQ,CAAC,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAkD7G"}