@almadar/ui 2.54.0 → 2.55.0
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/dist/avl/index.cjs +72 -30
- package/dist/avl/index.js +72 -30
- package/dist/components/index.cjs +72 -30
- package/dist/components/index.js +72 -30
- package/dist/components/molecules/markdown/CodeBlock.d.ts +8 -0
- package/dist/providers/index.cjs +72 -30
- package/dist/providers/index.js +72 -30
- package/dist/runtime/index.cjs +72 -30
- package/dist/runtime/index.js +72 -30
- package/package.json +1 -1
package/dist/components/index.js
CHANGED
|
@@ -9166,7 +9166,8 @@ var CodeBlock = React90__default.memo(
|
|
|
9166
9166
|
foldable: foldableProp,
|
|
9167
9167
|
className,
|
|
9168
9168
|
editable = false,
|
|
9169
|
-
onChange
|
|
9169
|
+
onChange,
|
|
9170
|
+
errorLines
|
|
9170
9171
|
}) => {
|
|
9171
9172
|
const code = typeof rawCode === "string" ? rawCode : String(rawCode ?? "");
|
|
9172
9173
|
const isOrb = language === "orb";
|
|
@@ -9198,6 +9199,28 @@ var CodeBlock = React90__default.memo(
|
|
|
9198
9199
|
ov.scrollLeft = ta.scrollLeft;
|
|
9199
9200
|
}
|
|
9200
9201
|
}, []);
|
|
9202
|
+
const errorLineProps = useMemo(() => {
|
|
9203
|
+
if (!errorLines || errorLines.size === 0) {
|
|
9204
|
+
return LINE_PROPS_FN;
|
|
9205
|
+
}
|
|
9206
|
+
return (lineNumber) => {
|
|
9207
|
+
const severity = errorLines.get(lineNumber);
|
|
9208
|
+
if (!severity) {
|
|
9209
|
+
return { "data-line": String(lineNumber - 1) };
|
|
9210
|
+
}
|
|
9211
|
+
return {
|
|
9212
|
+
"data-line": String(lineNumber - 1),
|
|
9213
|
+
style: {
|
|
9214
|
+
display: "block",
|
|
9215
|
+
backgroundColor: severity === "error" ? "rgba(248, 113, 113, 0.18)" : "rgba(251, 191, 36, 0.18)",
|
|
9216
|
+
// amber-400 @ 18%
|
|
9217
|
+
borderLeft: `3px solid ${severity === "error" ? "#ef4444" : "#f59e0b"}`,
|
|
9218
|
+
paddingLeft: "0.5rem",
|
|
9219
|
+
marginLeft: "-0.5rem"
|
|
9220
|
+
}
|
|
9221
|
+
};
|
|
9222
|
+
};
|
|
9223
|
+
}, [errorLines]);
|
|
9201
9224
|
const isFoldable = foldableProp ?? (language === "orb" || language === "json");
|
|
9202
9225
|
const [collapsed, setCollapsed] = useState(() => /* @__PURE__ */ new Set());
|
|
9203
9226
|
const foldRegions = useMemo(
|
|
@@ -9358,24 +9381,40 @@ var CodeBlock = React90__default.memo(
|
|
|
9358
9381
|
}
|
|
9359
9382
|
),
|
|
9360
9383
|
editable ? (
|
|
9361
|
-
/* GAP-77: editable mode = transparent
|
|
9362
|
-
|
|
9363
|
-
|
|
9364
|
-
|
|
9365
|
-
|
|
9366
|
-
|
|
9384
|
+
/* GAP-77 / GAP-82 / GAP-83: editable mode = transparent textarea on
|
|
9385
|
+
top of a Prism-highlighted SyntaxHighlighter overlay.
|
|
9386
|
+
|
|
9387
|
+
Layout: BOTH children are `position: absolute, inset: 0` so neither
|
|
9388
|
+
contributes to flow. The parent Box has `height: 100%` so it fills
|
|
9389
|
+
whatever container the consumer provides (the consumer is
|
|
9390
|
+
responsible for giving the parent a real height — usually via flex
|
|
9391
|
+
column with `minHeight: 0`).
|
|
9392
|
+
|
|
9393
|
+
Stacking: the overlay is FIRST in DOM order so it paints first
|
|
9394
|
+
(behind), the textarea is SECOND so it paints second (on top). No
|
|
9395
|
+
explicit z-index — DOM order alone determines stacking inside the
|
|
9396
|
+
parent's stacking context. The textarea has `color: transparent`
|
|
9397
|
+
plus `WebkitTextFillColor: transparent` (Safari) so its glyphs
|
|
9398
|
+
never paint, but the caret stays visible via `caretColor`.
|
|
9367
9399
|
|
|
9368
|
-
Scroll sync:
|
|
9369
|
-
|
|
9400
|
+
Scroll sync: textarea scrolls naturally; `handleEditableScroll`
|
|
9401
|
+
mirrors its scrollTop/scrollLeft onto the overlay div so the
|
|
9402
|
+
highlighted spans stay aligned with the textarea content.
|
|
9403
|
+
|
|
9404
|
+
Error highlights (GAP-80): `errorLines` prop accepts a Map of
|
|
9405
|
+
1-based line numbers → severity. The overlay's SyntaxHighlighter
|
|
9406
|
+
uses `wrapLines` + `lineProps` to paint a colored background on
|
|
9407
|
+
those lines. */
|
|
9370
9408
|
/* @__PURE__ */ jsxs(
|
|
9371
9409
|
Box,
|
|
9372
9410
|
{
|
|
9373
9411
|
style: {
|
|
9374
9412
|
position: "relative",
|
|
9375
|
-
|
|
9376
|
-
borderRadius: hasHeader ? "0 0 0.5rem 0.5rem" : "0.5rem",
|
|
9413
|
+
height: "100%",
|
|
9377
9414
|
minHeight: "160px",
|
|
9378
9415
|
maxHeight,
|
|
9416
|
+
backgroundColor: "#1e1e1e",
|
|
9417
|
+
borderRadius: hasHeader ? "0 0 0.5rem 0.5rem" : "0.5rem",
|
|
9379
9418
|
overflow: "hidden"
|
|
9380
9419
|
},
|
|
9381
9420
|
children: [
|
|
@@ -9386,10 +9425,12 @@ var CodeBlock = React90__default.memo(
|
|
|
9386
9425
|
"aria-hidden": true,
|
|
9387
9426
|
style: {
|
|
9388
9427
|
position: "absolute",
|
|
9389
|
-
|
|
9428
|
+
top: 0,
|
|
9429
|
+
left: 0,
|
|
9430
|
+
width: "100%",
|
|
9431
|
+
height: "100%",
|
|
9390
9432
|
overflow: "hidden",
|
|
9391
|
-
pointerEvents: "none"
|
|
9392
|
-
maxHeight
|
|
9433
|
+
pointerEvents: "none"
|
|
9393
9434
|
},
|
|
9394
9435
|
children: /* @__PURE__ */ jsx(
|
|
9395
9436
|
SyntaxHighlighter,
|
|
@@ -9397,6 +9438,8 @@ var CodeBlock = React90__default.memo(
|
|
|
9397
9438
|
PreTag: "div",
|
|
9398
9439
|
language,
|
|
9399
9440
|
style: activeStyle,
|
|
9441
|
+
wrapLines: errorLines && errorLines.size > 0,
|
|
9442
|
+
lineProps: errorLineProps,
|
|
9400
9443
|
customStyle: {
|
|
9401
9444
|
backgroundColor: "transparent",
|
|
9402
9445
|
borderRadius: 0,
|
|
@@ -9404,7 +9447,6 @@ var CodeBlock = React90__default.memo(
|
|
|
9404
9447
|
margin: 0,
|
|
9405
9448
|
whiteSpace: "pre",
|
|
9406
9449
|
minWidth: "100%",
|
|
9407
|
-
minHeight: "160px",
|
|
9408
9450
|
fontFamily: 'ui-monospace, SFMono-Regular, Menlo, Monaco, "Cascadia Mono", "Courier New", monospace',
|
|
9409
9451
|
fontSize: "13px",
|
|
9410
9452
|
lineHeight: "1.5"
|
|
@@ -9433,23 +9475,23 @@ var CodeBlock = React90__default.memo(
|
|
|
9433
9475
|
onScroll: handleEditableScroll,
|
|
9434
9476
|
spellCheck: false,
|
|
9435
9477
|
style: {
|
|
9436
|
-
position: "
|
|
9437
|
-
|
|
9438
|
-
|
|
9439
|
-
fontSize: "13px",
|
|
9440
|
-
lineHeight: "1.5",
|
|
9441
|
-
backgroundColor: "transparent",
|
|
9442
|
-
color: "transparent",
|
|
9443
|
-
caretColor: "#e6e6e6",
|
|
9444
|
-
borderRadius: hasHeader ? "0 0 0.5rem 0.5rem" : "0.5rem",
|
|
9445
|
-
border: "none",
|
|
9446
|
-
padding: "1rem",
|
|
9447
|
-
resize: "none",
|
|
9448
|
-
minHeight: "160px",
|
|
9449
|
-
maxHeight,
|
|
9478
|
+
position: "absolute",
|
|
9479
|
+
top: 0,
|
|
9480
|
+
left: 0,
|
|
9450
9481
|
width: "100%",
|
|
9451
9482
|
height: "100%",
|
|
9483
|
+
padding: "1rem",
|
|
9484
|
+
margin: 0,
|
|
9485
|
+
border: "none",
|
|
9452
9486
|
outline: "none",
|
|
9487
|
+
resize: "none",
|
|
9488
|
+
backgroundColor: "transparent",
|
|
9489
|
+
color: "transparent",
|
|
9490
|
+
caretColor: "#e6e6e6",
|
|
9491
|
+
WebkitTextFillColor: "transparent",
|
|
9492
|
+
fontFamily: 'ui-monospace, SFMono-Regular, Menlo, Monaco, "Cascadia Mono", "Courier New", monospace',
|
|
9493
|
+
fontSize: "13px",
|
|
9494
|
+
lineHeight: "1.5",
|
|
9453
9495
|
whiteSpace: "pre",
|
|
9454
9496
|
overflowWrap: "normal",
|
|
9455
9497
|
overflow: "auto"
|
|
@@ -9480,7 +9522,7 @@ var CodeBlock = React90__default.memo(
|
|
|
9480
9522
|
)
|
|
9481
9523
|
] });
|
|
9482
9524
|
},
|
|
9483
|
-
(prev, next) => prev.language === next.language && prev.code === next.code && prev.showCopyButton === next.showCopyButton && prev.maxHeight === next.maxHeight && prev.foldable === next.foldable && prev.editable === next.editable && prev.onChange === next.onChange
|
|
9525
|
+
(prev, next) => prev.language === next.language && prev.code === next.code && prev.showCopyButton === next.showCopyButton && prev.maxHeight === next.maxHeight && prev.foldable === next.foldable && prev.editable === next.editable && prev.onChange === next.onChange && prev.errorLines === next.errorLines
|
|
9484
9526
|
);
|
|
9485
9527
|
CodeBlock.displayName = "CodeBlock";
|
|
9486
9528
|
init_Typography();
|
|
@@ -40,5 +40,13 @@ export interface CodeBlockProps {
|
|
|
40
40
|
* Consumers should debounce + parse downstream — `CodeBlock` does not.
|
|
41
41
|
*/
|
|
42
42
|
onChange?: (code: string) => void;
|
|
43
|
+
/**
|
|
44
|
+
* GAP-80: line-level error/warning highlights for editable mode.
|
|
45
|
+
* Map of 1-based line number → severity. The overlay paints a colored
|
|
46
|
+
* background on each line: error = red, warning = yellow. Pass undefined
|
|
47
|
+
* (default) to disable. The consumer is responsible for computing the
|
|
48
|
+
* path → line map from the schema + validation results.
|
|
49
|
+
*/
|
|
50
|
+
errorLines?: Map<number, 'error' | 'warning'>;
|
|
43
51
|
}
|
|
44
52
|
export declare const CodeBlock: React.NamedExoticComponent<CodeBlockProps>;
|
package/dist/providers/index.cjs
CHANGED
|
@@ -4096,7 +4096,8 @@ var CodeBlock = React114__namespace.default.memo(
|
|
|
4096
4096
|
foldable: foldableProp,
|
|
4097
4097
|
className,
|
|
4098
4098
|
editable = false,
|
|
4099
|
-
onChange
|
|
4099
|
+
onChange,
|
|
4100
|
+
errorLines
|
|
4100
4101
|
}) => {
|
|
4101
4102
|
const code = typeof rawCode === "string" ? rawCode : String(rawCode ?? "");
|
|
4102
4103
|
const isOrb = language === "orb";
|
|
@@ -4128,6 +4129,28 @@ var CodeBlock = React114__namespace.default.memo(
|
|
|
4128
4129
|
ov.scrollLeft = ta.scrollLeft;
|
|
4129
4130
|
}
|
|
4130
4131
|
}, []);
|
|
4132
|
+
const errorLineProps = React114.useMemo(() => {
|
|
4133
|
+
if (!errorLines || errorLines.size === 0) {
|
|
4134
|
+
return LINE_PROPS_FN;
|
|
4135
|
+
}
|
|
4136
|
+
return (lineNumber) => {
|
|
4137
|
+
const severity = errorLines.get(lineNumber);
|
|
4138
|
+
if (!severity) {
|
|
4139
|
+
return { "data-line": String(lineNumber - 1) };
|
|
4140
|
+
}
|
|
4141
|
+
return {
|
|
4142
|
+
"data-line": String(lineNumber - 1),
|
|
4143
|
+
style: {
|
|
4144
|
+
display: "block",
|
|
4145
|
+
backgroundColor: severity === "error" ? "rgba(248, 113, 113, 0.18)" : "rgba(251, 191, 36, 0.18)",
|
|
4146
|
+
// amber-400 @ 18%
|
|
4147
|
+
borderLeft: `3px solid ${severity === "error" ? "#ef4444" : "#f59e0b"}`,
|
|
4148
|
+
paddingLeft: "0.5rem",
|
|
4149
|
+
marginLeft: "-0.5rem"
|
|
4150
|
+
}
|
|
4151
|
+
};
|
|
4152
|
+
};
|
|
4153
|
+
}, [errorLines]);
|
|
4131
4154
|
const isFoldable = foldableProp ?? (language === "orb" || language === "json");
|
|
4132
4155
|
const [collapsed, setCollapsed] = React114.useState(() => /* @__PURE__ */ new Set());
|
|
4133
4156
|
const foldRegions = React114.useMemo(
|
|
@@ -4288,24 +4311,40 @@ var CodeBlock = React114__namespace.default.memo(
|
|
|
4288
4311
|
}
|
|
4289
4312
|
),
|
|
4290
4313
|
editable ? (
|
|
4291
|
-
/* GAP-77: editable mode = transparent
|
|
4292
|
-
|
|
4293
|
-
|
|
4294
|
-
|
|
4295
|
-
|
|
4296
|
-
|
|
4314
|
+
/* GAP-77 / GAP-82 / GAP-83: editable mode = transparent textarea on
|
|
4315
|
+
top of a Prism-highlighted SyntaxHighlighter overlay.
|
|
4316
|
+
|
|
4317
|
+
Layout: BOTH children are `position: absolute, inset: 0` so neither
|
|
4318
|
+
contributes to flow. The parent Box has `height: 100%` so it fills
|
|
4319
|
+
whatever container the consumer provides (the consumer is
|
|
4320
|
+
responsible for giving the parent a real height — usually via flex
|
|
4321
|
+
column with `minHeight: 0`).
|
|
4322
|
+
|
|
4323
|
+
Stacking: the overlay is FIRST in DOM order so it paints first
|
|
4324
|
+
(behind), the textarea is SECOND so it paints second (on top). No
|
|
4325
|
+
explicit z-index — DOM order alone determines stacking inside the
|
|
4326
|
+
parent's stacking context. The textarea has `color: transparent`
|
|
4327
|
+
plus `WebkitTextFillColor: transparent` (Safari) so its glyphs
|
|
4328
|
+
never paint, but the caret stays visible via `caretColor`.
|
|
4297
4329
|
|
|
4298
|
-
Scroll sync:
|
|
4299
|
-
|
|
4330
|
+
Scroll sync: textarea scrolls naturally; `handleEditableScroll`
|
|
4331
|
+
mirrors its scrollTop/scrollLeft onto the overlay div so the
|
|
4332
|
+
highlighted spans stay aligned with the textarea content.
|
|
4333
|
+
|
|
4334
|
+
Error highlights (GAP-80): `errorLines` prop accepts a Map of
|
|
4335
|
+
1-based line numbers → severity. The overlay's SyntaxHighlighter
|
|
4336
|
+
uses `wrapLines` + `lineProps` to paint a colored background on
|
|
4337
|
+
those lines. */
|
|
4300
4338
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
4301
4339
|
Box,
|
|
4302
4340
|
{
|
|
4303
4341
|
style: {
|
|
4304
4342
|
position: "relative",
|
|
4305
|
-
|
|
4306
|
-
borderRadius: hasHeader ? "0 0 0.5rem 0.5rem" : "0.5rem",
|
|
4343
|
+
height: "100%",
|
|
4307
4344
|
minHeight: "160px",
|
|
4308
4345
|
maxHeight,
|
|
4346
|
+
backgroundColor: "#1e1e1e",
|
|
4347
|
+
borderRadius: hasHeader ? "0 0 0.5rem 0.5rem" : "0.5rem",
|
|
4309
4348
|
overflow: "hidden"
|
|
4310
4349
|
},
|
|
4311
4350
|
children: [
|
|
@@ -4316,10 +4355,12 @@ var CodeBlock = React114__namespace.default.memo(
|
|
|
4316
4355
|
"aria-hidden": true,
|
|
4317
4356
|
style: {
|
|
4318
4357
|
position: "absolute",
|
|
4319
|
-
|
|
4358
|
+
top: 0,
|
|
4359
|
+
left: 0,
|
|
4360
|
+
width: "100%",
|
|
4361
|
+
height: "100%",
|
|
4320
4362
|
overflow: "hidden",
|
|
4321
|
-
pointerEvents: "none"
|
|
4322
|
-
maxHeight
|
|
4363
|
+
pointerEvents: "none"
|
|
4323
4364
|
},
|
|
4324
4365
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4325
4366
|
SyntaxHighlighter__default.default,
|
|
@@ -4327,6 +4368,8 @@ var CodeBlock = React114__namespace.default.memo(
|
|
|
4327
4368
|
PreTag: "div",
|
|
4328
4369
|
language,
|
|
4329
4370
|
style: activeStyle,
|
|
4371
|
+
wrapLines: errorLines && errorLines.size > 0,
|
|
4372
|
+
lineProps: errorLineProps,
|
|
4330
4373
|
customStyle: {
|
|
4331
4374
|
backgroundColor: "transparent",
|
|
4332
4375
|
borderRadius: 0,
|
|
@@ -4334,7 +4377,6 @@ var CodeBlock = React114__namespace.default.memo(
|
|
|
4334
4377
|
margin: 0,
|
|
4335
4378
|
whiteSpace: "pre",
|
|
4336
4379
|
minWidth: "100%",
|
|
4337
|
-
minHeight: "160px",
|
|
4338
4380
|
fontFamily: 'ui-monospace, SFMono-Regular, Menlo, Monaco, "Cascadia Mono", "Courier New", monospace',
|
|
4339
4381
|
fontSize: "13px",
|
|
4340
4382
|
lineHeight: "1.5"
|
|
@@ -4363,23 +4405,23 @@ var CodeBlock = React114__namespace.default.memo(
|
|
|
4363
4405
|
onScroll: handleEditableScroll,
|
|
4364
4406
|
spellCheck: false,
|
|
4365
4407
|
style: {
|
|
4366
|
-
position: "
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
fontSize: "13px",
|
|
4370
|
-
lineHeight: "1.5",
|
|
4371
|
-
backgroundColor: "transparent",
|
|
4372
|
-
color: "transparent",
|
|
4373
|
-
caretColor: "#e6e6e6",
|
|
4374
|
-
borderRadius: hasHeader ? "0 0 0.5rem 0.5rem" : "0.5rem",
|
|
4375
|
-
border: "none",
|
|
4376
|
-
padding: "1rem",
|
|
4377
|
-
resize: "none",
|
|
4378
|
-
minHeight: "160px",
|
|
4379
|
-
maxHeight,
|
|
4408
|
+
position: "absolute",
|
|
4409
|
+
top: 0,
|
|
4410
|
+
left: 0,
|
|
4380
4411
|
width: "100%",
|
|
4381
4412
|
height: "100%",
|
|
4413
|
+
padding: "1rem",
|
|
4414
|
+
margin: 0,
|
|
4415
|
+
border: "none",
|
|
4382
4416
|
outline: "none",
|
|
4417
|
+
resize: "none",
|
|
4418
|
+
backgroundColor: "transparent",
|
|
4419
|
+
color: "transparent",
|
|
4420
|
+
caretColor: "#e6e6e6",
|
|
4421
|
+
WebkitTextFillColor: "transparent",
|
|
4422
|
+
fontFamily: 'ui-monospace, SFMono-Regular, Menlo, Monaco, "Cascadia Mono", "Courier New", monospace',
|
|
4423
|
+
fontSize: "13px",
|
|
4424
|
+
lineHeight: "1.5",
|
|
4383
4425
|
whiteSpace: "pre",
|
|
4384
4426
|
overflowWrap: "normal",
|
|
4385
4427
|
overflow: "auto"
|
|
@@ -4410,7 +4452,7 @@ var CodeBlock = React114__namespace.default.memo(
|
|
|
4410
4452
|
)
|
|
4411
4453
|
] });
|
|
4412
4454
|
},
|
|
4413
|
-
(prev, next) => prev.language === next.language && prev.code === next.code && prev.showCopyButton === next.showCopyButton && prev.maxHeight === next.maxHeight && prev.foldable === next.foldable && prev.editable === next.editable && prev.onChange === next.onChange
|
|
4455
|
+
(prev, next) => prev.language === next.language && prev.code === next.code && prev.showCopyButton === next.showCopyButton && prev.maxHeight === next.maxHeight && prev.foldable === next.foldable && prev.editable === next.editable && prev.onChange === next.onChange && prev.errorLines === next.errorLines
|
|
4414
4456
|
);
|
|
4415
4457
|
CodeBlock.displayName = "CodeBlock";
|
|
4416
4458
|
|
package/dist/providers/index.js
CHANGED
|
@@ -4051,7 +4051,8 @@ var CodeBlock = React114__default.memo(
|
|
|
4051
4051
|
foldable: foldableProp,
|
|
4052
4052
|
className,
|
|
4053
4053
|
editable = false,
|
|
4054
|
-
onChange
|
|
4054
|
+
onChange,
|
|
4055
|
+
errorLines
|
|
4055
4056
|
}) => {
|
|
4056
4057
|
const code = typeof rawCode === "string" ? rawCode : String(rawCode ?? "");
|
|
4057
4058
|
const isOrb = language === "orb";
|
|
@@ -4083,6 +4084,28 @@ var CodeBlock = React114__default.memo(
|
|
|
4083
4084
|
ov.scrollLeft = ta.scrollLeft;
|
|
4084
4085
|
}
|
|
4085
4086
|
}, []);
|
|
4087
|
+
const errorLineProps = useMemo(() => {
|
|
4088
|
+
if (!errorLines || errorLines.size === 0) {
|
|
4089
|
+
return LINE_PROPS_FN;
|
|
4090
|
+
}
|
|
4091
|
+
return (lineNumber) => {
|
|
4092
|
+
const severity = errorLines.get(lineNumber);
|
|
4093
|
+
if (!severity) {
|
|
4094
|
+
return { "data-line": String(lineNumber - 1) };
|
|
4095
|
+
}
|
|
4096
|
+
return {
|
|
4097
|
+
"data-line": String(lineNumber - 1),
|
|
4098
|
+
style: {
|
|
4099
|
+
display: "block",
|
|
4100
|
+
backgroundColor: severity === "error" ? "rgba(248, 113, 113, 0.18)" : "rgba(251, 191, 36, 0.18)",
|
|
4101
|
+
// amber-400 @ 18%
|
|
4102
|
+
borderLeft: `3px solid ${severity === "error" ? "#ef4444" : "#f59e0b"}`,
|
|
4103
|
+
paddingLeft: "0.5rem",
|
|
4104
|
+
marginLeft: "-0.5rem"
|
|
4105
|
+
}
|
|
4106
|
+
};
|
|
4107
|
+
};
|
|
4108
|
+
}, [errorLines]);
|
|
4086
4109
|
const isFoldable = foldableProp ?? (language === "orb" || language === "json");
|
|
4087
4110
|
const [collapsed, setCollapsed] = useState(() => /* @__PURE__ */ new Set());
|
|
4088
4111
|
const foldRegions = useMemo(
|
|
@@ -4243,24 +4266,40 @@ var CodeBlock = React114__default.memo(
|
|
|
4243
4266
|
}
|
|
4244
4267
|
),
|
|
4245
4268
|
editable ? (
|
|
4246
|
-
/* GAP-77: editable mode = transparent
|
|
4247
|
-
|
|
4248
|
-
|
|
4249
|
-
|
|
4250
|
-
|
|
4251
|
-
|
|
4269
|
+
/* GAP-77 / GAP-82 / GAP-83: editable mode = transparent textarea on
|
|
4270
|
+
top of a Prism-highlighted SyntaxHighlighter overlay.
|
|
4271
|
+
|
|
4272
|
+
Layout: BOTH children are `position: absolute, inset: 0` so neither
|
|
4273
|
+
contributes to flow. The parent Box has `height: 100%` so it fills
|
|
4274
|
+
whatever container the consumer provides (the consumer is
|
|
4275
|
+
responsible for giving the parent a real height — usually via flex
|
|
4276
|
+
column with `minHeight: 0`).
|
|
4277
|
+
|
|
4278
|
+
Stacking: the overlay is FIRST in DOM order so it paints first
|
|
4279
|
+
(behind), the textarea is SECOND so it paints second (on top). No
|
|
4280
|
+
explicit z-index — DOM order alone determines stacking inside the
|
|
4281
|
+
parent's stacking context. The textarea has `color: transparent`
|
|
4282
|
+
plus `WebkitTextFillColor: transparent` (Safari) so its glyphs
|
|
4283
|
+
never paint, but the caret stays visible via `caretColor`.
|
|
4252
4284
|
|
|
4253
|
-
Scroll sync:
|
|
4254
|
-
|
|
4285
|
+
Scroll sync: textarea scrolls naturally; `handleEditableScroll`
|
|
4286
|
+
mirrors its scrollTop/scrollLeft onto the overlay div so the
|
|
4287
|
+
highlighted spans stay aligned with the textarea content.
|
|
4288
|
+
|
|
4289
|
+
Error highlights (GAP-80): `errorLines` prop accepts a Map of
|
|
4290
|
+
1-based line numbers → severity. The overlay's SyntaxHighlighter
|
|
4291
|
+
uses `wrapLines` + `lineProps` to paint a colored background on
|
|
4292
|
+
those lines. */
|
|
4255
4293
|
/* @__PURE__ */ jsxs(
|
|
4256
4294
|
Box,
|
|
4257
4295
|
{
|
|
4258
4296
|
style: {
|
|
4259
4297
|
position: "relative",
|
|
4260
|
-
|
|
4261
|
-
borderRadius: hasHeader ? "0 0 0.5rem 0.5rem" : "0.5rem",
|
|
4298
|
+
height: "100%",
|
|
4262
4299
|
minHeight: "160px",
|
|
4263
4300
|
maxHeight,
|
|
4301
|
+
backgroundColor: "#1e1e1e",
|
|
4302
|
+
borderRadius: hasHeader ? "0 0 0.5rem 0.5rem" : "0.5rem",
|
|
4264
4303
|
overflow: "hidden"
|
|
4265
4304
|
},
|
|
4266
4305
|
children: [
|
|
@@ -4271,10 +4310,12 @@ var CodeBlock = React114__default.memo(
|
|
|
4271
4310
|
"aria-hidden": true,
|
|
4272
4311
|
style: {
|
|
4273
4312
|
position: "absolute",
|
|
4274
|
-
|
|
4313
|
+
top: 0,
|
|
4314
|
+
left: 0,
|
|
4315
|
+
width: "100%",
|
|
4316
|
+
height: "100%",
|
|
4275
4317
|
overflow: "hidden",
|
|
4276
|
-
pointerEvents: "none"
|
|
4277
|
-
maxHeight
|
|
4318
|
+
pointerEvents: "none"
|
|
4278
4319
|
},
|
|
4279
4320
|
children: /* @__PURE__ */ jsx(
|
|
4280
4321
|
SyntaxHighlighter,
|
|
@@ -4282,6 +4323,8 @@ var CodeBlock = React114__default.memo(
|
|
|
4282
4323
|
PreTag: "div",
|
|
4283
4324
|
language,
|
|
4284
4325
|
style: activeStyle,
|
|
4326
|
+
wrapLines: errorLines && errorLines.size > 0,
|
|
4327
|
+
lineProps: errorLineProps,
|
|
4285
4328
|
customStyle: {
|
|
4286
4329
|
backgroundColor: "transparent",
|
|
4287
4330
|
borderRadius: 0,
|
|
@@ -4289,7 +4332,6 @@ var CodeBlock = React114__default.memo(
|
|
|
4289
4332
|
margin: 0,
|
|
4290
4333
|
whiteSpace: "pre",
|
|
4291
4334
|
minWidth: "100%",
|
|
4292
|
-
minHeight: "160px",
|
|
4293
4335
|
fontFamily: 'ui-monospace, SFMono-Regular, Menlo, Monaco, "Cascadia Mono", "Courier New", monospace',
|
|
4294
4336
|
fontSize: "13px",
|
|
4295
4337
|
lineHeight: "1.5"
|
|
@@ -4318,23 +4360,23 @@ var CodeBlock = React114__default.memo(
|
|
|
4318
4360
|
onScroll: handleEditableScroll,
|
|
4319
4361
|
spellCheck: false,
|
|
4320
4362
|
style: {
|
|
4321
|
-
position: "
|
|
4322
|
-
|
|
4323
|
-
|
|
4324
|
-
fontSize: "13px",
|
|
4325
|
-
lineHeight: "1.5",
|
|
4326
|
-
backgroundColor: "transparent",
|
|
4327
|
-
color: "transparent",
|
|
4328
|
-
caretColor: "#e6e6e6",
|
|
4329
|
-
borderRadius: hasHeader ? "0 0 0.5rem 0.5rem" : "0.5rem",
|
|
4330
|
-
border: "none",
|
|
4331
|
-
padding: "1rem",
|
|
4332
|
-
resize: "none",
|
|
4333
|
-
minHeight: "160px",
|
|
4334
|
-
maxHeight,
|
|
4363
|
+
position: "absolute",
|
|
4364
|
+
top: 0,
|
|
4365
|
+
left: 0,
|
|
4335
4366
|
width: "100%",
|
|
4336
4367
|
height: "100%",
|
|
4368
|
+
padding: "1rem",
|
|
4369
|
+
margin: 0,
|
|
4370
|
+
border: "none",
|
|
4337
4371
|
outline: "none",
|
|
4372
|
+
resize: "none",
|
|
4373
|
+
backgroundColor: "transparent",
|
|
4374
|
+
color: "transparent",
|
|
4375
|
+
caretColor: "#e6e6e6",
|
|
4376
|
+
WebkitTextFillColor: "transparent",
|
|
4377
|
+
fontFamily: 'ui-monospace, SFMono-Regular, Menlo, Monaco, "Cascadia Mono", "Courier New", monospace',
|
|
4378
|
+
fontSize: "13px",
|
|
4379
|
+
lineHeight: "1.5",
|
|
4338
4380
|
whiteSpace: "pre",
|
|
4339
4381
|
overflowWrap: "normal",
|
|
4340
4382
|
overflow: "auto"
|
|
@@ -4365,7 +4407,7 @@ var CodeBlock = React114__default.memo(
|
|
|
4365
4407
|
)
|
|
4366
4408
|
] });
|
|
4367
4409
|
},
|
|
4368
|
-
(prev, next) => prev.language === next.language && prev.code === next.code && prev.showCopyButton === next.showCopyButton && prev.maxHeight === next.maxHeight && prev.foldable === next.foldable && prev.editable === next.editable && prev.onChange === next.onChange
|
|
4410
|
+
(prev, next) => prev.language === next.language && prev.code === next.code && prev.showCopyButton === next.showCopyButton && prev.maxHeight === next.maxHeight && prev.foldable === next.foldable && prev.editable === next.editable && prev.onChange === next.onChange && prev.errorLines === next.errorLines
|
|
4369
4411
|
);
|
|
4370
4412
|
CodeBlock.displayName = "CodeBlock";
|
|
4371
4413
|
|