@opentui/solid 0.1.15 → 0.1.17

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 (2) hide show
  1. package/index.js +11 -4
  2. package/package.json +2 -2
package/index.js CHANGED
@@ -191,13 +191,20 @@ class TextNode {
191
191
  }
192
192
  this.textParent = textParent;
193
193
  let styledText = textParent.content;
194
- if (anchor && anchor instanceof TextNode) {
195
- const anchorIndex = styledText.chunks.indexOf(anchor.chunk);
194
+ if (anchor) {
195
+ if (anchor instanceof Renderable) {
196
+ console.warn("text node can't be anchored to Renderable");
197
+ return;
198
+ } else if (isTextChunk(anchor)) {
199
+ anchor = ChunkToTextNodeMap.get(anchor);
200
+ }
201
+ const anchorIndex = anchor ? styledText.chunks.indexOf(anchor.chunk) : -1;
196
202
  if (anchorIndex === -1) {
197
203
  log("anchor not found");
198
- return;
204
+ styledText = styledText.insert(this.chunk);
205
+ } else {
206
+ styledText = styledText.insert(this.chunk, anchorIndex);
199
207
  }
200
- styledText = styledText.insert(this.chunk, anchorIndex);
201
208
  } else {
202
209
  const firstChunk = textParent.content.chunks[0];
203
210
  if (firstChunk && !ChunkToTextNodeMap.has(firstChunk)) {
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "main": "index.js",
5
5
  "types": "index.d.ts",
6
6
  "type": "module",
7
- "version": "0.1.15",
7
+ "version": "0.1.17",
8
8
  "description": "SolidJS renderer for OpenTUI",
9
9
  "license": "MIT",
10
10
  "repository": {
@@ -25,7 +25,7 @@
25
25
  "./jsx-dev-runtime": "./jsx-runtime.d.ts"
26
26
  },
27
27
  "dependencies": {
28
- "@opentui/core": "0.1.15",
28
+ "@opentui/core": "0.1.17",
29
29
  "babel-plugin-module-resolver": "5.0.2",
30
30
  "@babel/core": "7.28.0",
31
31
  "@babel/preset-typescript": "7.27.1",