@almadar/ui 6.8.0 → 6.9.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 +527 -46
- package/dist/avl/index.js +527 -46
- package/dist/{cn-sgpqpN0U.d.ts → cn-C7fvp9gH.d.ts} +37 -10
- package/dist/{cn-CCjFspAo.d.cts → cn-DnLYahyL.d.cts} +37 -10
- package/dist/components/index.cjs +557 -47
- package/dist/components/index.d.cts +8 -6
- package/dist/components/index.d.ts +8 -6
- package/dist/components/index.js +556 -48
- package/dist/hooks/index.cjs +30 -1
- package/dist/hooks/index.d.cts +2 -2
- package/dist/hooks/index.d.ts +2 -2
- package/dist/hooks/index.js +29 -2
- package/dist/lib/drawable/three/index.cjs +21 -2
- package/dist/lib/drawable/three/index.js +21 -2
- package/dist/lib/index.cjs +238 -9
- package/dist/lib/index.d.cts +1 -1
- package/dist/lib/index.d.ts +1 -1
- package/dist/lib/index.js +234 -10
- package/dist/marketing/index.cjs +12 -3
- package/dist/marketing/index.js +12 -3
- package/dist/providers/index.cjs +527 -46
- package/dist/providers/index.js +527 -46
- package/dist/runtime/index.cjs +541 -50
- package/dist/runtime/index.d.cts +7 -2
- package/dist/runtime/index.d.ts +7 -2
- package/dist/runtime/index.js +541 -50
- package/dist/{useKeyboardRouter-D84cNWmA.d.ts → useKeyboardRouter-B1pIi9jo.d.ts} +11 -1
- package/dist/{useKeyboardRouter-DQEE_9mq.d.cts → useKeyboardRouter-CVn8lfiX.d.cts} +11 -1
- package/package.json +3 -3
package/dist/components/index.js
CHANGED
|
@@ -1699,7 +1699,7 @@ var init_Button = __esm({
|
|
|
1699
1699
|
secondary: [
|
|
1700
1700
|
"bg-transparent text-accent",
|
|
1701
1701
|
"border border-accent",
|
|
1702
|
-
"hover:bg-accent hover:text-
|
|
1702
|
+
"hover:bg-accent hover:text-accent-foreground hover:border-accent",
|
|
1703
1703
|
"active:scale-[var(--active-scale)]"
|
|
1704
1704
|
].join(" "),
|
|
1705
1705
|
ghost: [
|
|
@@ -4150,8 +4150,17 @@ var init_Typography = __esm({
|
|
|
4150
4150
|
weight && weightStyles[weight],
|
|
4151
4151
|
size && typographySizeStyles[size],
|
|
4152
4152
|
align && `text-${align}`,
|
|
4153
|
-
|
|
4154
|
-
|
|
4153
|
+
// `min-w-0` rides along with truncate/wrap/clamp: a flex or grid
|
|
4154
|
+
// item's default `min-width: auto` refuses to shrink below its
|
|
4155
|
+
// content's intrinsic width, so ellipsis/wrap silently does nothing
|
|
4156
|
+
// in the single most common placement (a row next to a fixed-width
|
|
4157
|
+
// control) unless the item can also shrink to zero. (Spelled out as
|
|
4158
|
+
// just "truncate", not "truncate overflow-hidden text-ellipsis" —
|
|
4159
|
+
// tailwind-merge treats those as the same conflict group and drops
|
|
4160
|
+
// "truncate" as the earlier-declared class, silently losing its
|
|
4161
|
+
// `white-space: nowrap`.)
|
|
4162
|
+
truncate && "truncate min-w-0",
|
|
4163
|
+
overflow && cn(overflowStyles2[overflow], overflow !== "visible" && "min-w-0"),
|
|
4155
4164
|
className
|
|
4156
4165
|
),
|
|
4157
4166
|
style
|
|
@@ -13326,6 +13335,12 @@ var init_EmptyState = __esm({
|
|
|
13326
13335
|
});
|
|
13327
13336
|
|
|
13328
13337
|
// lib/editorMotions.ts
|
|
13338
|
+
function isEditorMotion(value) {
|
|
13339
|
+
return EDITOR_MOTION_SET.has(value);
|
|
13340
|
+
}
|
|
13341
|
+
function isEditorOperator(value) {
|
|
13342
|
+
return EDITOR_OPERATOR_SET.has(value);
|
|
13343
|
+
}
|
|
13329
13344
|
function clamp(value, min, max) {
|
|
13330
13345
|
return Math.max(min, Math.min(max, value));
|
|
13331
13346
|
}
|
|
@@ -13393,6 +13408,30 @@ function prevParagraphBoundary(lines, fromLineIdx) {
|
|
|
13393
13408
|
}
|
|
13394
13409
|
return 0;
|
|
13395
13410
|
}
|
|
13411
|
+
function matchBracket(text, pos) {
|
|
13412
|
+
const ch = text[pos];
|
|
13413
|
+
const partner = ch !== void 0 ? BRACKET_PARTNER[ch] : void 0;
|
|
13414
|
+
if (partner === void 0) return null;
|
|
13415
|
+
let depth = 1;
|
|
13416
|
+
if (OPEN_BRACKETS.has(ch)) {
|
|
13417
|
+
for (let i = pos + 1; i < text.length; i++) {
|
|
13418
|
+
if (text[i] === ch) depth++;
|
|
13419
|
+
else if (text[i] === partner) {
|
|
13420
|
+
depth--;
|
|
13421
|
+
if (depth === 0) return i;
|
|
13422
|
+
}
|
|
13423
|
+
}
|
|
13424
|
+
} else {
|
|
13425
|
+
for (let i = pos - 1; i >= 0; i--) {
|
|
13426
|
+
if (text[i] === ch) depth++;
|
|
13427
|
+
else if (text[i] === partner) {
|
|
13428
|
+
depth--;
|
|
13429
|
+
if (depth === 0) return i;
|
|
13430
|
+
}
|
|
13431
|
+
}
|
|
13432
|
+
}
|
|
13433
|
+
return null;
|
|
13434
|
+
}
|
|
13396
13435
|
function applyMotion(text, caret, motion, count) {
|
|
13397
13436
|
const n = Math.max(1, count);
|
|
13398
13437
|
const lines = computeLines(text);
|
|
@@ -13454,6 +13493,20 @@ function applyMotion(text, caret, motion, count) {
|
|
|
13454
13493
|
}
|
|
13455
13494
|
return pos;
|
|
13456
13495
|
}
|
|
13496
|
+
case "match-bracket": {
|
|
13497
|
+
const chAtCaret = text[caret];
|
|
13498
|
+
if (chAtCaret !== void 0 && BRACKET_PARTNER[chAtCaret] !== void 0) {
|
|
13499
|
+
const target = matchBracket(text, caret);
|
|
13500
|
+
return target === null ? caret : target;
|
|
13501
|
+
}
|
|
13502
|
+
for (let i = caret; i < line.end; i++) {
|
|
13503
|
+
if (BRACKET_PARTNER[text[i]] !== void 0) {
|
|
13504
|
+
const target = matchBracket(text, i);
|
|
13505
|
+
return target === null ? caret : target;
|
|
13506
|
+
}
|
|
13507
|
+
}
|
|
13508
|
+
return caret;
|
|
13509
|
+
}
|
|
13457
13510
|
case "line":
|
|
13458
13511
|
case "selection":
|
|
13459
13512
|
return caret;
|
|
@@ -13481,8 +13534,8 @@ function motionRange(text, caret, motion, count, selection) {
|
|
|
13481
13534
|
const newCaret = applyMotion(text, caret, motion, count);
|
|
13482
13535
|
let start = Math.min(caret, newCaret);
|
|
13483
13536
|
let end = Math.max(caret, newCaret);
|
|
13484
|
-
if (motion === "word-end" || motion === "line-end") {
|
|
13485
|
-
end = Math.min(Math.max(
|
|
13537
|
+
if ((motion === "word-end" || motion === "line-end" || motion === "match-bracket") && newCaret !== caret) {
|
|
13538
|
+
end = Math.min(Math.max(caret, newCaret) + 1, text.length);
|
|
13486
13539
|
} else if (motion === "word-forward" && newCaret > caret) {
|
|
13487
13540
|
const startLine = lineIndexAt(lines, caret);
|
|
13488
13541
|
const endLine = lineIndexAt(lines, newCaret);
|
|
@@ -13492,17 +13545,198 @@ function motionRange(text, caret, motion, count, selection) {
|
|
|
13492
13545
|
}
|
|
13493
13546
|
return [start, end];
|
|
13494
13547
|
}
|
|
13495
|
-
function
|
|
13496
|
-
|
|
13497
|
-
|
|
13498
|
-
|
|
13499
|
-
|
|
13500
|
-
|
|
13548
|
+
function toggleCase(s) {
|
|
13549
|
+
return s.replace(/[a-zA-Z]/g, (c) => c === c.toUpperCase() ? c.toLowerCase() : c.toUpperCase());
|
|
13550
|
+
}
|
|
13551
|
+
function applyJoin(text, caret, count, register, registerLinewise) {
|
|
13552
|
+
const lines = computeLines(text);
|
|
13553
|
+
const startIdx = lineIndexAt(lines, caret);
|
|
13554
|
+
const n = Math.max(2, count);
|
|
13555
|
+
const endIdx = clamp(startIdx + n - 1, 0, lines.length - 1);
|
|
13556
|
+
if (endIdx <= startIdx) {
|
|
13557
|
+
return { text, caret, register, registerLinewise };
|
|
13558
|
+
}
|
|
13559
|
+
const joinCaret = lines[startIdx].end;
|
|
13560
|
+
let joined = text.slice(lines[startIdx].start, lines[startIdx].end);
|
|
13561
|
+
for (let i = startIdx + 1; i <= endIdx; i++) {
|
|
13562
|
+
const raw = text.slice(lines[i].start, lines[i].end);
|
|
13563
|
+
joined += " " + raw.replace(/^[ \t]+/, "");
|
|
13564
|
+
}
|
|
13565
|
+
const newText = text.slice(0, lines[startIdx].start) + joined + text.slice(lines[endIdx].end);
|
|
13566
|
+
return { text: newText, caret: joinCaret, register, registerLinewise };
|
|
13567
|
+
}
|
|
13568
|
+
function applyIndent(text, start, end, operator, register, registerLinewise) {
|
|
13569
|
+
const lines = computeLines(text);
|
|
13570
|
+
const startLineIdx = lineIndexAt(lines, start);
|
|
13571
|
+
const lastTouchedPos = end > start ? end - 1 : start;
|
|
13572
|
+
const endLineIdx = lineIndexAt(lines, lastTouchedPos);
|
|
13573
|
+
let result = text;
|
|
13574
|
+
for (let i = endLineIdx; i >= startLineIdx; i--) {
|
|
13575
|
+
const lineStart = lines[i].start;
|
|
13576
|
+
if (operator === "indent") {
|
|
13577
|
+
result = result.slice(0, lineStart) + INDENT_UNIT + result.slice(lineStart);
|
|
13578
|
+
} else if (result[lineStart] === " ") {
|
|
13579
|
+
result = result.slice(0, lineStart) + result.slice(lineStart + 1);
|
|
13580
|
+
} else {
|
|
13581
|
+
let removeCount = 0;
|
|
13582
|
+
while (removeCount < INDENT_UNIT.length && result[lineStart + removeCount] === " ") removeCount++;
|
|
13583
|
+
result = result.slice(0, lineStart) + result.slice(lineStart + removeCount);
|
|
13584
|
+
}
|
|
13501
13585
|
}
|
|
13502
|
-
|
|
13586
|
+
const newLines = computeLines(result);
|
|
13587
|
+
const caret = firstNonBlank(result, newLines[startLineIdx]);
|
|
13588
|
+
return { text: result, caret, register, registerLinewise };
|
|
13503
13589
|
}
|
|
13590
|
+
function applyPut(text, caret, operator, register, registerLinewise, count) {
|
|
13591
|
+
if (register.length === 0) {
|
|
13592
|
+
return { text, caret, register, registerLinewise };
|
|
13593
|
+
}
|
|
13594
|
+
const content = register.repeat(count);
|
|
13595
|
+
const lines = computeLines(text);
|
|
13596
|
+
const line = lines[lineIndexAt(lines, caret)];
|
|
13597
|
+
if (registerLinewise) {
|
|
13598
|
+
if (operator === "put-before") {
|
|
13599
|
+
const insertPos3 = line.start;
|
|
13600
|
+
return {
|
|
13601
|
+
text: text.slice(0, insertPos3) + content + text.slice(insertPos3),
|
|
13602
|
+
caret: insertPos3,
|
|
13603
|
+
register,
|
|
13604
|
+
registerLinewise
|
|
13605
|
+
};
|
|
13606
|
+
}
|
|
13607
|
+
const nextLineIdx = lineIndexAt(lines, caret) + 1;
|
|
13608
|
+
if (nextLineIdx < lines.length) {
|
|
13609
|
+
const insertPos3 = lines[nextLineIdx].start;
|
|
13610
|
+
return {
|
|
13611
|
+
text: text.slice(0, insertPos3) + content + text.slice(insertPos3),
|
|
13612
|
+
caret: insertPos3,
|
|
13613
|
+
register,
|
|
13614
|
+
registerLinewise
|
|
13615
|
+
};
|
|
13616
|
+
}
|
|
13617
|
+
const insertPos2 = text.length;
|
|
13618
|
+
return {
|
|
13619
|
+
text: text.slice(0, insertPos2) + "\n" + content,
|
|
13620
|
+
caret: insertPos2 + 1,
|
|
13621
|
+
register,
|
|
13622
|
+
registerLinewise
|
|
13623
|
+
};
|
|
13624
|
+
}
|
|
13625
|
+
const insertPos = operator === "put-before" ? clamp(caret, 0, text.length) : clamp(caret + 1, line.start, line.end);
|
|
13626
|
+
return {
|
|
13627
|
+
text: text.slice(0, insertPos) + content + text.slice(insertPos),
|
|
13628
|
+
caret: insertPos + content.length - 1,
|
|
13629
|
+
register,
|
|
13630
|
+
registerLinewise
|
|
13631
|
+
};
|
|
13632
|
+
}
|
|
13633
|
+
function applyOperator(input) {
|
|
13634
|
+
const { text, caret, operator, motion, register, registerLinewise } = input;
|
|
13635
|
+
const count = Math.max(1, input.count);
|
|
13636
|
+
const start = clamp(input.range[0], 0, text.length);
|
|
13637
|
+
const end = clamp(input.range[1], start, text.length);
|
|
13638
|
+
switch (operator) {
|
|
13639
|
+
case "yank":
|
|
13640
|
+
return { text, caret: start, register: text.slice(start, end), registerLinewise: motion === "line" };
|
|
13641
|
+
case "delete":
|
|
13642
|
+
case "replace": {
|
|
13643
|
+
const removed = text.slice(start, end);
|
|
13644
|
+
return {
|
|
13645
|
+
text: text.slice(0, start) + text.slice(end),
|
|
13646
|
+
caret: start,
|
|
13647
|
+
register: removed,
|
|
13648
|
+
registerLinewise: motion === "line"
|
|
13649
|
+
};
|
|
13650
|
+
}
|
|
13651
|
+
case "change": {
|
|
13652
|
+
if (motion === "line") {
|
|
13653
|
+
const hasTrailingNewline = end > start && text[end - 1] === "\n";
|
|
13654
|
+
const removeEnd = hasTrailingNewline ? end - 1 : end;
|
|
13655
|
+
const removed2 = text.slice(start, removeEnd);
|
|
13656
|
+
return {
|
|
13657
|
+
text: text.slice(0, start) + text.slice(removeEnd),
|
|
13658
|
+
caret: start,
|
|
13659
|
+
register: removed2,
|
|
13660
|
+
registerLinewise: true
|
|
13661
|
+
};
|
|
13662
|
+
}
|
|
13663
|
+
const removed = text.slice(start, end);
|
|
13664
|
+
return {
|
|
13665
|
+
text: text.slice(0, start) + text.slice(end),
|
|
13666
|
+
caret: start,
|
|
13667
|
+
register: removed,
|
|
13668
|
+
registerLinewise: false
|
|
13669
|
+
};
|
|
13670
|
+
}
|
|
13671
|
+
case "put":
|
|
13672
|
+
case "put-before":
|
|
13673
|
+
return applyPut(text, caret, operator, register, registerLinewise, count);
|
|
13674
|
+
case "join":
|
|
13675
|
+
return applyJoin(text, caret, count, register, registerLinewise);
|
|
13676
|
+
case "toggle-case": {
|
|
13677
|
+
const toggled = toggleCase(text.slice(start, end));
|
|
13678
|
+
return { text: text.slice(0, start) + toggled + text.slice(end), caret: end, register, registerLinewise };
|
|
13679
|
+
}
|
|
13680
|
+
case "indent":
|
|
13681
|
+
case "dedent":
|
|
13682
|
+
return applyIndent(text, start, end, operator, register, registerLinewise);
|
|
13683
|
+
case "undo":
|
|
13684
|
+
case "redo":
|
|
13685
|
+
return { text, caret, register, registerLinewise };
|
|
13686
|
+
default: {
|
|
13687
|
+
const _exhaustive = operator;
|
|
13688
|
+
return _exhaustive;
|
|
13689
|
+
}
|
|
13690
|
+
}
|
|
13691
|
+
}
|
|
13692
|
+
var EDITOR_MOTIONS, EDITOR_OPERATORS, EDITOR_MOTION_SET, EDITOR_OPERATOR_SET, INDENT_UNIT, BRACKET_PARTNER, OPEN_BRACKETS;
|
|
13504
13693
|
var init_editorMotions = __esm({
|
|
13505
13694
|
"lib/editorMotions.ts"() {
|
|
13695
|
+
EDITOR_MOTIONS = [
|
|
13696
|
+
"left",
|
|
13697
|
+
"right",
|
|
13698
|
+
"up",
|
|
13699
|
+
"down",
|
|
13700
|
+
"word-forward",
|
|
13701
|
+
"word-back",
|
|
13702
|
+
"word-end",
|
|
13703
|
+
"line-start",
|
|
13704
|
+
"line-end",
|
|
13705
|
+
"first-nonblank",
|
|
13706
|
+
"doc-start",
|
|
13707
|
+
"doc-end",
|
|
13708
|
+
"paragraph-forward",
|
|
13709
|
+
"paragraph-back",
|
|
13710
|
+
"line",
|
|
13711
|
+
"selection",
|
|
13712
|
+
"match-bracket"
|
|
13713
|
+
];
|
|
13714
|
+
EDITOR_OPERATORS = [
|
|
13715
|
+
"delete",
|
|
13716
|
+
"yank",
|
|
13717
|
+
"change",
|
|
13718
|
+
"put",
|
|
13719
|
+
"put-before",
|
|
13720
|
+
"undo",
|
|
13721
|
+
"redo",
|
|
13722
|
+
"join",
|
|
13723
|
+
"toggle-case",
|
|
13724
|
+
"indent",
|
|
13725
|
+
"dedent",
|
|
13726
|
+
"replace"
|
|
13727
|
+
];
|
|
13728
|
+
EDITOR_MOTION_SET = new Set(EDITOR_MOTIONS);
|
|
13729
|
+
EDITOR_OPERATOR_SET = new Set(EDITOR_OPERATORS);
|
|
13730
|
+
INDENT_UNIT = " ";
|
|
13731
|
+
BRACKET_PARTNER = {
|
|
13732
|
+
"(": ")",
|
|
13733
|
+
")": "(",
|
|
13734
|
+
"[": "]",
|
|
13735
|
+
"]": "[",
|
|
13736
|
+
"{": "}",
|
|
13737
|
+
"}": "{"
|
|
13738
|
+
};
|
|
13739
|
+
OPEN_BRACKETS = /* @__PURE__ */ new Set(["(", "[", "{"]);
|
|
13506
13740
|
}
|
|
13507
13741
|
});
|
|
13508
13742
|
function isMotionPayload(payload) {
|
|
@@ -13517,14 +13751,103 @@ function isInsertTextPayload(payload) {
|
|
|
13517
13751
|
function isSetModePayload(payload) {
|
|
13518
13752
|
return !!payload && typeof payload.editorId === "string" && typeof payload.mode === "string" && typeof payload.caret === "string";
|
|
13519
13753
|
}
|
|
13754
|
+
function typedDelta(prev, next) {
|
|
13755
|
+
const maxPrefix = Math.min(prev.length, next.length);
|
|
13756
|
+
let prefixLen = 0;
|
|
13757
|
+
while (prefixLen < maxPrefix && prev[prefixLen] === next[prefixLen]) prefixLen++;
|
|
13758
|
+
const maxSuffix = Math.min(prev.length - prefixLen, next.length - prefixLen);
|
|
13759
|
+
let suffixLen = 0;
|
|
13760
|
+
while (suffixLen < maxSuffix && prev[prev.length - 1 - suffixLen] === next[next.length - 1 - suffixLen]) {
|
|
13761
|
+
suffixLen++;
|
|
13762
|
+
}
|
|
13763
|
+
const removed = prev.slice(prefixLen, prev.length - suffixLen);
|
|
13764
|
+
const inserted = next.slice(prefixLen, next.length - suffixLen);
|
|
13765
|
+
return removed + inserted;
|
|
13766
|
+
}
|
|
13520
13767
|
function useEditorCapabilities(args) {
|
|
13521
13768
|
const [caretMode, setCaretMode] = useState("bar");
|
|
13522
13769
|
const registerRef = useRef("");
|
|
13770
|
+
const registerLinewiseRef = useRef(false);
|
|
13771
|
+
const pastRef = useRef([]);
|
|
13772
|
+
const futureRef = useRef([]);
|
|
13773
|
+
const openTypingStepRef = useRef(false);
|
|
13774
|
+
const insertSessionOpenRef = useRef(false);
|
|
13775
|
+
const closeOpenTypingStep = useCallback(() => {
|
|
13776
|
+
openTypingStepRef.current = false;
|
|
13777
|
+
}, []);
|
|
13778
|
+
const pushHistoryStep = useCallback(
|
|
13779
|
+
(text, caret) => {
|
|
13780
|
+
closeOpenTypingStep();
|
|
13781
|
+
pastRef.current.push({ text, caret });
|
|
13782
|
+
futureRef.current = [];
|
|
13783
|
+
},
|
|
13784
|
+
[closeOpenTypingStep]
|
|
13785
|
+
);
|
|
13786
|
+
const recordKeystroke = useCallback(
|
|
13787
|
+
(prevText, prevCaret, nextText) => {
|
|
13788
|
+
if (!openTypingStepRef.current) {
|
|
13789
|
+
pastRef.current.push({ text: prevText, caret: prevCaret });
|
|
13790
|
+
futureRef.current = [];
|
|
13791
|
+
openTypingStepRef.current = true;
|
|
13792
|
+
}
|
|
13793
|
+
if (!insertSessionOpenRef.current && /\s/.test(typedDelta(prevText, nextText))) {
|
|
13794
|
+
openTypingStepRef.current = false;
|
|
13795
|
+
}
|
|
13796
|
+
},
|
|
13797
|
+
[]
|
|
13798
|
+
);
|
|
13799
|
+
const performUndo = useCallback(
|
|
13800
|
+
(count) => {
|
|
13801
|
+
const ta = args.textareaRef.current;
|
|
13802
|
+
if (!ta) return;
|
|
13803
|
+
closeOpenTypingStep();
|
|
13804
|
+
let moved = false;
|
|
13805
|
+
for (let i = 0; i < Math.max(1, count) && pastRef.current.length > 0; i++) {
|
|
13806
|
+
const prev = pastRef.current.pop();
|
|
13807
|
+
futureRef.current.push({ text: ta.value, caret: ta.selectionStart });
|
|
13808
|
+
ta.value = prev.text;
|
|
13809
|
+
ta.setSelectionRange(prev.caret, prev.caret);
|
|
13810
|
+
moved = true;
|
|
13811
|
+
}
|
|
13812
|
+
if (moved) args.applyChange(ta.value, "capability");
|
|
13813
|
+
},
|
|
13814
|
+
[args, closeOpenTypingStep]
|
|
13815
|
+
);
|
|
13816
|
+
const performRedo = useCallback(
|
|
13817
|
+
(count) => {
|
|
13818
|
+
const ta = args.textareaRef.current;
|
|
13819
|
+
if (!ta) return;
|
|
13820
|
+
closeOpenTypingStep();
|
|
13821
|
+
let moved = false;
|
|
13822
|
+
for (let i = 0; i < Math.max(1, count) && futureRef.current.length > 0; i++) {
|
|
13823
|
+
const next = futureRef.current.pop();
|
|
13824
|
+
pastRef.current.push({ text: ta.value, caret: ta.selectionStart });
|
|
13825
|
+
ta.value = next.text;
|
|
13826
|
+
ta.setSelectionRange(next.caret, next.caret);
|
|
13827
|
+
moved = true;
|
|
13828
|
+
}
|
|
13829
|
+
if (moved) args.applyChange(ta.value, "capability");
|
|
13830
|
+
},
|
|
13831
|
+
[args, closeOpenTypingStep]
|
|
13832
|
+
);
|
|
13833
|
+
const undo = useCallback(() => performUndo(1), [performUndo]);
|
|
13834
|
+
const redo = useCallback(() => performRedo(1), [performRedo]);
|
|
13835
|
+
const wasFocusedRef = useRef(args.focused);
|
|
13836
|
+
useEffect(() => {
|
|
13837
|
+
if (wasFocusedRef.current && !args.focused) {
|
|
13838
|
+
setCaretMode("bar");
|
|
13839
|
+
}
|
|
13840
|
+
wasFocusedRef.current = args.focused;
|
|
13841
|
+
}, [args.focused]);
|
|
13523
13842
|
useEventListener(`UI:${args.events.onMotion}`, (evt) => {
|
|
13524
13843
|
if (!args.editorId || !isMotionPayload(evt.payload) || evt.payload.editorId !== args.editorId) return;
|
|
13844
|
+
const { motion, count } = evt.payload;
|
|
13845
|
+
if (!isEditorMotion(motion)) {
|
|
13846
|
+
console.warn(`useEditorCapabilities: ignoring MOTION with unknown motion "${motion}"`);
|
|
13847
|
+
return;
|
|
13848
|
+
}
|
|
13525
13849
|
const ta = args.textareaRef.current;
|
|
13526
13850
|
if (!ta) return;
|
|
13527
|
-
const { motion, count } = evt.payload;
|
|
13528
13851
|
const newCaret = applyMotion(ta.value, ta.selectionStart, motion, count);
|
|
13529
13852
|
if (ta.selectionStart !== ta.selectionEnd) {
|
|
13530
13853
|
ta.setSelectionRange(ta.selectionStart, newCaret);
|
|
@@ -13534,32 +13857,63 @@ function useEditorCapabilities(args) {
|
|
|
13534
13857
|
});
|
|
13535
13858
|
useEventListener(`UI:${args.events.onOperate}`, (evt) => {
|
|
13536
13859
|
if (!args.editorId || !isOperatePayload(evt.payload) || evt.payload.editorId !== args.editorId) return;
|
|
13860
|
+
const { operator, motion, count } = evt.payload;
|
|
13861
|
+
if (!isEditorOperator(operator)) {
|
|
13862
|
+
console.warn(`useEditorCapabilities: ignoring OPERATE with unknown operator "${operator}"`);
|
|
13863
|
+
return;
|
|
13864
|
+
}
|
|
13865
|
+
if (!isEditorMotion(motion)) {
|
|
13866
|
+
console.warn(`useEditorCapabilities: ignoring OPERATE with unknown motion "${motion}"`);
|
|
13867
|
+
return;
|
|
13868
|
+
}
|
|
13537
13869
|
const ta = args.textareaRef.current;
|
|
13538
13870
|
if (!ta) return;
|
|
13539
|
-
|
|
13871
|
+
if (operator === "undo") {
|
|
13872
|
+
performUndo(count);
|
|
13873
|
+
return;
|
|
13874
|
+
}
|
|
13875
|
+
if (operator === "redo") {
|
|
13876
|
+
performRedo(count);
|
|
13877
|
+
return;
|
|
13878
|
+
}
|
|
13879
|
+
pushHistoryStep(ta.value, ta.selectionStart);
|
|
13540
13880
|
const selection = motion === "selection" ? [ta.selectionStart, ta.selectionEnd] : void 0;
|
|
13541
13881
|
const range = motionRange(ta.value, ta.selectionStart, motion, count, selection);
|
|
13542
|
-
const result = applyOperator(
|
|
13882
|
+
const result = applyOperator({
|
|
13883
|
+
text: ta.value,
|
|
13884
|
+
caret: ta.selectionStart,
|
|
13885
|
+
range,
|
|
13886
|
+
operator,
|
|
13887
|
+
motion,
|
|
13888
|
+
count,
|
|
13889
|
+
register: registerRef.current,
|
|
13890
|
+
registerLinewise: registerLinewiseRef.current
|
|
13891
|
+
});
|
|
13543
13892
|
registerRef.current = result.register;
|
|
13893
|
+
registerLinewiseRef.current = result.registerLinewise;
|
|
13544
13894
|
if (operator === "yank") {
|
|
13545
|
-
ta.setSelectionRange(
|
|
13895
|
+
ta.setSelectionRange(result.caret, result.caret);
|
|
13546
13896
|
} else {
|
|
13547
|
-
ta.
|
|
13897
|
+
ta.value = result.text;
|
|
13898
|
+
ta.setSelectionRange(result.caret, result.caret);
|
|
13548
13899
|
}
|
|
13549
|
-
args.applyChange(ta.value);
|
|
13900
|
+
args.applyChange(ta.value, "capability");
|
|
13550
13901
|
});
|
|
13551
13902
|
useEventListener(`UI:${args.events.onInsertText}`, (evt) => {
|
|
13552
13903
|
if (!args.editorId || !isInsertTextPayload(evt.payload) || evt.payload.editorId !== args.editorId) return;
|
|
13553
13904
|
const ta = args.textareaRef.current;
|
|
13554
13905
|
if (!ta) return;
|
|
13906
|
+
pushHistoryStep(ta.value, ta.selectionStart);
|
|
13555
13907
|
ta.setRangeText(evt.payload.text, ta.selectionStart, ta.selectionEnd, "end");
|
|
13556
|
-
args.applyChange(ta.value);
|
|
13908
|
+
args.applyChange(ta.value, "capability");
|
|
13557
13909
|
});
|
|
13558
13910
|
useEventListener(`UI:${args.events.onSetMode}`, (evt) => {
|
|
13559
13911
|
if (!args.editorId || !isSetModePayload(evt.payload) || evt.payload.editorId !== args.editorId) return;
|
|
13912
|
+
closeOpenTypingStep();
|
|
13913
|
+
insertSessionOpenRef.current = evt.payload.mode === "INSERT";
|
|
13560
13914
|
setCaretMode(evt.payload.caret);
|
|
13561
13915
|
});
|
|
13562
|
-
return { caretMode };
|
|
13916
|
+
return { caretMode, recordKeystroke, undo, redo };
|
|
13563
13917
|
}
|
|
13564
13918
|
var init_useEditorCapabilities = __esm({
|
|
13565
13919
|
"components/core/molecules/markdown/useEditorCapabilities.ts"() {
|
|
@@ -13978,9 +14332,23 @@ var init_CodeBlock = __esm({
|
|
|
13978
14332
|
"paragraph-forward",
|
|
13979
14333
|
"paragraph-back",
|
|
13980
14334
|
"line",
|
|
13981
|
-
"selection"
|
|
14335
|
+
"selection",
|
|
14336
|
+
"match-bracket"
|
|
13982
14337
|
],
|
|
13983
|
-
operators = [
|
|
14338
|
+
operators = [
|
|
14339
|
+
"delete",
|
|
14340
|
+
"yank",
|
|
14341
|
+
"change",
|
|
14342
|
+
"put",
|
|
14343
|
+
"put-before",
|
|
14344
|
+
"undo",
|
|
14345
|
+
"redo",
|
|
14346
|
+
"join",
|
|
14347
|
+
"toggle-case",
|
|
14348
|
+
"indent",
|
|
14349
|
+
"dedent",
|
|
14350
|
+
"replace"
|
|
14351
|
+
]
|
|
13984
14352
|
}) => {
|
|
13985
14353
|
const code = typeof rawCode === "string" ? rawCode : String(rawCode ?? "");
|
|
13986
14354
|
const activeStyle = resolveHighlightStyle(language);
|
|
@@ -14014,6 +14382,12 @@ var init_CodeBlock = __esm({
|
|
|
14014
14382
|
const lastPropCodeRef = useRef(code);
|
|
14015
14383
|
const editableTextareaRef = useRef(null);
|
|
14016
14384
|
const editableOverlayRef = useRef(null);
|
|
14385
|
+
const [isFocused, setIsFocused] = useState(false);
|
|
14386
|
+
const prevCaretRef = useRef(0);
|
|
14387
|
+
const [caretIndex, setCaretIndex] = useState(0);
|
|
14388
|
+
const caretMirrorRef = useRef(null);
|
|
14389
|
+
const caretMarkerRef = useRef(null);
|
|
14390
|
+
const [caretGeometry, setCaretGeometry] = useState(null);
|
|
14017
14391
|
useEffect(() => {
|
|
14018
14392
|
if (code !== lastPropCodeRef.current) {
|
|
14019
14393
|
lastPropCodeRef.current = code;
|
|
@@ -14029,23 +14403,77 @@ var init_CodeBlock = __esm({
|
|
|
14029
14403
|
ov.scrollLeft = ta.scrollLeft;
|
|
14030
14404
|
}
|
|
14031
14405
|
}, []);
|
|
14032
|
-
const handleEditableChange = useCallback((v) => {
|
|
14406
|
+
const handleEditableChange = useCallback((v, _origin) => {
|
|
14033
14407
|
lastPropCodeRef.current = v;
|
|
14034
14408
|
setEditableValue(v);
|
|
14409
|
+
const ta = editableTextareaRef.current;
|
|
14410
|
+
if (ta) setCaretIndex(ta.selectionStart);
|
|
14035
14411
|
onChange?.(v);
|
|
14036
14412
|
}, [onChange]);
|
|
14037
|
-
const { caretMode } = useEditorCapabilities({
|
|
14413
|
+
const { caretMode, recordKeystroke, undo, redo } = useEditorCapabilities({
|
|
14038
14414
|
editorId: editable ? editorId : void 0,
|
|
14039
14415
|
textareaRef: editableTextareaRef,
|
|
14040
14416
|
events: { onMotion, onOperate, onInsertText, onSetMode },
|
|
14417
|
+
focused: isFocused,
|
|
14041
14418
|
applyChange: handleEditableChange
|
|
14042
14419
|
});
|
|
14043
|
-
const
|
|
14044
|
-
|
|
14045
|
-
|
|
14046
|
-
|
|
14047
|
-
|
|
14048
|
-
|
|
14420
|
+
const handleEditableKeyDown = useCallback(
|
|
14421
|
+
(e) => {
|
|
14422
|
+
const ta = editableTextareaRef.current;
|
|
14423
|
+
if (ta) prevCaretRef.current = ta.selectionStart;
|
|
14424
|
+
const mod = e.metaKey || e.ctrlKey;
|
|
14425
|
+
if (!mod) return;
|
|
14426
|
+
const key = e.key.toLowerCase();
|
|
14427
|
+
if (key === "z" && !e.shiftKey) {
|
|
14428
|
+
e.preventDefault();
|
|
14429
|
+
undo();
|
|
14430
|
+
} else if (key === "z" && e.shiftKey || key === "y") {
|
|
14431
|
+
e.preventDefault();
|
|
14432
|
+
redo();
|
|
14433
|
+
}
|
|
14434
|
+
},
|
|
14435
|
+
[undo, redo]
|
|
14436
|
+
);
|
|
14437
|
+
const showBlockCaret = isFocused && caretMode !== "bar";
|
|
14438
|
+
useLayoutEffect(() => {
|
|
14439
|
+
if (!showBlockCaret) return;
|
|
14440
|
+
const ta = editableTextareaRef.current;
|
|
14441
|
+
const mirror = caretMirrorRef.current;
|
|
14442
|
+
const marker = caretMarkerRef.current;
|
|
14443
|
+
if (!ta || !mirror || !marker) return;
|
|
14444
|
+
const computed = window.getComputedStyle(ta);
|
|
14445
|
+
const MIRRORED_PROPS = [
|
|
14446
|
+
"font-family",
|
|
14447
|
+
"font-size",
|
|
14448
|
+
"font-weight",
|
|
14449
|
+
"font-style",
|
|
14450
|
+
"letter-spacing",
|
|
14451
|
+
"line-height",
|
|
14452
|
+
"padding-top",
|
|
14453
|
+
"padding-right",
|
|
14454
|
+
"padding-bottom",
|
|
14455
|
+
"padding-left",
|
|
14456
|
+
"border-top-width",
|
|
14457
|
+
"border-right-width",
|
|
14458
|
+
"border-bottom-width",
|
|
14459
|
+
"border-left-width",
|
|
14460
|
+
"box-sizing",
|
|
14461
|
+
"width",
|
|
14462
|
+
"white-space",
|
|
14463
|
+
"word-break",
|
|
14464
|
+
"overflow-wrap",
|
|
14465
|
+
"tab-size"
|
|
14466
|
+
];
|
|
14467
|
+
for (const prop of MIRRORED_PROPS) {
|
|
14468
|
+
mirror.style.setProperty(prop, computed.getPropertyValue(prop));
|
|
14469
|
+
}
|
|
14470
|
+
const lineHeight = parseFloat(computed.getPropertyValue("line-height"));
|
|
14471
|
+
setCaretGeometry({
|
|
14472
|
+
top: marker.offsetTop,
|
|
14473
|
+
left: marker.offsetLeft,
|
|
14474
|
+
lineHeight: Number.isFinite(lineHeight) ? lineHeight : 0
|
|
14475
|
+
});
|
|
14476
|
+
}, [showBlockCaret, editableValue, caretIndex]);
|
|
14049
14477
|
const errorLineProps = useMemo(() => buildLineProps(errorLines), [errorLines]);
|
|
14050
14478
|
const viewerLineProps = useMemo(
|
|
14051
14479
|
() => buildLineProps(errorLines, "px-4 py-0.5 hover:bg-muted/50"),
|
|
@@ -14569,11 +14997,24 @@ var init_CodeBlock = __esm({
|
|
|
14569
14997
|
{
|
|
14570
14998
|
ref: editableTextareaRef,
|
|
14571
14999
|
defaultValue: code,
|
|
14572
|
-
onChange: (e) =>
|
|
15000
|
+
onChange: (e) => {
|
|
15001
|
+
const next = e.target.value;
|
|
15002
|
+
recordKeystroke(editableValue, prevCaretRef.current, next);
|
|
15003
|
+
handleEditableChange(next, "keystroke");
|
|
15004
|
+
},
|
|
14573
15005
|
onScroll: handleEditableScroll,
|
|
14574
15006
|
onSelect: (e) => setCaretIndex(e.currentTarget.selectionStart),
|
|
14575
|
-
|
|
14576
|
-
|
|
15007
|
+
onKeyUp: (e) => setCaretIndex(e.currentTarget.selectionStart),
|
|
15008
|
+
onClick: (e) => setCaretIndex(e.currentTarget.selectionStart),
|
|
15009
|
+
onKeyDown: handleEditableKeyDown,
|
|
15010
|
+
onFocus: () => {
|
|
15011
|
+
setIsFocused(true);
|
|
15012
|
+
if (editorId) eventBus.emit(`UI:${onEditorFocus}`, { editorId });
|
|
15013
|
+
},
|
|
15014
|
+
onBlur: () => {
|
|
15015
|
+
setIsFocused(false);
|
|
15016
|
+
if (editorId) eventBus.emit(`UI:${onEditorBlur}`, { editorId });
|
|
15017
|
+
},
|
|
14577
15018
|
spellCheck: false,
|
|
14578
15019
|
style: {
|
|
14579
15020
|
position: "absolute",
|
|
@@ -14600,16 +15041,39 @@ var init_CodeBlock = __esm({
|
|
|
14600
15041
|
},
|
|
14601
15042
|
editableTextareaKey
|
|
14602
15043
|
),
|
|
14603
|
-
|
|
15044
|
+
showBlockCaret && /* @__PURE__ */ jsxs(
|
|
15045
|
+
"div",
|
|
15046
|
+
{
|
|
15047
|
+
ref: caretMirrorRef,
|
|
15048
|
+
"aria-hidden": true,
|
|
15049
|
+
"data-testid": "editor-caret-mirror",
|
|
15050
|
+
style: {
|
|
15051
|
+
position: "absolute",
|
|
15052
|
+
top: 0,
|
|
15053
|
+
left: 0,
|
|
15054
|
+
padding: "1rem",
|
|
15055
|
+
margin: 0,
|
|
15056
|
+
border: "none",
|
|
15057
|
+
visibility: "hidden",
|
|
15058
|
+
pointerEvents: "none"
|
|
15059
|
+
},
|
|
15060
|
+
children: [
|
|
15061
|
+
editableValue.slice(0, caretIndex),
|
|
15062
|
+
/* @__PURE__ */ jsx("span", { ref: caretMarkerRef, "data-testid": "editor-caret-marker", children: "\u200B" })
|
|
15063
|
+
]
|
|
15064
|
+
}
|
|
15065
|
+
),
|
|
15066
|
+
showBlockCaret && caretGeometry && /* @__PURE__ */ jsx(
|
|
14604
15067
|
"span",
|
|
14605
15068
|
{
|
|
14606
15069
|
"aria-hidden": true,
|
|
15070
|
+
"data-testid": "editor-caret",
|
|
14607
15071
|
style: {
|
|
14608
15072
|
position: "absolute",
|
|
14609
|
-
top:
|
|
14610
|
-
left:
|
|
15073
|
+
top: caretGeometry.top,
|
|
15074
|
+
left: caretGeometry.left,
|
|
14611
15075
|
width: "1ch",
|
|
14612
|
-
height: caretMode === "block" ? "
|
|
15076
|
+
height: caretMode === "block" ? caretGeometry.lineHeight || "1.2em" : "2px",
|
|
14613
15077
|
backgroundColor: caretMode === "block" ? "rgba(230, 230, 230, 0.5)" : void 0,
|
|
14614
15078
|
borderBottom: caretMode === "underline" ? "2px solid #e6e6e6" : void 0,
|
|
14615
15079
|
pointerEvents: "none"
|
|
@@ -19325,6 +19789,10 @@ var init_projector = __esm({
|
|
|
19325
19789
|
});
|
|
19326
19790
|
|
|
19327
19791
|
// lib/drawable/hitTest.ts
|
|
19792
|
+
function shapeDrawnItem(n) {
|
|
19793
|
+
if (n.shape !== "rect") return { pos: n.position, id: n.id };
|
|
19794
|
+
return { pos: n.position, id: n.id, anchor: n.anchor, width: n.width, height: n.height, rotation: n.rotate };
|
|
19795
|
+
}
|
|
19328
19796
|
function collectDrawnItems(nodes) {
|
|
19329
19797
|
const out = [];
|
|
19330
19798
|
for (const n of nodes) {
|
|
@@ -19333,6 +19801,8 @@ function collectDrawnItems(nodes) {
|
|
|
19333
19801
|
if (isValidScenePos(n.position)) out.push({ pos: n.position, id: n.id, anchor: n.anchor, width: n.width, height: n.height, rotation: n.rotation });
|
|
19334
19802
|
break;
|
|
19335
19803
|
case "draw-shape":
|
|
19804
|
+
if (isValidScenePos(n.position)) out.push(shapeDrawnItem(n));
|
|
19805
|
+
break;
|
|
19336
19806
|
case "draw-text":
|
|
19337
19807
|
case "draw-group":
|
|
19338
19808
|
case "draw-mesh":
|
|
@@ -19344,6 +19814,10 @@ function collectDrawnItems(nodes) {
|
|
|
19344
19814
|
}
|
|
19345
19815
|
break;
|
|
19346
19816
|
case "draw-shape-layer":
|
|
19817
|
+
for (const it of n.items) {
|
|
19818
|
+
if (isValidScenePos(it.position)) out.push(shapeDrawnItem(it));
|
|
19819
|
+
}
|
|
19820
|
+
break;
|
|
19347
19821
|
case "draw-text-layer":
|
|
19348
19822
|
for (const it of n.items) {
|
|
19349
19823
|
if (isValidScenePos(it.position)) out.push({ pos: it.position, id: it.id });
|
|
@@ -24135,6 +24609,7 @@ function SubMenu({
|
|
|
24135
24609
|
item.onClick?.();
|
|
24136
24610
|
},
|
|
24137
24611
|
"aria-disabled": item.disabled || void 0,
|
|
24612
|
+
title: item.title,
|
|
24138
24613
|
"data-testid": item.event ? `action-${item.event}` : void 0,
|
|
24139
24614
|
className: cn(
|
|
24140
24615
|
"w-full flex items-center gap-3 px-4 py-2 text-start",
|
|
@@ -24183,6 +24658,7 @@ function MenuItemRow({
|
|
|
24183
24658
|
as: "button",
|
|
24184
24659
|
onClick: () => onItemClick({ ...item, id: itemId }, itemId),
|
|
24185
24660
|
"aria-disabled": item.disabled || void 0,
|
|
24661
|
+
title: item.title,
|
|
24186
24662
|
onMouseEnter: (e) => {
|
|
24187
24663
|
if (hasSubMenu) openSubMenu(itemId, e.currentTarget);
|
|
24188
24664
|
},
|
|
@@ -34647,13 +35123,13 @@ var init_MapView = __esm({
|
|
|
34647
35123
|
shadowSize: [41, 41]
|
|
34648
35124
|
});
|
|
34649
35125
|
L.Marker.prototype.options.icon = defaultIcon;
|
|
34650
|
-
const { useEffect:
|
|
35126
|
+
const { useEffect: useEffect73, useRef: useRef70, useCallback: useCallback110, useState: useState110 } = React79__default;
|
|
34651
35127
|
const { Typography: Typography2 } = await Promise.resolve().then(() => (init_Typography(), Typography_exports));
|
|
34652
35128
|
const { useEventBus: useEventBus2 } = await Promise.resolve().then(() => (init_useEventBus(), useEventBus_exports));
|
|
34653
35129
|
function MapUpdater({ centerLat, centerLng, zoom }) {
|
|
34654
35130
|
const map = useMap();
|
|
34655
35131
|
const prevRef = useRef70({ centerLat, centerLng, zoom });
|
|
34656
|
-
|
|
35132
|
+
useEffect73(() => {
|
|
34657
35133
|
const prev = prevRef.current;
|
|
34658
35134
|
if (prev.centerLat !== centerLat || prev.centerLng !== centerLng || prev.zoom !== zoom) {
|
|
34659
35135
|
map.setView([centerLat, centerLng], zoom);
|
|
@@ -34664,7 +35140,7 @@ var init_MapView = __esm({
|
|
|
34664
35140
|
}
|
|
34665
35141
|
function MapClickHandler({ onMapClick }) {
|
|
34666
35142
|
const map = useMap();
|
|
34667
|
-
|
|
35143
|
+
useEffect73(() => {
|
|
34668
35144
|
if (!onMapClick) return;
|
|
34669
35145
|
const handler = (e) => {
|
|
34670
35146
|
onMapClick(e.latlng.lat, e.latlng.lng);
|
|
@@ -34693,7 +35169,7 @@ var init_MapView = __esm({
|
|
|
34693
35169
|
}) {
|
|
34694
35170
|
const eventBus = useEventBus2();
|
|
34695
35171
|
const [clickedPosition, setClickedPosition] = useState110(null);
|
|
34696
|
-
const handleMapClick =
|
|
35172
|
+
const handleMapClick = useCallback110((lat, lng) => {
|
|
34697
35173
|
if (showClickedPin) {
|
|
34698
35174
|
setClickedPosition({ lat, lng });
|
|
34699
35175
|
}
|
|
@@ -34702,7 +35178,7 @@ var init_MapView = __esm({
|
|
|
34702
35178
|
eventBus.emit(`UI:${mapClickEvent}`, { latitude: lat, longitude: lng });
|
|
34703
35179
|
}
|
|
34704
35180
|
}, [onMapClick, mapClickEvent, eventBus, showClickedPin]);
|
|
34705
|
-
const handleMarkerClick =
|
|
35181
|
+
const handleMarkerClick = useCallback110((marker) => {
|
|
34706
35182
|
onMarkerClick?.(marker);
|
|
34707
35183
|
if (markerClickEvent) {
|
|
34708
35184
|
eventBus.emit(`UI:${markerClickEvent}`, { ...marker });
|
|
@@ -44534,7 +45010,10 @@ var init_FloatingToolbar = __esm({
|
|
|
44534
45010
|
positionClasses = {
|
|
44535
45011
|
"bottom-center": "bottom-6 left-1/2 -translate-x-1/2",
|
|
44536
45012
|
"bottom-left": "bottom-6 left-6",
|
|
44537
|
-
"bottom-right": "bottom-6 right-6"
|
|
45013
|
+
"bottom-right": "bottom-6 right-6",
|
|
45014
|
+
"top-center": "top-6 left-1/2 -translate-x-1/2",
|
|
45015
|
+
"top-left": "top-6 left-6",
|
|
45016
|
+
"top-right": "top-6 right-6"
|
|
44538
45017
|
};
|
|
44539
45018
|
FloatingToolbar = ({
|
|
44540
45019
|
items,
|
|
@@ -52320,6 +52799,7 @@ var init_component_registry_generated = __esm({
|
|
|
52320
52799
|
"TrendIndicator": TrendIndicator,
|
|
52321
52800
|
"TypewriterText": TypewriterText,
|
|
52322
52801
|
"Typography": Typography,
|
|
52802
|
+
"UISlotComponent": UISlotComponent,
|
|
52323
52803
|
"UISlotRenderer": UISlotRenderer,
|
|
52324
52804
|
"UploadDropZone": UploadDropZone,
|
|
52325
52805
|
"VStack": VStack,
|
|
@@ -52625,6 +53105,7 @@ function UISlotComponentInner({
|
|
|
52625
53105
|
const contained = useContext(SlotContainedContext);
|
|
52626
53106
|
const schemaCtx = useEntitySchemaOptional();
|
|
52627
53107
|
const rawContent = slots[slot];
|
|
53108
|
+
const regionClassName = fallback !== void 0 ? cn("contents", className) : className;
|
|
52628
53109
|
const binding = useEntityBindingSnapshot(rawContent?.sourceTrait);
|
|
52629
53110
|
const content = useMemo(() => {
|
|
52630
53111
|
if (!rawContent) return rawContent;
|
|
@@ -52673,7 +53154,7 @@ function UISlotComponentInner({
|
|
|
52673
53154
|
Box,
|
|
52674
53155
|
{
|
|
52675
53156
|
id: `slot-${slot}`,
|
|
52676
|
-
className: cn("ui-slot", `ui-slot-${slot}`,
|
|
53157
|
+
className: cn("ui-slot", `ui-slot-${slot}`, regionClassName),
|
|
52677
53158
|
"data-testid": `ui-slot-${slot}`,
|
|
52678
53159
|
"data-slot-mode": "fallback",
|
|
52679
53160
|
children: fallback
|
|
@@ -52708,7 +53189,7 @@ function UISlotComponentInner({
|
|
|
52708
53189
|
Box,
|
|
52709
53190
|
{
|
|
52710
53191
|
id: `slot-${slot}-fallback`,
|
|
52711
|
-
className: cn("ui-slot", `ui-slot-${slot}-fallback`,
|
|
53192
|
+
className: cn("ui-slot", `ui-slot-${slot}-fallback`, regionClassName),
|
|
52712
53193
|
"data-testid": `ui-slot-${slot}-fallback`,
|
|
52713
53194
|
"data-slot-mode": "append",
|
|
52714
53195
|
children: fallback
|
|
@@ -52740,7 +53221,7 @@ function UISlotComponentInner({
|
|
|
52740
53221
|
Box,
|
|
52741
53222
|
{
|
|
52742
53223
|
id: `slot-${slot}`,
|
|
52743
|
-
className: cn("ui-slot", `ui-slot-${slot}`,
|
|
53224
|
+
className: cn("ui-slot", `ui-slot-${slot}`, regionClassName),
|
|
52744
53225
|
"data-pattern": content.pattern,
|
|
52745
53226
|
"data-source-trait": content.sourceTrait,
|
|
52746
53227
|
"data-testid": `ui-slot-${slot}`,
|
|
@@ -54566,6 +55047,33 @@ init_useEventBus();
|
|
|
54566
55047
|
|
|
54567
55048
|
// hooks/useKeyboardRouter.ts
|
|
54568
55049
|
init_useEventBus();
|
|
55050
|
+
function mergeCaptureTables(tables) {
|
|
55051
|
+
const merged = {};
|
|
55052
|
+
for (const table of tables) {
|
|
55053
|
+
for (const [target, entry] of Object.entries(table)) {
|
|
55054
|
+
const current = merged[target];
|
|
55055
|
+
if (!current) {
|
|
55056
|
+
merged[target] = { mode: entry.mode, keys: new Set(entry.keys) };
|
|
55057
|
+
continue;
|
|
55058
|
+
}
|
|
55059
|
+
for (const key of entry.keys) current.keys.add(key);
|
|
55060
|
+
if (current.mode === "any" || entry.mode === "any") current.mode = "any";
|
|
55061
|
+
else if (current.mode !== entry.mode) {
|
|
55062
|
+
current.mode = Array.from(/* @__PURE__ */ new Set([...current.mode.split("|"), entry.mode])).sort().join("|");
|
|
55063
|
+
}
|
|
55064
|
+
}
|
|
55065
|
+
}
|
|
55066
|
+
return merged;
|
|
55067
|
+
}
|
|
55068
|
+
function keyChord(event) {
|
|
55069
|
+
const parts = [];
|
|
55070
|
+
if (event.ctrlKey) parts.push("Control");
|
|
55071
|
+
if (event.altKey) parts.push("Alt");
|
|
55072
|
+
if (event.shiftKey) parts.push("Shift");
|
|
55073
|
+
if (event.metaKey) parts.push("Meta");
|
|
55074
|
+
parts.push(event.key);
|
|
55075
|
+
return parts.join("+");
|
|
55076
|
+
}
|
|
54569
55077
|
function useKeyboardRouter(options) {
|
|
54570
55078
|
const {
|
|
54571
55079
|
captureTable,
|
|
@@ -54602,7 +55110,7 @@ function useKeyboardRouter(options) {
|
|
|
54602
55110
|
if (event.isComposing) return;
|
|
54603
55111
|
const target = focusedEditorIdRef.current ?? "shell";
|
|
54604
55112
|
const entry = captureTableRef.current[target];
|
|
54605
|
-
const captured = entry !== void 0 && (entry.
|
|
55113
|
+
const captured = entry !== void 0 && (entry.keys.has(event.key) || entry.keys.has(keyChord(event)));
|
|
54606
55114
|
if (captured) {
|
|
54607
55115
|
event.preventDefault();
|
|
54608
55116
|
}
|
|
@@ -55970,4 +56478,4 @@ function assertUniqueSlotsPerHost(manifest) {
|
|
|
55970
56478
|
}
|
|
55971
56479
|
}
|
|
55972
56480
|
|
|
55973
|
-
export { ALL_PRESETS, ALMADAR_DND_MIME, AR_BOOK_FIELDS, AboutPageTemplate, Accordion, Card2 as ActionCard, ActionPalette, ActionTile, ActivationBlock, Alert, AlgoGraphCanvas, AlgorithmCanvas, AnimatedCounter, AnimatedGraphic, AnimatedReveal, ArticleSection, Aside, AssetPicker, AtlasImage, AtlasPanel, AuthLayout, Avatar, Badge, BehaviorView, BiologyCanvas, BloomQuizBlock, BookChapterView, BookCoverPage, BookNavBar, BookTableOfContents, BookViewer, Box, BranchingLogicBuilder, Breadcrumb, Button, ButtonGroup, CTABanner, CalendarGrid, Canvas, Canvas2D, Card, CardBody, CardContent, CardFooter, CardGrid, CardHeader, CardTitle, Carousel, CaseStudyCard, CaseStudyOrganism, Center, Chart, ChartLegend, ChatBar, Checkbox, ChemistryCanvas, ChoiceButton, Coachmark, CodeBlock, CodeRunnerPanel, CollapsibleSection, CommandPalette, CommunityLinks, ConditionalWrapper, ConfettiEffect, ConfirmDialog, ConnectionBlock, Container, ContentRenderer, ContentSection, ControlButton, ControlGrid, CounterTemplate, DEFAULT_LIKERT_OPTIONS, DEFAULT_MATRIX_COLUMNS, DEFAULT_SLOTS, DIAMOND_TOP_Y, DashboardGrid, DashboardLayout, DataGrid, DataList, DataTable, DateRangePicker, DateRangeSelector, DayCell, DetailPanel, Dialog, DialogueBubble, Divider, DocBreadcrumb, DocPagination, DocSearch, DocSidebar, DocTOC, DockLayout, DocumentDetails, DocumentPanel, DocumentViewer, StateMachineView as DomStateMachineVisualizer, Drawer, DrawerSlot, ELEMENT_SELECTED_EVENT, EdgeDecoration, EditorCheckbox, EditorSelect, EditorSlider, EditorTextInput, EditorToolbar, EmojiPicker, EmptyState, EntityDisplayEvents, ErrorBoundary, ErrorState, FEATURE_COLORS, FEATURE_TYPES, FLOOR_HEIGHT, FeatureCard, FeatureDetailPageTemplate, FeatureGrid, FeatureGridOrganism, FileTree, FilterGroup, FilterPill, Flex, FlipCard, FlipContainer, FloatingActionButton, FloatingToolbar, Form, FormActions, FormField, FormLayout, FormSection, FormSectionHeader, FxOverlay, GameAudioCue, GameAudioToggle, GameHud, GameIcon, GameMenu, GameShell, GenericAppTemplate, GeometricPattern, GradientDivider, GraphCanvas, GraphView, Grid, GridPicker, HStack, Header, HealthBar, HeroOrganism, HeroSection, I18nProvider, IDENTITY_BOOK_FIELDS, Icon, IconPicker, ImportPreviewTree, ImportProgress, ImportSourcePicker, InfiniteScrollSentinel, Input, InputGroup, InstallBox, JazariStateMachine, JsonTreeEditor, Label, LandingPageTemplate, LawReferenceTooltip, LearningCanvas, LearningScene3D, Lightbox, LikertScale, LineChart2 as LineChart, List3 as List, LoadingState, MapView, MarkdownContent, MarketingFooter, MarketingStatCard, MasterDetail, MasterDetailLayout, MathCanvas, MatrixQuestion, MediaGallery, Menu, Meter, Modal, ModalSlot, ModuleCard, Navigation, NodeSlotEditor, NotifyListener, NumberStepper, OnboardingSpotlight, OptionConstraintGroup, StateMachineView as OrbitalStateMachineView, OrbitalVisualization, Overlay, PageHeader, PageTransition, Pagination, PatternTile, PhysicsCanvas, Popover, PositionedCanvas, Presence, PricingCard, PricingGrid, PricingOrganism, PricingPageTemplate, ProgressBar, ProgressDots, PropertyInspector, PullQuote, PullToRefresh, QrScanner, QuizBlock, Radio, RangeSlider, ReflectionBlock, RelationSelect, RepeatableFormSection, ReplyTree, RichTextEditor, RuntimeDebugger, SHEET_COLUMNS, SPRITE_SHEET_LAYOUT, ScaledDiagram, ScoreDisplay, SearchInput, Section, SectionHeader, SegmentRenderer, Select, SequenceBar, ServiceCatalog, SharedEntityStoreContext, ShowcaseCard, ShowcaseOrganism, SidePanel, Sidebar, SignaturePad, SimpleGrid, Skeleton, SlotContentRenderer, SocialProof, SortableList, Spacer, Sparkline, Spinner, Split, SplitPane, SplitSection, Stack, StarRating, StatBadge, StatCard, StatDisplay, StateGraph, StateJsonView, StateMachineView, StateNode2 as StateNode, StatsGrid, StatsOrganism, StatusBar, StatusDot, StepFlow, StepFlowOrganism, SubagentTracePanel, SvgBranch, SvgConnection, SvgFlow, SvgGrid, SvgLobe, SvgMesh, SvgMorph, SvgNode, SvgPulse, SvgRing, SvgShield, SvgStack, SwipeableRow, Switch, TERRAIN_COLORS, TILE_HEIGHT, TILE_WIDTH, TabbedContainer, TableView, Tabs, TagCloud, TagInput, TeamCard, TeamOrganism, TerrainPalette, TextHighlight, Textarea, ThemeToggle, TimeSlotCell, Timeline, TimerDisplay, Toast, ToastSlot, Tooltip, TraitFrame, TraitSlot, TraitStateViewer, TransitionArrow, TrendIndicator, TypewriterText, Typography, UISlotComponent, UISlotRenderer, UploadDropZone, VStack, VersionDiff, ViolationAlert, VoteStack, WizardContainer, WizardNavigation, WizardProgress, arrowBetween, assertUniqueSlotsPerHost, billboardLabel, boardEntity, bool, calculateAttackTargets, calculateValidMoves, cn, createInitialGameState, createSharedEntityStore, createTranslate, createUnitAnimationState, cylinderBetween, dispatchCommandPaletteCommand, get3DClickPayload, getCurrentFrame, getTileDimensions, inferDirection, isoToScreen, makeAsset, makeAssetMap, mapBookData, meshSphere, num, objAvailableActions, objAvailableEvents, objCurrentState, objIcon, objId, objMaxRules, objName, objRules, objStates, parseEditFocus, parseLessonSegments, parseMarkdownWithCodeBlocks, parseQueryBinding, pendulum, projectileMotion, registerCodeLanguageLoader, renderPatternValue, resolveFieldMap, resolveFrame, resolveSheetDirection, rows, runTickFrame, sanitizeRichHtml, screenToIso, springOscillator, str, tickAnimationState, toCodeLanguage, transitionAnimation, unitHealth, unitPosition, unitTeam, useAgentChat, useAnchorRect, useAtlasSliceDataUrl, useAuthContext, useCamera, useCanvasGestures, useCompile, useConnectGitHub, useDeepAgentGeneration, useDisconnectGitHub, useDragReorder, useDraggable, useDropZone, useEmitEvent, useEventBus, useEventListener, useExtensions, useFileEditor, useFileSystem, useGameAudio, useGitHubBranches, useGitHubRepo, useGitHubRepos, useGitHubStatus, useImageCache, useInfiniteScroll, useKeyboardRouter, useLongPress, useMediaQuery, useOrbitalHistory, usePresence, usePreview, usePullToRefresh, useQuerySingleton, useRenderInterpolation, useSharedEntitySnapshot, useSharedEntityStore, useSharedEntityStoreContext, useSwipeGesture, useTapReveal, useTraitListens, useTranslate117 as useTranslate, useUIEvents, useUISlotManager, useUnitSpriteAtlas, useValidation, vec2 };
|
|
56481
|
+
export { ALL_PRESETS, ALMADAR_DND_MIME, AR_BOOK_FIELDS, AboutPageTemplate, Accordion, Card2 as ActionCard, ActionPalette, ActionTile, ActivationBlock, Alert, AlgoGraphCanvas, AlgorithmCanvas, AnimatedCounter, AnimatedGraphic, AnimatedReveal, ArticleSection, Aside, AssetPicker, AtlasImage, AtlasPanel, AuthLayout, Avatar, Badge, BehaviorView, BiologyCanvas, BloomQuizBlock, BookChapterView, BookCoverPage, BookNavBar, BookTableOfContents, BookViewer, Box, BranchingLogicBuilder, Breadcrumb, Button, ButtonGroup, CTABanner, CalendarGrid, Canvas, Canvas2D, Card, CardBody, CardContent, CardFooter, CardGrid, CardHeader, CardTitle, Carousel, CaseStudyCard, CaseStudyOrganism, Center, Chart, ChartLegend, ChatBar, Checkbox, ChemistryCanvas, ChoiceButton, Coachmark, CodeBlock, CodeRunnerPanel, CollapsibleSection, CommandPalette, CommunityLinks, ConditionalWrapper, ConfettiEffect, ConfirmDialog, ConnectionBlock, Container, ContentRenderer, ContentSection, ControlButton, ControlGrid, CounterTemplate, DEFAULT_LIKERT_OPTIONS, DEFAULT_MATRIX_COLUMNS, DEFAULT_SLOTS, DIAMOND_TOP_Y, DashboardGrid, DashboardLayout, DataGrid, DataList, DataTable, DateRangePicker, DateRangeSelector, DayCell, DetailPanel, Dialog, DialogueBubble, Divider, DocBreadcrumb, DocPagination, DocSearch, DocSidebar, DocTOC, DockLayout, DocumentDetails, DocumentPanel, DocumentViewer, StateMachineView as DomStateMachineVisualizer, Drawer, DrawerSlot, ELEMENT_SELECTED_EVENT, EdgeDecoration, EditorCheckbox, EditorSelect, EditorSlider, EditorTextInput, EditorToolbar, EmojiPicker, EmptyState, EntityDisplayEvents, ErrorBoundary, ErrorState, FEATURE_COLORS, FEATURE_TYPES, FLOOR_HEIGHT, FeatureCard, FeatureDetailPageTemplate, FeatureGrid, FeatureGridOrganism, FileTree, FilterGroup, FilterPill, Flex, FlipCard, FlipContainer, FloatingActionButton, FloatingToolbar, Form, FormActions, FormField, FormLayout, FormSection, FormSectionHeader, FxOverlay, GameAudioCue, GameAudioToggle, GameHud, GameIcon, GameMenu, GameShell, GenericAppTemplate, GeometricPattern, GradientDivider, GraphCanvas, GraphView, Grid, GridPicker, HStack, Header, HealthBar, HeroOrganism, HeroSection, I18nProvider, IDENTITY_BOOK_FIELDS, Icon, IconPicker, ImportPreviewTree, ImportProgress, ImportSourcePicker, InfiniteScrollSentinel, Input, InputGroup, InstallBox, JazariStateMachine, JsonTreeEditor, Label, LandingPageTemplate, LawReferenceTooltip, LearningCanvas, LearningScene3D, Lightbox, LikertScale, LineChart2 as LineChart, List3 as List, LoadingState, MapView, MarkdownContent, MarketingFooter, MarketingStatCard, MasterDetail, MasterDetailLayout, MathCanvas, MatrixQuestion, MediaGallery, Menu, Meter, Modal, ModalSlot, ModuleCard, Navigation, NodeSlotEditor, NotifyListener, NumberStepper, OnboardingSpotlight, OptionConstraintGroup, StateMachineView as OrbitalStateMachineView, OrbitalVisualization, Overlay, PageHeader, PageTransition, Pagination, PatternTile, PhysicsCanvas, Popover, PositionedCanvas, Presence, PricingCard, PricingGrid, PricingOrganism, PricingPageTemplate, ProgressBar, ProgressDots, PropertyInspector, PullQuote, PullToRefresh, QrScanner, QuizBlock, Radio, RangeSlider, ReflectionBlock, RelationSelect, RepeatableFormSection, ReplyTree, RichTextEditor, RuntimeDebugger, SHEET_COLUMNS, SPRITE_SHEET_LAYOUT, ScaledDiagram, ScoreDisplay, SearchInput, Section, SectionHeader, SegmentRenderer, Select, SequenceBar, ServiceCatalog, SharedEntityStoreContext, ShowcaseCard, ShowcaseOrganism, SidePanel, Sidebar, SignaturePad, SimpleGrid, Skeleton, SlotContentRenderer, SocialProof, SortableList, Spacer, Sparkline, Spinner, Split, SplitPane, SplitSection, Stack, StarRating, StatBadge, StatCard, StatDisplay, StateGraph, StateJsonView, StateMachineView, StateNode2 as StateNode, StatsGrid, StatsOrganism, StatusBar, StatusDot, StepFlow, StepFlowOrganism, SubagentTracePanel, SvgBranch, SvgConnection, SvgFlow, SvgGrid, SvgLobe, SvgMesh, SvgMorph, SvgNode, SvgPulse, SvgRing, SvgShield, SvgStack, SwipeableRow, Switch, TERRAIN_COLORS, TILE_HEIGHT, TILE_WIDTH, TabbedContainer, TableView, Tabs, TagCloud, TagInput, TeamCard, TeamOrganism, TerrainPalette, TextHighlight, Textarea, ThemeToggle, TimeSlotCell, Timeline, TimerDisplay, Toast, ToastSlot, Tooltip, TraitFrame, TraitSlot, TraitStateViewer, TransitionArrow, TrendIndicator, TypewriterText, Typography, UISlotComponent, UISlotRenderer, UploadDropZone, VStack, VersionDiff, ViolationAlert, VoteStack, WizardContainer, WizardNavigation, WizardProgress, arrowBetween, assertUniqueSlotsPerHost, billboardLabel, boardEntity, bool, calculateAttackTargets, calculateValidMoves, cn, createInitialGameState, createSharedEntityStore, createTranslate, createUnitAnimationState, cylinderBetween, dispatchCommandPaletteCommand, get3DClickPayload, getCurrentFrame, getTileDimensions, inferDirection, isoToScreen, keyChord, makeAsset, makeAssetMap, mapBookData, mergeCaptureTables, meshSphere, num, objAvailableActions, objAvailableEvents, objCurrentState, objIcon, objId, objMaxRules, objName, objRules, objStates, parseEditFocus, parseLessonSegments, parseMarkdownWithCodeBlocks, parseQueryBinding, pendulum, projectileMotion, registerCodeLanguageLoader, renderPatternValue, resolveFieldMap, resolveFrame, resolveSheetDirection, rows, runTickFrame, sanitizeRichHtml, screenToIso, springOscillator, str, tickAnimationState, toCodeLanguage, transitionAnimation, unitHealth, unitPosition, unitTeam, useAgentChat, useAnchorRect, useAtlasSliceDataUrl, useAuthContext, useCamera, useCanvasGestures, useCompile, useConnectGitHub, useDeepAgentGeneration, useDisconnectGitHub, useDragReorder, useDraggable, useDropZone, useEmitEvent, useEventBus, useEventListener, useExtensions, useFileEditor, useFileSystem, useGameAudio, useGitHubBranches, useGitHubRepo, useGitHubRepos, useGitHubStatus, useImageCache, useInfiniteScroll, useKeyboardRouter, useLongPress, useMediaQuery, useOrbitalHistory, usePresence, usePreview, usePullToRefresh, useQuerySingleton, useRenderInterpolation, useSharedEntitySnapshot, useSharedEntityStore, useSharedEntityStoreContext, useSwipeGesture, useTapReveal, useTraitListens, useTranslate117 as useTranslate, useUIEvents, useUISlotManager, useUnitSpriteAtlas, useValidation, vec2 };
|