fynixui 1.0.10 → 1.0.12

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 (104) hide show
  1. package/dist/custom/DataTable.js +1 -0
  2. package/dist/custom/button.js +241 -1
  3. package/dist/custom/index.js +1 -1
  4. package/dist/error/errorOverlay.js +1 -1
  5. package/dist/hooks/nixFor.js +6 -4
  6. package/dist/package.json +34 -37
  7. package/dist/plugins/vite-plugin-res.js +26 -4
  8. package/dist/router/router.js +108 -217
  9. package/dist/runtime.js +1251 -1028
  10. package/{dist → dist-types}/context/context.d.ts +1 -2
  11. package/dist-types/custom/DataTable.d.ts +0 -0
  12. package/dist-types/custom/button.d.ts +35 -0
  13. package/dist-types/custom/index.d.ts +2 -0
  14. package/{dist → dist-types}/custom/path.d.ts +0 -1
  15. package/{dist → dist-types}/error/errorOverlay.d.ts +0 -1
  16. package/{dist → dist-types}/fynix/index.d.ts +0 -1
  17. package/{dist → dist-types}/hooks/nixAsync.d.ts +0 -1
  18. package/{dist → dist-types}/hooks/nixAsyncCache.d.ts +0 -1
  19. package/{dist → dist-types}/hooks/nixAsyncDebounce.d.ts +0 -1
  20. package/{dist → dist-types}/hooks/nixAsyncQuery.d.ts +0 -1
  21. package/{dist → dist-types}/hooks/nixCallback.d.ts +0 -1
  22. package/{dist → dist-types}/hooks/nixComputed.d.ts +0 -1
  23. package/{dist → dist-types}/hooks/nixDebounce.d.ts +0 -1
  24. package/{dist → dist-types}/hooks/nixEffect.d.ts +0 -1
  25. package/{dist → dist-types}/hooks/nixFor.d.ts +0 -1
  26. package/{dist → dist-types}/hooks/nixForm.d.ts +0 -1
  27. package/{dist → dist-types}/hooks/nixFormAsync.d.ts +0 -1
  28. package/{dist → dist-types}/hooks/nixInterval.d.ts +0 -1
  29. package/{dist → dist-types}/hooks/nixLazy.d.ts +0 -1
  30. package/{dist → dist-types}/hooks/nixLazyAsync.d.ts +0 -1
  31. package/{dist → dist-types}/hooks/nixLazyFormAsync.d.ts +0 -1
  32. package/{dist → dist-types}/hooks/nixLocalStorage.d.ts +0 -1
  33. package/{dist → dist-types}/hooks/nixMemo.d.ts +0 -1
  34. package/{dist → dist-types}/hooks/nixPrevious.d.ts +0 -1
  35. package/{dist → dist-types}/hooks/nixRef.d.ts +0 -1
  36. package/{dist → dist-types}/hooks/nixState.d.ts +0 -1
  37. package/{dist → dist-types}/hooks/nixStore.d.ts +0 -1
  38. package/{dist → dist-types}/plugins/vite-plugin-res.d.ts +0 -1
  39. package/{dist → dist-types}/router/router.d.ts +14 -11
  40. package/dist-types/runtime.d.ts +200 -0
  41. package/package.json +43 -41
  42. package/dist/context/context.d.ts.map +0 -1
  43. package/dist/context/context.js.map +0 -7
  44. package/dist/custom/button.d.ts +0 -2
  45. package/dist/custom/button.d.ts.map +0 -1
  46. package/dist/custom/button.js.map +0 -7
  47. package/dist/custom/index.d.ts +0 -3
  48. package/dist/custom/index.d.ts.map +0 -1
  49. package/dist/custom/index.js.map +0 -7
  50. package/dist/custom/path.d.ts.map +0 -1
  51. package/dist/custom/path.js.map +0 -7
  52. package/dist/error/errorOverlay.d.ts.map +0 -1
  53. package/dist/error/errorOverlay.js.map +0 -7
  54. package/dist/fynix/index.d.ts.map +0 -1
  55. package/dist/fynix/index.js.map +0 -7
  56. package/dist/hooks/nixAsync.d.ts.map +0 -1
  57. package/dist/hooks/nixAsync.js.map +0 -7
  58. package/dist/hooks/nixAsyncCache.d.ts.map +0 -1
  59. package/dist/hooks/nixAsyncCache.js.map +0 -7
  60. package/dist/hooks/nixAsyncDebounce.d.ts.map +0 -1
  61. package/dist/hooks/nixAsyncDebounce.js.map +0 -7
  62. package/dist/hooks/nixAsyncQuery.d.ts.map +0 -1
  63. package/dist/hooks/nixAsyncQuery.js.map +0 -7
  64. package/dist/hooks/nixCallback.d.ts.map +0 -1
  65. package/dist/hooks/nixCallback.js.map +0 -7
  66. package/dist/hooks/nixComputed.d.ts.map +0 -1
  67. package/dist/hooks/nixComputed.js.map +0 -7
  68. package/dist/hooks/nixDebounce.d.ts.map +0 -1
  69. package/dist/hooks/nixDebounce.js.map +0 -7
  70. package/dist/hooks/nixEffect.d.ts.map +0 -1
  71. package/dist/hooks/nixEffect.js.map +0 -7
  72. package/dist/hooks/nixFor.d.ts.map +0 -1
  73. package/dist/hooks/nixFor.js.map +0 -7
  74. package/dist/hooks/nixForm.d.ts.map +0 -1
  75. package/dist/hooks/nixForm.js.map +0 -7
  76. package/dist/hooks/nixFormAsync.d.ts.map +0 -1
  77. package/dist/hooks/nixFormAsync.js.map +0 -7
  78. package/dist/hooks/nixInterval.d.ts.map +0 -1
  79. package/dist/hooks/nixInterval.js.map +0 -7
  80. package/dist/hooks/nixLazy.d.ts.map +0 -1
  81. package/dist/hooks/nixLazy.js.map +0 -7
  82. package/dist/hooks/nixLazyAsync.d.ts.map +0 -1
  83. package/dist/hooks/nixLazyAsync.js.map +0 -7
  84. package/dist/hooks/nixLazyFormAsync.d.ts.map +0 -1
  85. package/dist/hooks/nixLazyFormAsync.js.map +0 -7
  86. package/dist/hooks/nixLocalStorage.d.ts.map +0 -1
  87. package/dist/hooks/nixLocalStorage.js.map +0 -7
  88. package/dist/hooks/nixMemo.d.ts.map +0 -1
  89. package/dist/hooks/nixMemo.js.map +0 -7
  90. package/dist/hooks/nixPrevious.d.ts.map +0 -1
  91. package/dist/hooks/nixPrevious.js.map +0 -7
  92. package/dist/hooks/nixRef.d.ts.map +0 -1
  93. package/dist/hooks/nixRef.js.map +0 -7
  94. package/dist/hooks/nixState.d.ts.map +0 -1
  95. package/dist/hooks/nixState.js.map +0 -7
  96. package/dist/hooks/nixStore.d.ts.map +0 -1
  97. package/dist/hooks/nixStore.js.map +0 -7
  98. package/dist/plugins/vite-plugin-res.d.ts.map +0 -1
  99. package/dist/plugins/vite-plugin-res.js.map +0 -7
  100. package/dist/router/router.d.ts.map +0 -1
  101. package/dist/router/router.js.map +0 -7
  102. package/dist/runtime.d.ts +0 -124
  103. package/dist/runtime.d.ts.map +0 -1
  104. package/dist/runtime.js.map +0 -7
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../router/router.ts"],
4
- "sourcesContent": ["/* MIT License\r\n\r\n* Copyright (c) 2026 Resty Gonzales\r\n\r\nPermission is hereby granted, free of charge, to any person obtaining a copy\r\nof this software and associated documentation files (the \"Software\"), to deal\r\nin the Software without restriction, including without limitation the rights\r\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\ncopies of the Software, and to permit persons to whom the Software is\r\nfurnished to do so, subject to the following conditions:\r\n\r\nThe above copyright notice and this permission notice shall be included in all\r\ncopies or substantial portions of the Software.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\n* SOFTWARE.\r\n */\r\n\r\n/**\r\n * Fynix File-Based Router - TypeScript Edition\r\n * All Security & Memory Leak Issues Fixed\r\n */\r\n\r\nimport { mount } from \"../runtime\";\r\n\r\n// ---------------------- Types ----------------------\r\n\r\n// Enhanced Route Configuration for Enterprise Scale\r\ninterface RouteConfig {\r\n component: () => Promise<any>;\r\n preload?: boolean;\r\n priority?: \"high\" | \"medium\" | \"low\";\r\n prefetch?: string[]; // Related routes to prefetch\r\n guard?: RouteGuard;\r\n meta?: RouteMeta | ((params: Record<string, string>) => RouteMeta);\r\n keepAlive?: boolean;\r\n layout?: ComponentFunction;\r\n}\r\n\r\ninterface RouteGuard {\r\n canActivate?: (\r\n route: string,\r\n params: Record<string, string>\r\n ) => boolean | Promise<boolean>;\r\n canDeactivate?: (route: string) => boolean | Promise<boolean>;\r\n redirect?: string;\r\n}\r\n\r\ninterface RouteMatch {\r\n component: RouteComponent;\r\n params: Record<string, string>;\r\n meta?: RouteMeta;\r\n}\r\n\r\ninterface NestedRoute {\r\n path: string;\r\n component: ComponentFunction;\r\n children?: NestedRoute[];\r\n layout?: ComponentFunction;\r\n keepAlive?: boolean;\r\n}\r\n\r\ninterface ComponentFunction {\r\n (props: any): any;\r\n}\r\n\r\ninterface RouteComponent {\r\n (props: any): any;\r\n props?: Record<string, any> | (() => Record<string, any>);\r\n meta?: RouteMeta | ((params: Record<string, string>) => RouteMeta);\r\n}\r\n\r\ninterface RouteMeta {\r\n title?: string;\r\n description?: string;\r\n keywords?: string;\r\n twitterCard?: string;\r\n ogTitle?: string;\r\n ogDescription?: string;\r\n ogImage?: string;\r\n}\r\n\r\ninterface DynamicRoute {\r\n pattern: string;\r\n regex: RegExp;\r\n component: RouteComponent;\r\n params: string[];\r\n}\r\n\r\ninterface EventListener {\r\n element: Element | Window | Document;\r\n event: string;\r\n handler: EventListenerOrEventListenerObject;\r\n}\r\n\r\ninterface HistoryState {\r\n __fynixCacheKey?: string;\r\n serializedProps?: Record<string, any>;\r\n}\r\n\r\ninterface FynixRouter {\r\n mountRouter(selector?: string): void;\r\n navigate(path: string, props?: Record<string, any>): void;\r\n replace(path: string, props?: Record<string, any>): void;\r\n back(): void;\r\n cleanup(): void;\r\n routes: Record<string, RouteComponent>;\r\n dynamicRoutes: DynamicRoute[];\r\n // Enterprise features\r\n preloadRoute?(path: string): Promise<void>;\r\n clearCache?(): void;\r\n enableNestedRouting?(routes: NestedRoute[]): void;\r\n}\r\n\r\ninterface WindowWithFynix extends Window {\r\n [key: string]: any;\r\n __fynixPropsCache?: Map<string, Record<string, any>>;\r\n __lastRouteProps?: Record<string, any>;\r\n __fynixLinkProps__?: Record<string, any>;\r\n}\r\n\r\ndeclare const window: WindowWithFynix;\r\n\r\n// ---------------------- Constants ----------------------\r\n\r\nconst MAX_CACHE_SIZE = 50;\r\nconst PROPS_NAMESPACE = \"__fynixLinkProps__\";\r\nconst MAX_LISTENERS = 100;\r\nconst ALLOWED_PROTOCOLS = [\"http:\", \"https:\", \"\"];\r\nconst RENDER_DEBOUNCE = 10; // ms\r\n\r\n// ---------------------- Singleton State ----------------------\r\n\r\nlet routerInstance: FynixRouter | null = null;\r\nlet isRouterInitialized = false;\r\n\r\n// ---------------------- Security Helpers ----------------------\r\n\r\n/**\r\n * Detect external URLs\r\n */\r\nfunction isExternal(url: string): boolean {\r\n return /^https?:\\/\\//.test(url);\r\n}\r\n\r\n/**\r\n * HTML escaping to prevent XSS - Enhanced version\r\n */\r\nfunction escapeHTML(str: unknown): string {\r\n if (typeof str !== \"string\") return \"\";\r\n\r\n return str\r\n .replace(/&/g, \"&amp;\")\r\n .replace(/</g, \"&lt;\")\r\n .replace(/>/g, \"&gt;\")\r\n .replace(/\"/g, \"&quot;\")\r\n .replace(/'/g, \"&#039;\")\r\n .replace(/`/g, \"&#96;\")\r\n .replace(/\\//g, \"&#x2F;\")\r\n .replace(/=/g, \"&#x3D;\")\r\n .replace(/\\(/g, \"&#x28;\")\r\n .replace(/\\)/g, \"&#x29;\")\r\n .replace(/\\{/g, \"&#x7B;\")\r\n .replace(/\\}/g, \"&#x7D;\")\r\n .replace(/\\[/g, \"&#x5B;\")\r\n .replace(/\\]/g, \"&#x5D;\");\r\n}\r\n\r\n/**\r\n * Sanitize content for safe DOM insertion\r\n */\r\nfunction sanitizeContent(content: string): string {\r\n // Remove potentially dangerous elements and attributes\r\n return content\r\n .replace(/<script[^>]*>.*?<\\/script>/gis, \"\")\r\n .replace(/<iframe[^>]*>.*?<\\/iframe>/gis, \"\")\r\n .replace(/<object[^>]*>.*?<\\/object>/gis, \"\")\r\n .replace(/<embed[^>]*>/gi, \"\")\r\n .replace(/<link[^>]*>/gi, \"\")\r\n .replace(/on\\w+\\s*=/gi, \"\")\r\n .replace(/javascript:/gi, \"\")\r\n .replace(/vbscript:/gi, \"\")\r\n .replace(/data:/gi, \"\")\r\n .replace(/expression\\s*\\(/gi, \"\");\r\n}\r\n\r\n/**\r\n * Validate and sanitize component props\r\n */\r\nfunction sanitizeProps(props: Record<string, any>): Record<string, any> {\r\n const sanitized: Record<string, any> = {};\r\n\r\n for (const [key, value] of Object.entries(props)) {\r\n // Skip dangerous keys\r\n if (\r\n typeof key !== \"string\" ||\r\n key.startsWith(\"__\") ||\r\n key.includes(\"javascript\") ||\r\n key.includes(\"on\")\r\n ) {\r\n continue;\r\n }\r\n\r\n // Sanitize string values\r\n if (typeof value === \"string\") {\r\n // First sanitize any HTML content, then escape remaining characters\r\n const cleanContent = sanitizeContent(value);\r\n sanitized[key] = escapeHTML(cleanContent);\r\n } else if (typeof value === \"object\" && value !== null) {\r\n // Recursively sanitize nested objects (with depth limit)\r\n if (Object.keys(value).length < 50) {\r\n // Prevent DoS\r\n sanitized[key] = sanitizeProps(value);\r\n }\r\n } else if (typeof value === \"number\" || typeof value === \"boolean\") {\r\n sanitized[key] = value;\r\n }\r\n // Skip functions and other potentially dangerous types\r\n }\r\n\r\n return sanitized;\r\n}\r\n\r\n/**\r\n * Validate URL to prevent open redirect - Enhanced security\r\n */\r\nfunction isValidURL(url: string): boolean {\r\n try {\r\n // Reject URLs with suspicious patterns\r\n const suspiciousPatterns = [\r\n /javascript:/i,\r\n /vbscript:/i,\r\n /data:/i,\r\n /mailto:/i,\r\n /tel:/i,\r\n /ftp:/i,\r\n /file:/i,\r\n /%2f%2f/i, // Double slash encoding\r\n /%5c%5c/i, // Double backslash encoding\r\n /\\\\\\\\/, // UNC paths\r\n /@/, // Potential credential injection\r\n ];\r\n\r\n if (suspiciousPatterns.some((pattern) => pattern.test(url))) {\r\n console.warn(\"[Router] Security: Suspicious URL pattern blocked\");\r\n return false;\r\n }\r\n\r\n const parsed = new URL(url, window.location.origin);\r\n\r\n // Strict origin validation\r\n if (parsed.origin !== window.location.origin) {\r\n console.warn(\"[Router] Security: Cross-origin navigation blocked\");\r\n return false;\r\n }\r\n\r\n // Protocol validation\r\n if (!ALLOWED_PROTOCOLS.includes(parsed.protocol)) {\r\n console.warn(\r\n \"[Router] Security: Dangerous protocol blocked:\",\r\n parsed.protocol\r\n );\r\n return false;\r\n }\r\n\r\n // Additional checks for encoded attacks\r\n const decodedPath = decodeURIComponent(parsed.pathname);\r\n if (decodedPath !== parsed.pathname && /[<>\"'`]/.test(decodedPath)) {\r\n console.warn(\"[Router] Security: Encoded XSS attempt blocked\");\r\n return false;\r\n }\r\n\r\n // Check for excessive length (DoS prevention)\r\n if (url.length > 2048) {\r\n console.warn(\"[Router] Security: Excessively long URL blocked\");\r\n return false;\r\n }\r\n\r\n return true;\r\n } catch (e) {\r\n console.warn(\"[Router] Security: Invalid URL blocked\");\r\n return false;\r\n }\r\n}\r\n\r\n/**\r\n * Sanitize path to prevent directory traversal\r\n */\r\nfunction sanitizePath(path: string): string {\r\n if (typeof path !== \"string\") return \"/\";\r\n\r\n // Decode URL encoding first to catch encoded traversal attempts\r\n try {\r\n path = decodeURIComponent(path);\r\n } catch (e) {\r\n console.warn(\"[Router] Invalid URL encoding in path\");\r\n return \"/\";\r\n }\r\n\r\n // Remove null bytes\r\n path = path.replace(/\\0/g, \"\");\r\n\r\n // Normalize slashes\r\n path = path.replace(/\\\\/g, \"/\");\r\n path = path.replace(/\\/+/g, \"/\");\r\n\r\n // Remove directory traversal attempts\r\n path = path\r\n .split(\"/\")\r\n .filter((part) => part !== \"..\" && part !== \".\")\r\n .join(\"/\");\r\n\r\n // Ensure leading slash\r\n if (!path.startsWith(\"/\")) {\r\n path = \"/\" + path;\r\n }\r\n\r\n // Remove trailing slash (except for root)\r\n if (path.length > 1 && path.endsWith(\"/\")) {\r\n path = path.slice(0, -1);\r\n }\r\n\r\n return path || \"/\";\r\n}\r\n\r\n// ---------------------- Module Loading ----------------------\r\n\r\n/**\r\n * Try multiple possible glob paths for file-based routing\r\n */\r\n/**\r\n * Try multiple possible glob paths for file-based routing\r\n */\r\nfunction tryGlobPaths(): Record<string, any> {\r\n try {\r\n // Always try absolute from src first (Vite project root)\r\n let modules = import.meta.glob(\"/src/**/*.{fnx,tsx,jsx,ts,js}\", {\r\n eager: true,\r\n });\r\n /* console.log(\"[Router] Glob attempt 1 (/src/**):\", Object.keys(modules)); */\r\n\r\n // Fallback: try relative patterns (for monorepo or unusual setups)\r\n if (Object.keys(modules).length === 0) {\r\n modules = import.meta.glob(\r\n [\"./**/*.fnx\", \"./**/*.tsx\", \"./**/*.jsx\", \"./**/*.ts\", \"./**/*.js\"],\r\n { eager: true }\r\n );\r\n /* console.log(\"[Router] Glob attempt 2 (./**):\", Object.keys(modules)); */\r\n }\r\n\r\n // Fallback: try from parent\r\n if (Object.keys(modules).length === 0) {\r\n modules = import.meta.glob(\r\n [\"../**/*.fnx\", \"../**/*.tsx\", \"../**/*.jsx\"],\r\n { eager: true }\r\n );\r\n /* console.log(\"[Router] Glob attempt 3 (../**):\", Object.keys(modules)); */\r\n }\r\n\r\n /* console.log(\"[Router] Final modules loaded:\", Object.keys(modules).length); */\r\n return modules || {};\r\n } catch (error) {\r\n console.error(\"[Router] Failed to load modules:\", error);\r\n return {};\r\n }\r\n}\r\n\r\n/**\r\n * Convert file path to route path\r\n */\r\nfunction filePathToRoute(filePath: string): string {\r\n let route = filePath\r\n .replace(/^.*\\/src/, \"\")\r\n .replace(/\\.(ts|tsx|js|jsx|fnx)$/, \"\")\r\n .replace(/\\/view$/, \"\")\r\n .replace(/\\/$/, \"\");\r\n\r\n if (!route) route = \"/\";\r\n\r\n // Convert [param] to :param for route matching\r\n route = route.replace(/\\[([^\\]]+)\\]/g, \":$1\");\r\n\r\n return route;\r\n}\r\n\r\n// ---------------------- Route Matching ----------------------\r\n\r\n/**\r\n * Match a dynamic route pattern\r\n */\r\nfunction matchDynamicRoute(\r\n path: string,\r\n dynamicRoutes: DynamicRoute[]\r\n): { component: RouteComponent; params: Record<string, string> } | null {\r\n for (const route of dynamicRoutes) {\r\n const match = path.match(route.regex);\r\n\r\n if (match) {\r\n const params: Record<string, string> = {};\r\n\r\n route.params.forEach((param, i) => {\r\n // Already decoded in sanitizePath, just escape\r\n const matchValue = match[i + 1];\r\n params[param] = escapeHTML(matchValue || \"\");\r\n });\r\n\r\n return { component: route.component, params };\r\n }\r\n }\r\n\r\n return null;\r\n}\r\n\r\n// ---------------------- Props Serialization ----------------------\r\n\r\n/**\r\n * Deserialize plain props\r\n */\r\nfunction deserializeProps(props: unknown): Record<string, any> {\r\n if (!props || typeof props !== \"object\") return {};\r\n\r\n const deserialized: Record<string, any> = {};\r\n\r\n for (const [key, value] of Object.entries(props)) {\r\n if (typeof key !== \"string\" || key.startsWith(\"__\")) {\r\n continue;\r\n }\r\n deserialized[key] = value;\r\n }\r\n\r\n return deserialized;\r\n}\r\n\r\n/**\r\n * Normalize path\r\n */\r\nfunction normalizePath(path: string): string {\r\n return sanitizePath(path);\r\n}\r\n\r\n// ---------------------- Cache Management ----------------------\r\n\r\n/**\r\n * Generate unique cache keys using crypto API when available\r\n */\r\nfunction generateCacheKey(): string {\r\n if (typeof crypto !== \"undefined\" && crypto.randomUUID) {\r\n return crypto.randomUUID();\r\n }\r\n\r\n // Fallback with better uniqueness\r\n return `${Date.now()}-${Math.random().toString(36).slice(2)}-${Math.random()\r\n .toString(36)\r\n .slice(2)}`;\r\n}\r\n\r\n/**\r\n * Add to cache with LRU eviction\r\n */\r\nfunction addToCache(\r\n cache: Map<string, Record<string, any>>,\r\n key: string,\r\n value: Record<string, any>\r\n): void {\r\n if (cache.size >= MAX_CACHE_SIZE) {\r\n const firstKey = cache.keys().next().value;\r\n if (typeof firstKey === \"string\") {\r\n const evicted = cache.get(firstKey);\r\n if (evicted && typeof evicted === \"object\") {\r\n Object.values(evicted).forEach((val) => {\r\n if (val && typeof val === \"object\" && \"cleanup\" in val) {\r\n try {\r\n (val as any).cleanup();\r\n } catch (e) {\r\n // Silent cleanup failure\r\n }\r\n }\r\n });\r\n }\r\n cache.delete(firstKey);\r\n }\r\n }\r\n\r\n cache.set(key, value);\r\n}\r\n\r\n// ---------------------- Meta Tag Management ----------------------\r\n\r\ninterface MetaDefinition {\r\n key: keyof RouteMeta;\r\n name?: string;\r\n property?: string;\r\n}\r\n\r\nconst MANAGED_META: MetaDefinition[] = [\r\n { key: \"description\", name: \"description\" },\r\n { key: \"keywords\", name: \"keywords\" },\r\n { key: \"twitterCard\", name: \"twitter:card\" },\r\n { key: \"ogTitle\", property: \"og:title\" },\r\n { key: \"ogDescription\", property: \"og:description\" },\r\n { key: \"ogImage\", property: \"og:image\" },\r\n];\r\n\r\n/**\r\n * Update document meta tags for SEO with enhanced XSS prevention\r\n */\r\nfunction updateMetaTags(meta: RouteMeta = {}): void {\r\n if (!meta || typeof meta !== \"object\") return;\r\n\r\n // Sanitize title with length limit\r\n if (meta.title && typeof meta.title === \"string\") {\r\n const sanitizedTitle = escapeHTML(meta.title).substring(0, 60); // SEO best practice\r\n document.title = sanitizedTitle;\r\n }\r\n\r\n MANAGED_META.forEach((def) => {\r\n const value = meta[def.key];\r\n\r\n const selector = def.name\r\n ? `meta[name=\"${CSS.escape(def.name)}\"]`\r\n : `meta[property=\"${CSS.escape(def.property || \"\")}\"]`;\r\n\r\n let el = document.querySelector(selector);\r\n\r\n if (value == null) {\r\n if (el) el.remove();\r\n return;\r\n }\r\n\r\n if (typeof value !== \"string\") return;\r\n\r\n // Additional validation for meta content - sanitize HTML first\r\n const cleanValue = sanitizeContent(value);\r\n const sanitizedValue = escapeHTML(cleanValue).substring(0, 300); // Reasonable length limit\r\n\r\n // Block suspicious content\r\n if (/javascript:|vbscript:|data:|<|>/i.test(sanitizedValue)) {\r\n console.warn(\r\n `[Router] Security: Blocked suspicious meta content for ${def.key}`\r\n );\r\n return;\r\n }\r\n\r\n if (!el) {\r\n el = document.createElement(\"meta\");\r\n if (def.name) el.setAttribute(\"name\", def.name);\r\n if (def.property) el.setAttribute(\"property\", def.property);\r\n document.head.appendChild(el);\r\n }\r\n\r\n el.setAttribute(\"content\", sanitizedValue);\r\n });\r\n}\r\n\r\n// ---------------------- Enterprise Router Classes ----------------------\r\n\r\n/**\r\n * Advanced route management with preloading and caching\r\n */\r\nclass EnterpriseRouter {\r\n private routeCache = new Map<string, any>();\r\n private preloadQueue = new Set<string>();\r\n private routeMatchCache = new Map<string, RouteMatch | null>();\r\n private routes: Record<string, RouteConfig> = {};\r\n\r\n setRoutes(routes: Record<string, RouteConfig>) {\r\n if (!routes || typeof routes !== \"object\") {\r\n console.warn(\"[EnterpriseRouter] Invalid routes configuration\");\r\n return;\r\n }\r\n this.routes = routes;\r\n }\r\n\r\n async preloadRoute(path: string): Promise<void> {\r\n if (this.routeCache.has(path)) return;\r\n\r\n const route = this.routes[path];\r\n if (route?.component) {\r\n // Load in background during idle time\r\n const loadRoute = async () => {\r\n try {\r\n const component = await route.component();\r\n this.routeCache.set(path, component);\r\n\r\n // Preload related routes\r\n route.prefetch?.forEach((prefetchPath) => {\r\n this.preloadQueue.add(prefetchPath);\r\n });\r\n\r\n console.log(`[EnterpriseRouter] Preloaded route: ${path}`);\r\n } catch (error) {\r\n console.warn(\r\n `[EnterpriseRouter] Failed to preload route ${path}:`,\r\n error\r\n );\r\n }\r\n };\r\n\r\n if (\"requestIdleCallback\" in window) {\r\n requestIdleCallback(loadRoute);\r\n } else {\r\n setTimeout(loadRoute, 0);\r\n }\r\n }\r\n }\r\n\r\n // Smart route matching with caching\r\n matchRoute(path: string): RouteMatch | null {\r\n const cached = this.routeMatchCache.get(path);\r\n if (cached !== undefined) return cached;\r\n\r\n const match = this.computeRouteMatch(path);\r\n\r\n // Cache the result with LRU eviction\r\n if (this.routeMatchCache.size > 100) {\r\n const firstKey = this.routeMatchCache.keys().next().value;\r\n if (firstKey !== undefined) {\r\n this.routeMatchCache.delete(firstKey);\r\n }\r\n }\r\n\r\n this.routeMatchCache.set(path, match);\r\n return match;\r\n }\r\n\r\n private computeRouteMatch(path: string): RouteMatch | null {\r\n // Extract parameters from dynamic routes\r\n const segments = path.split(\"/\").filter(Boolean);\r\n\r\n for (const [routePath, routeConfig] of Object.entries(this.routes)) {\r\n const routeSegments = routePath.split(\"/\").filter(Boolean);\r\n\r\n if (segments.length !== routeSegments.length) continue;\r\n\r\n const params: Record<string, string> = {};\r\n let isMatch = true;\r\n\r\n for (let i = 0; i < segments.length; i++) {\r\n const segment = segments[i];\r\n const routeSegment = routeSegments[i];\r\n\r\n if (routeSegment && segment) {\r\n if (routeSegment.startsWith(\":\")) {\r\n // Dynamic parameter\r\n params[routeSegment.slice(1)] = segment;\r\n } else if (segment !== routeSegment) {\r\n isMatch = false;\r\n break;\r\n }\r\n } else {\r\n isMatch = false;\r\n break;\r\n }\r\n }\r\n\r\n if (isMatch) {\r\n return {\r\n component: routeConfig.component as any,\r\n params,\r\n meta:\r\n typeof routeConfig.meta === \"function\"\r\n ? routeConfig.meta(params)\r\n : routeConfig.meta,\r\n };\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n async checkRouteGuard(\r\n route: RouteConfig,\r\n path: string,\r\n params: Record<string, string>\r\n ): Promise<boolean> {\r\n if (!route.guard) return true;\r\n\r\n if (route.guard.canActivate) {\r\n const canActivate = await route.guard.canActivate(path, params);\r\n return canActivate;\r\n }\r\n\r\n return true;\r\n }\r\n\r\n getPreloadedComponent(path: string): any {\r\n return this.routeCache.get(path);\r\n }\r\n\r\n clearCache(): void {\r\n this.routeCache.clear();\r\n this.routeMatchCache.clear();\r\n this.preloadQueue.clear();\r\n }\r\n}\r\n\r\n/**\r\n * Nested routing with layout persistence\r\n */\r\nclass LayoutRouter {\r\n private layoutCache = new Map<string, any>();\r\n private keepAliveComponents = new Map<string, any>();\r\n\r\n renderNestedRoutes(routes: NestedRoute[], segments: string[]): any {\r\n if (segments.length === 0) return null;\r\n\r\n const [currentSegment, ...remainingSegments] = segments;\r\n const currentRoute = routes.find((r) => r.path === currentSegment);\r\n\r\n if (!currentRoute) return null;\r\n\r\n let content: any;\r\n\r\n if (remainingSegments.length > 0 && currentRoute.children) {\r\n // Recursive nested routing\r\n content = this.renderNestedRoutes(\r\n currentRoute.children,\r\n remainingSegments\r\n );\r\n } else {\r\n // Leaf route - render component with keep-alive if needed\r\n if (currentRoute.keepAlive && currentSegment) {\r\n content = this.renderKeepAlive(currentRoute.component, currentSegment);\r\n } else {\r\n content = this.renderComponent(currentRoute.component);\r\n }\r\n }\r\n\r\n // Wrap in layout if specified\r\n if (currentRoute.layout) {\r\n const layoutKey = `${currentSegment}_layout`;\r\n let layoutComponent = this.layoutCache.get(layoutKey);\r\n\r\n if (!layoutComponent) {\r\n layoutComponent = this.renderComponent(currentRoute.layout);\r\n this.layoutCache.set(layoutKey, layoutComponent);\r\n }\r\n\r\n return this.renderComponent(currentRoute.layout, { children: content });\r\n }\r\n\r\n return content;\r\n }\r\n\r\n private renderKeepAlive(component: ComponentFunction, key: string): any {\r\n if (this.keepAliveComponents.has(key)) {\r\n return this.keepAliveComponents.get(key);\r\n }\r\n\r\n const rendered = this.renderComponent(component);\r\n this.keepAliveComponents.set(key, rendered);\r\n return rendered;\r\n }\r\n\r\n private renderComponent(component: ComponentFunction, props: any = {}): any {\r\n try {\r\n return component(props);\r\n } catch (error) {\r\n console.error(\"[LayoutRouter] Component render error:\", error);\r\n return null;\r\n }\r\n }\r\n\r\n cleanup(): void {\r\n this.layoutCache.clear();\r\n this.keepAliveComponents.clear();\r\n }\r\n}\r\n\r\n// Global instances\r\nconst enterpriseRouter = new EnterpriseRouter();\r\nconst layoutRouter = new LayoutRouter();\r\n\r\n// ---------------------- Router Factory ----------------------\r\n\r\n/**\r\n * Fynix Router Factory\r\n */\r\nfunction createFynix(): FynixRouter {\r\n const isDevMode = import.meta.hot !== undefined;\r\n\r\n // Singleton pattern - return existing instance if already initialized\r\n if (routerInstance && isRouterInitialized && !isDevMode) {\r\n console.warn(\r\n \"[Router] Router already initialized, returning existing instance\"\r\n );\r\n return routerInstance;\r\n }\r\n\r\n // In dev mode with HMR, cleanup old instance before creating new one\r\n if (isDevMode && routerInstance) {\r\n console.log(\"[Router] HMR: Cleaning up old router instance\");\r\n routerInstance.cleanup();\r\n routerInstance = null;\r\n isRouterInitialized = false;\r\n }\r\n\r\n let rootSelector = \"#app-root\";\r\n let currentPath: string | null = null;\r\n let isDestroyed = false;\r\n let listenerCount = 0;\r\n let renderTimeout: NodeJS.Timeout | null = null;\r\n let lastNavigationTime = 0;\r\n const NAVIGATION_RATE_LIMIT = 100; // ms between navigations\r\n\r\n const listeners: EventListener[] = [];\r\n\r\n // Initialize props namespace\r\n if (!window[PROPS_NAMESPACE]) {\r\n window[PROPS_NAMESPACE] = {};\r\n }\r\n\r\n // Clear old cache in dev mode to prevent memory buildup\r\n if (isDevMode && window.__fynixPropsCache) {\r\n window.__fynixPropsCache.clear();\r\n }\r\n\r\n const propsCache: Map<\r\n string,\r\n Record<string, any>\r\n > = window.__fynixPropsCache || new Map();\r\n window.__fynixPropsCache = propsCache;\r\n\r\n // Load all route modules\r\n const modules = tryGlobPaths();\r\n const routes: Record<string, RouteComponent> = {};\r\n const dynamicRoutes: DynamicRoute[] = [];\r\n\r\n for (const [filePath, mod] of Object.entries(modules)) {\r\n const routePath = filePathToRoute(filePath);\r\n let component: RouteComponent | undefined = undefined;\r\n if (mod && typeof mod === \"object\") {\r\n if (\"default\" in mod && mod.default) {\r\n component = mod.default;\r\n } else {\r\n const keys = Object.keys(mod);\r\n const firstKey = keys.length > 0 ? keys[0] : undefined;\r\n if (\r\n firstKey !== undefined &&\r\n typeof firstKey === \"string\" &&\r\n typeof mod[firstKey] !== \"undefined\"\r\n ) {\r\n component = mod[firstKey];\r\n } else {\r\n const values = Object.values(mod).filter(Boolean);\r\n if (values.length > 0) {\r\n component = values[0] as RouteComponent;\r\n }\r\n }\r\n }\r\n }\r\n\r\n if (!component || typeof routePath !== \"string\") continue;\r\n\r\n const hasDynamic = /:[^/]+/.test(routePath);\r\n\r\n if (hasDynamic) {\r\n dynamicRoutes.push({\r\n pattern: routePath,\r\n regex: new RegExp(\"^\" + routePath.replace(/:[^/]+/g, \"([^/]+)\") + \"$\"),\r\n component,\r\n params: [...routePath.matchAll(/:([^/]+)/g)]\r\n .map((m) => m[1])\r\n .filter((p): p is string => typeof p === \"string\"),\r\n });\r\n } else {\r\n routes[routePath] = component;\r\n }\r\n }\r\n\r\n // ---------------------- Core Rendering ----------------------\r\n /**\r\n * Enhanced core route rendering function with enterprise features\r\n */\r\n async function renderRouteImmediate(): Promise<void> {\r\n if (isDestroyed) return;\r\n\r\n const path = normalizePath(window.location.pathname);\r\n let Page: RouteComponent | undefined = routes[path];\r\n let params: Record<string, string> = {};\r\n let routeProps: Record<string, any> = {};\r\n\r\n // Try enterprise router matching first\r\n const enterpriseMatch = enterpriseRouter.matchRoute(path);\r\n if (enterpriseMatch) {\r\n // Check if component is preloaded\r\n const preloadedComponent = enterpriseRouter.getPreloadedComponent(path);\r\n if (preloadedComponent) {\r\n Page = preloadedComponent;\r\n } else {\r\n Page = enterpriseMatch.component;\r\n }\r\n params = enterpriseMatch.params;\r\n }\r\n\r\n // Fallback to original dynamic route matching\r\n if (!Page) {\r\n const match = matchDynamicRoute(path, dynamicRoutes);\r\n if (match) {\r\n Page = match.component;\r\n params = match.params;\r\n }\r\n }\r\n\r\n const root = document.querySelector(rootSelector);\r\n if (!root) {\r\n console.error(\"[Router] Root element not found:\", rootSelector);\r\n return;\r\n }\r\n\r\n // Show enhanced 404 if no route found\r\n if (!Page) {\r\n root.innerHTML = \"\";\r\n const container = document.createElement(\"div\");\r\n container.style.cssText =\r\n \"padding: 2rem; text-align: center; font-family: system-ui, sans-serif;\";\r\n\r\n const heading = document.createElement(\"h2\");\r\n heading.textContent = \"404 Not Found\";\r\n heading.style.cssText = \"color: #dc2626; margin-bottom: 1rem;\";\r\n\r\n const pathInfo = document.createElement(\"p\");\r\n const safePath = escapeHTML(sanitizeContent(path));\r\n pathInfo.textContent = `Path: ${safePath}`;\r\n pathInfo.style.cssText = \"color: #6b7280; margin-bottom: 2rem;\";\r\n\r\n const backButton = document.createElement(\"button\");\r\n backButton.textContent = \"Go Back\";\r\n backButton.style.cssText =\r\n \"padding: 0.5rem 1rem; background: #3b82f6; color: white; border: none; border-radius: 0.25rem; cursor: pointer;\";\r\n backButton.onclick = () => window.history.back();\r\n\r\n container.appendChild(heading);\r\n container.appendChild(pathInfo);\r\n container.appendChild(backButton);\r\n root.appendChild(container);\r\n\r\n updateMetaTags({ title: \"404 - Page Not Found\" });\r\n\r\n // Preload commonly visited routes for better UX\r\n [\"/\", \"/home\", \"/about\"].forEach((commonPath) => {\r\n enterpriseRouter.preloadRoute(commonPath).catch(console.warn);\r\n });\r\n\r\n return;\r\n }\r\n\r\n // Retrieve props from cache or history state with enhanced caching\r\n const state = (window.history.state || {}) as HistoryState;\r\n let passedProps: Record<string, any> = {};\r\n\r\n if (state.__fynixCacheKey && propsCache.has(state.__fynixCacheKey)) {\r\n passedProps = propsCache.get(state.__fynixCacheKey)!;\r\n } else if (state.serializedProps) {\r\n passedProps = deserializeProps(state.serializedProps);\r\n }\r\n\r\n // Get route-specific props\r\n if (Page.props) {\r\n routeProps = typeof Page.props === \"function\" ? Page.props() : Page.props;\r\n }\r\n\r\n // Update meta tags\r\n if (Page.meta) {\r\n const meta =\r\n typeof Page.meta === \"function\" ? Page.meta(params) : Page.meta;\r\n updateMetaTags(meta);\r\n }\r\n\r\n // Merge and sanitize all props\r\n const unsafeProps = {\r\n ...routeProps,\r\n ...passedProps,\r\n params,\r\n };\r\n\r\n // Sanitize props before mounting to prevent XSS\r\n const safeProps = sanitizeProps(unsafeProps);\r\n window.__lastRouteProps = safeProps;\r\n\r\n // Mount the page component\r\n try {\r\n mount(Page, rootSelector, safeProps);\r\n } catch (err) {\r\n console.error(\"[Router] Mount failed:\", err);\r\n // Safe error display without innerHTML\r\n root.innerHTML = \"\";\r\n const errorDiv = document.createElement(\"pre\");\r\n errorDiv.style.color = \"red\";\r\n errorDiv.textContent = \"Mount Error occurred\";\r\n root.appendChild(errorDiv);\r\n }\r\n\r\n currentPath = path;\r\n }\r\n /**\r\n * Debounced route rendering to prevent race conditions\r\n */\r\n function renderRoute(): void {\r\n if (isDestroyed) return;\r\n\r\n if (renderTimeout) {\r\n clearTimeout(renderTimeout);\r\n }\r\n\r\n renderTimeout = setTimeout(async () => {\r\n await renderRouteImmediate();\r\n renderTimeout = null;\r\n }, RENDER_DEBOUNCE);\r\n }\r\n // ---------------------- Navigation Methods ----------------------\r\n\r\n /**\r\n * Navigate to a new path with props - Enhanced with preloading\r\n */\r\n function navigate(path: string, props: Record<string, any> = {}): void {\r\n if (isDestroyed) return;\r\n\r\n // Rate limiting to prevent DoS\r\n const now = Date.now();\r\n if (now - lastNavigationTime < NAVIGATION_RATE_LIMIT) {\r\n console.warn(\"[Router] Security: Navigation rate limited\");\r\n return;\r\n }\r\n lastNavigationTime = now;\r\n\r\n const normalizedPath = normalizePath(path);\r\n\r\n if (!isValidURL(window.location.origin + normalizedPath)) {\r\n console.error(\"[Router] Invalid navigation URL\");\r\n return;\r\n }\r\n\r\n if (normalizedPath === currentPath) return;\r\n\r\n // Preload the target route if possible\r\n enterpriseRouter.preloadRoute(normalizedPath).catch(console.warn);\r\n\r\n // Sanitize props before caching\r\n const sanitizedProps = sanitizeProps(props);\r\n const cacheKey = generateCacheKey();\r\n addToCache(propsCache, cacheKey, sanitizedProps);\r\n\r\n try {\r\n window.history.pushState(\r\n { __fynixCacheKey: cacheKey },\r\n \"\",\r\n normalizedPath\r\n );\r\n renderRoute();\r\n } catch (err) {\r\n console.error(\"[Router] Navigation failed:\", err);\r\n }\r\n }\r\n\r\n /**\r\n * Replace current path with new path and props - Enhanced security\r\n */\r\n function replace(path: string, props: Record<string, any> = {}): void {\r\n if (isDestroyed) return;\r\n\r\n // Rate limiting to prevent DoS\r\n const now = Date.now();\r\n if (now - lastNavigationTime < NAVIGATION_RATE_LIMIT) {\r\n console.warn(\"[Router] Security: Replace rate limited\");\r\n return;\r\n }\r\n lastNavigationTime = now;\r\n\r\n const normalizedPath = normalizePath(path);\r\n\r\n if (!isValidURL(window.location.origin + normalizedPath)) {\r\n console.error(\"[Router] Invalid replace URL\");\r\n return;\r\n }\r\n\r\n // Sanitize props before caching\r\n const sanitizedProps = sanitizeProps(props);\r\n const cacheKey = generateCacheKey();\r\n addToCache(propsCache, cacheKey, sanitizedProps);\r\n\r\n try {\r\n window.history.replaceState(\r\n { __fynixCacheKey: cacheKey },\r\n \"\",\r\n normalizedPath\r\n );\r\n renderRoute();\r\n } catch (err) {\r\n console.error(\"[Router] Replace failed:\", err);\r\n }\r\n }\r\n\r\n /**\r\n * Navigate back in history\r\n */\r\n function back(): void {\r\n if (isDestroyed) return;\r\n\r\n try {\r\n window.history.back();\r\n } catch (err) {\r\n console.error(\"[Router] Back navigation failed:\", err);\r\n }\r\n }\r\n\r\n // ---------------------- Event Handlers ----------------------\r\n\r\n /**\r\n * Link click delegation handler\r\n */\r\n const clickHandler = (e: Event): void => {\r\n if (isDestroyed) return;\r\n\r\n const target = e.target as HTMLElement;\r\n const link = target.closest(\r\n \"a[data-fynix-link]\"\r\n ) as HTMLAnchorElement | null;\r\n\r\n if (!link) return;\r\n\r\n const href = link.getAttribute(\"href\");\r\n if (!href) {\r\n console.warn(\"[Router] Missing href attribute\");\r\n return;\r\n }\r\n\r\n // Ignore external links\r\n if (isExternal(href)) {\r\n return; // Let the browser handle it\r\n }\r\n\r\n // Build full URL for validation (handles relative URLs)\r\n const fullUrl = new URL(link.href, window.location.origin).href;\r\n if (!isValidURL(fullUrl)) {\r\n console.warn(\"[Router] Invalid link href\");\r\n return;\r\n }\r\n\r\n e.preventDefault();\r\n\r\n const path = normalizePath(\r\n new URL(link.href, window.location.origin).pathname\r\n );\r\n\r\n if (path === currentPath) return;\r\n\r\n let props: Record<string, any> = {};\r\n const propsKey = link.getAttribute(\"data-props-key\");\r\n\r\n if (\r\n propsKey &&\r\n typeof propsKey === \"string\" &&\r\n !propsKey.startsWith(\"__\")\r\n ) {\r\n if (window[PROPS_NAMESPACE]?.[propsKey]) {\r\n props = window[PROPS_NAMESPACE][propsKey];\r\n }\r\n }\r\n\r\n // Serialize props (extract values from reactive states)\r\n const serializableProps: Record<string, any> = {};\r\n for (const [k, v] of Object.entries(props)) {\r\n if (typeof k !== \"string\" || k.startsWith(\"__\")) continue;\r\n serializableProps[k] =\r\n v && (v._isNixState || v._isRestState) ? v.value : v;\r\n }\r\n\r\n const cacheKey = generateCacheKey();\r\n addToCache(propsCache, cacheKey, serializableProps);\r\n\r\n try {\r\n window.history.pushState(\r\n { __fynixCacheKey: cacheKey, serializedProps: serializableProps },\r\n \"\",\r\n path\r\n );\r\n renderRoute();\r\n } catch (err) {\r\n console.error(\"[Router] Link navigation failed:\", err);\r\n }\r\n };\r\n\r\n // ---------------------- Event Listener Setup ----------------------\r\n\r\n // Only add listeners if not already added\r\n if (listenerCount < MAX_LISTENERS && !isRouterInitialized) {\r\n document.addEventListener(\"click\", clickHandler);\r\n listeners.push({\r\n element: document,\r\n event: \"click\",\r\n handler: clickHandler,\r\n });\r\n listenerCount++;\r\n\r\n window.addEventListener(\"popstate\", renderRoute);\r\n listeners.push({\r\n element: window,\r\n event: \"popstate\",\r\n handler: renderRoute,\r\n });\r\n listenerCount++;\r\n }\r\n\r\n // ---------------------- Public Methods ----------------------\r\n\r\n /**\r\n * Mount the router to a DOM element\r\n */\r\n function mountRouter(selector: string = \"#app-root\"): void {\r\n if (isDestroyed) {\r\n console.error(\"[Router] Cannot mount destroyed router\");\r\n return;\r\n }\r\n\r\n if (typeof selector !== \"string\" || selector.length === 0) {\r\n console.error(\"[Router] Invalid selector\");\r\n return;\r\n }\r\n\r\n rootSelector = selector;\r\n renderRoute();\r\n isRouterInitialized = true;\r\n }\r\n\r\n /**\r\n * Enhanced cleanup function with enterprise router cleanup\r\n */\r\n function cleanup(): void {\r\n // Clear timeout FIRST to prevent pending renders\r\n if (renderTimeout) {\r\n clearTimeout(renderTimeout);\r\n renderTimeout = null;\r\n }\r\n\r\n // Mark as destroyed\r\n isDestroyed = true;\r\n\r\n // Clean up enterprise router features\r\n enterpriseRouter.clearCache();\r\n layoutRouter.cleanup();\r\n\r\n // Remove all event listeners\r\n listeners.forEach(({ element, event, handler }) => {\r\n try {\r\n element.removeEventListener(event, handler);\r\n } catch (e) {\r\n console.error(\"[Router] Cleanup error:\", e);\r\n }\r\n });\r\n listeners.length = 0;\r\n listenerCount = 0;\r\n\r\n // Clean up all cached props\r\n propsCache.forEach((props) => {\r\n if (props && typeof props === \"object\") {\r\n Object.values(props).forEach((val) => {\r\n if (val && typeof val === \"object\" && \"cleanup\" in val) {\r\n try {\r\n (val as any).cleanup();\r\n } catch (e) {\r\n // Silent cleanup failure\r\n }\r\n }\r\n });\r\n }\r\n });\r\n propsCache.clear();\r\n\r\n // Clean up global namespace\r\n if (window[PROPS_NAMESPACE]) {\r\n const ns = window[PROPS_NAMESPACE];\r\n if (ns && typeof ns === \"object\") {\r\n Object.keys(ns).forEach((key) => {\r\n delete ns[key];\r\n });\r\n }\r\n delete window[PROPS_NAMESPACE];\r\n }\r\n\r\n // Clear last route props\r\n if (window.__lastRouteProps) {\r\n delete window.__lastRouteProps;\r\n }\r\n\r\n // Reset singleton flags at the VERY end\r\n isRouterInitialized = false;\r\n routerInstance = null;\r\n\r\n console.log(\"[Router] Cleanup complete\");\r\n }\r\n\r\n // ---------------------- HMR Support ----------------------\r\n\r\n // @ts-ignore - Vite HMR API\r\n if (import.meta.hot) {\r\n // @ts-ignore\r\n import.meta.hot.accept(() => {\r\n console.log(\"[Router] HMR detected, re-rendering route...\");\r\n renderRoute();\r\n });\r\n\r\n // @ts-ignore\r\n import.meta.hot.dispose(() => {\r\n console.log(\"[Router] HMR dispose, cleaning up...\");\r\n cleanup();\r\n // Reset singleton flags for HMR\r\n routerInstance = null;\r\n isRouterInitialized = false;\r\n });\r\n }\r\n\r\n // ---------------------- Router Instance ----------------------\r\n\r\n const router: FynixRouter = {\r\n mountRouter,\r\n navigate,\r\n replace,\r\n back,\r\n cleanup,\r\n routes,\r\n dynamicRoutes,\r\n // Enterprise features\r\n preloadRoute: enterpriseRouter.preloadRoute.bind(enterpriseRouter),\r\n clearCache: () => {\r\n enterpriseRouter.clearCache();\r\n layoutRouter.cleanup();\r\n },\r\n enableNestedRouting: (nestedRoutes: NestedRoute[]) => {\r\n // Store nested routes configuration\r\n (router as any).nestedRoutes = nestedRoutes;\r\n console.log(\r\n \"[Router] Nested routing enabled with\",\r\n nestedRoutes.length,\r\n \"routes\"\r\n );\r\n },\r\n };\r\n\r\n routerInstance = router;\r\n return router;\r\n}\r\n\r\n// Export as both named and default\r\nexport { createFynix };\r\nexport default createFynix;\r\n// ---------------------- Helper Exports ----------------------\r\n\r\n/**\r\n * Set props for links\r\n */\r\nexport function setLinkProps(key: string, props: Record<string, any>): void {\r\n if (typeof key !== \"string\" || key.startsWith(\"__\")) {\r\n console.error(\"[Router] Invalid props key\");\r\n return;\r\n }\r\n\r\n if (!props || typeof props !== \"object\") {\r\n console.error(\"[Router] Invalid props object\");\r\n return;\r\n }\r\n\r\n if (!window[PROPS_NAMESPACE]) {\r\n window[PROPS_NAMESPACE] = {};\r\n }\r\n\r\n if (Object.keys(window[PROPS_NAMESPACE]).length >= MAX_CACHE_SIZE) {\r\n console.warn(\"[Router] Props storage limit reached\");\r\n return;\r\n }\r\n\r\n window[PROPS_NAMESPACE][key] = props;\r\n}\r\n\r\n/**\r\n * Clear link props\r\n */\r\nexport function clearLinkProps(key: string): void {\r\n if (typeof key !== \"string\") return;\r\n\r\n if (window[PROPS_NAMESPACE]?.[key]) {\r\n const props = window[PROPS_NAMESPACE][key];\r\n\r\n if (props && typeof props === \"object\") {\r\n Object.values(props).forEach((val) => {\r\n if (val && typeof val === \"object\" && \"cleanup\" in val) {\r\n try {\r\n (val as any).cleanup();\r\n } catch (e) {\r\n // Silent cleanup failure\r\n }\r\n }\r\n });\r\n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AAK,EAAE,QAAQ,CAAC,QAAQ;AACpC,YAAI,OAAO,OAAO,QAAQ,YAAY,aAAa,KAAK;AACtD,cAAI;AACF,YAAC,IAAY,QAAQ;AAAA,UACvB,SAAS,GAAG;AAAA,UAEZ;AAAA,QACF;AAAA,MACF,CAAC;AAAA,IACH;AAEA,WAAO,OAAO,eAAe,EAAE,GAAG;AAAA,EACpC;AACF;AApBgB;",
6
- "names": []
7
- }
package/dist/runtime.d.ts DELETED
@@ -1,124 +0,0 @@
1
- type Priority = "immediate" | "high" | "normal" | "low" | "idle";
2
- interface FynixFiber {
3
- type: string | symbol | ComponentFunction;
4
- props: any;
5
- key: string | number | null;
6
- child: FynixFiber | null;
7
- sibling: FynixFiber | null;
8
- parent: FynixFiber | null;
9
- alternate: FynixFiber | null;
10
- effectTag: "PLACEMENT" | "UPDATE" | "DELETION" | null;
11
- updatePriority: Priority;
12
- _domNode?: Node | null;
13
- _rendered?: FynixFiber | null;
14
- hooks?: any[];
15
- context?: ComponentContext;
16
- }
17
- type VNodeType = string | symbol | ComponentFunction;
18
- type VNodeChild = VNode | string | number | boolean | null | undefined;
19
- type VNodeChildren = VNodeChild | VNodeChild[];
20
- interface VNodeProps {
21
- children?: VNode[];
22
- key?: string | number | null;
23
- [key: string]: any;
24
- }
25
- interface VNode {
26
- type: VNodeType;
27
- props: VNodeProps;
28
- key: string | number | null;
29
- _domNode?: Node | null;
30
- _rendered?: VNode | null;
31
- _state?: ReactiveState<any> | null;
32
- _cleanup?: (() => void) | null;
33
- }
34
- interface ComponentFunction {
35
- (props: any): VNode | Promise<VNode>;
36
- }
37
- interface ReactiveState<T> {
38
- value: T;
39
- _isNixState: boolean;
40
- subscribe(callback: () => void): () => void;
41
- }
42
- interface ComponentContext {
43
- hooks: any[];
44
- hookIndex: number;
45
- effects: Array<() => void | (() => void)>;
46
- cleanups: Array<() => void>;
47
- _vnode: VNode;
48
- _accessedStates: Set<ReactiveState<any>>;
49
- _subscriptions: Set<ReactiveState<any>>;
50
- _subscriptionCleanups: Array<() => void>;
51
- version: number;
52
- rerender: (() => void) | null;
53
- Component: ComponentFunction;
54
- _isMounted: boolean;
55
- _isRerendering: boolean;
56
- }
57
- import { Button, Path } from "./custom/index";
58
- import { nixAsync } from "./hooks/nixAsync";
59
- import { nixAsyncCached } from "./hooks/nixAsyncCache";
60
- import { nixAsyncDebounce } from "./hooks/nixAsyncDebounce";
61
- import { nixAsyncQuery } from "./hooks/nixAsyncQuery";
62
- import { nixCallback } from "./hooks/nixCallback";
63
- import { nixComputed } from "./hooks/nixComputed";
64
- import { nixDebounce } from "./hooks/nixDebounce";
65
- import { nixEffect, nixEffectAlways, nixEffectOnce } from "./hooks/nixEffect";
66
- import { nixForm } from "./hooks/nixForm";
67
- import { nixFormAsync } from "./hooks/nixFormAsync";
68
- import { nixInterval } from "./hooks/nixInterval";
69
- import { nixLazy, Suspense } from "./hooks/nixLazy";
70
- import { nixLazyAsync } from "./hooks/nixLazyAsync";
71
- import { nixLazyFormAsync } from "./hooks/nixLazyFormAsync";
72
- import { nixLocalStorage } from "./hooks/nixLocalStorage";
73
- import { nixMemo } from "./hooks/nixMemo";
74
- import { nixPrevious } from "./hooks/nixPrevious";
75
- import { nixRef } from "./hooks/nixRef";
76
- import { nixState } from "./hooks/nixState";
77
- import { nixStore } from "./hooks/nixStore";
78
- import createFynix from "./router/router";
79
- declare class FiberRenderer {
80
- private workInProgressRoot;
81
- private nextUnitOfWork;
82
- private currentRoot;
83
- private deletions;
84
- scheduleWork(fiber: FynixFiber): void;
85
- workLoop(deadline: number): void;
86
- performUnitOfWork(fiber: FynixFiber): FynixFiber | null;
87
- private reconcileChildren;
88
- private commitRoot;
89
- private commitWork;
90
- private commitDeletion;
91
- private updateDom;
92
- }
93
- export declare function useFiberRenderer(): FiberRenderer;
94
- declare class HierarchicalStore {
95
- private root;
96
- private selectorCache;
97
- private stateSnapshot;
98
- select<T>(selector: (state: any) => T): T;
99
- optimisticUpdate<T>(path: string, update: T, rollback?: () => void): {
100
- commit: () => void;
101
- rollback: () => void;
102
- };
103
- private getState;
104
- private get;
105
- private set;
106
- private clearRollback;
107
- private invalidateSelectors;
108
- }
109
- export declare function useHierarchicalStore(): HierarchicalStore;
110
- export declare const TEXT: unique symbol;
111
- export declare const Fragment: unique symbol;
112
- export declare function createTextVNode(text: any): VNode;
113
- export declare function h(type: VNodeType, props?: VNodeProps | null, ...children: VNodeChildren[]): VNode;
114
- export declare namespace h {
115
- var Fragment: ({ children }: {
116
- children?: VNode[];
117
- }) => VNode[];
118
- }
119
- export declare const Fynix: typeof h;
120
- export declare function renderComponent(Component: ComponentFunction, props?: any): VNode;
121
- export declare function patch(parent: Node, newVNode: VNode | string | number | null | undefined, oldVNode: VNode | string | number | null | undefined): Promise<void>;
122
- export declare function mount(AppComponent: ComponentFunction, root: string | Element, props?: any): void;
123
- export { Button, createFynix, nixAsync, nixAsyncCached, nixAsyncDebounce, nixAsyncQuery, nixCallback, nixComputed, nixDebounce, nixEffect, nixEffectAlways, nixEffectOnce, nixForm, nixFormAsync, nixInterval, nixLazy, nixLazyAsync, nixLazyFormAsync, nixLocalStorage, nixMemo, nixPrevious, nixRef, nixState, nixStore, Path, Suspense, };
124
- //# sourceMappingURL=runtime.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../runtime.ts"],"names":[],"mappings":"AAqCA,KAAK,QAAQ,GAAG,WAAW,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,GAAG,MAAM,CAAC;AA4BjE,UAAU,UAAU;IAClB,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,iBAAiB,CAAC;IAC1C,KAAK,EAAE,GAAG,CAAC;IACX,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAC5B,KAAK,EAAE,UAAU,GAAG,IAAI,CAAC;IACzB,OAAO,EAAE,UAAU,GAAG,IAAI,CAAC;IAC3B,MAAM,EAAE,UAAU,GAAG,IAAI,CAAC;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AI,EAAE,MAAM,GAAG,OAAO,EACtB,KAAK,GAAE,GAAQ,GACd,IAAI,CAkGN;AAID,OAAO,EACL,MAAM,EACN,WAAW,EACX,QAAQ,EACR,cAAc,EACd,gBAAgB,EAChB,aAAa,EACb,WAAW,EACX,WAAW,EACX,WAAW,EACX,SAAS,EACT,eAAe,EACf,aAAa,EACb,OAAO,EACP,YAAY,EACZ,WAAW,EACX,OAAO,EACP,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,OAAO,EACP,WAAW,EACX,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,IAAI,EACJ,QAAQ,GACT,CAAC"}
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../runtime.ts"],
4
- "sourcesContent": ["/* MIT License\r\n\r\n* Copyright (c) 2026 Resty Gonzales\r\n*\r\n* SECURITY NOTICE:\r\n* This runtime includes built-in XSS protection mechanisms.\r\n* For additional security, consider implementing:\r\n* 1. Content Security Policy (CSP) headers\r\n* 2. Subresource Integrity (SRI) for external scripts\r\n* 3. Regular security audits of your application code\r\n* 4. Input validation on the server side\r\n*\r\n* CSP Header Example:\r\n* Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline';\r\n\r\nPermission is hereby granted, free of charge, to any person obtaining a copy\r\nof this software and associated documentation files (the \"Software\"), to deal\r\nin the Software without restriction, including without limitation the rights\r\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\ncopies of the Software, and to permit persons to whom the Software is\r\nfurnished to do so, subject to the following conditions:\r\n\r\nThe above copyright notice and this permission notice shall be included in all\r\ncopies or substantial portions of the Software.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\n* SOFTWARE.\r\n */\r\n\r\n// ---------------------- Types ----------------------\r\n\r\n// Advanced Scheduling Types\r\ntype Priority = \"immediate\" | \"high\" | \"normal\" | \"low\" | \"idle\";\r\ntype UpdateType = \"state\" | \"props\" | \"effect\" | \"layout\";\r\n\r\ninterface Update {\r\n id: string;\r\n type: UpdateType;\r\n priority: Priority;\r\n component?: ComponentContext;\r\n callback: () => void;\r\n timestamp: number;\r\n}\r\n\r\ninterface PriorityQueue<T> {\r\n push(item: T, priority: Priority): void;\r\n pop(): T | undefined;\r\n peek(): T | undefined;\r\n size(): number;\r\n isEmpty(): boolean;\r\n}\r\n\r\ninterface ReactiveScheduler {\r\n schedule(update: Update, priority: Priority): void;\r\n batchUpdates(updates: Update[]): void;\r\n timeSlice(deadline: number): boolean;\r\n flush(): void;\r\n}\r\n\r\n// Fiber Architecture Types\r\ninterface FynixFiber {\r\n type: string | symbol | ComponentFunction;\r\n props: any;\r\n key: string | number | null;\r\n child: FynixFiber | null;\r\n sibling: FynixFiber | null;\r\n parent: FynixFiber | null;\r\n alternate: FynixFiber | null;\r\n effectTag: \"PLACEMENT\" | \"UPDATE\" | \"DELETION\" | null;\r\n updatePriority: Priority;\r\n _domNode?: Node | null;\r\n _rendered?: FynixFiber | null;\r\n hooks?: any[];\r\n context?: ComponentContext;\r\n}\r\n\r\ntype VNodeType = string | symbol | ComponentFunction;\r\ntype VNodeChild = VNode | string | number | boolean | null | undefined;\r\ntype VNodeChildren = VNodeChild | VNodeChild[];\r\n\r\ninterface VNodeProps {\r\n children?: VNode[];\r\n key?: string | number | null;\r\n [key: string]: any;\r\n}\r\n\r\ninterface VNode {\r\n type: VNodeType;\r\n props: VNodeProps;\r\n key: string | number | null;\r\n _domNode?: Node | null;\r\n _rendered?: VNode | null;\r\n _state?: ReactiveState<any> | null;\r\n _cleanup?: (() => void) | null;\r\n}\r\n\r\ninterface ComponentFunction {\r\n (props: any): VNode | Promise<VNode>;\r\n}\r\n\r\ninterface ReactiveState<T> {\r\n value: T;\r\n _isNixState: boolean;\r\n subscribe(callback: () => void): () => void;\r\n}\r\n\r\ninterface ComponentContext {\r\n hooks: any[];\r\n hookIndex: number;\r\n effects: Array<() => void | (() => void)>;\r\n cleanups: Array<() => void>;\r\n _vnode: VNode;\r\n _accessedStates: Set<ReactiveState<any>>;\r\n _subscriptions: Set<ReactiveState<any>>;\r\n _subscriptionCleanups: Array<() => void>;\r\n version: number;\r\n rerender: (() => void) | null;\r\n Component: ComponentFunction;\r\n _isMounted: boolean;\r\n _isRerendering: boolean;\r\n}\r\n\r\n// ---------------------- Imports ----------------------\r\n\r\nimport { activeContext, setActiveContext } from \"./context/context\";\r\nimport { Button, Path } from \"./custom/index\";\r\nimport { removeErrorOverlay, showErrorOverlay } from \"./error/errorOverlay\";\r\nimport { nixAsync } from \"./hooks/nixAsync\";\r\nimport { nixAsyncCached } from \"./hooks/nixAsyncCache\";\r\nimport { nixAsyncDebounce } from \"./hooks/nixAsyncDebounce\";\r\nimport { nixAsyncQuery } from \"./hooks/nixAsyncQuery\";\r\nimport { nixCallback } from \"./hooks/nixCallback\";\r\nimport { nixComputed } from \"./hooks/nixComputed\";\r\nimport { nixDebounce } from \"./hooks/nixDebounce\";\r\nimport { nixEffect, nixEffectAlways, nixEffectOnce } from \"./hooks/nixEffect\";\r\nimport { nixForm } from \"./hooks/nixForm\";\r\nimport { nixFormAsync } from \"./hooks/nixFormAsync\";\r\nimport { nixInterval } from \"./hooks/nixInterval\";\r\nimport { nixLazy, Suspense } from \"./hooks/nixLazy\";\r\nimport { nixLazyAsync } from \"./hooks/nixLazyAsync\";\r\nimport { nixLazyFormAsync } from \"./hooks/nixLazyFormAsync\";\r\nimport { nixLocalStorage } from \"./hooks/nixLocalStorage\";\r\nimport { nixMemo } from \"./hooks/nixMemo\";\r\nimport { nixPrevious } from \"./hooks/nixPrevious\";\r\nimport { nixRef } from \"./hooks/nixRef\";\r\nimport { nixState } from \"./hooks/nixState\";\r\nimport { nixStore } from \"./hooks/nixStore\";\r\nimport createFynix from \"./router/router\";\r\n\r\n// ---------------------- Advanced Scheduling System ----------------------\r\n\r\nclass SimplePriorityQueue<T> implements PriorityQueue<T> {\r\n private items: Array<{ item: T; priority: Priority }> = [];\r\n private priorityOrder: Record<Priority, number> = {\r\n immediate: 0,\r\n high: 1,\r\n normal: 2,\r\n low: 3,\r\n idle: 4,\r\n };\r\n\r\n push(item: T, priority: Priority): void {\r\n this.items.push({ item, priority });\r\n this.items.sort(\r\n (a, b) => this.priorityOrder[a.priority] - this.priorityOrder[b.priority]\r\n );\r\n }\r\n\r\n pop(): T | undefined {\r\n return this.items.shift()?.item;\r\n }\r\n\r\n peek(): T | undefined {\r\n return this.items[0]?.item;\r\n }\r\n\r\n size(): number {\r\n return this.items.length;\r\n }\r\n\r\n isEmpty(): boolean {\r\n return this.items.length === 0;\r\n }\r\n}\r\n\r\nclass FynixScheduler implements ReactiveScheduler {\r\n private updateQueue = new SimplePriorityQueue<Update>();\r\n private batchedUpdates = new Set<Update>();\r\n private isScheduled = false;\r\n private isWorking = false;\r\n private currentPriority: Priority = \"normal\";\r\n private updateIdCounter = 0;\r\n\r\n schedule(update: Update, priority: Priority = \"normal\"): void {\r\n update.id = `update_${this.updateIdCounter++}`;\r\n update.priority = priority;\r\n update.timestamp = performance.now();\r\n\r\n if (priority === \"immediate\") {\r\n this.flushUpdate(update);\r\n } else {\r\n this.updateQueue.push(update, priority);\r\n this.scheduleWork();\r\n }\r\n }\r\n\r\n batchUpdates(updates: Update[]): void {\r\n updates.forEach((update) => this.batchedUpdates.add(update));\r\n this.scheduleWork();\r\n }\r\n\r\n timeSlice(deadline: number): boolean {\r\n const startTime = performance.now();\r\n const previousPriority = this.currentPriority;\r\n\r\n while (\r\n !this.updateQueue.isEmpty() &&\r\n performance.now() - startTime < deadline\r\n ) {\r\n const update = this.updateQueue.pop();\r\n if (update) {\r\n // Check if we should yield to higher priority work\r\n if (this.shouldYield() && update.priority !== \"immediate\") {\r\n // Put update back and yield\r\n this.updateQueue.push(update, update.priority);\r\n break;\r\n }\r\n\r\n this.flushUpdate(update);\r\n }\r\n }\r\n\r\n this.currentPriority = previousPriority;\r\n return this.updateQueue.isEmpty();\r\n }\r\n\r\n flush(): void {\r\n if (this.isWorking) return;\r\n\r\n this.isWorking = true;\r\n\r\n try {\r\n // Process immediate updates first\r\n while (!this.updateQueue.isEmpty()) {\r\n const update = this.updateQueue.peek();\r\n if (update && update.priority === \"immediate\") {\r\n this.flushUpdate(this.updateQueue.pop()!);\r\n } else {\r\n break;\r\n }\r\n }\r\n\r\n // Process batched updates\r\n this.batchedUpdates.forEach((update) => this.flushUpdate(update));\r\n this.batchedUpdates.clear();\r\n } finally {\r\n this.isWorking = false;\r\n this.isScheduled = false;\r\n }\r\n }\r\n\r\n private flushUpdate(update: Update): void {\r\n const previousPriority = this.currentPriority;\r\n this.currentPriority = update.priority;\r\n\r\n try {\r\n update.callback();\r\n } catch (error) {\r\n console.error(\"[FynixScheduler] Update error:\", error);\r\n showErrorOverlay(error as Error);\r\n } finally {\r\n this.currentPriority = previousPriority;\r\n }\r\n }\r\n\r\n private scheduleWork(): void {\r\n if (this.isScheduled) return;\r\n\r\n this.isScheduled = true;\r\n\r\n // Use different scheduling strategies based on priority\r\n const nextUpdate = this.updateQueue.peek();\r\n if (nextUpdate) {\r\n if (nextUpdate.priority === \"high\") {\r\n // High priority - schedule for next frame\r\n requestAnimationFrame(() => this.workLoop(16.67)); // ~60fps\r\n } else {\r\n // Normal/low priority - use idle time\r\n if (\"requestIdleCallback\" in window) {\r\n requestIdleCallback((deadline) => {\r\n this.workLoop(deadline.timeRemaining());\r\n });\r\n } else {\r\n // Fallback for browsers without requestIdleCallback\r\n setTimeout(() => this.workLoop(5), 0);\r\n }\r\n }\r\n }\r\n }\r\n\r\n private workLoop(deadline: number): void {\r\n const hasMoreWork = !this.timeSlice(deadline);\r\n\r\n if (hasMoreWork) {\r\n // Continue in next frame/idle period\r\n this.isScheduled = false;\r\n this.scheduleWork();\r\n } else {\r\n this.flush();\r\n }\r\n }\r\n\r\n getCurrentPriority(): Priority {\r\n return this.currentPriority;\r\n }\r\n\r\n // Check if current execution should yield to higher priority work\r\n shouldYield(): boolean {\r\n const nextUpdate = this.updateQueue.peek();\r\n if (!nextUpdate) return false;\r\n\r\n const currentPriorityLevel = this.getPriorityLevel(this.currentPriority);\r\n const nextPriorityLevel = this.getPriorityLevel(nextUpdate.priority);\r\n\r\n return nextPriorityLevel < currentPriorityLevel;\r\n }\r\n\r\n private getPriorityLevel(priority: Priority): number {\r\n const levels = { immediate: 0, high: 1, normal: 2, low: 3, idle: 4 };\r\n return levels[priority];\r\n }\r\n}\r\n\r\n// Global scheduler instance\r\nconst scheduler = new FynixScheduler();\r\n\r\n// ---------------------- Fiber Architecture ----------------------\r\n\r\nclass FiberRenderer {\r\n private workInProgressRoot: FynixFiber | null = null;\r\n private nextUnitOfWork: FynixFiber | null = null;\r\n private currentRoot: FynixFiber | null = null;\r\n private deletions: FynixFiber[] = [];\r\n\r\n scheduleWork(fiber: FynixFiber): void {\r\n this.workInProgressRoot = {\r\n ...fiber,\r\n alternate: this.currentRoot,\r\n };\r\n this.nextUnitOfWork = this.workInProgressRoot;\r\n this.deletions = [];\r\n\r\n scheduler.schedule(\r\n {\r\n id: \"\",\r\n type: \"layout\",\r\n priority: \"high\",\r\n callback: () => this.workLoop(5),\r\n timestamp: performance.now(),\r\n },\r\n \"high\"\r\n );\r\n }\r\n\r\n workLoop(deadline: number): void {\r\n const startTime = performance.now();\r\n\r\n while (this.nextUnitOfWork && performance.now() - startTime < deadline) {\r\n this.nextUnitOfWork = this.performUnitOfWork(this.nextUnitOfWork);\r\n }\r\n\r\n if (!this.nextUnitOfWork && this.workInProgressRoot) {\r\n // Commit phase\r\n this.commitRoot();\r\n } else if (this.nextUnitOfWork) {\r\n // Continue work in next frame\r\n scheduler.schedule(\r\n {\r\n id: \"\",\r\n type: \"layout\",\r\n priority: \"normal\",\r\n callback: () => this.workLoop(5),\r\n timestamp: performance.now(),\r\n },\r\n \"normal\"\r\n );\r\n }\r\n }\r\n\r\n performUnitOfWork(fiber: FynixFiber): FynixFiber | null {\r\n // Reconcile children\r\n this.reconcileChildren(fiber, fiber.props?.children || []);\r\n\r\n // Return next unit of work\r\n if (fiber.child) {\r\n return fiber.child;\r\n }\r\n\r\n let nextFiber: FynixFiber | null = fiber;\r\n while (nextFiber) {\r\n if (nextFiber.sibling) {\r\n return nextFiber.sibling;\r\n }\r\n nextFiber = nextFiber.parent;\r\n }\r\n\r\n return null;\r\n }\r\n\r\n private reconcileChildren(wipFiber: FynixFiber, elements: any[]): void {\r\n let index = 0;\r\n let oldFiber = wipFiber.alternate?.child;\r\n let prevSibling: FynixFiber | null = null;\r\n\r\n while (index < elements.length || oldFiber != null) {\r\n const element = elements[index];\r\n let newFiber: FynixFiber | null = null;\r\n\r\n const sameType = oldFiber && element && element.type === oldFiber.type;\r\n\r\n if (sameType && oldFiber) {\r\n // Update the fiber\r\n newFiber = {\r\n type: oldFiber.type,\r\n props: element.props,\r\n key: element.key,\r\n _domNode: oldFiber._domNode,\r\n parent: wipFiber,\r\n alternate: oldFiber,\r\n effectTag: \"UPDATE\",\r\n updatePriority: \"normal\",\r\n child: null,\r\n sibling: null,\r\n _rendered: null,\r\n };\r\n }\r\n\r\n if (element && !sameType) {\r\n // Create new fiber\r\n newFiber = {\r\n type: element.type,\r\n props: element.props,\r\n key: element.key,\r\n _domNode: null,\r\n parent: wipFiber,\r\n alternate: null,\r\n effectTag: \"PLACEMENT\",\r\n updatePriority: \"normal\",\r\n child: null,\r\n sibling: null,\r\n _rendered: null,\r\n };\r\n }\r\n\r\n if (oldFiber && !sameType) {\r\n // Delete old fiber\r\n oldFiber.effectTag = \"DELETION\";\r\n this.deletions.push(oldFiber);\r\n }\r\n\r\n if (oldFiber) {\r\n oldFiber = oldFiber.sibling;\r\n }\r\n\r\n if (index === 0) {\r\n wipFiber.child = newFiber;\r\n } else if (newFiber && prevSibling) {\r\n prevSibling.sibling = newFiber;\r\n }\r\n\r\n prevSibling = newFiber;\r\n index++;\r\n }\r\n }\r\n\r\n private commitRoot(): void {\r\n this.deletions.forEach((fiber) => this.commitWork(fiber));\r\n if (this.workInProgressRoot?.child) {\r\n this.commitWork(this.workInProgressRoot.child);\r\n }\r\n this.currentRoot = this.workInProgressRoot;\r\n this.workInProgressRoot = null;\r\n }\r\n\r\n private commitWork(fiber: FynixFiber | null): void {\r\n if (!fiber) return;\r\n\r\n let domParentFiber = fiber.parent;\r\n while (!domParentFiber?._domNode) {\r\n domParentFiber = domParentFiber?.parent || null;\r\n }\r\n\r\n const domParent = domParentFiber?._domNode;\r\n\r\n if (fiber.effectTag === \"PLACEMENT\" && fiber._domNode && domParent) {\r\n domParent.appendChild(fiber._domNode);\r\n } else if (fiber.effectTag === \"UPDATE\" && fiber._domNode) {\r\n // Update DOM properties\r\n this.updateDom(\r\n fiber._domNode as Element,\r\n fiber.alternate?.props || {},\r\n fiber.props\r\n );\r\n } else if (fiber.effectTag === \"DELETION\" && domParent) {\r\n this.commitDeletion(fiber, domParent);\r\n }\r\n\r\n this.commitWork(fiber.child);\r\n this.commitWork(fiber.sibling);\r\n }\r\n\r\n private commitDeletion(fiber: FynixFiber, domParent: Node): void {\r\n if (fiber._domNode) {\r\n domParent.removeChild(fiber._domNode);\r\n } else if (fiber.child) {\r\n this.commitDeletion(fiber.child, domParent);\r\n }\r\n }\r\n\r\n private updateDom(dom: Element, prevProps: any, nextProps: any): void {\r\n // Remove old properties\r\n Object.keys(prevProps)\r\n .filter((key) => key !== \"children\" && !(key in nextProps))\r\n .forEach((name) => {\r\n if (name.startsWith(\"on\")) {\r\n const eventType = name.toLowerCase().substring(2);\r\n (dom as any).removeEventListener(eventType, prevProps[name]);\r\n } else {\r\n (dom as any)[name] = \"\";\r\n }\r\n });\r\n\r\n // Set new properties\r\n Object.keys(nextProps)\r\n .filter((key) => key !== \"children\")\r\n .forEach((name) => {\r\n if (prevProps[name] !== nextProps[name]) {\r\n if (name.startsWith(\"on\")) {\r\n const eventType = name.toLowerCase().substring(2);\r\n (dom as any).addEventListener(eventType, nextProps[name]);\r\n } else {\r\n (dom as any)[name] = nextProps[name];\r\n }\r\n }\r\n });\r\n }\r\n}\r\n\r\n// Global fiber renderer instance\r\nconst fiberRenderer = new FiberRenderer();\r\n\r\n// Export for use in enhanced rendering\r\nexport function useFiberRenderer(): FiberRenderer {\r\n return fiberRenderer;\r\n}\r\n\r\n// ---------------------- Enhanced State Store ----------------------\r\n\r\ninterface StoreNode<T = any> {\r\n path: string;\r\n value: T;\r\n children: Map<string, StoreNode>;\r\n subscribers: Set<() => void>;\r\n selector?: (state: any) => T;\r\n}\r\n\r\nclass HierarchicalStore {\r\n private root = new Map<string, StoreNode>();\r\n private selectorCache = new Map<string, any>();\r\n private stateSnapshot: any = {};\r\n\r\n select<T>(selector: (state: any) => T): T {\r\n const selectorKey = selector.toString();\r\n\r\n if (this.selectorCache.has(selectorKey)) {\r\n return this.selectorCache.get(selectorKey);\r\n }\r\n\r\n const result = selector(this.getState());\r\n this.selectorCache.set(selectorKey, result);\r\n\r\n return result;\r\n }\r\n\r\n optimisticUpdate<T>(path: string, update: T, rollback?: () => void) {\r\n const original = this.get(path);\r\n this.set(path, update);\r\n\r\n return {\r\n commit: () => this.clearRollback(path),\r\n rollback: () => {\r\n this.set(path, original);\r\n rollback?.();\r\n },\r\n };\r\n }\r\n\r\n private getState(): any {\r\n return this.stateSnapshot;\r\n }\r\n\r\n private get(path: string): any {\r\n return this.root.get(path)?.value;\r\n }\r\n\r\n private set(path: string, value: any): void {\r\n const node = this.root.get(path);\r\n if (node) {\r\n node.value = value;\r\n this.stateSnapshot = { ...this.stateSnapshot, [path]: value };\r\n this.invalidateSelectors();\r\n }\r\n }\r\n\r\n private clearRollback(path: string): void {\r\n // Mark optimistic update as committed - no rollback needed\r\n // This could involve clearing rollback data or updating transaction logs\r\n console.log(\r\n `[HierarchicalStore] Optimistic update committed for path: ${path}`\r\n );\r\n }\r\n\r\n private invalidateSelectors(): void {\r\n this.selectorCache.clear();\r\n }\r\n}\r\n\r\n// Global hierarchical store instance\r\nconst hierarchicalStore = new HierarchicalStore();\r\n\r\n// Export for advanced state management\r\nexport function useHierarchicalStore(): HierarchicalStore {\r\n return hierarchicalStore;\r\n}\r\n// ---------------------- Symbols ----------------------\r\n\r\nexport const TEXT = Symbol(\"text\");\r\nexport const Fragment = Symbol(\"Fragment\");\r\n\r\n// ---------------------- Constants ----------------------\r\n\r\nconst BOOLEAN_ATTRS = new Set([\r\n \"checked\",\r\n \"selected\",\r\n \"disabled\",\r\n \"readonly\",\r\n \"multiple\",\r\n \"autoplay\",\r\n \"controls\",\r\n \"loop\",\r\n \"muted\",\r\n \"open\",\r\n \"required\",\r\n \"reversed\",\r\n \"scoped\",\r\n \"seamless\",\r\n \"autofocus\",\r\n \"novalidate\",\r\n \"formnovalidate\",\r\n]);\r\n\r\nconst DOM_PROPERTIES = new Set([\r\n \"value\",\r\n \"checked\",\r\n \"selected\",\r\n \"selectedIndex\",\r\n \"innerHTML\",\r\n \"textContent\",\r\n \"innerText\",\r\n]);\r\n\r\n// Security: Dangerous HTML properties that should be sanitized\r\nconst DANGEROUS_HTML_PROPS = new Set([\r\n \"innerHTML\",\r\n \"outerHTML\",\r\n \"insertAdjacentHTML\",\r\n \"srcdoc\",\r\n]);\r\n\r\n// Security: Dangerous URL protocols\r\nconst DANGEROUS_PROTOCOLS = new Set([\r\n \"javascript:\",\r\n \"data:\",\r\n \"vbscript:\",\r\n \"file:\",\r\n \"about:\",\r\n]);\r\n\r\n// Security: Allowed URL protocols\r\nconst SAFE_PROTOCOLS = new Set([\r\n \"http:\",\r\n \"https:\",\r\n \"ftp:\",\r\n \"ftps:\",\r\n \"mailto:\",\r\n \"tel:\",\r\n \"#\",\r\n \"/\",\r\n \"./\",\r\n \"../\",\r\n]);\r\n\r\n// ---------------------- Virtual Node Helpers ----------------------\r\n\r\n/**\r\n * Creates a text virtual node from any value\r\n * Handles reactive state values by subscribing to changes\r\n *\r\n * @param text - Any value to convert to text (string, number, reactive state, etc.)\r\n * @returns VNode representing the text content\r\n *\r\n * @example\r\n * ```typescript\r\n * const textNode = createTextVNode(\"Hello World\");\r\n * const reactiveText = createTextVNode(nixState(\"Dynamic Text\"));\r\n * ```\r\n */\r\nexport function createTextVNode(text: any): VNode {\r\n if (text == null || text === false) {\r\n return { type: TEXT, props: { nodeValue: \"\" }, key: null };\r\n }\r\n\r\n if (text && typeof text === \"object\" && text._isNixState) {\r\n const vnode: VNode = {\r\n type: TEXT,\r\n props: { nodeValue: String(text.value) },\r\n key: null,\r\n _state: text,\r\n _cleanup: null,\r\n };\r\n\r\n vnode._cleanup = text.subscribe(() => {\r\n if (vnode._domNode) {\r\n (vnode._domNode as Text).nodeValue = String(text.value);\r\n }\r\n });\r\n\r\n return vnode;\r\n }\r\n\r\n return { type: TEXT, props: { nodeValue: String(text) }, key: null };\r\n}\r\n\r\n/**\r\n * Creates a virtual node (hyperscript function)\r\n * The core function for creating virtual DOM elements\r\n *\r\n * @param type - Element type (string for HTML elements, symbol for special nodes, or component function)\r\n * @param props - Element properties and attributes (can be null)\r\n * @param children - Child elements (can be nested arrays, will be flattened)\r\n * @returns VNode representing the element\r\n *\r\n * @example\r\n * ```typescript\r\n * // HTML element\r\n * const div = h('div', { class: 'container' }, 'Hello');\r\n *\r\n * // Component\r\n * const component = h(MyComponent, { prop: 'value' });\r\n *\r\n * // Fragment\r\n * const fragment = h(Fragment, null, child1, child2);\r\n * ```\r\n */\r\nexport function h(\r\n type: VNodeType,\r\n props: VNodeProps | null = null,\r\n ...children: VNodeChildren[]\r\n): VNode {\r\n const normalizedProps: VNodeProps =\r\n props === null || typeof props !== \"object\" || Array.isArray(props)\r\n ? {}\r\n : props;\r\n\r\n const flatChildren: VNode[] = [];\r\n\r\n for (const c of children.flat(Infinity)) {\r\n if (c == null || c === false) continue;\r\n\r\n if (c && typeof c === \"object\" && \"_isNixState\" in c) {\r\n flatChildren.push(createTextVNode(c));\r\n } else if (typeof c === \"string\" || typeof c === \"number\") {\r\n flatChildren.push(createTextVNode(c));\r\n } else if (c && typeof c === \"object\" && \"type\" in c) {\r\n if (c.type === Fragment) {\r\n const fragmentChildren = (c.props.children || []).filter(\r\n (x: any) => x != null && x !== false\r\n );\r\n flatChildren.push(...fragmentChildren);\r\n } else {\r\n flatChildren.push(c as VNode);\r\n }\r\n } else if (typeof c === \"function\") {\r\n // Preserve function children as-is (used by components like <For>)\r\n flatChildren.push(c as any);\r\n } else {\r\n flatChildren.push(createTextVNode(String(c)));\r\n }\r\n }\r\n\r\n const key = normalizedProps.key ?? null;\r\n if (key !== undefined) delete normalizedProps.key;\r\n\r\n if (type === Fragment) {\r\n return { type: Fragment, props: { children: flatChildren }, key };\r\n }\r\n\r\n return {\r\n type,\r\n props: { ...normalizedProps, children: flatChildren },\r\n key,\r\n };\r\n}\r\n\r\nh.Fragment = ({ children }: { children?: VNode[] }) => children || [];\r\n\r\nexport const Fynix = h;\r\nFynix.Fragment = h.Fragment;\r\n\r\n// ---------------------- Component Management ----------------------\r\n\r\nconst componentInstances = new WeakMap<VNode, ComponentContext>();\r\nlet rootRenderFn: (() => Promise<void>) | null = null;\r\nconst pendingRerenders = new WeakSet<ComponentContext>();\r\n\r\n/**\r\n * Initializes or retrieves a component context for rendering\r\n * Sets up the component's hooks, state tracking, and lifecycle management\r\n *\r\n * @param vnode - The virtual node representing the component\r\n * @returns ComponentContext for the component\r\n *\r\n * @internal Used by the runtime for component lifecycle management\r\n */\r\nfunction beginComponent(vnode: VNode): ComponentContext {\r\n let ctx = componentInstances.get(vnode);\r\n\r\n if (!ctx) {\r\n ctx = {\r\n hooks: [],\r\n hookIndex: 0,\r\n effects: [],\r\n cleanups: [],\r\n _vnode: vnode,\r\n _accessedStates: new Set(),\r\n _subscriptions: new Set(),\r\n _subscriptionCleanups: [],\r\n version: 0,\r\n rerender: null,\r\n Component: vnode.type as ComponentFunction,\r\n _isMounted: false,\r\n _isRerendering: false,\r\n };\r\n componentInstances.set(vnode, ctx);\r\n }\r\n\r\n ctx.hookIndex = 0;\r\n ctx._accessedStates.clear();\r\n setActiveContext(ctx);\r\n ctx.version++;\r\n\r\n return ctx;\r\n}\r\n\r\n/**\r\n * Finalizes component rendering and sets up reactive subscriptions\r\n * Handles state change subscriptions and cleanup for component reactivity\r\n *\r\n * @internal Used by the runtime after component rendering\r\n */\r\nfunction endComponent(): void {\r\n const ctx = activeContext as ComponentContext | null;\r\n if (!ctx) return;\r\n\r\n ctx._accessedStates.forEach((state) => {\r\n if (!ctx._subscriptions.has(state)) {\r\n if (!ctx.rerender) {\r\n let rerenderTimeout: NodeJS.Timeout | null = null;\r\n\r\n ctx.rerender = function rerender() {\r\n if (ctx._isRerendering || pendingRerenders.has(ctx)) {\r\n return;\r\n }\r\n\r\n if (rerenderTimeout) {\r\n clearTimeout(rerenderTimeout);\r\n }\r\n\r\n rerenderTimeout = setTimeout(async () => {\r\n if (ctx._isRerendering || !ctx._isMounted) return;\r\n\r\n ctx._isRerendering = true;\r\n pendingRerenders.add(ctx);\r\n\r\n try {\r\n removeErrorOverlay();\r\n\r\n const vnode = ctx._vnode;\r\n const oldRendered = vnode._rendered;\r\n\r\n beginComponent(vnode);\r\n const result = ctx.Component(vnode.props);\r\n const newRendered =\r\n result instanceof Promise ? await result : result;\r\n endComponent();\r\n\r\n vnode._rendered = newRendered;\r\n\r\n const domNode = vnode._domNode;\r\n if (domNode && domNode.parentNode) {\r\n await patch(domNode.parentNode, newRendered, oldRendered);\r\n if (newRendered && typeof newRendered === \"object\") {\r\n vnode._domNode = (newRendered as VNode)._domNode;\r\n }\r\n ctx._isRerendering = false;\r\n pendingRerenders.delete(ctx);\r\n } else if (rootRenderFn) {\r\n await rootRenderFn();\r\n ctx._isRerendering = false;\r\n pendingRerenders.delete(ctx);\r\n } else {\r\n ctx._isRerendering = false;\r\n pendingRerenders.delete(ctx);\r\n }\r\n } catch (err) {\r\n console.error(\"[Fynix] Component rerender error:\", err);\r\n showErrorOverlay(err as Error);\r\n ctx._isRerendering = false;\r\n pendingRerenders.delete(ctx);\r\n }\r\n\r\n rerenderTimeout = null;\r\n }, 0);\r\n };\r\n }\r\n\r\n const unsub = state.subscribe(() => {\r\n if (ctx.rerender && ctx._isMounted) {\r\n if (typeof queueMicrotask === \"function\") {\r\n queueMicrotask(() => ctx.rerender!());\r\n } else {\r\n setTimeout(ctx.rerender, 0);\r\n }\r\n }\r\n });\r\n\r\n ctx._subscriptions.add(state);\r\n ctx._subscriptionCleanups.push(unsub);\r\n }\r\n });\r\n\r\n setActiveContext(null);\r\n}\r\n\r\n/**\r\n * Renders a component function with given props\r\n * Handles both synchronous and asynchronous components\r\n *\r\n * @param Component - The component function to render\r\n * @param props - Properties to pass to the component\r\n * @returns VNode result of the component rendering\r\n *\r\n * @example\r\n * ```typescript\r\n * const MyComponent = (props) => h('div', null, props.message);\r\n * const rendered = renderComponent(MyComponent, { message: 'Hello' });\r\n * ```\r\n */\r\nexport function renderComponent(\r\n Component: ComponentFunction,\r\n props: any = {}\r\n): VNode {\r\n const vnode: VNode = { type: Component, props, key: null };\r\n const ctx = beginComponent(vnode);\r\n ctx.Component = Component;\r\n\r\n if (!ctx.rerender) {\r\n let rerenderTimeout: NodeJS.Timeout | null = null;\r\n\r\n ctx.rerender = () => {\r\n if (ctx._isRerendering || pendingRerenders.has(ctx)) return;\r\n\r\n if (rerenderTimeout) {\r\n clearTimeout(rerenderTimeout);\r\n }\r\n\r\n rerenderTimeout = setTimeout(async () => {\r\n if (ctx._isRerendering || !ctx._isMounted) return;\r\n\r\n ctx._isRerendering = true;\r\n pendingRerenders.add(ctx);\r\n\r\n try {\r\n removeErrorOverlay();\r\n\r\n const vnode = ctx._vnode;\r\n const oldRendered = vnode._rendered;\r\n\r\n beginComponent(vnode);\r\n const result = ctx.Component(vnode.props);\r\n const newRendered = result instanceof Promise ? await result : result;\r\n endComponent();\r\n\r\n vnode._rendered = newRendered;\r\n\r\n const domNode = vnode._domNode;\r\n if (domNode && domNode.parentNode) {\r\n await patch(domNode.parentNode, newRendered, oldRendered);\r\n if (newRendered && typeof newRendered === \"object\") {\r\n vnode._domNode = (newRendered as VNode)._domNode;\r\n }\r\n ctx._isRerendering = false;\r\n pendingRerenders.delete(ctx);\r\n } else if (rootRenderFn) {\r\n await rootRenderFn();\r\n ctx._isRerendering = false;\r\n pendingRerenders.delete(ctx);\r\n } else {\r\n ctx._isRerendering = false;\r\n pendingRerenders.delete(ctx);\r\n }\r\n } catch (err) {\r\n console.error(\"[Fynix] Component rerender error:\", err);\r\n showErrorOverlay(err as Error);\r\n ctx._isRerendering = false;\r\n pendingRerenders.delete(ctx);\r\n }\r\n\r\n rerenderTimeout = null;\r\n }, 0);\r\n };\r\n }\r\n\r\n try {\r\n removeErrorOverlay();\r\n const result = Component(props);\r\n\r\n // Handle both sync and async components\r\n if (result instanceof Promise) {\r\n // For async components, return a placeholder and handle async rendering\r\n const placeholderVNode = h(\"div\", null, \"Loading...\");\r\n ctx._vnode = vnode;\r\n vnode._rendered = placeholderVNode;\r\n ctx._isMounted = true;\r\n\r\n result\r\n .then((resolvedVNode) => {\r\n vnode._rendered = resolvedVNode;\r\n if (ctx.rerender) {\r\n ctx.rerender();\r\n }\r\n })\r\n .catch((err) => {\r\n console.error(\"[Fynix] Async component error:\", err);\r\n showErrorOverlay(err as Error);\r\n });\r\n\r\n return placeholderVNode;\r\n }\r\n\r\n ctx._vnode = vnode;\r\n vnode._rendered = result;\r\n ctx._isMounted = true;\r\n return result;\r\n } catch (err) {\r\n console.error(\"[Fynix] Component render error:\", err);\r\n showErrorOverlay(err as Error);\r\n return h(\r\n \"div\",\r\n { style: \"color:red\" },\r\n `Error: ${sanitizeErrorMessage(err)}`\r\n );\r\n } finally {\r\n endComponent();\r\n }\r\n}\r\n\r\n// ---------------------- Event Delegation ----------------------\r\n\r\nconst delegatedEvents = new Map<string, Map<number, (e: Event) => void>>();\r\nlet eventIdCounter = 1;\r\n\r\n/**\r\n * Ensures event delegation is set up for a specific event type\r\n * Creates a global event listener that delegates to specific elements\r\n *\r\n * @param eventType - The event type to delegate (e.g., 'click', 'change')\r\n *\r\n * @internal Used by the event system for performance optimization\r\n */\r\nfunction ensureDelegated(eventType: string): void {\r\n if (delegatedEvents.has(eventType)) return;\r\n\r\n delegatedEvents.set(eventType, new Map());\r\n\r\n document.addEventListener(eventType, (e: Event) => {\r\n let cur: Node | null = e.target as Node;\r\n\r\n while (cur && cur !== document) {\r\n if (cur.nodeType !== 1) break;\r\n\r\n const el = cur as any;\r\n const eid = el._rest_eid;\r\n const map = delegatedEvents.get(eventType);\r\n\r\n if (eid != null && map?.has(eid)) {\r\n map.get(eid)!(e);\r\n return;\r\n }\r\n\r\n cur = (cur as Element).parentElement;\r\n }\r\n });\r\n}\r\n\r\n/**\r\n * Registers an event handler using the delegation system\r\n * More efficient than individual event listeners on each element\r\n *\r\n * @param el - The HTML element to attach the handler to\r\n * @param eventName - Name of the event (without 'on' prefix)\r\n * @param fn - Event handler function\r\n *\r\n * @internal Used when processing r- prefixed event attributes\r\n */\r\nfunction registerDelegatedHandler(\r\n el: HTMLElement,\r\n eventName: string,\r\n fn: (e: Event) => void\r\n): void {\r\n if (!fn || el.nodeType !== 1) return;\r\n\r\n const anyEl = el as any;\r\n const eid = anyEl._rest_eid ?? (anyEl._rest_eid = ++eventIdCounter);\r\n\r\n ensureDelegated(eventName);\r\n\r\n delegatedEvents.get(eventName)!.set(eid, (e: Event) => {\r\n try {\r\n fn.call(el, e);\r\n } catch (err) {\r\n console.error(\"[Fynix] Event handler error:\", err);\r\n showErrorOverlay(err as Error);\r\n }\r\n });\r\n}\r\n\r\n// ---------------------- Security Helpers ----------------------\r\n\r\n/**\r\n * Sanitizes text content to prevent XSS attacks\r\n */\r\nfunction sanitizeText(text: string): string {\r\n if (typeof text !== \"string\") return String(text);\r\n\r\n // Remove potentially dangerous characters and patterns\r\n return text\r\n .replace(/[<>\"'&]/g, (match) => {\r\n const entityMap: Record<string, string> = {\r\n \"<\": \"&lt;\",\r\n \">\": \"&gt;\",\r\n '\"': \"&quot;\",\r\n \"'\": \"&#x27;\",\r\n \"&\": \"&amp;\",\r\n };\r\n return entityMap[match] || match;\r\n })\r\n .replace(/javascript:/gi, \"blocked:\")\r\n .replace(/data:.*?base64/gi, \"blocked:\");\r\n}\r\n\r\n/**\r\n * Sanitizes attribute values\r\n */\r\nfunction sanitizeAttributeValue(value: string): string {\r\n if (typeof value !== \"string\") return String(value);\r\n\r\n return value\r\n .replace(/[\"'<>]/g, (match) => {\r\n const entityMap: Record<string, string> = {\r\n '\"': \"&quot;\",\r\n \"'\": \"&#x27;\",\r\n \"<\": \"&lt;\",\r\n \">\": \"&gt;\",\r\n };\r\n return entityMap[match] || match;\r\n })\r\n .replace(/javascript:/gi, \"blocked:\")\r\n .replace(/on\\w+=/gi, \"blocked=\");\r\n}\r\n\r\n/**\r\n * Validates and sanitizes error messages to prevent XSS\r\n */\r\nfunction sanitizeErrorMessage(error: any): string {\r\n if (!error) return \"Unknown error\";\r\n\r\n const message = error.message || error.toString() || \"Unknown error\";\r\n return sanitizeText(String(message)).slice(0, 200); // Limit length\r\n}\r\n\r\n// ---------------------- Property Setter ----------------------\r\n\r\n/**\r\n * Sets a property or attribute on an HTML element with security validation\r\n * Handles special cases like reactive classes, events, and dangerous properties\r\n *\r\n * @param el - The HTML element to modify\r\n * @param key - Property/attribute name\r\n * @param value - Value to set\r\n *\r\n * @security Blocks dangerous properties like innerHTML and validates URLs\r\n *\r\n * @internal Used during DOM creation and updates\r\n */\r\nfunction setProperty(el: HTMLElement, key: string, value: any): void {\r\n const k = key.toLowerCase();\r\n\r\n if (key === \"r-class\" || key === \"rc\") {\r\n if (typeof value === \"string\") {\r\n el.setAttribute(\"class\", value);\r\n } else if (value && (value._isNixState || value._isRestState)) {\r\n el.setAttribute(\"class\", value.value);\r\n\r\n const anyEl = el as any;\r\n if (!anyEl._fynixCleanups) anyEl._fynixCleanups = [];\r\n\r\n const unsub = value.subscribe(() =>\r\n el.setAttribute(\"class\", value.value)\r\n );\r\n anyEl._fynixCleanups.push(unsub);\r\n }\r\n return;\r\n }\r\n\r\n if (key.startsWith(\"r-\")) {\r\n registerDelegatedHandler(el, key.slice(2).toLowerCase(), value);\r\n return;\r\n }\r\n\r\n if (key === \"style\" && typeof value === \"object\") {\r\n Object.assign(el.style, value);\r\n return;\r\n }\r\n\r\n // Security: Block dangerous HTML properties completely\r\n if (DANGEROUS_HTML_PROPS.has(key)) {\r\n console.error(\r\n `[Fynix] Security: ${key} is blocked for security reasons. Use textContent or children instead.`\r\n );\r\n return;\r\n }\r\n\r\n // Security: Validate URL attributes more thoroughly\r\n if (\r\n (key === \"href\" ||\r\n key === \"src\" ||\r\n key === \"action\" ||\r\n key === \"formaction\") &&\r\n typeof value === \"string\"\r\n ) {\r\n const normalizedValue = value.trim().toLowerCase();\r\n\r\n // Check for dangerous protocols (blacklist)\r\n for (const protocol of DANGEROUS_PROTOCOLS) {\r\n if (normalizedValue.startsWith(protocol)) {\r\n console.error(\r\n `[Fynix] Security: ${protocol} protocol blocked in ${key}`\r\n );\r\n return;\r\n }\r\n }\r\n\r\n // Validate against safe protocols (whitelist) - more secure approach\r\n if (normalizedValue.includes(\":\")) {\r\n const protocol = normalizedValue.split(\":\")[0] + \":\";\r\n if (\r\n !SAFE_PROTOCOLS.has(protocol) &&\r\n !SAFE_PROTOCOLS.has(normalizedValue.charAt(0))\r\n ) {\r\n console.error(\r\n `[Fynix] Security: Protocol '${protocol}' not in safe list for ${key}`\r\n );\r\n return;\r\n }\r\n }\r\n\r\n // Additional validation for data: URLs (can contain base64 encoded scripts)\r\n if (normalizedValue.startsWith(\"data:\")) {\r\n if (\r\n normalizedValue.includes(\"javascript\") ||\r\n normalizedValue.includes(\"<script\")\r\n ) {\r\n console.error(\r\n `[Fynix] Security: Suspicious data: URL blocked in ${key}`\r\n );\r\n return;\r\n }\r\n }\r\n }\r\n\r\n // Security: Sanitize event handler attributes\r\n if (key.toLowerCase().startsWith(\"on\") && key !== \"open\") {\r\n console.error(\r\n `[Fynix] Security: Inline event handler '${key}' blocked. Use r-${key.slice(2)} instead.`\r\n );\r\n return;\r\n }\r\n\r\n if (BOOLEAN_ATTRS.has(k)) {\r\n if (value) {\r\n el.setAttribute(k, \"\");\r\n (el as any)[k] = true;\r\n } else {\r\n el.removeAttribute(k);\r\n (el as any)[k] = false;\r\n }\r\n return;\r\n }\r\n\r\n if (DOM_PROPERTIES.has(key) && !DANGEROUS_HTML_PROPS.has(key)) {\r\n // Security: Sanitize textContent and innerText\r\n if (key === \"textContent\" || key === \"innerText\") {\r\n (el as any)[key] = sanitizeText(value ?? \"\");\r\n } else {\r\n (el as any)[key] = value ?? \"\";\r\n }\r\n return;\r\n }\r\n\r\n if (key.startsWith(\"data-\") || key.startsWith(\"aria-\")) {\r\n if (value != null && value !== false) {\r\n // Security: Sanitize data and aria attributes\r\n el.setAttribute(key, sanitizeAttributeValue(String(value)));\r\n } else {\r\n el.removeAttribute(key);\r\n }\r\n return;\r\n }\r\n\r\n if (value != null && value !== false) {\r\n el.setAttribute(key, value);\r\n }\r\n}\r\n\r\n// ---------------------- DOM Creation ----------------------\r\n\r\n/**\r\n * Creates actual DOM nodes from virtual nodes\r\n * Handles all types of vnodes including components, text, and fragments\r\n *\r\n * @param vnode - Virtual node or primitive value to create DOM for\r\n * @param existing - Existing DOM node to reuse (optional)\r\n * @returns Promise resolving to the created DOM node\r\n *\r\n * @example\r\n * ```typescript\r\n * const vnode = h('div', { class: 'test' }, 'Hello');\r\n * const domNode = await createDom(vnode);\r\n * document.body.appendChild(domNode);\r\n * ```\r\n *\r\n * @internal Core function for DOM creation\r\n */\r\nasync function createDom(\r\n vnode: VNode | string | number | Promise<any> | null | undefined,\r\n existing: Node | null = null\r\n): Promise<Node> {\r\n if (vnode == null) {\r\n return document.createTextNode(\"\");\r\n }\r\n\r\n if (typeof vnode === \"string\" || typeof vnode === \"number\") {\r\n return document.createTextNode(String(vnode));\r\n }\r\n\r\n if (vnode instanceof Promise) {\r\n const placeholder = document.createTextNode(\"Loading...\");\r\n\r\n vnode\r\n .then(async (resolved) => {\r\n try {\r\n const dom = await createDom(resolved);\r\n if (placeholder.parentNode) {\r\n placeholder.replaceWith(dom);\r\n }\r\n } catch (err) {\r\n console.error(\"[Fynix] Async component error:\", err);\r\n if (placeholder.parentNode) {\r\n placeholder.textContent = \"Error loading component\";\r\n }\r\n }\r\n })\r\n .catch((err) => {\r\n console.error(\"[Fynix] Async component promise error:\", err);\r\n if (placeholder.parentNode) {\r\n placeholder.textContent = \"Error loading async component\";\r\n }\r\n });\r\n\r\n return placeholder;\r\n }\r\n\r\n const vnodeObj = vnode as VNode;\r\n\r\n if (vnodeObj.type === TEXT) {\r\n const textNode =\r\n existing || document.createTextNode(vnodeObj.props.nodeValue ?? \"\");\r\n vnodeObj._domNode = textNode;\r\n return textNode;\r\n }\r\n\r\n if (vnodeObj.type === Fragment) {\r\n const frag = document.createDocumentFragment();\r\n for (const child of vnodeObj.props?.children || []) {\r\n frag.appendChild(await createDom(child));\r\n }\r\n vnodeObj._domNode = frag;\r\n return frag;\r\n }\r\n\r\n if (typeof vnodeObj.type === \"function\") {\r\n const rendered = await renderMaybeAsyncComponent(\r\n vnodeObj.type as ComponentFunction,\r\n vnodeObj.props,\r\n vnodeObj\r\n );\r\n vnodeObj._rendered = rendered;\r\n const dom = await createDom(rendered);\r\n vnodeObj._domNode = dom;\r\n return dom;\r\n }\r\n\r\n const el = existing || document.createElement(vnodeObj.type as string);\r\n\r\n for (const [k, v] of Object.entries(vnodeObj.props || {})) {\r\n if (k !== \"children\") {\r\n setProperty(el as HTMLElement, k, v);\r\n }\r\n }\r\n\r\n for (const child of vnodeObj.props?.children || []) {\r\n el.appendChild(await createDom(child));\r\n }\r\n\r\n vnodeObj._domNode = el;\r\n return el;\r\n}\r\n\r\n// ---------------------- Async Component Helper ----------------------\r\n\r\n/**\r\n * Renders a component that may be synchronous or asynchronous\r\n * Handles the component lifecycle and error boundaries\r\n *\r\n * @param Component - Component function to render\r\n * @param props - Properties to pass to the component\r\n * @param vnode - Virtual node representing this component\r\n * @returns Promise resolving to the rendered VNode or null on error\r\n *\r\n * @internal Used for rendering components during DOM creation\r\n */\r\nasync function renderMaybeAsyncComponent(\r\n Component: ComponentFunction,\r\n props: any,\r\n vnode: VNode\r\n): Promise<VNode | null> {\r\n const ctx = beginComponent(vnode);\r\n removeErrorOverlay();\r\n\r\n try {\r\n const result = await Component(props);\r\n ctx._vnode = vnode;\r\n vnode._rendered = result;\r\n ctx._isMounted = true;\r\n endComponent();\r\n return result ?? null;\r\n } catch (err) {\r\n console.error(\"[Fynix] async render error:\", err);\r\n showErrorOverlay(err as Error);\r\n ctx._isMounted = false;\r\n endComponent();\r\n return h(\r\n \"div\",\r\n { style: \"color:red\" },\r\n `Error: ${sanitizeErrorMessage(err)}`\r\n );\r\n }\r\n}\r\n\r\n// ---------------------- Patch / Diff ----------------------\r\n\r\n/**\r\n * Efficiently updates the DOM by comparing old and new virtual nodes\r\n * Core diffing algorithm that minimizes DOM manipulations\r\n *\r\n * @param parent - Parent DOM node containing the elements to patch\r\n * @param newVNode - New virtual node or primitive value\r\n * @param oldVNode - Previous virtual node or primitive value\r\n *\r\n * @example\r\n * ```typescript\r\n * const oldVNode = h('div', null, 'Old text');\r\n * const newVNode = h('div', null, 'New text');\r\n * await patch(container, newVNode, oldVNode);\r\n * ```\r\n *\r\n * @public Core API for manual DOM updates\r\n */\r\nexport async function patch(\r\n parent: Node,\r\n newVNode: VNode | string | number | null | undefined,\r\n oldVNode: VNode | string | number | null | undefined\r\n): Promise<void> {\r\n if (!(parent instanceof Node)) {\r\n console.error(\r\n \"[Fynix] patch() expects a DOM Node, got:\",\r\n typeof parent,\r\n parent\r\n );\r\n return;\r\n }\r\n\r\n if (!newVNode && !oldVNode) return;\r\n\r\n if (!newVNode && oldVNode) {\r\n const domNode = (oldVNode as VNode)._domNode;\r\n if (domNode?.parentNode) {\r\n domNode.parentNode.removeChild(domNode);\r\n }\r\n unmountVNode(oldVNode as VNode);\r\n return;\r\n }\r\n\r\n if (newVNode && !oldVNode) {\r\n const newDom = await createDom(newVNode);\r\n if (newDom instanceof Node) {\r\n parent.appendChild(newDom);\r\n }\r\n return;\r\n }\r\n\r\n const newIsPrimitive =\r\n typeof newVNode === \"string\" || typeof newVNode === \"number\";\r\n const oldIsPrimitive =\r\n typeof oldVNode === \"string\" || typeof oldVNode === \"number\";\r\n\r\n if (newIsPrimitive || oldIsPrimitive) {\r\n if (\r\n newIsPrimitive &&\r\n oldIsPrimitive &&\r\n String(newVNode) === String(oldVNode)\r\n )\r\n return;\r\n\r\n const newDom = await createDom(newVNode);\r\n const oldDom = (oldVNode as VNode)?._domNode || parent.firstChild;\r\n\r\n if (oldDom?.parentNode && newDom instanceof Node) {\r\n oldDom.parentNode.replaceChild(newDom, oldDom);\r\n }\r\n\r\n if (oldVNode && typeof oldVNode === \"object\") {\r\n unmountVNode(oldVNode as VNode);\r\n }\r\n return;\r\n }\r\n\r\n const newVN = newVNode as VNode;\r\n const oldVN = oldVNode as VNode;\r\n\r\n const newType = newVN.type;\r\n const oldType = oldVN.type;\r\n\r\n if (newType !== oldType) {\r\n const newDom = await createDom(newVN);\r\n const oldDom = oldVN._domNode;\r\n\r\n if (oldDom?.parentNode && newDom instanceof Node) {\r\n oldDom.parentNode.replaceChild(newDom, oldDom);\r\n }\r\n\r\n unmountVNode(oldVN);\r\n return;\r\n }\r\n\r\n if (newType === TEXT) {\r\n const oldDom = oldVN._domNode;\r\n const newText = newVN.props.nodeValue ?? \"\";\r\n const oldText = oldVN.props.nodeValue ?? \"\";\r\n\r\n if (newText !== oldText && oldDom) {\r\n (oldDom as Text).nodeValue = newText;\r\n }\r\n\r\n newVN._domNode = oldDom;\r\n return;\r\n }\r\n\r\n if (newType === Fragment) {\r\n const newChildren = newVN.props?.children || [];\r\n const oldChildren = oldVN.props?.children || [];\r\n await patchChildren(parent, newChildren, oldChildren);\r\n newVN._domNode = oldVN._domNode;\r\n return;\r\n }\r\n\r\n if (typeof newType === \"function\") {\r\n const oldCtx = componentInstances.get(oldVN);\r\n\r\n if (oldCtx && newType === oldType) {\r\n componentInstances.delete(oldVN);\r\n componentInstances.set(newVN, oldCtx);\r\n\r\n oldCtx._vnode = newVN;\r\n\r\n beginComponent(newVN);\r\n const rendered = await oldCtx.Component(newVN.props);\r\n endComponent();\r\n\r\n newVN._rendered = rendered;\r\n\r\n const oldRendered = oldVN._rendered;\r\n const oldDom = oldVN._domNode;\r\n\r\n if (oldDom?.parentNode instanceof Node) {\r\n await patch(oldDom.parentNode, rendered, oldRendered);\r\n newVN._domNode = (rendered as VNode)?._domNode || oldDom;\r\n }\r\n } else {\r\n const rendered = await renderMaybeAsyncComponent(\r\n newType as ComponentFunction,\r\n newVN.props,\r\n newVN\r\n );\r\n newVN._rendered = rendered;\r\n\r\n const oldRendered = oldVN._rendered;\r\n const oldDom = oldVN._domNode;\r\n\r\n if (oldDom?.parentNode instanceof Node) {\r\n await patch(oldDom.parentNode, rendered, oldRendered);\r\n newVN._domNode = (rendered as VNode)?._domNode || oldDom;\r\n } else {\r\n const newDom = await createDom(rendered);\r\n if (parent && newDom instanceof Node) {\r\n parent.appendChild(newDom);\r\n }\r\n newVN._domNode = newDom;\r\n }\r\n\r\n if (oldCtx && newType !== oldType) {\r\n unmountVNode(oldVN);\r\n }\r\n }\r\n return;\r\n }\r\n\r\n const el = oldVN._domNode;\r\n if (!el || el.nodeType !== 1) {\r\n const newDom = await createDom(newVN);\r\n if (parent && newDom instanceof Node) {\r\n parent.appendChild(newDom);\r\n }\r\n unmountVNode(oldVN);\r\n return;\r\n }\r\n\r\n updateProps(el as HTMLElement, newVN.props, oldVN.props);\r\n newVN._domNode = el;\r\n\r\n const newChildren = newVN.props?.children || [];\r\n const oldChildren = oldVN.props?.children || [];\r\n await patchChildren(el, newChildren, oldChildren);\r\n}\r\n\r\n/**\r\n * Updates child elements using efficient diffing with key-based optimization\r\n * Handles both keyed and non-keyed reconciliation strategies\r\n *\r\n * @param parent - Parent DOM node containing the children\r\n * @param newChildren - Array of new child vnodes\r\n * @param oldChildren - Array of previous child vnodes\r\n *\r\n * @internal Used by the patch function for child reconciliation\r\n */\r\nasync function patchChildren(\r\n parent: Node,\r\n newChildren: VNode[],\r\n oldChildren: VNode[]\r\n): Promise<void> {\r\n if (!(parent instanceof Node)) return;\r\n\r\n const hasKeys =\r\n newChildren.some((c) => c?.key != null) ||\r\n oldChildren.some((c) => c?.key != null);\r\n\r\n if (!hasKeys) {\r\n const maxLen = Math.max(newChildren.length, oldChildren.length);\r\n\r\n for (let i = 0; i < maxLen; i++) {\r\n const newChild = newChildren[i];\r\n const oldChild = oldChildren[i];\r\n\r\n if (i >= newChildren.length) {\r\n const dom = oldChild?._domNode;\r\n if (dom?.parentNode) {\r\n dom.parentNode.removeChild(dom);\r\n }\r\n unmountVNode(oldChild);\r\n } else if (i >= oldChildren.length) {\r\n const newDom = await createDom(newChild);\r\n if (newDom instanceof Node) {\r\n parent.appendChild(newDom);\r\n }\r\n } else {\r\n await patch(parent, newChild, oldChild);\r\n }\r\n }\r\n return;\r\n }\r\n\r\n const oldKeyMap = new Map<string | number, VNode>();\r\n\r\n oldChildren.forEach((child) => {\r\n if (child?.key != null) {\r\n oldKeyMap.set(child.key, child);\r\n }\r\n });\r\n\r\n const newKeySet = new Set(\r\n newChildren.filter((c) => c?.key != null).map((c) => c.key!)\r\n );\r\n\r\n oldChildren.forEach((oldChild) => {\r\n if (oldChild?.key != null && !newKeySet.has(oldChild.key)) {\r\n const dom = oldChild._domNode;\r\n if (dom?.parentNode) {\r\n dom.parentNode.removeChild(dom);\r\n }\r\n unmountVNode(oldChild);\r\n }\r\n });\r\n\r\n for (let i = 0; i < newChildren.length; i++) {\r\n const newChild = newChildren[i];\r\n const key = newChild?.key;\r\n\r\n if (key != null && oldKeyMap.has(key)) {\r\n const oldChild = oldKeyMap.get(key)!;\r\n const oldDom = oldChild._domNode;\r\n const childNodes = Array.from(parent.childNodes);\r\n const currentPos = childNodes.indexOf(oldDom as ChildNode);\r\n const desiredPos = i;\r\n\r\n if (currentPos !== desiredPos) {\r\n const refNode = childNodes[desiredPos] || null;\r\n if (oldDom && oldDom.parentNode === parent) {\r\n parent.insertBefore(oldDom, refNode as ChildNode | null);\r\n }\r\n }\r\n\r\n await patch(parent, newChild, oldChild);\r\n } else {\r\n const newDom = await createDom(newChild);\r\n if (newDom instanceof Node) {\r\n const childNodes = Array.from(parent.childNodes);\r\n const refNode = childNodes[i] || null;\r\n parent.insertBefore(newDom, refNode as ChildNode | null);\r\n }\r\n }\r\n }\r\n}\r\n\r\n// ---------------------- Unmount ----------------------\r\n\r\n/**\r\n * Properly unmounts a virtual node and cleans up all associated resources\r\n * Handles component cleanup, subscriptions, effects, and event listeners\r\n *\r\n * @param vnode - Virtual node to unmount\r\n *\r\n * @example\r\n * ```typescript\r\n * // Cleanup when removing from DOM\r\n * unmountVNode(oldVNode);\r\n * ```\r\n *\r\n * @internal Critical for preventing memory leaks\r\n */\r\nfunction unmountVNode(vnode: VNode | any): void {\r\n if (!vnode) return;\r\n\r\n if (vnode._cleanup && typeof vnode._cleanup === \"function\") {\r\n try {\r\n vnode._cleanup();\r\n } catch (e) {\r\n console.error(\"[Fynix] Text vnode cleanup error:\", e);\r\n }\r\n vnode._cleanup = null;\r\n }\r\n\r\n if (typeof vnode.type === \"function\") {\r\n const ctx = componentInstances.get(vnode);\r\n\r\n if (ctx) {\r\n ctx._isMounted = false;\r\n\r\n ctx._subscriptionCleanups.forEach((u) => {\r\n try {\r\n u();\r\n } catch (e) {\r\n console.error(\"[Fynix] Cleanup error:\", e);\r\n }\r\n });\r\n\r\n ctx.cleanups.forEach((c) => {\r\n try {\r\n c?.();\r\n } catch (e) {\r\n console.error(\"[Fynix] Effect cleanup error:\", e);\r\n }\r\n });\r\n\r\n ctx._subscriptions.clear();\r\n ctx._accessedStates.clear();\r\n ctx._subscriptionCleanups = [];\r\n ctx.cleanups = [];\r\n ctx.hooks = [];\r\n ctx.effects = [];\r\n ctx.rerender = null;\r\n ctx._vnode = null as any;\r\n\r\n componentInstances.delete(vnode);\r\n pendingRerenders.delete(ctx);\r\n }\r\n\r\n unmountVNode(vnode._rendered);\r\n return;\r\n }\r\n\r\n if (vnode._domNode && vnode._domNode.nodeType === 1) {\r\n const anyNode = vnode._domNode as any;\r\n const eid = anyNode._rest_eid;\r\n\r\n if (eid) {\r\n delegatedEvents.forEach((map) => map.delete(eid));\r\n }\r\n\r\n if (anyNode._fynixCleanups) {\r\n anyNode._fynixCleanups.forEach((cleanup: () => void) => {\r\n try {\r\n cleanup();\r\n } catch (e) {\r\n console.error(\"[Fynix] Element cleanup error:\", e);\r\n }\r\n });\r\n anyNode._fynixCleanups = null;\r\n }\r\n }\r\n\r\n if (vnode.props?.children) {\r\n vnode.props.children.forEach((c: VNode) => unmountVNode(c));\r\n }\r\n\r\n vnode._domNode = null;\r\n vnode._rendered = null;\r\n}\r\n\r\n// ---------------------- Update Props ----------------------\r\n\r\n/**\r\n * Updates element properties by comparing old and new props\r\n * Efficiently adds, removes, and modifies attributes and properties\r\n *\r\n * @param el - HTML element to update\r\n * @param newProps - New properties object\r\n * @param oldProps - Previous properties object\r\n *\r\n * @internal Used during DOM patching to sync element state\r\n */\r\nfunction updateProps(\r\n el: HTMLElement,\r\n newProps: VNodeProps = {},\r\n oldProps: VNodeProps = {}\r\n): void {\r\n if (!el || el.nodeType !== 1) return;\r\n\r\n for (const k of Object.keys(oldProps)) {\r\n if (k === \"children\") continue;\r\n\r\n if (!(k in newProps)) {\r\n if (k.startsWith(\"r-\")) {\r\n const anyEl = el as any;\r\n const eid = anyEl._rest_eid;\r\n if (eid && delegatedEvents.has(k.slice(2).toLowerCase())) {\r\n delegatedEvents.get(k.slice(2).toLowerCase())!.delete(eid);\r\n }\r\n } else if (BOOLEAN_ATTRS.has(k.toLowerCase())) {\r\n el.removeAttribute(k);\r\n (el as any)[k] = false;\r\n } else if (DOM_PROPERTIES.has(k)) {\r\n (el as any)[k] = \"\";\r\n } else {\r\n el.removeAttribute(k);\r\n }\r\n }\r\n }\r\n\r\n for (const [k, v] of Object.entries(newProps)) {\r\n if (k === \"children\") continue;\r\n if (oldProps[k] !== v) {\r\n setProperty(el, k, v);\r\n }\r\n }\r\n}\r\n\r\n// ---------------------- Mount ----------------------\r\n\r\n/**\r\n * Mounts a Fynix application to a DOM element\r\n * Sets up the root component, handles HMR, and manages the application lifecycle\r\n *\r\n * @param AppComponent - Root component function for the application\r\n * @param root - CSS selector string or DOM element to mount to\r\n * @param props - Initial properties for the root component\r\n *\r\n * @example\r\n * ```typescript\r\n * const App = () => h('div', null, 'Hello Fynix!');\r\n * mount(App, '#root');\r\n *\r\n * // With props\r\n * mount(App, document.getElementById('app'), { theme: 'dark' });\r\n * ```\r\n *\r\n * @public Main entry point for Fynix applications\r\n */\r\nexport function mount(\r\n AppComponent: ComponentFunction,\r\n root: string | Element,\r\n props: any = {}\r\n): void {\r\n if (typeof root === \"string\") {\r\n const element = document.querySelector(root);\r\n if (!element) {\r\n console.error(\r\n \"[Fynix] Mount error: Element not found for selector:\",\r\n root\r\n );\r\n return;\r\n }\r\n root = element;\r\n }\r\n\r\n if (!(root instanceof Element)) {\r\n console.error(\"[Fynix] Mount error: Invalid root element\", root);\r\n return;\r\n }\r\n\r\n let Component = AppComponent;\r\n let oldVNode: VNode | null = null;\r\n let currentProps = props;\r\n let appVNode: VNode | null = null;\r\n let isRendering = false;\r\n\r\n async function renderApp(): Promise<void> {\r\n if (isRendering) return;\r\n\r\n isRendering = true;\r\n\r\n try {\r\n removeErrorOverlay();\r\n\r\n const win = window as any;\r\n const propsToUse =\r\n win.__lastRouteProps || win.__fynix__?.lastRouteProps || currentProps;\r\n\r\n if (!appVNode) {\r\n appVNode = { type: Component, props: propsToUse, key: null };\r\n\r\n if (root instanceof Element) {\r\n root.innerHTML = \"\";\r\n const dom = await createDom(appVNode);\r\n if (dom instanceof Node) {\r\n root.appendChild(dom);\r\n }\r\n } else {\r\n console.error(\"[Fynix] Mount error: root is not a DOM Element\", root);\r\n return;\r\n }\r\n\r\n oldVNode = appVNode;\r\n } else {\r\n appVNode.props = propsToUse;\r\n\r\n if (root instanceof Node) {\r\n await patch(root, appVNode, oldVNode);\r\n oldVNode = appVNode;\r\n } else {\r\n console.error(\"[Fynix] Patch error: root is not a DOM Node\", root);\r\n return;\r\n }\r\n }\r\n } catch (err) {\r\n console.error(\"[Fynix] Mount error:\", err);\r\n showErrorOverlay(err as Error);\r\n } finally {\r\n isRendering = false;\r\n }\r\n }\r\n\r\n rootRenderFn = renderApp;\r\n\r\n const win = window as any;\r\n win.__fynix__ = win.__fynix__ || {};\r\n win.__fynix__.rerender = renderApp;\r\n\r\n renderApp();\r\n\r\n if (import.meta.hot) {\r\n if (!win.__fynix__.hmr) {\r\n win.__fynix__.hmr = async ({ mod }: { mod: any }) => {\r\n try {\r\n const UpdatedComponent = mod.App || mod.default;\r\n if (UpdatedComponent) {\r\n Component = UpdatedComponent;\r\n if (appVNode) {\r\n appVNode.type = UpdatedComponent;\r\n }\r\n win.__fynix__.rerender?.();\r\n }\r\n } catch (err) {\r\n console.error(\"[Fynix HMR] update error:\", err);\r\n showErrorOverlay(err as Error);\r\n }\r\n };\r\n import.meta.hot.accept();\r\n }\r\n }\r\n}\r\n\r\n// ---------------------- Exports ----------------------\r\n\r\nexport {\r\n Button,\r\n createFynix,\r\n nixAsync,\r\n nixAsyncCached,\r\n nixAsyncDebounce,\r\n nixAsyncQuery,\r\n nixCallback,\r\n nixComputed,\r\n nixDebounce,\r\n nixEffect,\r\n nixEffectAlways,\r\n nixEffectOnce,\r\n nixForm,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