@superblocksteam/library 2.0.162 → 2.0.163-next.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/{early-console-buffer-BJWsc4E3.js → early-console-buffer-DMR1SCsN.js} +3 -10
- package/dist/early-console-buffer-DMR1SCsN.js.map +1 -0
- package/dist/jsx-dev-runtime/index.js +2 -2
- package/dist/{jsx-wrapper-CAKd0FsI.js → jsx-wrapper-BGGZod5X.js} +2 -2
- package/dist/{jsx-wrapper-CAKd0FsI.js.map → jsx-wrapper-BGGZod5X.js.map} +1 -1
- package/dist/lib/index.d.ts +30 -218
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +102 -1256
- package/dist/lib/index.js.map +1 -1
- package/dist/{logs-DwKJqoRc.js → logs-CUUgkcJf.js} +2 -2
- package/dist/{logs-DwKJqoRc.js.map → logs-CUUgkcJf.js.map} +1 -1
- package/dist/{root-store-DFc-KUI6.js → root-store-CtsStoaR.js} +40 -298
- package/dist/root-store-CtsStoaR.js.map +1 -0
- package/dist/{sdk-api-discovery-ChkM2xTd.js → sdk-api-discovery-DdbqEI70.js} +2 -2
- package/dist/{sdk-api-discovery-ChkM2xTd.js.map → sdk-api-discovery-DdbqEI70.js.map} +1 -1
- package/dist/{utils-Blrvh8kW.js → utils-DXaAwgS_.js} +2 -2
- package/dist/{utils-Blrvh8kW.js.map → utils-DXaAwgS_.js.map} +1 -1
- package/package.json +8 -10
- package/dist/early-console-buffer-BJWsc4E3.js.map +0 -1
- package/dist/root-store-DFc-KUI6.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as LibraryEarlyConsoleBuffer } from "./early-console-buffer-
|
|
1
|
+
import { t as LibraryEarlyConsoleBuffer } from "./early-console-buffer-DMR1SCsN.js";
|
|
2
2
|
import { resourceFromAttributes } from "@opentelemetry/resources";
|
|
3
3
|
import { ATTR_SERVICE_NAME } from "@opentelemetry/semantic-conventions";
|
|
4
4
|
import { OTLPLogExporter } from "@opentelemetry/exporter-logs-otlp-http";
|
|
@@ -26,4 +26,4 @@ function initLibraryLoggerProvider(context) {
|
|
|
26
26
|
//#endregion
|
|
27
27
|
export { initLibraryLoggerProvider };
|
|
28
28
|
|
|
29
|
-
//# sourceMappingURL=logs-
|
|
29
|
+
//# sourceMappingURL=logs-CUUgkcJf.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logs-
|
|
1
|
+
{"version":3,"file":"logs-CUUgkcJf.js","names":[],"sources":["../src/lib/tracing/logs.ts"],"sourcesContent":["import { OTLPLogExporter } from \"@opentelemetry/exporter-logs-otlp-http\";\nimport { resourceFromAttributes } from \"@opentelemetry/resources\";\nimport {\n BatchLogRecordProcessor,\n LoggerProvider,\n} from \"@opentelemetry/sdk-logs\";\nimport { ATTR_SERVICE_NAME } from \"@opentelemetry/semantic-conventions\";\n\nimport LibraryEarlyConsoleBuffer from \"./early-console-buffer.js\";\n\ninterface LoggingContext {\n windowOriginUrl: string;\n environment: string;\n appId: string;\n userId?: string;\n userEmail?: string;\n orgId: string;\n orgName?: string;\n}\n\nexport function initLibraryLoggerProvider(context: LoggingContext) {\n const logExporter = new OTLPLogExporter({\n url: context.windowOriginUrl + \"/api/v1/logs\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n });\n\n const resource = resourceFromAttributes({\n [ATTR_SERVICE_NAME]: \"superblocks-ui-framework\",\n \"user-id\": context.userId,\n \"user-email\": context.userEmail,\n \"organization-id\": context.orgId,\n \"organization-name\": context.orgName,\n \"application-id\": context.appId,\n \"deployment.environment\": context.environment,\n });\n\n const loggerProvider = new LoggerProvider({\n resource,\n processors: [new BatchLogRecordProcessor({ exporter: logExporter })],\n });\n\n const otelLogger = loggerProvider.getLogger(\n \"superblocks-ui-framework\",\n \"1.0.0\",\n );\n\n // Enable buffered console logs with rich context\n LibraryEarlyConsoleBuffer.getInstance().enableOpenTelemetry(otelLogger);\n}\n"],"mappings":";;;;;;AAoBA,SAAgB,0BAA0B,SAAyB;CACjE,MAAM,cAAc,IAAI,gBAAgB;EACtC,KAAK,QAAQ,kBAAkB;EAC/B,SAAS,EACP,gBAAgB,oBACjB;EACF,CAAC;CAiBF,MAAM,aAAa,IALQ,eAAe;EACxC,UAXe,uBAAuB;IACrC,oBAAoB;GACrB,WAAW,QAAQ;GACnB,cAAc,QAAQ;GACtB,mBAAmB,QAAQ;GAC3B,qBAAqB,QAAQ;GAC7B,kBAAkB,QAAQ;GAC1B,0BAA0B,QAAQ;GACnC,CAGS;EACR,YAAY,CAAC,IAAI,wBAAwB,EAAE,UAAU,aAAa,CAAC,CAAC;EACrE,CAEgC,CAAC,UAChC,4BACA,QACD;AAGD,2BAA0B,aAAa,CAAC,oBAAoB,WAAW"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as getTracer } from "./utils-
|
|
2
|
-
import {
|
|
1
|
+
import { t as getTracer } from "./utils-DXaAwgS_.js";
|
|
2
|
+
import { PropsCategory } from "@superblocksteam/library-shared/props";
|
|
3
3
|
import { action, entries, isComputedProp, isObservableArray, isObservableMap, isObservableObject, makeAutoObservable, makeObservable, observable, observe, reaction, toJS, values } from "mobx";
|
|
4
4
|
import { matchRoutes } from "react-router";
|
|
5
5
|
import { URL_PARAMS, getQueryParams, pathStringToArray, toMobXPatch } from "@superblocksteam/library-shared";
|
|
@@ -14,99 +14,10 @@ import { NotificationPosition } from "@superblocksteam/library-shared/types";
|
|
|
14
14
|
import { jsx } from "react/jsx-runtime";
|
|
15
15
|
import { ROOT_CONTEXT, context, propagation, trace } from "@opentelemetry/api";
|
|
16
16
|
import diff from "microdiff";
|
|
17
|
-
//#region src/edit-mode/get-edit-store.ts
|
|
18
|
-
/**
|
|
19
|
-
* Get the global EditStore instance
|
|
20
|
-
* @returns The EditStore instance
|
|
21
|
-
*/
|
|
22
|
-
function getEditStore() {
|
|
23
|
-
if (!window.__SUPERBLOCKS_EDITOR_HOOK__ || !window.__SUPERBLOCKS_EDITOR_HOOK__.isInitialized) throw new Error("EditStore not initialized");
|
|
24
|
-
return window.__SUPERBLOCKS_EDITOR_HOOK__;
|
|
25
|
-
}
|
|
26
|
-
//#endregion
|
|
27
|
-
//#region src/lib/user-facing/properties-panel/properties-panel-definition.ts
|
|
28
|
-
function createPropertiesPanelDefinition(sections, componentProps) {
|
|
29
|
-
const sectionDefs = [];
|
|
30
|
-
const getSectionChildren = (propDefinitions, parentPath) => {
|
|
31
|
-
const properties = [];
|
|
32
|
-
/**
|
|
33
|
-
* There are three ways we can display a Composite prop:
|
|
34
|
-
* 1. Prop control + popover panel (e.g: TextStyle)
|
|
35
|
-
* 2. Prop control (e.g: Border)
|
|
36
|
-
* 3. Inline, without a prop control (e.g: Search prop on Table, which contains backgroundColor, borderRadius, etc.)
|
|
37
|
-
*
|
|
38
|
-
* isCompositeWithInlineNestedProps is used to determine if a prop is of type (3).
|
|
39
|
-
*/
|
|
40
|
-
const isCompositeWithInlineNestedProps = (prop, fullPath) => {
|
|
41
|
-
if (!(prop instanceof CompositeProp) || !prop.hasPropertiesPanelDisplay()) return false;
|
|
42
|
-
const displayMode = prop.propertiesPanelChildrenDisplayMode();
|
|
43
|
-
if (!displayMode) return false;
|
|
44
|
-
return (typeof displayMode === "function" ? displayMode(componentProps, fullPath) : displayMode)?.type === "inline";
|
|
45
|
-
};
|
|
46
|
-
for (const [name, prop] of Object.entries(propDefinitions)) {
|
|
47
|
-
if (!prop) continue;
|
|
48
|
-
const fullPath = parentPath ? `${parentPath}.${name}` : name;
|
|
49
|
-
if (isCompositeWithInlineNestedProps(prop, fullPath)) {
|
|
50
|
-
const inlinePropertiesDefs = getSectionChildren(prop.nestedProps, fullPath);
|
|
51
|
-
properties.push(...inlinePropertiesDefs);
|
|
52
|
-
} else if (prop.hasPropertiesPanelDisplay()) {
|
|
53
|
-
const def = prop.setName(fullPath).toDefinition(componentProps);
|
|
54
|
-
if (def) properties.push(def);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
return properties;
|
|
58
|
-
};
|
|
59
|
-
for (const section of Object.values(sections)) {
|
|
60
|
-
const children = getSectionChildren(section.props, "");
|
|
61
|
-
if (children.length === 0) continue;
|
|
62
|
-
sectionDefs.push({
|
|
63
|
-
name: section.name,
|
|
64
|
-
category: section.category,
|
|
65
|
-
children,
|
|
66
|
-
showHeader: section.propertiesPanelConfig.showHeader,
|
|
67
|
-
isDefaultOpen: section.propertiesPanelConfig.isDefaultOpen,
|
|
68
|
-
headerType: section.propertiesPanelConfig.headerType,
|
|
69
|
-
subHeader: section.propertiesPanelConfig.subHeader
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
return { sections: sectionDefs };
|
|
73
|
-
}
|
|
74
|
-
//#endregion
|
|
75
17
|
//#region src/lib/user-facing/properties-panel/props-builder.ts
|
|
76
|
-
function mergeRelations(existingRelations, relations) {
|
|
77
|
-
if (!existingRelations || existingRelations.length === 0) return relations;
|
|
78
|
-
if (!relations || relations.length === 0) return existingRelations;
|
|
79
|
-
return existingRelations && existingRelations.length > 0 ? existingRelations.flatMap((existing) => relations.map((relation) => [...existing, ...relation])) : relations;
|
|
80
|
-
}
|
|
81
|
-
function getChildren(input, path, props) {
|
|
82
|
-
function getChildrenFromSection(section) {
|
|
83
|
-
return Object.keys(section.props).reduce((acc, key) => {
|
|
84
|
-
const prop = section.props[key];
|
|
85
|
-
if (!prop) return acc;
|
|
86
|
-
const definition = prop.setName(path + "." + key).toDefinition(props);
|
|
87
|
-
if (definition) acc[key] = definition;
|
|
88
|
-
return acc;
|
|
89
|
-
}, {});
|
|
90
|
-
}
|
|
91
|
-
let children;
|
|
92
|
-
if (input instanceof Section) children = getChildrenFromSection(input);
|
|
93
|
-
else if (Object.values(input).every((c) => c instanceof Section)) children = Object.values(input).reduce((acc, section) => {
|
|
94
|
-
return {
|
|
95
|
-
...acc,
|
|
96
|
-
...getChildrenFromSection(section)
|
|
97
|
-
};
|
|
98
|
-
}, {});
|
|
99
|
-
else children = Object.fromEntries(Object.entries(input).map(([key, prop]) => {
|
|
100
|
-
return [key, prop.setName(path + "." + key).toDefinition(props)];
|
|
101
|
-
}));
|
|
102
|
-
return children;
|
|
103
|
-
}
|
|
104
18
|
var Section = class Section {
|
|
105
19
|
props = {};
|
|
106
|
-
propertiesPanelConfig = {
|
|
107
|
-
showHeader: true,
|
|
108
|
-
isDefaultOpen: true
|
|
109
|
-
};
|
|
20
|
+
propertiesPanelConfig = {};
|
|
110
21
|
constructor(category) {
|
|
111
22
|
this.category = category;
|
|
112
23
|
}
|
|
@@ -129,11 +40,8 @@ var Section = class Section {
|
|
|
129
40
|
return this;
|
|
130
41
|
}
|
|
131
42
|
add = this.children;
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
...this.propertiesPanelConfig,
|
|
135
|
-
...config
|
|
136
|
-
};
|
|
43
|
+
/** @deprecated Panel configuration is accepted for source compatibility and ignored. */
|
|
44
|
+
propertiesPanel(_config) {
|
|
137
45
|
return this;
|
|
138
46
|
}
|
|
139
47
|
get name() {
|
|
@@ -146,18 +54,12 @@ var Section = class Section {
|
|
|
146
54
|
case PropsCategory.Permissions: return "Permissions";
|
|
147
55
|
case PropsCategory.EventHandlers: return "Actions";
|
|
148
56
|
case PropsCategory.Styles: return "Styles";
|
|
149
|
-
case PropsCategory.Uncategorized: return "Uncategorized";
|
|
150
57
|
default: return "Uncategorized";
|
|
151
58
|
}
|
|
152
59
|
}
|
|
153
60
|
};
|
|
154
61
|
var Prop = class Prop {
|
|
155
62
|
prop;
|
|
156
|
-
/**
|
|
157
|
-
* Relations are an array of arrays
|
|
158
|
-
* each sub-array is AND requirements, and each element is an OR requirement
|
|
159
|
-
*/
|
|
160
|
-
relations = [];
|
|
161
63
|
constructor(typeString) {
|
|
162
64
|
this.prop = {
|
|
163
65
|
path: "",
|
|
@@ -250,7 +152,6 @@ var Prop = class Prop {
|
|
|
250
152
|
}
|
|
251
153
|
default(de) {
|
|
252
154
|
this.prop.default = de;
|
|
253
|
-
if (this.prop.propertiesPanelDisplay && this.prop.propertiesPanelDisplay.defaultValue === void 0) this.prop.propertiesPanelDisplay.defaultValue = de;
|
|
254
155
|
return this;
|
|
255
156
|
}
|
|
256
157
|
contextual(computedArgs) {
|
|
@@ -262,120 +163,31 @@ var Prop = class Prop {
|
|
|
262
163
|
this.prop.path = name;
|
|
263
164
|
return this;
|
|
264
165
|
}
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
let isJSConvertible = true;
|
|
268
|
-
let isTriggerProperty = false;
|
|
269
|
-
let inputType;
|
|
270
|
-
switch (this.prop.dataType) {
|
|
271
|
-
case "string":
|
|
272
|
-
baseControlType = "INPUT_TEXT";
|
|
273
|
-
break;
|
|
274
|
-
case "number":
|
|
275
|
-
baseControlType = "INPUT_TEXT";
|
|
276
|
-
inputType = InputType.NUMBER;
|
|
277
|
-
break;
|
|
278
|
-
case "array":
|
|
279
|
-
baseControlType = "INPUT_TEXT";
|
|
280
|
-
break;
|
|
281
|
-
case "boolean":
|
|
282
|
-
baseControlType = "SWITCH";
|
|
283
|
-
break;
|
|
284
|
-
case "eventHandler":
|
|
285
|
-
baseControlType = "EVENT_HANDLER";
|
|
286
|
-
isJSConvertible = false;
|
|
287
|
-
isTriggerProperty = true;
|
|
288
|
-
break;
|
|
289
|
-
case "jsx":
|
|
290
|
-
baseControlType = "JSX";
|
|
291
|
-
break;
|
|
292
|
-
default:
|
|
293
|
-
baseControlType = "INPUT_JS_EXPR";
|
|
294
|
-
break;
|
|
295
|
-
}
|
|
296
|
-
const propertiesPanelDisplay = {
|
|
297
|
-
controlType: baseControlType,
|
|
298
|
-
isJSConvertible,
|
|
299
|
-
isTriggerProperty,
|
|
300
|
-
defaultValue: schema.defaultValue ?? this.prop.default,
|
|
301
|
-
defaultOnAdd: this.prop.propertiesPanelDisplay?.defaultOnAdd,
|
|
302
|
-
inputType,
|
|
303
|
-
...schema
|
|
304
|
-
};
|
|
305
|
-
this.prop.propertiesPanelDisplay = propertiesPanelDisplay;
|
|
166
|
+
/** @deprecated Panel configuration is accepted for source compatibility and ignored. */
|
|
167
|
+
propertiesPanel(_schema) {
|
|
306
168
|
return this;
|
|
307
169
|
}
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
this.prop.propertiesPanelDisplay[property] = value;
|
|
170
|
+
/** @deprecated Panel metadata is accepted for source compatibility and ignored. */
|
|
171
|
+
setDisplayProperty(_property, _value) {
|
|
311
172
|
return this;
|
|
312
173
|
}
|
|
313
|
-
|
|
314
|
-
|
|
174
|
+
/** @deprecated Panel relations are accepted for source compatibility and ignored. */
|
|
175
|
+
dependsOn(_relations) {
|
|
315
176
|
return this;
|
|
316
177
|
}
|
|
317
|
-
build() {
|
|
318
|
-
return this.prop;
|
|
319
|
-
}
|
|
320
|
-
toDefinition(props) {
|
|
321
|
-
const evaluatedProperties = Object.entries(this.prop.propertiesPanelDisplay ?? {}).reduce((acc, [key, value]) => {
|
|
322
|
-
if (typeof value === "function") try {
|
|
323
|
-
acc[key] = value.bind(props)(this.prop.path);
|
|
324
|
-
} catch (e) {
|
|
325
|
-
console.error(`Error evaluating property ${key}:`, e);
|
|
326
|
-
}
|
|
327
|
-
return acc;
|
|
328
|
-
}, {});
|
|
329
|
-
if (evaluatedProperties.isVisible === false) return;
|
|
330
|
-
const propertiesPanelDisplay = {
|
|
331
|
-
...this.prop.propertiesPanelDisplay,
|
|
332
|
-
...evaluatedProperties
|
|
333
|
-
};
|
|
334
|
-
if ("treatDefaultAsNull" in propertiesPanelDisplay) {
|
|
335
|
-
if (propertiesPanelDisplay.treatDefaultAsNull) {
|
|
336
|
-
if (propertiesPanelDisplay.defaultOnAdd === void 0) propertiesPanelDisplay.defaultOnAdd = propertiesPanelDisplay.defaultValue;
|
|
337
|
-
propertiesPanelDisplay.defaultValue = void 0;
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
let panelConfig;
|
|
341
|
-
const childrenDisplay = propertiesPanelDisplay?.childrenDisplayMode;
|
|
342
|
-
if (childrenDisplay?.type === "popover") {
|
|
343
|
-
if (!(this instanceof CompositeProp || this instanceof RecordProp)) {
|
|
344
|
-
console.error(this);
|
|
345
|
-
throw new Error("Only composite properties can be used in popover properties at the moment");
|
|
346
|
-
}
|
|
347
|
-
const content = this.getProps();
|
|
348
|
-
const { type, ...rest } = childrenDisplay;
|
|
349
|
-
let contentDef;
|
|
350
|
-
if (content instanceof Section) contentDef = { content };
|
|
351
|
-
else if (Object.values(content).every((c) => c instanceof Section)) contentDef = content;
|
|
352
|
-
else contentDef = { content: Section.category(PropsCategory.Content).propertiesPanel({ showHeader: false }).children(content) };
|
|
353
|
-
panelConfig = {
|
|
354
|
-
...createPropertiesPanelDefinition(contentDef, props),
|
|
355
|
-
...rest
|
|
356
|
-
};
|
|
357
|
-
}
|
|
358
|
-
if (this.prop.computedArgs) propertiesPanelDisplay.computedArgs = typeof this.prop.computedArgs === "function" ? this.prop.computedArgs(props) : this.prop.computedArgs;
|
|
359
|
-
const propertiesPanelDisplayWithPanelConfig = {
|
|
360
|
-
...propertiesPanelDisplay,
|
|
361
|
-
...panelConfig && { panelConfig }
|
|
362
|
-
};
|
|
363
|
-
return {
|
|
364
|
-
path: this.prop.path,
|
|
365
|
-
dataType: this.prop.dataType,
|
|
366
|
-
relations: this.relations,
|
|
367
|
-
propertiesPanelDisplay: propertiesPanelDisplayWithPanelConfig
|
|
368
|
-
};
|
|
369
|
-
}
|
|
370
178
|
getRelations() {
|
|
371
|
-
return
|
|
179
|
+
return [];
|
|
180
|
+
}
|
|
181
|
+
hasPropertiesPanelDisplay() {
|
|
182
|
+
return false;
|
|
372
183
|
}
|
|
373
|
-
|
|
374
|
-
|
|
184
|
+
toDefinition(_props) {}
|
|
185
|
+
docs(docs) {
|
|
186
|
+
this.prop.docs = docs;
|
|
375
187
|
return this;
|
|
376
188
|
}
|
|
377
|
-
|
|
378
|
-
return this.prop
|
|
189
|
+
build() {
|
|
190
|
+
return this.prop;
|
|
379
191
|
}
|
|
380
192
|
get type() {
|
|
381
193
|
return this.prop.dataType;
|
|
@@ -397,17 +209,7 @@ var CompositeProp = class extends Prop {
|
|
|
397
209
|
getProps() {
|
|
398
210
|
return this.nestedProps;
|
|
399
211
|
}
|
|
400
|
-
|
|
401
|
-
const definition = super.toDefinition(props);
|
|
402
|
-
if (!definition) return;
|
|
403
|
-
return {
|
|
404
|
-
...definition,
|
|
405
|
-
children: getChildren(this.nestedProps, this.prop.path, props)
|
|
406
|
-
};
|
|
407
|
-
}
|
|
408
|
-
propertiesPanelChildrenDisplayMode() {
|
|
409
|
-
return this.prop.propertiesPanelDisplay?.childrenDisplayMode;
|
|
410
|
-
}
|
|
212
|
+
propertiesPanelChildrenDisplayMode() {}
|
|
411
213
|
};
|
|
412
214
|
/**
|
|
413
215
|
* See {@link Prop.record}
|
|
@@ -422,29 +224,18 @@ var RecordProp = class extends Prop {
|
|
|
422
224
|
getProps() {
|
|
423
225
|
return this.nestedProps;
|
|
424
226
|
}
|
|
425
|
-
toDefinition(props) {
|
|
426
|
-
const definition = super.toDefinition(props);
|
|
427
|
-
if (!definition) return;
|
|
428
|
-
return {
|
|
429
|
-
...definition,
|
|
430
|
-
children: getChildren(this.nestedProps, this.prop.path, props)
|
|
431
|
-
};
|
|
432
|
-
}
|
|
433
227
|
};
|
|
434
228
|
var FunctionProp = class extends Prop {
|
|
435
229
|
typeString = "function";
|
|
436
|
-
_actionPanel;
|
|
437
230
|
constructor(implementation) {
|
|
438
231
|
super("function");
|
|
439
232
|
this.default(implementation);
|
|
440
233
|
}
|
|
441
|
-
|
|
442
|
-
|
|
234
|
+
/** @deprecated Action panel metadata is accepted for source compatibility and ignored. */
|
|
235
|
+
actionPanel(_panel) {
|
|
443
236
|
return this;
|
|
444
237
|
}
|
|
445
|
-
getActionPanel() {
|
|
446
|
-
return this._actionPanel;
|
|
447
|
-
}
|
|
238
|
+
getActionPanel() {}
|
|
448
239
|
};
|
|
449
240
|
var UnionProp = class extends Prop {
|
|
450
241
|
typeString = "union";
|
|
@@ -456,51 +247,9 @@ var UnionProp = class extends Prop {
|
|
|
456
247
|
this.variants = variants;
|
|
457
248
|
}
|
|
458
249
|
getProps() {
|
|
459
|
-
const
|
|
460
|
-
const
|
|
461
|
-
|
|
462
|
-
Object.entries(v).forEach(([key, prop]) => {
|
|
463
|
-
const existingRelations = acc[key] ?? [];
|
|
464
|
-
const newRelations = prop.getRelations() ?? [];
|
|
465
|
-
acc[key] = [...existingRelations, ...newRelations];
|
|
466
|
-
});
|
|
467
|
-
return acc;
|
|
468
|
-
}, {});
|
|
469
|
-
const mergedVariants = variants.reduce((acc, v) => {
|
|
470
|
-
const relations = Object.entries(v).filter(([key]) => sharedKeys.includes(key)).map(([key, prop]) => {
|
|
471
|
-
return {
|
|
472
|
-
key,
|
|
473
|
-
value: prop.build().default
|
|
474
|
-
};
|
|
475
|
-
});
|
|
476
|
-
const filteredVariant = Object.fromEntries(Object.entries(v).filter(([key]) => !sharedKeys.includes(key)).map(([key, prop]) => {
|
|
477
|
-
const existingRelations = prop?.getRelations() ?? [];
|
|
478
|
-
const preMergeRelations = preMergeRelationsMap[key];
|
|
479
|
-
const existingNonPreMergeRelations = existingRelations.filter((r) => !preMergeRelations.some((p) => p === r));
|
|
480
|
-
const newProp = prop.dependsOn([...existingNonPreMergeRelations, ...mergeRelations(preMergeRelations, [relations])]);
|
|
481
|
-
if (acc[key]) {
|
|
482
|
-
const existingPropRelations = acc[key].getRelations() ?? [];
|
|
483
|
-
const newPropRelations = newProp.getRelations() ?? [];
|
|
484
|
-
const seenHashes = /* @__PURE__ */ new Set();
|
|
485
|
-
const uniqueRelations = [...existingPropRelations, ...newPropRelations].filter((relationGroup) => {
|
|
486
|
-
const hash = relationGroup.map((r) => `${r.key}:${String(r.value)}`).sort().join("|");
|
|
487
|
-
if (seenHashes.has(hash)) return false;
|
|
488
|
-
seenHashes.add(hash);
|
|
489
|
-
return true;
|
|
490
|
-
});
|
|
491
|
-
return [key, acc[key].dependsOn(uniqueRelations)];
|
|
492
|
-
}
|
|
493
|
-
return [key, newProp];
|
|
494
|
-
}));
|
|
495
|
-
return {
|
|
496
|
-
...acc,
|
|
497
|
-
...filteredVariant
|
|
498
|
-
};
|
|
499
|
-
}, {});
|
|
500
|
-
return {
|
|
501
|
-
...this.shared,
|
|
502
|
-
...mergedVariants
|
|
503
|
-
};
|
|
250
|
+
const props = { ...this.shared };
|
|
251
|
+
for (const variant of this.variants) for (const [key, prop] of Object.entries(variant)) if (!Object.hasOwn(props, key)) props[key] = prop;
|
|
252
|
+
return props;
|
|
504
253
|
}
|
|
505
254
|
};
|
|
506
255
|
function buildCompositeDefault(prop, name, parentDefault) {
|
|
@@ -725,8 +474,6 @@ var DeployedParentBridge = class {
|
|
|
725
474
|
sendStreamedApiMessage(_message, _apiName) {}
|
|
726
475
|
setApiStarted(_apiName) {}
|
|
727
476
|
setApiResponse(_apiName, _response) {}
|
|
728
|
-
updatePropertiesPanels(_updates) {}
|
|
729
|
-
addPropertiesPanel(_id, _definition) {}
|
|
730
477
|
addApiRunRecord(_apiId, _run) {}
|
|
731
478
|
updateApiRunRecord(_apiId, _callId, _updates) {}
|
|
732
479
|
initializeEditorSyncedStore(_payload) {}
|
|
@@ -765,6 +512,16 @@ var DeployedParentBridge = class {
|
|
|
765
512
|
}
|
|
766
513
|
};
|
|
767
514
|
//#endregion
|
|
515
|
+
//#region src/edit-mode/get-edit-store.ts
|
|
516
|
+
/**
|
|
517
|
+
* Get the global EditStore instance
|
|
518
|
+
* @returns The EditStore instance
|
|
519
|
+
*/
|
|
520
|
+
function getEditStore() {
|
|
521
|
+
if (!window.__SUPERBLOCKS_EDITOR_HOOK__ || !window.__SUPERBLOCKS_EDITOR_HOOK__.isInitialized) throw new Error("EditStore not initialized");
|
|
522
|
+
return window.__SUPERBLOCKS_EDITOR_HOOK__;
|
|
523
|
+
}
|
|
524
|
+
//#endregion
|
|
768
525
|
//#region src/edit-mode/message-queue.ts
|
|
769
526
|
const MESSAGE_BATCH_TIME = 50;
|
|
770
527
|
const DEFAULT_KEY = "default";
|
|
@@ -919,21 +676,6 @@ var SuperblocksEditorBridge = class SuperblocksEditorBridge {
|
|
|
919
676
|
}
|
|
920
677
|
});
|
|
921
678
|
}
|
|
922
|
-
updatePropertiesPanels(updates) {
|
|
923
|
-
this.queueMessage({
|
|
924
|
-
type: "codeMode/updatePropertiesPanels",
|
|
925
|
-
payload: updates
|
|
926
|
-
});
|
|
927
|
-
}
|
|
928
|
-
addPropertiesPanel(id, definition) {
|
|
929
|
-
this.queueMessage({
|
|
930
|
-
type: "codeMode/addPropertiesPanel",
|
|
931
|
-
payload: {
|
|
932
|
-
id,
|
|
933
|
-
definition
|
|
934
|
-
}
|
|
935
|
-
});
|
|
936
|
-
}
|
|
937
679
|
addApiRunRecord(apiId, run) {
|
|
938
680
|
this.queueMessage({
|
|
939
681
|
type: "codeMode/addApiRunRecord",
|
|
@@ -2926,7 +2668,7 @@ var ApiManager = class {
|
|
|
2926
2668
|
}
|
|
2927
2669
|
if (!entryPoint && this.rootStore.sdkApiEnabled) try {
|
|
2928
2670
|
const rediscoveryT0 = performance.now();
|
|
2929
|
-
const { discoverAndRegisterSdkApis } = await import("./sdk-api-discovery-
|
|
2671
|
+
const { discoverAndRegisterSdkApis } = await import("./sdk-api-discovery-DdbqEI70.js").then((n) => n.n);
|
|
2930
2672
|
await discoverAndRegisterSdkApis();
|
|
2931
2673
|
const rediscoveryMs = Math.round(performance.now() - rediscoveryT0);
|
|
2932
2674
|
discoveryMs += rediscoveryMs;
|
|
@@ -3840,6 +3582,6 @@ var RootStore = class {
|
|
|
3840
3582
|
};
|
|
3841
3583
|
var root_store_default = new RootStore();
|
|
3842
3584
|
//#endregion
|
|
3843
|
-
export { Section as A, iframeMessageHandler as C, createManagedPropsList as D, isEditMode as E,
|
|
3585
|
+
export { Section as A, iframeMessageHandler as C, createManagedPropsList as D, isEditMode as E, Prop as O, getParentOrigin as S, sendMessageImmediately as T, generateId as _, tracker as a, editorBridge as b, resolveById as c, useSuperblocksContext as d, useSuperblocksDataTags as f, embedStore as g, useSuperblocksUser as h, getContextFromTraceHeaders as i, PropsCategory as k, SuperblocksContextProvider as l, useSuperblocksProfiles as m, root_store_default as n, addNewPromise as o, useSuperblocksGroups as p, createIframeSpan as r, rejectById as s, ORCHESTRATOR_EXECUTE_RESPONSE_SIZE_LIMIT_FLAG as t, getAppMode as u, sendNotification as v, isEmbeddedBySuperblocksFirstParty as w, getEditStore as x, colors as y };
|
|
3844
3586
|
|
|
3845
|
-
//# sourceMappingURL=root-store-
|
|
3587
|
+
//# sourceMappingURL=root-store-CtsStoaR.js.map
|