tokensafe-ui 0.1.8 → 0.1.10
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/{chunk-W4DCPVD6.js → chunk-4E3ZOBB5.js} +2 -2
- package/dist/{chunk-OE2N2PMS.js → chunk-IYLKNCN7.js} +3 -3
- package/dist/{chunk-JQRAF2JG.js → chunk-PRDRKCKA.js} +101 -42
- package/dist/{chunk-GJWCBVCA.js → chunk-QM2CUNVR.js} +1 -1
- package/dist/{chunk-UXZDGOF5.js → chunk-RFQ234HI.js} +1 -1
- package/dist/cli.js +4 -4
- package/dist/index.cjs +101 -42
- package/dist/index.js +1 -1
- package/dist/mcp.js +4 -4
- package/dist/observer.js +2 -2
- package/dist/oumv.js +4 -4
- package/dist/react.js +4 -4
- package/dist/testing.js +1 -1
- package/dist/vite.js +1 -1
- package/dist/vue.js +4 -4
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
buildDependencyGraph,
|
|
3
3
|
observeDiff
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-QM2CUNVR.js";
|
|
5
5
|
import {
|
|
6
6
|
applyPatch
|
|
7
7
|
} from "./chunk-N7XIVYCL.js";
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
activeInstances,
|
|
10
10
|
testAction,
|
|
11
11
|
testEffect
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-PRDRKCKA.js";
|
|
13
13
|
|
|
14
14
|
// ../mcp/dist/index.js
|
|
15
15
|
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
atomicApplySourceEdit,
|
|
3
3
|
validateWorkspacePath
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-4E3ZOBB5.js";
|
|
5
5
|
import {
|
|
6
6
|
buildDependencyGraph,
|
|
7
7
|
observe
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-QM2CUNVR.js";
|
|
9
9
|
import {
|
|
10
10
|
testAction
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-PRDRKCKA.js";
|
|
12
12
|
|
|
13
13
|
// ../oumv/dist/chunk-ONAJHNWR.js
|
|
14
14
|
import fs from "fs";
|
|
@@ -837,8 +837,14 @@ var SVG_TAGS = /* @__PURE__ */ new Set([
|
|
|
837
837
|
]);
|
|
838
838
|
function h(type, props, ...children) {
|
|
839
839
|
const normalizedProps = props || {};
|
|
840
|
-
|
|
841
|
-
if (flatChildren.length
|
|
840
|
+
let flatChildren = children.flat().filter((c) => c !== null && c !== void 0);
|
|
841
|
+
if (flatChildren.length === 0 && normalizedProps.children) {
|
|
842
|
+
if (Array.isArray(normalizedProps.children)) {
|
|
843
|
+
flatChildren = normalizedProps.children.flat().filter((c) => c !== null && c !== void 0);
|
|
844
|
+
} else {
|
|
845
|
+
flatChildren = [normalizedProps.children];
|
|
846
|
+
}
|
|
847
|
+
} else if (flatChildren.length > 0 && !normalizedProps.children) {
|
|
842
848
|
normalizedProps.children = flatChildren.length === 1 ? flatChildren[0] : flatChildren;
|
|
843
849
|
}
|
|
844
850
|
return {
|
|
@@ -1044,13 +1050,52 @@ function hydrateNode(domNode, vnode, instance) {
|
|
|
1044
1050
|
}
|
|
1045
1051
|
}
|
|
1046
1052
|
}
|
|
1053
|
+
var idSeq = 0;
|
|
1054
|
+
var fallbackDispatcher = {
|
|
1055
|
+
readContext: (ctx) => ctx?._currentValue,
|
|
1056
|
+
useCallback: (fn) => fn,
|
|
1057
|
+
useContext: (ctx) => ctx?._currentValue,
|
|
1058
|
+
useEffect: () => {
|
|
1059
|
+
},
|
|
1060
|
+
useImperativeHandle: () => {
|
|
1061
|
+
},
|
|
1062
|
+
useInsertionEffect: () => {
|
|
1063
|
+
},
|
|
1064
|
+
useLayoutEffect: () => {
|
|
1065
|
+
},
|
|
1066
|
+
useMemo: (fn) => fn(),
|
|
1067
|
+
useReducer: (_, init) => [init, () => {
|
|
1068
|
+
}],
|
|
1069
|
+
useRef: (init) => ({ current: init }),
|
|
1070
|
+
useState: (init) => [typeof init === "function" ? init() : init, () => {
|
|
1071
|
+
}],
|
|
1072
|
+
useDebugValue: () => {
|
|
1073
|
+
},
|
|
1074
|
+
useDeferredValue: (v) => v,
|
|
1075
|
+
useTransition: () => [false, (fn) => fn()],
|
|
1076
|
+
useId: () => `:r${++idSeq}:`
|
|
1077
|
+
};
|
|
1078
|
+
function ensureReactDispatcher() {
|
|
1079
|
+
try {
|
|
1080
|
+
const React = globalThis.React || typeof window !== "undefined" && window.React;
|
|
1081
|
+
if (!React) return;
|
|
1082
|
+
const clientInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
|
|
1083
|
+
if (clientInternals && !clientInternals.H) {
|
|
1084
|
+
clientInternals.H = fallbackDispatcher;
|
|
1085
|
+
}
|
|
1086
|
+
const secretInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
1087
|
+
if (secretInternals?.ReactCurrentDispatcher && !secretInternals.ReactCurrentDispatcher.current) {
|
|
1088
|
+
secretInternals.ReactCurrentDispatcher.current = fallbackDispatcher;
|
|
1089
|
+
}
|
|
1090
|
+
} catch {
|
|
1091
|
+
}
|
|
1092
|
+
}
|
|
1047
1093
|
function convertReactNode(rn) {
|
|
1048
1094
|
if (!rn || typeof rn !== "object") return rn;
|
|
1049
1095
|
if (Array.isArray(rn)) return rn.map(convertReactNode);
|
|
1050
1096
|
if ("props" in rn && "type" in rn) {
|
|
1051
1097
|
const props = { ...rn.props || {} };
|
|
1052
1098
|
const rawChildren = props.children;
|
|
1053
|
-
delete props.children;
|
|
1054
1099
|
let children = [];
|
|
1055
1100
|
if (Array.isArray(rawChildren)) {
|
|
1056
1101
|
children = rawChildren.flat().filter((c) => c !== null && c !== void 0).map(convertReactNode);
|
|
@@ -1106,20 +1151,27 @@ function renderVNode(node, instance) {
|
|
|
1106
1151
|
}
|
|
1107
1152
|
return root;
|
|
1108
1153
|
}
|
|
1109
|
-
let
|
|
1154
|
+
let vnode = node;
|
|
1155
|
+
if ("props" in vnode && (!("children" in vnode) || !Array.isArray(vnode.children) || "$$typeof" in vnode)) {
|
|
1156
|
+
vnode = convertReactNode(vnode);
|
|
1157
|
+
}
|
|
1158
|
+
let targetType = vnode.type;
|
|
1110
1159
|
if (typeof targetType === "object" && targetType !== null) {
|
|
1111
1160
|
if (targetType.$$typeof && targetType.type) {
|
|
1112
1161
|
targetType = targetType.type;
|
|
1113
1162
|
}
|
|
1114
1163
|
if (typeof targetType.render === "function") {
|
|
1115
|
-
|
|
1164
|
+
ensureReactDispatcher();
|
|
1165
|
+
const rendered = targetType.render(vnode.props, vnode.props?.ref || null);
|
|
1116
1166
|
return renderVNode(convertReactNode(rendered), instance);
|
|
1117
1167
|
}
|
|
1118
1168
|
}
|
|
1169
|
+
const rawChildren = vnode.children ?? vnode.props?.children;
|
|
1170
|
+
const childrenList = Array.isArray(rawChildren) ? rawChildren : rawChildren !== null && rawChildren !== void 0 ? [rawChildren] : [];
|
|
1119
1171
|
if (typeof targetType === "function") {
|
|
1120
1172
|
if (targetType === Fragment) {
|
|
1121
1173
|
const fragment = document.createDocumentFragment();
|
|
1122
|
-
for (const child of
|
|
1174
|
+
for (const child of childrenList) {
|
|
1123
1175
|
fragment.appendChild(renderVNode(child, instance));
|
|
1124
1176
|
}
|
|
1125
1177
|
return fragment;
|
|
@@ -1133,7 +1185,7 @@ function renderVNode(node, instance) {
|
|
|
1133
1185
|
let currentNodes = [];
|
|
1134
1186
|
let currentScope = null;
|
|
1135
1187
|
effect(() => {
|
|
1136
|
-
const whenVal = typeof
|
|
1188
|
+
const whenVal = typeof vnode.props.when === "function" ? vnode.props.when() : vnode.props.when;
|
|
1137
1189
|
if (currentScope) {
|
|
1138
1190
|
currentScope.dispose();
|
|
1139
1191
|
currentScope = null;
|
|
@@ -1145,7 +1197,7 @@ function renderVNode(node, instance) {
|
|
|
1145
1197
|
if (whenVal) {
|
|
1146
1198
|
const { result: rendered, scope: branchScope } = createScope(() => {
|
|
1147
1199
|
const branch = untrack(
|
|
1148
|
-
() => typeof
|
|
1200
|
+
() => typeof vnode.props.children === "function" ? vnode.props.children(whenVal) : vnode.props.children
|
|
1149
1201
|
);
|
|
1150
1202
|
return untrack(() => branch ? renderVNode(branch, instance) : null);
|
|
1151
1203
|
});
|
|
@@ -1155,9 +1207,9 @@ function renderVNode(node, instance) {
|
|
|
1155
1207
|
parent.insertBefore(rendered, endAnchor);
|
|
1156
1208
|
currentNodes.push(rendered);
|
|
1157
1209
|
}
|
|
1158
|
-
} else if (
|
|
1210
|
+
} else if (vnode.props.fallback) {
|
|
1159
1211
|
const { result: rendered, scope: branchScope } = createScope(() => {
|
|
1160
|
-
return untrack(() => renderVNode(
|
|
1212
|
+
return untrack(() => renderVNode(vnode.props.fallback, instance));
|
|
1161
1213
|
});
|
|
1162
1214
|
currentScope = branchScope;
|
|
1163
1215
|
if (rendered) {
|
|
@@ -1172,7 +1224,7 @@ function renderVNode(node, instance) {
|
|
|
1172
1224
|
});
|
|
1173
1225
|
return container;
|
|
1174
1226
|
}
|
|
1175
|
-
if (
|
|
1227
|
+
if (vnode.type === For) {
|
|
1176
1228
|
const container = document.createDocumentFragment();
|
|
1177
1229
|
const startAnchor = document.createComment("agent-dom:for-start");
|
|
1178
1230
|
const endAnchor = document.createComment("agent-dom:for-end");
|
|
@@ -1180,16 +1232,16 @@ function renderVNode(node, instance) {
|
|
|
1180
1232
|
container.appendChild(endAnchor);
|
|
1181
1233
|
let currentMap = /* @__PURE__ */ new Map();
|
|
1182
1234
|
effect(() => {
|
|
1183
|
-
const rawItems = typeof
|
|
1235
|
+
const rawItems = typeof vnode.props.each === "function" ? vnode.props.each() : vnode.props.each || [];
|
|
1184
1236
|
const items = Array.isArray(rawItems) ? rawItems : [];
|
|
1185
1237
|
const newMap = /* @__PURE__ */ new Map();
|
|
1186
1238
|
const parent = endAnchor.parentNode || container;
|
|
1187
1239
|
items.forEach((item, idx) => {
|
|
1188
1240
|
let itemKey;
|
|
1189
|
-
if (typeof
|
|
1190
|
-
itemKey =
|
|
1191
|
-
} else if (
|
|
1192
|
-
itemKey = item[
|
|
1241
|
+
if (typeof vnode.props.key === "function") {
|
|
1242
|
+
itemKey = vnode.props.key(item, idx);
|
|
1243
|
+
} else if (vnode.props.key && typeof item === "object") {
|
|
1244
|
+
itemKey = item[vnode.props.key];
|
|
1193
1245
|
} else {
|
|
1194
1246
|
itemKey = item?.id ?? item?.key ?? (typeof item === "string" ? item : idx);
|
|
1195
1247
|
}
|
|
@@ -1202,7 +1254,7 @@ function renderVNode(node, instance) {
|
|
|
1202
1254
|
} else {
|
|
1203
1255
|
const indexSignal = signal(idx);
|
|
1204
1256
|
const { result: rendered, scope: itemScope } = createScope(() => {
|
|
1205
|
-
const childVNode2 = untrack(() =>
|
|
1257
|
+
const childVNode2 = untrack(() => vnode.props.children(item, () => indexSignal.value));
|
|
1206
1258
|
return untrack(() => renderVNode(childVNode2, instance));
|
|
1207
1259
|
});
|
|
1208
1260
|
existing = { key: itemKey, node: rendered, indexSignal, scope: itemScope };
|
|
@@ -1227,7 +1279,7 @@ function renderVNode(node, instance) {
|
|
|
1227
1279
|
}
|
|
1228
1280
|
if (targetType === ErrorBoundary) {
|
|
1229
1281
|
try {
|
|
1230
|
-
return renderVNode(
|
|
1282
|
+
return renderVNode(vnode.props.children, instance);
|
|
1231
1283
|
} catch (err) {
|
|
1232
1284
|
if (instance?.runtimeLog) {
|
|
1233
1285
|
instance.runtimeLog.push({
|
|
@@ -1236,20 +1288,20 @@ function renderVNode(node, instance) {
|
|
|
1236
1288
|
error: `ErrorBoundary: ${err.message}`
|
|
1237
1289
|
});
|
|
1238
1290
|
}
|
|
1239
|
-
return renderVNode(
|
|
1291
|
+
return renderVNode(vnode.props.fallback(err), instance);
|
|
1240
1292
|
}
|
|
1241
1293
|
}
|
|
1242
|
-
let childVNode = targetType(
|
|
1294
|
+
let childVNode = targetType(vnode.props);
|
|
1243
1295
|
if (typeof childVNode === "function") {
|
|
1244
1296
|
childVNode = childVNode();
|
|
1245
1297
|
}
|
|
1246
1298
|
return renderVNode(childVNode, instance);
|
|
1247
1299
|
}
|
|
1248
|
-
const tagName = typeof
|
|
1300
|
+
const tagName = typeof vnode.type === "string" ? vnode.type : String(vnode.type);
|
|
1249
1301
|
const isSvg = SVG_TAGS.has(tagName.toLowerCase());
|
|
1250
1302
|
const el = isSvg ? document.createElementNS(SVG_NS, tagName) : document.createElement(tagName);
|
|
1251
1303
|
const cleanups = instance?._cleanups;
|
|
1252
|
-
for (const [key, value] of Object.entries(
|
|
1304
|
+
for (const [key, value] of Object.entries(vnode.props || {})) {
|
|
1253
1305
|
if (key === "children") continue;
|
|
1254
1306
|
if (key === "ref") {
|
|
1255
1307
|
if (typeof value === "function") {
|
|
@@ -1280,7 +1332,7 @@ function renderVNode(node, instance) {
|
|
|
1280
1332
|
if (key.startsWith("on") && typeof value === "function") {
|
|
1281
1333
|
const eventName = key.slice(2).toLowerCase();
|
|
1282
1334
|
el.addEventListener(eventName, value);
|
|
1283
|
-
if (value?._actionName && !
|
|
1335
|
+
if (value?._actionName && !vnode.props["data-agent-action"]) {
|
|
1284
1336
|
el.setAttribute("data-agent-action", value._actionName);
|
|
1285
1337
|
}
|
|
1286
1338
|
} else if (key === "class" || key === "className") {
|
|
@@ -1334,7 +1386,7 @@ function renderVNode(node, instance) {
|
|
|
1334
1386
|
el.setAttribute(key, value === true ? "" : String(value));
|
|
1335
1387
|
}
|
|
1336
1388
|
}
|
|
1337
|
-
for (const child of
|
|
1389
|
+
for (const child of childrenList) {
|
|
1338
1390
|
if (typeof child === "function") {
|
|
1339
1391
|
const parentAgentId = el.getAttribute("data-agent-id") || el.tagName.toLowerCase();
|
|
1340
1392
|
const startAnchor = document.createComment(`tokensafe:dyn-start`);
|
|
@@ -1432,44 +1484,51 @@ function vnodeToString(node) {
|
|
|
1432
1484
|
if (Array.isArray(node)) {
|
|
1433
1485
|
return node.map(vnodeToString).join("");
|
|
1434
1486
|
}
|
|
1435
|
-
let
|
|
1487
|
+
let vnode = node;
|
|
1488
|
+
if ("props" in vnode && (!("children" in vnode) || !Array.isArray(vnode.children) || "$$typeof" in vnode)) {
|
|
1489
|
+
vnode = convertReactNode(vnode);
|
|
1490
|
+
}
|
|
1491
|
+
let targetType = vnode.type;
|
|
1436
1492
|
if (typeof targetType === "object" && targetType !== null) {
|
|
1437
1493
|
if (targetType.$$typeof && targetType.type) {
|
|
1438
1494
|
targetType = targetType.type;
|
|
1439
1495
|
}
|
|
1440
1496
|
if (typeof targetType.render === "function") {
|
|
1441
|
-
|
|
1497
|
+
ensureReactDispatcher();
|
|
1498
|
+
const rendered = targetType.render(vnode.props, vnode.props?.ref || null);
|
|
1442
1499
|
return vnodeToString(convertReactNode(rendered));
|
|
1443
1500
|
}
|
|
1444
1501
|
}
|
|
1502
|
+
const rawChildren = vnode.children ?? vnode.props?.children;
|
|
1503
|
+
const childrenList = Array.isArray(rawChildren) ? rawChildren : rawChildren !== null && rawChildren !== void 0 ? [rawChildren] : [];
|
|
1445
1504
|
if (typeof targetType === "function") {
|
|
1446
1505
|
if (targetType === Fragment) {
|
|
1447
|
-
return
|
|
1506
|
+
return childrenList.map(vnodeToString).join("");
|
|
1448
1507
|
}
|
|
1449
1508
|
if (targetType === Show) {
|
|
1450
|
-
const whenVal = typeof
|
|
1451
|
-
const branch = whenVal ? typeof
|
|
1509
|
+
const whenVal = typeof vnode.props.when === "function" ? vnode.props.when() : vnode.props.when;
|
|
1510
|
+
const branch = whenVal ? typeof vnode.props.children === "function" ? vnode.props.children(whenVal) : vnode.props.children : vnode.props.fallback;
|
|
1452
1511
|
return branch ? vnodeToString(branch) : "";
|
|
1453
1512
|
}
|
|
1454
1513
|
if (targetType === For) {
|
|
1455
|
-
const rawItems = typeof
|
|
1514
|
+
const rawItems = typeof vnode.props.each === "function" ? vnode.props.each() : vnode.props.each || [];
|
|
1456
1515
|
const items = Array.isArray(rawItems) ? rawItems : [];
|
|
1457
1516
|
return items.map((item, idx) => {
|
|
1458
|
-
const childNode =
|
|
1517
|
+
const childNode = vnode.props.children(item, () => idx);
|
|
1459
1518
|
return vnodeToString(childNode);
|
|
1460
1519
|
}).join("");
|
|
1461
1520
|
}
|
|
1462
1521
|
if (targetType === ErrorBoundary) {
|
|
1463
1522
|
try {
|
|
1464
|
-
return vnodeToString(
|
|
1523
|
+
return vnodeToString(vnode.props.children);
|
|
1465
1524
|
} catch (err) {
|
|
1466
|
-
return vnodeToString(
|
|
1525
|
+
return vnodeToString(vnode.props.fallback(err));
|
|
1467
1526
|
}
|
|
1468
1527
|
}
|
|
1469
|
-
return vnodeToString(targetType(
|
|
1528
|
+
return vnodeToString(targetType(vnode.props));
|
|
1470
1529
|
}
|
|
1471
1530
|
const attrs = [];
|
|
1472
|
-
for (let [key, value] of Object.entries(
|
|
1531
|
+
for (let [key, value] of Object.entries(vnode.props || {})) {
|
|
1473
1532
|
if (key === "children" || key.startsWith("on")) continue;
|
|
1474
1533
|
if (typeof value === "function") {
|
|
1475
1534
|
try {
|
|
@@ -1487,15 +1546,15 @@ function vnodeToString(node) {
|
|
|
1487
1546
|
}
|
|
1488
1547
|
}
|
|
1489
1548
|
const attrStr = attrs.length > 0 ? " " + attrs.join(" ") : "";
|
|
1490
|
-
if (
|
|
1491
|
-
return `<${
|
|
1549
|
+
if (vnode.props?.dangerouslySetInnerHTML?.__html) {
|
|
1550
|
+
return `<${vnode.type}${attrStr}>${vnode.props.dangerouslySetInnerHTML.__html}</${vnode.type}>`;
|
|
1492
1551
|
}
|
|
1493
|
-
if (
|
|
1494
|
-
const raw = typeof
|
|
1495
|
-
return `<${
|
|
1552
|
+
if (vnode.props?.innerHTML) {
|
|
1553
|
+
const raw = typeof vnode.props.innerHTML === "function" ? vnode.props.innerHTML() : vnode.props.innerHTML;
|
|
1554
|
+
return `<${vnode.type}${attrStr}>${raw}</${vnode.type}>`;
|
|
1496
1555
|
}
|
|
1497
|
-
const childrenStr =
|
|
1498
|
-
return `<${
|
|
1556
|
+
const childrenStr = childrenList.map(vnodeToString).join("");
|
|
1557
|
+
return `<${vnode.type}${attrStr}>${childrenStr}</${vnode.type}>`;
|
|
1499
1558
|
}
|
|
1500
1559
|
function escapeHtml(str) {
|
|
1501
1560
|
return str.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
package/dist/cli.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
startMcpServer
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-RFQ234HI.js";
|
|
4
|
+
import "./chunk-4E3ZOBB5.js";
|
|
5
|
+
import "./chunk-QM2CUNVR.js";
|
|
6
6
|
import "./chunk-N7XIVYCL.js";
|
|
7
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-PRDRKCKA.js";
|
|
8
8
|
|
|
9
9
|
// src/cli.ts
|
|
10
10
|
function parseCliArgs(argv) {
|
package/dist/index.cjs
CHANGED
|
@@ -897,8 +897,14 @@ var SVG_TAGS = /* @__PURE__ */ new Set([
|
|
|
897
897
|
]);
|
|
898
898
|
function h(type, props, ...children) {
|
|
899
899
|
const normalizedProps = props || {};
|
|
900
|
-
|
|
901
|
-
if (flatChildren.length
|
|
900
|
+
let flatChildren = children.flat().filter((c) => c !== null && c !== void 0);
|
|
901
|
+
if (flatChildren.length === 0 && normalizedProps.children) {
|
|
902
|
+
if (Array.isArray(normalizedProps.children)) {
|
|
903
|
+
flatChildren = normalizedProps.children.flat().filter((c) => c !== null && c !== void 0);
|
|
904
|
+
} else {
|
|
905
|
+
flatChildren = [normalizedProps.children];
|
|
906
|
+
}
|
|
907
|
+
} else if (flatChildren.length > 0 && !normalizedProps.children) {
|
|
902
908
|
normalizedProps.children = flatChildren.length === 1 ? flatChildren[0] : flatChildren;
|
|
903
909
|
}
|
|
904
910
|
return {
|
|
@@ -1104,13 +1110,52 @@ function hydrateNode(domNode, vnode, instance) {
|
|
|
1104
1110
|
}
|
|
1105
1111
|
}
|
|
1106
1112
|
}
|
|
1113
|
+
var idSeq = 0;
|
|
1114
|
+
var fallbackDispatcher = {
|
|
1115
|
+
readContext: (ctx) => ctx?._currentValue,
|
|
1116
|
+
useCallback: (fn) => fn,
|
|
1117
|
+
useContext: (ctx) => ctx?._currentValue,
|
|
1118
|
+
useEffect: () => {
|
|
1119
|
+
},
|
|
1120
|
+
useImperativeHandle: () => {
|
|
1121
|
+
},
|
|
1122
|
+
useInsertionEffect: () => {
|
|
1123
|
+
},
|
|
1124
|
+
useLayoutEffect: () => {
|
|
1125
|
+
},
|
|
1126
|
+
useMemo: (fn) => fn(),
|
|
1127
|
+
useReducer: (_, init) => [init, () => {
|
|
1128
|
+
}],
|
|
1129
|
+
useRef: (init) => ({ current: init }),
|
|
1130
|
+
useState: (init) => [typeof init === "function" ? init() : init, () => {
|
|
1131
|
+
}],
|
|
1132
|
+
useDebugValue: () => {
|
|
1133
|
+
},
|
|
1134
|
+
useDeferredValue: (v) => v,
|
|
1135
|
+
useTransition: () => [false, (fn) => fn()],
|
|
1136
|
+
useId: () => `:r${++idSeq}:`
|
|
1137
|
+
};
|
|
1138
|
+
function ensureReactDispatcher() {
|
|
1139
|
+
try {
|
|
1140
|
+
const React = globalThis.React || typeof window !== "undefined" && window.React;
|
|
1141
|
+
if (!React) return;
|
|
1142
|
+
const clientInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
|
|
1143
|
+
if (clientInternals && !clientInternals.H) {
|
|
1144
|
+
clientInternals.H = fallbackDispatcher;
|
|
1145
|
+
}
|
|
1146
|
+
const secretInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
1147
|
+
if (secretInternals?.ReactCurrentDispatcher && !secretInternals.ReactCurrentDispatcher.current) {
|
|
1148
|
+
secretInternals.ReactCurrentDispatcher.current = fallbackDispatcher;
|
|
1149
|
+
}
|
|
1150
|
+
} catch {
|
|
1151
|
+
}
|
|
1152
|
+
}
|
|
1107
1153
|
function convertReactNode(rn) {
|
|
1108
1154
|
if (!rn || typeof rn !== "object") return rn;
|
|
1109
1155
|
if (Array.isArray(rn)) return rn.map(convertReactNode);
|
|
1110
1156
|
if ("props" in rn && "type" in rn) {
|
|
1111
1157
|
const props = { ...rn.props || {} };
|
|
1112
1158
|
const rawChildren = props.children;
|
|
1113
|
-
delete props.children;
|
|
1114
1159
|
let children = [];
|
|
1115
1160
|
if (Array.isArray(rawChildren)) {
|
|
1116
1161
|
children = rawChildren.flat().filter((c) => c !== null && c !== void 0).map(convertReactNode);
|
|
@@ -1166,20 +1211,27 @@ function renderVNode(node, instance) {
|
|
|
1166
1211
|
}
|
|
1167
1212
|
return root;
|
|
1168
1213
|
}
|
|
1169
|
-
let
|
|
1214
|
+
let vnode = node;
|
|
1215
|
+
if ("props" in vnode && (!("children" in vnode) || !Array.isArray(vnode.children) || "$$typeof" in vnode)) {
|
|
1216
|
+
vnode = convertReactNode(vnode);
|
|
1217
|
+
}
|
|
1218
|
+
let targetType = vnode.type;
|
|
1170
1219
|
if (typeof targetType === "object" && targetType !== null) {
|
|
1171
1220
|
if (targetType.$$typeof && targetType.type) {
|
|
1172
1221
|
targetType = targetType.type;
|
|
1173
1222
|
}
|
|
1174
1223
|
if (typeof targetType.render === "function") {
|
|
1175
|
-
|
|
1224
|
+
ensureReactDispatcher();
|
|
1225
|
+
const rendered = targetType.render(vnode.props, vnode.props?.ref || null);
|
|
1176
1226
|
return renderVNode(convertReactNode(rendered), instance);
|
|
1177
1227
|
}
|
|
1178
1228
|
}
|
|
1229
|
+
const rawChildren = vnode.children ?? vnode.props?.children;
|
|
1230
|
+
const childrenList = Array.isArray(rawChildren) ? rawChildren : rawChildren !== null && rawChildren !== void 0 ? [rawChildren] : [];
|
|
1179
1231
|
if (typeof targetType === "function") {
|
|
1180
1232
|
if (targetType === Fragment) {
|
|
1181
1233
|
const fragment = document.createDocumentFragment();
|
|
1182
|
-
for (const child of
|
|
1234
|
+
for (const child of childrenList) {
|
|
1183
1235
|
fragment.appendChild(renderVNode(child, instance));
|
|
1184
1236
|
}
|
|
1185
1237
|
return fragment;
|
|
@@ -1193,7 +1245,7 @@ function renderVNode(node, instance) {
|
|
|
1193
1245
|
let currentNodes = [];
|
|
1194
1246
|
let currentScope = null;
|
|
1195
1247
|
effect(() => {
|
|
1196
|
-
const whenVal = typeof
|
|
1248
|
+
const whenVal = typeof vnode.props.when === "function" ? vnode.props.when() : vnode.props.when;
|
|
1197
1249
|
if (currentScope) {
|
|
1198
1250
|
currentScope.dispose();
|
|
1199
1251
|
currentScope = null;
|
|
@@ -1205,7 +1257,7 @@ function renderVNode(node, instance) {
|
|
|
1205
1257
|
if (whenVal) {
|
|
1206
1258
|
const { result: rendered, scope: branchScope } = createScope(() => {
|
|
1207
1259
|
const branch = untrack(
|
|
1208
|
-
() => typeof
|
|
1260
|
+
() => typeof vnode.props.children === "function" ? vnode.props.children(whenVal) : vnode.props.children
|
|
1209
1261
|
);
|
|
1210
1262
|
return untrack(() => branch ? renderVNode(branch, instance) : null);
|
|
1211
1263
|
});
|
|
@@ -1215,9 +1267,9 @@ function renderVNode(node, instance) {
|
|
|
1215
1267
|
parent.insertBefore(rendered, endAnchor);
|
|
1216
1268
|
currentNodes.push(rendered);
|
|
1217
1269
|
}
|
|
1218
|
-
} else if (
|
|
1270
|
+
} else if (vnode.props.fallback) {
|
|
1219
1271
|
const { result: rendered, scope: branchScope } = createScope(() => {
|
|
1220
|
-
return untrack(() => renderVNode(
|
|
1272
|
+
return untrack(() => renderVNode(vnode.props.fallback, instance));
|
|
1221
1273
|
});
|
|
1222
1274
|
currentScope = branchScope;
|
|
1223
1275
|
if (rendered) {
|
|
@@ -1232,7 +1284,7 @@ function renderVNode(node, instance) {
|
|
|
1232
1284
|
});
|
|
1233
1285
|
return container;
|
|
1234
1286
|
}
|
|
1235
|
-
if (
|
|
1287
|
+
if (vnode.type === For) {
|
|
1236
1288
|
const container = document.createDocumentFragment();
|
|
1237
1289
|
const startAnchor = document.createComment("agent-dom:for-start");
|
|
1238
1290
|
const endAnchor = document.createComment("agent-dom:for-end");
|
|
@@ -1240,16 +1292,16 @@ function renderVNode(node, instance) {
|
|
|
1240
1292
|
container.appendChild(endAnchor);
|
|
1241
1293
|
let currentMap = /* @__PURE__ */ new Map();
|
|
1242
1294
|
effect(() => {
|
|
1243
|
-
const rawItems = typeof
|
|
1295
|
+
const rawItems = typeof vnode.props.each === "function" ? vnode.props.each() : vnode.props.each || [];
|
|
1244
1296
|
const items = Array.isArray(rawItems) ? rawItems : [];
|
|
1245
1297
|
const newMap = /* @__PURE__ */ new Map();
|
|
1246
1298
|
const parent = endAnchor.parentNode || container;
|
|
1247
1299
|
items.forEach((item, idx) => {
|
|
1248
1300
|
let itemKey;
|
|
1249
|
-
if (typeof
|
|
1250
|
-
itemKey =
|
|
1251
|
-
} else if (
|
|
1252
|
-
itemKey = item[
|
|
1301
|
+
if (typeof vnode.props.key === "function") {
|
|
1302
|
+
itemKey = vnode.props.key(item, idx);
|
|
1303
|
+
} else if (vnode.props.key && typeof item === "object") {
|
|
1304
|
+
itemKey = item[vnode.props.key];
|
|
1253
1305
|
} else {
|
|
1254
1306
|
itemKey = item?.id ?? item?.key ?? (typeof item === "string" ? item : idx);
|
|
1255
1307
|
}
|
|
@@ -1262,7 +1314,7 @@ function renderVNode(node, instance) {
|
|
|
1262
1314
|
} else {
|
|
1263
1315
|
const indexSignal = signal(idx);
|
|
1264
1316
|
const { result: rendered, scope: itemScope } = createScope(() => {
|
|
1265
|
-
const childVNode2 = untrack(() =>
|
|
1317
|
+
const childVNode2 = untrack(() => vnode.props.children(item, () => indexSignal.value));
|
|
1266
1318
|
return untrack(() => renderVNode(childVNode2, instance));
|
|
1267
1319
|
});
|
|
1268
1320
|
existing = { key: itemKey, node: rendered, indexSignal, scope: itemScope };
|
|
@@ -1287,7 +1339,7 @@ function renderVNode(node, instance) {
|
|
|
1287
1339
|
}
|
|
1288
1340
|
if (targetType === ErrorBoundary) {
|
|
1289
1341
|
try {
|
|
1290
|
-
return renderVNode(
|
|
1342
|
+
return renderVNode(vnode.props.children, instance);
|
|
1291
1343
|
} catch (err) {
|
|
1292
1344
|
if (instance?.runtimeLog) {
|
|
1293
1345
|
instance.runtimeLog.push({
|
|
@@ -1296,20 +1348,20 @@ function renderVNode(node, instance) {
|
|
|
1296
1348
|
error: `ErrorBoundary: ${err.message}`
|
|
1297
1349
|
});
|
|
1298
1350
|
}
|
|
1299
|
-
return renderVNode(
|
|
1351
|
+
return renderVNode(vnode.props.fallback(err), instance);
|
|
1300
1352
|
}
|
|
1301
1353
|
}
|
|
1302
|
-
let childVNode = targetType(
|
|
1354
|
+
let childVNode = targetType(vnode.props);
|
|
1303
1355
|
if (typeof childVNode === "function") {
|
|
1304
1356
|
childVNode = childVNode();
|
|
1305
1357
|
}
|
|
1306
1358
|
return renderVNode(childVNode, instance);
|
|
1307
1359
|
}
|
|
1308
|
-
const tagName = typeof
|
|
1360
|
+
const tagName = typeof vnode.type === "string" ? vnode.type : String(vnode.type);
|
|
1309
1361
|
const isSvg = SVG_TAGS.has(tagName.toLowerCase());
|
|
1310
1362
|
const el = isSvg ? document.createElementNS(SVG_NS, tagName) : document.createElement(tagName);
|
|
1311
1363
|
const cleanups = instance?._cleanups;
|
|
1312
|
-
for (const [key, value] of Object.entries(
|
|
1364
|
+
for (const [key, value] of Object.entries(vnode.props || {})) {
|
|
1313
1365
|
if (key === "children") continue;
|
|
1314
1366
|
if (key === "ref") {
|
|
1315
1367
|
if (typeof value === "function") {
|
|
@@ -1340,7 +1392,7 @@ function renderVNode(node, instance) {
|
|
|
1340
1392
|
if (key.startsWith("on") && typeof value === "function") {
|
|
1341
1393
|
const eventName = key.slice(2).toLowerCase();
|
|
1342
1394
|
el.addEventListener(eventName, value);
|
|
1343
|
-
if (value?._actionName && !
|
|
1395
|
+
if (value?._actionName && !vnode.props["data-agent-action"]) {
|
|
1344
1396
|
el.setAttribute("data-agent-action", value._actionName);
|
|
1345
1397
|
}
|
|
1346
1398
|
} else if (key === "class" || key === "className") {
|
|
@@ -1394,7 +1446,7 @@ function renderVNode(node, instance) {
|
|
|
1394
1446
|
el.setAttribute(key, value === true ? "" : String(value));
|
|
1395
1447
|
}
|
|
1396
1448
|
}
|
|
1397
|
-
for (const child of
|
|
1449
|
+
for (const child of childrenList) {
|
|
1398
1450
|
if (typeof child === "function") {
|
|
1399
1451
|
const parentAgentId = el.getAttribute("data-agent-id") || el.tagName.toLowerCase();
|
|
1400
1452
|
const startAnchor = document.createComment(`tokensafe:dyn-start`);
|
|
@@ -1492,44 +1544,51 @@ function vnodeToString(node) {
|
|
|
1492
1544
|
if (Array.isArray(node)) {
|
|
1493
1545
|
return node.map(vnodeToString).join("");
|
|
1494
1546
|
}
|
|
1495
|
-
let
|
|
1547
|
+
let vnode = node;
|
|
1548
|
+
if ("props" in vnode && (!("children" in vnode) || !Array.isArray(vnode.children) || "$$typeof" in vnode)) {
|
|
1549
|
+
vnode = convertReactNode(vnode);
|
|
1550
|
+
}
|
|
1551
|
+
let targetType = vnode.type;
|
|
1496
1552
|
if (typeof targetType === "object" && targetType !== null) {
|
|
1497
1553
|
if (targetType.$$typeof && targetType.type) {
|
|
1498
1554
|
targetType = targetType.type;
|
|
1499
1555
|
}
|
|
1500
1556
|
if (typeof targetType.render === "function") {
|
|
1501
|
-
|
|
1557
|
+
ensureReactDispatcher();
|
|
1558
|
+
const rendered = targetType.render(vnode.props, vnode.props?.ref || null);
|
|
1502
1559
|
return vnodeToString(convertReactNode(rendered));
|
|
1503
1560
|
}
|
|
1504
1561
|
}
|
|
1562
|
+
const rawChildren = vnode.children ?? vnode.props?.children;
|
|
1563
|
+
const childrenList = Array.isArray(rawChildren) ? rawChildren : rawChildren !== null && rawChildren !== void 0 ? [rawChildren] : [];
|
|
1505
1564
|
if (typeof targetType === "function") {
|
|
1506
1565
|
if (targetType === Fragment) {
|
|
1507
|
-
return
|
|
1566
|
+
return childrenList.map(vnodeToString).join("");
|
|
1508
1567
|
}
|
|
1509
1568
|
if (targetType === Show) {
|
|
1510
|
-
const whenVal = typeof
|
|
1511
|
-
const branch = whenVal ? typeof
|
|
1569
|
+
const whenVal = typeof vnode.props.when === "function" ? vnode.props.when() : vnode.props.when;
|
|
1570
|
+
const branch = whenVal ? typeof vnode.props.children === "function" ? vnode.props.children(whenVal) : vnode.props.children : vnode.props.fallback;
|
|
1512
1571
|
return branch ? vnodeToString(branch) : "";
|
|
1513
1572
|
}
|
|
1514
1573
|
if (targetType === For) {
|
|
1515
|
-
const rawItems = typeof
|
|
1574
|
+
const rawItems = typeof vnode.props.each === "function" ? vnode.props.each() : vnode.props.each || [];
|
|
1516
1575
|
const items = Array.isArray(rawItems) ? rawItems : [];
|
|
1517
1576
|
return items.map((item, idx) => {
|
|
1518
|
-
const childNode =
|
|
1577
|
+
const childNode = vnode.props.children(item, () => idx);
|
|
1519
1578
|
return vnodeToString(childNode);
|
|
1520
1579
|
}).join("");
|
|
1521
1580
|
}
|
|
1522
1581
|
if (targetType === ErrorBoundary) {
|
|
1523
1582
|
try {
|
|
1524
|
-
return vnodeToString(
|
|
1583
|
+
return vnodeToString(vnode.props.children);
|
|
1525
1584
|
} catch (err) {
|
|
1526
|
-
return vnodeToString(
|
|
1585
|
+
return vnodeToString(vnode.props.fallback(err));
|
|
1527
1586
|
}
|
|
1528
1587
|
}
|
|
1529
|
-
return vnodeToString(targetType(
|
|
1588
|
+
return vnodeToString(targetType(vnode.props));
|
|
1530
1589
|
}
|
|
1531
1590
|
const attrs = [];
|
|
1532
|
-
for (let [key, value] of Object.entries(
|
|
1591
|
+
for (let [key, value] of Object.entries(vnode.props || {})) {
|
|
1533
1592
|
if (key === "children" || key.startsWith("on")) continue;
|
|
1534
1593
|
if (typeof value === "function") {
|
|
1535
1594
|
try {
|
|
@@ -1547,15 +1606,15 @@ function vnodeToString(node) {
|
|
|
1547
1606
|
}
|
|
1548
1607
|
}
|
|
1549
1608
|
const attrStr = attrs.length > 0 ? " " + attrs.join(" ") : "";
|
|
1550
|
-
if (
|
|
1551
|
-
return `<${
|
|
1609
|
+
if (vnode.props?.dangerouslySetInnerHTML?.__html) {
|
|
1610
|
+
return `<${vnode.type}${attrStr}>${vnode.props.dangerouslySetInnerHTML.__html}</${vnode.type}>`;
|
|
1552
1611
|
}
|
|
1553
|
-
if (
|
|
1554
|
-
const raw = typeof
|
|
1555
|
-
return `<${
|
|
1612
|
+
if (vnode.props?.innerHTML) {
|
|
1613
|
+
const raw = typeof vnode.props.innerHTML === "function" ? vnode.props.innerHTML() : vnode.props.innerHTML;
|
|
1614
|
+
return `<${vnode.type}${attrStr}>${raw}</${vnode.type}>`;
|
|
1556
1615
|
}
|
|
1557
|
-
const childrenStr =
|
|
1558
|
-
return `<${
|
|
1616
|
+
const childrenStr = childrenList.map(vnodeToString).join("");
|
|
1617
|
+
return `<${vnode.type}${attrStr}>${childrenStr}</${vnode.type}>`;
|
|
1559
1618
|
}
|
|
1560
1619
|
function escapeHtml(str) {
|
|
1561
1620
|
return str.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
package/dist/index.js
CHANGED
package/dist/mcp.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
startMcpServer
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-RFQ234HI.js";
|
|
4
4
|
import {
|
|
5
5
|
MCP_SERVER_VERSION,
|
|
6
6
|
atomicApplySourceEdit,
|
|
@@ -10,10 +10,10 @@ import {
|
|
|
10
10
|
inspectComponentContract,
|
|
11
11
|
validateSourceSyntaxAndTypes,
|
|
12
12
|
validateWorkspacePath
|
|
13
|
-
} from "./chunk-
|
|
14
|
-
import "./chunk-
|
|
13
|
+
} from "./chunk-4E3ZOBB5.js";
|
|
14
|
+
import "./chunk-QM2CUNVR.js";
|
|
15
15
|
import "./chunk-N7XIVYCL.js";
|
|
16
|
-
import "./chunk-
|
|
16
|
+
import "./chunk-PRDRKCKA.js";
|
|
17
17
|
export {
|
|
18
18
|
MCP_SERVER_VERSION,
|
|
19
19
|
atomicApplySourceEdit,
|
package/dist/observer.js
CHANGED
package/dist/oumv.js
CHANGED
|
@@ -9,11 +9,11 @@ import {
|
|
|
9
9
|
isReducerLike,
|
|
10
10
|
isReduxStore,
|
|
11
11
|
isZustandStore
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
12
|
+
} from "./chunk-IYLKNCN7.js";
|
|
13
|
+
import "./chunk-4E3ZOBB5.js";
|
|
14
|
+
import "./chunk-QM2CUNVR.js";
|
|
15
15
|
import "./chunk-N7XIVYCL.js";
|
|
16
|
-
import "./chunk-
|
|
16
|
+
import "./chunk-PRDRKCKA.js";
|
|
17
17
|
export {
|
|
18
18
|
connectContext,
|
|
19
19
|
connectReducer,
|
package/dist/react.js
CHANGED
|
@@ -7,11 +7,11 @@ import {
|
|
|
7
7
|
isReducerLike,
|
|
8
8
|
isReduxStore,
|
|
9
9
|
isZustandStore
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
10
|
+
} from "./chunk-IYLKNCN7.js";
|
|
11
|
+
import "./chunk-4E3ZOBB5.js";
|
|
12
|
+
import "./chunk-QM2CUNVR.js";
|
|
13
13
|
import "./chunk-N7XIVYCL.js";
|
|
14
|
-
import "./chunk-
|
|
14
|
+
import "./chunk-PRDRKCKA.js";
|
|
15
15
|
export {
|
|
16
16
|
connectContext,
|
|
17
17
|
connectReducer,
|
package/dist/testing.js
CHANGED
package/dist/vite.js
CHANGED
package/dist/vue.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createVueAdapter
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-IYLKNCN7.js";
|
|
4
|
+
import "./chunk-4E3ZOBB5.js";
|
|
5
|
+
import "./chunk-QM2CUNVR.js";
|
|
6
6
|
import "./chunk-N7XIVYCL.js";
|
|
7
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-PRDRKCKA.js";
|
|
8
8
|
export {
|
|
9
9
|
createVueAdapter
|
|
10
10
|
};
|