@jasonshimmy/custom-elements-runtime 1.2.3 → 2.0.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.
Files changed (75) hide show
  1. package/README.md +157 -83
  2. package/dist/custom-elements-runtime.cjs.js +6 -149
  3. package/dist/custom-elements-runtime.cjs.js.map +1 -1
  4. package/dist/custom-elements-runtime.directive-enhancements.cjs.js +2 -0
  5. package/dist/custom-elements-runtime.directive-enhancements.cjs.js.map +1 -0
  6. package/dist/custom-elements-runtime.directive-enhancements.es.js +144 -0
  7. package/dist/custom-elements-runtime.directive-enhancements.es.js.map +1 -0
  8. package/dist/custom-elements-runtime.directives.cjs.js +2 -0
  9. package/dist/custom-elements-runtime.directives.cjs.js.map +1 -0
  10. package/dist/custom-elements-runtime.directives.es.js +49 -0
  11. package/dist/custom-elements-runtime.directives.es.js.map +1 -0
  12. package/dist/custom-elements-runtime.es.js +2147 -4451
  13. package/dist/custom-elements-runtime.es.js.map +1 -1
  14. package/dist/custom-elements-runtime.event-bus.cjs.js +2 -0
  15. package/dist/custom-elements-runtime.event-bus.cjs.js.map +1 -0
  16. package/dist/custom-elements-runtime.event-bus.es.js +147 -0
  17. package/dist/custom-elements-runtime.event-bus.es.js.map +1 -0
  18. package/dist/custom-elements-runtime.router.cjs.js +29 -0
  19. package/dist/custom-elements-runtime.router.cjs.js.map +1 -0
  20. package/dist/custom-elements-runtime.router.es.js +305 -0
  21. package/dist/custom-elements-runtime.router.es.js.map +1 -0
  22. package/dist/custom-elements-runtime.ssr.cjs.js +2 -0
  23. package/dist/custom-elements-runtime.ssr.cjs.js.map +1 -0
  24. package/dist/custom-elements-runtime.ssr.es.js +18 -0
  25. package/dist/custom-elements-runtime.ssr.es.js.map +1 -0
  26. package/dist/custom-elements-runtime.store.cjs.js +2 -0
  27. package/dist/custom-elements-runtime.store.cjs.js.map +1 -0
  28. package/dist/custom-elements-runtime.store.es.js +25 -0
  29. package/dist/custom-elements-runtime.store.es.js.map +1 -0
  30. package/dist/custom-elements-runtime.transitions.cjs.js +2 -0
  31. package/dist/custom-elements-runtime.transitions.cjs.js.map +1 -0
  32. package/dist/custom-elements-runtime.transitions.es.js +10 -0
  33. package/dist/custom-elements-runtime.transitions.es.js.map +1 -0
  34. package/dist/directive-enhancements.d.ts +6 -6
  35. package/dist/directives.d.ts +2 -2
  36. package/dist/event-bus.d.ts +20 -11
  37. package/dist/helpers-CDfJhmMS.js +609 -0
  38. package/dist/helpers-CDfJhmMS.js.map +1 -0
  39. package/dist/helpers-D3UjNfYY.cjs +5 -0
  40. package/dist/helpers-D3UjNfYY.cjs.map +1 -0
  41. package/dist/index.d.ts +6 -20
  42. package/dist/logger-BpibrmKL.js +25 -0
  43. package/dist/logger-BpibrmKL.js.map +1 -0
  44. package/dist/logger-CqdBMdui.cjs +2 -0
  45. package/dist/logger-CqdBMdui.cjs.map +1 -0
  46. package/dist/router.d.ts +6 -6
  47. package/dist/runtime/component.d.ts +3 -3
  48. package/dist/runtime/event-manager.d.ts +3 -3
  49. package/dist/runtime/helpers.d.ts +4 -4
  50. package/dist/runtime/hooks.d.ts +3 -3
  51. package/dist/runtime/lifecycle.d.ts +1 -1
  52. package/dist/runtime/logger.d.ts +3 -3
  53. package/dist/runtime/node-metadata.d.ts +11 -2
  54. package/dist/runtime/props.d.ts +2 -2
  55. package/dist/runtime/reactive-proxy-cache.d.ts +6 -3
  56. package/dist/runtime/reactive.d.ts +5 -4
  57. package/dist/runtime/render.d.ts +4 -4
  58. package/dist/runtime/secure-expression-evaluator.d.ts +1 -1
  59. package/dist/runtime/template-compiler.d.ts +10 -10
  60. package/dist/runtime/transition-group-handler.d.ts +21 -0
  61. package/dist/runtime/transition-utils.d.ts +43 -3
  62. package/dist/runtime/types.d.ts +27 -17
  63. package/dist/runtime/vdom-model-helpers.d.ts +7 -7
  64. package/dist/runtime/vdom-ssr.d.ts +9 -0
  65. package/dist/runtime/vdom.d.ts +30 -22
  66. package/dist/runtime/watchers.d.ts +3 -3
  67. package/dist/ssr.d.ts +6 -0
  68. package/dist/transitions-Crm12oGl.cjs +115 -0
  69. package/dist/transitions-Crm12oGl.cjs.map +1 -0
  70. package/dist/transitions-D5YybtBE.js +1415 -0
  71. package/dist/transitions-D5YybtBE.js.map +1 -0
  72. package/dist/transitions.d.ts +5 -0
  73. package/package.json +56 -8
  74. package/dist/custom-elements-runtime.umd.js +0 -156
  75. package/dist/custom-elements-runtime.umd.js.map +0 -1
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./custom-elements-runtime.directives.cjs.js");function g(n,e){return c.when(!n,e)}function m(n,e){const r=!n||n.length===0;return c.when(r,e)}function k(n,e){const r=!!(n&&n.length>0);return c.when(r,e)}function y(n,e,r){const t=[];return n.forEach((o,i)=>{e(o,i)&&t.push({item:o,originalIndex:i})}),t.map(({item:o,originalIndex:i},a)=>{const l=typeof o=="object"&&o!=null?o?.key??o?.id??`filtered-${i}`:`filtered-${i}`;return c.anchorBlock(r(o,i,a),`each-where-${l}`)})}function B(n,e){const r=n?.length??0;return r===0&&e.empty?c.anchorBlock(e.empty,"switch-length-empty"):r===1&&e.one?c.anchorBlock(e.one(n[0]),"switch-length-one"):e.exactly?.[r]?c.anchorBlock(e.exactly[r](n),`switch-length-${r}`):r>1&&e.many?c.anchorBlock(e.many(n),"switch-length-many"):c.anchorBlock([],"switch-length-fallback")}function x(n,e,r){const t=new Map;return n.forEach(o=>{const i=e(o);t.has(i)||t.set(i,[]),t.get(i).push(o)}),Array.from(t.entries()).map(([o,i],a)=>c.anchorBlock(r(o,i,a),`each-group-${o}`))}function v(n,e,r,t){const o=r*e,i=Math.min(o+e,n.length);return n.slice(o,i).map((l,p)=>{const u=o+p,w=typeof l=="object"&&l!=null?l?.key??l?.id??`page-${u}`:`page-${u}`;return c.anchorBlock(t(l,u,p),`each-page-${w}`)})}function b(n,e){return n.loading&&e.loading?c.anchorBlock(e.loading,"promise-loading"):n.error&&e.error?c.anchorBlock(e.error(n.error),"promise-error"):n.data!==void 0&&e.success?c.anchorBlock(e.success(n.data),"promise-success"):e.idle?c.anchorBlock(e.idle,"promise-idle"):c.anchorBlock([],"promise-fallback")}function h(n,e){const r=typeof window<"u"&&window.matchMedia?.(n)?.matches;return c.when(!!r,e)}const s={sm:"(min-width:640px)",md:"(min-width:768px)",lg:"(min-width:1024px)",xl:"(min-width:1280px)","2xl":"(min-width:1536px)",dark:"(prefers-color-scheme: dark)"},d=["sm","md","lg","xl","2xl"],f={sm:n=>h(s.sm,n),md:n=>h(s.md,n),lg:n=>h(s.lg,n),xl:n=>h(s.xl,n),"2xl":n=>h(s["2xl"],n),dark:n=>h(s.dark,n),light:n=>h("(prefers-color-scheme: light)",n),touch:n=>h("(hover: none) and (pointer: coarse)",n),mouse:n=>h("(hover: hover) and (pointer: fine)",n),reducedMotion:n=>h("(prefers-reduced-motion: reduce)",n),highContrast:n=>h("(prefers-contrast: high)",n),portrait:n=>h("(orientation: portrait)",n),landscape:n=>h("(orientation: landscape)",n)};function O(n,e){const r=[];n.includes("dark")?r.push(s.dark):n.includes("light")&&r.push("(prefers-color-scheme: light)");const t=n.filter(a=>d.includes(a)),o=t[t.length-1];o&&o in s&&r.push(s[o]);const i=r.length>0?r.join(" and "):"all";return h(i,e)}function $(n){const e=[];return n.base&&e.push(c.anchorBlock(n.base,"responsive-base")),d.forEach(r=>{const t=n[r];t&&e.push(f[r](t))}),e}function E(n){const e=[];let r=null;return{case(t,o){const i=typeof t=="function"?t:a=>a===t;return e.push({condition:i,content:o}),this},when(t,o){return e.push({condition:t,content:o}),this},otherwise(t){return r=t,this},done(){for(let t=0;t<e.length;t++){const{condition:o,content:i}=e[t];if(o(n))return c.anchorBlock(i,`switch-case-${t}`)}return c.anchorBlock(r||[],"switch-otherwise")}}}exports.eachGroup=x;exports.eachPage=v;exports.eachWhere=y;exports.mediaVariants=s;exports.responsive=f;exports.responsiveOrder=d;exports.responsiveSwitch=$;exports.switchOn=E;exports.switchOnLength=B;exports.switchOnPromise=b;exports.unless=g;exports.whenEmpty=m;exports.whenMedia=h;exports.whenNotEmpty=k;exports.whenVariants=O;
2
+ //# sourceMappingURL=custom-elements-runtime.directive-enhancements.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"custom-elements-runtime.directive-enhancements.cjs.js","sources":["../src/lib/directive-enhancements.ts"],"sourcesContent":["// Enhanced collection directives for better developer experience\n\nimport type { VNode } from './runtime/types';\nimport { when, anchorBlock } from './directives';\n\n/**\n * Conditional rendering with negated condition (opposite of when)\n * @param cond - Boolean condition to negate\n * @param children - Content to render when condition is false\n */\nexport function unless(cond: boolean, children: VNode | VNode[]): VNode {\n return when(!cond, children);\n}\n\n/**\n * Render content only if array/collection is empty\n * @param collection - Array or collection to check\n * @param children - Content to render when empty\n */\nexport function whenEmpty<T>(\n collection: T[] | null | undefined,\n children: VNode | VNode[],\n): VNode {\n const isEmpty = !collection || collection.length === 0;\n return when(isEmpty, children);\n}\n\n/**\n * Render content only if array/collection has items\n * @param collection - Array or collection to check\n * @param children - Content to render when not empty\n */\nexport function whenNotEmpty<T>(\n collection: T[] | null | undefined,\n children: VNode | VNode[],\n): VNode {\n const hasItems = Boolean(collection && collection.length > 0);\n return when(hasItems, children);\n}\n\n/**\n * Enhanced each with filtering capability\n * @param list - Array to iterate over\n * @param predicate - Filter function (optional)\n * @param render - Render function for each item\n */\nexport function eachWhere<T>(\n list: T[],\n predicate: (item: T, index: number) => boolean,\n render: (item: T, index: number, filteredIndex: number) => VNode | VNode[],\n): VNode[] {\n const filtered: Array<{ item: T; originalIndex: number }> = [];\n\n list.forEach((item, index) => {\n if (predicate(item, index)) {\n filtered.push({ item, originalIndex: index });\n }\n });\n\n return filtered.map(({ item, originalIndex }, filteredIndex) => {\n const itemKey =\n typeof item === 'object' && item != null\n ? ((item as Record<string, unknown>)?.key ??\n (item as Record<string, unknown>)?.id ??\n `filtered-${originalIndex}`)\n : `filtered-${originalIndex}`;\n\n return anchorBlock(\n render(item, originalIndex, filteredIndex),\n `each-where-${itemKey}`,\n );\n });\n}\n\n/**\n * Render different content based on array length\n * @param list - Array to check\n * @param cases - Object with length-based cases\n */\nexport function switchOnLength<T>(\n list: T[],\n cases: {\n empty?: VNode | VNode[];\n one?: (item: T) => VNode | VNode[];\n many?: (items: T[]) => VNode | VNode[];\n exactly?: { [count: number]: (items: T[]) => VNode | VNode[] };\n },\n): VNode {\n const length = list?.length ?? 0;\n\n if (length === 0 && cases.empty) {\n return anchorBlock(cases.empty, 'switch-length-empty');\n }\n\n if (length === 1 && cases.one) {\n return anchorBlock(cases.one(list[0]), 'switch-length-one');\n }\n\n if (cases.exactly?.[length]) {\n return anchorBlock(cases.exactly[length](list), `switch-length-${length}`);\n }\n\n if (length > 1 && cases.many) {\n return anchorBlock(cases.many(list), 'switch-length-many');\n }\n\n return anchorBlock([], 'switch-length-fallback');\n}\n\n/**\n * Group array items and render each group\n * @param list - Array to group\n * @param groupBy - Function to determine group key\n * @param renderGroup - Function to render each group\n */\nexport function eachGroup<T, K extends string | number>(\n list: T[],\n groupBy: (item: T) => K,\n renderGroup: (groupKey: K, items: T[], groupIndex: number) => VNode | VNode[],\n): VNode[] {\n const groups = new Map<K, T[]>();\n\n list.forEach((item) => {\n const key = groupBy(item);\n if (!groups.has(key)) {\n groups.set(key, []);\n }\n groups.get(key)!.push(item);\n });\n\n return Array.from(groups.entries()).map(([groupKey, items], groupIndex) => {\n return anchorBlock(\n renderGroup(groupKey, items, groupIndex),\n `each-group-${groupKey}`,\n );\n });\n}\n\n/**\n * Render with pagination/chunking\n * @param list - Array to chunk\n * @param pageSize - Items per page/chunk\n * @param currentPage - Current page (0-based)\n * @param render - Render function for visible items\n */\nexport function eachPage<T>(\n list: T[],\n pageSize: number,\n currentPage: number,\n render: (item: T, index: number, pageIndex: number) => VNode | VNode[],\n): VNode[] {\n const startIndex = currentPage * pageSize;\n const endIndex = Math.min(startIndex + pageSize, list.length);\n const pageItems = list.slice(startIndex, endIndex);\n\n return pageItems.map((item, pageIndex) => {\n const globalIndex = startIndex + pageIndex;\n const itemKey =\n typeof item === 'object' && item != null\n ? ((item as Record<string, unknown>)?.key ??\n (item as Record<string, unknown>)?.id ??\n `page-${globalIndex}`)\n : `page-${globalIndex}`;\n\n return anchorBlock(\n render(item, globalIndex, pageIndex),\n `each-page-${itemKey}`,\n );\n });\n}\n\n/* --- Async & Loading State Directives --- */\n\n/**\n * Render content based on Promise state\n * @param promiseState - Object with loading, data, error states\n * @param cases - Render functions for each state\n */\nexport function switchOnPromise<T, E = Error>(\n promiseState: {\n loading?: boolean;\n data?: T;\n error?: E;\n },\n cases: {\n loading?: VNode | VNode[];\n success?: (data: T) => VNode | VNode[];\n error?: (error: E) => VNode | VNode[];\n idle?: VNode | VNode[];\n },\n): VNode {\n if (promiseState.loading && cases.loading) {\n return anchorBlock(cases.loading, 'promise-loading');\n }\n\n if (promiseState.error && cases.error) {\n return anchorBlock(cases.error(promiseState.error), 'promise-error');\n }\n\n if (promiseState.data !== undefined && cases.success) {\n return anchorBlock(cases.success(promiseState.data), 'promise-success');\n }\n\n if (cases.idle) {\n return anchorBlock(cases.idle, 'promise-idle');\n }\n\n return anchorBlock([], 'promise-fallback');\n}\n\n/* --- Utility Directives --- */\n\n/**\n * Render content based on screen size/media query\n * @param mediaQuery - CSS media query string\n * @param children - Content to render when media query matches\n */\nexport function whenMedia(\n mediaQuery: string,\n children: VNode | VNode[],\n): VNode {\n const matches =\n typeof window !== 'undefined' && window.matchMedia?.(mediaQuery)?.matches;\n return when(Boolean(matches), children);\n}\n\n/* --- Responsive & Media Query Directives (aligned with style.ts) --- */\n\n/**\n * Media variants matching those in style.ts\n */\nexport const mediaVariants = {\n // Responsive breakpoints (matching style.ts)\n sm: '(min-width:640px)',\n md: '(min-width:768px)',\n lg: '(min-width:1024px)',\n xl: '(min-width:1280px)',\n '2xl': '(min-width:1536px)',\n\n // Dark mode (matching style.ts)\n dark: '(prefers-color-scheme: dark)',\n} as const;\n\n/**\n * Responsive order matching style.ts\n */\nexport const responsiveOrder = ['sm', 'md', 'lg', 'xl', '2xl'] as const;\n\n/**\n * Individual responsive directives matching the style.ts breakpoint system\n */\nexport const responsive = {\n // Breakpoint-based rendering (matching style.ts exactly)\n sm: (children: VNode | VNode[]) => whenMedia(mediaVariants.sm, children),\n md: (children: VNode | VNode[]) => whenMedia(mediaVariants.md, children),\n lg: (children: VNode | VNode[]) => whenMedia(mediaVariants.lg, children),\n xl: (children: VNode | VNode[]) => whenMedia(mediaVariants.xl, children),\n '2xl': (children: VNode | VNode[]) =>\n whenMedia(mediaVariants['2xl'], children),\n\n // Dark mode (matching style.ts)\n dark: (children: VNode | VNode[]) => whenMedia(mediaVariants.dark, children),\n light: (children: VNode | VNode[]) =>\n whenMedia('(prefers-color-scheme: light)', children),\n\n // Accessibility and interaction preferences\n touch: (children: VNode | VNode[]) =>\n whenMedia('(hover: none) and (pointer: coarse)', children),\n mouse: (children: VNode | VNode[]) =>\n whenMedia('(hover: hover) and (pointer: fine)', children),\n reducedMotion: (children: VNode | VNode[]) =>\n whenMedia('(prefers-reduced-motion: reduce)', children),\n highContrast: (children: VNode | VNode[]) =>\n whenMedia('(prefers-contrast: high)', children),\n\n // Orientation\n portrait: (children: VNode | VNode[]) =>\n whenMedia('(orientation: portrait)', children),\n landscape: (children: VNode | VNode[]) =>\n whenMedia('(orientation: landscape)', children),\n} as const;\n\n/**\n * Advanced responsive directive that matches the style.ts multi-variant processing\n * Allows chaining responsive and dark mode conditions like in CSS classes\n * @param variants - Array of variant keys (e.g., ['dark', 'lg'])\n * @param children - Content to render when all variants match\n */\nexport function whenVariants(\n variants: Array<keyof typeof mediaVariants | 'light'>,\n children: VNode | VNode[],\n): VNode {\n const conditions: string[] = [];\n\n // Process dark/light mode\n if (variants.includes('dark')) {\n conditions.push(mediaVariants.dark);\n } else if (variants.includes('light')) {\n conditions.push('(prefers-color-scheme: light)');\n }\n\n // Process responsive variants (take the last one, matching style.ts behavior)\n const responsiveVariants = variants.filter((v) =>\n responsiveOrder.includes(v as (typeof responsiveOrder)[number]),\n );\n const lastResponsive = responsiveVariants[responsiveVariants.length - 1];\n if (lastResponsive && lastResponsive in mediaVariants) {\n conditions.push(\n mediaVariants[lastResponsive as keyof typeof mediaVariants],\n );\n }\n\n const mediaQuery = conditions.length > 0 ? conditions.join(' and ') : 'all';\n return whenMedia(mediaQuery, children);\n}\n\n/**\n * Responsive switch directive - render different content for different breakpoints\n * Mirrors the responsive behavior from the style system\n * @param content - Object with breakpoint keys and corresponding content\n */\nexport function responsiveSwitch(content: {\n base?: VNode | VNode[];\n sm?: VNode | VNode[];\n md?: VNode | VNode[];\n lg?: VNode | VNode[];\n xl?: VNode | VNode[];\n '2xl'?: VNode | VNode[];\n}): VNode[] {\n const results: VNode[] = [];\n\n // Handle light mode variants\n if (content.base) {\n // Base content (no media query)\n results.push(anchorBlock(content.base, 'responsive-base'));\n }\n\n // Add responsive variants in order\n responsiveOrder.forEach((breakpoint) => {\n const breakpointContent = content[breakpoint];\n if (breakpointContent) {\n results.push(responsive[breakpoint](breakpointContent));\n }\n });\n\n return results;\n}\n\n/* --- Enhanced Match Directive --- */\n\n/**\n * Enhanced match directive with more fluent API\n * @param value - Value to match against\n */\nexport function switchOn<T>(value: T) {\n const branches: Array<{\n condition: (val: T) => boolean;\n content: VNode | VNode[];\n }> = [];\n let otherwiseContent: VNode | VNode[] | null = null;\n\n return {\n case(matcher: T | ((val: T) => boolean), content: VNode | VNode[]) {\n const condition =\n typeof matcher === 'function'\n ? (matcher as (val: T) => boolean)\n : (val: T) => val === matcher;\n\n branches.push({ condition, content });\n return this;\n },\n\n when(predicate: (val: T) => boolean, content: VNode | VNode[]) {\n branches.push({ condition: predicate, content });\n return this;\n },\n\n otherwise(content: VNode | VNode[]) {\n otherwiseContent = content;\n return this;\n },\n\n done() {\n for (let i = 0; i < branches.length; i++) {\n const { condition, content } = branches[i];\n if (condition(value)) {\n return anchorBlock(content, `switch-case-${i}`);\n }\n }\n return anchorBlock(otherwiseContent || [], 'switch-otherwise');\n },\n };\n}\n"],"names":["unless","cond","children","when","whenEmpty","collection","isEmpty","whenNotEmpty","hasItems","eachWhere","list","predicate","render","filtered","item","index","originalIndex","filteredIndex","itemKey","anchorBlock","switchOnLength","cases","length","eachGroup","groupBy","renderGroup","groups","key","groupKey","items","groupIndex","eachPage","pageSize","currentPage","startIndex","endIndex","pageIndex","globalIndex","switchOnPromise","promiseState","whenMedia","mediaQuery","matches","mediaVariants","responsiveOrder","responsive","whenVariants","variants","conditions","responsiveVariants","v","lastResponsive","responsiveSwitch","content","results","breakpoint","breakpointContent","switchOn","value","branches","otherwiseContent","matcher","condition","val","i"],"mappings":"+IAUO,SAASA,EAAOC,EAAeC,EAAkC,CACtE,OAAOC,EAAAA,KAAK,CAACF,EAAMC,CAAQ,CAC7B,CAOO,SAASE,EACdC,EACAH,EACO,CACP,MAAMI,EAAU,CAACD,GAAcA,EAAW,SAAW,EACrD,OAAOF,EAAAA,KAAKG,EAASJ,CAAQ,CAC/B,CAOO,SAASK,EACdF,EACAH,EACO,CACP,MAAMM,EAAW,GAAQH,GAAcA,EAAW,OAAS,GAC3D,OAAOF,EAAAA,KAAKK,EAAUN,CAAQ,CAChC,CAQO,SAASO,EACdC,EACAC,EACAC,EACS,CACT,MAAMC,EAAsD,CAAA,EAE5D,OAAAH,EAAK,QAAQ,CAACI,EAAMC,IAAU,CACxBJ,EAAUG,EAAMC,CAAK,GACvBF,EAAS,KAAK,CAAE,KAAAC,EAAM,cAAeC,EAAO,CAEhD,CAAC,EAEMF,EAAS,IAAI,CAAC,CAAE,KAAAC,EAAM,cAAAE,CAAA,EAAiBC,IAAkB,CAC9D,MAAMC,EACJ,OAAOJ,GAAS,UAAYA,GAAQ,KAC9BA,GAAkC,KACnCA,GAAkC,IACnC,YAAYE,CAAa,GACzB,YAAYA,CAAa,GAE/B,OAAOG,EAAAA,YACLP,EAAOE,EAAME,EAAeC,CAAa,EACzC,c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KAAK1C,EAAgC0C,EAA0B,CAC7D,OAAAM,EAAS,KAAK,CAAE,UAAWhD,EAAW,QAAA0C,EAAS,EACxC,IACT,EAEA,UAAUA,EAA0B,CAClC,OAAAO,EAAmBP,EACZ,IACT,EAEA,MAAO,CACL,QAASW,EAAI,EAAGA,EAAIL,EAAS,OAAQK,IAAK,CACxC,KAAM,CAAE,UAAAF,EAAW,QAAAT,GAAYM,EAASK,CAAC,EACzC,GAAIF,EAAUJ,CAAK,EACjB,OAAOvC,EAAAA,YAAYkC,EAAS,eAAeW,CAAC,EAAE,CAElD,CACA,OAAO7C,cAAYyC,GAAoB,CAAA,EAAI,kBAAkB,CAC/D,CAAA,CAEJ"}
@@ -0,0 +1,144 @@
1
+ import { when as a, anchorBlock as s } from "./custom-elements-runtime.directives.es.js";
2
+ function y(n, e) {
3
+ return a(!n, e);
4
+ }
5
+ function x(n, e) {
6
+ const t = !n || n.length === 0;
7
+ return a(t, e);
8
+ }
9
+ function k(n, e) {
10
+ const t = !!(n && n.length > 0);
11
+ return a(t, e);
12
+ }
13
+ function b(n, e, t) {
14
+ const r = [];
15
+ return n.forEach((o, i) => {
16
+ e(o, i) && r.push({ item: o, originalIndex: i });
17
+ }), r.map(({ item: o, originalIndex: i }, u) => {
18
+ const l = typeof o == "object" && o != null ? o?.key ?? o?.id ?? `filtered-${i}` : `filtered-${i}`;
19
+ return s(
20
+ t(o, i, u),
21
+ `each-where-${l}`
22
+ );
23
+ });
24
+ }
25
+ function $(n, e) {
26
+ const t = n?.length ?? 0;
27
+ return t === 0 && e.empty ? s(e.empty, "switch-length-empty") : t === 1 && e.one ? s(e.one(n[0]), "switch-length-one") : e.exactly?.[t] ? s(e.exactly[t](n), `switch-length-${t}`) : t > 1 && e.many ? s(e.many(n), "switch-length-many") : s([], "switch-length-fallback");
28
+ }
29
+ function v(n, e, t) {
30
+ const r = /* @__PURE__ */ new Map();
31
+ return n.forEach((o) => {
32
+ const i = e(o);
33
+ r.has(i) || r.set(i, []), r.get(i).push(o);
34
+ }), Array.from(r.entries()).map(([o, i], u) => s(
35
+ t(o, i, u),
36
+ `each-group-${o}`
37
+ ));
38
+ }
39
+ function E(n, e, t, r) {
40
+ const o = t * e, i = Math.min(o + e, n.length);
41
+ return n.slice(o, i).map((l, p) => {
42
+ const d = o + p, g = typeof l == "object" && l != null ? l?.key ?? l?.id ?? `page-${d}` : `page-${d}`;
43
+ return s(
44
+ r(l, d, p),
45
+ `each-page-${g}`
46
+ );
47
+ });
48
+ }
49
+ function M(n, e) {
50
+ return n.loading && e.loading ? s(e.loading, "promise-loading") : n.error && e.error ? s(e.error(n.error), "promise-error") : n.data !== void 0 && e.success ? s(e.success(n.data), "promise-success") : e.idle ? s(e.idle, "promise-idle") : s([], "promise-fallback");
51
+ }
52
+ function h(n, e) {
53
+ const t = typeof window < "u" && window.matchMedia?.(n)?.matches;
54
+ return a(!!t, e);
55
+ }
56
+ const c = {
57
+ // Responsive breakpoints (matching style.ts)
58
+ sm: "(min-width:640px)",
59
+ md: "(min-width:768px)",
60
+ lg: "(min-width:1024px)",
61
+ xl: "(min-width:1280px)",
62
+ "2xl": "(min-width:1536px)",
63
+ // Dark mode (matching style.ts)
64
+ dark: "(prefers-color-scheme: dark)"
65
+ }, f = ["sm", "md", "lg", "xl", "2xl"], m = {
66
+ // Breakpoint-based rendering (matching style.ts exactly)
67
+ sm: (n) => h(c.sm, n),
68
+ md: (n) => h(c.md, n),
69
+ lg: (n) => h(c.lg, n),
70
+ xl: (n) => h(c.xl, n),
71
+ "2xl": (n) => h(c["2xl"], n),
72
+ // Dark mode (matching style.ts)
73
+ dark: (n) => h(c.dark, n),
74
+ light: (n) => h("(prefers-color-scheme: light)", n),
75
+ // Accessibility and interaction preferences
76
+ touch: (n) => h("(hover: none) and (pointer: coarse)", n),
77
+ mouse: (n) => h("(hover: hover) and (pointer: fine)", n),
78
+ reducedMotion: (n) => h("(prefers-reduced-motion: reduce)", n),
79
+ highContrast: (n) => h("(prefers-contrast: high)", n),
80
+ // Orientation
81
+ portrait: (n) => h("(orientation: portrait)", n),
82
+ landscape: (n) => h("(orientation: landscape)", n)
83
+ };
84
+ function I(n, e) {
85
+ const t = [];
86
+ n.includes("dark") ? t.push(c.dark) : n.includes("light") && t.push("(prefers-color-scheme: light)");
87
+ const r = n.filter(
88
+ (u) => f.includes(u)
89
+ ), o = r[r.length - 1];
90
+ o && o in c && t.push(
91
+ c[o]
92
+ );
93
+ const i = t.length > 0 ? t.join(" and ") : "all";
94
+ return h(i, e);
95
+ }
96
+ function O(n) {
97
+ const e = [];
98
+ return n.base && e.push(s(n.base, "responsive-base")), f.forEach((t) => {
99
+ const r = n[t];
100
+ r && e.push(m[t](r));
101
+ }), e;
102
+ }
103
+ function j(n) {
104
+ const e = [];
105
+ let t = null;
106
+ return {
107
+ case(r, o) {
108
+ const i = typeof r == "function" ? r : (u) => u === r;
109
+ return e.push({ condition: i, content: o }), this;
110
+ },
111
+ when(r, o) {
112
+ return e.push({ condition: r, content: o }), this;
113
+ },
114
+ otherwise(r) {
115
+ return t = r, this;
116
+ },
117
+ done() {
118
+ for (let r = 0; r < e.length; r++) {
119
+ const { condition: o, content: i } = e[r];
120
+ if (o(n))
121
+ return s(i, `switch-case-${r}`);
122
+ }
123
+ return s(t || [], "switch-otherwise");
124
+ }
125
+ };
126
+ }
127
+ export {
128
+ v as eachGroup,
129
+ E as eachPage,
130
+ b as eachWhere,
131
+ c as mediaVariants,
132
+ m as responsive,
133
+ f as responsiveOrder,
134
+ O as responsiveSwitch,
135
+ j as switchOn,
136
+ $ as switchOnLength,
137
+ M as switchOnPromise,
138
+ y as unless,
139
+ x as whenEmpty,
140
+ h as whenMedia,
141
+ k as whenNotEmpty,
142
+ I as whenVariants
143
+ };
144
+ //# sourceMappingURL=custom-elements-runtime.directive-enhancements.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"custom-elements-runtime.directive-enhancements.es.js","sources":["../src/lib/directive-enhancements.ts"],"sourcesContent":["// Enhanced collection directives for better developer experience\n\nimport type { VNode } from './runtime/types';\nimport { when, anchorBlock } from './directives';\n\n/**\n * Conditional rendering with negated condition (opposite of when)\n * @param cond - Boolean condition to negate\n * @param children - Content to render when condition is false\n */\nexport function unless(cond: boolean, children: VNode | VNode[]): VNode {\n return when(!cond, children);\n}\n\n/**\n * Render content only if array/collection is empty\n * @param collection - Array or collection to check\n * @param children - Content to render when empty\n */\nexport function whenEmpty<T>(\n collection: T[] | null | undefined,\n children: VNode | VNode[],\n): VNode {\n const isEmpty = !collection || collection.length === 0;\n return when(isEmpty, children);\n}\n\n/**\n * Render content only if array/collection has items\n * @param collection - Array or collection to check\n * @param children - Content to render when not empty\n */\nexport function whenNotEmpty<T>(\n collection: T[] | null | undefined,\n children: VNode | VNode[],\n): VNode {\n const hasItems = Boolean(collection && collection.length > 0);\n return when(hasItems, children);\n}\n\n/**\n * Enhanced each with filtering capability\n * @param list - Array to iterate over\n * @param predicate - Filter function (optional)\n * @param render - Render function for each item\n */\nexport function eachWhere<T>(\n list: T[],\n predicate: (item: T, index: number) => boolean,\n render: (item: T, index: number, filteredIndex: number) => VNode | VNode[],\n): VNode[] {\n const filtered: Array<{ item: T; originalIndex: number }> = [];\n\n list.forEach((item, index) => {\n if (predicate(item, index)) {\n filtered.push({ item, originalIndex: index });\n }\n });\n\n return filtered.map(({ item, originalIndex }, filteredIndex) => {\n const itemKey =\n typeof item === 'object' && item != null\n ? ((item as Record<string, unknown>)?.key ??\n (item as Record<string, unknown>)?.id ??\n `filtered-${originalIndex}`)\n : `filtered-${originalIndex}`;\n\n return anchorBlock(\n render(item, originalIndex, filteredIndex),\n `each-where-${itemKey}`,\n );\n });\n}\n\n/**\n * Render different content based on array length\n * @param list - Array to check\n * @param cases - Object with length-based cases\n */\nexport function switchOnLength<T>(\n list: T[],\n cases: {\n empty?: VNode | VNode[];\n one?: (item: T) => VNode | VNode[];\n many?: (items: T[]) => VNode | VNode[];\n exactly?: { [count: number]: (items: T[]) => VNode | VNode[] };\n },\n): VNode {\n const length = list?.length ?? 0;\n\n if (length === 0 && cases.empty) {\n return anchorBlock(cases.empty, 'switch-length-empty');\n }\n\n if (length === 1 && cases.one) {\n return anchorBlock(cases.one(list[0]), 'switch-length-one');\n }\n\n if (cases.exactly?.[length]) {\n return anchorBlock(cases.exactly[length](list), `switch-length-${length}`);\n }\n\n if (length > 1 && cases.many) {\n return anchorBlock(cases.many(list), 'switch-length-many');\n }\n\n return anchorBlock([], 'switch-length-fallback');\n}\n\n/**\n * Group array items and render each group\n * @param list - Array to group\n * @param groupBy - Function to determine group key\n * @param renderGroup - Function to render each group\n */\nexport function eachGroup<T, K extends string | number>(\n list: T[],\n groupBy: (item: T) => K,\n renderGroup: (groupKey: K, items: T[], groupIndex: number) => VNode | VNode[],\n): VNode[] {\n const groups = new Map<K, T[]>();\n\n list.forEach((item) => {\n const key = groupBy(item);\n if (!groups.has(key)) {\n groups.set(key, []);\n }\n groups.get(key)!.push(item);\n });\n\n return Array.from(groups.entries()).map(([groupKey, items], groupIndex) => {\n return anchorBlock(\n renderGroup(groupKey, items, groupIndex),\n `each-group-${groupKey}`,\n );\n });\n}\n\n/**\n * Render with pagination/chunking\n * @param list - Array to chunk\n * @param pageSize - Items per page/chunk\n * @param currentPage - Current page (0-based)\n * @param render - Render function for visible items\n */\nexport function eachPage<T>(\n list: T[],\n pageSize: number,\n currentPage: number,\n render: (item: T, index: number, pageIndex: number) => VNode | VNode[],\n): VNode[] {\n const startIndex = currentPage * pageSize;\n const endIndex = Math.min(startIndex + pageSize, list.length);\n const pageItems = list.slice(startIndex, endIndex);\n\n return pageItems.map((item, pageIndex) => {\n const globalIndex = startIndex + pageIndex;\n const itemKey =\n typeof item === 'object' && item != null\n ? ((item as Record<string, unknown>)?.key ??\n (item as Record<string, unknown>)?.id ??\n `page-${globalIndex}`)\n : `page-${globalIndex}`;\n\n return anchorBlock(\n render(item, globalIndex, pageIndex),\n `each-page-${itemKey}`,\n );\n });\n}\n\n/* --- Async & Loading State Directives --- */\n\n/**\n * Render content based on Promise state\n * @param promiseState - Object with loading, data, error states\n * @param cases - Render functions for each state\n */\nexport function switchOnPromise<T, E = Error>(\n promiseState: {\n loading?: boolean;\n data?: T;\n error?: E;\n },\n cases: {\n loading?: VNode | VNode[];\n success?: (data: T) => VNode | VNode[];\n error?: (error: E) => VNode | VNode[];\n idle?: VNode | VNode[];\n },\n): VNode {\n if (promiseState.loading && cases.loading) {\n return anchorBlock(cases.loading, 'promise-loading');\n }\n\n if (promiseState.error && cases.error) {\n return anchorBlock(cases.error(promiseState.error), 'promise-error');\n }\n\n if (promiseState.data !== undefined && cases.success) {\n return anchorBlock(cases.success(promiseState.data), 'promise-success');\n }\n\n if (cases.idle) {\n return anchorBlock(cases.idle, 'promise-idle');\n }\n\n return anchorBlock([], 'promise-fallback');\n}\n\n/* --- Utility Directives --- */\n\n/**\n * Render content based on screen size/media query\n * @param mediaQuery - CSS media query string\n * @param children - Content to render when media query matches\n */\nexport function whenMedia(\n mediaQuery: string,\n children: VNode | VNode[],\n): VNode {\n const matches =\n typeof window !== 'undefined' && window.matchMedia?.(mediaQuery)?.matches;\n return when(Boolean(matches), children);\n}\n\n/* --- Responsive & Media Query Directives (aligned with style.ts) --- */\n\n/**\n * Media variants matching those in style.ts\n */\nexport const mediaVariants = {\n // Responsive breakpoints (matching style.ts)\n sm: '(min-width:640px)',\n md: '(min-width:768px)',\n lg: '(min-width:1024px)',\n xl: '(min-width:1280px)',\n '2xl': '(min-width:1536px)',\n\n // Dark mode (matching style.ts)\n dark: '(prefers-color-scheme: dark)',\n} as const;\n\n/**\n * Responsive order matching style.ts\n */\nexport const responsiveOrder = ['sm', 'md', 'lg', 'xl', '2xl'] as const;\n\n/**\n * Individual responsive directives matching the style.ts breakpoint system\n */\nexport const responsive = {\n // Breakpoint-based rendering (matching style.ts exactly)\n sm: (children: VNode | VNode[]) => whenMedia(mediaVariants.sm, children),\n md: (children: VNode | VNode[]) => whenMedia(mediaVariants.md, children),\n lg: (children: VNode | VNode[]) => whenMedia(mediaVariants.lg, children),\n xl: (children: VNode | VNode[]) => whenMedia(mediaVariants.xl, children),\n '2xl': (children: VNode | VNode[]) =>\n whenMedia(mediaVariants['2xl'], children),\n\n // Dark mode (matching style.ts)\n dark: (children: VNode | VNode[]) => whenMedia(mediaVariants.dark, children),\n light: (children: VNode | VNode[]) =>\n whenMedia('(prefers-color-scheme: light)', children),\n\n // Accessibility and interaction preferences\n touch: (children: VNode | VNode[]) =>\n whenMedia('(hover: none) and (pointer: coarse)', children),\n mouse: (children: VNode | VNode[]) =>\n whenMedia('(hover: hover) and (pointer: fine)', children),\n reducedMotion: (children: VNode | VNode[]) =>\n whenMedia('(prefers-reduced-motion: reduce)', children),\n highContrast: (children: VNode | VNode[]) =>\n whenMedia('(prefers-contrast: high)', children),\n\n // Orientation\n portrait: (children: VNode | VNode[]) =>\n whenMedia('(orientation: portrait)', children),\n landscape: (children: VNode | VNode[]) =>\n whenMedia('(orientation: landscape)', children),\n} as const;\n\n/**\n * Advanced responsive directive that matches the style.ts multi-variant processing\n * Allows chaining responsive and dark mode conditions like in CSS classes\n * @param variants - Array of variant keys (e.g., ['dark', 'lg'])\n * @param children - Content to render when all variants match\n */\nexport function whenVariants(\n variants: Array<keyof typeof mediaVariants | 'light'>,\n children: VNode | VNode[],\n): VNode {\n const conditions: string[] = [];\n\n // Process dark/light mode\n if (variants.includes('dark')) {\n conditions.push(mediaVariants.dark);\n } else if (variants.includes('light')) {\n conditions.push('(prefers-color-scheme: light)');\n }\n\n // Process responsive variants (take the last one, matching style.ts behavior)\n const responsiveVariants = variants.filter((v) =>\n responsiveOrder.includes(v as (typeof responsiveOrder)[number]),\n );\n const lastResponsive = responsiveVariants[responsiveVariants.length - 1];\n if (lastResponsive && lastResponsive in mediaVariants) {\n conditions.push(\n mediaVariants[lastResponsive as keyof typeof mediaVariants],\n );\n }\n\n const mediaQuery = conditions.length > 0 ? conditions.join(' and ') : 'all';\n return whenMedia(mediaQuery, children);\n}\n\n/**\n * Responsive switch directive - render different content for different breakpoints\n * Mirrors the responsive behavior from the style system\n * @param content - Object with breakpoint keys and corresponding content\n */\nexport function responsiveSwitch(content: {\n base?: VNode | VNode[];\n sm?: VNode | VNode[];\n md?: VNode | VNode[];\n lg?: VNode | VNode[];\n xl?: VNode | VNode[];\n '2xl'?: VNode | VNode[];\n}): VNode[] {\n const results: VNode[] = [];\n\n // Handle light mode variants\n if (content.base) {\n // Base content (no media query)\n results.push(anchorBlock(content.base, 'responsive-base'));\n }\n\n // Add responsive variants in order\n responsiveOrder.forEach((breakpoint) => {\n const breakpointContent = content[breakpoint];\n if (breakpointContent) {\n results.push(responsive[breakpoint](breakpointContent));\n }\n });\n\n return results;\n}\n\n/* --- Enhanced Match Directive --- */\n\n/**\n * Enhanced match directive with more fluent API\n * @param value - Value to match against\n */\nexport function switchOn<T>(value: T) {\n const branches: Array<{\n condition: (val: T) => boolean;\n content: VNode | VNode[];\n }> = [];\n let otherwiseContent: VNode | VNode[] | null = null;\n\n return {\n case(matcher: T | ((val: T) => boolean), content: VNode | VNode[]) {\n const condition =\n typeof matcher === 'function'\n ? (matcher as (val: T) => boolean)\n : (val: T) => val === matcher;\n\n branches.push({ condition, content });\n return this;\n },\n\n when(predicate: (val: T) => boolean, content: VNode | VNode[]) {\n branches.push({ condition: predicate, content });\n return this;\n },\n\n otherwise(content: VNode | VNode[]) {\n otherwiseContent = content;\n return this;\n },\n\n done() {\n for (let i = 0; i < branches.length; i++) {\n const { condition, content } = branches[i];\n if (condition(value)) {\n return anchorBlock(content, `switch-case-${i}`);\n }\n }\n return anchorBlock(otherwiseContent || [], 'switch-otherwise');\n },\n };\n}\n"],"names":["unless","cond","children","when","whenEmpty","collection","isEmpty","whenNotEmpty","hasItems","eachWhere","list","predicate","render","filtered","item","index","originalIndex","filteredIndex","itemKey","anchorBlock","switchOnLength","cases","length","eachGroup","groupBy","renderGroup","groups","key","groupKey","items","groupIndex","eachPage","pageSize","currentPage","startIndex","endIndex","pageIndex","globalIndex","switchOnPromise","promiseState","whenMedia","mediaQuery","matches","mediaVariants","responsiveOrder","responsive","whenVariants","variants","conditions","responsiveVariants","v","lastResponsive","responsiveSwitch","content","results","breakpoint","breakpointContent","switchOn","value","branches","otherwiseContent","matcher","condition","val","i"],"mappings":";AAUO,SAASA,EAAOC,GAAeC,GAAkC;AACtE,SAAOC,EAAK,CAACF,GAAMC,CAAQ;AAC7B;AAOO,SAASE,EACdC,GACAH,GACO;AACP,QAAMI,IAAU,CAACD,KAAcA,EAAW,WAAW;AACrD,SAAOF,EAAKG,GAASJ,CAAQ;AAC/B;AAOO,SAASK,EACdF,GACAH,GACO;AACP,QAAMM,IAAW,GAAQH,KAAcA,EAAW,SAAS;AAC3D,SAAOF,EAAKK,GAAUN,CAAQ;AAChC;AAQO,SAASO,EACdC,GACAC,GACAC,GACS;AACT,QAAMC,IAAsD,CAAA;AAE5D,SAAAH,EAAK,QAAQ,CAACI,GAAMC,MAAU;AAC5B,IAAIJ,EAAUG,GAAMC,CAAK,KACvBF,EAAS,KAAK,EAAE,MAAAC,GAAM,eAAeC,GAAO;AAAA,EAEhD,CAAC,GAEMF,EAAS,IAAI,CAAC,EAAE,MAAAC,GAAM,eAAAE,EAAA,GAAiBC,MAAkB;AAC9D,UAAMC,IACJ,OAAOJ,KAAS,YAAYA,KAAQ,OAC9BA,GAAkC,OACnCA,GAAkC,MACnC,YAAYE,CAAa,KACzB,YAAYA,CAAa;AAE/B,WAAOG;AAAA,MACLP,EAAOE,GAAME,GAAeC,CAAa;AAAA,MACzC,cAAcC,CAAO;AAAA,IAAA;AAAA,EAEzB,CAAC;AACH;AAOO,SAASE,EACdV,GACAW,GAMO;AACP,QAAMC,IAASZ,GAAM,UAAU;AAE/B,SAAIY,MAAW,KAAKD,EAAM,QACjBF,EAAYE,EAAM,OAAO,qBAAqB,IAGnDC,MAAW,KAAKD,EAAM,MACjBF,EAAYE,EAAM,IAAIX,EAAK,CAAC,CAAC,GAAG,mBAAmB,IAGxDW,E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AAA,IACT;AAAA,IAEA,KAAK1C,GAAgC0C,GAA0B;AAC7D,aAAAM,EAAS,KAAK,EAAE,WAAWhD,GAAW,SAAA0C,GAAS,GACxC;AAAA,IACT;AAAA,IAEA,UAAUA,GAA0B;AAClC,aAAAO,IAAmBP,GACZ;AAAA,IACT;AAAA,IAEA,OAAO;AACL,eAASW,IAAI,GAAGA,IAAIL,EAAS,QAAQK,KAAK;AACxC,cAAM,EAAE,WAAAF,GAAW,SAAAT,MAAYM,EAASK,CAAC;AACzC,YAAIF,EAAUJ,CAAK;AACjB,iBAAOvC,EAAYkC,GAAS,eAAeW,CAAC,EAAE;AAAA,MAElD;AACA,aAAO7C,EAAYyC,KAAoB,CAAA,GAAI,kBAAkB;AAAA,IAC/D;AAAA,EAAA;AAEJ;"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function c(n,t){const e="when-block";return o(typeof t=="function"?n?t():[]:n?t:[],e)}function h(n,t){return n.map((e,r)=>{const u=typeof e=="object"?e?.key??e?.id??`idx-${r}`:String(e);return o(t(e,r),`each-${u}`)})}function a(){const n=[];return{when(t,e){return n.push([t,e]),this},otherwise(t){return n.push([!0,t]),this},done(){return i(...n)}}}function i(...n){for(let t=0;t<n.length;t++){const[e,r]=n[t];if(e){const u=typeof r=="function"?r():r;return[o(u,`whenChain-branch-${t}`)]}}return[o([],"whenChain-empty")]}function o(n,t){const e=n?Array.isArray(n)?n.filter(r=>r!=null):[n].filter(r=>r!=null):[];return{tag:"#anchor",key:t,children:e}}exports.anchorBlock=o;exports.each=h;exports.match=a;exports.when=c;
2
+ //# sourceMappingURL=custom-elements-runtime.directives.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"custom-elements-runtime.directives.cjs.js","sources":["../src/lib/directives.ts"],"sourcesContent":["import type { VNode } from './runtime/types';\n\n/* --- When --- */\nexport function when(cond: boolean, children: VNode | VNode[]): VNode;\nexport function when(cond: boolean, factory: () => VNode | VNode[]): VNode;\nexport function when(\n cond: boolean,\n childrenOrFactory: VNode | VNode[] | (() => VNode | VNode[]),\n): VNode {\n const anchorKey = 'when-block'; // stable key regardless of condition\n if (typeof childrenOrFactory === 'function') {\n return anchorBlock(cond ? childrenOrFactory() : [], anchorKey);\n }\n return anchorBlock(cond ? childrenOrFactory : [], anchorKey);\n}\n\n/* --- Each --- */\nexport function each<\n T extends string | number | boolean | { id?: string | number; key?: string },\n>(list: T[], render: (item: T, index: number) => VNode | VNode[]): VNode[] {\n return list.map((item, i) => {\n // For primitives, use value as key; for objects, prefer key/id\n const itemKey =\n typeof item === 'object'\n ? ((item as Record<string, unknown>)?.key ??\n (item as Record<string, unknown>)?.id ??\n `idx-${i}`)\n : String(item);\n return anchorBlock(render(item, i), `each-${itemKey}`);\n });\n}\n\n/* --- match --- */\nexport function match() {\n const branches: Branch[] = [];\n return {\n when(cond: unknown, content: VNode | VNode[] | (() => VNode | VNode[])) {\n branches.push([cond, content]);\n return this;\n },\n otherwise(content: VNode | VNode[]) {\n branches.push([true, content]);\n return this;\n },\n done() {\n return whenChain(...branches);\n },\n };\n}\n\n/* --- WhenChain --- */\ntype Branch = [\n condition: unknown,\n content: VNode | VNode[] | (() => VNode | VNode[]),\n];\n\nfunction whenChain(...branches: Branch[]): VNode[] {\n for (let idx = 0; idx < branches.length; idx++) {\n const [cond, content] = branches[idx];\n if (cond) {\n const payload =\n typeof content === 'function'\n ? (content as () => VNode | VNode[])()\n : content;\n return [anchorBlock(payload, `whenChain-branch-${idx}`)];\n }\n }\n return [anchorBlock([], 'whenChain-empty')];\n}\n\n/**\n * Create a stable anchor block with consistent boundaries.\n * Always has start/end boundaries.\n */\nexport function anchorBlock(\n children: VNode | VNode[] | null | undefined,\n anchorKey: string,\n): VNode {\n // Normalize children to array, filtering out only null/undefined values.\n // Preserve meaningful falsy values such as 0, false, and empty string.\n const childArray = !children\n ? []\n : Array.isArray(children)\n ? children.filter((c) => c !== null && c !== undefined)\n : [children].filter((c) => c !== null && c !== undefined);\n\n return {\n tag: '#anchor',\n key: anchorKey,\n children: childArray,\n };\n}\n"],"names":["when","cond","childrenOrFactory","anchorKey","anchorBlock","each","list","render","item","i","itemKey","match","branches","content","whenChain","idx","payload","children","childArray","c"],"mappings":"gFAKO,SAASA,EACdC,EACAC,EACO,CACP,MAAMC,EAAY,aAClB,OACSC,EADL,OAAOF,GAAsB,WACZD,EAAOC,EAAA,EAAsB,CAAA,EAE/BD,EAAOC,EAAoB,CAAA,EAFQC,CAAS,CAGjE,CAGO,SAASE,EAEdC,EAAWC,EAA8D,CACzE,OAAOD,EAAK,IAAI,CAACE,EAAMC,IAAM,CAE3B,MAAMC,EACJ,OAAOF,GAAS,SACVA,GAAkC,KACnCA,GAAkC,IACnC,OAAOC,CAAC,GACR,OAAOD,CAAI,EACjB,OAAOJ,EAAYG,EAAOC,EAAMC,CAAC,EAAG,QAAQC,CAAO,EAAE,CACvD,CAAC,CACH,CAGO,SAASC,GAAQ,CACtB,MAAMC,EAAqB,CAAA,EAC3B,MAAO,CACL,KAAKX,EAAeY,EAAoD,CACtE,OAAAD,EAAS,KAAK,CAACX,EAAMY,CAAO,CAAC,EACtB,IACT,EACA,UAAUA,EAA0B,CAClC,OAAAD,EAAS,KAAK,CAAC,GAAMC,CAAO,CAAC,EACtB,IACT,EACA,MAAO,CACL,OAAOC,EAAU,GAAGF,CAAQ,CAC9B,CAAA,CAEJ,CAQA,SAASE,KAAaF,EAA6B,CACjD,QAASG,EAAM,EAAGA,EAAMH,EAAS,OAAQG,IAAO,CAC9C,KAAM,CAACd,EAAMY,CAAO,EAAID,EAASG,CAAG,EACpC,GAAId,EAAM,CACR,MAAMe,EACJ,OAAOH,GAAY,WACdA,IACDA,EACN,MAAO,CAACT,EAAYY,EAAS,oBAAoBD,CAAG,EAAE,CAAC,CACzD,CACF,CACA,MAAO,CAACX,EAAY,GAAI,iBAAiB,CAAC,CAC5C,CAMO,SAASA,EACda,EACAd,EACO,CAGP,MAAMe,EAAcD,EAEhB,MAAM,QAAQA,CAAQ,EACpBA,EAAS,OAAQE,GAAMA,GAAM,IAAuB,EACpD,CAACF,CAAQ,EAAE,OAAQE,GAAMA,GAAM,IAAuB,EAHxD,CAAA,EAKJ,MAAO,CACL,IAAK,UACL,IAAKhB,EACL,SAAUe,CAAA,CAEd"}
@@ -0,0 +1,49 @@
1
+ function c(n, t) {
2
+ const e = "when-block";
3
+ return o(typeof t == "function" ? n ? t() : [] : n ? t : [], e);
4
+ }
5
+ function i(n, t) {
6
+ return n.map((e, r) => {
7
+ const u = typeof e == "object" ? e?.key ?? e?.id ?? `idx-${r}` : String(e);
8
+ return o(t(e, r), `each-${u}`);
9
+ });
10
+ }
11
+ function a() {
12
+ const n = [];
13
+ return {
14
+ when(t, e) {
15
+ return n.push([t, e]), this;
16
+ },
17
+ otherwise(t) {
18
+ return n.push([!0, t]), this;
19
+ },
20
+ done() {
21
+ return h(...n);
22
+ }
23
+ };
24
+ }
25
+ function h(...n) {
26
+ for (let t = 0; t < n.length; t++) {
27
+ const [e, r] = n[t];
28
+ if (e) {
29
+ const u = typeof r == "function" ? r() : r;
30
+ return [o(u, `whenChain-branch-${t}`)];
31
+ }
32
+ }
33
+ return [o([], "whenChain-empty")];
34
+ }
35
+ function o(n, t) {
36
+ const e = n ? Array.isArray(n) ? n.filter((r) => r != null) : [n].filter((r) => r != null) : [];
37
+ return {
38
+ tag: "#anchor",
39
+ key: t,
40
+ children: e
41
+ };
42
+ }
43
+ export {
44
+ o as anchorBlock,
45
+ i as each,
46
+ a as match,
47
+ c as when
48
+ };
49
+ //# sourceMappingURL=custom-elements-runtime.directives.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"custom-elements-runtime.directives.es.js","sources":["../src/lib/directives.ts"],"sourcesContent":["import type { VNode } from './runtime/types';\n\n/* --- When --- */\nexport function when(cond: boolean, children: VNode | VNode[]): VNode;\nexport function when(cond: boolean, factory: () => VNode | VNode[]): VNode;\nexport function when(\n cond: boolean,\n childrenOrFactory: VNode | VNode[] | (() => VNode | VNode[]),\n): VNode {\n const anchorKey = 'when-block'; // stable key regardless of condition\n if (typeof childrenOrFactory === 'function') {\n return anchorBlock(cond ? childrenOrFactory() : [], anchorKey);\n }\n return anchorBlock(cond ? childrenOrFactory : [], anchorKey);\n}\n\n/* --- Each --- */\nexport function each<\n T extends string | number | boolean | { id?: string | number; key?: string },\n>(list: T[], render: (item: T, index: number) => VNode | VNode[]): VNode[] {\n return list.map((item, i) => {\n // For primitives, use value as key; for objects, prefer key/id\n const itemKey =\n typeof item === 'object'\n ? ((item as Record<string, unknown>)?.key ??\n (item as Record<string, unknown>)?.id ??\n `idx-${i}`)\n : String(item);\n return anchorBlock(render(item, i), `each-${itemKey}`);\n });\n}\n\n/* --- match --- */\nexport function match() {\n const branches: Branch[] = [];\n return {\n when(cond: unknown, content: VNode | VNode[] | (() => VNode | VNode[])) {\n branches.push([cond, content]);\n return this;\n },\n otherwise(content: VNode | VNode[]) {\n branches.push([true, content]);\n return this;\n },\n done() {\n return whenChain(...branches);\n },\n };\n}\n\n/* --- WhenChain --- */\ntype Branch = [\n condition: unknown,\n content: VNode | VNode[] | (() => VNode | VNode[]),\n];\n\nfunction whenChain(...branches: Branch[]): VNode[] {\n for (let idx = 0; idx < branches.length; idx++) {\n const [cond, content] = branches[idx];\n if (cond) {\n const payload =\n typeof content === 'function'\n ? (content as () => VNode | VNode[])()\n : content;\n return [anchorBlock(payload, `whenChain-branch-${idx}`)];\n }\n }\n return [anchorBlock([], 'whenChain-empty')];\n}\n\n/**\n * Create a stable anchor block with consistent boundaries.\n * Always has start/end boundaries.\n */\nexport function anchorBlock(\n children: VNode | VNode[] | null | undefined,\n anchorKey: string,\n): VNode {\n // Normalize children to array, filtering out only null/undefined values.\n // Preserve meaningful falsy values such as 0, false, and empty string.\n const childArray = !children\n ? []\n : Array.isArray(children)\n ? children.filter((c) => c !== null && c !== undefined)\n : [children].filter((c) => c !== null && c !== undefined);\n\n return {\n tag: '#anchor',\n key: anchorKey,\n children: childArray,\n };\n}\n"],"names":["when","cond","childrenOrFactory","anchorKey","anchorBlock","each","list","render","item","i","itemKey","match","branches","content","whenChain","idx","payload","children","childArray","c"],"mappings":"AAKO,SAASA,EACdC,GACAC,GACO;AACP,QAAMC,IAAY;AAClB,SACSC,EADL,OAAOF,KAAsB,aACZD,IAAOC,EAAA,IAAsB,CAAA,IAE/BD,IAAOC,IAAoB,CAAA,GAFQC,CAAS;AAGjE;AAGO,SAASE,EAEdC,GAAWC,GAA8D;AACzE,SAAOD,EAAK,IAAI,CAACE,GAAMC,MAAM;AAE3B,UAAMC,IACJ,OAAOF,KAAS,WACVA,GAAkC,OACnCA,GAAkC,MACnC,OAAOC,CAAC,KACR,OAAOD,CAAI;AACjB,WAAOJ,EAAYG,EAAOC,GAAMC,CAAC,GAAG,QAAQC,CAAO,EAAE;AAAA,EACvD,CAAC;AACH;AAGO,SAASC,IAAQ;AACtB,QAAMC,IAAqB,CAAA;AAC3B,SAAO;AAAA,IACL,KAAKX,GAAeY,GAAoD;AACtE,aAAAD,EAAS,KAAK,CAACX,GAAMY,CAAO,CAAC,GACtB;AAAA,IACT;AAAA,IACA,UAAUA,GAA0B;AAClC,aAAAD,EAAS,KAAK,CAAC,IAAMC,CAAO,CAAC,GACtB;AAAA,IACT;AAAA,IACA,OAAO;AACL,aAAOC,EAAU,GAAGF,CAAQ;AAAA,IAC9B;AAAA,EAAA;AAEJ;AAQA,SAASE,KAAaF,GAA6B;AACjD,WAASG,IAAM,GAAGA,IAAMH,EAAS,QAAQG,KAAO;AAC9C,UAAM,CAACd,GAAMY,CAAO,IAAID,EAASG,CAAG;AACpC,QAAId,GAAM;AACR,YAAMe,IACJ,OAAOH,KAAY,aACdA,MACDA;AACN,aAAO,CAACT,EAAYY,GAAS,oBAAoBD,CAAG,EAAE,CAAC;AAAA,IACzD;AAAA,EACF;AACA,SAAO,CAACX,EAAY,IAAI,iBAAiB,CAAC;AAC5C;AAMO,SAASA,EACda,G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