flexium 0.10.6 → 0.12.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -15
- package/dist/canvas.d.cts +83 -23
- package/dist/canvas.d.ts +83 -23
- package/dist/canvas.js +1 -1
- package/dist/canvas.js.map +1 -1
- package/dist/canvas.mjs +1 -1
- package/dist/canvas.mjs.map +1 -1
- package/dist/chunk-44RZHCII.mjs +2 -0
- package/dist/chunk-44RZHCII.mjs.map +1 -0
- package/dist/chunk-7BXR4ZFD.js +2 -0
- package/dist/chunk-7BXR4ZFD.js.map +1 -0
- package/dist/chunk-7DXFHPWZ.mjs +2 -0
- package/dist/chunk-7DXFHPWZ.mjs.map +1 -0
- package/dist/chunk-ALTO2MGI.js +2 -0
- package/dist/chunk-ALTO2MGI.js.map +1 -0
- package/dist/chunk-C452JE6C.js +2 -0
- package/dist/chunk-C452JE6C.js.map +1 -0
- package/dist/chunk-CPJRQL2C.mjs +2 -0
- package/dist/chunk-CPJRQL2C.mjs.map +1 -0
- package/dist/chunk-EJ7Z5OMU.mjs +2 -0
- package/dist/chunk-EJ7Z5OMU.mjs.map +1 -0
- package/dist/chunk-ENWGYQNU.js +2 -0
- package/dist/chunk-ENWGYQNU.js.map +1 -0
- package/dist/chunk-EXLNKYSH.js +2 -0
- package/dist/chunk-EXLNKYSH.js.map +1 -0
- package/dist/chunk-LUREDEUB.mjs +2 -0
- package/dist/chunk-LUREDEUB.mjs.map +1 -0
- package/dist/chunk-LUW7DIEW.js +2 -0
- package/dist/chunk-LUW7DIEW.js.map +1 -0
- package/dist/chunk-ZCO4NIGC.mjs +2 -0
- package/dist/chunk-ZCO4NIGC.mjs.map +1 -0
- package/dist/core.d.cts +41 -2
- package/dist/core.d.ts +41 -2
- package/dist/core.js +1 -1
- package/dist/core.mjs +1 -1
- package/dist/dom.d.cts +10 -33
- package/dist/dom.d.ts +10 -33
- package/dist/dom.js +1 -1
- package/dist/dom.js.map +1 -1
- package/dist/dom.mjs +1 -1
- package/dist/dom.mjs.map +1 -1
- package/dist/index.d.cts +1 -24
- package/dist/index.d.ts +1 -24
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/interactive.d.cts +65 -148
- package/dist/interactive.d.ts +65 -148
- package/dist/interactive.js +1 -1
- package/dist/interactive.js.map +1 -1
- package/dist/interactive.mjs +1 -1
- package/dist/interactive.mjs.map +1 -1
- package/dist/jsx-dev-runtime.d.cts +6 -2
- package/dist/jsx-dev-runtime.d.ts +6 -2
- package/dist/jsx-dev-runtime.js +1 -1
- package/dist/jsx-dev-runtime.js.map +1 -1
- package/dist/jsx-dev-runtime.mjs +1 -1
- package/dist/jsx-dev-runtime.mjs.map +1 -1
- package/dist/jsx-runtime.d.cts +6 -68
- package/dist/jsx-runtime.d.ts +6 -68
- package/dist/jsx-runtime.js +1 -1
- package/dist/jsx-runtime.mjs +1 -1
- package/dist/metafile-cjs.json +1 -1
- package/dist/metafile-esm.json +1 -1
- package/dist/router.d.cts +48 -15
- package/dist/router.d.ts +48 -15
- package/dist/router.js +1 -1
- package/dist/router.js.map +1 -1
- package/dist/router.mjs +1 -1
- package/dist/router.mjs.map +1 -1
- package/package.json +13 -53
- package/dist/DrawText-CVAKQ5wZ.d.cts +0 -309
- package/dist/DrawText-Dlh1L1Ar.d.ts +0 -309
- package/dist/Motion-BrOAJzgH.d.cts +0 -87
- package/dist/Motion-BrOAJzgH.d.ts +0 -87
- package/dist/advanced.d.cts +0 -32
- package/dist/advanced.d.ts +0 -32
- package/dist/advanced.js +0 -2
- package/dist/advanced.js.map +0 -1
- package/dist/advanced.mjs +0 -2
- package/dist/advanced.mjs.map +0 -1
- package/dist/chunk-2L2QFYBL.mjs +0 -2
- package/dist/chunk-2L2QFYBL.mjs.map +0 -1
- package/dist/chunk-ANJNQW77.js +0 -2
- package/dist/chunk-ANJNQW77.js.map +0 -1
- package/dist/chunk-BYHIHYRR.mjs +0 -2
- package/dist/chunk-BYHIHYRR.mjs.map +0 -1
- package/dist/chunk-DZ7L3SHV.js +0 -2
- package/dist/chunk-DZ7L3SHV.js.map +0 -1
- package/dist/chunk-E5WYPGCV.mjs +0 -3
- package/dist/chunk-E5WYPGCV.mjs.map +0 -1
- package/dist/chunk-ECYYIQEX.mjs +0 -3
- package/dist/chunk-ECYYIQEX.mjs.map +0 -1
- package/dist/chunk-ERIXVRJ4.mjs +0 -3
- package/dist/chunk-ERIXVRJ4.mjs.map +0 -1
- package/dist/chunk-F23GIQDE.mjs +0 -2
- package/dist/chunk-F23GIQDE.mjs.map +0 -1
- package/dist/chunk-FDMJHFN7.mjs +0 -2
- package/dist/chunk-FDMJHFN7.mjs.map +0 -1
- package/dist/chunk-GKJQEOP7.mjs +0 -2
- package/dist/chunk-GKJQEOP7.mjs.map +0 -1
- package/dist/chunk-GYDP6MFV.js +0 -3
- package/dist/chunk-GYDP6MFV.js.map +0 -1
- package/dist/chunk-HB5VPQTB.mjs +0 -2
- package/dist/chunk-HB5VPQTB.mjs.map +0 -1
- package/dist/chunk-KNF5ERPK.mjs +0 -2
- package/dist/chunk-KNF5ERPK.mjs.map +0 -1
- package/dist/chunk-NF4RPLCK.js +0 -3
- package/dist/chunk-NF4RPLCK.js.map +0 -1
- package/dist/chunk-OPAAGNBO.mjs +0 -2
- package/dist/chunk-OPAAGNBO.mjs.map +0 -1
- package/dist/chunk-OPAQ4R4M.mjs +0 -2
- package/dist/chunk-OPAQ4R4M.mjs.map +0 -1
- package/dist/chunk-Q7IWDVJ4.js +0 -2
- package/dist/chunk-Q7IWDVJ4.js.map +0 -1
- package/dist/chunk-RLLO5M6F.js +0 -3
- package/dist/chunk-RLLO5M6F.js.map +0 -1
- package/dist/chunk-RMN5IPS5.js +0 -2
- package/dist/chunk-RMN5IPS5.js.map +0 -1
- package/dist/chunk-U6C6VDVZ.js +0 -2
- package/dist/chunk-U6C6VDVZ.js.map +0 -1
- package/dist/chunk-WQFQO5LK.js +0 -2
- package/dist/chunk-WQFQO5LK.js.map +0 -1
- package/dist/chunk-WVEJT7HD.mjs +0 -2
- package/dist/chunk-WVEJT7HD.mjs.map +0 -1
- package/dist/chunk-WWEWRI6S.js +0 -2
- package/dist/chunk-WWEWRI6S.js.map +0 -1
- package/dist/chunk-YDZ37ZZ4.js +0 -2
- package/dist/chunk-YDZ37ZZ4.js.map +0 -1
- package/dist/chunk-YEBBTVHG.js +0 -2
- package/dist/chunk-YEBBTVHG.js.map +0 -1
- package/dist/chunk-YPVRQKMW.js +0 -2
- package/dist/chunk-YPVRQKMW.js.map +0 -1
- package/dist/components-BMbqsbMY.d.cts +0 -126
- package/dist/components-C83mBQXW.d.ts +0 -126
- package/dist/core-CxHP8991.d.cts +0 -32
- package/dist/core-D0ggvjX3.d.ts +0 -32
- package/dist/effect-554ONNZR.js +0 -2
- package/dist/effect-554ONNZR.js.map +0 -1
- package/dist/effect-T2GVIS3T.mjs +0 -2
- package/dist/effect-T2GVIS3T.mjs.map +0 -1
- package/dist/owner-QS9tPwPr.d.cts +0 -27
- package/dist/owner-QS9tPwPr.d.ts +0 -27
- package/dist/portal-BK_0Z0hE.d.cts +0 -206
- package/dist/portal-CbguxtuQ.d.ts +0 -206
- package/dist/primitives/layout.d.cts +0 -295
- package/dist/primitives/layout.d.ts +0 -295
- package/dist/primitives/layout.js +0 -2
- package/dist/primitives/layout.js.map +0 -1
- package/dist/primitives/layout.mjs +0 -2
- package/dist/primitives/layout.mjs.map +0 -1
- package/dist/primitives/motion.d.cts +0 -230
- package/dist/primitives/motion.d.ts +0 -230
- package/dist/primitives/motion.js +0 -2
- package/dist/primitives/motion.js.map +0 -1
- package/dist/primitives/motion.mjs +0 -2
- package/dist/primitives/motion.mjs.map +0 -1
- package/dist/primitives/ui.d.cts +0 -81
- package/dist/primitives/ui.d.ts +0 -81
- package/dist/primitives/ui.js +0 -2
- package/dist/primitives/ui.js.map +0 -1
- package/dist/primitives/ui.mjs +0 -2
- package/dist/primitives/ui.mjs.map +0 -1
- package/dist/primitives.d.cts +0 -93
- package/dist/primitives.d.ts +0 -93
- package/dist/primitives.js +0 -2
- package/dist/primitives.js.map +0 -1
- package/dist/primitives.mjs +0 -2
- package/dist/primitives.mjs.map +0 -1
- package/dist/renderer-DSLb-FGg.d.cts +0 -135
- package/dist/renderer-DSLb-FGg.d.ts +0 -135
- package/dist/server.d.cts +0 -3
- package/dist/server.d.ts +0 -3
- package/dist/server.js +0 -2
- package/dist/server.js.map +0 -1
- package/dist/server.mjs +0 -2
- package/dist/server.mjs.map +0 -1
- package/dist/state-DitsMyev.d.cts +0 -96
- package/dist/state-DitsMyev.d.ts +0 -96
- package/dist/state-S3TSPDMB.js +0 -2
- package/dist/state-S3TSPDMB.js.map +0 -1
- package/dist/state-SUVOJZYY.mjs +0 -2
- package/dist/state-SUVOJZYY.mjs.map +0 -1
- package/dist/sync-Z4QqUDjF.d.cts +0 -25
- package/dist/sync-Z4QqUDjF.d.ts +0 -25
- package/dist/test-exports.d.cts +0 -68
- package/dist/test-exports.d.ts +0 -68
- package/dist/test-exports.js +0 -2
- package/dist/test-exports.js.map +0 -1
- package/dist/test-exports.mjs +0 -2
- package/dist/test-exports.mjs.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/router/core.ts","../src/router/utils.ts","../src/router/context.ts","../src/router/components.ts"],"names":["createLocation","getDefaultLoc","getLoc","parseQuery","loc","setLoc","state","navigate","path","isUnsafePath","handlePopState","error","normalizedPath","protocol","sanitizeQueryValue","value","DANGEROUS_KEYS","search","params","query","key","sanitizedKey","sanitizedValue","matchPath","pathname","routePath","paramNames","regexPath","_","paramName","regex","match","index","createRoutesFromChildren","children","routes","childArray","child","isFNode","component","beforeEnter","nestedChildren","route","matchRoutes","location","result","matchRouteBranch","parentPath","fullPath","isLeaf","matcher","compilePath","matchedPath","paramValues","paramsObj","extractParams","currentMatch","childMatches","indexRoute","prefix","values","i","RouterCtx","createContext","RouteDepthCtx","router","ctx","context","Router","props","nonRouteChildren","routeChildren","Route","matches","m","routerContext","target","prop","ms","matchedContent","rootMatch","f","_props","Outlet","depth","Component","Link","r","handleClick","e"],"mappings":"wIA8BO,SAASA,CAAAA,EAA6E,CAE3F,IAAMC,CAAAA,CAAgB,KAAiB,CACrC,QAAA,CAAU,GAAA,CACV,MAAA,CAAQ,EAAA,CACR,IAAA,CAAM,EAAA,CACN,KAAA,CAAO,EACT,CAAA,CAAA,CAEMC,CAAAA,CAAS,IACT,OAAO,MAAA,CAAW,GAAA,CACbD,CAAAA,EAAc,CAEhB,CACL,QAAA,CAAU,MAAA,CAAO,QAAA,CAAS,QAAA,CAC1B,MAAA,CAAQ,MAAA,CAAO,QAAA,CAAS,MAAA,CACxB,IAAA,CAAM,MAAA,CAAO,QAAA,CAAS,IAAA,CACtB,KAAA,CAAOE,CAAAA,CAAW,MAAA,CAAO,QAAA,CAAS,MAAM,CAC1C,CAAA,CAGI,CAACC,CAAAA,CAAKC,CAAM,CAAA,CAAIC,GAAAA,CAAgBJ,CAAAA,EAAQ,CAAA,CAExCK,CAAAA,CAAYC,CAAAA,EAAiB,CAEjC,GAAI,EAAA,OAAO,MAAA,CAAW,GAAA,CAAA,CAGtB,CAAA,GAAIC,CAAAA,CAAaD,CAAI,EAAG,CACtB,OAAA,CAAQ,KAAA,CAAM,qDAAA,CAAuDA,CAAI,CAAA,CACzE,MACF,CACA,MAAA,CAAO,OAAA,CAAQ,SAAA,CAAU,EAAC,CAAG,EAAA,CAAIA,CAAI,CAAA,CACrCH,CAAAA,CAAOH,CAAAA,EAAQ,EAAA,CACjB,CAAA,CAGMQ,CAAAA,CAAiB,IAAM,CAC3B,GAAI,CACFL,CAAAA,CAAOH,CAAAA,EAAQ,EACjB,CAAA,MAASS,CAAAA,CAAO,CACd,OAAA,CAAQ,KAAA,CAAM,2CAAA,CAA6CA,CAAK,EAClE,CACF,CAAA,CAEA,OAAI,OAAO,MAAA,CAAW,GAAA,EACpB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MAAM,CAAA,GACpC,KAAA,CAAO,OAAO,IAAA,CAG/B,IAAMsD,CAAAA,CAAYtD,CAAAA,CAAM,KAAA,CAAM,SAAA,CAG9B,OAAOkD,GAAAA,CAAEjB,CAAAA,CAAc,QAAA,CAAU,CAAE,KAAA,CAAOoB,CAAAA,CAAQ,CAAE,CAAA,CAAG,CACrDH,GAAAA,CAAEI,CAAAA,CAAW,CAAE,MAAA,CAAQtD,CAAAA,CAAM,MAAO,CAAC,CACvC,CAAC,CACH,CAAA,CAtBoB,IAuBtB,CAEO,SAASuD,CAAAA,CAAKjB,CAAAA,CAAkB,CACrC,IAAMkB,CAAAA,CAAItB,CAAAA,EAAO,CAEXuB,CAAAA,CAAeC,CAAAA,EAAa,CAChCA,CAAAA,CAAE,cAAA,EAAe,CACjBF,CAAAA,CAAE,QAAA,CAASlB,CAAAA,CAAM,EAAE,EACrB,CAAA,CAEA,OAAOY,GAAAA,CACL,GAAA,CACA,CACE,IAAA,CAAMZ,CAAAA,CAAM,EAAA,CACZ,KAAA,CAAOA,CAAAA,CAAM,KAAA,CACb,OAAA,CAASmB,CACX,CAAA,CACAnB,CAAAA,CAAM,QACR,CACF","file":"chunk-ERIXVRJ4.mjs","sourcesContent":["/**\n * Router Core Module\n *\n * Provides core routing functionality including location management,\n * path matching, and navigation.\n */\n\nimport { state, type StateValue } from '../core/state'\nimport { Location } from './types'\n\n/**\n * Creates a reactive location signal and navigate function.\n *\n * The location signal automatically updates when:\n * - navigate() is called\n * - Browser back/forward buttons are used (popstate event)\n *\n * @returns Tuple of [location signal, navigate function, cleanup function]\n *\n * @example\n * ```tsx\n * const [location, navigate, cleanup] = createLocation();\n * // Access current path\n * console.log(location().pathname);\n * // Navigate to new path\n * navigate('/users/123');\n * // Cleanup when done (removes popstate listener)\n * cleanup();\n * ```\n */\nexport function createLocation(): [StateValue<Location>, (path: string) => void, () => void] {\n // SSR guard: return safe defaults on server\n const getDefaultLoc = (): Location => ({\n pathname: '/',\n search: '',\n hash: '',\n query: {},\n })\n\n const getLoc = (): Location => {\n if (typeof window === 'undefined') {\n return getDefaultLoc()\n }\n return {\n pathname: window.location.pathname,\n search: window.location.search,\n hash: window.location.hash,\n query: parseQuery(window.location.search),\n }\n }\n\n const [loc, setLoc] = state<Location>(getLoc())\n\n const navigate = (path: string) => {\n // SSR guard\n if (typeof window === 'undefined') return\n\n // Security: Validate path to prevent javascript: and other dangerous protocols\n if (isUnsafePath(path)) {\n console.error('[Flexium Router] Blocked navigation to unsafe path:', path)\n return\n }\n window.history.pushState({}, '', path)\n setLoc(getLoc())\n }\n\n // SSR guard for popstate listener\n const handlePopState = () => {\n try {\n setLoc(getLoc())\n } catch (error) {\n console.error('[Flexium Router] Error handling popstate:', error)\n }\n }\n\n if (typeof window !== 'undefined') {\n window.addEventListener('popstate', handlePopState)\n }\n\n // Cleanup function to remove listener\n const cleanup = () => {\n if (typeof window !== 'undefined') {\n window.removeEventListener('popstate', handlePopState)\n }\n }\n\n return [loc, navigate, cleanup]\n}\n\n/**\n * Check if a path contains unsafe protocols (XSS prevention)\n * @param path - Path to validate\n * @returns true if path is unsafe\n */\nexport function isUnsafePath(path: string): boolean {\n const normalizedPath = path.trim().toLowerCase()\n const unsafeProtocols = ['javascript:', 'data:', 'vbscript:', 'file:']\n return unsafeProtocols.some(protocol => normalizedPath.startsWith(protocol))\n}\n\n/**\n * Sanitize query parameter value to prevent XSS\n * @param value - Query parameter value\n * @returns Sanitized value\n */\nexport function sanitizeQueryValue(value: string): string {\n // Remove potential script tags and event handlers\n return value\n .replace(/<[^>]*>/g, '') // Remove HTML tags\n .replace(/javascript:/gi, '') // Remove javascript: protocol\n .replace(/on\\w+\\s*=/gi, '') // Remove event handlers like onclick=\n}\n\n/**\n * Parses URL search string into key-value object\n * @param search - URL search string (e.g., \"?foo=bar&baz=qux\")\n * @returns Object with query parameters\n */\n// Dangerous keys that could lead to prototype pollution\nconst DANGEROUS_KEYS = new Set(['__proto__', 'constructor', 'prototype'])\n\nfunction parseQuery(search: string): Record<string, string> {\n const params = new URLSearchParams(search)\n // Use Object.create(null) to prevent prototype pollution\n const query: Record<string, string> = Object.create(null)\n params.forEach((value, key) => {\n // Sanitize both key and value to prevent XSS\n const sanitizedKey = sanitizeQueryValue(key)\n const sanitizedValue = sanitizeQueryValue(value)\n // Block dangerous keys to prevent prototype pollution\n if (sanitizedKey && !DANGEROUS_KEYS.has(sanitizedKey)) {\n query[sanitizedKey] = sanitizedValue\n }\n })\n return query\n}\n\n/**\n * Matches a pathname against a route pattern.\n *\n * Supports dynamic segments with `:param` syntax.\n *\n * @param pathname - Current URL pathname (e.g., \"/users/123\")\n * @param routePath - Route pattern (e.g., \"/users/:id\")\n * @returns Object with `matches` boolean and extracted `params`\n *\n * @example\n * ```tsx\n * const result = matchPath('/users/123', '/users/:id');\n * // { matches: true, params: { id: '123' } }\n * ```\n */\nexport function matchPath(\n pathname: string,\n routePath: string\n): { matches: boolean; params: Record<string, string> } {\n const paramNames: string[] = []\n const regexPath = routePath.replace(/:([^/]+)/g, (_, paramName) => {\n paramNames.push(paramName)\n return '([^/]+)'\n })\n\n const regex = new RegExp(`^${regexPath}$`)\n const match = pathname.match(regex)\n\n if (!match) {\n return { matches: false, params: {} }\n }\n\n const params: Record<string, string> = {}\n match.slice(1).forEach((value, index) => {\n params[paramNames[index]] = value\n })\n\n return { matches: true, params }\n}\n","import { RouteDef, RouteMatch } from './types'\nimport type { FNodeChild } from '../core/renderer'\nimport { isFNode } from '../renderers/dom/f'\n\n/**\n * Flatten the children of <Router> or <Route> into a route configuration tree.\n * Note: This assumes `children` are FNodes representing <Route> components.\n */\nexport function createRoutesFromChildren(children: FNodeChild): RouteDef[] {\n const routes: RouteDef[] = []\n\n const childArray = Array.isArray(children) ? children : [children]\n\n for (const child of childArray) {\n if (!isFNode(child)) {\n continue\n }\n\n const { path, index, component, beforeEnter } = child.props as {\n path?: string\n index?: boolean\n component?: Function\n beforeEnter?: (\n params: Record<string, string>\n ) => boolean | Promise<boolean>\n }\n const nestedChildren = child.children\n\n // Skip routes without a component (unless they have children as layout routes)\n if (!component && !nestedChildren) {\n console.warn(\n `[Flexium Router] Route \"${path || '(index)'}\" has no component and no children. Skipping.`\n )\n continue\n }\n\n const route: RouteDef = {\n path: path || '',\n index: !!index,\n component: component || (() => null),\n children: nestedChildren ? createRoutesFromChildren(nestedChildren) : [],\n beforeEnter,\n }\n\n routes.push(route)\n }\n\n return routes\n}\n\n/**\n * Match a URL against a route tree.\n * Returns an array of matches (from root to leaf).\n */\nexport function matchRoutes(\n routes: RouteDef[],\n location: string\n): RouteMatch[] | null {\n for (const route of routes) {\n const result = matchRouteBranch(route, location, '')\n if (result) return result\n }\n return null\n}\n\nfunction matchRouteBranch(\n route: RouteDef,\n location: string,\n parentPath: string\n): RouteMatch[] | null {\n let fullPath = parentPath\n if (route.path) {\n fullPath =\n parentPath.replace(/\\/$/, '') + '/' + route.path.replace(/^\\//, '')\n }\n\n const isLeaf = route.children.length === 0\n const matcher = compilePath(fullPath, !isLeaf)\n const match = location.match(matcher)\n\n if (match) {\n const [matchedPath, ...paramValues] = match\n const paramsObj = extractParams(fullPath, paramValues)\n\n const currentMatch: RouteMatch = {\n route,\n params: paramsObj,\n pathname: matchedPath,\n }\n\n if (isLeaf) {\n // Exact match required for leaf\n if (matchedPath === location) return [currentMatch]\n return null\n }\n\n // Has children: try to match one of them\n // If no children match, and this route is an index route?\n // Or if this route matches partially, maybe an index child matches the rest?\n\n for (const child of route.children) {\n const childMatches = matchRouteBranch(child, location, fullPath)\n if (childMatches) {\n return [currentMatch, ...childMatches]\n }\n }\n\n // If no children matched, but we matched exactly this layout route?\n // E.g. /users matches /users layout, and maybe it renders index?\n if (matchedPath === location) {\n // Check for index route\n const indexRoute = route.children.find((c) => c.index)\n if (indexRoute) {\n return [\n currentMatch,\n { route: indexRoute, params: {}, pathname: matchedPath },\n ]\n }\n // Just the layout? Maybe.\n return [currentMatch]\n }\n }\n\n return null\n}\n\nfunction compilePath(path: string, prefix: boolean): RegExp {\n const regexPath = path.replace(/:([^/]+)/g, () => '([^/]+)')\n\n // If path is exactly \"/\", and we want prefix matching, it should match everything\n if (regexPath === '/' && prefix) {\n return new RegExp('^')\n }\n\n // If prefix matching allowed, ensure we match segment boundary\n return new RegExp(`^${regexPath}${prefix ? '(?:/|$)' : '$'}`)\n}\n\nfunction extractParams(path: string, values: string[]): Record<string, string> {\n const params: Record<string, string> = {}\n let i = 0\n // Re-parse to find param names... inefficient but works\n path.replace(/:([^/]+)/g, (_, paramName) => {\n params[paramName] = values[i++]\n return ''\n })\n return params\n}\n","import { createContext } from '../core/context'\nimport { RouterContext } from './types'\n\n// Global Router Context\nexport const RouterCtx = createContext<RouterContext | null>(null)\n\n// Current Route Depth Context (for Outlet)\n// Stores the index of the current match in the `matches` array\nexport const RouteDepthCtx = createContext<number>(0)\n","import { state, type StateValue } from '../core/state'\nimport { createLocation } from './core'\nimport { createRoutesFromChildren, matchRoutes } from './utils'\nimport { LinkProps, RouteProps, RouterContext } from './types'\nimport { f, isFNode } from '../renderers/dom/f'\nimport { RouterCtx, RouteDepthCtx } from './context'\nimport { context } from '../core/context'\nimport type { FNodeChild } from '../core/renderer'\n\n/**\n * Get the current router context.\n * Must be called within a <Router> component.\n *\n * @example\n * ```tsx\n * const r = router()\n * r.navigate('/dashboard')\n * ```\n */\nexport function router(): RouterContext {\n const ctx = context(RouterCtx)\n if (!ctx) {\n throw new Error('router() must be called within a <Router> component')\n }\n return ctx\n}\n\nexport function Router(props: { children: FNodeChild }) {\n const [location, navigate] = createLocation()\n\n // Separate Route children from non-Route children (like Nav, etc.)\n const childArray = Array.isArray(props.children) ? props.children : [props.children]\n const nonRouteChildren: FNodeChild[] = []\n const routeChildren: FNodeChild[] = []\n\n for (const child of childArray) {\n if (isFNode(child) && typeof child.type === 'function' && child.type === Route) {\n routeChildren.push(child)\n } else {\n nonRouteChildren.push(child)\n }\n }\n\n // Parse route configuration from Route children only\n const routes = createRoutesFromChildren(routeChildren)\n\n // Compute matches\n const [matches] = state(() => {\n const loc = location()\n return matchRoutes(routes, loc.pathname) || []\n })\n\n const [params] = state(() => {\n const m = matches()\n if (m.length > 0) {\n return m[m.length - 1].params\n }\n return {}\n })\n\n // Create routerContext as a stable object\n // The signals (location, params, matches) are already reactive\n // We create a proxy to ensure property access is properly tracked\n // When accessing location, params, or matches, automatically read the signal's value\n // to register subscriptions (similar to how state() proxy works)\n const routerContext: RouterContext = new Proxy({\n location,\n params,\n navigate,\n matches,\n } as any, {\n get(target, prop) {\n const value = target[prop as keyof RouterContext]\n\n // For state values (location, params, matches), return them directly\n // They are already Proxy-based and work like state() - property access triggers tracking\n if (prop === 'location' || prop === 'params' || prop === 'matches') {\n return value as StateValue<unknown>\n }\n\n // For navigate, return as-is\n return value\n }\n }) as RouterContext\n\n return () => {\n const ms = matches()\n\n // Matched route component (or null if no match)\n let matchedContent: FNodeChild = null\n if (ms.length > 0) {\n const rootMatch = ms[0]\n\n // Check beforeEnter guard\n if (rootMatch.route.beforeEnter) {\n const result = rootMatch.route.beforeEnter(rootMatch.params)\n if (result !== false) {\n matchedContent = f(RouteDepthCtx.Provider, { value: 1 }, [\n f('div', { key: rootMatch.route.path, style: { display: 'contents' } }, [\n f(rootMatch.route.component, { params: rootMatch.params }),\n ]),\n ])\n }\n } else {\n matchedContent = f(RouteDepthCtx.Provider, { value: 1 }, [\n f('div', { key: rootMatch.route.path, style: { display: 'contents' } }, [\n f(rootMatch.route.component, { params: rootMatch.params }),\n ]),\n ])\n }\n }\n\n // Render non-Route children (like Nav) and the matched route wrapped in main\n return f(RouterCtx.Provider, { value: routerContext }, [\n ...nonRouteChildren,\n f('main', { id: 'main' }, [matchedContent]),\n ])\n }\n}\n\n/**\n * Route configuration component.\n * Doesn't render anything directly; used by Router to build the route tree.\n */\nexport function Route(_props: RouteProps) {\n return null\n}\n\n/**\n * Renders the child route content.\n */\nexport function Outlet() {\n const router = context(RouterCtx)\n const depth = context(RouteDepthCtx) || 0 // Default 0\n\n // Safety check\n if (!router) return null\n\n return () => {\n const ms = router.matches()\n\n // Check if we have a match at this depth\n if (depth >= ms.length) return null\n\n const match = ms[depth]\n\n // Check beforeEnter guard\n if (match.route.beforeEnter) {\n const result = match.route.beforeEnter(match.params)\n if (result === false) return null\n }\n\n const Component = match.route.component\n\n // Render component and provide next depth\n return f(RouteDepthCtx.Provider, { value: depth + 1 }, [\n f(Component, { params: match.params }),\n ])\n }\n}\n\nexport function Link(props: LinkProps) {\n const r = router()\n\n const handleClick = (e: Event) => {\n e.preventDefault()\n r.navigate(props.to)\n }\n\n return f(\n 'a',\n {\n href: props.to,\n class: props.class,\n onclick: handleClick,\n },\n props.children\n )\n}\n"]}
|
package/dist/chunk-F23GIQDE.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import {g}from'./chunk-2L2QFYBL.mjs';function x(i){if(!i)return {};let e={};i.display&&(e.display=i.display),i.flex!==void 0&&(e.flex=i.flex),i.flexDirection&&(e.flexDirection=i.flexDirection),i.flexWrap&&(e.flexWrap=i.flexWrap),i.justifyContent&&(e.justifyContent=i.justifyContent),i.alignItems&&(e.alignItems=i.alignItems),i.alignSelf&&(e.alignSelf=i.alignSelf),i.gap!==void 0&&(e.gap=`${i.gap}px`),i.padding!==void 0&&(e.padding=`${i.padding}px`),i.paddingTop!==void 0&&(e.paddingTop=`${i.paddingTop}px`),i.paddingRight!==void 0&&(e.paddingRight=`${i.paddingRight}px`),i.paddingBottom!==void 0&&(e.paddingBottom=`${i.paddingBottom}px`),i.paddingLeft!==void 0&&(e.paddingLeft=`${i.paddingLeft}px`),i.paddingHorizontal!==void 0&&(e.paddingLeft=`${i.paddingHorizontal}px`,e.paddingRight=`${i.paddingHorizontal}px`),i.paddingVertical!==void 0&&(e.paddingTop=`${i.paddingVertical}px`,e.paddingBottom=`${i.paddingVertical}px`),i.margin!==void 0&&(e.margin=`${i.margin}px`),i.marginTop!==void 0&&(e.marginTop=`${i.marginTop}px`),i.marginRight!==void 0&&(e.marginRight=`${i.marginRight}px`),i.marginBottom!==void 0&&(e.marginBottom=`${i.marginBottom}px`),i.marginLeft!==void 0&&(e.marginLeft=`${i.marginLeft}px`),i.marginHorizontal!==void 0&&(e.marginLeft=`${i.marginHorizontal}px`,e.marginRight=`${i.marginHorizontal}px`),i.marginVertical!==void 0&&(e.marginTop=`${i.marginVertical}px`,e.marginBottom=`${i.marginVertical}px`),i.width!==void 0&&(e.width=typeof i.width=="number"?`${i.width}px`:i.width),i.height!==void 0&&(e.height=typeof i.height=="number"?`${i.height}px`:i.height),i.minWidth!==void 0&&(e.minWidth=`${i.minWidth}px`),i.maxWidth!==void 0&&(e.maxWidth=`${i.maxWidth}px`),i.minHeight!==void 0&&(e.minHeight=`${i.minHeight}px`),i.maxHeight!==void 0&&(e.maxHeight=`${i.maxHeight}px`),i.backgroundColor&&(e.backgroundColor=i.backgroundColor),i.borderRadius!==void 0&&(e.borderRadius=`${i.borderRadius}px`),i.borderTopLeftRadius!==void 0&&(e.borderTopLeftRadius=`${i.borderTopLeftRadius}px`),i.borderTopRightRadius!==void 0&&(e.borderTopRightRadius=`${i.borderTopRightRadius}px`),i.borderBottomLeftRadius!==void 0&&(e.borderBottomLeftRadius=`${i.borderBottomLeftRadius}px`),i.borderBottomRightRadius!==void 0&&(e.borderBottomRightRadius=`${i.borderBottomRightRadius}px`),i.opacity!==void 0&&(e.opacity=i.opacity),i.borderWidth!==void 0&&(e.borderWidth=`${i.borderWidth}px`),i.borderColor&&(e.borderColor=i.borderColor),i.borderTopWidth!==void 0&&(e.borderTopWidth=`${i.borderTopWidth}px`),i.borderRightWidth!==void 0&&(e.borderRightWidth=`${i.borderRightWidth}px`),i.borderBottomWidth!==void 0&&(e.borderBottomWidth=`${i.borderBottomWidth}px`),i.borderLeftWidth!==void 0&&(e.borderLeftWidth=`${i.borderLeftWidth}px`),i.position&&(e.position=i.position),i.top!==void 0&&(e.top=`${i.top}px`),i.right!==void 0&&(e.right=`${i.right}px`),i.bottom!==void 0&&(e.bottom=`${i.bottom}px`),i.left!==void 0&&(e.left=`${i.left}px`),i.zIndex!==void 0&&(e.zIndex=i.zIndex),i.transform&&(e.transform=i.transform);let t=i;return t.color&&(e.color=t.color),t.fontSize!==void 0&&(e.fontSize=`${t.fontSize}px`),t.fontWeight&&(e.fontWeight=t.fontWeight),t.fontFamily&&(e.fontFamily=t.fontFamily),t.fontStyle&&(e.fontStyle=t.fontStyle),t.textAlign&&(e.textAlign=t.textAlign),t.textDecoration&&(e.textDecoration=t.textDecoration),t.lineHeight!==void 0&&(e.lineHeight=`${t.lineHeight}px`),t.letterSpacing!==void 0&&(e.letterSpacing=`${t.letterSpacing}px`),e}function k(i){return g(i)}function n(i){return k(i)?i():i!==null&&typeof i=="object"&&"value"in i&&"peek"in i?i.value:i}function b(i,e,t,r){if(!e)return;let a=Array.isArray(e)?e:[e];for(let o of a)if(!(!o||!o.type))switch(o.type){case "canvas-rect":D(i,o.props);break;case "canvas-circle":S(i,o.props);break;case "canvas-path":W(i,o.props);break;case "canvas-text":C(i,o.props);break;case "canvas-line":T(i,o.props);break;case "canvas-arc":v(i,o.props);break}}function D(i,e){let t=n(e.x),r=n(e.y),a=n(e.width),o=n(e.height),d=n(e.fill),f=n(e.stroke),p=n(e.strokeWidth),c=n(e.opacity);i.save(),c!==void 0&&(i.globalAlpha=c),d&&(i.fillStyle=d,i.fillRect(t,r,a,o)),f&&(i.strokeStyle=f,i.lineWidth=p||1,i.strokeRect(t,r,a,o)),i.restore();}function S(i,e){let t=n(e.x),r=n(e.y),a=n(e.radius),o=n(e.fill),d=n(e.stroke),f=n(e.strokeWidth),p=n(e.opacity);i.save(),p!==void 0&&(i.globalAlpha=p),i.beginPath(),i.arc(t,r,a,0,2*Math.PI),o&&(i.fillStyle=o,i.fill()),d&&(i.strokeStyle=d,i.lineWidth=f||1,i.stroke()),i.restore();}function W(i,e){let t=n(e.d),r=n(e.fill),a=n(e.stroke),o=n(e.strokeWidth),d=n(e.opacity);i.save(),d!==void 0&&(i.globalAlpha=d);let f=new Path2D(t);r&&(i.fillStyle=r,i.fill(f)),a&&(i.strokeStyle=a,i.lineWidth=o||1,i.stroke(f)),i.restore();}function C(i,e){let t=n(e.x),r=n(e.y),a=n(e.text),o=n(e.fill),d=n(e.fontSize)||12,f=n(e.fontFamily)||"sans-serif",p=n(e.fontWeight)||"normal",c=n(e.textAlign)||"left",m=n(e.textBaseline)||"alphabetic";i.save(),i.font=`${p} ${d}px ${f}`,i.textAlign=c,i.textBaseline=m,o&&(i.fillStyle=o,i.fillText(a,t,r)),i.restore();}function T(i,e){let t=n(e.x1),r=n(e.y1),a=n(e.x2),o=n(e.y2),d=n(e.stroke)||"black",f=n(e.strokeWidth)||1,p=n(e.opacity);i.save(),p!==void 0&&(i.globalAlpha=p),i.beginPath(),i.moveTo(t,r),i.lineTo(a,o),i.strokeStyle=d,i.lineWidth=f,i.stroke(),i.restore();}function v(i,e){let t=n(e.x),r=n(e.y),a=n(e.radius),o=n(e.startAngle),d=n(e.endAngle),f=n(e.counterclockwise)||false,p=n(e.fill),c=n(e.stroke),m=n(e.strokeWidth),h=n(e.opacity);i.save(),h!==void 0&&(i.globalAlpha=h),i.beginPath(),i.arc(t,r,a,o,d,f),p&&(i.fillStyle=p,i.fill()),c&&(i.strokeStyle=c,i.lineWidth=m||1,i.stroke()),i.restore();}function N(i){let{width:e,height:t,children:r,style:a,id:o,...d}=i;return {type:"canvas",props:{...d,id:o,width:e,height:t,style:x(a),ref:f=>{if(!f||typeof requestAnimationFrame>"u")return;let p=f.getContext("2d");p&&Promise.all([import('./effect-T2GVIS3T.mjs').then(c=>({effect:c.effect,onCleanup:c.onCleanup})),import('./state-SUVOJZYY.mjs').then(c=>({isSignal:c.isSignal}))]).then(([{effect:c,onCleanup:m},{isSignal:h}])=>{let g,R=()=>{g!==void 0&&cancelAnimationFrame(g),g=requestAnimationFrame(()=>{p.clearRect(0,0,e,t),b(p,r),g=void 0;});};c(()=>{let w=Array.isArray(r)?r:[r];for(let u of w)if(u&&u.props)for(let $ in u.props){let s=u.props[$];h(s)&&s();}R(),m(()=>{g!==void 0&&(cancelAnimationFrame(g),g=void 0);});});}).catch(c=>{console.error("[Flexium Canvas] Failed to load signal module:",c);});}},children:[]}}function V(i){return {type:"canvas-rect",props:i,children:[]}}function j(i){return {type:"canvas-circle",props:i,children:[]}}function M(i){return {type:"canvas-arc",props:i,children:[]}}function E(i){return {type:"canvas-line",props:i,children:[]}}function J(i){return {type:"canvas-path",props:i,children:[]}}function O(i){return {type:"canvas-text",props:i,children:[]}}export{x as a,n as b,b as c,N as d,V as e,j as f,M as g,E as h,J as i,O as j};//# sourceMappingURL=chunk-F23GIQDE.mjs.map
|
|
2
|
-
//# sourceMappingURL=chunk-F23GIQDE.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/primitives/utils.ts","../src/primitives/canvas/utils.ts","../src/primitives/canvas/renderer.ts","../src/primitives/canvas/Canvas.ts","../src/primitives/canvas/DrawRect.ts","../src/primitives/canvas/DrawCircle.ts","../src/primitives/canvas/DrawArc.ts","../src/primitives/canvas/DrawLine.ts","../src/primitives/canvas/DrawPath.ts","../src/primitives/canvas/DrawText.ts"],"names":["normalizeStyle","style","css","textStyle","isSignal","value","unwrapSignal","renderCanvasChildren","ctx","children","_width","_height","childArray","child","renderRect","renderCircle","renderPath","renderText","renderLine","renderArc","props","x","y","width","height","fill","stroke","strokeWidth","opacity","radius","d","path","text","fontSize","fontFamily","fontWeight","textAlign","textBaseline","x1","y1","x2","y2","startAngle","endAngle","counterclockwise","Canvas","id","rest","canvas","m","effect","onCleanup","rafId","scheduleRender","key","err","DrawRect","DrawCircle","DrawArc","DrawLine","DrawPath","DrawText"],"mappings":"qCASO,SAASA,EACdC,CAAAA,CAEqB,CACrB,GAAI,CAACA,CAAAA,CAAO,OAAO,EAAC,CAGpB,IAAMC,CAAAA,CAA2B,EAAC,CAG9BD,CAAAA,CAAM,UAASC,CAAAA,CAAI,OAAA,CAAU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,CACN,KAAA,CAAAA,EACA,QAAA,CAAU,EACZ,CACF,CCNO,SAASuC,CAAAA,CAASvC,EAA6B,CACpD,OAAO,CACL,IAAA,CAAM,aAAA,CACN,MAAAA,CAAAA,CACA,QAAA,CAAU,EACZ,CACF,CCNO,SAASwC,EAASxC,CAAAA,CAA6B,CACpD,OAAO,CACL,IAAA,CAAM,aAAA,CACN,KAAA,CAAAA,EACA,QAAA,CAAU,EACZ,CACF,CCNO,SAASyC,CAAAA,CAASzC,CAAAA,CAA6B,CACpD,OAAO,CACL,KAAM,aAAA,CACN,KAAA,CAAAA,EACA,QAAA,CAAU,EACZ,CACF","file":"chunk-F23GIQDE.mjs","sourcesContent":["/**\n * Primitive utilities\n */\n\nimport type { CommonStyle, TextStyle } from './types'\n\n/**\n * Normalize CommonStyle to CSS properties\n */\nexport function normalizeStyle(\n style?: CommonStyle | TextStyle\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): Record<string, any> {\n if (!style) return {}\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const css: Record<string, any> = {}\n\n // Layout\n if (style.display) css.display = style.display\n if (style.flex !== undefined) css.flex = style.flex\n if (style.flexDirection) css.flexDirection = style.flexDirection\n if (style.flexWrap) css.flexWrap = style.flexWrap\n if (style.justifyContent) css.justifyContent = style.justifyContent\n if (style.alignItems) css.alignItems = style.alignItems\n if (style.alignSelf) css.alignSelf = style.alignSelf\n if (style.gap !== undefined) css.gap = `${style.gap}px`\n\n // Spacing - padding\n if (style.padding !== undefined) css.padding = `${style.padding}px`\n if (style.paddingTop !== undefined) css.paddingTop = `${style.paddingTop}px`\n if (style.paddingRight !== undefined)\n css.paddingRight = `${style.paddingRight}px`\n if (style.paddingBottom !== undefined)\n css.paddingBottom = `${style.paddingBottom}px`\n if (style.paddingLeft !== undefined)\n css.paddingLeft = `${style.paddingLeft}px`\n if (style.paddingHorizontal !== undefined) {\n css.paddingLeft = `${style.paddingHorizontal}px`\n css.paddingRight = `${style.paddingHorizontal}px`\n }\n if (style.paddingVertical !== undefined) {\n css.paddingTop = `${style.paddingVertical}px`\n css.paddingBottom = `${style.paddingVertical}px`\n }\n\n // Spacing - margin\n if (style.margin !== undefined) css.margin = `${style.margin}px`\n if (style.marginTop !== undefined) css.marginTop = `${style.marginTop}px`\n if (style.marginRight !== undefined)\n css.marginRight = `${style.marginRight}px`\n if (style.marginBottom !== undefined)\n css.marginBottom = `${style.marginBottom}px`\n if (style.marginLeft !== undefined) css.marginLeft = `${style.marginLeft}px`\n if (style.marginHorizontal !== undefined) {\n css.marginLeft = `${style.marginHorizontal}px`\n css.marginRight = `${style.marginHorizontal}px`\n }\n if (style.marginVertical !== undefined) {\n css.marginTop = `${style.marginVertical}px`\n css.marginBottom = `${style.marginVertical}px`\n }\n\n // Sizing\n if (style.width !== undefined)\n css.width =\n typeof style.width === 'number' ? `${style.width}px` : style.width\n if (style.height !== undefined)\n css.height =\n typeof style.height === 'number' ? `${style.height}px` : style.height\n if (style.minWidth !== undefined) css.minWidth = `${style.minWidth}px`\n if (style.maxWidth !== undefined) css.maxWidth = `${style.maxWidth}px`\n if (style.minHeight !== undefined) css.minHeight = `${style.minHeight}px`\n if (style.maxHeight !== undefined) css.maxHeight = `${style.maxHeight}px`\n\n // Visual\n if (style.backgroundColor) css.backgroundColor = style.backgroundColor\n if (style.borderRadius !== undefined)\n css.borderRadius = `${style.borderRadius}px`\n if (style.borderTopLeftRadius !== undefined)\n css.borderTopLeftRadius = `${style.borderTopLeftRadius}px`\n if (style.borderTopRightRadius !== undefined)\n css.borderTopRightRadius = `${style.borderTopRightRadius}px`\n if (style.borderBottomLeftRadius !== undefined)\n css.borderBottomLeftRadius = `${style.borderBottomLeftRadius}px`\n if (style.borderBottomRightRadius !== undefined)\n css.borderBottomRightRadius = `${style.borderBottomRightRadius}px`\n if (style.opacity !== undefined) css.opacity = style.opacity\n\n // Border\n if (style.borderWidth !== undefined)\n css.borderWidth = `${style.borderWidth}px`\n if (style.borderColor) css.borderColor = style.borderColor\n if (style.borderTopWidth !== undefined)\n css.borderTopWidth = `${style.borderTopWidth}px`\n if (style.borderRightWidth !== undefined)\n css.borderRightWidth = `${style.borderRightWidth}px`\n if (style.borderBottomWidth !== undefined)\n css.borderBottomWidth = `${style.borderBottomWidth}px`\n if (style.borderLeftWidth !== undefined)\n css.borderLeftWidth = `${style.borderLeftWidth}px`\n\n // Position\n if (style.position) css.position = style.position\n if (style.top !== undefined) css.top = `${style.top}px`\n if (style.right !== undefined) css.right = `${style.right}px`\n if (style.bottom !== undefined) css.bottom = `${style.bottom}px`\n if (style.left !== undefined) css.left = `${style.left}px`\n if (style.zIndex !== undefined) css.zIndex = style.zIndex\n\n // Transform\n if (style.transform) css.transform = style.transform\n\n // Text-specific (if TextStyle)\n const textStyle = style as TextStyle\n if (textStyle.color) css.color = textStyle.color\n if (textStyle.fontSize !== undefined) css.fontSize = `${textStyle.fontSize}px`\n if (textStyle.fontWeight) css.fontWeight = textStyle.fontWeight\n if (textStyle.fontFamily) css.fontFamily = textStyle.fontFamily\n if (textStyle.fontStyle) css.fontStyle = textStyle.fontStyle\n if (textStyle.textAlign) css.textAlign = textStyle.textAlign\n if (textStyle.textDecoration) css.textDecoration = textStyle.textDecoration\n if (textStyle.lineHeight !== undefined)\n css.lineHeight = `${textStyle.lineHeight}px`\n if (textStyle.letterSpacing !== undefined)\n css.letterSpacing = `${textStyle.letterSpacing}px`\n\n return css\n}\n","/**\n * Canvas utilities\n */\n\nimport { isSignal as coreIsSignal } from '../../core/state'\nimport type { StateValue } from '../../core/state'\n\n/**\n * Check if a value is a Signal\n */\nexport function isSignal<T>(value: T | StateValue<T>): value is StateValue<T> {\n // Use core isSignal which checks for SIGNAL_MARKER symbol\n // Signals are functions with properties, not plain objects\n return coreIsSignal(value)\n}\n\n/**\n * Unwrap a value that might be a Signal\n */\nexport function unwrapSignal<T>(value: T | StateValue<T>): T {\n // Check for real signals first (have STATE_SIGNAL)\n if (isSignal(value)) {\n return (value as StateValue<T>)()\n }\n // Handle signal-like objects (for testing) - duck typing\n // Check if it's an object with a 'value' property\n if (\n value !== null &&\n typeof value === 'object' &&\n 'value' in value &&\n 'peek' in value\n ) {\n return (value as any).value\n }\n return value\n}\n","/**\n * Canvas renderer - renders canvas primitives to canvas context\n */\n\nimport type {\n DrawRectProps,\n DrawCircleProps,\n DrawPathProps,\n DrawTextProps,\n DrawLineProps,\n DrawArcProps,\n} from '../types'\nimport { unwrapSignal } from './utils'\n\n/**\n * Render canvas children to context\n */\nexport function renderCanvasChildren(\n ctx: CanvasRenderingContext2D,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n children: any,\n _width: number,\n _height: number\n): void {\n if (!children) return\n\n const childArray = Array.isArray(children) ? children : [children]\n\n for (const child of childArray) {\n if (!child || !child.type) continue\n\n switch (child.type) {\n case 'canvas-rect':\n renderRect(ctx, child.props)\n break\n case 'canvas-circle':\n renderCircle(ctx, child.props)\n break\n case 'canvas-path':\n renderPath(ctx, child.props)\n break\n case 'canvas-text':\n renderText(ctx, child.props)\n break\n case 'canvas-line':\n renderLine(ctx, child.props)\n break\n case 'canvas-arc':\n renderArc(ctx, child.props)\n break\n }\n }\n}\n\n/**\n * Render rectangle\n */\nfunction renderRect(ctx: CanvasRenderingContext2D, props: DrawRectProps): void {\n const x = unwrapSignal(props.x)\n const y = unwrapSignal(props.y)\n const width = unwrapSignal(props.width)\n const height = unwrapSignal(props.height)\n const fill = unwrapSignal(props.fill)\n const stroke = unwrapSignal(props.stroke)\n const strokeWidth = unwrapSignal(props.strokeWidth)\n const opacity = unwrapSignal(props.opacity)\n\n ctx.save()\n\n if (opacity !== undefined) {\n ctx.globalAlpha = opacity\n }\n\n if (fill) {\n ctx.fillStyle = fill\n ctx.fillRect(x, y, width, height)\n }\n\n if (stroke) {\n ctx.strokeStyle = stroke\n ctx.lineWidth = strokeWidth || 1\n ctx.strokeRect(x, y, width, height)\n }\n\n ctx.restore()\n}\n\n/**\n * Render circle\n */\nfunction renderCircle(\n ctx: CanvasRenderingContext2D,\n props: DrawCircleProps\n): void {\n const x = unwrapSignal(props.x)\n const y = unwrapSignal(props.y)\n const radius = unwrapSignal(props.radius)\n const fill = unwrapSignal(props.fill)\n const stroke = unwrapSignal(props.stroke)\n const strokeWidth = unwrapSignal(props.strokeWidth)\n const opacity = unwrapSignal(props.opacity)\n\n ctx.save()\n\n if (opacity !== undefined) {\n ctx.globalAlpha = opacity\n }\n\n ctx.beginPath()\n ctx.arc(x, y, radius, 0, 2 * Math.PI)\n\n if (fill) {\n ctx.fillStyle = fill\n ctx.fill()\n }\n\n if (stroke) {\n ctx.strokeStyle = stroke\n ctx.lineWidth = strokeWidth || 1\n ctx.stroke()\n }\n\n ctx.restore()\n}\n\n/**\n * Render path\n */\nfunction renderPath(ctx: CanvasRenderingContext2D, props: DrawPathProps): void {\n const d = unwrapSignal(props.d)\n const fill = unwrapSignal(props.fill)\n const stroke = unwrapSignal(props.stroke)\n const strokeWidth = unwrapSignal(props.strokeWidth)\n const opacity = unwrapSignal(props.opacity)\n\n ctx.save()\n\n if (opacity !== undefined) {\n ctx.globalAlpha = opacity\n }\n\n // Parse SVG path (simplified - only supports basic commands)\n const path = new Path2D(d)\n\n if (fill) {\n ctx.fillStyle = fill\n ctx.fill(path)\n }\n\n if (stroke) {\n ctx.strokeStyle = stroke\n ctx.lineWidth = strokeWidth || 1\n ctx.stroke(path)\n }\n\n ctx.restore()\n}\n\n/**\n * Render text\n */\nfunction renderText(ctx: CanvasRenderingContext2D, props: DrawTextProps): void {\n const x = unwrapSignal(props.x)\n const y = unwrapSignal(props.y)\n const text = unwrapSignal(props.text)\n const fill = unwrapSignal(props.fill)\n const fontSize = unwrapSignal(props.fontSize) || 12\n const fontFamily = unwrapSignal(props.fontFamily) || 'sans-serif'\n const fontWeight = unwrapSignal(props.fontWeight) || 'normal'\n const textAlign = unwrapSignal(props.textAlign) || 'left'\n const textBaseline = unwrapSignal(props.textBaseline) || 'alphabetic'\n\n ctx.save()\n\n ctx.font = `${fontWeight} ${fontSize}px ${fontFamily}`\n ctx.textAlign = textAlign\n ctx.textBaseline = textBaseline\n\n if (fill) {\n ctx.fillStyle = fill\n ctx.fillText(text, x, y)\n }\n\n ctx.restore()\n}\n\n/**\n * Render line\n */\nfunction renderLine(ctx: CanvasRenderingContext2D, props: DrawLineProps): void {\n const x1 = unwrapSignal(props.x1)\n const y1 = unwrapSignal(props.y1)\n const x2 = unwrapSignal(props.x2)\n const y2 = unwrapSignal(props.y2)\n const stroke = unwrapSignal(props.stroke) || 'black'\n const strokeWidth = unwrapSignal(props.strokeWidth) || 1\n const opacity = unwrapSignal(props.opacity)\n\n ctx.save()\n\n if (opacity !== undefined) {\n ctx.globalAlpha = opacity\n }\n\n ctx.beginPath()\n ctx.moveTo(x1, y1)\n ctx.lineTo(x2, y2)\n\n ctx.strokeStyle = stroke\n ctx.lineWidth = strokeWidth\n ctx.stroke()\n\n ctx.restore()\n}\n\n/**\n * Render arc\n */\nfunction renderArc(ctx: CanvasRenderingContext2D, props: DrawArcProps): void {\n const x = unwrapSignal(props.x)\n const y = unwrapSignal(props.y)\n const radius = unwrapSignal(props.radius)\n const startAngle = unwrapSignal(props.startAngle)\n const endAngle = unwrapSignal(props.endAngle)\n const counterclockwise = unwrapSignal(props.counterclockwise) || false\n const fill = unwrapSignal(props.fill)\n const stroke = unwrapSignal(props.stroke)\n const strokeWidth = unwrapSignal(props.strokeWidth)\n const opacity = unwrapSignal(props.opacity)\n\n ctx.save()\n\n if (opacity !== undefined) {\n ctx.globalAlpha = opacity\n }\n\n ctx.beginPath()\n ctx.arc(x, y, radius, startAngle, endAngle, counterclockwise)\n\n if (fill) {\n ctx.fillStyle = fill\n ctx.fill()\n }\n\n if (stroke) {\n ctx.strokeStyle = stroke\n ctx.lineWidth = strokeWidth || 1\n ctx.stroke()\n }\n\n ctx.restore()\n}\n","/**\n * Canvas - Declarative canvas container with JSX drawing\n *\n * Supports Signal-based reactive rendering\n *\n * @example\n * ```tsx\n * const x = signal(50)\n *\n * <Canvas width={300} height={200}>\n * <Rect x={x} y={50} width={100} height={50} fill=\"blue\" />\n * <Circle x={150} y={100} radius={30} fill=\"red\" />\n * </Canvas>\n * ```\n */\n\nimport type { FNode } from '../../types'\nimport type { CanvasProps } from '../types'\nimport { normalizeStyle } from '../utils'\nimport { renderCanvasChildren } from './renderer'\n\nexport function Canvas(props: CanvasProps): FNode {\n const { width, height, children, style, id, ...rest } = props\n\n return {\n type: 'canvas',\n props: {\n ...rest,\n id,\n width,\n height,\n style: normalizeStyle(style),\n // Attach canvas renderer when element is mounted\n ref: (canvas: HTMLCanvasElement | null) => {\n if (!canvas) return\n\n // SSR guard: skip canvas rendering on server\n if (typeof requestAnimationFrame === 'undefined') return\n\n const ctx = canvas.getContext('2d')\n if (!ctx) return\n\n // Check if effect is available before trying to import\n // Import effect and onCleanup dynamically to avoid circular deps\n Promise.all([\n import('../../core/effect').then(m => ({ effect: m.effect, onCleanup: m.onCleanup })),\n import('../../core/state').then(m => ({ isSignal: m.isSignal }))\n ])\n .then(([{ effect, onCleanup }, { isSignal }]) => {\n let rafId: number | undefined\n\n const scheduleRender = () => {\n if (rafId !== undefined) {\n cancelAnimationFrame(rafId)\n }\n\n rafId = requestAnimationFrame(() => {\n // Clear canvas\n ctx.clearRect(0, 0, width, height)\n\n // Render all children\n renderCanvasChildren(ctx, children, width, height)\n\n rafId = undefined\n })\n }\n\n effect(() => {\n // To track signal dependencies, we need to access them in the effect\n // Walk through children and touch any signals to track dependencies\n const childArray = Array.isArray(children) ? children : [children]\n for (const child of childArray) {\n if (child && child.props) {\n // Touch each prop to track signal dependencies\n for (const key in child.props) {\n const value = child.props[key]\n // If it's a signal, access its value to track it\n if (isSignal(value)) {\n void (value as any)() // Touch the signal to track dependency\n }\n }\n }\n }\n\n // Now schedule the actual render\n scheduleRender()\n\n // Cleanup RAF when effect is disposed\n onCleanup(() => {\n if (rafId !== undefined) {\n cancelAnimationFrame(rafId)\n rafId = undefined\n }\n })\n })\n })\n .catch((err) => {\n console.error('[Flexium Canvas] Failed to load signal module:', err)\n })\n },\n },\n children: [],\n }\n}\n","/**\n * DrawRect - Canvas rectangle primitive\n *\n * @example\n * ```tsx\n * <DrawRect x={10} y={10} width={100} height={50} fill=\"blue\" />\n * ```\n */\n\nimport type { FNode } from '../../types'\nimport type { DrawRectProps } from '../types'\n\nexport function DrawRect(props: DrawRectProps): FNode {\n return {\n type: 'canvas-rect',\n props,\n children: [],\n }\n}\n","/**\n * DrawCircle - Canvas circle primitive\n *\n * @example\n * ```tsx\n * <DrawCircle x={100} y={100} radius={50} fill=\"red\" />\n * ```\n */\n\nimport type { FNode } from '../../types'\nimport type { DrawCircleProps } from '../types'\n\nexport function DrawCircle(props: DrawCircleProps): FNode {\n return {\n type: 'canvas-circle',\n props,\n children: [],\n }\n}\n","/**\n * DrawArc - Canvas arc primitive\n *\n * @example\n * ```tsx\n * <DrawArc x={100} y={100} radius={50} startAngle={0} endAngle={Math.PI} fill=\"green\" />\n * ```\n */\n\nimport type { FNode } from '../../types'\nimport type { DrawArcProps } from '../types'\n\nexport function DrawArc(props: DrawArcProps): FNode {\n return {\n type: 'canvas-arc',\n props,\n children: [],\n }\n}\n","/**\n * DrawLine - Canvas line primitive\n *\n * @example\n * ```tsx\n * <DrawLine x1={10} y1={10} x2={100} y2={100} stroke=\"black\" strokeWidth={2} />\n * ```\n */\n\nimport type { FNode } from '../../types'\nimport type { DrawLineProps } from '../types'\n\nexport function DrawLine(props: DrawLineProps): FNode {\n return {\n type: 'canvas-line',\n props,\n children: [],\n }\n}\n","/**\n * DrawPath - Canvas path primitive\n *\n * @example\n * ```tsx\n * <DrawPath d=\"M 10 10 L 100 100\" stroke=\"black\" strokeWidth={2} />\n * ```\n */\n\nimport type { FNode } from '../../types'\nimport type { DrawPathProps } from '../types'\n\nexport function DrawPath(props: DrawPathProps): FNode {\n return {\n type: 'canvas-path',\n props,\n children: [],\n }\n}\n","/**\n * DrawText - Canvas text primitive\n *\n * @example\n * ```tsx\n * <DrawText x={50} y={50} text=\"Hello Canvas\" fontSize={20} fill=\"black\" />\n * ```\n */\n\nimport type { FNode } from '../../types'\nimport type { DrawTextProps } from '../types'\n\nexport function DrawText(props: DrawTextProps): FNode {\n return {\n type: 'canvas-text',\n props,\n children: [],\n }\n}\n"]}
|
package/dist/chunk-FDMJHFN7.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var o=0,i=new Set,r=new Set,n=false;function f(){n||(n=true,queueMicrotask(s));}function s(){if(n=false,r.size===0)return;let e=[];for(let t of r)e.push(t);r.clear();for(let t=0;t<e.length;t++)e[t].execute();}function a(e){r.add(e);}function b(e){i.add(e);}function d(){return o}function h(e){let t;if(e){o++;try{t=e();}finally{if(o--,o===0){let c=[];for(let u of i)c.push(u);i.clear();for(let u=0;u<c.length;u++)c[u].execute();}}}return s(),t}export{f as a,a as b,b as c,d,h as e};//# sourceMappingURL=chunk-FDMJHFN7.mjs.map
|
|
2
|
-
//# sourceMappingURL=chunk-FDMJHFN7.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/sync.ts"],"names":["batchDepth","batchQueue","autoBatchQueue","isAutoBatchScheduled","scheduleAutoBatch","flushAutoBatch","queue","sub","i","addToAutoBatch","addToBatch","getBatchDepth","sync","fn","result"],"mappings":"AAGA,IAAIA,CAAAA,CAAa,CAAA,CAEXC,CAAAA,CAAa,IAAI,GAAA,CAGjBC,CAAAA,CAAiB,IAAI,GAAA,CACvBC,CAAAA,CAAuB,KAAA,CAEpB,SAASC,CAAAA,EAA0B,CACjCD,CAAAA,GACDA,CAAAA,CAAuB,IAAA,CACvB,cAAA,CAAeE,CAAc,CAAA,EAErC,CAEO,SAASA,CAAAA,EAAuB,CAEnC,GADAF,CAAAA,CAAuB,KAAA,CACnBD,CAAAA,CAAe,IAAA,GAAS,CAAA,CAAG,OAI/B,IAAMI,CAAAA,CAAuB,EAAC,CAC9B,IAAA,IAAWC,CAAAA,IAAOL,CAAAA,CACdI,CAAAA,CAAM,IAAA,CAAKC,CAAG,CAAA,CAElBL,CAAAA,CAAe,KAAA,EAAM,CAGrB,IAAA,IAASM,CAAAA,CAAI,EAAGA,CAAAA,CAAIF,CAAAA,CAAM,MAAA,CAAQE,CAAAA,EAAAA,CAC9BF,CAAAA,CAAME,CAAC,CAAA,CAAE,OAAA,GAEjB,CAEO,SAASC,CAAAA,CAAeF,CAAAA,CAAwB,CACnDL,CAAAA,CAAe,GAAA,CAAIK,CAAG,EAC1B,CAEO,SAASG,CAAAA,CAAWH,CAAAA,CAAwB,CAC/CN,CAAAA,CAAW,GAAA,CAAIM,CAAG,EACtB,CAEO,SAASI,CAAAA,EAAwB,CACpC,OAAOX,CACX,CAwBO,SAASY,CAAAA,CAAQC,CAAAA,CAAwB,CAC5C,IAAIC,CAAAA,CAEJ,GAAID,CAAAA,CAAI,CACJb,IACA,GAAI,CACAc,CAAAA,CAASD,CAAAA,GACb,CAAA,OAAE,CAEE,GADAb,IACIA,CAAAA,GAAe,CAAA,CAAG,CAGlB,IAAMM,CAAAA,CAAuB,EAAC,CAC9B,IAAA,IAAWC,CAAAA,IAAON,CAAAA,CACdK,CAAAA,CAAM,IAAA,CAAKC,CAAG,CAAA,CAElBN,CAAAA,CAAW,KAAA,GAEX,IAAA,IAASO,CAAAA,CAAI,CAAA,CAAGA,CAAAA,CAAIF,CAAAA,CAAM,MAAA,CAAQE,CAAAA,EAAAA,CAC9BF,CAAAA,CAAME,CAAC,CAAA,CAAE,OAAA,GAEjB,CACJ,CACJ,CAGA,OAAAH,CAAAA,GAEOS,CACX","file":"chunk-FDMJHFN7.mjs","sourcesContent":["import { ISubscriber } from './graph'\n\n// Batching state\nlet batchDepth = 0\n// Batch queue now needs to store raw subscribers. Set is efficient for uniqueness.\nconst batchQueue = new Set<ISubscriber>()\n\n// Auto-batching state (Microtask Scheduler)\nconst autoBatchQueue = new Set<ISubscriber>()\nlet isAutoBatchScheduled = false\n\nexport function scheduleAutoBatch(): void {\n if (!isAutoBatchScheduled) {\n isAutoBatchScheduled = true\n queueMicrotask(flushAutoBatch)\n }\n}\n\nexport function flushAutoBatch(): void {\n isAutoBatchScheduled = false\n if (autoBatchQueue.size === 0) return\n\n // Performance: Direct iteration instead of Array.from() to avoid array allocation\n // Build array while iterating Set\n const queue: ISubscriber[] = []\n for (const sub of autoBatchQueue) {\n queue.push(sub)\n }\n autoBatchQueue.clear()\n\n // Execute effects - use for loop instead of forEach (slightly faster)\n for (let i = 0; i < queue.length; i++) {\n queue[i].execute()\n }\n}\n\nexport function addToAutoBatch(sub: ISubscriber): void {\n autoBatchQueue.add(sub)\n}\n\nexport function addToBatch(sub: ISubscriber): void {\n batchQueue.add(sub)\n}\n\nexport function getBatchDepth(): number {\n return batchDepth\n}\n\n/**\n * Synchronizes state updates.\n * \n * - `sync()`: Force flushes any pending auto-batched effects.\n * - `sync(fn)`: Batches updates within `fn`, then flushes them and any pending effects synchronously.\n *\n * @param fn - Optional function containing state updates\n * @returns The return value of fn, if provided\n *\n * @example\n * ```tsx\n * // 1. Force flush pending effects\n * count.value++\n * sync() // DOM is now updated\n *\n * // 2. Batch updates and flush immediately\n * sync(() => {\n * count.value = 1\n * name.value = 'Bob'\n * }) // Effects run once here, DOM updated\n * ```\n */\nexport function sync<T>(fn?: () => T): T | void {\n let result: T | undefined\n\n if (fn) {\n batchDepth++\n try {\n result = fn()\n } finally {\n batchDepth--\n if (batchDepth === 0) {\n // Execute all queued subscribers from manual batch\n // Performance: Direct iteration instead of Array.from() to avoid array allocation\n const queue: ISubscriber[] = []\n for (const sub of batchQueue) {\n queue.push(sub)\n }\n batchQueue.clear()\n // Use for loop instead of forEach (slightly faster)\n for (let i = 0; i < queue.length; i++) {\n queue[i].execute()\n }\n }\n }\n }\n\n // Always flushing auto-batch queue to ensure everything is synced\n flushAutoBatch()\n\n return result\n}\n"]}
|
package/dist/chunk-GKJQEOP7.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import {a}from'./chunk-WVEJT7HD.mjs';import {d as d$1}from'./chunk-HB5VPQTB.mjs';function m(e){let t={},i=[];return e.x!==void 0&&i.push(`translateX(${e.x}px)`),e.y!==void 0&&i.push(`translateY(${e.y}px)`),e.scale!==void 0?i.push(`scale(${e.scale})`):(e.scaleX!==void 0&&i.push(`scaleX(${e.scaleX})`),e.scaleY!==void 0&&i.push(`scaleY(${e.scaleY})`)),e.rotate!==void 0&&i.push(`rotate(${e.rotate}deg)`),i.length>0&&(t.transform=i.join(" ")),e.opacity!==void 0&&(t.opacity=e.opacity.toString()),e.width!==void 0&&(t.width=typeof e.width=="number"?`${e.width}px`:e.width),e.height!==void 0&&(t.height=typeof e.height=="number"?`${e.height}px`:e.height),t}function L(e){let t=e.tension??170,i=e.friction??26,o=e.mass??1,r=t,n=i,s=o,l=Math.sqrt(r/s),c=n/(2*Math.sqrt(r*s)),u=4.6/(c*l)*1e3;return c<1?{duration:u,easing:"cubic-bezier(0.34, 1.56, 0.64, 1)"}:{duration:u,easing:"cubic-bezier(0.22, 1, 0.36, 1)"}}var d=null,x=null;function A(){if(d===null)if(typeof window<"u"&&window.matchMedia){let e=window.matchMedia("(prefers-reduced-motion: reduce)");d=e.matches;let t=i=>{d=i.matches;};e.addEventListener("change",t),x=()=>{e.removeEventListener("change",t),d=null,x=null;};}else d=false;return d}function O(){x&&x();}var f=class{constructor(t){this.animation=null;this.resizeObserver=null;this.previousSize=null;this.element=t;}animate(t){let{initial:i,animate:o,duration:r=300,spring:n,easing:s="ease-out",delay:l=0}=t;if(!o)return;if(this.cancel(),A()){let a=m(o);Object.assign(this.element.style,{transform:a.transform||"",opacity:a.opacity||"",width:a.width||"",height:a.height||""}),t.onAnimationStart&&t.onAnimationStart(),t.onAnimationComplete&&t.onAnimationComplete();return}if(i){let a=m(i);Object.assign(this.element.style,{transform:a.transform||"",opacity:a.opacity||"",width:a.width||"",height:a.height||""});}let c=i?m(i):{},u=m(o),h=r,g=s;if(n){let a=L(n);h=a.duration,g=a.easing;}this.animation=this.element.animate([c,u],{duration:h,easing:g,delay:l,fill:"forwards"}),t.onAnimationStart&&t.onAnimationStart(),this.animation.onfinish=()=>{t.onAnimationComplete&&t.onAnimationComplete();};}async animateExit(t,i=300,o="ease-in"){if(this.cancel(),A()){let n=m(t);Object.assign(this.element.style,{transform:n.transform||"",opacity:n.opacity||"",width:n.width||"",height:n.height||""});return}let r=m(t);this.animation=this.element.animate([{},r],{duration:i,easing:o,fill:"forwards"}),await this.animation.finished;}enableLayoutAnimation(t=300,i="ease-out"){let o=this.element.getBoundingClientRect();this.previousSize={width:o.width,height:o.height},this.resizeObserver=new ResizeObserver(r=>{for(let n of r){if(!this.previousSize){this.previousSize={width:n.contentRect.width,height:n.contentRect.height};return}let s=n.contentRect.width,l=n.contentRect.height;(s!==this.previousSize.width||l!==this.previousSize.height)&&(this.cancel(),this.animation=this.element.animate([{width:`${this.previousSize.width}px`,height:`${this.previousSize.height}px`},{width:`${s}px`,height:`${l}px`}],{duration:t,easing:i,fill:"forwards"}),this.previousSize={width:s,height:l});}}),this.resizeObserver.observe(this.element);}disableLayoutAnimation(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null,this.previousSize=null);}cancel(){this.animation&&(this.animation.cancel(),this.animation=null);}dispose(){this.cancel(),this.disableLayoutAnimation();}};function R(e){switch(e){case "fade":return {enter:{opacity:0},enterTo:{opacity:1},exit:{opacity:0}};case "slide-up":return {enter:{opacity:0,y:20},enterTo:{opacity:1,y:0},exit:{opacity:0,y:-20}};case "slide-down":return {enter:{opacity:0,y:-20},enterTo:{opacity:1,y:0},exit:{opacity:0,y:20}};case "slide-left":return {enter:{opacity:0,x:20},enterTo:{opacity:1,x:0},exit:{opacity:0,x:-20}};case "slide-right":return {enter:{opacity:0,x:-20},enterTo:{opacity:1,x:0},exit:{opacity:0,x:20}};case "scale":return {enter:{scale:.9},enterTo:{scale:1},exit:{scale:.9}};case "scale-fade":return {enter:{opacity:0,scale:.95},enterTo:{opacity:1,scale:1},exit:{opacity:0,scale:.95}};default:return {enter:{},enterTo:{},exit:{}}}}var y=null;function $(e){let{preset:t,enter:i,enterTo:o,exit:r,enterTiming:n={duration:300,easing:"ease-out"},exitTiming:s={duration:200,easing:"ease-in"},onEnterStart:l,onEnterComplete:c,onExitStart:u,onExitComplete:h,children:g}=e,a$1=t?R(t):null,P=i??a$1?.enter??{},C=o??a$1?.enterTo??{},S=r??a$1?.exit??{},b=null,p=null,M=y?.registerChild()??0,z=y?.staggerDelay??0,E=M*z;return d$1(async()=>{b&&p&&(u?.(),await p.animateExit(S,s.duration,s.easing),h?.());}),a("div",{style:{display:"contents"},ref:T=>{T&&(b=T,p=new f(T),queueMicrotask(()=>{p&&(l?.(),p.animate({initial:P,animate:C,duration:n.duration,easing:n.easing,delay:(n.delay??0)+E,onAnimationComplete:c}));}));}},g)}function G(e){let{stagger:t=50,children:i}=e,o=0,r={registerChild:()=>o++,staggerDelay:t};return ()=>{o=0;let n=y;y=r;try{return i}finally{y=n;}}}var D={fade:{preset:"fade"},slideUp:{preset:"slide-up"},slideDown:{preset:"slide-down"},slideLeft:{preset:"slide-left"},slideRight:{preset:"slide-right"},scale:{preset:"scale"},scaleFade:{preset:"scale-fade"},modal:{enter:{opacity:0,scale:.95,y:-10},enterTo:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},enterTiming:{duration:200,easing:"cubic-bezier(0.16, 1, 0.3, 1)"},exitTiming:{duration:150,easing:"ease-in"}},dropdown:{enter:{opacity:0,y:-8,scale:.95},enterTo:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},enterTiming:{duration:150,easing:"ease-out"},exitTiming:{duration:100,easing:"ease-in"}},tooltip:{enter:{opacity:0,scale:.9},enterTo:{opacity:1,scale:1},exit:{opacity:0,scale:.9},enterTiming:{duration:100,easing:"ease-out"},exitTiming:{duration:75,easing:"ease-in"}},notification:{enter:{opacity:0,x:100},enterTo:{opacity:1,x:0},exit:{opacity:0,x:100},enterTiming:{duration:300,easing:"cubic-bezier(0.16, 1, 0.3, 1)"},exitTiming:{duration:200,easing:"ease-in"}},page:{enter:{opacity:0},enterTo:{opacity:1},exit:{opacity:0},enterTiming:{duration:200,easing:"ease-out"},exitTiming:{duration:150,easing:"ease-in"}}};export{O as a,f as b,$ as c,G as d,D as e};//# sourceMappingURL=chunk-GKJQEOP7.mjs.map
|
|
2
|
-
//# sourceMappingURL=chunk-GKJQEOP7.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/primitives/motion/Motion.ts","../src/primitives/motion/Transition.ts"],"names":["propsToKeyframe","props","keyframe","transforms","springToTiming","spring","tension","friction","mass","k","c","m","naturalFreq","dampingRatio","duration","prefersReducedMotion","mediaQueryCleanup","checkReducedMotion","mediaQuery","handler","e","cleanupMotionState","MotionController","element","initial","animate","easing","delay","finalKeyframe","initialKeyframe","from","to","animDuration","animEasing","timing","exitProps","rect","entries","entry","newWidth","newHeight","getPresetKeyframes","preset","currentTransitionGroup","Transition","customEnter","customEnterTo","customExit","enterTiming","exitTiming","onEnterStart","onEnterComplete","onExitStart","onExitComplete","children","presetFrames","enter","enterTo","exit","controller","staggerIndex","staggerDelay","additionalDelay","onCleanup","f","el","TransitionGroup","stagger","childIndex","context","previousGroup","transitions"],"mappings":"iFAkDA,SAASA,EAAgBC,CAAAA,CAAkC,CACzD,IAAMC,CAAAA,CAAqB,EAAC,CAEtBC,CAAAA,CAAuB,EAAC,CAE9B,OAAIF,CAAAA,CAAM,CAAA,GAAM,MAAA,EACdE,CAAAA,CAAW,KAAK,CAAA,WAAA,EAAcF,CAAAA,CAAM,CAAC,CAAA,GAAA,CAAK,EAGxCA,CAAAA,CAAM,CAAA,GAAM,MAAA,EACdE,CAAAA,CAAW,KAAK,CAAA,WAAA,EAAcF,CAAAA,CAAM,CAAC,CAAA,GAAA,CAAK,EAGxCA,CAAAA,CAAM,KAAA,GAAU,OAClBE,CAAAA,CAAW,IAAA,CAAK,SAAS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,WAAA,CAAa,CAAE,SAAU,GAAA,CAAK,MAAA,CAAQ,UAAW,CAAA,CACjD,WAAY,CAAE,QAAA,CAAU,IAAK,MAAA,CAAQ,SAAU,CACjD,CACF","file":"chunk-GKJQEOP7.mjs","sourcesContent":["/**\n * Motion Component - Declarative animations using Web Animations API\n *\n * Provides smooth, performant animations without JavaScript RAF\n * Supports transforms, opacity, spring physics, and layout animations\n */\n\n/**\n * Animation properties that can be animated\n */\nexport interface AnimatableProps {\n x?: number\n y?: number\n scale?: number\n scaleX?: number\n scaleY?: number\n rotate?: number // in degrees\n opacity?: number\n width?: number | string\n height?: number | string\n}\n\n/**\n * Spring physics configuration\n */\nexport interface SpringConfig {\n tension?: number // Default: 170\n friction?: number // Default: 26\n mass?: number // Default: 1\n}\n\n/**\n * Motion component props\n */\nexport interface MotionProps {\n element?: HTMLElement | null\n initial?: AnimatableProps\n animate?: AnimatableProps\n exit?: AnimatableProps\n duration?: number // in milliseconds\n spring?: SpringConfig\n easing?: string // CSS easing function\n delay?: number\n onAnimationStart?: () => void\n onAnimationComplete?: () => void\n}\n\n/**\n * Convert animatable props to Web Animations API keyframe\n */\nfunction propsToKeyframe(props: AnimatableProps): Keyframe {\n const keyframe: Keyframe = {}\n\n const transforms: string[] = []\n\n if (props.x !== undefined) {\n transforms.push(`translateX(${props.x}px)`)\n }\n\n if (props.y !== undefined) {\n transforms.push(`translateY(${props.y}px)`)\n }\n\n if (props.scale !== undefined) {\n transforms.push(`scale(${props.scale})`)\n } else {\n if (props.scaleX !== undefined) {\n transforms.push(`scaleX(${props.scaleX})`)\n }\n if (props.scaleY !== undefined) {\n transforms.push(`scaleY(${props.scaleY})`)\n }\n }\n\n if (props.rotate !== undefined) {\n transforms.push(`rotate(${props.rotate}deg)`)\n }\n\n if (transforms.length > 0) {\n keyframe.transform = transforms.join(' ')\n }\n\n if (props.opacity !== undefined) {\n keyframe.opacity = props.opacity.toString()\n }\n\n if (props.width !== undefined) {\n keyframe.width =\n typeof props.width === 'number' ? `${props.width}px` : props.width\n }\n\n if (props.height !== undefined) {\n keyframe.height =\n typeof props.height === 'number' ? `${props.height}px` : props.height\n }\n\n return keyframe\n}\n\n/**\n * Calculate spring-based duration and easing\n * Based on spring physics formula\n */\nfunction springToTiming(spring: SpringConfig): {\n duration: number\n easing: string\n} {\n const tension = spring.tension ?? 170\n const friction = spring.friction ?? 26\n const mass = spring.mass ?? 1\n\n // Calculate damping ratio and natural frequency\n const k = tension\n const c = friction\n const m = mass\n\n const naturalFreq = Math.sqrt(k / m)\n const dampingRatio = c / (2 * Math.sqrt(k * m))\n\n // Calculate duration (time to settle within 1% of final value)\n const duration = (4.6 / (dampingRatio * naturalFreq)) * 1000\n\n // Create spring easing curve\n // For underdamped (bouncy) springs\n if (dampingRatio < 1) {\n // Use cubic-bezier that approximates spring behavior\n // Values tuned for natural spring feel\n const easing = `cubic-bezier(0.34, 1.56, 0.64, 1)`\n return { duration, easing }\n }\n\n // For critically damped or overdamped springs\n const easing = `cubic-bezier(0.22, 1, 0.36, 1)`\n return { duration, easing }\n}\n\n/**\n * Check if user prefers reduced motion\n * Cached at module level for performance\n */\nlet prefersReducedMotion: boolean | null = null\nlet mediaQueryCleanup: (() => void) | null = null\n\nfunction checkReducedMotion(): boolean {\n if (prefersReducedMotion === null) {\n if (typeof window !== 'undefined' && window.matchMedia) {\n const mediaQuery = window.matchMedia('(prefers-reduced-motion: reduce)')\n prefersReducedMotion = mediaQuery.matches\n // Listen for changes with proper cleanup support\n const handler = (e: MediaQueryListEvent) => {\n prefersReducedMotion = e.matches\n }\n mediaQuery.addEventListener('change', handler)\n mediaQueryCleanup = () => {\n mediaQuery.removeEventListener('change', handler)\n prefersReducedMotion = null\n mediaQueryCleanup = null\n }\n } else {\n prefersReducedMotion = false\n }\n }\n return prefersReducedMotion\n}\n\n/**\n * Cleanup motion module state (useful for testing and SSR)\n */\nexport function cleanupMotionState(): void {\n if (mediaQueryCleanup) {\n mediaQueryCleanup()\n }\n}\n\n/**\n * Motion controller class\n * Manages animations for a single element using Web Animations API\n * Respects prefers-reduced-motion accessibility setting\n */\nexport class MotionController {\n private element: HTMLElement\n private animation: Animation | null = null\n private resizeObserver: ResizeObserver | null = null\n private previousSize: { width: number; height: number } | null = null\n\n constructor(element: HTMLElement) {\n this.element = element\n }\n\n /**\n * Animate from initial to animate props\n * Respects prefers-reduced-motion: applies end state instantly if enabled\n */\n animate(props: MotionProps): void {\n const {\n initial,\n animate,\n duration = 300,\n spring,\n easing = 'ease-out',\n delay = 0,\n } = props\n\n if (!animate) return\n\n // Cancel any running animation\n this.cancel()\n\n // Respect prefers-reduced-motion: skip animation and apply final state instantly\n if (checkReducedMotion()) {\n const finalKeyframe = propsToKeyframe(animate)\n Object.assign(this.element.style, {\n transform: finalKeyframe.transform || '',\n opacity: finalKeyframe.opacity || '',\n width: finalKeyframe.width || '',\n height: finalKeyframe.height || '',\n })\n if (props.onAnimationStart) props.onAnimationStart()\n if (props.onAnimationComplete) props.onAnimationComplete()\n return\n }\n\n // Apply initial state immediately if provided\n if (initial) {\n const initialKeyframe = propsToKeyframe(initial)\n Object.assign(this.element.style, {\n transform: initialKeyframe.transform || '',\n opacity: initialKeyframe.opacity || '',\n width: initialKeyframe.width || '',\n height: initialKeyframe.height || '',\n })\n }\n\n // Create keyframes\n const from = initial ? propsToKeyframe(initial) : {}\n const to = propsToKeyframe(animate)\n\n // Calculate timing\n let animDuration = duration\n let animEasing = easing\n\n if (spring) {\n const timing = springToTiming(spring)\n animDuration = timing.duration\n animEasing = timing.easing\n }\n\n // Create animation\n this.animation = this.element.animate([from, to], {\n duration: animDuration,\n easing: animEasing,\n delay,\n fill: 'forwards',\n })\n\n // Handle callbacks\n if (props.onAnimationStart) {\n props.onAnimationStart()\n }\n\n this.animation.onfinish = () => {\n if (props.onAnimationComplete) {\n props.onAnimationComplete()\n }\n }\n }\n\n /**\n * Animate exit (used when element is being removed)\n * Respects prefers-reduced-motion: applies end state instantly if enabled\n */\n async animateExit(\n exitProps: AnimatableProps,\n duration = 300,\n easing = 'ease-in'\n ): Promise<void> {\n this.cancel()\n\n // Respect prefers-reduced-motion: skip animation\n if (checkReducedMotion()) {\n const finalKeyframe = propsToKeyframe(exitProps)\n Object.assign(this.element.style, {\n transform: finalKeyframe.transform || '',\n opacity: finalKeyframe.opacity || '',\n width: finalKeyframe.width || '',\n height: finalKeyframe.height || '',\n })\n return\n }\n\n const to = propsToKeyframe(exitProps)\n\n this.animation = this.element.animate([{}, to], {\n duration,\n easing,\n fill: 'forwards',\n })\n\n await this.animation.finished\n }\n\n /**\n * Enable layout animations (animate size changes automatically)\n */\n enableLayoutAnimation(duration = 300, easing = 'ease-out'): void {\n // Store initial size\n const rect = this.element.getBoundingClientRect()\n this.previousSize = { width: rect.width, height: rect.height }\n\n // Watch for size changes\n this.resizeObserver = new ResizeObserver((entries) => {\n for (const entry of entries) {\n if (!this.previousSize) {\n this.previousSize = {\n width: entry.contentRect.width,\n height: entry.contentRect.height,\n }\n return\n }\n\n const newWidth = entry.contentRect.width\n const newHeight = entry.contentRect.height\n\n // Only animate if size actually changed\n if (\n newWidth !== this.previousSize.width ||\n newHeight !== this.previousSize.height\n ) {\n // Animate from previous size to new size\n this.cancel()\n\n this.animation = this.element.animate(\n [\n {\n width: `${this.previousSize.width}px`,\n height: `${this.previousSize.height}px`,\n },\n {\n width: `${newWidth}px`,\n height: `${newHeight}px`,\n },\n ],\n {\n duration,\n easing,\n fill: 'forwards',\n }\n )\n\n this.previousSize = { width: newWidth, height: newHeight }\n }\n }\n })\n\n this.resizeObserver.observe(this.element)\n }\n\n /**\n * Disable layout animations\n */\n disableLayoutAnimation(): void {\n if (this.resizeObserver) {\n this.resizeObserver.disconnect()\n this.resizeObserver = null\n this.previousSize = null\n }\n }\n\n /**\n * Cancel current animation\n */\n cancel(): void {\n if (this.animation) {\n this.animation.cancel()\n this.animation = null\n }\n }\n\n /**\n * Cleanup all animations and observers\n */\n dispose(): void {\n this.cancel()\n this.disableLayoutAnimation()\n }\n}\n\n\n","/**\n * Transition Component - Coordinated Enter/Exit Animations\n *\n * Provides declarative transitions for elements entering and leaving the DOM.\n * Works seamlessly with For and conditional rendering (ternary, &&).\n */\n\nimport { onCleanup } from '../../core/effect'\nimport type { AnimatableProps, MotionController } from './Motion'\nimport { MotionController as MC } from './Motion'\nimport { f } from '../../renderers/dom/f'\n\n/**\n * Preset animation types\n */\nexport type TransitionPreset =\n | 'fade'\n | 'slide-up'\n | 'slide-down'\n | 'slide-left'\n | 'slide-right'\n | 'scale'\n | 'scale-fade'\n\n/**\n * Transition timing configuration\n */\nexport interface TransitionTiming {\n duration?: number\n delay?: number\n easing?: string\n}\n\n/**\n * Transition component props\n */\nexport interface TransitionProps {\n /** Use a preset animation */\n preset?: TransitionPreset\n /** Custom enter animation (from state) */\n enter?: AnimatableProps\n /** Custom enter animation (to state) */\n enterTo?: AnimatableProps\n /** Custom exit animation (to state) */\n exit?: AnimatableProps\n /** Enter timing */\n enterTiming?: TransitionTiming\n /** Exit timing */\n exitTiming?: TransitionTiming\n /** Callback when enter animation starts */\n onEnterStart?: () => void\n /** Callback when enter animation completes */\n onEnterComplete?: () => void\n /** Callback when exit animation starts */\n onExitStart?: () => void\n /** Callback when exit animation completes */\n onExitComplete?: () => void\n /** Children to animate */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n children: any\n}\n\n/**\n * Get animation keyframes for a preset\n */\nfunction getPresetKeyframes(preset: TransitionPreset): {\n enter: AnimatableProps\n enterTo: AnimatableProps\n exit: AnimatableProps\n} {\n switch (preset) {\n case 'fade':\n return {\n enter: { opacity: 0 },\n enterTo: { opacity: 1 },\n exit: { opacity: 0 },\n }\n case 'slide-up':\n return {\n enter: { opacity: 0, y: 20 },\n enterTo: { opacity: 1, y: 0 },\n exit: { opacity: 0, y: -20 },\n }\n case 'slide-down':\n return {\n enter: { opacity: 0, y: -20 },\n enterTo: { opacity: 1, y: 0 },\n exit: { opacity: 0, y: 20 },\n }\n case 'slide-left':\n return {\n enter: { opacity: 0, x: 20 },\n enterTo: { opacity: 1, x: 0 },\n exit: { opacity: 0, x: -20 },\n }\n case 'slide-right':\n return {\n enter: { opacity: 0, x: -20 },\n enterTo: { opacity: 1, x: 0 },\n exit: { opacity: 0, x: 20 },\n }\n case 'scale':\n return {\n enter: { scale: 0.9 },\n enterTo: { scale: 1 },\n exit: { scale: 0.9 },\n }\n case 'scale-fade':\n return {\n enter: { opacity: 0, scale: 0.95 },\n enterTo: { opacity: 1, scale: 1 },\n exit: { opacity: 0, scale: 0.95 },\n }\n default:\n return {\n enter: {},\n enterTo: {},\n exit: {},\n }\n }\n}\n\n/**\n * TransitionGroup context for staggered animations\n */\ninterface TransitionGroupContext {\n registerChild: () => number\n staggerDelay: number\n}\n\nlet currentTransitionGroup: TransitionGroupContext | null = null\n\n/**\n * Transition component for animated enter/exit\n *\n * @example\n * {() => visible() && (\n * <Transition preset=\"fade\">\n * <div>Content appears with fade</div>\n * </Transition>\n * )}\n *\n * @example\n * <Transition\n * enter={{ opacity: 0, y: 50 }}\n * enterTo={{ opacity: 1, y: 0 }}\n * exit={{ opacity: 0, y: -50 }}\n * enterTiming={{ duration: 300, easing: 'ease-out' }}\n * exitTiming={{ duration: 200, easing: 'ease-in' }}\n * >\n * <div>Custom animated content</div>\n * </Transition>\n */\nexport function Transition(props: TransitionProps) {\n const {\n preset,\n enter: customEnter,\n enterTo: customEnterTo,\n exit: customExit,\n enterTiming = { duration: 300, easing: 'ease-out' },\n exitTiming = { duration: 200, easing: 'ease-in' },\n onEnterStart,\n onEnterComplete,\n onExitStart,\n onExitComplete,\n children,\n } = props\n\n // Get keyframes from preset or custom props\n const presetFrames = preset ? getPresetKeyframes(preset) : null\n const enter = customEnter ?? presetFrames?.enter ?? {}\n const enterTo = customEnterTo ?? presetFrames?.enterTo ?? {}\n const exit = customExit ?? presetFrames?.exit ?? {}\n\n // Track the mounted element and controller\n let element: HTMLElement | null = null\n let controller: MotionController | null = null\n\n // Get stagger delay from group if present\n const staggerIndex = currentTransitionGroup?.registerChild() ?? 0\n const staggerDelay = currentTransitionGroup?.staggerDelay ?? 0\n const additionalDelay = staggerIndex * staggerDelay\n\n // Setup cleanup for exit animation\n onCleanup(async () => {\n if (element && controller) {\n onExitStart?.()\n\n await controller.animateExit(exit, exitTiming.duration, exitTiming.easing)\n\n onExitComplete?.()\n }\n })\n\n // Return wrapper div with ref to capture element\n return f(\n 'div',\n {\n style: { display: 'contents' },\n ref: (el: HTMLElement | null) => {\n if (!el) return\n\n element = el\n controller = new MC(el)\n\n // Schedule enter animation after DOM update\n queueMicrotask(() => {\n if (controller) {\n onEnterStart?.()\n\n controller.animate({\n initial: enter,\n animate: enterTo,\n duration: enterTiming.duration,\n easing: enterTiming.easing,\n delay: (enterTiming.delay ?? 0) + additionalDelay,\n onAnimationComplete: onEnterComplete,\n })\n }\n })\n },\n },\n children\n )\n}\n\n/**\n * TransitionGroup props\n */\nexport interface TransitionGroupProps {\n /** Delay between each child animation (stagger effect) */\n stagger?: number\n /** Children (should contain Transition components) */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n children: any\n}\n\n/**\n * TransitionGroup component for staggered animations\n *\n * @example\n * <TransitionGroup stagger={50}>\n * <For each={items}>\n * {(item) => (\n * <Transition preset=\"slide-up\">\n * <div>{item.name}</div>\n * </Transition>\n * )}\n * </For>\n * </TransitionGroup>\n */\nexport function TransitionGroup(props: TransitionGroupProps) {\n const { stagger = 50, children } = props\n\n let childIndex = 0\n\n const context: TransitionGroupContext = {\n registerChild: () => childIndex++,\n staggerDelay: stagger,\n }\n\n return () => {\n // Reset child index for each render\n childIndex = 0\n\n // Set context for child Transitions\n const previousGroup = currentTransitionGroup\n currentTransitionGroup = context\n\n try {\n return children\n } finally {\n currentTransitionGroup = previousGroup\n }\n }\n}\n\n/**\n * Preset transition configurations\n */\nexport const transitions = {\n fade: { preset: 'fade' },\n slideUp: { preset: 'slide-up' },\n slideDown: { preset: 'slide-down' },\n slideLeft: { preset: 'slide-left' },\n slideRight: { preset: 'slide-right' },\n scale: { preset: 'scale' },\n scaleFade: { preset: 'scale-fade' },\n\n // Common UI patterns\n modal: {\n enter: { opacity: 0, scale: 0.95, y: -10 },\n enterTo: { opacity: 1, scale: 1, y: 0 },\n exit: { opacity: 0, scale: 0.95, y: 10 },\n enterTiming: { duration: 200, easing: 'cubic-bezier(0.16, 1, 0.3, 1)' },\n exitTiming: { duration: 150, easing: 'ease-in' },\n },\n\n dropdown: {\n enter: { opacity: 0, y: -8, scale: 0.95 },\n enterTo: { opacity: 1, y: 0, scale: 1 },\n exit: { opacity: 0, y: -8, scale: 0.95 },\n enterTiming: { duration: 150, easing: 'ease-out' },\n exitTiming: { duration: 100, easing: 'ease-in' },\n },\n\n tooltip: {\n enter: { opacity: 0, scale: 0.9 },\n enterTo: { opacity: 1, scale: 1 },\n exit: { opacity: 0, scale: 0.9 },\n enterTiming: { duration: 100, easing: 'ease-out' },\n exitTiming: { duration: 75, easing: 'ease-in' },\n },\n\n notification: {\n enter: { opacity: 0, x: 100 },\n enterTo: { opacity: 1, x: 0 },\n exit: { opacity: 0, x: 100 },\n enterTiming: { duration: 300, easing: 'cubic-bezier(0.16, 1, 0.3, 1)' },\n exitTiming: { duration: 200, easing: 'ease-in' },\n },\n\n page: {\n enter: { opacity: 0 },\n enterTo: { opacity: 1 },\n exit: { opacity: 0 },\n enterTiming: { duration: 200, easing: 'ease-out' },\n exitTiming: { duration: 150, easing: 'ease-in' },\n },\n} satisfies Record<string, Omit<TransitionProps, 'children'>>\n"]}
|
package/dist/chunk-GYDP6MFV.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
'use strict';var n={EFFECT_EXECUTION_FAILED:"FLX101",CLEANUP_OUTSIDE_EFFECT:"FLX102",SIGNAL_UPDATE_DURING_RENDER:"FLX103",COMPUTED_EXECUTION_FAILED:"FLX104",CONTEXT_MISSING_PROVIDER:"FLX201",ROUTER_OUTSIDE_PROVIDER:"FLX202",FORM_VALIDATION_FAILED:"FLX301",FORM_SUBMISSION_FAILED:"FLX302",ASYNC_VALIDATION_FAILED:"FLX303",BUTTON_HANDLER_FAILED:"FLX401",BUTTON_MISSING_ARIA_LABEL:"FLX402",COMPONENT_RENDER_FAILED:"FLX403",HYDRATION_MISMATCH:"FLX501",HYDRATION_TEXT_MISMATCH:"FLX502",HYDRATION_TAG_MISMATCH:"FLX503",HYDRATION_ATTRIBUTE_MISMATCH:"FLX504",DEVTOOLS_LISTENER_ERROR:"FLX601",UNCAUGHT_RENDER_ERROR:"FLX701",ERROR_BOUNDARY_CALLBACK_FAILED:"FLX702",DOM_CLEANUP_FAILED:"FLX703",EVENT_HANDLER_FAILED:"FLX801",KEYBOARD_HANDLER_FAILED:"FLX802",RESOURCE_FETCH_FAILED:"FLX901",RESOURCE_TIMEOUT:"FLX902"};function g(e){return typeof process<"u"&&process.env?.NODE_ENV!=="production"?{[n.EFFECT_EXECUTION_FAILED]:{message:"Effect execution failed",suggestion:"Check the effect callback for runtime errors. Consider wrapping async operations in try-catch."},[n.CLEANUP_OUTSIDE_EFFECT]:{message:"onCleanup must be called from within an effect",suggestion:"Move the onCleanup() call inside an effect() callback."},[n.SIGNAL_UPDATE_DURING_RENDER]:{message:"Signal was updated during render",suggestion:"Avoid updating signals inside render functions. Use effect() for side effects."},[n.CONTEXT_MISSING_PROVIDER]:{message:"Context used outside of Provider",suggestion:"Wrap your component tree with the appropriate Context.Provider."},[n.ROUTER_OUTSIDE_PROVIDER]:{message:"router() must be used within a <Router> component",suggestion:"Ensure your component is a descendant of <Router>."},[n.FORM_VALIDATION_FAILED]:{message:"Form field validation failed",suggestion:"Check the validation rules for the field and the input value."},[n.FORM_SUBMISSION_FAILED]:{message:"Form submission failed",suggestion:"Check the onSubmit handler and network connectivity."},[n.BUTTON_HANDLER_FAILED]:{message:"Button press handler failed",suggestion:"Check the onPress/onClick callback for errors."},[n.BUTTON_MISSING_ARIA_LABEL]:{message:"IconButton is missing an aria-label",suggestion:"Add an aria-label prop to IconButton for screen reader accessibility."},[n.HYDRATION_MISMATCH]:{message:"Hydration mismatch detected",suggestion:"Ensure server and client render the same content. Check for browser-only code."},[n.HYDRATION_TEXT_MISMATCH]:{message:"Text content mismatch during hydration",suggestion:"Server and client rendered different text. Check for Date.now(), Math.random(), or client-only data."},[n.HYDRATION_TAG_MISMATCH]:{message:"Element tag mismatch during hydration",suggestion:"Server and client rendered different elements. Verify conditional rendering logic."},[n.DEVTOOLS_LISTENER_ERROR]:{message:"DevTools listener threw an error",suggestion:"Check your DevTools event listener callback."},[n.UNCAUGHT_RENDER_ERROR]:{message:"Uncaught error during render",suggestion:"Wrap components with <ErrorBoundary> to catch and handle errors gracefully."},[n.ERROR_BOUNDARY_CALLBACK_FAILED]:{message:"ErrorBoundary callback failed",suggestion:"Check your onError or onReset callback for errors."},[n.COMPUTED_EXECUTION_FAILED]:{message:"Computed value execution failed",suggestion:"Check the computed callback for runtime errors. Ensure all dependencies are valid."},[n.ASYNC_VALIDATION_FAILED]:{message:"Async form validation failed",suggestion:"Check the async validation function and ensure it handles errors properly."},[n.COMPONENT_RENDER_FAILED]:{message:"Component render failed",suggestion:"Check the component function for runtime errors. Consider wrapping with <ErrorBoundary>."},[n.HYDRATION_ATTRIBUTE_MISMATCH]:{message:"Attribute mismatch during hydration",suggestion:"Server and client rendered different attribute values. Check for dynamic attributes."},[n.DOM_CLEANUP_FAILED]:{message:"DOM cleanup operation failed",suggestion:"A node may have been removed from the DOM unexpectedly. Check for manual DOM manipulation."},[n.EVENT_HANDLER_FAILED]:{message:"Event handler threw an error",suggestion:"Check your event handler callback. Consider adding try-catch for async operations."},[n.KEYBOARD_HANDLER_FAILED]:{message:"Keyboard event handler failed",suggestion:"Check the onKeyDown/onKeyUp handler for errors."},[n.RESOURCE_FETCH_FAILED]:{message:"Resource fetch failed",suggestion:"Check the async function and network connectivity. The resource will show an error state."},[n.RESOURCE_TIMEOUT]:{message:"Resource fetch timed out",suggestion:"The async operation took too long. Consider adding a timeout handler or retry logic."}}[e]||{message:`Error ${e}`}:{message:`Minified Error ${e}`}}function c(e,r,o){let t=g(e);return {code:e,message:t.message,suggestion:t.suggestion,context:r,originalError:o}}function u(e){let r=`[Flexium ${e.code}] ${e.message}`;if(e.context&&Object.keys(e.context).length>0){let o=Object.entries(e.context).map(([t,s])=>`${t}: ${JSON.stringify(s)}`).join(", ");r+=` (${o})`;}return e.suggestion&&(r+=`
|
|
2
|
-
\u2192 ${e.suggestion}`),r}function E(e,r,o){let t=c(e,r,o),s=u(t);o?console.error(s,o):console.error(s);}function d(e,r){let o=c(e,r),t=u(o);console.warn(t);}var i=null;function f(){return i}function _(e){i=e;}function I(e){let r=i;i=null;try{return e()}finally{i=r;}}var a=null;function R(){return a}function A(e){a=e;}function T(e){let r=a,o={cleanups:[],context:r?Object.create(r.context):null,owner:r};a=o;let t=()=>{if(o.cleanups.length!==0){for(let s of o.cleanups)s();o.cleanups=[];}};try{return e(t)}finally{a=r;}}exports.a=n;exports.b=E;exports.c=d;exports.d=f;exports.e=_;exports.f=I;exports.g=R;exports.h=A;exports.i=T;//# sourceMappingURL=chunk-GYDP6MFV.js.map
|
|
3
|
-
//# sourceMappingURL=chunk-GYDP6MFV.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/errors.ts","../src/core/owner.ts"],"names":["ErrorCodes","getErrorDetails","code","createErrorInfo","context","originalError","details","formatErrorMessage","info","message","contextStr","key","value","logError","logWarning","activeEffect","getActiveEffect","setActiveEffect","effect","untrack","fn","prev","owner","getOwner","setOwner","newOwner","root","prevOwner","dispose","cleanup"],"mappings":"aAQO,IAAMA,CAAAA,CAAa,CAExB,uBAAA,CAAyB,QAAA,CACzB,uBAAwB,QAAA,CACxB,2BAAA,CAA6B,SAC7B,yBAAA,CAA2B,QAAA,CAG3B,yBAA0B,QAAA,CAC1B,uBAAA,CAAyB,SAGzB,sBAAA,CAAwB,QAAA,CACxB,uBAAwB,QAAA,CACxB,uBAAA,CAAyB,QAAA,CAG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J,CAAAA,CAAS,QAAA,CAAW,IACxB,CAAA,CAEA,GAAI,CACA,OAAOL,EAAGQ,CAAO,CACrB,QAAE,CACEN,CAAAA,CAAQK,EACZ,CACJ","file":"chunk-GYDP6MFV.js","sourcesContent":["/**\n * Flexium Error System\n *\n * Standardized error handling with error codes, contextual information,\n * and actionable suggestions for developers.\n */\n\n// Error codes for all Flexium errors\nexport const ErrorCodes = {\n // Signal/Effect errors (1xx)\n EFFECT_EXECUTION_FAILED: 'FLX101',\n CLEANUP_OUTSIDE_EFFECT: 'FLX102',\n SIGNAL_UPDATE_DURING_RENDER: 'FLX103',\n COMPUTED_EXECUTION_FAILED: 'FLX104',\n\n // Context errors (2xx)\n CONTEXT_MISSING_PROVIDER: 'FLX201',\n ROUTER_OUTSIDE_PROVIDER: 'FLX202',\n\n // Form errors (3xx)\n FORM_VALIDATION_FAILED: 'FLX301',\n FORM_SUBMISSION_FAILED: 'FLX302',\n ASYNC_VALIDATION_FAILED: 'FLX303',\n\n // Component errors (4xx)\n BUTTON_HANDLER_FAILED: 'FLX401',\n BUTTON_MISSING_ARIA_LABEL: 'FLX402',\n COMPONENT_RENDER_FAILED: 'FLX403',\n\n // Hydration errors (5xx)\n HYDRATION_MISMATCH: 'FLX501',\n HYDRATION_TEXT_MISMATCH: 'FLX502',\n HYDRATION_TAG_MISMATCH: 'FLX503',\n HYDRATION_ATTRIBUTE_MISMATCH: 'FLX504',\n\n // DevTools errors (6xx)\n DEVTOOLS_LISTENER_ERROR: 'FLX601',\n\n // Render errors (7xx)\n UNCAUGHT_RENDER_ERROR: 'FLX701',\n ERROR_BOUNDARY_CALLBACK_FAILED: 'FLX702',\n DOM_CLEANUP_FAILED: 'FLX703',\n\n // Event errors (8xx)\n EVENT_HANDLER_FAILED: 'FLX801',\n KEYBOARD_HANDLER_FAILED: 'FLX802',\n\n // Resource/Async errors (9xx)\n RESOURCE_FETCH_FAILED: 'FLX901',\n RESOURCE_TIMEOUT: 'FLX902',\n} as const\n\nexport type ErrorCode = (typeof ErrorCodes)[keyof typeof ErrorCodes]\n\ninterface ErrorDefinition {\n message: string\n suggestion?: string\n}\n\n// Error message definitions with suggestions\n// Wrapped in a function to allow tree-shaking in production\nfunction getErrorDetails(code: ErrorCode): {\n message: string\n suggestion?: string\n} {\n const isDev = typeof process !== 'undefined' && process.env?.NODE_ENV !== 'production'\n if (isDev) {\n const errorDefinitions: Record<ErrorCode, ErrorDefinition> = {\n [ErrorCodes.EFFECT_EXECUTION_FAILED]: {\n message: 'Effect execution failed',\n suggestion:\n 'Check the effect callback for runtime errors. Consider wrapping async operations in try-catch.',\n },\n [ErrorCodes.CLEANUP_OUTSIDE_EFFECT]: {\n message: 'onCleanup must be called from within an effect',\n suggestion: 'Move the onCleanup() call inside an effect() callback.',\n },\n [ErrorCodes.SIGNAL_UPDATE_DURING_RENDER]: {\n message: 'Signal was updated during render',\n suggestion:\n 'Avoid updating signals inside render functions. Use effect() for side effects.',\n },\n [ErrorCodes.CONTEXT_MISSING_PROVIDER]: {\n message: 'Context used outside of Provider',\n suggestion:\n 'Wrap your component tree with the appropriate Context.Provider.',\n },\n [ErrorCodes.ROUTER_OUTSIDE_PROVIDER]: {\n message: 'router() must be used within a <Router> component',\n suggestion: 'Ensure your component is a descendant of <Router>.',\n },\n [ErrorCodes.FORM_VALIDATION_FAILED]: {\n message: 'Form field validation failed',\n suggestion:\n 'Check the validation rules for the field and the input value.',\n },\n [ErrorCodes.FORM_SUBMISSION_FAILED]: {\n message: 'Form submission failed',\n suggestion: 'Check the onSubmit handler and network connectivity.',\n },\n [ErrorCodes.BUTTON_HANDLER_FAILED]: {\n message: 'Button press handler failed',\n suggestion: 'Check the onPress/onClick callback for errors.',\n },\n [ErrorCodes.BUTTON_MISSING_ARIA_LABEL]: {\n message: 'IconButton is missing an aria-label',\n suggestion:\n 'Add an aria-label prop to IconButton for screen reader accessibility.',\n },\n [ErrorCodes.HYDRATION_MISMATCH]: {\n message: 'Hydration mismatch detected',\n suggestion:\n 'Ensure server and client render the same content. Check for browser-only code.',\n },\n [ErrorCodes.HYDRATION_TEXT_MISMATCH]: {\n message: 'Text content mismatch during hydration',\n suggestion:\n 'Server and client rendered different text. Check for Date.now(), Math.random(), or client-only data.',\n },\n [ErrorCodes.HYDRATION_TAG_MISMATCH]: {\n message: 'Element tag mismatch during hydration',\n suggestion:\n 'Server and client rendered different elements. Verify conditional rendering logic.',\n },\n [ErrorCodes.DEVTOOLS_LISTENER_ERROR]: {\n message: 'DevTools listener threw an error',\n suggestion: 'Check your DevTools event listener callback.',\n },\n [ErrorCodes.UNCAUGHT_RENDER_ERROR]: {\n message: 'Uncaught error during render',\n suggestion:\n 'Wrap components with <ErrorBoundary> to catch and handle errors gracefully.',\n },\n [ErrorCodes.ERROR_BOUNDARY_CALLBACK_FAILED]: {\n message: 'ErrorBoundary callback failed',\n suggestion: 'Check your onError or onReset callback for errors.',\n },\n [ErrorCodes.COMPUTED_EXECUTION_FAILED]: {\n message: 'Computed value execution failed',\n suggestion:\n 'Check the computed callback for runtime errors. Ensure all dependencies are valid.',\n },\n [ErrorCodes.ASYNC_VALIDATION_FAILED]: {\n message: 'Async form validation failed',\n suggestion:\n 'Check the async validation function and ensure it handles errors properly.',\n },\n [ErrorCodes.COMPONENT_RENDER_FAILED]: {\n message: 'Component render failed',\n suggestion:\n 'Check the component function for runtime errors. Consider wrapping with <ErrorBoundary>.',\n },\n [ErrorCodes.HYDRATION_ATTRIBUTE_MISMATCH]: {\n message: 'Attribute mismatch during hydration',\n suggestion:\n 'Server and client rendered different attribute values. Check for dynamic attributes.',\n },\n [ErrorCodes.DOM_CLEANUP_FAILED]: {\n message: 'DOM cleanup operation failed',\n suggestion:\n 'A node may have been removed from the DOM unexpectedly. Check for manual DOM manipulation.',\n },\n [ErrorCodes.EVENT_HANDLER_FAILED]: {\n message: 'Event handler threw an error',\n suggestion:\n 'Check your event handler callback. Consider adding try-catch for async operations.',\n },\n [ErrorCodes.KEYBOARD_HANDLER_FAILED]: {\n message: 'Keyboard event handler failed',\n suggestion: 'Check the onKeyDown/onKeyUp handler for errors.',\n },\n [ErrorCodes.RESOURCE_FETCH_FAILED]: {\n message: 'Resource fetch failed',\n suggestion:\n 'Check the async function and network connectivity. The resource will show an error state.',\n },\n [ErrorCodes.RESOURCE_TIMEOUT]: {\n message: 'Resource fetch timed out',\n suggestion:\n 'The async operation took too long. Consider adding a timeout handler or retry logic.',\n },\n }\n return errorDefinitions[code] || { message: `Error ${code}` }\n }\n return { message: `Minified Error ${code}` }\n}\n\nexport interface FlexiumErrorInfo {\n code: ErrorCode\n message: string\n suggestion?: string\n context?: Record<string, unknown>\n originalError?: unknown\n}\n\n/**\n * Create a standardized error info object\n */\nexport function createErrorInfo(\n code: ErrorCode,\n context?: Record<string, unknown>,\n originalError?: unknown\n): FlexiumErrorInfo {\n const details = getErrorDetails(code)\n return {\n code,\n message: details.message,\n suggestion: details.suggestion,\n context,\n originalError,\n }\n}\n\n/**\n * Format error message for console output\n */\nexport function formatErrorMessage(info: FlexiumErrorInfo): string {\n let message = `[Flexium ${info.code}] ${info.message}`\n\n if (info.context && Object.keys(info.context).length > 0) {\n const contextStr = Object.entries(info.context)\n .map(([key, value]) => `${key}: ${JSON.stringify(value)}`)\n .join(', ')\n message += ` (${contextStr})`\n }\n\n if (info.suggestion) {\n message += `\\n → ${info.suggestion}`\n }\n\n return message\n}\n\n/**\n * Log an error with standardized formatting\n */\nexport function logError(\n code: ErrorCode,\n context?: Record<string, unknown>,\n originalError?: unknown\n): void {\n const info = createErrorInfo(code, context, originalError)\n const message = formatErrorMessage(info)\n\n if (originalError) {\n console.error(message, originalError)\n } else {\n console.error(message)\n }\n}\n\n/**\n * Log a warning with standardized formatting\n */\nexport function logWarning(\n code: ErrorCode,\n context?: Record<string, unknown>\n): void {\n const info = createErrorInfo(code, context)\n const message = formatErrorMessage(info)\n console.warn(message)\n}\n\n/**\n * Create a FlexiumError with standardized information\n */\nexport class FlexiumError extends Error {\n code: ErrorCode\n suggestion?: string\n context?: Record<string, unknown>\n\n constructor(code: ErrorCode, context?: Record<string, unknown>) {\n const details = getErrorDetails(code)\n super(details.message)\n this.name = 'FlexiumError'\n this.code = code\n this.suggestion = details.suggestion\n this.context = context\n }\n\n toString(): string {\n return formatErrorMessage({\n code: this.code,\n message: this.message,\n suggestion: this.suggestion,\n context: this.context,\n })\n }\n}\n","/**\n * Owner.ts\n *\n * Managing reactive scopes and cleanup contexts.\n */\n\n// ==================================================================================\n// 1. Owner & Scope Management\n// ==================================================================================\n\nexport interface Owner {\n cleanups: (() => void)[]\n context: Record<symbol, unknown> | null\n owner: Owner | null // Parent owner\n}\n\nimport type { ISubscriber } from './graph'\n\n// Global context for dependency tracking\nlet activeEffect: ISubscriber | null = null\n\nexport function getActiveEffect(): ISubscriber | null {\n return activeEffect\n}\n\nexport function setActiveEffect(effect: ISubscriber | null): void {\n activeEffect = effect\n}\n\n/**\n * Execute a function without tracking signal dependencies.\n * Useful when you need to read signals inside an effect without creating dependencies.\n *\n * @param fn - Function to execute without tracking\n * @returns The return value of fn\n */\nexport function untrack<T>(fn: () => T): T {\n const prev = activeEffect\n activeEffect = null\n try {\n return fn()\n } finally {\n activeEffect = prev\n }\n}\n\nlet owner: Owner | null = null\n\n/**\n * Get the current owner (scope)\n * @internal\n */\nexport function getOwner(): Owner | null {\n return owner\n}\n\n/**\n * Set the current owner (scope)\n * @internal\n */\nexport function setOwner(newOwner: Owner | null): void {\n owner = newOwner\n}\n\n/**\n * Creates a disposal scope.\n * The return value of the function is returned, and a dispose function is returned.\n *\n * @param fn - Function to run within a new root scope\n * @returns [return value of fn, dispose function]\n *\n * @example\n * ```tsx\n * const [val, dispose] = root((dispose) => {\n * effect(() => console.log('Inside root'));\n * return 123;\n * });\n * dispose(); // Cleans up all effects created inside\n * ```\n */\nexport function root<T>(fn: (dispose: () => void) => T): T {\n const prevOwner = owner\n const newOwner: Owner = {\n cleanups: [],\n context: prevOwner ? Object.create(prevOwner.context) : null,\n owner: prevOwner,\n }\n\n owner = newOwner\n\n const dispose = () => {\n // Performance: Fast path when no cleanups\n if (newOwner.cleanups.length === 0) return\n \n for (const cleanup of newOwner.cleanups) {\n cleanup()\n }\n newOwner.cleanups = []\n }\n\n try {\n return fn(dispose)\n } finally {\n owner = prevOwner\n }\n}\n\n\n"]}
|
package/dist/chunk-HB5VPQTB.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import {g as g$1,d,e,h,b,a,c as c$1}from'./chunk-ECYYIQEX.mjs';var c;(i=>{let o=[],t=0;function s(e,d){if(t>0){let r=o[--t];return r.dep=e,r.sub=d,r.prevSub=void 0,r.nextSub=void 0,r.prevDep=void 0,r.nextDep=void 0,r}return {dep:e,sub:d,prevSub:void 0,nextSub:void 0,prevDep:void 0,nextDep:void 0}}i.alloc=s;function n(e){e.dep=void 0,e.sub=void 0,e.prevSub=void 0,e.nextSub=void 0,e.prevDep=void 0,e.nextDep=void 0,t<1e4&&(o[t++]=e);}i.free=n;})(c||(c={}));var u;(s=>{function o(n,i){let e=c.alloc(n,i),d=i.depsHead;e.nextDep=d,d&&(d.prevDep=e),i.depsHead=e;let r=n.subsHead;e.nextSub=r,r&&(r.prevSub=e),n.subsHead=e;}s.connect=o;function t(n){let i=n.depsHead;for(;i;){let e=i.dep,d=i.nextDep,r=i.prevSub,f=i.nextSub;r?r.nextSub=f:e.subsHead=f,f&&(f.prevSub=r),c.free(i),i=d;}n.depsHead=void 0;}s.disconnectDependencies=t;})(u||(u={}));var g;(n=>{function o(i,e){return (i.flags&e)!==0}n.has=o;function t(i,e){i.flags|=e;}n.add=t;function s(i,e){i.flags&=~e;}n.remove=s;})(g||(g={}));var x=class{constructor(t,s){this.fn=t;this.onError=s;this.cleanups=[];this.flags=0;this.nodeType=3;this.owner=null;this.owner=g$1();}execute(){if((this.flags&1)!==0){this.flags|=2;return}this.flags|=1;try{this.run();}finally{this.flags&=-2,(this.flags&2)!==0&&(this.flags&=-3,queueMicrotask(()=>this.execute()));}}run(){if(this.cleanups.length>0){for(let n=this.cleanups.length-1;n>=0;n--)this.cleanups[n]();this.cleanups=[];}u.disconnectDependencies(this);let t=d(),s=g$1();e(this),h(this.owner);try{let n=this.fn();typeof n=="function"&&this.cleanups.push(n);}catch(n){this.onError?this.onError(n):b(a.EFFECT_EXECUTION_FAILED,void 0,n);}finally{e(t),h(s);}}dispose(){if(this.cleanups.length>0){for(let t=this.cleanups.length-1;t>=0;t--)this.cleanups[t]();this.cleanups=[];}u.disconnectDependencies(this);}};function O(o,t){let s=new x(o,t?.onError);s.execute();let n=()=>s.dispose(),i=g$1();return i&&i.cleanups.push(n),n}function k(o){let t=d();t&&t.nodeType===3?t.cleanups.push(o):c$1(a.CLEANUP_OUTSIDE_EFFECT);}export{u as a,x as b,O as c,k as d};//# sourceMappingURL=chunk-HB5VPQTB.mjs.map
|
|
2
|
-
//# sourceMappingURL=chunk-HB5VPQTB.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/graph.ts","../src/core/effect.ts"],"names":["LinkPool","pool","size","alloc","dep","sub","link","free","Graph","connect","depsHead","subsHead","disconnectDependencies","nextDep","prevSub","nextSub","Flags","has","obj","flag","add","remove","EffectNode","fn","onError","getOwner","i","prevEffect","getActiveEffect","prevOwner","setActiveEffect","setOwner","result","error","logError","ErrorCodes","effect","options","node","dispose","owner","onCleanup","activeEffect","logWarning"],"mappings":"+DA0FO,IAAUA,CAAAA,CAAAA,CAAAA,CAAAA,EAAV,CACH,IAAMC,CAAAA,CAAe,EAAC,CAClBC,CAAAA,CAAO,CAAA,CAEJ,SAASC,CAAAA,CAAMC,CAAAA,CAAkBC,CAAAA,CAAwB,CAC5D,GAAIH,CAAAA,CAAO,CAAA,CAAG,CACV,IAAMI,CAAAA,CAAOL,CAAAA,CAAK,EAAEC,CAAI,CAAA,CACxB,OAAAI,CAAAA,CAAK,GAAA,CAAMF,CAAAA,CACXE,CAAAA,CAAK,IAAMD,CAAAA,CACXC,CAAAA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AgBA,CAAAA,CAAa,QAAA,GAAa,CAAA,CACzCA,CAAAA,CAA4B,QAAA,CAAS,IAAA,CAAKnB,CAAE,CAAA,CAE7CoB,GAAAA,CAAWR,CAAAA,CAAW,sBAAsB,EAEpD","file":"chunk-HB5VPQTB.mjs","sourcesContent":["/**\n * Graph.ts\n *\n * Core Graph Data Structures & Algorithms\n * Implements the \"Hardcore\" Doubly Linked List for dependency tracking.\n *\n * This module is purely internal and has NO dependencies on other core modules\n * to avoid circular references.\n */\n\n// ==================================================================================\n// 1. Data Structures\n// ==================================================================================\n\n/**\n * Flags for subscriber state (Optimization: Bitmasking)\n */\nexport const enum SubscriberFlags {\n Running = 1 << 0,\n Notified = 1 << 1,\n Dirty = 1 << 2,\n Stale = 1 << 3,\n Tracking = 1 << 4,\n}\n\n/**\n * Node type identifiers for fast type checking (Performance: Avoid instanceof)\n */\nexport const enum NodeType {\n Signal = 1,\n Computed = 2,\n Effect = 3,\n Resource = 4,\n}\n\n/**\n * Link node connecting a Subscriber (Effect/Computed) to a Dependency (Signal/Computed).\n *\n * ASCII Visualization of the Doubly Linked Graph:\n *\n * [Signal A] <==> [Link 1] <==> [Effect B]\n * ^\n * | (Prev/Next Sub on Signal A)\n * v\n * [Link 2] <==> [Effect C]\n *\n * Each Link serves as a node in TWO lists simultaneously:\n * 1. The Subscriber's list of dependencies (prevDep/nextDep)\n * 2. The Dependency's list of subscribers (prevSub/nextSub)\n */\nexport interface Link {\n dep: IObservable | undefined\n sub: ISubscriber | undefined\n\n // Pointers for Dependency's subscriber list\n prevSub: Link | undefined\n nextSub: Link | undefined\n\n // Pointers for Subscriber's dependency list\n prevDep: Link | undefined\n nextDep: Link | undefined\n}\n\n/**\n * Base interface for subscriber nodes (Effect, Computed)\n */\nexport interface ISubscriber {\n execute(): void\n depsHead: Link | undefined // Head of dependencies list\n flags: SubscriberFlags\n nodeType: NodeType // Fast type checking (Performance optimization)\n}\n\n/**\n * Base interface for observable nodes (Signal, Computed)\n */\nexport interface IObservable {\n subsHead: Link | undefined // Head of subscribers list\n version: number // For epoch-based check\n notify(): void\n nodeType: NodeType // Fast type checking (Performance optimization)\n}\n\n// ==================================================================================\n// 2. Object Pool (Memory Optimization)\n// ==================================================================================\n\n/**\n * Pool for Link objects to eliminate GC pressure.\n */\nexport namespace LinkPool {\n const pool: Link[] = []\n let size = 0\n\n export function alloc(dep: IObservable, sub: ISubscriber): Link {\n if (size > 0) {\n const link = pool[--size]\n link.dep = dep\n link.sub = sub\n link.prevSub = undefined\n link.nextSub = undefined\n link.prevDep = undefined\n link.nextDep = undefined\n return link\n }\n return {\n dep,\n sub,\n prevSub: undefined,\n nextSub: undefined,\n prevDep: undefined,\n nextDep: undefined,\n }\n }\n\n export function free(link: Link): void {\n link.dep = undefined\n link.sub = undefined\n // Clearing pointers is optional for safety but good for debugging leaks\n link.prevSub = undefined\n link.nextSub = undefined\n link.prevDep = undefined\n link.nextDep = undefined\n\n if (size < 10000) { // Safety cap\n pool[size++] = link\n }\n }\n}\n\n// ==================================================================================\n// 3. Graph Operations\n// ==================================================================================\n\n/**\n * Internal Graph operations to manage the \"Hardcore\" Linked List structure.\n * Encapsulates raw pointer arithmetic for readability.\n */\nexport namespace Graph {\n /**\n * Connects a dependency (Signal) to a subscriber (Effect/Computed).\n * Allocates a Link from the pool and stitches it into both lists.\n */\n export function connect(dep: IObservable, sub: ISubscriber): void {\n const link = LinkPool.alloc(dep, sub)\n\n // Add to Subscriber's dependency list (prepend)\n // Performance: Cache depsHead to avoid repeated property access\n const depsHead = sub.depsHead\n link.nextDep = depsHead\n if (depsHead) {\n depsHead.prevDep = link\n }\n sub.depsHead = link\n\n // Add to Dependency's subscriber list (prepend)\n // Performance: Cache subsHead to avoid repeated property access\n const subsHead = dep.subsHead\n link.nextSub = subsHead\n if (subsHead) {\n subsHead.prevSub = link\n }\n dep.subsHead = link\n }\n\n /**\n * Fully disconnects a subscriber from all its dependencies.\n * Walks the 'depsHead' list and unlinks each one.\n */\n export function disconnectDependencies(sub: ISubscriber): void {\n let link = sub.depsHead\n while (link) {\n const dep = link.dep!\n // Performance: Cache nextDep and pointers before modifying link\n const nextDep = link.nextDep\n const prevSub = link.prevSub\n const nextSub = link.nextSub\n\n // Remove link from dependency's subscriber list\n // This is a standard doubly-linked list removal\n // Performance: Branch prediction - middle nodes are more common\n if (prevSub) {\n prevSub.nextSub = nextSub\n } else {\n dep.subsHead = nextSub\n }\n if (nextSub) {\n nextSub.prevSub = prevSub\n }\n\n LinkPool.free(link)\n link = nextDep\n }\n sub.depsHead = undefined\n }\n}\n\n/**\n * Flag helpers for readability\n */\nexport namespace Flags {\n export function has(obj: { flags: number }, flag: SubscriberFlags): boolean {\n return (obj.flags & flag) !== 0\n }\n\n export function add(obj: { flags: number }, flag: SubscriberFlags): void {\n obj.flags |= flag\n }\n\n export function remove(obj: { flags: number }, flag: SubscriberFlags): void {\n obj.flags &= ~flag\n }\n}\n","import { ErrorCodes, logError, logWarning } from './errors'\nimport {\n Graph,\n\n type Link,\n type ISubscriber,\n SubscriberFlags,\n NodeType\n} from './graph'\nimport {\n Owner,\n getOwner,\n setOwner,\n getActiveEffect,\n setActiveEffect\n} from './owner'\n\nexport class EffectNode implements ISubscriber {\n depsHead: Link | undefined\n cleanups: (() => void)[] = []\n flags = 0 // detached by default, will set flags during execution\n nodeType = NodeType.Effect\n\n private owner: Owner | null = null\n\n constructor(\n public fn: () => void | (() => void),\n public onError?: (error: Error) => void\n ) {\n this.owner = getOwner()\n }\n\n execute(): void {\n // Performance: Inline bit operations for better performance\n if ((this.flags & SubscriberFlags.Running) !== 0) {\n this.flags |= SubscriberFlags.Notified\n return\n }\n\n this.flags |= SubscriberFlags.Running\n\n try {\n this.run()\n } finally {\n // Performance: Inline bit operations\n this.flags &= ~SubscriberFlags.Running\n if ((this.flags & SubscriberFlags.Notified) !== 0) {\n this.flags &= ~SubscriberFlags.Notified\n // Schedule microtask to avoid stack overflow and infinite sync loops\n queueMicrotask(() => this.execute())\n }\n }\n }\n\n private run(): void {\n // Performance: Fast path when no cleanups\n if (this.cleanups.length > 0) {\n // Performance: Run cleanups in reverse order (most recent first)\n // This ensures proper dependency cleanup order and matches React's behavior\n for (let i = this.cleanups.length - 1; i >= 0; i--) {\n this.cleanups[i]()\n }\n this.cleanups = []\n }\n\n // Clean up previous dependencies via Graph helper\n Graph.disconnectDependencies(this)\n\n const prevEffect = getActiveEffect()\n const prevOwner = getOwner()\n setActiveEffect(this)\n setOwner(this.owner)\n\n try {\n const result = this.fn()\n if (typeof result === 'function') {\n this.cleanups.push(result)\n }\n } catch (error) {\n if (this.onError) {\n this.onError(error as Error)\n } else {\n logError(ErrorCodes.EFFECT_EXECUTION_FAILED, undefined, error)\n }\n } finally {\n setActiveEffect(prevEffect)\n setOwner(prevOwner)\n }\n }\n\n dispose(): void {\n // Performance: Run cleanups in reverse order (most recent first)\n // This ensures proper dependency cleanup order\n if (this.cleanups.length > 0) {\n for (let i = this.cleanups.length - 1; i >= 0; i--) {\n this.cleanups[i]()\n }\n this.cleanups = []\n }\n Graph.disconnectDependencies(this)\n }\n}\n\n/**\n * Creates a side effect that runs when dependencies change\n *\n * @param fn - Effect function, can return a cleanup function\n * @param options - Optional error handler\n * @returns Dispose function to stop the effect\n *\n * @example\n * ```ts\n * const [count, setCount] = state(0);\n * \n * effect(() => {\n * console.log(count());\n * });\n * \n * setCount(1); // logs: 1\n * ```\n */\nexport function effect(\n fn: () => void | (() => void),\n options?: { onError?: (error: Error) => void; name?: string }\n): () => void {\n // DevTools hooks integration would go here if needed\n // For now we rely on the devtools hooks in signal.ts or need to export them properly\n // This implementation is sufficient for core logic\n\n const node = new EffectNode(fn, options?.onError)\n node.execute()\n const dispose = () => node.dispose()\n\n const owner = getOwner()\n if (owner) {\n owner.cleanups.push(dispose)\n }\n\n return dispose\n}\n\n/**\n * Registers a cleanup function that runs before the current effect re-runs or is disposed\n *\n * @param fn - Cleanup function\n */\nexport function onCleanup(fn: () => void): void {\n const activeEffect = getActiveEffect()\n // Performance: Use nodeType instead of instanceof\n if (activeEffect && activeEffect.nodeType === NodeType.Effect) {\n (activeEffect as EffectNode).cleanups.push(fn)\n } else {\n logWarning(ErrorCodes.CLEANUP_OUTSIDE_EFFECT)\n }\n}\n"]}
|
package/dist/chunk-KNF5ERPK.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/fnode.ts"],"names":["createFNode","type","props","children","key"],"mappings":"AAMO,SAASA,EACdC,CAAAA,CACAC,CAAAA,CACAC,CAAAA,CACAC,CAAAA,CACO,CACP,OAAO,CACL,IAAA,CAAAH,CAAAA,CACA,MAAAC,CAAAA,CACA,QAAA,CAAAC,EACA,GAAA,CAAKC,CAAAA,EAAO,MACd,CACF","file":"chunk-KNF5ERPK.mjs","sourcesContent":["import type { FNode, FNodeChild } from './renderer'\n\n/**\n * Creates an FNode ensuring consistent object shape (Monomorphism).\n * This is crucial for JS engine optimization (Hidden Classes).\n */\nexport function createFNode(\n type: string | Function,\n props: Record<string, unknown>,\n children: FNodeChild[],\n key?: string | number | null\n): FNode {\n return {\n type,\n props,\n children,\n key: key ?? undefined,\n }\n}\n"]}
|
package/dist/chunk-NF4RPLCK.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
'use strict';var chunkDZ7L3SHV_js=require('./chunk-DZ7L3SHV.js'),chunkYEBBTVHG_js=require('./chunk-YEBBTVHG.js'),chunkQ7IWDVJ4_js=require('./chunk-Q7IWDVJ4.js');function v(){let t=()=>({pathname:"/",search:"",hash:"",query:{}}),e=()=>typeof window>"u"?t():{pathname:window.location.pathname,search:window.location.search,hash:window.location.hash,query:F(window.location.search)},[n,r]=chunkYEBBTVHG_js.k(e()),i=s=>{if(!(typeof window>"u")){if(L(s)){console.error("[Flexium Router] Blocked navigation to unsafe path:",s);return}window.history.pushState({},"",s),r(e());}},a=()=>{try{r(e());}catch(s){console.error("[Flexium Router] Error handling popstate:",s);}};return typeof window<"u"&&window.addEventListener("popstate",a),[n,i,()=>{typeof window<"u"&&window.removeEventListener("popstate",a);}]}function L(t){let e=t.trim().toLowerCase();return ["javascript:","data:","vbscript:","file:"].some(r=>e.startsWith(r))}function C(t){return t.replace(/<[^>]*>/g,"").replace(/javascript:/gi,"").replace(/on\w+\s*=/gi,"")}var b=new Set(["__proto__","constructor","prototype"]);function F(t){let e=new URLSearchParams(t),n=Object.create(null);return e.forEach((r,i)=>{let a=C(i),u=C(r);a&&!b.has(a)&&(n[a]=u);}),n}function A(t,e){let n=[],r=e.replace(/:([^/]+)/g,(s,h)=>(n.push(h),"([^/]+)")),i=new RegExp(`^${r}$`),a=t.match(i);if(!a)return {matches:false,params:{}};let u={};return a.slice(1).forEach((s,h)=>{u[n[h]]=s;}),{matches:true,params:u}}function y(t){let e=[],n=Array.isArray(t)?t:[t];for(let r of n){if(!chunkQ7IWDVJ4_js.c(r))continue;let{path:i,index:a,component:u,beforeEnter:s}=r.props,h=r.children;if(!u&&!h){console.warn(`[Flexium Router] Route "${i||"(index)"}" has no component and no children. Skipping.`);continue}let f={path:i||"",index:!!a,component:u||(()=>null),children:h?y(h):[],beforeEnter:s};e.push(f);}return e}function P(t,e){for(let n of t){let r=E(n,e,"");if(r)return r}return null}function E(t,e,n){let r=n;t.path&&(r=n.replace(/\/$/,"")+"/"+t.path.replace(/^\//,""));let i=t.children.length===0,a=k(r,!i),u=e.match(a);if(u){let[s,...h]=u,f=D(r,h),o={route:t,params:f,pathname:s};if(i)return s===e?[o]:null;for(let l of t.children){let c=E(l,e,r);if(c)return [o,...c]}if(s===e){let l=t.children.find(c=>c.index);return l?[o,{route:l,params:{},pathname:s}]:[o]}}return null}function k(t,e){let n=t.replace(/:([^/]+)/g,()=>"([^/]+)");return n==="/"&&e?new RegExp("^"):new RegExp(`^${n}${e?"(?:/|$)":"$"}`)}function D(t,e){let n={},r=0;return t.replace(/:([^/]+)/g,(i,a)=>(n[a]=e[r++],"")),n}var x=chunkDZ7L3SHV_js.a(null),d=chunkDZ7L3SHV_js.a(0);function N(){let t=chunkDZ7L3SHV_js.b(x);if(!t)throw new Error("router() must be called within a <Router> component");return t}function W(t){let[e,n]=v(),r=Array.isArray(t.children)?t.children:[t.children],i=[],a=[];for(let o of r)chunkQ7IWDVJ4_js.c(o)&&typeof o.type=="function"&&o.type===S?a.push(o):i.push(o);let u=y(a),[s]=chunkYEBBTVHG_js.k(()=>{let o=e();return P(u,o.pathname)||[]}),[h]=chunkYEBBTVHG_js.k(()=>{let o=s();return o.length>0?o[o.length-1].params:{}}),f=new Proxy({location:e,params:h,navigate:n,matches:s},{get(o,l){let c=o[l];return c}});return ()=>{let o=s(),l=null;if(o.length>0){let c=o[0];c.route.beforeEnter?c.route.beforeEnter(c.params)!==false&&(l=chunkQ7IWDVJ4_js.a(d.Provider,{value:1},[chunkQ7IWDVJ4_js.a("div",{key:c.route.path,style:{display:"contents"}},[chunkQ7IWDVJ4_js.a(c.route.component,{params:c.params})])])):l=chunkQ7IWDVJ4_js.a(d.Provider,{value:1},[chunkQ7IWDVJ4_js.a("div",{key:c.route.path,style:{display:"contents"}},[chunkQ7IWDVJ4_js.a(c.route.component,{params:c.params})])]);}return chunkQ7IWDVJ4_js.a(x.Provider,{value:f},[...i,chunkQ7IWDVJ4_js.a("main",{id:"main"},[l])])}}function S(t){return null}function Y(){let t=chunkDZ7L3SHV_js.b(x),e=chunkDZ7L3SHV_js.b(d)||0;return t?()=>{let n=t.matches();if(e>=n.length)return null;let r=n[e];if(r.route.beforeEnter&&r.route.beforeEnter(r.params)===false)return null;let i=r.route.component;return chunkQ7IWDVJ4_js.a(d.Provider,{value:e+1},[chunkQ7IWDVJ4_js.a(i,{params:r.params})])}:null}function H(t){let e=N(),n=r=>{r.preventDefault(),e.navigate(t.to);};return chunkQ7IWDVJ4_js.a("a",{href:t.to,class:t.class,onclick:n},t.children)}
|
|
2
|
-
exports.a=v;exports.b=L;exports.c=C;exports.d=A;exports.e=y;exports.f=P;exports.g=N;exports.h=W;exports.i=S;exports.j=Y;exports.k=H;//# sourceMappingURL=chunk-NF4RPLCK.js.map
|
|
3
|
-
//# sourceMappingURL=chunk-NF4RPLCK.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/router/core.ts","../src/router/utils.ts","../src/router/context.ts","../src/router/components.ts"],"names":["createLocation","getDefaultLoc","getLoc","parseQuery","loc","setLoc","state","navigate","path","isUnsafePath","handlePopState","error","normalizedPath","protocol","sanitizeQueryValue","value","DANGEROUS_KEYS","search","params","query","key","sanitizedKey","sanitizedValue","matchPath","pathname","routePath","paramNames","regexPath","_","paramName","regex","match","index","createRoutesFromChildren","children","routes","childArray","child","isFNode","component","beforeEnter","nestedChildren","route","matchRoutes","location","result","matchRouteBranch","parentPath","fullPath","isLeaf","matcher","compilePath","matchedPath","paramValues","paramsObj","extractParams","currentMatch","childMatches","indexRoute","prefix","values","i","RouterCtx","createContext","RouteDepthCtx","router","ctx","context","Router","props","nonRouteChildren","routeChildren","Route","matches","m","routerContext","target","prop","ms","matchedContent","rootMatch","f","_props","Outlet","depth","Component","Link","r","handleClick","e"],"mappings":"iKA8BO,SAASA,CAAAA,EAA6E,CAE3F,IAAMC,CAAAA,CAAgB,KAAiB,CACrC,QAAA,CAAU,GAAA,CACV,MAAA,CAAQ,EAAA,CACR,IAAA,CAAM,EAAA,CACN,KAAA,CAAO,EACT,CAAA,CAAA,CAEMC,CAAAA,CAAS,IACT,OAAO,MAAA,CAAW,GAAA,CACbD,CAAAA,EAAc,CAEhB,CACL,QAAA,CAAU,MAAA,CAAO,QAAA,CAAS,QAAA,CAC1B,MAAA,CAAQ,MAAA,CAAO,QAAA,CAAS,MAAA,CACxB,IAAA,CAAM,MAAA,CAAO,QAAA,CAAS,IAAA,CACtB,KAAA,CAAOE,CAAAA,CAAW,MAAA,CAAO,QAAA,CAAS,MAAM,CAC1C,CAAA,CAGI,CAACC,CAAAA,CAAKC,CAAM,CAAA,CAAIC,kBAAAA,CAAgBJ,CAAAA,EAAQ,CAAA,C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AAM,KAAA,CACb,OAAA,CAASmB,CACX,CAAA,CACAnB,CAAAA,CAAM,QACR,CACF","file":"chunk-NF4RPLCK.js","sourcesContent":["/**\n * Router Core Module\n *\n * Provides core routing functionality including location management,\n * path matching, and navigation.\n */\n\nimport { state, type StateValue } from '../core/state'\nimport { Location } from './types'\n\n/**\n * Creates a reactive location signal and navigate function.\n *\n * The location signal automatically updates when:\n * - navigate() is called\n * - Browser back/forward buttons are used (popstate event)\n *\n * @returns Tuple of [location signal, navigate function, cleanup function]\n *\n * @example\n * ```tsx\n * const [location, navigate, cleanup] = createLocation();\n * // Access current path\n * console.log(location().pathname);\n * // Navigate to new path\n * navigate('/users/123');\n * // Cleanup when done (removes popstate listener)\n * cleanup();\n * ```\n */\nexport function createLocation(): [StateValue<Location>, (path: string) => void, () => void] {\n // SSR guard: return safe defaults on server\n const getDefaultLoc = (): Location => ({\n pathname: '/',\n search: '',\n hash: '',\n query: {},\n })\n\n const getLoc = (): Location => {\n if (typeof window === 'undefined') {\n return getDefaultLoc()\n }\n return {\n pathname: window.location.pathname,\n search: window.location.search,\n hash: window.location.hash,\n query: parseQuery(window.location.search),\n }\n }\n\n const [loc, setLoc] = state<Location>(getLoc())\n\n const navigate = (path: string) => {\n // SSR guard\n if (typeof window === 'undefined') return\n\n // Security: Validate path to prevent javascript: and other dangerous protocols\n if (isUnsafePath(path)) {\n console.error('[Flexium Router] Blocked navigation to unsafe path:', path)\n return\n }\n window.history.pushState({}, '', path)\n setLoc(getLoc())\n }\n\n // SSR guard for popstate listener\n const handlePopState = () => {\n try {\n setLoc(getLoc())\n } catch (error) {\n console.error('[Flexium Router] Error handling popstate:', error)\n }\n }\n\n if (typeof window !== 'undefined') {\n window.addEventListener('popstate', handlePopState)\n }\n\n // Cleanup function to remove listener\n const cleanup = () => {\n if (typeof window !== 'undefined') {\n window.removeEventListener('popstate', handlePopState)\n }\n }\n\n return [loc, navigate, cleanup]\n}\n\n/**\n * Check if a path contains unsafe protocols (XSS prevention)\n * @param path - Path to validate\n * @returns true if path is unsafe\n */\nexport function isUnsafePath(path: string): boolean {\n const normalizedPath = path.trim().toLowerCase()\n const unsafeProtocols = ['javascript:', 'data:', 'vbscript:', 'file:']\n return unsafeProtocols.some(protocol => normalizedPath.startsWith(protocol))\n}\n\n/**\n * Sanitize query parameter value to prevent XSS\n * @param value - Query parameter value\n * @returns Sanitized value\n */\nexport function sanitizeQueryValue(value: string): string {\n // Remove potential script tags and event handlers\n return value\n .replace(/<[^>]*>/g, '') // Remove HTML tags\n .replace(/javascript:/gi, '') // Remove javascript: protocol\n .replace(/on\\w+\\s*=/gi, '') // Remove event handlers like onclick=\n}\n\n/**\n * Parses URL search string into key-value object\n * @param search - URL search string (e.g., \"?foo=bar&baz=qux\")\n * @returns Object with query parameters\n */\n// Dangerous keys that could lead to prototype pollution\nconst DANGEROUS_KEYS = new Set(['__proto__', 'constructor', 'prototype'])\n\nfunction parseQuery(search: string): Record<string, string> {\n const params = new URLSearchParams(search)\n // Use Object.create(null) to prevent prototype pollution\n const query: Record<string, string> = Object.create(null)\n params.forEach((value, key) => {\n // Sanitize both key and value to prevent XSS\n const sanitizedKey = sanitizeQueryValue(key)\n const sanitizedValue = sanitizeQueryValue(value)\n // Block dangerous keys to prevent prototype pollution\n if (sanitizedKey && !DANGEROUS_KEYS.has(sanitizedKey)) {\n query[sanitizedKey] = sanitizedValue\n }\n })\n return query\n}\n\n/**\n * Matches a pathname against a route pattern.\n *\n * Supports dynamic segments with `:param` syntax.\n *\n * @param pathname - Current URL pathname (e.g., \"/users/123\")\n * @param routePath - Route pattern (e.g., \"/users/:id\")\n * @returns Object with `matches` boolean and extracted `params`\n *\n * @example\n * ```tsx\n * const result = matchPath('/users/123', '/users/:id');\n * // { matches: true, params: { id: '123' } }\n * ```\n */\nexport function matchPath(\n pathname: string,\n routePath: string\n): { matches: boolean; params: Record<string, string> } {\n const paramNames: string[] = []\n const regexPath = routePath.replace(/:([^/]+)/g, (_, paramName) => {\n paramNames.push(paramName)\n return '([^/]+)'\n })\n\n const regex = new RegExp(`^${regexPath}$`)\n const match = pathname.match(regex)\n\n if (!match) {\n return { matches: false, params: {} }\n }\n\n const params: Record<string, string> = {}\n match.slice(1).forEach((value, index) => {\n params[paramNames[index]] = value\n })\n\n return { matches: true, params }\n}\n","import { RouteDef, RouteMatch } from './types'\nimport type { FNodeChild } from '../core/renderer'\nimport { isFNode } from '../renderers/dom/f'\n\n/**\n * Flatten the children of <Router> or <Route> into a route configuration tree.\n * Note: This assumes `children` are FNodes representing <Route> components.\n */\nexport function createRoutesFromChildren(children: FNodeChild): RouteDef[] {\n const routes: RouteDef[] = []\n\n const childArray = Array.isArray(children) ? children : [children]\n\n for (const child of childArray) {\n if (!isFNode(child)) {\n continue\n }\n\n const { path, index, component, beforeEnter } = child.props as {\n path?: string\n index?: boolean\n component?: Function\n beforeEnter?: (\n params: Record<string, string>\n ) => boolean | Promise<boolean>\n }\n const nestedChildren = child.children\n\n // Skip routes without a component (unless they have children as layout routes)\n if (!component && !nestedChildren) {\n console.warn(\n `[Flexium Router] Route \"${path || '(index)'}\" has no component and no children. Skipping.`\n )\n continue\n }\n\n const route: RouteDef = {\n path: path || '',\n index: !!index,\n component: component || (() => null),\n children: nestedChildren ? createRoutesFromChildren(nestedChildren) : [],\n beforeEnter,\n }\n\n routes.push(route)\n }\n\n return routes\n}\n\n/**\n * Match a URL against a route tree.\n * Returns an array of matches (from root to leaf).\n */\nexport function matchRoutes(\n routes: RouteDef[],\n location: string\n): RouteMatch[] | null {\n for (const route of routes) {\n const result = matchRouteBranch(route, location, '')\n if (result) return result\n }\n return null\n}\n\nfunction matchRouteBranch(\n route: RouteDef,\n location: string,\n parentPath: string\n): RouteMatch[] | null {\n let fullPath = parentPath\n if (route.path) {\n fullPath =\n parentPath.replace(/\\/$/, '') + '/' + route.path.replace(/^\\//, '')\n }\n\n const isLeaf = route.children.length === 0\n const matcher = compilePath(fullPath, !isLeaf)\n const match = location.match(matcher)\n\n if (match) {\n const [matchedPath, ...paramValues] = match\n const paramsObj = extractParams(fullPath, paramValues)\n\n const currentMatch: RouteMatch = {\n route,\n params: paramsObj,\n pathname: matchedPath,\n }\n\n if (isLeaf) {\n // Exact match required for leaf\n if (matchedPath === location) return [currentMatch]\n return null\n }\n\n // Has children: try to match one of them\n // If no children match, and this route is an index route?\n // Or if this route matches partially, maybe an index child matches the rest?\n\n for (const child of route.children) {\n const childMatches = matchRouteBranch(child, location, fullPath)\n if (childMatches) {\n return [currentMatch, ...childMatches]\n }\n }\n\n // If no children matched, but we matched exactly this layout route?\n // E.g. /users matches /users layout, and maybe it renders index?\n if (matchedPath === location) {\n // Check for index route\n const indexRoute = route.children.find((c) => c.index)\n if (indexRoute) {\n return [\n currentMatch,\n { route: indexRoute, params: {}, pathname: matchedPath },\n ]\n }\n // Just the layout? Maybe.\n return [currentMatch]\n }\n }\n\n return null\n}\n\nfunction compilePath(path: string, prefix: boolean): RegExp {\n const regexPath = path.replace(/:([^/]+)/g, () => '([^/]+)')\n\n // If path is exactly \"/\", and we want prefix matching, it should match everything\n if (regexPath === '/' && prefix) {\n return new RegExp('^')\n }\n\n // If prefix matching allowed, ensure we match segment boundary\n return new RegExp(`^${regexPath}${prefix ? '(?:/|$)' : '$'}`)\n}\n\nfunction extractParams(path: string, values: string[]): Record<string, string> {\n const params: Record<string, string> = {}\n let i = 0\n // Re-parse to find param names... inefficient but works\n path.replace(/:([^/]+)/g, (_, paramName) => {\n params[paramName] = values[i++]\n return ''\n })\n return params\n}\n","import { createContext } from '../core/context'\nimport { RouterContext } from './types'\n\n// Global Router Context\nexport const RouterCtx = createContext<RouterContext | null>(null)\n\n// Current Route Depth Context (for Outlet)\n// Stores the index of the current match in the `matches` array\nexport const RouteDepthCtx = createContext<number>(0)\n","import { state, type StateValue } from '../core/state'\nimport { createLocation } from './core'\nimport { createRoutesFromChildren, matchRoutes } from './utils'\nimport { LinkProps, RouteProps, RouterContext } from './types'\nimport { f, isFNode } from '../renderers/dom/f'\nimport { RouterCtx, RouteDepthCtx } from './context'\nimport { context } from '../core/context'\nimport type { FNodeChild } from '../core/renderer'\n\n/**\n * Get the current router context.\n * Must be called within a <Router> component.\n *\n * @example\n * ```tsx\n * const r = router()\n * r.navigate('/dashboard')\n * ```\n */\nexport function router(): RouterContext {\n const ctx = context(RouterCtx)\n if (!ctx) {\n throw new Error('router() must be called within a <Router> component')\n }\n return ctx\n}\n\nexport function Router(props: { children: FNodeChild }) {\n const [location, navigate] = createLocation()\n\n // Separate Route children from non-Route children (like Nav, etc.)\n const childArray = Array.isArray(props.children) ? props.children : [props.children]\n const nonRouteChildren: FNodeChild[] = []\n const routeChildren: FNodeChild[] = []\n\n for (const child of childArray) {\n if (isFNode(child) && typeof child.type === 'function' && child.type === Route) {\n routeChildren.push(child)\n } else {\n nonRouteChildren.push(child)\n }\n }\n\n // Parse route configuration from Route children only\n const routes = createRoutesFromChildren(routeChildren)\n\n // Compute matches\n const [matches] = state(() => {\n const loc = location()\n return matchRoutes(routes, loc.pathname) || []\n })\n\n const [params] = state(() => {\n const m = matches()\n if (m.length > 0) {\n return m[m.length - 1].params\n }\n return {}\n })\n\n // Create routerContext as a stable object\n // The signals (location, params, matches) are already reactive\n // We create a proxy to ensure property access is properly tracked\n // When accessing location, params, or matches, automatically read the signal's value\n // to register subscriptions (similar to how state() proxy works)\n const routerContext: RouterContext = new Proxy({\n location,\n params,\n navigate,\n matches,\n } as any, {\n get(target, prop) {\n const value = target[prop as keyof RouterContext]\n\n // For state values (location, params, matches), return them directly\n // They are already Proxy-based and work like state() - property access triggers tracking\n if (prop === 'location' || prop === 'params' || prop === 'matches') {\n return value as StateValue<unknown>\n }\n\n // For navigate, return as-is\n return value\n }\n }) as RouterContext\n\n return () => {\n const ms = matches()\n\n // Matched route component (or null if no match)\n let matchedContent: FNodeChild = null\n if (ms.length > 0) {\n const rootMatch = ms[0]\n\n // Check beforeEnter guard\n if (rootMatch.route.beforeEnter) {\n const result = rootMatch.route.beforeEnter(rootMatch.params)\n if (result !== false) {\n matchedContent = f(RouteDepthCtx.Provider, { value: 1 }, [\n f('div', { key: rootMatch.route.path, style: { display: 'contents' } }, [\n f(rootMatch.route.component, { params: rootMatch.params }),\n ]),\n ])\n }\n } else {\n matchedContent = f(RouteDepthCtx.Provider, { value: 1 }, [\n f('div', { key: rootMatch.route.path, style: { display: 'contents' } }, [\n f(rootMatch.route.component, { params: rootMatch.params }),\n ]),\n ])\n }\n }\n\n // Render non-Route children (like Nav) and the matched route wrapped in main\n return f(RouterCtx.Provider, { value: routerContext }, [\n ...nonRouteChildren,\n f('main', { id: 'main' }, [matchedContent]),\n ])\n }\n}\n\n/**\n * Route configuration component.\n * Doesn't render anything directly; used by Router to build the route tree.\n */\nexport function Route(_props: RouteProps) {\n return null\n}\n\n/**\n * Renders the child route content.\n */\nexport function Outlet() {\n const router = context(RouterCtx)\n const depth = context(RouteDepthCtx) || 0 // Default 0\n\n // Safety check\n if (!router) return null\n\n return () => {\n const ms = router.matches()\n\n // Check if we have a match at this depth\n if (depth >= ms.length) return null\n\n const match = ms[depth]\n\n // Check beforeEnter guard\n if (match.route.beforeEnter) {\n const result = match.route.beforeEnter(match.params)\n if (result === false) return null\n }\n\n const Component = match.route.component\n\n // Render component and provide next depth\n return f(RouteDepthCtx.Provider, { value: depth + 1 }, [\n f(Component, { params: match.params }),\n ])\n }\n}\n\nexport function Link(props: LinkProps) {\n const r = router()\n\n const handleClick = (e: Event) => {\n e.preventDefault()\n r.navigate(props.to)\n }\n\n return f(\n 'a',\n {\n href: props.to,\n class: props.class,\n onclick: handleClick,\n },\n props.children\n )\n}\n"]}
|
package/dist/chunk-OPAAGNBO.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import {g}from'./chunk-ECYYIQEX.mjs';function u(n){let e=Symbol("context"),t=r=>r.children;return t._contextId=e,{id:e,Provider:t,defaultValue:n}}function c(n){let e=g();if(e&&e.context){let t=e.context[n.id];if(t!==void 0)return t}return n.defaultValue}function l(n,e){let t=g();t&&(t.context||(t.context={}),t.context[n]=e);}export{u as a,c as b,l as c};//# sourceMappingURL=chunk-OPAAGNBO.mjs.map
|
|
2
|
-
//# sourceMappingURL=chunk-OPAAGNBO.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/context.ts"],"names":["createContext","defaultValue","id","Provider","props","context","ctx","owner","getOwner","value","pushProvider"],"mappings":"qCASO,SAASA,CAAAA,CAAiBC,CAAAA,CAA6B,CAC5D,IAAMC,EAAK,MAAA,CAAO,SAAS,CAAA,CAErBC,CAAAA,CAAYC,GACTA,CAAAA,CAAM,QAAA,CAEX,OAACD,CAAAA,CAA+C,WAAaD,CAAAA,CAE1D,CACL,EAAA,CAAAA,CAAAA,CACA,SAAAC,CAAAA,CACA,YAAA,CAAAF,CACF,CACF,CAUO,SAASI,CAAAA,CAAWC,CAAAA,CAAoB,CAC7C,IAAMC,CAAAA,CAAQC,CAAAA,EAAS,CACvB,GAAID,GAASA,CAAAA,CAAM,OAAA,CAAS,CAC1B,IAAME,EAAQF,CAAAA,CAAM,OAAA,CAAQD,CAAAA,CAAI,EAAE,EAClC,GAAIG,CAAAA,GAAU,MAAA,CACZ,OAAOA,CAEX,CACA,OAAOH,CAAAA,CAAI,YACb,CAQO,SAASI,CAAAA,CAAaR,CAAAA,CAAYO,CAAAA,CAAsB,CAC7D,IAAMF,CAAAA,CAAQC,CAAAA,EAAS,CACnBD,IACGA,CAAAA,CAAM,OAAA,GACTA,CAAAA,CAAM,OAAA,CAAU,EAAC,CAAA,CAEnBA,CAAAA,CAAM,OAAA,CAAQL,CAAE,EAAIO,CAAAA,EAExB","file":"chunk-OPAAGNBO.mjs","sourcesContent":["import type { FNodeChild } from './renderer'\nimport { getOwner, setOwner } from './owner'\n\nexport interface Context<T> {\n id: symbol\n Provider: (props: { value: T; children: FNodeChild }) => FNodeChild\n defaultValue: T\n}\n\nexport function createContext<T>(defaultValue: T): Context<T> {\n const id = Symbol('context')\n\n const Provider = (props: { value: T; children: FNodeChild }): FNodeChild => {\n return props.children\n }\n ; (Provider as unknown as { _contextId: symbol })._contextId = id\n\n return {\n id,\n Provider,\n defaultValue,\n }\n}\n\n/**\n * Get the current value from a context.\n *\n * @example\n * ```tsx\n * const theme = context(ThemeContext)\n * ```\n */\nexport function context<T>(ctx: Context<T>): T {\n const owner = getOwner()\n if (owner && owner.context) {\n const value = owner.context[ctx.id]\n if (value !== undefined) {\n return value as T\n }\n }\n return ctx.defaultValue\n}\n\n/**\n * Push a value onto the context stack for a given context ID.\n * @internal Used by the renderer during component mounting.\n * @param id - The context symbol identifier\n * @param value - The value to push onto the context stack\n */\nexport function pushProvider(id: symbol, value: unknown): void {\n const owner = getOwner()\n if (owner) {\n if (!owner.context) {\n owner.context = {}\n }\n owner.context[id] = value\n }\n}\n\n/**\n * Pop a value from the context stack for a given context ID.\n * @internal No-op in Owner-based context system (handled by scope)\n */\nexport function popProvider(_id: symbol): void {\n // No-op: Context scoping is handled by the Owner prototype chain\n}\n\n/**\n * Capture the current context state\n * Returns an opaque handle to the current owner scope.\n */\nexport function captureContext(): unknown {\n return getOwner()\n}\n\n/**\n * Run a function with the captured context restored\n */\nexport function runWithContext<T>(\n snapshot: unknown,\n fn: () => T\n): T {\n const prev = getOwner()\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n setOwner(snapshot as any)\n try {\n return fn()\n } finally {\n setOwner(prev)\n }\n}\n"]}
|
package/dist/chunk-OPAQ4R4M.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import {a as a$1}from'./chunk-KNF5ERPK.mjs';function a(i){let e=[];for(let o=0;o<i.length;o++){let n=i[o];if(Array.isArray(n)){let t=a(n);for(let r=0;r<t.length;r++)e.push(t[r]);}else e.push(n);}return e}function c(i){let e=[];for(let o=0;o<i.length;o++){let n=i[o];n!=null&&n!==false&&e.push(n);}return e}function d(i,e){let o=e.key,n={};for(let l in e)l!=="key"&&l!=="children"&&(n[l]=e[l]);let t=e.children,r=[];return t!==void 0&&(Array.isArray(t)?r=c(a(t)):t!==null&&t!==false&&(r=[t])),a$1(i,n,r,o)}function y(i,e){let o=e.key,n={};for(let l in e)l!=="key"&&l!=="children"&&(n[l]=e[l]);let t=[],r=e.children;return Array.isArray(r)?t=c(r):r!=null&&r!==false&&(t=[r]),a$1(i,n,t,o)}function u(i){return a$1("fragment",{},i.children??[])}export{d as a,y as b,u as c};//# sourceMappingURL=chunk-OPAQ4R4M.mjs.map
|
|
2
|
-
//# sourceMappingURL=chunk-OPAQ4R4M.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/jsx-runtime.ts"],"names":["flattenChildren","children","result","i","child","flattened","j","filterChildren","jsx","type","props","key","restProps","k","normalizedChildren","createFNode","jsxs","Fragment"],"mappings":"4CAyCA,SAASA,CAAAA,CAAgBC,EAAwB,CAE/C,IAAMC,EAAgB,EAAC,CAEvB,IAAA,IAASC,CAAAA,CAAI,CAAA,CAAGA,CAAAA,CAAIF,EAAS,MAAA,CAAQE,CAAAA,EAAAA,CAAK,CACxC,IAAMC,CAAAA,CAAQH,CAAAA,CAASE,CAAC,CAAA,CACxB,GAAI,KAAA,CAAM,OAAA,CAAQC,CAAK,CAAA,CAAG,CACxB,IAAMC,CAAAA,CAAYL,EAAgBI,CAAK,CAAA,CACvC,QAASE,CAAAA,CAAI,CAAA,CAAGA,CAAAA,CAAID,CAAAA,CAAU,MAAA,CAAQC,CAAAA,EAAAA,CACpCJ,EAAO,IAAA,CAAKG,CAAAA,CAAUC,CAAC,CAAC,EAE5B,CAAA,KACEJ,EAAO,IAAA,CAAKE,CAAK,EAErB,CAEA,OAAOF,CACT,CAOA,SAASK,CAAAA,CAAeN,EAAwB,CAE9C,IAAMC,EAAgB,EAAC,CACvB,IAAA,IAASC,CAAAA,CAAI,CAAA,CAAGA,CAAAA,CAAIF,EAAS,MAAA,CAAQE,CAAAA,EAAAA,CAAK,CACxC,IAAMC,CAAAA,CAAQH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ACbA,IAAa,KAAA,GAEba,CAAAA,CAAqB,CAACb,CAAQ,CAAA,CAAA,CAGzBc,GAAAA,CAAYN,EAAMG,CAAAA,CAAWE,CAAAA,CAAoBH,CAAG,CAC7D,CAOO,SAASM,EAASP,CAAAA,CAAoC,CAC3D,OAAOK,GAAAA,CAAY,UAAA,CAAY,GAAIL,CAAAA,CAAM,QAAA,EAAY,EAAE,CACzD","file":"chunk-OPAQ4R4M.mjs","sourcesContent":["/**\n * Flexium JSX Runtime\n *\n * This module provides the automatic JSX runtime for Flexium.\n * It implements the new JSX transform introduced in React 17+.\n *\n * With automatic JSX runtime, you no longer need to import `f`:\n *\n * Before (classic):\n * ```tsx\n * import { f } from 'flexium/dom'\n * function App() {\n * return <div>Hello</div>\n * }\n * ```\n *\n * After (automatic):\n * ```tsx\n * function App() {\n * return <div>Hello</div>\n * }\n * ```\n *\n * Usage in tsconfig.json:\n * ```json\n * {\n * \"compilerOptions\": {\n * \"jsx\": \"react-jsx\",\n * \"jsxImportSource\": \"flexium\"\n * }\n * }\n * ```\n */\n\nimport type { FNode } from './core/renderer'\nimport { createFNode } from './core/fnode'\n\n/**\n * Flatten nested children arrays\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction flattenChildren(children: any[]): any[] {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const result: any[] = []\n\n for (let i = 0; i < children.length; i++) {\n const child = children[i]\n if (Array.isArray(child)) {\n const flattened = flattenChildren(child)\n for (let j = 0; j < flattened.length; j++) {\n result.push(flattened[j])\n }\n } else {\n result.push(child)\n }\n }\n\n return result\n}\n\n/**\n * Filter out null, undefined, and false children\n * Optimized for performance using a simple loop\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction filterChildren(children: any[]): any[] {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const result: any[] = []\n for (let i = 0; i < children.length; i++) {\n const child = children[i]\n if (child !== null && child !== undefined && child !== false) {\n result.push(child)\n }\n }\n return result\n}\n\n/**\n * JSX runtime function for elements with multiple children\n *\n * @param type - Element type (string for built-in, function for components)\n * @param props - Element properties including children\n * @returns Flexium node\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function jsx(\n type: string | Function,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n props: Record<string, any>\n): FNode {\n // Extract children from props\n // Manual extraction is faster than destructuring\n const key = props.key\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const restProps: Record<string, any> = {}\n\n for (const k in props) {\n if (k !== 'key' && k !== 'children') {\n restProps[k] = props[k]\n }\n }\n\n const children = props.children\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let normalizedChildren: any[] = []\n\n if (children !== undefined) {\n if (Array.isArray(children)) {\n // Recursively flatten and then filter\n normalizedChildren = filterChildren(flattenChildren(children))\n } else if (children !== null && children !== false) {\n // Single child optimization\n normalizedChildren = [children]\n }\n }\n\n return createFNode(type, restProps, normalizedChildren, key)\n}\n\n/**\n * JSX runtime function for elements with static children\n * (optimization hint from the compiler)\n *\n * @param type - Element type\n * @param props - Element properties\n * @returns Flexium node\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function jsxs(\n type: string | Function,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n props: Record<string, any>\n): FNode {\n // For jsxs, we know children is an array passed as a prop\n // We can skip flattening, but we still need to filter\n\n const key = props.key\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const restProps: Record<string, any> = {}\n\n for (const k in props) {\n if (k !== 'key' && k !== 'children') {\n restProps[k] = props[k]\n }\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let normalizedChildren: any[] = []\n const children = props.children\n\n if (Array.isArray(children)) {\n // Skip recursive flattening for jsxs, just filter\n normalizedChildren = filterChildren(children)\n } else if (\n children !== undefined &&\n children !== null &&\n children !== false\n ) {\n normalizedChildren = [children]\n }\n\n return createFNode(type, restProps, normalizedChildren, key)\n}\n\n/**\n * Fragment component for JSX\n * Renders children without a wrapper element\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function Fragment(props: { children?: any[] }): FNode {\n return createFNode('fragment', {}, props.children ?? [])\n}\n\n/**\n * JSX runtime for development (same as production for now)\n */\nexport { jsx as jsxDEV }\n\nexport namespace JSX {\n export interface IntrinsicElements {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [elemName: string]: any\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n export type Element = any\n export interface ElementClass {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n render: any\n }\n export interface ElementAttributesProperty {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n props: any\n }\n export interface ElementChildrenAttribute {\n children: {}\n }\n}\n"]}
|
package/dist/chunk-Q7IWDVJ4.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
'use strict';var chunkWQFQO5LK_js=require('./chunk-WQFQO5LK.js');function l(n,e,...r){let o=e||{},d=o.key;d!==void 0&&delete o.key;let s=f(r).filter(t=>t!=null&&t!==false);return chunkWQFQO5LK_js.a(n,o,s,d)}function y(n){return chunkWQFQO5LK_js.a("fragment",{},n.children||[])}function f(n){let e=[];for(let r of n)Array.isArray(r)?e.push(...f(r)):e.push(r);return e}function u(n){return n!==null&&typeof n=="object"&&"type"in n&&"props"in n&&"children"in n}exports.a=l;exports.b=y;exports.c=u;//# sourceMappingURL=chunk-Q7IWDVJ4.js.map
|
|
2
|
-
//# sourceMappingURL=chunk-Q7IWDVJ4.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/renderers/dom/f.ts"],"names":["f","type","props","children","normalizedProps","key","normalizedChildren","flattenChildren","child","createFNode","Fragment","result","isFNode","value"],"mappings":"iEA4BO,SAASA,CAAAA,CACdC,EAEAC,CAAAA,CAAAA,GAEGC,CAAAA,CACI,CAEP,IAAMC,CAAAA,CAAkBF,GAAS,EAAC,CAG5BG,EAAMD,CAAAA,CAAgB,GAAA,CACxBC,IAAQ,MAAA,EACV,OAAOD,EAAgB,GAAA,CAIzB,IAAME,CAAAA,CAAqBC,CAAAA,CAAgBJ,CAAQ,CAAA,CAAE,OAClDK,CAAAA,EAAUA,CAAAA,EAAU,MAA+BA,CAAAA,GAAU,KAChE,EAEA,OAAOC,kBAAAA,CAAYR,EAAMG,CAAAA,CAAiBE,CAAAA,CAAoBD,CAAG,CACnE,CAOO,SAASK,CAAAA,CAASR,CAAAA,CAAoC,CAC3D,OAAOO,kBAAAA,CAAY,UAAA,CAAY,EAAC,CAAGP,CAAAA,CAAM,UAAY,EAAE,CACzD,CAMA,SAASK,EAAgBJ,CAAAA,CAAwB,CAE/C,IAAMQ,CAAAA,CAAgB,GAEtB,IAAA,IAAWH,CAAAA,IAASL,EACd,KAAA,CAAM,OAAA,CAAQK,CAAK,CAAA,CACrBG,CAAAA,CAAO,IAAA,CAAK,GAAGJ,CAAAA,CAAgBC,CAAK,CAAC,CAAA,CAErCG,CAAAA,CAAO,KAAKH,CAAK,CAAA,CAIrB,OAAOG,CACT,CAMO,SAASC,CAAAA,CAAQC,CAAAA,CAA4B,CAClD,OACEA,CAAAA,GAAU,IAAA,EACV,OAAOA,CAAAA,EAAU,QAAA,EACjB,SAAUA,CAAAA,EACV,OAAA,GAAWA,CAAAA,EACX,UAAA,GAAcA,CAElB","file":"chunk-Q7IWDVJ4.js","sourcesContent":["/**\n * JSX Factory Function (f)\n *\n * This module provides the JSX factory function for creating Flexium nodes.\n * It's used by the JSX transpiler to convert JSX syntax into function calls.\n *\n * Usage in tsconfig.json:\n * {\n * \"compilerOptions\": {\n * \"jsx\": \"react\",\n * \"jsxFactory\": \"f\",\n * \"jsxFragmentFactory\": \"Fragment\"\n * }\n * }\n */\n\nimport type { FNode } from '../../core/renderer'\nimport { createFNode } from '../../core/fnode'\n\n/**\n * JSX factory function for Flexium\n * Creates a Flexium node from JSX syntax\n *\n * @param type - Element type (string for built-in, function for components)\n * @param props - Element properties\n * @param children - Child elements\n * @returns Flexium node\n */\nexport function f(\n type: string | Function,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n props: Record<string, any> | null,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ...children: any[]\n): FNode {\n // Normalize props\n const normalizedProps = props || {}\n\n // Extract key if present\n const key = normalizedProps.key\n if (key !== undefined) {\n delete normalizedProps.key\n }\n\n // Flatten and filter children\n const normalizedChildren = flattenChildren(children).filter(\n (child) => child !== null && child !== undefined && child !== false\n )\n\n return createFNode(type, normalizedProps, normalizedChildren, key)\n}\n\n/**\n * Fragment component\n * Renders children without a wrapper element\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function Fragment(props: { children?: any[] }): FNode {\n return createFNode('fragment', {}, props.children || [])\n}\n\n/**\n * Flatten nested children arrays\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction flattenChildren(children: any[]): any[] {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const result: any[] = []\n\n for (const child of children) {\n if (Array.isArray(child)) {\n result.push(...flattenChildren(child))\n } else {\n result.push(child)\n }\n }\n\n return result\n}\n\n/**\n * Check if a value is an FNode\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function isFNode(value: any): value is FNode {\n return (\n value !== null &&\n typeof value === 'object' &&\n 'type' in value &&\n 'props' in value &&\n 'children' in value\n )\n}\n"]}
|