blecsd 0.4.0 → 0.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. package/README.md +169 -147
  2. package/dist/blend-BZDmQFAm.d.ts +1215 -0
  3. package/dist/{border-DGNDfT6T.d.ts → border-Br-Jc027.d.ts} +2 -2
  4. package/dist/{cell-DwIu2ryP.d.ts → cell-5Ty_3yMs.d.ts} +1 -1
  5. package/dist/cellRenderer-D0-DJXWl.d.ts +374 -0
  6. package/dist/chunk-3PGACJB6.js +1 -0
  7. package/dist/{chunk-DNRXW56C.js → chunk-4EV3YS7F.js} +1 -1
  8. package/dist/chunk-4XW4WIPH.js +1 -0
  9. package/dist/chunk-7CLV3LTZ.js +4 -0
  10. package/dist/chunk-7ZFQO3OQ.js +1 -0
  11. package/dist/chunk-AM6IDSXI.js +1 -0
  12. package/dist/chunk-APPZ3YHO.js +0 -0
  13. package/dist/chunk-EHYOVHRL.js +2 -0
  14. package/dist/chunk-EKE2BXPS.js +1 -0
  15. package/dist/chunk-EOFT3PNU.js +1 -0
  16. package/dist/chunk-ESMSDY3P.js +1 -0
  17. package/dist/chunk-FJLSHFCF.js +1 -0
  18. package/dist/chunk-FUW7OD3H.js +1 -0
  19. package/dist/chunk-GIMWA5WA.js +1 -0
  20. package/dist/chunk-GRMSEMU7.js +1 -0
  21. package/dist/chunk-I7AUKTXE.js +1 -0
  22. package/dist/chunk-IXUFU6TE.js +3 -0
  23. package/dist/chunk-JB5KFQPD.js +1 -0
  24. package/dist/chunk-JCLNGU3K.js +1 -0
  25. package/dist/chunk-JN2OGNK3.js +1 -0
  26. package/dist/chunk-JRRJCATR.js +1 -0
  27. package/dist/chunk-JWIVZCKW.js +1 -0
  28. package/dist/chunk-K5UMVDQX.js +1 -0
  29. package/dist/chunk-KYNS3GBJ.js +2 -0
  30. package/dist/chunk-L4FIDOS6.js +1 -0
  31. package/dist/chunk-LIVVHEOU.js +1 -0
  32. package/dist/chunk-LNEISTXM.js +1 -0
  33. package/dist/chunk-M5FXA5FL.js +1 -0
  34. package/dist/chunk-MEJJLDEQ.js +1 -0
  35. package/dist/chunk-NYIMY4UV.js +1 -0
  36. package/dist/chunk-PQZTNWLA.js +1 -0
  37. package/dist/chunk-QS5QXZNJ.js +1 -0
  38. package/dist/chunk-SXOBHRXF.js +2 -0
  39. package/dist/chunk-T2EQLWMN.js +1 -0
  40. package/dist/chunk-T62UPG63.js +4 -0
  41. package/dist/chunk-TPBILYDM.js +10 -0
  42. package/dist/chunk-UWS6FIU5.js +1 -0
  43. package/dist/chunk-W64J7C25.js +4 -0
  44. package/dist/chunk-W6RELN6A.js +1 -0
  45. package/dist/chunk-XYMPBCYW.js +1 -0
  46. package/dist/chunk-ZAJI53SZ.js +1 -0
  47. package/dist/cli/init.js +1 -1
  48. package/dist/{componentStorage-CJTh-TPO.d.ts → componentStorage-CXJvx4Lt.d.ts} +2 -2
  49. package/dist/components/index.d.ts +7762 -7682
  50. package/dist/components/index.js +5 -1
  51. package/dist/core/index.d.ts +4851 -4261
  52. package/dist/core/index.js +1 -1
  53. package/dist/debug/index.d.ts +310 -84
  54. package/dist/debug/index.js +8 -1
  55. package/dist/{dirtyTracking-C4v8MmM9.d.ts → dirtyTracking-D0SQrEeo.d.ts} +2 -2
  56. package/dist/{doubleBuffer-CKQFmlPN.d.ts → doubleBuffer-d9yVNtj1.d.ts} +22 -2
  57. package/dist/errors/index.js +1 -1
  58. package/dist/{events-9ForpTfM.d.ts → events-CGqK6LGt.d.ts} +2 -2
  59. package/dist/{inputActions-Fyw14_Gm.d.ts → factories-vW7bn_He.d.ts} +21 -786
  60. package/dist/{gameLoop-CSTb7e0L.d.ts → gameLoop-C1AyRWyP.d.ts} +3 -3
  61. package/dist/index.d.ts +25 -1217
  62. package/dist/index.js +1 -3
  63. package/dist/input/index.d.ts +1 -1
  64. package/dist/input/index.js +1 -1
  65. package/dist/inputStream-BoFAEJ7g.d.ts +1385 -0
  66. package/dist/interactiveSystem-Dtv3xERg.d.ts +2292 -0
  67. package/dist/{keyParser-m7fWto6g.d.ts → keyParser-DReXe2j-.d.ts} +28 -28
  68. package/dist/{mouseParser-B7p5ow7K.d.ts → mouseParser-CTNGolIA.d.ts} +1 -1
  69. package/dist/{packedStore-BgvnEdE7.d.ts → packedStore-480t2X74.d.ts} +1 -1
  70. package/dist/panelMovement-DSLYdNOL.d.ts +1909 -0
  71. package/dist/{parser-iMHmQuUh.d.ts → parser-Q1YLXYpF.d.ts} +1 -1
  72. package/dist/positioning-DiUivJXa.d.ts +917 -0
  73. package/dist/{renderable-CwqGwrEV.d.ts → renderable-IbSJao5y.d.ts} +2 -2
  74. package/dist/{scheduler-DeeZleia.d.ts → scheduler-NbHT3-D2.d.ts} +1 -1
  75. package/dist/schemas/index.d.ts +6 -6
  76. package/dist/schemas/index.js +1 -1
  77. package/dist/style/index.d.ts +851 -0
  78. package/dist/style/index.js +1 -0
  79. package/dist/styleInheritance-CuRb5Dmp.d.ts +251 -0
  80. package/dist/systems/index.d.ts +786 -1882
  81. package/dist/systems/index.js +1 -1
  82. package/dist/terminal/index.d.ts +5542 -2460
  83. package/dist/terminal/index.js +1 -1
  84. package/dist/terminalBuffer-BbUz27qM.d.ts +691 -0
  85. package/dist/{terminus-14-bold-HWSPRLJD.js → terminus-14-bold-ZS4IH465.js} +1 -1
  86. package/dist/{terminus-14-normal-T3SWMH4D.js → terminus-14-normal-HD5N7F5W.js} +1 -1
  87. package/dist/testing/index.d.ts +923 -0
  88. package/dist/testing/index.js +7 -0
  89. package/dist/text/index.d.ts +263 -0
  90. package/dist/text/index.js +3 -0
  91. package/dist/textWrap-sY-PZzE7.d.ts +761 -0
  92. package/dist/{tilemap-BirMJdbu.d.ts → tilemap-ByvTsepD.d.ts} +5 -5
  93. package/dist/{types-CPB4CpbH.d.ts → types-B8LmNkzG.d.ts} +1 -1
  94. package/dist/utils/index.d.ts +829 -782
  95. package/dist/utils/index.js +32 -1
  96. package/dist/{virtualScrollback-D9uLFe8l.d.ts → virtualScrollback-CiooIebp.d.ts} +4 -4
  97. package/dist/virtualViewport-fIlbIGPt.d.ts +657 -0
  98. package/dist/{virtualizedLineStore-DwPEvPkk.d.ts → virtualizedLineStore-DfyhojPZ.d.ts} +1 -1
  99. package/dist/widgets/bigText.d.ts +13 -13
  100. package/dist/widgets/bigText.js +1 -1
  101. package/dist/widgets/fonts/index.d.ts +1 -1
  102. package/dist/widgets/fonts/index.js +1 -1
  103. package/dist/widgets/index.d.ts +1620 -910
  104. package/dist/widgets/index.js +24 -1
  105. package/package.json +23 -22
  106. package/dist/3d/index.d.ts +0 -5
  107. package/dist/3d/index.js +0 -1
  108. package/dist/audio/index.d.ts +0 -177
  109. package/dist/audio/index.js +0 -1
  110. package/dist/chunk-25OEBENM.js +0 -3
  111. package/dist/chunk-26STV7ZS.js +0 -1
  112. package/dist/chunk-2NMGUEFC.js +0 -4
  113. package/dist/chunk-35LCBY6P.js +0 -1
  114. package/dist/chunk-4PRDJTCM.js +0 -1
  115. package/dist/chunk-5PELJRUQ.js +0 -1
  116. package/dist/chunk-5VEKHA3B.js +0 -5
  117. package/dist/chunk-6KEM3OS2.js +0 -11
  118. package/dist/chunk-6XWY6GB7.js +0 -1
  119. package/dist/chunk-735KKTP3.js +0 -1
  120. package/dist/chunk-7SWJNDOL.js +0 -26
  121. package/dist/chunk-APKUNIMB.js +0 -1
  122. package/dist/chunk-CJCSZRV6.js +0 -1
  123. package/dist/chunk-DMBMCCLN.js +0 -1
  124. package/dist/chunk-DQTVJITR.js +0 -1
  125. package/dist/chunk-DSKQ5J4R.js +0 -1
  126. package/dist/chunk-E4CJRSND.js +0 -1
  127. package/dist/chunk-EF4DC6IN.js +0 -1
  128. package/dist/chunk-EJAKECSN.js +0 -1
  129. package/dist/chunk-FNQRUMFD.js +0 -1
  130. package/dist/chunk-GJ3RS2VG.js +0 -1
  131. package/dist/chunk-KTVEMB2I.js +0 -1
  132. package/dist/chunk-KYAPE44E.js +0 -8
  133. package/dist/chunk-LI4Y7TBZ.js +0 -1
  134. package/dist/chunk-NHOL4BN6.js +0 -1
  135. package/dist/chunk-NPNUUSIB.js +0 -1
  136. package/dist/chunk-NZ55KBM6.js +0 -1
  137. package/dist/chunk-OFRWGW2G.js +0 -1
  138. package/dist/chunk-OMMJ7B5P.js +0 -1
  139. package/dist/chunk-OMU5BSAS.js +0 -2
  140. package/dist/chunk-P3ZLIQJP.js +0 -1
  141. package/dist/chunk-PWI36BQJ.js +0 -1
  142. package/dist/chunk-QQMUDJ32.js +0 -2
  143. package/dist/chunk-R3ICZOE4.js +0 -1
  144. package/dist/chunk-RZ7FGVI6.js +0 -1
  145. package/dist/chunk-S6WS46FE.js +0 -1
  146. package/dist/chunk-TSARUU56.js +0 -1
  147. package/dist/chunk-WJRVUAZR.js +0 -33
  148. package/dist/chunk-WY5EZOOL.js +0 -1
  149. package/dist/chunk-YY6RZCZH.js +0 -4
  150. package/dist/chunk-ZPGJCHXH.js +0 -1
  151. package/dist/chunk-ZPL2J25N.js +0 -1
  152. package/dist/game/index.d.ts +0 -486
  153. package/dist/game/index.js +0 -1
  154. package/dist/index-DBS5Uefn.d.ts +0 -3156
  155. package/dist/viewport3d-xI33-_wq.d.ts +0 -182
  156. package/dist/virtualViewport-DTSN6jFk.d.ts +0 -1856
@@ -0,0 +1 @@
1
+ export{d as COLOR_ALIASES,c as COLOR_NAMES,j as CSS_COLORS,e as ColorNameSchema,g as colorToName,k as cssNameToColor,l as getColorNames,m as getCssColorNames,h as isColorName,i as isSpecialColor,f as nameToColor}from'../chunk-GIMWA5WA.js';export{a as Color256Schema,e as HSLASchema,d as HSLSchema,f as HexColorSchema,c as RGBASchema,b as RGBSchema,X as blend,ea as blendAlpha,da as blendWithAlpha,F as color256ToHex,D as color256ToRgb,ga as complement,la as contrastRatio,Z as darken,$ as darken256,ba as desaturate,ia as gradient,ja as gradient256,ca as grayscale,E as hexToColor256,v as hexToRgb,z as hslToRgb,B as hslaToRgba,ha as invert,g as isColor256,i as isRGB,ma as isReadable,Y as lighten,_ as lighten256,ka as luminance,W as mix,C as rgbToColor256,w as rgbToHex,y as rgbToHsl,x as rgbaToHex,A as rgbaToHsla,fa as rotateHue,aa as saturate}from'../chunk-FUW7OD3H.js';export{a as INHERITING_PROPERTIES,b as NON_INHERITING_PROPERTIES,f as clearStyleCache,l as computeInheritedStyle,n as doesPropertyInherit,p as findPropertySource,r as getComputedStyles,i as getDefaultStyle,o as getInheritedProperty,h as getLocalStyle,e as invalidateAllStyleCaches,d as invalidateStyleCache,k as isDefaultColor,j as mergeStyles,q as precomputeStyles,m as resolveStyle}from'../chunk-NYIMY4UV.js';import {a}from'../chunk-QS5QXZNJ.js';import {e,c}from'../chunk-JRRJCATR.js';import {I as I$1,J,M}from'../chunk-LIVVHEOU.js';import'../chunk-Z4EZERNE.js';import {k,m,r,o}from'../chunk-7ZFQO3OQ.js';export{u as colorToHex,t as hexToColor,r as packColor,s as unpackColor}from'../chunk-7ZFQO3OQ.js';import'../chunk-I7AUKTXE.js';import {z}from'zod';var w=z.object({fg:z.union([z.string(),z.number()]).optional(),bg:z.union([z.string(),z.number()]).optional(),bold:z.boolean().optional(),underline:z.boolean().optional(),blink:z.boolean().optional(),inverse:z.boolean().optional(),transparent:z.boolean().optional(),opacity:z.number().min(0).max(1).optional()}),A=z.object({tag:z.string().optional(),className:z.string().optional(),entityId:z.number().int().nonnegative().optional()}).refine(r=>r.tag!==void 0||r.className!==void 0||r.entityId!==void 0,{message:"Selector must have at least one of: tag, className, entityId"}),F=z.object({selector:A,style:w,priority:z.number().int().optional()}),qe=z.object({name:z.string().min(1),rules:z.array(F)}),Ke=1,Qe=10,Xe=100;function p(r){let t=0;return r.tag!==void 0&&(t+=Ke),r.className!==void 0&&(t+=Qe),r.entityId!==void 0&&(t+=Xe),t}function Ze(r,t){if(e(r,t)){let a=c(r,t);if(a&&typeof a.tag=="string")return a.tag}let n=a(r,t,"widgetTag",void 0);if(n!==void 0)return n}function er(r,t){if(e(r,t)){let a=c(r,t);if(a&&Array.isArray(a.classes))return a.classes}let n=a(r,t,"styleClasses",void 0);return n!==void 0&&Array.isArray(n)?n:[]}function h(r,t,n){return !(n.entityId!==void 0&&t!==n.entityId||n.tag!==void 0&&Ze(r,t)!==n.tag||n.className!==void 0&&!er(r,t).includes(n.className))}function rr(r){return {name:r,rules:[]}}function tr(r,t){return F.parse(t),{...r,rules:[...r.rules,t]}}function nr(r,t){return {...r,rules:r.rules.filter(n=>!t(n))}}function or(r){return {...r,rules:[]}}function ar(r,t){t.fg!==void 0&&(r.fg=t.fg),t.bg!==void 0&&(r.bg=t.bg),t.bold!==void 0&&(r.bold=t.bold),t.underline!==void 0&&(r.underline=t.underline),t.blink!==void 0&&(r.blink=t.blink),t.inverse!==void 0&&(r.inverse=t.inverse),t.transparent!==void 0&&(r.transparent=t.transparent),t.opacity!==void 0&&(r.opacity=t.opacity);}function P(r){let t=[...r].sort((a,i)=>a.specificity!==i.specificity?a.specificity-i.specificity:a.priority!==i.priority?a.priority-i.priority:a.order-i.order),n={};for(let a of t)ar(n,a.style);return n}function ir(r,t){let n=k(r),a=0,i=new Set;for(let s of n){if(!m(r,s,I$1))continue;let g=[];for(let u=0;u<t.rules.length;u++){let m=t.rules[u];m&&h(r,s,m.selector)&&(i.add(u),g.push({style:m.style,specificity:p(m.selector),priority:m.priority??0,order:u}));}if(g.length===0)continue;let W=P(g);J(r,s,W),M(r,s),a++;}return {entitiesStyled:a,rulesMatched:i.size}}function lr(r,t,n){if(!m(r,t,I$1))return false;let a=[];for(let s=0;s<n.rules.length;s++){let g=n.rules[s];g&&h(r,t,g.selector)&&a.push({style:g.style,specificity:p(g.selector),priority:g.priority??0,order:s});}if(a.length===0)return false;let i=P(a);return J(r,t,i),M(r,t),true}function sr(r,t,n){let a=[];for(let i of n.rules)h(r,t,i.selector)&&a.push({rule:i,specificity:p(i.selector)});return a}var gr=z.object({primary:z.number(),secondary:z.number(),accent:z.number(),background:z.number(),foreground:z.number(),error:z.number(),warning:z.number(),success:z.number(),info:z.number(),muted:z.number(),border:z.number()}),cr=z.object({style:z.enum(["single","double","rounded","heavy","none"]),fg:z.number(),bg:z.number()}),dr=z.object({fg:z.number(),bg:z.number(),borderFg:z.number()}),ur=z.object({button:z.object({fg:z.number(),bg:z.number(),activeFg:z.number(),activeBg:z.number()}),input:z.object({fg:z.number(),bg:z.number(),placeholderFg:z.number(),cursorFg:z.number()}),list:z.object({fg:z.number(),bg:z.number(),selectedFg:z.number(),selectedBg:z.number()}),panel:z.object({fg:z.number(),bg:z.number(),headerFg:z.number(),headerBg:z.number()})}),R=z.object({name:z.string(),colors:gr,borders:cr,focus:dr,widgets:ur}),d=new Map,C=new Map;function mr(r){R.parse(r),d.set(r.name,r);}function fr(r){return d.get(r)}function yr(r,t){if(!d.get(t))throw new Error(`Theme "${t}" is not registered`);C.set(r,t);}function v(r){let t=C.get(r)??"default",n=d.get(t);if(!n)throw new Error("No theme registered. Register at least one theme before use.");return n}function br(){d.clear(),C.clear();}function N(){return {name:"default",colors:{primary:r(33,150,243),secondary:r(156,39,176),accent:r(255,193,7),background:r(18,18,18),foreground:r(238,238,238),error:r(244,67,54),warning:r(255,152,0),success:r(76,175,80),info:r(33,150,243),muted:r(117,117,117),border:r(66,66,66)},borders:{style:"single",fg:r(66,66,66),bg:r(0,0,0,0)},focus:{fg:r(255,255,255),bg:r(33,150,243),borderFg:r(100,181,246)},widgets:{button:{fg:r(255,255,255),bg:r(33,150,243),activeFg:r(255,255,255),activeBg:r(25,118,210)},input:{fg:r(238,238,238),bg:r(38,38,38),placeholderFg:r(117,117,117),cursorFg:r(255,255,255)},list:{fg:r(238,238,238),bg:r(18,18,18),selectedFg:r(255,255,255),selectedBg:r(33,150,243)},panel:{fg:r(238,238,238),bg:r(28,28,28),headerFg:r(255,255,255),headerBg:r(48,48,48)}}}}function pr(){return {name:"dark",colors:{primary:r(66,165,245),secondary:r(186,104,200),accent:r(255,213,79),background:r(12,12,12),foreground:r(250,250,250),error:r(239,83,80),warning:r(255,167,38),success:r(102,187,106),info:r(66,165,245),muted:r(97,97,97),border:r(48,48,48)},borders:{style:"single",fg:r(48,48,48),bg:r(0,0,0,0)},focus:{fg:r(255,255,255),bg:r(66,165,245),borderFg:r(144,202,249)},widgets:{button:{fg:r(255,255,255),bg:r(66,165,245),activeFg:r(255,255,255),activeBg:r(42,139,230)},input:{fg:r(250,250,250),bg:r(24,24,24),placeholderFg:r(97,97,97),cursorFg:r(255,255,255)},list:{fg:r(250,250,250),bg:r(12,12,12),selectedFg:r(255,255,255),selectedBg:r(66,165,245)},panel:{fg:r(250,250,250),bg:r(18,18,18),headerFg:r(255,255,255),headerBg:r(33,33,33)}}}}function hr(){return {name:"light",colors:{primary:r(25,118,210),secondary:r(123,31,162),accent:r(255,160,0),background:r(250,250,250),foreground:r(33,33,33),error:r(211,47,47),warning:r(245,124,0),success:r(56,142,60),info:r(25,118,210),muted:r(158,158,158),border:r(224,224,224)},borders:{style:"single",fg:r(224,224,224),bg:r(0,0,0,0)},focus:{fg:r(255,255,255),bg:r(25,118,210),borderFg:r(66,165,245)},widgets:{button:{fg:r(255,255,255),bg:r(25,118,210),activeFg:r(255,255,255),activeBg:r(21,101,192)},input:{fg:r(33,33,33),bg:r(255,255,255),placeholderFg:r(158,158,158),cursorFg:r(33,33,33)},list:{fg:r(33,33,33),bg:r(250,250,250),selectedFg:r(255,255,255),selectedBg:r(25,118,210)},panel:{fg:r(33,33,33),bg:r(245,245,245),headerFg:r(33,33,33),headerBg:r(238,238,238)}}}}function Tr(){return {name:"high-contrast",colors:{primary:r(0,120,215),secondary:r(136,23,152),accent:r(255,185,0),background:r(0,0,0),foreground:r(255,255,255),error:r(255,0,0),warning:r(255,140,0),success:r(0,255,0),info:r(0,120,215),muted:r(128,128,128),border:r(255,255,255)},borders:{style:"heavy",fg:r(255,255,255),bg:r(0,0,0,0)},focus:{fg:r(0,0,0),bg:r(255,255,0),borderFg:r(255,255,0)},widgets:{button:{fg:r(0,0,0),bg:r(255,255,255),activeFg:r(255,255,255),activeBg:r(0,120,215)},input:{fg:r(255,255,255),bg:r(0,0,0),placeholderFg:r(128,128,128),cursorFg:r(255,255,0)},list:{fg:r(255,255,255),bg:r(0,0,0),selectedFg:r(0,0,0),selectedBg:r(255,255,255)},panel:{fg:r(255,255,255),bg:r(0,0,0),headerFg:r(0,0,0),headerBg:r(255,255,255)}}}}function Sr(){return {name:"solarized",colors:{primary:r(38,139,210),secondary:r(108,113,196),accent:r(181,137,0),background:r(0,43,54),foreground:r(131,148,150),error:r(220,50,47),warning:r(203,75,22),success:r(133,153,0),info:r(42,161,152),muted:r(88,110,117),border:r(7,54,66)},borders:{style:"single",fg:r(7,54,66),bg:r(0,0,0,0)},focus:{fg:r(253,246,227),bg:r(38,139,210),borderFg:r(108,113,196)},widgets:{button:{fg:r(253,246,227),bg:r(38,139,210),activeFg:r(253,246,227),activeBg:r(108,113,196)},input:{fg:r(131,148,150),bg:r(7,54,66),placeholderFg:r(88,110,117),cursorFg:r(253,246,227)},list:{fg:r(131,148,150),bg:r(0,43,54),selectedFg:r(253,246,227),selectedBg:r(38,139,210)},panel:{fg:r(131,148,150),bg:r(7,54,66),headerFg:r(147,161,161),headerBg:r(0,43,54)}}}}function xr(){return {name:"monokai",colors:{primary:r(102,217,239),secondary:r(171,157,242),accent:r(230,219,116),background:r(39,40,34),foreground:r(248,248,242),error:r(249,38,114),warning:r(253,151,31),success:r(166,226,46),info:r(102,217,239),muted:r(117,113,94),border:r(73,72,62)},borders:{style:"single",fg:r(73,72,62),bg:r(0,0,0,0)},focus:{fg:r(39,40,34),bg:r(230,219,116),borderFg:r(102,217,239)},widgets:{button:{fg:r(39,40,34),bg:r(102,217,239),activeFg:r(39,40,34),activeBg:r(171,157,242)},input:{fg:r(248,248,242),bg:r(73,72,62),placeholderFg:r(117,113,94),cursorFg:r(230,219,116)},list:{fg:r(248,248,242),bg:r(39,40,34),selectedFg:r(39,40,34),selectedBg:r(102,217,239)},panel:{fg:r(248,248,242),bg:r(73,72,62),headerFg:r(248,248,242),headerBg:r(39,40,34)}}}}function Fr(){return {name:"nord",colors:{primary:r(136,192,208),secondary:r(180,142,173),accent:r(235,203,139),background:r(46,52,64),foreground:r(236,239,244),error:r(191,97,106),warning:r(208,135,112),success:r(163,190,140),info:r(129,161,193),muted:r(76,86,106),border:r(59,66,82)},borders:{style:"single",fg:r(59,66,82),bg:r(0,0,0,0)},focus:{fg:r(46,52,64),bg:r(136,192,208),borderFg:r(129,161,193)},widgets:{button:{fg:r(46,52,64),bg:r(136,192,208),activeFg:r(46,52,64),activeBg:r(129,161,193)},input:{fg:r(236,239,244),bg:r(59,66,82),placeholderFg:r(76,86,106),cursorFg:r(236,239,244)},list:{fg:r(236,239,244),bg:r(46,52,64),selectedFg:r(46,52,64),selectedBg:r(136,192,208)},panel:{fg:r(236,239,244),bg:r(59,66,82),headerFg:r(236,239,244),headerBg:r(67,76,94)}}}}function Rr(){return {name:"dracula",colors:{primary:r(189,147,249),secondary:r(255,121,198),accent:r(241,250,140),background:r(40,42,54),foreground:r(248,248,242),error:r(255,85,85),warning:r(255,184,108),success:r(80,250,123),info:r(139,233,253),muted:r(98,114,164),border:r(68,71,90)},borders:{style:"single",fg:r(68,71,90),bg:r(0,0,0,0)},focus:{fg:r(40,42,54),bg:r(189,147,249),borderFg:r(255,121,198)},widgets:{button:{fg:r(40,42,54),bg:r(189,147,249),activeFg:r(40,42,54),activeBg:r(255,121,198)},input:{fg:r(248,248,242),bg:r(68,71,90),placeholderFg:r(98,114,164),cursorFg:r(248,248,242)},list:{fg:r(248,248,242),bg:r(40,42,54),selectedFg:r(40,42,54),selectedBg:r(189,147,249)},panel:{fg:r(248,248,242),bg:r(68,71,90),headerFg:r(248,248,242),headerBg:r(40,42,54)}}}}function Cr(){return {name:"gruvbox",colors:{primary:r(131,165,152),secondary:r(211,134,155),accent:r(250,189,47),background:r(40,40,40),foreground:r(235,219,178),error:r(251,73,52),warning:r(254,128,25),success:r(184,187,38),info:r(131,165,152),muted:r(146,131,116),border:r(60,56,54)},borders:{style:"single",fg:r(60,56,54),bg:r(0,0,0,0)},focus:{fg:r(40,40,40),bg:r(250,189,47),borderFg:r(131,165,152)},widgets:{button:{fg:r(40,40,40),bg:r(131,165,152),activeFg:r(40,40,40),activeBg:r(184,187,38)},input:{fg:r(235,219,178),bg:r(60,56,54),placeholderFg:r(146,131,116),cursorFg:r(235,219,178)},list:{fg:r(235,219,178),bg:r(40,40,40),selectedFg:r(40,40,40),selectedBg:r(131,165,152)},panel:{fg:r(235,219,178),bg:r(60,56,54),headerFg:r(235,219,178),headerBg:r(80,73,69)}}}}function I(r,t){let n={...r};for(let a in t)if(Object.hasOwn(t,a)){let i=t[a],s=n[a];i&&typeof i=="object"&&!Array.isArray(i)&&s&&typeof s=="object"&&!Array.isArray(s)?n[a]=I(s,i):i!==void 0&&(n[a]=i);}return n}function vr(r,t){let n=N();return {...E(n,t),name:r}}function E(r,t){return {name:r.name,colors:{...r.colors,...t.colors??{}},borders:{...r.borders,...t.borders??{}},focus:{...r.focus,...t.focus??{}},widgets:{button:{...r.widgets.button,...t.widgets?.button??{}},input:{...r.widgets.input,...t.widgets?.input??{}},list:{...r.widgets.list,...t.widgets?.list??{}},panel:{...r.widgets.panel,...t.widgets?.panel??{}}}}}function Br(r,t,n){let a=d.get(r);if(!a)throw new Error(`Base theme "${r}" is not registered`);return {...I(a,n),name:t}}function kr(r){return JSON.stringify(r)}function wr(r){let t=JSON.parse(r);return R.parse(t)}function Ar(r,t){let n=v(r);J(r,t,{fg:n.colors.foreground,bg:n.colors.background}),M(r,t);}function Pr(r){let t=v(r),n=o(r,[I$1]);for(let a of n)m(r,a,I$1)&&(I$1.fg[a]=t.colors.foreground,I$1.bg[a]=t.colors.background,I$1.dirty[a]=1);}export{w as StylePropertiesSchema,F as StyleRuleSchema,A as StyleSelectorSchema,qe as StylesheetSchema,R as ThemeSchema,tr as addRule,ir as applyStylesheet,lr as applyStylesheetToEntity,Ar as applyTheme,Pr as applyThemeToAll,p as calculateSpecificity,or as clearRules,pr as createDarkTheme,N as createDefaultTheme,Rr as createDraculaTheme,Cr as createGruvboxTheme,Tr as createHighContrastTheme,hr as createLightTheme,xr as createMonokaiTheme,Fr as createNordTheme,Sr as createSolarizedTheme,rr as createStylesheet,vr as createTheme,wr as deserializeTheme,Br as extendTheme,v as getActiveTheme,sr as getMatchingRules,fr as getTheme,h as matchesSelector,E as mergeThemes,mr as registerTheme,nr as removeRules,br as resetThemeRegistry,kr as serializeTheme,yr as setActiveTheme};
@@ -0,0 +1,251 @@
1
+ import { S as StyleData } from './renderable-IbSJao5y.js';
2
+ import { W as World, E as Entity } from './types-B8LmNkzG.js';
3
+
4
+ /**
5
+ * Style inheritance system for cascading styles through the hierarchy.
6
+ * Some style properties (like fg, bold) inherit from ancestors,
7
+ * while others (like bg) are local to each element.
8
+ * @module core/styleInheritance
9
+ */
10
+
11
+ /**
12
+ * Style properties that inherit from parent to child.
13
+ * These cascade down the hierarchy if not explicitly set.
14
+ *
15
+ * - `fg`: Foreground color inherits (text color from parent)
16
+ * - `bold`: Bold text inherits
17
+ * - `underline`: Underline inherits
18
+ * - `blink`: Blink inherits
19
+ * - `inverse`: Inverse inherits
20
+ *
21
+ * Properties that do NOT inherit:
22
+ * - `bg`: Background is local to each element
23
+ * - `transparent`: Transparency is local
24
+ */
25
+ declare const INHERITING_PROPERTIES: ReadonlyArray<keyof StyleData>;
26
+ /**
27
+ * Properties that do NOT inherit from parent.
28
+ * These are always local to the element.
29
+ */
30
+ declare const NON_INHERITING_PROPERTIES: ReadonlyArray<keyof StyleData>;
31
+ /**
32
+ * Gets the current cache generation.
33
+ * @returns Current generation number
34
+ */
35
+ declare function getCacheGeneration(): number;
36
+ /**
37
+ * Invalidates the computed style cache for an entity and its descendants.
38
+ * Call this when a style property changes.
39
+ *
40
+ * @param eid - The entity whose cache to invalidate
41
+ *
42
+ * @example
43
+ * ```typescript
44
+ * import { invalidateStyleCache, setStyle } from 'blecsd';
45
+ *
46
+ * // After changing style, invalidate cache
47
+ * setStyle(world, entity, { fg: 0xff0000ff });
48
+ * invalidateStyleCache(entity);
49
+ * ```
50
+ */
51
+ declare function invalidateStyleCache(eid: Entity): void;
52
+ /**
53
+ * Invalidates all computed style caches.
54
+ * More efficient than invalidating individual entities when many change.
55
+ *
56
+ * @example
57
+ * ```typescript
58
+ * import { invalidateAllStyleCaches } from 'blecsd';
59
+ *
60
+ * // After bulk style changes
61
+ * invalidateAllStyleCaches();
62
+ * ```
63
+ */
64
+ declare function invalidateAllStyleCaches(): void;
65
+ /**
66
+ * Clears the style cache.
67
+ * Primarily for testing.
68
+ */
69
+ declare function clearStyleCache(): void;
70
+ /**
71
+ * Checks if an entity has a valid cached computed style.
72
+ *
73
+ * @param eid - The entity ID
74
+ * @returns true if valid cache exists
75
+ */
76
+ declare function hasValidStyleCache(eid: Entity): boolean;
77
+ /**
78
+ * Gets the local (non-inherited) style of an entity.
79
+ * Returns default values if entity has no Renderable component.
80
+ *
81
+ * @param world - The ECS world
82
+ * @param eid - The entity ID
83
+ * @returns The entity's local style
84
+ */
85
+ declare function getLocalStyle(world: World, eid: Entity): StyleData;
86
+ /**
87
+ * Gets the default style (used when no style is set).
88
+ *
89
+ * @returns Default style data
90
+ */
91
+ declare function getDefaultStyle(): StyleData;
92
+ /**
93
+ * Merges a parent style into a child style.
94
+ * Inheriting properties from parent are used if child hasn't set them.
95
+ * Non-inheriting properties always use the child's value.
96
+ *
97
+ * @param parent - The parent's computed style
98
+ * @param child - The child's local style
99
+ * @returns Merged style with inheritance applied
100
+ *
101
+ * @example
102
+ * ```typescript
103
+ * import { mergeStyles } from 'blecsd';
104
+ *
105
+ * const parentStyle = { fg: 0xff0000ff, bold: true, bg: 0x000000ff };
106
+ * const childStyle = { fg: 0x00ff00ff, bold: false, bg: 0x111111ff };
107
+ *
108
+ * const merged = mergeStyles(parentStyle, childStyle);
109
+ * // merged.fg = 0x00ff00ff (child overrides)
110
+ * // merged.bold = false (child overrides)
111
+ * // merged.bg = 0x111111ff (bg doesn't inherit, uses child)
112
+ * ```
113
+ */
114
+ declare function mergeStyles(parent: StyleData, child: StyleData): StyleData;
115
+ /**
116
+ * Checks if a color is the default (unset) color.
117
+ *
118
+ * @param color - The color to check
119
+ * @returns true if the color is the default
120
+ */
121
+ declare function isDefaultColor(color: number): boolean;
122
+ /**
123
+ * Computes the inherited style for an entity by walking up the hierarchy.
124
+ * Caches the result for efficiency.
125
+ *
126
+ * @param world - The ECS world
127
+ * @param eid - The entity ID
128
+ * @returns The computed style with inheritance applied
129
+ *
130
+ * @example
131
+ * ```typescript
132
+ * import { computeInheritedStyle, setStyle, appendChild } from 'blecsd';
133
+ *
134
+ * // Parent has red foreground
135
+ * setStyle(world, parent, { fg: 0xff0000ff });
136
+ *
137
+ * // Child has no foreground set
138
+ * appendChild(world, parent, child);
139
+ *
140
+ * const childStyle = computeInheritedStyle(world, child);
141
+ * // childStyle.fg === 0xff0000ff (inherited from parent)
142
+ * ```
143
+ */
144
+ declare function computeInheritedStyle(world: World, eid: Entity): StyleData;
145
+ /**
146
+ * Resolves the final style for an entity.
147
+ * This is an alias for computeInheritedStyle for clearer semantics.
148
+ *
149
+ * @param world - The ECS world
150
+ * @param eid - The entity ID
151
+ * @returns The resolved style with inheritance applied
152
+ *
153
+ * @example
154
+ * ```typescript
155
+ * import { resolveStyle, colorToHex } from 'blecsd';
156
+ *
157
+ * const style = resolveStyle(world, entity);
158
+ * console.log(`Foreground: ${colorToHex(style.fg)}`);
159
+ * ```
160
+ */
161
+ declare function resolveStyle(world: World, eid: Entity): StyleData;
162
+ /**
163
+ * Checks if a style property inherits from parent.
164
+ *
165
+ * @param property - The property name
166
+ * @returns true if the property inherits
167
+ *
168
+ * @example
169
+ * ```typescript
170
+ * import { doesPropertyInherit } from 'blecsd';
171
+ *
172
+ * doesPropertyInherit('fg'); // true
173
+ * doesPropertyInherit('bold'); // true
174
+ * doesPropertyInherit('bg'); // false
175
+ * ```
176
+ */
177
+ declare function doesPropertyInherit(property: keyof StyleData): boolean;
178
+ /**
179
+ * Gets the value of an inherited property for an entity.
180
+ * Walks up the hierarchy to find the first ancestor with a non-default value.
181
+ *
182
+ * @param world - The ECS world
183
+ * @param eid - The entity ID
184
+ * @param property - The property name
185
+ * @returns The inherited value
186
+ *
187
+ * @example
188
+ * ```typescript
189
+ * import { getInheritedProperty } from 'blecsd';
190
+ *
191
+ * const fg = getInheritedProperty(world, entity, 'fg');
192
+ * ```
193
+ */
194
+ declare function getInheritedProperty<K extends keyof StyleData>(world: World, eid: Entity, property: K): StyleData[K];
195
+ /**
196
+ * Gets the nearest ancestor with a non-default value for a property.
197
+ * Returns the entity itself if it has a non-default value.
198
+ *
199
+ * @param world - The ECS world
200
+ * @param eid - The entity ID
201
+ * @param property - The property name
202
+ * @returns The ancestor entity ID or 0 if no ancestor has the property set
203
+ *
204
+ * @example
205
+ * ```typescript
206
+ * import { findPropertySource } from 'blecsd';
207
+ *
208
+ * const source = findPropertySource(world, entity, 'fg');
209
+ * if (source !== 0) {
210
+ * console.log(`Color inherited from entity ${source}`);
211
+ * }
212
+ * ```
213
+ */
214
+ declare function findPropertySource(world: World, eid: Entity, property: keyof StyleData): Entity;
215
+ /**
216
+ * Precomputes inherited styles for all entities in an array.
217
+ * Useful for batch processing before rendering.
218
+ *
219
+ * @param world - The ECS world
220
+ * @param entities - Array of entity IDs
221
+ *
222
+ * @example
223
+ * ```typescript
224
+ * import { precomputeStyles, getAllEntities } from 'blecsd';
225
+ *
226
+ * const entities = getAllEntities(world);
227
+ * precomputeStyles(world, entities);
228
+ *
229
+ * // Now all styles are cached for fast access
230
+ * ```
231
+ */
232
+ declare function precomputeStyles(world: World, entities: readonly Entity[]): void;
233
+ /**
234
+ * Gets all computed styles for entities.
235
+ * More efficient than calling resolveStyle individually.
236
+ *
237
+ * @param world - The ECS world
238
+ * @param entities - Array of entity IDs
239
+ * @returns Map of entity IDs to computed styles
240
+ *
241
+ * @example
242
+ * ```typescript
243
+ * import { getComputedStyles } from 'blecsd';
244
+ *
245
+ * const styles = getComputedStyles(world, [entity1, entity2]);
246
+ * const style1 = styles.get(entity1);
247
+ * ```
248
+ */
249
+ declare function getComputedStyles(world: World, entities: readonly Entity[]): Map<Entity, StyleData>;
250
+
251
+ export { INHERITING_PROPERTIES as I, NON_INHERITING_PROPERTIES as N, computeInheritedStyle as a, getComputedStyles as b, clearStyleCache as c, doesPropertyInherit as d, getDefaultStyle as e, findPropertySource as f, getCacheGeneration as g, getInheritedProperty as h, getLocalStyle as i, hasValidStyleCache as j, invalidateAllStyleCaches as k, invalidateStyleCache as l, isDefaultColor as m, mergeStyles as n, precomputeStyles as p, resolveStyle as r };