pollination-react-io 1.24.3 → 1.24.5
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/build/hooks/utilities.d.ts +1 -1
- package/build/index.esm.js +41 -23
- package/build/index.esm.js.map +1 -1
- package/build/index.js +41 -23
- package/build/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { PanelMessageIn } from './types';
|
|
2
2
|
export declare function checkDotNet(): boolean;
|
|
3
3
|
export declare function checkRuby(): boolean;
|
|
4
|
-
export declare function checkPollinationPanel(): boolean;
|
|
4
|
+
export declare function checkPollinationPanel(silent?: boolean): boolean;
|
|
5
5
|
export declare function sendMessageDotNet(message: PanelMessageIn): PanelMessageIn;
|
|
6
6
|
export declare function sendMessageRuby(message?: PanelMessageIn): any;
|
|
7
7
|
export declare function getHost(key?: string, defaultValue?: 'web' | 'rhino' | 'revit' | 'sketchup'): 'web' | 'rhino' | 'revit' | 'sketchup';
|
package/build/index.esm.js
CHANGED
|
@@ -37781,44 +37781,54 @@ function checkRuby() {
|
|
|
37781
37781
|
checkPollinationPanel();
|
|
37782
37782
|
return true;
|
|
37783
37783
|
}
|
|
37784
|
-
function
|
|
37784
|
+
function conditional_throw(message, silent) {
|
|
37785
|
+
if (silent === void 0) { silent = true; }
|
|
37786
|
+
if (silent) {
|
|
37787
|
+
return false;
|
|
37788
|
+
}
|
|
37789
|
+
else {
|
|
37790
|
+
throw new Error(message);
|
|
37791
|
+
}
|
|
37792
|
+
}
|
|
37793
|
+
function checkPollinationPanel(silent) {
|
|
37794
|
+
if (silent === void 0) { silent = true; }
|
|
37785
37795
|
try {
|
|
37786
37796
|
if (typeof window.parent.chrome === 'undefined') {
|
|
37787
|
-
|
|
37797
|
+
return conditional_throw('[POLLINATION-DEBUG]: chrome not found.', silent);
|
|
37788
37798
|
}
|
|
37789
37799
|
}
|
|
37790
37800
|
catch (_a) {
|
|
37791
|
-
|
|
37801
|
+
return conditional_throw('[POLLINATION-DEBUG]: chrome not found.', silent);
|
|
37792
37802
|
}
|
|
37793
37803
|
try {
|
|
37794
37804
|
if (typeof window.parent.chrome.webview === 'undefined') {
|
|
37795
|
-
|
|
37805
|
+
return conditional_throw('[POLLINATION-DEBUG]: webview not found.', silent);
|
|
37796
37806
|
}
|
|
37797
37807
|
}
|
|
37798
37808
|
catch (_b) {
|
|
37799
|
-
|
|
37809
|
+
return conditional_throw('[POLLINATION-DEBUG]: webview not found.', silent);
|
|
37800
37810
|
}
|
|
37801
37811
|
try {
|
|
37802
37812
|
if (typeof window.parent.chrome.webview.hostObjects === 'undefined') {
|
|
37803
|
-
|
|
37813
|
+
return conditional_throw('[POLLINATION-DEBUG]: webview not found.', silent);
|
|
37804
37814
|
}
|
|
37805
37815
|
}
|
|
37806
37816
|
catch (_c) {
|
|
37807
|
-
|
|
37817
|
+
return conditional_throw('[POLLINATION-DEBUG]: webview not found.', silent);
|
|
37808
37818
|
}
|
|
37809
37819
|
try {
|
|
37810
37820
|
if (typeof window.parent.chrome.webview.hostObjects.sync === 'undefined') {
|
|
37811
|
-
|
|
37821
|
+
return conditional_throw('[POLLINATION-DEBUG]: webview not found.', silent);
|
|
37812
37822
|
}
|
|
37813
37823
|
}
|
|
37814
37824
|
catch (_d) {
|
|
37815
|
-
|
|
37825
|
+
return conditional_throw('[POLLINATION-DEBUG]: webview not found.', silent);
|
|
37816
37826
|
}
|
|
37817
37827
|
return true;
|
|
37818
37828
|
}
|
|
37819
37829
|
function sendMessageDotNet(message) {
|
|
37820
37830
|
if (!checkPollinationPanel())
|
|
37821
|
-
;
|
|
37831
|
+
return undefined;
|
|
37822
37832
|
// const json = JSON.stringify(message)
|
|
37823
37833
|
var json = message;
|
|
37824
37834
|
if (typeof message.data !== 'string') {
|
|
@@ -37834,7 +37844,7 @@ function sendMessageDotNet(message) {
|
|
|
37834
37844
|
}
|
|
37835
37845
|
function sendMessageRuby(message) {
|
|
37836
37846
|
if (!checkPollinationPanel())
|
|
37837
|
-
;
|
|
37847
|
+
return undefined;
|
|
37838
37848
|
throw new Error('[POLLINATION-DEBUG]: sendMesssageRuby not yet implemented');
|
|
37839
37849
|
}
|
|
37840
37850
|
// not sure if this will work from Streamlit?
|
|
@@ -38002,6 +38012,9 @@ var useCreateStudy = function (accountName, projectName, client) {
|
|
|
38002
38012
|
// then save it to the users machine and provide
|
|
38003
38013
|
// the name to the jobInfo object
|
|
38004
38014
|
if (typeof value.key === 'string') {
|
|
38015
|
+
if (value.name == null) {
|
|
38016
|
+
reject("'name' attribute of ".concat(value.key, " is null. Job will be invalid."));
|
|
38017
|
+
}
|
|
38005
38018
|
downloadArtifact(value.key)
|
|
38006
38019
|
.then(function (url) {
|
|
38007
38020
|
fetch(url)
|
|
@@ -38108,8 +38121,7 @@ var useCreateStudy = function (accountName, projectName, client) {
|
|
|
38108
38121
|
arguments: [jobArguments]
|
|
38109
38122
|
});
|
|
38110
38123
|
}).catch(function (err) {
|
|
38111
|
-
|
|
38112
|
-
console.error(data.detail);
|
|
38124
|
+
console.error(err);
|
|
38113
38125
|
})];
|
|
38114
38126
|
case 1:
|
|
38115
38127
|
job = _c.sent();
|
|
@@ -46239,7 +46251,7 @@ var SendGeometry = function (_a) {
|
|
|
46239
46251
|
var _d = useState(defaultKey !== null && defaultKey !== void 0 ? defaultKey : performance.now().toString()), key = _d[0], setKey = _d[1];
|
|
46240
46252
|
var sendMessage = useSendMessage().sendMessage;
|
|
46241
46253
|
var disabled = useMemo(function () {
|
|
46242
|
-
return checkPollinationPanel();
|
|
46254
|
+
return !checkPollinationPanel();
|
|
46243
46255
|
}, []);
|
|
46244
46256
|
useEffect(function () {
|
|
46245
46257
|
setSelOpt(defaultAction);
|
|
@@ -46365,6 +46377,9 @@ var SendModel = function (_a) {
|
|
|
46365
46377
|
var _c = useState(defaultAction !== null && defaultAction !== void 0 ? defaultAction : Action$1.preview), selOpt = _c[0], setSelOpt = _c[1];
|
|
46366
46378
|
var _d = useState(defaultKey !== null && defaultKey !== void 0 ? defaultKey : performance.now().toString()), key = _d[0], setKey = _d[1];
|
|
46367
46379
|
var sendHbjson = useSendHbjson().sendHbjson;
|
|
46380
|
+
var disabled = useMemo(function () {
|
|
46381
|
+
return !checkPollinationPanel();
|
|
46382
|
+
}, []);
|
|
46368
46383
|
useEffect(function () {
|
|
46369
46384
|
setSelOpt(defaultAction);
|
|
46370
46385
|
}, [defaultAction]);
|
|
@@ -46372,7 +46387,7 @@ var SendModel = function (_a) {
|
|
|
46372
46387
|
setKey(defaultKey);
|
|
46373
46388
|
}, [defaultKey]);
|
|
46374
46389
|
useEffect(function () {
|
|
46375
|
-
if (
|
|
46390
|
+
if (disabled || selOpt !== Action$1.subscribePreview)
|
|
46376
46391
|
return;
|
|
46377
46392
|
sendHbjson('SubscribePreviewHBJSON', {
|
|
46378
46393
|
data: hbjson,
|
|
@@ -46392,9 +46407,9 @@ var SendModel = function (_a) {
|
|
|
46392
46407
|
},
|
|
46393
46408
|
});
|
|
46394
46409
|
};
|
|
46395
|
-
}, [
|
|
46396
|
-
return (React__default.createElement(SettingsButton, { disabled:
|
|
46397
|
-
if (
|
|
46410
|
+
}, [disabled, hbjson, key, selOpt, sendHbjson]);
|
|
46411
|
+
return (React__default.createElement(SettingsButton, { disabled: disabled, onClick: function () {
|
|
46412
|
+
if (disabled)
|
|
46398
46413
|
return;
|
|
46399
46414
|
sendHbjson(getAction$1(selOpt), {
|
|
46400
46415
|
data: hbjson,
|
|
@@ -46415,7 +46430,7 @@ var SendModel = function (_a) {
|
|
|
46415
46430
|
label: 'Preview',
|
|
46416
46431
|
checked: selOpt === Action$1.preview,
|
|
46417
46432
|
icon: React__default.createElement(Eyeglasses$1, { size: 16 }),
|
|
46418
|
-
disabled:
|
|
46433
|
+
disabled: disabled,
|
|
46419
46434
|
onSelect: function () {
|
|
46420
46435
|
setSelOpt(function (state) { return (state === Action$1.preview ? undefined : Action$1.preview); });
|
|
46421
46436
|
},
|
|
@@ -46426,7 +46441,7 @@ var SendModel = function (_a) {
|
|
|
46426
46441
|
label: 'Add',
|
|
46427
46442
|
checked: selOpt === Action$1.add,
|
|
46428
46443
|
icon: React__default.createElement(Building$1, { size: 16 }),
|
|
46429
|
-
disabled:
|
|
46444
|
+
disabled: disabled,
|
|
46430
46445
|
onSelect: function () {
|
|
46431
46446
|
setSelOpt(function (state) { return (state === Action$1.add ? undefined : Action$1.add); });
|
|
46432
46447
|
},
|
|
@@ -46437,7 +46452,7 @@ var SendModel = function (_a) {
|
|
|
46437
46452
|
label: 'Clear',
|
|
46438
46453
|
checked: selOpt === Action$1.clear,
|
|
46439
46454
|
icon: React__default.createElement(Recycle$1, { size: 16 }),
|
|
46440
|
-
disabled:
|
|
46455
|
+
disabled: disabled,
|
|
46441
46456
|
onSelect: function () {
|
|
46442
46457
|
setSelOpt(function (state) { return (state === Action$1.clear ? undefined : Action$1.clear); });
|
|
46443
46458
|
},
|
|
@@ -46448,7 +46463,7 @@ var SendModel = function (_a) {
|
|
|
46448
46463
|
label: 'Subscribe Preview',
|
|
46449
46464
|
checked: selOpt === Action$1.subscribePreview,
|
|
46450
46465
|
icon: React__default.createElement(ArrowRepeat$1, { size: 16 }),
|
|
46451
|
-
disabled:
|
|
46466
|
+
disabled: disabled,
|
|
46452
46467
|
onSelect: function () {
|
|
46453
46468
|
setSelOpt(function (state) { return (state === Action$1.subscribePreview ? undefined : Action$1.subscribePreview); });
|
|
46454
46469
|
},
|
|
@@ -46490,8 +46505,11 @@ var SendResults = function (_a) {
|
|
|
46490
46505
|
var _d = useState(defaultKey !== null && defaultKey !== void 0 ? defaultKey : performance.now().toString()), key = _d[0], setKey = _d[1];
|
|
46491
46506
|
var sendMessage = useSendMessage().sendMessage;
|
|
46492
46507
|
var disabled = useMemo(function () {
|
|
46493
|
-
return checkPollinationPanel();
|
|
46508
|
+
return !checkPollinationPanel();
|
|
46494
46509
|
}, []);
|
|
46510
|
+
useEffect(function () {
|
|
46511
|
+
console.log(disabled);
|
|
46512
|
+
}, [disabled]);
|
|
46495
46513
|
useEffect(function () {
|
|
46496
46514
|
setSelOpt(defaultAction);
|
|
46497
46515
|
}, [defaultAction]);
|