@superblocksteam/library 2.0.6-next.57 → 2.0.6-next.59
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/{allPaths-KPe-OJkU.js → allPaths-Bqg2PyfV.js} +2 -2
- package/dist/{allPaths-KPe-OJkU.js.map → allPaths-Bqg2PyfV.js.map} +1 -1
- package/dist/{allPaths-CFjMeIdd.js → allPaths-rSpFWZlR.js} +2 -2
- package/dist/{allPaths-CFjMeIdd.js.map → allPaths-rSpFWZlR.js.map} +1 -1
- package/dist/{allPathsLoader-B9kcOhBr.js → allPathsLoader-D0DZVqPi.js} +3 -3
- package/dist/{allPathsLoader-B9kcOhBr.js.map → allPathsLoader-D0DZVqPi.js.map} +1 -1
- package/dist/{allPathsLoader-BhebPX_9.js → allPathsLoader-Dza5jMza.js} +3 -3
- package/dist/{allPathsLoader-BhebPX_9.js.map → allPathsLoader-Dza5jMza.js.map} +1 -1
- package/dist/{devtools-consolidated-DDIhwU5g.js → devtools-consolidated-Cc9P7odf.js} +2 -2
- package/dist/{devtools-consolidated-DDIhwU5g.js.map → devtools-consolidated-Cc9P7odf.js.map} +1 -1
- package/dist/{index-fmpMMpkS.js → index-1LMlc1Q6.js} +446 -267
- package/dist/{index-fmpMMpkS.js.map → index-1LMlc1Q6.js.map} +1 -1
- package/dist/index.js +2 -2
- package/dist/{splitPathsBySizeLoader-Z2MNgkRA.js → splitPathsBySizeLoader-BtCO3mSJ.js} +2 -2
- package/dist/{splitPathsBySizeLoader-Z2MNgkRA.js.map → splitPathsBySizeLoader-BtCO3mSJ.js.map} +1 -1
- package/dist/{splitPathsBySizeLoader-C-dfe3r6.js → splitPathsBySizeLoader-CyCuKl4N.js} +2 -2
- package/dist/{splitPathsBySizeLoader-C-dfe3r6.js.map → splitPathsBySizeLoader-CyCuKl4N.js.map} +1 -1
- package/dist-types/lib/internal-details/lib/evaluator/base-entity-manager.d.ts +8 -7
- package/dist-types/lib/internal-details/lib/evaluator/create-scope-proxy.d.ts +1 -1
- package/dist-types/lib/internal-details/lib/evaluator/entity-manager.d.ts +5 -6
- package/dist-types/lib/internal-details/lib/evaluator/pretty-print-function.d.ts +1 -1
- package/dist-types/lib/internal-details/lib/evaluator/sanitize-object.d.ts +6 -0
- package/dist-types/lib/internal-details/lib/evaluator/suspense-helpers.d.ts +8 -0
- package/dist-types/lib/internal-details/lib/evaluator/use-shallow-mobx-observer.d.ts +1 -1
- package/dist-types/lib/internal-details/lib/features/component-registry.d.ts +9 -0
- package/dist-types/lib/user-facing/component-base/sb-component.d.ts +5 -1
- package/dist-types/lib/user-facing/components/custom/register-custom-component.d.ts +5 -2
- package/dist-types/lib/user-facing/components/input/input-component.d.ts +1 -0
- package/dist-types/lib/user-facing/components/table/index.d.ts +0 -1
- package/dist-types/lib/user-facing/components/table/props.d.ts +0 -1
- package/dist-types/lib/user-facing/entities/api/props.d.ts +11 -2
- package/dist-types/lib/user-facing/entities/api/suspensible-api.d.ts +20 -0
- package/dist-types/lib/user-facing/properties-panel/create-managed-props-list.d.ts +4 -0
- package/dist-types/lib/user-facing/properties-panel/props-builder.d.ts +8 -0
- package/package.json +2 -2
|
@@ -78597,7 +78597,8 @@ const PropsPanelCategory = {
|
|
|
78597
78597
|
// these are hidden categories
|
|
78598
78598
|
Meta: "Meta",
|
|
78599
78599
|
Derived: "Derived",
|
|
78600
|
-
Functions: "Functions"
|
|
78600
|
+
Functions: "Functions",
|
|
78601
|
+
Internal: "Internal"
|
|
78601
78602
|
};
|
|
78602
78603
|
function createPropertiesPanelDefinition(sections, entity, scopedState) {
|
|
78603
78604
|
const sectionDefs = [];
|
|
@@ -82920,6 +82921,16 @@ class Prop {
|
|
|
82920
82921
|
const prop = new Prop("function");
|
|
82921
82922
|
return prop.default(implementation);
|
|
82922
82923
|
}
|
|
82924
|
+
/**
|
|
82925
|
+
* Creates an internal property that is not exposed in the entity's public interface,
|
|
82926
|
+
* not tracked for reactivity/syncing, and not serialized. This is useful for
|
|
82927
|
+
* storing implementation details like SuspensibleAPI instances that other
|
|
82928
|
+
* properties can reference via `this._propertyName`.
|
|
82929
|
+
*/
|
|
82930
|
+
static internal(factory) {
|
|
82931
|
+
const prop = new Prop("internal");
|
|
82932
|
+
return prop.default(factory);
|
|
82933
|
+
}
|
|
82923
82934
|
/**
|
|
82924
82935
|
* Creates a composite property, which is a property that contains nested properties. For example,
|
|
82925
82936
|
* the following composite property:
|
|
@@ -82989,6 +83000,10 @@ class Prop {
|
|
|
82989
83000
|
}
|
|
82990
83001
|
return this;
|
|
82991
83002
|
}
|
|
83003
|
+
// alias for default
|
|
83004
|
+
computed(computeFn) {
|
|
83005
|
+
return this.default(computeFn);
|
|
83006
|
+
}
|
|
82992
83007
|
allowNestedBindings() {
|
|
82993
83008
|
this.prop.nestedBindings = true;
|
|
82994
83009
|
throw new Error("Nested bindings are not supported yet");
|
|
@@ -83289,8 +83304,7 @@ function buildPropLeafDefault(prop, name, parentDefault) {
|
|
|
83289
83304
|
}
|
|
83290
83305
|
return propDefault;
|
|
83291
83306
|
}
|
|
83292
|
-
function
|
|
83293
|
-
const managedPropsList = [];
|
|
83307
|
+
function traverseProps(sections, onProp, parentPath = "") {
|
|
83294
83308
|
const processProps = (props2, parentPath2, parentDefault) => {
|
|
83295
83309
|
for (const [name, prop] of Object.entries(props2)) {
|
|
83296
83310
|
const fullPath = parentPath2 ? `${parentPath2}.${name}` : name;
|
|
@@ -83318,12 +83332,7 @@ function createManagedPropsList(sections, parentPath = "") {
|
|
|
83318
83332
|
processProps(variantWithoutSharedKeys, fullPath);
|
|
83319
83333
|
}
|
|
83320
83334
|
} else if (prop instanceof Prop) {
|
|
83321
|
-
|
|
83322
|
-
const propDefault = buildPropLeafDefault(prop, name, parentDefault);
|
|
83323
|
-
if (propDefault !== void 0) {
|
|
83324
|
-
configuredProp = configuredProp.default(propDefault);
|
|
83325
|
-
}
|
|
83326
|
-
managedPropsList.push({ ...configuredProp.build() });
|
|
83335
|
+
onProp(prop, fullPath, name, parentDefault);
|
|
83327
83336
|
} else {
|
|
83328
83337
|
console.warn("Invalid prop type", { name, prop });
|
|
83329
83338
|
}
|
|
@@ -83332,6 +83341,41 @@ function createManagedPropsList(sections, parentPath = "") {
|
|
|
83332
83341
|
for (const [, section] of Object.entries(sections)) {
|
|
83333
83342
|
processProps(section.props, parentPath);
|
|
83334
83343
|
}
|
|
83344
|
+
}
|
|
83345
|
+
function createInternalPropsList(sections, parentPath = "") {
|
|
83346
|
+
const internalPropsList = [];
|
|
83347
|
+
traverseProps(
|
|
83348
|
+
sections,
|
|
83349
|
+
(prop, fullPath) => {
|
|
83350
|
+
const builtProp = prop.setName(fullPath).build();
|
|
83351
|
+
if (builtProp.dataType === "internal" && builtProp.default) {
|
|
83352
|
+
internalPropsList.push({
|
|
83353
|
+
path: fullPath,
|
|
83354
|
+
factory: builtProp.default
|
|
83355
|
+
});
|
|
83356
|
+
}
|
|
83357
|
+
},
|
|
83358
|
+
parentPath
|
|
83359
|
+
);
|
|
83360
|
+
return internalPropsList;
|
|
83361
|
+
}
|
|
83362
|
+
function createManagedPropsList(sections, parentPath = "") {
|
|
83363
|
+
const managedPropsList = [];
|
|
83364
|
+
traverseProps(
|
|
83365
|
+
sections,
|
|
83366
|
+
(prop, fullPath, name, parentDefault) => {
|
|
83367
|
+
let configuredProp = prop.setName(fullPath);
|
|
83368
|
+
const propDefault = buildPropLeafDefault(prop, name, parentDefault);
|
|
83369
|
+
if (propDefault !== void 0) {
|
|
83370
|
+
configuredProp = configuredProp.default(propDefault);
|
|
83371
|
+
}
|
|
83372
|
+
const builtProp = configuredProp.build();
|
|
83373
|
+
if (builtProp.dataType !== "internal") {
|
|
83374
|
+
managedPropsList.push({ ...builtProp });
|
|
83375
|
+
}
|
|
83376
|
+
},
|
|
83377
|
+
parentPath
|
|
83378
|
+
);
|
|
83335
83379
|
return managedPropsList;
|
|
83336
83380
|
}
|
|
83337
83381
|
var rfdc_1;
|
|
@@ -83532,7 +83576,7 @@ function registerStores(stores) {
|
|
|
83532
83576
|
internalStores = { ...internalStores, ...stores };
|
|
83533
83577
|
if (SUPPORTED_MODES.includes("production")) {
|
|
83534
83578
|
if (Object.keys(internalStores).length === Object.keys(stores).length) {
|
|
83535
|
-
import("./devtools-consolidated-
|
|
83579
|
+
import("./devtools-consolidated-Cc9P7odf.js").then(({ initializeCustomDevTools, setRegisteredStores }) => {
|
|
83536
83580
|
setRegisteredStores(internalStores);
|
|
83537
83581
|
initializeCustomDevTools();
|
|
83538
83582
|
}).catch((error) => {
|
|
@@ -83545,7 +83589,7 @@ function registerStores(stores) {
|
|
|
83545
83589
|
}
|
|
83546
83590
|
}
|
|
83547
83591
|
const DevToolsInternal = React__default.lazy(() => {
|
|
83548
|
-
return import("./devtools-consolidated-
|
|
83592
|
+
return import("./devtools-consolidated-Cc9P7odf.js").then((module2) => ({
|
|
83549
83593
|
default: module2.CustomDevTools
|
|
83550
83594
|
}));
|
|
83551
83595
|
});
|
|
@@ -83612,17 +83656,26 @@ function createGlobalObject({
|
|
|
83612
83656
|
}
|
|
83613
83657
|
);
|
|
83614
83658
|
}
|
|
83615
|
-
const prettyPrintFunction = (func, args) => {
|
|
83616
|
-
|
|
83617
|
-
|
|
83618
|
-
|
|
83619
|
-
|
|
83620
|
-
|
|
83621
|
-
|
|
83622
|
-
|
|
83623
|
-
|
|
83624
|
-
|
|
83625
|
-
|
|
83659
|
+
const prettyPrintFunction = (func, args, fnName) => {
|
|
83660
|
+
let funcStr;
|
|
83661
|
+
try {
|
|
83662
|
+
funcStr = func.toString().replace(/\s+/g, " ").trim();
|
|
83663
|
+
} catch {
|
|
83664
|
+
funcStr = "[Function]";
|
|
83665
|
+
}
|
|
83666
|
+
let argsStr;
|
|
83667
|
+
try {
|
|
83668
|
+
argsStr = args.map((arg) => {
|
|
83669
|
+
try {
|
|
83670
|
+
return typeof arg === "string" ? `"${arg.replace(/\n/g, "\\n").replace(/"/g, '\\"')}"` : String(arg).replace(/\s+/g, " ").trim();
|
|
83671
|
+
} catch {
|
|
83672
|
+
return String(arg);
|
|
83673
|
+
}
|
|
83674
|
+
}).join(", ");
|
|
83675
|
+
} catch {
|
|
83676
|
+
argsStr = "[Arguments]";
|
|
83677
|
+
}
|
|
83678
|
+
return `${fnName}: ${funcStr}(${argsStr})`;
|
|
83626
83679
|
};
|
|
83627
83680
|
class EvalComputeEngine {
|
|
83628
83681
|
constructor() {
|
|
@@ -83672,9 +83725,16 @@ class EvalComputeEngine {
|
|
|
83672
83725
|
func.toString()
|
|
83673
83726
|
);
|
|
83674
83727
|
} catch (error) {
|
|
83728
|
+
if (error instanceof Promise) {
|
|
83729
|
+
throw error;
|
|
83730
|
+
}
|
|
83675
83731
|
console.log(`Error in eval(${entityName.value}.${path2})`, {
|
|
83676
83732
|
error,
|
|
83677
|
-
func: prettyPrintFunction(
|
|
83733
|
+
func: prettyPrintFunction(
|
|
83734
|
+
func,
|
|
83735
|
+
args || [],
|
|
83736
|
+
entityName.value + "." + path2
|
|
83737
|
+
)
|
|
83678
83738
|
});
|
|
83679
83739
|
return void 0;
|
|
83680
83740
|
}
|
|
@@ -83699,15 +83759,65 @@ class DirectComputeEngine {
|
|
|
83699
83759
|
}
|
|
83700
83760
|
return func.call(entity, snapshot, ...funcArgs);
|
|
83701
83761
|
} catch (error) {
|
|
83762
|
+
if (error instanceof Promise) {
|
|
83763
|
+
throw error;
|
|
83764
|
+
}
|
|
83702
83765
|
console.log(`Error in direct(${entityName.value}.${path2})`, {
|
|
83703
83766
|
error,
|
|
83704
|
-
func: prettyPrintFunction(
|
|
83767
|
+
func: prettyPrintFunction(
|
|
83768
|
+
func,
|
|
83769
|
+
args || [],
|
|
83770
|
+
entityName.value + "." + path2
|
|
83771
|
+
)
|
|
83705
83772
|
});
|
|
83706
83773
|
return void 0;
|
|
83707
83774
|
}
|
|
83708
83775
|
}
|
|
83709
83776
|
}
|
|
83710
|
-
|
|
83777
|
+
const objectFallbackCache = /* @__PURE__ */ new WeakMap();
|
|
83778
|
+
function sanitizeObject(obj) {
|
|
83779
|
+
if (!objectFallbackCache.has(obj)) {
|
|
83780
|
+
objectFallbackCache.set(obj, {});
|
|
83781
|
+
}
|
|
83782
|
+
const fallbackCache = objectFallbackCache.get(obj);
|
|
83783
|
+
return new Proxy(obj, {
|
|
83784
|
+
get(target, prop) {
|
|
83785
|
+
try {
|
|
83786
|
+
const value = target[prop];
|
|
83787
|
+
if (typeof prop === "string") {
|
|
83788
|
+
fallbackCache[prop] = value;
|
|
83789
|
+
}
|
|
83790
|
+
return value;
|
|
83791
|
+
} catch (error) {
|
|
83792
|
+
if (error instanceof Promise) {
|
|
83793
|
+
return typeof prop === "string" ? fallbackCache[prop] : void 0;
|
|
83794
|
+
}
|
|
83795
|
+
throw error;
|
|
83796
|
+
}
|
|
83797
|
+
}
|
|
83798
|
+
});
|
|
83799
|
+
}
|
|
83800
|
+
function sanitizeEntity(entity) {
|
|
83801
|
+
return sanitizeObject(entity);
|
|
83802
|
+
}
|
|
83803
|
+
function sanitizeScopedState(state) {
|
|
83804
|
+
return new Proxy(state, {
|
|
83805
|
+
get(target, prop) {
|
|
83806
|
+
const value = target[prop];
|
|
83807
|
+
if (value && typeof value === "object" && "type" in value) {
|
|
83808
|
+
return sanitizeObject(value);
|
|
83809
|
+
}
|
|
83810
|
+
return value;
|
|
83811
|
+
}
|
|
83812
|
+
});
|
|
83813
|
+
}
|
|
83814
|
+
function sanitizedToJS(value) {
|
|
83815
|
+
if (value === null || value === void 0 || typeof value !== "object") {
|
|
83816
|
+
return toJS(value);
|
|
83817
|
+
}
|
|
83818
|
+
return toJS(sanitizeObject(value));
|
|
83819
|
+
}
|
|
83820
|
+
function createScopeProxy(scopes, useSuspense = false) {
|
|
83711
83821
|
const proxy = new Proxy(
|
|
83712
83822
|
{},
|
|
83713
83823
|
{
|
|
@@ -83717,10 +83827,10 @@ function createScopeProxy(scopes) {
|
|
|
83717
83827
|
return void 0;
|
|
83718
83828
|
}
|
|
83719
83829
|
if (prop in scope.entities) {
|
|
83720
|
-
return scope.entities[prop];
|
|
83830
|
+
return !useSuspense ? sanitizeEntity(scope.entities[prop]) : scope.entities[prop];
|
|
83721
83831
|
}
|
|
83722
83832
|
if (scope !== scopes[0] && scope.name === prop) {
|
|
83723
|
-
return scope.entities;
|
|
83833
|
+
return !useSuspense ? sanitizeScopedState(scope.entities) : scope.entities;
|
|
83724
83834
|
}
|
|
83725
83835
|
}
|
|
83726
83836
|
},
|
|
@@ -83754,115 +83864,6 @@ function createScopeProxy(scopes) {
|
|
|
83754
83864
|
);
|
|
83755
83865
|
return proxy;
|
|
83756
83866
|
}
|
|
83757
|
-
function buildPath$1(entry) {
|
|
83758
|
-
if (!entry) return "ROOT";
|
|
83759
|
-
const res = [];
|
|
83760
|
-
while (entry.parent) {
|
|
83761
|
-
res.push(entry.path);
|
|
83762
|
-
entry = entry.parent;
|
|
83763
|
-
}
|
|
83764
|
-
return res.reverse().join("/");
|
|
83765
|
-
}
|
|
83766
|
-
function isRecursivelyObservable$1(thing) {
|
|
83767
|
-
return isObservableObject(thing) || isObservableArray(thing) || isObservableMap(thing);
|
|
83768
|
-
}
|
|
83769
|
-
function getRelatedEntity(path2, target) {
|
|
83770
|
-
if (typeof target !== "object" || !("getEntity" in target)) {
|
|
83771
|
-
return void 0;
|
|
83772
|
-
}
|
|
83773
|
-
return target.getEntity({
|
|
83774
|
-
value: path2,
|
|
83775
|
-
isAnonymous: false
|
|
83776
|
-
});
|
|
83777
|
-
}
|
|
83778
|
-
function deepObserve$1(target, listener) {
|
|
83779
|
-
const entrySet = /* @__PURE__ */ new WeakMap();
|
|
83780
|
-
function genericListener(change) {
|
|
83781
|
-
const entry = entrySet.get(change.object);
|
|
83782
|
-
processChange(change, entry);
|
|
83783
|
-
const relatedEntity = getRelatedEntity(entry.path, target);
|
|
83784
|
-
if (relatedEntity) {
|
|
83785
|
-
listener(
|
|
83786
|
-
{
|
|
83787
|
-
...change,
|
|
83788
|
-
relatedEntity
|
|
83789
|
-
},
|
|
83790
|
-
buildPath$1(entry),
|
|
83791
|
-
relatedEntity
|
|
83792
|
-
);
|
|
83793
|
-
} else {
|
|
83794
|
-
listener(change, buildPath$1(entry), target);
|
|
83795
|
-
}
|
|
83796
|
-
}
|
|
83797
|
-
function processChange(change, parent) {
|
|
83798
|
-
switch (change.type) {
|
|
83799
|
-
// Object changes
|
|
83800
|
-
case "add":
|
|
83801
|
-
observeRecursively(change.newValue, parent, change.name);
|
|
83802
|
-
break;
|
|
83803
|
-
case "update":
|
|
83804
|
-
unobserveRecursively(change.oldValue);
|
|
83805
|
-
observeRecursively(
|
|
83806
|
-
change.newValue,
|
|
83807
|
-
parent,
|
|
83808
|
-
change.name || "" + change.index
|
|
83809
|
-
);
|
|
83810
|
-
break;
|
|
83811
|
-
case "remove":
|
|
83812
|
-
// object
|
|
83813
|
-
case "delete":
|
|
83814
|
-
unobserveRecursively(change.oldValue);
|
|
83815
|
-
break;
|
|
83816
|
-
// Array changes
|
|
83817
|
-
case "splice":
|
|
83818
|
-
change.removed.map(unobserveRecursively);
|
|
83819
|
-
change.added.forEach(
|
|
83820
|
-
(value, idx) => observeRecursively(value, parent, "" + (change.index + idx))
|
|
83821
|
-
);
|
|
83822
|
-
for (let i3 = change.index + change.addedCount; i3 < change.object.length; i3++) {
|
|
83823
|
-
if (isRecursivelyObservable$1(change.object[i3])) {
|
|
83824
|
-
const entry = entrySet.get(change.object[i3]);
|
|
83825
|
-
if (entry) entry.path = "" + i3;
|
|
83826
|
-
}
|
|
83827
|
-
}
|
|
83828
|
-
break;
|
|
83829
|
-
}
|
|
83830
|
-
}
|
|
83831
|
-
function observeRecursively(thing, parent, path2) {
|
|
83832
|
-
if (isRecursivelyObservable$1(thing)) {
|
|
83833
|
-
const entry = entrySet.get(thing);
|
|
83834
|
-
if (entry) {
|
|
83835
|
-
if (entry.parent !== parent || entry.path !== path2)
|
|
83836
|
-
throw new Error(
|
|
83837
|
-
`The same observable object cannot appear twice in the same tree, trying to assign it to '${buildPath$1(parent)}/${path2}', but it already exists at '${buildPath$1(entry.parent)}/${entry.path}'`
|
|
83838
|
-
);
|
|
83839
|
-
} else {
|
|
83840
|
-
const entry2 = {
|
|
83841
|
-
parent,
|
|
83842
|
-
path: path2,
|
|
83843
|
-
dispose: observe$1(thing, genericListener)
|
|
83844
|
-
};
|
|
83845
|
-
entrySet.set(thing, entry2);
|
|
83846
|
-
entries(thing).forEach(
|
|
83847
|
-
([key2, value]) => observeRecursively(value, entry2, key2)
|
|
83848
|
-
);
|
|
83849
|
-
}
|
|
83850
|
-
}
|
|
83851
|
-
}
|
|
83852
|
-
function unobserveRecursively(thing) {
|
|
83853
|
-
if (isRecursivelyObservable$1(thing)) {
|
|
83854
|
-
const entry = entrySet.get(thing);
|
|
83855
|
-
if (!entry) return;
|
|
83856
|
-
entrySet.delete(thing);
|
|
83857
|
-
entry.dispose();
|
|
83858
|
-
values$1(thing).forEach(unobserveRecursively);
|
|
83859
|
-
}
|
|
83860
|
-
}
|
|
83861
|
-
observeRecursively(target, void 0, "");
|
|
83862
|
-
return () => {
|
|
83863
|
-
unobserveRecursively(target);
|
|
83864
|
-
};
|
|
83865
|
-
}
|
|
83866
83867
|
class SbEventFlow {
|
|
83867
83868
|
constructor() {
|
|
83868
83869
|
__publicField(this, "steps", []);
|
|
@@ -84199,11 +84200,21 @@ const buildEntityScope = (id2, name) => ({
|
|
|
84199
84200
|
entityMeta: {},
|
|
84200
84201
|
childScopes: {},
|
|
84201
84202
|
idToName: {},
|
|
84202
|
-
getEntity(name2) {
|
|
84203
|
-
|
|
84203
|
+
getEntity(name2, options) {
|
|
84204
|
+
const entity = this.entities[name2.value];
|
|
84205
|
+
const useSuspense = (options == null ? void 0 : options.useSuspense) ?? false;
|
|
84206
|
+
if (!useSuspense && entity) {
|
|
84207
|
+
return sanitizeEntity(entity);
|
|
84208
|
+
}
|
|
84209
|
+
return entity;
|
|
84204
84210
|
},
|
|
84205
|
-
getEntityMeta(name2) {
|
|
84206
|
-
|
|
84211
|
+
getEntityMeta(name2, options) {
|
|
84212
|
+
const entityMeta = this.entityMeta[name2.value];
|
|
84213
|
+
const useSuspense = (options == null ? void 0 : options.useSuspense) ?? false;
|
|
84214
|
+
if (!useSuspense && entityMeta) {
|
|
84215
|
+
return sanitizeEntity(entityMeta);
|
|
84216
|
+
}
|
|
84217
|
+
return entityMeta;
|
|
84207
84218
|
},
|
|
84208
84219
|
getEntityName(id22) {
|
|
84209
84220
|
return this.idToName[id22];
|
|
@@ -84251,16 +84262,17 @@ class EntityManager {
|
|
|
84251
84262
|
registerStores({ Entities: this.state });
|
|
84252
84263
|
}
|
|
84253
84264
|
}
|
|
84254
|
-
getEntity(
|
|
84255
|
-
return this.getState(
|
|
84265
|
+
getEntity(scopeId, name, options) {
|
|
84266
|
+
return this.getState(scopeId, options)[name.value];
|
|
84256
84267
|
}
|
|
84257
|
-
getEntityById(scopeId, id2) {
|
|
84268
|
+
getEntityById(scopeId, id2, options) {
|
|
84258
84269
|
const scope = this.getScope(scopeId);
|
|
84259
|
-
return scope.getEntity(scope.getEntityName(id2));
|
|
84270
|
+
return scope.getEntity(scope.getEntityName(id2), options);
|
|
84260
84271
|
}
|
|
84261
|
-
getState(scopeId) {
|
|
84272
|
+
getState(scopeId, options) {
|
|
84262
84273
|
const scopes = this.getAccessibleScopes(scopeId);
|
|
84263
|
-
|
|
84274
|
+
const useSuspense = (options == null ? void 0 : options.useSuspense) ?? false;
|
|
84275
|
+
return createScopeProxy(scopes, useSuspense);
|
|
84264
84276
|
}
|
|
84265
84277
|
getScopeName(scopeId) {
|
|
84266
84278
|
const scope = this.getScope(scopeId);
|
|
@@ -84390,6 +84402,10 @@ class EntityManager {
|
|
|
84390
84402
|
this means the entire item will have leaf properties (more expensive)`
|
|
84391
84403
|
);
|
|
84392
84404
|
}
|
|
84405
|
+
const internalProps = this.componentRegistry.getInternalProps(type5);
|
|
84406
|
+
for (const internalProp of internalProps) {
|
|
84407
|
+
this.addInternalProperty(scopeId, name, internalProp);
|
|
84408
|
+
}
|
|
84393
84409
|
const functionalProps = toExecutablesOrValues(props2, managedPropsForType);
|
|
84394
84410
|
const addedProperties = /* @__PURE__ */ new Set();
|
|
84395
84411
|
for (const [prop, value] of functionalProps) {
|
|
@@ -84398,6 +84414,18 @@ class EntityManager {
|
|
|
84398
84414
|
}
|
|
84399
84415
|
this.addMissingProps(managedPropsForType, addedProperties, scopeId, name);
|
|
84400
84416
|
}
|
|
84417
|
+
addInternalProperty(scopeId, name, internalProp) {
|
|
84418
|
+
const entity = this.getScope(scopeId).getEntity(name);
|
|
84419
|
+
const { path: path2, factory } = internalProp;
|
|
84420
|
+
const instance = factory.call(entity);
|
|
84421
|
+
Object.defineProperty(entity, path2, {
|
|
84422
|
+
value: instance,
|
|
84423
|
+
writable: false,
|
|
84424
|
+
enumerable: false,
|
|
84425
|
+
// This hides it from Object.keys(), JSON.stringify(), etc.
|
|
84426
|
+
configurable: false
|
|
84427
|
+
});
|
|
84428
|
+
}
|
|
84401
84429
|
addProperty(scopeId, name, prop, eov) {
|
|
84402
84430
|
if (prop.split(".").includes(RECORD_PATH_IDENTIFIER)) {
|
|
84403
84431
|
return;
|
|
@@ -84427,7 +84455,7 @@ class EntityManager {
|
|
|
84427
84455
|
const entityType = entity.type;
|
|
84428
84456
|
if (eov.type === "external-function") {
|
|
84429
84457
|
const finalFunction = async (...args) => this.dirComputeEngine.compute({
|
|
84430
|
-
snapshot: snapshot(scopeId),
|
|
84458
|
+
snapshot: snapshot(scopeId, { useSuspense: true }),
|
|
84431
84459
|
func: eov.value,
|
|
84432
84460
|
path: prop,
|
|
84433
84461
|
args,
|
|
@@ -84474,7 +84502,7 @@ class EntityManager {
|
|
|
84474
84502
|
if (managedProp == null ? void 0 : managedProp.contextual) {
|
|
84475
84503
|
ret = function(context2) {
|
|
84476
84504
|
return computeEngine.compute({
|
|
84477
|
-
snapshot: snapshot(scopeId),
|
|
84505
|
+
snapshot: snapshot(scopeId, { useSuspense: true }),
|
|
84478
84506
|
entityName: name,
|
|
84479
84507
|
func: eov.value,
|
|
84480
84508
|
path: prop,
|
|
@@ -84484,7 +84512,7 @@ class EntityManager {
|
|
|
84484
84512
|
};
|
|
84485
84513
|
} else {
|
|
84486
84514
|
ret = computeEngine.compute({
|
|
84487
|
-
snapshot: snapshot(scopeId),
|
|
84515
|
+
snapshot: snapshot(scopeId, { useSuspense: true }),
|
|
84488
84516
|
entityName: name,
|
|
84489
84517
|
func: eov.value,
|
|
84490
84518
|
path: prop
|
|
@@ -84495,10 +84523,10 @@ class EntityManager {
|
|
|
84495
84523
|
}
|
|
84496
84524
|
}
|
|
84497
84525
|
if ((managedProp == null ? void 0 : managedProp.validate) && typeof ret !== "function") {
|
|
84498
|
-
const currentState = snapshot(scopeId);
|
|
84526
|
+
const currentState = snapshot(scopeId, { useSuspense: true });
|
|
84499
84527
|
const entity2 = currentState[name.value];
|
|
84500
84528
|
const validationResult = managedProp.validate(ret, entity2);
|
|
84501
|
-
if (entity2[WIDGET_SOURCE_ID_ATTRIBUTE]) {
|
|
84529
|
+
if (entity2 == null ? void 0 : entity2[WIDGET_SOURCE_ID_ATTRIBUTE]) {
|
|
84502
84530
|
this.setValidationState(
|
|
84503
84531
|
entity2[WIDGET_SOURCE_ID_ATTRIBUTE],
|
|
84504
84532
|
prop,
|
|
@@ -84514,11 +84542,14 @@ class EntityManager {
|
|
|
84514
84542
|
}
|
|
84515
84543
|
ret = validationResult.result;
|
|
84516
84544
|
}
|
|
84517
|
-
|
|
84518
|
-
|
|
84545
|
+
} catch (e3) {
|
|
84546
|
+
if (e3 instanceof Promise) {
|
|
84547
|
+
throw e3;
|
|
84548
|
+
}
|
|
84519
84549
|
console.log("Could not compute property value");
|
|
84520
84550
|
return void 0;
|
|
84521
84551
|
}
|
|
84552
|
+
return ret;
|
|
84522
84553
|
});
|
|
84523
84554
|
const setValue = (value) => {
|
|
84524
84555
|
const metaParent = getMetaParent();
|
|
@@ -84671,6 +84702,7 @@ class EntityManager {
|
|
|
84671
84702
|
}
|
|
84672
84703
|
this.deleteObsoleteNestedProperties(scopeId, name, props2, entity);
|
|
84673
84704
|
const managedPropsForType = this.componentRegistry.getManagedProps(type5);
|
|
84705
|
+
const internalProps = this.componentRegistry.getInternalProps(type5);
|
|
84674
84706
|
const functionalProps = toExecutablesOrValues(props2, managedPropsForType);
|
|
84675
84707
|
const addedProperties = /* @__PURE__ */ new Set();
|
|
84676
84708
|
for (const [prop, value] of functionalProps) {
|
|
@@ -84679,9 +84711,11 @@ class EntityManager {
|
|
|
84679
84711
|
}
|
|
84680
84712
|
const missingPropKeys = Object.keys(entity).filter((key2) => {
|
|
84681
84713
|
const propInfo = managedPropsForType.find((p) => p.path === key2);
|
|
84714
|
+
const isInternalProp = internalProps.some((p) => p.path === key2);
|
|
84682
84715
|
return !(key2 in props2) && // not in props
|
|
84683
84716
|
!PROTECTED_KEYS.has(key2) && // not a protected key
|
|
84684
|
-
(propInfo == null ? void 0 : propInfo.dataType) !== "function"
|
|
84717
|
+
(propInfo == null ? void 0 : propInfo.dataType) !== "function" && // not a function (these are considered immutable)
|
|
84718
|
+
!isInternalProp;
|
|
84685
84719
|
});
|
|
84686
84720
|
missingPropKeys.forEach((key2) => delete entity[key2]);
|
|
84687
84721
|
this.addMissingProps(managedPropsForType, addedProperties, scopeId, name);
|
|
@@ -84759,10 +84793,6 @@ class EntityManager {
|
|
|
84759
84793
|
));
|
|
84760
84794
|
return { atom, isNew };
|
|
84761
84795
|
}
|
|
84762
|
-
observeScope(scopeId, listener) {
|
|
84763
|
-
const scope = this.getScope(scopeId);
|
|
84764
|
-
return deepObserve$1(scope, listener);
|
|
84765
|
-
}
|
|
84766
84796
|
}
|
|
84767
84797
|
function cleanObject(obj) {
|
|
84768
84798
|
obj = toJS(obj);
|
|
@@ -84862,7 +84892,7 @@ const triggerSendFromQueue = throttle(
|
|
|
84862
84892
|
// { leading: false, trailing: true },
|
|
84863
84893
|
);
|
|
84864
84894
|
function queueMessage(message2) {
|
|
84865
|
-
actionQueue.push(
|
|
84895
|
+
actionQueue.push(message2);
|
|
84866
84896
|
triggerSendFromQueue();
|
|
84867
84897
|
}
|
|
84868
84898
|
class SbIframeEventInternal extends Event {
|
|
@@ -85796,16 +85826,18 @@ function deepObserve(target, listener) {
|
|
|
85796
85826
|
}
|
|
85797
85827
|
function startEditorSync(options) {
|
|
85798
85828
|
const { store, storeId, keys: keys2, projection, debounce: debounce2 } = options;
|
|
85799
|
-
const reactionOptions =
|
|
85800
|
-
delay: debounce2
|
|
85801
|
-
|
|
85829
|
+
const reactionOptions = {
|
|
85830
|
+
delay: debounce2,
|
|
85831
|
+
name: `editor-sync(${storeId})`
|
|
85832
|
+
};
|
|
85802
85833
|
let initialState;
|
|
85803
85834
|
if (keys2) {
|
|
85804
|
-
|
|
85835
|
+
const p = lodashExports.pick(store, Object.keys(keys2));
|
|
85836
|
+
initialState = sanitizedToJS(p);
|
|
85805
85837
|
} else if (projection) {
|
|
85806
|
-
initialState =
|
|
85838
|
+
initialState = sanitizedToJS(projection(store));
|
|
85807
85839
|
} else {
|
|
85808
|
-
initialState =
|
|
85840
|
+
initialState = sanitizedToJS(store);
|
|
85809
85841
|
}
|
|
85810
85842
|
editorBridge.initializeEditorSyncedStore({
|
|
85811
85843
|
storeId,
|
|
@@ -85819,7 +85851,7 @@ function startEditorSync(options) {
|
|
|
85819
85851
|
return reaction(
|
|
85820
85852
|
() => {
|
|
85821
85853
|
const currentProjection = projection(store);
|
|
85822
|
-
return
|
|
85854
|
+
return sanitizedToJS(currentProjection[key2]);
|
|
85823
85855
|
},
|
|
85824
85856
|
(value) => {
|
|
85825
85857
|
const diffs = microPatches(lastValue, value, key2);
|
|
@@ -85856,7 +85888,7 @@ function startEditorSync(options) {
|
|
|
85856
85888
|
patch: {
|
|
85857
85889
|
op: "update",
|
|
85858
85890
|
path: [key2],
|
|
85859
|
-
value:
|
|
85891
|
+
value: sanitizedToJS(projection(store)[key2])
|
|
85860
85892
|
}
|
|
85861
85893
|
});
|
|
85862
85894
|
});
|
|
@@ -85931,6 +85963,7 @@ class ComponentRegistry {
|
|
|
85931
85963
|
__publicField(this, "_typeRegistry", /* @__PURE__ */ new Map());
|
|
85932
85964
|
__publicField(this, "_customComponentRegistry", /* @__PURE__ */ new Map());
|
|
85933
85965
|
__publicField(this, "_managedPropsRegistry", /* @__PURE__ */ new Map());
|
|
85966
|
+
__publicField(this, "_internalPropsRegistry", /* @__PURE__ */ new Map());
|
|
85934
85967
|
this.rootStore = rootStore2;
|
|
85935
85968
|
makeAutoObservable(this);
|
|
85936
85969
|
startEditorSync({
|
|
@@ -85970,6 +86003,12 @@ class ComponentRegistry {
|
|
|
85970
86003
|
deleteManagedProps(type5) {
|
|
85971
86004
|
this._managedPropsRegistry.delete(type5);
|
|
85972
86005
|
}
|
|
86006
|
+
addInternalProps(type5, props2) {
|
|
86007
|
+
this._internalPropsRegistry.set(type5, props2);
|
|
86008
|
+
}
|
|
86009
|
+
getInternalProps(type5) {
|
|
86010
|
+
return this._internalPropsRegistry.get(type5) ?? [];
|
|
86011
|
+
}
|
|
85973
86012
|
get libraryComponentList() {
|
|
85974
86013
|
return Array.from(this._typeRegistry.keys());
|
|
85975
86014
|
}
|
|
@@ -86855,10 +86894,15 @@ class PropertiesPanelManager {
|
|
|
86855
86894
|
if (this.propertiesPanelTrackerDisposer) {
|
|
86856
86895
|
this.propertiesPanelTrackerDisposer();
|
|
86857
86896
|
}
|
|
86858
|
-
this.propertiesPanelTrackerDisposer = autorun(
|
|
86859
|
-
|
|
86860
|
-
|
|
86861
|
-
|
|
86897
|
+
this.propertiesPanelTrackerDisposer = autorun(
|
|
86898
|
+
() => {
|
|
86899
|
+
const propertiesPanel = this.getPropertiesPanel(scopeId, instanceId);
|
|
86900
|
+
editorBridge.addPropertiesPanel(sourceId, propertiesPanel);
|
|
86901
|
+
},
|
|
86902
|
+
{
|
|
86903
|
+
name: `trackPropertiesPanel[${scopeId}-${instanceId}]`
|
|
86904
|
+
}
|
|
86905
|
+
);
|
|
86862
86906
|
}
|
|
86863
86907
|
getPropertiesDefinition(type5) {
|
|
86864
86908
|
return this.propertiesDefinitions.get(type5);
|
|
@@ -91208,14 +91252,14 @@ function getLoaderFn$1(options) {
|
|
|
91208
91252
|
if (!(loader === "all")) return [3, 3];
|
|
91209
91253
|
return [4, import(
|
|
91210
91254
|
/* webpackChunkName: "blueprint-icons-all-paths-loader" */
|
|
91211
|
-
"./allPathsLoader-
|
|
91255
|
+
"./allPathsLoader-D0DZVqPi.js"
|
|
91212
91256
|
)];
|
|
91213
91257
|
case 2:
|
|
91214
91258
|
return [2, _b2.sent().allPathsLoader];
|
|
91215
91259
|
case 3:
|
|
91216
91260
|
return [4, import(
|
|
91217
91261
|
/* webpackChunkName: "blueprint-icons-split-paths-by-size-loader" */
|
|
91218
|
-
"./splitPathsBySizeLoader-
|
|
91262
|
+
"./splitPathsBySizeLoader-BtCO3mSJ.js"
|
|
91219
91263
|
)];
|
|
91220
91264
|
case 4:
|
|
91221
91265
|
return [2, _b2.sent().splitPathsBySizeLoader];
|
|
@@ -100335,10 +100379,16 @@ function createSbScope(getInitialEntities, options) {
|
|
|
100335
100379
|
return void 0;
|
|
100336
100380
|
}
|
|
100337
100381
|
return createBindableEntityProxy(
|
|
100338
|
-
() => rootStore.entityManager.getEntity(
|
|
100339
|
-
|
|
100340
|
-
|
|
100341
|
-
|
|
100382
|
+
() => rootStore.entityManager.getEntity(
|
|
100383
|
+
scopeId,
|
|
100384
|
+
{
|
|
100385
|
+
value: key2,
|
|
100386
|
+
isAnonymous: false
|
|
100387
|
+
},
|
|
100388
|
+
{
|
|
100389
|
+
useSuspense: true
|
|
100390
|
+
}
|
|
100391
|
+
),
|
|
100342
100392
|
getBinding(key2)
|
|
100343
100393
|
);
|
|
100344
100394
|
}
|
|
@@ -111674,14 +111724,46 @@ const createEntityActions = (entityName, scopeId) => ({
|
|
|
111674
111724
|
reset: entityActions.reset.bind(null, entityName, scopeId),
|
|
111675
111725
|
update: entityActions.update.bind(null, entityName, scopeId)
|
|
111676
111726
|
});
|
|
111677
|
-
const
|
|
111727
|
+
const SuspenseSymbol = Symbol("SuspenseSymbol");
|
|
111728
|
+
function toJsOrSuspense(obj, key2) {
|
|
111729
|
+
try {
|
|
111730
|
+
if (key2) {
|
|
111731
|
+
return toJS(obj[key2]);
|
|
111732
|
+
}
|
|
111733
|
+
return toJS(obj);
|
|
111734
|
+
} catch (error) {
|
|
111735
|
+
if (error instanceof Promise) {
|
|
111736
|
+
return {
|
|
111737
|
+
__isSuspenseResult: SuspenseSymbol
|
|
111738
|
+
};
|
|
111739
|
+
}
|
|
111740
|
+
throw error;
|
|
111741
|
+
}
|
|
111742
|
+
}
|
|
111743
|
+
function removeSuspense(keys2, result, prevSafeResult) {
|
|
111744
|
+
const sanitized = {};
|
|
111745
|
+
for (const key2 of keys2) {
|
|
111746
|
+
const value = result[key2];
|
|
111747
|
+
if (value && value.__isSuspenseResult) {
|
|
111748
|
+
const preSafeValue = (prevSafeResult == null ? void 0 : prevSafeResult[key2]) || null;
|
|
111749
|
+
sanitized[key2] = preSafeValue;
|
|
111750
|
+
} else {
|
|
111751
|
+
sanitized[key2] = value;
|
|
111752
|
+
}
|
|
111753
|
+
}
|
|
111754
|
+
return sanitized;
|
|
111755
|
+
}
|
|
111756
|
+
const useShallowMobxObserver = (obj, useSuspense = true) => {
|
|
111678
111757
|
const isFirstRenderRef = useRef(true);
|
|
111679
111758
|
const [keys2, setKeys] = useState(Object.keys(obj));
|
|
111680
|
-
const
|
|
111759
|
+
const preSafeResultRef = useRef(void 0);
|
|
111760
|
+
const [result, setResult] = useState(
|
|
111761
|
+
() => toJsOrSuspense(obj)
|
|
111762
|
+
);
|
|
111681
111763
|
useEffect(() => {
|
|
111682
111764
|
if (!isFirstRenderRef.current) {
|
|
111683
111765
|
setKeys(Object.keys(obj));
|
|
111684
|
-
setResult(
|
|
111766
|
+
setResult(toJsOrSuspense(obj));
|
|
111685
111767
|
}
|
|
111686
111768
|
isFirstRenderRef.current = false;
|
|
111687
111769
|
}, [obj]);
|
|
@@ -111690,12 +111772,12 @@ const useShallowMobxObserver = (obj) => {
|
|
|
111690
111772
|
() => Object.keys(obj),
|
|
111691
111773
|
(newKeys) => {
|
|
111692
111774
|
setKeys(newKeys);
|
|
111693
|
-
setResult(
|
|
111694
|
-
|
|
111775
|
+
setResult(
|
|
111776
|
+
newKeys.reduce((acc, key2) => {
|
|
111695
111777
|
acc[key2] = obj[key2];
|
|
111696
111778
|
return acc;
|
|
111697
|
-
}, {})
|
|
111698
|
-
|
|
111779
|
+
}, {})
|
|
111780
|
+
);
|
|
111699
111781
|
},
|
|
111700
111782
|
{
|
|
111701
111783
|
name: "shallowMobxObserver-keys",
|
|
@@ -111708,11 +111790,10 @@ const useShallowMobxObserver = (obj) => {
|
|
|
111708
111790
|
for (const key2 of keys2) {
|
|
111709
111791
|
disposers.push(
|
|
111710
111792
|
reaction(
|
|
111711
|
-
() =>
|
|
111793
|
+
() => toJsOrSuspense(obj, key2),
|
|
111712
111794
|
(v2) => {
|
|
111713
111795
|
setResult((prev2) => {
|
|
111714
|
-
|
|
111715
|
-
return res;
|
|
111796
|
+
return { ...prev2, [key2]: v2 };
|
|
111716
111797
|
});
|
|
111717
111798
|
},
|
|
111718
111799
|
{
|
|
@@ -111724,6 +111805,21 @@ const useShallowMobxObserver = (obj) => {
|
|
|
111724
111805
|
}
|
|
111725
111806
|
return () => disposers.forEach((disposer) => disposer());
|
|
111726
111807
|
}, [obj, keys2]);
|
|
111808
|
+
const wholeResultIsSuspense = result && result.__isSuspenseResult;
|
|
111809
|
+
const aKeyIsSuspense = wholeResultIsSuspense || (keys2 == null ? void 0 : keys2.some((key2) => {
|
|
111810
|
+
var _a2;
|
|
111811
|
+
return (_a2 = result[key2]) == null ? void 0 : _a2.__isSuspenseResult;
|
|
111812
|
+
}));
|
|
111813
|
+
const somethingIsSuspense = wholeResultIsSuspense || aKeyIsSuspense;
|
|
111814
|
+
if (somethingIsSuspense && useSuspense) {
|
|
111815
|
+
return obj;
|
|
111816
|
+
}
|
|
111817
|
+
if (somethingIsSuspense && !useSuspense) {
|
|
111818
|
+
const sanitized = removeSuspense(keys2, result, preSafeResultRef.current);
|
|
111819
|
+
preSafeResultRef.current = sanitized;
|
|
111820
|
+
return sanitized;
|
|
111821
|
+
}
|
|
111822
|
+
preSafeResultRef.current = result;
|
|
111727
111823
|
return result;
|
|
111728
111824
|
};
|
|
111729
111825
|
const shimmerAnimation = We$1`
|
|
@@ -111840,14 +111936,23 @@ const ReactiveComponent = observer(function Component2({
|
|
|
111840
111936
|
scopeId,
|
|
111841
111937
|
name
|
|
111842
111938
|
);
|
|
111843
|
-
const entity = rootStore.entityManager.getEntity(
|
|
111844
|
-
|
|
111845
|
-
|
|
111846
|
-
|
|
111939
|
+
const entity = rootStore.entityManager.getEntity(
|
|
111940
|
+
scopeId,
|
|
111941
|
+
{
|
|
111942
|
+
value: name,
|
|
111943
|
+
isAnonymous: false
|
|
111944
|
+
},
|
|
111945
|
+
{
|
|
111946
|
+
useSuspense: true
|
|
111947
|
+
}
|
|
111948
|
+
);
|
|
111847
111949
|
const safeProps = useMemo$2(() => {
|
|
111848
111950
|
return isNameDuplicated || !entity ? removeBindings(widgetProps) : entity;
|
|
111849
111951
|
}, [isNameDuplicated, widgetProps, entity]);
|
|
111850
|
-
const reactiveProps = useShallowMobxObserver(
|
|
111952
|
+
const reactiveProps = useShallowMobxObserver(
|
|
111953
|
+
safeProps,
|
|
111954
|
+
safeProps.loading === void 0
|
|
111955
|
+
);
|
|
111851
111956
|
const stylePropWithSize = useStyleWithSize(reactiveProps);
|
|
111852
111957
|
const styleProp = useMemo$2(() => {
|
|
111853
111958
|
const styleWithOverflow = {
|
|
@@ -111915,8 +112020,12 @@ const ReactiveComponent = observer(function Component2({
|
|
|
111915
112020
|
}
|
|
111916
112021
|
);
|
|
111917
112022
|
});
|
|
112023
|
+
const LoadingWrapper = (props2) => {
|
|
112024
|
+
const { getFallbackStyle } = useComponentSuspenseStyle();
|
|
112025
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx(SuspenseFallback, { style: getFallbackStyle }), children: props2.children });
|
|
112026
|
+
};
|
|
111918
112027
|
const WrappedReactiveComponent = (props2) => {
|
|
111919
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(ComponentSuspenseStyleProvider, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(ReactiveComponent, { ...props2 }) });
|
|
112028
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(ComponentSuspenseStyleProvider, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(LoadingWrapper, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(ReactiveComponent, { ...props2 }) }) });
|
|
111920
112029
|
};
|
|
111921
112030
|
const CustomComponentContext = createContext({
|
|
111922
112031
|
isInCustomComponent: false,
|
|
@@ -119160,7 +119269,9 @@ const registerSbComponent = (type5, config2, Component3) => {
|
|
|
119160
119269
|
};
|
|
119161
119270
|
function registerSbEntity(name, config2, Entity) {
|
|
119162
119271
|
const managedProps = createManagedPropsList(config2.propertiesDefinition);
|
|
119272
|
+
const internalProps = createInternalPropsList(config2.propertiesDefinition);
|
|
119163
119273
|
rootStore.componentRegistry.addManagedProps(name, managedProps ?? []);
|
|
119274
|
+
rootStore.componentRegistry.addInternalProps(name, internalProps ?? []);
|
|
119164
119275
|
rootStore.onEditorRegistered(() => {
|
|
119165
119276
|
getEditStore().propertiesPanelManager.setPropertiesDefinition(
|
|
119166
119277
|
name,
|
|
@@ -119634,23 +119745,24 @@ const borderRadius = (propertiesPanelConfig = {}) => {
|
|
|
119634
119745
|
...propertiesPanelConfig
|
|
119635
119746
|
});
|
|
119636
119747
|
};
|
|
119637
|
-
const loading = () => Prop.boolean().default(
|
|
119748
|
+
const loading = () => Prop.boolean().default(void 0).readAndWrite().propertiesPanel({
|
|
119638
119749
|
label: "Loading",
|
|
119639
119750
|
controlType: "RADIO_BUTTON_GROUP",
|
|
119640
119751
|
helpText: "Whether the component is loading, switch to code mode to set the loading state based whatever you want",
|
|
119641
119752
|
options: [
|
|
119642
119753
|
{
|
|
119643
119754
|
label: "Off",
|
|
119644
|
-
value: false
|
|
119755
|
+
value: false,
|
|
119756
|
+
showTooltip: false
|
|
119645
119757
|
},
|
|
119646
119758
|
{
|
|
119647
119759
|
label: "On",
|
|
119648
|
-
value: true
|
|
119760
|
+
value: true,
|
|
119761
|
+
showTooltip: false
|
|
119649
119762
|
},
|
|
119650
119763
|
{
|
|
119651
119764
|
label: "Auto",
|
|
119652
|
-
|
|
119653
|
-
tooltip: "Coming soon! Loading state is based on if referenced data is loading",
|
|
119765
|
+
tooltip: "Loading state is based on if referenced data is loading",
|
|
119654
119766
|
showTooltip: true,
|
|
119655
119767
|
value: void 0
|
|
119656
119768
|
}
|
|
@@ -127343,9 +127455,26 @@ const hasIconSupport = (inputType) => {
|
|
|
127343
127455
|
const _InputComponent = class _InputComponent extends React__default.Component {
|
|
127344
127456
|
constructor(props2) {
|
|
127345
127457
|
super(props2);
|
|
127346
|
-
__publicField(this, "numericInputRef");
|
|
127347
|
-
__publicField(this, "inputRef");
|
|
127348
|
-
__publicField(this, "groupWrapperRef");
|
|
127458
|
+
__publicField(this, "numericInputRef", React__default.createRef());
|
|
127459
|
+
__publicField(this, "inputRef", React__default.createRef());
|
|
127460
|
+
__publicField(this, "groupWrapperRef", React__default.createRef());
|
|
127461
|
+
__publicField(this, "processAndSetValue", (value, inputType) => {
|
|
127462
|
+
if (isNumericInput(inputType)) {
|
|
127463
|
+
const isPercentInput = inputType === InputTypes.PERCENTAGE;
|
|
127464
|
+
const number4 = sanitizeNumericInputValue(value, isPercentInput);
|
|
127465
|
+
const numberWithPrecision = this.valueWithPrecision(number4);
|
|
127466
|
+
const formatted = this.formatNumber(numberWithPrecision);
|
|
127467
|
+
this.setState({
|
|
127468
|
+
localValue: numberWithPrecision,
|
|
127469
|
+
displayValue: formatted
|
|
127470
|
+
});
|
|
127471
|
+
} else {
|
|
127472
|
+
this.setState({
|
|
127473
|
+
localValue: value,
|
|
127474
|
+
displayValue: value
|
|
127475
|
+
});
|
|
127476
|
+
}
|
|
127477
|
+
});
|
|
127349
127478
|
__publicField(this, "onDebouncedValueChange", lodashExports.debounce(
|
|
127350
127479
|
(value) => this.props.onValueChange(value),
|
|
127351
127480
|
this.props.disableDebounce ? 0 : 300
|
|
@@ -127648,26 +127777,14 @@ const _InputComponent = class _InputComponent extends React__default.Component {
|
|
|
127648
127777
|
}
|
|
127649
127778
|
);
|
|
127650
127779
|
});
|
|
127651
|
-
let value = props2.value;
|
|
127652
|
-
let displayValue = props2.value;
|
|
127653
|
-
if (isNumericInput(props2.inputType)) {
|
|
127654
|
-
value = String(
|
|
127655
|
-
props2.inputType === InputTypes.PERCENTAGE && props2.value !== "" && !isNaN(Number(props2.value)) ? new Decimal(props2.value).times(100) : props2.value
|
|
127656
|
-
);
|
|
127657
|
-
value = this.valueWithPrecision(value);
|
|
127658
|
-
displayValue = this.formatNumber(value || "");
|
|
127659
|
-
}
|
|
127660
127780
|
this.state = {
|
|
127661
|
-
localValue: value,
|
|
127662
|
-
displayValue,
|
|
127663
127781
|
showPassword: false,
|
|
127664
127782
|
inputFocused: false
|
|
127665
127783
|
};
|
|
127666
|
-
this.
|
|
127667
|
-
this.inputRef = React__default.createRef();
|
|
127668
|
-
this.groupWrapperRef = React__default.createRef();
|
|
127784
|
+
this.processAndSetValue(props2.value, props2.inputType);
|
|
127669
127785
|
}
|
|
127670
127786
|
componentDidMount() {
|
|
127787
|
+
this.processAndSetValue(this.props.value, this.props.inputType);
|
|
127671
127788
|
this.ensureFocus();
|
|
127672
127789
|
}
|
|
127673
127790
|
componentDidUpdate(prevProps) {
|
|
@@ -127681,22 +127798,8 @@ const _InputComponent = class _InputComponent extends React__default.Component {
|
|
|
127681
127798
|
preventFormattingWhileTyping
|
|
127682
127799
|
} = this.props;
|
|
127683
127800
|
if (preventFormattingWhileTyping && this.state.inputFocused) return;
|
|
127684
|
-
const isPercentInput = inputType === InputTypes.PERCENTAGE;
|
|
127685
127801
|
if (prevProps.numberFormatting !== numberFormatting || prevProps.minimumFractionDigits !== minimumFractionDigits || prevProps.maximumFractionDigits !== maximumFractionDigits || prevProps.inputType !== inputType || prevProps.defaultValue !== defaultValue2 || prevProps.value !== value) {
|
|
127686
|
-
|
|
127687
|
-
const number4 = sanitizeNumericInputValue(value, isPercentInput);
|
|
127688
|
-
const numberWithPrecision = this.valueWithPrecision(number4);
|
|
127689
|
-
const formatted = this.formatNumber(numberWithPrecision);
|
|
127690
|
-
this.setState({
|
|
127691
|
-
localValue: numberWithPrecision,
|
|
127692
|
-
displayValue: formatted
|
|
127693
|
-
});
|
|
127694
|
-
} else {
|
|
127695
|
-
this.setState({
|
|
127696
|
-
localValue: value,
|
|
127697
|
-
displayValue: value
|
|
127698
|
-
});
|
|
127699
|
-
}
|
|
127802
|
+
this.processAndSetValue(value, inputType);
|
|
127700
127803
|
}
|
|
127701
127804
|
}
|
|
127702
127805
|
componentWillUnmount() {
|
|
@@ -148213,14 +148316,14 @@ function getLoaderFn(options) {
|
|
|
148213
148316
|
if (!(loader === "all")) return [3, 3];
|
|
148214
148317
|
return [4, import(
|
|
148215
148318
|
/* webpackChunkName: "blueprint-icons-all-paths-loader" */
|
|
148216
|
-
"./allPathsLoader-
|
|
148319
|
+
"./allPathsLoader-Dza5jMza.js"
|
|
148217
148320
|
)];
|
|
148218
148321
|
case 2:
|
|
148219
148322
|
return [2, _b2.sent().allPathsLoader];
|
|
148220
148323
|
case 3:
|
|
148221
148324
|
return [4, import(
|
|
148222
148325
|
/* webpackChunkName: "blueprint-icons-split-paths-by-size-loader" */
|
|
148223
|
-
"./splitPathsBySizeLoader-
|
|
148326
|
+
"./splitPathsBySizeLoader-CyCuKl4N.js"
|
|
148224
148327
|
)];
|
|
148225
148328
|
case 4:
|
|
148226
148329
|
return [2, _b2.sent().splitPathsBySizeLoader];
|
|
@@ -164566,11 +164669,6 @@ const propertiesDefinition$9 = {
|
|
|
164566
164669
|
helpText: "Whether the component is visible",
|
|
164567
164670
|
controlType: "SWITCH"
|
|
164568
164671
|
}),
|
|
164569
|
-
collapseWhenHidden: Prop.boolean().propertiesPanel({
|
|
164570
|
-
label: "Collapse when hidden",
|
|
164571
|
-
helpText: "Collapse the component when it is hidden",
|
|
164572
|
-
controlType: "SWITCH"
|
|
164573
|
-
}),
|
|
164574
164672
|
// todo: move search to its own section (secondary style)
|
|
164575
164673
|
// TODO(FE-621): move to composite prop once we enable inline
|
|
164576
164674
|
// rendering of child props in the properties panel.
|
|
@@ -183363,7 +183461,7 @@ class DropDownComponent extends React__default.PureComponent {
|
|
|
183363
183461
|
...basePopoverProps,
|
|
183364
183462
|
...this.props.forceOpen ? controlledPopoverProps : {}
|
|
183365
183463
|
},
|
|
183366
|
-
itemListPredicate: this.itemListPredicate
|
|
183464
|
+
itemListPredicate: this.itemListPredicate.bind(this)
|
|
183367
183465
|
}
|
|
183368
183466
|
),
|
|
183369
183467
|
singleSelectDropdownIconElement,
|
|
@@ -183403,7 +183501,6 @@ class DropDownComponent extends React__default.PureComponent {
|
|
|
183403
183501
|
scrollToActiveItem: false,
|
|
183404
183502
|
resetOnSelect: false,
|
|
183405
183503
|
resetOnQuery: false,
|
|
183406
|
-
itemListPredicate: this.itemListPredicate,
|
|
183407
183504
|
placeholder: this.props.placeholder,
|
|
183408
183505
|
tagRenderer: this.renderTag,
|
|
183409
183506
|
itemRenderer: this.renderMultiSelectItem,
|
|
@@ -183460,7 +183557,8 @@ class DropDownComponent extends React__default.PureComponent {
|
|
|
183460
183557
|
width: this.props.width,
|
|
183461
183558
|
isValid: !this.props.isInvalid,
|
|
183462
183559
|
canvasMode: this.props.canvasMode,
|
|
183463
|
-
hasIcon: Boolean(this.props.icon)
|
|
183560
|
+
hasIcon: Boolean(this.props.icon),
|
|
183561
|
+
itemListPredicate: this.itemListPredicate.bind(this)
|
|
183464
183562
|
}
|
|
183465
183563
|
),
|
|
183466
183564
|
defaultIconElement,
|
|
@@ -184079,7 +184177,10 @@ const SbCustom = registerSbComponent(
|
|
|
184079
184177
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { display: "block" }, ...props2, children });
|
|
184080
184178
|
}
|
|
184081
184179
|
);
|
|
184082
|
-
const
|
|
184180
|
+
const defaultSections = {
|
|
184181
|
+
appearance: Section.category(PropsPanelCategory.Appearance).children({
|
|
184182
|
+
loading: loading()
|
|
184183
|
+
}),
|
|
184083
184184
|
layout: basicLayout()
|
|
184084
184185
|
};
|
|
184085
184186
|
function registerComponent(name, propertiesDefinition2, component) {
|
|
@@ -184104,7 +184205,7 @@ function registerComponent(name, propertiesDefinition2, component) {
|
|
|
184104
184205
|
{
|
|
184105
184206
|
propertiesDefinition: {
|
|
184106
184207
|
content: contentSection,
|
|
184107
|
-
...
|
|
184208
|
+
...defaultSections,
|
|
184108
184209
|
events: eventSection
|
|
184109
184210
|
},
|
|
184110
184211
|
customComponent: true
|
|
@@ -185039,7 +185140,7 @@ const SbIcon = registerSbComponent(
|
|
|
185039
185140
|
},
|
|
185040
185141
|
(props2) => {
|
|
185041
185142
|
const [isLoading, setIsLoading] = useState(false);
|
|
185042
|
-
const { icon, style: style2, color, size: size2, onClick } = props2;
|
|
185143
|
+
const { icon, style: style2, color, size: size2, loading: loading2, onClick } = props2;
|
|
185043
185144
|
const { style: passthroughStyle, ...passThroughProps } = usePassthroughProps(props2);
|
|
185044
185145
|
const inlineStyles = useMemo$2(() => {
|
|
185045
185146
|
const minWidthStyle = !icon ? {
|
|
@@ -185058,13 +185159,17 @@ const SbIcon = registerSbComponent(
|
|
|
185058
185159
|
const handleClick = useCallback(async () => {
|
|
185059
185160
|
if (onClick) {
|
|
185060
185161
|
try {
|
|
185061
|
-
|
|
185162
|
+
if (loading2 === void 0) {
|
|
185163
|
+
setIsLoading(true);
|
|
185164
|
+
}
|
|
185062
185165
|
await onClick();
|
|
185063
185166
|
} finally {
|
|
185064
|
-
|
|
185167
|
+
if (loading2 === void 0) {
|
|
185168
|
+
setIsLoading(false);
|
|
185169
|
+
}
|
|
185065
185170
|
}
|
|
185066
185171
|
}
|
|
185067
|
-
}, [onClick]);
|
|
185172
|
+
}, [onClick, loading2]);
|
|
185068
185173
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
185069
185174
|
StyledContainer,
|
|
185070
185175
|
{
|
|
@@ -185434,6 +185539,59 @@ const SbTimer = registerSbEntity(
|
|
|
185434
185539
|
};
|
|
185435
185540
|
}
|
|
185436
185541
|
);
|
|
185542
|
+
class SuspensibleAPI {
|
|
185543
|
+
constructor({
|
|
185544
|
+
runFn,
|
|
185545
|
+
cancelFn
|
|
185546
|
+
}) {
|
|
185547
|
+
__publicField(this, "_response");
|
|
185548
|
+
__publicField(this, "_error");
|
|
185549
|
+
__publicField(this, "_promise");
|
|
185550
|
+
__publicField(this, "_isLoading", false);
|
|
185551
|
+
__publicField(this, "_runFn");
|
|
185552
|
+
__publicField(this, "_cancelFn");
|
|
185553
|
+
this._runFn = runFn;
|
|
185554
|
+
this._cancelFn = cancelFn;
|
|
185555
|
+
makeAutoObservable(this);
|
|
185556
|
+
}
|
|
185557
|
+
/**
|
|
185558
|
+
* Context-aware response getter that either returns data or throws promises to trigger React Suspense.
|
|
185559
|
+
*/
|
|
185560
|
+
get response() {
|
|
185561
|
+
if (this._isLoading && this._promise) {
|
|
185562
|
+
throw this._promise;
|
|
185563
|
+
}
|
|
185564
|
+
return this._response;
|
|
185565
|
+
}
|
|
185566
|
+
get isLoading() {
|
|
185567
|
+
return this._isLoading;
|
|
185568
|
+
}
|
|
185569
|
+
get error() {
|
|
185570
|
+
return this._error;
|
|
185571
|
+
}
|
|
185572
|
+
async run(...args) {
|
|
185573
|
+
this._isLoading = true;
|
|
185574
|
+
this._error = void 0;
|
|
185575
|
+
this._promise = this._runFn(...args).then(
|
|
185576
|
+
action((data2) => {
|
|
185577
|
+
this._response = data2;
|
|
185578
|
+
this._isLoading = false;
|
|
185579
|
+
return data2;
|
|
185580
|
+
})
|
|
185581
|
+
).catch(
|
|
185582
|
+
action((error) => {
|
|
185583
|
+
this._error = error;
|
|
185584
|
+
this._isLoading = false;
|
|
185585
|
+
throw error;
|
|
185586
|
+
})
|
|
185587
|
+
);
|
|
185588
|
+
return this._promise;
|
|
185589
|
+
}
|
|
185590
|
+
async cancel(...args) {
|
|
185591
|
+
this._isLoading = false;
|
|
185592
|
+
await this._cancelFn(...args);
|
|
185593
|
+
}
|
|
185594
|
+
}
|
|
185437
185595
|
const propertiesDefinition = {
|
|
185438
185596
|
events: Section.category(PropsPanelCategory.EventHandlers).children({
|
|
185439
185597
|
onSuccess: Prop.event().propertiesPanel({ label: "onSuccess" }),
|
|
@@ -185445,37 +185603,58 @@ const propertiesDefinition = {
|
|
|
185445
185603
|
subHeader: "Configure frontend event handlers to run in response to the API"
|
|
185446
185604
|
}),
|
|
185447
185605
|
metadata: Section.category(PropsPanelCategory.Meta).children({
|
|
185448
|
-
response: Prop.any().
|
|
185449
|
-
|
|
185450
|
-
|
|
185606
|
+
response: Prop.any().computed(function() {
|
|
185607
|
+
return this._suspensibleApi.response;
|
|
185608
|
+
}).readable(),
|
|
185609
|
+
error: Prop.any().computed(function() {
|
|
185610
|
+
return this._suspensibleApi.error;
|
|
185611
|
+
}).readable(),
|
|
185612
|
+
isLoading: Prop.boolean().computed(function() {
|
|
185613
|
+
return this._suspensibleApi.isLoading;
|
|
185614
|
+
}).readable()
|
|
185451
185615
|
}),
|
|
185452
185616
|
functions: Section.category("Derived").children({
|
|
185453
185617
|
run: Prop.function(async function(_s2) {
|
|
185454
185618
|
var _a2, _b2;
|
|
185455
185619
|
const api2 = this;
|
|
185456
|
-
|
|
185457
|
-
|
|
185458
|
-
const result = await rootStore.apis.runApi(api2.name, api2.scopeId).catch(
|
|
185459
|
-
(err) => ({
|
|
185460
|
-
error: err,
|
|
185461
|
-
data: null
|
|
185462
|
-
})
|
|
185463
|
-
);
|
|
185464
|
-
api2.isRunning = false;
|
|
185465
|
-
if (!result.error) {
|
|
185466
|
-
api2.response = result.data;
|
|
185620
|
+
try {
|
|
185621
|
+
const result = await api2._suspensibleApi.run();
|
|
185467
185622
|
await ((_a2 = api2.onSuccess) == null ? void 0 : _a2.call(api2));
|
|
185468
|
-
return
|
|
185469
|
-
}
|
|
185470
|
-
api2.error = result.error;
|
|
185623
|
+
return result;
|
|
185624
|
+
} catch (error) {
|
|
185471
185625
|
await ((_b2 = api2.onError) == null ? void 0 : _b2.call(api2));
|
|
185472
|
-
|
|
185626
|
+
throw error;
|
|
185473
185627
|
}
|
|
185474
185628
|
}),
|
|
185475
185629
|
cancel: Prop.function(async function(_s2) {
|
|
185476
185630
|
const api2 = this;
|
|
185477
|
-
api2.
|
|
185478
|
-
|
|
185631
|
+
await api2._suspensibleApi.cancel();
|
|
185632
|
+
})
|
|
185633
|
+
}),
|
|
185634
|
+
internal: Section.category(PropsPanelCategory.Internal).children({
|
|
185635
|
+
/**
|
|
185636
|
+
* Internal SuspensibleAPI instance that manages loading states and React Suspense integration.
|
|
185637
|
+
* This property is hidden from the public interface but accessible to other properties.
|
|
185638
|
+
*/
|
|
185639
|
+
_suspensibleApi: Prop.internal(function() {
|
|
185640
|
+
const api2 = this;
|
|
185641
|
+
return new SuspensibleAPI({
|
|
185642
|
+
runFn: async () => {
|
|
185643
|
+
const result = await rootStore.apis.runApi(api2.name, api2.scopeId).catch(
|
|
185644
|
+
(err) => ({
|
|
185645
|
+
error: err,
|
|
185646
|
+
data: null
|
|
185647
|
+
})
|
|
185648
|
+
);
|
|
185649
|
+
if (result.error) {
|
|
185650
|
+
throw result.error;
|
|
185651
|
+
}
|
|
185652
|
+
return result.data;
|
|
185653
|
+
},
|
|
185654
|
+
cancelFn: async () => {
|
|
185655
|
+
rootStore.apis.cancelApi(api2.name, api2.scopeId);
|
|
185656
|
+
}
|
|
185657
|
+
});
|
|
185479
185658
|
})
|
|
185480
185659
|
})
|
|
185481
185660
|
};
|
|
@@ -199908,4 +200087,4 @@ export {
|
|
|
199908
200087
|
SbVariable as y,
|
|
199909
200088
|
SbTimer as z
|
|
199910
200089
|
};
|
|
199911
|
-
//# sourceMappingURL=index-
|
|
200090
|
+
//# sourceMappingURL=index-1LMlc1Q6.js.map
|