pollination-react-io 1.24.3 → 1.24.4
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 +37 -21
- package/build/index.esm.js.map +1 -1
- package/build/index.js +37 -21
- 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?
|
|
@@ -46239,7 +46249,7 @@ var SendGeometry = function (_a) {
|
|
|
46239
46249
|
var _d = useState(defaultKey !== null && defaultKey !== void 0 ? defaultKey : performance.now().toString()), key = _d[0], setKey = _d[1];
|
|
46240
46250
|
var sendMessage = useSendMessage().sendMessage;
|
|
46241
46251
|
var disabled = useMemo(function () {
|
|
46242
|
-
return checkPollinationPanel();
|
|
46252
|
+
return !checkPollinationPanel();
|
|
46243
46253
|
}, []);
|
|
46244
46254
|
useEffect(function () {
|
|
46245
46255
|
setSelOpt(defaultAction);
|
|
@@ -46365,6 +46375,9 @@ var SendModel = function (_a) {
|
|
|
46365
46375
|
var _c = useState(defaultAction !== null && defaultAction !== void 0 ? defaultAction : Action$1.preview), selOpt = _c[0], setSelOpt = _c[1];
|
|
46366
46376
|
var _d = useState(defaultKey !== null && defaultKey !== void 0 ? defaultKey : performance.now().toString()), key = _d[0], setKey = _d[1];
|
|
46367
46377
|
var sendHbjson = useSendHbjson().sendHbjson;
|
|
46378
|
+
var disabled = useMemo(function () {
|
|
46379
|
+
return !checkPollinationPanel();
|
|
46380
|
+
}, []);
|
|
46368
46381
|
useEffect(function () {
|
|
46369
46382
|
setSelOpt(defaultAction);
|
|
46370
46383
|
}, [defaultAction]);
|
|
@@ -46372,7 +46385,7 @@ var SendModel = function (_a) {
|
|
|
46372
46385
|
setKey(defaultKey);
|
|
46373
46386
|
}, [defaultKey]);
|
|
46374
46387
|
useEffect(function () {
|
|
46375
|
-
if (
|
|
46388
|
+
if (disabled || selOpt !== Action$1.subscribePreview)
|
|
46376
46389
|
return;
|
|
46377
46390
|
sendHbjson('SubscribePreviewHBJSON', {
|
|
46378
46391
|
data: hbjson,
|
|
@@ -46392,9 +46405,9 @@ var SendModel = function (_a) {
|
|
|
46392
46405
|
},
|
|
46393
46406
|
});
|
|
46394
46407
|
};
|
|
46395
|
-
}, [
|
|
46396
|
-
return (React__default.createElement(SettingsButton, { disabled:
|
|
46397
|
-
if (
|
|
46408
|
+
}, [disabled, hbjson, key, selOpt, sendHbjson]);
|
|
46409
|
+
return (React__default.createElement(SettingsButton, { disabled: disabled, onClick: function () {
|
|
46410
|
+
if (disabled)
|
|
46398
46411
|
return;
|
|
46399
46412
|
sendHbjson(getAction$1(selOpt), {
|
|
46400
46413
|
data: hbjson,
|
|
@@ -46415,7 +46428,7 @@ var SendModel = function (_a) {
|
|
|
46415
46428
|
label: 'Preview',
|
|
46416
46429
|
checked: selOpt === Action$1.preview,
|
|
46417
46430
|
icon: React__default.createElement(Eyeglasses$1, { size: 16 }),
|
|
46418
|
-
disabled:
|
|
46431
|
+
disabled: disabled,
|
|
46419
46432
|
onSelect: function () {
|
|
46420
46433
|
setSelOpt(function (state) { return (state === Action$1.preview ? undefined : Action$1.preview); });
|
|
46421
46434
|
},
|
|
@@ -46426,7 +46439,7 @@ var SendModel = function (_a) {
|
|
|
46426
46439
|
label: 'Add',
|
|
46427
46440
|
checked: selOpt === Action$1.add,
|
|
46428
46441
|
icon: React__default.createElement(Building$1, { size: 16 }),
|
|
46429
|
-
disabled:
|
|
46442
|
+
disabled: disabled,
|
|
46430
46443
|
onSelect: function () {
|
|
46431
46444
|
setSelOpt(function (state) { return (state === Action$1.add ? undefined : Action$1.add); });
|
|
46432
46445
|
},
|
|
@@ -46437,7 +46450,7 @@ var SendModel = function (_a) {
|
|
|
46437
46450
|
label: 'Clear',
|
|
46438
46451
|
checked: selOpt === Action$1.clear,
|
|
46439
46452
|
icon: React__default.createElement(Recycle$1, { size: 16 }),
|
|
46440
|
-
disabled:
|
|
46453
|
+
disabled: disabled,
|
|
46441
46454
|
onSelect: function () {
|
|
46442
46455
|
setSelOpt(function (state) { return (state === Action$1.clear ? undefined : Action$1.clear); });
|
|
46443
46456
|
},
|
|
@@ -46448,7 +46461,7 @@ var SendModel = function (_a) {
|
|
|
46448
46461
|
label: 'Subscribe Preview',
|
|
46449
46462
|
checked: selOpt === Action$1.subscribePreview,
|
|
46450
46463
|
icon: React__default.createElement(ArrowRepeat$1, { size: 16 }),
|
|
46451
|
-
disabled:
|
|
46464
|
+
disabled: disabled,
|
|
46452
46465
|
onSelect: function () {
|
|
46453
46466
|
setSelOpt(function (state) { return (state === Action$1.subscribePreview ? undefined : Action$1.subscribePreview); });
|
|
46454
46467
|
},
|
|
@@ -46490,8 +46503,11 @@ var SendResults = function (_a) {
|
|
|
46490
46503
|
var _d = useState(defaultKey !== null && defaultKey !== void 0 ? defaultKey : performance.now().toString()), key = _d[0], setKey = _d[1];
|
|
46491
46504
|
var sendMessage = useSendMessage().sendMessage;
|
|
46492
46505
|
var disabled = useMemo(function () {
|
|
46493
|
-
return checkPollinationPanel();
|
|
46506
|
+
return !checkPollinationPanel();
|
|
46494
46507
|
}, []);
|
|
46508
|
+
useEffect(function () {
|
|
46509
|
+
console.log(disabled);
|
|
46510
|
+
}, [disabled]);
|
|
46495
46511
|
useEffect(function () {
|
|
46496
46512
|
setSelOpt(defaultAction);
|
|
46497
46513
|
}, [defaultAction]);
|