frontend-hamroun 1.2.85 → 1.2.89

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 (96) hide show
  1. package/dist/batch.d.ts +4 -0
  2. package/dist/batch.d.ts.map +1 -0
  3. package/dist/batch.js +22 -0
  4. package/dist/client-router.d.ts +61 -0
  5. package/dist/client-router.d.ts.map +1 -0
  6. package/dist/client-router.js +209 -0
  7. package/dist/component.d.ts +15 -0
  8. package/dist/component.d.ts.map +1 -0
  9. package/dist/component.js +84 -0
  10. package/dist/components/Counter.d.ts +1 -0
  11. package/dist/components/Counter.d.ts.map +1 -0
  12. package/dist/components/Counter.js +2 -0
  13. package/dist/context.d.ts +5 -0
  14. package/dist/context.d.ts.map +1 -0
  15. package/dist/context.js +23 -0
  16. package/dist/event-bus.d.ts +24 -0
  17. package/dist/event-bus.d.ts.map +1 -0
  18. package/dist/event-bus.js +74 -0
  19. package/dist/forms.d.ts +41 -0
  20. package/dist/forms.d.ts.map +1 -0
  21. package/dist/forms.js +147 -0
  22. package/dist/hooks.d.ts +12 -0
  23. package/dist/hooks.d.ts.map +1 -0
  24. package/dist/hooks.js +142 -0
  25. package/dist/index.cjs +1231 -1
  26. package/dist/index.cjs.map +1 -1
  27. package/dist/index.client.d.ts +13 -0
  28. package/dist/index.client.d.ts.map +1 -0
  29. package/dist/index.client.js +12 -25
  30. package/dist/index.d.ts +68 -0
  31. package/dist/index.d.ts.map +1 -0
  32. package/dist/index.js +1153 -265
  33. package/dist/index.js.map +1 -1
  34. package/dist/jsx-dev-runtime.cjs +102 -0
  35. package/dist/jsx-dev-runtime.cjs.map +1 -0
  36. package/dist/jsx-dev-runtime.d.ts +3 -0
  37. package/dist/jsx-dev-runtime.d.ts.map +1 -0
  38. package/dist/jsx-dev-runtime.js +96 -0
  39. package/dist/jsx-dev-runtime.js.map +1 -0
  40. package/dist/jsx-runtime/jsx-runtime.d.ts +5 -0
  41. package/dist/jsx-runtime/jsx-runtime.d.ts.map +1 -0
  42. package/dist/jsx-runtime/jsx-runtime.js +40 -0
  43. package/dist/jsx-runtime.cjs +112 -1
  44. package/dist/jsx-runtime.cjs.map +1 -1
  45. package/dist/jsx-runtime.d.ts +18 -0
  46. package/dist/jsx-runtime.d.ts.map +1 -0
  47. package/dist/jsx-runtime.js +90 -79
  48. package/dist/jsx-runtime.js.map +1 -1
  49. package/dist/lifecycle-events.d.ts +109 -0
  50. package/dist/lifecycle-events.d.ts.map +1 -0
  51. package/dist/lifecycle-events.js +176 -0
  52. package/dist/renderComponent.d.ts +14 -0
  53. package/dist/renderComponent.d.ts.map +1 -0
  54. package/dist/renderComponent.js +29 -0
  55. package/dist/renderer.d.ts +4 -0
  56. package/dist/renderer.d.ts.map +1 -0
  57. package/dist/renderer.js +49 -0
  58. package/dist/router.d.ts +56 -0
  59. package/dist/router.d.ts.map +1 -0
  60. package/dist/router.js +165 -0
  61. package/dist/server-renderer.d.ts +2 -0
  62. package/dist/server-renderer.d.ts.map +1 -0
  63. package/dist/server-renderer.js +111 -5
  64. package/dist/server-types.d.ts +43 -0
  65. package/dist/server-types.d.ts.map +1 -0
  66. package/dist/server-types.js +5 -0
  67. package/dist/store.d.ts +42 -0
  68. package/dist/store.d.ts.map +1 -0
  69. package/dist/store.js +98 -0
  70. package/dist/types.d.ts +272 -0
  71. package/dist/types.d.ts.map +1 -0
  72. package/dist/types.js +2 -0
  73. package/dist/utils.d.ts +47 -0
  74. package/dist/utils.d.ts.map +1 -0
  75. package/dist/utils.js +143 -0
  76. package/dist/vdom.d.ts +9 -0
  77. package/dist/vdom.d.ts.map +1 -0
  78. package/dist/vdom.js +21 -0
  79. package/dist/wasm.d.ts +37 -0
  80. package/dist/wasm.d.ts.map +1 -0
  81. package/dist/wasm.js +158 -0
  82. package/package.json +54 -83
  83. package/dist/index.client.cjs +0 -2
  84. package/dist/index.client.cjs.map +0 -1
  85. package/dist/index.client.js.map +0 -1
  86. package/dist/renderer-DaVfBeVi.cjs +0 -2
  87. package/dist/renderer-DaVfBeVi.cjs.map +0 -1
  88. package/dist/renderer-nfT7XSpo.js +0 -61
  89. package/dist/renderer-nfT7XSpo.js.map +0 -1
  90. package/dist/server-renderer-B5b0Q0ck.cjs +0 -2
  91. package/dist/server-renderer-B5b0Q0ck.cjs.map +0 -1
  92. package/dist/server-renderer-C4MB-jAp.js +0 -248
  93. package/dist/server-renderer-C4MB-jAp.js.map +0 -1
  94. package/dist/server-renderer.cjs +0 -2
  95. package/dist/server-renderer.cjs.map +0 -1
  96. package/dist/server-renderer.js.map +0 -1
@@ -1,93 +1,104 @@
1
1
  function jsx(type, props) {
2
- console.log("JSX Transform:", { type, props });
3
- const processedProps = { ...props };
4
- if (arguments.length > 2) {
5
- processedProps.children = Array.prototype.slice.call(arguments, 2);
6
- }
7
- return { type, props: processedProps };
2
+ console.log('JSX Transform:', { type, props });
3
+ const processedProps = { ...props };
4
+ // Handle children properly
5
+ if (arguments.length > 2) {
6
+ processedProps.children = Array.prototype.slice.call(arguments, 2);
7
+ }
8
+ return { type, props: processedProps };
8
9
  }
9
10
  const Fragment = ({ children }) => children;
10
11
  async function createElement(vnode) {
11
- console.log("Creating element from:", vnode);
12
- if (vnode == null) {
13
- return document.createTextNode("");
14
- }
15
- if (typeof vnode === "boolean") {
16
- return document.createTextNode("");
17
- }
18
- if (typeof vnode === "number" || typeof vnode === "string") {
19
- return document.createTextNode(String(vnode));
20
- }
21
- if (Array.isArray(vnode)) {
22
- const fragment = document.createDocumentFragment();
23
- for (const child of vnode) {
24
- const node = await createElement(child);
25
- fragment.appendChild(node);
12
+ console.log('Creating element from:', vnode);
13
+ // Handle primitives and null
14
+ if (vnode == null) {
15
+ return document.createTextNode('');
16
+ }
17
+ if (typeof vnode === 'boolean') {
18
+ return document.createTextNode('');
19
+ }
20
+ if (typeof vnode === 'number' || typeof vnode === 'string') {
21
+ return document.createTextNode(String(vnode));
26
22
  }
27
- return fragment;
28
- }
29
- if ("type" in vnode && vnode.props !== void 0) {
30
- const { type, props } = vnode;
31
- if (typeof type === "function") {
32
- try {
33
- const result = await type(props || {});
34
- const node = await createElement(result);
35
- if (node instanceof Element) {
36
- node.setAttribute("data-component-id", type.name || type.toString());
23
+ // Handle arrays
24
+ if (Array.isArray(vnode)) {
25
+ const fragment = document.createDocumentFragment();
26
+ for (const child of vnode) {
27
+ const node = await createElement(child);
28
+ fragment.appendChild(node);
37
29
  }
38
- return node;
39
- } catch (error) {
40
- console.error("Error rendering component:", error);
41
- return document.createTextNode("");
42
- }
30
+ return fragment;
43
31
  }
44
- const element = document.createElement(type);
45
- for (const [key, value] of Object.entries(props || {})) {
46
- if (key === "children") continue;
47
- if (key.startsWith("on") && typeof value === "function") {
48
- const eventName = key.toLowerCase().slice(2);
49
- const existingHandler = element.__events?.[eventName];
50
- if (existingHandler) {
51
- element.removeEventListener(eventName, existingHandler);
32
+ // Handle VNode
33
+ if ('type' in vnode && vnode.props !== undefined) {
34
+ const { type, props } = vnode;
35
+ // Handle function components
36
+ if (typeof type === 'function') {
37
+ try {
38
+ const result = await type(props || {});
39
+ const node = await createElement(result);
40
+ if (node instanceof Element) {
41
+ node.setAttribute('data-component-id', type.name || type.toString());
42
+ }
43
+ return node;
44
+ }
45
+ catch (error) {
46
+ console.error('Error rendering component:', error);
47
+ return document.createTextNode('');
48
+ }
52
49
  }
53
- element.addEventListener(eventName, value);
54
- if (!element.__events) {
55
- element.__events = {};
50
+ // Create DOM element
51
+ const element = document.createElement(type);
52
+ // Handle props
53
+ for (const [key, value] of Object.entries(props || {})) {
54
+ if (key === 'children')
55
+ continue;
56
+ if (key.startsWith('on') && typeof value === 'function') {
57
+ const eventName = key.toLowerCase().slice(2);
58
+ // Remove existing event listener if any
59
+ const existingHandler = element.__events?.[eventName];
60
+ if (existingHandler) {
61
+ element.removeEventListener(eventName, existingHandler);
62
+ }
63
+ // Add new event listener
64
+ element.addEventListener(eventName, value);
65
+ if (!element.__events) {
66
+ element.__events = {};
67
+ }
68
+ element.__events[eventName] = value;
69
+ }
70
+ else if (key === 'style' && typeof value === 'object') {
71
+ Object.assign(element.style, value);
72
+ }
73
+ else if (key === 'className') {
74
+ element.setAttribute('class', String(value));
75
+ }
76
+ else if (key !== 'key' && key !== 'ref') {
77
+ element.setAttribute(key, String(value));
78
+ }
56
79
  }
57
- element.__events[eventName] = value;
58
- } else if (key === "style" && typeof value === "object") {
59
- Object.assign(element.style, value);
60
- } else if (key === "className") {
61
- element.setAttribute("class", String(value));
62
- } else if (key !== "key" && key !== "ref") {
63
- element.setAttribute(key, String(value));
64
- }
65
- }
66
- const children = props?.children;
67
- if (children != null) {
68
- const childArray = Array.isArray(children) ? children.flat() : [children];
69
- for (const child of childArray) {
70
- const childNode = await createElement(child);
71
- element.appendChild(childNode);
72
- }
80
+ // Handle children
81
+ const children = props?.children;
82
+ if (children != null) {
83
+ const childArray = Array.isArray(children) ? children.flat() : [children];
84
+ for (const child of childArray) {
85
+ const childNode = await createElement(child);
86
+ element.appendChild(childNode);
87
+ }
88
+ }
89
+ return element;
73
90
  }
74
- return element;
75
- }
76
- return document.createTextNode(String(vnode));
91
+ // Handle other objects by converting to string
92
+ return document.createTextNode(String(vnode));
77
93
  }
94
+ // Named exports object
78
95
  const jsxRuntime = {
79
- jsx,
80
- jsxs: jsx,
81
- jsxDEV: jsx,
82
- Fragment,
83
- createElement
84
- };
85
- export {
86
- Fragment,
87
- createElement,
88
- jsxRuntime as default,
89
- jsx,
90
- jsx as jsxDEV,
91
- jsx as jsxs
96
+ jsx,
97
+ jsxs: jsx,
98
+ jsxDEV: jsx,
99
+ Fragment,
100
+ createElement
92
101
  };
102
+
103
+ export { Fragment, createElement, jsxRuntime as default, jsx, jsx as jsxDEV, jsx as jsxs };
93
104
  //# sourceMappingURL=jsx-runtime.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"jsx-runtime.js","sources":["../src/jsx-runtime.ts"],"sourcesContent":["import type { VNode, ComponentType, Key, ReactElement } from './types.js';\r\n\r\nfunction jsx(type: string | Function, props: any): VNode {\r\n console.log('JSX Transform:', { type, props });\r\n const processedProps = { ...props };\r\n \r\n // Handle children properly\r\n if (arguments.length > 2) {\r\n processedProps.children = Array.prototype.slice.call(arguments, 2);\r\n }\r\n \r\n return { type, props: processedProps };\r\n}\r\n\r\nconst Fragment = ({ children }: { children: any }) => children;\r\n\r\nasync function createElement(vnode: VNode | any): Promise<Node> {\r\n console.log('Creating element from:', vnode);\r\n\r\n // Handle primitives and null\r\n if (vnode == null) {\r\n return document.createTextNode('');\r\n }\r\n \r\n if (typeof vnode === 'boolean') {\r\n return document.createTextNode('');\r\n }\r\n\r\n if (typeof vnode === 'number' || typeof vnode === 'string') {\r\n return document.createTextNode(String(vnode));\r\n }\r\n\r\n // Handle arrays\r\n if (Array.isArray(vnode)) {\r\n const fragment = document.createDocumentFragment();\r\n for (const child of vnode) {\r\n const node = await createElement(child);\r\n fragment.appendChild(node);\r\n }\r\n return fragment;\r\n }\r\n\r\n // Handle VNode\r\n if ('type' in vnode && vnode.props !== undefined) {\r\n const { type, props } = vnode;\r\n \r\n // Handle function components\r\n if (typeof type === 'function') {\r\n try {\r\n const result = await type(props || {});\r\n const node = await createElement(result);\r\n if (node instanceof Element) {\r\n node.setAttribute('data-component-id', type.name || type.toString());\r\n }\r\n return node;\r\n } catch (error) {\r\n console.error('Error rendering component:', error);\r\n return document.createTextNode('');\r\n }\r\n }\r\n\r\n // Create DOM element\r\n const element = document.createElement(type as string);\r\n \r\n // Handle props\r\n for (const [key, value] of Object.entries(props || {})) {\r\n if (key === 'children') continue;\r\n if (key.startsWith('on') && typeof value === 'function') {\r\n const eventName = key.toLowerCase().slice(2);\r\n // Remove existing event listener if any\r\n const existingHandler = (element as any).__events?.[eventName];\r\n if (existingHandler) {\r\n element.removeEventListener(eventName, existingHandler);\r\n }\r\n \r\n // Add new event listener\r\n element.addEventListener(eventName, value as EventListener);\r\n if (!(element as any).__events) {\r\n (element as any).__events = {};\r\n }\r\n (element as any).__events[eventName] = value;\r\n } else if (key === 'style' && typeof value === 'object') {\r\n Object.assign(element.style, value);\r\n } else if (key === 'className') {\r\n element.setAttribute('class', String(value));\r\n } else if (key !== 'key' && key !== 'ref') {\r\n element.setAttribute(key, String(value));\r\n }\r\n }\r\n\r\n // Handle children\r\n const children = props?.children;\r\n if (children != null) {\r\n const childArray = Array.isArray(children) ? children.flat() : [children];\r\n for (const child of childArray) {\r\n const childNode = await createElement(child);\r\n element.appendChild(childNode);\r\n }\r\n }\r\n\r\n return element;\r\n }\r\n\r\n // Handle other objects by converting to string\r\n return document.createTextNode(String(vnode));\r\n}\r\n\r\n// Export named functions and aliases\r\nexport {\r\n jsx,\r\n jsx as jsxs,\r\n jsx as jsxDEV,\r\n Fragment,\r\n createElement\r\n};\r\n\r\n// Named exports object\r\nconst jsxRuntime = {\r\n jsx,\r\n jsxs: jsx,\r\n jsxDEV: jsx,\r\n Fragment,\r\n createElement\r\n};\r\n\r\nexport default jsxRuntime;\r\n"],"names":[],"mappings":"AAEA,SAAS,IAAI,MAAyB,OAAmB;AACvD,UAAQ,IAAI,kBAAkB,EAAE,MAAM,OAAO;AACvC,QAAA,iBAAiB,EAAE,GAAG,MAAM;AAG9B,MAAA,UAAU,SAAS,GAAG;AACxB,mBAAe,WAAW,MAAM,UAAU,MAAM,KAAK,WAAW,CAAC;AAAA,EAAA;AAG5D,SAAA,EAAE,MAAM,OAAO,eAAe;AACvC;AAEA,MAAM,WAAW,CAAC,EAAE,eAAkC;AAEtD,eAAe,cAAc,OAAmC;AACtD,UAAA,IAAI,0BAA0B,KAAK;AAG3C,MAAI,SAAS,MAAM;AACV,WAAA,SAAS,eAAe,EAAE;AAAA,EAAA;AAG/B,MAAA,OAAO,UAAU,WAAW;AACvB,WAAA,SAAS,eAAe,EAAE;AAAA,EAAA;AAGnC,MAAI,OAAO,UAAU,YAAY,OAAO,UAAU,UAAU;AAC1D,WAAO,SAAS,eAAe,OAAO,KAAK,CAAC;AAAA,EAAA;AAI1C,MAAA,MAAM,QAAQ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C;AAAA,MAClC,WAAA,QAAQ,SAAS,QAAQ,OAAO;AACzC,gBAAQ,aAAa,KAAK,OAAO,KAAK,CAAC;AAAA,MAAA;AAAA,IACzC;AAIF,UAAM,WAAW,OAAO;AACxB,QAAI,YAAY,MAAM;AACd,YAAA,aAAa,MAAM,QAAQ,QAAQ,IAAI,SAAS,SAAS,CAAC,QAAQ;AACxE,iBAAW,SAAS,YAAY;AACxB,cAAA,YAAY,MAAM,cAAc,KAAK;AAC3C,gBAAQ,YAAY,SAAS;AAAA,MAAA;AAAA,IAC/B;AAGK,WAAA;AAAA,EAAA;AAIT,SAAO,SAAS,eAAe,OAAO,KAAK,CAAC;AAC9C;AAYA,MAAM,aAAa;AAAA,EACjB;AAAA,EACA,MAAM;AAAA,EACN,QAAQ;AAAA,EACR;AAAA,EACA;AACF;"}
1
+ {"version":3,"file":"jsx-runtime.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,109 @@
1
+ export declare enum LifecycleEvents {
2
+ APP_INIT = "app:init",
3
+ APP_MOUNTED = "app:mounted",
4
+ APP_UPDATED = "app:updated",
5
+ APP_ERROR = "app:error",
6
+ APP_DESTROYED = "app:destroyed",
7
+ COMPONENT_CREATED = "component:created",
8
+ COMPONENT_MOUNTED = "component:mounted",
9
+ COMPONENT_UPDATED = "component:updated",
10
+ COMPONENT_ERROR = "component:error",
11
+ COMPONENT_UNMOUNTED = "component:unmounted",
12
+ ROUTER_BEFORE_CHANGE = "router:before-change",
13
+ ROUTER_AFTER_CHANGE = "router:after-change",
14
+ ROUTER_ERROR = "router:error",
15
+ STORE_INITIALIZED = "store:initialized",
16
+ STORE_BEFORE_ACTION = "store:before-action",
17
+ STORE_AFTER_ACTION = "store:after-action",
18
+ STORE_ERROR = "store:error"
19
+ }
20
+ export interface ComponentInfo {
21
+ id: string;
22
+ name: string;
23
+ props: Record<string, any>;
24
+ path?: string;
25
+ }
26
+ export interface RouteChangeInfo {
27
+ from: string;
28
+ to: string;
29
+ params: Record<string, string>;
30
+ }
31
+ export interface StoreActionInfo {
32
+ type: string;
33
+ payload: any;
34
+ prevState: any;
35
+ nextState: any;
36
+ }
37
+ export declare function emitAppInit(data: any): void;
38
+ export declare function emitAppMounted(rootElement: HTMLElement): void;
39
+ export declare function emitAppUpdated(): void;
40
+ export declare function emitAppError(error: Error): void;
41
+ export declare function emitAppDestroyed(): void;
42
+ export declare function emitComponentCreated(info: ComponentInfo): void;
43
+ export declare function emitComponentMounted(info: ComponentInfo, element: HTMLElement): void;
44
+ export declare function emitComponentUpdated(info: ComponentInfo, prevProps: Record<string, any>, newProps: Record<string, any>): void;
45
+ export declare function emitComponentError(info: ComponentInfo, error: Error): void;
46
+ export declare function emitComponentUnmounted(info: ComponentInfo): void;
47
+ export declare function emitRouterBeforeChange(info: RouteChangeInfo): Promise<boolean>;
48
+ export declare function emitRouterAfterChange(info: RouteChangeInfo): void;
49
+ export declare function emitRouterError(error: Error, info?: Partial<RouteChangeInfo>): void;
50
+ export declare function emitStoreInitialized(state: any): void;
51
+ export declare function emitStoreBeforeAction(actionType: string, payload: any, state: any): void;
52
+ export declare function emitStoreAfterAction(info: StoreActionInfo): void;
53
+ export declare function emitStoreError(error: Error, actionType: string, payload: any): void;
54
+ export declare function onAppInit(handler: (data: any) => void): () => void;
55
+ export declare function onAppMounted(handler: (rootElement: HTMLElement) => void): () => void;
56
+ export declare function onAppUpdated(handler: () => void): () => void;
57
+ export declare function onAppError(handler: (error: Error) => void): () => void;
58
+ export declare function onAppDestroyed(handler: () => void): () => void;
59
+ export declare function onComponentCreated(handler: (info: ComponentInfo) => void): () => void;
60
+ export declare function onComponentMounted(handler: (info: ComponentInfo, element: HTMLElement) => void): () => void;
61
+ export declare function onComponentUpdated(handler: (info: ComponentInfo, prevProps: Record<string, any>, newProps: Record<string, any>) => void): () => void;
62
+ export declare function onComponentError(handler: (info: ComponentInfo, error: Error) => void): () => void;
63
+ export declare function onComponentUnmounted(handler: (info: ComponentInfo) => void): () => void;
64
+ export declare function onRouterBeforeChange(handler: (info: RouteChangeInfo, prevent: () => void) => void): () => void;
65
+ export declare function onRouterAfterChange(handler: (info: RouteChangeInfo) => void): () => void;
66
+ export declare function onRouterError(handler: (error: Error, info?: Partial<RouteChangeInfo>) => void): () => void;
67
+ export declare function onStoreInitialized(handler: (state: any) => void): () => void;
68
+ export declare function onStoreBeforeAction(handler: (actionType: string, payload: any, state: any) => void): () => void;
69
+ export declare function onStoreAfterAction(handler: (info: StoreActionInfo) => void): () => void;
70
+ export declare function onStoreError(handler: (error: Error, actionType: string, payload: any) => void): () => void;
71
+ declare const _default: {
72
+ LifecycleEvents: typeof LifecycleEvents;
73
+ emitAppInit: typeof emitAppInit;
74
+ emitAppMounted: typeof emitAppMounted;
75
+ emitAppUpdated: typeof emitAppUpdated;
76
+ emitAppError: typeof emitAppError;
77
+ emitAppDestroyed: typeof emitAppDestroyed;
78
+ emitComponentCreated: typeof emitComponentCreated;
79
+ emitComponentMounted: typeof emitComponentMounted;
80
+ emitComponentUpdated: typeof emitComponentUpdated;
81
+ emitComponentError: typeof emitComponentError;
82
+ emitComponentUnmounted: typeof emitComponentUnmounted;
83
+ emitRouterBeforeChange: typeof emitRouterBeforeChange;
84
+ emitRouterAfterChange: typeof emitRouterAfterChange;
85
+ emitRouterError: typeof emitRouterError;
86
+ emitStoreInitialized: typeof emitStoreInitialized;
87
+ emitStoreBeforeAction: typeof emitStoreBeforeAction;
88
+ emitStoreAfterAction: typeof emitStoreAfterAction;
89
+ emitStoreError: typeof emitStoreError;
90
+ onAppInit: typeof onAppInit;
91
+ onAppMounted: typeof onAppMounted;
92
+ onAppUpdated: typeof onAppUpdated;
93
+ onAppError: typeof onAppError;
94
+ onAppDestroyed: typeof onAppDestroyed;
95
+ onComponentCreated: typeof onComponentCreated;
96
+ onComponentMounted: typeof onComponentMounted;
97
+ onComponentUpdated: typeof onComponentUpdated;
98
+ onComponentError: typeof onComponentError;
99
+ onComponentUnmounted: typeof onComponentUnmounted;
100
+ onRouterBeforeChange: typeof onRouterBeforeChange;
101
+ onRouterAfterChange: typeof onRouterAfterChange;
102
+ onRouterError: typeof onRouterError;
103
+ onStoreInitialized: typeof onStoreInitialized;
104
+ onStoreBeforeAction: typeof onStoreBeforeAction;
105
+ onStoreAfterAction: typeof onStoreAfterAction;
106
+ onStoreError: typeof onStoreError;
107
+ };
108
+ export default _default;
109
+ //# sourceMappingURL=lifecycle-events.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lifecycle-events.d.ts","sourceRoot":"","sources":["../src/lifecycle-events.ts"],"names":[],"mappings":"AAKA,oBAAY,eAAe;IACzB,QAAQ,aAAa;IACrB,WAAW,gBAAgB;IAC3B,WAAW,gBAAgB;IAC3B,SAAS,cAAc;IACvB,aAAa,kBAAkB;IAE/B,iBAAiB,sBAAsB;IACvC,iBAAiB,sBAAsB;IACvC,iBAAiB,sBAAsB;IACvC,eAAe,oBAAoB;IACnC,mBAAmB,wBAAwB;IAE3C,oBAAoB,yBAAyB;IAC7C,mBAAmB,wBAAwB;IAC3C,YAAY,iBAAiB;IAE7B,iBAAiB,sBAAsB;IACvC,mBAAmB,wBAAwB;IAC3C,kBAAkB,uBAAuB;IACzC,WAAW,gBAAgB;CAC5B;AAGD,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAGD,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAChC;AAG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OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,KAAK,IAAI,cAE7F;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,cAE/D;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,KAAK,IAAI,cAElG;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,eAAe,KAAK,IAAI,cAE1E;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,KAAK,IAAI,cAE7F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAED,wBAsCE"}
@@ -0,0 +1,176 @@
1
+ /**
2
+ * Lifecycle events for components and application
3
+ */
4
+ import { eventBus } from './event-bus.js';
5
+ export var LifecycleEvents;
6
+ (function (LifecycleEvents) {
7
+ LifecycleEvents["APP_INIT"] = "app:init";
8
+ LifecycleEvents["APP_MOUNTED"] = "app:mounted";
9
+ LifecycleEvents["APP_UPDATED"] = "app:updated";
10
+ LifecycleEvents["APP_ERROR"] = "app:error";
11
+ LifecycleEvents["APP_DESTROYED"] = "app:destroyed";
12
+ LifecycleEvents["COMPONENT_CREATED"] = "component:created";
13
+ LifecycleEvents["COMPONENT_MOUNTED"] = "component:mounted";
14
+ LifecycleEvents["COMPONENT_UPDATED"] = "component:updated";
15
+ LifecycleEvents["COMPONENT_ERROR"] = "component:error";
16
+ LifecycleEvents["COMPONENT_UNMOUNTED"] = "component:unmounted";
17
+ LifecycleEvents["ROUTER_BEFORE_CHANGE"] = "router:before-change";
18
+ LifecycleEvents["ROUTER_AFTER_CHANGE"] = "router:after-change";
19
+ LifecycleEvents["ROUTER_ERROR"] = "router:error";
20
+ LifecycleEvents["STORE_INITIALIZED"] = "store:initialized";
21
+ LifecycleEvents["STORE_BEFORE_ACTION"] = "store:before-action";
22
+ LifecycleEvents["STORE_AFTER_ACTION"] = "store:after-action";
23
+ LifecycleEvents["STORE_ERROR"] = "store:error";
24
+ })(LifecycleEvents || (LifecycleEvents = {}));
25
+ // Event emitters
26
+ export function emitAppInit(data) {
27
+ eventBus.emit(LifecycleEvents.APP_INIT, data);
28
+ }
29
+ export function emitAppMounted(rootElement) {
30
+ eventBus.emit(LifecycleEvents.APP_MOUNTED, rootElement);
31
+ }
32
+ export function emitAppUpdated() {
33
+ eventBus.emit(LifecycleEvents.APP_UPDATED);
34
+ }
35
+ export function emitAppError(error) {
36
+ eventBus.emit(LifecycleEvents.APP_ERROR, error);
37
+ }
38
+ export function emitAppDestroyed() {
39
+ eventBus.emit(LifecycleEvents.APP_DESTROYED);
40
+ }
41
+ export function emitComponentCreated(info) {
42
+ eventBus.emit(LifecycleEvents.COMPONENT_CREATED, info);
43
+ }
44
+ export function emitComponentMounted(info, element) {
45
+ eventBus.emit(LifecycleEvents.COMPONENT_MOUNTED, info, element);
46
+ }
47
+ export function emitComponentUpdated(info, prevProps, newProps) {
48
+ eventBus.emit(LifecycleEvents.COMPONENT_UPDATED, info, prevProps, newProps);
49
+ }
50
+ export function emitComponentError(info, error) {
51
+ eventBus.emit(LifecycleEvents.COMPONENT_ERROR, info, error);
52
+ }
53
+ export function emitComponentUnmounted(info) {
54
+ eventBus.emit(LifecycleEvents.COMPONENT_UNMOUNTED, info);
55
+ }
56
+ export function emitRouterBeforeChange(info) {
57
+ return new Promise(resolve => {
58
+ // Allow hooks to prevent navigation
59
+ let prevented = false;
60
+ const prevent = () => {
61
+ prevented = true;
62
+ };
63
+ eventBus.emit(LifecycleEvents.ROUTER_BEFORE_CHANGE, info, prevent);
64
+ // Resolve with whether navigation should continue
65
+ resolve(!prevented);
66
+ });
67
+ }
68
+ export function emitRouterAfterChange(info) {
69
+ eventBus.emit(LifecycleEvents.ROUTER_AFTER_CHANGE, info);
70
+ }
71
+ export function emitRouterError(error, info) {
72
+ eventBus.emit(LifecycleEvents.ROUTER_ERROR, error, info);
73
+ }
74
+ export function emitStoreInitialized(state) {
75
+ eventBus.emit(LifecycleEvents.STORE_INITIALIZED, state);
76
+ }
77
+ export function emitStoreBeforeAction(actionType, payload, state) {
78
+ eventBus.emit(LifecycleEvents.STORE_BEFORE_ACTION, actionType, payload, state);
79
+ }
80
+ export function emitStoreAfterAction(info) {
81
+ eventBus.emit(LifecycleEvents.STORE_AFTER_ACTION, info);
82
+ }
83
+ export function emitStoreError(error, actionType, payload) {
84
+ eventBus.emit(LifecycleEvents.STORE_ERROR, error, actionType, payload);
85
+ }
86
+ // Event listeners
87
+ export function onAppInit(handler) {
88
+ return eventBus.on(LifecycleEvents.APP_INIT, handler);
89
+ }
90
+ export function onAppMounted(handler) {
91
+ return eventBus.on(LifecycleEvents.APP_MOUNTED, handler);
92
+ }
93
+ export function onAppUpdated(handler) {
94
+ return eventBus.on(LifecycleEvents.APP_UPDATED, handler);
95
+ }
96
+ export function onAppError(handler) {
97
+ return eventBus.on(LifecycleEvents.APP_ERROR, handler);
98
+ }
99
+ export function onAppDestroyed(handler) {
100
+ return eventBus.on(LifecycleEvents.APP_DESTROYED, handler);
101
+ }
102
+ export function onComponentCreated(handler) {
103
+ return eventBus.on(LifecycleEvents.COMPONENT_CREATED, handler);
104
+ }
105
+ export function onComponentMounted(handler) {
106
+ return eventBus.on(LifecycleEvents.COMPONENT_MOUNTED, handler);
107
+ }
108
+ export function onComponentUpdated(handler) {
109
+ return eventBus.on(LifecycleEvents.COMPONENT_UPDATED, handler);
110
+ }
111
+ export function onComponentError(handler) {
112
+ return eventBus.on(LifecycleEvents.COMPONENT_ERROR, handler);
113
+ }
114
+ export function onComponentUnmounted(handler) {
115
+ return eventBus.on(LifecycleEvents.COMPONENT_UNMOUNTED, handler);
116
+ }
117
+ export function onRouterBeforeChange(handler) {
118
+ return eventBus.on(LifecycleEvents.ROUTER_BEFORE_CHANGE, handler);
119
+ }
120
+ export function onRouterAfterChange(handler) {
121
+ return eventBus.on(LifecycleEvents.ROUTER_AFTER_CHANGE, handler);
122
+ }
123
+ export function onRouterError(handler) {
124
+ return eventBus.on(LifecycleEvents.ROUTER_ERROR, handler);
125
+ }
126
+ export function onStoreInitialized(handler) {
127
+ return eventBus.on(LifecycleEvents.STORE_INITIALIZED, handler);
128
+ }
129
+ export function onStoreBeforeAction(handler) {
130
+ return eventBus.on(LifecycleEvents.STORE_BEFORE_ACTION, handler);
131
+ }
132
+ export function onStoreAfterAction(handler) {
133
+ return eventBus.on(LifecycleEvents.STORE_AFTER_ACTION, handler);
134
+ }
135
+ export function onStoreError(handler) {
136
+ return eventBus.on(LifecycleEvents.STORE_ERROR, handler);
137
+ }
138
+ export default {
139
+ LifecycleEvents,
140
+ // Emitters
141
+ emitAppInit,
142
+ emitAppMounted,
143
+ emitAppUpdated,
144
+ emitAppError,
145
+ emitAppDestroyed,
146
+ emitComponentCreated,
147
+ emitComponentMounted,
148
+ emitComponentUpdated,
149
+ emitComponentError,
150
+ emitComponentUnmounted,
151
+ emitRouterBeforeChange,
152
+ emitRouterAfterChange,
153
+ emitRouterError,
154
+ emitStoreInitialized,
155
+ emitStoreBeforeAction,
156
+ emitStoreAfterAction,
157
+ emitStoreError,
158
+ // Listeners
159
+ onAppInit,
160
+ onAppMounted,
161
+ onAppUpdated,
162
+ onAppError,
163
+ onAppDestroyed,
164
+ onComponentCreated,
165
+ onComponentMounted,
166
+ onComponentUpdated,
167
+ onComponentError,
168
+ onComponentUnmounted,
169
+ onRouterBeforeChange,
170
+ onRouterAfterChange,
171
+ onRouterError,
172
+ onStoreInitialized,
173
+ onStoreBeforeAction,
174
+ onStoreAfterAction,
175
+ onStoreError
176
+ };
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Result of component rendering
3
+ */
4
+ export interface RenderResult {
5
+ html: string;
6
+ success: boolean;
7
+ error?: Error;
8
+ }
9
+ /**
10
+ * Renders a component to an HTML string with error handling
11
+ */
12
+ export declare function renderComponent(Component: any, props?: any): Promise<RenderResult>;
13
+ export default renderComponent;
14
+ //# sourceMappingURL=renderComponent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderComponent.d.ts","sourceRoot":"","sources":["../src/renderComponent.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,KAAK,CAAC;CACf;AAED;;GAEG;AACH,wBAAsB,eAAe,CAAC,SAAS,EAAE,GAAG,EAAE,KAAK,GAAE,GAAQ,GAAG,OAAO,CAAC,YAAY,CAAC,CAqB5F;AAED,eAAe,eAAe,CAAC"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Utility for rendering components to strings and hydrating them
3
+ */
4
+ import { renderToString } from './server-renderer.js';
5
+ /**
6
+ * Renders a component to an HTML string with error handling
7
+ */
8
+ export async function renderComponent(Component, props = {}) {
9
+ try {
10
+ // Call the component function with props
11
+ const element = Component(props);
12
+ // Convert the element to an HTML string
13
+ const html = await renderToString(element);
14
+ return {
15
+ html,
16
+ success: true
17
+ };
18
+ }
19
+ catch (error) {
20
+ console.error('Error rendering component:', error);
21
+ return {
22
+ html: `<div class="error">Error rendering component</div>`,
23
+ success: false,
24
+ // Fix the type error by ensuring error is an Error object
25
+ error: error instanceof Error ? error : new Error(String(error))
26
+ };
27
+ }
28
+ }
29
+ export default renderComponent;
@@ -0,0 +1,4 @@
1
+ import type { ReactElement } from './types.js';
2
+ export declare function render(element: ReactElement, container: Element | DocumentFragment): Promise<void>;
3
+ export declare function hydrate(element: ReactElement, container: Element): Promise<void>;
4
+ //# sourceMappingURL=renderer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../src/renderer.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG/C,wBAAsB,MAAM,CAAC,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,OAAO,GAAG,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAiCxG;AAGD,wBAAsB,OAAO,CAAC,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CActF"}
@@ -0,0 +1,49 @@
1
+ import { createElement } from './jsx-runtime.js';
2
+ import { prepareRender, finishRender, setRenderCallback } from './hooks.js';
3
+ // Render function for client-side rendering
4
+ export async function render(element, container) {
5
+ try {
6
+ // Set up render callback for state updates
7
+ setRenderCallback(render, element, container);
8
+ // Prepare render context
9
+ const renderId = prepareRender(element);
10
+ // Create DOM nodes from virtual elements
11
+ const domNode = await createElement(element);
12
+ // Clear container and append new content
13
+ // Handle both Element and DocumentFragment cases
14
+ if (container instanceof Element) {
15
+ container.innerHTML = '';
16
+ }
17
+ else {
18
+ // For DocumentFragment, clear all children
19
+ while (container.firstChild) {
20
+ container.removeChild(container.firstChild);
21
+ }
22
+ }
23
+ container.appendChild(domNode);
24
+ // Finish render
25
+ finishRender();
26
+ console.log('Render completed successfully');
27
+ }
28
+ catch (error) {
29
+ console.error('Error during render:', error);
30
+ // Clean up render context on error
31
+ finishRender();
32
+ throw error;
33
+ }
34
+ }
35
+ // Hydrate function for client-side hydration of SSR content
36
+ export async function hydrate(element, container) {
37
+ try {
38
+ console.log('Starting hydration...');
39
+ // For now, hydrate works the same as render
40
+ // In a more advanced implementation, this would preserve existing DOM
41
+ // and only attach event listeners and initialize state
42
+ await render(element, container);
43
+ console.log('Hydration completed successfully');
44
+ }
45
+ catch (error) {
46
+ console.error('Error during hydration:', error);
47
+ throw error;
48
+ }
49
+ }
@@ -0,0 +1,56 @@
1
+ export interface Route {
2
+ path: string;
3
+ component: any;
4
+ exact?: boolean;
5
+ children?: Route[];
6
+ }
7
+ export interface RouterContextValue {
8
+ currentPath: string;
9
+ navigate: (path: string) => void;
10
+ params: Record<string, string>;
11
+ query: Record<string, string>;
12
+ }
13
+ export interface RouteParams {
14
+ [key: string]: string;
15
+ }
16
+ export declare const RouterContext: import("./types.js").Context<RouterContextValue>;
17
+ export declare function useRouter(): RouterContextValue;
18
+ export declare function useLocation(): {
19
+ pathname: string;
20
+ search: string;
21
+ hash: string;
22
+ state: {};
23
+ };
24
+ export declare function useParams<T extends RouteParams = RouteParams>(): T;
25
+ export declare function useNavigate(): (path: string) => void;
26
+ export declare function RouterProvider({ children }: {
27
+ children: any;
28
+ }): any;
29
+ export declare function Router({ routes }: {
30
+ routes: Route[];
31
+ }): any;
32
+ export declare function Link({ to, children, ...rest }: {
33
+ to: string;
34
+ children: any;
35
+ [key: string]: any;
36
+ }): any;
37
+ export declare function Route({ path, component }: {
38
+ path: string;
39
+ component: any;
40
+ }): null;
41
+ export declare function Switch({ children }: {
42
+ children: any;
43
+ }): any;
44
+ declare const _default: {
45
+ RouterProvider: typeof RouterProvider;
46
+ Router: typeof Router;
47
+ Link: typeof Link;
48
+ Route: typeof Route;
49
+ Switch: typeof Switch;
50
+ useRouter: typeof useRouter;
51
+ useParams: typeof useParams;
52
+ useNavigate: typeof useNavigate;
53
+ useLocation: typeof useLocation;
54
+ };
55
+ export default _default;
56
+ //# sourceMappingURL=router.d.ts.map