baraqex 1.0.76 → 2.0.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 (182) hide show
  1. package/CHANGELOG.md +73 -0
  2. package/README.md +268 -315
  3. package/bin/baraqex.js +150 -12
  4. package/dist/browser.d.ts +1 -1
  5. package/dist/browser.d.ts.map +1 -1
  6. package/dist/browser.js +2319 -205
  7. package/dist/browser.js.map +4 -4
  8. package/dist/core/batch.d.ts +10 -0
  9. package/dist/core/batch.d.ts.map +1 -0
  10. package/dist/core/component.d.ts +69 -0
  11. package/dist/core/component.d.ts.map +1 -0
  12. package/dist/core/context.d.ts +22 -0
  13. package/dist/core/context.d.ts.map +1 -0
  14. package/dist/core/errors.d.ts +125 -0
  15. package/dist/core/errors.d.ts.map +1 -0
  16. package/dist/core/event-bus.d.ts +29 -0
  17. package/dist/core/event-bus.d.ts.map +1 -0
  18. package/dist/core/forms.d.ts +128 -0
  19. package/dist/core/forms.d.ts.map +1 -0
  20. package/dist/core/hooks.d.ts +84 -0
  21. package/dist/core/hooks.d.ts.map +1 -0
  22. package/dist/core/index.d.ts +23 -0
  23. package/dist/core/index.d.ts.map +1 -0
  24. package/dist/core/jsx-runtime.d.ts +45 -0
  25. package/dist/core/jsx-runtime.d.ts.map +1 -0
  26. package/dist/core/lifecycle-events.d.ts +71 -0
  27. package/dist/core/lifecycle-events.d.ts.map +1 -0
  28. package/dist/core/renderer.d.ts +39 -0
  29. package/dist/core/renderer.d.ts.map +1 -0
  30. package/dist/core/router.d.ts +108 -0
  31. package/dist/core/router.d.ts.map +1 -0
  32. package/dist/core/server-renderer.d.ts +26 -0
  33. package/dist/core/server-renderer.d.ts.map +1 -0
  34. package/dist/core/store.d.ts +102 -0
  35. package/dist/core/store.d.ts.map +1 -0
  36. package/dist/core/types.d.ts +66 -0
  37. package/dist/core/types.d.ts.map +1 -0
  38. package/dist/core/utils.d.ts +153 -0
  39. package/dist/core/utils.d.ts.map +1 -0
  40. package/dist/core/vdom.d.ts +29 -0
  41. package/dist/core/vdom.d.ts.map +1 -0
  42. package/dist/index.d.ts +39 -35
  43. package/dist/index.d.ts.map +1 -1
  44. package/dist/index.js +2592 -508
  45. package/dist/index.js.map +4 -4
  46. package/dist/server/auth.d.ts +8 -3
  47. package/dist/server/auth.d.ts.map +1 -1
  48. package/dist/server/index.d.ts +2 -2
  49. package/dist/server/index.d.ts.map +1 -1
  50. package/dist/server/index.js +173 -112
  51. package/dist/server/index.js.map +4 -4
  52. package/dist/server/middleware.d.ts +10 -1
  53. package/dist/server/middleware.d.ts.map +1 -1
  54. package/package.json +224 -124
  55. package/templates/basic-app/src/main.jsx +336 -0
  56. package/templates/complete-app/api/hello.js +0 -0
  57. package/templates/complete-app/client.js +58 -0
  58. package/templates/complete-app/lib/frontend-hamroun.js +182 -0
  59. package/templates/complete-app/package.json +18 -0
  60. package/templates/complete-app/pages/about.js +119 -0
  61. package/templates/complete-app/pages/about.jsx +0 -0
  62. package/templates/complete-app/pages/index.js +157 -0
  63. package/templates/complete-app/pages/index.jsx +0 -0
  64. package/templates/complete-app/pages/wasm-demo.js +290 -0
  65. package/templates/complete-app/pages/wasm-demo.jsx +0 -0
  66. package/templates/complete-app/public/client.js +89 -0
  67. package/templates/complete-app/public/index.html +118 -0
  68. package/templates/complete-app/public/styles.css +76 -0
  69. package/templates/complete-app/readme.md +188 -0
  70. package/templates/complete-app/server.js +226 -0
  71. package/templates/complete-app/server.ts +275 -0
  72. package/templates/complete-app/src/App.tsx +59 -0
  73. package/templates/complete-app/src/client.ts +61 -0
  74. package/templates/complete-app/src/client.tsx +18 -0
  75. package/templates/complete-app/src/pages/index.tsx +51 -0
  76. package/templates/complete-app/src/server.ts +218 -0
  77. package/templates/complete-app/tsconfig.json +22 -0
  78. package/templates/complete-app/tsconfig.server.json +19 -0
  79. package/templates/complete-app/vite.config.js +57 -0
  80. package/templates/complete-app/vite.config.ts +30 -0
  81. package/templates/complete-app/wasm/build.bat +0 -0
  82. package/templates/complete-app/wasm/build.sh +0 -0
  83. package/templates/complete-app/wasm/example.go +0 -0
  84. package/templates/fullstack-app/README.md +37 -0
  85. package/templates/fullstack-app/api/hello.js +11 -0
  86. package/templates/fullstack-app/api/hello.ts +18 -0
  87. package/templates/fullstack-app/api/users/[id].ts +73 -0
  88. package/templates/fullstack-app/api/users/index.ts +32 -0
  89. package/templates/fullstack-app/build/main.css +874 -0
  90. package/templates/fullstack-app/build/main.css.map +7 -0
  91. package/templates/fullstack-app/build/main.js +967 -0
  92. package/templates/fullstack-app/build/main.js.map +7 -0
  93. package/templates/fullstack-app/build.ts +210 -0
  94. package/templates/fullstack-app/index.html +36 -0
  95. package/templates/fullstack-app/package.json +35 -0
  96. package/templates/fullstack-app/postcss.config.js +6 -0
  97. package/templates/fullstack-app/process-tailwind.js +45 -0
  98. package/templates/fullstack-app/public/_redirects +1 -0
  99. package/templates/fullstack-app/public/route-handler.js +47 -0
  100. package/templates/fullstack-app/public/spa-fix.html +17 -0
  101. package/templates/fullstack-app/public/styles.css +975 -0
  102. package/templates/fullstack-app/public/tailwind.css +15 -0
  103. package/templates/fullstack-app/server.js +267 -0
  104. package/templates/fullstack-app/server.ts +474 -0
  105. package/templates/fullstack-app/src/README.md +55 -0
  106. package/templates/fullstack-app/src/client.js +87 -0
  107. package/templates/fullstack-app/src/components/ClientHome.tsx +0 -0
  108. package/templates/fullstack-app/src/components/ErrorBoundary.tsx +36 -0
  109. package/templates/fullstack-app/src/components/Layout.tsx +42 -0
  110. package/templates/fullstack-app/src/components/StateDemo.tsx +207 -0
  111. package/templates/fullstack-app/src/components/UserList.tsx +44 -0
  112. package/templates/fullstack-app/src/config.ts +42 -0
  113. package/templates/fullstack-app/src/data/api.ts +206 -0
  114. package/templates/fullstack-app/src/main.tsx +155 -0
  115. package/templates/fullstack-app/src/middleware.ts +28 -0
  116. package/templates/fullstack-app/src/pages/404.tsx +28 -0
  117. package/templates/fullstack-app/src/pages/[id].tsx +0 -0
  118. package/templates/fullstack-app/src/pages/_app.tsx +11 -0
  119. package/templates/fullstack-app/src/pages/_document.tsx +25 -0
  120. package/templates/fullstack-app/src/pages/_error.tsx +45 -0
  121. package/templates/fullstack-app/src/pages/about/index.tsx +67 -0
  122. package/templates/fullstack-app/src/pages/about.tsx +71 -0
  123. package/templates/fullstack-app/src/pages/api/users/[id].ts +73 -0
  124. package/templates/fullstack-app/src/pages/api/users/index.ts +43 -0
  125. package/templates/fullstack-app/src/pages/index.tsx +110 -0
  126. package/templates/fullstack-app/src/pages/users/[id].tsx +153 -0
  127. package/templates/fullstack-app/src/pages/users.tsx +60 -0
  128. package/templates/fullstack-app/src/pages/wasm-demo.tsx +1 -0
  129. package/templates/fullstack-app/src/router.ts +255 -0
  130. package/templates/fullstack-app/src/styles.css +5 -0
  131. package/templates/fullstack-app/tailwind.config.js +11 -0
  132. package/templates/fullstack-app/tsconfig.json +18 -0
  133. package/templates/fullstack-app/vite.config.js +87 -0
  134. package/templates/go/build.bat +36 -0
  135. package/templates/go/build.sh +43 -0
  136. package/templates/go/example.go +205 -0
  137. package/templates/go-wasm-app/README.md +38 -0
  138. package/templates/go-wasm-app/babel.config.js +21 -0
  139. package/templates/go-wasm-app/build-client.js +49 -0
  140. package/templates/go-wasm-app/build-wasm.js +237 -0
  141. package/templates/go-wasm-app/build.config.js +62 -0
  142. package/templates/go-wasm-app/build.js +218 -0
  143. package/templates/go-wasm-app/package.json +32 -0
  144. package/templates/go-wasm-app/public/index.html +128 -0
  145. package/templates/go-wasm-app/public/styles.css +197 -0
  146. package/templates/go-wasm-app/public/wasm/example.wasm +0 -0
  147. package/templates/go-wasm-app/public/wasm/wasm_exec.js +561 -0
  148. package/templates/go-wasm-app/public/wasm/wasm_exec_node.js +39 -0
  149. package/templates/go-wasm-app/server.js +70 -0
  150. package/templates/go-wasm-app/src/App.jsx +38 -0
  151. package/templates/go-wasm-app/src/app.js +173 -0
  152. package/templates/go-wasm-app/src/client.js +57 -0
  153. package/templates/go-wasm-app/src/components/Footer.jsx +13 -0
  154. package/templates/go-wasm-app/src/components/Header.jsx +19 -0
  155. package/templates/go-wasm-app/src/components/WasmDemo.jsx +120 -0
  156. package/templates/go-wasm-app/src/main.jsx +12 -0
  157. package/templates/go-wasm-app/src/wasm/example.go +75 -0
  158. package/templates/go-wasm-app/tsconfig.server.json +18 -0
  159. package/templates/go-wasm-app/vite.config.js +45 -0
  160. package/dist/forms/index.d.ts +0 -2
  161. package/dist/forms/index.d.ts.map +0 -1
  162. package/dist/forms/types.d.ts +0 -2
  163. package/dist/forms/types.d.ts.map +0 -1
  164. package/dist/frontend/components/WasmLoader.d.ts +0 -2
  165. package/dist/frontend/components/WasmLoader.d.ts.map +0 -1
  166. package/dist/frontend/hooks/useWasm.d.ts +0 -2
  167. package/dist/frontend/hooks/useWasm.d.ts.map +0 -1
  168. package/dist/frontend/index.d.ts +0 -2
  169. package/dist/frontend/index.d.ts.map +0 -1
  170. package/dist/router/index.d.ts +0 -2
  171. package/dist/router/index.d.ts.map +0 -1
  172. package/dist/router/types.d.ts +0 -2
  173. package/dist/router/types.d.ts.map +0 -1
  174. package/dist/store/index.d.ts +0 -2
  175. package/dist/store/index.d.ts.map +0 -1
  176. package/dist/store/types.d.ts +0 -2
  177. package/dist/store/types.d.ts.map +0 -1
  178. package/templates/basic-app/package-lock.json +0 -7173
  179. package/templates/fullstack-template/package-lock.json +0 -3558
  180. package/templates/ssr-template/package-lock.json +0 -5380
  181. package/templates/wasm/package-lock.json +0 -5347
  182. package/templates/wasm/public/example.wasm +0 -0
@@ -0,0 +1,108 @@
1
+ /**
2
+ * Client-side Router for Single Page Applications
3
+ */
4
+ import { VNode } from './types.js';
5
+ export interface Route {
6
+ path: string;
7
+ component: (props: any) => VNode | null;
8
+ exact?: boolean;
9
+ children?: Route[];
10
+ }
11
+ export interface RouterState {
12
+ pathname: string;
13
+ search: string;
14
+ hash: string;
15
+ params: Record<string, string>;
16
+ query: Record<string, string>;
17
+ }
18
+ export interface RouterContextValue extends RouterState {
19
+ navigate: (to: string, options?: NavigateOptions) => void;
20
+ back: () => void;
21
+ forward: () => void;
22
+ match: (pattern: string) => boolean;
23
+ }
24
+ export interface NavigateOptions {
25
+ replace?: boolean;
26
+ state?: any;
27
+ }
28
+ export declare const RouterContext: import("./context.js").Context<RouterContextValue>;
29
+ /**
30
+ * Router Provider component
31
+ */
32
+ export declare function RouterProvider({ children }: {
33
+ children: any;
34
+ }): VNode;
35
+ /**
36
+ * Router component - renders matching routes
37
+ */
38
+ export declare function Router({ routes }: {
39
+ routes: Route[];
40
+ }): VNode | null;
41
+ /**
42
+ * Route component - conditionally renders based on path match
43
+ */
44
+ export declare function Route({ path, component: Component, exact }: {
45
+ path: string;
46
+ component: (props: any) => VNode | null;
47
+ exact?: boolean;
48
+ }): VNode | null;
49
+ /**
50
+ * Switch component - renders first matching child route
51
+ */
52
+ export declare function Switch({ children }: {
53
+ children: any;
54
+ }): VNode | null;
55
+ /**
56
+ * Link component - navigation without page reload
57
+ */
58
+ export declare function Link({ to, children, replace, className, activeClassName, ...rest }: {
59
+ to: string;
60
+ children: any;
61
+ replace?: boolean;
62
+ className?: string;
63
+ activeClassName?: string;
64
+ [key: string]: any;
65
+ }): VNode;
66
+ /**
67
+ * Redirect component
68
+ */
69
+ export declare function Redirect({ to, replace }: {
70
+ to: string;
71
+ replace?: boolean;
72
+ }): null;
73
+ /**
74
+ * NavLink component — Link with automatic active class.
75
+ * Defaults to "active" class when the link matches the current path.
76
+ */
77
+ export declare function NavLink({ to, children, activeClassName, className, exact, ...rest }: {
78
+ to: string;
79
+ children: any;
80
+ activeClassName?: string;
81
+ className?: string;
82
+ exact?: boolean;
83
+ [key: string]: any;
84
+ }): VNode;
85
+ export declare function useRouter(): RouterContextValue;
86
+ export declare function useLocation(): RouterState;
87
+ export declare function useParams<T extends Record<string, string> = Record<string, string>>(): T;
88
+ export declare function useNavigate(): (to: string, options?: NavigateOptions) => void;
89
+ export declare function useSearchParams(): [URLSearchParams, (params: URLSearchParams) => void];
90
+ export declare function useMatch(pattern: string): Record<string, string> | null;
91
+ declare const _default: {
92
+ RouterProvider: typeof RouterProvider;
93
+ Router: typeof Router;
94
+ Route: typeof Route;
95
+ Switch: typeof Switch;
96
+ Link: typeof Link;
97
+ NavLink: typeof NavLink;
98
+ Redirect: typeof Redirect;
99
+ useRouter: typeof useRouter;
100
+ useLocation: typeof useLocation;
101
+ useParams: typeof useParams;
102
+ useNavigate: typeof useNavigate;
103
+ useSearchParams: typeof useSearchParams;
104
+ useMatch: typeof useMatch;
105
+ RouterContext: import("./context.js").Context<RouterContextValue>;
106
+ };
107
+ export default _default;
108
+ //# sourceMappingURL=router.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../src/core/router.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,MAAM,WAAW,KAAK;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,KAAK,GAAG,IAAI,CAAC;IACxC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,KAAK,EAAE,CAAC;CACpB;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC/B;AAED,MAAM,WAAW,kBAAmB,SAAQ,WAAW;IACrD,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,eAAe,KAAK,IAAI,CAAC;IAC1D,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,KAA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gB,QAAQ,CAAC,EACvB,EAAE,EACF,OAAc,EACf,EAAE;IACD,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,GAAG,IAAI,CAQP;AAED;;;GAGG;AACH,wBAAgB,OAAO,CAAC,EACtB,EAAE,EACF,QAAQ,EACR,eAA0B,EAC1B,SAAc,EACd,KAAa,EACb,GAAG,IAAI,EACR,EAAE;IACD,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,GAAG,CAAC;IACd,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB,GAAG,KAAK,CAsBR;AAGD,wBAAgB,SAAS,IAAI,kBAAkB,CAE9C;AAED,wBAAgB,WAAW,IAAI,WAAW,CAGzC;AAED,wBAAgB,SAAS,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,CAGxF;AAED,wBAAgB,WAAW,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,eAAe,KAAK,IAAI,CAG7E;AAED,wBAAgB,eAAe,IAAI,CAAC,eAAe,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,IAAI,CAAC,CAStF;AAED,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAIvE;;;;;;;;;;;;;;;;;AAED,wBAeE"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Server-side rendering - converts virtual DOM to HTML strings
3
+ */
4
+ import { VNode } from './types.js';
5
+ /**
6
+ * Renders a virtual DOM tree to an HTML string
7
+ */
8
+ export declare function renderToString(vnode: VNode | any): string;
9
+ /**
10
+ * Renders to string with data for hydration
11
+ */
12
+ export declare function renderToStringWithData(vnode: VNode | any): {
13
+ html: string;
14
+ data: any;
15
+ };
16
+ /**
17
+ * Stream rendering for large pages
18
+ */
19
+ export declare function renderToStream(vnode: VNode | any): AsyncGenerator<string>;
20
+ declare const _default: {
21
+ renderToString: typeof renderToString;
22
+ renderToStringWithData: typeof renderToStringWithData;
23
+ renderToStream: typeof renderToStream;
24
+ };
25
+ export default _default;
26
+ //# sourceMappingURL=server-renderer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server-renderer.d.ts","sourceRoot":"","sources":["../../src/core/server-renderer.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAWnC;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,KAAK,GAAG,GAAG,GAAG,MAAM,CAWzD;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,KAAK,GAAG,GAAG,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,GAAG,CAAA;CAAE,CAGtF;AAED;;GAEG;AACH,wBAAuB,cAAc,CAAC,KAAK,EAAE,KAAK,GAAG,GAAG,GAAG,cAAc,CAAC,MAAM,CAAC,CAEhF;;;;;;AAwID,wBAIE"}
@@ -0,0 +1,102 @@
1
+ /**
2
+ * Global State Management (Redux-like store)
3
+ */
4
+ import { VNode } from './types.js';
5
+ export interface Action<T = any> {
6
+ type: string;
7
+ payload?: T;
8
+ }
9
+ export type Reducer<S, A extends Action = Action> = (state: S, action: A) => S;
10
+ export type Dispatch<A extends Action = Action> = (action: A) => void;
11
+ export type Selector<S, R> = (state: S) => R;
12
+ export type Middleware<S> = (store: Store<S>) => (next: Dispatch) => (action: Action) => void;
13
+ export interface Store<S> {
14
+ getState: () => S;
15
+ dispatch: Dispatch;
16
+ subscribe: (listener: () => void) => () => void;
17
+ replaceReducer: (nextReducer: Reducer<S>) => void;
18
+ }
19
+ export type AsyncAction<S> = (dispatch: Dispatch, getState: () => S) => Promise<void> | void;
20
+ /**
21
+ * Create a Redux-like store
22
+ */
23
+ export declare function createStore<S>(reducer: Reducer<S>, initialState: S, middlewares?: Middleware<S>[]): Store<S>;
24
+ /**
25
+ * Combine multiple reducers into one
26
+ */
27
+ export declare function combineReducers<S extends Record<string, any>>(reducers: {
28
+ [K in keyof S]: Reducer<S[K]>;
29
+ }): Reducer<S>;
30
+ interface StoreContextValue<S = any> {
31
+ store: Store<S>;
32
+ state: S;
33
+ }
34
+ export declare const StoreContext: import("./context.js").Context<StoreContextValue<any>>;
35
+ /**
36
+ * Store Provider component
37
+ */
38
+ export declare function StoreProvider<S>({ store, children }: {
39
+ store: Store<S>;
40
+ children: any;
41
+ }): VNode;
42
+ /**
43
+ * Hook to select state from the store
44
+ */
45
+ export declare function useSelector<S, R>(selector: Selector<S, R>): R;
46
+ /**
47
+ * Hook to get the dispatch function
48
+ */
49
+ export declare function useDispatch<A extends Action = Action>(): Dispatch<A>;
50
+ /**
51
+ * Hook to get the entire store
52
+ */
53
+ export declare function useStore<S>(): Store<S>;
54
+ /**
55
+ * Logger middleware - logs actions and state changes
56
+ */
57
+ export declare const logger: Middleware<any>;
58
+ /**
59
+ * Thunk middleware - enables async actions
60
+ */
61
+ export declare const thunk: Middleware<any>;
62
+ /**
63
+ * DevTools middleware - integrates with Redux DevTools
64
+ */
65
+ export declare const devTools: Middleware<any>;
66
+ /**
67
+ * Create an action creator
68
+ */
69
+ export declare function createAction<P = void>(type: string): {
70
+ (payload: P): Action<P>;
71
+ type: string;
72
+ match(action: Action): action is Action<P>;
73
+ };
74
+ /**
75
+ * Create a slice (reducer + actions)
76
+ */
77
+ export interface SliceConfig<S, R extends Record<string, (state: S, action: Action<any>) => S>> {
78
+ name: string;
79
+ initialState: S;
80
+ reducers: R;
81
+ }
82
+ export declare function createSlice<S, R extends Record<string, (state: S, action: Action<any>) => S>>(config: SliceConfig<S, R>): {
83
+ name: string;
84
+ reducer: Reducer<S, Action<any>>;
85
+ actions: Record<string, (payload?: any) => Action>;
86
+ };
87
+ declare const _default: {
88
+ createStore: typeof createStore;
89
+ combineReducers: typeof combineReducers;
90
+ StoreProvider: typeof StoreProvider;
91
+ useSelector: typeof useSelector;
92
+ useDispatch: typeof useDispatch;
93
+ useStore: typeof useStore;
94
+ logger: Middleware<any>;
95
+ thunk: Middleware<any>;
96
+ devTools: Middleware<any>;
97
+ createAction: typeof createAction;
98
+ createSlice: typeof createSlice;
99
+ StoreContext: import("./context.js").Context<StoreContextValue<any>>;
100
+ };
101
+ export default _default;
102
+ //# sourceMappingURL=store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/core/store.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,MAAM,WAAW,MAAM,CAAC,CAAC,GAAG,GAAG;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,CAAC,CAAC;CACb;AAED,MAAM,MAAM,OAAO,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,GAAG,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC;AAE/E,MAAM,MAAM,QAAQ,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,IAAI,CAAC;AAEtE,MAAM,MAAM,QAAQ,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,CAAC;AAE7C,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,QAAQ,KAAK,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;AAE9F,MAAM,WAAW,KAAK,CAAC,CAAC;IAC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itions for the framework
3
+ */
4
+ export type { Context } from './context.js';
5
+ export interface VNode {
6
+ type: string | Function;
7
+ props: Record<string, any>;
8
+ key?: string | number;
9
+ }
10
+ export type Component<P = any> = (props: P) => VNode | null;
11
+ export type FC<P = {}> = Component<P>;
12
+ export interface RefObject<T> {
13
+ current: T;
14
+ }
15
+ export type SetStateAction<S> = S | ((prevState: S) => S);
16
+ export type Dispatch<A> = (value: A) => void;
17
+ export type Props = Record<string, any>;
18
+ export type PropsWithChildren<P = {}> = P & {
19
+ children?: any;
20
+ };
21
+ declare global {
22
+ namespace JSX {
23
+ interface Element {
24
+ type: string | Function;
25
+ props: Record<string, any>;
26
+ key?: string | number;
27
+ }
28
+ type IntrinsicElements = Record<string, any>;
29
+ interface ElementAttributesProperty {
30
+ props: {};
31
+ }
32
+ interface ElementChildrenAttribute {
33
+ children: {};
34
+ }
35
+ }
36
+ }
37
+ export interface ServerConfig {
38
+ port?: number;
39
+ apiDir?: string;
40
+ pagesDir?: string;
41
+ staticDir?: string;
42
+ enableCors?: boolean;
43
+ corsOptions?: any;
44
+ db?: DbConfig;
45
+ auth?: AuthConfig;
46
+ }
47
+ export interface DbConfig {
48
+ url: string;
49
+ type: 'mongodb' | 'mysql' | 'postgres';
50
+ }
51
+ export interface AuthConfig {
52
+ secret: string;
53
+ expiresIn?: string;
54
+ }
55
+ export interface User {
56
+ id: string | number;
57
+ username: string;
58
+ password?: string;
59
+ email?: string;
60
+ roles?: string[];
61
+ [key: string]: any;
62
+ }
63
+ export interface MiddlewareFunction {
64
+ (req: any, res: any, next: any): void | Promise<void>;
65
+ }
66
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,YAAY,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5C,MAAM,WAAW,KAAK;IACpB,IAAI,EAAE,MAAM,GAAG,QAAQ,CAAC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AAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,GAAG,CAAC;IAClB,EAAE,CAAC,EAAE,QAAQ,CAAC;IACd,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB;AAED,MAAM,WAAW,QAAQ;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,SAAS,GAAG,OAAO,GAAG,UAAU,CAAC;CACxC;AAED,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,IAAI;IACnB,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,MAAM,WAAW,kBAAkB;IACjC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACvD"}
@@ -0,0 +1,153 @@
1
+ /**
2
+ * Utility functions for the framework
3
+ */
4
+ /**
5
+ * Creates a debounced function that delays invoking func until after wait milliseconds
6
+ */
7
+ export declare function debounce<T extends (...args: any[]) => any>(func: T, wait: number, options?: {
8
+ leading?: boolean;
9
+ trailing?: boolean;
10
+ }): T & {
11
+ cancel: () => void;
12
+ flush: () => void;
13
+ };
14
+ /**
15
+ * Creates a throttled function that only invokes func at most once per every wait milliseconds
16
+ */
17
+ export declare function throttle<T extends (...args: any[]) => any>(func: T, wait: number, options?: {
18
+ leading?: boolean;
19
+ trailing?: boolean;
20
+ }): T & {
21
+ cancel: () => void;
22
+ };
23
+ /**
24
+ * Deep clone an object
25
+ */
26
+ export declare function deepClone<T>(obj: T): T;
27
+ /**
28
+ * Deep merge objects
29
+ */
30
+ export declare function deepMerge<T extends Record<string, any>>(target: T, ...sources: Partial<T>[]): T;
31
+ /**
32
+ * Memoize a function
33
+ */
34
+ export declare function memoize<T extends (...args: any[]) => any>(fn: T, options?: {
35
+ maxSize?: number;
36
+ keyGenerator?: (...args: Parameters<T>) => string;
37
+ }): T & {
38
+ cache: Map<string, ReturnType<T>>;
39
+ clear: () => void;
40
+ };
41
+ /**
42
+ * Generate a UUID v4
43
+ */
44
+ export declare function uuid(): string;
45
+ /**
46
+ * Format a date
47
+ */
48
+ export declare function formatDate(date: Date | string | number, format?: string): string;
49
+ /**
50
+ * Shallow equality check
51
+ */
52
+ export declare function shallowEqual(a: any, b: any): boolean;
53
+ /**
54
+ * Deep equality check
55
+ */
56
+ export declare function deepEqual(a: any, b: any): boolean;
57
+ /**
58
+ * Escape HTML entities
59
+ */
60
+ export declare function escapeHtml(str: string): string;
61
+ /**
62
+ * Unescape HTML entities
63
+ */
64
+ export declare function unescapeHtml(str: string): string;
65
+ /**
66
+ * Capitalize first letter
67
+ */
68
+ export declare function capitalize(str: string): string;
69
+ /**
70
+ * Convert string to camelCase
71
+ */
72
+ export declare function camelCase(str: string): string;
73
+ /**
74
+ * Convert string to kebab-case
75
+ */
76
+ export declare function kebabCase(str: string): string;
77
+ /**
78
+ * Sleep/delay utility
79
+ */
80
+ export declare function sleep(ms: number): Promise<void>;
81
+ /**
82
+ * Retry a function with exponential backoff
83
+ */
84
+ export declare function retry<T>(fn: () => Promise<T>, options?: {
85
+ retries?: number;
86
+ delay?: number;
87
+ backoff?: number;
88
+ onRetry?: (error: Error, attempt: number) => void;
89
+ }): Promise<T>;
90
+ /**
91
+ * Create a promise that can be resolved/rejected externally
92
+ */
93
+ export declare function deferred<T>(): {
94
+ promise: Promise<T>;
95
+ resolve: (value: T | PromiseLike<T>) => void;
96
+ reject: (reason?: any) => void;
97
+ };
98
+ /**
99
+ * Pick specific keys from an object
100
+ */
101
+ export declare function pick<T extends Record<string, any>, K extends keyof T>(obj: T, keys: K[]): Pick<T, K>;
102
+ /**
103
+ * Omit specific keys from an object
104
+ */
105
+ export declare function omit<T extends Record<string, any>, K extends keyof T>(obj: T, keys: K[]): Omit<T, K>;
106
+ /**
107
+ * Group array items by a key
108
+ */
109
+ export declare function groupBy<T>(array: T[], key: keyof T | ((item: T) => string)): Record<string, T[]>;
110
+ /**
111
+ * Check if value is empty
112
+ */
113
+ export declare function isEmpty(value: any): boolean;
114
+ /**
115
+ * Clamp a number between min and max
116
+ */
117
+ export declare function clamp(value: number, min: number, max: number): number;
118
+ /**
119
+ * Get a nested property from an object using a path
120
+ */
121
+ export declare function get(obj: any, path: string | string[], defaultValue?: any): any;
122
+ /**
123
+ * Set a nested property on an object using a path
124
+ */
125
+ export declare function set(obj: any, path: string | string[], value: any): any;
126
+ declare const _default: {
127
+ debounce: typeof debounce;
128
+ throttle: typeof throttle;
129
+ deepClone: typeof deepClone;
130
+ deepMerge: typeof deepMerge;
131
+ memoize: typeof memoize;
132
+ uuid: typeof uuid;
133
+ formatDate: typeof formatDate;
134
+ shallowEqual: typeof shallowEqual;
135
+ deepEqual: typeof deepEqual;
136
+ escapeHtml: typeof escapeHtml;
137
+ unescapeHtml: typeof unescapeHtml;
138
+ capitalize: typeof capitalize;
139
+ camelCase: typeof camelCase;
140
+ kebabCase: typeof kebabCase;
141
+ sleep: typeof sleep;
142
+ retry: typeof retry;
143
+ deferred: typeof deferred;
144
+ pick: typeof pick;
145
+ omit: typeof omit;
146
+ groupBy: typeof groupBy;
147
+ isEmpty: typeof isEmpty;
148
+ clamp: typeof clamp;
149
+ get: typeof get;
150
+ set: typeof set;
151
+ };
152
+ export default _default;
153
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0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M,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAErE;AAED;;GAEG;AACH,wBAAgB,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,YAAY,CAAC,EAAE,GAAG,GAAG,GAAG,CAY9E;AAED;;GAEG;AACH,wBAAgB,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,KAAK,EAAE,GAAG,GAAG,GAAG,CActE;;;;;;;;;;;;;;;;;;;;;;;;;;;AAED,wBAyBE"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Virtual DOM diffing and patching utilities
3
+ *
4
+ * Provides diff detection, patch calculation, and DOM patch application.
5
+ * Supports keyed children for efficient list reconciliation.
6
+ */
7
+ import { VNode } from './types.js';
8
+ export declare function diff(oldNode: VNode | any, newNode: VNode | any): boolean;
9
+ export declare function shouldComponentUpdate(oldProps: any, newProps: any): boolean;
10
+ export interface Patch {
11
+ type: 'CREATE' | 'REMOVE' | 'REPLACE' | 'UPDATE' | 'SET_PROP' | 'REMOVE_PROP';
12
+ node?: VNode | any;
13
+ props?: Record<string, any>;
14
+ children?: Patch[];
15
+ }
16
+ export declare function calculatePatches(oldNode: VNode | any, newNode: VNode | any): Patch | null;
17
+ /**
18
+ * Apply a patch to a DOM element. Returns the replacement element (or null
19
+ * if the element was removed).
20
+ */
21
+ export declare function applyPatches(element: Element, patch: Patch): Element | null;
22
+ declare const _default: {
23
+ diff: typeof diff;
24
+ shouldComponentUpdate: typeof shouldComponentUpdate;
25
+ calculatePatches: typeof calculatePatches;
26
+ applyPatches: typeof applyPatches;
27
+ };
28
+ export default _default;
29
+ //# sourceMappingURL=vdom.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vdom.d.ts","sourceRoot":"","sources":["../../src/core/vdom.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAoBnC,wBAAgB,IAAI,CAAC,OAAO,EAAE,KAAK,GAAG,GAAG,EAAE,OAAO,EAAE,KAAK,GAAG,GAAG,GAAG,OAAO,CAuBxE;AAED,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,GAAG,OAAO,CAE3E;AAMD,MAAM,WAAW,KAAK;IACpB,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,UAAU,GAAG,aAAa,CAAC;IAC9E,IAAI,CAAC,EAAE,KAAK,GAAG,GAAG,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC5B,QAAQ,CAAC,EAAE,KAAK,EAAE,CAAC;CACpB;AAMD,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,KAAK,GAAG,GAAG,EAAE,OAAO,EAAE,KAAK,GAAG,GAAG,GAAG,KAAK,GAAG,IAAI,CAwEzF;AAgDD;;;GAGG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,GAAG,OAAO,GAAG,IAAI,CAuE3E;;;;;;;AAED,wBAKE"}
package/dist/index.d.ts CHANGED
@@ -1,38 +1,42 @@
1
- export * from 'frontend-hamroun';
1
+ /**
2
+ * Baraqex — main entry point (universal)
3
+ *
4
+ * Re-exports everything from core (standalone, no external dependencies).
5
+ * Server modules are loaded lazily on first access — no race conditions.
6
+ */
7
+ export * from './core/index.js';
2
8
  export type { ServerConfig, User, DbConfig, MiddlewareFunction } from './server/types.js';
3
- export { loadGoWasm, callWasmFunction, isWasmReady, getWasmFunctions, useGoWasm } from './wasm.js';
4
9
  export type { GoWasmOptions, GoWasmInstance } from './server/types.js';
5
- declare let BaraqexServer: any;
6
- declare let createServer: any;
7
- declare let createDevServer: any;
8
- declare let createProductionServer: any;
9
- declare let renderComponent: any;
10
- declare let Database: any;
11
- declare let AuthService: any;
12
- declare let ApiRouter: any;
13
- declare let requestLogger: any;
14
- declare let errorHandler: any;
15
- declare let notFoundHandler: any;
16
- declare let rateLimit: any;
17
- declare let initNodeWasm: any;
18
- declare let loadGoWasmFromFile: any;
19
- declare let hashString: any;
20
- declare let getPagination: any;
21
- declare let sendSuccess: any;
22
- declare let sendError: any;
23
- declare let validateFields: any;
24
- declare let validateFileUpload: any;
25
- declare let getEnvironmentInfo: any;
26
- declare let isDirectoryEmpty: any;
27
- declare let ensureDirectory: any;
28
- declare let writeJsonFile: any;
29
- declare let readJsonFile: any;
30
- declare let baraqexRenderToString: any;
31
- declare let safeJsonParse: (json: string, fallback: any) => any;
32
- declare let generateToken: (length?: number) => string;
33
- declare let generateDocument: (content: string, options?: any) => string;
34
- declare let generateErrorPage: (code: number, message: string) => string;
35
- declare let generateLoadingPage: (message?: string) => string;
36
- declare let renderToString: (component: any) => string;
37
- export { BaraqexServer, createServer, createDevServer, createProductionServer, renderComponent, Database, AuthService, ApiRouter, requestLogger, errorHandler, notFoundHandler, rateLimit, initNodeWasm, loadGoWasmFromFile, safeJsonParse, generateToken, hashString, getPagination, sendSuccess, sendError, validateFields, validateFileUpload, getEnvironmentInfo, isDirectoryEmpty, ensureDirectory, writeJsonFile, readJsonFile, generateDocument, generateErrorPage, generateLoadingPage, baraqexRenderToString, renderToString };
10
+ export { loadGoWasm, callWasmFunction, isWasmReady, getWasmFunctions, useGoWasm } from './wasm.js';
11
+ export declare const safeJsonParse: (json: string, fallback: any) => any;
12
+ export declare const generateToken: (length?: number) => string;
13
+ export declare const generateDocument: (content: string, options?: any) => string;
14
+ export declare const generateErrorPage: (code: number, message: string) => string;
15
+ export declare const generateLoadingPage: (message?: string) => string;
16
+ export declare const fallbackRenderToString: (component: any) => string;
17
+ export declare const createServer: (...args: any[]) => any;
18
+ export declare const createDevServer: (...args: any[]) => any;
19
+ export declare const createProductionServer: (...args: any[]) => any;
20
+ export declare const BaraqexServer: typeof import("./server/index.js").Server;
21
+ export declare const Database: typeof import("./server/database.js").Database;
22
+ export declare const AuthService: typeof import("./server/auth.js").AuthService;
23
+ export declare const ApiRouter: typeof import("./server/api-router.js").ApiRouter;
24
+ export declare const requestLogger: (...args: any[]) => any;
25
+ export declare const errorHandler: (...args: any[]) => any;
26
+ export declare const notFoundHandler: (...args: any[]) => any;
27
+ export declare const rateLimit: (...args: any[]) => any;
28
+ export declare const initNodeWasm: (...args: any[]) => any;
29
+ export declare const loadGoWasmFromFile: (...args: any[]) => any;
30
+ export declare const hashString: (...args: any[]) => any;
31
+ export declare const getPagination: (...args: any[]) => any;
32
+ export declare const sendSuccess: (...args: any[]) => any;
33
+ export declare const sendError: (...args: any[]) => any;
34
+ export declare const validateFields: (...args: any[]) => any;
35
+ export declare const validateFileUpload: (...args: any[]) => any;
36
+ export declare const getEnvironmentInfo: (...args: any[]) => any;
37
+ export declare const isDirectoryEmpty: (...args: any[]) => any;
38
+ export declare const ensureDirectory: (...args: any[]) => any;
39
+ export declare const writeJsonFile: (...args: any[]) => any;
40
+ export declare const readJsonFile: (...args: any[]) => any;
41
+ export declare const renderComponent: (...args: any[]) => any;
38
42
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,kBAAkB,CAAC;AAGjC,YAAY,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAG1F,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,WAAW,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACnG,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAOvE,QAAA,IAAI,aAAa,EAAE,GAAU,CAAC;AAC9B,QAAA,IAAI,YAAY,EAAE,GAAU,CAAC;AAC7B,QAAA,IAAI,eAAe,EAAE,GAAU,CAAC;AAChC,Q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