@thatopen/components 2.4.0-alpha.28 → 2.4.0-alpha.30

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/index.mjs CHANGED
@@ -5548,6 +5548,43 @@ class Configurator {
5548
5548
  }
5549
5549
  }
5550
5550
  }
5551
+ export() {
5552
+ const serializedData = {};
5553
+ for (const id in this._config) {
5554
+ const control = this._config[id];
5555
+ if (control.type === "Color") {
5556
+ const { r, g, b } = control.value;
5557
+ serializedData[id] = { ...control, value: { r, g, b } };
5558
+ } else if (control.type === "Vector3") {
5559
+ const { x, y, z } = control.value;
5560
+ serializedData[id] = { ...control, value: { x, y, z } };
5561
+ } else if (control.type === "Select" || control.type === "TextSet") {
5562
+ const value = Array.from(control.value);
5563
+ serializedData[id] = { ...control, value };
5564
+ } else {
5565
+ serializedData[id] = { ...control };
5566
+ }
5567
+ }
5568
+ return serializedData;
5569
+ }
5570
+ import(serializedData) {
5571
+ const imported = {};
5572
+ for (const id in serializedData) {
5573
+ const control = serializedData[id];
5574
+ if (control.type === "Color") {
5575
+ const { r, g, b } = control.value;
5576
+ imported[id] = { ...control, value: new THREE$1.Color(r, g, b) };
5577
+ } else if (control.type === "Vector3") {
5578
+ const { x, y, z } = control.value;
5579
+ imported[id] = { ...control, value: new THREE$1.Vector3(x, y, z) };
5580
+ } else if (control.type === "Select" || control.type === "TextSet") {
5581
+ imported[id] = { ...control, value: new Set(control.value) };
5582
+ } else {
5583
+ imported[id] = { ...control };
5584
+ }
5585
+ }
5586
+ this.set(imported);
5587
+ }
5551
5588
  copyEntry(controlEntry) {
5552
5589
  if (controlEntry.type === "Boolean") {
5553
5590
  const entry = controlEntry;