@burger-editor/client 4.0.0-alpha.42 → 4.0.0-alpha.44

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/client.js CHANGED
@@ -578,8 +578,8 @@ function getNormalizedAttributes(el) {
578
578
  * @returns 属性が同じ場合true、異なる場合false
579
579
  */
580
580
  function compareAttributes(attrs1, attrs2) {
581
- const keys1 = Object.keys(attrs1).sort();
582
- const keys2 = Object.keys(attrs2).sort();
581
+ const keys1 = Object.keys(attrs1).toSorted();
582
+ const keys2 = Object.keys(attrs2).toSorted();
583
583
  // 属性名の数が異なる場合は異なる
584
584
  if (keys1.length !== keys2.length) {
585
585
  return false;
@@ -4413,11 +4413,11 @@ class BurgerEditorEngine {
4413
4413
  }
4414
4414
  async #createItemElement(itemData) {
4415
4415
  if (typeof itemData !== 'string' && 'localName' in itemData) {
4416
- Item$1.rebind(itemData, this.items, this.itemEditorDialog);
4417
- return itemData;
4416
+ const item = Item$1.rebind(itemData, this.items, this.itemEditorDialog);
4417
+ return item.el;
4418
4418
  }
4419
4419
  const name = typeof itemData === 'string' ? itemData : itemData.name;
4420
- const item = await Item$1.create(name, this.items, this.itemEditorDialog);
4420
+ const item = await Item$1.create(name, this.items, this.itemEditorDialog, typeof itemData === 'string' ? undefined : itemData.data);
4421
4421
  return item.el;
4422
4422
  }
4423
4423
  #isUIName(name) {
@@ -33057,7 +33057,7 @@ const _BgeWysiwygElement = class _BgeWysiwygElement extends HTMLElement {
33057
33057
  __privateGet$1(this, _textarea).value = value;
33058
33058
  }
33059
33059
  get mode() {
33060
- const modeAttr = this.shadowRoot?.querySelector(`[data-bge-mode]`)?.getAttribute("data-bge-mode");
33060
+ const modeAttr = this.shadowRoot?.querySelector(`[data-bge-mode]`)?.dataset.bgeMode;
33061
33061
  return modeAttr === "html" ? "html" : "wysiwyg";
33062
33062
  }
33063
33063
  set mode(mode) {
@@ -34378,7 +34378,6 @@ function invoke_error_boundary(error, effect) {
34378
34378
  * effect: Effect | null;
34379
34379
  * effects: Effect[];
34380
34380
  * render_effects: Effect[];
34381
- * block_effects: Effect[];
34382
34381
  * }} EffectTarget
34383
34382
  */
34384
34383
 
@@ -34462,15 +34461,15 @@ class Batch {
34462
34461
 
34463
34462
  /**
34464
34463
  * Deferred effects (which run after async work has completed) that are DIRTY
34465
- * @type {Effect[]}
34464
+ * @type {Set<Effect>}
34466
34465
  */
34467
- #dirty_effects = [];
34466
+ #dirty_effects = new Set();
34468
34467
 
34469
34468
  /**
34470
34469
  * Deferred effects that are MAYBE_DIRTY
34471
- * @type {Effect[]}
34470
+ * @type {Set<Effect>}
34472
34471
  */
34473
- #maybe_dirty_effects = [];
34472
+ #maybe_dirty_effects = new Set();
34474
34473
 
34475
34474
  /**
34476
34475
  * A set of branches that still exist, but will be destroyed when this batch
@@ -34501,8 +34500,7 @@ class Batch {
34501
34500
  parent: null,
34502
34501
  effect: null,
34503
34502
  effects: [],
34504
- render_effects: [],
34505
- block_effects: []
34503
+ render_effects: []
34506
34504
  };
34507
34505
 
34508
34506
  for (const root of root_effects) {
@@ -34521,7 +34519,6 @@ class Batch {
34521
34519
  if (this.is_deferred()) {
34522
34520
  this.#defer_effects(target.effects);
34523
34521
  this.#defer_effects(target.render_effects);
34524
- this.#defer_effects(target.block_effects);
34525
34522
  } else {
34526
34523
  // If sources are written to, then work needs to happen in a separate batch, else prior sources would be mixed with
34527
34524
  // newly updated sources, which could lead to infinite loops when effects run over and over again.
@@ -34562,8 +34559,7 @@ class Batch {
34562
34559
  parent: target,
34563
34560
  effect,
34564
34561
  effects: [],
34565
- render_effects: [],
34566
- block_effects: []
34562
+ render_effects: []
34567
34563
  };
34568
34564
  }
34569
34565
 
@@ -34573,7 +34569,7 @@ class Batch {
34573
34569
  } else if ((flags & EFFECT) !== 0) {
34574
34570
  target.effects.push(effect);
34575
34571
  } else if (is_dirty(effect)) {
34576
- if ((effect.f & BLOCK_EFFECT) !== 0) target.block_effects.push(effect);
34572
+ if ((effect.f & BLOCK_EFFECT) !== 0) this.#dirty_effects.add(effect);
34577
34573
  update_effect(effect);
34578
34574
  }
34579
34575
 
@@ -34595,7 +34591,6 @@ class Batch {
34595
34591
  // once the boundary is ready?
34596
34592
  this.#defer_effects(target.effects);
34597
34593
  this.#defer_effects(target.render_effects);
34598
- this.#defer_effects(target.block_effects);
34599
34594
 
34600
34595
  target = /** @type {EffectTarget} */ (target.parent);
34601
34596
  }
@@ -34611,8 +34606,11 @@ class Batch {
34611
34606
  */
34612
34607
  #defer_effects(effects) {
34613
34608
  for (const e of effects) {
34614
- const target = (e.f & DIRTY) !== 0 ? this.#dirty_effects : this.#maybe_dirty_effects;
34615
- target.push(e);
34609
+ if ((e.f & DIRTY) !== 0) {
34610
+ this.#dirty_effects.add(e);
34611
+ } else if ((e.f & MAYBE_DIRTY) !== 0) {
34612
+ this.#maybe_dirty_effects.add(e);
34613
+ }
34616
34614
 
34617
34615
  // Since we're not executing these effects now, we need to clear any WAS_MARKED flags
34618
34616
  // so that other batches can correctly reach these effects during their own traversal
@@ -34722,8 +34720,7 @@ class Batch {
34722
34720
  parent: null,
34723
34721
  effect: null,
34724
34722
  effects: [],
34725
- render_effects: [],
34726
- block_effects: []
34723
+ render_effects: []
34727
34724
  };
34728
34725
 
34729
34726
  for (const batch of batches) {
@@ -34816,6 +34813,7 @@ class Batch {
34816
34813
 
34817
34814
  revive() {
34818
34815
  for (const e of this.#dirty_effects) {
34816
+ this.#maybe_dirty_effects.delete(e);
34819
34817
  set_signal_status(e, DIRTY);
34820
34818
  schedule_effect(e);
34821
34819
  }
@@ -34825,9 +34823,6 @@ class Batch {
34825
34823
  schedule_effect(e);
34826
34824
  }
34827
34825
 
34828
- this.#dirty_effects = [];
34829
- this.#maybe_dirty_effects = [];
34830
-
34831
34826
  this.flush();
34832
34827
  }
34833
34828
 
@@ -44093,7 +44088,7 @@ function parseConfig(config) {
44093
44088
  }
44094
44089
  }
44095
44090
 
44096
- const version = "4.0.0-alpha.39";
44091
+ const version = "4.0.0-alpha.43";
44097
44092
  function attachDraftSwitcher(engine) {
44098
44093
  if (engine.hasDraft()) {
44099
44094
  const container = document.createElement("div");