@superblocksteam/library 2.0.42-next.48 → 2.0.42-next.49
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/index.js +67 -105
- package/dist/index.js.map +1 -1
- package/dist/{logs-ivxzrJPP.js → logs-DDh7Anxs.js} +10 -11
- package/dist/{logs-ivxzrJPP.js.map → logs-DDh7Anxs.js.map} +1 -1
- package/dist/root-store-4FotQ8o2.js +4 -0
- package/dist/{root-store-DHEbJGYN.js → root-store-DSXdJ9lh.js} +24 -45
- package/dist/root-store-DSXdJ9lh.js.map +1 -0
- package/package.json +2 -2
- package/dist/root-store-B9bo79E9.js +0 -4
- package/dist/root-store-DHEbJGYN.js.map +0 -1
|
@@ -10,17 +10,16 @@ function initLibraryLoggerProvider(context) {
|
|
|
10
10
|
url: context.windowOriginUrl + "/api/v1/logs",
|
|
11
11
|
headers: { "Content-Type": "application/json" }
|
|
12
12
|
});
|
|
13
|
-
const resource = resourceFromAttributes({
|
|
14
|
-
[ATTR_SERVICE_NAME]: "superblocks-ui-framework",
|
|
15
|
-
"user-id": context.userId,
|
|
16
|
-
"user-email": context.userEmail,
|
|
17
|
-
"organization-id": context.orgId,
|
|
18
|
-
"organization-name": context.orgName,
|
|
19
|
-
"application-id": context.appId,
|
|
20
|
-
"deployment.environment": context.environment
|
|
21
|
-
});
|
|
22
13
|
const otelLogger = new LoggerProvider({
|
|
23
|
-
resource
|
|
14
|
+
resource: resourceFromAttributes({
|
|
15
|
+
[ATTR_SERVICE_NAME]: "superblocks-ui-framework",
|
|
16
|
+
"user-id": context.userId,
|
|
17
|
+
"user-email": context.userEmail,
|
|
18
|
+
"organization-id": context.orgId,
|
|
19
|
+
"organization-name": context.orgName,
|
|
20
|
+
"application-id": context.appId,
|
|
21
|
+
"deployment.environment": context.environment
|
|
22
|
+
}),
|
|
24
23
|
processors: [new BatchLogRecordProcessor(logExporter)]
|
|
25
24
|
}).getLogger("superblocks-ui-framework", "1.0.0");
|
|
26
25
|
early_console_buffer_default.getInstance().enableOpenTelemetry(otelLogger);
|
|
@@ -28,4 +27,4 @@ function initLibraryLoggerProvider(context) {
|
|
|
28
27
|
|
|
29
28
|
//#endregion
|
|
30
29
|
export { initLibraryLoggerProvider };
|
|
31
|
-
//# sourceMappingURL=logs-
|
|
30
|
+
//# sourceMappingURL=logs-DDh7Anxs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logs-
|
|
1
|
+
{"version":3,"file":"logs-DDh7Anxs.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\";\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(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":";;;;;;;AAmBA,SAAgB,0BAA0B,SAAyB;CACjE,MAAM,cAAc,IAAI,gBAAgB;EACtC,KAAK,QAAQ,kBAAkB;EAC/B,SAAS,EACP,gBAAgB,oBACjB;EACF,CAAC;CAiBF,MAAM,aALiB,IAAI,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,CAAC;EAIA,YAAY,CAAC,IAAI,wBAAwB,YAAY,CAAC;EACvD,CAAC,CAEgC,UAChC,4BACA,QACD;AAGD,8BAA0B,aAAa,CAAC,oBAAoB,WAAW"}
|
|
@@ -743,9 +743,8 @@ function interceptWindowClicks(navigation$1) {
|
|
|
743
743
|
function clickCallback(ev, aEl) {
|
|
744
744
|
if (!(ev.button === 0 && !ev.defaultPrevented && !ev.metaKey && !ev.altKey && !ev.ctrlKey && !ev.shiftKey)) return;
|
|
745
745
|
const targetUrl = new URL(aEl.href, window.location.origin);
|
|
746
|
-
const isSameDocument = targetUrl.origin === window.location.origin && targetUrl.pathname === window.location.pathname;
|
|
747
746
|
const navigationEvent = new NavigationEvent({
|
|
748
|
-
isSameDocument,
|
|
747
|
+
isSameDocument: targetUrl.origin === window.location.origin && targetUrl.pathname === window.location.pathname,
|
|
749
748
|
targetUrl: aEl.href,
|
|
750
749
|
isBlob: targetUrl.protocol === "blob:",
|
|
751
750
|
newWindow: aEl.target === "_blank",
|
|
@@ -756,10 +755,9 @@ function interceptWindowClicks(navigation$1) {
|
|
|
756
755
|
function submitCallback(ev, form) {
|
|
757
756
|
if (ev.defaultPrevented) return;
|
|
758
757
|
if ((ev.submitter && "formMethod" in ev.submitter && ev.submitter.formMethod ? ev.submitter.formMethod : form.method) === "dialog") return;
|
|
759
|
-
const action$1 = ev.submitter && "formAction" in ev.submitter && ev.submitter.formAction ? ev.submitter.formAction : form.action;
|
|
760
758
|
const navigationEvent = new NavigationEvent({
|
|
761
759
|
isSameDocument: false,
|
|
762
|
-
targetUrl: action
|
|
760
|
+
targetUrl: ev.submitter && "formAction" in ev.submitter && ev.submitter.formAction ? ev.submitter.formAction : form.action,
|
|
763
761
|
formData: new FormData(form)
|
|
764
762
|
});
|
|
765
763
|
navigation$1.dispatchEvent(navigationEvent);
|
|
@@ -993,7 +991,7 @@ var registry_default = EventRegistry;
|
|
|
993
991
|
|
|
994
992
|
//#endregion
|
|
995
993
|
//#region src/lib/triggers/run-event-handlers.ts
|
|
996
|
-
const getRootStore = () => import("./root-store-
|
|
994
|
+
const getRootStore = () => import("./root-store-4FotQ8o2.js").then((module) => module.default);
|
|
997
995
|
const runEventHandlers = async ({ flow, name, scopeId, additionalContext }) => {
|
|
998
996
|
const context$1 = {
|
|
999
997
|
scopeId,
|
|
@@ -1004,8 +1002,7 @@ const runEventHandlers = async ({ flow, name, scopeId, additionalContext }) => {
|
|
|
1004
1002
|
const steps = flow?.build() ?? [];
|
|
1005
1003
|
for (const step of steps) {
|
|
1006
1004
|
if (!isValidStepDef(step)) continue;
|
|
1007
|
-
const
|
|
1008
|
-
const trigger = registry_default[stepType];
|
|
1005
|
+
const trigger = registry_default[step.type];
|
|
1009
1006
|
if (trigger) await trigger.execute(context$1, step);
|
|
1010
1007
|
else console.error(`Trigger ${step.type} not found`);
|
|
1011
1008
|
}
|
|
@@ -1796,14 +1793,11 @@ function traverseProps(sections, onProp, parentPath = "") {
|
|
|
1796
1793
|
props: prop.shared,
|
|
1797
1794
|
parentPath: fullPath
|
|
1798
1795
|
});
|
|
1799
|
-
for (const variant of prop.variants) {
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
parentPath: fullPath
|
|
1805
|
-
});
|
|
1806
|
-
}
|
|
1796
|
+
for (const variant of prop.variants) processProps({
|
|
1797
|
+
sectionName,
|
|
1798
|
+
props: Object.fromEntries(Object.entries(variant).filter(([key]) => !sharedKeys.includes(key))),
|
|
1799
|
+
parentPath: fullPath
|
|
1800
|
+
});
|
|
1807
1801
|
} else if (prop instanceof Prop) onProp(prop, fullPath, name, parentDefault, sectionName);
|
|
1808
1802
|
else console.warn("Invalid prop type", {
|
|
1809
1803
|
name,
|
|
@@ -2211,8 +2205,7 @@ const transformBindings = (value) => {
|
|
|
2211
2205
|
return new Function(`return ${body}`);
|
|
2212
2206
|
};
|
|
2213
2207
|
const toEvalFunc = ([prop, binding]) => {
|
|
2214
|
-
|
|
2215
|
-
return [prop, func];
|
|
2208
|
+
return [prop, transformBindings(binding)];
|
|
2216
2209
|
};
|
|
2217
2210
|
const stringToJS = (string) => {
|
|
2218
2211
|
if (string === void 0 || string === "") return "''";
|
|
@@ -2424,10 +2417,7 @@ var EntityManager = class {
|
|
|
2424
2417
|
getState(scopeId, options) {
|
|
2425
2418
|
const scope = this.getScope(scopeId);
|
|
2426
2419
|
const useSuspense = options?.useSuspense ?? false;
|
|
2427
|
-
if (options?.includeParentScopes ?? false)
|
|
2428
|
-
const allScopes = this.getAccessibleScopes(scopeId);
|
|
2429
|
-
return createScopeProxy(allScopes, useSuspense);
|
|
2430
|
-
}
|
|
2420
|
+
if (options?.includeParentScopes ?? false) return createScopeProxy(this.getAccessibleScopes(scopeId), useSuspense);
|
|
2431
2421
|
return createScopeProxy([scope], useSuspense);
|
|
2432
2422
|
}
|
|
2433
2423
|
getScopeName(scopeId) {
|
|
@@ -2450,10 +2440,7 @@ var EntityManager = class {
|
|
|
2450
2440
|
if (isNameBasedEntity) entities[name] = entity;
|
|
2451
2441
|
else entities[id] = entity;
|
|
2452
2442
|
}
|
|
2453
|
-
for (const childScopeId of scope.childScopes)
|
|
2454
|
-
const childScope = this.getScope(childScopeId);
|
|
2455
|
-
processScope(childScope);
|
|
2456
|
-
}
|
|
2443
|
+
for (const childScopeId of scope.childScopes) processScope(this.getScope(childScopeId));
|
|
2457
2444
|
};
|
|
2458
2445
|
processScope(this.state);
|
|
2459
2446
|
return entities;
|
|
@@ -2464,8 +2451,7 @@ var EntityManager = class {
|
|
|
2464
2451
|
const isDescendant = (scope, scopeId$1) => {
|
|
2465
2452
|
if (scope.id === scopeId$1) return true;
|
|
2466
2453
|
return Array.from(scope.childScopes).some((childScopeId) => {
|
|
2467
|
-
|
|
2468
|
-
return isDescendant(childScope, scopeId$1);
|
|
2454
|
+
return isDescendant(this.getScope(childScopeId), scopeId$1);
|
|
2469
2455
|
});
|
|
2470
2456
|
};
|
|
2471
2457
|
while (currentScope) {
|
|
@@ -3288,10 +3274,7 @@ var FileManagerClass = class FileManagerClass {
|
|
|
3288
3274
|
};
|
|
3289
3275
|
const FileManager = FileManagerClass.getInstance();
|
|
3290
3276
|
function getFileUploadId(file) {
|
|
3291
|
-
|
|
3292
|
-
const size = file.size;
|
|
3293
|
-
const lastModified = file.lastModified;
|
|
3294
|
-
return `${name}-${size}-${lastModified}`;
|
|
3277
|
+
return `${file.name.replace(/[^a-zA-Z0-9.-]/g, "_")}-${file.size}-${file.lastModified}`;
|
|
3295
3278
|
}
|
|
3296
3279
|
/**
|
|
3297
3280
|
* Check if the given object is a light readable file.
|
|
@@ -3358,15 +3341,14 @@ async function formatFilesForRequest(files) {
|
|
|
3358
3341
|
const entries$1 = Object.entries(files);
|
|
3359
3342
|
return await Promise.all(entries$1.map(async ([fileId, file]) => {
|
|
3360
3343
|
try {
|
|
3361
|
-
const base64 = await new Promise((resolve, reject) => {
|
|
3362
|
-
const reader = new FileReader();
|
|
3363
|
-
reader.onload = () => resolve(reader.result.split(",")[1]);
|
|
3364
|
-
reader.onerror = () => reject(new Error(reader.error?.message || "Unknown error reading file"));
|
|
3365
|
-
reader.readAsDataURL(file);
|
|
3366
|
-
});
|
|
3367
3344
|
return {
|
|
3368
3345
|
originalName: fileId,
|
|
3369
|
-
buffer:
|
|
3346
|
+
buffer: await new Promise((resolve, reject) => {
|
|
3347
|
+
const reader = new FileReader();
|
|
3348
|
+
reader.onload = () => resolve(reader.result.split(",")[1]);
|
|
3349
|
+
reader.onerror = () => reject(new Error(reader.error?.message || "Unknown error reading file"));
|
|
3350
|
+
reader.readAsDataURL(file);
|
|
3351
|
+
}),
|
|
3370
3352
|
encoding: "base64",
|
|
3371
3353
|
mimetype: "text/plain"
|
|
3372
3354
|
};
|
|
@@ -4181,10 +4163,8 @@ function startEditorSync(options) {
|
|
|
4181
4163
|
name: `editor-sync(${storeId})`
|
|
4182
4164
|
};
|
|
4183
4165
|
let initialState;
|
|
4184
|
-
if (keys)
|
|
4185
|
-
|
|
4186
|
-
initialState = sanitizedToJS(p);
|
|
4187
|
-
} else if (projection) initialState = sanitizedToJS(projection(store));
|
|
4166
|
+
if (keys) initialState = sanitizedToJS(pick(store, Object.keys(keys)));
|
|
4167
|
+
else if (projection) initialState = sanitizedToJS(projection(store));
|
|
4188
4168
|
else initialState = sanitizedToJS(store);
|
|
4189
4169
|
editorBridge.initializeEditorSyncedStore({
|
|
4190
4170
|
storeId,
|
|
@@ -4196,8 +4176,7 @@ function startEditorSync(options) {
|
|
|
4196
4176
|
const createDisposer = (key) => {
|
|
4197
4177
|
let lastValue;
|
|
4198
4178
|
return reaction(() => {
|
|
4199
|
-
|
|
4200
|
-
return sanitizedToJS(currentProjection[key]);
|
|
4179
|
+
return sanitizedToJS(projection(store)[key]);
|
|
4201
4180
|
}, (value) => {
|
|
4202
4181
|
const diffs = microPatches(lastValue, value, key);
|
|
4203
4182
|
lastValue = value;
|
|
@@ -4729,4 +4708,4 @@ var root_store_default = new RootStore();
|
|
|
4729
4708
|
|
|
4730
4709
|
//#endregion
|
|
4731
4710
|
export { CLASS_NAMES, DEFAULT_ANONYMOUS_SOURCE_ID, DevTools, EventFlow, FileManager, GLOBAL_SCOPE_ID, LazyFunction, NavigationEvent, Prop, PropsPanelCategory, RecordProp, Section, VALIDATORS, addNewPromise, colors, createInternalPropsList, createManagedPropsList, createPropertiesPanelDefinition, editorBridge, generateId, getEditStore, getFileWithUploadId, getName, iframeMessageHandler, isEditMode, isEmbeddedBySuperblocksFirstParty, isLocalLink, isName, isNameEqual, navigation, rejectById, resolveById, root_store_default, run_event_handlers_default, sendNotification, startEditorSync, system_error_default };
|
|
4732
|
-
//# sourceMappingURL=root-store-
|
|
4711
|
+
//# sourceMappingURL=root-store-DSXdJ9lh.js.map
|