@superblocksteam/library 2.0.59-next.2 → 2.0.59-next.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/dist/{early-console-buffer-SSPd-jq2.js → early-console-buffer-oUqxIuRK.js} +31 -4
- package/dist/early-console-buffer-oUqxIuRK.js.map +1 -0
- package/dist/jsx-dev-runtime/index.d.ts.map +1 -1
- package/dist/jsx-dev-runtime/index.js +7 -282
- package/dist/jsx-dev-runtime/index.js.map +1 -1
- package/dist/{widget-wrapper-naming-DxFT8zmk.js → jsx-wrapper-Ddb528TO.js} +410 -17
- package/dist/jsx-wrapper-Ddb528TO.js.map +1 -0
- package/dist/lib/index.d.ts +500 -19
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +214 -72
- package/dist/lib/index.js.map +1 -1
- package/dist/{logs-CgCPS9qr.js → logs-CQnzO-hw.js} +2 -2
- package/dist/{logs-CgCPS9qr.js.map → logs-CQnzO-hw.js.map} +1 -1
- package/package.json +3 -3
- package/dist/early-console-buffer-SSPd-jq2.js.map +0 -1
- package/dist/widget-wrapper-naming-DxFT8zmk.js.map +0 -1
package/dist/lib/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { A as
|
|
1
|
+
import { A as SuperblocksContextProvider, B as iframeMessageHandler, C as startEditorSync, E as getContextFromTraceHeaders, F as useSuperblocksUser, H as isEditMode, I as sendNotification, L as colors$1, M as useSuperblocksContext, N as useSuperblocksGroups, O as rejectById, P as useSuperblocksProfiles, R as editorBridge, S as createPropertiesPanelDefinition, T as createIframeSpan, V as isEmbeddedBySuperblocksFirstParty, _ as root_store_default, a as FixWithClarkButton, b as PropsCategory, c as ErrorContent, d as ErrorMessage, f as ErrorStack, g as StyledClarkIcon, h as SecondaryButton, i as getWidgetRectAnchorName, j as getAppMode, k as resolveById, l as ErrorDetails, m as ErrorTitle, n as useJSXContext, o as ActionsContainer, p as ErrorSummary, r as getWidgetAnchorName, s as ErrorContainer, u as ErrorIconContainer, v as createManagedPropsList, w as generateId, x as Section, y as Prop, z as getEditStore } from "../jsx-wrapper-Ddb528TO.js";
|
|
2
2
|
import "../utils-AzBGeVXo.js";
|
|
3
|
-
import { t as early_console_buffer_default } from "../early-console-buffer-
|
|
3
|
+
import { n as consoleLogAttributes, t as early_console_buffer_default } from "../early-console-buffer-oUqxIuRK.js";
|
|
4
4
|
import { Dim, NATIVE_COMPONENT_TYPES, NO_SELECT_ATTRIBUTE, Property, Property as Property$1, SELECTOR_ID_ATTRIBUTE, SOURCE_ID_ATTRIBUTE, generateSourceId, getBindingIdentifier } from "@superblocksteam/library-shared";
|
|
5
5
|
import * as React$1 from "react";
|
|
6
6
|
import React, { Suspense, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
@@ -363,6 +363,7 @@ let cachedBorderPresets = null;
|
|
|
363
363
|
const borderWidth = defaultTheme.borderWidth;
|
|
364
364
|
const borderRadius = defaultTheme.borderRadius;
|
|
365
365
|
const boxShadow = defaultTheme.boxShadow;
|
|
366
|
+
const DEFAULT_KEY = "DEFAULT";
|
|
366
367
|
function isBoxShadowValue(value) {
|
|
367
368
|
const trimmedValue = value.trim().toLowerCase();
|
|
368
369
|
const isBoxShadow = /^(0|none|inset|outset|shadow-sm|shadow|shadow-md|shadow-lg|shadow-xl|shadow-2xl|shadow-inner|shadow-none)$/.test(trimmedValue);
|
|
@@ -402,24 +403,23 @@ function getBorderPresets() {
|
|
|
402
403
|
for (const [prop, value] of Object.entries(cssVariables.dark)) addCssSize(prop, value);
|
|
403
404
|
const borderWidthPresets = [...sizePresets];
|
|
404
405
|
const borderRadiusPresets = [...sizePresets];
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
});
|
|
406
|
+
function addTailwindProperty(presets, key, value, valueConverter) {
|
|
407
|
+
if (key === DEFAULT_KEY && typeof value === "string") presets.push({
|
|
408
|
+
label: "default",
|
|
409
|
+
value: "",
|
|
410
|
+
rawValue: valueConverter ? valueConverter(value) : convertRemToPixels(value),
|
|
411
|
+
type: "tailwind"
|
|
412
|
+
});
|
|
413
|
+
else if (typeof value === "string") presets.push({
|
|
414
|
+
label: formatLabel(key),
|
|
415
|
+
value: key,
|
|
416
|
+
rawValue: valueConverter ? valueConverter(value) : convertRemToPixels(value),
|
|
417
|
+
type: "tailwind"
|
|
418
|
+
});
|
|
419
|
+
}
|
|
420
|
+
for (const [key, value] of Object.entries(borderWidth)) addTailwindProperty(borderWidthPresets, key, value, convertRemToPixels);
|
|
421
|
+
for (const [key, value] of Object.entries(borderRadius)) addTailwindProperty(borderRadiusPresets, key, value, convertRemToPixels);
|
|
422
|
+
for (const [key, value] of Object.entries(boxShadow)) addTailwindProperty(boxShadowPresets, key, value);
|
|
423
423
|
const seen = /* @__PURE__ */ new Set();
|
|
424
424
|
const uniqueBorderWidthPresets = borderWidthPresets.filter((preset) => {
|
|
425
425
|
if (seen.has(preset.value)) return false;
|
|
@@ -825,14 +825,17 @@ const getApiPath = (name) => {
|
|
|
825
825
|
return apiPath;
|
|
826
826
|
};
|
|
827
827
|
function useApiStateful(name) {
|
|
828
|
+
const { sourceId } = useJSXContext();
|
|
828
829
|
return {
|
|
829
830
|
run: useCallback(async (inputs) => {
|
|
830
831
|
const apiPath = getApiPath(name);
|
|
832
|
+
const editMode = isEditMode();
|
|
831
833
|
return (await root_store_default.apis.runApiByPath({
|
|
832
834
|
path: apiPath,
|
|
833
|
-
inputs: inputs ?? {}
|
|
835
|
+
inputs: inputs ?? {},
|
|
836
|
+
...editMode ? { injectedCallerId: sourceId } : {}
|
|
834
837
|
})).data;
|
|
835
|
-
}, [name]),
|
|
838
|
+
}, [name, sourceId]),
|
|
836
839
|
cancel: useCallback(async () => {
|
|
837
840
|
await root_store_default.apis.cancelApi(name);
|
|
838
841
|
}, [name])
|
|
@@ -1345,13 +1348,16 @@ var OperationAPI = class {
|
|
|
1345
1348
|
/**
|
|
1346
1349
|
* @throws {Error} if the websocket connection can't be initiated after 3 attempts
|
|
1347
1350
|
*/
|
|
1348
|
-
async connect({ peerId, userId, authorization, applicationId }) {
|
|
1351
|
+
async connect({ peerId, userId, authorization, applicationId, traceContext, connectionType, connectionTarget }) {
|
|
1349
1352
|
try {
|
|
1350
1353
|
const socket = await connectSocket(this.serverUrl, {
|
|
1351
1354
|
peerId,
|
|
1352
1355
|
userId,
|
|
1353
1356
|
authorization,
|
|
1354
1357
|
applicationId,
|
|
1358
|
+
traceContext,
|
|
1359
|
+
connectionType,
|
|
1360
|
+
connectionTarget,
|
|
1355
1361
|
onClose: this.handleSocketClose({
|
|
1356
1362
|
peerId,
|
|
1357
1363
|
userId,
|
|
@@ -1440,13 +1446,29 @@ function startSocketHeartbeat(socket) {
|
|
|
1440
1446
|
clearTimeout(timeoutId);
|
|
1441
1447
|
};
|
|
1442
1448
|
}
|
|
1443
|
-
async function connectSocket(serverUrl, { peerId, userId, applicationId, authorization, onClose }) {
|
|
1449
|
+
async function connectSocket(serverUrl, { peerId, userId, applicationId, authorization, onClose, traceContext, connectionType, connectionTarget }) {
|
|
1444
1450
|
if (!serverUrl) return;
|
|
1445
1451
|
const wsUrl = new URL("/sb-updates", serverUrl);
|
|
1446
1452
|
wsUrl.searchParams.set("peerId", peerId);
|
|
1447
1453
|
if (userId) wsUrl.searchParams.set("userId", userId);
|
|
1448
1454
|
wsUrl.searchParams.set("applicationId", applicationId);
|
|
1449
1455
|
root_store_default.editStore?.connectionManager.initializeSocket();
|
|
1456
|
+
let parentContext;
|
|
1457
|
+
if (traceContext) parentContext = getContextFromTraceHeaders(traceContext);
|
|
1458
|
+
const appWebsocketSpan = createIframeSpan("devServerAppWebSocketConnection", {
|
|
1459
|
+
url: wsUrl.toString(),
|
|
1460
|
+
connection_source: "app",
|
|
1461
|
+
connection_type: connectionType || "initial",
|
|
1462
|
+
connection_target: connectionTarget || "default",
|
|
1463
|
+
application_id: applicationId
|
|
1464
|
+
}, parentContext);
|
|
1465
|
+
const wsStartTime = Date.now();
|
|
1466
|
+
console.log("Dev server connection app websocket starting", consoleLogAttributes({
|
|
1467
|
+
url: wsUrl.toString(),
|
|
1468
|
+
connectionSource: "app",
|
|
1469
|
+
connectionType: connectionType || "initial",
|
|
1470
|
+
connectionTarget: connectionTarget || "default"
|
|
1471
|
+
}));
|
|
1450
1472
|
try {
|
|
1451
1473
|
let stopSocketHeartbeat;
|
|
1452
1474
|
const socket = createISocketClient(new ISocketWithClientAuth(await connectWebSocket(wsUrl.toString()), authorization, {
|
|
@@ -1485,7 +1507,11 @@ async function connectSocket(serverUrl, { peerId, userId, applicationId, authori
|
|
|
1485
1507
|
stopSocketHeartbeat?.();
|
|
1486
1508
|
stopSocketHeartbeat = void 0;
|
|
1487
1509
|
onClose(event);
|
|
1488
|
-
console.log("
|
|
1510
|
+
console.log("Dev server connection app websocket closed", consoleLogAttributes({
|
|
1511
|
+
connectionSource: "app",
|
|
1512
|
+
connectionType: connectionType || "initial",
|
|
1513
|
+
connectionTarget: connectionTarget || "default"
|
|
1514
|
+
}));
|
|
1489
1515
|
root_store_default.editStore?.connectionManager.disconnect();
|
|
1490
1516
|
},
|
|
1491
1517
|
timeouts: {
|
|
@@ -1493,12 +1519,47 @@ async function connectSocket(serverUrl, { peerId, userId, applicationId, authori
|
|
|
1493
1519
|
noResponseTimeoutInSeconds: 60
|
|
1494
1520
|
}
|
|
1495
1521
|
}));
|
|
1496
|
-
|
|
1522
|
+
const wsDuration = Date.now() - wsStartTime;
|
|
1523
|
+
console.log("Dev server connection app websocket succeeded", consoleLogAttributes({
|
|
1524
|
+
connectionSource: "app",
|
|
1525
|
+
connectionType: connectionType || "initial",
|
|
1526
|
+
connectionTarget: connectionTarget || "default",
|
|
1527
|
+
durationMs: wsDuration
|
|
1528
|
+
}));
|
|
1529
|
+
window.parent.postMessage({
|
|
1530
|
+
type: "app-websocket-connected",
|
|
1531
|
+
payload: {
|
|
1532
|
+
success: true,
|
|
1533
|
+
durationMs: wsDuration
|
|
1534
|
+
}
|
|
1535
|
+
}, "*");
|
|
1536
|
+
appWebsocketSpan.end();
|
|
1497
1537
|
stopSocketHeartbeat = startSocketHeartbeat(socket);
|
|
1498
1538
|
root_store_default.editStore?.connectionManager.connect();
|
|
1499
1539
|
return socket;
|
|
1500
1540
|
} catch (error) {
|
|
1501
|
-
|
|
1541
|
+
const wsDuration = Date.now() - wsStartTime;
|
|
1542
|
+
console.error("Dev server connection app websocket failed", consoleLogAttributes({
|
|
1543
|
+
connectionSource: "app",
|
|
1544
|
+
connectionType: connectionType || "initial",
|
|
1545
|
+
connectionTarget: connectionTarget || "default",
|
|
1546
|
+
durationMs: wsDuration,
|
|
1547
|
+
error: error instanceof Error ? error.message : String(error)
|
|
1548
|
+
}));
|
|
1549
|
+
window.parent.postMessage({
|
|
1550
|
+
type: "app-websocket-connected",
|
|
1551
|
+
payload: {
|
|
1552
|
+
success: false,
|
|
1553
|
+
durationMs: wsDuration,
|
|
1554
|
+
error: {
|
|
1555
|
+
message: error instanceof Error ? error.message : String(error),
|
|
1556
|
+
type: error instanceof Error ? error.constructor.name : "Unknown",
|
|
1557
|
+
stack: error instanceof Error ? error.stack : void 0
|
|
1558
|
+
}
|
|
1559
|
+
}
|
|
1560
|
+
}, "*");
|
|
1561
|
+
if (error instanceof Error) appWebsocketSpan.recordException(error);
|
|
1562
|
+
appWebsocketSpan.end();
|
|
1502
1563
|
root_store_default.editStore?.connectionManager.disconnect();
|
|
1503
1564
|
throw error;
|
|
1504
1565
|
}
|
|
@@ -1859,10 +1920,10 @@ var RuntimeComponentNode = class {
|
|
|
1859
1920
|
if (result) return result;
|
|
1860
1921
|
}
|
|
1861
1922
|
}
|
|
1862
|
-
get
|
|
1863
|
-
if (this.isSbComponent &&
|
|
1923
|
+
get nearestSelectableAncestor() {
|
|
1924
|
+
if (this.isSbComponent && !this.noSelect) return this.selectorId;
|
|
1864
1925
|
const componentParent = this.store.graph.parent(this.selectorId);
|
|
1865
|
-
if (componentParent) return this.store.jsxNodes[componentParent]?.
|
|
1926
|
+
if (componentParent) return this.store.jsxNodes[componentParent]?.nearestSelectableAncestor;
|
|
1866
1927
|
}
|
|
1867
1928
|
get displayName() {
|
|
1868
1929
|
if (this.isHtmlElement) return this.type;
|
|
@@ -1930,13 +1991,13 @@ var RuntimeTrackingStore = class {
|
|
|
1930
1991
|
getFirstAnchorableTag(selectorId) {
|
|
1931
1992
|
return this.jsxNodes[selectorId]?.firstRenderedTag;
|
|
1932
1993
|
}
|
|
1933
|
-
|
|
1994
|
+
getNearestSelectableAncestor(selectorId, skipSelf = false) {
|
|
1934
1995
|
if (skipSelf) {
|
|
1935
1996
|
const componentParent = this.graph.parent(selectorId);
|
|
1936
|
-
if (componentParent) return this.jsxNodes[componentParent]?.
|
|
1997
|
+
if (componentParent) return this.jsxNodes[componentParent]?.nearestSelectableAncestor;
|
|
1937
1998
|
return;
|
|
1938
1999
|
}
|
|
1939
|
-
return this.jsxNodes[selectorId]?.
|
|
2000
|
+
return this.jsxNodes[selectorId]?.nearestSelectableAncestor;
|
|
1940
2001
|
}
|
|
1941
2002
|
updatePropsForComponent(selectorId, props) {
|
|
1942
2003
|
const componentNode = this.jsxNodes[selectorId];
|
|
@@ -2530,23 +2591,23 @@ const Layers = {
|
|
|
2530
2591
|
|
|
2531
2592
|
//#endregion
|
|
2532
2593
|
//#region src/edit-mode/assets/close.svg
|
|
2533
|
-
var _path$
|
|
2534
|
-
function _extends$
|
|
2535
|
-
return _extends$
|
|
2594
|
+
var _path$2;
|
|
2595
|
+
function _extends$7() {
|
|
2596
|
+
return _extends$7 = Object.assign ? Object.assign.bind() : function(n) {
|
|
2536
2597
|
for (var e = 1; e < arguments.length; e++) {
|
|
2537
2598
|
var t = arguments[e];
|
|
2538
2599
|
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
2539
2600
|
}
|
|
2540
2601
|
return n;
|
|
2541
|
-
}, _extends$
|
|
2602
|
+
}, _extends$7.apply(null, arguments);
|
|
2542
2603
|
}
|
|
2543
2604
|
var SvgClose = function SvgClose$1(props) {
|
|
2544
|
-
return /* @__PURE__ */ React$1.createElement("svg", _extends$
|
|
2605
|
+
return /* @__PURE__ */ React$1.createElement("svg", _extends$7({
|
|
2545
2606
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2546
2607
|
width: 16,
|
|
2547
2608
|
height: 16,
|
|
2548
2609
|
fill: "none"
|
|
2549
|
-
}, props), _path$
|
|
2610
|
+
}, props), _path$2 || (_path$2 = /* @__PURE__ */ React$1.createElement("path", {
|
|
2550
2611
|
stroke: "currentColor",
|
|
2551
2612
|
strokeLinecap: "round",
|
|
2552
2613
|
strokeLinejoin: "round",
|
|
@@ -2557,6 +2618,37 @@ var close_default = SvgClose;
|
|
|
2557
2618
|
|
|
2558
2619
|
//#endregion
|
|
2559
2620
|
//#region src/edit-mode/assets/pencil.svg
|
|
2621
|
+
var _path$1, _path2$1;
|
|
2622
|
+
function _extends$6() {
|
|
2623
|
+
return _extends$6 = Object.assign ? Object.assign.bind() : function(n) {
|
|
2624
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
2625
|
+
var t = arguments[e];
|
|
2626
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
2627
|
+
}
|
|
2628
|
+
return n;
|
|
2629
|
+
}, _extends$6.apply(null, arguments);
|
|
2630
|
+
}
|
|
2631
|
+
var SvgPencil = function SvgPencil$1(props) {
|
|
2632
|
+
return /* @__PURE__ */ React$1.createElement("svg", _extends$6({
|
|
2633
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2634
|
+
width: 16,
|
|
2635
|
+
height: 16,
|
|
2636
|
+
fill: "none"
|
|
2637
|
+
}, props), _path$1 || (_path$1 = /* @__PURE__ */ React$1.createElement("path", {
|
|
2638
|
+
fill: "#fff",
|
|
2639
|
+
d: "m2.5 13.5 1.196-3.189a4 4 0 0 1 .917-1.424L10 3.5A2.5 2.5 0 0 0 12.5 6l-5.387 5.387a4 4 0 0 1-1.424.917z",
|
|
2640
|
+
opacity: .12
|
|
2641
|
+
})), _path2$1 || (_path2$1 = /* @__PURE__ */ React$1.createElement("path", {
|
|
2642
|
+
stroke: "#fff",
|
|
2643
|
+
strokeLinecap: "round",
|
|
2644
|
+
strokeLinejoin: "round",
|
|
2645
|
+
d: "M10 3.5 4.613 8.887a4 4 0 0 0-.917 1.424L2.5 13.5l3.189-1.196a4 4 0 0 0 1.424-.917L12.5 6M10 3.5l.75-.75a1.768 1.768 0 1 1 2.5 2.5L12.5 6M10 3.5A2.5 2.5 0 0 0 12.5 6"
|
|
2646
|
+
})));
|
|
2647
|
+
};
|
|
2648
|
+
var pencil_default = SvgPencil;
|
|
2649
|
+
|
|
2650
|
+
//#endregion
|
|
2651
|
+
//#region src/edit-mode/assets/target.svg
|
|
2560
2652
|
var _path, _path2;
|
|
2561
2653
|
function _extends$5() {
|
|
2562
2654
|
return _extends$5 = Object.assign ? Object.assign.bind() : function(n) {
|
|
@@ -2567,7 +2659,7 @@ function _extends$5() {
|
|
|
2567
2659
|
return n;
|
|
2568
2660
|
}, _extends$5.apply(null, arguments);
|
|
2569
2661
|
}
|
|
2570
|
-
var
|
|
2662
|
+
var SvgTarget = function SvgTarget$1(props) {
|
|
2571
2663
|
return /* @__PURE__ */ React$1.createElement("svg", _extends$5({
|
|
2572
2664
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2573
2665
|
width: 16,
|
|
@@ -2575,16 +2667,18 @@ var SvgPencil = function SvgPencil$1(props) {
|
|
|
2575
2667
|
fill: "none"
|
|
2576
2668
|
}, props), _path || (_path = /* @__PURE__ */ React$1.createElement("path", {
|
|
2577
2669
|
fill: "#fff",
|
|
2578
|
-
|
|
2670
|
+
fillRule: "evenodd",
|
|
2671
|
+
d: "M14 8A6 6 0 1 1 2 8a6 6 0 0 1 12 0M8 9.263a1.263 1.263 0 1 0 0-2.526 1.263 1.263 0 0 0 0 2.526",
|
|
2672
|
+
clipRule: "evenodd",
|
|
2579
2673
|
opacity: .12
|
|
2580
2674
|
})), _path2 || (_path2 = /* @__PURE__ */ React$1.createElement("path", {
|
|
2581
2675
|
stroke: "#fff",
|
|
2582
2676
|
strokeLinecap: "round",
|
|
2583
2677
|
strokeLinejoin: "round",
|
|
2584
|
-
d: "
|
|
2678
|
+
d: "M14 8a6 6 0 0 1-6 6m6-6a6 6 0 0 0-6-6m6 6h-2m-4 6a6 6 0 0 1-6-6m6 6v-2M2 8a6 6 0 0 1 6-6M2 8h2m4-6v2m1.263 4a1.263 1.263 0 1 1-2.526 0 1.263 1.263 0 0 1 2.526 0"
|
|
2585
2679
|
})));
|
|
2586
2680
|
};
|
|
2587
|
-
var
|
|
2681
|
+
var target_default = SvgTarget;
|
|
2588
2682
|
|
|
2589
2683
|
//#endregion
|
|
2590
2684
|
//#region src/edit-mode/interaction-utils.ts
|
|
@@ -2702,12 +2796,11 @@ function InteractionRectActions(props) {
|
|
|
2702
2796
|
event.stopPropagation();
|
|
2703
2797
|
event.preventDefault();
|
|
2704
2798
|
const sourceId = getEditStore().runtimeTrackingStore.getComponent(selectorId)?.sourceId;
|
|
2705
|
-
if (sourceId) editorBridge.
|
|
2799
|
+
if (sourceId) editorBridge.toggleComponentInAiContext(sourceId, selectorId, displayName);
|
|
2706
2800
|
};
|
|
2707
2801
|
const aiContextMode = getEditStore().ai.getAiContextMode();
|
|
2708
2802
|
const isAiTaggingEnabled = getEditStore().ai.getIsTaggingEnabled();
|
|
2709
2803
|
const shouldHideActions = !isPrimarySelectorId;
|
|
2710
|
-
const shouldShowAddToChatButton = isAiTaggingEnabled && (aiContextMode === AiContextMode.SILENT || aiContextMode === AiContextMode.HIGHLIGHT && type !== "TARGETED");
|
|
2711
2804
|
const shouldShowAiPurplePill = isAiTaggingEnabled && (aiContextMode === AiContextMode.AUTO_SELECT || aiContextMode === AiContextMode.HIGHLIGHT && type === "TARGETED");
|
|
2712
2805
|
const renderedTagSelectorId = getEditStore().runtimeTrackingStore.getFirstAnchorableTag(selectorId);
|
|
2713
2806
|
const showDesignModeToggle = getEditStore().interactionMode === "interactive";
|
|
@@ -2750,15 +2843,15 @@ function InteractionRectActions(props) {
|
|
|
2750
2843
|
children: /* @__PURE__ */ jsx(close_default, {})
|
|
2751
2844
|
})
|
|
2752
2845
|
}), /* @__PURE__ */ jsx(TooltipPortal, { children: /* @__PURE__ */ jsx(TooltipContent$1, { children: "Exit design mode" }) })] }) }),
|
|
2753
|
-
|
|
2846
|
+
isAiTaggingEnabled && /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsxs(Root, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
|
|
2754
2847
|
asChild: true,
|
|
2755
2848
|
children: /* @__PURE__ */ jsx("button", {
|
|
2756
|
-
"aria-label": "Add to chat",
|
|
2849
|
+
"aria-label": type === "TARGETED" ? "Remove from chat" : "Add to chat",
|
|
2757
2850
|
className: "sb-edit-add-to-chat-button",
|
|
2758
2851
|
onPointerDownCapture: handleAddToChat,
|
|
2759
|
-
children: /* @__PURE__ */ jsx(
|
|
2852
|
+
children: /* @__PURE__ */ jsx(target_default, {})
|
|
2760
2853
|
})
|
|
2761
|
-
}), /* @__PURE__ */ jsx(TooltipPortal, { children: /* @__PURE__ */ jsx(TooltipContent$1, { children: "Add to chat" }) })] }) }),
|
|
2854
|
+
}), /* @__PURE__ */ jsx(TooltipPortal, { children: /* @__PURE__ */ jsx(TooltipContent$1, { children: type === "TARGETED" ? "Remove from chat" : "Add to chat" }) })] }) }),
|
|
2762
2855
|
/* @__PURE__ */ jsx(interaction_rect_name_pill_default, {
|
|
2763
2856
|
selectorId,
|
|
2764
2857
|
displayName,
|
|
@@ -2920,7 +3013,7 @@ const InteractionRectTargetBorder = ({ selectorId }) => {
|
|
|
2920
3013
|
};
|
|
2921
3014
|
const InteractionRect = (props) => {
|
|
2922
3015
|
const { selectionType, selectorId } = props;
|
|
2923
|
-
const parentSelectorId = getEditStore().runtimeTrackingStore.
|
|
3016
|
+
const parentSelectorId = getEditStore().runtimeTrackingStore.getNearestSelectableAncestor(selectorId);
|
|
2924
3017
|
const renderedParentTagSelectorId = parentSelectorId ? getEditStore().runtimeTrackingStore.getFirstAnchorableTag(parentSelectorId) : void 0;
|
|
2925
3018
|
const renderedTagSelectorId = getEditStore().runtimeTrackingStore.getFirstAnchorableTag(selectorId);
|
|
2926
3019
|
const aiContextMode = getEditStore().ai.getAiContextMode();
|
|
@@ -3056,7 +3149,10 @@ const IframeConnected = observer(function IframeConnected$1(props) {
|
|
|
3056
3149
|
peerId: data.payload.peerId,
|
|
3057
3150
|
userId: data.payload.userId,
|
|
3058
3151
|
authorization: data.payload.devServerAuthorization,
|
|
3059
|
-
applicationId: data.payload.appId
|
|
3152
|
+
applicationId: data.payload.appId,
|
|
3153
|
+
traceContext: data.payload.traceContext,
|
|
3154
|
+
connectionType: data.payload.connectionType,
|
|
3155
|
+
connectionTarget: data.payload.connectionTarget
|
|
3060
3156
|
});
|
|
3061
3157
|
} catch (error) {
|
|
3062
3158
|
console.error("Error connecting to internal socket from library", error);
|
|
@@ -3127,7 +3223,7 @@ const EmbedWrapper = (props) => {
|
|
|
3127
3223
|
root_store_default.windowOriginUrl = event.data.payload.logContext.superblocks_window_origin_url;
|
|
3128
3224
|
if (root_store_default.windowOriginUrl) import("../utils-DR35eYvX.js").then(({ initTracerProviderWithOrigin }) => {
|
|
3129
3225
|
initTracerProviderWithOrigin(root_store_default.windowOriginUrl);
|
|
3130
|
-
import("../logs-
|
|
3226
|
+
import("../logs-CQnzO-hw.js").then(({ initLibraryLoggerProvider }) => {
|
|
3131
3227
|
initLibraryLoggerProvider({
|
|
3132
3228
|
windowOriginUrl: root_store_default.windowOriginUrl,
|
|
3133
3229
|
appId: event.data.payload.appId,
|
|
@@ -3288,19 +3384,45 @@ const EmbedWrapper = (props) => {
|
|
|
3288
3384
|
}
|
|
3289
3385
|
case "RUN_API": {
|
|
3290
3386
|
const { apiName, traceHeaders, callId, isTestRun, inputs } = action$1.payload;
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
}).catch((error$1) => {
|
|
3299
|
-
console.error(`Failed to test API ${apiName}:`, error$1);
|
|
3300
|
-
});
|
|
3301
|
-
else if (callId) root_store_default.apis.rerunApiByCallId(callId).catch((error$1) => {
|
|
3302
|
-
console.error(`Failed to re-run API with callId ${callId}:`, error$1);
|
|
3387
|
+
console.log("[iframe-wrappers] Received RUN_API:", {
|
|
3388
|
+
apiName,
|
|
3389
|
+
callId,
|
|
3390
|
+
isTestRun,
|
|
3391
|
+
hasInputs: !!inputs,
|
|
3392
|
+
inputs,
|
|
3393
|
+
traceHeaders
|
|
3303
3394
|
});
|
|
3395
|
+
if (isTestRun) {
|
|
3396
|
+
console.log("[iframe-wrappers] Running as test run");
|
|
3397
|
+
root_store_default.apis.runApiByPath({
|
|
3398
|
+
path: getApiPath(apiName),
|
|
3399
|
+
inputs: {
|
|
3400
|
+
...traceHeaders,
|
|
3401
|
+
...inputs
|
|
3402
|
+
},
|
|
3403
|
+
isTestRun: true
|
|
3404
|
+
}).catch((error$1) => {
|
|
3405
|
+
console.error(`Failed to test API ${apiName}:`, error$1);
|
|
3406
|
+
});
|
|
3407
|
+
} else if (callId) {
|
|
3408
|
+
console.log("[iframe-wrappers] Re-running with callId:", callId);
|
|
3409
|
+
root_store_default.apis.rerunApiByCallId(callId).catch((error$1) => {
|
|
3410
|
+
console.error(`Failed to re-run API with callId ${callId}:`, error$1);
|
|
3411
|
+
});
|
|
3412
|
+
} else {
|
|
3413
|
+
console.log("[iframe-wrappers] This might be a Clark request - executing API normally");
|
|
3414
|
+
root_store_default.apis.runApiByPath({
|
|
3415
|
+
path: getApiPath(apiName),
|
|
3416
|
+
inputs: {
|
|
3417
|
+
...traceHeaders,
|
|
3418
|
+
...inputs
|
|
3419
|
+
},
|
|
3420
|
+
callId,
|
|
3421
|
+
isTestRun: false
|
|
3422
|
+
}).catch((error$1) => {
|
|
3423
|
+
console.error(`Failed to run API ${apiName}:`, error$1);
|
|
3424
|
+
});
|
|
3425
|
+
}
|
|
3304
3426
|
break;
|
|
3305
3427
|
}
|
|
3306
3428
|
}
|
|
@@ -3442,7 +3564,7 @@ const getWidgetFromPointHelper = (params) => {
|
|
|
3442
3564
|
const extendedWidget = widgetsWithBuffer.hoveredActual.find((item) => {
|
|
3443
3565
|
let actualSelectorId = item.selectorId;
|
|
3444
3566
|
if (item.noSelect) {
|
|
3445
|
-
actualSelectorId = editStore.runtimeTrackingStore.
|
|
3567
|
+
actualSelectorId = editStore.runtimeTrackingStore.getNearestSelectableAncestor(item.selectorId, false);
|
|
3446
3568
|
if (!actualSelectorId) return false;
|
|
3447
3569
|
}
|
|
3448
3570
|
const componentType = editStore.runtimeTrackingStore.getComponent(actualSelectorId)?.type;
|
|
@@ -3456,7 +3578,7 @@ const getWidgetFromPointHelper = (params) => {
|
|
|
3456
3578
|
});
|
|
3457
3579
|
return getFirstItemWithFocusedSelectorPrioritized(atPointWidgets.hoveredPills) ?? atPointWidgets.hoveredActual[0];
|
|
3458
3580
|
};
|
|
3459
|
-
const
|
|
3581
|
+
const shouldBubbleUpForNearestSelectableAncestor = (selectorId) => {
|
|
3460
3582
|
const editStore = getEditStore();
|
|
3461
3583
|
if (editStore.runtimeTrackingStore.getComponent(selectorId)?.noSelect) return true;
|
|
3462
3584
|
const parentSelectorId = editStore.runtimeTrackingStore.getComponentParent(selectorId);
|
|
@@ -3492,8 +3614,8 @@ function getMostRelevantWidgetAtPoint(params) {
|
|
|
3492
3614
|
const relevantParent = getRelevantParentIfItReducesRepetition(widget.selectorId);
|
|
3493
3615
|
if (relevantParent) return relevantParent;
|
|
3494
3616
|
}
|
|
3495
|
-
if (
|
|
3496
|
-
const registeredAncestor = editStore.runtimeTrackingStore.
|
|
3617
|
+
if (shouldBubbleUpForNearestSelectableAncestor(widget.selectorId)) {
|
|
3618
|
+
const registeredAncestor = editStore.runtimeTrackingStore.getNearestSelectableAncestor(widget.selectorId, false);
|
|
3497
3619
|
if (registeredAncestor) return registeredAncestor;
|
|
3498
3620
|
}
|
|
3499
3621
|
return widget.selectorId;
|
|
@@ -3586,16 +3708,29 @@ function useWidgetClick() {
|
|
|
3586
3708
|
event.preventDefault();
|
|
3587
3709
|
event.stopPropagation();
|
|
3588
3710
|
}
|
|
3589
|
-
if (event.altKey || editStore.ai.
|
|
3711
|
+
if (event.altKey || editStore.ai.shouldToggleComponentInAiContext()) {
|
|
3590
3712
|
console.log("[useWidgetClick] Toggling component in AI context");
|
|
3591
3713
|
editorBridge.toggleComponentInAiContext(sourceId, selectorId, displayName);
|
|
3592
3714
|
return;
|
|
3593
3715
|
}
|
|
3594
3716
|
editStore.ui.selectWidget(selectorId, event.shiftKey === true);
|
|
3595
3717
|
};
|
|
3718
|
+
const isInsideInteractionLayer = (element) => {
|
|
3719
|
+
if (!(element instanceof Element)) return false;
|
|
3720
|
+
return element.closest(`[${INTERACTION_LAYER_ATTRIBUTE}="true"]`) !== null;
|
|
3721
|
+
};
|
|
3722
|
+
const handlePointerDown = (event) => {
|
|
3723
|
+
const isTargetMode = editStore.ai.shouldToggleComponentInAiContext();
|
|
3724
|
+
if ((editStore.interactionMode === "design" || isTargetMode) && !isInsideInteractionLayer(event.target)) {
|
|
3725
|
+
event.preventDefault();
|
|
3726
|
+
event.stopPropagation();
|
|
3727
|
+
}
|
|
3728
|
+
};
|
|
3596
3729
|
rootElement?.addEventListener("click", handleClick, { capture: true });
|
|
3730
|
+
rootElement?.addEventListener("pointerdown", handlePointerDown, { capture: true });
|
|
3597
3731
|
return () => {
|
|
3598
3732
|
rootElement?.removeEventListener("click", handleClick, { capture: true });
|
|
3733
|
+
rootElement?.removeEventListener("pointerdown", handlePointerDown, { capture: true });
|
|
3599
3734
|
};
|
|
3600
3735
|
}, []);
|
|
3601
3736
|
}
|
|
@@ -3692,7 +3827,14 @@ const ExternalInteractionLayer = observer(() => {
|
|
|
3692
3827
|
const isEditStoreInitialized = Boolean(root_store_default.editStore?.isInitialized);
|
|
3693
3828
|
const interactionLayerVisible = root_store_default.editStore?.interactionMode === "design" || root_store_default.editStore?.interactionMode === "interactive";
|
|
3694
3829
|
if (!(isEditStoreInitialized && interactionLayerVisible)) return null;
|
|
3695
|
-
|
|
3830
|
+
const isDesignMode = root_store_default.editStore?.interactionMode === "design";
|
|
3831
|
+
const isTargetMode = root_store_default.editStore?.ai.shouldToggleComponentInAiContext();
|
|
3832
|
+
const pencilCursor = `url('data:image/svg+xml;utf8,<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path opacity="0.12" d="M2.5 13.5L3.69577 10.3113C3.89627 9.77662 4.2089 9.2911 4.61266 8.88734L10 3.5C10 4.88071 11.1193 6 12.5 6L7.11266 11.3873C6.7089 11.7911 6.22338 12.1037 5.68873 12.3042L2.5 13.5Z" fill="black"/><path d="M10 3.5L4.61266 8.88734C4.2089 9.2911 3.89627 9.77662 3.69577 10.3113L2.5 13.5L5.68873 12.3042C6.22338 12.1037 6.7089 11.7911 7.11266 11.3873L12.5 6M10 3.5L10.75 2.75C11.4404 2.05964 12.5596 2.05964 13.25 2.75C13.9404 3.44036 13.9404 4.55964 13.25 5.25L12.5 6M10 3.5C10 4.88071 11.1193 6 12.5 6" stroke="white" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/><path d="M10 3.5L4.61266 8.88734C4.2089 9.2911 3.89627 9.77662 3.69577 10.3113L2.5 13.5L5.68873 12.3042C6.22338 12.1037 6.7089 11.7911 7.11266 11.3873L12.5 6M10 3.5L10.75 2.75C11.4404 2.05964 12.5596 2.05964 13.25 2.75C13.9404 3.44036 13.9404 4.55964 13.25 5.25L12.5 6M10 3.5C10 4.88071 11.1193 6 12.5 6" stroke="black" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>') 2 14, auto`;
|
|
3833
|
+
const targetCursor = `url('data:image/svg+xml;utf8,<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path opacity="0.12" fill-rule="evenodd" clip-rule="evenodd" d="M14 8C14 11.3137 11.3137 14 8 14C4.68629 14 2 11.3137 2 8C2 4.68629 4.68629 2 8 2C11.3137 2 14 4.68629 14 8ZM8 9.26316C8.69762 9.26316 9.26316 8.69762 9.26316 8C9.26316 7.30238 8.69762 6.73684 8 6.73684C7.30238 6.73684 6.73684 7.30238 6.73684 8C6.73684 8.69762 7.30238 9.26316 8 9.26316Z" fill="black"/><path d="M14 8C14 11.3137 11.3137 14 8 14M14 8C14 4.68629 11.3137 2 8 2M14 8H12M8 14C4.68629 14 2 11.3137 2 8M8 14V12M2 8C2 4.68629 4.68629 2 8 2M2 8H4M8 2V4M9.26316 8C9.26316 8.69762 8.69762 9.26316 8 9.26316C7.30238 9.26316 6.73684 8.69762 6.73684 8C6.73684 7.30238 7.30238 6.73684 8 6.73684C8.69762 6.73684 9.26316 7.30238 9.26316 8Z" stroke="white" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"/><path d="M14 8C14 11.3137 11.3137 14 8 14M14 8C14 4.68629 11.3137 2 8 2M14 8H12M8 14C4.68629 14 2 11.3137 2 8M8 14V12M2 8C2 4.68629 4.68629 2 8 2M2 8H4M8 2V4M9.26316 8C9.26316 8.69762 8.69762 9.26316 8 9.26316C7.30238 9.26316 6.73684 8.69762 6.73684 8C6.73684 7.30238 7.30238 6.73684 8 6.73684C8.69762 6.73684 9.26316 7.30238 9.26316 8Z" stroke="black" stroke-linecap="round" stroke-linejoin="round"/></svg>') 8 8, auto`;
|
|
3834
|
+
let cursorStyle = "";
|
|
3835
|
+
if (isTargetMode) cursorStyle = `* { cursor: ${targetCursor} !important; }`;
|
|
3836
|
+
else if (isDesignMode) cursorStyle = `* { cursor: ${pencilCursor} !important; }`;
|
|
3837
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(InteractionLayerManager, {}), cursorStyle && /* @__PURE__ */ jsx("style", { dangerouslySetInnerHTML: { __html: cursorStyle } })] });
|
|
3696
3838
|
});
|
|
3697
3839
|
var interaction_layer_default = ExternalInteractionLayer;
|
|
3698
3840
|
|
|
@@ -3737,7 +3879,7 @@ const EmbedWrapper$1 = (props) => {
|
|
|
3737
3879
|
root_store_default.windowOriginUrl = event.data.payload.logContext.superblocks_window_origin_url;
|
|
3738
3880
|
if (root_store_default.windowOriginUrl) import("../utils-DR35eYvX.js").then(({ initTracerProviderWithOrigin }) => {
|
|
3739
3881
|
initTracerProviderWithOrigin(root_store_default.windowOriginUrl);
|
|
3740
|
-
import("../logs-
|
|
3882
|
+
import("../logs-CQnzO-hw.js").then(({ initLibraryLoggerProvider }) => {
|
|
3741
3883
|
initLibraryLoggerProvider({
|
|
3742
3884
|
windowOriginUrl: root_store_default.windowOriginUrl,
|
|
3743
3885
|
appId: event.data.payload.appId,
|
|
@@ -5003,5 +5145,5 @@ early_console_buffer_default.getInstance().patchEarly();
|
|
|
5003
5145
|
registerHtmlElements();
|
|
5004
5146
|
|
|
5005
5147
|
//#endregion
|
|
5006
|
-
export { App, PageNotFound, Prop, Property, PropsCategory, RouteLoadError, Section, sb_provider_default as SuperblocksProvider, registerComponent, tailwindStylesCategory, useApiStateful as useApi, useSuperblocksGroups, useSuperblocksProfiles, useSuperblocksUser };
|
|
5148
|
+
export { App, PageNotFound, Prop, Property, PropsCategory, RouteLoadError, Section, sb_provider_default as SuperblocksProvider, getAppMode, registerComponent, tailwindStylesCategory, useApiStateful as useApi, useSuperblocksGroups, useSuperblocksProfiles, useSuperblocksUser };
|
|
5007
5149
|
//# sourceMappingURL=index.js.map
|