@skirbi/sugar 0.0.24 → 0.0.26

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/Changes CHANGED
@@ -1,5 +1,27 @@
1
1
  Revision history for @skirbi/sugar
2
2
 
3
+ 0.0.26 2026-05-30 00:49:13Z
4
+
5
+ * Introduce morphedCallbackSugar. Morphing is a delicate matter for
6
+ webcomponents. The problem with morphing is a lot of life cycle wizardry
7
+ and things that seem logical but are not.
8
+
9
+ So the problem is that semtic-choice-card wasn't able to really detect
10
+ that it was selected or not. The problem here was the morph *might* happen
11
+ on an element that is rendered already so we cannot rely on purely morphing
12
+ defenses. We need to know that we got morphed while being completely
13
+ rendered. This meant we need to look at the rendered shape and now using a
14
+ `morphedCallbackSugar()` where you can apply logic to tell the component,
15
+ "yo, you have a new state, do this thing". This allowed semtic-choice-card
16
+ to work correctly.
17
+
18
+ It only took me 8 hrs of my life and a good chunk of my sanity.
19
+
20
+
21
+ 0.0.25 2026-05-29 08:52:30Z
22
+
23
+ * Add hooks for event-listeners in connected sugar
24
+
3
25
  0.0.24 2026-05-29 05:27:25Z
4
26
 
5
27
  * Fix inheritance bugs related to init() twice
package/lib/index.mjs CHANGED
@@ -2,7 +2,7 @@
2
2
  //
3
3
  // SPDX-License-Identifier: MIT
4
4
 
5
- const VERSION = "0.0.24";
5
+ const VERSION = "0.0.26";
6
6
 
7
7
  export { HTMLElementSugar } from './htmlelement.mjs';
8
8
  export { HTMLElementSugarInput } from './htmlelement-input.mjs';
@@ -9,6 +9,9 @@ export const withConnectedSugar = (Base) =>
9
9
  connectedCallback() {
10
10
  this._syncObservedAttributesToConfig();
11
11
  this._armMorphObserver();
12
+ if (this.connectedCallbackSugarOnce) {
13
+ this.connectedCallbackSugarOnce();
14
+ }
12
15
 
13
16
  if (this._shouldRenderOnConnect()) {
14
17
  this.connectedCallbackSugar();
@@ -28,6 +31,11 @@ export const withConnectedSugar = (Base) =>
28
31
  this._sugarMo = new MutationObserver(() => {
29
32
  if (this._shouldRenderOnMorph()) {
30
33
  this.connectedCallbackSugar();
34
+ return;
35
+ }
36
+ if (this.hasRenderedShape() && this.morphedCallbackSugar) {
37
+ this.morphedCallbackSugar();
38
+ return;
31
39
  }
32
40
  });
33
41
 
package/package.json CHANGED
@@ -52,5 +52,5 @@
52
52
  },
53
53
  "sideEffects": false,
54
54
  "type": "module",
55
- "version": "0.0.24"
55
+ "version": "0.0.26"
56
56
  }