{"version":3,"sources":["../src/widget-descriptors/helpers.ts","../src/components/Box.tsx","../src/components/BigText.tsx","../src/components/Button.tsx","../src/components/Input.tsx","../src/components/List.tsx","../src/components/Spacer.tsx","../src/components/Text.tsx","../src/dom.ts","../src/widget-descriptors/factory.ts","../src/reconciler.ts","../src/render.ts"],"names":["colors","WidgetDescriptor","BoxWidget","forwardRef","jsx","BigTextWidget","ButtonWidget","Textbox","ListWidget","TextWidget","createReconciler","updateLayoutNode","DefaultEventPriority","setRuntime","Screen","LayoutManager"],"mappings":";;;;;;;;;;;;;;AAiCO,SAAS,YACd,KAAA,EACY;AAGZ,EAAA,IACE,CAAC,MAAA,CAAO,KAAA,CAAM,MAAM,CAAA,IACpB,CAAC,MAAA,CAAO,KAAA,CAAM,SAAS,CAAA,IACvB,CAAC,MAAA,CAAO,MAAM,YAAY,CAAA,IAC1B,CAAC,MAAA,CAAO,KAAA,CAAM,UAAU,KACxB,CAAC,MAAA,CAAO,KAAA,CAAM,WAAW,CAAA,EACzB;AACA,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,MAAM,MAAA,GAAc;AAAA,IAClB,IAAA,EAAM,MAAA;AAAA,IACN,KAAA,EAAO,MAAM,WAAA,IAAe;AAAA,GAC9B;AAGA,EAAA,MAAA,CAAO,GAAA,GACL,MAAM,SAAA,KAAc,MAAA,GAAY,OAAO,KAAA,CAAM,SAAS,IAAI,CAAA,GAAI,IAAA;AAChE,EAAA,MAAA,CAAO,MAAA,GACL,MAAM,YAAA,KAAiB,MAAA,GAAY,OAAO,KAAA,CAAM,YAAY,IAAI,CAAA,GAAI,IAAA;AACtE,EAAA,MAAA,CAAO,IAAA,GACL,MAAM,UAAA,KAAe,MAAA,GAAY,OAAO,KAAA,CAAM,UAAU,IAAI,CAAA,GAAI,IAAA;AAClE,EAAA,MAAA,CAAO,KAAA,GACL,MAAM,WAAA,KAAgB,MAAA,GAAY,OAAO,KAAA,CAAM,WAAW,IAAI,CAAA,GAAI,IAAA;AAG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,KAAK,CAAA;AAAA;AAAA,IACrC;AAAA;AAAA,GACF;AAGA,EAAA,IAAI,qBAAiC,MAAM;AAAA,EAAC,CAAA;AAC5C,EAAA,MAAM,WAAA,GAAc,IAAI,OAAA,CAAc,CAAC,OAAA,KAAY;AACjD,IAAA,kBAAA,GAAqB,OAAA;AAAA,EACvB,CAAC,CAAA;AAGD,EAAA,kBAAA,CAAW,eAAA,CAAgB,OAAA,EAAS,SAAA,EAAW,IAAA,EAAM,MAAM;AAAA,EAE3D,CAAC,CAAA;AAED,EAAA,OAAO;AAAA,IACL,MAAA;AAAA,IACA,SAAS,MAAM;AAEb,MAAA,kBAAA,CAAW,eAAA,CAAgB,IAAA,EAAM,SAAA,EAAW,IAAA,EAAM,MAAM;AAAA,MAAC,CAAC,CAAA;AAG1D,MAAA,OAAA,CAAQ,QAAQ,cAAc,CAAA;AAG9B,MAAA,IAAI,qBAAA,EAAuB;AACzB,QAAA,MAAA,CAAO,OAAA,EAAQ;AAAA,MACjB;AAGA,MAAA,kBAAA,EAAmB;AAAA,IACrB,CAAA;AAAA,IAEA,QAAA,EAAU,CAAC,UAAA,KAA0B;AACnC,MAAA,kBAAA,CAAW,eAAA,CAAgB,UAAA,EAAY,SAAA,EAAW,IAAA,EAAM,MAAM;AAAA,MAAC,CAAC,CAAA;AAAA,IAClE,CAAA;AAAA,IAEA,eAAe,MAAM;AAAA,GACvB;AACF","file":"index.cjs","sourcesContent":["/**\n * helpers.ts - Helper functions for widget descriptor composition\n *\n * These functions provide reusable logic that descriptors can compose together,\n * avoiding the need for complex inheritance hierarchies.\n */\n\nimport { colors } from \"@unblessed/core\";\nimport type {\n  BorderProps,\n  BorderStyleObject,\n  FocusableProps,\n  StyleObject,\n} from \"./common-props.js\";\n\n/**\n * Props that include border numbers (for Yoga)\n */\ninterface BorderNumberProps {\n  border?: number;\n  borderTop?: number;\n  borderBottom?: number;\n  borderLeft?: number;\n  borderRight?: number;\n}\n\n/**\n * Builds border configuration from BorderProps\n * IMPORTANT: Only creates border if Yoga knows about it (border numbers are set)\n *\n * @param props - Props with border configuration\n * @returns Border object or null if no border numbers are set\n */\nexport function buildBorder(\n  props: BorderProps & BorderNumberProps,\n): any | null {\n  // Only create border if Yoga knows about it (has border numbers)\n  // This prevents creating borders that Yoga doesn't reserve space for\n  if (\n    !Number(props.border) &&\n    !Number(props.borderTop) &&\n    !Number(props.borderBottom) &&\n    !Number(props.borderLeft) &&\n    !Number(props.borderRight)\n  ) {\n    return null;\n  }\n\n  const border: any = {\n    type: \"line\",\n    style: props.borderStyle || \"single\",\n  };\n\n  // Per-side visibility\n  border.top =\n    props.borderTop !== undefined ? Number(props.borderTop) > 0 : true;\n  border.bottom =\n    props.borderBottom !== undefined ? Number(props.borderBottom) > 0 : true;\n  border.left =\n    props.borderLeft !== undefined ? Number(props.borderLeft) > 0 : true;\n  border.right =\n    props.borderRight !== undefined ? Number(props.borderRight) > 0 : true;\n\n  // Border color (global or per-side)\n  if (props.borderColor) {\n    border.fg = colors.convert(props.borderColor);\n  }\n\n  if (props.borderTopColor) {\n    border.topColor = colors.convert(props.borderTopColor);\n  }\n  if (props.borderBottomColor) {\n    border.bottomColor = colors.convert(props.borderBottomColor);\n  }\n  if (props.borderLeftColor) {\n    border.leftColor = colors.convert(props.borderLeftColor);\n  }\n  if (props.borderRightColor) {\n    border.rightColor = colors.convert(props.borderRightColor);\n  }\n\n  // Border dim (global or per-side)\n  if (props.borderDimColor !== undefined) {\n    border.dim = props.borderDimColor;\n  }\n\n  if (props.borderTopDim !== undefined) {\n    border.borderTopDim = props.borderTopDim;\n  }\n  if (props.borderBottomDim !== undefined) {\n    border.borderBottomDim = props.borderBottomDim;\n  }\n  if (props.borderLeftDim !== undefined) {\n    border.borderLeftDim = props.borderLeftDim;\n  }\n  if (props.borderRightDim !== undefined) {\n    border.borderRightDim = props.borderRightDim;\n  }\n\n  return border;\n}\n\n/**\n * Pre-populates style.border.fg for unblessed compatibility\n *\n * @param border - Border configuration object\n * @returns Style object with border.fg set, or empty object if no border\n */\nexport function prepareBorderStyle(border: any): any {\n  if (!border) return {};\n\n  return {\n    border: {\n      fg: border.fg,\n    },\n  };\n}\n\n/**\n * Builds text style object from TextStyleProps\n *\n * @param props - Props with text styling\n * @returns Style object or null if no text styles are set\n */\nexport function buildTextStyles(props: StyleObject): any | null {\n  if (\n    !props.color &&\n    !props.backgroundColor &&\n    !props.bold &&\n    !props.italic &&\n    !props.underline &&\n    !props.strikethrough &&\n    !props.reverse &&\n    !props.blink &&\n    !props.hide &&\n    !props.dim\n  ) {\n    return null;\n  }\n\n  const style: any = {};\n\n  if (props.color) {\n    style.fg = colors.convert(props.color);\n  }\n  if (props.backgroundColor) {\n    style.bg = colors.convert(props.backgroundColor);\n  }\n  if (props.bold) style.bold = true;\n  if (props.italic) style.italic = true;\n  if (props.underline) style.underline = true;\n  if (props.strikethrough) style.strikethrough = true;\n  if (props.reverse) style.inverse = true;\n  if (props.blink) style.blink = true;\n  if (props.hide) style.invisible = true;\n  if (props.dim) style.dim = true;\n\n  return style;\n}\n\n/**\n * Builds focusable widget options\n *\n * **IMPORTANT**: For focus effects to work, elements must be keyable.\n * This ensures they receive focus/blur events from the screen.\n *\n * @param props - Props with focus configuration\n * @param defaultTabIndex - Default tabIndex value if not provided (typically 0 for interactive widgets, undefined for non-interactive)\n * @returns Options object with focus properties\n */\nexport function buildFocusableOptions(\n  props: FocusableProps,\n  defaultTabIndex?: number,\n): any {\n  const options: any = {};\n\n  // Only set tabIndex if explicitly provided by user, or if we have a default to apply\n  if (props.tabIndex !== undefined) {\n    options.tabIndex = props.tabIndex;\n  } else if (defaultTabIndex !== undefined) {\n    options.tabIndex = defaultTabIndex;\n  }\n\n  // CRITICAL: Set keyable=true if element has tabIndex\n  // This ensures the element receives keyboard input and focus/blur events\n  // Without this, focusEffects won't work!\n  if (options.tabIndex !== undefined) {\n    options.keyable = true;\n    options.clickable = true;\n  }\n\n  return options;\n}\n\n/**\n * Merges multiple style objects, handling nested properties correctly\n *\n * @param styles - Array of style objects to merge\n * @returns Merged style object\n */\nexport function mergeStyles(...styles: any[]): any {\n  const merged: any = {};\n\n  for (const style of styles) {\n    if (!style) continue;\n\n    for (const [key, value] of Object.entries(style)) {\n      if (key === \"border\" && merged.border) {\n        // Merge border objects\n        merged.border = { ...merged.border, ...(value as any) };\n      } else {\n        merged[key] = value;\n      }\n    }\n  }\n\n  return Object.keys(merged).length > 0 ? merged : null;\n}\n\n/**\n * Builds border style object from BorderStyleObject\n * Converts color names to numbers and normalizes shorthands\n *\n * @param borderStyle - Border style configuration\n * @returns Unblessed border style object\n */\nfunction buildBorderStyleObject(borderStyle: BorderStyleObject): any {\n  const border: any = {};\n\n  // Normalize color shorthands\n  const fg = borderStyle.color ?? borderStyle.fg;\n  const bg =\n    borderStyle.bg ?? borderStyle.background ?? borderStyle.backgroundColor;\n\n  // Main colors\n  if (fg) border.fg = colors.convert(fg);\n  if (bg) border.bg = colors.convert(bg);\n\n  // Per-side colors\n  if (borderStyle.topColor)\n    border.topColor = colors.convert(borderStyle.topColor);\n  if (borderStyle.bottomColor)\n    border.bottomColor = colors.convert(borderStyle.bottomColor);\n  if (borderStyle.leftColor)\n    border.leftColor = colors.convert(borderStyle.leftColor);\n  if (borderStyle.rightColor)\n    border.rightColor = colors.convert(borderStyle.rightColor);\n\n  // Dim properties\n  if (borderStyle.dim !== undefined) border.dim = borderStyle.dim;\n  if (borderStyle.topDim !== undefined) border.topDim = borderStyle.topDim;\n  if (borderStyle.bottomDim !== undefined)\n    border.bottomDim = borderStyle.bottomDim;\n  if (borderStyle.leftDim !== undefined) border.leftDim = borderStyle.leftDim;\n  if (borderStyle.rightDim !== undefined)\n    border.rightDim = borderStyle.rightDim;\n\n  return border;\n}\n\n/**\n * Builds style object from StyleObject\n * Converts StyleObject (React props) to unblessed style format\n * Handles color conversion and shorthand normalization\n *\n * @param styleObj - Style configuration object\n * @returns Unblessed style object\n */\nexport function buildStyleObject(styleObj?: StyleObject): any {\n  if (!styleObj) return {};\n\n  const style: any = {};\n\n  // Normalize color shorthands (priority: shorthand > full name)\n  const fg = styleObj.fg ?? styleObj.color;\n  const bg = styleObj.bg ?? styleObj.background ?? styleObj.backgroundColor;\n\n  // Text colors\n  if (fg) style.fg = colors.convert(fg);\n  if (bg) style.bg = colors.convert(bg);\n\n  // Text styles\n  if (styleObj.bold !== undefined) style.bold = styleObj.bold;\n  if (styleObj.italic !== undefined) style.italic = styleObj.italic;\n  if (styleObj.underline !== undefined) style.underline = styleObj.underline;\n  if (styleObj.strikethrough !== undefined)\n    style.strikethrough = styleObj.strikethrough;\n  if (styleObj.reverse !== undefined) style.inverse = styleObj.reverse;\n  if (styleObj.dim !== undefined) style.dim = styleObj.dim;\n  if (styleObj.blink !== undefined) style.blink = styleObj.blink;\n  if (styleObj.hide !== undefined) style.invisible = styleObj.hide;\n\n  // Border styling (nested)\n  if (styleObj.border) {\n    style.border = buildBorderStyleObject(styleObj.border);\n  }\n\n  return style;\n}\n\n/**\n * Extracts StyleObject properties from component props\n * Used to get default state styling from direct component props\n *\n * @param props - Component props object\n * @returns StyleObject extracted from props\n */\nexport function extractStyleProps(props: any): StyleObject {\n  const styleObj: StyleObject = {};\n\n  // Extract color properties\n  if (props.color !== undefined) styleObj.color = props.color;\n  if (props.fg !== undefined) styleObj.fg = props.fg;\n  if (props.backgroundColor !== undefined)\n    styleObj.backgroundColor = props.backgroundColor;\n  if (props.bg !== undefined) styleObj.bg = props.bg;\n  if (props.background !== undefined) styleObj.background = props.background;\n\n  // Extract text style properties\n  if (props.bold !== undefined) styleObj.bold = props.bold;\n  if (props.italic !== undefined) styleObj.italic = props.italic;\n  if (props.underline !== undefined) styleObj.underline = props.underline;\n  if (props.strikethrough !== undefined)\n    styleObj.strikethrough = props.strikethrough;\n  if (props.reverse !== undefined) styleObj.reverse = props.reverse;\n  if (props.dim !== undefined) styleObj.dim = props.dim;\n  if (props.blink !== undefined) styleObj.blink = props.blink;\n  if (props.hide !== undefined) styleObj.hide = props.hide;\n\n  // Note: We don't extract border here because StyleObject.border is a BorderStyleObject,\n  // not the same as BorderProps.border (which is a number for Yoga layout)\n\n  return styleObj;\n}\n","/**\n * Box.tsx - Box component and descriptor for @unblessed/react\n */\n\nimport { Box as BoxWidget, type Screen } from \"@unblessed/core\";\nimport {\n  ComputedLayout,\n  FlexboxProps,\n  WidgetDescriptor,\n} from \"@unblessed/layout\";\nimport type { ReactNode } from \"react\";\nimport { forwardRef, type PropsWithChildren } from \"react\";\nimport { InteractiveWidgetProps } from \"../widget-descriptors\";\nimport {\n  buildBorder,\n  buildFocusableOptions,\n  buildStyleObject,\n  extractStyleProps,\n  mergeStyles,\n  prepareBorderStyle,\n} from \"../widget-descriptors/helpers.js\";\n\nexport const COMMON_WIDGET_OPTIONS = {\n  tags: true,\n  mouse: true,\n  keys: true,\n  clickable: true,\n};\n\n/**\n * Props interface for Box component\n * Combines flexbox layout props with box-specific visual properties\n *\n * Inherits all interactive widget properties including:\n * - Layout (flexbox, width, height, padding, margin, etc.)\n * - Events (onClick, onKeyPress, onFocus, etc.)\n * - Styling (color, bg, bold, etc.)\n * - State styling (hover, focus)\n * - Borders (borderStyle, borderColor, etc.)\n */\nexport interface BoxProps extends InteractiveWidgetProps {\n  tags?: boolean;\n  content?: string;\n  children?: ReactNode;\n}\n\n/**\n * Descriptor for Box widgets\n */\nexport class BoxDescriptor<T extends BoxProps> extends WidgetDescriptor<T> {\n  readonly type: string = \"box\";\n\n  get flexProps(): FlexboxProps {\n    // Extract all flexbox-related properties\n    const {\n      flexGrow,\n      flexShrink,\n      flexBasis,\n      flexDirection,\n      flexWrap,\n      justifyContent,\n      alignItems,\n      alignSelf,\n      width,\n      height,\n      minWidth,\n      minHeight,\n      maxWidth,\n      maxHeight,\n      padding,\n      paddingX,\n      paddingY,\n      paddingTop,\n      paddingBottom,\n      paddingLeft,\n      paddingRight,\n      border,\n      borderTop,\n      borderBottom,\n      borderLeft,\n      borderRight,\n      margin,\n      marginX,\n      marginY,\n      marginTop,\n      marginBottom,\n      marginLeft,\n      marginRight,\n      gap,\n      rowGap,\n      columnGap,\n      position,\n      display,\n    } = this.props;\n\n    const flexboxProps: FlexboxProps = {};\n\n    // Only include defined properties\n    if (flexGrow !== undefined) flexboxProps.flexGrow = flexGrow;\n    if (flexShrink !== undefined) flexboxProps.flexShrink = flexShrink;\n    if (flexBasis !== undefined) flexboxProps.flexBasis = flexBasis;\n    if (flexDirection !== undefined) flexboxProps.flexDirection = flexDirection;\n    if (flexWrap !== undefined) flexboxProps.flexWrap = flexWrap;\n    if (justifyContent !== undefined)\n      flexboxProps.justifyContent = justifyContent;\n    if (alignItems !== undefined) flexboxProps.alignItems = alignItems;\n    if (alignSelf !== undefined) flexboxProps.alignSelf = alignSelf;\n    if (width !== undefined) flexboxProps.width = width;\n    if (height !== undefined) flexboxProps.height = height;\n    if (minWidth !== undefined) flexboxProps.minWidth = minWidth;\n    if (minHeight !== undefined) flexboxProps.minHeight = minHeight;\n    if (maxWidth !== undefined) flexboxProps.maxWidth = maxWidth;\n    if (maxHeight !== undefined) flexboxProps.maxHeight = maxHeight;\n    if (padding !== undefined) flexboxProps.padding = padding;\n    if (paddingX !== undefined) flexboxProps.paddingX = paddingX;\n    if (paddingY !== undefined) flexboxProps.paddingY = paddingY;\n    if (paddingTop !== undefined) flexboxProps.paddingTop = paddingTop;\n    if (paddingBottom !== undefined) flexboxProps.paddingBottom = paddingBottom;\n    if (paddingLeft !== undefined) flexboxProps.paddingLeft = paddingLeft;\n    if (paddingRight !== undefined) flexboxProps.paddingRight = paddingRight;\n    if (border !== undefined) flexboxProps.border = border ? 1 : 0;\n    if (borderTop !== undefined) flexboxProps.borderTop = borderTop;\n    if (borderBottom !== undefined) flexboxProps.borderBottom = borderBottom;\n    if (borderLeft !== undefined) flexboxProps.borderLeft = borderLeft;\n    if (borderRight !== undefined) flexboxProps.borderRight = borderRight;\n    if (margin !== undefined) flexboxProps.margin = margin;\n    if (marginX !== undefined) flexboxProps.marginX = marginX;\n    if (marginY !== undefined) flexboxProps.marginY = marginY;\n    if (marginTop !== undefined) flexboxProps.marginTop = marginTop;\n    if (marginBottom !== undefined) flexboxProps.marginBottom = marginBottom;\n    if (marginLeft !== undefined) flexboxProps.marginLeft = marginLeft;\n    if (marginRight !== undefined) flexboxProps.marginRight = marginRight;\n    if (gap !== undefined) flexboxProps.gap = gap;\n    if (rowGap !== undefined) flexboxProps.rowGap = rowGap;\n    if (columnGap !== undefined) flexboxProps.columnGap = columnGap;\n    if (position !== undefined) flexboxProps.position = position;\n    if (display !== undefined) flexboxProps.display = display;\n\n    return flexboxProps;\n  }\n\n  get widgetOptions(): Record<string, any> {\n    const widgetOptions: any = {};\n\n    // Build border using helper function\n    const border = buildBorder(this.props);\n    if (border) {\n      widgetOptions.border = border;\n      // Pre-populate style.border.fg\n      widgetOptions.style = prepareBorderStyle(border);\n    } else {\n      widgetOptions.style = {};\n    }\n\n    // Ensure style.border exists if hover/focus have border effects\n    // This prevents errors when setEffects tries to save original border values\n    if (this.props.hover?.border || this.props.focus?.border) {\n      widgetOptions.style.border = widgetOptions.style.border || {};\n    }\n\n    // Build focusable options using helper function\n    // Box is not focusable by default (no defaultTabIndex)\n    Object.assign(widgetOptions, buildFocusableOptions(this.props));\n\n    // Base/default state styling from direct props\n    const defaultStyle = extractStyleProps(this.props);\n    const baseStyle = buildStyleObject(defaultStyle);\n    if (Object.keys(baseStyle).length > 0) {\n      widgetOptions.style = mergeStyles(widgetOptions.style, baseStyle);\n    }\n\n    // Hover effects\n    if (this.props.hover) {\n      widgetOptions.hoverEffects = buildStyleObject(this.props.hover);\n    }\n\n    // Focus effects\n    if (this.props.focus) {\n      widgetOptions.focusEffects = buildStyleObject(this.props.focus);\n    }\n\n    // Content\n    if (this.props.content !== undefined) {\n      widgetOptions.content = this.props.content;\n    }\n\n    // Tags\n    if (this.props.tags !== undefined) {\n      widgetOptions.tags = this.props.tags;\n    }\n\n    return widgetOptions;\n  }\n\n  get eventHandlers(): Record<string, Function> {\n    const handlers: Record<string, Function> = {};\n\n    // Mouse events\n    if (this.props.onClick) handlers.click = this.props.onClick;\n    if (this.props.onMouseDown) handlers.mousedown = this.props.onMouseDown;\n    if (this.props.onMouseUp) handlers.mouseup = this.props.onMouseUp;\n    if (this.props.onMouseMove) handlers.mousemove = this.props.onMouseMove;\n    if (this.props.onMouseOver) handlers.mouseover = this.props.onMouseOver;\n    if (this.props.onMouseOut) handlers.mouseout = this.props.onMouseOut;\n    if (this.props.onMouseWheel) handlers.mousewheel = this.props.onMouseWheel;\n    if (this.props.onWheelDown) handlers.wheeldown = this.props.onWheelDown;\n    if (this.props.onWheelUp) handlers.wheelup = this.props.onWheelUp;\n\n    // Keyboard events\n    if (this.props.onKeyPress) handlers.keypress = this.props.onKeyPress;\n\n    // Focus events\n    if (this.props.onFocus) handlers.focus = this.props.onFocus;\n    if (this.props.onBlur) handlers.blur = this.props.onBlur;\n\n    return handlers;\n  }\n\n  createWidget(layout: ComputedLayout, screen: Screen): BoxWidget {\n    return new BoxWidget({\n      screen,\n      ...COMMON_WIDGET_OPTIONS,\n      top: layout.top,\n      left: layout.left,\n      width: layout.width,\n      height: layout.height,\n      ...this.widgetOptions,\n    });\n  }\n}\n\n/**\n * Box component - Container with flexbox layout support\n *\n * Supports flexbox properties, borders, colors, event handling, and state styling.\n * Default state styling uses direct props (color, bg, bold, etc.)\n * State variations use nested objects (hover, focus)\n *\n * @example Basic layout\n * ```tsx\n * <Box\n *   flexDirection=\"row\"\n *   gap={2}\n *   padding={1}\n *   border={1}\n *   borderStyle=\"single\"\n *   borderColor=\"cyan\"\n * >\n *   <Box width={20}>Left</Box>\n *   <Box flexGrow={1}>Middle</Box>\n *   <Box width={20}>Right</Box>\n * </Box>\n * ```\n *\n * @example With styling and state effects\n * ```tsx\n * <Box\n *   padding={1}\n *   border={1}\n *   borderStyle=\"single\"\n *   borderColor=\"white\"\n *   color=\"gray\"\n *   hover={{ border: { color: \"cyan\" }, color: \"white\" }}\n *   focus={{ border: { color: \"yellow\" } }}\n * >\n *   Interactive Box\n * </Box>\n * ```\n *\n * @example With event handling\n * ```tsx\n * <Box\n *   padding={1}\n *   border={1}\n *   borderStyle=\"single\"\n *   tabIndex={0}\n *   onClick={(data) => console.log('Clicked!', data)}\n *   onKeyPress={(ch, key) => {\n *     if (key.name === 'enter') handleSubmit();\n *   }}\n * >\n *   Click or press Enter\n * </Box>\n * ```\n */\nexport const Box = forwardRef<any, PropsWithChildren<BoxProps>>(\n  ({ children, ...props }, ref) => {\n    return (\n      <box ref={ref} {...props}>\n        {children}\n      </box>\n    );\n  },\n);\n\nBox.displayName = \"Box\";\n","/**\n * BigText.tsx - BigText component and descriptor for @unblessed/react\n */\n\nimport { BigText as BigTextWidget, type Screen } from \"@unblessed/core\";\nimport { ComputedLayout, FlexboxProps } from \"@unblessed/layout\";\nimport { forwardRef, type PropsWithChildren } from \"react\";\nimport { StyleObject } from \"../widget-descriptors\";\nimport { BoxDescriptor, COMMON_WIDGET_OPTIONS } from \"./Box\";\n\n/**\n * Props interface for BigText component\n */\nexport interface BigTextProps\n  extends FlexboxProps,\n    Pick<StyleObject, \"color\" | \"backgroundColor\"> {\n  font?: string;\n  fontBold?: boolean;\n  char?: string;\n  content?: string;\n  children?: string;\n}\n\n/**\n * Descriptor for BigText widgets\n */\nexport class BigTextDescriptor extends BoxDescriptor<BigTextProps> {\n  override readonly type = \"bigtext\";\n\n  override get widgetOptions() {\n    const options = super.widgetOptions;\n    if (this.props.font) options.font = this.props.font;\n    if (this.props.fontBold) options.fontBold = this.props.fontBold;\n    if (this.props.char) options.fch = this.props.char;\n    if (this.props.content !== undefined) options.content = this.props.content;\n\n    return options;\n  }\n\n  override createWidget(layout: ComputedLayout, screen: Screen): BigTextWidget {\n    return new BigTextWidget({\n      screen,\n      ...COMMON_WIDGET_OPTIONS,\n      top: layout.top,\n      left: layout.left,\n      width: layout.width,\n      height: layout.height,\n      ...this.widgetOptions,\n    });\n  }\n}\n\n/**\n * BigText component - Renders large ASCII art text\n *\n * Uses terminal fonts to render large text. Each character is 14 rows × 8 columns.\n * Supports all BoxProps including flexbox layout, borders, and event handling.\n *\n * @example\n * ```tsx\n * <BigText color=\"cyan\">\n *   HELLO\n * </BigText>\n * ```\n *\n * @example With border and events\n * ```tsx\n * <BigText\n *   color=\"green\"\n *   borderStyle=\"single\"\n *   padding={1}\n *   onClick={() => console.log('Big text clicked!')}\n * >\n *   WELCOME\n * </BigText>\n * ```\n */\nexport const BigText = forwardRef<any, PropsWithChildren<BigTextProps>>(\n  ({ children, ...props }, ref) => {\n    const fontHeight = 14;\n    const fontWidth = 8;\n\n    return (\n      <bigtext\n        ref={ref}\n        color=\"white\"\n        height={fontHeight}\n        width={(children?.length || 0) * fontWidth}\n        {...props}\n      >\n        {children}\n      </bigtext>\n    );\n  },\n);\n\nBigText.displayName = \"BigText\";\n","/**\n * Button.tsx - Button component and descriptor for @unblessed/react\n */\n\nimport { Button as ButtonWidget, type Screen } from \"@unblessed/core\";\nimport { ComputedLayout } from \"@unblessed/layout\";\nimport type { ReactNode } from \"react\";\nimport { forwardRef, type PropsWithChildren } from \"react\";\nimport type { InteractiveWidgetProps } from \"../widget-descriptors/common-props.js\";\nimport { buildFocusableOptions } from \"../widget-descriptors/helpers.js\";\nimport { BoxDescriptor, COMMON_WIDGET_OPTIONS } from \"./Box\";\n\n/**\n * Props interface for Button component\n * Inherits all interactive widget properties (layout, events, focus, borders, styling)\n */\nexport interface ButtonProps extends InteractiveWidgetProps {\n  content?: string;\n  children?: ReactNode;\n}\n\n/**\n * Descriptor for Button widgets\n */\nexport class ButtonDescriptor extends BoxDescriptor<ButtonProps> {\n  override readonly type = \"button\";\n\n  override get widgetOptions() {\n    const options = super.widgetOptions;\n\n    // Build focusable options using helper function\n    Object.assign(options, buildFocusableOptions(this.props, 0));\n\n    // Button-specific options\n    if (this.props.content !== undefined) options.content = this.props.content;\n\n    return options;\n  }\n\n  override get eventHandlers() {\n    const handlers: Record<string, Function> = super.eventHandlers;\n    if (this.props.onPress) handlers.press = this.props.onPress;\n    return handlers;\n  }\n\n  override createWidget(layout: ComputedLayout, screen: Screen): ButtonWidget {\n    return new ButtonWidget({\n      screen,\n      ...COMMON_WIDGET_OPTIONS,\n      top: layout.top,\n      left: layout.left,\n      width: layout.width,\n      height: layout.height,\n      ...this.widgetOptions,\n    });\n  }\n}\n\n/**\n * Button component - Interactive button with hover and focus effects\n *\n * Supports mouse clicks, keyboard press (Enter), and visual state changes.\n * Automatically receives focus when tabbed to.\n *\n * Default state styling uses direct props (color, bg, bold, etc.)\n * State variations use nested objects (hover, focus)\n *\n * @example Basic button\n * ```tsx\n * <Button\n *   borderStyle=\"single\"\n *   borderColor=\"green\"\n *   padding={1}\n *   onClick={() => console.log('Clicked!')}\n * >\n *   Click Me\n * </Button>\n * ```\n *\n * @example With hover and focus effects\n * ```tsx\n * <Button\n *   borderStyle=\"single\"\n *   borderColor=\"blue\"\n *   color=\"white\"\n *   bg=\"blue\"\n *   bold={true}\n *   hover={{ bg: \"darkblue\" }}\n *   focus={{ border: { color: \"cyan\" } }}\n *   padding={1}\n *   onPress={() => handleSubmit()}\n * >\n *   Submit\n * </Button>\n * ```\n *\n * @example Interactive counter\n * ```tsx\n * const [count, setCount] = useState(0);\n *\n * <Button onClick={() => setCount(c => c + 1)}>\n *   Count: {count}\n * </Button>\n * ```\n */\nexport const Button = forwardRef<any, PropsWithChildren<ButtonProps>>(\n  ({ children, ...props }, ref) => {\n    return (\n      <tbutton ref={ref} border={1} minHeight={3} {...props}>\n        {children}\n      </tbutton>\n    );\n  },\n);\n\nButton.displayName = \"Button\";\n","/**\n * Input.tsx - Input component and descriptor for @unblessed/react\n */\n\nimport { type Screen, Textbox } from \"@unblessed/core\";\nimport { ComputedLayout } from \"@unblessed/layout\";\nimport { forwardRef } from \"react\";\nimport type { InteractiveWidgetProps } from \"../widget-descriptors/common-props.js\";\nimport { buildFocusableOptions } from \"../widget-descriptors/helpers.js\";\nimport { BoxDescriptor, COMMON_WIDGET_OPTIONS } from \"./Box\";\n\n/**\n * Props interface for Input component\n * Inherits all interactive widget properties (layout, events, focus, borders)\n */\nexport interface InputProps extends InteractiveWidgetProps {\n  /** Controlled value - when provided, input becomes controlled */\n  value?: string;\n  /** Default value for uncontrolled mode */\n  defaultValue?: string;\n}\n\n/**\n * Descriptor for Input/Textbox widgets\n */\nexport class InputDescriptor extends BoxDescriptor<InputProps> {\n  override readonly type = \"input\";\n\n  override get widgetOptions() {\n    const options: any = super.widgetOptions;\n\n    // Build focusable options using helper function\n    Object.assign(options, buildFocusableOptions(this.props, 0));\n\n    // Input value: controlled (value) or uncontrolled (defaultValue)\n    // In controlled mode, value is managed externally\n    // In uncontrolled mode, defaultValue sets initial value only\n    if (this.props.value !== undefined) {\n      options.value = this.props.value;\n    } else if (this.props.defaultValue !== undefined) {\n      options.value = this.props.defaultValue;\n    }\n\n    return options;\n  }\n\n  override get eventHandlers() {\n    const handlers: Record<string, Function> = {};\n    if (this.props.onSubmit) handlers.submit = this.props.onSubmit;\n    if (this.props.onCancel) handlers.cancel = this.props.onCancel;\n    return handlers;\n  }\n\n  override createWidget(layout: ComputedLayout, screen: Screen): Textbox {\n    return new Textbox({\n      screen,\n      ...COMMON_WIDGET_OPTIONS,\n      inputOnFocus: true,\n      top: layout.top,\n      left: layout.left,\n      width: layout.width,\n      height: layout.height,\n      ...this.widgetOptions,\n    });\n  }\n\n  override updateWidget(widget: Textbox, layout: ComputedLayout): void {\n    // Call base implementation for position and options update\n    super.updateWidget(widget, layout);\n\n    // Input-specific: Update value in controlled mode\n    // Only update if value is explicitly provided (controlled mode)\n    if (this.props.value !== undefined) {\n      widget.setValue(this.props.value);\n    }\n  }\n}\n\n/**\n * Input component - Text input field for user interaction\n *\n * Provides a single-line text input with submit/cancel events.\n * Users can type text and submit with Enter or cancel with Escape.\n * Automatically receives focus when tabbed to (tabIndex=0 by default).\n *\n * Supports both controlled and uncontrolled modes:\n * - Controlled: Provide `value` prop and update it via events\n * - Uncontrolled: Use `defaultValue` for initial value, or omit for empty input\n *\n * Default state styling uses direct props (color, bg, bold, etc.)\n * State variations use nested objects (hover, focus)\n *\n * @example Uncontrolled input (with default value)\n * ```tsx\n * <Input\n *   width={30}\n *   defaultValue=\"Initial text\"\n *   color=\"white\"\n *   focus={{ border: { color: \"cyan\" } }}\n *   onSubmit={(value) => console.log('Submitted:', value)}\n *   onCancel={() => console.log('Cancelled')}\n * />\n * ```\n *\n * @example Controlled input\n * ```tsx\n * const [text, setText] = useState('');\n * <Input\n *   width={40}\n *   value={text}\n *   onChange={(newValue) => setText(newValue)}\n *   onSubmit={(value) => handleSubmit(value)}\n * />\n * ```\n *\n * @example With auto-focus and styling\n * ```tsx\n * <Input\n *   width={40}\n *   defaultValue=\"Focus me!\"\n *   color=\"white\"\n *   bg=\"blue\"\n *   focus={{ border: { color: \"cyan\" }, bg: \"darkblue\" }}\n *   onSubmit={(value) => handleSubmit(value)}\n * />\n * ```\n */\nexport const Input = forwardRef<any, InputProps>(({ ...props }, ref) => {\n  return <textinput ref={ref} border={1} height={3} color=\"white\" {...props} />;\n});\n\nInput.displayName = \"Input\";\n","/**\n * List.tsx - List component and descriptor for @unblessed/react\n *\n * Provides a scrollable, selectable list with keyboard and mouse support.\n */\n\nimport { List as ListWidget, type Screen } from \"@unblessed/core\";\nimport { ComputedLayout } from \"@unblessed/layout\";\nimport type { ReactNode } from \"react\";\nimport { forwardRef } from \"react\";\nimport type {\n  InteractiveWidgetProps,\n  StyleObject,\n} from \"../widget-descriptors/common-props.js\";\nimport {\n  buildFocusableOptions,\n  buildStyleObject,\n} from \"../widget-descriptors/helpers.js\";\nimport { BoxDescriptor, COMMON_WIDGET_OPTIONS } from \"./Box\";\n\n/**\n * Props interface for List component\n * Provides a simplified, React-friendly API with sensible defaults\n *\n * Styling hierarchy:\n * - style, hover, focus: Affect the List container (borders, background)\n * - itemStyle, itemSelected, itemHover: Affect individual list items\n */\nexport interface ListProps extends InteractiveWidgetProps {\n  // Items\n  items: string[];\n  children?: ReactNode;\n\n  // label\n  label: string;\n\n  // Events\n  onSelect?: (item: string, index: number) => void;\n  onCancel?: () => void;\n\n  // State\n  defaultSelected?: number;\n\n  // Behavior\n  disabled?: boolean; // Maps to !interactive (more intuitive than interactive)\n  vi?: boolean; // Vi keybindings (default: false)\n\n  // Item state styling\n  itemStyle?: StyleObject; // Normal item appearance\n  itemSelected?: StyleObject; // Selected item appearance\n  itemHover?: StyleObject; // Hovered item appearance\n\n  // Scrollbar configuration\n  scrollbar?: boolean; // Enable/disable scrollbar (default: enabled)\n  scrollbarBg?: string; // Scrollbar background color\n  scrollbarFg?: string; // Scrollbar foreground color\n  scrollbarChar?: string; // Scrollbar character (default: ' ')\n  scrollbarTrack?: boolean; // Show scrollbar track\n  scrollbarTrackBg?: string; // Track background color\n  scrollbarTrackFg?: string; // Track foreground color\n  scrollbarTrackChar?: string; // Track character\n}\n\n/**\n * Descriptor for List widgets\n */\nexport class ListDescriptor extends BoxDescriptor<ListProps> {\n  override readonly type = \"list\";\n\n  override get widgetOptions() {\n    const options = super.widgetOptions;\n\n    // Build focusable options using helper function\n    Object.assign(options, buildFocusableOptions(this.props, 0));\n\n    // Items\n    options.items = this.props.items || [];\n\n    // label\n    options.label = this.props.label;\n\n    // React defaults (always enabled - users can't disable)\n    options.mouse = true;\n    options.keys = true;\n    options.tags = true;\n    options.inputOnFocus = true;\n\n    // User-controlled behavior\n    options.interactive = !this.props.disabled; // disabled is more intuitive\n    options.vi = this.props.vi ?? false;\n\n    // Build scrollbar configuration\n    if (this.props.scrollbar !== false) {\n      options.scrollbar = {\n        ch: this.props.scrollbarChar || \" \",\n      };\n\n      if (this.props.scrollbarFg) options.scrollbar.fg = this.props.scrollbarFg;\n      if (this.props.scrollbarBg) options.scrollbar.bg = this.props.scrollbarBg;\n\n      // Add track configuration if enabled\n      if (this.props.scrollbarTrack) {\n        options.scrollbar.track = {\n          ch: this.props.scrollbarTrackChar,\n        };\n        if (this.props.scrollbarTrackFg)\n          options.scrollbar.track.fg = this.props.scrollbarTrackFg;\n        if (this.props.scrollbarTrackBg)\n          options.scrollbar.track.bg = this.props.scrollbarTrackBg;\n      }\n    }\n\n    // Selected item styling\n    if (this.props.itemSelected) {\n      const selectedStyle = buildStyleObject(this.props.itemSelected);\n      if (selectedStyle.fg !== undefined) options.selectedFg = selectedStyle.fg;\n      if (selectedStyle.bg !== undefined) options.selectedBg = selectedStyle.bg;\n      if (selectedStyle.bold !== undefined)\n        options.selectedBold = selectedStyle.bold;\n      if (selectedStyle.underline !== undefined)\n        options.selectedUnderline = selectedStyle.underline;\n      if (selectedStyle.blink !== undefined)\n        options.selectedBlink = selectedStyle.blink;\n      if (selectedStyle.inverse !== undefined)\n        options.selectedInverse = selectedStyle.reverse;\n    }\n\n    // Normal item styling\n    if (this.props.itemStyle) {\n      const itemStyleObj = buildStyleObject(this.props.itemStyle);\n      if (itemStyleObj.fg !== undefined) options.itemFg = itemStyleObj.fg;\n      if (itemStyleObj.bg !== undefined) options.itemBg = itemStyleObj.bg;\n      if (itemStyleObj.bold !== undefined) options.itemBold = itemStyleObj.bold;\n      if (itemStyleObj.underline !== undefined)\n        options.itemUnderline = itemStyleObj.underline;\n      if (itemStyleObj.blink !== undefined)\n        options.itemBlink = itemStyleObj.blink;\n      if (itemStyleObj.inverse !== undefined)\n        options.itemInverse = itemStyleObj.reverse;\n    }\n\n    // Item hover styling\n    if (this.props.itemHover) {\n      const hoverStyle = buildStyleObject(this.props.itemHover);\n      if (hoverStyle.bg !== undefined) options.itemHoverBg = hoverStyle.bg;\n    }\n\n    return options;\n  }\n\n  override get eventHandlers() {\n    const handlers: Record<string, Function> = super.eventHandlers;\n\n    // List-specific events\n    if (this.props.onSelect) handlers.select = this.props.onSelect;\n    if (this.props.onCancel) handlers.cancel = this.props.onCancel;\n\n    return handlers;\n  }\n\n  override createWidget(layout: ComputedLayout, screen: Screen): ListWidget {\n    return new ListWidget({\n      screen,\n      ...COMMON_WIDGET_OPTIONS,\n      top: layout.top,\n      left: layout.left,\n      width: layout.width,\n      height: layout.height,\n      ...this.widgetOptions,\n    });\n  }\n\n  override updateWidget(widget: ListWidget, layout: ComputedLayout): void {\n    // Call base implementation for position and options update\n    super.updateWidget(widget, layout);\n\n    // List-specific: Update items array\n    const newItems = this.widgetOptions.items || [];\n    widget.setItems(newItems);\n  }\n}\n\n/**\n * List component - Scrollable, selectable list with keyboard and mouse support\n *\n * Provides a simplified API with better defaults than raw unblessed List.\n * Mouse, keyboard, and tags are always enabled.\n *\n * Styling hierarchy:\n * - style, hover, focus: Affect the List container (borders, background)\n * - itemStyle, itemSelected, itemHover: Affect individual list items\n *\n * @example Basic list\n * ```tsx\n * <List\n *   items={['Apple', 'Banana', 'Cherry']}\n *   label=\"Choose a fruit\"\n *   width={40}\n *   height={10}\n *   border={1}\n *   borderStyle=\"single\"\n *   itemSelected={{ bg: \"blue\", color: \"white\" }}\n *   onSelect={(item, index) => console.log('Selected:', item)}\n * />\n * ```\n *\n * @example With list container and item styling\n * ```tsx\n * <List\n *   items={items}\n *   label=\"Select an option\"\n *   border={1}\n *   borderStyle=\"single\"\n *   borderColor=\"white\"\n *   hover={{ border: { color: \"cyan\" } }}          // List border on hover\n *   focus={{ border: { color: \"yellow\" } }}        // List border on focus\n *   itemStyle={{ color: \"gray\" }}                  // Normal items\n *   itemSelected={{ bg: \"white\", color: \"black\", bold: true }}  // Selected item\n *   itemHover={{ bg: \"darkgray\" }}                 // Hovered item\n * />\n * ```\n *\n * @example Disabled list (read-only)\n * ```tsx\n * <List\n *   items={items}\n *   label=\"Read only\"\n *   disabled={true}\n *   itemStyle={{ color: \"gray\" }}\n * />\n * ```\n */\nexport const List = forwardRef<any, ListProps>(({ ...props }, ref) => {\n  return (\n    <list\n      ref={ref}\n      border={1}\n      minHeight={5}\n      itemSelected={{ bg: \"white\", color: \"black\" }}\n      {...props}\n    />\n  );\n});\n\nList.displayName = \"List\";\n","/**\n * Spacer.tsx - Spacer component and descriptor for @unblessed/react\n *\n * Spacer is a special Box that grows to fill available space (flexGrow: 1)\n */\n\nimport { Box as BoxWidget, Screen } from \"@unblessed/core\";\nimport {\n  ComputedLayout,\n  FlexboxProps,\n  WidgetDescriptor,\n} from \"@unblessed/layout\";\n\n/**\n * Props interface for Spacer component\n */\nexport interface SpacerProps extends FlexboxProps {}\n\n/**\n * Descriptor for Spacer widgets\n */\nexport class SpacerDescriptor extends WidgetDescriptor<SpacerProps> {\n  readonly type = \"spacer\";\n\n  get flexProps(): FlexboxProps {\n    // Spacer is just a box with flexGrow: 1\n    return {\n      ...this.props,\n      flexGrow: this.props.flexGrow !== undefined ? this.props.flexGrow : 1,\n    };\n  }\n\n  get widgetOptions() {\n    return {};\n  }\n\n  get eventHandlers() {\n    return {};\n  }\n\n  createWidget(layout: ComputedLayout, screen: Screen): BoxWidget {\n    return new BoxWidget({\n      screen,\n      top: layout.top,\n      left: layout.left,\n      width: layout.width,\n      height: layout.height,\n    });\n  }\n}\n\n/**\n * Spacer component - Flexible space that expands to fill available space\n *\n * This is a convenience component that renders a Box with flexGrow={1}.\n * It's useful for creating space-between layouts.\n *\n * @example\n * ```tsx\n * <Box flexDirection=\"row\">\n *   <Box width={20}>Left</Box>\n *   <Spacer />\n *   <Box width={20}>Right</Box>\n * </Box>\n * ```\n *\n * @example With custom flexGrow\n * ```tsx\n * <Box flexDirection=\"row\">\n *   <Spacer flexGrow={2} />\n *   <Box width={30}>Content</Box>\n *   <Spacer flexGrow={1} />\n * </Box>\n * ```\n */\nexport const Spacer = (props: SpacerProps) => {\n  return <spacer {...props} />;\n};\n\nSpacer.displayName = \"Spacer\";\n","/**\n * Text.tsx - Text component and descriptor for @unblessed/react\n */\n\nimport { type Screen, Text as TextWidget } from \"@unblessed/core\";\nimport { ComputedLayout, WidgetDescriptor } from \"@unblessed/layout\";\nimport type { ReactNode } from \"react\";\nimport { forwardRef, type PropsWithChildren } from \"react\";\nimport type { StyleObject } from \"../widget-descriptors/common-props.js\";\nimport { buildTextStyles } from \"../widget-descriptors/helpers.js\";\nimport { COMMON_WIDGET_OPTIONS } from \"./Box\";\n\n/**\n * Props interface for Text component\n */\nexport interface TextProps extends StyleObject {\n  content?: string;\n  children?: ReactNode;\n}\n\n/**\n * Descriptor for Text widgets\n */\nexport class TextDescriptor extends WidgetDescriptor<TextProps> {\n  readonly type = \"text\";\n\n  get flexProps() {\n    // Text widgets don't have flex props - dimensions are calculated from content\n    return {};\n  }\n\n  get widgetOptions() {\n    const widgetOptions: any = {};\n\n    // Build text styles using helper function\n    const textStyles = buildTextStyles(this.props);\n    if (textStyles) {\n      widgetOptions.style = textStyles;\n    }\n\n    if (this.props.content !== undefined) {\n      widgetOptions.content = this.props.content;\n    }\n\n    widgetOptions.tags = true;\n\n    return widgetOptions;\n  }\n\n  get eventHandlers() {\n    // Text widgets don't have event handlers\n    return {};\n  }\n\n  createWidget(layout: ComputedLayout, screen: Screen): TextWidget {\n    return new TextWidget({\n      screen,\n      ...COMMON_WIDGET_OPTIONS,\n      clickable: false,\n      top: layout.top,\n      left: layout.left,\n      width: layout.width,\n      height: layout.height,\n      ...this.widgetOptions,\n    });\n  }\n}\n\n/**\n * Text component - Renders text with styling\n *\n * @example\n * ```tsx\n * <Text color=\"green\" bold>\n *   Hello World!\n * </Text>\n * ```\n *\n * @example With nested text\n * ```tsx\n * <Text>\n *   Hello <Text color=\"red\">World</Text>!\n * </Text>\n * ```\n */\nexport const Text = forwardRef<any, PropsWithChildren<TextProps>>(\n  ({ children, ...props }, ref) => {\n    return (\n      <text ref={ref} {...props}>\n        {children}\n      </text>\n    );\n  },\n);\n\nText.displayName = \"Text\";\n","/**\n * dom.ts - Virtual DOM for @unblessed/react\n *\n * This module defines the virtual DOM structure that bridges React components\n * to @unblessed/layout's LayoutNodes and ultimately to unblessed widgets.\n *\n * Key insight: We use LayoutNode from @unblessed/layout as our \"DOM\" nodes.\n * The reconciler creates/updates LayoutNodes, and @unblessed/layout handles\n * the Yoga calculations and widget synchronization.\n */\n\nimport { BigText, Screen } from \"@unblessed/core\";\nimport type { LayoutNode } from \"@unblessed/layout\";\nimport { BoxProps } from \"./components/Box\";\nimport { TextProps } from \"./components/Text\";\n\n/**\n * Element types in our virtual DOM\n */\nexport type ElementType = \"box\" | \"text\" | \"root\";\n\n/**\n * Virtual DOM node - wraps a LayoutNode with React-specific metadata\n */\nexport interface DOMNode {\n  /**\n   * Element type\n   */\n  type: ElementType;\n\n  /**\n   * The underlying layout node (from @unblessed/layout)\n   * This is what gets passed to LayoutManager\n   */\n  layoutNode: LayoutNode;\n\n  /**\n   * React props for this node\n   */\n  props: BoxProps | TextProps | BigText | Record<string, unknown>;\n\n  /**\n   * Parent DOM node\n   */\n  parentNode: DOMNode | null;\n\n  /**\n   * Child DOM nodes\n   */\n  childNodes: AnyNode[];\n\n  /**\n   * The screen instance (only on root node)\n   */\n  screen?: Screen;\n\n  /**\n   * Callback for layout calculation (only on root node)\n   */\n  onComputeLayout?: () => void;\n}\n\n/**\n * Text node in the virtual DOM\n */\nexport interface TextNode {\n  /**\n   * Always '#text' for text nodes\n   */\n  type: \"#text\";\n\n  /**\n   * The text content\n   */\n  nodeValue: string;\n\n  /**\n   * Text styling props\n   */\n  props: TextProps;\n\n  /**\n   * Parent DOM node\n   */\n  parentNode: DOMNode | null;\n\n  /**\n   * The underlying layout node\n   */\n  layoutNode: LayoutNode;\n}\n\n/**\n * Union type for all node types\n */\nexport type AnyNode = DOMNode | TextNode;\n\n/**\n * Creates a new DOM element node\n */\nexport function createElement(\n  type: ElementType,\n  layoutNode: LayoutNode,\n  props: any = {},\n): DOMNode {\n  return {\n    type,\n    layoutNode,\n    props,\n    parentNode: null,\n    childNodes: [],\n  };\n}\n\n/**\n * Creates a new text node\n */\nexport function createTextNode(\n  text: string,\n  layoutNode: LayoutNode,\n  props: TextProps = {},\n): TextNode {\n  return {\n    type: \"#text\",\n    nodeValue: text,\n    props,\n    parentNode: null,\n    layoutNode,\n  };\n}\n\n/**\n * Appends a child node to a parent\n */\nexport function appendChild(parent: DOMNode, child: AnyNode): void {\n  child.parentNode = parent;\n  parent.childNodes.push(child);\n}\n\n/**\n * Inserts a child before a reference child\n */\nexport function insertBefore(\n  parent: DOMNode,\n  child: AnyNode,\n  beforeChild: AnyNode,\n): void {\n  const index = parent.childNodes.indexOf(beforeChild);\n  if (index === -1) {\n    throw new Error(\"Reference child not found in parent\");\n  }\n\n  child.parentNode = parent;\n  parent.childNodes.splice(index, 0, child);\n}\n\n/**\n * Removes a child node from its parent\n */\nexport function removeChild(parent: DOMNode, child: AnyNode): void {\n  const index = parent.childNodes.indexOf(child);\n  if (index === -1) return;\n\n  parent.childNodes.splice(index, 1);\n  child.parentNode = null;\n}\n\n/**\n * Updates a node's props\n */\nexport function updateNodeProps(node: DOMNode | TextNode, props: any): void {\n  node.props = props;\n}\n","/**\n * factory.ts - Widget descriptor factory and registry\n *\n * Maps type strings to descriptor classes and creates descriptor instances\n * from React props.\n */\n\nimport { WidgetDescriptor } from \"@unblessed/layout\";\nimport { BigTextDescriptor } from \"../components/BigText.js\";\nimport { BoxDescriptor } from \"../components/Box.js\";\nimport { ButtonDescriptor } from \"../components/Button.js\";\nimport { InputDescriptor } from \"../components/Input.js\";\nimport { ListDescriptor } from \"../components/List.js\";\nimport { SpacerDescriptor } from \"../components/Spacer.js\";\nimport { TextDescriptor } from \"../components/Text.js\";\n\n/**\n * Registry mapping type strings to descriptor class constructors\n */\nconst descriptorRegistry = new Map<\n  string,\n  new (props: any) => WidgetDescriptor\n>([\n  [\"box\", BoxDescriptor],\n  [\"text\", TextDescriptor],\n  [\"button\", ButtonDescriptor],\n  [\"tbutton\", ButtonDescriptor], // Alias to avoid conflict with HTML <button>\n  [\"input\", InputDescriptor],\n  [\"textinput\", InputDescriptor], // Alias to avoid conflict with HTML <input>\n  [\"bigtext\", BigTextDescriptor],\n  [\"spacer\", SpacerDescriptor],\n  [\"list\", ListDescriptor],\n]);\n\n/**\n * Creates a descriptor instance for the given widget type and props.\n *\n * @param type - Widget type string (e.g., 'box', 'text', 'button')\n * @param props - Props to pass to the descriptor\n * @returns A WidgetDescriptor instance\n * @throws Error if the widget type is not registered\n */\nexport function createDescriptor(\n  type: string,\n  props: any = {},\n): WidgetDescriptor {\n  const DescriptorClass = descriptorRegistry.get(type);\n\n  if (!DescriptorClass) {\n    throw new Error(\n      `Unknown widget type: \"${type}\". Available types: ${Array.from(descriptorRegistry.keys()).join(\", \")}`,\n    );\n  }\n\n  return new DescriptorClass(props);\n}\n\n/**\n * Registers a custom widget descriptor.\n * Allows users to extend the system with their own widget types.\n *\n * @param type - Widget type string\n * @param descriptorClass - Descriptor class constructor\n *\n * @example\n * ```typescript\n * class MyCustomDescriptor extends WidgetDescriptor<MyCustomProps> {\n *   // ... implementation\n * }\n *\n * registerDescriptor('mycustom', MyCustomDescriptor);\n * ```\n */\nexport function registerDescriptor(\n  type: string,\n  descriptorClass: new (props: any) => WidgetDescriptor,\n): void {\n  descriptorRegistry.set(type, descriptorClass);\n}\n\n/**\n * Gets the list of registered widget types.\n *\n * @returns Array of registered type strings\n */\nexport function getRegisteredTypes(): string[] {\n  return Array.from(descriptorRegistry.keys());\n}\n","/**\n * reconciler.ts - React reconciler for @unblessed/react\n *\n * This module configures the React reconciler to work with our virtual DOM\n * and @unblessed/layout's LayoutManager.\n *\n * Key differences from Ink:\n * - We use LayoutManager from @unblessed/layout (don't create Yoga nodes directly)\n * - Widget descriptors encapsulate all widget configuration logic\n * - Layout calculation delegated to LayoutManager\n */\n\nimport { LayoutManager, updateLayoutNode } from \"@unblessed/layout\";\nimport createReconciler from \"react-reconciler\";\nimport { DefaultEventPriority } from \"react-reconciler/constants.js\";\nimport {\n  appendChild,\n  createElement,\n  createTextNode,\n  type DOMNode,\n  type ElementType,\n  insertBefore,\n  removeChild,\n  type TextNode,\n  updateNodeProps,\n} from \"./dom.js\";\nimport { createDescriptor } from \"./widget-descriptors\";\n\ntype Props = Record<string, unknown>;\n\ntype HostContext = {};\n\nlet currentLayoutManager: LayoutManager | null = null;\n\n/**\n * Set the layout manager for the current render\n * Called by render.ts\n */\nexport function setLayoutManager(manager: LayoutManager): void {\n  currentLayoutManager = manager;\n}\n\n/**\n * Get the current layout manager\n */\nfunction getLayoutManager(): LayoutManager {\n  if (!currentLayoutManager) {\n    throw new Error(\n      \"LayoutManager not set - this is a bug in @unblessed/react\",\n    );\n  }\n  return currentLayoutManager;\n}\n\nconst reconciler = createReconciler<\n  ElementType,\n  Props,\n  DOMNode,\n  DOMNode,\n  TextNode,\n  DOMNode,\n  unknown,\n  unknown,\n  HostContext,\n  unknown,\n  unknown,\n  unknown,\n  unknown\n>({\n  supportsMutation: true,\n  supportsPersistence: false,\n  supportsHydration: false,\n  isPrimaryRenderer: true,\n\n  getRootHostContext() {\n    return {};\n  },\n\n  getChildHostContext() {\n    return {};\n  },\n\n  // Node creation\n  createInstance(type, props) {\n    const manager = getLayoutManager();\n\n    // Create descriptor for this widget type with its props\n    const descriptor = createDescriptor(type, props);\n\n    // Create LayoutNode using descriptor's extracted properties\n    const layoutNode = manager.createNode(\n      type,\n      descriptor.flexProps,\n      descriptor.widgetOptions,\n    );\n\n    // Store descriptor and event handlers on the layout node\n    layoutNode._descriptor = descriptor;\n    layoutNode.eventHandlers = descriptor.eventHandlers;\n\n    return createElement(type, layoutNode, props);\n  },\n\n  createTextInstance(text) {\n    const manager = getLayoutManager();\n\n    const layoutNode = manager.createNode(\n      \"#text\",\n      { height: 1, width: text.length },\n      { content: text, tags: true },\n    );\n\n    return createTextNode(text, layoutNode, {});\n  },\n\n  // Tree manipulation\n  appendInitialChild(parent, child) {\n    appendChild(parent, child);\n\n    // Also update layout tree\n    const manager = getLayoutManager();\n    manager.appendChild(parent.layoutNode, child.layoutNode);\n  },\n\n  appendChild(parent, child) {\n    appendChild(parent, child);\n\n    // Also update layout tree\n    const manager = getLayoutManager();\n    manager.appendChild(parent.layoutNode, child.layoutNode);\n  },\n\n  insertBefore(parent, child, beforeChild) {\n    insertBefore(parent, child, beforeChild);\n\n    // Also update layout tree\n    const manager = getLayoutManager();\n    manager.insertBefore(\n      parent.layoutNode,\n      child.layoutNode,\n      beforeChild.layoutNode,\n    );\n  },\n\n  removeChild(parent, child) {\n    removeChild(parent, child);\n\n    // Also update layout tree\n    const manager = getLayoutManager();\n    manager.removeChild(parent.layoutNode, child.layoutNode);\n  },\n\n  removeChildFromContainer(container, child) {\n    if (container.childNodes.includes(child)) {\n      removeChild(container, child);\n\n      const manager = getLayoutManager();\n      manager.removeChild(container.layoutNode, child.layoutNode);\n    }\n  },\n\n  appendChildToContainer(container, child) {\n    appendChild(container, child);\n\n    const manager = getLayoutManager();\n    manager.appendChild(container.layoutNode, child.layoutNode);\n  },\n\n  insertInContainerBefore(container, child, beforeChild) {\n    insertBefore(container, child, beforeChild);\n\n    const manager = getLayoutManager();\n    manager.insertBefore(\n      container.layoutNode,\n      child.layoutNode,\n      beforeChild.layoutNode,\n    );\n  },\n\n  // Updates\n  prepareUpdate() {\n    // Return non-null to indicate update is needed\n    // The actual update happens in commitUpdate\n    return true;\n  },\n\n  commitUpdate(instance, _updatePayload, type, _oldProps, newProps) {\n    updateNodeProps(instance, newProps);\n\n    // Create/update descriptor with new props\n    const descriptor = createDescriptor(type, newProps);\n\n    // Update layout node with new descriptor properties\n    updateLayoutNode(instance.layoutNode, descriptor.flexProps);\n    instance.layoutNode.widgetOptions = descriptor.widgetOptions;\n    instance.layoutNode.eventHandlers = descriptor.eventHandlers;\n    instance.layoutNode._descriptor = descriptor;\n  },\n\n  commitTextUpdate(textInstance, _oldText, newText) {\n    textInstance.nodeValue = newText;\n    textInstance.layoutNode.widgetOptions = { content: newText };\n\n    // Update Yoga width when text length changes\n    textInstance.layoutNode.yogaNode.setWidth(newText.length);\n    textInstance.layoutNode.props.width = newText.length;\n  },\n\n  // Commit hooks\n  prepareForCommit: () => null,\n  resetAfterCommit(rootNode) {\n    if (rootNode.onComputeLayout) {\n      rootNode.onComputeLayout();\n    }\n  },\n\n  preparePortalMount: () => null,\n  clearContainer: () => false,\n\n  // Instance management\n  getPublicInstance: (instance) => instance,\n  finalizeInitialChildren: () => false,\n  shouldSetTextContent: () => false,\n\n  // Visibility\n  hideInstance(instance) {\n    instance.layoutNode.props.display = \"none\";\n    instance.layoutNode.yogaNode.setDisplay(1); // Yoga.DISPLAY_NONE\n  },\n\n  unhideInstance(instance) {\n    instance.layoutNode.props.display = \"flex\";\n    instance.layoutNode.yogaNode.setDisplay(0); // Yoga.DISPLAY_FLEX\n  },\n\n  hideTextInstance(instance) {\n    instance.nodeValue = \"\";\n    instance.layoutNode.widgetOptions = { content: \"\" };\n  },\n\n  unhideTextInstance(instance, text) {\n    instance.nodeValue = text;\n    instance.layoutNode.widgetOptions = { content: text };\n  },\n\n  // Reset methods\n  resetTextContent: () => {},\n\n  // Scheduling\n  scheduleTimeout: setTimeout,\n  cancelTimeout: clearTimeout,\n  noTimeout: -1,\n  getCurrentEventPriority: () => DefaultEventPriority,\n\n  // Update priority\n  // @ts-expect-error\n  setCurrentUpdatePriority: () => {},\n\n  // Scope (unused)\n  getInstanceFromNode: () => null,\n  prepareScopeUpdate: () => {},\n  getInstanceFromScope: () => null,\n\n  // Deletion\n  detachDeletedInstance: () => {},\n\n  // Active instance (unused)\n  beforeActiveInstanceBlur: () => {},\n  afterActiveInstanceBlur: () => {},\n});\n\nexport default reconciler;\n","/**\n * render.ts - Main render function for @unblessed/react\n *\n * This module provides the main `render()` function that users call to\n * mount React components to an unblessed Screen.\n */\n\nimport { Screen, setRuntime } from \"@unblessed/core\";\nimport { LayoutManager } from \"@unblessed/layout\";\nimport type { ReactNode } from \"react\";\nimport { BoxDescriptor } from \"./components/Box.js\";\nimport { createElement } from \"./dom.js\";\nimport reconciler, { setLayoutManager } from \"./reconciler.js\";\nimport type { RenderInstance, RenderOptions } from \"./types.js\";\n\n/**\n * Render a React element to an unblessed Screen\n *\n * @example\n * Basic usage (render() creates screen automatically):\n * ```tsx\n * import { NodeRuntime } from '@unblessed/node';\n * import { render, Box, Text } from '@unblessed/react';\n *\n * const App = () => (\n *   <Box flexDirection=\"row\" gap={2}>\n *     <Box width={20}>Left</Box>\n *     <Box flexGrow={1}>Middle</Box>\n *     <Box width={20}>Right</Box>\n *   </Box>\n * );\n *\n * const instance = render(<App />, { runtime: new NodeRuntime() });\n *\n * // Later:\n * instance.unmount();  // Automatically destroys screen\n * ```\n *\n * @example\n * Advanced usage (provide custom screen):\n * ```tsx\n * import { Screen, NodeRuntime } from '@unblessed/node';\n * import { render, Box, Text } from '@unblessed/react';\n *\n * const screen = new Screen({\n *   smartCSR: false,\n *   debug: true,\n *   log: './debug.log'\n * });\n *\n * const instance = render(<App />, {\n *   runtime: new NodeRuntime(),\n *   screen\n * });\n *\n * // Later:\n * instance.unmount();\n * screen.destroy();  // You must destroy screen manually\n * ```\n */\nexport function render(\n  element: ReactNode,\n  options: RenderOptions,\n): RenderInstance {\n  setRuntime(options.runtime);\n\n  // Use provided screen or create default\n  const screen =\n    options.screen ||\n    new Screen({\n      smartCSR: true,\n      fullUnicode: true,\n    });\n\n  // Track whether screen was provided by user\n  const screenCreatedByRender = !options.screen;\n\n  // Create LayoutManager\n  const manager = new LayoutManager({\n    screen,\n    debug: options.debug,\n  });\n\n  // Set layout manager for reconciler to use\n  setLayoutManager(manager);\n\n  // Create root layout node using BoxDescriptor (treat root like a box)\n  const rootDescriptor = new BoxDescriptor({\n    width: screen.width || 80,\n    height: screen.height || 24,\n  });\n\n  const rootLayoutNode = manager.createNode(\n    \"root\",\n    rootDescriptor.flexProps,\n    rootDescriptor.widgetOptions,\n  );\n  rootLayoutNode._descriptor = rootDescriptor;\n\n  // Create root DOM node\n  const rootDOMNode = createElement(\"root\", rootLayoutNode, {});\n  rootDOMNode.screen = screen;\n\n  // Set up layout calculation callback\n  rootDOMNode.onComputeLayout = () => {\n    // Calculate layout using LayoutManager\n    manager.performLayout(rootLayoutNode);\n  };\n\n  // Create React container\n  const container = reconciler.createContainer(\n    rootDOMNode,\n    0, // LegacyRoot\n    null, // hydration callbacks\n    false, // isStrictMode\n    null, // concurrentUpdatesByDefaultOverride\n    \"\", // identifierPrefix\n    (error: Error) => console.error(error), // onRecoverableError\n    null, // transitionCallbacks\n  );\n\n  // Promise that resolves when unmounted\n  let resolveExitPromise: () => void = () => {};\n  const exitPromise = new Promise<void>((resolve) => {\n    resolveExitPromise = resolve;\n  });\n\n  // Render the React element\n  reconciler.updateContainer(element, container, null, () => {\n    // Initial render complete\n  });\n\n  return {\n    screen,\n    unmount: () => {\n      // Unmount React tree\n      reconciler.updateContainer(null, container, null, () => {});\n\n      // Cleanup layout\n      manager.destroy(rootLayoutNode);\n\n      // Cleanup screen only if we created it\n      if (screenCreatedByRender) {\n        screen.destroy();\n      }\n\n      // Resolve exit promise\n      resolveExitPromise();\n    },\n\n    rerender: (newElement: ReactNode) => {\n      reconciler.updateContainer(newElement, container, null, () => {});\n    },\n\n    waitUntilExit: () => exitPromise,\n  };\n}\n"]}