@skirbi/sugar 0.1.10 → 0.1.11
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 +6 -0
- package/lib/index.mjs +1 -1
- package/lib/livewire.mjs +50 -57
- package/package.json +1 -1
package/Changes
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
Revision history for @skirbi/sugar
|
|
2
2
|
|
|
3
|
+
0.1.11 2026-07-01 04:10:34Z
|
|
4
|
+
|
|
5
|
+
* Debugging session start. There is a weird case of it works via local file
|
|
6
|
+
and not via npm. So I can't really rely on the local file mounts. Ship the
|
|
7
|
+
debug.
|
|
8
|
+
|
|
3
9
|
0.1.10 2026-07-01 01:54:46Z
|
|
4
10
|
|
|
5
11
|
* Add tests to semtic-select
|
package/lib/index.mjs
CHANGED
package/lib/livewire.mjs
CHANGED
|
@@ -15,30 +15,28 @@
|
|
|
15
15
|
*
|
|
16
16
|
* Only import this when using Sugar components inside a Livewire application.
|
|
17
17
|
*/
|
|
18
|
+
console.log('[sugar-livewire] eval', performance.now())
|
|
18
19
|
|
|
19
|
-
/*
|
|
20
20
|
console.log('[sugar-livewire] module loaded', {
|
|
21
21
|
hasLivewire: !!window.Livewire,
|
|
22
22
|
hasHook: !!window.Livewire?.hook,
|
|
23
23
|
});
|
|
24
|
-
*/
|
|
25
24
|
|
|
26
25
|
let registered = false;
|
|
27
26
|
|
|
28
|
-
|
|
29
27
|
/**
|
|
30
28
|
* Registers the Sugar Livewire hydration hook.
|
|
31
29
|
*
|
|
32
30
|
* @returns {void}
|
|
33
31
|
*/
|
|
32
|
+
|
|
34
33
|
function registerSugarLivewire() {
|
|
35
|
-
/*
|
|
36
34
|
console.log('[sugar-livewire] register called', {
|
|
37
35
|
registered,
|
|
38
36
|
hasLivewire: !!window.Livewire,
|
|
39
37
|
hasHook: !!window.Livewire?.hook,
|
|
38
|
+
perf: performance.now(),
|
|
40
39
|
});
|
|
41
|
-
*/
|
|
42
40
|
|
|
43
41
|
if (registered) return;
|
|
44
42
|
if (!window.Livewire?.hook) return;
|
|
@@ -47,74 +45,69 @@ function registerSugarLivewire() {
|
|
|
47
45
|
|
|
48
46
|
window.Livewire.hook('component.init', ({ component }) => {
|
|
49
47
|
|
|
50
|
-
|
|
48
|
+
console.log('[sugar-livewire] component.init hit', component.id);
|
|
51
49
|
|
|
52
50
|
const original = component.processEffects.bind(component);
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
staging.remove();
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
|
|
51
|
+
component.processEffects = function processSugarEffects(effects) {
|
|
52
|
+
|
|
53
|
+
console.log('[sugar-livewire] definitions', {
|
|
54
|
+
dibuho: !!customElements.get('dibuho-container-panel'),
|
|
55
|
+
panel: !!customElements.get('semtic-panel'),
|
|
56
|
+
header: !!customElements.get('semtic-header'),
|
|
57
|
+
perf: performance.now(),
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
console.log('[sugar-livewire] processEffects hit', {
|
|
61
|
+
hasHtml: !!effects.html,
|
|
62
|
+
sugarHydrated: !!effects._sugarHydrated,
|
|
63
|
+
perf: performance.now(),
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
if (!effects.html) return original(effects);
|
|
67
|
+
if (effects._sugarHydrated) return original(effects);
|
|
68
|
+
|
|
69
|
+
const before = effects.html;
|
|
70
|
+
const staging = document.createElement('div');
|
|
71
|
+
staging.style.display = 'none';
|
|
72
|
+
document.body.appendChild(staging);
|
|
73
|
+
|
|
74
|
+
try {
|
|
75
|
+
staging.innerHTML = before;
|
|
76
|
+
const after = staging.innerHTML;
|
|
77
|
+
effects.html = after;
|
|
78
|
+
effects._sugarHydrated = true;
|
|
79
|
+
|
|
80
|
+
console.group('[sugar-livewire] html');
|
|
81
|
+
console.log('perf:\n',performance.now());
|
|
82
|
+
console.log('before:\n', before);
|
|
83
|
+
console.log('after:\n', after);
|
|
84
|
+
console.log('changed:', before !== after);
|
|
85
|
+
console.log('handoff:\n', effects.html);
|
|
86
|
+
console.log('handoff is after:', effects.html === after);
|
|
87
|
+
console.groupEnd();
|
|
88
|
+
|
|
89
|
+
return original(effects);
|
|
90
|
+
}
|
|
91
|
+
finally {
|
|
92
|
+
staging.remove();
|
|
93
|
+
}
|
|
94
|
+
};
|
|
101
95
|
});
|
|
102
96
|
}
|
|
103
97
|
|
|
104
98
|
if (typeof document !== 'undefined') {
|
|
105
99
|
document.addEventListener('livewire:init', registerSugarLivewire);
|
|
106
|
-
|
|
107
100
|
queueMicrotask(() => {
|
|
108
101
|
registerSugarLivewire();
|
|
109
102
|
});
|
|
110
103
|
}
|
|
111
104
|
|
|
112
105
|
document.addEventListener('livewire:init', () => {
|
|
113
|
-
|
|
106
|
+
console.log('[sugar-livewire] livewire:init heard');
|
|
114
107
|
registerSugarLivewire();
|
|
115
108
|
});
|
|
116
109
|
|
|
117
110
|
queueMicrotask(() => {
|
|
118
|
-
|
|
111
|
+
console.log('[sugar-livewire] microtask fallback');
|
|
119
112
|
registerSugarLivewire();
|
|
120
113
|
});
|
package/package.json
CHANGED