flexium 0.17.0 → 0.17.2
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/dist/chunk-C6ATNBIE.js +2 -0
- package/dist/chunk-C6ATNBIE.js.map +1 -0
- package/dist/chunk-F5JCZFHX.js +2 -0
- package/dist/chunk-F5JCZFHX.js.map +1 -0
- package/dist/chunk-GHXGQFTP.mjs +2 -0
- package/dist/chunk-GHXGQFTP.mjs.map +1 -0
- package/dist/chunk-GLMD343V.js +2 -0
- package/dist/chunk-GLMD343V.js.map +1 -0
- package/dist/chunk-I6X66M5T.mjs +2 -0
- package/dist/chunk-I6X66M5T.mjs.map +1 -0
- package/dist/chunk-MEJO2RIK.mjs +2 -0
- package/dist/chunk-MEJO2RIK.mjs.map +1 -0
- package/dist/chunk-SMVFW7HP.js +2 -0
- package/dist/chunk-SMVFW7HP.js.map +1 -0
- package/dist/chunk-XQZNYJCD.mjs +2 -0
- package/dist/chunk-XQZNYJCD.mjs.map +1 -0
- package/dist/css.js +1 -1
- package/dist/css.mjs +1 -1
- package/dist/dom.js +1 -1
- package/dist/dom.mjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- 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/metafile-cjs.json +1 -1
- package/dist/metafile-esm.json +1 -1
- package/dist/render-DQ5Y7FXE.js +2 -0
- package/dist/{render-YCVY5DAU.js.map → render-DQ5Y7FXE.js.map} +1 -1
- package/dist/render-EA3YGOX2.mjs +2 -0
- package/dist/{render-TG2G2LIG.mjs.map → render-EA3YGOX2.mjs.map} +1 -1
- package/dist/router.js +1 -1
- package/dist/router.mjs +1 -1
- package/package.json +2 -1
- package/dist/chunk-E6BLZITZ.js +0 -2
- package/dist/chunk-E6BLZITZ.js.map +0 -1
- package/dist/chunk-FOIJLZF5.mjs +0 -2
- package/dist/chunk-FOIJLZF5.mjs.map +0 -1
- package/dist/chunk-FU4W2BKL.mjs +0 -2
- package/dist/chunk-FU4W2BKL.mjs.map +0 -1
- package/dist/chunk-G77CMAP7.js +0 -2
- package/dist/chunk-G77CMAP7.js.map +0 -1
- package/dist/chunk-GX6JHCXO.mjs +0 -2
- package/dist/chunk-GX6JHCXO.mjs.map +0 -1
- package/dist/chunk-OJBE2TFB.mjs +0 -2
- package/dist/chunk-OJBE2TFB.mjs.map +0 -1
- package/dist/chunk-SXV5YVKP.js +0 -2
- package/dist/chunk-SXV5YVKP.js.map +0 -1
- package/dist/chunk-ZJZRDYA2.js +0 -2
- package/dist/chunk-ZJZRDYA2.js.map +0 -1
- package/dist/render-TG2G2LIG.mjs +0 -2
- package/dist/render-YCVY5DAU.js +0 -2
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';function C(e){let n=5381;for(let t=0;t<e.length;t++)n=(n<<5)+n^e.charCodeAt(t);return "fx-"+(n>>>0).toString(36)}var W=new Set(["animationIterationCount","borderImageOutset","borderImageSlice","borderImageWidth","boxFlex","boxFlexGroup","boxOrdinalGroup","columnCount","columns","flex","flexGrow","flexPositive","flexShrink","flexNegative","flexOrder","gridArea","gridRow","gridRowEnd","gridRowSpan","gridRowStart","gridColumn","gridColumnEnd","gridColumnSpan","gridColumnStart","fontWeight","lineClamp","lineHeight","opacity","order","orphans","tabSize","widows","zIndex","zoom","fillOpacity","floodOpacity","stopOpacity","strokeDasharray","strokeDashoffset","strokeMiterlimit","strokeOpacity","strokeWidth"]);function K(e){return e.replace(/[A-Z]/g,n=>"-"+n.toLowerCase())}function P(e,n){return typeof n=="number"&&n!==0&&!W.has(e)?n+"px":String(n)}function k(e,n){let t="",r="";for(let i in e){let a=e[i];if(a!=null)if(i.startsWith("&")){let l=i.replace(/&/g,n);r+=k(a,l);}else if(i.startsWith("@"))r+=`${i}{${k(a,n)}}`;else {if(typeof a=="object")continue;t+=`${K(i)}:${P(i,a)};`;}}let s="";return t&&(s=`${n}{${t}}`),s+=r,s}function z(e,n){let t="";for(let r in n){let s=n[r],i="";for(let a in s){let l=s[a];l!=null&&typeof l!="object"&&(i+=`${K(a)}:${P(a,l)};`);}t+=`${r}{${i}}`;}return `@keyframes ${e}{${t}}`}var g=new Map,T=[],m=null;function M(){return typeof document<"u"&&"adoptedStyleSheets"in document&&typeof CSSStyleSheet<"u"&&"replaceSync"in CSSStyleSheet.prototype}function H(){return M()?(m||(m=new CSSStyleSheet,document.adoptedStyleSheets=[...document.adoptedStyleSheets,m]),m):null}function V(e,n){if(g.has(e))return;g.set(e,true);let t=H();if(t)try{t.insertRule(n,t.cssRules.length);}catch{}else T.push(n);}function O(e){return g.has(e)}function A(){return T.join("")}function L(){let e=A();return e?`<style data-flexium-css>${e}</style>`:""}function q(){T=[],g=new Map,m=null;}function D(){if(typeof document>"u")return;let e=document.querySelector("style[data-flexium-css]");if(e){let n=e.textContent||"",t=/\.fx-[a-z0-9]+/g,r;for(;(r=t.exec(n))!==null;){let s=r[0].slice(1);g.set(s,true);}}}M()&&D();function S(e){let n=JSON.stringify(e),t=C(n);if(O(t))return t;let r=k(e,"."+t);return V(t,r),t}function $(...e){return e.filter(Boolean).join(" ")}function G(e,n){let{base:t,variants:r,defaultVariants:s,compoundVariants:i}=n,a=S(t),l=new Map;function F(d,c){let h=`${d}:${c}`,f=l.get(h);return !f&&r?.[d]?.[c]&&(f=S(r[d][c]),l.set(h,f)),f||""}let j=new Map;function v(d){let{children:c,className:h,...f}=d,u={},N={};for(let o in f)r&&o in r?u[o]=f[o]??s?.[o]:N[o]=f[o];if(s)for(let o in s)o in u||(u[o]=String(s[o]));let w=[];for(let[o,x]of Object.entries(u))if(x){let y=F(o,String(x));y&&w.push(y);}if(i)for(let o of i){let{css:x,...y}=o,R=true;for(let[b,p]of Object.entries(y))if(u[b]!==p){R=false;break}if(R){let b=JSON.stringify(y),p=j.get(b);p||(p=S(x),j.set(b,p)),w.push(p);}}let I=$(a,...w,h);return {type:e,props:{...N,className:I},children:Array.isArray(c)?c:c!=null?[c]:[],key:void 0}}return v.displayName=`Styled(${e})`,v}function J(e){let n=JSON.stringify(e),t=C(n);if(O(t))return t;let r=z(t,e);return V(t,r),t}exports.a=A;exports.b=L;exports.c=q;exports.d=D;exports.e=S;exports.f=$;exports.g=G;exports.h=J;//# sourceMappingURL=chunk-C6ATNBIE.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-C6ATNBIE.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/css/runtime/hash.ts","../src/css/runtime/serialize.ts","../src/css/runtime/sheet.ts","../src/css/css.ts","../src/css/styled.ts","../src/css/keyframes.ts"],"names":["hash","str","h","i","unitlessProperties","toKebabCase","match","addUnit","property","value","serialize","styles","selector","properties","nested","key","nestedSelector","result","serializeKeyframes","name","keyframes","frames","prop","cache","serverStyles","browserSheet","supportsAdoptedStyleSheets","getBrowserSheet","insert","css","sheet","has","getStyles","getStyleTag","resetStyles","hydrateStyles","styleTag","text","classRegex","className","cssText","cx","classes","styled","tag","config","base","variants","defaultVariants","compoundVariants","baseClass","variantCache","getVariantClass","variantName","variantValue","cacheKey","compoundCache","StyledComponent","props","children","userClassName","rest","variantProps","elementProps","variantClasses","vc","compound","compoundStyles","conditions","matches","compoundClass","finalClassName","definition"],"mappings":"aAIO,SAASA,CAAAA,CAAKC,EAAqB,CACxC,IAAIC,EAAI,IAAA,CACR,IAAA,IAASC,EAAI,CAAA,CAAGA,CAAAA,CAAIF,EAAI,MAAA,CAAQE,CAAAA,EAAAA,CAC9BD,GAAMA,CAAAA,EAAK,CAAA,EAAKA,EAAKD,CAAAA,CAAI,UAAA,CAAWE,CAAC,CAAA,CAEvC,OAAO,OAASD,CAAAA,GAAM,CAAA,EAAG,SAAS,EAAE,CACtC,CCLA,IAAME,CAAAA,CAAqB,IAAI,GAAA,CAAI,CACjC,0BACA,mBAAA,CACA,kBAAA,CACA,mBACA,SAAA,CACA,cAAA,CACA,kBACA,aAAA,C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A,GAAMN,CAAAA,CAAO,CAC/B4D,CAAAA,CAAU,KAAA,CACV,KACF,CAGF,GAAIA,EAAS,CAEX,IAAMd,CAAAA,CAAW,IAAA,CAAK,SAAA,CAAUa,CAAU,EACtCE,CAAAA,CAAgBd,CAAAA,CAAc,IAAID,CAAQ,CAAA,CAEzCe,IACHA,CAAAA,CAAgBzC,CAAAA,CAAIsC,CAAc,CAAA,CAClCX,CAAAA,CAAc,IAAID,CAAAA,CAAUe,CAAa,GAG3CN,CAAAA,CAAe,IAAA,CAAKM,CAAa,EACnC,CACF,CAIF,IAAMC,CAAAA,CAAiB9B,EAAGS,CAAAA,CAAW,GAAGc,EAAgBJ,CAAa,CAAA,CAGrE,OAAO,CACL,IAAA,CAAMhB,EACN,KAAA,CAAO,CAAE,GAAGmB,CAAAA,CAAc,SAAA,CAAWQ,CAAe,CAAA,CACpD,QAAA,CAAU,MAAM,OAAA,CAAQZ,CAAQ,CAAA,CAAIA,CAAAA,CAAWA,CAAAA,EAAY,IAAA,CAAO,CAACA,CAAQ,CAAA,CAAI,EAAC,CAChF,GAAA,CAAK,MACP,CACF,CAGA,OAAAF,CAAAA,CAAgB,WAAA,CAAc,UAAUb,CAAG,CAAA,CAAA,CAAA,CAEpCa,CACT,CChJO,SAASrC,EAAUoD,CAAAA,CAAwC,CAEhE,IAAMzD,CAAAA,CAAM,IAAA,CAAK,SAAA,CAAUyD,CAAU,CAAA,CAC/BrD,CAAAA,CAAOnB,EAAKe,CAAG,CAAA,CAGrB,GAAIgB,CAAAA,CAAIZ,CAAI,EACV,OAAOA,CAAAA,CAIT,IAAMqB,CAAAA,CAAUtB,CAAAA,CAAmBC,EAAMqD,CAAsD,CAAA,CAC/F,OAAA5C,CAAAA,CAAOT,CAAAA,CAAMqB,CAAO,CAAA,CAEbrB,CACT","file":"chunk-C6ATNBIE.js","sourcesContent":["/**\n * Generate a hash for a style object\n * Uses djb2 algorithm for fast, low-collision hashing\n */\nexport function hash(str: string): string {\n let h = 5381\n for (let i = 0; i < str.length; i++) {\n h = ((h << 5) + h) ^ str.charCodeAt(i)\n }\n return 'fx-' + (h >>> 0).toString(36)\n}\n","import type { StyleObject, CSSValue } from '../types'\n\n/**\n * Properties that should not have 'px' auto-added\n */\nconst unitlessProperties = new Set([\n 'animationIterationCount',\n 'borderImageOutset',\n 'borderImageSlice',\n 'borderImageWidth',\n 'boxFlex',\n 'boxFlexGroup',\n 'boxOrdinalGroup',\n 'columnCount',\n 'columns',\n 'flex',\n 'flexGrow',\n 'flexPositive',\n 'flexShrink',\n 'flexNegative',\n 'flexOrder',\n 'gridArea',\n 'gridRow',\n 'gridRowEnd',\n 'gridRowSpan',\n 'gridRowStart',\n 'gridColumn',\n 'gridColumnEnd',\n 'gridColumnSpan',\n 'gridColumnStart',\n 'fontWeight',\n 'lineClamp',\n 'lineHeight',\n 'opacity',\n 'order',\n 'orphans',\n 'tabSize',\n 'widows',\n 'zIndex',\n 'zoom',\n 'fillOpacity',\n 'floodOpacity',\n 'stopOpacity',\n 'strokeDasharray',\n 'strokeDashoffset',\n 'strokeMiterlimit',\n 'strokeOpacity',\n 'strokeWidth',\n])\n\n/**\n * Convert camelCase to kebab-case\n */\nexport function toKebabCase(str: string): string {\n return str.replace(/[A-Z]/g, (match) => '-' + match.toLowerCase())\n}\n\n/**\n * Add unit to numeric values where appropriate\n */\nexport function addUnit(property: string, value: CSSValue): string {\n if (typeof value === 'number' && value !== 0 && !unitlessProperties.has(property)) {\n return value + 'px'\n }\n return String(value)\n}\n\n/**\n * Serialize a style object to CSS string\n */\nexport function serialize(styles: StyleObject, selector: string): string {\n let properties = ''\n let nested = ''\n\n for (const key in styles) {\n const value = styles[key]\n\n if (value === undefined || value === null) {\n continue\n }\n\n if (key.startsWith('&')) {\n // Nested selector: &:hover, &::before, & > div\n const nestedSelector = key.replace(/&/g, selector)\n nested += serialize(value as StyleObject, nestedSelector)\n } else if (key.startsWith('@')) {\n // At-rule: @media, @supports, @container\n nested += `${key}{${serialize(value as StyleObject, selector)}}`\n } else if (typeof value === 'object') {\n // Skip invalid nested objects without & or @\n continue\n } else {\n // Regular CSS property\n properties += `${toKebabCase(key)}:${addUnit(key, value)};`\n }\n }\n\n let result = ''\n if (properties) {\n result = `${selector}{${properties}}`\n }\n result += nested\n\n return result\n}\n\n/**\n * Serialize keyframes to CSS string\n */\nexport function serializeKeyframes(\n name: string,\n keyframes: Record<string, Record<string, CSSValue>>\n): string {\n let frames = ''\n\n for (const key in keyframes) {\n const styles = keyframes[key]\n let properties = ''\n\n for (const prop in styles) {\n const value = styles[prop]\n if (value !== undefined && value !== null && typeof value !== 'object') {\n properties += `${toKebabCase(prop)}:${addUnit(prop, value)};`\n }\n }\n\n frames += `${key}{${properties}}`\n }\n\n return `@keyframes ${name}{${frames}}`\n}\n","/**\n * StyleSheet manager\n * Uses adoptedStyleSheets for efficient style injection\n * Falls back to server-side collection when not available (SSR, jsdom)\n */\n\n// Cache to track which styles have been inserted\nlet cache = new Map<string, boolean>()\n\n// Server-side collected styles\nlet serverStyles: string[] = []\n\n// Browser stylesheet (lazy initialized)\nlet browserSheet: CSSStyleSheet | null = null\n\n/**\n * Check if adoptedStyleSheets is supported\n */\nfunction supportsAdoptedStyleSheets(): boolean {\n return (\n typeof document !== 'undefined' &&\n 'adoptedStyleSheets' in document &&\n typeof CSSStyleSheet !== 'undefined' &&\n 'replaceSync' in CSSStyleSheet.prototype\n )\n}\n\nfunction getBrowserSheet(): CSSStyleSheet | null {\n if (!supportsAdoptedStyleSheets()) {\n return null\n }\n\n if (!browserSheet) {\n browserSheet = new CSSStyleSheet()\n document.adoptedStyleSheets = [...document.adoptedStyleSheets, browserSheet]\n }\n return browserSheet\n}\n\n/**\n * Insert a CSS rule\n */\nexport function insert(hash: string, css: string): void {\n if (cache.has(hash)) {\n return\n }\n\n cache.set(hash, true)\n\n const sheet = getBrowserSheet()\n if (sheet) {\n try {\n sheet.insertRule(css, sheet.cssRules.length)\n } catch {\n // Handle invalid CSS gracefully\n }\n } else {\n // Server-side or unsupported environment: collect styles\n serverStyles.push(css)\n }\n}\n\n/**\n * Check if a hash is already in the cache\n */\nexport function has(hash: string): boolean {\n return cache.has(hash)\n}\n\n/**\n * Get all collected styles for SSR\n */\nexport function getStyles(): string {\n return serverStyles.join('')\n}\n\n/**\n * Get styles as a style tag for SSR\n */\nexport function getStyleTag(): string {\n const styles = getStyles()\n if (!styles) return ''\n return `<style data-flexium-css>${styles}</style>`\n}\n\n/**\n * Reset collected styles and cache (for SSR between requests or testing)\n */\nexport function resetStyles(): void {\n serverStyles = []\n cache = new Map()\n browserSheet = null\n}\n\n/**\n * Hydrate styles on the client\n * Call this after SSR to sync the cache with server-rendered styles\n */\nexport function hydrateStyles(): void {\n if (typeof document === 'undefined') return\n\n const styleTag = document.querySelector('style[data-flexium-css]')\n if (styleTag) {\n // Parse and cache existing styles\n const text = styleTag.textContent || ''\n const classRegex = /\\.fx-[a-z0-9]+/g\n let match\n while ((match = classRegex.exec(text)) !== null) {\n const hash = match[0].slice(1) // Remove the dot\n cache.set(hash, true)\n }\n }\n}\n\n// Auto-hydrate on client (only if adoptedStyleSheets is supported)\nif (supportsAdoptedStyleSheets()) {\n hydrateStyles()\n}\n","import type { StyleObject } from './types'\nimport { hash } from './runtime/hash'\nimport { serialize } from './runtime/serialize'\nimport { insert, has } from './runtime/sheet'\n\n/**\n * Create a CSS class from a style object\n *\n * @example\n * ```tsx\n * const buttonClass = css({\n * padding: '8px 16px',\n * backgroundColor: 'blue',\n * color: 'white',\n * '&:hover': {\n * backgroundColor: 'darkblue'\n * }\n * })\n *\n * <button className={buttonClass}>Click me</button>\n * ```\n */\nexport function css(styles: StyleObject): string {\n // Generate unique hash from style object\n const key = JSON.stringify(styles)\n const className = hash(key)\n\n // Skip if already inserted\n if (has(className)) {\n return className\n }\n\n // Serialize and insert CSS\n const cssText = serialize(styles, '.' + className)\n insert(className, cssText)\n\n return className\n}\n\n/**\n * Combine multiple class names, filtering out falsy values\n *\n * @example\n * ```tsx\n * const className = cx(\n * baseClass,\n * isActive && activeClass,\n * variant === 'primary' && primaryClass\n * )\n * ```\n */\nexport function cx(\n ...classes: (string | boolean | null | undefined)[]\n): string {\n return classes.filter(Boolean).join(' ')\n}\n","import type { StyleObject, VariantConfig, StyledConfig } from './types'\nimport type { FNode } from '../dom/types'\nimport { css, cx } from './css'\n\n// HTML element tag names\ntype HTMLTag = 'a' | 'abbr' | 'address' | 'area' | 'article' | 'aside' | 'audio' |\n 'b' | 'base' | 'bdi' | 'bdo' | 'blockquote' | 'body' | 'br' | 'button' |\n 'canvas' | 'caption' | 'cite' | 'code' | 'col' | 'colgroup' |\n 'data' | 'datalist' | 'dd' | 'del' | 'details' | 'dfn' | 'dialog' | 'div' | 'dl' | 'dt' |\n 'em' | 'embed' |\n 'fieldset' | 'figcaption' | 'figure' | 'footer' | 'form' |\n 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'head' | 'header' | 'hgroup' | 'hr' | 'html' |\n 'i' | 'iframe' | 'img' | 'input' | 'ins' |\n 'kbd' |\n 'label' | 'legend' | 'li' | 'link' |\n 'main' | 'map' | 'mark' | 'menu' | 'meta' | 'meter' |\n 'nav' | 'noscript' |\n 'object' | 'ol' | 'optgroup' | 'option' | 'output' |\n 'p' | 'picture' | 'pre' | 'progress' |\n 'q' |\n 'rp' | 'rt' | 'ruby' |\n 's' | 'samp' | 'script' | 'search' | 'section' | 'select' | 'slot' | 'small' | 'source' | 'span' | 'strong' | 'style' | 'sub' | 'summary' | 'sup' | 'svg' |\n 'table' | 'tbody' | 'td' | 'template' | 'textarea' | 'tfoot' | 'th' | 'thead' | 'time' | 'title' | 'tr' | 'track' |\n 'u' | 'ul' |\n 'var' | 'video' |\n 'wbr'\n\n/**\n * Create a styled component with variant support\n *\n * @example\n * ```tsx\n * const Button = styled('button', {\n * base: {\n * padding: '8px 16px',\n * border: 'none',\n * borderRadius: 4,\n * cursor: 'pointer'\n * },\n * variants: {\n * variant: {\n * primary: { backgroundColor: 'blue', color: 'white' },\n * secondary: { backgroundColor: 'gray', color: 'black' }\n * },\n * size: {\n * sm: { padding: '4px 8px', fontSize: 12 },\n * md: { padding: '8px 16px', fontSize: 14 },\n * lg: { padding: '12px 24px', fontSize: 16 }\n * }\n * },\n * defaultVariants: {\n * variant: 'primary',\n * size: 'md'\n * }\n * })\n *\n * // Usage\n * <Button variant=\"secondary\" size=\"lg\">Click me</Button>\n * ```\n */\nexport function styled<\n T extends HTMLTag,\n V extends VariantConfig = Record<string, never>\n>(\n tag: T,\n config: StyledConfig<V>\n): StyledComponent<T, V> {\n const { base, variants, defaultVariants, compoundVariants } = config\n\n // Pre-compute base class\n const baseClass = css(base)\n\n // Cache for variant classes\n const variantCache = new Map<string, string>()\n\n // Get or create variant class\n function getVariantClass(variantName: string, variantValue: string): string {\n const cacheKey = `${variantName}:${variantValue}`\n let className = variantCache.get(cacheKey)\n\n if (!className && variants?.[variantName]?.[variantValue]) {\n className = css(variants[variantName][variantValue])\n variantCache.set(cacheKey, className)\n }\n\n return className || ''\n }\n\n // Compound variant cache\n const compoundCache = new Map<string, string>()\n\n function StyledComponent(props: StyledComponentProps<V>): FNode {\n const { children, className: userClassName, ...rest } = props as any\n\n // Separate variant props from element props\n const variantProps: Record<string, string> = {}\n const elementProps: Record<string, any> = {}\n\n for (const key in rest) {\n if (variants && key in variants) {\n variantProps[key] = rest[key] ?? (defaultVariants as any)?.[key]\n } else {\n elementProps[key] = rest[key]\n }\n }\n\n // Apply default variants for missing props\n if (defaultVariants) {\n for (const key in defaultVariants) {\n if (!(key in variantProps)) {\n variantProps[key] = String(defaultVariants[key as keyof typeof defaultVariants])\n }\n }\n }\n\n // Collect variant classes\n const variantClasses: string[] = []\n for (const [name, value] of Object.entries(variantProps)) {\n if (value) {\n const vc = getVariantClass(name, String(value))\n if (vc) variantClasses.push(vc)\n }\n }\n\n // Check compound variants\n if (compoundVariants) {\n for (const compound of compoundVariants) {\n const { css: compoundStyles, ...conditions } = compound\n\n // Check if all conditions match\n let matches = true\n for (const [key, value] of Object.entries(conditions)) {\n if (variantProps[key] !== value) {\n matches = false\n break\n }\n }\n\n if (matches) {\n // Generate cache key from conditions\n const cacheKey = JSON.stringify(conditions)\n let compoundClass = compoundCache.get(cacheKey)\n\n if (!compoundClass) {\n compoundClass = css(compoundStyles)\n compoundCache.set(cacheKey, compoundClass)\n }\n\n variantClasses.push(compoundClass)\n }\n }\n }\n\n // Combine all classes\n const finalClassName = cx(baseClass, ...variantClasses, userClassName)\n\n // Return FNode element\n return {\n type: tag,\n props: { ...elementProps, className: finalClassName },\n children: Array.isArray(children) ? children : children != null ? [children] : [],\n key: undefined\n }\n }\n\n // Mark as styled component\n StyledComponent.displayName = `Styled(${tag})`\n\n return StyledComponent as unknown as StyledComponent<T, V>\n}\n\n// Types\ntype StyledComponent<\n T extends HTMLTag,\n V extends VariantConfig\n> = {\n (props: StyledComponentProps<V>): FNode\n displayName: string\n}\n\ntype StyledComponentProps<V extends VariantConfig> = {\n [K in keyof V]?: keyof V[K]\n} & {\n children?: any\n className?: string\n [key: string]: any\n}\n","import type { KeyframeDefinition, CSSValue } from './types'\nimport { hash } from './runtime/hash'\nimport { serializeKeyframes } from './runtime/serialize'\nimport { insert, has } from './runtime/sheet'\n\n/**\n * Create a keyframes animation\n *\n * @example\n * ```tsx\n * const fadeIn = keyframes({\n * from: { opacity: 0 },\n * to: { opacity: 1 }\n * })\n *\n * const slideIn = keyframes({\n * '0%': { transform: 'translateX(-100%)' },\n * '100%': { transform: 'translateX(0)' }\n * })\n *\n * const className = css({\n * animation: `${fadeIn} 0.3s ease-in-out`\n * })\n * ```\n */\nexport function keyframes(definition: KeyframeDefinition): string {\n // Generate unique name from keyframe definition\n const key = JSON.stringify(definition)\n const name = hash(key)\n\n // Skip if already inserted\n if (has(name)) {\n return name\n }\n\n // Serialize and insert keyframes\n const cssText = serializeKeyframes(name, definition as Record<string, Record<string, CSSValue>>)\n insert(name, cssText)\n\n return name\n}\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var chunkGLMD343V_js=require('./chunk-GLMD343V.js'),chunkBP5PDE6F_js=require('./chunk-BP5PDE6F.js'),chunk3CKIHQIE_js=require('./chunk-3CKIHQIE.js'),chunkOU6XJZ76_js=require('./chunk-OU6XJZ76.js');function Q(e,n,...t){return {type:e,props:n||{},children:t,key:n?.key}}var p=null,w=new WeakMap,h=null;function U(e,n,t={}){let{state:o,onHydrated:r,onMismatch:a}=t;p=n.firstChild;try{let i;typeof e=="function"&&!$(e)?i={type:e,props:{},children:[],key:void 0}:i=e,v(i,n),r?.();}catch(i){a?.(i),n.innerHTML="",import('./render-DQ5Y7FXE.js').then(({render:l})=>{l(e,n);});}finally{p=null;}}function $(e){return e&&typeof e=="object"&&"type"in e&&"props"in e}function v(e,n){if(e==null||typeof e=="boolean")return P(),null;if(typeof e=="string"||typeof e=="number")return Y(String(e));if(Array.isArray(e)){let t=[];for(let o of e){let r=v(o,n);r&&(Array.isArray(r)?t.push(...r):t.push(r));}return t}if(typeof e=="function")return V({type:e,props:{},children:[],key:void 0},n);if(typeof e=="object"&&$(e)){if(typeof e.type=="string")return Z(e);if(typeof e.type=="function")return V(e,n)}return null}function P(){for(;p&&p.nodeType===Node.TEXT_NODE&&(!p.textContent||p.textContent.trim()==="");)p=p.nextSibling;}function Y(e){P();let n=p;if(!n)return null;if(n.nodeType!==Node.TEXT_NODE){if(e.trim()==="")return null;throw new Error(`Hydration mismatch: expected text node "${e}", got ${n.nodeName}`)}return p=n.nextSibling,n}function Z(e){P();let n=p,t=e.type;if(!n||n.nodeType!==Node.ELEMENT_NODE)throw new Error(`Hydration mismatch: expected element <${t}>, got ${n?.nodeName||"nothing"}`);if(n.tagName.toLowerCase()!==t.toLowerCase())throw new Error(`Hydration mismatch: expected <${t}>, got <${n.tagName.toLowerCase()}>`);if(e.props){for(let[o,r]of Object.entries(e.props))if(o==="ref")typeof r=="function"?r(n):r&&typeof r=="object"&&"current"in r&&(r.current=n);else if(o.startsWith("on")&&typeof r=="function"){let a=o.slice(2).toLowerCase();n.addEventListener(a,r),n.__eventHandlers||(n.__eventHandlers={}),n.__eventHandlers[a]=r;}}if(p=n.nextSibling,e.children&&e.children.length>0){let o=p;p=n.firstChild;for(let r of e.children)v(r,n);p=o;}return n}function V(e,n){let t=e.type,o={...e.props};e.children&&e.children.length>0&&(o.children=e.children.length===1?e.children[0]:e.children);let r=t._contextId,a=r!==void 0,i;a&&(i=chunkOU6XJZ76_js.h(r,o.value)),w.has(n)||w.set(n,new Map);let l=w.get(n),C=e.key!==void 0,u;if(C)u=e.key;else {let c=0,y=t.name||"anonymous";l.forEach((F,x)=>{typeof x=="string"&&x.startsWith(`__auto_${y}_`)&&c++;}),u=`__auto_${y}_${c}`;}let s={hooks:[],hookIndex:0,nodes:[],parent:n,fnode:e,props:o,key:u,children:new Set,parentInstance:h||void 0};h&&h.children.add(s),l.set(u,s);let d=h;h=s;try{let c=chunkOU6XJZ76_js.a(s,()=>t(o)),y=v(c,n);s.nodes=y?Array.isArray(y)?y:[y]:[];let F=!0,x=()=>{let X=s.props,B=chunkOU6XJZ76_js.a(s,()=>t(X));if(F){F=!1;return}if(s.nodes.length===0){let g=chunkGLMD343V_js.b(B,n);s.nodes=g?Array.isArray(g)?g:[g]:[];return}let m=s.nodes[0].parentNode;if(!m)return;let E=document.createComment("flexium-marker"),L=s.nodes[s.nodes.length-1];L.nextSibling?m.insertBefore(E,L.nextSibling):m.appendChild(E),s.children.clear();let q=document.createElement("div"),N=chunkGLMD343V_js.b(B,q,m),G=N?Array.isArray(N)?N:[N]:[],J=chunkGLMD343V_js.c(s.nodes,G,m,E);m.removeChild(E),s.nodes=J;};return s.renderFn=x,chunk3CKIHQIE_js.b(x),s.nodes}finally{h=d,a&&chunkOU6XJZ76_js.i(r,i);}}var ee={register:()=>{},hasBoundary:false},H=new chunkOU6XJZ76_js.f(ee);function D(){let[e]=chunkBP5PDE6F_js.c(H);return e}function R(e){let{fallback:n,children:t}=e,o=chunkOU6XJZ76_js.b(()=>new Set),[,r]=chunkBP5PDE6F_js.c(0),[a,i]=chunkBP5PDE6F_js.c(false),C={register:s=>{o.has(s)||(o.add(s),r(d=>d+1),i(true),s.finally(()=>{o.delete(s),r(d=>{let c=d-1;return c===0&&i(false),c});}));},hasBoundary:true},u=a?n:t;return {type:H.Provider,props:{value:C},children:[u],key:void 0}}function W(e){let{fallback:n,onError:t,children:o,resetKey:r}=e,[a,i]=chunkBP5PDE6F_js.c({error:null,info:null}),l=chunkOU6XJZ76_js.b(()=>({current:r}));r!==l.current&&(l.current=r,a.error!==null&&i({error:null,info:null}));if(a.error)return typeof n=="function"?n(a.error,a.info):n;try{return o}finally{}}function K(e){let n=null,t=null,o=null,r=a=>{if(n)return n(a);if(o)throw o;let i=D();return t||(t=e().then(l=>{n=l.default;}).catch(l=>{o=l instanceof Error?l:new Error(String(l));})),i.hasBoundary&&i.register(t),null};return r._lazy=true,r._loader=e,r}exports.a=Q;exports.b=U;exports.c=R;exports.d=W;exports.e=K;//# sourceMappingURL=chunk-F5JCZFHX.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-F5JCZFHX.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/dom/f.ts","../src/dom/hydrate.ts","../src/dom/components/suspenseContext.ts","../src/dom/components/Suspense.tsx","../src/dom/components/ErrorBoundary.tsx","../src/dom/components/lazy.ts"],"names":["f","type","props","children","hydrationCursor","hydratedInstanceRegistry","currentHydratingInstance","hydrate","app","container","options","state","onHydrated","onMismatch","fnode","isFNode","hydrateNode","error","render","value","parent","skipEmptyTextNodes","hydrateTextNode","nodes","child","result","hydrateComponent","hydrateElement","text","current","tag","key","eventName","savedCursor","Component","contextId","isProvider","prevContextValue","pushContext","parentRegistry","hasExplicitKey","instanceCount","componentName","_","k","instance","previousHydratingInstance","runWithComponent","isFirstRender","renderFn","currentProps","newNodes","renderNode","nodeParent","marker","lastNode","tempContainer","newNodesArray","reconciledNodes","reconcile","unsafeEffect","popContext","defaultValue","SuspenseCtx","Context","suspenseContext","use","Suspense","fallback","pendingSet","hook","setPendingCount","showFallback","setShowFallback","contextValue","promise","c","newCount","content","ErrorBoundary","onError","resetKey","errorState","setErrorState","prevResetKeyRef","lazy","loader","resolved","LazyWrapper","suspense","module","err"],"mappings":"iNAKO,SAASA,CAAAA,CACZC,CAAAA,CACAC,CAAAA,CAAAA,GACGC,CAAAA,CACE,CACL,OAAO,CACH,IAAA,CAAAF,CAAAA,CACA,KAAA,CAAOC,CAAAA,EAAS,GAChB,QAAA,CAAAC,CAAAA,CACA,GAAA,CAAKD,CAAAA,EAAO,GAChB,CACJ,CCRA,IACIE,CAAAA,CAA+B,IAAA,CAkC7BC,EAA2B,IAAI,OAAA,CACjCC,CAAAA,CAAwD,KAarD,SAASC,CAAAA,CACdC,CAAAA,CACAC,CAAAA,CACAC,CAAAA,CAA0B,EAAC,CACrB,CACN,GAAM,CAAE,MAAAC,CAAAA,CAAO,UAAA,CAAAC,CAAAA,CAAY,UAAA,CAAAC,CAAW,CAAA,CAAIH,CAAAA,CAO1CN,CAAAA,CAAkBK,CAAAA,CAAU,WAE5B,GAAI,CAEF,IAAIK,CAAAA,CACA,OAAON,CAAAA,EAAQ,YAAc,CAACO,CAAAA,CAAQP,CAAG,CAAA,CAC3CM,CAAAA,CAAQ,CAAE,KAAMN,CAAAA,CAAK,KAAA,CAAO,EAAC,CAAG,QAAA,CAAU,EAAC,CAAG,GAAA,CAAK,KAAA,CAAU,CAAA,CAE7DM,CAAAA,CAAQN,CAAAA,CAIVQ,CAAAA,CAAYF,CAAAA,CAAOL,CAAS,CAAA,CAE5BG,CAAAA,KACF,CAAA,MAASK,CAAAA,CAAO,CAEdJ,CAAAA,GAAaI,CAAc,CAAA,CAG3BR,CAAAA,CAAU,SAAA,CAAY,EAAA,CAEtB,OAAO,sBAAU,EAAE,IAAA,CAAK,CAAC,CAAE,MAAA,CAAAS,CAAO,CAAA,GAAM,CACtCA,CAAAA,CAA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O,CACd,IAAA,CAAKI,GAAU,CACdH,CAAAA,CAAWG,EAAO,QACpB,CAAC,EACA,KAAA,CAAMC,CAAAA,EAAO,CACZ1E,CAAAA,CAAQ0E,CAAAA,YAAe,KAAA,CAAQA,EAAM,IAAI,KAAA,CAAM,OAAOA,CAAG,CAAC,EAC5D,CAAC,CAAA,CAAA,CAIDF,CAAAA,CAAS,WAAA,EACXA,CAAAA,CAAS,QAAA,CAASd,CAAO,CAAA,CAIpB,IACT,EAGC,OAACa,CAAAA,CAAiC,MAAQ,IAAA,CACzCA,CAAAA,CAAiC,OAAA,CAAUF,CAAAA,CAEtCE,CACT","file":"chunk-F5JCZFHX.js","sourcesContent":["import type { FNode } from './types'\n\n/**\n * f() - Create FNodes without JSX\n */\nexport function f(\n type: string | Function,\n props?: any,\n ...children: any[]\n): FNode {\n return {\n type,\n props: props || {},\n children,\n key: props?.key\n }\n}\n","import type { FNode, FNodeChild } from './types'\nimport type { SerializedState } from '../server/types'\nimport { runWithComponent, type ComponentInstance } from '../core/hook'\nimport { pushContext, popContext } from '../core/context'\nimport { unsafeEffect } from '../core/lifecycle'\nimport { renderNode, reconcile } from './render'\n\n// Hydration state\nlet isHydrating = false\nlet hydrationCursor: Node | null = null\nlet hydrationState: SerializedState | null = null\n\nexport interface HydrateOptions {\n /**\n * Serialized state from server\n * Typically embedded in HTML as JSON script tag\n */\n state?: SerializedState\n\n /**\n * Called when hydration completes successfully\n */\n onHydrated?: () => void\n\n /**\n * Called when hydration fails (falls back to full render)\n */\n onMismatch?: (error: Error) => void\n}\n\n// Extended ComponentInstance for DOM tracking (same as render.ts)\ninterface DOMComponentInstance extends ComponentInstance {\n nodes: Node[]\n parent: HTMLElement\n fnode: any\n props: any\n key?: any\n renderFn?: () => void\n children: Set<DOMComponentInstance>\n parentInstance?: DOMComponentInstance\n}\n\n// Registry for hydrated components\nconst hydratedInstanceRegistry = new WeakMap<HTMLElement, Map<any, DOMComponentInstance>>()\nlet currentHydratingInstance: DOMComponentInstance | null = null\n\nexport function getIsHydrating(): boolean {\n return isHydrating\n}\n\nexport function getHydrationState(): SerializedState | null {\n return hydrationState\n}\n\n/**\n * Hydrate server-rendered HTML with client-side interactivity\n */\nexport function hydrate(\n app: FNodeChild | (() => FNodeChild),\n container: HTMLElement,\n options: HydrateOptions = {}\n): void {\n const { state, onHydrated, onMismatch } = options\n\n // Store state for rehydration\n hydrationState = state || null\n\n // Initialize hydration mode\n isHydrating = true\n hydrationCursor = container.firstChild\n\n try {\n // Normalize input\n let fnode: FNodeChild\n if (typeof app === 'function' && !isFNode(app)) {\n fnode = { type: app, props: {}, children: [], key: undefined }\n } else {\n fnode = app\n }\n\n // Hydrate the tree\n hydrateNode(fnode, container)\n\n onHydrated?.()\n } catch (error) {\n // Hydration mismatch - fall back to full render\n onMismatch?.(error as Error)\n\n // Clear and re-render\n container.innerHTML = ''\n // Import dynamically to avoid circular deps\n import('./render').then(({ render }) => {\n render(app, container)\n })\n } finally {\n isHydrating = false\n hydrationCursor = null\n hydrationState = null\n }\n}\n\nfunction isFNode(value: any): value is FNode {\n return value && typeof value === 'object' && 'type' in value && 'props' in value\n}\n\nfunction hydrateNode(fnode: FNodeChild, parent: HTMLElement): Node | Node[] | null {\n // Null/undefined/boolean -> skip empty text nodes\n if (fnode === null || fnode === undefined || typeof fnode === 'boolean') {\n // Server might have rendered an empty text node\n skipEmptyTextNodes()\n return null\n }\n\n // String/number -> expect text node\n if (typeof fnode === 'string' || typeof fnode === 'number') {\n return hydrateTextNode(String(fnode))\n }\n\n // Array -> hydrate each child\n if (Array.isArray(fnode)) {\n const nodes: Node[] = []\n for (const child of fnode) {\n const result = hydrateNode(child, parent)\n if (result) {\n if (Array.isArray(result)) {\n nodes.push(...result)\n } else {\n nodes.push(result)\n }\n }\n }\n return nodes\n }\n\n // Function (standalone) -> wrap in FNode and hydrate\n if (typeof fnode === 'function') {\n const wrappedFnode: FNode = { type: fnode, props: {}, children: [], key: undefined }\n return hydrateComponent(wrappedFnode, parent)\n }\n\n // Object (FNode)\n if (typeof fnode === 'object' && isFNode(fnode)) {\n if (typeof fnode.type === 'string') {\n return hydrateElement(fnode)\n }\n\n if (typeof fnode.type === 'function') {\n return hydrateComponent(fnode, parent)\n }\n }\n\n return null\n}\n\nfunction skipEmptyTextNodes(): void {\n while (\n hydrationCursor &&\n hydrationCursor.nodeType === Node.TEXT_NODE &&\n (!hydrationCursor.textContent || hydrationCursor.textContent.trim() === '')\n ) {\n hydrationCursor = hydrationCursor.nextSibling\n }\n}\n\nfunction hydrateTextNode(text: string): Node | null {\n skipEmptyTextNodes()\n\n const current = hydrationCursor\n\n if (!current) {\n // No node to hydrate - this is okay for conditional rendering\n return null\n }\n\n if (current.nodeType !== Node.TEXT_NODE) {\n // Try to find a text node nearby (whitespace handling)\n if (text.trim() === '') {\n return null\n }\n throw new Error(`Hydration mismatch: expected text node \"${text}\", got ${current.nodeName}`)\n }\n\n // Update cursor\n hydrationCursor = current.nextSibling\n\n return current\n}\n\nfunction hydrateElement(fnode: FNode): Node {\n skipEmptyTextNodes()\n\n const current = hydrationCursor as Element\n const tag = fnode.type as string\n\n // Validate element type\n if (!current || current.nodeType !== Node.ELEMENT_NODE) {\n throw new Error(`Hydration mismatch: expected element <${tag}>, got ${current?.nodeName || 'nothing'}`)\n }\n\n if (current.tagName.toLowerCase() !== tag.toLowerCase()) {\n throw new Error(`Hydration mismatch: expected <${tag}>, got <${current.tagName.toLowerCase()}>`)\n }\n\n // Attach event handlers and refs (don't modify DOM structure)\n if (fnode.props) {\n for (const [key, value] of Object.entries(fnode.props)) {\n if (key === 'ref') {\n if (typeof value === 'function') {\n value(current)\n } else if (value && typeof value === 'object' && 'current' in value) {\n value.current = current\n }\n } else if (key.startsWith('on') && typeof value === 'function') {\n const eventName = key.slice(2).toLowerCase()\n current.addEventListener(eventName, value as EventListener)\n\n // Store for reconciliation\n if (!(current as any).__eventHandlers) {\n (current as any).__eventHandlers = {}\n }\n (current as any).__eventHandlers[eventName] = value\n }\n }\n }\n\n // Move cursor past this element\n hydrationCursor = current.nextSibling\n\n // Hydrate children\n if (fnode.children && fnode.children.length > 0) {\n const savedCursor = hydrationCursor\n\n hydrationCursor = current.firstChild\n\n for (const child of fnode.children) {\n hydrateNode(child, current as HTMLElement)\n }\n\n hydrationCursor = savedCursor\n }\n\n return current\n}\n\nfunction hydrateComponent(fnode: FNode, parent: HTMLElement): Node | Node[] | null {\n const Component = fnode.type as Function\n\n // Merge props\n const props = { ...fnode.props }\n if (fnode.children && fnode.children.length > 0) {\n props.children = fnode.children.length === 1\n ? fnode.children[0]\n : fnode.children\n }\n\n // Handle context providers\n const contextId = (Component as any)._contextId\n const isProvider = contextId !== undefined\n let prevContextValue: any\n\n if (isProvider) {\n prevContextValue = pushContext(contextId, props.value)\n }\n\n // Generate key (same logic as render.ts)\n if (!hydratedInstanceRegistry.has(parent)) {\n hydratedInstanceRegistry.set(parent, new Map())\n }\n const parentRegistry = hydratedInstanceRegistry.get(parent)!\n\n const hasExplicitKey = fnode.key !== undefined\n let key: any\n if (hasExplicitKey) {\n key = fnode.key\n } else {\n let instanceCount = 0\n const componentName = (Component as any).name || 'anonymous'\n parentRegistry.forEach((_, k) => {\n if (typeof k === 'string' && k.startsWith(`__auto_${componentName}_`)) {\n instanceCount++\n }\n })\n key = `__auto_${componentName}_${instanceCount}`\n }\n\n // Create component instance\n const instance: DOMComponentInstance = {\n hooks: [],\n hookIndex: 0,\n nodes: [],\n parent,\n fnode,\n props,\n key,\n children: new Set(),\n parentInstance: currentHydratingInstance || undefined\n }\n\n if (currentHydratingInstance) {\n currentHydratingInstance.children.add(instance)\n }\n\n parentRegistry.set(key, instance)\n\n const previousHydratingInstance = currentHydratingInstance\n currentHydratingInstance = instance\n\n try {\n // First render during hydration - just match DOM\n const result = runWithComponent(instance, () => Component(props))\n const nodes = hydrateNode(result, parent)\n instance.nodes = nodes ? (Array.isArray(nodes) ? nodes : [nodes]) : []\n\n // Set up reactive re-rendering for future updates\n let isFirstRender = true\n const renderFn = () => {\n // Re-render with reconciliation (same logic as render.ts)\n const currentProps = instance.props\n\n // Always run the component to establish reactive tracking\n const result = runWithComponent(instance, () => Component(currentProps))\n\n if (isFirstRender) {\n isFirstRender = false\n return // Skip DOM manipulation on first render, already done during hydration\n }\n\n if (instance.nodes.length === 0) {\n const newNodes = renderNode(result, parent)\n instance.nodes = newNodes ? (Array.isArray(newNodes) ? newNodes : [newNodes]) : []\n return\n }\n\n const firstNode = instance.nodes[0]\n const nodeParent = firstNode.parentNode as HTMLElement\n\n if (!nodeParent) {\n return\n }\n\n const marker = document.createComment('flexium-marker')\n const lastNode = instance.nodes[instance.nodes.length - 1]\n if (lastNode.nextSibling) {\n nodeParent.insertBefore(marker, lastNode.nextSibling)\n } else {\n nodeParent.appendChild(marker)\n }\n\n instance.children.clear()\n\n const tempContainer = document.createElement('div')\n const newNodes = renderNode(result, tempContainer, nodeParent)\n const newNodesArray = newNodes ? (Array.isArray(newNodes) ? newNodes : [newNodes]) : []\n\n const reconciledNodes = reconcile(instance.nodes, newNodesArray, nodeParent, marker)\n\n nodeParent.removeChild(marker)\n\n instance.nodes = reconciledNodes\n }\n\n instance.renderFn = renderFn\n unsafeEffect(renderFn)\n\n return instance.nodes\n } finally {\n currentHydratingInstance = previousHydratingInstance\n\n if (isProvider) {\n popContext(contextId, prevContextValue)\n }\n }\n}\n","import { Context } from '../../core/context'\nimport { use } from '../../core/use'\nimport type { SuspenseContextValue } from './types'\n\nconst defaultValue: SuspenseContextValue = {\n register: () => {},\n hasBoundary: false\n}\n\nexport const SuspenseCtx = new Context<SuspenseContextValue>(defaultValue)\n\nexport function suspenseContext(): SuspenseContextValue {\n const [value] = use(SuspenseCtx)\n return value\n}\n","import { use } from '../../core/use'\nimport { hook } from '../../core/hook'\nimport { SuspenseCtx } from './suspenseContext'\nimport type { SuspenseProps, SuspenseContextValue } from './types'\nimport type { FNodeChild } from '../types'\n\n/**\n * Suspense component that shows fallback while children are loading\n *\n * @example\n * ```tsx\n * const Dashboard = lazy(() => import('./Dashboard'))\n *\n * function App() {\n * return (\n * <Suspense fallback={<div>Loading...</div>}>\n * <Dashboard />\n * </Suspense>\n * )\n * }\n * ```\n */\nexport function Suspense(props: SuspenseProps): FNodeChild {\n const { fallback, children } = props\n\n // Track pending promises using hook for mutable Set\n const pendingSet = hook(() => new Set<Promise<any>>())\n const [, setPendingCount] = use(0)\n const [showFallback, setShowFallback] = use(false)\n\n // Register function for lazy components\n const register = (promise: Promise<any>) => {\n if (!pendingSet.has(promise)) {\n // Add to pending set\n pendingSet.add(promise)\n setPendingCount(c => c + 1)\n setShowFallback(true)\n\n // Wait for resolution\n promise.finally(() => {\n pendingSet.delete(promise)\n setPendingCount(c => {\n const newCount = c - 1\n if (newCount === 0) {\n setShowFallback(false)\n }\n return newCount\n })\n })\n }\n }\n\n const contextValue: SuspenseContextValue = {\n register,\n hasBoundary: true\n }\n\n // Render fallback or children based on pending state\n const content = showFallback ? fallback : children\n\n // Wrap content with Suspense context provider\n return {\n type: SuspenseCtx.Provider,\n props: { value: contextValue },\n children: [content],\n key: undefined\n } as any\n}\n","import { use } from '../../core/use'\nimport { hook } from '../../core/hook'\nimport type { FNodeChild } from '../types'\nimport type { ErrorInfo, ErrorBoundaryProps } from './types'\n\n// Component name stack for error messages\nlet componentNameStack: string[] = []\n\nexport function pushComponentName(name: string): void {\n componentNameStack.push(name)\n}\n\nexport function popComponentName(): void {\n componentNameStack.pop()\n}\n\nexport function getComponentStack(): string {\n return componentNameStack\n .map(name => ` at ${name}`)\n .reverse()\n .join('\\n')\n}\n\n// Stack of error boundaries for nested error propagation\ninterface ErrorBoundaryInstance {\n handleError: (error: Error, phase: 'render' | 'effect' | 'event') => void\n}\n\nlet errorBoundaryStack: ErrorBoundaryInstance[] = []\n\nexport function pushErrorBoundary(instance: ErrorBoundaryInstance): void {\n errorBoundaryStack.push(instance)\n}\n\nexport function popErrorBoundary(): void {\n errorBoundaryStack.pop()\n}\n\nexport function getNearestErrorBoundary(): ErrorBoundaryInstance | null {\n return errorBoundaryStack[errorBoundaryStack.length - 1] || null\n}\n\n/**\n * ErrorBoundary component that catches errors in its children and displays fallback UI\n *\n * @example\n * ```tsx\n * <ErrorBoundary\n * fallback={(error, info) => <div>Error: {error.message}</div>}\n * onError={(error, info) => console.error(error)}\n * >\n * <App />\n * </ErrorBoundary>\n * ```\n */\nexport function ErrorBoundary(props: ErrorBoundaryProps): FNodeChild {\n const { fallback, onError, children, resetKey } = props\n\n // Error state\n const [errorState, setErrorState] = use<{\n error: Error | null\n info: ErrorInfo | null\n }>({ error: null, info: null })\n\n // Track reset key changes to clear error\n const prevResetKeyRef = hook(() => ({ current: resetKey }))\n\n if (resetKey !== prevResetKeyRef.current) {\n prevResetKeyRef.current = resetKey\n if (errorState.error !== null) {\n setErrorState({ error: null, info: null })\n }\n }\n\n // Error boundary instance\n const boundaryInstance: ErrorBoundaryInstance = {\n handleError: (error: Error, phase: 'render' | 'effect' | 'event') => {\n const info: ErrorInfo = {\n componentStack: getComponentStack(),\n phase\n }\n\n // Call error callback\n onError?.(error, info)\n\n // Update error state (triggers re-render with fallback)\n setErrorState({ error, info })\n }\n }\n\n // If we have an error, render fallback\n if (errorState.error) {\n if (typeof fallback === 'function') {\n return fallback(errorState.error, errorState.info!)\n }\n return fallback\n }\n\n // Push boundary onto stack for children to use\n pushErrorBoundary(boundaryInstance)\n\n try {\n // Return children - they will be rendered with this boundary active\n return children\n } finally {\n popErrorBoundary()\n }\n}\n","import { suspenseContext } from './suspenseContext'\nimport type { FNodeChild } from '../types'\nimport type { LazyComponent } from './types'\n\n/**\n * Creates a lazy-loaded component for code splitting\n *\n * @example\n * ```tsx\n * const Dashboard = lazy(() => import('./Dashboard'))\n * const Settings = lazy(() => import('./Settings'))\n *\n * function App() {\n * return (\n * <Suspense fallback={<div>Loading...</div>}>\n * <Dashboard />\n * </Suspense>\n * )\n * }\n * ```\n */\nexport function lazy<P = {}>(\n loader: () => Promise<{ default: (props: P) => FNodeChild }>\n): LazyComponent<P> {\n // Shared state across all instances\n let resolved: ((props: P) => FNodeChild) | null = null\n let promise: Promise<any> | null = null\n let error: Error | null = null\n\n // The wrapper component\n const LazyWrapper = (props: P): FNodeChild => {\n // If already resolved, render immediately\n if (resolved) {\n return resolved(props)\n }\n\n // If error occurred, throw it (will be caught by ErrorBoundary)\n if (error) {\n throw error\n }\n\n // Get suspense context\n const suspense = suspenseContext()\n\n // Start loading if not already\n if (!promise) {\n promise = loader()\n .then(module => {\n resolved = module.default\n })\n .catch(err => {\n error = err instanceof Error ? err : new Error(String(err))\n })\n }\n\n // Register with suspense boundary if available\n if (suspense.hasBoundary) {\n suspense.register(promise)\n }\n\n // Return null - Suspense will show fallback\n return null\n }\n\n // Mark as lazy component\n ;(LazyWrapper as LazyComponent<P>)._lazy = true\n ;(LazyWrapper as LazyComponent<P>)._loader = loader\n\n return LazyWrapper as LazyComponent<P>\n}\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {b,c}from'./chunk-MEJO2RIK.mjs';import {c as c$1}from'./chunk-FJNIW7B2.mjs';import {b as b$1}from'./chunk-NRPWBHKP.mjs';import {f,h as h$1,a,i,b as b$2}from'./chunk-TIUNOZRI.mjs';function Q(e,n,...t){return {type:e,props:n||{},children:t,key:n?.key}}var p=null,w=new WeakMap,h=null;function U(e,n,t={}){let{state:o,onHydrated:r,onMismatch:a}=t;p=n.firstChild;try{let i;typeof e=="function"&&!$(e)?i={type:e,props:{},children:[],key:void 0}:i=e,v(i,n),r?.();}catch(i){a?.(i),n.innerHTML="",import('./render-EA3YGOX2.mjs').then(({render:l})=>{l(e,n);});}finally{p=null;}}function $(e){return e&&typeof e=="object"&&"type"in e&&"props"in e}function v(e,n){if(e==null||typeof e=="boolean")return P(),null;if(typeof e=="string"||typeof e=="number")return Y(String(e));if(Array.isArray(e)){let t=[];for(let o of e){let r=v(o,n);r&&(Array.isArray(r)?t.push(...r):t.push(r));}return t}if(typeof e=="function")return V({type:e,props:{},children:[],key:void 0},n);if(typeof e=="object"&&$(e)){if(typeof e.type=="string")return Z(e);if(typeof e.type=="function")return V(e,n)}return null}function P(){for(;p&&p.nodeType===Node.TEXT_NODE&&(!p.textContent||p.textContent.trim()==="");)p=p.nextSibling;}function Y(e){P();let n=p;if(!n)return null;if(n.nodeType!==Node.TEXT_NODE){if(e.trim()==="")return null;throw new Error(`Hydration mismatch: expected text node "${e}", got ${n.nodeName}`)}return p=n.nextSibling,n}function Z(e){P();let n=p,t=e.type;if(!n||n.nodeType!==Node.ELEMENT_NODE)throw new Error(`Hydration mismatch: expected element <${t}>, got ${n?.nodeName||"nothing"}`);if(n.tagName.toLowerCase()!==t.toLowerCase())throw new Error(`Hydration mismatch: expected <${t}>, got <${n.tagName.toLowerCase()}>`);if(e.props){for(let[o,r]of Object.entries(e.props))if(o==="ref")typeof r=="function"?r(n):r&&typeof r=="object"&&"current"in r&&(r.current=n);else if(o.startsWith("on")&&typeof r=="function"){let a=o.slice(2).toLowerCase();n.addEventListener(a,r),n.__eventHandlers||(n.__eventHandlers={}),n.__eventHandlers[a]=r;}}if(p=n.nextSibling,e.children&&e.children.length>0){let o=p;p=n.firstChild;for(let r of e.children)v(r,n);p=o;}return n}function V(e,n){let t=e.type,o={...e.props};e.children&&e.children.length>0&&(o.children=e.children.length===1?e.children[0]:e.children);let r=t._contextId,a$1=r!==void 0,i$1;a$1&&(i$1=h$1(r,o.value)),w.has(n)||w.set(n,new Map);let l=w.get(n),C=e.key!==void 0,u;if(C)u=e.key;else {let c=0,y=t.name||"anonymous";l.forEach((F,x)=>{typeof x=="string"&&x.startsWith(`__auto_${y}_`)&&c++;}),u=`__auto_${y}_${c}`;}let s={hooks:[],hookIndex:0,nodes:[],parent:n,fnode:e,props:o,key:u,children:new Set,parentInstance:h||void 0};h&&h.children.add(s),l.set(u,s);let d=h;h=s;try{let c$1=a(s,()=>t(o)),y=v(c$1,n);s.nodes=y?Array.isArray(y)?y:[y]:[];let F=!0,x=()=>{let X=s.props,B=a(s,()=>t(X));if(F){F=!1;return}if(s.nodes.length===0){let g=b(B,n);s.nodes=g?Array.isArray(g)?g:[g]:[];return}let m=s.nodes[0].parentNode;if(!m)return;let E=document.createComment("flexium-marker"),L=s.nodes[s.nodes.length-1];L.nextSibling?m.insertBefore(E,L.nextSibling):m.appendChild(E),s.children.clear();let q=document.createElement("div"),N=b(B,q,m),G=N?Array.isArray(N)?N:[N]:[],J=c(s.nodes,G,m,E);m.removeChild(E),s.nodes=J;};return s.renderFn=x,b$1(x),s.nodes}finally{h=d,a$1&&i(r,i$1);}}var ee={register:()=>{},hasBoundary:false},H=new f(ee);function D(){let[e]=c$1(H);return e}function R(e){let{fallback:n,children:t}=e,o=b$2(()=>new Set),[,r]=c$1(0),[a,i]=c$1(false),C={register:s=>{o.has(s)||(o.add(s),r(d=>d+1),i(true),s.finally(()=>{o.delete(s),r(d=>{let c=d-1;return c===0&&i(false),c});}));},hasBoundary:true},u=a?n:t;return {type:H.Provider,props:{value:C},children:[u],key:void 0}}function W(e){let{fallback:n,onError:t,children:o,resetKey:r}=e,[a,i]=c$1({error:null,info:null}),l=b$2(()=>({current:r}));r!==l.current&&(l.current=r,a.error!==null&&i({error:null,info:null}));if(a.error)return typeof n=="function"?n(a.error,a.info):n;try{return o}finally{}}function K(e){let n=null,t=null,o=null,r=a=>{if(n)return n(a);if(o)throw o;let i=D();return t||(t=e().then(l=>{n=l.default;}).catch(l=>{o=l instanceof Error?l:new Error(String(l));})),i.hasBoundary&&i.register(t),null};return r._lazy=true,r._loader=e,r}export{Q as a,U as b,R as c,W as d,K as e};//# sourceMappingURL=chunk-GHXGQFTP.mjs.map
|
|
2
|
+
//# sourceMappingURL=chunk-GHXGQFTP.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/dom/f.ts","../src/dom/hydrate.ts","../src/dom/components/suspenseContext.ts","../src/dom/components/Suspense.tsx","../src/dom/components/ErrorBoundary.tsx","../src/dom/components/lazy.ts"],"names":["f","type","props","children","hydrationCursor","hydratedInstanceRegistry","currentHydratingInstance","hydrate","app","container","options","state","onHydrated","onMismatch","fnode","isFNode","hydrateNode","error","render","value","parent","skipEmptyTextNodes","hydrateTextNode","nodes","child","result","hydrateComponent","hydrateElement","text","current","tag","key","eventName","savedCursor","Component","contextId","isProvider","prevContextValue","pushContext","parentRegistry","hasExplicitKey","instanceCount","componentName","_","k","instance","previousHydratingInstance","runWithComponent","isFirstRender","renderFn","currentProps","newNodes","renderNode","nodeParent","marker","lastNode","tempContainer","newNodesArray","reconciledNodes","reconcile","unsafeEffect","popContext","defaultValue","SuspenseCtx","Context","suspenseContext","use","Suspense","fallback","pendingSet","hook","setPendingCount","showFallback","setShowFallback","contextValue","promise","c","newCount","content","ErrorBoundary","onError","resetKey","errorState","setErrorState","prevResetKeyRef","lazy","loader","resolved","LazyWrapper","suspense","module","err"],"mappings":"0LAKO,SAASA,CAAAA,CACZC,CAAAA,CACAC,CAAAA,CAAAA,GACGC,CAAAA,CACE,CACL,OAAO,CACH,IAAA,CAAAF,CAAAA,CACA,KAAA,CAAOC,CAAAA,EAAS,GAChB,QAAA,CAAAC,CAAAA,CACA,GAAA,CAAKD,CAAAA,EAAO,GAChB,CACJ,CCRA,IACIE,CAAAA,CAA+B,IAAA,CAkC7BC,EAA2B,IAAI,OAAA,CACjCC,CAAAA,CAAwD,KAarD,SAASC,CAAAA,CACdC,CAAAA,CACAC,CAAAA,CACAC,CAAAA,CAA0B,EAAC,CACrB,CACN,GAAM,CAAE,MAAAC,CAAAA,CAAO,UAAA,CAAAC,CAAAA,CAAY,UAAA,CAAAC,CAAW,CAAA,CAAIH,CAAAA,CAO1CN,CAAAA,CAAkBK,CAAAA,CAAU,WAE5B,GAAI,CAEF,IAAIK,CAAAA,CACA,OAAON,CAAAA,EAAQ,YAAc,CAACO,CAAAA,CAAQP,CAAG,CAAA,CAC3CM,CAAAA,CAAQ,CAAE,KAAMN,CAAAA,CAAK,KAAA,CAAO,EAAC,CAAG,QAAA,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AASkF,EACdC,CAAAA,CACkB,CAElB,IAAIC,CAAAA,CAA8C,IAAA,CAC9CZ,CAAAA,CAA+B,KAC/B1D,CAAAA,CAAsB,IAAA,CAGpBuE,EAAetF,CAAAA,EAAyB,CAE5C,GAAIqF,CAAAA,CACF,OAAOA,CAAAA,CAASrF,CAAK,CAAA,CAIvB,GAAIe,EACF,MAAMA,CAAAA,CAIR,IAAMwE,CAAAA,CAAWxB,CAAAA,GAGjB,OAAKU,CAAAA,GACHA,CAAAA,CAAUW,CAAAA,EAAO,CACd,IAAA,CAAKI,GAAU,CACdH,CAAAA,CAAWG,EAAO,QACpB,CAAC,EACA,KAAA,CAAMC,CAAAA,EAAO,CACZ1E,CAAAA,CAAQ0E,CAAAA,YAAe,KAAA,CAAQA,EAAM,IAAI,KAAA,CAAM,OAAOA,CAAG,CAAC,EAC5D,CAAC,CAAA,CAAA,CAIDF,CAAAA,CAAS,WAAA,EACXA,CAAAA,CAAS,QAAA,CAASd,CAAO,CAAA,CAIpB,IACT,EAGC,OAACa,CAAAA,CAAiC,MAAQ,IAAA,CACzCA,CAAAA,CAAiC,OAAA,CAAUF,CAAAA,CAEtCE,CACT","file":"chunk-GHXGQFTP.mjs","sourcesContent":["import type { FNode } from './types'\n\n/**\n * f() - Create FNodes without JSX\n */\nexport function f(\n type: string | Function,\n props?: any,\n ...children: any[]\n): FNode {\n return {\n type,\n props: props || {},\n children,\n key: props?.key\n }\n}\n","import type { FNode, FNodeChild } from './types'\nimport type { SerializedState } from '../server/types'\nimport { runWithComponent, type ComponentInstance } from '../core/hook'\nimport { pushContext, popContext } from '../core/context'\nimport { unsafeEffect } from '../core/lifecycle'\nimport { renderNode, reconcile } from './render'\n\n// Hydration state\nlet isHydrating = false\nlet hydrationCursor: Node | null = null\nlet hydrationState: SerializedState | null = null\n\nexport interface HydrateOptions {\n /**\n * Serialized state from server\n * Typically embedded in HTML as JSON script tag\n */\n state?: SerializedState\n\n /**\n * Called when hydration completes successfully\n */\n onHydrated?: () => void\n\n /**\n * Called when hydration fails (falls back to full render)\n */\n onMismatch?: (error: Error) => void\n}\n\n// Extended ComponentInstance for DOM tracking (same as render.ts)\ninterface DOMComponentInstance extends ComponentInstance {\n nodes: Node[]\n parent: HTMLElement\n fnode: any\n props: any\n key?: any\n renderFn?: () => void\n children: Set<DOMComponentInstance>\n parentInstance?: DOMComponentInstance\n}\n\n// Registry for hydrated components\nconst hydratedInstanceRegistry = new WeakMap<HTMLElement, Map<any, DOMComponentInstance>>()\nlet currentHydratingInstance: DOMComponentInstance | null = null\n\nexport function getIsHydrating(): boolean {\n return isHydrating\n}\n\nexport function getHydrationState(): SerializedState | null {\n return hydrationState\n}\n\n/**\n * Hydrate server-rendered HTML with client-side interactivity\n */\nexport function hydrate(\n app: FNodeChild | (() => FNodeChild),\n container: HTMLElement,\n options: HydrateOptions = {}\n): void {\n const { state, onHydrated, onMismatch } = options\n\n // Store state for rehydration\n hydrationState = state || null\n\n // Initialize hydration mode\n isHydrating = true\n hydrationCursor = container.firstChild\n\n try {\n // Normalize input\n let fnode: FNodeChild\n if (typeof app === 'function' && !isFNode(app)) {\n fnode = { type: app, props: {}, children: [], key: undefined }\n } else {\n fnode = app\n }\n\n // Hydrate the tree\n hydrateNode(fnode, container)\n\n onHydrated?.()\n } catch (error) {\n // Hydration mismatch - fall back to full render\n onMismatch?.(error as Error)\n\n // Clear and re-render\n container.innerHTML = ''\n // Import dynamically to avoid circular deps\n import('./render').then(({ render }) => {\n render(app, container)\n })\n } finally {\n isHydrating = false\n hydrationCursor = null\n hydrationState = null\n }\n}\n\nfunction isFNode(value: any): value is FNode {\n return value && typeof value === 'object' && 'type' in value && 'props' in value\n}\n\nfunction hydrateNode(fnode: FNodeChild, parent: HTMLElement): Node | Node[] | null {\n // Null/undefined/boolean -> skip empty text nodes\n if (fnode === null || fnode === undefined || typeof fnode === 'boolean') {\n // Server might have rendered an empty text node\n skipEmptyTextNodes()\n return null\n }\n\n // String/number -> expect text node\n if (typeof fnode === 'string' || typeof fnode === 'number') {\n return hydrateTextNode(String(fnode))\n }\n\n // Array -> hydrate each child\n if (Array.isArray(fnode)) {\n const nodes: Node[] = []\n for (const child of fnode) {\n const result = hydrateNode(child, parent)\n if (result) {\n if (Array.isArray(result)) {\n nodes.push(...result)\n } else {\n nodes.push(result)\n }\n }\n }\n return nodes\n }\n\n // Function (standalone) -> wrap in FNode and hydrate\n if (typeof fnode === 'function') {\n const wrappedFnode: FNode = { type: fnode, props: {}, children: [], key: undefined }\n return hydrateComponent(wrappedFnode, parent)\n }\n\n // Object (FNode)\n if (typeof fnode === 'object' && isFNode(fnode)) {\n if (typeof fnode.type === 'string') {\n return hydrateElement(fnode)\n }\n\n if (typeof fnode.type === 'function') {\n return hydrateComponent(fnode, parent)\n }\n }\n\n return null\n}\n\nfunction skipEmptyTextNodes(): void {\n while (\n hydrationCursor &&\n hydrationCursor.nodeType === Node.TEXT_NODE &&\n (!hydrationCursor.textContent || hydrationCursor.textContent.trim() === '')\n ) {\n hydrationCursor = hydrationCursor.nextSibling\n }\n}\n\nfunction hydrateTextNode(text: string): Node | null {\n skipEmptyTextNodes()\n\n const current = hydrationCursor\n\n if (!current) {\n // No node to hydrate - this is okay for conditional rendering\n return null\n }\n\n if (current.nodeType !== Node.TEXT_NODE) {\n // Try to find a text node nearby (whitespace handling)\n if (text.trim() === '') {\n return null\n }\n throw new Error(`Hydration mismatch: expected text node \"${text}\", got ${current.nodeName}`)\n }\n\n // Update cursor\n hydrationCursor = current.nextSibling\n\n return current\n}\n\nfunction hydrateElement(fnode: FNode): Node {\n skipEmptyTextNodes()\n\n const current = hydrationCursor as Element\n const tag = fnode.type as string\n\n // Validate element type\n if (!current || current.nodeType !== Node.ELEMENT_NODE) {\n throw new Error(`Hydration mismatch: expected element <${tag}>, got ${current?.nodeName || 'nothing'}`)\n }\n\n if (current.tagName.toLowerCase() !== tag.toLowerCase()) {\n throw new Error(`Hydration mismatch: expected <${tag}>, got <${current.tagName.toLowerCase()}>`)\n }\n\n // Attach event handlers and refs (don't modify DOM structure)\n if (fnode.props) {\n for (const [key, value] of Object.entries(fnode.props)) {\n if (key === 'ref') {\n if (typeof value === 'function') {\n value(current)\n } else if (value && typeof value === 'object' && 'current' in value) {\n value.current = current\n }\n } else if (key.startsWith('on') && typeof value === 'function') {\n const eventName = key.slice(2).toLowerCase()\n current.addEventListener(eventName, value as EventListener)\n\n // Store for reconciliation\n if (!(current as any).__eventHandlers) {\n (current as any).__eventHandlers = {}\n }\n (current as any).__eventHandlers[eventName] = value\n }\n }\n }\n\n // Move cursor past this element\n hydrationCursor = current.nextSibling\n\n // Hydrate children\n if (fnode.children && fnode.children.length > 0) {\n const savedCursor = hydrationCursor\n\n hydrationCursor = current.firstChild\n\n for (const child of fnode.children) {\n hydrateNode(child, current as HTMLElement)\n }\n\n hydrationCursor = savedCursor\n }\n\n return current\n}\n\nfunction hydrateComponent(fnode: FNode, parent: HTMLElement): Node | Node[] | null {\n const Component = fnode.type as Function\n\n // Merge props\n const props = { ...fnode.props }\n if (fnode.children && fnode.children.length > 0) {\n props.children = fnode.children.length === 1\n ? fnode.children[0]\n : fnode.children\n }\n\n // Handle context providers\n const contextId = (Component as any)._contextId\n const isProvider = contextId !== undefined\n let prevContextValue: any\n\n if (isProvider) {\n prevContextValue = pushContext(contextId, props.value)\n }\n\n // Generate key (same logic as render.ts)\n if (!hydratedInstanceRegistry.has(parent)) {\n hydratedInstanceRegistry.set(parent, new Map())\n }\n const parentRegistry = hydratedInstanceRegistry.get(parent)!\n\n const hasExplicitKey = fnode.key !== undefined\n let key: any\n if (hasExplicitKey) {\n key = fnode.key\n } else {\n let instanceCount = 0\n const componentName = (Component as any).name || 'anonymous'\n parentRegistry.forEach((_, k) => {\n if (typeof k === 'string' && k.startsWith(`__auto_${componentName}_`)) {\n instanceCount++\n }\n })\n key = `__auto_${componentName}_${instanceCount}`\n }\n\n // Create component instance\n const instance: DOMComponentInstance = {\n hooks: [],\n hookIndex: 0,\n nodes: [],\n parent,\n fnode,\n props,\n key,\n children: new Set(),\n parentInstance: currentHydratingInstance || undefined\n }\n\n if (currentHydratingInstance) {\n currentHydratingInstance.children.add(instance)\n }\n\n parentRegistry.set(key, instance)\n\n const previousHydratingInstance = currentHydratingInstance\n currentHydratingInstance = instance\n\n try {\n // First render during hydration - just match DOM\n const result = runWithComponent(instance, () => Component(props))\n const nodes = hydrateNode(result, parent)\n instance.nodes = nodes ? (Array.isArray(nodes) ? nodes : [nodes]) : []\n\n // Set up reactive re-rendering for future updates\n let isFirstRender = true\n const renderFn = () => {\n // Re-render with reconciliation (same logic as render.ts)\n const currentProps = instance.props\n\n // Always run the component to establish reactive tracking\n const result = runWithComponent(instance, () => Component(currentProps))\n\n if (isFirstRender) {\n isFirstRender = false\n return // Skip DOM manipulation on first render, already done during hydration\n }\n\n if (instance.nodes.length === 0) {\n const newNodes = renderNode(result, parent)\n instance.nodes = newNodes ? (Array.isArray(newNodes) ? newNodes : [newNodes]) : []\n return\n }\n\n const firstNode = instance.nodes[0]\n const nodeParent = firstNode.parentNode as HTMLElement\n\n if (!nodeParent) {\n return\n }\n\n const marker = document.createComment('flexium-marker')\n const lastNode = instance.nodes[instance.nodes.length - 1]\n if (lastNode.nextSibling) {\n nodeParent.insertBefore(marker, lastNode.nextSibling)\n } else {\n nodeParent.appendChild(marker)\n }\n\n instance.children.clear()\n\n const tempContainer = document.createElement('div')\n const newNodes = renderNode(result, tempContainer, nodeParent)\n const newNodesArray = newNodes ? (Array.isArray(newNodes) ? newNodes : [newNodes]) : []\n\n const reconciledNodes = reconcile(instance.nodes, newNodesArray, nodeParent, marker)\n\n nodeParent.removeChild(marker)\n\n instance.nodes = reconciledNodes\n }\n\n instance.renderFn = renderFn\n unsafeEffect(renderFn)\n\n return instance.nodes\n } finally {\n currentHydratingInstance = previousHydratingInstance\n\n if (isProvider) {\n popContext(contextId, prevContextValue)\n }\n }\n}\n","import { Context } from '../../core/context'\nimport { use } from '../../core/use'\nimport type { SuspenseContextValue } from './types'\n\nconst defaultValue: SuspenseContextValue = {\n register: () => {},\n hasBoundary: false\n}\n\nexport const SuspenseCtx = new Context<SuspenseContextValue>(defaultValue)\n\nexport function suspenseContext(): SuspenseContextValue {\n const [value] = use(SuspenseCtx)\n return value\n}\n","import { use } from '../../core/use'\nimport { hook } from '../../core/hook'\nimport { SuspenseCtx } from './suspenseContext'\nimport type { SuspenseProps, SuspenseContextValue } from './types'\nimport type { FNodeChild } from '../types'\n\n/**\n * Suspense component that shows fallback while children are loading\n *\n * @example\n * ```tsx\n * const Dashboard = lazy(() => import('./Dashboard'))\n *\n * function App() {\n * return (\n * <Suspense fallback={<div>Loading...</div>}>\n * <Dashboard />\n * </Suspense>\n * )\n * }\n * ```\n */\nexport function Suspense(props: SuspenseProps): FNodeChild {\n const { fallback, children } = props\n\n // Track pending promises using hook for mutable Set\n const pendingSet = hook(() => new Set<Promise<any>>())\n const [, setPendingCount] = use(0)\n const [showFallback, setShowFallback] = use(false)\n\n // Register function for lazy components\n const register = (promise: Promise<any>) => {\n if (!pendingSet.has(promise)) {\n // Add to pending set\n pendingSet.add(promise)\n setPendingCount(c => c + 1)\n setShowFallback(true)\n\n // Wait for resolution\n promise.finally(() => {\n pendingSet.delete(promise)\n setPendingCount(c => {\n const newCount = c - 1\n if (newCount === 0) {\n setShowFallback(false)\n }\n return newCount\n })\n })\n }\n }\n\n const contextValue: SuspenseContextValue = {\n register,\n hasBoundary: true\n }\n\n // Render fallback or children based on pending state\n const content = showFallback ? fallback : children\n\n // Wrap content with Suspense context provider\n return {\n type: SuspenseCtx.Provider,\n props: { value: contextValue },\n children: [content],\n key: undefined\n } as any\n}\n","import { use } from '../../core/use'\nimport { hook } from '../../core/hook'\nimport type { FNodeChild } from '../types'\nimport type { ErrorInfo, ErrorBoundaryProps } from './types'\n\n// Component name stack for error messages\nlet componentNameStack: string[] = []\n\nexport function pushComponentName(name: string): void {\n componentNameStack.push(name)\n}\n\nexport function popComponentName(): void {\n componentNameStack.pop()\n}\n\nexport function getComponentStack(): string {\n return componentNameStack\n .map(name => ` at ${name}`)\n .reverse()\n .join('\\n')\n}\n\n// Stack of error boundaries for nested error propagation\ninterface ErrorBoundaryInstance {\n handleError: (error: Error, phase: 'render' | 'effect' | 'event') => void\n}\n\nlet errorBoundaryStack: ErrorBoundaryInstance[] = []\n\nexport function pushErrorBoundary(instance: ErrorBoundaryInstance): void {\n errorBoundaryStack.push(instance)\n}\n\nexport function popErrorBoundary(): void {\n errorBoundaryStack.pop()\n}\n\nexport function getNearestErrorBoundary(): ErrorBoundaryInstance | null {\n return errorBoundaryStack[errorBoundaryStack.length - 1] || null\n}\n\n/**\n * ErrorBoundary component that catches errors in its children and displays fallback UI\n *\n * @example\n * ```tsx\n * <ErrorBoundary\n * fallback={(error, info) => <div>Error: {error.message}</div>}\n * onError={(error, info) => console.error(error)}\n * >\n * <App />\n * </ErrorBoundary>\n * ```\n */\nexport function ErrorBoundary(props: ErrorBoundaryProps): FNodeChild {\n const { fallback, onError, children, resetKey } = props\n\n // Error state\n const [errorState, setErrorState] = use<{\n error: Error | null\n info: ErrorInfo | null\n }>({ error: null, info: null })\n\n // Track reset key changes to clear error\n const prevResetKeyRef = hook(() => ({ current: resetKey }))\n\n if (resetKey !== prevResetKeyRef.current) {\n prevResetKeyRef.current = resetKey\n if (errorState.error !== null) {\n setErrorState({ error: null, info: null })\n }\n }\n\n // Error boundary instance\n const boundaryInstance: ErrorBoundaryInstance = {\n handleError: (error: Error, phase: 'render' | 'effect' | 'event') => {\n const info: ErrorInfo = {\n componentStack: getComponentStack(),\n phase\n }\n\n // Call error callback\n onError?.(error, info)\n\n // Update error state (triggers re-render with fallback)\n setErrorState({ error, info })\n }\n }\n\n // If we have an error, render fallback\n if (errorState.error) {\n if (typeof fallback === 'function') {\n return fallback(errorState.error, errorState.info!)\n }\n return fallback\n }\n\n // Push boundary onto stack for children to use\n pushErrorBoundary(boundaryInstance)\n\n try {\n // Return children - they will be rendered with this boundary active\n return children\n } finally {\n popErrorBoundary()\n }\n}\n","import { suspenseContext } from './suspenseContext'\nimport type { FNodeChild } from '../types'\nimport type { LazyComponent } from './types'\n\n/**\n * Creates a lazy-loaded component for code splitting\n *\n * @example\n * ```tsx\n * const Dashboard = lazy(() => import('./Dashboard'))\n * const Settings = lazy(() => import('./Settings'))\n *\n * function App() {\n * return (\n * <Suspense fallback={<div>Loading...</div>}>\n * <Dashboard />\n * </Suspense>\n * )\n * }\n * ```\n */\nexport function lazy<P = {}>(\n loader: () => Promise<{ default: (props: P) => FNodeChild }>\n): LazyComponent<P> {\n // Shared state across all instances\n let resolved: ((props: P) => FNodeChild) | null = null\n let promise: Promise<any> | null = null\n let error: Error | null = null\n\n // The wrapper component\n const LazyWrapper = (props: P): FNodeChild => {\n // If already resolved, render immediately\n if (resolved) {\n return resolved(props)\n }\n\n // If error occurred, throw it (will be caught by ErrorBoundary)\n if (error) {\n throw error\n }\n\n // Get suspense context\n const suspense = suspenseContext()\n\n // Start loading if not already\n if (!promise) {\n promise = loader()\n .then(module => {\n resolved = module.default\n })\n .catch(err => {\n error = err instanceof Error ? err : new Error(String(err))\n })\n }\n\n // Register with suspense boundary if available\n if (suspense.hasBoundary) {\n suspense.register(promise)\n }\n\n // Return null - Suspense will show fallback\n return null\n }\n\n // Mark as lazy component\n ;(LazyWrapper as LazyComponent<P>)._lazy = true\n ;(LazyWrapper as LazyComponent<P>)._loader = loader\n\n return LazyWrapper as LazyComponent<P>\n}\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var chunk3CKIHQIE_js=require('./chunk-3CKIHQIE.js'),chunkOU6XJZ76_js=require('./chunk-OU6XJZ76.js');var d=new WeakMap,l=null;function K(){l=null;}function I(e){e.children.forEach(n=>{I(n);}),e.nodes.forEach(n=>{n.parentNode&&n.parentNode.removeChild(n);}),e.children.clear(),e.parentInstance&&e.parentInstance.children.delete(e);}function S(e,n,i){let c=i||n,r=f=>{let p={...f.props};return f.children&&f.children.length>0&&(p.children=f.children.length===1?f.children[0]:f.children),p},a=e.key!==void 0;d.has(c)||d.set(c,new Map);let t=d.get(c),o;if(a)o=e.key;else {let f=0,p=e.type.name||"anonymous";t.forEach((b,g)=>{typeof g=="string"&&g.startsWith(`__auto_${p}_`)&&f++;}),o=`__auto_${p}_${f}`;}if(t.has(o)){let f=t.get(o);f.fnode=e;let p=r(e);return f.props=p,f.children.clear(),f.renderFn&&f.renderFn(),f.nodes}let s={hooks:[],hookIndex:0,nodes:[],parent:n,fnode:e,props:r(e),key:o,children:new Set,parentInstance:l||void 0};l&&l.children.add(s),t.set(o,s);let u=true,y=()=>{let f=s.fnode,p=s.props;f.type._contextId!==void 0&&chunkOU6XJZ76_js.h(f.type._contextId,p.value);let g=l;l=s;let C=chunkOU6XJZ76_js.a(s,()=>f.type(p));if(u){let _=h(C,n);s.nodes=_?Array.isArray(_)?_:[_]:[],s.nodes.forEach(m=>{m.__ownerInstance||(m.__ownerInstance=s);}),u=false;}else {if(s.nodes.length===0){let v=h(C,n);s.nodes=v?Array.isArray(v)?v:[v]:[],l=g;return}let m=s.nodes[0].parentNode;m||(m=s.parent);let M=document.createComment("flexium-marker"),L=s.nodes[s.nodes.length-1];L.nextSibling?m.insertBefore(M,L.nextSibling):m.appendChild(M),s.children.clear();let x=document.createElement("div"),T=h(C,x,m),O=T?Array.isArray(T)?T:[T]:[],R=P(s.nodes,O,m,M);m.removeChild(M),s.nodes=R;}l=g;};return s.renderFn=y,chunk3CKIHQIE_js.b(y),s.nodes}function h(e,n,i){let c=i||n;if(e==null||typeof e=="boolean"){let r=document.createTextNode("");return n.appendChild(r),r}if(typeof e=="string"||typeof e=="number"){let r=document.createTextNode(String(e));return n.appendChild(r),r}if(Array.isArray(e)){let r=new Set;d.has(c)&&d.get(c).forEach((s,u)=>r.add(u));let a=[];e.forEach(o=>{let s=h(o,n,i);s&&(Array.isArray(s)?a.push(...s):a.push(s));});let t=new Set;if(d.has(c)&&d.get(c).forEach((s,u)=>t.add(u)),d.has(c)){let o=d.get(c),s=[];r.forEach(u=>{if(!t.has(u)){let y=o.get(u);y&&(I(y),s.push(u));}}),s.forEach(u=>o.delete(u));}return a}if(typeof e=="object"){if(typeof e.type=="string"){let r=document.createElement(e.type);return e.props&&Object.entries(e.props).forEach(([a,t])=>{if(a==="ref")typeof t=="function"?t(r):t&&typeof t=="object"&&"current"in t&&(t.current=r);else if(a.startsWith("on")&&typeof t=="function"){let o=a.slice(2).toLowerCase();r.addEventListener(o,t),r.__eventHandlers||(r.__eventHandlers={}),r.__eventHandlers[o]=t;}else a!=="ref"&&D(r,a,t);}),e.children&&e.children.length>0&&e.children.forEach(a=>{h(a,r);}),n.appendChild(r),r}if(typeof e.type=="function")return S(e,n,i)}return null}function D(e,n,i){i==null?e.removeAttribute(n):n==="style"&&typeof i=="object"?Object.assign(e.style,i):n==="class"?e.className=String(i):n in e&&typeof e[n]!="function"?e[n]=i:e.setAttribute(n,String(i));}function j(e,n){return e.nodeType!==n.nodeType?false:e.nodeType===Node.ELEMENT_NODE&&n.nodeType===Node.ELEMENT_NODE?e.tagName===n.tagName:true}function k(e,n){Array.from(e.attributes).forEach(t=>{n.hasAttribute(t.name)||e.removeAttribute(t.name);}),Array.from(n.attributes).forEach(t=>{e.getAttribute(t.name)!==t.value&&(t.name==="value"&&"value"in e?e.value=t.value:t.name==="checked"&&"checked"in e?e.checked=t.value==="true"||t.value==="":e.setAttribute(t.name,t.value));});let r=e.__eventHandlers||{},a=n.__eventHandlers||{};Object.keys(r).forEach(t=>{a[t]||e.removeEventListener(t,r[t]);}),Object.keys(a).forEach(t=>{r[t]!==a[t]&&(r[t]&&e.removeEventListener(t,r[t]),e.addEventListener(t,a[t]));}),Object.keys(a).length>0?e.__eventHandlers=a:delete e.__eventHandlers,e instanceof HTMLInputElement&&n instanceof HTMLInputElement&&(e.value!==n.value&&(e.value=n.value),e.checked!==n.checked&&(e.checked=n.checked)),e instanceof HTMLTextAreaElement&&n instanceof HTMLTextAreaElement&&e.value!==n.value&&(e.value=n.value),e instanceof HTMLSelectElement&&n instanceof HTMLSelectElement&&e.value!==n.value&&(e.value=n.value);}function F(e,n){let i=Array.from(e.childNodes),c=Array.from(n.childNodes),r=Math.max(i.length,c.length);for(let a=0;a<r;a++){let t=i[a],o=c[a];!t&&o?e.appendChild(o):t&&!o?e.removeChild(t):t&&o&&N(t,o,e);}}function N(e,n,i){if(j(e,n)){let c=n.__ownerInstance;if(c){let r=c.nodes.indexOf(n);r!==-1&&(c.nodes[r]=e),e.__ownerInstance=c,delete n.__ownerInstance;}return e.nodeType===Node.TEXT_NODE?e.nodeValue!==n.nodeValue&&(e.nodeValue=n.nodeValue):e.nodeType===Node.ELEMENT_NODE&&(k(e,n),F(e,n)),e}else return e.parentNode===i?i.replaceChild(n,e):(e.parentNode&&e.parentNode.removeChild(e),i.insertBefore(n,null)),n}function P(e,n,i,c){let r=Math.max(e.length,n.length),a=[];for(let t=0;t<r;t++){let o=e[t],s=n[t];if(!o&&s)i.insertBefore(s,c),a.push(s);else if(o&&!s)o.parentNode&&i.removeChild(o);else if(o&&s){let u=N(o,s,i);a.push(u);}}return a}function $(e,n){return n.innerHTML="",typeof e=="function"&&(e={type:e,props:{},children:[],key:void 0}),h(e,n),()=>{if(d.has(n)){let i=d.get(n);i.forEach(c=>{I(c);}),i.clear(),d.delete(n);}n.innerHTML="";}}exports.a=K;exports.b=h;exports.c=P;exports.d=$;//# sourceMappingURL=chunk-GLMD343V.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-GLMD343V.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/dom/render.ts"],"names":["instanceRegistry","currentRenderingInstance","resetRender","removeComponentInstance","instance","child","node","renderComponent","fnode","parent","registryParent","effectiveRegistryParent","mergeProps","props","hasExplicitKey","parentRegistry","key","instanceCount","componentName","_","k","newProps","isFirstRender","renderFn","currentFnode","currentProps","pushContext","previousRenderingInstance","result","runWithComponent","newNodes","renderNode","nodeParent","marker","lastNode","tempContainer","newNodesArray","reconciledNodes","reconcile","unsafeEffect","oldKeysSet","nodes","newKeysSet","keysToRemove","dom","value","eventName","setAttribute","el","canReuse","oldNode","newNode","updateAttributes","oldEl","newEl","attr","oldHandlers","newHandlers","event","reconcileChildren","oldChildren","newChildren","maxLen","i","oldChild","newChild","patchNode","ownerInstance","idx","oldNodes","beforeMarker","resultNodes","resultNode","render","app","container","registry"],"mappings":"iHAiBA,IAAMA,EAAmB,IAAI,OAAA,CAGzBC,CAAAA,CAAwD,IAAA,CAGrD,SAASC,CAAAA,EAAoB,CAChCD,CAAAA,CAA2B,KAE/B,CAGA,SAASE,CAAAA,CAAwBC,CAAAA,CAAsC,CACnEA,EAAS,QAAA,CAAS,OAAA,CAAQC,CAAAA,EAAS,CAC/BF,EAAwBE,CAAK,EACjC,CAAC,CAAA,CAEDD,EAAS,KAAA,CAAM,OAAA,CAAQE,CAAAA,EAAQ,CACvBA,EAAK,UAAA,EACLA,CAAAA,CAAK,UAAA,CAAW,WAAA,CAAYA,CAAI,EAExC,CAAC,CAAA,CAEDF,CAAAA,CAAS,SAAS,KAAA,EAAM,CAEpBA,CAAAA,CAAS,cAAA,EACTA,EAAS,cAAA,CAAe,QAAA,CAAS,MAAA,CAAOA,CAAQ,EAExD,CAGA,SAASG,CAAAA,CAAgBC,CAAAA,CAAYC,EAAqBC,CAAAA,CAAsC,CAC5F,IAAMC,CAAAA,CAA0BD,GAAkBD,CAAAA,CAE5CG,CAAAA,CAAcN,CAAAA,EAAc,CAC9B,IAAMO,CAAAA,CAAQ,CAAE,GAAGP,CAAAA,CAAK,KAAM,CAAA,CAC9B,OAAIA,EAAK,QAAA,EAAYA,CAAAA,CAAK,SAAS,MAAA,CAAS,CAAA,GACxCO,CAAAA,CAAM,QAAA,CAAWP,EAAK,QAAA,CAAS,MAAA,GAAW,CAAA,CACpCA,CAAAA,CAAK,SAAS,CAAC,CAAA,CACfA,CAAAA,CAAK,QAAA,CAAA,CAERO,CACX,CAAA,CAEMC,CAAAA,CAAiBN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,GAAI,GAAA,CAAK,MAAU,CAAA,CAAA,CAG/D3C,CAAAA,CAAW2C,EAAKC,CAAS,CAAA,CAGlB,IAAM,CAET,GAAI3E,CAAAA,CAAiB,GAAA,CAAI2E,CAAS,CAAA,CAAG,CACjC,IAAMC,CAAAA,CAAW5E,CAAAA,CAAiB,GAAA,CAAI2E,CAAS,CAAA,CAC/CC,CAAAA,CAAS,OAAA,CAAQxE,CAAAA,EAAY,CACzBD,CAAAA,CAAwBC,CAAQ,EACpC,CAAC,EACDwE,CAAAA,CAAS,KAAA,EAAM,CACf5E,CAAAA,CAAiB,OAAO2E,CAAS,EACrC,CAEAA,CAAAA,CAAU,SAAA,CAAY,GAC1B,CACJ","file":"chunk-GLMD343V.js","sourcesContent":["import { pushContext } from '../core/context'\nimport { runWithComponent, type ComponentInstance } from '../core/hook'\nimport { unsafeEffect } from '../core/lifecycle'\n\n// Extended ComponentInstance for DOM tracking\ninterface DOMComponentInstance extends ComponentInstance {\n nodes: Node[]\n parent: HTMLElement\n fnode: any\n props: any\n key?: any\n renderFn?: () => void\n children: Set<DOMComponentInstance>\n parentInstance?: DOMComponentInstance\n}\n\n// Registry to store component instances by parent and key\nconst instanceRegistry = new WeakMap<HTMLElement, Map<any, DOMComponentInstance>>()\n\n// Current rendering component instance (for tracking parent-child relationships)\nlet currentRenderingInstance: DOMComponentInstance | null = null\n\n// Reset render state - call before re-rendering the entire app (e.g., srcdoc update)\nexport function resetRender(): void {\n currentRenderingInstance = null\n // Note: WeakMap will automatically GC old entries when their keys are gone\n}\n\n// Recursively remove component instance and all its children\nfunction removeComponentInstance(instance: DOMComponentInstance): void {\n instance.children.forEach(child => {\n removeComponentInstance(child)\n })\n\n instance.nodes.forEach(node => {\n if (node.parentNode) {\n node.parentNode.removeChild(node)\n }\n })\n\n instance.children.clear()\n\n if (instance.parentInstance) {\n instance.parentInstance.children.delete(instance)\n }\n}\n\n// Render a function component with reactive re-rendering\nfunction renderComponent(fnode: any, parent: HTMLElement, registryParent?: HTMLElement): Node[] {\n const effectiveRegistryParent = registryParent || parent\n\n const mergeProps = (node: any) => {\n const props = { ...node.props }\n if (node.children && node.children.length > 0) {\n props.children = node.children.length === 1\n ? node.children[0]\n : node.children\n }\n return props\n }\n\n const hasExplicitKey = fnode.key !== undefined\n\n if (!instanceRegistry.has(effectiveRegistryParent)) {\n instanceRegistry.set(effectiveRegistryParent, new Map())\n }\n const parentRegistry = instanceRegistry.get(effectiveRegistryParent)!\n\n let key: any\n if (hasExplicitKey) {\n key = fnode.key\n } else {\n let instanceCount = 0\n const componentName = fnode.type.name || 'anonymous'\n parentRegistry.forEach((_, k) => {\n if (typeof k === 'string' && k.startsWith(`__auto_${componentName}_`)) {\n instanceCount++\n }\n })\n key = `__auto_${componentName}_${instanceCount}`\n }\n\n if (parentRegistry.has(key)) {\n const instance = parentRegistry.get(key)!\n instance.fnode = fnode\n const newProps = mergeProps(fnode)\n instance.props = newProps\n instance.children.clear()\n\n if (instance.renderFn) {\n instance.renderFn()\n }\n\n return instance.nodes\n }\n\n const instance: DOMComponentInstance = {\n hooks: [],\n hookIndex: 0,\n nodes: [],\n parent,\n fnode: fnode,\n props: mergeProps(fnode),\n key,\n children: new Set(),\n parentInstance: currentRenderingInstance || undefined\n }\n\n if (currentRenderingInstance) {\n currentRenderingInstance.children.add(instance)\n }\n\n parentRegistry.set(key, instance)\n\n let isFirstRender = true\n\n const renderFn = () => {\n const currentFnode = instance.fnode\n const currentProps = instance.props\n\n const isProvider = (currentFnode.type as any)._contextId !== undefined\n if (isProvider) {\n pushContext((currentFnode.type as any)._contextId, currentProps.value)\n }\n\n const previousRenderingInstance = currentRenderingInstance\n currentRenderingInstance = instance\n\n const result = runWithComponent(instance, () => currentFnode.type(currentProps))\n\n if (isFirstRender) {\n const newNodes = renderNode(result, parent)\n instance.nodes = newNodes ? (Array.isArray(newNodes) ? newNodes : [newNodes]) : []\n instance.nodes.forEach(node => {\n if (!(node as any).__ownerInstance) {\n (node as any).__ownerInstance = instance\n }\n })\n isFirstRender = false\n } else {\n if (instance.nodes.length === 0) {\n const newNodes = renderNode(result, parent)\n instance.nodes = newNodes ? (Array.isArray(newNodes) ? newNodes : [newNodes]) : []\n currentRenderingInstance = previousRenderingInstance\n return\n }\n\n const firstNode = instance.nodes[0]\n let nodeParent = firstNode.parentNode as HTMLElement\n\n if (!nodeParent) {\n nodeParent = instance.parent\n }\n\n const marker = document.createComment('flexium-marker')\n const lastNode = instance.nodes[instance.nodes.length - 1]\n if (lastNode.nextSibling) {\n nodeParent.insertBefore(marker, lastNode.nextSibling)\n } else {\n nodeParent.appendChild(marker)\n }\n\n instance.children.clear()\n\n const tempContainer = document.createElement('div')\n const newNodes = renderNode(result, tempContainer, nodeParent)\n const newNodesArray = newNodes ? (Array.isArray(newNodes) ? newNodes : [newNodes]) : []\n\n const reconciledNodes = reconcile(instance.nodes, newNodesArray, nodeParent, marker)\n\n nodeParent.removeChild(marker)\n\n instance.nodes = reconciledNodes\n }\n\n currentRenderingInstance = previousRenderingInstance\n }\n\n instance.renderFn = renderFn\n\n unsafeEffect(renderFn)\n\n return instance.nodes\n}\n\nexport function renderNode(fnode: any, parent: HTMLElement, registryParent?: HTMLElement): Node | Node[] | null {\n const effectiveRegistryParent = registryParent || parent\n\n if (fnode === null || fnode === undefined || typeof fnode === 'boolean') {\n const node = document.createTextNode('')\n parent.appendChild(node)\n return node\n }\n\n if (typeof fnode === 'string' || typeof fnode === 'number') {\n const node = document.createTextNode(String(fnode))\n parent.appendChild(node)\n return node\n }\n\n if (Array.isArray(fnode)) {\n const oldKeysSet = new Set<any>()\n if (instanceRegistry.has(effectiveRegistryParent)) {\n const parentRegistry = instanceRegistry.get(effectiveRegistryParent)!\n parentRegistry.forEach((_, key) => oldKeysSet.add(key))\n }\n\n const nodes: Node[] = []\n fnode.forEach((child) => {\n const result = renderNode(child, parent, registryParent)\n if (result) {\n if (Array.isArray(result)) {\n nodes.push(...result)\n } else {\n nodes.push(result)\n }\n }\n })\n\n const newKeysSet = new Set<any>()\n if (instanceRegistry.has(effectiveRegistryParent)) {\n const parentRegistry = instanceRegistry.get(effectiveRegistryParent)!\n parentRegistry.forEach((_, key) => newKeysSet.add(key))\n }\n\n if (instanceRegistry.has(effectiveRegistryParent)) {\n const parentRegistry = instanceRegistry.get(effectiveRegistryParent)!\n const keysToRemove: any[] = []\n\n oldKeysSet.forEach(key => {\n if (!newKeysSet.has(key)) {\n const instance = parentRegistry.get(key)\n if (instance) {\n removeComponentInstance(instance)\n keysToRemove.push(key)\n }\n }\n })\n\n keysToRemove.forEach(key => parentRegistry.delete(key))\n }\n\n return nodes\n }\n\n if (typeof fnode === 'object') {\n if (typeof fnode.type === 'string') {\n const dom = document.createElement(fnode.type)\n\n if (fnode.props) {\n Object.entries(fnode.props).forEach(([key, value]) => {\n if (key === 'ref') {\n // Handle both callback refs and RefObject\n if (typeof value === 'function') {\n value(dom)\n } else if (value && typeof value === 'object' && 'current' in value) {\n value.current = dom\n }\n } else if (key.startsWith('on') && typeof value === 'function') {\n const eventName = key.slice(2).toLowerCase()\n dom.addEventListener(eventName, value as EventListener)\n\n if (!(dom as any).__eventHandlers) {\n (dom as any).__eventHandlers = {}\n }\n (dom as any).__eventHandlers[eventName] = value\n } else if (key !== 'ref') {\n setAttribute(dom, key, value)\n }\n })\n }\n\n if (fnode.children && fnode.children.length > 0) {\n fnode.children.forEach((child: any) => {\n renderNode(child, dom)\n })\n }\n\n parent.appendChild(dom)\n return dom\n }\n\n if (typeof fnode.type === 'function') {\n return renderComponent(fnode, parent, registryParent)\n }\n }\n\n return null\n}\n\nfunction setAttribute(el: Element, key: string, value: any) {\n if (value === null || value === undefined) {\n el.removeAttribute(key)\n } else if (key === 'style' && typeof value === 'object') {\n Object.assign((el as HTMLElement).style, value)\n } else if (key === 'class') {\n el.className = String(value)\n } else if (key in el && typeof (el as any)[key] !== 'function') {\n (el as any)[key] = value\n } else {\n el.setAttribute(key, String(value))\n }\n}\n\n// Reconciliation helpers\nfunction canReuse(oldNode: Node, newNode: Node): boolean {\n if (oldNode.nodeType !== newNode.nodeType) return false\n if (oldNode.nodeType === Node.ELEMENT_NODE && newNode.nodeType === Node.ELEMENT_NODE) {\n return (oldNode as Element).tagName === (newNode as Element).tagName\n }\n return true\n}\n\nfunction updateAttributes(oldEl: Element, newEl: Element): void {\n const oldAttrs = Array.from(oldEl.attributes)\n oldAttrs.forEach(attr => {\n if (!newEl.hasAttribute(attr.name)) {\n oldEl.removeAttribute(attr.name)\n }\n })\n\n const newAttrs = Array.from(newEl.attributes)\n newAttrs.forEach(attr => {\n if (oldEl.getAttribute(attr.name) !== attr.value) {\n if (attr.name === 'value' && 'value' in oldEl) {\n (oldEl as HTMLInputElement).value = attr.value\n } else if (attr.name === 'checked' && 'checked' in oldEl) {\n (oldEl as HTMLInputElement).checked = attr.value === 'true' || attr.value === ''\n } else {\n oldEl.setAttribute(attr.name, attr.value)\n }\n }\n })\n\n const oldHandlers = (oldEl as any).__eventHandlers || {}\n const newHandlers = (newEl as any).__eventHandlers || {}\n\n Object.keys(oldHandlers).forEach(event => {\n if (!newHandlers[event]) {\n oldEl.removeEventListener(event, oldHandlers[event])\n }\n })\n\n Object.keys(newHandlers).forEach(event => {\n if (oldHandlers[event] !== newHandlers[event]) {\n if (oldHandlers[event]) {\n oldEl.removeEventListener(event, oldHandlers[event])\n }\n oldEl.addEventListener(event, newHandlers[event])\n }\n })\n\n if (Object.keys(newHandlers).length > 0) {\n (oldEl as any).__eventHandlers = newHandlers\n } else {\n delete (oldEl as any).__eventHandlers\n }\n\n if (oldEl instanceof HTMLInputElement && newEl instanceof HTMLInputElement) {\n if (oldEl.value !== newEl.value) {\n oldEl.value = newEl.value\n }\n if (oldEl.checked !== newEl.checked) {\n oldEl.checked = newEl.checked\n }\n }\n if (oldEl instanceof HTMLTextAreaElement && newEl instanceof HTMLTextAreaElement) {\n if (oldEl.value !== newEl.value) {\n oldEl.value = newEl.value\n }\n }\n if (oldEl instanceof HTMLSelectElement && newEl instanceof HTMLSelectElement) {\n if (oldEl.value !== newEl.value) {\n oldEl.value = newEl.value\n }\n }\n}\n\nfunction reconcileChildren(oldEl: Element, newEl: Element): void {\n const oldChildren = Array.from(oldEl.childNodes)\n const newChildren = Array.from(newEl.childNodes)\n const maxLen = Math.max(oldChildren.length, newChildren.length)\n\n for (let i = 0; i < maxLen; i++) {\n const oldChild = oldChildren[i]\n const newChild = newChildren[i]\n\n if (!oldChild && newChild) {\n oldEl.appendChild(newChild)\n } else if (oldChild && !newChild) {\n oldEl.removeChild(oldChild)\n } else if (oldChild && newChild) {\n // patchNode returns the node that's now in DOM\n // For reconcileChildren, we just need the side effect\n patchNode(oldChild, newChild, oldEl)\n }\n }\n}\n\nfunction patchNode(oldNode: Node, newNode: Node, parent: Element): Node {\n if (canReuse(oldNode, newNode)) {\n const ownerInstance = (newNode as any).__ownerInstance as DOMComponentInstance | undefined\n if (ownerInstance) {\n const idx = ownerInstance.nodes.indexOf(newNode)\n if (idx !== -1) {\n ownerInstance.nodes[idx] = oldNode\n }\n ; (oldNode as any).__ownerInstance = ownerInstance\n delete (newNode as any).__ownerInstance\n }\n\n if (oldNode.nodeType === Node.TEXT_NODE) {\n if (oldNode.nodeValue !== newNode.nodeValue) {\n oldNode.nodeValue = newNode.nodeValue\n }\n } else if (oldNode.nodeType === Node.ELEMENT_NODE) {\n updateAttributes(oldNode as Element, newNode as Element)\n reconcileChildren(oldNode as Element, newNode as Element)\n }\n return oldNode\n } else {\n // Ensure oldNode is actually a child of parent before replacing\n if (oldNode.parentNode === parent) {\n parent.replaceChild(newNode, oldNode)\n } else if (oldNode.parentNode) {\n // oldNode is attached to a different parent, remove it and insert newNode\n oldNode.parentNode.removeChild(oldNode)\n parent.insertBefore(newNode, null)\n } else {\n // oldNode is detached, just insert newNode\n parent.insertBefore(newNode, null)\n }\n return newNode\n }\n}\n\nexport function reconcile(oldNodes: Node[], newNodes: Node[], parent: Node, beforeMarker: Node): Node[] {\n const maxLen = Math.max(oldNodes.length, newNodes.length)\n const resultNodes: Node[] = []\n\n for (let i = 0; i < maxLen; i++) {\n const oldNode = oldNodes[i]\n const newNode = newNodes[i]\n\n if (!oldNode && newNode) {\n parent.insertBefore(newNode, beforeMarker)\n resultNodes.push(newNode)\n } else if (oldNode && !newNode) {\n if (oldNode.parentNode) {\n parent.removeChild(oldNode)\n }\n } else if (oldNode && newNode) {\n const resultNode = patchNode(oldNode, newNode, parent as Element)\n resultNodes.push(resultNode)\n }\n }\n\n return resultNodes\n}\n\nexport function render(app: any, container: HTMLElement): () => void {\n container.innerHTML = ''\n\n if (typeof app === 'function') {\n app = { type: app, props: {}, children: [], key: undefined }\n }\n\n renderNode(app, container)\n\n // Return dispose function\n return () => {\n // Remove all component instances registered under this container\n if (instanceRegistry.has(container)) {\n const registry = instanceRegistry.get(container)!\n registry.forEach(instance => {\n removeComponentInstance(instance)\n })\n registry.clear()\n instanceRegistry.delete(container)\n }\n // Clear container\n container.innerHTML = ''\n }\n}\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
function C(e){let n=5381;for(let t=0;t<e.length;t++)n=(n<<5)+n^e.charCodeAt(t);return "fx-"+(n>>>0).toString(36)}var W=new Set(["animationIterationCount","borderImageOutset","borderImageSlice","borderImageWidth","boxFlex","boxFlexGroup","boxOrdinalGroup","columnCount","columns","flex","flexGrow","flexPositive","flexShrink","flexNegative","flexOrder","gridArea","gridRow","gridRowEnd","gridRowSpan","gridRowStart","gridColumn","gridColumnEnd","gridColumnSpan","gridColumnStart","fontWeight","lineClamp","lineHeight","opacity","order","orphans","tabSize","widows","zIndex","zoom","fillOpacity","floodOpacity","stopOpacity","strokeDasharray","strokeDashoffset","strokeMiterlimit","strokeOpacity","strokeWidth"]);function K(e){return e.replace(/[A-Z]/g,n=>"-"+n.toLowerCase())}function P(e,n){return typeof n=="number"&&n!==0&&!W.has(e)?n+"px":String(n)}function k(e,n){let t="",r="";for(let i in e){let a=e[i];if(a!=null)if(i.startsWith("&")){let l=i.replace(/&/g,n);r+=k(a,l);}else if(i.startsWith("@"))r+=`${i}{${k(a,n)}}`;else {if(typeof a=="object")continue;t+=`${K(i)}:${P(i,a)};`;}}let s="";return t&&(s=`${n}{${t}}`),s+=r,s}function z(e,n){let t="";for(let r in n){let s=n[r],i="";for(let a in s){let l=s[a];l!=null&&typeof l!="object"&&(i+=`${K(a)}:${P(a,l)};`);}t+=`${r}{${i}}`;}return `@keyframes ${e}{${t}}`}var g=new Map,T=[],m=null;function M(){return typeof document<"u"&&"adoptedStyleSheets"in document&&typeof CSSStyleSheet<"u"&&"replaceSync"in CSSStyleSheet.prototype}function H(){return M()?(m||(m=new CSSStyleSheet,document.adoptedStyleSheets=[...document.adoptedStyleSheets,m]),m):null}function V(e,n){if(g.has(e))return;g.set(e,true);let t=H();if(t)try{t.insertRule(n,t.cssRules.length);}catch{}else T.push(n);}function O(e){return g.has(e)}function A(){return T.join("")}function L(){let e=A();return e?`<style data-flexium-css>${e}</style>`:""}function q(){T=[],g=new Map,m=null;}function D(){if(typeof document>"u")return;let e=document.querySelector("style[data-flexium-css]");if(e){let n=e.textContent||"",t=/\.fx-[a-z0-9]+/g,r;for(;(r=t.exec(n))!==null;){let s=r[0].slice(1);g.set(s,true);}}}M()&&D();function S(e){let n=JSON.stringify(e),t=C(n);if(O(t))return t;let r=k(e,"."+t);return V(t,r),t}function $(...e){return e.filter(Boolean).join(" ")}function G(e,n){let{base:t,variants:r,defaultVariants:s,compoundVariants:i}=n,a=S(t),l=new Map;function F(d,c){let h=`${d}:${c}`,f=l.get(h);return !f&&r?.[d]?.[c]&&(f=S(r[d][c]),l.set(h,f)),f||""}let j=new Map;function v(d){let{children:c,className:h,...f}=d,u={},N={};for(let o in f)r&&o in r?u[o]=f[o]??s?.[o]:N[o]=f[o];if(s)for(let o in s)o in u||(u[o]=String(s[o]));let w=[];for(let[o,x]of Object.entries(u))if(x){let y=F(o,String(x));y&&w.push(y);}if(i)for(let o of i){let{css:x,...y}=o,R=true;for(let[b,p]of Object.entries(y))if(u[b]!==p){R=false;break}if(R){let b=JSON.stringify(y),p=j.get(b);p||(p=S(x),j.set(b,p)),w.push(p);}}let I=$(a,...w,h);return {type:e,props:{...N,className:I},children:Array.isArray(c)?c:c!=null?[c]:[],key:void 0}}return v.displayName=`Styled(${e})`,v}function J(e){let n=JSON.stringify(e),t=C(n);if(O(t))return t;let r=z(t,e);return V(t,r),t}export{A as a,L as b,q as c,D as d,S as e,$ as f,G as g,J as h};//# sourceMappingURL=chunk-I6X66M5T.mjs.map
|
|
2
|
+
//# sourceMappingURL=chunk-I6X66M5T.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/css/runtime/hash.ts","../src/css/runtime/serialize.ts","../src/css/runtime/sheet.ts","../src/css/css.ts","../src/css/styled.ts","../src/css/keyframes.ts"],"names":["hash","str","h","i","unitlessProperties","toKebabCase","match","addUnit","property","value","serialize","styles","selector","properties","nested","key","nestedSelector","result","serializeKeyframes","name","keyframes","frames","prop","cache","serverStyles","browserSheet","supportsAdoptedStyleSheets","getBrowserSheet","insert","css","sheet","has","getStyles","getStyleTag","resetStyles","hydrateStyles","styleTag","text","classRegex","className","cssText","cx","classes","styled","tag","config","base","variants","defaultVariants","compoundVariants","baseClass","variantCache","getVariantClass","variantName","variantValue","cacheKey","compoundCache","StyledComponent","props","children","userClassName","rest","variantProps","elementProps","variantClasses","vc","compound","compoundStyles","conditions","matches","compoundClass","finalClassName","definition"],"mappings":"AAIO,SAASA,CAAAA,CAAKC,EAAqB,CACxC,IAAIC,EAAI,IAAA,CACR,IAAA,IAASC,EAAI,CAAA,CAAGA,CAAAA,CAAIF,EAAI,MAAA,CAAQE,CAAAA,EAAAA,CAC9BD,GAAMA,CAAAA,EAAK,CAAA,EAAKA,EAAKD,CAAAA,CAAI,UAAA,CAAWE,CAAC,CAAA,CAEvC,OAAO,OAASD,CAAAA,GAAM,CAAA,EAAG,SAAS,EAAE,CACtC,CCLA,IAAME,CAAAA,CAAqB,IA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s","sourcesContent":["/**\n * Generate a hash for a style object\n * Uses djb2 algorithm for fast, low-collision hashing\n */\nexport function hash(str: string): string {\n let h = 5381\n for (let i = 0; i < str.length; i++) {\n h = ((h << 5) + h) ^ str.charCodeAt(i)\n }\n return 'fx-' + (h >>> 0).toString(36)\n}\n","import type { StyleObject, CSSValue } from '../types'\n\n/**\n * Properties that should not have 'px' auto-added\n */\nconst unitlessProperties = new Set([\n 'animationIterationCount',\n 'borderImageOutset',\n 'borderImageSlice',\n 'borderImageWidth',\n 'boxFlex',\n 'boxFlexGroup',\n 'boxOrdinalGroup',\n 'columnCount',\n 'columns',\n 'flex',\n 'flexGrow',\n 'flexPositive',\n 'flexShrink',\n 'flexNegative',\n 'flexOrder',\n 'gridArea',\n 'gridRow',\n 'gridRowEnd',\n 'gridRowSpan',\n 'gridRowStart',\n 'gridColumn',\n 'gridColumnEnd',\n 'gridColumnSpan',\n 'gridColumnStart',\n 'fontWeight',\n 'lineClamp',\n 'lineHeight',\n 'opacity',\n 'order',\n 'orphans',\n 'tabSize',\n 'widows',\n 'zIndex',\n 'zoom',\n 'fillOpacity',\n 'floodOpacity',\n 'stopOpacity',\n 'strokeDasharray',\n 'strokeDashoffset',\n 'strokeMiterlimit',\n 'strokeOpacity',\n 'strokeWidth',\n])\n\n/**\n * Convert camelCase to kebab-case\n */\nexport function toKebabCase(str: string): string {\n return str.replace(/[A-Z]/g, (match) => '-' + match.toLowerCase())\n}\n\n/**\n * Add unit to numeric values where appropriate\n */\nexport function addUnit(property: string, value: CSSValue): string {\n if (typeof value === 'number' && value !== 0 && !unitlessProperties.has(property)) {\n return value + 'px'\n }\n return String(value)\n}\n\n/**\n * Serialize a style object to CSS string\n */\nexport function serialize(styles: StyleObject, selector: string): string {\n let properties = ''\n let nested = ''\n\n for (const key in styles) {\n const value = styles[key]\n\n if (value === undefined || value === null) {\n continue\n }\n\n if (key.startsWith('&')) {\n // Nested selector: &:hover, &::before, & > div\n const nestedSelector = key.replace(/&/g, selector)\n nested += serialize(value as StyleObject, nestedSelector)\n } else if (key.startsWith('@')) {\n // At-rule: @media, @supports, @container\n nested += `${key}{${serialize(value as StyleObject, selector)}}`\n } else if (typeof value === 'object') {\n // Skip invalid nested objects without & or @\n continue\n } else {\n // Regular CSS property\n properties += `${toKebabCase(key)}:${addUnit(key, value)};`\n }\n }\n\n let result = ''\n if (properties) {\n result = `${selector}{${properties}}`\n }\n result += nested\n\n return result\n}\n\n/**\n * Serialize keyframes to CSS string\n */\nexport function serializeKeyframes(\n name: string,\n keyframes: Record<string, Record<string, CSSValue>>\n): string {\n let frames = ''\n\n for (const key in keyframes) {\n const styles = keyframes[key]\n let properties = ''\n\n for (const prop in styles) {\n const value = styles[prop]\n if (value !== undefined && value !== null && typeof value !== 'object') {\n properties += `${toKebabCase(prop)}:${addUnit(prop, value)};`\n }\n }\n\n frames += `${key}{${properties}}`\n }\n\n return `@keyframes ${name}{${frames}}`\n}\n","/**\n * StyleSheet manager\n * Uses adoptedStyleSheets for efficient style injection\n * Falls back to server-side collection when not available (SSR, jsdom)\n */\n\n// Cache to track which styles have been inserted\nlet cache = new Map<string, boolean>()\n\n// Server-side collected styles\nlet serverStyles: string[] = []\n\n// Browser stylesheet (lazy initialized)\nlet browserSheet: CSSStyleSheet | null = null\n\n/**\n * Check if adoptedStyleSheets is supported\n */\nfunction supportsAdoptedStyleSheets(): boolean {\n return (\n typeof document !== 'undefined' &&\n 'adoptedStyleSheets' in document &&\n typeof CSSStyleSheet !== 'undefined' &&\n 'replaceSync' in CSSStyleSheet.prototype\n )\n}\n\nfunction getBrowserSheet(): CSSStyleSheet | null {\n if (!supportsAdoptedStyleSheets()) {\n return null\n }\n\n if (!browserSheet) {\n browserSheet = new CSSStyleSheet()\n document.adoptedStyleSheets = [...document.adoptedStyleSheets, browserSheet]\n }\n return browserSheet\n}\n\n/**\n * Insert a CSS rule\n */\nexport function insert(hash: string, css: string): void {\n if (cache.has(hash)) {\n return\n }\n\n cache.set(hash, true)\n\n const sheet = getBrowserSheet()\n if (sheet) {\n try {\n sheet.insertRule(css, sheet.cssRules.length)\n } catch {\n // Handle invalid CSS gracefully\n }\n } else {\n // Server-side or unsupported environment: collect styles\n serverStyles.push(css)\n }\n}\n\n/**\n * Check if a hash is already in the cache\n */\nexport function has(hash: string): boolean {\n return cache.has(hash)\n}\n\n/**\n * Get all collected styles for SSR\n */\nexport function getStyles(): string {\n return serverStyles.join('')\n}\n\n/**\n * Get styles as a style tag for SSR\n */\nexport function getStyleTag(): string {\n const styles = getStyles()\n if (!styles) return ''\n return `<style data-flexium-css>${styles}</style>`\n}\n\n/**\n * Reset collected styles and cache (for SSR between requests or testing)\n */\nexport function resetStyles(): void {\n serverStyles = []\n cache = new Map()\n browserSheet = null\n}\n\n/**\n * Hydrate styles on the client\n * Call this after SSR to sync the cache with server-rendered styles\n */\nexport function hydrateStyles(): void {\n if (typeof document === 'undefined') return\n\n const styleTag = document.querySelector('style[data-flexium-css]')\n if (styleTag) {\n // Parse and cache existing styles\n const text = styleTag.textContent || ''\n const classRegex = /\\.fx-[a-z0-9]+/g\n let match\n while ((match = classRegex.exec(text)) !== null) {\n const hash = match[0].slice(1) // Remove the dot\n cache.set(hash, true)\n }\n }\n}\n\n// Auto-hydrate on client (only if adoptedStyleSheets is supported)\nif (supportsAdoptedStyleSheets()) {\n hydrateStyles()\n}\n","import type { StyleObject } from './types'\nimport { hash } from './runtime/hash'\nimport { serialize } from './runtime/serialize'\nimport { insert, has } from './runtime/sheet'\n\n/**\n * Create a CSS class from a style object\n *\n * @example\n * ```tsx\n * const buttonClass = css({\n * padding: '8px 16px',\n * backgroundColor: 'blue',\n * color: 'white',\n * '&:hover': {\n * backgroundColor: 'darkblue'\n * }\n * })\n *\n * <button className={buttonClass}>Click me</button>\n * ```\n */\nexport function css(styles: StyleObject): string {\n // Generate unique hash from style object\n const key = JSON.stringify(styles)\n const className = hash(key)\n\n // Skip if already inserted\n if (has(className)) {\n return className\n }\n\n // Serialize and insert CSS\n const cssText = serialize(styles, '.' + className)\n insert(className, cssText)\n\n return className\n}\n\n/**\n * Combine multiple class names, filtering out falsy values\n *\n * @example\n * ```tsx\n * const className = cx(\n * baseClass,\n * isActive && activeClass,\n * variant === 'primary' && primaryClass\n * )\n * ```\n */\nexport function cx(\n ...classes: (string | boolean | null | undefined)[]\n): string {\n return classes.filter(Boolean).join(' ')\n}\n","import type { StyleObject, VariantConfig, StyledConfig } from './types'\nimport type { FNode } from '../dom/types'\nimport { css, cx } from './css'\n\n// HTML element tag names\ntype HTMLTag = 'a' | 'abbr' | 'address' | 'area' | 'article' | 'aside' | 'audio' |\n 'b' | 'base' | 'bdi' | 'bdo' | 'blockquote' | 'body' | 'br' | 'button' |\n 'canvas' | 'caption' | 'cite' | 'code' | 'col' | 'colgroup' |\n 'data' | 'datalist' | 'dd' | 'del' | 'details' | 'dfn' | 'dialog' | 'div' | 'dl' | 'dt' |\n 'em' | 'embed' |\n 'fieldset' | 'figcaption' | 'figure' | 'footer' | 'form' |\n 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'head' | 'header' | 'hgroup' | 'hr' | 'html' |\n 'i' | 'iframe' | 'img' | 'input' | 'ins' |\n 'kbd' |\n 'label' | 'legend' | 'li' | 'link' |\n 'main' | 'map' | 'mark' | 'menu' | 'meta' | 'meter' |\n 'nav' | 'noscript' |\n 'object' | 'ol' | 'optgroup' | 'option' | 'output' |\n 'p' | 'picture' | 'pre' | 'progress' |\n 'q' |\n 'rp' | 'rt' | 'ruby' |\n 's' | 'samp' | 'script' | 'search' | 'section' | 'select' | 'slot' | 'small' | 'source' | 'span' | 'strong' | 'style' | 'sub' | 'summary' | 'sup' | 'svg' |\n 'table' | 'tbody' | 'td' | 'template' | 'textarea' | 'tfoot' | 'th' | 'thead' | 'time' | 'title' | 'tr' | 'track' |\n 'u' | 'ul' |\n 'var' | 'video' |\n 'wbr'\n\n/**\n * Create a styled component with variant support\n *\n * @example\n * ```tsx\n * const Button = styled('button', {\n * base: {\n * padding: '8px 16px',\n * border: 'none',\n * borderRadius: 4,\n * cursor: 'pointer'\n * },\n * variants: {\n * variant: {\n * primary: { backgroundColor: 'blue', color: 'white' },\n * secondary: { backgroundColor: 'gray', color: 'black' }\n * },\n * size: {\n * sm: { padding: '4px 8px', fontSize: 12 },\n * md: { padding: '8px 16px', fontSize: 14 },\n * lg: { padding: '12px 24px', fontSize: 16 }\n * }\n * },\n * defaultVariants: {\n * variant: 'primary',\n * size: 'md'\n * }\n * })\n *\n * // Usage\n * <Button variant=\"secondary\" size=\"lg\">Click me</Button>\n * ```\n */\nexport function styled<\n T extends HTMLTag,\n V extends VariantConfig = Record<string, never>\n>(\n tag: T,\n config: StyledConfig<V>\n): StyledComponent<T, V> {\n const { base, variants, defaultVariants, compoundVariants } = config\n\n // Pre-compute base class\n const baseClass = css(base)\n\n // Cache for variant classes\n const variantCache = new Map<string, string>()\n\n // Get or create variant class\n function getVariantClass(variantName: string, variantValue: string): string {\n const cacheKey = `${variantName}:${variantValue}`\n let className = variantCache.get(cacheKey)\n\n if (!className && variants?.[variantName]?.[variantValue]) {\n className = css(variants[variantName][variantValue])\n variantCache.set(cacheKey, className)\n }\n\n return className || ''\n }\n\n // Compound variant cache\n const compoundCache = new Map<string, string>()\n\n function StyledComponent(props: StyledComponentProps<V>): FNode {\n const { children, className: userClassName, ...rest } = props as any\n\n // Separate variant props from element props\n const variantProps: Record<string, string> = {}\n const elementProps: Record<string, any> = {}\n\n for (const key in rest) {\n if (variants && key in variants) {\n variantProps[key] = rest[key] ?? (defaultVariants as any)?.[key]\n } else {\n elementProps[key] = rest[key]\n }\n }\n\n // Apply default variants for missing props\n if (defaultVariants) {\n for (const key in defaultVariants) {\n if (!(key in variantProps)) {\n variantProps[key] = String(defaultVariants[key as keyof typeof defaultVariants])\n }\n }\n }\n\n // Collect variant classes\n const variantClasses: string[] = []\n for (const [name, value] of Object.entries(variantProps)) {\n if (value) {\n const vc = getVariantClass(name, String(value))\n if (vc) variantClasses.push(vc)\n }\n }\n\n // Check compound variants\n if (compoundVariants) {\n for (const compound of compoundVariants) {\n const { css: compoundStyles, ...conditions } = compound\n\n // Check if all conditions match\n let matches = true\n for (const [key, value] of Object.entries(conditions)) {\n if (variantProps[key] !== value) {\n matches = false\n break\n }\n }\n\n if (matches) {\n // Generate cache key from conditions\n const cacheKey = JSON.stringify(conditions)\n let compoundClass = compoundCache.get(cacheKey)\n\n if (!compoundClass) {\n compoundClass = css(compoundStyles)\n compoundCache.set(cacheKey, compoundClass)\n }\n\n variantClasses.push(compoundClass)\n }\n }\n }\n\n // Combine all classes\n const finalClassName = cx(baseClass, ...variantClasses, userClassName)\n\n // Return FNode element\n return {\n type: tag,\n props: { ...elementProps, className: finalClassName },\n children: Array.isArray(children) ? children : children != null ? [children] : [],\n key: undefined\n }\n }\n\n // Mark as styled component\n StyledComponent.displayName = `Styled(${tag})`\n\n return StyledComponent as unknown as StyledComponent<T, V>\n}\n\n// Types\ntype StyledComponent<\n T extends HTMLTag,\n V extends VariantConfig\n> = {\n (props: StyledComponentProps<V>): FNode\n displayName: string\n}\n\ntype StyledComponentProps<V extends VariantConfig> = {\n [K in keyof V]?: keyof V[K]\n} & {\n children?: any\n className?: string\n [key: string]: any\n}\n","import type { KeyframeDefinition, CSSValue } from './types'\nimport { hash } from './runtime/hash'\nimport { serializeKeyframes } from './runtime/serialize'\nimport { insert, has } from './runtime/sheet'\n\n/**\n * Create a keyframes animation\n *\n * @example\n * ```tsx\n * const fadeIn = keyframes({\n * from: { opacity: 0 },\n * to: { opacity: 1 }\n * })\n *\n * const slideIn = keyframes({\n * '0%': { transform: 'translateX(-100%)' },\n * '100%': { transform: 'translateX(0)' }\n * })\n *\n * const className = css({\n * animation: `${fadeIn} 0.3s ease-in-out`\n * })\n * ```\n */\nexport function keyframes(definition: KeyframeDefinition): string {\n // Generate unique name from keyframe definition\n const key = JSON.stringify(definition)\n const name = hash(key)\n\n // Skip if already inserted\n if (has(name)) {\n return name\n }\n\n // Serialize and insert keyframes\n const cssText = serializeKeyframes(name, definition as Record<string, Record<string, CSSValue>>)\n insert(name, cssText)\n\n return name\n}\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {b}from'./chunk-NRPWBHKP.mjs';import {h as h$1,a}from'./chunk-TIUNOZRI.mjs';var d=new WeakMap,l=null;function K(){l=null;}function I(e){e.children.forEach(n=>{I(n);}),e.nodes.forEach(n=>{n.parentNode&&n.parentNode.removeChild(n);}),e.children.clear(),e.parentInstance&&e.parentInstance.children.delete(e);}function S(e,n,i){let c=i||n,r=f=>{let p={...f.props};return f.children&&f.children.length>0&&(p.children=f.children.length===1?f.children[0]:f.children),p},a$1=e.key!==void 0;d.has(c)||d.set(c,new Map);let t=d.get(c),o;if(a$1)o=e.key;else {let f=0,p=e.type.name||"anonymous";t.forEach((b,g)=>{typeof g=="string"&&g.startsWith(`__auto_${p}_`)&&f++;}),o=`__auto_${p}_${f}`;}if(t.has(o)){let f=t.get(o);f.fnode=e;let p=r(e);return f.props=p,f.children.clear(),f.renderFn&&f.renderFn(),f.nodes}let s={hooks:[],hookIndex:0,nodes:[],parent:n,fnode:e,props:r(e),key:o,children:new Set,parentInstance:l||void 0};l&&l.children.add(s),t.set(o,s);let u=true,y=()=>{let f=s.fnode,p=s.props;f.type._contextId!==void 0&&h$1(f.type._contextId,p.value);let g=l;l=s;let C=a(s,()=>f.type(p));if(u){let _=h(C,n);s.nodes=_?Array.isArray(_)?_:[_]:[],s.nodes.forEach(m=>{m.__ownerInstance||(m.__ownerInstance=s);}),u=false;}else {if(s.nodes.length===0){let v=h(C,n);s.nodes=v?Array.isArray(v)?v:[v]:[],l=g;return}let m=s.nodes[0].parentNode;m||(m=s.parent);let M=document.createComment("flexium-marker"),L=s.nodes[s.nodes.length-1];L.nextSibling?m.insertBefore(M,L.nextSibling):m.appendChild(M),s.children.clear();let x=document.createElement("div"),T=h(C,x,m),O=T?Array.isArray(T)?T:[T]:[],R=P(s.nodes,O,m,M);m.removeChild(M),s.nodes=R;}l=g;};return s.renderFn=y,b(y),s.nodes}function h(e,n,i){let c=i||n;if(e==null||typeof e=="boolean"){let r=document.createTextNode("");return n.appendChild(r),r}if(typeof e=="string"||typeof e=="number"){let r=document.createTextNode(String(e));return n.appendChild(r),r}if(Array.isArray(e)){let r=new Set;d.has(c)&&d.get(c).forEach((s,u)=>r.add(u));let a=[];e.forEach(o=>{let s=h(o,n,i);s&&(Array.isArray(s)?a.push(...s):a.push(s));});let t=new Set;if(d.has(c)&&d.get(c).forEach((s,u)=>t.add(u)),d.has(c)){let o=d.get(c),s=[];r.forEach(u=>{if(!t.has(u)){let y=o.get(u);y&&(I(y),s.push(u));}}),s.forEach(u=>o.delete(u));}return a}if(typeof e=="object"){if(typeof e.type=="string"){let r=document.createElement(e.type);return e.props&&Object.entries(e.props).forEach(([a,t])=>{if(a==="ref")typeof t=="function"?t(r):t&&typeof t=="object"&&"current"in t&&(t.current=r);else if(a.startsWith("on")&&typeof t=="function"){let o=a.slice(2).toLowerCase();r.addEventListener(o,t),r.__eventHandlers||(r.__eventHandlers={}),r.__eventHandlers[o]=t;}else a!=="ref"&&D(r,a,t);}),e.children&&e.children.length>0&&e.children.forEach(a=>{h(a,r);}),n.appendChild(r),r}if(typeof e.type=="function")return S(e,n,i)}return null}function D(e,n,i){i==null?e.removeAttribute(n):n==="style"&&typeof i=="object"?Object.assign(e.style,i):n==="class"?e.className=String(i):n in e&&typeof e[n]!="function"?e[n]=i:e.setAttribute(n,String(i));}function j(e,n){return e.nodeType!==n.nodeType?false:e.nodeType===Node.ELEMENT_NODE&&n.nodeType===Node.ELEMENT_NODE?e.tagName===n.tagName:true}function k(e,n){Array.from(e.attributes).forEach(t=>{n.hasAttribute(t.name)||e.removeAttribute(t.name);}),Array.from(n.attributes).forEach(t=>{e.getAttribute(t.name)!==t.value&&(t.name==="value"&&"value"in e?e.value=t.value:t.name==="checked"&&"checked"in e?e.checked=t.value==="true"||t.value==="":e.setAttribute(t.name,t.value));});let r=e.__eventHandlers||{},a=n.__eventHandlers||{};Object.keys(r).forEach(t=>{a[t]||e.removeEventListener(t,r[t]);}),Object.keys(a).forEach(t=>{r[t]!==a[t]&&(r[t]&&e.removeEventListener(t,r[t]),e.addEventListener(t,a[t]));}),Object.keys(a).length>0?e.__eventHandlers=a:delete e.__eventHandlers,e instanceof HTMLInputElement&&n instanceof HTMLInputElement&&(e.value!==n.value&&(e.value=n.value),e.checked!==n.checked&&(e.checked=n.checked)),e instanceof HTMLTextAreaElement&&n instanceof HTMLTextAreaElement&&e.value!==n.value&&(e.value=n.value),e instanceof HTMLSelectElement&&n instanceof HTMLSelectElement&&e.value!==n.value&&(e.value=n.value);}function F(e,n){let i=Array.from(e.childNodes),c=Array.from(n.childNodes),r=Math.max(i.length,c.length);for(let a=0;a<r;a++){let t=i[a],o=c[a];!t&&o?e.appendChild(o):t&&!o?e.removeChild(t):t&&o&&N(t,o,e);}}function N(e,n,i){if(j(e,n)){let c=n.__ownerInstance;if(c){let r=c.nodes.indexOf(n);r!==-1&&(c.nodes[r]=e),e.__ownerInstance=c,delete n.__ownerInstance;}return e.nodeType===Node.TEXT_NODE?e.nodeValue!==n.nodeValue&&(e.nodeValue=n.nodeValue):e.nodeType===Node.ELEMENT_NODE&&(k(e,n),F(e,n)),e}else return e.parentNode===i?i.replaceChild(n,e):(e.parentNode&&e.parentNode.removeChild(e),i.insertBefore(n,null)),n}function P(e,n,i,c){let r=Math.max(e.length,n.length),a=[];for(let t=0;t<r;t++){let o=e[t],s=n[t];if(!o&&s)i.insertBefore(s,c),a.push(s);else if(o&&!s)o.parentNode&&i.removeChild(o);else if(o&&s){let u=N(o,s,i);a.push(u);}}return a}function $(e,n){return n.innerHTML="",typeof e=="function"&&(e={type:e,props:{},children:[],key:void 0}),h(e,n),()=>{if(d.has(n)){let i=d.get(n);i.forEach(c=>{I(c);}),i.clear(),d.delete(n);}n.innerHTML="";}}export{K as a,h as b,P as c,$ as d};//# sourceMappingURL=chunk-MEJO2RIK.mjs.map
|
|
2
|
+
//# sourceMappingURL=chunk-MEJO2RIK.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/dom/render.ts"],"names":["instanceRegistry","currentRenderingInstance","resetRender","removeComponentInstance","instance","child","node","renderComponent","fnode","parent","registryParent","effectiveRegistryParent","mergeProps","props","hasExplicitKey","parentRegistry","key","instanceCount","componentName","_","k","newProps","isFirstRender","renderFn","currentFnode","currentProps","pushContext","previousRenderingInstance","result","runWithComponent","newNodes","renderNode","nodeParent","marker","lastNode","tempContainer","newNodesArray","reconciledNodes","reconcile","unsafeEffect","oldKeysSet","nodes","newKeysSet","keysToRemove","dom","value","eventName","setAttribute","el","canReuse","oldNode","newNode","updateAttributes","oldEl","newEl","attr","oldHandlers","newHandlers","event","reconcileChildren","oldChildren","newChildren","maxLen","i","oldChild","newChild","patchNode","ownerInstance","idx","oldNodes","beforeMarker","resultNodes","resultNode","render","app","container","registry"],"mappings":"mFAiBA,IAAMA,EAAmB,IAAI,OAAA,CAGzBC,CAAAA,CAAwD,IAAA,CAGrD,SAASC,CAAAA,EAAoB,CAChCD,CAAAA,CAA2B,KAE/B,CAGA,SAASE,CAAAA,CAAwBC,CAAAA,CAAsC,CACnEA,EAAS,QAAA,CAAS,OAAA,CAAQC,CAAAA,EAAS,CAC/BF,EAAwBE,CAAK,EACjC,CAAC,CAAA,CAEDD,EAAS,KAAA,CAAM,OAAA,CAAQE,CAAAA,EAAQ,CACvBA,EAAK,UAAA,EACLA,CAAAA,CAAK,UAAA,CAAW,WAAA,CAAYA,CAAI,EAExC,CAAC,CAAA,CAEDF,CAAAA,CAAS,SAAS,KAAA,EAAM,CAEpBA,CAAAA,CAAS,cAAA,EACTA,EAAS,cAAA,CAAe,QAAA,CAAS,MAAA,CAAOA,CAAQ,EAExD,CAGA,SAASG,CAAAA,CAAgBC,CAAAA,CAAYC,EAAqBC,CAAAA,CAAsC,CAC5F,IAAMC,CAAAA,CAA0BD,GAAkBD,CAAAA,CA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CAC3B,IAAMqB,EAAaN,CAAAA,CAAUhB,CAAAA,CAASC,CAAAA,CAAS1C,CAAiB,EAChE8D,CAAAA,CAAY,IAAA,CAAKC,CAAU,EAC/B,CACJ,CAEA,OAAOD,CACX,CAEO,SAASE,CAAAA,CAAOC,CAAAA,CAAUC,CAAAA,CAAoC,CACjE,OAAAA,CAAAA,CAAU,SAAA,CAAY,EAAA,CAElB,OAAOD,GAAQ,UAAA,GACfA,CAAAA,CAAM,CAAE,IAAA,CAAMA,EAAK,KAAA,CAAO,GAAI,QAAA,CAAU,GAAI,GAAA,CAAK,MAAU,CAAA,CAAA,CAG/D3C,CAAAA,CAAW2C,EAAKC,CAAS,CAAA,CAGlB,IAAM,CAET,GAAI3E,CAAAA,CAAiB,GAAA,CAAI2E,CAAS,CAAA,CAAG,CACjC,IAAMC,CAAAA,CAAW5E,CAAAA,CAAiB,GAAA,CAAI2E,CAAS,CAAA,CAC/CC,CAAAA,CAAS,OAAA,CAAQxE,CAAAA,EAAY,CACzBD,CAAAA,CAAwBC,CAAQ,EACpC,CAAC,EACDwE,CAAAA,CAAS,KAAA,EAAM,CACf5E,CAAAA,CAAiB,OAAO2E,CAAS,EACrC,CAEAA,CAAAA,CAAU,SAAA,CAAY,GAC1B,CACJ","file":"chunk-MEJO2RIK.mjs","sourcesContent":["import { pushContext } from '../core/context'\nimport { runWithComponent, type ComponentInstance } from '../core/hook'\nimport { unsafeEffect } from '../core/lifecycle'\n\n// Extended ComponentInstance for DOM tracking\ninterface DOMComponentInstance extends ComponentInstance {\n nodes: Node[]\n parent: HTMLElement\n fnode: any\n props: any\n key?: any\n renderFn?: () => void\n children: Set<DOMComponentInstance>\n parentInstance?: DOMComponentInstance\n}\n\n// Registry to store component instances by parent and key\nconst instanceRegistry = new WeakMap<HTMLElement, Map<any, DOMComponentInstance>>()\n\n// Current rendering component instance (for tracking parent-child relationships)\nlet currentRenderingInstance: DOMComponentInstance | null = null\n\n// Reset render state - call before re-rendering the entire app (e.g., srcdoc update)\nexport function resetRender(): void {\n currentRenderingInstance = null\n // Note: WeakMap will automatically GC old entries when their keys are gone\n}\n\n// Recursively remove component instance and all its children\nfunction removeComponentInstance(instance: DOMComponentInstance): void {\n instance.children.forEach(child => {\n removeComponentInstance(child)\n })\n\n instance.nodes.forEach(node => {\n if (node.parentNode) {\n node.parentNode.removeChild(node)\n }\n })\n\n instance.children.clear()\n\n if (instance.parentInstance) {\n instance.parentInstance.children.delete(instance)\n }\n}\n\n// Render a function component with reactive re-rendering\nfunction renderComponent(fnode: any, parent: HTMLElement, registryParent?: HTMLElement): Node[] {\n const effectiveRegistryParent = registryParent || parent\n\n const mergeProps = (node: any) => {\n const props = { ...node.props }\n if (node.children && node.children.length > 0) {\n props.children = node.children.length === 1\n ? node.children[0]\n : node.children\n }\n return props\n }\n\n const hasExplicitKey = fnode.key !== undefined\n\n if (!instanceRegistry.has(effectiveRegistryParent)) {\n instanceRegistry.set(effectiveRegistryParent, new Map())\n }\n const parentRegistry = instanceRegistry.get(effectiveRegistryParent)!\n\n let key: any\n if (hasExplicitKey) {\n key = fnode.key\n } else {\n let instanceCount = 0\n const componentName = fnode.type.name || 'anonymous'\n parentRegistry.forEach((_, k) => {\n if (typeof k === 'string' && k.startsWith(`__auto_${componentName}_`)) {\n instanceCount++\n }\n })\n key = `__auto_${componentName}_${instanceCount}`\n }\n\n if (parentRegistry.has(key)) {\n const instance = parentRegistry.get(key)!\n instance.fnode = fnode\n const newProps = mergeProps(fnode)\n instance.props = newProps\n instance.children.clear()\n\n if (instance.renderFn) {\n instance.renderFn()\n }\n\n return instance.nodes\n }\n\n const instance: DOMComponentInstance = {\n hooks: [],\n hookIndex: 0,\n nodes: [],\n parent,\n fnode: fnode,\n props: mergeProps(fnode),\n key,\n children: new Set(),\n parentInstance: currentRenderingInstance || undefined\n }\n\n if (currentRenderingInstance) {\n currentRenderingInstance.children.add(instance)\n }\n\n parentRegistry.set(key, instance)\n\n let isFirstRender = true\n\n const renderFn = () => {\n const currentFnode = instance.fnode\n const currentProps = instance.props\n\n const isProvider = (currentFnode.type as any)._contextId !== undefined\n if (isProvider) {\n pushContext((currentFnode.type as any)._contextId, currentProps.value)\n }\n\n const previousRenderingInstance = currentRenderingInstance\n currentRenderingInstance = instance\n\n const result = runWithComponent(instance, () => currentFnode.type(currentProps))\n\n if (isFirstRender) {\n const newNodes = renderNode(result, parent)\n instance.nodes = newNodes ? (Array.isArray(newNodes) ? newNodes : [newNodes]) : []\n instance.nodes.forEach(node => {\n if (!(node as any).__ownerInstance) {\n (node as any).__ownerInstance = instance\n }\n })\n isFirstRender = false\n } else {\n if (instance.nodes.length === 0) {\n const newNodes = renderNode(result, parent)\n instance.nodes = newNodes ? (Array.isArray(newNodes) ? newNodes : [newNodes]) : []\n currentRenderingInstance = previousRenderingInstance\n return\n }\n\n const firstNode = instance.nodes[0]\n let nodeParent = firstNode.parentNode as HTMLElement\n\n if (!nodeParent) {\n nodeParent = instance.parent\n }\n\n const marker = document.createComment('flexium-marker')\n const lastNode = instance.nodes[instance.nodes.length - 1]\n if (lastNode.nextSibling) {\n nodeParent.insertBefore(marker, lastNode.nextSibling)\n } else {\n nodeParent.appendChild(marker)\n }\n\n instance.children.clear()\n\n const tempContainer = document.createElement('div')\n const newNodes = renderNode(result, tempContainer, nodeParent)\n const newNodesArray = newNodes ? (Array.isArray(newNodes) ? newNodes : [newNodes]) : []\n\n const reconciledNodes = reconcile(instance.nodes, newNodesArray, nodeParent, marker)\n\n nodeParent.removeChild(marker)\n\n instance.nodes = reconciledNodes\n }\n\n currentRenderingInstance = previousRenderingInstance\n }\n\n instance.renderFn = renderFn\n\n unsafeEffect(renderFn)\n\n return instance.nodes\n}\n\nexport function renderNode(fnode: any, parent: HTMLElement, registryParent?: HTMLElement): Node | Node[] | null {\n const effectiveRegistryParent = registryParent || parent\n\n if (fnode === null || fnode === undefined || typeof fnode === 'boolean') {\n const node = document.createTextNode('')\n parent.appendChild(node)\n return node\n }\n\n if (typeof fnode === 'string' || typeof fnode === 'number') {\n const node = document.createTextNode(String(fnode))\n parent.appendChild(node)\n return node\n }\n\n if (Array.isArray(fnode)) {\n const oldKeysSet = new Set<any>()\n if (instanceRegistry.has(effectiveRegistryParent)) {\n const parentRegistry = instanceRegistry.get(effectiveRegistryParent)!\n parentRegistry.forEach((_, key) => oldKeysSet.add(key))\n }\n\n const nodes: Node[] = []\n fnode.forEach((child) => {\n const result = renderNode(child, parent, registryParent)\n if (result) {\n if (Array.isArray(result)) {\n nodes.push(...result)\n } else {\n nodes.push(result)\n }\n }\n })\n\n const newKeysSet = new Set<any>()\n if (instanceRegistry.has(effectiveRegistryParent)) {\n const parentRegistry = instanceRegistry.get(effectiveRegistryParent)!\n parentRegistry.forEach((_, key) => newKeysSet.add(key))\n }\n\n if (instanceRegistry.has(effectiveRegistryParent)) {\n const parentRegistry = instanceRegistry.get(effectiveRegistryParent)!\n const keysToRemove: any[] = []\n\n oldKeysSet.forEach(key => {\n if (!newKeysSet.has(key)) {\n const instance = parentRegistry.get(key)\n if (instance) {\n removeComponentInstance(instance)\n keysToRemove.push(key)\n }\n }\n })\n\n keysToRemove.forEach(key => parentRegistry.delete(key))\n }\n\n return nodes\n }\n\n if (typeof fnode === 'object') {\n if (typeof fnode.type === 'string') {\n const dom = document.createElement(fnode.type)\n\n if (fnode.props) {\n Object.entries(fnode.props).forEach(([key, value]) => {\n if (key === 'ref') {\n // Handle both callback refs and RefObject\n if (typeof value === 'function') {\n value(dom)\n } else if (value && typeof value === 'object' && 'current' in value) {\n value.current = dom\n }\n } else if (key.startsWith('on') && typeof value === 'function') {\n const eventName = key.slice(2).toLowerCase()\n dom.addEventListener(eventName, value as EventListener)\n\n if (!(dom as any).__eventHandlers) {\n (dom as any).__eventHandlers = {}\n }\n (dom as any).__eventHandlers[eventName] = value\n } else if (key !== 'ref') {\n setAttribute(dom, key, value)\n }\n })\n }\n\n if (fnode.children && fnode.children.length > 0) {\n fnode.children.forEach((child: any) => {\n renderNode(child, dom)\n })\n }\n\n parent.appendChild(dom)\n return dom\n }\n\n if (typeof fnode.type === 'function') {\n return renderComponent(fnode, parent, registryParent)\n }\n }\n\n return null\n}\n\nfunction setAttribute(el: Element, key: string, value: any) {\n if (value === null || value === undefined) {\n el.removeAttribute(key)\n } else if (key === 'style' && typeof value === 'object') {\n Object.assign((el as HTMLElement).style, value)\n } else if (key === 'class') {\n el.className = String(value)\n } else if (key in el && typeof (el as any)[key] !== 'function') {\n (el as any)[key] = value\n } else {\n el.setAttribute(key, String(value))\n }\n}\n\n// Reconciliation helpers\nfunction canReuse(oldNode: Node, newNode: Node): boolean {\n if (oldNode.nodeType !== newNode.nodeType) return false\n if (oldNode.nodeType === Node.ELEMENT_NODE && newNode.nodeType === Node.ELEMENT_NODE) {\n return (oldNode as Element).tagName === (newNode as Element).tagName\n }\n return true\n}\n\nfunction updateAttributes(oldEl: Element, newEl: Element): void {\n const oldAttrs = Array.from(oldEl.attributes)\n oldAttrs.forEach(attr => {\n if (!newEl.hasAttribute(attr.name)) {\n oldEl.removeAttribute(attr.name)\n }\n })\n\n const newAttrs = Array.from(newEl.attributes)\n newAttrs.forEach(attr => {\n if (oldEl.getAttribute(attr.name) !== attr.value) {\n if (attr.name === 'value' && 'value' in oldEl) {\n (oldEl as HTMLInputElement).value = attr.value\n } else if (attr.name === 'checked' && 'checked' in oldEl) {\n (oldEl as HTMLInputElement).checked = attr.value === 'true' || attr.value === ''\n } else {\n oldEl.setAttribute(attr.name, attr.value)\n }\n }\n })\n\n const oldHandlers = (oldEl as any).__eventHandlers || {}\n const newHandlers = (newEl as any).__eventHandlers || {}\n\n Object.keys(oldHandlers).forEach(event => {\n if (!newHandlers[event]) {\n oldEl.removeEventListener(event, oldHandlers[event])\n }\n })\n\n Object.keys(newHandlers).forEach(event => {\n if (oldHandlers[event] !== newHandlers[event]) {\n if (oldHandlers[event]) {\n oldEl.removeEventListener(event, oldHandlers[event])\n }\n oldEl.addEventListener(event, newHandlers[event])\n }\n })\n\n if (Object.keys(newHandlers).length > 0) {\n (oldEl as any).__eventHandlers = newHandlers\n } else {\n delete (oldEl as any).__eventHandlers\n }\n\n if (oldEl instanceof HTMLInputElement && newEl instanceof HTMLInputElement) {\n if (oldEl.value !== newEl.value) {\n oldEl.value = newEl.value\n }\n if (oldEl.checked !== newEl.checked) {\n oldEl.checked = newEl.checked\n }\n }\n if (oldEl instanceof HTMLTextAreaElement && newEl instanceof HTMLTextAreaElement) {\n if (oldEl.value !== newEl.value) {\n oldEl.value = newEl.value\n }\n }\n if (oldEl instanceof HTMLSelectElement && newEl instanceof HTMLSelectElement) {\n if (oldEl.value !== newEl.value) {\n oldEl.value = newEl.value\n }\n }\n}\n\nfunction reconcileChildren(oldEl: Element, newEl: Element): void {\n const oldChildren = Array.from(oldEl.childNodes)\n const newChildren = Array.from(newEl.childNodes)\n const maxLen = Math.max(oldChildren.length, newChildren.length)\n\n for (let i = 0; i < maxLen; i++) {\n const oldChild = oldChildren[i]\n const newChild = newChildren[i]\n\n if (!oldChild && newChild) {\n oldEl.appendChild(newChild)\n } else if (oldChild && !newChild) {\n oldEl.removeChild(oldChild)\n } else if (oldChild && newChild) {\n // patchNode returns the node that's now in DOM\n // For reconcileChildren, we just need the side effect\n patchNode(oldChild, newChild, oldEl)\n }\n }\n}\n\nfunction patchNode(oldNode: Node, newNode: Node, parent: Element): Node {\n if (canReuse(oldNode, newNode)) {\n const ownerInstance = (newNode as any).__ownerInstance as DOMComponentInstance | undefined\n if (ownerInstance) {\n const idx = ownerInstance.nodes.indexOf(newNode)\n if (idx !== -1) {\n ownerInstance.nodes[idx] = oldNode\n }\n ; (oldNode as any).__ownerInstance = ownerInstance\n delete (newNode as any).__ownerInstance\n }\n\n if (oldNode.nodeType === Node.TEXT_NODE) {\n if (oldNode.nodeValue !== newNode.nodeValue) {\n oldNode.nodeValue = newNode.nodeValue\n }\n } else if (oldNode.nodeType === Node.ELEMENT_NODE) {\n updateAttributes(oldNode as Element, newNode as Element)\n reconcileChildren(oldNode as Element, newNode as Element)\n }\n return oldNode\n } else {\n // Ensure oldNode is actually a child of parent before replacing\n if (oldNode.parentNode === parent) {\n parent.replaceChild(newNode, oldNode)\n } else if (oldNode.parentNode) {\n // oldNode is attached to a different parent, remove it and insert newNode\n oldNode.parentNode.removeChild(oldNode)\n parent.insertBefore(newNode, null)\n } else {\n // oldNode is detached, just insert newNode\n parent.insertBefore(newNode, null)\n }\n return newNode\n }\n}\n\nexport function reconcile(oldNodes: Node[], newNodes: Node[], parent: Node, beforeMarker: Node): Node[] {\n const maxLen = Math.max(oldNodes.length, newNodes.length)\n const resultNodes: Node[] = []\n\n for (let i = 0; i < maxLen; i++) {\n const oldNode = oldNodes[i]\n const newNode = newNodes[i]\n\n if (!oldNode && newNode) {\n parent.insertBefore(newNode, beforeMarker)\n resultNodes.push(newNode)\n } else if (oldNode && !newNode) {\n if (oldNode.parentNode) {\n parent.removeChild(oldNode)\n }\n } else if (oldNode && newNode) {\n const resultNode = patchNode(oldNode, newNode, parent as Element)\n resultNodes.push(resultNode)\n }\n }\n\n return resultNodes\n}\n\nexport function render(app: any, container: HTMLElement): () => void {\n container.innerHTML = ''\n\n if (typeof app === 'function') {\n app = { type: app, props: {}, children: [], key: undefined }\n }\n\n renderNode(app, container)\n\n // Return dispose function\n return () => {\n // Remove all component instances registered under this container\n if (instanceRegistry.has(container)) {\n const registry = instanceRegistry.get(container)!\n registry.forEach(instance => {\n removeComponentInstance(instance)\n })\n registry.clear()\n instanceRegistry.delete(container)\n }\n // Clear container\n container.innerHTML = ''\n }\n}\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var chunkBP5PDE6F_js=require('./chunk-BP5PDE6F.js'),chunkOU6XJZ76_js=require('./chunk-OU6XJZ76.js'),chunkKXZRGDXD_js=require('./chunk-KXZRGDXD.js');function P(t){if(!t)return {};if(typeof URLSearchParams<"u"){let e=new URLSearchParams(t),r={};return e.forEach((n,i)=>r[i]=n),r}return t.substring(1).split("&").reduce((e,r)=>{let[n,i]=r.split("=");return n&&(e[decodeURIComponent(n)]=decodeURIComponent(i||"")),e},{})}function F(t){return !!(!t||typeof t!="string"||t.length>2048||t.includes("__proto__")||t.includes("constructor")||/^\s*javascript:/i.test(t))}function v(t){let e=[];return t.forEach(r=>{if(!r)return;let{path:n,component:i,children:s,beforeEnter:l}=r.props||{},a={path:n||"/",component:i,beforeEnter:l};if(s){let g=Array.isArray(s)?s:[s];a.children=v(g);}!a.children&&r.children&&r.children.length>0&&(a.children=v(r.children)),e.push(a);}),e}function A(t,e){for(let r of t){let n=r.path,i=j(n,e);if(i)return [{route:r,params:i.params,pathname:i.path}]}return null}function j(t,e){let r=t.split("/").filter(Boolean),n=e.split("/").filter(Boolean);if(r.length!==n.length)return null;let i={};for(let s=0;s<r.length;s++){let l=r[s],a=n[s];if(l.startsWith(":")){let g=l.slice(1);i[g]=a;}else if(l!==a)return null}return {params:i,path:e}}var b=new chunkOU6XJZ76_js.f(null),d=new chunkOU6XJZ76_js.f(0),_=()=>({pathname:"/",search:"",hash:"",query:{}}),S=()=>{if(typeof window>"u")return _();let t=window.location.pathname;return (!t||t==="srcdoc"||t==="/srcdoc")&&(t="/"),{pathname:t,search:window.location.search,hash:window.location.hash,query:P(window.location.search)}},c=null,f=null,q=false;function I(){c=null,f=null;}function h(){if(c&&f)return [c,f];c=chunkBP5PDE6F_js.a(S());let t=e=>{c&&(c.pathname=e.pathname,c.search=e.search,c.hash=e.hash,c.query=e.query);};return f=e=>{if(typeof window>"u"||F(e))return;try{window.history.pushState({},"",e);}catch{}let r={pathname:e.split("?")[0].split("#")[0],search:e.includes("?")?"?"+e.split("?")[1].split("#")[0]:"",hash:e.includes("#")?"#"+e.split("#")[1]:"",query:P(e.includes("?")?"?"+e.split("?")[1].split("#")[0]:"")};t(r);},typeof window<"u"&&!q&&(window.addEventListener("popstate",()=>{t(S());}),q=true),[c,f]}function C(){let[t]=chunkBP5PDE6F_js.c(b);if(!t)throw new Error("useRouter() must be called within a <Routes> component");return t}function Q(){let[,t]=h();return t}function N(){return f||h(),f}function M(){return C().params}function B(){let[t]=h();return t.query}function p(t){return null}function R(t){return t&&typeof t=="object"&&("type"in t||Array.isArray(t))}function O(t){let[e,r]=h(),n=Array.isArray(t.children)?t.children:[t.children],i=n.filter(o=>R(o)&&o.type===p),s=n.findIndex(o=>R(o)&&o.type===p),l=[],a=[];s===-1?l=n.filter(o=>!R(o)||o.type!==p):(l=n.slice(0,s).filter(o=>!R(o)||o.type!==p),a=n.slice(s).filter(o=>!R(o)||o.type!==p));let g=v(i),k=e.pathname,m=A(g,k)||[],T=m.length>0?m[m.length-1].params:{},U={location:e,navigate:r,matches:m,params:T},w=null;if(m.length>0){let o=m[0],D=o.route.component,x=k;o.route.beforeEnter?o.route.beforeEnter(o.params)!==false&&(w=chunkKXZRGDXD_js.a(d.Provider,{value:1,key:x,children:chunkKXZRGDXD_js.a(D,{params:o.params,key:x})})):w=chunkKXZRGDXD_js.a(d.Provider,{value:1,key:x,children:chunkKXZRGDXD_js.a(D,{params:o.params,key:x})});}return chunkKXZRGDXD_js.a(b.Provider,{value:U,children:[...l,w,...a]})}function K(){let t=C(),[e]=chunkBP5PDE6F_js.c(d),r=e??0,[n]=chunkBP5PDE6F_js.c(()=>t.matches);if(r>=n.length)return null;let i=n[r],s=i.route.component;return i.route.beforeEnter&&i.route.beforeEnter(i.params)===false?null:chunkKXZRGDXD_js.a(d.Provider,{value:r+1,children:chunkKXZRGDXD_js.a(s,{params:i.params})})}function V(t){return chunkKXZRGDXD_js.a("a",{href:t.to,class:t.class||t.className,style:t.style?t.style+"; cursor: pointer;":"cursor: pointer;",onclick:e=>{e.preventDefault(),N()(t.to);},children:t.children})}exports.a=I;exports.b=h;exports.c=C;exports.d=Q;exports.e=N;exports.f=M;exports.g=B;exports.h=p;exports.i=O;exports.j=K;exports.k=V;//# sourceMappingURL=chunk-SMVFW7HP.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-SMVFW7HP.js.map
|