@opentui/core 0.1.97 → 0.1.99

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.
@@ -103,7 +103,7 @@ import {
103
103
  getBorderSides,
104
104
  getCharacterPositions,
105
105
  getDataPaths,
106
- getKeyBindingKey,
106
+ getKeyBindingAction,
107
107
  getLinkId,
108
108
  getObjectsInViewport,
109
109
  getTreeSitterClient,
@@ -167,7 +167,7 @@ import {
167
167
  white,
168
168
  wrapWithDelegates,
169
169
  yellow
170
- } from "./index-kgg0v67t.js";
170
+ } from "./index-8978gvk3.js";
171
171
 
172
172
  // src/index.ts
173
173
  var exports_src2 = {};
@@ -3674,10 +3674,18 @@ class BoxRenderable extends Renderable {
3674
3674
  }
3675
3675
  }
3676
3676
  renderSelf(buffer) {
3677
- const currentBorderColor = this._focused ? this._focusedBorderColor : this._borderColor;
3677
+ const hasBorder = this.borderSides.top || this.borderSides.right || this.borderSides.bottom || this.borderSides.left;
3678
+ const hasVisibleFill = this.shouldFill && this._backgroundColor.a > 0;
3679
+ if (!hasBorder && !hasVisibleFill) {
3680
+ return;
3681
+ }
3682
+ const hasFocusWithin = this._focusable && (this._focused || this._hasFocusedDescendant);
3683
+ const currentBorderColor = hasFocusWithin ? this._focusedBorderColor : this._borderColor;
3684
+ const screenX = this._screenX;
3685
+ const screenY = this._screenY;
3678
3686
  buffer.drawBox({
3679
- x: this.x,
3680
- y: this.y,
3687
+ x: screenX,
3688
+ y: screenY,
3681
3689
  width: this.width,
3682
3690
  height: this.height,
3683
3691
  borderStyle: this._borderStyle,
@@ -4089,16 +4097,18 @@ class TextBufferRenderable extends Renderable {
4089
4097
  render(buffer, deltaTime) {
4090
4098
  if (!this.visible)
4091
4099
  return;
4100
+ const screenX = this._screenX;
4101
+ const screenY = this._screenY;
4092
4102
  this.markClean();
4093
- this._ctx.addToHitGrid(this.x, this.y, this.width, this.height, this.num);
4103
+ this._ctx.addToHitGrid(screenX, screenY, this.width, this.height, this.num);
4094
4104
  this.renderSelf(buffer);
4095
4105
  if (this.buffered && this.frameBuffer) {
4096
- buffer.drawFrameBuffer(this.x, this.y, this.frameBuffer);
4106
+ buffer.drawFrameBuffer(screenX, screenY, this.frameBuffer);
4097
4107
  }
4098
4108
  }
4099
4109
  renderSelf(buffer) {
4100
4110
  if (this.textBuffer.ptr) {
4101
- buffer.drawTextBuffer(this.textBufferView, this.x, this.y);
4111
+ buffer.drawTextBuffer(this.textBufferView, this._screenX, this._screenY);
4102
4112
  }
4103
4113
  }
4104
4114
  destroy() {
@@ -6579,15 +6589,7 @@ class TextareaRenderable extends EditBufferRenderable {
6579
6589
  this.insertText(stripAnsiSequences(decodePasteBytes(event.bytes)));
6580
6590
  }
6581
6591
  handleKeyPress(key) {
6582
- const bindingKey = getKeyBindingKey({
6583
- name: key.name,
6584
- ctrl: key.ctrl,
6585
- shift: key.shift,
6586
- meta: key.meta,
6587
- super: key.super,
6588
- action: "move-left"
6589
- });
6590
- const action = this._keyBindingsMap.get(bindingKey);
6592
+ const action = getKeyBindingAction(this._keyBindingsMap, key);
6591
6593
  if (action) {
6592
6594
  const handler = this._actionHandlers.get(action);
6593
6595
  if (handler) {
@@ -10616,11 +10618,19 @@ class ContentRenderable extends BoxRenderable {
10616
10618
  set viewportCulling(value) {
10617
10619
  this._viewportCulling = value;
10618
10620
  }
10621
+ _hasVisibleChildFilter() {
10622
+ return this._viewportCulling;
10623
+ }
10619
10624
  _getVisibleChildren() {
10620
10625
  if (this._viewportCulling) {
10621
- return getObjectsInViewport(this.viewport, this.getChildrenSortedByPrimaryAxis(), this.primaryAxis, 0).map((child) => child.num);
10626
+ return getObjectsInViewport({
10627
+ x: this.viewport.screenX,
10628
+ y: this.viewport.screenY,
10629
+ width: this.viewport.width,
10630
+ height: this.viewport.height
10631
+ }, this.getChildrenSortedByPrimaryAxis(), this.primaryAxis, 0).map((child) => child.num);
10622
10632
  }
10623
- return this.getChildrenSortedByPrimaryAxis().map((child) => child.num);
10633
+ return super._getVisibleChildren();
10624
10634
  }
10625
10635
  }
10626
10636
  var SCROLLBOX_PADDING_KEYS = [
@@ -11515,15 +11525,7 @@ class SelectRenderable extends Renderable {
11515
11525
  this.requestRender();
11516
11526
  }
11517
11527
  handleKeyPress(key) {
11518
- const bindingKey = getKeyBindingKey({
11519
- name: key.name,
11520
- ctrl: key.ctrl,
11521
- shift: key.shift,
11522
- meta: key.meta,
11523
- super: key.super,
11524
- action: "move-up"
11525
- });
11526
- const action = this._keyBindingsMap.get(bindingKey);
11528
+ const action = getKeyBindingAction(this._keyBindingsMap, key);
11527
11529
  if (action) {
11528
11530
  switch (action) {
11529
11531
  case "move-up":
@@ -11883,15 +11885,7 @@ class TabSelectRenderable extends Renderable {
11883
11885
  return this._tabWidth;
11884
11886
  }
11885
11887
  handleKeyPress(key) {
11886
- const bindingKey = getKeyBindingKey({
11887
- name: key.name,
11888
- ctrl: key.ctrl,
11889
- shift: key.shift,
11890
- meta: key.meta,
11891
- super: key.super,
11892
- action: "move-left"
11893
- });
11894
- const action = this._keyBindingsMap.get(bindingKey);
11888
+ const action = getKeyBindingAction(this._keyBindingsMap, key);
11895
11889
  if (action) {
11896
11890
  switch (action) {
11897
11891
  case "move-left":
@@ -12069,5 +12063,5 @@ class TimeToFirstDrawRenderable extends Renderable {
12069
12063
  }
12070
12064
  export { TextBufferView, convertThemeToStyles, SyntaxStyle, DistortionEffect, VignetteEffect, CloudsEffect, FlamesEffect, CRTRollingBarEffect, RainbowTextEffect, applyScanlines, applyInvert, applyNoise, applyChromaticAberration, applyAsciiArt, applyBrightness, applyGain, applySaturation, BloomEffect, SEPIA_MATRIX, PROTANOPIA_SIM_MATRIX, DEUTERANOPIA_SIM_MATRIX, TRITANOPIA_SIM_MATRIX, ACHROMATOPSIA_MATRIX, PROTANOPIA_COMP_MATRIX, DEUTERANOPIA_COMP_MATRIX, TRITANOPIA_COMP_MATRIX, TECHNICOLOR_MATRIX, SOLARIZATION_MATRIX, SYNTHWAVE_MATRIX, GREENSCALE_MATRIX, GRAYSCALE_MATRIX, INVERT_MATRIX, Timeline, engine, createTimeline, SlotRegistry, createSlotRegistry, createCoreSlotRegistry, registerCorePlugin, resolveCoreSlot, SlotRenderable, NativeSpanFeed, FrameBufferRenderable, ASCIIFontRenderable, BoxRenderable, TextBufferRenderable, CodeRenderable, isTextNodeRenderable, TextNodeRenderable, RootTextNodeRenderable, Generic, Box, Text, ASCIIFont, Input, Select, TabSelect, FrameBuffer, Code, ScrollBox, vstyles, VRenderable, LineNumberRenderable, TextRenderable, DiffRenderable, TextareaRenderable, InputRenderableEvents, InputRenderable, TextTableRenderable, MarkdownRenderable, SliderRenderable, ScrollBarRenderable, ArrowRenderable, ScrollBoxRenderable, SelectRenderableEvents, SelectRenderable, TabSelectRenderableEvents, TabSelectRenderable, TimeToFirstDrawRenderable, exports_src2 as exports_src };
12071
12065
 
12072
- //# debugId=56EDE40183F8E45364756E2164756E21
12073
- //# sourceMappingURL=index-9y4vegye.js.map
12066
+ //# debugId=B00F19B858C15EFD64756E2164756E21
12067
+ //# sourceMappingURL=index-fedv7szb.js.map