@skirbi/sugar 0.0.16 → 0.0.18
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 +10 -0
- package/lib/htmlelement.mjs +6 -0
- package/lib/index.mjs +1 -1
- package/lib/with-connected-sugar.mjs +2 -8
- package/package.json +2 -2
package/Changes
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
Revision history for @skirbi/sugar
|
|
2
2
|
|
|
3
|
+
0.0.18 2026-04-20 06:11:32Z
|
|
4
|
+
|
|
5
|
+
* Move renderGuardSelector and hasRenderedShape from with-connected-sugar to
|
|
6
|
+
the base sugar class for @skirbi/bolbe. We need this protection for some
|
|
7
|
+
non-morping semtic elements such as semtic-terminal. Dragons, I found them.
|
|
8
|
+
|
|
9
|
+
0.0.17 2026-04-20 02:34:38Z
|
|
10
|
+
|
|
11
|
+
* Fakedom, not fakedomE
|
|
12
|
+
|
|
3
13
|
0.0.16 2026-04-20 02:29:48Z
|
|
4
14
|
|
|
5
15
|
* Introduce fakedom.mjs, can be imported as @skirbi/sugar/fakedom
|
package/lib/htmlelement.mjs
CHANGED
|
@@ -27,6 +27,7 @@ import { registerDevAlias } from './aliases.mjs';
|
|
|
27
27
|
|
|
28
28
|
export class HTMLElementSugar extends HTMLElement {
|
|
29
29
|
|
|
30
|
+
static renderGuardSelector = '';
|
|
30
31
|
/**
|
|
31
32
|
* Register the element using its static `tag` name.
|
|
32
33
|
* Should be called once per component.
|
|
@@ -258,6 +259,11 @@ export class HTMLElementSugar extends HTMLElement {
|
|
|
258
259
|
}
|
|
259
260
|
}
|
|
260
261
|
|
|
262
|
+
hasRenderedShape() {
|
|
263
|
+
const sel = this.constructor.renderGuardSelector;
|
|
264
|
+
return !!(sel && this.querySelector(sel));
|
|
265
|
+
}
|
|
266
|
+
|
|
261
267
|
/**
|
|
262
268
|
* Called when an observed attribute changes.
|
|
263
269
|
* @param {string} name - The attribute name
|
package/lib/index.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export const withConnectedSugar = (Base) =>
|
|
2
2
|
class extends Base {
|
|
3
|
-
static renderGuardSelector = '';
|
|
4
3
|
static morphTriggerSelector = '';
|
|
5
4
|
|
|
6
5
|
connectedCallback() {
|
|
@@ -32,7 +31,7 @@ export const withConnectedSugar = (Base) =>
|
|
|
32
31
|
}
|
|
33
32
|
|
|
34
33
|
_shouldRenderOnMorph() {
|
|
35
|
-
return this._hasMorphTrigger() && !this.
|
|
34
|
+
return this._hasMorphTrigger() && !this.hasRenderedShape();
|
|
36
35
|
}
|
|
37
36
|
|
|
38
37
|
_hasMorphTrigger() {
|
|
@@ -42,16 +41,11 @@ export const withConnectedSugar = (Base) =>
|
|
|
42
41
|
|
|
43
42
|
_shouldRenderOnConnect() {
|
|
44
43
|
const guard = this.constructor.renderGuardSelector;
|
|
45
|
-
if (guard) return !this.
|
|
44
|
+
if (guard) return !this.hasRenderedShape();
|
|
46
45
|
|
|
47
46
|
return true;
|
|
48
47
|
}
|
|
49
48
|
|
|
50
|
-
_hasRenderedShape() {
|
|
51
|
-
const sel = this.constructor.renderGuardSelector;
|
|
52
|
-
return !!(sel && this.querySelector(sel));
|
|
53
|
-
}
|
|
54
|
-
|
|
55
49
|
disconnectedCallback() {
|
|
56
50
|
this._sugarMo?.disconnect();
|
|
57
51
|
this._sugarMo = null;
|
package/package.json
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"./aliases": "./lib/aliases.mjs",
|
|
21
21
|
"./aliases-register": "./lib/aliases-register.mjs",
|
|
22
22
|
"./boolean": "./lib/boolean.mjs",
|
|
23
|
-
"./
|
|
23
|
+
"./fakedom": "./lib/fakedom.mjs",
|
|
24
24
|
"./htmlelement": "./lib/htmlelement.mjs",
|
|
25
25
|
"./htmlelement-input": "./lib/htmlelement-input.mjs",
|
|
26
26
|
"./htmlelement-select": "./lib/htmlelement-select.mjs",
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
},
|
|
52
52
|
"sideEffects": false,
|
|
53
53
|
"type": "module",
|
|
54
|
-
"version": "0.0.
|
|
54
|
+
"version": "0.0.18"
|
|
55
55
|
}
|