@walkeros/explorer 2.1.2 → 2.1.3
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/AGENT.md +9 -5
- package/dist/chunk-52ELVFJE.mjs +573 -0
- package/dist/chunk-52ELVFJE.mjs.map +1 -0
- package/dist/components/atoms/code.d.ts +8 -2
- package/dist/components/atoms/code.d.ts.map +1 -1
- package/dist/components/atoms/code.js +58 -5
- package/dist/components/atoms/code.js.map +1 -1
- package/dist/components/molecules/code-box.d.ts.map +1 -1
- package/dist/components/molecules/code-box.js +28 -39
- package/dist/components/molecules/code-box.js.map +1 -1
- package/dist/components/molecules/preview.d.ts.map +1 -1
- package/dist/components/molecules/preview.js +3 -0
- package/dist/components/molecules/preview.js.map +1 -1
- package/dist/index.d.cts +8 -13
- package/dist/index.mjs +165 -75
- package/dist/index.mjs.map +1 -1
- package/dist/{monaco-types-7HYTHECU.mjs → monaco-types-ZGWM2633.mjs} +2 -2
- package/dist/styles.css +47 -4
- package/dist/utils/monaco-json-schema.d.ts +13 -3
- package/dist/utils/monaco-json-schema.d.ts.map +1 -1
- package/dist/utils/monaco-json-schema.js +26 -11
- package/dist/utils/monaco-json-schema.js.map +1 -1
- package/package.json +3 -2
- package/dist/chunk-3TPAJIVM.mjs +0 -580
- package/dist/chunk-3TPAJIVM.mjs.map +0 -1
- /package/dist/{monaco-types-7HYTHECU.mjs.map → monaco-types-ZGWM2633.mjs.map} +0 -0
package/dist/index.mjs
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
import {
|
|
3
|
-
__require,
|
|
4
3
|
addFunctionContextTypes,
|
|
5
4
|
initializeMonacoTypes,
|
|
6
5
|
loadPackageTypes,
|
|
7
6
|
loadTypeLibraryFromURL,
|
|
8
7
|
registerWalkerOSTypes
|
|
9
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-52ELVFJE.mjs";
|
|
10
9
|
|
|
11
10
|
// src/components/demos/MappingDemo.tsx
|
|
12
11
|
import { useState as useState6, useCallback as useCallback5, useEffect as useEffect5 } from "react";
|
|
13
12
|
|
|
14
13
|
// src/components/molecules/code-box.tsx
|
|
15
14
|
import { useState as useState4, useCallback as useCallback3, useRef as useRef4, useEffect as useEffect3 } from "react";
|
|
15
|
+
import { useMonaco } from "@monaco-editor/react";
|
|
16
16
|
|
|
17
17
|
// src/components/atoms/box.tsx
|
|
18
18
|
import { useState } from "react";
|
|
@@ -1117,11 +1117,10 @@ function registerFormatters(monacoInstance) {
|
|
|
1117
1117
|
var schemaRegistry = /* @__PURE__ */ new Map();
|
|
1118
1118
|
var idCounter = 0;
|
|
1119
1119
|
var _json;
|
|
1120
|
-
function
|
|
1121
|
-
if (
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
return _json;
|
|
1120
|
+
function initMonacoJson(monaco) {
|
|
1121
|
+
if (_json) return;
|
|
1122
|
+
_json = monaco.json;
|
|
1123
|
+
if (schemaRegistry.size > 0) applySchemas();
|
|
1125
1124
|
}
|
|
1126
1125
|
function generateModelPath() {
|
|
1127
1126
|
return `inmemory://walkeros/json-${++idCounter}.json`;
|
|
@@ -1139,7 +1138,8 @@ function unregisterJsonSchema(modelPath) {
|
|
|
1139
1138
|
applySchemas();
|
|
1140
1139
|
}
|
|
1141
1140
|
function applySchemas() {
|
|
1142
|
-
|
|
1141
|
+
if (!_json) return;
|
|
1142
|
+
_json.jsonDefaults.setDiagnosticsOptions({
|
|
1143
1143
|
validate: true,
|
|
1144
1144
|
schemaValidation: "error",
|
|
1145
1145
|
schemaRequest: "ignore",
|
|
@@ -1366,11 +1366,12 @@ function Code({
|
|
|
1366
1366
|
};
|
|
1367
1367
|
const handleBeforeMount = async (monaco) => {
|
|
1368
1368
|
monacoRef.current = monaco;
|
|
1369
|
+
initMonacoJson(monaco);
|
|
1369
1370
|
registerAllThemes(monaco);
|
|
1370
1371
|
registerFormatters(monaco);
|
|
1371
1372
|
if (packages && packages.length > 0) {
|
|
1372
1373
|
registerWalkerOSTypes(monaco);
|
|
1373
|
-
const { loadPackageTypes: loadPackageTypes2 } = await import("./monaco-types-
|
|
1374
|
+
const { loadPackageTypes: loadPackageTypes2 } = await import("./monaco-types-ZGWM2633.mjs");
|
|
1374
1375
|
for (const pkg of packages) {
|
|
1375
1376
|
if (pkg !== "@walkeros/core") {
|
|
1376
1377
|
await loadPackageTypes2(monaco, { package: pkg }).catch(() => {
|
|
@@ -1429,10 +1430,6 @@ function Code({
|
|
|
1429
1430
|
endColumn: issue.endColumn ?? issue.column + 1
|
|
1430
1431
|
}))
|
|
1431
1432
|
);
|
|
1432
|
-
onMarkerCountsRef.current?.({
|
|
1433
|
-
errors: result.errors.length,
|
|
1434
|
-
warnings: result.warnings.length
|
|
1435
|
-
});
|
|
1436
1433
|
};
|
|
1437
1434
|
runValidation();
|
|
1438
1435
|
const validateDisposable = monacoEditor.onDidChangeModelContent(() => {
|
|
@@ -1444,6 +1441,55 @@ function Code({
|
|
|
1444
1441
|
validateDisposable.dispose();
|
|
1445
1442
|
});
|
|
1446
1443
|
}
|
|
1444
|
+
if (onMarkerCountsRef.current && monacoRef.current) {
|
|
1445
|
+
const monacoInstance = monacoRef.current;
|
|
1446
|
+
const model = monacoEditor.getModel();
|
|
1447
|
+
const hasCustomValidate = !!validateRef.current;
|
|
1448
|
+
if (model) {
|
|
1449
|
+
const reportMarkers = () => {
|
|
1450
|
+
if (hasCustomValidate) {
|
|
1451
|
+
monacoInstance.editor.setModelMarkers(model, "json", []);
|
|
1452
|
+
}
|
|
1453
|
+
const raw = monacoInstance.editor.getModelMarkers({
|
|
1454
|
+
resource: model.uri
|
|
1455
|
+
});
|
|
1456
|
+
let errors = 0;
|
|
1457
|
+
let warnings = 0;
|
|
1458
|
+
const details = [];
|
|
1459
|
+
for (const m of raw) {
|
|
1460
|
+
if (m.severity === 8) {
|
|
1461
|
+
errors++;
|
|
1462
|
+
details.push({
|
|
1463
|
+
message: m.message,
|
|
1464
|
+
severity: "error",
|
|
1465
|
+
line: m.startLineNumber,
|
|
1466
|
+
column: m.startColumn
|
|
1467
|
+
});
|
|
1468
|
+
} else if (m.severity === 4) {
|
|
1469
|
+
warnings++;
|
|
1470
|
+
details.push({
|
|
1471
|
+
message: m.message,
|
|
1472
|
+
severity: "warning",
|
|
1473
|
+
line: m.startLineNumber,
|
|
1474
|
+
column: m.startColumn
|
|
1475
|
+
});
|
|
1476
|
+
}
|
|
1477
|
+
}
|
|
1478
|
+
onMarkerCountsRef.current?.({ errors, warnings, markers: details });
|
|
1479
|
+
};
|
|
1480
|
+
const markerDisposable = monacoInstance.editor.onDidChangeMarkers(
|
|
1481
|
+
(uris) => {
|
|
1482
|
+
if (uris.some((uri) => uri.toString() === model.uri.toString())) {
|
|
1483
|
+
reportMarkers();
|
|
1484
|
+
}
|
|
1485
|
+
}
|
|
1486
|
+
);
|
|
1487
|
+
requestAnimationFrame(reportMarkers);
|
|
1488
|
+
decorationsCleanupRef.current.push(() => {
|
|
1489
|
+
markerDisposable.dispose();
|
|
1490
|
+
});
|
|
1491
|
+
}
|
|
1492
|
+
}
|
|
1447
1493
|
requestAnimationFrame(() => {
|
|
1448
1494
|
monacoEditor.layout();
|
|
1449
1495
|
});
|
|
@@ -1539,13 +1585,6 @@ function Code({
|
|
|
1539
1585
|
|
|
1540
1586
|
// src/components/molecules/code-box.tsx
|
|
1541
1587
|
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1542
|
-
var _monacoNs;
|
|
1543
|
-
function getMonaco() {
|
|
1544
|
-
if (!_monacoNs) {
|
|
1545
|
-
_monacoNs = __require("monaco-editor");
|
|
1546
|
-
}
|
|
1547
|
-
return _monacoNs;
|
|
1548
|
-
}
|
|
1549
1588
|
function CodeBox({
|
|
1550
1589
|
// Code props (single code mode)
|
|
1551
1590
|
code,
|
|
@@ -1578,6 +1617,7 @@ function CodeBox({
|
|
|
1578
1617
|
...codeProps
|
|
1579
1618
|
}) {
|
|
1580
1619
|
const { onMount: userOnMount, ...restCodeProps } = codeProps;
|
|
1620
|
+
const monaco = useMonaco();
|
|
1581
1621
|
const [copied, setCopied] = useState4(false);
|
|
1582
1622
|
const [showSettingsPanel, setShowSettingsPanel] = useState4(false);
|
|
1583
1623
|
const [settings, setSettings] = useState4({
|
|
@@ -1588,18 +1628,23 @@ function CodeBox({
|
|
|
1588
1628
|
});
|
|
1589
1629
|
const settingsRef = useRef4(null);
|
|
1590
1630
|
const [markerCounts, setMarkerCounts] = useState4({ errors: 0, warnings: 0 });
|
|
1631
|
+
const [markerDetails, setMarkerDetails] = useState4([]);
|
|
1632
|
+
const [openMarkerMenu, setOpenMarkerMenu] = useState4(null);
|
|
1633
|
+
const markerMenuRef = useRef4(null);
|
|
1591
1634
|
const editorInstanceRef = useRef4(null);
|
|
1592
|
-
const lastJumpIndexRef = useRef4({ errors: -1, warnings: -1 });
|
|
1593
1635
|
useEffect3(() => {
|
|
1594
|
-
if (!showSettingsPanel) return;
|
|
1636
|
+
if (!showSettingsPanel && !openMarkerMenu) return;
|
|
1595
1637
|
const handleClickOutside = (e) => {
|
|
1596
|
-
if (settingsRef.current && !settingsRef.current.contains(e.target)) {
|
|
1638
|
+
if (showSettingsPanel && settingsRef.current && !settingsRef.current.contains(e.target)) {
|
|
1597
1639
|
setShowSettingsPanel(false);
|
|
1598
1640
|
}
|
|
1641
|
+
if (openMarkerMenu && markerMenuRef.current && !markerMenuRef.current.contains(e.target)) {
|
|
1642
|
+
setOpenMarkerMenu(null);
|
|
1643
|
+
}
|
|
1599
1644
|
};
|
|
1600
1645
|
document.addEventListener("mousedown", handleClickOutside);
|
|
1601
1646
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
1602
|
-
}, [showSettingsPanel]);
|
|
1647
|
+
}, [showSettingsPanel, openMarkerMenu]);
|
|
1603
1648
|
const [currentTabId, setCurrentTabId] = useState4(
|
|
1604
1649
|
controlledActiveTab ?? defaultTab ?? tabs?.[0]?.id ?? ""
|
|
1605
1650
|
);
|
|
@@ -1640,33 +1685,20 @@ function CodeBox({
|
|
|
1640
1685
|
[userOnMount]
|
|
1641
1686
|
);
|
|
1642
1687
|
const handleMarkerCounts = useCallback3(
|
|
1643
|
-
(
|
|
1644
|
-
setMarkerCounts(
|
|
1645
|
-
|
|
1646
|
-
onValidationIssues?.(
|
|
1688
|
+
(info) => {
|
|
1689
|
+
setMarkerCounts({ errors: info.errors, warnings: info.warnings });
|
|
1690
|
+
setMarkerDetails(info.markers);
|
|
1691
|
+
onValidationIssues?.({ errors: info.errors, warnings: info.warnings });
|
|
1647
1692
|
},
|
|
1648
1693
|
[onValidationIssues]
|
|
1649
1694
|
);
|
|
1650
|
-
const
|
|
1695
|
+
const jumpToLine = useCallback3((line, column) => {
|
|
1651
1696
|
const ed = editorInstanceRef.current;
|
|
1652
1697
|
if (!ed) return;
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
const severityValue = severity === "error" ? 8 : 4;
|
|
1656
|
-
const markers = getMonaco().editor.getModelMarkers({ resource: model.uri }).filter((m) => m.severity === severityValue).sort(
|
|
1657
|
-
(a, b) => a.startLineNumber - b.startLineNumber || a.startColumn - b.startColumn
|
|
1658
|
-
);
|
|
1659
|
-
if (markers.length === 0) return;
|
|
1660
|
-
const key = severity === "error" ? "errors" : "warnings";
|
|
1661
|
-
const nextIndex = (lastJumpIndexRef.current[key] + 1) % markers.length;
|
|
1662
|
-
lastJumpIndexRef.current[key] = nextIndex;
|
|
1663
|
-
const marker = markers[nextIndex];
|
|
1664
|
-
ed.revealLineInCenter(marker.startLineNumber);
|
|
1665
|
-
ed.setPosition({
|
|
1666
|
-
lineNumber: marker.startLineNumber,
|
|
1667
|
-
column: marker.startColumn
|
|
1668
|
-
});
|
|
1698
|
+
ed.revealLineInCenter(line);
|
|
1699
|
+
ed.setPosition({ lineNumber: line, column });
|
|
1669
1700
|
ed.focus();
|
|
1701
|
+
setOpenMarkerMenu(null);
|
|
1670
1702
|
}, []);
|
|
1671
1703
|
const settingsProps = {
|
|
1672
1704
|
lineNumbers: settings.lineNumbers,
|
|
@@ -1676,56 +1708,88 @@ function CodeBox({
|
|
|
1676
1708
|
};
|
|
1677
1709
|
const actions = /* @__PURE__ */ jsxs3("div", { style: { display: "flex", gap: "4px", alignItems: "center" }, children: [
|
|
1678
1710
|
markerCounts.errors > 0 && /* @__PURE__ */ jsxs3(
|
|
1679
|
-
"
|
|
1711
|
+
"div",
|
|
1680
1712
|
{
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
title: `${markerCounts.errors} error${markerCounts.errors !== 1 ? "s" : ""} \u2014 click to jump`,
|
|
1713
|
+
ref: openMarkerMenu === "error" ? markerMenuRef : void 0,
|
|
1714
|
+
style: { position: "relative" },
|
|
1684
1715
|
children: [
|
|
1685
1716
|
/* @__PURE__ */ jsxs3(
|
|
1686
|
-
"
|
|
1717
|
+
"button",
|
|
1687
1718
|
{
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
viewBox: "0 0 24 24",
|
|
1691
|
-
fill: "none",
|
|
1692
|
-
stroke: "currentColor",
|
|
1693
|
-
strokeWidth: "2",
|
|
1719
|
+
className: "elb-codebox-marker-badge elb-codebox-marker-badge--error",
|
|
1720
|
+
onClick: () => setOpenMarkerMenu(openMarkerMenu === "error" ? null : "error"),
|
|
1694
1721
|
children: [
|
|
1695
|
-
/* @__PURE__ */
|
|
1696
|
-
|
|
1697
|
-
|
|
1722
|
+
/* @__PURE__ */ jsxs3(
|
|
1723
|
+
"svg",
|
|
1724
|
+
{
|
|
1725
|
+
width: "14",
|
|
1726
|
+
height: "14",
|
|
1727
|
+
viewBox: "0 0 24 24",
|
|
1728
|
+
fill: "none",
|
|
1729
|
+
stroke: "currentColor",
|
|
1730
|
+
strokeWidth: "2",
|
|
1731
|
+
children: [
|
|
1732
|
+
/* @__PURE__ */ jsx4("circle", { cx: "12", cy: "12", r: "10" }),
|
|
1733
|
+
/* @__PURE__ */ jsx4("line", { x1: "15", y1: "9", x2: "9", y2: "15" }),
|
|
1734
|
+
/* @__PURE__ */ jsx4("line", { x1: "9", y1: "9", x2: "15", y2: "15" })
|
|
1735
|
+
]
|
|
1736
|
+
}
|
|
1737
|
+
),
|
|
1738
|
+
/* @__PURE__ */ jsx4("span", { children: markerCounts.errors })
|
|
1698
1739
|
]
|
|
1699
1740
|
}
|
|
1700
1741
|
),
|
|
1701
|
-
/* @__PURE__ */ jsx4(
|
|
1742
|
+
openMarkerMenu === "error" && /* @__PURE__ */ jsx4(
|
|
1743
|
+
MarkerMenu,
|
|
1744
|
+
{
|
|
1745
|
+
markers: markerDetails.filter((m) => m.severity === "error"),
|
|
1746
|
+
onJump: jumpToLine
|
|
1747
|
+
}
|
|
1748
|
+
)
|
|
1702
1749
|
]
|
|
1703
1750
|
}
|
|
1704
1751
|
),
|
|
1705
1752
|
markerCounts.warnings > 0 && /* @__PURE__ */ jsxs3(
|
|
1706
|
-
"
|
|
1753
|
+
"div",
|
|
1707
1754
|
{
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
title: `${markerCounts.warnings} warning${markerCounts.warnings !== 1 ? "s" : ""} \u2014 click to jump`,
|
|
1755
|
+
ref: openMarkerMenu === "warning" ? markerMenuRef : void 0,
|
|
1756
|
+
style: { position: "relative" },
|
|
1711
1757
|
children: [
|
|
1712
1758
|
/* @__PURE__ */ jsxs3(
|
|
1713
|
-
"
|
|
1759
|
+
"button",
|
|
1714
1760
|
{
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
viewBox: "0 0 24 24",
|
|
1718
|
-
fill: "none",
|
|
1719
|
-
stroke: "currentColor",
|
|
1720
|
-
strokeWidth: "2",
|
|
1761
|
+
className: "elb-codebox-marker-badge elb-codebox-marker-badge--warning",
|
|
1762
|
+
onClick: () => setOpenMarkerMenu(openMarkerMenu === "warning" ? null : "warning"),
|
|
1721
1763
|
children: [
|
|
1722
|
-
/* @__PURE__ */
|
|
1723
|
-
|
|
1724
|
-
|
|
1764
|
+
/* @__PURE__ */ jsxs3(
|
|
1765
|
+
"svg",
|
|
1766
|
+
{
|
|
1767
|
+
width: "14",
|
|
1768
|
+
height: "14",
|
|
1769
|
+
viewBox: "0 0 24 24",
|
|
1770
|
+
fill: "none",
|
|
1771
|
+
stroke: "currentColor",
|
|
1772
|
+
strokeWidth: "2",
|
|
1773
|
+
strokeLinecap: "round",
|
|
1774
|
+
strokeLinejoin: "round",
|
|
1775
|
+
children: [
|
|
1776
|
+
/* @__PURE__ */ jsx4("path", { d: "M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z" }),
|
|
1777
|
+
/* @__PURE__ */ jsx4("line", { x1: "12", y1: "9", x2: "12", y2: "13" }),
|
|
1778
|
+
/* @__PURE__ */ jsx4("circle", { cx: "12", cy: "17", r: ".5" })
|
|
1779
|
+
]
|
|
1780
|
+
}
|
|
1781
|
+
),
|
|
1782
|
+
/* @__PURE__ */ jsx4("span", { children: markerCounts.warnings })
|
|
1725
1783
|
]
|
|
1726
1784
|
}
|
|
1727
1785
|
),
|
|
1728
|
-
/* @__PURE__ */ jsx4(
|
|
1786
|
+
openMarkerMenu === "warning" && /* @__PURE__ */ jsx4(
|
|
1787
|
+
MarkerMenu,
|
|
1788
|
+
{
|
|
1789
|
+
markers: markerDetails.filter((m) => m.severity === "warning"),
|
|
1790
|
+
onJump: jumpToLine
|
|
1791
|
+
}
|
|
1792
|
+
)
|
|
1729
1793
|
]
|
|
1730
1794
|
}
|
|
1731
1795
|
),
|
|
@@ -1920,6 +1984,26 @@ function CodeBox({
|
|
|
1920
1984
|
}
|
|
1921
1985
|
);
|
|
1922
1986
|
}
|
|
1987
|
+
function MarkerMenu({
|
|
1988
|
+
markers,
|
|
1989
|
+
onJump
|
|
1990
|
+
}) {
|
|
1991
|
+
return /* @__PURE__ */ jsx4("div", { className: "elb-codebox-marker-menu", children: markers.sort((a, b) => a.line - b.line || a.column - b.column).map((m, i) => /* @__PURE__ */ jsxs3(
|
|
1992
|
+
"button",
|
|
1993
|
+
{
|
|
1994
|
+
className: "elb-codebox-marker-menu-item",
|
|
1995
|
+
onClick: () => onJump(m.line, m.column),
|
|
1996
|
+
children: [
|
|
1997
|
+
/* @__PURE__ */ jsxs3("span", { className: "elb-codebox-marker-menu-line", children: [
|
|
1998
|
+
"Ln ",
|
|
1999
|
+
m.line
|
|
2000
|
+
] }),
|
|
2001
|
+
/* @__PURE__ */ jsx4("span", { className: "elb-codebox-marker-menu-msg", children: m.message })
|
|
2002
|
+
]
|
|
2003
|
+
},
|
|
2004
|
+
i
|
|
2005
|
+
)) });
|
|
2006
|
+
}
|
|
1923
2007
|
|
|
1924
2008
|
// src/components/atoms/grid.tsx
|
|
1925
2009
|
import {
|
|
@@ -2593,10 +2677,14 @@ function Preview({
|
|
|
2593
2677
|
const createNoopLogger = () => ({
|
|
2594
2678
|
error: () => {
|
|
2595
2679
|
},
|
|
2680
|
+
warn: () => {
|
|
2681
|
+
},
|
|
2596
2682
|
info: () => {
|
|
2597
2683
|
},
|
|
2598
2684
|
debug: () => {
|
|
2599
2685
|
},
|
|
2686
|
+
json: () => {
|
|
2687
|
+
},
|
|
2600
2688
|
throw: (msg) => {
|
|
2601
2689
|
throw msg instanceof Error ? msg : new Error(msg);
|
|
2602
2690
|
},
|
|
@@ -2633,6 +2721,8 @@ function Preview({
|
|
|
2633
2721
|
logger: noopLogger,
|
|
2634
2722
|
setIngest: async () => {
|
|
2635
2723
|
},
|
|
2724
|
+
setRespond: () => {
|
|
2725
|
+
},
|
|
2636
2726
|
config,
|
|
2637
2727
|
env
|
|
2638
2728
|
});
|