@fairyhunter13/opentui-core 0.1.138 → 0.1.140
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.
- package/3d.js +1 -1
- package/3d.js.map +2 -2
- package/README.md +2 -2
- package/{index-2bhr97k7.js → index-h1ewdzdj.js} +3 -3
- package/{index-n2b7w731.js → index-jct3zgy3.js} +18 -36
- package/{index-n2b7w731.js.map → index-jct3zgy3.js.map} +14 -14
- package/{index-x59exf1c.js → index-jfshts6b.js} +9 -241
- package/index-jfshts6b.js.map +35 -0
- package/index.js +2 -2
- package/package.json +7 -7
- package/parser.worker.js +8 -16
- package/parser.worker.js.map +3 -3
- package/renderables/Markdown.d.ts +0 -4
- package/runtime-plugin-support.js +3 -3
- package/runtime-plugin.js +3 -3
- package/testing.js +1 -1
- package/testing.js.map +2 -2
- package/index-x59exf1c.js.map +0 -35
- /package/{index-2bhr97k7.js.map → index-h1ewdzdj.js.map} +0 -0
|
@@ -185,7 +185,7 @@ import {
|
|
|
185
185
|
white,
|
|
186
186
|
wrapWithDelegates,
|
|
187
187
|
yellow
|
|
188
|
-
} from "./index-
|
|
188
|
+
} from "./index-jct3zgy3.js";
|
|
189
189
|
|
|
190
190
|
// src/index.ts
|
|
191
191
|
var exports_src2 = {};
|
|
@@ -7711,7 +7711,7 @@ function parseMarkdownIncremental(newContent, prevState, trailingUnstable = 2) {
|
|
|
7711
7711
|
}
|
|
7712
7712
|
|
|
7713
7713
|
// src/renderables/Markdown.ts
|
|
7714
|
-
var TRAILING_MARKDOWN_BLOCK_BREAKS_RE = /(?:\r?\n)
|
|
7714
|
+
var TRAILING_MARKDOWN_BLOCK_BREAKS_RE = /(?:\r?\n){2,}$/;
|
|
7715
7715
|
var TRAILING_MARKDOWN_BLOCK_NEWLINES_RE = /(?:\r?\n)+$/;
|
|
7716
7716
|
function colorsEqual(left, right) {
|
|
7717
7717
|
if (!left || !right)
|
|
@@ -7739,9 +7739,6 @@ class MarkdownRenderable extends Renderable {
|
|
|
7739
7739
|
content: context.content,
|
|
7740
7740
|
highlights: context.highlights
|
|
7741
7741
|
});
|
|
7742
|
-
_inlineConcealChunks = (chunks, context) => {
|
|
7743
|
-
return this.buildInlineConcealChunks(chunks, context);
|
|
7744
|
-
};
|
|
7745
7742
|
_contentDefaultOptions = {
|
|
7746
7743
|
content: "",
|
|
7747
7744
|
conceal: true,
|
|
@@ -8001,235 +7998,6 @@ class MarkdownRenderable extends Renderable {
|
|
|
8001
7998
|
renderable.marginTop = marginTop;
|
|
8002
7999
|
renderable.marginBottom = marginBottom;
|
|
8003
8000
|
}
|
|
8004
|
-
buildInlineConcealChunks(chunks, context) {
|
|
8005
|
-
const result = [];
|
|
8006
|
-
try {
|
|
8007
|
-
const parsed = parseMarkdownIncremental(context.content, null, 0);
|
|
8008
|
-
const tokens = parsed.tokens;
|
|
8009
|
-
for (const token of tokens) {
|
|
8010
|
-
this.renderBlockTokenInline(token, result);
|
|
8011
|
-
}
|
|
8012
|
-
} catch {
|
|
8013
|
-
return chunks;
|
|
8014
|
-
}
|
|
8015
|
-
if (result.length > 0 && result[result.length - 1].text === `
|
|
8016
|
-
`) {
|
|
8017
|
-
result.pop();
|
|
8018
|
-
}
|
|
8019
|
-
if (result.length === 0)
|
|
8020
|
-
return chunks;
|
|
8021
|
-
const linked = this._linkifyMarkdownChunks(result, context);
|
|
8022
|
-
if (Array.isArray(linked))
|
|
8023
|
-
return linked;
|
|
8024
|
-
return result;
|
|
8025
|
-
}
|
|
8026
|
-
renderBlockTokenInline(token, chunks) {
|
|
8027
|
-
switch (token.type) {
|
|
8028
|
-
case "heading": {
|
|
8029
|
-
const headingToken = token;
|
|
8030
|
-
const style = `markup.heading.${headingToken.depth}`;
|
|
8031
|
-
for (const child of headingToken.tokens) {
|
|
8032
|
-
this.renderInlineTokenWithStyle(child, chunks, style);
|
|
8033
|
-
}
|
|
8034
|
-
chunks.push(this.createDefaultChunk(`
|
|
8035
|
-
`));
|
|
8036
|
-
break;
|
|
8037
|
-
}
|
|
8038
|
-
case "paragraph": {
|
|
8039
|
-
const paragraphToken = token;
|
|
8040
|
-
this.renderInlineContent(paragraphToken.tokens, chunks);
|
|
8041
|
-
chunks.push(this.createDefaultChunk(`
|
|
8042
|
-
`));
|
|
8043
|
-
break;
|
|
8044
|
-
}
|
|
8045
|
-
case "list": {
|
|
8046
|
-
this.renderListInline(token, chunks, 0);
|
|
8047
|
-
break;
|
|
8048
|
-
}
|
|
8049
|
-
case "blockquote": {
|
|
8050
|
-
const quoteToken = token;
|
|
8051
|
-
for (const child of quoteToken.tokens) {
|
|
8052
|
-
const markedChild = child;
|
|
8053
|
-
if (markedChild.type === "paragraph" && "tokens" in markedChild) {
|
|
8054
|
-
chunks.push(this.createChunk("\u258E ", "markup.quote"));
|
|
8055
|
-
for (const inline of markedChild.tokens) {
|
|
8056
|
-
this.renderInlineTokenWithStyle(inline, chunks, "markup.quote");
|
|
8057
|
-
}
|
|
8058
|
-
chunks.push(this.createDefaultChunk(`
|
|
8059
|
-
`));
|
|
8060
|
-
} else if (markedChild.type === "table") {
|
|
8061
|
-
const tbl = markedChild;
|
|
8062
|
-
const headerCells = tbl.header.map((h2) => h2.text || " ").join(" | ");
|
|
8063
|
-
const sepCells = tbl.header.map(() => "---").join(" | ");
|
|
8064
|
-
const tableLines = [
|
|
8065
|
-
`| ${headerCells} |`,
|
|
8066
|
-
`| ${sepCells} |`,
|
|
8067
|
-
...tbl.rows.map((row) => `| ${row.map((c) => c.text || " ").join(" | ")} |`)
|
|
8068
|
-
];
|
|
8069
|
-
for (const line of tableLines) {
|
|
8070
|
-
chunks.push(this.createChunk("\u258E ", "markup.quote"));
|
|
8071
|
-
chunks.push(this.createDefaultChunk(line + `
|
|
8072
|
-
`));
|
|
8073
|
-
}
|
|
8074
|
-
} else {
|
|
8075
|
-
chunks.push(this.createChunk("\u258E ", "markup.quote"));
|
|
8076
|
-
this.renderBlockTokenInline(markedChild, chunks);
|
|
8077
|
-
}
|
|
8078
|
-
}
|
|
8079
|
-
break;
|
|
8080
|
-
}
|
|
8081
|
-
case "code": {
|
|
8082
|
-
const codeToken = token;
|
|
8083
|
-
const rawStyle = this.getStyle("markup.raw.block");
|
|
8084
|
-
const codeText = codeToken.text;
|
|
8085
|
-
for (const line of codeText.split(`
|
|
8086
|
-
`)) {
|
|
8087
|
-
chunks.push({
|
|
8088
|
-
__isChunk: true,
|
|
8089
|
-
text: " " + line,
|
|
8090
|
-
fg: rawStyle?.fg,
|
|
8091
|
-
bg: rawStyle?.bg,
|
|
8092
|
-
attributes: rawStyle ? createTextAttributes({
|
|
8093
|
-
bold: rawStyle.bold,
|
|
8094
|
-
italic: rawStyle.italic,
|
|
8095
|
-
underline: rawStyle.underline,
|
|
8096
|
-
dim: rawStyle.dim
|
|
8097
|
-
}) : 0
|
|
8098
|
-
});
|
|
8099
|
-
chunks.push(this.createDefaultChunk(`
|
|
8100
|
-
`));
|
|
8101
|
-
}
|
|
8102
|
-
break;
|
|
8103
|
-
}
|
|
8104
|
-
case "html": {
|
|
8105
|
-
chunks.push(this.createDefaultChunk(token.text));
|
|
8106
|
-
chunks.push(this.createDefaultChunk(`
|
|
8107
|
-
`));
|
|
8108
|
-
break;
|
|
8109
|
-
}
|
|
8110
|
-
case "hr": {
|
|
8111
|
-
const hrStyle = this.getStyle("punctuation.special");
|
|
8112
|
-
chunks.push({
|
|
8113
|
-
__isChunk: true,
|
|
8114
|
-
text: "\u2500".repeat(40),
|
|
8115
|
-
fg: hrStyle?.fg,
|
|
8116
|
-
bg: hrStyle?.bg,
|
|
8117
|
-
attributes: hrStyle ? createTextAttributes({
|
|
8118
|
-
bold: hrStyle.bold,
|
|
8119
|
-
italic: hrStyle.italic,
|
|
8120
|
-
underline: hrStyle.underline,
|
|
8121
|
-
dim: hrStyle.dim
|
|
8122
|
-
}) : 0
|
|
8123
|
-
});
|
|
8124
|
-
chunks.push(this.createDefaultChunk(`
|
|
8125
|
-
`));
|
|
8126
|
-
break;
|
|
8127
|
-
}
|
|
8128
|
-
case "table": {
|
|
8129
|
-
chunks.push(this.createDefaultChunk(token.raw ?? ""));
|
|
8130
|
-
chunks.push(this.createDefaultChunk(`
|
|
8131
|
-
`));
|
|
8132
|
-
break;
|
|
8133
|
-
}
|
|
8134
|
-
case "def":
|
|
8135
|
-
break;
|
|
8136
|
-
case "space":
|
|
8137
|
-
chunks.push(this.createDefaultChunk(`
|
|
8138
|
-
`));
|
|
8139
|
-
break;
|
|
8140
|
-
default:
|
|
8141
|
-
if ("tokens" in token && Array.isArray(token.tokens)) {
|
|
8142
|
-
this.renderInlineContent(token.tokens, chunks);
|
|
8143
|
-
} else {
|
|
8144
|
-
chunks.push(this.createDefaultChunk(token.raw ?? ""));
|
|
8145
|
-
}
|
|
8146
|
-
chunks.push(this.createDefaultChunk(`
|
|
8147
|
-
`));
|
|
8148
|
-
break;
|
|
8149
|
-
}
|
|
8150
|
-
}
|
|
8151
|
-
renderListInline(list, chunks, depth) {
|
|
8152
|
-
const listStyle = this.getStyle("markup.list");
|
|
8153
|
-
const checkedStyle = this.getStyle("markup.list.checked");
|
|
8154
|
-
const uncheckedStyle = this.getStyle("markup.list.unchecked");
|
|
8155
|
-
for (let i = 0;i < list.items.length; i++) {
|
|
8156
|
-
const item = list.items[i];
|
|
8157
|
-
const indent = " ".repeat(depth);
|
|
8158
|
-
const start = typeof list.start === "number" ? list.start : 1;
|
|
8159
|
-
if (item.task) {
|
|
8160
|
-
const checkmark = item.checked ? "\u2611 " : "\u2610 ";
|
|
8161
|
-
const checkStyle = item.checked ? checkedStyle : uncheckedStyle;
|
|
8162
|
-
chunks.push({
|
|
8163
|
-
__isChunk: true,
|
|
8164
|
-
text: indent + checkmark,
|
|
8165
|
-
fg: checkStyle?.fg ?? listStyle?.fg,
|
|
8166
|
-
bg: checkStyle?.bg ?? listStyle?.bg,
|
|
8167
|
-
attributes: checkStyle ? createTextAttributes({
|
|
8168
|
-
bold: checkStyle.bold,
|
|
8169
|
-
italic: checkStyle.italic,
|
|
8170
|
-
underline: checkStyle.underline,
|
|
8171
|
-
dim: checkStyle.dim
|
|
8172
|
-
}) : 0
|
|
8173
|
-
});
|
|
8174
|
-
} else {
|
|
8175
|
-
const bullet = list.ordered ? `${start + i}. ` : "\u2022 ";
|
|
8176
|
-
chunks.push({
|
|
8177
|
-
__isChunk: true,
|
|
8178
|
-
text: indent + bullet,
|
|
8179
|
-
fg: listStyle?.fg,
|
|
8180
|
-
bg: listStyle?.bg,
|
|
8181
|
-
attributes: listStyle ? createTextAttributes({
|
|
8182
|
-
bold: listStyle.bold,
|
|
8183
|
-
italic: listStyle.italic,
|
|
8184
|
-
underline: listStyle.underline,
|
|
8185
|
-
dim: listStyle.dim
|
|
8186
|
-
}) : 0
|
|
8187
|
-
});
|
|
8188
|
-
}
|
|
8189
|
-
for (const subToken of item.tokens) {
|
|
8190
|
-
const markedSub = subToken;
|
|
8191
|
-
if (markedSub.type === "text" && "tokens" in markedSub && Array.isArray(markedSub.tokens)) {
|
|
8192
|
-
this.renderInlineContent(markedSub.tokens, chunks);
|
|
8193
|
-
} else if (markedSub.type === "list") {
|
|
8194
|
-
chunks.push(this.createDefaultChunk(`
|
|
8195
|
-
`));
|
|
8196
|
-
this.renderListInline(markedSub, chunks, depth + 1);
|
|
8197
|
-
continue;
|
|
8198
|
-
} else if (markedSub.type === "paragraph" && "tokens" in markedSub) {
|
|
8199
|
-
this.renderInlineContent(markedSub.tokens, chunks);
|
|
8200
|
-
} else if (markedSub.type === "code") {
|
|
8201
|
-
if (chunks.length > 0 && !chunks[chunks.length - 1].text.endsWith(`
|
|
8202
|
-
`)) {
|
|
8203
|
-
chunks[chunks.length - 1] = { ...chunks[chunks.length - 1], text: chunks[chunks.length - 1].text + `
|
|
8204
|
-
` };
|
|
8205
|
-
} else {
|
|
8206
|
-
chunks.push(this.createDefaultChunk(`
|
|
8207
|
-
`));
|
|
8208
|
-
}
|
|
8209
|
-
const codeLines = markedSub.text.split(`
|
|
8210
|
-
`);
|
|
8211
|
-
const codeStyle = this.getStyle("markup.raw") || this.getStyle("default");
|
|
8212
|
-
for (const codeLine of codeLines) {
|
|
8213
|
-
chunks.push(this.createDefaultChunk(indent + " "));
|
|
8214
|
-
chunks.push({
|
|
8215
|
-
__isChunk: true,
|
|
8216
|
-
text: codeLine,
|
|
8217
|
-
fg: codeStyle?.fg,
|
|
8218
|
-
bg: codeStyle?.bg,
|
|
8219
|
-
attributes: 0
|
|
8220
|
-
});
|
|
8221
|
-
chunks.push(this.createDefaultChunk(`
|
|
8222
|
-
`));
|
|
8223
|
-
}
|
|
8224
|
-
continue;
|
|
8225
|
-
} else {
|
|
8226
|
-
this.renderInlineToken(markedSub, chunks);
|
|
8227
|
-
}
|
|
8228
|
-
}
|
|
8229
|
-
chunks.push(this.createDefaultChunk(`
|
|
8230
|
-
`));
|
|
8231
|
-
}
|
|
8232
|
-
}
|
|
8233
8001
|
createMarkdownCodeRenderable(content, id, marginBottom = 0) {
|
|
8234
8002
|
return new CodeRenderable(this.ctx, {
|
|
8235
8003
|
id,
|
|
@@ -8239,9 +8007,9 @@ class MarkdownRenderable extends Renderable {
|
|
|
8239
8007
|
fg: this._fg,
|
|
8240
8008
|
bg: this._bg,
|
|
8241
8009
|
conceal: this._conceal,
|
|
8242
|
-
drawUnstyledText:
|
|
8010
|
+
drawUnstyledText: false,
|
|
8243
8011
|
streaming: true,
|
|
8244
|
-
onChunks: this.
|
|
8012
|
+
onChunks: this._linkifyMarkdownChunks,
|
|
8245
8013
|
treeSitterClient: this._treeSitterClient,
|
|
8246
8014
|
width: "100%",
|
|
8247
8015
|
marginBottom
|
|
@@ -8270,9 +8038,8 @@ class MarkdownRenderable extends Renderable {
|
|
|
8270
8038
|
renderable.fg = this._fg;
|
|
8271
8039
|
renderable.bg = this._bg;
|
|
8272
8040
|
renderable.conceal = this._conceal;
|
|
8273
|
-
renderable.drawUnstyledText =
|
|
8041
|
+
renderable.drawUnstyledText = false;
|
|
8274
8042
|
renderable.streaming = true;
|
|
8275
|
-
renderable.onChunks = this._conceal ? this._inlineConcealChunks : this._linkifyMarkdownChunks;
|
|
8276
8043
|
renderable.marginBottom = marginBottom;
|
|
8277
8044
|
}
|
|
8278
8045
|
applyCodeBlockRenderable(renderable, token, marginBottom) {
|
|
@@ -8303,7 +8070,8 @@ class MarkdownRenderable extends Renderable {
|
|
|
8303
8070
|
};
|
|
8304
8071
|
}
|
|
8305
8072
|
normalizeMarkdownBlockRaw(raw) {
|
|
8306
|
-
return raw.replace(TRAILING_MARKDOWN_BLOCK_BREAKS_RE,
|
|
8073
|
+
return raw.replace(TRAILING_MARKDOWN_BLOCK_BREAKS_RE, `
|
|
8074
|
+
`);
|
|
8307
8075
|
}
|
|
8308
8076
|
normalizeScrollbackMarkdownBlockRaw(raw) {
|
|
8309
8077
|
return raw.replace(TRAILING_MARKDOWN_BLOCK_NEWLINES_RE, "");
|
|
@@ -10986,5 +10754,5 @@ class TimeToFirstDrawRenderable extends Renderable {
|
|
|
10986
10754
|
}
|
|
10987
10755
|
export { 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, Generic, Box, Text, ASCIIFont, Input, Select, TabSelect, FrameBuffer, Code, ScrollBox, vstyles, VRenderable, LineNumberRenderable, DiffRenderable, defaultTextareaKeyBindings, TextareaRenderable, InputRenderableEvents, InputRenderable, TextTableRenderable, MarkdownRenderable, SliderRenderable, ScrollBarRenderable, ArrowRenderable, ScrollBoxRenderable, SelectRenderableEvents, SelectRenderable, TabSelectRenderableEvents, TabSelectRenderable, TimeToFirstDrawRenderable, exports_src2 as exports_src };
|
|
10988
10756
|
|
|
10989
|
-
//# debugId=
|
|
10990
|
-
//# sourceMappingURL=index-
|
|
10757
|
+
//# debugId=6608E532EE6A69FA64756E2164756E21
|
|
10758
|
+
//# sourceMappingURL=index-jfshts6b.js.map
|