@jasonshimmy/custom-elements-runtime 3.4.0 → 3.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -7
- package/dist/css-utils-Bn-dO44e.js +203 -0
- package/dist/{css-utils-CC43BbEy.js.map → css-utils-Bn-dO44e.js.map} +1 -1
- package/dist/{css-utils-CC43BbEy.js → css-utils-CFeP8SK1.cjs} +5 -71
- package/dist/{css-utils-mgjmH8qX.cjs.map → css-utils-CFeP8SK1.cjs.map} +1 -1
- package/dist/custom-elements-runtime.cjs.js +3 -4
- package/dist/custom-elements-runtime.cjs.js.map +1 -1
- package/dist/custom-elements-runtime.colors.cjs.js +1 -2
- package/dist/custom-elements-runtime.colors.cjs.js.map +1 -1
- package/dist/custom-elements-runtime.colors.es.js +277 -277
- package/dist/custom-elements-runtime.colors.es.js.map +1 -1
- package/dist/custom-elements-runtime.directive-enhancements.cjs.js +1 -2
- package/dist/custom-elements-runtime.directive-enhancements.cjs.js.map +1 -1
- package/dist/custom-elements-runtime.directive-enhancements.es.js +106 -122
- package/dist/custom-elements-runtime.directive-enhancements.es.js.map +1 -1
- package/dist/custom-elements-runtime.directives.cjs.js +1 -2
- package/dist/custom-elements-runtime.directives.cjs.js.map +1 -1
- package/dist/custom-elements-runtime.directives.es.js +60 -65
- package/dist/custom-elements-runtime.directives.es.js.map +1 -1
- package/dist/custom-elements-runtime.dom-jit-css.cjs.js +1 -7
- package/dist/custom-elements-runtime.dom-jit-css.cjs.js.map +1 -1
- package/dist/custom-elements-runtime.dom-jit-css.es.js +103 -115
- package/dist/custom-elements-runtime.dom-jit-css.es.js.map +1 -1
- package/dist/custom-elements-runtime.es.js +206 -253
- package/dist/custom-elements-runtime.es.js.map +1 -1
- package/dist/custom-elements-runtime.event-bus.cjs.js +1 -2
- package/dist/custom-elements-runtime.event-bus.cjs.js.map +1 -1
- package/dist/custom-elements-runtime.event-bus.es.js +102 -108
- package/dist/custom-elements-runtime.event-bus.es.js.map +1 -1
- package/dist/custom-elements-runtime.jit-css.cjs.js +1 -2
- package/dist/custom-elements-runtime.jit-css.cjs.js.map +1 -1
- package/dist/custom-elements-runtime.jit-css.es.js +14 -32
- package/dist/custom-elements-runtime.jit-css.es.js.map +1 -1
- package/dist/custom-elements-runtime.router.cjs.js +20 -21
- package/dist/custom-elements-runtime.router.cjs.js.map +1 -1
- package/dist/custom-elements-runtime.router.es.js +866 -926
- package/dist/custom-elements-runtime.router.es.js.map +1 -1
- package/dist/custom-elements-runtime.ssr-middleware.cjs.js +3 -4
- package/dist/custom-elements-runtime.ssr-middleware.cjs.js.map +1 -1
- package/dist/custom-elements-runtime.ssr-middleware.es.js +67 -73
- package/dist/custom-elements-runtime.ssr-middleware.es.js.map +1 -1
- package/dist/custom-elements-runtime.ssr.cjs.js +1 -1
- package/dist/custom-elements-runtime.ssr.es.js +3 -14
- package/dist/custom-elements-runtime.store.cjs.js +1 -2
- package/dist/custom-elements-runtime.store.cjs.js.map +1 -1
- package/dist/custom-elements-runtime.store.es.js +32 -33
- package/dist/custom-elements-runtime.store.es.js.map +1 -1
- package/dist/custom-elements-runtime.transitions.cjs.js +1 -2
- package/dist/custom-elements-runtime.transitions.cjs.js.map +1 -1
- package/dist/custom-elements-runtime.transitions.es.js +200 -210
- package/dist/custom-elements-runtime.transitions.es.js.map +1 -1
- package/dist/custom-elements-runtime.vite-plugin.cjs.js +4 -2
- package/dist/custom-elements-runtime.vite-plugin.cjs.js.map +1 -1
- package/dist/custom-elements-runtime.vite-plugin.es.js +155 -78
- package/dist/custom-elements-runtime.vite-plugin.es.js.map +1 -1
- package/dist/helpers-7zLtbh_q.cjs +5 -0
- package/dist/helpers-7zLtbh_q.cjs.map +1 -0
- package/dist/helpers-kOWgceUQ.js +696 -0
- package/dist/helpers-kOWgceUQ.js.map +1 -0
- package/dist/hooks-BY_35J9Y.cjs +2 -0
- package/dist/hooks-BY_35J9Y.cjs.map +1 -0
- package/dist/hooks-Dj1xwqpK.js +407 -0
- package/dist/hooks-Dj1xwqpK.js.map +1 -0
- package/dist/logger-DIJ0UH3R.js +36 -0
- package/dist/{logger-L25axmB-.js.map → logger-DIJ0UH3R.js.map} +1 -1
- package/dist/logger-Dkht1dCX.cjs +2 -0
- package/dist/{logger-BYIN7ysT.cjs.map → logger-Dkht1dCX.cjs.map} +1 -1
- package/dist/namespace-helpers-CIUkG8Mn.js +56 -0
- package/dist/{namespace-helpers-BucDdgz_.js.map → namespace-helpers-CIUkG8Mn.js.map} +1 -1
- package/dist/namespace-helpers-yYIb7INq.cjs +2 -0
- package/dist/{namespace-helpers-Bf7rm9JV.cjs.map → namespace-helpers-yYIb7INq.cjs.map} +1 -1
- package/dist/runtime/tag-utils.d.ts +11 -0
- package/dist/ssr-Bg9jYXYv.js +171 -0
- package/dist/{ssr-H9GDwbTy.js.map → ssr-Bg9jYXYv.js.map} +1 -1
- package/dist/ssr-CucZ-Iwz.cjs +4 -0
- package/dist/{ssr-DRsGduIK.cjs.map → ssr-CucZ-Iwz.cjs.map} +1 -1
- package/dist/ssr.d.ts +2 -0
- package/dist/style-A8l3aQ52.cjs +55 -0
- package/dist/{style-Bjn8zDiZ.cjs.map → style-A8l3aQ52.cjs.map} +1 -1
- package/dist/style-DSSoCbC9.js +1877 -0
- package/dist/{style-DuDoj_xK.js.map → style-DSSoCbC9.js.map} +1 -1
- package/dist/tag-utils-Dg0vRKq9.js +10 -0
- package/dist/tag-utils-Dg0vRKq9.js.map +1 -0
- package/dist/tag-utils-ZOoyzCm9.cjs +2 -0
- package/dist/tag-utils-ZOoyzCm9.cjs.map +1 -0
- package/dist/template-compiler-BJRZoRzZ.js +3044 -0
- package/dist/{template-compiler-Cs5axmn4.js.map → template-compiler-BJRZoRzZ.js.map} +1 -1
- package/dist/template-compiler-C0SkzB_f.cjs +19 -0
- package/dist/{template-compiler-BB4JJdqk.cjs.map → template-compiler-C0SkzB_f.cjs.map} +1 -1
- package/dist/vite-plugin.d.ts +96 -2
- package/package.json +8 -8
- package/dist/css-utils-mgjmH8qX.cjs +0 -577
- package/dist/hooks-_3xP4G2N.js +0 -1189
- package/dist/hooks-_3xP4G2N.js.map +0 -1
- package/dist/hooks-fYQgZk2g.cjs +0 -7
- package/dist/hooks-fYQgZk2g.cjs.map +0 -1
- package/dist/logger-BYIN7ysT.cjs +0 -3
- package/dist/logger-L25axmB-.js +0 -41
- package/dist/namespace-helpers-Bf7rm9JV.cjs +0 -3
- package/dist/namespace-helpers-BucDdgz_.js +0 -61
- package/dist/ssr-DRsGduIK.cjs +0 -5
- package/dist/ssr-H9GDwbTy.js +0 -172
- package/dist/style-Bjn8zDiZ.cjs +0 -56
- package/dist/style-DuDoj_xK.js +0 -1972
- package/dist/template-compiler-BB4JJdqk.cjs +0 -23
- package/dist/template-compiler-Cs5axmn4.js +0 -3236
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"css-utils-mgjmH8qX.cjs","names":[],"sources":["../src/lib/css/variables.css?raw","../src/lib/runtime/css-utils.ts","../src/lib/runtime/render-bridge.ts"],"sourcesContent":["export default \"/*\\n * Custom Elements Variables CSS\\n * Default fallback values\\n * \\n * Define your overrides in the document's :root to have them\\n * inherited into all Shadow DOM components:\\n * \\n * <style>\\n * :root {\\n * --cer-color-primary-500: #8b5cf6;\\n * --cer-font-sans: 'Inter', sans-serif;\\n * }\\n * </style>\\n * \\n * Note: Only :root is used here (not :host) so document-level\\n * overrides will inherit into Shadow DOM and take precedence.\\n */\\n\\n:root {\\n /* Font families (match runtime defaults in src/lib/runtime/style.ts) */\\n --cer-font-sans:\\n ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto,\\n 'Helvetica Neue', Arial, 'Noto Sans', sans-serif;\\n --cer-font-serif: ui-serif, Georgia, 'Times New Roman', Times, serif;\\n --cer-font-mono:\\n ui-monospace, 'SFMono-Regular', Menlo, Monaco, 'Roboto Mono', 'Courier New',\\n monospace;\\n\\n /* Default outline style */\\n --cer-outline-style: solid;\\n\\n /* Colors */\\n --cer-color-transparent: transparent;\\n --cer-color-current: currentColor;\\n --cer-color-black: #000000;\\n --cer-color-white: #ffffff;\\n --cer-color-inherit: inherit;\\n\\n /* neutral */\\n --cer-color-neutral-50: #fafafa;\\n --cer-color-neutral-100: #f4f4f5;\\n --cer-color-neutral-200: #e4e4e7;\\n --cer-color-neutral-300: #d4d4d8;\\n --cer-color-neutral-400: #9f9fa9;\\n --cer-color-neutral-500: #71717b;\\n --cer-color-neutral-600: #52525c;\\n --cer-color-neutral-700: #3f3f46;\\n --cer-color-neutral-800: #27272a;\\n --cer-color-neutral-900: #18181b;\\n --cer-color-neutral-950: #09090b;\\n\\n /* primary */\\n --cer-color-primary-50: #eff6ff;\\n --cer-color-primary-100: #dbeafe;\\n --cer-color-primary-200: #bfdbfe;\\n --cer-color-primary-300: #93c5fd;\\n --cer-color-primary-400: #60a5fa;\\n --cer-color-primary-500: #3b82f6;\\n --cer-color-primary-600: #2563eb;\\n --cer-color-primary-700: #1d4ed8;\\n --cer-color-primary-800: #1e40af;\\n --cer-color-primary-900: #1e3a8a;\\n --cer-color-primary-950: #172554;\\n\\n /* secondary */\\n --cer-color-secondary-50: #eef2ff;\\n --cer-color-secondary-100: #e0e7ff;\\n --cer-color-secondary-200: #c7d2fe;\\n --cer-color-secondary-300: #a5b4fc;\\n --cer-color-secondary-400: #818cf8;\\n --cer-color-secondary-500: #6366f1;\\n --cer-color-secondary-600: #4f46e5;\\n --cer-color-secondary-700: #4338ca;\\n --cer-color-secondary-800: #3730a3;\\n --cer-color-secondary-900: #312e81;\\n --cer-color-secondary-950: #1e1b4b;\\n\\n /* success */\\n --cer-color-success-50: #f0fdf4;\\n --cer-color-success-100: #dcfce7;\\n --cer-color-success-200: #bbf7d0;\\n --cer-color-success-300: #86efac;\\n --cer-color-success-400: #4ade80;\\n --cer-color-success-500: #22c55e;\\n --cer-color-success-600: #16a34a;\\n --cer-color-success-700: #15803d;\\n --cer-color-success-800: #166534;\\n --cer-color-success-900: #14532d;\\n --cer-color-success-950: #052e16;\\n\\n /* info */\\n --cer-color-info-50: #f0f9ff;\\n --cer-color-info-100: #e0f2fe;\\n --cer-color-info-200: #bae6fd;\\n --cer-color-info-300: #7dd3fc;\\n --cer-color-info-400: #38bdf8;\\n --cer-color-info-500: #0ea5e9;\\n --cer-color-info-600: #0284c7;\\n --cer-color-info-700: #0369a1;\\n --cer-color-info-800: #075985;\\n --cer-color-info-900: #0c4a6e;\\n --cer-color-info-950: #082f49;\\n\\n /* warning */\\n --cer-color-warning-50: #fffbeb;\\n --cer-color-warning-100: #fef3c7;\\n --cer-color-warning-200: #fde68a;\\n --cer-color-warning-300: #fcd34d;\\n --cer-color-warning-400: #fbbf24;\\n --cer-color-warning-500: #f59e0b;\\n --cer-color-warning-600: #d97706;\\n --cer-color-warning-700: #b45309;\\n --cer-color-warning-800: #92400e;\\n --cer-color-warning-900: #78350f;\\n --cer-color-warning-950: #451a03;\\n\\n /* error */\\n --cer-color-error-50: #fef2f2;\\n --cer-color-error-100: #fee2e2;\\n --cer-color-error-200: #fecaca;\\n --cer-color-error-300: #fca5a5;\\n --cer-color-error-400: #f87171;\\n --cer-color-error-500: #ef4444;\\n --cer-color-error-600: #dc2626;\\n --cer-color-error-700: #b91c1c;\\n --cer-color-error-800: #991b1b;\\n --cer-color-error-900: #7f1d1d;\\n --cer-color-error-950: #450a0a;\\n\\n /* Extended Tailwind palette — override to theme these colors */\\n /* slate */\\n --cer-color-slate-50: #f8fafc;\\n --cer-color-slate-100: #f1f5f9;\\n --cer-color-slate-200: #e2e8f0;\\n --cer-color-slate-300: #cbd5e1;\\n --cer-color-slate-400: #94a3b8;\\n --cer-color-slate-500: #64748b;\\n --cer-color-slate-600: #475569;\\n --cer-color-slate-700: #334155;\\n --cer-color-slate-800: #1e293b;\\n --cer-color-slate-900: #0f172a;\\n --cer-color-slate-950: #020617;\\n /* gray */\\n --cer-color-gray-50: #f9fafb;\\n --cer-color-gray-100: #f3f4f6;\\n --cer-color-gray-200: #e5e7eb;\\n --cer-color-gray-300: #d1d5db;\\n --cer-color-gray-400: #9ca3af;\\n --cer-color-gray-500: #6b7280;\\n --cer-color-gray-600: #4b5563;\\n --cer-color-gray-700: #374151;\\n --cer-color-gray-800: #1f2937;\\n --cer-color-gray-900: #111827;\\n --cer-color-gray-950: #030712;\\n /* zinc */\\n --cer-color-zinc-50: #fafafa;\\n --cer-color-zinc-100: #f4f4f5;\\n --cer-color-zinc-200: #e4e4e7;\\n --cer-color-zinc-300: #d4d4d8;\\n --cer-color-zinc-400: #a1a1aa;\\n --cer-color-zinc-500: #71717a;\\n --cer-color-zinc-600: #52525b;\\n --cer-color-zinc-700: #3f3f46;\\n --cer-color-zinc-800: #27272a;\\n --cer-color-zinc-900: #18181b;\\n --cer-color-zinc-950: #09090b;\\n /* stone */\\n --cer-color-stone-50: #fafaf9;\\n --cer-color-stone-100: #f5f5f4;\\n --cer-color-stone-200: #e7e5e4;\\n --cer-color-stone-300: #d6d3d1;\\n --cer-color-stone-400: #a8a29e;\\n --cer-color-stone-500: #78716c;\\n --cer-color-stone-600: #57534e;\\n --cer-color-stone-700: #44403c;\\n --cer-color-stone-800: #292524;\\n --cer-color-stone-900: #1c1917;\\n --cer-color-stone-950: #0c0a09;\\n /* red */\\n --cer-color-red-50: #fef2f2;\\n --cer-color-red-100: #fee2e2;\\n --cer-color-red-200: #fecaca;\\n --cer-color-red-300: #fca5a5;\\n --cer-color-red-400: #f87171;\\n --cer-color-red-500: #ef4444;\\n --cer-color-red-600: #dc2626;\\n --cer-color-red-700: #b91c1c;\\n --cer-color-red-800: #991b1b;\\n --cer-color-red-900: #7f1d1d;\\n --cer-color-red-950: #450a0a;\\n /* orange */\\n --cer-color-orange-50: #fff7ed;\\n --cer-color-orange-100: #ffedd5;\\n --cer-color-orange-200: #fed7aa;\\n --cer-color-orange-300: #fdba74;\\n --cer-color-orange-400: #fb923c;\\n --cer-color-orange-500: #f97316;\\n --cer-color-orange-600: #ea580c;\\n --cer-color-orange-700: #c2410c;\\n --cer-color-orange-800: #9a3412;\\n --cer-color-orange-900: #7c2d12;\\n --cer-color-orange-950: #431407;\\n /* amber */\\n --cer-color-amber-50: #fffbeb;\\n --cer-color-amber-100: #fef3c7;\\n --cer-color-amber-200: #fde68a;\\n --cer-color-amber-300: #fcd34d;\\n --cer-color-amber-400: #fbbf24;\\n --cer-color-amber-500: #f59e0b;\\n --cer-color-amber-600: #d97706;\\n --cer-color-amber-700: #b45309;\\n --cer-color-amber-800: #92400e;\\n --cer-color-amber-900: #78350f;\\n --cer-color-amber-950: #451a03;\\n /* yellow */\\n --cer-color-yellow-50: #fefce8;\\n --cer-color-yellow-100: #fef9c3;\\n --cer-color-yellow-200: #fef08a;\\n --cer-color-yellow-300: #fde047;\\n --cer-color-yellow-400: #facc15;\\n --cer-color-yellow-500: #eab308;\\n --cer-color-yellow-600: #ca8a04;\\n --cer-color-yellow-700: #a16207;\\n --cer-color-yellow-800: #854d0e;\\n --cer-color-yellow-900: #713f12;\\n --cer-color-yellow-950: #422006;\\n /* lime */\\n --cer-color-lime-50: #f7fee7;\\n --cer-color-lime-100: #ecfccb;\\n --cer-color-lime-200: #d9f99d;\\n --cer-color-lime-300: #bef264;\\n --cer-color-lime-400: #a3e635;\\n --cer-color-lime-500: #84cc16;\\n --cer-color-lime-600: #65a30d;\\n --cer-color-lime-700: #4d7c0f;\\n --cer-color-lime-800: #3f6212;\\n --cer-color-lime-900: #365314;\\n --cer-color-lime-950: #1a2e05;\\n /* green */\\n --cer-color-green-50: #f0fdf4;\\n --cer-color-green-100: #dcfce7;\\n --cer-color-green-200: #bbf7d0;\\n --cer-color-green-300: #86efac;\\n --cer-color-green-400: #4ade80;\\n --cer-color-green-500: #22c55e;\\n --cer-color-green-600: #16a34a;\\n --cer-color-green-700: #15803d;\\n --cer-color-green-800: #166534;\\n --cer-color-green-900: #14532d;\\n --cer-color-green-950: #052e16;\\n /* emerald */\\n --cer-color-emerald-50: #ecfdf5;\\n --cer-color-emerald-100: #d1fae5;\\n --cer-color-emerald-200: #a7f3d0;\\n --cer-color-emerald-300: #6ee7b7;\\n --cer-color-emerald-400: #34d399;\\n --cer-color-emerald-500: #10b981;\\n --cer-color-emerald-600: #059669;\\n --cer-color-emerald-700: #047857;\\n --cer-color-emerald-800: #065f46;\\n --cer-color-emerald-900: #064e3b;\\n --cer-color-emerald-950: #022c22;\\n /* teal */\\n --cer-color-teal-50: #f0fdfa;\\n --cer-color-teal-100: #ccfbf1;\\n --cer-color-teal-200: #99f6e4;\\n --cer-color-teal-300: #5eead4;\\n --cer-color-teal-400: #2dd4bf;\\n --cer-color-teal-500: #14b8a6;\\n --cer-color-teal-600: #0d9488;\\n --cer-color-teal-700: #0f766e;\\n --cer-color-teal-800: #115e59;\\n --cer-color-teal-900: #134e4a;\\n --cer-color-teal-950: #042f2e;\\n /* cyan */\\n --cer-color-cyan-50: #ecfeff;\\n --cer-color-cyan-100: #cffafe;\\n --cer-color-cyan-200: #a5f3fc;\\n --cer-color-cyan-300: #67e8f9;\\n --cer-color-cyan-400: #22d3ee;\\n --cer-color-cyan-500: #06b6d4;\\n --cer-color-cyan-600: #0891b2;\\n --cer-color-cyan-700: #0e7490;\\n --cer-color-cyan-800: #155e75;\\n --cer-color-cyan-900: #164e63;\\n --cer-color-cyan-950: #083344;\\n /* sky */\\n --cer-color-sky-50: #f0f9ff;\\n --cer-color-sky-100: #e0f2fe;\\n --cer-color-sky-200: #bae6fd;\\n --cer-color-sky-300: #7dd3fc;\\n --cer-color-sky-400: #38bdf8;\\n --cer-color-sky-500: #0ea5e9;\\n --cer-color-sky-600: #0284c7;\\n --cer-color-sky-700: #0369a1;\\n --cer-color-sky-800: #075985;\\n --cer-color-sky-900: #0c4a6e;\\n --cer-color-sky-950: #082f49;\\n /* blue */\\n --cer-color-blue-50: #eff6ff;\\n --cer-color-blue-100: #dbeafe;\\n --cer-color-blue-200: #bfdbfe;\\n --cer-color-blue-300: #93c5fd;\\n --cer-color-blue-400: #60a5fa;\\n --cer-color-blue-500: #3b82f6;\\n --cer-color-blue-600: #2563eb;\\n --cer-color-blue-700: #1d4ed8;\\n --cer-color-blue-800: #1e40af;\\n --cer-color-blue-900: #1e3a8a;\\n --cer-color-blue-950: #172554;\\n /* indigo */\\n --cer-color-indigo-50: #eef2ff;\\n --cer-color-indigo-100: #e0e7ff;\\n --cer-color-indigo-200: #c7d2fe;\\n --cer-color-indigo-300: #a5b4fc;\\n --cer-color-indigo-400: #818cf8;\\n --cer-color-indigo-500: #6366f1;\\n --cer-color-indigo-600: #4f46e5;\\n --cer-color-indigo-700: #4338ca;\\n --cer-color-indigo-800: #3730a3;\\n --cer-color-indigo-900: #312e81;\\n --cer-color-indigo-950: #1e1b4b;\\n /* violet */\\n --cer-color-violet-50: #f5f3ff;\\n --cer-color-violet-100: #ede9fe;\\n --cer-color-violet-200: #ddd6fe;\\n --cer-color-violet-300: #c4b5fd;\\n --cer-color-violet-400: #a78bfa;\\n --cer-color-violet-500: #8b5cf6;\\n --cer-color-violet-600: #7c3aed;\\n --cer-color-violet-700: #6d28d9;\\n --cer-color-violet-800: #5b21b6;\\n --cer-color-violet-900: #4c1d95;\\n --cer-color-violet-950: #2e1065;\\n /* purple */\\n --cer-color-purple-50: #faf5ff;\\n --cer-color-purple-100: #f3e8ff;\\n --cer-color-purple-200: #e9d5ff;\\n --cer-color-purple-300: #d8b4fe;\\n --cer-color-purple-400: #c084fc;\\n --cer-color-purple-500: #a855f7;\\n --cer-color-purple-600: #9333ea;\\n --cer-color-purple-700: #7e22ce;\\n --cer-color-purple-800: #6b21a8;\\n --cer-color-purple-900: #581c87;\\n --cer-color-purple-950: #3b0764;\\n /* fuchsia */\\n --cer-color-fuchsia-50: #fdf4ff;\\n --cer-color-fuchsia-100: #fae8ff;\\n --cer-color-fuchsia-200: #f5d0fe;\\n --cer-color-fuchsia-300: #f0abfc;\\n --cer-color-fuchsia-400: #e879f9;\\n --cer-color-fuchsia-500: #d946ef;\\n --cer-color-fuchsia-600: #c026d3;\\n --cer-color-fuchsia-700: #a21caf;\\n --cer-color-fuchsia-800: #86198f;\\n --cer-color-fuchsia-900: #701a75;\\n --cer-color-fuchsia-950: #4a044e;\\n /* pink */\\n --cer-color-pink-50: #fdf2f8;\\n --cer-color-pink-100: #fce7f3;\\n --cer-color-pink-200: #fbcfe8;\\n --cer-color-pink-300: #f9a8d4;\\n --cer-color-pink-400: #f472b6;\\n --cer-color-pink-500: #ec4899;\\n --cer-color-pink-600: #db2777;\\n --cer-color-pink-700: #be185d;\\n --cer-color-pink-800: #9d174d;\\n --cer-color-pink-900: #831843;\\n --cer-color-pink-950: #500724;\\n /* rose */\\n --cer-color-rose-50: #fff1f2;\\n --cer-color-rose-100: #ffe4e6;\\n --cer-color-rose-200: #fecdd3;\\n --cer-color-rose-300: #fda4af;\\n --cer-color-rose-400: #fb7185;\\n --cer-color-rose-500: #f43f5e;\\n --cer-color-rose-600: #e11d48;\\n --cer-color-rose-700: #be123c;\\n --cer-color-rose-800: #9f1239;\\n --cer-color-rose-900: #881337;\\n --cer-color-rose-950: #4c0519;\\n}\\n\\n/* @property registrations for CSS transition composability */\\n@property --cer-rotate {\\n syntax: '<angle>';\\n initial-value: 0deg;\\n inherits: false;\\n}\\n@property --cer-translate-x {\\n syntax: '<length>';\\n initial-value: 0px;\\n inherits: false;\\n}\\n@property --cer-translate-y {\\n syntax: '<length>';\\n initial-value: 0px;\\n inherits: false;\\n}\\n@property --cer-skew-x {\\n syntax: '<angle>';\\n initial-value: 0deg;\\n inherits: false;\\n}\\n@property --cer-skew-y {\\n syntax: '<angle>';\\n initial-value: 0deg;\\n inherits: false;\\n}\\n@property --cer-scale-x {\\n syntax: '<number>';\\n initial-value: 1;\\n inherits: false;\\n}\\n@property --cer-scale-y {\\n syntax: '<number>';\\n initial-value: 1;\\n inherits: false;\\n}\\n/* Filter composition variables (--cer-blur, --cer-brightness, etc.) intentionally\\n omit @property registration because their \\\"no-op\\\" value is empty string (''),\\n which is not a valid CSS initial-value. They compose correctly without Houdini. */\\n@property --cer-opacity {\\n syntax: '<number>';\\n initial-value: 1;\\n inherits: false;\\n}\\n\"","/**\n * Pure CSS utility functions — no JIT dependencies, no module-level side effects.\n *\n * Extracted so that render.ts and hooks.ts can import lightweight CSS helpers\n * without pulling the entire JIT CSS engine into every consumer's bundle.\n */\n\nimport variables from '../css/variables.css?raw';\n\n/**\n * CSS template literal tag\n */\nexport function css(\n strings: TemplateStringsArray,\n ...values: unknown[]\n): string {\n let result = '';\n for (let i = 0; i < strings.length; i++) {\n result += strings[i];\n if (i < values.length) result += values[i];\n }\n return result;\n}\n\n/**\n * CSS minification utility (basic)\n */\nexport function minifyCSS(input: string): string {\n return input\n .replace(/\\/\\*[\\s\\S]*?\\*\\//g, '')\n .replace(/\\s+/g, ' ')\n .replace(/\\s*([{}:;,>~])\\s*/g, '$1')\n .replace(/;}/g, '}')\n .trim();\n}\n\n/**\n * Sanitize CSS to prevent injection attacks (XSS, javascript: URLs, expression(), etc.)\n */\nexport function sanitizeCSS(input: string): string {\n return input\n // Remove @charset rules (can alter encoding interpretation in some parsers)\n .replace(/@charset\\s+[^;]*;/gi, '')\n // Remove javascript: URL references inside url()\n .replace(/url\\s*\\(\\s*['\"]?javascript:[^)]*\\)/gi, '')\n // Remove data: URI references inside url() (can embed scripts/SVGs)\n .replace(/url\\s*\\(\\s*['\"]?data:[^)]*\\)/gi, '')\n // Remove @import rules (can load external malicious stylesheets)\n .replace(/@import\\s[^;{]*/gi, '')\n // Remove IE-era -moz-binding and behavior properties\n .replace(/-moz-binding\\s*:[^;]*/gi, '')\n .replace(/\\bbehavior\\s*:[^;]*/gi, '')\n // Remove <script> tags that may be injected alongside CSS\n .replace(/<script[\\s\\S]*?>[\\s\\S]*?<\\/script>/gi, '')\n // Remove IE expression() calls\n .replace(/expression\\s*\\([^)]*\\)/gi, '');\n}\n\n/**\n * Polyfill for CSS.escape() for SSR environments.\n * Based on https://drafts.csswg.org/cssom/#serialize-an-identifier\n */\nexport function cssEscape(value: string): string {\n if (typeof CSS !== 'undefined' && CSS.escape) {\n return CSS.escape(value);\n }\n\n const str = String(value);\n const length = str.length;\n let result = '';\n let i = 0;\n\n while (i < length) {\n const char = str.charAt(i);\n const code = str.charCodeAt(i);\n\n if (code === 0x0000) {\n result += '\\uFFFD';\n } else if (\n (code >= 0x0001 && code <= 0x001f) ||\n code === 0x007f ||\n (i === 0 && code >= 0x0030 && code <= 0x0039) ||\n (i === 1 &&\n code >= 0x0030 &&\n code <= 0x0039 &&\n str.charCodeAt(0) === 0x002d)\n ) {\n result += '\\\\' + code.toString(16) + ' ';\n } else if (i === 0 && length === 1 && code === 0x002d) {\n result += '\\\\' + char;\n } else if (\n code >= 0x0080 ||\n code === 0x002d ||\n code === 0x005f ||\n (code >= 0x0030 && code <= 0x0039) ||\n (code >= 0x0041 && code <= 0x005a) ||\n (code >= 0x0061 && code <= 0x007a)\n ) {\n result += char;\n } else {\n result += '\\\\' + char;\n }\n\n i++;\n }\n\n return result;\n}\n\n/** Escape a class name and prefix it with a dot for use in CSS selectors. */\nexport function escapeClassName(name: string): string {\n return '.' + cssEscape(name);\n}\n\n/** Escape a string for use in a RegExp. */\nexport function escapeRegExp(str: string): string {\n return str.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n}\n\n// --- Base reset stylesheet ---\n\nexport const baseReset = css`\n ${variables}\n :host,\n *,\n ::before,\n ::after {\n all: isolate;\n box-sizing: border-box;\n border: 0 solid currentColor;\n margin: 0;\n padding: 0;\n font: inherit;\n vertical-align: baseline;\n background: transparent;\n color: inherit;\n -webkit-tap-highlight-color: transparent;\n /* Transform composition variables (reset per-element for composability) */\n --cer-translate-x: 0px;\n --cer-translate-y: 0px;\n --cer-rotate: 0deg;\n --cer-skew-x: 0deg;\n --cer-skew-y: 0deg;\n --cer-scale-x: 1;\n --cer-scale-y: 1;\n /* Ring variables */\n --cer-ring-color: rgb(59 130 246 / 0.5);\n /* Filter composition variables (empty = no-op in filter chain) */\n --cer-blur: ;\n --cer-brightness: ;\n --cer-contrast: ;\n --cer-grayscale: ;\n --cer-hue-rotate: ;\n --cer-invert: ;\n --cer-saturate: ;\n --cer-sepia: ;\n --cer-drop-shadow: ;\n --cer-backdrop-blur: ;\n --cer-backdrop-brightness: ;\n --cer-backdrop-contrast: ;\n --cer-backdrop-grayscale: ;\n --cer-backdrop-hue-rotate: ;\n --cer-backdrop-invert: ;\n --cer-backdrop-saturate: ;\n --cer-backdrop-sepia: ;\n }\n :host {\n display: contents;\n font: 16px/1.5 var(--cer-font-sans, ui-sans-serif, system-ui, sans-serif);\n /* Default CE line-height variable so leading-* can reliably override */\n --cer-line-height: 1.5;\n -webkit-text-size-adjust: 100%;\n text-size-adjust: 100%;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n /* Default gradient variables to avoid undefined var() usage in generated utilities */\n --cer-gradient-from-position: 0%;\n --cer-gradient-to-position: 100%;\n --cer-gradient-via-position: 50%;\n --cer-gradient-from: rgba(255, 255, 255, 0);\n --cer-gradient-to: rgba(255, 255, 255, 0);\n --cer-gradient-stops: var(--cer-gradient-from), var(--cer-gradient-to);\n /* Default outline style variable */\n --cer-outline-style: solid;\n }\n button,\n input,\n select,\n textarea {\n background: transparent;\n outline: none;\n }\n textarea {\n resize: vertical;\n }\n progress {\n vertical-align: baseline;\n }\n button,\n textarea {\n overflow: visible;\n }\n img,\n svg,\n video,\n canvas,\n audio,\n iframe,\n embed,\n object {\n display: block;\n max-width: 100%;\n height: auto;\n }\n svg {\n fill: currentColor;\n stroke: none;\n }\n a {\n text-decoration: inherit;\n cursor: pointer;\n }\n button,\n [type='button'],\n [type='reset'],\n [type='submit'] {\n cursor: pointer;\n appearance: button;\n background: none;\n -webkit-user-select: none;\n user-select: none;\n }\n ::-webkit-input-placeholder,\n ::placeholder {\n color: inherit;\n opacity: 0.5;\n }\n *:focus-visible {\n outline: 2px solid var(--cer-color-primary-500, #3b82f6);\n outline-offset: 2px;\n }\n ol,\n ul {\n list-style: none;\n }\n table {\n border-collapse: collapse;\n }\n sub,\n sup {\n font-size: 0.75em;\n line-height: 0;\n position: relative;\n }\n sub {\n bottom: -0.25em;\n }\n sup {\n top: -0.5em;\n }\n [disabled],\n [aria-disabled='true'] {\n cursor: not-allowed;\n }\n [hidden] {\n display: none;\n }\n`;\n\n/** Default spacing unit used by the JIT spacing scale. */\nexport const spacing = '0.25rem';\n\n// --- Base reset stylesheet singleton ---\n\nlet baseResetSheet: CSSStyleSheet | null = null;\n\nexport function getBaseResetSheet(): CSSStyleSheet {\n if (!baseResetSheet) {\n if (typeof CSSStyleSheet === 'undefined') {\n baseResetSheet = {\n cssRules: [],\n replaceSync: () => {},\n toString: () => minifyCSS(baseReset),\n } as unknown as CSSStyleSheet;\n } else {\n baseResetSheet = new CSSStyleSheet();\n baseResetSheet.replaceSync(minifyCSS(baseReset));\n }\n }\n return baseResetSheet;\n}\n\n/** Reset the base reset sheet singleton (for HMR). @internal */\nexport function _resetBaseResetSheet(): void {\n baseResetSheet = null;\n}\n","/**\n * Lazy render bridge — populated by style.ts when the JIT engine is imported.\n *\n * render.ts always imports this module (so it is always bundled), but\n * style.ts (the full JIT engine, ~24 KB gzip) is only bundled when the\n * consumer explicitly imports JIT CSS symbols such as `enableJITCSS` or\n * `useJITCSS`. When style.ts IS imported it registers itself here so that\n * render.ts can call back into the JIT engine without a static dependency.\n *\n * Result: consumers that never use JIT CSS get zero JIT code in their bundle.\n */\n\ntype JITChecker = (root: ShadowRoot) => boolean;\ntype JITProcessor = (html: string) => string;\ntype ProseSheetGetter = () => CSSStyleSheet | null;\n\nlet _jitChecker: JITChecker | null = null;\nlet _jitProcessor: JITProcessor | null = null;\nlet _proseGetter: ProseSheetGetter | null = null;\n\n/**\n * Register the JIT CSS engine with the render pipeline.\n * Called by style.ts at module load time so renders automatically get\n * JIT processing without render.ts needing to import style.ts directly.\n * @internal\n */\nexport function _registerRenderBridge(\n checker: JITChecker,\n processor: JITProcessor,\n proseGetter: ProseSheetGetter,\n): void {\n _jitChecker = checker;\n _jitProcessor = processor;\n _proseGetter = proseGetter;\n}\n\n/**\n * Returns true when JIT CSS should run for the given shadow root.\n * Returns false if the JIT engine is not loaded.\n */\nexport function isJITCSSActiveFor(root: ShadowRoot): boolean {\n return _jitChecker ? _jitChecker(root) : false;\n}\n\n/**\n * Run JIT CSS processing over the aggregated HTML string.\n * Returns empty string if the JIT engine is not loaded.\n */\nexport function processJITCSS(html: string): string {\n return _jitProcessor ? _jitProcessor(html) : '';\n}\n\n/**\n * Get the prose stylesheet singleton.\n * Returns null if the JIT engine is not loaded or no prose classes detected.\n */\nexport function getProseStyleSheet(): CSSStyleSheet | null {\n return _proseGetter ? _proseGetter() : null;\n}\n"],"mappings":"AAAA,IAAA,EAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAA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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAoJS,EAAU,UAInB,EAAuC,KAE3C,SAAgB,GAAmC,CACjD,OAAK,IACC,OAAO,cAAkB,IAC3B,EAAiB,CACf,SAAU,CAAA,EACV,YAAA,IAAmB,CAAA,EACnB,SAAA,IAAgB,EAAU,CAAA,IAG5B,EAAiB,IAAI,cACrB,EAAe,YAAY,EAAU,CAAA,CAAU,IAG5C,ECjRT,IAAI,EAAiC,KACjC,EAAqC,KACrC,EAAwC,KAQ5C,SAAgB,EACd,EACA,EACA,EACM,CACN,EAAc,EACd,EAAgB,EAChB,EAAe,EAOjB,SAAgB,EAAkB,EAA2B,CAC3D,OAAO,EAAc,EAAY,CAAA,EAAQ,GAO3C,SAAgB,EAAc,EAAsB,CAClD,OAAO,EAAgB,EAAc,CAAA,EAAQ,GAO/C,SAAgB,GAA2C,CACzD,OAAO,EAAe,EAAA,EAAiB"}
|
|
1
|
+
{"version":3,"file":"css-utils-CFeP8SK1.cjs","names":[],"sources":["../src/lib/css/variables.css?raw","../src/lib/runtime/css-utils.ts","../src/lib/runtime/render-bridge.ts"],"sourcesContent":["export default \"/*\\n * Custom Elements Variables CSS\\n * Default fallback values\\n * \\n * Define your overrides in the document's :root to have them\\n * inherited into all Shadow DOM components:\\n * \\n * <style>\\n * :root {\\n * --cer-color-primary-500: #8b5cf6;\\n * --cer-font-sans: 'Inter', sans-serif;\\n * }\\n * </style>\\n * \\n * Note: Only :root is used here (not :host) so document-level\\n * overrides will inherit into Shadow DOM and take precedence.\\n */\\n\\n:root {\\n /* Font families (match runtime defaults in src/lib/runtime/style.ts) */\\n --cer-font-sans:\\n ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto,\\n 'Helvetica Neue', Arial, 'Noto Sans', sans-serif;\\n --cer-font-serif: ui-serif, Georgia, 'Times New Roman', Times, serif;\\n --cer-font-mono:\\n ui-monospace, 'SFMono-Regular', Menlo, Monaco, 'Roboto Mono', 'Courier New',\\n monospace;\\n\\n /* Default outline style */\\n --cer-outline-style: solid;\\n\\n /* Colors */\\n --cer-color-transparent: transparent;\\n --cer-color-current: currentColor;\\n --cer-color-black: #000000;\\n --cer-color-white: #ffffff;\\n --cer-color-inherit: inherit;\\n\\n /* neutral */\\n --cer-color-neutral-50: #fafafa;\\n --cer-color-neutral-100: #f4f4f5;\\n --cer-color-neutral-200: #e4e4e7;\\n --cer-color-neutral-300: #d4d4d8;\\n --cer-color-neutral-400: #9f9fa9;\\n --cer-color-neutral-500: #71717b;\\n --cer-color-neutral-600: #52525c;\\n --cer-color-neutral-700: #3f3f46;\\n --cer-color-neutral-800: #27272a;\\n --cer-color-neutral-900: #18181b;\\n --cer-color-neutral-950: #09090b;\\n\\n /* primary */\\n --cer-color-primary-50: #eff6ff;\\n --cer-color-primary-100: #dbeafe;\\n --cer-color-primary-200: #bfdbfe;\\n --cer-color-primary-300: #93c5fd;\\n --cer-color-primary-400: #60a5fa;\\n --cer-color-primary-500: #3b82f6;\\n --cer-color-primary-600: #2563eb;\\n --cer-color-primary-700: #1d4ed8;\\n --cer-color-primary-800: #1e40af;\\n --cer-color-primary-900: #1e3a8a;\\n --cer-color-primary-950: #172554;\\n\\n /* secondary */\\n --cer-color-secondary-50: #eef2ff;\\n --cer-color-secondary-100: #e0e7ff;\\n --cer-color-secondary-200: #c7d2fe;\\n --cer-color-secondary-300: #a5b4fc;\\n --cer-color-secondary-400: #818cf8;\\n --cer-color-secondary-500: #6366f1;\\n --cer-color-secondary-600: #4f46e5;\\n --cer-color-secondary-700: #4338ca;\\n --cer-color-secondary-800: #3730a3;\\n --cer-color-secondary-900: #312e81;\\n --cer-color-secondary-950: #1e1b4b;\\n\\n /* success */\\n --cer-color-success-50: #f0fdf4;\\n --cer-color-success-100: #dcfce7;\\n --cer-color-success-200: #bbf7d0;\\n --cer-color-success-300: #86efac;\\n --cer-color-success-400: #4ade80;\\n --cer-color-success-500: #22c55e;\\n --cer-color-success-600: #16a34a;\\n --cer-color-success-700: #15803d;\\n --cer-color-success-800: #166534;\\n --cer-color-success-900: #14532d;\\n --cer-color-success-950: #052e16;\\n\\n /* info */\\n --cer-color-info-50: #f0f9ff;\\n --cer-color-info-100: #e0f2fe;\\n --cer-color-info-200: #bae6fd;\\n --cer-color-info-300: #7dd3fc;\\n --cer-color-info-400: #38bdf8;\\n --cer-color-info-500: #0ea5e9;\\n --cer-color-info-600: #0284c7;\\n --cer-color-info-700: #0369a1;\\n --cer-color-info-800: #075985;\\n --cer-color-info-900: #0c4a6e;\\n --cer-color-info-950: #082f49;\\n\\n /* warning */\\n --cer-color-warning-50: #fffbeb;\\n --cer-color-warning-100: #fef3c7;\\n --cer-color-warning-200: #fde68a;\\n --cer-color-warning-300: #fcd34d;\\n --cer-color-warning-400: #fbbf24;\\n --cer-color-warning-500: #f59e0b;\\n --cer-color-warning-600: #d97706;\\n --cer-color-warning-700: #b45309;\\n --cer-color-warning-800: #92400e;\\n --cer-color-warning-900: #78350f;\\n --cer-color-warning-950: #451a03;\\n\\n /* error */\\n --cer-color-error-50: #fef2f2;\\n --cer-color-error-100: #fee2e2;\\n --cer-color-error-200: #fecaca;\\n --cer-color-error-300: #fca5a5;\\n --cer-color-error-400: #f87171;\\n --cer-color-error-500: #ef4444;\\n --cer-color-error-600: #dc2626;\\n --cer-color-error-700: #b91c1c;\\n --cer-color-error-800: #991b1b;\\n --cer-color-error-900: #7f1d1d;\\n --cer-color-error-950: #450a0a;\\n\\n /* Extended Tailwind palette — override to theme these colors */\\n /* slate */\\n --cer-color-slate-50: #f8fafc;\\n --cer-color-slate-100: #f1f5f9;\\n --cer-color-slate-200: #e2e8f0;\\n --cer-color-slate-300: #cbd5e1;\\n --cer-color-slate-400: #94a3b8;\\n --cer-color-slate-500: #64748b;\\n --cer-color-slate-600: #475569;\\n --cer-color-slate-700: #334155;\\n --cer-color-slate-800: #1e293b;\\n --cer-color-slate-900: #0f172a;\\n --cer-color-slate-950: #020617;\\n /* gray */\\n --cer-color-gray-50: #f9fafb;\\n --cer-color-gray-100: #f3f4f6;\\n --cer-color-gray-200: #e5e7eb;\\n --cer-color-gray-300: #d1d5db;\\n --cer-color-gray-400: #9ca3af;\\n --cer-color-gray-500: #6b7280;\\n --cer-color-gray-600: #4b5563;\\n --cer-color-gray-700: #374151;\\n --cer-color-gray-800: #1f2937;\\n --cer-color-gray-900: #111827;\\n --cer-color-gray-950: #030712;\\n /* zinc */\\n --cer-color-zinc-50: #fafafa;\\n --cer-color-zinc-100: #f4f4f5;\\n --cer-color-zinc-200: #e4e4e7;\\n --cer-color-zinc-300: #d4d4d8;\\n --cer-color-zinc-400: #a1a1aa;\\n --cer-color-zinc-500: #71717a;\\n --cer-color-zinc-600: #52525b;\\n --cer-color-zinc-700: #3f3f46;\\n --cer-color-zinc-800: #27272a;\\n --cer-color-zinc-900: #18181b;\\n --cer-color-zinc-950: #09090b;\\n /* stone */\\n --cer-color-stone-50: #fafaf9;\\n --cer-color-stone-100: #f5f5f4;\\n --cer-color-stone-200: #e7e5e4;\\n --cer-color-stone-300: #d6d3d1;\\n --cer-color-stone-400: #a8a29e;\\n --cer-color-stone-500: #78716c;\\n --cer-color-stone-600: #57534e;\\n --cer-color-stone-700: #44403c;\\n --cer-color-stone-800: #292524;\\n --cer-color-stone-900: #1c1917;\\n --cer-color-stone-950: #0c0a09;\\n /* red */\\n --cer-color-red-50: #fef2f2;\\n --cer-color-red-100: #fee2e2;\\n --cer-color-red-200: #fecaca;\\n --cer-color-red-300: #fca5a5;\\n --cer-color-red-400: #f87171;\\n --cer-color-red-500: #ef4444;\\n --cer-color-red-600: #dc2626;\\n --cer-color-red-700: #b91c1c;\\n --cer-color-red-800: #991b1b;\\n --cer-color-red-900: #7f1d1d;\\n --cer-color-red-950: #450a0a;\\n /* orange */\\n --cer-color-orange-50: #fff7ed;\\n --cer-color-orange-100: #ffedd5;\\n --cer-color-orange-200: #fed7aa;\\n --cer-color-orange-300: #fdba74;\\n --cer-color-orange-400: #fb923c;\\n --cer-color-orange-500: #f97316;\\n --cer-color-orange-600: #ea580c;\\n --cer-color-orange-700: #c2410c;\\n --cer-color-orange-800: #9a3412;\\n --cer-color-orange-900: #7c2d12;\\n --cer-color-orange-950: #431407;\\n /* amber */\\n --cer-color-amber-50: #fffbeb;\\n --cer-color-amber-100: #fef3c7;\\n --cer-color-amber-200: #fde68a;\\n --cer-color-amber-300: #fcd34d;\\n --cer-color-amber-400: #fbbf24;\\n --cer-color-amber-500: #f59e0b;\\n --cer-color-amber-600: #d97706;\\n --cer-color-amber-700: #b45309;\\n --cer-color-amber-800: #92400e;\\n --cer-color-amber-900: #78350f;\\n --cer-color-amber-950: #451a03;\\n /* yellow */\\n --cer-color-yellow-50: #fefce8;\\n --cer-color-yellow-100: #fef9c3;\\n --cer-color-yellow-200: #fef08a;\\n --cer-color-yellow-300: #fde047;\\n --cer-color-yellow-400: #facc15;\\n --cer-color-yellow-500: #eab308;\\n --cer-color-yellow-600: #ca8a04;\\n --cer-color-yellow-700: #a16207;\\n --cer-color-yellow-800: #854d0e;\\n --cer-color-yellow-900: #713f12;\\n --cer-color-yellow-950: #422006;\\n /* lime */\\n --cer-color-lime-50: #f7fee7;\\n --cer-color-lime-100: #ecfccb;\\n --cer-color-lime-200: #d9f99d;\\n --cer-color-lime-300: #bef264;\\n --cer-color-lime-400: #a3e635;\\n --cer-color-lime-500: #84cc16;\\n --cer-color-lime-600: #65a30d;\\n --cer-color-lime-700: #4d7c0f;\\n --cer-color-lime-800: #3f6212;\\n --cer-color-lime-900: #365314;\\n --cer-color-lime-950: #1a2e05;\\n /* green */\\n --cer-color-green-50: #f0fdf4;\\n --cer-color-green-100: #dcfce7;\\n --cer-color-green-200: #bbf7d0;\\n --cer-color-green-300: #86efac;\\n --cer-color-green-400: #4ade80;\\n --cer-color-green-500: #22c55e;\\n --cer-color-green-600: #16a34a;\\n --cer-color-green-700: #15803d;\\n --cer-color-green-800: #166534;\\n --cer-color-green-900: #14532d;\\n --cer-color-green-950: #052e16;\\n /* emerald */\\n --cer-color-emerald-50: #ecfdf5;\\n --cer-color-emerald-100: #d1fae5;\\n --cer-color-emerald-200: #a7f3d0;\\n --cer-color-emerald-300: #6ee7b7;\\n --cer-color-emerald-400: #34d399;\\n --cer-color-emerald-500: #10b981;\\n --cer-color-emerald-600: #059669;\\n --cer-color-emerald-700: #047857;\\n --cer-color-emerald-800: #065f46;\\n --cer-color-emerald-900: #064e3b;\\n --cer-color-emerald-950: #022c22;\\n /* teal */\\n --cer-color-teal-50: #f0fdfa;\\n --cer-color-teal-100: #ccfbf1;\\n --cer-color-teal-200: #99f6e4;\\n --cer-color-teal-300: #5eead4;\\n --cer-color-teal-400: #2dd4bf;\\n --cer-color-teal-500: #14b8a6;\\n --cer-color-teal-600: #0d9488;\\n --cer-color-teal-700: #0f766e;\\n --cer-color-teal-800: #115e59;\\n --cer-color-teal-900: #134e4a;\\n --cer-color-teal-950: #042f2e;\\n /* cyan */\\n --cer-color-cyan-50: #ecfeff;\\n --cer-color-cyan-100: #cffafe;\\n --cer-color-cyan-200: #a5f3fc;\\n --cer-color-cyan-300: #67e8f9;\\n --cer-color-cyan-400: #22d3ee;\\n --cer-color-cyan-500: #06b6d4;\\n --cer-color-cyan-600: #0891b2;\\n --cer-color-cyan-700: #0e7490;\\n --cer-color-cyan-800: #155e75;\\n --cer-color-cyan-900: #164e63;\\n --cer-color-cyan-950: #083344;\\n /* sky */\\n --cer-color-sky-50: #f0f9ff;\\n --cer-color-sky-100: #e0f2fe;\\n --cer-color-sky-200: #bae6fd;\\n --cer-color-sky-300: #7dd3fc;\\n --cer-color-sky-400: #38bdf8;\\n --cer-color-sky-500: #0ea5e9;\\n --cer-color-sky-600: #0284c7;\\n --cer-color-sky-700: #0369a1;\\n --cer-color-sky-800: #075985;\\n --cer-color-sky-900: #0c4a6e;\\n --cer-color-sky-950: #082f49;\\n /* blue */\\n --cer-color-blue-50: #eff6ff;\\n --cer-color-blue-100: #dbeafe;\\n --cer-color-blue-200: #bfdbfe;\\n --cer-color-blue-300: #93c5fd;\\n --cer-color-blue-400: #60a5fa;\\n --cer-color-blue-500: #3b82f6;\\n --cer-color-blue-600: #2563eb;\\n --cer-color-blue-700: #1d4ed8;\\n --cer-color-blue-800: #1e40af;\\n --cer-color-blue-900: #1e3a8a;\\n --cer-color-blue-950: #172554;\\n /* indigo */\\n --cer-color-indigo-50: #eef2ff;\\n --cer-color-indigo-100: #e0e7ff;\\n --cer-color-indigo-200: #c7d2fe;\\n --cer-color-indigo-300: #a5b4fc;\\n --cer-color-indigo-400: #818cf8;\\n --cer-color-indigo-500: #6366f1;\\n --cer-color-indigo-600: #4f46e5;\\n --cer-color-indigo-700: #4338ca;\\n --cer-color-indigo-800: #3730a3;\\n --cer-color-indigo-900: #312e81;\\n --cer-color-indigo-950: #1e1b4b;\\n /* violet */\\n --cer-color-violet-50: #f5f3ff;\\n --cer-color-violet-100: #ede9fe;\\n --cer-color-violet-200: #ddd6fe;\\n --cer-color-violet-300: #c4b5fd;\\n --cer-color-violet-400: #a78bfa;\\n --cer-color-violet-500: #8b5cf6;\\n --cer-color-violet-600: #7c3aed;\\n --cer-color-violet-700: #6d28d9;\\n --cer-color-violet-800: #5b21b6;\\n --cer-color-violet-900: #4c1d95;\\n --cer-color-violet-950: #2e1065;\\n /* purple */\\n --cer-color-purple-50: #faf5ff;\\n --cer-color-purple-100: #f3e8ff;\\n --cer-color-purple-200: #e9d5ff;\\n --cer-color-purple-300: #d8b4fe;\\n --cer-color-purple-400: #c084fc;\\n --cer-color-purple-500: #a855f7;\\n --cer-color-purple-600: #9333ea;\\n --cer-color-purple-700: #7e22ce;\\n --cer-color-purple-800: #6b21a8;\\n --cer-color-purple-900: #581c87;\\n --cer-color-purple-950: #3b0764;\\n /* fuchsia */\\n --cer-color-fuchsia-50: #fdf4ff;\\n --cer-color-fuchsia-100: #fae8ff;\\n --cer-color-fuchsia-200: #f5d0fe;\\n --cer-color-fuchsia-300: #f0abfc;\\n --cer-color-fuchsia-400: #e879f9;\\n --cer-color-fuchsia-500: #d946ef;\\n --cer-color-fuchsia-600: #c026d3;\\n --cer-color-fuchsia-700: #a21caf;\\n --cer-color-fuchsia-800: #86198f;\\n --cer-color-fuchsia-900: #701a75;\\n --cer-color-fuchsia-950: #4a044e;\\n /* pink */\\n --cer-color-pink-50: #fdf2f8;\\n --cer-color-pink-100: #fce7f3;\\n --cer-color-pink-200: #fbcfe8;\\n --cer-color-pink-300: #f9a8d4;\\n --cer-color-pink-400: #f472b6;\\n --cer-color-pink-500: #ec4899;\\n --cer-color-pink-600: #db2777;\\n --cer-color-pink-700: #be185d;\\n --cer-color-pink-800: #9d174d;\\n --cer-color-pink-900: #831843;\\n --cer-color-pink-950: #500724;\\n /* rose */\\n --cer-color-rose-50: #fff1f2;\\n --cer-color-rose-100: #ffe4e6;\\n --cer-color-rose-200: #fecdd3;\\n --cer-color-rose-300: #fda4af;\\n --cer-color-rose-400: #fb7185;\\n --cer-color-rose-500: #f43f5e;\\n --cer-color-rose-600: #e11d48;\\n --cer-color-rose-700: #be123c;\\n --cer-color-rose-800: #9f1239;\\n --cer-color-rose-900: #881337;\\n --cer-color-rose-950: #4c0519;\\n}\\n\\n/* @property registrations for CSS transition composability */\\n@property --cer-rotate {\\n syntax: '<angle>';\\n initial-value: 0deg;\\n inherits: false;\\n}\\n@property --cer-translate-x {\\n syntax: '<length>';\\n initial-value: 0px;\\n inherits: false;\\n}\\n@property --cer-translate-y {\\n syntax: '<length>';\\n initial-value: 0px;\\n inherits: false;\\n}\\n@property --cer-skew-x {\\n syntax: '<angle>';\\n initial-value: 0deg;\\n inherits: false;\\n}\\n@property --cer-skew-y {\\n syntax: '<angle>';\\n initial-value: 0deg;\\n inherits: false;\\n}\\n@property --cer-scale-x {\\n syntax: '<number>';\\n initial-value: 1;\\n inherits: false;\\n}\\n@property --cer-scale-y {\\n syntax: '<number>';\\n initial-value: 1;\\n inherits: false;\\n}\\n/* Filter composition variables (--cer-blur, --cer-brightness, etc.) intentionally\\n omit @property registration because their \\\"no-op\\\" value is empty string (''),\\n which is not a valid CSS initial-value. They compose correctly without Houdini. */\\n@property --cer-opacity {\\n syntax: '<number>';\\n initial-value: 1;\\n inherits: false;\\n}\\n\"","/**\n * Pure CSS utility functions — no JIT dependencies, no module-level side effects.\n *\n * Extracted so that render.ts and hooks.ts can import lightweight CSS helpers\n * without pulling the entire JIT CSS engine into every consumer's bundle.\n */\n\nimport variables from '../css/variables.css?raw';\n\n/**\n * CSS template literal tag\n */\nexport function css(\n strings: TemplateStringsArray,\n ...values: unknown[]\n): string {\n let result = '';\n for (let i = 0; i < strings.length; i++) {\n result += strings[i];\n if (i < values.length) result += values[i];\n }\n return result;\n}\n\n/**\n * CSS minification utility (basic)\n */\nexport function minifyCSS(input: string): string {\n return input\n .replace(/\\/\\*[\\s\\S]*?\\*\\//g, '')\n .replace(/\\s+/g, ' ')\n .replace(/\\s*([{}:;,>~])\\s*/g, '$1')\n .replace(/;}/g, '}')\n .trim();\n}\n\n/**\n * Sanitize CSS to prevent injection attacks (XSS, javascript: URLs, expression(), etc.)\n */\nexport function sanitizeCSS(input: string): string {\n return input\n // Remove @charset rules (can alter encoding interpretation in some parsers)\n .replace(/@charset\\s+[^;]*;/gi, '')\n // Remove javascript: URL references inside url()\n .replace(/url\\s*\\(\\s*['\"]?javascript:[^)]*\\)/gi, '')\n // Remove data: URI references inside url() (can embed scripts/SVGs)\n .replace(/url\\s*\\(\\s*['\"]?data:[^)]*\\)/gi, '')\n // Remove @import rules (can load external malicious stylesheets)\n .replace(/@import\\s[^;{]*/gi, '')\n // Remove IE-era -moz-binding and behavior properties\n .replace(/-moz-binding\\s*:[^;]*/gi, '')\n .replace(/\\bbehavior\\s*:[^;]*/gi, '')\n // Remove <script> tags that may be injected alongside CSS\n .replace(/<script[\\s\\S]*?>[\\s\\S]*?<\\/script>/gi, '')\n // Remove IE expression() calls\n .replace(/expression\\s*\\([^)]*\\)/gi, '');\n}\n\n/**\n * Polyfill for CSS.escape() for SSR environments.\n * Based on https://drafts.csswg.org/cssom/#serialize-an-identifier\n */\nexport function cssEscape(value: string): string {\n if (typeof CSS !== 'undefined' && CSS.escape) {\n return CSS.escape(value);\n }\n\n const str = String(value);\n const length = str.length;\n let result = '';\n let i = 0;\n\n while (i < length) {\n const char = str.charAt(i);\n const code = str.charCodeAt(i);\n\n if (code === 0x0000) {\n result += '\\uFFFD';\n } else if (\n (code >= 0x0001 && code <= 0x001f) ||\n code === 0x007f ||\n (i === 0 && code >= 0x0030 && code <= 0x0039) ||\n (i === 1 &&\n code >= 0x0030 &&\n code <= 0x0039 &&\n str.charCodeAt(0) === 0x002d)\n ) {\n result += '\\\\' + code.toString(16) + ' ';\n } else if (i === 0 && length === 1 && code === 0x002d) {\n result += '\\\\' + char;\n } else if (\n code >= 0x0080 ||\n code === 0x002d ||\n code === 0x005f ||\n (code >= 0x0030 && code <= 0x0039) ||\n (code >= 0x0041 && code <= 0x005a) ||\n (code >= 0x0061 && code <= 0x007a)\n ) {\n result += char;\n } else {\n result += '\\\\' + char;\n }\n\n i++;\n }\n\n return result;\n}\n\n/** Escape a class name and prefix it with a dot for use in CSS selectors. */\nexport function escapeClassName(name: string): string {\n return '.' + cssEscape(name);\n}\n\n/** Escape a string for use in a RegExp. */\nexport function escapeRegExp(str: string): string {\n return str.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n}\n\n// --- Base reset stylesheet ---\n\nexport const baseReset = css`\n ${variables}\n :host,\n *,\n ::before,\n ::after {\n all: isolate;\n box-sizing: border-box;\n border: 0 solid currentColor;\n margin: 0;\n padding: 0;\n font: inherit;\n vertical-align: baseline;\n background: transparent;\n color: inherit;\n -webkit-tap-highlight-color: transparent;\n /* Transform composition variables (reset per-element for composability) */\n --cer-translate-x: 0px;\n --cer-translate-y: 0px;\n --cer-rotate: 0deg;\n --cer-skew-x: 0deg;\n --cer-skew-y: 0deg;\n --cer-scale-x: 1;\n --cer-scale-y: 1;\n /* Ring variables */\n --cer-ring-color: rgb(59 130 246 / 0.5);\n /* Filter composition variables (empty = no-op in filter chain) */\n --cer-blur: ;\n --cer-brightness: ;\n --cer-contrast: ;\n --cer-grayscale: ;\n --cer-hue-rotate: ;\n --cer-invert: ;\n --cer-saturate: ;\n --cer-sepia: ;\n --cer-drop-shadow: ;\n --cer-backdrop-blur: ;\n --cer-backdrop-brightness: ;\n --cer-backdrop-contrast: ;\n --cer-backdrop-grayscale: ;\n --cer-backdrop-hue-rotate: ;\n --cer-backdrop-invert: ;\n --cer-backdrop-saturate: ;\n --cer-backdrop-sepia: ;\n }\n :host {\n display: contents;\n font: 16px/1.5 var(--cer-font-sans, ui-sans-serif, system-ui, sans-serif);\n /* Default CE line-height variable so leading-* can reliably override */\n --cer-line-height: 1.5;\n -webkit-text-size-adjust: 100%;\n text-size-adjust: 100%;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n /* Default gradient variables to avoid undefined var() usage in generated utilities */\n --cer-gradient-from-position: 0%;\n --cer-gradient-to-position: 100%;\n --cer-gradient-via-position: 50%;\n --cer-gradient-from: rgba(255, 255, 255, 0);\n --cer-gradient-to: rgba(255, 255, 255, 0);\n --cer-gradient-stops: var(--cer-gradient-from), var(--cer-gradient-to);\n /* Default outline style variable */\n --cer-outline-style: solid;\n }\n button,\n input,\n select,\n textarea {\n background: transparent;\n outline: none;\n }\n textarea {\n resize: vertical;\n }\n progress {\n vertical-align: baseline;\n }\n button,\n textarea {\n overflow: visible;\n }\n img,\n svg,\n video,\n canvas,\n audio,\n iframe,\n embed,\n object {\n display: block;\n max-width: 100%;\n height: auto;\n }\n svg {\n fill: currentColor;\n stroke: none;\n }\n a {\n text-decoration: inherit;\n cursor: pointer;\n }\n button,\n [type='button'],\n [type='reset'],\n [type='submit'] {\n cursor: pointer;\n appearance: button;\n background: none;\n -webkit-user-select: none;\n user-select: none;\n }\n ::-webkit-input-placeholder,\n ::placeholder {\n color: inherit;\n opacity: 0.5;\n }\n *:focus-visible {\n outline: 2px solid var(--cer-color-primary-500, #3b82f6);\n outline-offset: 2px;\n }\n ol,\n ul {\n list-style: none;\n }\n table {\n border-collapse: collapse;\n }\n sub,\n sup {\n font-size: 0.75em;\n line-height: 0;\n position: relative;\n }\n sub {\n bottom: -0.25em;\n }\n sup {\n top: -0.5em;\n }\n [disabled],\n [aria-disabled='true'] {\n cursor: not-allowed;\n }\n [hidden] {\n display: none;\n }\n`;\n\n/** Default spacing unit used by the JIT spacing scale. */\nexport const spacing = '0.25rem';\n\n// --- Base reset stylesheet singleton ---\n\nlet baseResetSheet: CSSStyleSheet | null = null;\n\nexport function getBaseResetSheet(): CSSStyleSheet {\n if (!baseResetSheet) {\n if (typeof CSSStyleSheet === 'undefined') {\n baseResetSheet = {\n cssRules: [],\n replaceSync: () => {},\n toString: () => minifyCSS(baseReset),\n } as unknown as CSSStyleSheet;\n } else {\n baseResetSheet = new CSSStyleSheet();\n baseResetSheet.replaceSync(minifyCSS(baseReset));\n }\n }\n return baseResetSheet;\n}\n\n/** Reset the base reset sheet singleton (for HMR). @internal */\nexport function _resetBaseResetSheet(): void {\n baseResetSheet = null;\n}\n","/**\n * Lazy render bridge — populated by style.ts when the JIT engine is imported.\n *\n * render.ts always imports this module (so it is always bundled), but\n * style.ts (the full JIT engine, ~24 KB gzip) is only bundled when the\n * consumer explicitly imports JIT CSS symbols such as `enableJITCSS` or\n * `useJITCSS`. When style.ts IS imported it registers itself here so that\n * render.ts can call back into the JIT engine without a static dependency.\n *\n * Result: consumers that never use JIT CSS get zero JIT code in their bundle.\n */\n\ntype JITChecker = (root: ShadowRoot) => boolean;\ntype JITProcessor = (html: string) => string;\ntype ProseSheetGetter = () => CSSStyleSheet | null;\n\nlet _jitChecker: JITChecker | null = null;\nlet _jitProcessor: JITProcessor | null = null;\nlet _proseGetter: ProseSheetGetter | null = null;\n\n/**\n * Register the JIT CSS engine with the render pipeline.\n * Called by style.ts at module load time so renders automatically get\n * JIT processing without render.ts needing to import style.ts directly.\n * @internal\n */\nexport function _registerRenderBridge(\n checker: JITChecker,\n processor: JITProcessor,\n proseGetter: ProseSheetGetter,\n): void {\n _jitChecker = checker;\n _jitProcessor = processor;\n _proseGetter = proseGetter;\n}\n\n/**\n * Returns true when JIT CSS should run for the given shadow root.\n * Returns false if the JIT engine is not loaded.\n */\nexport function isJITCSSActiveFor(root: ShadowRoot): boolean {\n return _jitChecker ? _jitChecker(root) : false;\n}\n\n/**\n * Run JIT CSS processing over the aggregated HTML string.\n * Returns empty string if the JIT engine is not loaded.\n */\nexport function processJITCSS(html: string): string {\n return _jitProcessor ? _jitProcessor(html) : '';\n}\n\n/**\n * Get the prose stylesheet singleton.\n * Returns null if the JIT engine is not loaded or no prose classes detected.\n */\nexport function getProseStyleSheet(): CSSStyleSheet | null {\n return _proseGetter ? _proseGetter() : null;\n}\n"],"mappings":"AAAA,IAAA,EAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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1dCX.cjs`),t=require(`./helpers-7zLtbh_q.cjs`),n=require(`./template-compiler-C0SkzB_f.cjs`),r=require(`./css-utils-CFeP8SK1.cjs`),i=require(`./hooks-BY_35J9Y.cjs`);function a(e=document){typeof CustomEvent>`u`||(e instanceof Document?e.documentElement:e).dispatchEvent(new CustomEvent(`cer:hydrate`,{bubbles:!0,composed:!0}))}var o=100,s=3e4;function c(e,t,n){return n===`jitCacheHitRate`?e<t*.5?`critical`:e<t?`warning`:`healthy`:e>t*2?`critical`:e>t?`warning`:`healthy`}function l(e){let t=[];return e.memoryUsage?.status!==`healthy`&&t.push(`Consider reducing component complexity or implementing better memory cleanup`),e.averageRenderTime?.status!==`healthy`&&t.push(`Optimize component render functions - consider lazy loading or virtualization`),e.jitCacheHitRate?.status!==`healthy`&&t.push(`JIT CSS cache performance is poor - review CSS patterns for optimization`),e.componentErrorRate?.status!==`healthy`&&t.push(`High component error rate detected - review error handling and component logic`),e.activeReactiveStates?.status!==`healthy`&&t.push(`High number of reactive states - consider state consolidation or cleanup`),e.memoryLeakIndicator?.status!==`healthy`&&t.push(`Potential memory leak detected - review component cleanup and event listener management`),t}function u(){let t=new Map,n=new Set,r=null;function i(e,n,r){t.set(e,{name:e,value:n,threshold:r,status:`healthy`,lastUpdated:Date.now(),history:[]})}function a(){i(`activeComponents`,0,1e3),i(`componentCreateRate`,0,50),i(`componentErrorRate`,0,.1),i(`memoryUsage`,0,50*1024*1024),i(`memoryGrowthRate`,0,1024*1024),i(`averageRenderTime`,0,16),i(`slowRenderCount`,0,10),i(`jitCacheHitRate`,100,80),i(`activeReactiveStates`,0,5e3),i(`dependencyUpdates`,0,100),i(`memoryLeakIndicator`,0,.1)}function u(e,n){let r=t.get(e);r&&(r.value=n,r.lastUpdated=Date.now(),r.history.push(n),r.history.length>o&&r.history.shift(),r.status=c(n,r.threshold,e))}function d(){let e={},n=`healthy`;for(let[r,i]of t)e[r]={...i},i.status===`critical`?n=`critical`:i.status===`warning`&&n===`healthy`&&(n=`warning`);return{overall:n,metrics:e,timestamp:Date.now(),recommendations:l(e)}}function f(){if(`memory`in performance&&performance.memory){let e=performance.memory;u(`memoryUsage`,e.usedJSHeapSize);let n=t.get(`memoryUsage`);if(n&&n.history.length>1){let e=n.history[n.history.length-2],t=n.history[n.history.length-1];u(`memoryGrowthRate`,Math.max(0,t-e))}}}function p(t){for(let r of n)try{r(t)}catch(t){e.t(`Error in health monitor listener:`,t)}}function m(){f();let t=d();p(t),t.overall===`critical`?e.t(`🚨 Runtime Health: Critical issues detected`,t.recommendations):t.overall===`warning`&&e.r(`⚠️ Runtime Health: Performance warnings`,t.recommendations)}function h(){typeof window>`u`||(r=setInterval(m,s))}function g(){r!==null&&(clearInterval(r),r=null)}function _(e){n.add(e)}function v(e){n.delete(e)}function y(e){let n=t.get(e);return n?[...n.history]:[]}function b(){for(let e of t.values())e.history=[]}return a(),h(),{updateMetric:u,getHealthReport:d,addListener:_,removeListener:v,stop:g,getMetricHistory:y,clearHistory:b}}var d=null;function f(){return d||=u(),d}function p(e,t){f().updateMetric(e,t)}function m(){return f().getHealthReport()}function h(){typeof window>`u`||typeof customElements>`u`||customElements.get(`cer-keep-alive`)||customElements.define(`cer-keep-alive`,g())}function g(){return class extends HTMLElement{_cache=new Map;_slot=null;_slotListener=null;connectedCallback(){this.shadowRoot||this.attachShadow({mode:`open`}),this.shadowRoot.querySelector(`slot`)||(this.shadowRoot.innerHTML=`<slot></slot>`),this._slot=this.shadowRoot.querySelector(`slot`),this._slot&&(this._slotListener=()=>this._handleSlotChange(),this._slot.addEventListener(`slotchange`,this._slotListener),this._handleSlotChange())}disconnectedCallback(){this._slot&&this._slotListener&&this._slot.removeEventListener(`slotchange`,this._slotListener),this._slotListener=null}clearCache(e){e?this._cache.delete(e):this._cache.clear()}_handleSlotChange(){if(!this._slot)return;let e=this._slot.assignedElements({flatten:!0});for(let t of e){let e=this._buildCacheKey(t);if(!this._cache.has(e))this._cache.set(e,t);else{let n=this._cache.get(e);if(n!==t)try{t.parentNode?.replaceChild(n,t)}catch{this._cache.set(e,t)}}}}_buildCacheKey(e){let t=e.tagName.toLowerCase(),n=e.getAttribute(`id`);return n?`${t}:${n}`:t}}}function _(){typeof customElements<`u`&&customElements.get(`cer-suspense`)||n.n(`cer-suspense`,()=>{let{pending:e}=i._({pending:!1});return e?n.t`<slot name="fallback"><span>Loading…</span></slot>`:n.t`<slot></slot>`})}function v(){typeof customElements<`u`&&customElements.get(`cer-error-boundary`)||n.n(`cer-error-boundary`,()=>{let e=t.y(!1),r=t.y(``);return i.g(t=>{e.value=!0,r.value=t.message}),i.d({_cerHandleChildError:t=>{e.peek()||(e.value=!0,r.value=t instanceof Error?t.message:String(t))},reset:()=>{e.value=!1,r.value=``}}),e.value?n.t`<slot name="fallback"
|
|
2
2
|
><div role="alert">
|
|
3
3
|
<strong>Something went wrong.</strong>
|
|
4
|
-
${
|
|
4
|
+
${r.value?n.t`<p>${r.value}</p>`:n.t``}
|
|
5
5
|
</div></slot
|
|
6
|
-
>`:
|
|
7
|
-
|
|
6
|
+
>`:n.t`<slot></slot>`})}function y(){_(),v(),h()}function b(e){if(typeof document>`u`||i.o())return{portal:()=>{},destroy:()=>{}};if(i.i()){let n=t.v.getOrCreateState(null),r=n.peek();if(r!==null)return r;let i=x(e,()=>n.initSilent(null));return n.initSilent(i),i}return x(e)}function x(e,t){let r=typeof e==`string`?document.querySelector(e):e;if(!r)return console.warn(`[useTeleport] Target "${String(e)}" not found in the document. Teleported content will not be rendered.`),{portal:()=>{},destroy:()=>{}};let i=document.createElement(`cer-teleport`);i.dataset.cerTeleport=``,r.appendChild(i);let a={};return{portal(e){n.r(i,e==null?[]:Array.isArray(e)?e:[e],void 0,a)},destroy(){try{n.r(i,[],void 0,a)}catch{}i.parentNode&&i.parentNode.removeChild(i),t?.()}}}exports.ReactiveState=t.h,exports.component=n.n,exports.computed=t.g,exports.createComposable=i.n,exports.createHealthMonitor=u,exports.css=r.o,exports.decodeEntities=t.n,exports.defineModel=i.r,exports.devLog=e.n,exports.flushDOMUpdates=t.E,exports.getCurrentComponentContext=i.i,exports.getHealthMonitor=f,exports.getHealthStatus=m,exports.html=n.t,exports.hydrateApp=a,exports.inject=i.a,exports.isReactiveState=t._,exports.nextTick=t.D,exports.provide=i.s,exports.ref=t.y,exports.registerBuiltinComponents=y,exports.registerErrorBoundary=v,exports.registerKeepAlive=h,exports.registerSuspense=_,exports.scheduleWithPriority=t.k,exports.setDevMode=e.i,exports.unsafeHTML=t.m,exports.updateHealthMetric=p,exports.useDesignTokens=i.l,exports.useEmit=i.u,exports.useExpose=i.d,exports.useGlobalStyle=i.f,exports.useOnAttributeChanged=i.p,exports.useOnConnected=i.m,exports.useOnDisconnected=i.h,exports.useOnError=i.g,exports.useProps=i._,exports.useSlots=i.v,exports.useStyle=i.y,exports.useTeleport=b,exports.watch=t.b,exports.watchEffect=t.x;
|
|
8
7
|
//# sourceMappingURL=custom-elements-runtime.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"custom-elements-runtime.cjs.js","names":[],"sources":["../src/lib/runtime/hydration.ts","../src/lib/runtime/monitoring/health-monitor.ts","../src/lib/keep-alive.ts","../src/lib/runtime/builtin-components.ts","../src/lib/teleport.ts"],"sourcesContent":["/**\n * Client-side hydration helpers.\n *\n * When the server renders with `dsd: true`, each custom element's shadow DOM\n * is already present in the HTML via a Declarative Shadow DOM template. The\n * browser parses that template and attaches the shadow root before any\n * JavaScript runs. When the JS bundle loads, the custom element constructors\n * detect the existing shadow root and skip the `attachShadow()` call, then\n * hydrate (attach reactivity to) the existing DOM on `connectedCallback`.\n *\n * `hydrateApp` is a signal/entry point for this process. In most cases custom\n * elements self-hydrate automatically on connection — this function is useful\n * when you need to explicitly trigger or defer the hydration of a subtree.\n */\n\n/**\n * Trigger hydration for all registered custom elements within `root`.\n *\n * In practice, custom elements self-hydrate as soon as their class definition\n * is registered and the element is connected to the DOM. Call `hydrateApp`\n * after importing and calling `component()` for all your components to signal\n * that the page is ready for reactive activation.\n *\n * @param root - The root element to hydrate. Defaults to `document`.\n *\n * @example\n * ```ts\n * import { component, hydrateApp } from '@jasonshimmy/custom-elements-runtime';\n * import './components'; // registers all components via component()\n *\n * hydrateApp(); // activate all DSD-rendered components on the page\n * ```\n */\nexport function hydrateApp(root: Element | Document = document): void {\n if (typeof CustomEvent === 'undefined') return;\n const target =\n root instanceof Document ? root.documentElement : (root as Element);\n target.dispatchEvent(\n new CustomEvent('cer:hydrate', { bubbles: true, composed: true }),\n );\n}\n","/**\n * Runtime Health Monitoring System\n * Tracks framework health metrics and provides early warning for potential issues\n */\n\nimport { devWarn, devError } from '../logger';\n\ninterface HealthMetric {\n name: string;\n value: number;\n threshold: number;\n status: 'healthy' | 'warning' | 'critical';\n lastUpdated: number;\n history: number[];\n}\n\ninterface HealthReport {\n overall: 'healthy' | 'warning' | 'critical';\n metrics: Record<string, HealthMetric>;\n timestamp: number;\n recommendations: string[];\n}\nexport type { HealthReport };\n\n/**\n * Public interface for a health monitor instance.\n * All state is managed internally via closures — no class syntax.\n */\nexport interface HealthMonitorInstance {\n /** Update a specific health metric value */\n updateMetric(name: string, value: number): void;\n /** Get the current health report */\n getHealthReport(): HealthReport;\n /** Add a listener to be notified when a health check runs */\n addListener(listener: (report: HealthReport) => void): void;\n /** Remove a previously registered listener */\n removeListener(listener: (report: HealthReport) => void): void;\n /** Stop the periodic health monitoring timer */\n stop(): void;\n /** Get historical values for a specific metric */\n getMetricHistory(name: string): number[];\n /** Clear all metric history */\n clearHistory(): void;\n}\n\nconst MAX_HISTORY_SIZE = 100;\nconst CHECK_INTERVAL = 30_000; // 30 seconds\n\nfunction calcStatus(\n value: number,\n threshold: number,\n metricName: string,\n): 'healthy' | 'warning' | 'critical' {\n if (metricName === 'jitCacheHitRate') {\n if (value < threshold * 0.5) return 'critical';\n if (value < threshold) return 'warning';\n return 'healthy';\n }\n if (value > threshold * 2) return 'critical';\n if (value > threshold) return 'warning';\n return 'healthy';\n}\n\nfunction buildRecommendations(metrics: Record<string, HealthMetric>): string[] {\n const out: string[] = [];\n if (metrics.memoryUsage?.status !== 'healthy')\n out.push(\n 'Consider reducing component complexity or implementing better memory cleanup',\n );\n if (metrics.averageRenderTime?.status !== 'healthy')\n out.push(\n 'Optimize component render functions - consider lazy loading or virtualization',\n );\n if (metrics.jitCacheHitRate?.status !== 'healthy')\n out.push(\n 'JIT CSS cache performance is poor - review CSS patterns for optimization',\n );\n if (metrics.componentErrorRate?.status !== 'healthy')\n out.push(\n 'High component error rate detected - review error handling and component logic',\n );\n if (metrics.activeReactiveStates?.status !== 'healthy')\n out.push(\n 'High number of reactive states - consider state consolidation or cleanup',\n );\n if (metrics.memoryLeakIndicator?.status !== 'healthy')\n out.push(\n 'Potential memory leak detected - review component cleanup and event listener management',\n );\n return out;\n}\n\n/**\n * Create a new health monitor instance.\n * All mutable state lives in closures — no `class` or `this`.\n */\nexport function createHealthMonitor(): HealthMonitorInstance {\n const metricsMap = new Map<string, HealthMetric>();\n const listeners = new Set<(report: HealthReport) => void>();\n let intervalId: ReturnType<typeof setInterval> | null = null;\n\n function addMetric(name: string, value: number, threshold: number): void {\n metricsMap.set(name, {\n name,\n value,\n threshold,\n status: 'healthy',\n lastUpdated: Date.now(),\n history: [],\n });\n }\n\n function initializeMetrics(): void {\n addMetric('activeComponents', 0, 1000);\n addMetric('componentCreateRate', 0, 50);\n addMetric('componentErrorRate', 0, 0.1);\n addMetric('memoryUsage', 0, 50 * 1024 * 1024);\n addMetric('memoryGrowthRate', 0, 1024 * 1024);\n addMetric('averageRenderTime', 0, 16);\n addMetric('slowRenderCount', 0, 10);\n addMetric('jitCacheHitRate', 100, 80);\n addMetric('activeReactiveStates', 0, 5000);\n addMetric('dependencyUpdates', 0, 100);\n addMetric('memoryLeakIndicator', 0, 0.1);\n }\n\n function updateMetric(name: string, value: number): void {\n const metric = metricsMap.get(name);\n if (!metric) return;\n metric.value = value;\n metric.lastUpdated = Date.now();\n metric.history.push(value);\n if (metric.history.length > MAX_HISTORY_SIZE) metric.history.shift();\n metric.status = calcStatus(value, metric.threshold, name);\n }\n\n function getHealthReport(): HealthReport {\n const snapshot: Record<string, HealthMetric> = {};\n let overall: 'healthy' | 'warning' | 'critical' = 'healthy';\n for (const [name, metric] of metricsMap) {\n snapshot[name] = { ...metric };\n if (metric.status === 'critical') overall = 'critical';\n else if (metric.status === 'warning' && overall === 'healthy')\n overall = 'warning';\n }\n return {\n overall,\n metrics: snapshot,\n timestamp: Date.now(),\n recommendations: buildRecommendations(snapshot),\n };\n }\n\n function updateMemoryMetrics(): void {\n if (\n 'memory' in performance &&\n (performance as Record<string, unknown>).memory\n ) {\n const mem = (performance as Record<string, unknown>).memory as {\n usedJSHeapSize: number;\n };\n updateMetric('memoryUsage', mem.usedJSHeapSize);\n const m = metricsMap.get('memoryUsage');\n if (m && m.history.length > 1) {\n const prev = m.history[m.history.length - 2];\n const curr = m.history[m.history.length - 1];\n updateMetric('memoryGrowthRate', Math.max(0, curr - prev));\n }\n }\n }\n\n function notifyListeners(report: HealthReport): void {\n for (const listener of listeners) {\n try {\n listener(report);\n } catch (e) {\n devError('Error in health monitor listener:', e);\n }\n }\n }\n\n function performHealthCheck(): void {\n updateMemoryMetrics();\n const report = getHealthReport();\n notifyListeners(report);\n if (report.overall === 'critical')\n devError(\n '🚨 Runtime Health: Critical issues detected',\n report.recommendations,\n );\n else if (report.overall === 'warning')\n devWarn(\n '⚠️ Runtime Health: Performance warnings',\n report.recommendations,\n );\n }\n\n function startMonitoring(): void {\n if (typeof window === 'undefined') return;\n intervalId = setInterval(performHealthCheck, CHECK_INTERVAL);\n }\n\n function stop(): void {\n if (intervalId !== null) {\n clearInterval(intervalId);\n intervalId = null;\n }\n }\n\n function addListener(listener: (report: HealthReport) => void): void {\n listeners.add(listener);\n }\n function removeListener(listener: (report: HealthReport) => void): void {\n listeners.delete(listener);\n }\n function getMetricHistory(name: string): number[] {\n const m = metricsMap.get(name);\n return m ? [...m.history] : [];\n }\n function clearHistory(): void {\n for (const m of metricsMap.values()) m.history = [];\n }\n\n initializeMetrics();\n startMonitoring();\n\n return {\n updateMetric,\n getHealthReport,\n addListener,\n removeListener,\n stop,\n getMetricHistory,\n clearHistory,\n };\n}\n\n// Global singleton\nlet _monitor: HealthMonitorInstance | null = null;\n\n/**\n * Get the global health monitor singleton instance.\n */\nexport function getHealthMonitor(): HealthMonitorInstance {\n if (!_monitor) _monitor = createHealthMonitor();\n return _monitor;\n}\n\n/**\n * Update a health metric from anywhere in the framework.\n */\nexport function updateHealthMetric(name: string, value: number): void {\n getHealthMonitor().updateMetric(name, value);\n}\n\n/**\n * Get the current health status report.\n */\nexport function getHealthStatus(): HealthReport {\n return getHealthMonitor().getHealthReport();\n}\n","/**\n * keep-alive.ts\n *\n * Preserves component state when a component is removed from and later\n * re-inserted into the DOM. By default, custom elements lose all JavaScript\n * state when `disconnectedCallback` fires. `cer-keep-alive` intercepts\n * that lifecycle and keeps the child element alive in memory, re-attaching\n * it when a matching component is re-inserted.\n *\n * ## Usage\n *\n * Wrap any custom element with `<cer-keep-alive>`:\n * ```html\n * <cer-keep-alive>\n * <my-counter></my-counter>\n * </cer-keep-alive>\n * ```\n *\n * Or register it programmatically:\n * ```ts\n * import { registerKeepAlive } from '@jasonshimmy/custom-elements-runtime';\n * registerKeepAlive(); // registers <cer-keep-alive> globally\n * ```\n *\n * ## How it works\n *\n * `cer-keep-alive` uses a slotted layout. When a slotted child component is\n * about to leave the DOM (via a re-render of a parent), KeepAlive intercepts\n * `slotchange` events and preserves the detached child element in an internal\n * cache keyed by tag name. When the same tag re-appears in the slot, the\n * cached element is re-inserted, restoring all JavaScript state.\n *\n * ## Limitations\n *\n * - The first slot child per tag name is cached. Multiple children with the\n * same tag use separate cache entries keyed by their `id` attribute.\n * - Only components registered with the same tag name are matched.\n * - Cache entries can be manually evicted with `clearCache()`.\n */\n\n/** Cache key = tagName[:id] */\ntype CacheKey = string;\n\n/**\n * Register the `<cer-keep-alive>` custom element.\n * Safe to call multiple times — subsequent calls are no-ops.\n *\n * @example\n * ```ts\n * import { registerKeepAlive } from '@jasonshimmy/custom-elements-runtime';\n * registerKeepAlive();\n * ```\n */\nexport function registerKeepAlive(): void {\n if (\n typeof window === 'undefined' ||\n typeof customElements === 'undefined' ||\n customElements.get('cer-keep-alive')\n ) {\n return;\n }\n\n customElements.define('cer-keep-alive', createKeepAliveClass());\n}\n\nfunction createKeepAliveClass(): CustomElementConstructor {\n return class CerKeepAlive extends HTMLElement {\n /** Preserved component instances keyed by tag[:id]. */\n private _cache = new Map<CacheKey, Element>();\n private _slot: HTMLSlotElement | null = null;\n private _slotListener: (() => void) | null = null;\n\n connectedCallback(): void {\n if (!this.shadowRoot) {\n this.attachShadow({ mode: 'open' });\n }\n\n if (!this.shadowRoot!.querySelector('slot')) {\n this.shadowRoot!.innerHTML = '<slot></slot>';\n }\n\n this._slot = this.shadowRoot!.querySelector('slot');\n if (this._slot) {\n this._slotListener = () => this._handleSlotChange();\n this._slot.addEventListener('slotchange', this._slotListener);\n // Process current slotted content\n this._handleSlotChange();\n }\n }\n\n disconnectedCallback(): void {\n if (this._slot && this._slotListener) {\n this._slot.removeEventListener('slotchange', this._slotListener);\n }\n this._slotListener = null;\n }\n\n /**\n * Evict a cached element by its cache key (`tagName` or `tagName:id`).\n * The evicted element is disconnected and removed from the cache.\n */\n clearCache(key?: CacheKey): void {\n if (key) {\n this._cache.delete(key);\n } else {\n this._cache.clear();\n }\n }\n\n private _handleSlotChange(): void {\n if (!this._slot) return;\n\n const slottedElements = this._slot.assignedElements({ flatten: true });\n\n for (const child of slottedElements) {\n const cacheKey = this._buildCacheKey(child);\n\n if (!this._cache.has(cacheKey)) {\n // New element — cache it so we can restore it later\n this._cache.set(cacheKey, child);\n } else {\n const cached = this._cache.get(cacheKey)!;\n if (cached !== child) {\n // A different instance appeared for the same slot.\n // Replace it with the cached instance to restore state.\n try {\n child.parentNode?.replaceChild(cached, child);\n } catch {\n // If replacement fails, update the cache with the new element\n this._cache.set(cacheKey, child);\n }\n }\n }\n }\n }\n\n private _buildCacheKey(el: Element): CacheKey {\n const tag = el.tagName.toLowerCase();\n const id = el.getAttribute('id');\n return id ? `${tag}:${id}` : tag;\n }\n };\n}\n","/**\n * Built-in utility components provided by the custom-elements runtime.\n *\n * These components are registered automatically when this module is imported.\n * They are designed to be minimal, tree-shakeable, and zero-dependency.\n *\n * Included components:\n * - `<cer-suspense>` — Shows a fallback while async work is pending\n * - `<cer-error-boundary>` — Catches render errors and shows a fallback UI\n * - `<cer-keep-alive>` — Preserves component state across DOM removal/re-insertion\n */\n\nimport { component } from './component';\nimport { html } from './template-compiler';\nimport { ref } from './reactive';\nimport { useProps, useOnError, useExpose } from './hooks';\nimport { registerKeepAlive } from '../keep-alive';\n\n// ── cer-suspense ──────────────────────────────────────────────────────────────\n\n/**\n * A built-in component that conditionally renders either the default slot\n * content or the `fallback` slot content, controlled by the `pending` prop.\n *\n * Use the `pending` attribute/property to signal that async work is in\n * progress; the component will swap to the `fallback` slot until `pending`\n * becomes falsy.\n *\n * @example\n * ```html\n * <cer-suspense pending>\n * <!-- shown when pending=false -->\n * <my-async-content></my-async-content>\n *\n * <!-- shown while pending=true -->\n * <div slot=\"fallback\">Loading…</div>\n * </cer-suspense>\n * ```\n *\n * @example Programmatic usage\n * ```ts\n * component('my-data-loader', () => {\n * const pending = ref(true);\n * useOnConnected(async () => {\n * await fetchData();\n * pending.value = false;\n * });\n * return html`\n * <cer-suspense pending=\"${pending.value}\">\n * <my-data-view></my-data-view>\n * <div slot=\"fallback\">Loading data…</div>\n * </cer-suspense>\n * `;\n * });\n * ```\n */\nexport function registerSuspense(): void {\n if (typeof customElements !== 'undefined' && customElements.get('cer-suspense')) return;\n\n component('cer-suspense', () => {\n const { pending } = useProps({ pending: false });\n\n return pending\n ? html`<slot name=\"fallback\"><span>Loading…</span></slot>`\n : html`<slot></slot>`;\n });\n}\n\n// ── cer-error-boundary ────────────────────────────────────────────────────────\n\n/**\n * A built-in component that catches errors thrown during child component\n * rendering and displays a fallback UI instead of crashing the page.\n *\n * Errors are caught via the `useOnError` lifecycle hook. Once an error is\n * caught the component switches to showing the `fallback` named slot (or a\n * default \"Something went wrong\" message if no fallback slot is provided).\n *\n * Call the custom `reset()` method on the element to clear the error and\n * attempt re-rendering the default slot.\n *\n * @example\n * ```html\n * <cer-error-boundary>\n * <my-risky-component></my-risky-component>\n *\n * <div slot=\"fallback\">\n * <p>Something went wrong. <button onclick=\"this.closest('cer-error-boundary').reset()\">Retry</button></p>\n * </div>\n * </cer-error-boundary>\n * ```\n */\nexport function registerErrorBoundary(): void {\n if (typeof customElements !== 'undefined' && customElements.get('cer-error-boundary')) return;\n\n component('cer-error-boundary', () => {\n const hasError = ref(false);\n const errorMessage = ref('');\n\n useOnError((err: Error) => {\n hasError.value = true;\n errorMessage.value = err.message;\n });\n\n // Expose a reset() method so parent templates can call\n // `errorBoundaryRef.value.reset()` to clear the error and retry.\n // Also expose an internal `_cerHandleChildError` receiver so that the\n // component runtime can propagate uncaught errors from slotted child\n // components up to the nearest ancestor <cer-error-boundary>.\n useExpose({\n _cerHandleChildError: (err: unknown) => {\n // Use peek() to read the current value without registering a reactive\n // dependency — the child component's render context may be active when\n // this handler runs, and we must not accidentally subscribe the child\n // to this boundary's internal state.\n if (!hasError.peek()) {\n hasError.value = true;\n errorMessage.value = err instanceof Error ? err.message : String(err);\n }\n },\n reset: () => {\n hasError.value = false;\n errorMessage.value = '';\n },\n });\n\n return hasError.value\n ? html`<slot name=\"fallback\"\n ><div role=\"alert\">\n <strong>Something went wrong.</strong>\n ${errorMessage.value ? html`<p>${errorMessage.value}</p>` : html``}\n </div></slot\n >`\n : html`<slot></slot>`;\n });\n}\n\n// ── Auto-register all components ─────────────────────────────────────────────\n\n/**\n * Register all built-in components (`cer-suspense`, `cer-error-boundary`,\n * `cer-keep-alive`).\n * Safe to call multiple times — each registration is guarded by a\n * `customElements.get()` check.\n */\nexport function registerBuiltinComponents(): void {\n registerSuspense();\n registerErrorBoundary();\n registerKeepAlive();\n}\n","/**\n * teleport.ts\n *\n * Renders virtual DOM content into an arbitrary DOM target located outside\n * the current component's Shadow Root. Useful for modals, tooltips, popovers,\n * and any UI that must visually escape the component boundary.\n *\n * @example\n * ```ts\n * import { component, html, ref, useOnDisconnected, useTeleport } from '@jasonshimmy/custom-elements-runtime';\n *\n * component('modal-trigger', () => {\n * const isOpen = ref(false);\n *\n * // Render modal content into <body> outside the shadow root\n * const { portal, destroy } = useTeleport('#modal-root');\n * useOnDisconnected(destroy);\n *\n * // Call portal() to update the teleported content on each render\n * if (isOpen.value) {\n * portal(html`<div class=\"modal\">\n * <h2>Hello</h2>\n * <button @click=\"${() => (isOpen.value = false)}\">Close</button>\n * </div>`);\n * } else {\n * portal(null);\n * }\n *\n * return html`\n * <button @click=\"${() => (isOpen.value = true)}\">Open modal</button>\n * `;\n * });\n * ```\n */\n\nimport type { VNode, VDomRefs } from './runtime/types';\nimport { vdomRenderer } from './runtime/vdom';\nimport { reactiveSystem } from './runtime/reactive';\nimport { getCurrentComponentContext, isDiscoveryRender } from './runtime/hooks';\n\n/** Handle returned by {@link useTeleport} for managing a portal. */\nexport interface TeleportHandle {\n /**\n * Render (or clear) content at the teleport target.\n * Pass `null` or `undefined` to remove previously rendered content.\n */\n portal(content: VNode | VNode[] | null | undefined): void;\n\n /**\n * Destroy the teleport container and clean up all rendered content.\n * Call this in `useOnDisconnected` to prevent memory leaks.\n */\n destroy(): void;\n}\n\n/**\n * Create a teleport portal that renders content outside the current Shadow Root.\n *\n * @param target - A CSS selector string or an `Element` reference to render into.\n * @returns A {@link TeleportHandle} with `portal()` (update content) and `destroy()` (cleanup).\n *\n * @example\n * ```ts\n * import { component, html, useOnDisconnected, useTeleport } from '@jasonshimmy/custom-elements-runtime';\n *\n * component('my-tooltip', () => {\n * const { portal, destroy } = useTeleport('body');\n * useOnDisconnected(destroy);\n *\n * portal(html`<div class=\"tooltip\">Tooltip content</div>`);\n * return html`<span>Hover me</span>`;\n * });\n * ```\n */\nexport function useTeleport(target: string | Element): TeleportHandle {\n // SSR guard\n if (typeof document === 'undefined') {\n return { portal: () => {}, destroy: () => {} };\n }\n\n // During discovery render the component is not yet mounted — return a no-op\n // handle so the library can detect props/hooks without side-effects.\n if (isDiscoveryRender()) {\n return { portal: () => {}, destroy: () => {} };\n }\n\n // If called inside a component render, use the reactive state-index slot\n // mechanism to ensure the same handle is returned on every re-render of the\n // same component instance. Without this, each re-render would create a new\n // <cer-teleport> container in the target, leaking all but the last one.\n const ctx = getCurrentComponentContext();\n if (ctx) {\n // getOrCreateState uses an incrementing stateIndex that is reset to 0 at\n // the start of each render, so the same call site always gets the same slot.\n const slot = reactiveSystem.getOrCreateState<TeleportHandle | null>(null);\n const existing = slot.peek();\n if (existing !== null) {\n return existing;\n }\n // First render: create the handle and store it without triggering a\n // reactive update (initSilent bypasses triggerUpdate).\n // Pass a slot-invalidation callback so that destroy() clears the slot,\n // allowing a reconnected component to create a fresh container.\n const handle = _createTeleportHandle(target, () => slot.initSilent(null));\n slot.initSilent(handle);\n return handle;\n }\n\n // Outside a component context (e.g. called directly in tests or scripts):\n // fall through to a non-cached, non-stable handle.\n return _createTeleportHandle(target);\n}\n\n/** Internal: create a fresh teleport handle pointing at `target`.\n * @param onDestroy - Optional callback invoked after cleanup in destroy(), used\n * to invalidate a cached slot so the next render creates a fresh handle.\n */\nfunction _createTeleportHandle(\n target: string | Element,\n onDestroy?: () => void,\n): TeleportHandle {\n const targetEl =\n typeof target === 'string'\n ? (document.querySelector(target) as Element | null)\n : target;\n\n if (!targetEl) {\n console.warn(\n `[useTeleport] Target \"${String(target)}\" not found in the document. ` +\n 'Teleported content will not be rendered.',\n );\n return { portal: () => {}, destroy: () => {} };\n }\n\n // Create a dedicated container so we never clobber sibling content.\n const container = document.createElement('cer-teleport');\n container.dataset.cerTeleport = '';\n targetEl.appendChild(container);\n\n // Shared refs bag — passed consistently so ref directives work across updates.\n const refs: VDomRefs = {};\n\n const handle: TeleportHandle = {\n portal(content: VNode | VNode[] | null | undefined): void {\n const nodes: VNode[] =\n content == null ? [] : Array.isArray(content) ? content : [content];\n // vdomRenderer stores _prevVNode/_prevDom on the root object for diffing.\n // Casting to ShadowRoot is safe: we only access properties that exist on\n // HTMLElement (firstChild, appendChild, replaceChild, childNodes).\n vdomRenderer(container as unknown as ShadowRoot, nodes, undefined, refs);\n },\n\n destroy(): void {\n // Render empty nodes to clean up event listeners and refs.\n try {\n vdomRenderer(container as unknown as ShadowRoot, [], undefined, refs);\n } catch {\n /* best-effort cleanup */\n }\n if (container.parentNode) {\n container.parentNode.removeChild(container);\n }\n // Invalidate the cached slot so that if the component reconnects and\n // re-renders, useTeleport() creates a fresh container rather than\n // reusing this destroyed one.\n onDestroy?.();\n },\n };\n\n return handle;\n}\n"],"mappings":"kOAiCA,SAAgB,EAAW,EAA2B,SAAgB,CAChE,OAAO,YAAgB,MAEzB,aAAgB,SAAW,EAAK,gBAAmB,GAC9C,cACL,IAAI,YAAY,cAAe,CAAE,QAAS,GAAM,SAAU,GAAM,CAAC,ECOrE,IAAM,EAAmB,IACnB,EAAiB,IAEvB,SAAS,EACP,EACA,EACA,EACoC,CACpC,OAAI,IAAe,kBACb,EAAQ,EAAY,GAAY,WAChC,EAAQ,EAAkB,UACvB,UAEL,EAAQ,EAAY,EAAU,WAC9B,EAAQ,EAAkB,UACvB,UAGT,SAAS,EAAqB,EAAiD,CAC7E,MAAM,EAAgB,CAAA,EACtB,OAAI,EAAQ,aAAa,SAAW,WAClC,EAAI,KACF,8EAAA,EAEA,EAAQ,mBAAmB,SAAW,WACxC,EAAI,KACF,+EAAA,EAEA,EAAQ,iBAAiB,SAAW,WACtC,EAAI,KACF,0EAAA,EAEA,EAAQ,oBAAoB,SAAW,WACzC,EAAI,KACF,gFAAA,EAEA,EAAQ,sBAAsB,SAAW,WAC3C,EAAI,KACF,0EAAA,EAEA,EAAQ,qBAAqB,SAAW,WAC1C,EAAI,KACF,yFAAA,EAEG,EAOT,SAA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AAW,EAAK,KAAA,EACtB,GAAI,IAAa,KACf,OAAO,EAMT,MAAM,EAAS,EAAsB,EAAA,IAAc,EAAK,WAAW,IAAA,CAAK,EACxE,OAAA,EAAK,WAAW,CAAA,EACT,EAKT,OAAO,EAAsB,CAAA,EAO/B,SAAS,EACP,EACA,EACgB,CAChB,MAAM,EACJ,OAAO,GAAW,SACb,SAAS,cAAc,CAAA,EACxB,EAEN,GAAI,CAAC,EACH,eAAQ,KACN,yBAAyB,OAAO,CAAA,CAAO,uEAAC,EAGnC,CAAE,OAAA,IAAc,CAAA,EAAI,QAAA,IAAe,CAAA,GAI5C,MAAM,EAAY,SAAS,cAAc,cAAA,EACzC,EAAU,QAAQ,YAAc,GAChC,EAAS,YAAY,CAAA,EAGrB,MAAM,EAAiB,CAAA,EA6BvB,MA3B+B,CAC7B,OAAO,EAAmD,CAMxD,EAAA,aAAa,EAJX,GAAW,KAAO,CAAA,EAAK,MAAM,QAAQ,CAAA,EAAW,EAAU,CAAC,CAAA,EAIL,OAAW,CAAA,GAGrE,SAAgB,CAEd,GAAI,CACF,EAAA,aAAa,EAAoC,CAAA,EAAI,OAAW,CAAA,OAC1D,CAAA,CAGJ,EAAU,YACZ,EAAU,WAAW,YAAY,CAAA,EAKnC,IAAA"}
|
|
1
|
+
{"version":3,"file":"custom-elements-runtime.cjs.js","names":[],"sources":["../src/lib/runtime/hydration.ts","../src/lib/runtime/monitoring/health-monitor.ts","../src/lib/keep-alive.ts","../src/lib/runtime/builtin-components.ts","../src/lib/teleport.ts"],"sourcesContent":["/**\n * Client-side hydration helpers.\n *\n * When the server renders with `dsd: true`, each custom element's shadow DOM\n * is already present in the HTML via a Declarative Shadow DOM template. The\n * browser parses that template and attaches the shadow root before any\n * JavaScript runs. When the JS bundle loads, the custom element constructors\n * detect the existing shadow root and skip the `attachShadow()` call, then\n * hydrate (attach reactivity to) the existing DOM on `connectedCallback`.\n *\n * `hydrateApp` is a signal/entry point for this process. In most cases custom\n * elements self-hydrate automatically on connection — this function is useful\n * when you need to explicitly trigger or defer the hydration of a subtree.\n */\n\n/**\n * Trigger hydration for all registered custom elements within `root`.\n *\n * In practice, custom elements self-hydrate as soon as their class definition\n * is registered and the element is connected to the DOM. Call `hydrateApp`\n * after importing and calling `component()` for all your components to signal\n * that the page is ready for reactive activation.\n *\n * @param root - The root element to hydrate. Defaults to `document`.\n *\n * @example\n * ```ts\n * import { component, hydrateApp } from '@jasonshimmy/custom-elements-runtime';\n * import './components'; // registers all components via component()\n *\n * hydrateApp(); // activate all DSD-rendered components on the page\n * ```\n */\nexport function hydrateApp(root: Element | Document = document): void {\n if (typeof CustomEvent === 'undefined') return;\n const target =\n root instanceof Document ? root.documentElement : (root as Element);\n target.dispatchEvent(\n new CustomEvent('cer:hydrate', { bubbles: true, composed: true }),\n );\n}\n","/**\n * Runtime Health Monitoring System\n * Tracks framework health metrics and provides early warning for potential issues\n */\n\nimport { devWarn, devError } from '../logger';\n\ninterface HealthMetric {\n name: string;\n value: number;\n threshold: number;\n status: 'healthy' | 'warning' | 'critical';\n lastUpdated: number;\n history: number[];\n}\n\ninterface HealthReport {\n overall: 'healthy' | 'warning' | 'critical';\n metrics: Record<string, HealthMetric>;\n timestamp: number;\n recommendations: string[];\n}\nexport type { HealthReport };\n\n/**\n * Public interface for a health monitor instance.\n * All state is managed internally via closures — no class syntax.\n */\nexport interface HealthMonitorInstance {\n /** Update a specific health metric value */\n updateMetric(name: string, value: number): void;\n /** Get the current health report */\n getHealthReport(): HealthReport;\n /** Add a listener to be notified when a health check runs */\n addListener(listener: (report: HealthReport) => void): void;\n /** Remove a previously registered listener */\n removeListener(listener: (report: HealthReport) => void): void;\n /** Stop the periodic health monitoring timer */\n stop(): void;\n /** Get historical values for a specific metric */\n getMetricHistory(name: string): number[];\n /** Clear all metric history */\n clearHistory(): void;\n}\n\nconst MAX_HISTORY_SIZE = 100;\nconst CHECK_INTERVAL = 30_000; // 30 seconds\n\nfunction calcStatus(\n value: number,\n threshold: number,\n metricName: string,\n): 'healthy' | 'warning' | 'critical' {\n if (metricName === 'jitCacheHitRate') {\n if (value < threshold * 0.5) return 'critical';\n if (value < threshold) return 'warning';\n return 'healthy';\n }\n if (value > threshold * 2) return 'critical';\n if (value > threshold) return 'warning';\n return 'healthy';\n}\n\nfunction buildRecommendations(metrics: Record<string, HealthMetric>): string[] {\n const out: string[] = [];\n if (metrics.memoryUsage?.status !== 'healthy')\n out.push(\n 'Consider reducing component complexity or implementing better memory cleanup',\n );\n if (metrics.averageRenderTime?.status !== 'healthy')\n out.push(\n 'Optimize component render functions - consider lazy loading or virtualization',\n );\n if (metrics.jitCacheHitRate?.status !== 'healthy')\n out.push(\n 'JIT CSS cache performance is poor - review CSS patterns for optimization',\n );\n if (metrics.componentErrorRate?.status !== 'healthy')\n out.push(\n 'High component error rate detected - review error handling and component logic',\n );\n if (metrics.activeReactiveStates?.status !== 'healthy')\n out.push(\n 'High number of reactive states - consider state consolidation or cleanup',\n );\n if (metrics.memoryLeakIndicator?.status !== 'healthy')\n out.push(\n 'Potential memory leak detected - review component cleanup and event listener management',\n );\n return out;\n}\n\n/**\n * Create a new health monitor instance.\n * All mutable state lives in closures — no `class` or `this`.\n */\nexport function createHealthMonitor(): HealthMonitorInstance {\n const metricsMap = new Map<string, HealthMetric>();\n const listeners = new Set<(report: HealthReport) => void>();\n let intervalId: ReturnType<typeof setInterval> | null = null;\n\n function addMetric(name: string, value: number, threshold: number): void {\n metricsMap.set(name, {\n name,\n value,\n threshold,\n status: 'healthy',\n lastUpdated: Date.now(),\n history: [],\n });\n }\n\n function initializeMetrics(): void {\n addMetric('activeComponents', 0, 1000);\n addMetric('componentCreateRate', 0, 50);\n addMetric('componentErrorRate', 0, 0.1);\n addMetric('memoryUsage', 0, 50 * 1024 * 1024);\n addMetric('memoryGrowthRate', 0, 1024 * 1024);\n addMetric('averageRenderTime', 0, 16);\n addMetric('slowRenderCount', 0, 10);\n addMetric('jitCacheHitRate', 100, 80);\n addMetric('activeReactiveStates', 0, 5000);\n addMetric('dependencyUpdates', 0, 100);\n addMetric('memoryLeakIndicator', 0, 0.1);\n }\n\n function updateMetric(name: string, value: number): void {\n const metric = metricsMap.get(name);\n if (!metric) return;\n metric.value = value;\n metric.lastUpdated = Date.now();\n metric.history.push(value);\n if (metric.history.length > MAX_HISTORY_SIZE) metric.history.shift();\n metric.status = calcStatus(value, metric.threshold, name);\n }\n\n function getHealthReport(): HealthReport {\n const snapshot: Record<string, HealthMetric> = {};\n let overall: 'healthy' | 'warning' | 'critical' = 'healthy';\n for (const [name, metric] of metricsMap) {\n snapshot[name] = { ...metric };\n if (metric.status === 'critical') overall = 'critical';\n else if (metric.status === 'warning' && overall === 'healthy')\n overall = 'warning';\n }\n return {\n overall,\n metrics: snapshot,\n timestamp: Date.now(),\n recommendations: buildRecommendations(snapshot),\n };\n }\n\n function updateMemoryMetrics(): void {\n if (\n 'memory' in performance &&\n (performance as Record<string, unknown>).memory\n ) {\n const mem = (performance as Record<string, unknown>).memory as {\n usedJSHeapSize: number;\n };\n updateMetric('memoryUsage', mem.usedJSHeapSize);\n const m = metricsMap.get('memoryUsage');\n if (m && m.history.length > 1) {\n const prev = m.history[m.history.length - 2];\n const curr = m.history[m.history.length - 1];\n updateMetric('memoryGrowthRate', Math.max(0, curr - prev));\n }\n }\n }\n\n function notifyListeners(report: HealthReport): void {\n for (const listener of listeners) {\n try {\n listener(report);\n } catch (e) {\n devError('Error in health monitor listener:', e);\n }\n }\n }\n\n function performHealthCheck(): void {\n updateMemoryMetrics();\n const report = getHealthReport();\n notifyListeners(report);\n if (report.overall === 'critical')\n devError(\n '🚨 Runtime Health: Critical issues detected',\n report.recommendations,\n );\n else if (report.overall === 'warning')\n devWarn(\n '⚠️ Runtime Health: Performance warnings',\n report.recommendations,\n );\n }\n\n function startMonitoring(): void {\n if (typeof window === 'undefined') return;\n intervalId = setInterval(performHealthCheck, CHECK_INTERVAL);\n }\n\n function stop(): void {\n if (intervalId !== null) {\n clearInterval(intervalId);\n intervalId = null;\n }\n }\n\n function addListener(listener: (report: HealthReport) => void): void {\n listeners.add(listener);\n }\n function removeListener(listener: (report: HealthReport) => void): void {\n listeners.delete(listener);\n }\n function getMetricHistory(name: string): number[] {\n const m = metricsMap.get(name);\n return m ? [...m.history] : [];\n }\n function clearHistory(): void {\n for (const m of metricsMap.values()) m.history = [];\n }\n\n initializeMetrics();\n startMonitoring();\n\n return {\n updateMetric,\n getHealthReport,\n addListener,\n removeListener,\n stop,\n getMetricHistory,\n clearHistory,\n };\n}\n\n// Global singleton\nlet _monitor: HealthMonitorInstance | null = null;\n\n/**\n * Get the global health monitor singleton instance.\n */\nexport function getHealthMonitor(): HealthMonitorInstance {\n if (!_monitor) _monitor = createHealthMonitor();\n return _monitor;\n}\n\n/**\n * Update a health metric from anywhere in the framework.\n */\nexport function updateHealthMetric(name: string, value: number): void {\n getHealthMonitor().updateMetric(name, value);\n}\n\n/**\n * Get the current health status report.\n */\nexport function getHealthStatus(): HealthReport {\n return getHealthMonitor().getHealthReport();\n}\n","/**\n * keep-alive.ts\n *\n * Preserves component state when a component is removed from and later\n * re-inserted into the DOM. By default, custom elements lose all JavaScript\n * state when `disconnectedCallback` fires. `cer-keep-alive` intercepts\n * that lifecycle and keeps the child element alive in memory, re-attaching\n * it when a matching component is re-inserted.\n *\n * ## Usage\n *\n * Wrap any custom element with `<cer-keep-alive>`:\n * ```html\n * <cer-keep-alive>\n * <my-counter></my-counter>\n * </cer-keep-alive>\n * ```\n *\n * Or register it programmatically:\n * ```ts\n * import { registerKeepAlive } from '@jasonshimmy/custom-elements-runtime';\n * registerKeepAlive(); // registers <cer-keep-alive> globally\n * ```\n *\n * ## How it works\n *\n * `cer-keep-alive` uses a slotted layout. When a slotted child component is\n * about to leave the DOM (via a re-render of a parent), KeepAlive intercepts\n * `slotchange` events and preserves the detached child element in an internal\n * cache keyed by tag name. When the same tag re-appears in the slot, the\n * cached element is re-inserted, restoring all JavaScript state.\n *\n * ## Limitations\n *\n * - The first slot child per tag name is cached. Multiple children with the\n * same tag use separate cache entries keyed by their `id` attribute.\n * - Only components registered with the same tag name are matched.\n * - Cache entries can be manually evicted with `clearCache()`.\n */\n\n/** Cache key = tagName[:id] */\ntype CacheKey = string;\n\n/**\n * Register the `<cer-keep-alive>` custom element.\n * Safe to call multiple times — subsequent calls are no-ops.\n *\n * @example\n * ```ts\n * import { registerKeepAlive } from '@jasonshimmy/custom-elements-runtime';\n * registerKeepAlive();\n * ```\n */\nexport function registerKeepAlive(): void {\n if (\n typeof window === 'undefined' ||\n typeof customElements === 'undefined' ||\n customElements.get('cer-keep-alive')\n ) {\n return;\n }\n\n customElements.define('cer-keep-alive', createKeepAliveClass());\n}\n\nfunction createKeepAliveClass(): CustomElementConstructor {\n return class CerKeepAlive extends HTMLElement {\n /** Preserved component instances keyed by tag[:id]. */\n private _cache = new Map<CacheKey, Element>();\n private _slot: HTMLSlotElement | null = null;\n private _slotListener: (() => void) | null = null;\n\n connectedCallback(): void {\n if (!this.shadowRoot) {\n this.attachShadow({ mode: 'open' });\n }\n\n if (!this.shadowRoot!.querySelector('slot')) {\n this.shadowRoot!.innerHTML = '<slot></slot>';\n }\n\n this._slot = this.shadowRoot!.querySelector('slot');\n if (this._slot) {\n this._slotListener = () => this._handleSlotChange();\n this._slot.addEventListener('slotchange', this._slotListener);\n // Process current slotted content\n this._handleSlotChange();\n }\n }\n\n disconnectedCallback(): void {\n if (this._slot && this._slotListener) {\n this._slot.removeEventListener('slotchange', this._slotListener);\n }\n this._slotListener = null;\n }\n\n /**\n * Evict a cached element by its cache key (`tagName` or `tagName:id`).\n * The evicted element is disconnected and removed from the cache.\n */\n clearCache(key?: CacheKey): void {\n if (key) {\n this._cache.delete(key);\n } else {\n this._cache.clear();\n }\n }\n\n private _handleSlotChange(): void {\n if (!this._slot) return;\n\n const slottedElements = this._slot.assignedElements({ flatten: true });\n\n for (const child of slottedElements) {\n const cacheKey = this._buildCacheKey(child);\n\n if (!this._cache.has(cacheKey)) {\n // New element — cache it so we can restore it later\n this._cache.set(cacheKey, child);\n } else {\n const cached = this._cache.get(cacheKey)!;\n if (cached !== child) {\n // A different instance appeared for the same slot.\n // Replace it with the cached instance to restore state.\n try {\n child.parentNode?.replaceChild(cached, child);\n } catch {\n // If replacement fails, update the cache with the new element\n this._cache.set(cacheKey, child);\n }\n }\n }\n }\n }\n\n private _buildCacheKey(el: Element): CacheKey {\n const tag = el.tagName.toLowerCase();\n const id = el.getAttribute('id');\n return id ? `${tag}:${id}` : tag;\n }\n };\n}\n","/**\n * Built-in utility components provided by the custom-elements runtime.\n *\n * These components are registered automatically when this module is imported.\n * They are designed to be minimal, tree-shakeable, and zero-dependency.\n *\n * Included components:\n * - `<cer-suspense>` — Shows a fallback while async work is pending\n * - `<cer-error-boundary>` — Catches render errors and shows a fallback UI\n * - `<cer-keep-alive>` — Preserves component state across DOM removal/re-insertion\n */\n\nimport { component } from './component';\nimport { html } from './template-compiler';\nimport { ref } from './reactive';\nimport { useProps, useOnError, useExpose } from './hooks';\nimport { registerKeepAlive } from '../keep-alive';\n\n// ── cer-suspense ──────────────────────────────────────────────────────────────\n\n/**\n * A built-in component that conditionally renders either the default slot\n * content or the `fallback` slot content, controlled by the `pending` prop.\n *\n * Use the `pending` attribute/property to signal that async work is in\n * progress; the component will swap to the `fallback` slot until `pending`\n * becomes falsy.\n *\n * @example\n * ```html\n * <cer-suspense pending>\n * <!-- shown when pending=false -->\n * <my-async-content></my-async-content>\n *\n * <!-- shown while pending=true -->\n * <div slot=\"fallback\">Loading…</div>\n * </cer-suspense>\n * ```\n *\n * @example Programmatic usage\n * ```ts\n * component('my-data-loader', () => {\n * const pending = ref(true);\n * useOnConnected(async () => {\n * await fetchData();\n * pending.value = false;\n * });\n * return html`\n * <cer-suspense pending=\"${pending.value}\">\n * <my-data-view></my-data-view>\n * <div slot=\"fallback\">Loading data…</div>\n * </cer-suspense>\n * `;\n * });\n * ```\n */\nexport function registerSuspense(): void {\n if (typeof customElements !== 'undefined' && customElements.get('cer-suspense')) return;\n\n component('cer-suspense', () => {\n const { pending } = useProps({ pending: false });\n\n return pending\n ? html`<slot name=\"fallback\"><span>Loading…</span></slot>`\n : html`<slot></slot>`;\n });\n}\n\n// ── cer-error-boundary ────────────────────────────────────────────────────────\n\n/**\n * A built-in component that catches errors thrown during child component\n * rendering and displays a fallback UI instead of crashing the page.\n *\n * Errors are caught via the `useOnError` lifecycle hook. Once an error is\n * caught the component switches to showing the `fallback` named slot (or a\n * default \"Something went wrong\" message if no fallback slot is provided).\n *\n * Call the custom `reset()` method on the element to clear the error and\n * attempt re-rendering the default slot.\n *\n * @example\n * ```html\n * <cer-error-boundary>\n * <my-risky-component></my-risky-component>\n *\n * <div slot=\"fallback\">\n * <p>Something went wrong. <button onclick=\"this.closest('cer-error-boundary').reset()\">Retry</button></p>\n * </div>\n * </cer-error-boundary>\n * ```\n */\nexport function registerErrorBoundary(): void {\n if (typeof customElements !== 'undefined' && customElements.get('cer-error-boundary')) return;\n\n component('cer-error-boundary', () => {\n const hasError = ref(false);\n const errorMessage = ref('');\n\n useOnError((err: Error) => {\n hasError.value = true;\n errorMessage.value = err.message;\n });\n\n // Expose a reset() method so parent templates can call\n // `errorBoundaryRef.value.reset()` to clear the error and retry.\n // Also expose an internal `_cerHandleChildError` receiver so that the\n // component runtime can propagate uncaught errors from slotted child\n // components up to the nearest ancestor <cer-error-boundary>.\n useExpose({\n _cerHandleChildError: (err: unknown) => {\n // Use peek() to read the current value without registering a reactive\n // dependency — the child component's render context may be active when\n // this handler runs, and we must not accidentally subscribe the child\n // to this boundary's internal state.\n if (!hasError.peek()) {\n hasError.value = true;\n errorMessage.value = err instanceof Error ? err.message : String(err);\n }\n },\n reset: () => {\n hasError.value = false;\n errorMessage.value = '';\n },\n });\n\n return hasError.value\n ? html`<slot name=\"fallback\"\n ><div role=\"alert\">\n <strong>Something went wrong.</strong>\n ${errorMessage.value ? html`<p>${errorMessage.value}</p>` : html``}\n </div></slot\n >`\n : html`<slot></slot>`;\n });\n}\n\n// ── Auto-register all components ─────────────────────────────────────────────\n\n/**\n * Register all built-in components (`cer-suspense`, `cer-error-boundary`,\n * `cer-keep-alive`).\n * Safe to call multiple times — each registration is guarded by a\n * `customElements.get()` check.\n */\nexport function registerBuiltinComponents(): void {\n registerSuspense();\n registerErrorBoundary();\n registerKeepAlive();\n}\n","/**\n * teleport.ts\n *\n * Renders virtual DOM content into an arbitrary DOM target located outside\n * the current component's Shadow Root. Useful for modals, tooltips, popovers,\n * and any UI that must visually escape the component boundary.\n *\n * @example\n * ```ts\n * import { component, html, ref, useOnDisconnected, useTeleport } from '@jasonshimmy/custom-elements-runtime';\n *\n * component('modal-trigger', () => {\n * const isOpen = ref(false);\n *\n * // Render modal content into <body> outside the shadow root\n * const { portal, destroy } = useTeleport('#modal-root');\n * useOnDisconnected(destroy);\n *\n * // Call portal() to update the teleported content on each render\n * if (isOpen.value) {\n * portal(html`<div class=\"modal\">\n * <h2>Hello</h2>\n * <button @click=\"${() => (isOpen.value = false)}\">Close</button>\n * </div>`);\n * } else {\n * portal(null);\n * }\n *\n * return html`\n * <button @click=\"${() => (isOpen.value = true)}\">Open modal</button>\n * `;\n * });\n * ```\n */\n\nimport type { VNode, VDomRefs } from './runtime/types';\nimport { vdomRenderer } from './runtime/vdom';\nimport { reactiveSystem } from './runtime/reactive';\nimport { getCurrentComponentContext, isDiscoveryRender } from './runtime/hooks';\n\n/** Handle returned by {@link useTeleport} for managing a portal. */\nexport interface TeleportHandle {\n /**\n * Render (or clear) content at the teleport target.\n * Pass `null` or `undefined` to remove previously rendered content.\n */\n portal(content: VNode | VNode[] | null | undefined): void;\n\n /**\n * Destroy the teleport container and clean up all rendered content.\n * Call this in `useOnDisconnected` to prevent memory leaks.\n */\n destroy(): void;\n}\n\n/**\n * Create a teleport portal that renders content outside the current Shadow Root.\n *\n * @param target - A CSS selector string or an `Element` reference to render into.\n * @returns A {@link TeleportHandle} with `portal()` (update content) and `destroy()` (cleanup).\n *\n * @example\n * ```ts\n * import { component, html, useOnDisconnected, useTeleport } from '@jasonshimmy/custom-elements-runtime';\n *\n * component('my-tooltip', () => {\n * const { portal, destroy } = useTeleport('body');\n * useOnDisconnected(destroy);\n *\n * portal(html`<div class=\"tooltip\">Tooltip content</div>`);\n * return html`<span>Hover me</span>`;\n * });\n * ```\n */\nexport function useTeleport(target: string | Element): TeleportHandle {\n // SSR guard\n if (typeof document === 'undefined') {\n return { portal: () => {}, destroy: () => {} };\n }\n\n // During discovery render the component is not yet mounted — return a no-op\n // handle so the library can detect props/hooks without side-effects.\n if (isDiscoveryRender()) {\n return { portal: () => {}, destroy: () => {} };\n }\n\n // If called inside a component render, use the reactive state-index slot\n // mechanism to ensure the same handle is returned on every re-render of the\n // same component instance. Without this, each re-render would create a new\n // <cer-teleport> container in the target, leaking all but the last one.\n const ctx = getCurrentComponentContext();\n if (ctx) {\n // getOrCreateState uses an incrementing stateIndex that is reset to 0 at\n // the start of each render, so the same call site always gets the same slot.\n const slot = reactiveSystem.getOrCreateState<TeleportHandle | null>(null);\n const existing = slot.peek();\n if (existing !== null) {\n return existing;\n }\n // First render: create the handle and store it without triggering a\n // reactive update (initSilent bypasses triggerUpdate).\n // Pass a slot-invalidation callback so that destroy() clears the slot,\n // allowing a reconnected component to create a fresh container.\n const handle = _createTeleportHandle(target, () => slot.initSilent(null));\n slot.initSilent(handle);\n return handle;\n }\n\n // Outside a component context (e.g. called directly in tests or scripts):\n // fall through to a non-cached, non-stable handle.\n return _createTeleportHandle(target);\n}\n\n/** Internal: create a fresh teleport handle pointing at `target`.\n * @param onDestroy - Optional callback invoked after cleanup in destroy(), used\n * to invalidate a cached slot so the next render creates a fresh handle.\n */\nfunction _createTeleportHandle(\n target: string | Element,\n onDestroy?: () => void,\n): TeleportHandle {\n const targetEl =\n typeof target === 'string'\n ? (document.querySelector(target) as Element | null)\n : target;\n\n if (!targetEl) {\n console.warn(\n `[useTeleport] Target \"${String(target)}\" not found in the document. ` +\n 'Teleported content will not be rendered.',\n );\n return { portal: () => {}, destroy: () => {} };\n }\n\n // Create a dedicated container so we never clobber sibling content.\n const container = document.createElement('cer-teleport');\n container.dataset.cerTeleport = '';\n targetEl.appendChild(container);\n\n // Shared refs bag — passed consistently so ref directives work across updates.\n const refs: VDomRefs = {};\n\n const handle: TeleportHandle = {\n portal(content: VNode | VNode[] | null | undefined): void {\n const nodes: VNode[] =\n content == null ? [] : Array.isArray(content) ? content : [content];\n // vdomRenderer stores _prevVNode/_prevDom on the root object for diffing.\n // Casting to ShadowRoot is safe: we only access properties that exist on\n // HTMLElement (firstChild, appendChild, replaceChild, childNodes).\n vdomRenderer(container as unknown as ShadowRoot, nodes, undefined, refs);\n },\n\n destroy(): void {\n // Render empty nodes to clean up event listeners and refs.\n try {\n vdomRenderer(container as unknown as ShadowRoot, [], undefined, refs);\n } catch {\n /* best-effort cleanup */\n }\n if (container.parentNode) {\n container.parentNode.removeChild(container);\n }\n // Invalidate the cached slot so that if the component reconnects and\n // re-renders, useTeleport() creates a fresh container rather than\n // reusing this destroyed one.\n onDestroy?.();\n },\n };\n\n return handle;\n}\n"],"mappings":"sQAiCA,SAAgB,EAAW,EAA2B,SAAgB,CAChE,OAAO,YAAgB,MAEzB,aAAgB,SAAW,EAAK,gBAAmB,GAC9C,cACL,IAAI,YAAY,cAAe,CAAE,QAAS,GAAM,SAAU,GAAM,CAAC,CAClE,CCMH,IAAM,EAAmB,IACnB,EAAiB,IAEvB,SAAS,EACP,EACA,EACA,EACoC,CAQpC,OAPI,IAAe,kBACb,EAAQ,EAAY,GAAY,WAChC,EAAQ,EAAkB,UACvB,UAEL,EAAQ,EAAY,EAAU,WAC9B,EAAQ,EAAkB,UACvB,UAGT,SAAS,EAAqB,EAAiD,CAC7E,IAAM,EAAgB,EAAE,CAyBxB,OAxBI,EAAQ,aAAa,SAAW,WAClC,EAAI,KACF,+EACD,CACC,EAAQ,mBAAmB,SAAW,WACxC,EAAI,KACF,gFACD,CACC,EAAQ,iBAAiB,SAAW,WACtC,EAAI,KACF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,CAC/B,CAGP,IAAM,EAAO,EAAA,EAAe,iBAAwC,KAAK,CACnE,EAAW,EAAK,MAAM,CAC5B,GAAI,IAAa,KACf,OAAO,EAMT,IAAM,EAAS,EAAsB,MAAc,EAAK,WAAW,KAAK,CAAC,CAEzE,OADA,EAAK,WAAW,EAAO,CAChB,EAKT,OAAO,EAAsB,EAAO,CAOtC,SAAS,EACP,EACA,EACgB,CAChB,IAAM,EACJ,OAAO,GAAW,SACb,SAAS,cAAc,EAAO,CAC/B,EAEN,GAAI,CAAC,EAKH,OAJA,QAAQ,KACN,yBAAyB,OAAO,EAAO,CAAC,uEAEzC,CACM,CAAE,WAAc,GAAI,YAAe,GAAI,CAIhD,IAAM,EAAY,SAAS,cAAc,eAAe,CACxD,EAAU,QAAQ,YAAc,GAChC,EAAS,YAAY,EAAU,CAG/B,IAAM,EAAiB,EAAE,CA6BzB,MA3B+B,CAC7B,OAAO,EAAmD,CAMxD,EAAA,EAAa,EAJX,GAAW,KAAO,EAAE,CAAG,MAAM,QAAQ,EAAQ,CAAG,EAAU,CAAC,EAAQ,CAIb,IAAA,GAAW,EAAK,EAG1E,SAAgB,CAEd,GAAI,CACF,EAAA,EAAa,EAAoC,EAAE,CAAE,IAAA,GAAW,EAAK,MAC/D,EAGJ,EAAU,YACZ,EAAU,WAAW,YAAY,EAAU,CAK7C,KAAa,EAEhB"}
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value
|
|
2
|
-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e={slate:{50:`#f8fafc`,100:`#f1f5f9`,200:`#e2e8f0`,300:`#cbd5e1`,400:`#94a3b8`,500:`#64748b`,600:`#475569`,700:`#334155`,800:`#1e293b`,900:`#0f172a`,950:`#020617`},gray:{50:`#f9fafb`,100:`#f3f4f6`,200:`#e5e7eb`,300:`#d1d5db`,400:`#9ca3af`,500:`#6b7280`,600:`#4b5563`,700:`#374151`,800:`#1f2937`,900:`#111827`,950:`#030712`},zinc:{50:`#fafafa`,100:`#f4f4f5`,200:`#e4e4e7`,300:`#d4d4d8`,400:`#a1a1aa`,500:`#71717a`,600:`#52525b`,700:`#3f3f46`,800:`#27272a`,900:`#18181b`,950:`#09090b`},stone:{50:`#fafaf9`,100:`#f5f5f4`,200:`#e7e5e4`,300:`#d6d3d1`,400:`#a8a29e`,500:`#78716c`,600:`#57534e`,700:`#44403c`,800:`#292524`,900:`#1c1917`,950:`#0c0a09`},red:{50:`#fef2f2`,100:`#fee2e2`,200:`#fecaca`,300:`#fca5a5`,400:`#f87171`,500:`#ef4444`,600:`#dc2626`,700:`#b91c1c`,800:`#991b1b`,900:`#7f1d1d`,950:`#450a0a`},orange:{50:`#fff7ed`,100:`#ffedd5`,200:`#fed7aa`,300:`#fdba74`,400:`#fb923c`,500:`#f97316`,600:`#ea580c`,700:`#c2410c`,800:`#9a3412`,900:`#7c2d12`,950:`#431407`},amber:{50:`#fffbeb`,100:`#fef3c7`,200:`#fde68a`,300:`#fcd34d`,400:`#fbbf24`,500:`#f59e0b`,600:`#d97706`,700:`#b45309`,800:`#92400e`,900:`#78350f`,950:`#451a03`},yellow:{50:`#fefce8`,100:`#fef9c3`,200:`#fef08a`,300:`#fde047`,400:`#facc15`,500:`#eab308`,600:`#ca8a04`,700:`#a16207`,800:`#854d0e`,900:`#713f12`,950:`#422006`},lime:{50:`#f7fee7`,100:`#ecfccb`,200:`#d9f99d`,300:`#bef264`,400:`#a3e635`,500:`#84cc16`,600:`#65a30d`,700:`#4d7c0f`,800:`#3f6212`,900:`#365314`,950:`#1a2e05`},green:{50:`#f0fdf4`,100:`#dcfce7`,200:`#bbf7d0`,300:`#86efac`,400:`#4ade80`,500:`#22c55e`,600:`#16a34a`,700:`#15803d`,800:`#166534`,900:`#14532d`,950:`#052e16`},emerald:{50:`#ecfdf5`,100:`#d1fae5`,200:`#a7f3d0`,300:`#6ee7b7`,400:`#34d399`,500:`#10b981`,600:`#059669`,700:`#047857`,800:`#065f46`,900:`#064e3b`,950:`#022c22`},teal:{50:`#f0fdfa`,100:`#ccfbf1`,200:`#99f6e4`,300:`#5eead4`,400:`#2dd4bf`,500:`#14b8a6`,600:`#0d9488`,700:`#0f766e`,800:`#115e59`,900:`#134e4a`,950:`#042f2e`},cyan:{50:`#ecfeff`,100:`#cffafe`,200:`#a5f3fc`,300:`#67e8f9`,400:`#22d3ee`,500:`#06b6d4`,600:`#0891b2`,700:`#0e7490`,800:`#155e75`,900:`#164e63`,950:`#083344`},sky:{50:`#f0f9ff`,100:`#e0f2fe`,200:`#bae6fd`,300:`#7dd3fc`,400:`#38bdf8`,500:`#0ea5e9`,600:`#0284c7`,700:`#0369a1`,800:`#075985`,900:`#0c4a6e`,950:`#082f49`},blue:{50:`#eff6ff`,100:`#dbeafe`,200:`#bfdbfe`,300:`#93c5fd`,400:`#60a5fa`,500:`#3b82f6`,600:`#2563eb`,700:`#1d4ed8`,800:`#1e40af`,900:`#1e3a8a`,950:`#172554`},indigo:{50:`#eef2ff`,100:`#e0e7ff`,200:`#c7d2fe`,300:`#a5b4fc`,400:`#818cf8`,500:`#6366f1`,600:`#4f46e5`,700:`#4338ca`,800:`#3730a3`,900:`#312e81`,950:`#1e1b4b`},violet:{50:`#f5f3ff`,100:`#ede9fe`,200:`#ddd6fe`,300:`#c4b5fd`,400:`#a78bfa`,500:`#8b5cf6`,600:`#7c3aed`,700:`#6d28d9`,800:`#5b21b6`,900:`#4c1d95`,950:`#2e1065`},purple:{50:`#faf5ff`,100:`#f3e8ff`,200:`#e9d5ff`,300:`#d8b4fe`,400:`#c084fc`,500:`#a855f7`,600:`#9333ea`,700:`#7e22ce`,800:`#6b21a8`,900:`#581c87`,950:`#3b0764`},fuchsia:{50:`#fdf4ff`,100:`#fae8ff`,200:`#f5d0fe`,300:`#f0abfc`,400:`#e879f9`,500:`#d946ef`,600:`#c026d3`,700:`#a21caf`,800:`#86198f`,900:`#701a75`,950:`#4a044e`},pink:{50:`#fdf2f8`,100:`#fce7f3`,200:`#fbcfe8`,300:`#f9a8d4`,400:`#f472b6`,500:`#ec4899`,600:`#db2777`,700:`#be185d`,800:`#9d174d`,900:`#831843`,950:`#500724`},rose:{50:`#fff1f2`,100:`#ffe4e6`,200:`#fecdd3`,300:`#fda4af`,400:`#fb7185`,500:`#f43f5e`,600:`#e11d48`,700:`#be123c`,800:`#9f1239`,900:`#881337`,950:`#4c0519`}};exports.extendedColors=e;
|
|
3
2
|
//# sourceMappingURL=custom-elements-runtime.colors.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"custom-elements-runtime.colors.cjs.js","names":[],"sources":["../src/lib/css/colors.ts"],"sourcesContent":["/**\n * Extended Tailwind-compatible color palette — opt-in module.\n *\n * Import individual color objects or the full palette as needed.\n *\n * @example\n * ```ts\n * import { extendedColors } from '@jasonshimmy/custom-elements-runtime/css/colors';\n * ```\n */\n\n/** A single color scale with shade keys 50–950. */\nexport type ColorScale = Record<string, string>;\n\n/** Full extended color palette with Tailwind-compatible color names. */\nexport const extendedColors: Record<string, ColorScale> = {\n slate: {\n '50': '#f8fafc',\n '100': '#f1f5f9',\n '200': '#e2e8f0',\n '300': '#cbd5e1',\n '400': '#94a3b8',\n '500': '#64748b',\n '600': '#475569',\n '700': '#334155',\n '800': '#1e293b',\n '900': '#0f172a',\n '950': '#020617',\n },\n gray: {\n '50': '#f9fafb',\n '100': '#f3f4f6',\n '200': '#e5e7eb',\n '300': '#d1d5db',\n '400': '#9ca3af',\n '500': '#6b7280',\n '600': '#4b5563',\n '700': '#374151',\n '800': '#1f2937',\n '900': '#111827',\n '950': '#030712',\n },\n zinc: {\n '50': '#fafafa',\n '100': '#f4f4f5',\n '200': '#e4e4e7',\n '300': '#d4d4d8',\n '400': '#a1a1aa',\n '500': '#71717a',\n '600': '#52525b',\n '700': '#3f3f46',\n '800': '#27272a',\n '900': '#18181b',\n '950': '#09090b',\n },\n stone: {\n '50': '#fafaf9',\n '100': '#f5f5f4',\n '200': '#e7e5e4',\n '300': '#d6d3d1',\n '400': '#a8a29e',\n '500': '#78716c',\n '600': '#57534e',\n '700': '#44403c',\n '800': '#292524',\n '900': '#1c1917',\n '950': '#0c0a09',\n },\n red: {\n '50': '#fef2f2',\n '100': '#fee2e2',\n '200': '#fecaca',\n '300': '#fca5a5',\n '400': '#f87171',\n '500': '#ef4444',\n '600': '#dc2626',\n '700': '#b91c1c',\n '800': '#991b1b',\n '900': '#7f1d1d',\n '950': '#450a0a',\n },\n orange: {\n '50': '#fff7ed',\n '100': '#ffedd5',\n '200': '#fed7aa',\n '300': '#fdba74',\n '400': '#fb923c',\n '500': '#f97316',\n '600': '#ea580c',\n '700': '#c2410c',\n '800': '#9a3412',\n '900': '#7c2d12',\n '950': '#431407',\n },\n amber: {\n '50': '#fffbeb',\n '100': '#fef3c7',\n '200': '#fde68a',\n '300': '#fcd34d',\n '400': '#fbbf24',\n '500': '#f59e0b',\n '600': '#d97706',\n '700': '#b45309',\n '800': '#92400e',\n '900': '#78350f',\n '950': '#451a03',\n },\n yellow: {\n '50': '#fefce8',\n '100': '#fef9c3',\n '200': '#fef08a',\n '300': '#fde047',\n '400': '#facc15',\n '500': '#eab308',\n '600': '#ca8a04',\n '700': '#a16207',\n '800': '#854d0e',\n '900': '#713f12',\n '950': '#422006',\n },\n lime: {\n '50': '#f7fee7',\n '100': '#ecfccb',\n '200': '#d9f99d',\n '300': '#bef264',\n '400': '#a3e635',\n '500': '#84cc16',\n '600': '#65a30d',\n '700': '#4d7c0f',\n '800': '#3f6212',\n '900': '#365314',\n '950': '#1a2e05',\n },\n green: {\n '50': '#f0fdf4',\n '100': '#dcfce7',\n '200': '#bbf7d0',\n '300': '#86efac',\n '400': '#4ade80',\n '500': '#22c55e',\n '600': '#16a34a',\n '700': '#15803d',\n '800': '#166534',\n '900': '#14532d',\n '950': '#052e16',\n },\n emerald: {\n '50': '#ecfdf5',\n '100': '#d1fae5',\n '200': '#a7f3d0',\n '300': '#6ee7b7',\n '400': '#34d399',\n '500': '#10b981',\n '600': '#059669',\n '700': '#047857',\n '800': '#065f46',\n '900': '#064e3b',\n '950': '#022c22',\n },\n teal: {\n '50': '#f0fdfa',\n '100': '#ccfbf1',\n '200': '#99f6e4',\n '300': '#5eead4',\n '400': '#2dd4bf',\n '500': '#14b8a6',\n '600': '#0d9488',\n '700': '#0f766e',\n '800': '#115e59',\n '900': '#134e4a',\n '950': '#042f2e',\n },\n cyan: {\n '50': '#ecfeff',\n '100': '#cffafe',\n '200': '#a5f3fc',\n '300': '#67e8f9',\n '400': '#22d3ee',\n '500': '#06b6d4',\n '600': '#0891b2',\n '700': '#0e7490',\n '800': '#155e75',\n '900': '#164e63',\n '950': '#083344',\n },\n sky: {\n '50': '#f0f9ff',\n '100': '#e0f2fe',\n '200': '#bae6fd',\n '300': '#7dd3fc',\n '400': '#38bdf8',\n '500': '#0ea5e9',\n '600': '#0284c7',\n '700': '#0369a1',\n '800': '#075985',\n '900': '#0c4a6e',\n '950': '#082f49',\n },\n blue: {\n '50': '#eff6ff',\n '100': '#dbeafe',\n '200': '#bfdbfe',\n '300': '#93c5fd',\n '400': '#60a5fa',\n '500': '#3b82f6',\n '600': '#2563eb',\n '700': '#1d4ed8',\n '800': '#1e40af',\n '900': '#1e3a8a',\n '950': '#172554',\n },\n indigo: {\n '50': '#eef2ff',\n '100': '#e0e7ff',\n '200': '#c7d2fe',\n '300': '#a5b4fc',\n '400': '#818cf8',\n '500': '#6366f1',\n '600': '#4f46e5',\n '700': '#4338ca',\n '800': '#3730a3',\n '900': '#312e81',\n '950': '#1e1b4b',\n },\n violet: {\n '50': '#f5f3ff',\n '100': '#ede9fe',\n '200': '#ddd6fe',\n '300': '#c4b5fd',\n '400': '#a78bfa',\n '500': '#8b5cf6',\n '600': '#7c3aed',\n '700': '#6d28d9',\n '800': '#5b21b6',\n '900': '#4c1d95',\n '950': '#2e1065',\n },\n purple: {\n '50': '#faf5ff',\n '100': '#f3e8ff',\n '200': '#e9d5ff',\n '300': '#d8b4fe',\n '400': '#c084fc',\n '500': '#a855f7',\n '600': '#9333ea',\n '700': '#7e22ce',\n '800': '#6b21a8',\n '900': '#581c87',\n '950': '#3b0764',\n },\n fuchsia: {\n '50': '#fdf4ff',\n '100': '#fae8ff',\n '200': '#f5d0fe',\n '300': '#f0abfc',\n '400': '#e879f9',\n '500': '#d946ef',\n '600': '#c026d3',\n '700': '#a21caf',\n '800': '#86198f',\n '900': '#701a75',\n '950': '#4a044e',\n },\n pink: {\n '50': '#fdf2f8',\n '100': '#fce7f3',\n '200': '#fbcfe8',\n '300': '#f9a8d4',\n '400': '#f472b6',\n '500': '#ec4899',\n '600': '#db2777',\n '700': '#be185d',\n '800': '#9d174d',\n '900': '#831843',\n '950': '#500724',\n },\n rose: {\n '50': '#fff1f2',\n '100': '#ffe4e6',\n '200': '#fecdd3',\n '300': '#fda4af',\n '400': '#fb7185',\n '500': '#f43f5e',\n '600': '#e11d48',\n '700': '#be123c',\n '800': '#9f1239',\n '900': '#881337',\n '950': '#4c0519',\n },\n};\n"],"mappings":"mEAeA,IAAa,EAA6C,CACxD,MAAO,CACL,GAAM,UACN,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,
|
|
1
|
+
{"version":3,"file":"custom-elements-runtime.colors.cjs.js","names":[],"sources":["../src/lib/css/colors.ts"],"sourcesContent":["/**\n * Extended Tailwind-compatible color palette — opt-in module.\n *\n * Import individual color objects or the full palette as needed.\n *\n * @example\n * ```ts\n * import { extendedColors } from '@jasonshimmy/custom-elements-runtime/css/colors';\n * ```\n */\n\n/** A single color scale with shade keys 50–950. */\nexport type ColorScale = Record<string, string>;\n\n/** Full extended color palette with Tailwind-compatible color names. */\nexport const extendedColors: Record<string, ColorScale> = {\n slate: {\n '50': '#f8fafc',\n '100': '#f1f5f9',\n '200': '#e2e8f0',\n '300': '#cbd5e1',\n '400': '#94a3b8',\n '500': '#64748b',\n '600': '#475569',\n '700': '#334155',\n '800': '#1e293b',\n '900': '#0f172a',\n '950': '#020617',\n },\n gray: {\n '50': '#f9fafb',\n '100': '#f3f4f6',\n '200': '#e5e7eb',\n '300': '#d1d5db',\n '400': '#9ca3af',\n '500': '#6b7280',\n '600': '#4b5563',\n '700': '#374151',\n '800': '#1f2937',\n '900': '#111827',\n '950': '#030712',\n },\n zinc: {\n '50': '#fafafa',\n '100': '#f4f4f5',\n '200': '#e4e4e7',\n '300': '#d4d4d8',\n '400': '#a1a1aa',\n '500': '#71717a',\n '600': '#52525b',\n '700': '#3f3f46',\n '800': '#27272a',\n '900': '#18181b',\n '950': '#09090b',\n },\n stone: {\n '50': '#fafaf9',\n '100': '#f5f5f4',\n '200': '#e7e5e4',\n '300': '#d6d3d1',\n '400': '#a8a29e',\n '500': '#78716c',\n '600': '#57534e',\n '700': '#44403c',\n '800': '#292524',\n '900': '#1c1917',\n '950': '#0c0a09',\n },\n red: {\n '50': '#fef2f2',\n '100': '#fee2e2',\n '200': '#fecaca',\n '300': '#fca5a5',\n '400': '#f87171',\n '500': '#ef4444',\n '600': '#dc2626',\n '700': '#b91c1c',\n '800': '#991b1b',\n '900': '#7f1d1d',\n '950': '#450a0a',\n },\n orange: {\n '50': '#fff7ed',\n '100': '#ffedd5',\n '200': '#fed7aa',\n '300': '#fdba74',\n '400': '#fb923c',\n '500': '#f97316',\n '600': '#ea580c',\n '700': '#c2410c',\n '800': '#9a3412',\n '900': '#7c2d12',\n '950': '#431407',\n },\n amber: {\n '50': '#fffbeb',\n '100': '#fef3c7',\n '200': '#fde68a',\n '300': '#fcd34d',\n '400': '#fbbf24',\n '500': '#f59e0b',\n '600': '#d97706',\n '700': '#b45309',\n '800': '#92400e',\n '900': '#78350f',\n '950': '#451a03',\n },\n yellow: {\n '50': '#fefce8',\n '100': '#fef9c3',\n '200': '#fef08a',\n '300': '#fde047',\n '400': '#facc15',\n '500': '#eab308',\n '600': '#ca8a04',\n '700': '#a16207',\n '800': '#854d0e',\n '900': '#713f12',\n '950': '#422006',\n },\n lime: {\n '50': '#f7fee7',\n '100': '#ecfccb',\n '200': '#d9f99d',\n '300': '#bef264',\n '400': '#a3e635',\n '500': '#84cc16',\n '600': '#65a30d',\n '700': '#4d7c0f',\n '800': '#3f6212',\n '900': '#365314',\n '950': '#1a2e05',\n },\n green: {\n '50': '#f0fdf4',\n '100': '#dcfce7',\n '200': '#bbf7d0',\n '300': '#86efac',\n '400': '#4ade80',\n '500': '#22c55e',\n '600': '#16a34a',\n '700': '#15803d',\n '800': '#166534',\n '900': '#14532d',\n '950': '#052e16',\n },\n emerald: {\n '50': '#ecfdf5',\n '100': '#d1fae5',\n '200': '#a7f3d0',\n '300': '#6ee7b7',\n '400': '#34d399',\n '500': '#10b981',\n '600': '#059669',\n '700': '#047857',\n '800': '#065f46',\n '900': '#064e3b',\n '950': '#022c22',\n },\n teal: {\n '50': '#f0fdfa',\n '100': '#ccfbf1',\n '200': '#99f6e4',\n '300': '#5eead4',\n '400': '#2dd4bf',\n '500': '#14b8a6',\n '600': '#0d9488',\n '700': '#0f766e',\n '800': '#115e59',\n '900': '#134e4a',\n '950': '#042f2e',\n },\n cyan: {\n '50': '#ecfeff',\n '100': '#cffafe',\n '200': '#a5f3fc',\n '300': '#67e8f9',\n '400': '#22d3ee',\n '500': '#06b6d4',\n '600': '#0891b2',\n '700': '#0e7490',\n '800': '#155e75',\n '900': '#164e63',\n '950': '#083344',\n },\n sky: {\n '50': '#f0f9ff',\n '100': '#e0f2fe',\n '200': '#bae6fd',\n '300': '#7dd3fc',\n '400': '#38bdf8',\n '500': '#0ea5e9',\n '600': '#0284c7',\n '700': '#0369a1',\n '800': '#075985',\n '900': '#0c4a6e',\n '950': '#082f49',\n },\n blue: {\n '50': '#eff6ff',\n '100': '#dbeafe',\n '200': '#bfdbfe',\n '300': '#93c5fd',\n '400': '#60a5fa',\n '500': '#3b82f6',\n '600': '#2563eb',\n '700': '#1d4ed8',\n '800': '#1e40af',\n '900': '#1e3a8a',\n '950': '#172554',\n },\n indigo: {\n '50': '#eef2ff',\n '100': '#e0e7ff',\n '200': '#c7d2fe',\n '300': '#a5b4fc',\n '400': '#818cf8',\n '500': '#6366f1',\n '600': '#4f46e5',\n '700': '#4338ca',\n '800': '#3730a3',\n '900': '#312e81',\n '950': '#1e1b4b',\n },\n violet: {\n '50': '#f5f3ff',\n '100': '#ede9fe',\n '200': '#ddd6fe',\n '300': '#c4b5fd',\n '400': '#a78bfa',\n '500': '#8b5cf6',\n '600': '#7c3aed',\n '700': '#6d28d9',\n '800': '#5b21b6',\n '900': '#4c1d95',\n '950': '#2e1065',\n },\n purple: {\n '50': '#faf5ff',\n '100': '#f3e8ff',\n '200': '#e9d5ff',\n '300': '#d8b4fe',\n '400': '#c084fc',\n '500': '#a855f7',\n '600': '#9333ea',\n '700': '#7e22ce',\n '800': '#6b21a8',\n '900': '#581c87',\n '950': '#3b0764',\n },\n fuchsia: {\n '50': '#fdf4ff',\n '100': '#fae8ff',\n '200': '#f5d0fe',\n '300': '#f0abfc',\n '400': '#e879f9',\n '500': '#d946ef',\n '600': '#c026d3',\n '700': '#a21caf',\n '800': '#86198f',\n '900': '#701a75',\n '950': '#4a044e',\n },\n pink: {\n '50': '#fdf2f8',\n '100': '#fce7f3',\n '200': '#fbcfe8',\n '300': '#f9a8d4',\n '400': '#f472b6',\n '500': '#ec4899',\n '600': '#db2777',\n '700': '#be185d',\n '800': '#9d174d',\n '900': '#831843',\n '950': '#500724',\n },\n rose: {\n '50': '#fff1f2',\n '100': '#ffe4e6',\n '200': '#fecdd3',\n '300': '#fda4af',\n '400': '#fb7185',\n '500': '#f43f5e',\n '600': '#e11d48',\n '700': '#be123c',\n '800': '#9f1239',\n '900': '#881337',\n '950': '#4c0519',\n },\n};\n"],"mappings":"mEAeA,IAAa,EAA6C,CACxD,MAAO,CACL,GAAM,UACN,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACR,CACD,KAAM,CACJ,GAAM,UACN,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACR,CACD,KAAM,CACJ,GAAM,UACN,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACR,CACD,MAAO,CACL,GAAM,UACN,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACR,CACD,IAAK,CACH,GAAM,UACN,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACR,CACD,OAAQ,CACN,GAAM,UACN,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACR,CACD,MAAO,CACL,GAAM,UACN,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACR,CACD,OAAQ,CACN,GAAM,UACN,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACR,CACD,KAAM,CACJ,GAAM,UACN,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACR,CACD,MAAO,CACL,GAAM,UACN,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACR,CACD,QAAS,CACP,GAAM,UACN,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACR,CACD,KAAM,CACJ,GAAM,UACN,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACR,CACD,KAAM,CACJ,GAAM,UACN,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACR,CACD,IAAK,CACH,GAAM,UACN,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACR,CACD,KAAM,CACJ,GAAM,UACN,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACR,CACD,OAAQ,CACN,GAAM,UACN,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACR,CACD,OAAQ,CACN,GAAM,UACN,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACR,CACD,OAAQ,CACN,GAAM,UACN,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACR,CACD,QAAS,CACP,GAAM,UACN,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACR,CACD,KAAM,CACJ,GAAM,UACN,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACR,CACD,KAAM,CACJ,GAAM,UACN,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACP,IAAO,UACR,CACF"}
|