@carbonorm/carbonreact 4.0.2 → 4.0.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/dist/CarbonReact.d.ts +7 -7
- package/dist/components/Alert/Alert.d.ts +6 -6
- package/dist/components/Errors/BackendThrowable.d.ts +3 -3
- package/dist/components/WebSocket/CarbonWebSocket.d.ts +5 -5
- package/dist/hoc/deleteRestfulObjectArrays.d.ts +2 -6
- package/dist/hoc/updateRestfulObjectArrays.d.ts +3 -7
- package/dist/index.cjs.js +11 -6
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +11 -6
- package/dist/index.esm.js.map +1 -1
- package/dist/variables/C6.d.ts +842 -0
- package/package.json +1 -1
- package/src/CarbonReact.tsx +20 -12
- package/src/components/Alert/Alert.tsx +8 -10
- package/src/components/Errors/BackendThrowable.tsx +3 -3
- package/src/components/WebSocket/CarbonWebSocket.tsx +6 -6
- package/src/hoc/deleteRestfulObjectArrays.tsx +2 -2
- package/src/hoc/updateRestfulObjectArrays.tsx +3 -3
- package/src/variables/C6.tsx +1 -0
package/dist/index.esm.js
CHANGED
|
@@ -4359,11 +4359,16 @@ function isJsonString(str) {
|
|
|
4359
4359
|
}
|
|
4360
4360
|
class CarbonReact extends Component {
|
|
4361
4361
|
static persistentStateMap = new Map();
|
|
4362
|
+
// Context is for functional components to access the state of this class efficiently
|
|
4362
4363
|
context = createContext(this.state);
|
|
4363
|
-
// Private static member
|
|
4364
|
-
// we actually implement this in the constructor todo - test this
|
|
4365
|
-
static instance;
|
|
4366
4364
|
target;
|
|
4365
|
+
static _instance;
|
|
4366
|
+
static get instance() {
|
|
4367
|
+
return this;
|
|
4368
|
+
}
|
|
4369
|
+
static set instance(instance) {
|
|
4370
|
+
this._instance = instance;
|
|
4371
|
+
}
|
|
4367
4372
|
updateRestfulObjectArrays = (rest) => updateRestfulObjectArrays({
|
|
4368
4373
|
instance: this,
|
|
4369
4374
|
...rest
|
|
@@ -4383,7 +4388,7 @@ class CarbonReact extends Component {
|
|
|
4383
4388
|
// this is the magic that allows each class that's extends this to have a static instance - a singleton pattern
|
|
4384
4389
|
// new.target is a meta-property introduced in ES6 that references the constructor that was directly invoked with the new keyword.
|
|
4385
4390
|
Object.assign(new.target, {
|
|
4386
|
-
|
|
4391
|
+
_instance: this
|
|
4387
4392
|
});
|
|
4388
4393
|
if (this.props.instanceId && CarbonReact.persistentStateMap.has(this.props.instanceId)) {
|
|
4389
4394
|
this.state = CarbonReact.persistentStateMap.get(this.props.instanceId);
|
|
@@ -4427,11 +4432,11 @@ class CarbonReact extends Component {
|
|
|
4427
4432
|
console.log('%c color (' + colorHex + ')', 'color: ' + colorHex);
|
|
4428
4433
|
const nest = jsxRuntime_1(Nest, { position: 'fixed', backgroundColor: '', color: hexToRgb(colorHex), count: 100 });
|
|
4429
4434
|
if (this.state.backendThrowable.length > 0) {
|
|
4430
|
-
return jsxRuntime_2(jsxRuntime_3, { children: [nest, jsxRuntime_1(BackendThrowable, { instance:
|
|
4435
|
+
return jsxRuntime_2(jsxRuntime_3, { children: [nest, jsxRuntime_1(BackendThrowable, { instance: this })] });
|
|
4431
4436
|
}
|
|
4432
4437
|
const Context = this.context.Provider;
|
|
4433
4438
|
return jsxRuntime_2(jsxRuntime_3, { children: [jsxRuntime_1(GlobalHistory, {}), this.props.websocket &&
|
|
4434
|
-
jsxRuntime_1(CarbonWebSocket, { ...(
|
|
4439
|
+
jsxRuntime_1(CarbonWebSocket, { ...(false !== this.props.websocket ? this.props.websocket : {}), instance: this }), jsxRuntime_1(Context, { value: this.state, children: this.props.children }), jsxRuntime_1(ToastContainer, {})] });
|
|
4435
4440
|
}
|
|
4436
4441
|
}
|
|
4437
4442
|
|