pollination-react-io 1.24.2 → 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 +59 -37
- package/build/index.esm.js.map +1 -1
- package/build/index.js +59 -37
- 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?
|
|
@@ -46238,6 +46248,9 @@ var SendGeometry = function (_a) {
|
|
|
46238
46248
|
var _c = useState(defaultAction !== null && defaultAction !== void 0 ? defaultAction : Action$2.preview), selOpt = _c[0], setSelOpt = _c[1];
|
|
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;
|
|
46251
|
+
var disabled = useMemo(function () {
|
|
46252
|
+
return !checkPollinationPanel();
|
|
46253
|
+
}, []);
|
|
46241
46254
|
useEffect(function () {
|
|
46242
46255
|
setSelOpt(defaultAction);
|
|
46243
46256
|
}, [defaultAction]);
|
|
@@ -46245,7 +46258,7 @@ var SendGeometry = function (_a) {
|
|
|
46245
46258
|
setKey(defaultKey);
|
|
46246
46259
|
}, [defaultKey]);
|
|
46247
46260
|
useEffect(function () {
|
|
46248
|
-
if (
|
|
46261
|
+
if (disabled || selOpt !== 'subscribe-preview')
|
|
46249
46262
|
return;
|
|
46250
46263
|
sendMessage('SubscribePreviewGeometry', {
|
|
46251
46264
|
data: geometry,
|
|
@@ -46259,9 +46272,9 @@ var SendGeometry = function (_a) {
|
|
|
46259
46272
|
options: geometryOptions
|
|
46260
46273
|
});
|
|
46261
46274
|
};
|
|
46262
|
-
}, [
|
|
46263
|
-
return (React__default.createElement(SettingsButton, { disabled:
|
|
46264
|
-
if (
|
|
46275
|
+
}, [disabled, geometry, geometryOptions, key, selOpt, sendMessage]);
|
|
46276
|
+
return (React__default.createElement(SettingsButton, { disabled: disabled, onClick: function () {
|
|
46277
|
+
if (disabled)
|
|
46265
46278
|
return;
|
|
46266
46279
|
sendMessage(getAction$2(selOpt), {
|
|
46267
46280
|
data: geometry,
|
|
@@ -46279,7 +46292,7 @@ var SendGeometry = function (_a) {
|
|
|
46279
46292
|
label: 'Preview',
|
|
46280
46293
|
checked: selOpt === Action$2.preview,
|
|
46281
46294
|
icon: React__default.createElement(Eyeglasses$1, { size: 16 }),
|
|
46282
|
-
disabled:
|
|
46295
|
+
disabled: disabled,
|
|
46283
46296
|
onSelect: function () {
|
|
46284
46297
|
setSelOpt(function (state) { return (state === Action$2.preview ? undefined : Action$2.preview); });
|
|
46285
46298
|
},
|
|
@@ -46290,7 +46303,7 @@ var SendGeometry = function (_a) {
|
|
|
46290
46303
|
label: 'Add',
|
|
46291
46304
|
checked: selOpt === Action$2.add,
|
|
46292
46305
|
icon: React__default.createElement(Building$1, { size: 16 }),
|
|
46293
|
-
disabled:
|
|
46306
|
+
disabled: disabled,
|
|
46294
46307
|
onSelect: function () {
|
|
46295
46308
|
setSelOpt(function (state) { return (state === Action$2.add ? undefined : Action$2.add); });
|
|
46296
46309
|
},
|
|
@@ -46301,7 +46314,7 @@ var SendGeometry = function (_a) {
|
|
|
46301
46314
|
label: 'Delete',
|
|
46302
46315
|
checked: selOpt === Action$2.delete,
|
|
46303
46316
|
icon: React__default.createElement(Trash$1, { size: 16 }),
|
|
46304
|
-
disabled:
|
|
46317
|
+
disabled: disabled,
|
|
46305
46318
|
onSelect: function () {
|
|
46306
46319
|
setSelOpt(function (state) { return (state === Action$2.delete ? undefined : Action$2.delete); });
|
|
46307
46320
|
},
|
|
@@ -46312,7 +46325,7 @@ var SendGeometry = function (_a) {
|
|
|
46312
46325
|
label: 'Clear',
|
|
46313
46326
|
checked: selOpt === Action$2.clear,
|
|
46314
46327
|
icon: React__default.createElement(Recycle$1, { size: 16 }),
|
|
46315
|
-
disabled:
|
|
46328
|
+
disabled: disabled,
|
|
46316
46329
|
onSelect: function () {
|
|
46317
46330
|
setSelOpt(function (state) { return (state === Action$2.clear ? undefined : Action$2.clear); });
|
|
46318
46331
|
},
|
|
@@ -46323,7 +46336,7 @@ var SendGeometry = function (_a) {
|
|
|
46323
46336
|
label: 'Subscribe Preview',
|
|
46324
46337
|
checked: selOpt === Action$2.subscribePreview,
|
|
46325
46338
|
icon: React__default.createElement(ArrowRepeat$1, { size: 16 }),
|
|
46326
|
-
disabled:
|
|
46339
|
+
disabled: disabled,
|
|
46327
46340
|
onSelect: function () {
|
|
46328
46341
|
setSelOpt(function (state) { return (state === Action$2.subscribePreview ? undefined : Action$2.subscribePreview); });
|
|
46329
46342
|
},
|
|
@@ -46362,6 +46375,9 @@ var SendModel = function (_a) {
|
|
|
46362
46375
|
var _c = useState(defaultAction !== null && defaultAction !== void 0 ? defaultAction : Action$1.preview), selOpt = _c[0], setSelOpt = _c[1];
|
|
46363
46376
|
var _d = useState(defaultKey !== null && defaultKey !== void 0 ? defaultKey : performance.now().toString()), key = _d[0], setKey = _d[1];
|
|
46364
46377
|
var sendHbjson = useSendHbjson().sendHbjson;
|
|
46378
|
+
var disabled = useMemo(function () {
|
|
46379
|
+
return !checkPollinationPanel();
|
|
46380
|
+
}, []);
|
|
46365
46381
|
useEffect(function () {
|
|
46366
46382
|
setSelOpt(defaultAction);
|
|
46367
46383
|
}, [defaultAction]);
|
|
@@ -46369,7 +46385,7 @@ var SendModel = function (_a) {
|
|
|
46369
46385
|
setKey(defaultKey);
|
|
46370
46386
|
}, [defaultKey]);
|
|
46371
46387
|
useEffect(function () {
|
|
46372
|
-
if (
|
|
46388
|
+
if (disabled || selOpt !== Action$1.subscribePreview)
|
|
46373
46389
|
return;
|
|
46374
46390
|
sendHbjson('SubscribePreviewHBJSON', {
|
|
46375
46391
|
data: hbjson,
|
|
@@ -46389,9 +46405,9 @@ var SendModel = function (_a) {
|
|
|
46389
46405
|
},
|
|
46390
46406
|
});
|
|
46391
46407
|
};
|
|
46392
|
-
}, [
|
|
46393
|
-
return (React__default.createElement(SettingsButton, { disabled:
|
|
46394
|
-
if (
|
|
46408
|
+
}, [disabled, hbjson, key, selOpt, sendHbjson]);
|
|
46409
|
+
return (React__default.createElement(SettingsButton, { disabled: disabled, onClick: function () {
|
|
46410
|
+
if (disabled)
|
|
46395
46411
|
return;
|
|
46396
46412
|
sendHbjson(getAction$1(selOpt), {
|
|
46397
46413
|
data: hbjson,
|
|
@@ -46412,7 +46428,7 @@ var SendModel = function (_a) {
|
|
|
46412
46428
|
label: 'Preview',
|
|
46413
46429
|
checked: selOpt === Action$1.preview,
|
|
46414
46430
|
icon: React__default.createElement(Eyeglasses$1, { size: 16 }),
|
|
46415
|
-
disabled:
|
|
46431
|
+
disabled: disabled,
|
|
46416
46432
|
onSelect: function () {
|
|
46417
46433
|
setSelOpt(function (state) { return (state === Action$1.preview ? undefined : Action$1.preview); });
|
|
46418
46434
|
},
|
|
@@ -46423,7 +46439,7 @@ var SendModel = function (_a) {
|
|
|
46423
46439
|
label: 'Add',
|
|
46424
46440
|
checked: selOpt === Action$1.add,
|
|
46425
46441
|
icon: React__default.createElement(Building$1, { size: 16 }),
|
|
46426
|
-
disabled:
|
|
46442
|
+
disabled: disabled,
|
|
46427
46443
|
onSelect: function () {
|
|
46428
46444
|
setSelOpt(function (state) { return (state === Action$1.add ? undefined : Action$1.add); });
|
|
46429
46445
|
},
|
|
@@ -46434,7 +46450,7 @@ var SendModel = function (_a) {
|
|
|
46434
46450
|
label: 'Clear',
|
|
46435
46451
|
checked: selOpt === Action$1.clear,
|
|
46436
46452
|
icon: React__default.createElement(Recycle$1, { size: 16 }),
|
|
46437
|
-
disabled:
|
|
46453
|
+
disabled: disabled,
|
|
46438
46454
|
onSelect: function () {
|
|
46439
46455
|
setSelOpt(function (state) { return (state === Action$1.clear ? undefined : Action$1.clear); });
|
|
46440
46456
|
},
|
|
@@ -46445,7 +46461,7 @@ var SendModel = function (_a) {
|
|
|
46445
46461
|
label: 'Subscribe Preview',
|
|
46446
46462
|
checked: selOpt === Action$1.subscribePreview,
|
|
46447
46463
|
icon: React__default.createElement(ArrowRepeat$1, { size: 16 }),
|
|
46448
|
-
disabled:
|
|
46464
|
+
disabled: disabled,
|
|
46449
46465
|
onSelect: function () {
|
|
46450
46466
|
setSelOpt(function (state) { return (state === Action$1.subscribePreview ? undefined : Action$1.subscribePreview); });
|
|
46451
46467
|
},
|
|
@@ -46486,6 +46502,12 @@ var SendResults = function (_a) {
|
|
|
46486
46502
|
var _c = useState(defaultAction !== null && defaultAction !== void 0 ? defaultAction : Action.preview), selOpt = _c[0], setSelOpt = _c[1];
|
|
46487
46503
|
var _d = useState(defaultKey !== null && defaultKey !== void 0 ? defaultKey : performance.now().toString()), key = _d[0], setKey = _d[1];
|
|
46488
46504
|
var sendMessage = useSendMessage().sendMessage;
|
|
46505
|
+
var disabled = useMemo(function () {
|
|
46506
|
+
return !checkPollinationPanel();
|
|
46507
|
+
}, []);
|
|
46508
|
+
useEffect(function () {
|
|
46509
|
+
console.log(disabled);
|
|
46510
|
+
}, [disabled]);
|
|
46489
46511
|
useEffect(function () {
|
|
46490
46512
|
setSelOpt(defaultAction);
|
|
46491
46513
|
}, [defaultAction]);
|
|
@@ -46493,7 +46515,7 @@ var SendResults = function (_a) {
|
|
|
46493
46515
|
setKey(defaultKey);
|
|
46494
46516
|
}, [defaultKey]);
|
|
46495
46517
|
useEffect(function () {
|
|
46496
|
-
if (
|
|
46518
|
+
if (disabled || selOpt !== Action.subscribePreview)
|
|
46497
46519
|
return;
|
|
46498
46520
|
sendMessage('SubscribePreviewResults', {
|
|
46499
46521
|
data: results,
|
|
@@ -46507,9 +46529,9 @@ var SendResults = function (_a) {
|
|
|
46507
46529
|
options: geometryOptions,
|
|
46508
46530
|
});
|
|
46509
46531
|
};
|
|
46510
|
-
}, [geometryOptions, key, results, selOpt, sendMessage]);
|
|
46511
|
-
return (React__default.createElement(SettingsButton, { disabled:
|
|
46512
|
-
if (
|
|
46532
|
+
}, [disabled, geometryOptions, key, results, selOpt, sendMessage]);
|
|
46533
|
+
return (React__default.createElement(SettingsButton, { disabled: disabled, onClick: function () {
|
|
46534
|
+
if (disabled)
|
|
46513
46535
|
return;
|
|
46514
46536
|
sendMessage(getAction(selOpt), {
|
|
46515
46537
|
data: results,
|
|
@@ -46527,7 +46549,7 @@ var SendResults = function (_a) {
|
|
|
46527
46549
|
label: 'Preview',
|
|
46528
46550
|
checked: selOpt === Action.preview,
|
|
46529
46551
|
icon: React__default.createElement(Eyeglasses$1, { size: 16 }),
|
|
46530
|
-
disabled:
|
|
46552
|
+
disabled: disabled,
|
|
46531
46553
|
onSelect: function () {
|
|
46532
46554
|
setSelOpt(function (state) { return (state === Action.preview ? undefined : Action.preview); });
|
|
46533
46555
|
},
|
|
@@ -46538,7 +46560,7 @@ var SendResults = function (_a) {
|
|
|
46538
46560
|
label: 'Add',
|
|
46539
46561
|
checked: selOpt === Action.add,
|
|
46540
46562
|
icon: React__default.createElement(Building$1, { size: 16 }),
|
|
46541
|
-
disabled:
|
|
46563
|
+
disabled: disabled,
|
|
46542
46564
|
onSelect: function () {
|
|
46543
46565
|
setSelOpt(function (state) { return (state === Action.add ? undefined : Action.add); });
|
|
46544
46566
|
},
|
|
@@ -46549,7 +46571,7 @@ var SendResults = function (_a) {
|
|
|
46549
46571
|
label: 'Delete',
|
|
46550
46572
|
checked: selOpt === Action.delete,
|
|
46551
46573
|
icon: React__default.createElement(Trash$1, { size: 16 }),
|
|
46552
|
-
disabled:
|
|
46574
|
+
disabled: disabled,
|
|
46553
46575
|
onSelect: function () {
|
|
46554
46576
|
setSelOpt(function (state) { return (state === Action.delete ? undefined : Action.delete); });
|
|
46555
46577
|
},
|
|
@@ -46560,7 +46582,7 @@ var SendResults = function (_a) {
|
|
|
46560
46582
|
label: 'Clear',
|
|
46561
46583
|
checked: selOpt === Action.clear,
|
|
46562
46584
|
icon: React__default.createElement(Recycle$1, { size: 16 }),
|
|
46563
|
-
disabled:
|
|
46585
|
+
disabled: disabled,
|
|
46564
46586
|
onSelect: function () {
|
|
46565
46587
|
setSelOpt(function (state) { return (state === Action.clear ? undefined : Action.clear); });
|
|
46566
46588
|
},
|
|
@@ -46571,7 +46593,7 @@ var SendResults = function (_a) {
|
|
|
46571
46593
|
label: 'Subscribe Preview',
|
|
46572
46594
|
checked: selOpt === Action.subscribePreview,
|
|
46573
46595
|
icon: React__default.createElement(ArrowRepeat$1, { size: 16 }),
|
|
46574
|
-
disabled:
|
|
46596
|
+
disabled: disabled,
|
|
46575
46597
|
onSelect: function () {
|
|
46576
46598
|
setSelOpt(function (state) { return (state === Action.subscribePreview ? undefined : Action.subscribePreview); });
|
|
46577
46599
|
},
|