@schukai/monster 4.141.1 → 4.141.2

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/package.json CHANGED
@@ -1 +1 @@
1
- {"author":"Volker Schukai","dependencies":{"@floating-ui/dom":"^1.7.6"},"description":"Monster is a simple library for creating fast, robust and lightweight websites.","homepage":"https://monsterjs.org/","keywords":["framework","web","dom","css","sass","mobile-first","app","front-end","templates","schukai","core","shopcloud","alvine","monster","buildmap","stack","observer","observable","uuid","node","nodelist","css-in-js","logger","log","theme"],"license":"AGPL 3.0","main":"source/monster.mjs","module":"source/monster.mjs","name":"@schukai/monster","repository":{"type":"git","url":"https://gitlab.schukai.com/oss/libraries/javascript/monster.git"},"type":"module","version":"4.141.1"}
1
+ {"author":"Volker Schukai","dependencies":{"@floating-ui/dom":"^1.7.6"},"description":"Monster is a simple library for creating fast, robust and lightweight websites.","homepage":"https://monsterjs.org/","keywords":["framework","web","dom","css","sass","mobile-first","app","front-end","templates","schukai","core","shopcloud","alvine","monster","buildmap","stack","observer","observable","uuid","node","nodelist","css-in-js","logger","log","theme"],"license":"AGPL 3.0","main":"source/monster.mjs","module":"source/monster.mjs","name":"@schukai/monster","repository":{"type":"git","url":"https://gitlab.schukai.com/oss/libraries/javascript/monster.git"},"type":"module","version":"4.141.2"}
@@ -266,11 +266,14 @@ class ControlBar extends CustomElement {
266
266
  needsMeasure: true,
267
267
  needsLayout: true,
268
268
  needsObserve: true,
269
+ initialLayoutPending: true,
270
+ initialLayoutOpacity: undefined,
269
271
  suppressSlotChange: false,
270
272
  suppressMutation: false,
271
273
  };
272
274
 
273
275
  initControlReferences.call(this);
276
+ hideControlBarUntilInitialLayout.call(this);
274
277
  initEventHandler.call(this);
275
278
 
276
279
  // setup structure
@@ -462,6 +465,44 @@ function isElementSelfHidden(element) {
462
465
  );
463
466
  }
464
467
 
468
+ /**
469
+ * @private
470
+ * @return {void}
471
+ */
472
+ function hideControlBarUntilInitialLayout() {
473
+ const state = this[layoutStateSymbol];
474
+ if (!state || !(this[controlBarElementSymbol] instanceof HTMLElement)) {
475
+ return;
476
+ }
477
+
478
+ state.initialLayoutOpacity = this[controlBarElementSymbol].style.opacity;
479
+ this[controlBarElementSymbol].style.opacity = "0";
480
+ }
481
+
482
+ /**
483
+ * @private
484
+ * @return {void}
485
+ */
486
+ function revealControlBarAfterInitialLayout() {
487
+ const state = this[layoutStateSymbol];
488
+ if (
489
+ !state ||
490
+ state.initialLayoutPending !== true ||
491
+ !(this[controlBarElementSymbol] instanceof HTMLElement)
492
+ ) {
493
+ return;
494
+ }
495
+
496
+ state.initialLayoutPending = false;
497
+ const initialOpacity = state.initialLayoutOpacity;
498
+ if (typeof initialOpacity === "string" && initialOpacity !== "") {
499
+ this[controlBarElementSymbol].style.opacity = initialOpacity;
500
+ return;
501
+ }
502
+
503
+ this[controlBarElementSymbol].style.removeProperty("opacity");
504
+ }
505
+
465
506
  /**
466
507
  * @private
467
508
  */
@@ -664,6 +705,7 @@ function runLayout() {
664
705
  })
665
706
  .finally(() => {
666
707
  state.running = false;
708
+ revealControlBarAfterInitialLayout.call(this);
667
709
  if (state.needsObserve || state.needsMeasure || state.needsLayout) {
668
710
  scheduleLayoutFrame.call(this);
669
711
  }
@@ -734,12 +734,15 @@ describe("ControlBar", function () {
734
734
  value: 20,
735
735
  });
736
736
 
737
+ expect(controlBar.style.opacity).to.equal("0");
738
+
737
739
  await flushFrames();
738
740
  await new Promise((resolve) => setTimeout(resolve, 0));
739
741
  await new Promise((resolve) => setTimeout(resolve, 0));
740
742
 
741
743
  expect(switchButton.hasAttribute("hidden")).to.be.true;
742
744
  expect(button.hasAttribute("slot")).to.be.false;
745
+ expect(controlBar.style.opacity).to.equal("");
743
746
  expect(controlBar.getAttribute("data-monster-layout-stacked")).to.equal(
744
747
  "true",
745
748
  );