@skirbi/sugar 0.0.25 → 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 +18 -0
- package/lib/index.mjs +1 -1
- package/lib/with-connected-sugar.mjs +5 -0
- package/package.json +1 -1
package/Changes
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
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
|
+
|
|
3
21
|
0.0.25 2026-05-29 08:52:30Z
|
|
4
22
|
|
|
5
23
|
* Add hooks for event-listeners in connected sugar
|
package/lib/index.mjs
CHANGED
|
@@ -31,6 +31,11 @@ export const withConnectedSugar = (Base) =>
|
|
|
31
31
|
this._sugarMo = new MutationObserver(() => {
|
|
32
32
|
if (this._shouldRenderOnMorph()) {
|
|
33
33
|
this.connectedCallbackSugar();
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
if (this.hasRenderedShape() && this.morphedCallbackSugar) {
|
|
37
|
+
this.morphedCallbackSugar();
|
|
38
|
+
return;
|
|
34
39
|
}
|
|
35
40
|
});
|
|
36
41
|
|
package/package.json
CHANGED