shinkom 1.0.2 → 1.1.0
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/README.md +3 -2
- package/dist/bundles/_virtual/_rolldown/runtime.js +1 -1
- package/dist/bundles/core/constants.d.ts +1 -1
- package/dist/bundles/core/constants.js +5 -2
- package/dist/bundles/core/elements/compat-view-element.d.ts +100 -0
- package/dist/bundles/core/elements/compat-view-element.js +440 -0
- package/dist/bundles/core/elements/control-panel-element.d.ts +45 -0
- package/dist/bundles/core/elements/control-panel-element.js +99 -0
- package/dist/bundles/core/elements/index.d.ts +13 -0
- package/dist/bundles/core/elements/index.js +13 -0
- package/dist/bundles/core/elements/inspector-element.d.ts +27 -0
- package/dist/bundles/core/elements/inspector-element.js +58 -0
- package/dist/bundles/core/elements/recent-result-item.js +46 -0
- package/dist/bundles/core/elements/results-history-item.js +46 -0
- package/dist/bundles/core/elements/templates/compat-view.templates.js +462 -0
- package/dist/bundles/core/elements/templates/control-panel.templates.js +335 -0
- package/dist/bundles/core/elements/templates/root-styles.template.js +40 -0
- package/dist/bundles/core/event-bus.d.ts +19 -5
- package/dist/bundles/core/event-bus.js +21 -8
- package/dist/bundles/core/helpers.js +24 -2
- package/dist/bundles/core/index.d.ts +5 -2
- package/dist/bundles/core/index.js +6 -2
- package/dist/bundles/core/state-service.d.ts +24 -4
- package/dist/bundles/core/state-service.js +25 -5
- package/dist/bundles/core/ui-component.d.ts +25 -6
- package/dist/bundles/core/ui-component.js +31 -12
- package/dist/bundles/engine/engine.d.ts +57 -9
- package/dist/bundles/engine/engine.js +115 -31
- package/dist/bundles/engine/index.js +1 -1
- package/dist/bundles/gen/browser-data.js +36 -36
- package/dist/bundles/gen/browser-usage-data.js +224 -222
- package/dist/bundles/gen/compat-data.js +1 -1
- package/dist/bundles/gen/index.js +1 -1
- package/dist/bundles/index.d.ts +6 -2
- package/dist/bundles/index.js +8 -2
- package/dist/bundles/pkg/shinkore.d.ts +1 -1
- package/dist/bundles/pkg/shinkore.js +1 -1
- package/dist/bundles/pkg/shinkore_bg.wasm +0 -0
- package/dist/bundles/shinkom.d.ts +9 -1
- package/dist/bundles/shinkom.js +31 -6
- package/dist/bundles/types/public.d.ts +13 -29
- package/dist/bundles/types/types.d.ts +99 -0
- package/dist/bundles/ui/compat-ui/compat-ui.d.ts +12 -2
- package/dist/bundles/ui/compat-ui/compat-ui.js +12 -2
- package/dist/bundles/ui/compat-ui/index.js +8 -0
- package/dist/bundles/ui/compatibility-view/compatibility-view.d.ts +42 -0
- package/dist/bundles/ui/compatibility-view/compatibility-view.js +229 -0
- package/dist/bundles/ui/compatibility-view/index.js +8 -0
- package/dist/bundles/ui/control-panel/control-panel.d.ts +30 -16
- package/dist/bundles/ui/control-panel/control-panel.js +188 -277
- package/dist/bundles/ui/control-panel/index.js +8 -0
- package/dist/bundles/ui/index.d.ts +3 -2
- package/dist/bundles/ui/index.js +7 -2
- package/dist/bundles/ui/inspector/index.js +8 -0
- package/dist/bundles/ui/inspector/inspector.d.ts +60 -6
- package/dist/bundles/ui/inspector/inspector.js +149 -69
- package/dist/modules/core/constants.cjs +17 -1
- package/dist/modules/core/elements/compat-view-element.cjs +434 -0
- package/dist/modules/core/elements/control-panel-element.cjs +93 -0
- package/dist/modules/core/elements/index.cjs +11 -0
- package/dist/modules/core/elements/inspector-element.cjs +52 -0
- package/dist/modules/core/elements/recent-result-item.cjs +39 -0
- package/dist/modules/core/elements/results-history-item.cjs +39 -0
- package/dist/modules/core/elements/templates/compat-view.templates.cjs +458 -0
- package/dist/modules/core/elements/templates/control-panel.templates.cjs +332 -0
- package/dist/modules/core/elements/templates/root-styles.template.cjs +33 -0
- package/dist/modules/core/event-bus.cjs +43 -1
- package/dist/modules/core/helpers.cjs +41 -1
- package/dist/modules/core/index.cjs +16 -1
- package/dist/modules/core/state-service.cjs +74 -1
- package/dist/modules/core/ui-component.cjs +65 -1
- package/dist/modules/engine/engine.cjs +232 -1
- package/dist/modules/gen/browser-data.cjs +100 -1
- package/dist/modules/gen/browser-usage-data.cjs +675 -1
- package/dist/modules/gen/compat-data.cjs +31015 -1
- package/dist/modules/gen/index.cjs +7 -1
- package/dist/modules/index.cjs +27 -1
- package/dist/modules/pkg/shinkore.cjs +459 -1
- package/dist/modules/pkg/shinkore_bg.wasm +0 -0
- package/dist/modules/shinkom.cjs +73 -1
- package/dist/modules/ui/compat-ui/compat-ui.cjs +53 -1
- package/dist/modules/ui/compat-ui/index.cjs +1 -0
- package/dist/modules/ui/compatibility-view/compatibility-view.cjs +223 -0
- package/dist/modules/ui/compatibility-view/index.cjs +1 -0
- package/dist/modules/ui/control-panel/control-panel.cjs +314 -182
- package/dist/modules/ui/control-panel/index.cjs +1 -0
- package/dist/modules/ui/index.cjs +13 -1
- package/dist/modules/ui/inspector/index.cjs +1 -0
- package/dist/modules/ui/inspector/inspector.cjs +388 -1
- package/package.json +15 -8
- package/dist/bundles/node_modules/@mdn/browser-compat-data/types.d.ts +0 -78
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
//#region src/core/elements/templates/control-panel.templates.js
|
|
2
|
+
const controlPanelHTML = `
|
|
3
|
+
<div style="position: relative">
|
|
4
|
+
<button id="sk-show-panel" class="sk-button-style sk-show-panel">
|
|
5
|
+
<svg style="display: block; pointer-events: none;" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"
|
|
6
|
+
stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
|
|
7
|
+
class="lucide lucide-panel-left-open-icon lucide-panel-left-open">
|
|
8
|
+
<rect width="18" height="18" x="3" y="3" rx="2" />
|
|
9
|
+
<path d="M9 3v18" />
|
|
10
|
+
<path d="m14 9 3 3-3 3" />
|
|
11
|
+
</svg>
|
|
12
|
+
</button>
|
|
13
|
+
<div part="control-panel" id="sk-control-panel" class="sk-control-panel" style="display: none;">
|
|
14
|
+
<div class="sk-control-panel-inner">
|
|
15
|
+
<nav class="sk-tabs-nav">
|
|
16
|
+
<button id="sk-inspector-tab" class="sk-tab-button">Inspector</button>
|
|
17
|
+
<div class="sk-tab-line"></div>
|
|
18
|
+
<button id="sk-compat-view-tab" class="sk-tab-button">Compatibility View</button>
|
|
19
|
+
</nav>
|
|
20
|
+
<hr class="sk-hr-line">
|
|
21
|
+
<main id="sk-control-panel-main" class="sk-control-panel-main"></main>
|
|
22
|
+
<hr class="sk-hr-line">
|
|
23
|
+
<footer class="sk-close">
|
|
24
|
+
<button id="sk-close-panel" class="sk-button-style">Close</button>
|
|
25
|
+
<span class="sk-copy">© 2026 Shinkom</span>
|
|
26
|
+
</footer>
|
|
27
|
+
</div>
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
30
|
+
`;
|
|
31
|
+
const controlPanelInspectorTab = `
|
|
32
|
+
<div class="sk-multi-elements">
|
|
33
|
+
<p>Activate multi-element checking</p>
|
|
34
|
+
<label class="sk-multi-elements-checkbox-container">
|
|
35
|
+
<input id="sk-toggle-elements" type="checkbox">
|
|
36
|
+
<span class="sk-multi-elements-checkbox"></span>
|
|
37
|
+
</label>
|
|
38
|
+
<p>Enter a depth level</p>
|
|
39
|
+
<input id="sk-depth-level" class="sk-text-input" type="text" placeholder="depth_level">
|
|
40
|
+
</div>
|
|
41
|
+
<hr class="sk-hr-line">
|
|
42
|
+
<div class="sk-element-switching sk-section-grid">
|
|
43
|
+
<p>Toggle element switching</p>
|
|
44
|
+
<button id="sk-toggle-switching" class="sk-button-style">Disabled</button>
|
|
45
|
+
</div>
|
|
46
|
+
<hr class="sk-hr-line">
|
|
47
|
+
<div class="sk-inspector-toggling-container">
|
|
48
|
+
<div class="sk-inspector-toggling">
|
|
49
|
+
<p>Toggle the inspector</p>
|
|
50
|
+
<button id="sk-toggle-inspector" class="sk-button-style">Enabled</button>
|
|
51
|
+
</div>
|
|
52
|
+
<span class="sk-inspector-toggling-hint">Sets/ removes event listeners for the inspector, setting/
|
|
53
|
+
removing the override of click and
|
|
54
|
+
pointer events on the window object.</span>
|
|
55
|
+
</div>
|
|
56
|
+
<hr class="sk-hr-line">
|
|
57
|
+
<div class="sk-create-inspector-container sk-section-grid">
|
|
58
|
+
<p>Create inspector</p>
|
|
59
|
+
<button id="sk-create-inspector" class="sk-button-style">Create</button>
|
|
60
|
+
</div>
|
|
61
|
+
<hr class="sk-hr-line">
|
|
62
|
+
<div class="sk-reset-inspector-container sk-section-grid">
|
|
63
|
+
<p>Reset inspector</p>
|
|
64
|
+
<button id="sk-reset-inspector" class="sk-button-style">Reset</button>
|
|
65
|
+
</div>
|
|
66
|
+
<hr class="sk-hr-line">
|
|
67
|
+
<div class="sk-destroy-inspector-container sk-section-grid">
|
|
68
|
+
<p>Destroy inspector</p>
|
|
69
|
+
<button id="sk-destroy-inspector" class="sk-button-style">Destroy</button>
|
|
70
|
+
</div>
|
|
71
|
+
`;
|
|
72
|
+
const controlPanelCompatViewTab = `
|
|
73
|
+
<div class="sk-max-history-container sk-section-grid">
|
|
74
|
+
<p>Change maximum number of results stored in history</p>
|
|
75
|
+
<input id="sk-max-history" class="sk-text-input" type="text" placeholder="default is 10">
|
|
76
|
+
</div>
|
|
77
|
+
<hr class="sk-hr-line">
|
|
78
|
+
<div class="sk-clear-history-container sk-section-grid">
|
|
79
|
+
<p>Clear results history in localStorage</p>
|
|
80
|
+
<button id="sk-clear-history" class="sk-button-style">Clear</button>
|
|
81
|
+
</div>
|
|
82
|
+
`;
|
|
83
|
+
const controlPanelStyles = `
|
|
84
|
+
* {
|
|
85
|
+
box-sizing: border-box;
|
|
86
|
+
margin: 0;
|
|
87
|
+
padding: 0;
|
|
88
|
+
}
|
|
89
|
+
.sk-control-panel {
|
|
90
|
+
display: flex;
|
|
91
|
+
flex-direction: column;
|
|
92
|
+
justify-content: space-evenly;
|
|
93
|
+
width: 30rem;
|
|
94
|
+
height: 40rem;
|
|
95
|
+
padding-block: 1rem;
|
|
96
|
+
background-image: linear-gradient(to bottom, var(--sk-primary) 0%, var(--sk-background-variant-1) 25% );
|
|
97
|
+
color: white;
|
|
98
|
+
font-family: Arial, Helvetica, sans-serif;
|
|
99
|
+
border-radius: 1rem;
|
|
100
|
+
overflow: hidden;
|
|
101
|
+
}
|
|
102
|
+
.sk-control-panel * {
|
|
103
|
+
transition-property: color, background-color, border-color;
|
|
104
|
+
transition-duration: 300ms;
|
|
105
|
+
transition-timing-function: ease-in-out;
|
|
106
|
+
}
|
|
107
|
+
.sk-section-grid {
|
|
108
|
+
display: grid;
|
|
109
|
+
grid-template-columns: 1fr 1fr;
|
|
110
|
+
grid-template-rows: auto;
|
|
111
|
+
align-items: center;
|
|
112
|
+
padding-inline: 1rem;
|
|
113
|
+
padding-block: .5rem;
|
|
114
|
+
}
|
|
115
|
+
.sk-control-panel-inner {
|
|
116
|
+
display: flex;
|
|
117
|
+
flex-direction: column;
|
|
118
|
+
height: 100%;
|
|
119
|
+
}
|
|
120
|
+
.sk-tabs-nav {
|
|
121
|
+
position: relative;
|
|
122
|
+
display: grid;
|
|
123
|
+
grid-template-columns: 1fr 1fr;
|
|
124
|
+
grid-template-rows: auto;
|
|
125
|
+
align-items: center;
|
|
126
|
+
height: 2.5rem;
|
|
127
|
+
margin-bottom: 3rem;
|
|
128
|
+
}
|
|
129
|
+
.sk-tab-button {
|
|
130
|
+
color: white;
|
|
131
|
+
background: none;
|
|
132
|
+
border: none;
|
|
133
|
+
cursor: pointer;
|
|
134
|
+
font-size: var(--sk-text-xl);
|
|
135
|
+
}
|
|
136
|
+
.sk-tab-line {
|
|
137
|
+
position: absolute;
|
|
138
|
+
left: 50%;
|
|
139
|
+
top: 0;
|
|
140
|
+
height: 100%;
|
|
141
|
+
border-left: 1px solid var(--sk-accent);
|
|
142
|
+
}
|
|
143
|
+
.sk-button-style {
|
|
144
|
+
width: fit-content;
|
|
145
|
+
font-size: var(--sk-text-md);
|
|
146
|
+
color: white;
|
|
147
|
+
background-color: var(--sk-background-variant-2);
|
|
148
|
+
border: 1px solid var(--sk-secondary);
|
|
149
|
+
border-radius: .5rem;
|
|
150
|
+
padding-inline: 1.1rem;
|
|
151
|
+
padding-block: .3rem;
|
|
152
|
+
cursor: pointer;
|
|
153
|
+
}
|
|
154
|
+
.sk-button-style:hover {
|
|
155
|
+
background-color: var(--sk-hover-color);
|
|
156
|
+
}
|
|
157
|
+
.sk-hr-line {
|
|
158
|
+
width: 100%;
|
|
159
|
+
border: 0px solid transparent;
|
|
160
|
+
border-top: 1px solid var(--sk-accent);
|
|
161
|
+
}
|
|
162
|
+
.sk-control-panel-main {
|
|
163
|
+
font-size: var(--sk-text-lg);
|
|
164
|
+
}
|
|
165
|
+
.sk-multi-elements {
|
|
166
|
+
display: grid;
|
|
167
|
+
grid-template-columns: 1fr 1fr;
|
|
168
|
+
grid-template-rows: auto;
|
|
169
|
+
align-items: center;
|
|
170
|
+
padding-inline: 1rem;
|
|
171
|
+
padding-block: 1.5rem;
|
|
172
|
+
gap: 1.1rem;
|
|
173
|
+
}
|
|
174
|
+
.sk-text-input {
|
|
175
|
+
width: 50%;
|
|
176
|
+
justify-self: center;
|
|
177
|
+
background-color: var(--sk-background-variant-2);
|
|
178
|
+
border: 1px solid var(--sk-secondary);
|
|
179
|
+
border-radius: .35rem;
|
|
180
|
+
padding: .25rem;
|
|
181
|
+
color: white;
|
|
182
|
+
text-align: center;
|
|
183
|
+
font-size: var(--sk-text-md);
|
|
184
|
+
}
|
|
185
|
+
.sk-multi-elements-checkbox-container {
|
|
186
|
+
width: fit-content;
|
|
187
|
+
height: fit-content;
|
|
188
|
+
justify-self: center;
|
|
189
|
+
padding: .1rem;
|
|
190
|
+
}
|
|
191
|
+
.sk-multi-elements-checkbox-container input {
|
|
192
|
+
position: absolute;
|
|
193
|
+
opacity: 0;
|
|
194
|
+
cursor: pointer;
|
|
195
|
+
height: 0;
|
|
196
|
+
width: 0;
|
|
197
|
+
}
|
|
198
|
+
.sk-multi-elements-checkbox-container:hover input ~ .sk-multi-elements-checkbox {
|
|
199
|
+
background-color: var(--sk-hover-color);
|
|
200
|
+
}
|
|
201
|
+
.sk-multi-elements-checkbox-container input:checked ~ .sk-multi-elements-checkbox::after {
|
|
202
|
+
position: absolute;
|
|
203
|
+
top: 5%;
|
|
204
|
+
left: 25%;
|
|
205
|
+
content: "✔";
|
|
206
|
+
color: white;
|
|
207
|
+
font-size: var(--sk-text-sm);
|
|
208
|
+
}
|
|
209
|
+
.sk-multi-elements-checkbox {
|
|
210
|
+
position: relative;
|
|
211
|
+
display: inline-block;
|
|
212
|
+
width: 1.5rem;
|
|
213
|
+
height: 1.5rem;
|
|
214
|
+
background-color: var(--sk-background-variant-2);
|
|
215
|
+
border: 1px solid var(--sk-secondary);
|
|
216
|
+
border-radius: .35rem;
|
|
217
|
+
}
|
|
218
|
+
.sk-element-switching {
|
|
219
|
+
gap: 1.1rem;
|
|
220
|
+
}
|
|
221
|
+
#sk-toggle-switching {
|
|
222
|
+
justify-self: center;
|
|
223
|
+
}
|
|
224
|
+
.sk-inspector-toggling-container {
|
|
225
|
+
padding-inline: 1rem;
|
|
226
|
+
padding-block: .5rem;
|
|
227
|
+
}
|
|
228
|
+
.sk-inspector-toggling {
|
|
229
|
+
display: grid;
|
|
230
|
+
grid-template-columns: 1fr 1fr;
|
|
231
|
+
grid-template-rows: auto;
|
|
232
|
+
align-items: center;
|
|
233
|
+
gap: 1.1rem;
|
|
234
|
+
}
|
|
235
|
+
#sk-toggle-inspector {
|
|
236
|
+
justify-self: center;
|
|
237
|
+
}
|
|
238
|
+
.sk-inspector-toggling-hint {
|
|
239
|
+
font-size: var(--sk-text-xs);
|
|
240
|
+
color: var(--sk-text-grey);
|
|
241
|
+
}
|
|
242
|
+
.sk-create-inspector-container {
|
|
243
|
+
gap: 1.1rem;
|
|
244
|
+
}
|
|
245
|
+
#sk-create-inspector {
|
|
246
|
+
justify-self: center;
|
|
247
|
+
}
|
|
248
|
+
.sk-reset-inspector-container {
|
|
249
|
+
gap: 1.1rem;
|
|
250
|
+
}
|
|
251
|
+
#sk-reset-inspector {
|
|
252
|
+
justify-self: center;
|
|
253
|
+
}
|
|
254
|
+
.sk-destroy-inspector-container {
|
|
255
|
+
gap: 1.1rem;
|
|
256
|
+
}
|
|
257
|
+
#sk-destroy-inspector {
|
|
258
|
+
justify-self: center;
|
|
259
|
+
}
|
|
260
|
+
.sk-close {
|
|
261
|
+
display: flex;
|
|
262
|
+
flex: 1 1 0%;
|
|
263
|
+
justify-content: space-between;
|
|
264
|
+
align-items: flex-end;
|
|
265
|
+
padding-inline: 1rem;
|
|
266
|
+
padding-top: 1.25rem;
|
|
267
|
+
}
|
|
268
|
+
.sk-copy {
|
|
269
|
+
color: var(--sk-text-grey);
|
|
270
|
+
}
|
|
271
|
+
.sk-show-panel {
|
|
272
|
+
width: fit-content;
|
|
273
|
+
position: absolute;
|
|
274
|
+
top: 1rem;
|
|
275
|
+
left: 1rem;
|
|
276
|
+
z-index: -1;
|
|
277
|
+
transition-property: color, background-color, border-color;
|
|
278
|
+
transition-duration: 300ms;
|
|
279
|
+
transition-timing-function: ease-in-out;
|
|
280
|
+
}
|
|
281
|
+
.sk-max-history-container {
|
|
282
|
+
gap: 1.1rem;
|
|
283
|
+
}
|
|
284
|
+
.sk-clear-history-container {
|
|
285
|
+
gap: 1.1rem;
|
|
286
|
+
}
|
|
287
|
+
#sk-clear-history {
|
|
288
|
+
justify-self: center;
|
|
289
|
+
}`;
|
|
290
|
+
const controlPanelTransitions = `
|
|
291
|
+
/* Control panel transition styles injected from Shinkom */
|
|
292
|
+
|
|
293
|
+
::part(control-panel) {
|
|
294
|
+
view-transition-name: control-panel;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
@keyframes move-fade-in {
|
|
298
|
+
from {
|
|
299
|
+
opacity: 0;
|
|
300
|
+
transform: translateX(-2rem)
|
|
301
|
+
}
|
|
302
|
+
to {
|
|
303
|
+
opacity: 1;
|
|
304
|
+
transform: translateX(0rem)
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
@keyframes move-fade-out {
|
|
309
|
+
from {
|
|
310
|
+
opacity: 1;
|
|
311
|
+
transform: translateX(0rem);
|
|
312
|
+
}
|
|
313
|
+
to {
|
|
314
|
+
opacity: 0;
|
|
315
|
+
transform: translateX(-2rem);
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
::view-transition-old(control-panel) {
|
|
320
|
+
animation: 300ms ease-out both move-fade-out;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
::view-transition-new(control-panel) {
|
|
324
|
+
animation: 300ms ease-out both move-fade-in;
|
|
325
|
+
}
|
|
326
|
+
`;
|
|
327
|
+
//#endregion
|
|
328
|
+
exports.controlPanelCompatViewTab = controlPanelCompatViewTab;
|
|
329
|
+
exports.controlPanelHTML = controlPanelHTML;
|
|
330
|
+
exports.controlPanelInspectorTab = controlPanelInspectorTab;
|
|
331
|
+
exports.controlPanelStyles = controlPanelStyles;
|
|
332
|
+
exports.controlPanelTransitions = controlPanelTransitions;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
//#region src/core/elements/templates/root-styles.template.js
|
|
2
|
+
const hostStyles = `
|
|
3
|
+
:host {
|
|
4
|
+
--sk-primary: #050021;
|
|
5
|
+
--sk-secondary: #1E0074;
|
|
6
|
+
--sk-accent: #C9D1FF;
|
|
7
|
+
--sk-hover-color: #03001a;
|
|
8
|
+
--sk-background-variant-1: #191B1C;
|
|
9
|
+
--sk-background-variant-2: #1E1E1E;
|
|
10
|
+
--sk-background-variant-3: #0c0c0c;
|
|
11
|
+
|
|
12
|
+
--sk-text-grey: #5f5f5f;
|
|
13
|
+
--sk-results-blue-foreground: #3172ff;
|
|
14
|
+
--sk-results-yellow-foreground: #ffe600;
|
|
15
|
+
--sk-results-green-foreground: #40ff2f;
|
|
16
|
+
--sk-results-red-foreground: #ff2b2b;
|
|
17
|
+
--sk-indicator-green: #36ff46;
|
|
18
|
+
--sk-indicator-yellow: #fafe09;
|
|
19
|
+
--sk-indicator-red: #de291f;
|
|
20
|
+
--sk-indicator-blue: #1b72e4;
|
|
21
|
+
|
|
22
|
+
--sk-text-xs: 0.75rem;
|
|
23
|
+
--sk-text-sm: 0.875rem;
|
|
24
|
+
--sk-text-base: 1rem;
|
|
25
|
+
--sk-text-md: 1.075rem;
|
|
26
|
+
--sk-text-lg: 1.125rem;
|
|
27
|
+
--sk-text-xl: 1.25rem;
|
|
28
|
+
--sk-text-2xl: 1.5rem;
|
|
29
|
+
--sk-text-3xl: 2rem;
|
|
30
|
+
--sk-text-4xl: 3rem;
|
|
31
|
+
}`;
|
|
32
|
+
//#endregion
|
|
33
|
+
exports.hostStyles = hostStyles;
|
|
@@ -1 +1,43 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
//#region src/core/event-bus.js
|
|
3
|
+
/**@typedef {import("../types/types").ShinkomEventTarget} ShinkomEventTarget */
|
|
4
|
+
/**@typedef {import("../types/types").ShinkomEventMap} ShinkomEventMap */
|
|
5
|
+
/**@typedef {import("../types/types").ShinkomEventListener<keyof ShinkomEventMap>} ShinkomEventListener */
|
|
6
|
+
/**
|
|
7
|
+
* ShinkomBus is the application event bus used to coordinate cross-cutting
|
|
8
|
+
* actions across Shinkom UI components and the engine.
|
|
9
|
+
*
|
|
10
|
+
* It wraps a standard `EventTarget` and exposes a small typed API for
|
|
11
|
+
* emitting custom events and subscribing to them with cleanup support.
|
|
12
|
+
*/
|
|
13
|
+
var ShinkomBus = class {
|
|
14
|
+
#customEventTarget = new EventTarget();
|
|
15
|
+
/**
|
|
16
|
+
* Emits an event to the event bus.
|
|
17
|
+
*
|
|
18
|
+
* @param {string} event
|
|
19
|
+
* @param {object | undefined} detail
|
|
20
|
+
*/
|
|
21
|
+
emit(event, detail = void 0) {
|
|
22
|
+
this.#customEventTarget.dispatchEvent(new CustomEvent(event, detail));
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Registers a listener on the event bus.
|
|
26
|
+
*
|
|
27
|
+
* The returned cleanup function removes the listener so callers can stop
|
|
28
|
+
* receiving events and avoid leaking handlers when the listener is no
|
|
29
|
+
* longer needed.
|
|
30
|
+
*
|
|
31
|
+
* @param {keyof ShinkomEventMap} eventName
|
|
32
|
+
* @param {Function} cb
|
|
33
|
+
* @returns {() => void} cleanup function
|
|
34
|
+
*/
|
|
35
|
+
on(eventName, cb) {
|
|
36
|
+
/**@type {ShinkomEventListener} */
|
|
37
|
+
const wrapper = (e) => cb(e.detail);
|
|
38
|
+
this.#customEventTarget.addEventListener(eventName, wrapper);
|
|
39
|
+
return () => this.#customEventTarget.removeEventListener(eventName, wrapper);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
//#endregion
|
|
43
|
+
exports.ShinkomBus = ShinkomBus;
|
|
@@ -1 +1,41 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/core/helpers.js
|
|
2
|
+
/**
|
|
3
|
+
* Get the resolved module path as a string or URL.
|
|
4
|
+
* @param {string} modulePath
|
|
5
|
+
* @returns {Promise<string | URL>} module path
|
|
6
|
+
*/
|
|
7
|
+
const getModulePath = async (modulePath) => {
|
|
8
|
+
const path = await import("node:url");
|
|
9
|
+
const module = await import("node:module");
|
|
10
|
+
try {
|
|
11
|
+
return module.createRequire({}.url).resolve(modulePath);
|
|
12
|
+
} catch (_error) {
|
|
13
|
+
return path.pathToFileURL(require.resolve(modulePath));
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Splits a version string into parts.
|
|
18
|
+
* @param {string} version
|
|
19
|
+
* @returns {number[]} version number in parts
|
|
20
|
+
*/
|
|
21
|
+
function versionToParts(version) {
|
|
22
|
+
return version.replace(/^v/, "").split(".").map(Number);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Creates a CSSStyleSheet and applies styles to it.
|
|
26
|
+
* @param {CSSStyleSheet | null} cache
|
|
27
|
+
* @param {string} styles
|
|
28
|
+
* @returns {CSSStyleSheet | null} A CSS stylesheet
|
|
29
|
+
*/
|
|
30
|
+
function getStyleSheet(cache, styles) {
|
|
31
|
+
if (typeof window === "undefined") return null;
|
|
32
|
+
if (!cache) {
|
|
33
|
+
cache = new CSSStyleSheet();
|
|
34
|
+
cache.replaceSync(styles);
|
|
35
|
+
}
|
|
36
|
+
return cache;
|
|
37
|
+
}
|
|
38
|
+
//#endregion
|
|
39
|
+
exports.getModulePath = getModulePath;
|
|
40
|
+
exports.getStyleSheet = getStyleSheet;
|
|
41
|
+
exports.versionToParts = versionToParts;
|
|
@@ -1 +1,16 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_core_event_bus = require("./event-bus.cjs");
|
|
3
|
+
const require_core_constants = require("./constants.cjs");
|
|
4
|
+
const require_core_state_service = require("./state-service.cjs");
|
|
5
|
+
const require_core_ui_component = require("./ui-component.cjs");
|
|
6
|
+
const require_core_elements_compat_view_element = require("./elements/compat-view-element.cjs");
|
|
7
|
+
const require_core_elements_control_panel_element = require("./elements/control-panel-element.cjs");
|
|
8
|
+
const require_core_elements_inspector_element = require("./elements/inspector-element.cjs");
|
|
9
|
+
require("./elements/index.cjs");
|
|
10
|
+
exports.CompatControlPanelElement = require_core_elements_control_panel_element.CompatControlPanelElement;
|
|
11
|
+
exports.CompatInspectorElement = require_core_elements_inspector_element.CompatInspectorElement;
|
|
12
|
+
exports.CompatViewElement = require_core_elements_compat_view_element.CompatViewElement;
|
|
13
|
+
exports.DEFAULT_STATE = require_core_constants.DEFAULT_STATE;
|
|
14
|
+
exports.ShinkomBus = require_core_event_bus.ShinkomBus;
|
|
15
|
+
exports.ShinkomState = require_core_state_service.ShinkomState;
|
|
16
|
+
exports.UIComponent = require_core_ui_component.UIComponent;
|
|
@@ -1 +1,74 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_core_constants = require("./constants.cjs");
|
|
3
|
+
//#region src/core/state-service.js
|
|
4
|
+
/**@typedef {import('../types/public').UISharedState} UISharedState */
|
|
5
|
+
/**@typedef {import('../types/public').UISharedStateProps} UISharedStateProps */
|
|
6
|
+
/**
|
|
7
|
+
* ShinkomState provides shared UI state management for the application.
|
|
8
|
+
*
|
|
9
|
+
* It wraps a proxied state object and notifies subscribed listeners whenever
|
|
10
|
+
* a state property changes. Components can subscribe to update events and
|
|
11
|
+
* access the reactive state through `getState()`.
|
|
12
|
+
*/
|
|
13
|
+
var ShinkomState = class {
|
|
14
|
+
/**@type {UISharedState}*/
|
|
15
|
+
#state;
|
|
16
|
+
/**@type {function[]} */
|
|
17
|
+
#listeners = [];
|
|
18
|
+
/**
|
|
19
|
+
* Initializes the shared state service.
|
|
20
|
+
*
|
|
21
|
+
* The returned state object is proxied so that property assignments
|
|
22
|
+
* automatically notify listeners when values change.
|
|
23
|
+
*
|
|
24
|
+
* @param {UISharedState} initalState
|
|
25
|
+
*/
|
|
26
|
+
constructor(initalState = require_core_constants.DEFAULT_STATE) {
|
|
27
|
+
const notify = (prop, val) => {
|
|
28
|
+
this.#listeners.forEach((fn) => fn(prop, val));
|
|
29
|
+
};
|
|
30
|
+
this.#state = new Proxy(initalState, {
|
|
31
|
+
get(obj, prop) {
|
|
32
|
+
return obj[prop];
|
|
33
|
+
},
|
|
34
|
+
set(obj, prop, val) {
|
|
35
|
+
if (obj[prop] === val) return true;
|
|
36
|
+
notify(prop, val);
|
|
37
|
+
/**@type {any} */ obj[prop] = val;
|
|
38
|
+
console.log(`Setting ${prop} -> ${val}`);
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* @callback Listener
|
|
45
|
+
* @param {UISharedStateProps} prop
|
|
46
|
+
* @param {any} val
|
|
47
|
+
*/
|
|
48
|
+
/**
|
|
49
|
+
* Subscribes a listener to state change notifications.
|
|
50
|
+
*
|
|
51
|
+
* When any property on the shared state changes, the callback receives the
|
|
52
|
+
* changed property and its new value.
|
|
53
|
+
*
|
|
54
|
+
* @param {Listener} callback
|
|
55
|
+
* @returns {() => void} cleanup function
|
|
56
|
+
*/
|
|
57
|
+
subscribe(callback) {
|
|
58
|
+
this.#listeners.push(callback);
|
|
59
|
+
return () => {
|
|
60
|
+
this.#listeners = this.#listeners.filter((fn) => fn !== callback);
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Returns the proxied shared state object.
|
|
65
|
+
*
|
|
66
|
+
* Callers can read and write state properties directly, and writes will
|
|
67
|
+
* trigger listener notifications when values change.
|
|
68
|
+
*
|
|
69
|
+
* @returns {UISharedState}
|
|
70
|
+
*/
|
|
71
|
+
getState = () => this.#state;
|
|
72
|
+
};
|
|
73
|
+
//#endregion
|
|
74
|
+
exports.ShinkomState = ShinkomState;
|
|
@@ -1 +1,65 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
//#region src/core/ui-component.js
|
|
3
|
+
/**
|
|
4
|
+
* Base UI component class for Shinkom UI modules.
|
|
5
|
+
*
|
|
6
|
+
* UIComponent is abstract and provides shared integration with the Shinkom
|
|
7
|
+
* event bus and shared state service. Subclasses must implement lifecycle
|
|
8
|
+
* methods for mounting, unmounting, binding state, and responding to state
|
|
9
|
+
* changes.
|
|
10
|
+
*/
|
|
11
|
+
var UIComponent = class UIComponent {
|
|
12
|
+
/**
|
|
13
|
+
* @param {ShinkomBus} bus
|
|
14
|
+
* @param {ShinkomState} stateService
|
|
15
|
+
*/
|
|
16
|
+
constructor(bus, stateService) {
|
|
17
|
+
if (this.constructor === UIComponent) throw new Error("UIComponent is an abstract class and cannot be instantiated.");
|
|
18
|
+
this.bus = bus;
|
|
19
|
+
this.stateService = stateService;
|
|
20
|
+
stateService.subscribe((prop, val) => {
|
|
21
|
+
this.onStateChange(prop, val);
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Mounts the component into the DOM.
|
|
26
|
+
*
|
|
27
|
+
* Subclasses must implement this method to create and attach their UI.
|
|
28
|
+
*/
|
|
29
|
+
mount() {
|
|
30
|
+
throw new Error("mount() method must be implemented.");
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Unmounts the component from the DOM.
|
|
34
|
+
*
|
|
35
|
+
* Subclasses must implement this method to remove their UI and cleanup.
|
|
36
|
+
*/
|
|
37
|
+
unmount() {
|
|
38
|
+
throw new Error("unmount() method must be implemented.");
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Binds shared UI state to the component instance.
|
|
42
|
+
*
|
|
43
|
+
* Implementations should store the bound state reference and apply any
|
|
44
|
+
* initial state values needed by the component.
|
|
45
|
+
*
|
|
46
|
+
* @param {UISharedState} _state
|
|
47
|
+
*/
|
|
48
|
+
bindState(_state) {
|
|
49
|
+
throw new Error("bindState() method must be implemented.");
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Called when a shared state property changes.
|
|
53
|
+
*
|
|
54
|
+
* Components should override this to react to updates from the shared state
|
|
55
|
+
* service.
|
|
56
|
+
*
|
|
57
|
+
* @param {UISharedStateProps} _prop
|
|
58
|
+
* @param {any} _val
|
|
59
|
+
*/
|
|
60
|
+
onStateChange(_prop, _val) {
|
|
61
|
+
throw new Error("onStateChange() method must be implemented.");
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
//#endregion
|
|
65
|
+
exports.UIComponent = UIComponent;
|