slicejs-web-framework 3.3.7 → 3.4.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.
@@ -1,420 +1,470 @@
1
- /**
2
- * ContextManager debug panel.
3
- */
4
- export default class ContextManagerDebugger extends HTMLElement {
5
- constructor() {
6
- super();
7
- this.isOpen = false;
8
- this.filterText = '';
9
- }
10
-
11
- /**
12
- * Initialize panel UI.
13
- * @returns {Promise<void>}
14
- */
15
- async init() {
16
- this.innerHTML = this.renderTemplate();
17
- slice.stylesManager.registerComponentStyles('ContextManagerDebugger', this.renderStyles());
18
- this.cacheElements();
19
- this.bindEvents();
20
- this.makeDraggable();
21
- this.renderList();
22
- }
23
-
24
- /**
25
- * Toggle panel visibility.
26
- * @returns {void}
27
- */
28
- toggle() {
29
- this.isOpen = !this.isOpen;
30
- this.container.classList.toggle('active', this.isOpen);
31
- if (this.isOpen) {
32
- this.renderList();
33
- }
34
- }
35
-
36
- /**
37
- * Show panel.
38
- * @returns {void}
39
- */
40
- open() {
41
- this.isOpen = true;
42
- this.container.classList.add('active');
43
- this.renderList();
44
- }
45
-
46
- /**
47
- * Hide panel.
48
- * @returns {void}
49
- */
50
- close() {
51
- this.isOpen = false;
52
- this.container.classList.remove('active');
53
- }
54
-
55
- cacheElements() {
56
- this.container = this.querySelector('#context-debugger');
57
- this.header = this.querySelector('.context-header');
58
- this.list = this.querySelector('#context-list');
59
- this.filterInput = this.querySelector('#context-filter');
60
- this.countLabel = this.querySelector('#context-count');
61
- this.refreshButton = this.querySelector('#context-refresh');
62
- this.closeButton = this.querySelector('#context-close');
63
- }
64
-
65
- bindEvents() {
66
- this.refreshButton.addEventListener('click', () => this.renderList());
67
- this.closeButton.addEventListener('click', () => this.close());
68
- this.filterInput.addEventListener('input', (event) => {
69
- this.filterText = event.target.value.trim().toLowerCase();
70
- this.renderList();
71
- });
72
- }
73
-
74
- makeDraggable() {
75
- if (!this.header || !this.container) return;
76
-
77
- let offset = { x: 0, y: 0 };
78
- let isDragging = false;
79
-
80
- this.header.style.cursor = 'grab';
81
-
82
- this.header.addEventListener('mousedown', (event) => {
83
- if (event.target.closest('.btn')) return;
84
- isDragging = true;
85
- offset.x = event.clientX - this.container.getBoundingClientRect().left;
86
- offset.y = event.clientY - this.container.getBoundingClientRect().top;
87
- this.header.style.cursor = 'grabbing';
88
- });
89
-
90
- document.addEventListener('mousemove', (event) => {
91
- if (!isDragging) return;
92
- const rect = this.container.getBoundingClientRect();
93
- const maxX = window.innerWidth - rect.width;
94
- const maxY = window.innerHeight - rect.height;
95
- const x = Math.min(Math.max(event.clientX - offset.x, 0), maxX);
96
- const y = Math.min(Math.max(event.clientY - offset.y, 0), maxY);
97
- this.container.style.left = `${x}px`;
98
- this.container.style.top = `${y}px`;
99
- this.container.style.right = 'auto';
100
- this.container.style.bottom = 'auto';
101
- });
102
-
103
- document.addEventListener('mouseup', () => {
104
- if (!isDragging) return;
105
- isDragging = false;
106
- this.header.style.cursor = 'grab';
107
- });
108
- }
109
-
110
- renderList() {
111
- if (!slice?.context?.contexts) {
112
- this.list.textContent = 'ContextManager not available.';
113
- this.countLabel.textContent = '0';
114
- return;
115
- }
116
-
117
- const items = [];
118
- slice.context.contexts.forEach((value, name) => {
119
- if (this.filterText && !name.toLowerCase().includes(this.filterText)) {
120
- return;
121
- }
122
- const keys = value?.state ? Object.keys(value.state).length : 0;
123
- items.push({ name, keys, state: value?.state || {} });
124
- });
125
-
126
- items.sort((a, b) => a.name.localeCompare(b.name));
127
-
128
- this.countLabel.textContent = String(items.length);
129
- this.list.innerHTML = items.length
130
- ? items.map((item) => {
131
- const preview = JSON.stringify(item.state, null, 2);
132
- return `
133
- <div class="context-row">
134
- <div class="context-row-head">
135
- <div class="context-name">${item.name}</div>
136
- <div class="context-keys">${item.keys} keys</div>
137
- </div>
138
- <pre class="context-preview">${this.escapeHtml(preview)}</pre>
139
- </div>
140
- `;
141
- }).join('')
142
- : '<div class="empty">No contexts</div>';
143
- }
144
-
145
- escapeHtml(value) {
146
- return value
147
- .replace(/&/g, '&amp;')
148
- .replace(/</g, '&lt;')
149
- .replace(/>/g, '&gt;')
150
- .replace(/"/g, '&quot;')
151
- .replace(/'/g, '&#39;');
152
- }
153
-
154
- renderTemplate() {
155
- return `
156
- <div id="context-debugger">
157
- <div class="context-header">
158
- <div class="brand">
159
- <span class="status-dot"></span>
160
- <span class="glyph">◈</span>
161
- <span class="title">CONTEXT</span>
162
- </div>
163
- <div class="actions">
164
- <button id="context-refresh" class="btn" title="Refresh" aria-label="Refresh">⟳</button>
165
- <button id="context-close" class="btn" title="Close" aria-label="Close">✕</button>
166
- </div>
167
- </div>
168
- <div class="context-toolbar">
169
- <input id="context-filter" type="text" placeholder="filter contexts…" autocomplete="off" spellcheck="false" />
170
- <div class="count"><span id="context-count">0</span></div>
171
- </div>
172
- <div class="context-list" id="context-list"></div>
173
- </div>
174
- `;
175
- }
176
-
177
- renderStyles() {
178
- return `
179
- /* Slice Instruments — context store. All selectors scoped to the
180
- <slice-contextmanager-debugger> tag so nothing clashes with app styles. */
181
- slice-contextmanager-debugger {
182
- --si-accent: var(--primary-color, #6ee7ff);
183
- --si-accent-rgb: var(--primary-color-rgb, 110, 231, 255);
184
- --si-surface: rgba(17, 19, 28, 0.86);
185
- --si-raised: rgba(255, 255, 255, 0.035);
186
- --si-raised-2: rgba(255, 255, 255, 0.06);
187
- --si-border: rgba(255, 255, 255, 0.09);
188
- --si-text: #e8eaf2;
189
- --si-dim: #888fa6;
190
- --si-mono: ui-monospace, 'SF Mono', 'JetBrains Mono', 'Cascadia Code', Menlo, Consolas, monospace;
191
- }
192
-
193
- slice-contextmanager-debugger #context-debugger {
194
- position: fixed;
195
- bottom: 20px;
196
- left: 20px;
197
- width: min(400px, calc(100vw - 40px));
198
- max-height: 64vh;
199
- background: var(--si-surface);
200
- border: 1px solid var(--si-border);
201
- border-radius: 14px;
202
- box-shadow:
203
- 0 24px 60px -12px rgba(0, 0, 0, 0.55),
204
- 0 0 0 1px rgba(0, 0, 0, 0.2),
205
- 0 0 38px -18px rgba(var(--si-accent-rgb), 0.55);
206
- -webkit-backdrop-filter: blur(22px) saturate(1.3);
207
- backdrop-filter: blur(22px) saturate(1.3);
208
- display: none;
209
- flex-direction: column;
210
- z-index: 10001;
211
- overflow: hidden;
212
- color: var(--si-text);
213
- font-family: var(--si-mono);
214
- }
215
-
216
- slice-contextmanager-debugger #context-debugger.active {
217
- display: flex;
218
- animation: si-context-in 0.26s cubic-bezier(0.16, 1, 0.3, 1);
219
- }
220
-
221
- @keyframes si-context-in {
222
- from { opacity: 0; transform: translateY(10px) scale(0.985); }
223
- to { opacity: 1; transform: translateY(0) scale(1); }
224
- }
225
-
226
- slice-contextmanager-debugger #context-debugger * { box-sizing: border-box; }
227
-
228
- slice-contextmanager-debugger #context-debugger::before {
229
- content: '';
230
- position: absolute;
231
- left: 0; top: 0; bottom: 0;
232
- width: 2px;
233
- background: linear-gradient(180deg, var(--si-accent), transparent 70%);
234
- opacity: 0.85;
235
- pointer-events: none;
236
- }
237
-
238
- slice-contextmanager-debugger #context-debugger > .context-header {
239
- display: flex;
240
- justify-content: space-between;
241
- align-items: center;
242
- padding: 12px 14px;
243
- background:
244
- radial-gradient(120% 140% at 0% 0%, rgba(var(--si-accent-rgb), 0.10), transparent 60%),
245
- var(--si-raised);
246
- border-bottom: 1px solid var(--si-border);
247
- user-select: none;
248
- }
249
-
250
- slice-contextmanager-debugger .brand { display: flex; align-items: center; gap: 9px; }
251
-
252
- slice-contextmanager-debugger .status-dot {
253
- width: 7px; height: 7px;
254
- border-radius: 50%;
255
- background: var(--si-accent);
256
- animation: si-pulse-ctx 2.4s ease-out infinite;
257
- }
258
-
259
- @keyframes si-pulse-ctx {
260
- 0% { box-shadow: 0 0 0 0 rgba(var(--si-accent-rgb), 0.55); }
261
- 70% { box-shadow: 0 0 0 7px rgba(var(--si-accent-rgb), 0); }
262
- 100% { box-shadow: 0 0 0 0 rgba(var(--si-accent-rgb), 0); }
263
- }
264
-
265
- slice-contextmanager-debugger .glyph { color: var(--si-accent); font-size: 12px; opacity: 0.9; }
266
-
267
- slice-contextmanager-debugger .title {
268
- font-weight: 600;
269
- font-size: 11px;
270
- letter-spacing: 0.18em;
271
- color: var(--si-text);
272
- }
273
-
274
- slice-contextmanager-debugger .actions { display: flex; gap: 6px; }
275
-
276
- slice-contextmanager-debugger .btn {
277
- width: 26px; height: 26px;
278
- display: flex; align-items: center; justify-content: center;
279
- border-radius: 7px;
280
- border: 1px solid var(--si-border);
281
- background: var(--si-raised);
282
- color: var(--si-dim);
283
- cursor: pointer;
284
- font-size: 13px;
285
- line-height: 1;
286
- transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
287
- }
288
- slice-contextmanager-debugger .btn:hover {
289
- color: var(--si-text);
290
- background: var(--si-raised-2);
291
- border-color: rgba(var(--si-accent-rgb), 0.5);
292
- }
293
- slice-contextmanager-debugger .btn:active { transform: scale(0.92); }
294
- slice-contextmanager-debugger #context-refresh:hover { color: var(--si-accent); }
295
-
296
- slice-contextmanager-debugger .context-toolbar {
297
- display: flex;
298
- gap: 10px;
299
- align-items: center;
300
- padding: 10px 12px;
301
- border-bottom: 1px solid var(--si-border);
302
- }
303
-
304
- slice-contextmanager-debugger .context-toolbar input {
305
- flex: 1;
306
- min-width: 0;
307
- padding: 7px 10px 7px 30px;
308
- border-radius: 8px;
309
- border: 1px solid var(--si-border);
310
- background:
311
- var(--si-raised) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='13' height='13' viewBox='0 0 24 24' fill='none' stroke='%23888fa6' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E") no-repeat 10px center;
312
- color: var(--si-text);
313
- font-family: var(--si-mono);
314
- font-size: 12px;
315
- transition: border-color 0.15s ease, box-shadow 0.15s ease;
316
- }
317
- slice-contextmanager-debugger .context-toolbar input::placeholder { color: var(--si-dim); }
318
- slice-contextmanager-debugger .context-toolbar input:focus {
319
- outline: none;
320
- border-color: rgba(var(--si-accent-rgb), 0.6);
321
- box-shadow: 0 0 0 3px rgba(var(--si-accent-rgb), 0.12);
322
- }
323
-
324
- slice-contextmanager-debugger .context-toolbar .count { font-size: 11px; color: var(--si-dim); min-width: 22px; text-align: center; }
325
- slice-contextmanager-debugger .context-toolbar .count span { color: var(--si-accent); font-weight: 600; }
326
-
327
- slice-contextmanager-debugger .context-list {
328
- padding: 10px 12px 12px;
329
- overflow: auto;
330
- display: flex;
331
- flex-direction: column;
332
- gap: 9px;
333
- }
334
- slice-contextmanager-debugger .context-list::-webkit-scrollbar { width: 8px; }
335
- slice-contextmanager-debugger .context-list::-webkit-scrollbar-thumb {
336
- background: var(--si-raised-2);
337
- border-radius: 8px;
338
- border: 2px solid transparent;
339
- background-clip: padding-box;
340
- }
341
- slice-contextmanager-debugger .context-list::-webkit-scrollbar-thumb:hover { background: rgba(var(--si-accent-rgb), 0.4); background-clip: padding-box; }
342
-
343
- slice-contextmanager-debugger .context-row {
344
- border: 1px solid var(--si-border);
345
- border-left: 2px solid transparent;
346
- border-radius: 10px;
347
- background: var(--si-raised);
348
- padding: 10px 11px;
349
- display: flex;
350
- flex-direction: column;
351
- gap: 8px;
352
- transition: border-color 0.18s ease, background 0.18s ease;
353
- }
354
- slice-contextmanager-debugger .context-row:hover { background: var(--si-raised-2); border-left-color: var(--si-accent); }
355
-
356
- slice-contextmanager-debugger .context-row-head {
357
- display: flex;
358
- align-items: center;
359
- justify-content: space-between;
360
- gap: 10px;
361
- }
362
-
363
- slice-contextmanager-debugger .context-name {
364
- font-weight: 600;
365
- font-size: 12.5px;
366
- color: var(--si-text);
367
- font-family: var(--si-mono);
368
- }
369
-
370
- slice-contextmanager-debugger .context-keys {
371
- font-size: 10px;
372
- letter-spacing: 0.04em;
373
- text-transform: uppercase;
374
- color: var(--si-accent);
375
- background: rgba(var(--si-accent-rgb), 0.12);
376
- border: 1px solid rgba(var(--si-accent-rgb), 0.25);
377
- padding: 1px 8px;
378
- border-radius: 999px;
379
- white-space: nowrap;
380
- }
381
-
382
- slice-contextmanager-debugger .context-preview {
383
- background: rgba(0, 0, 0, 0.3);
384
- border-radius: 8px;
385
- padding: 10px;
386
- border: 1px solid var(--si-border);
387
- max-height: 200px;
388
- overflow: auto;
389
- font-size: 11px;
390
- line-height: 1.55;
391
- font-family: var(--si-mono);
392
- color: #c5cad8;
393
- white-space: pre;
394
- margin: 0;
395
- }
396
- slice-contextmanager-debugger .context-preview::-webkit-scrollbar { width: 8px; height: 8px; }
397
- slice-contextmanager-debugger .context-preview::-webkit-scrollbar-thumb {
398
- background: var(--si-raised-2);
399
- border-radius: 8px;
400
- border: 2px solid transparent;
401
- background-clip: padding-box;
402
- }
403
-
404
- slice-contextmanager-debugger .empty {
405
- color: var(--si-dim);
406
- font-size: 11px;
407
- letter-spacing: 0.04em;
408
- text-align: center;
409
- padding: 22px 0;
410
- }
411
-
412
- @media (prefers-reduced-motion: reduce) {
413
- slice-contextmanager-debugger #context-debugger.active { animation: none; }
414
- slice-contextmanager-debugger .status-dot { animation: none; }
415
- }
416
- `;
417
- }
418
- }
419
-
420
- customElements.define('slice-contextmanager-debugger', ContextManagerDebugger);
1
+ /**
2
+ * ContextManager debug panel.
3
+ */
4
+ export default class ContextManagerDebugger extends HTMLElement {
5
+ constructor() {
6
+ super();
7
+ this.isOpen = false;
8
+ this.filterText = '';
9
+ this._contextSubscriptions = new Map();
10
+ this._debounceTimer = null;
11
+ }
12
+
13
+ /**
14
+ * Initialize panel UI.
15
+ * @returns {Promise<void>}
16
+ */
17
+ async init() {
18
+ this.innerHTML = this.renderTemplate();
19
+ slice.stylesManager.registerComponentStyles('ContextManagerDebugger', this.renderStyles());
20
+ this.cacheElements();
21
+ this.bindEvents();
22
+ this.makeDraggable();
23
+ this._subscribeToAllContexts();
24
+ this.renderList();
25
+ }
26
+
27
+ /**
28
+ * Toggle panel visibility.
29
+ * @returns {void}
30
+ */
31
+ toggle() {
32
+ this.isOpen = !this.isOpen;
33
+ this.container.classList.toggle('active', this.isOpen);
34
+ if (this.isOpen) {
35
+ this._subscribeToAllContexts();
36
+ this.renderList();
37
+ }
38
+ }
39
+
40
+ /**
41
+ * Show panel.
42
+ * @returns {void}
43
+ */
44
+ open() {
45
+ this.isOpen = true;
46
+ this.container.classList.add('active');
47
+ this._subscribeToAllContexts();
48
+ this.renderList();
49
+ }
50
+
51
+ /**
52
+ * Hide panel.
53
+ * @returns {void}
54
+ */
55
+ close() {
56
+ this.isOpen = false;
57
+ this.container.classList.remove('active');
58
+ }
59
+
60
+ disconnectedCallback() {
61
+ this._unsubscribeAll();
62
+ }
63
+
64
+ _unsubscribeAll() {
65
+ for (const [name, id] of this._contextSubscriptions) {
66
+ slice.events.unsubscribe(`context:${name}`, id);
67
+ }
68
+ this._contextSubscriptions.clear();
69
+ if (this._createdSub) {
70
+ slice.events.unsubscribe('context:__created', this._createdSub);
71
+ this._createdSub = null;
72
+ }
73
+ }
74
+
75
+ _subscribeToAllContexts() {
76
+ if (!slice?.context?.contexts) return;
77
+ slice.context.contexts.forEach((value, name) => {
78
+ if (this._contextSubscriptions.has(name)) return;
79
+ const id = slice.events.subscribe(`context:${name}`, () => this._scheduleRender());
80
+ this._contextSubscriptions.set(name, id);
81
+ });
82
+ if (!this._createdSub) {
83
+ this._createdSub = slice.events.subscribe('context:__created', ({ name }) => {
84
+ if (!this._contextSubscriptions.has(name)) {
85
+ const id = slice.events.subscribe(`context:${name}`, () => this._scheduleRender());
86
+ this._contextSubscriptions.set(name, id);
87
+ }
88
+ this._scheduleRender();
89
+ });
90
+ }
91
+ }
92
+
93
+ _scheduleRender() {
94
+ if (this._debounceTimer) clearTimeout(this._debounceTimer);
95
+ this._debounceTimer = setTimeout(() => {
96
+ if (this.isOpen) this.renderList();
97
+ }, 50);
98
+ }
99
+
100
+ cacheElements() {
101
+ this.container = this.querySelector('#context-debugger');
102
+ this.header = this.querySelector('.context-header');
103
+ this.list = this.querySelector('#context-list');
104
+ this.filterInput = this.querySelector('#context-filter');
105
+ this.countLabel = this.querySelector('#context-count');
106
+ this.refreshButton = this.querySelector('#context-refresh');
107
+ this.closeButton = this.querySelector('#context-close');
108
+ }
109
+
110
+ bindEvents() {
111
+ this.refreshButton.addEventListener('click', () => this.renderList());
112
+ this.closeButton.addEventListener('click', () => this.close());
113
+ this.filterInput.addEventListener('input', (event) => {
114
+ this.filterText = event.target.value.trim().toLowerCase();
115
+ this.renderList();
116
+ });
117
+ }
118
+
119
+ makeDraggable() {
120
+ if (!this.header || !this.container) return;
121
+
122
+ let offset = { x: 0, y: 0 };
123
+ let isDragging = false;
124
+
125
+ this.header.style.cursor = 'grab';
126
+
127
+ this.header.addEventListener('mousedown', (event) => {
128
+ if (event.target.closest('.btn')) return;
129
+ isDragging = true;
130
+ offset.x = event.clientX - this.container.getBoundingClientRect().left;
131
+ offset.y = event.clientY - this.container.getBoundingClientRect().top;
132
+ this.header.style.cursor = 'grabbing';
133
+ });
134
+
135
+ document.addEventListener('mousemove', (event) => {
136
+ if (!isDragging) return;
137
+ const rect = this.container.getBoundingClientRect();
138
+ const maxX = window.innerWidth - rect.width;
139
+ const maxY = window.innerHeight - rect.height;
140
+ const x = Math.min(Math.max(event.clientX - offset.x, 0), maxX);
141
+ const y = Math.min(Math.max(event.clientY - offset.y, 0), maxY);
142
+ this.container.style.left = `${x}px`;
143
+ this.container.style.top = `${y}px`;
144
+ this.container.style.right = 'auto';
145
+ this.container.style.bottom = 'auto';
146
+ });
147
+
148
+ document.addEventListener('mouseup', () => {
149
+ if (!isDragging) return;
150
+ isDragging = false;
151
+ this.header.style.cursor = 'grab';
152
+ });
153
+ }
154
+
155
+ renderList() {
156
+ if (!slice?.context?.contexts) {
157
+ this.list.textContent = 'ContextManager not available.';
158
+ this.countLabel.textContent = '0';
159
+ return;
160
+ }
161
+
162
+ const items = [];
163
+ slice.context.contexts.forEach((value, name) => {
164
+ if (this.filterText && !name.toLowerCase().includes(this.filterText)) {
165
+ return;
166
+ }
167
+ const keys = value?.state ? Object.keys(value.state).length : 0;
168
+ items.push({ name, keys, state: value?.state || {} });
169
+ });
170
+
171
+ items.sort((a, b) => a.name.localeCompare(b.name));
172
+
173
+ this.countLabel.textContent = String(items.length);
174
+ this.list.innerHTML = items.length
175
+ ? items.map((item) => {
176
+ let preview;
177
+ try { preview = JSON.stringify(item.state, null, 2); } catch { preview = String(item.state); }
178
+ return `
179
+ <div class="context-row">
180
+ <div class="context-row-head">
181
+ <div class="context-name">${item.name}</div>
182
+ <div class="context-keys">${item.keys} keys</div>
183
+ </div>
184
+ <pre class="context-preview">${this.escapeHtml(preview)}</pre>
185
+ </div>
186
+ `;
187
+ }).join('')
188
+ : '<div class="empty">No contexts</div>';
189
+ }
190
+
191
+ escapeHtml(value) {
192
+ return value
193
+ .replace(/&/g, '&amp;')
194
+ .replace(/</g, '&lt;')
195
+ .replace(/>/g, '&gt;')
196
+ .replace(/"/g, '&quot;')
197
+ .replace(/'/g, '&#39;');
198
+ }
199
+
200
+ renderTemplate() {
201
+ return `
202
+ <div id="context-debugger">
203
+ <div class="context-header">
204
+ <div class="brand">
205
+ <span class="status-dot"></span>
206
+ <span class="glyph">◈</span>
207
+ <span class="title">CONTEXT</span>
208
+ </div>
209
+ <div class="actions">
210
+ <button id="context-refresh" class="btn" title="Refresh" aria-label="Refresh">⟳</button>
211
+ <button id="context-close" class="btn" title="Close" aria-label="Close">✕</button>
212
+ </div>
213
+ </div>
214
+ <div class="context-toolbar">
215
+ <input id="context-filter" type="text" placeholder="filter contexts…" autocomplete="off" spellcheck="false" />
216
+ <div class="count"><span id="context-count">0</span></div>
217
+ </div>
218
+ <div class="context-list" id="context-list"></div>
219
+ </div>
220
+ `;
221
+ }
222
+
223
+ renderStyles() {
224
+ return `
225
+ /* Slice Instruments — context store. All selectors scoped to the
226
+ <slice-contextmanager-debugger> tag so nothing clashes with app styles.
227
+ Every --si-* token reads the matching framework theme variable from
228
+ :root, falling back to the original hardcoded value if absent. */
229
+ slice-contextmanager-debugger {
230
+ --si-accent: var(--primary-color, #6ee7ff);
231
+ --si-accent-rgb: var(--primary-color-rgb, 110, 231, 255);
232
+ --si-surface: var(--primary-background-color, rgba(17, 19, 28, 0.86));
233
+ --si-raised: var(--secondary-background-color, rgba(255, 255, 255, 0.035));
234
+ --si-raised-2: var(--tertiary-background-color, rgba(255, 255, 255, 0.06));
235
+ --si-border: var(--medium-color, rgba(255, 255, 255, 0.09));
236
+ --si-text: var(--font-primary-color, #e8eaf2);
237
+ --si-dim: var(--font-secondary-color, #888fa6);
238
+ --si-danger: var(--danger-color, #ff6b6b);
239
+ --si-success: var(--success-color, #46d39a);
240
+ --si-mono: ui-monospace, 'SF Mono', 'JetBrains Mono', 'Cascadia Code', Menlo, Consolas, monospace;
241
+ }
242
+
243
+ slice-contextmanager-debugger #context-debugger {
244
+ position: fixed;
245
+ bottom: 20px;
246
+ left: 20px;
247
+ width: min(400px, calc(100vw - 40px));
248
+ max-height: 64vh;
249
+ background: var(--si-surface);
250
+ border: 1px solid var(--si-border);
251
+ border-radius: 14px;
252
+ box-shadow:
253
+ 0 24px 60px -12px rgba(0, 0, 0, 0.55),
254
+ 0 0 0 1px rgba(0, 0, 0, 0.2),
255
+ 0 0 38px -18px rgba(var(--si-accent-rgb), 0.55);
256
+ -webkit-backdrop-filter: blur(22px) saturate(1.3);
257
+ backdrop-filter: blur(22px) saturate(1.3);
258
+ display: none;
259
+ flex-direction: column;
260
+ z-index: 10001;
261
+ overflow: hidden;
262
+ color: var(--si-text);
263
+ font-family: var(--si-mono);
264
+ }
265
+
266
+ slice-contextmanager-debugger #context-debugger.active {
267
+ display: flex;
268
+ animation: si-context-in 0.26s cubic-bezier(0.16, 1, 0.3, 1);
269
+ }
270
+
271
+ @keyframes si-context-in {
272
+ from { opacity: 0; transform: translateY(10px) scale(0.985); }
273
+ to { opacity: 1; transform: translateY(0) scale(1); }
274
+ }
275
+
276
+ slice-contextmanager-debugger #context-debugger * { box-sizing: border-box; }
277
+
278
+ slice-contextmanager-debugger #context-debugger::before {
279
+ content: '';
280
+ position: absolute;
281
+ left: 0; top: 0; bottom: 0;
282
+ width: 2px;
283
+ background: linear-gradient(180deg, var(--si-accent), transparent 70%);
284
+ opacity: 0.85;
285
+ pointer-events: none;
286
+ }
287
+
288
+ slice-contextmanager-debugger #context-debugger > .context-header {
289
+ display: flex;
290
+ justify-content: space-between;
291
+ align-items: center;
292
+ padding: 12px 14px;
293
+ background:
294
+ radial-gradient(120% 140% at 0% 0%, rgba(var(--si-accent-rgb), 0.10), transparent 60%),
295
+ var(--si-raised);
296
+ border-bottom: 1px solid var(--si-border);
297
+ user-select: none;
298
+ }
299
+
300
+ slice-contextmanager-debugger .brand { display: flex; align-items: center; gap: 9px; }
301
+
302
+ slice-contextmanager-debugger .status-dot {
303
+ width: 7px; height: 7px;
304
+ border-radius: 50%;
305
+ background: var(--si-accent);
306
+ animation: si-pulse-ctx 2.4s ease-out infinite;
307
+ }
308
+
309
+ @keyframes si-pulse-ctx {
310
+ 0% { box-shadow: 0 0 0 0 rgba(var(--si-accent-rgb), 0.55); }
311
+ 70% { box-shadow: 0 0 0 7px rgba(var(--si-accent-rgb), 0); }
312
+ 100% { box-shadow: 0 0 0 0 rgba(var(--si-accent-rgb), 0); }
313
+ }
314
+
315
+ slice-contextmanager-debugger .glyph { color: var(--si-accent); font-size: 12px; opacity: 0.9; }
316
+
317
+ slice-contextmanager-debugger .title {
318
+ font-weight: 600;
319
+ font-size: 11px;
320
+ letter-spacing: 0.18em;
321
+ color: var(--si-text);
322
+ }
323
+
324
+ slice-contextmanager-debugger .actions { display: flex; gap: 6px; }
325
+
326
+ slice-contextmanager-debugger .btn {
327
+ width: 26px; height: 26px;
328
+ display: flex; align-items: center; justify-content: center;
329
+ border-radius: 7px;
330
+ border: 1px solid var(--si-border);
331
+ background: var(--si-raised);
332
+ color: var(--si-dim);
333
+ cursor: pointer;
334
+ font-size: 13px;
335
+ line-height: 1;
336
+ transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
337
+ }
338
+ slice-contextmanager-debugger .btn:hover {
339
+ color: var(--si-text);
340
+ background: var(--si-raised-2);
341
+ border-color: rgba(var(--si-accent-rgb), 0.5);
342
+ }
343
+ slice-contextmanager-debugger .btn:active { transform: scale(0.92); }
344
+ slice-contextmanager-debugger #context-refresh:hover { color: var(--si-accent); }
345
+
346
+ slice-contextmanager-debugger .context-toolbar {
347
+ display: flex;
348
+ gap: 10px;
349
+ align-items: center;
350
+ padding: 10px 12px;
351
+ border-bottom: 1px solid var(--si-border);
352
+ }
353
+
354
+ slice-contextmanager-debugger .context-toolbar input {
355
+ flex: 1;
356
+ min-width: 0;
357
+ padding: 7px 10px 7px 30px;
358
+ border-radius: 8px;
359
+ border: 1px solid var(--si-border);
360
+ background:
361
+ var(--si-raised) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='13' height='13' viewBox='0 0 24 24' fill='none' stroke='%23888fa6' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E") no-repeat 10px center;
362
+ color: var(--si-text);
363
+ font-family: var(--si-mono);
364
+ font-size: 12px;
365
+ transition: border-color 0.15s ease, box-shadow 0.15s ease;
366
+ }
367
+ slice-contextmanager-debugger .context-toolbar input::placeholder { color: var(--si-dim); }
368
+ slice-contextmanager-debugger .context-toolbar input:focus {
369
+ outline: none;
370
+ border-color: rgba(var(--si-accent-rgb), 0.6);
371
+ box-shadow: 0 0 0 3px rgba(var(--si-accent-rgb), 0.12);
372
+ }
373
+
374
+ slice-contextmanager-debugger .context-toolbar .count { font-size: 11px; color: var(--si-dim); min-width: 22px; text-align: center; }
375
+ slice-contextmanager-debugger .context-toolbar .count span { color: var(--si-accent); font-weight: 600; }
376
+
377
+ slice-contextmanager-debugger .context-list {
378
+ padding: 10px 12px 12px;
379
+ overflow: auto;
380
+ display: flex;
381
+ flex-direction: column;
382
+ gap: 9px;
383
+ }
384
+ slice-contextmanager-debugger .context-list::-webkit-scrollbar { width: 8px; }
385
+ slice-contextmanager-debugger .context-list::-webkit-scrollbar-thumb {
386
+ background: var(--si-raised-2);
387
+ border-radius: 8px;
388
+ border: 2px solid transparent;
389
+ background-clip: padding-box;
390
+ }
391
+ slice-contextmanager-debugger .context-list::-webkit-scrollbar-thumb:hover { background: rgba(var(--si-accent-rgb), 0.4); background-clip: padding-box; }
392
+
393
+ slice-contextmanager-debugger .context-row {
394
+ border: 1px solid var(--si-border);
395
+ border-left: 2px solid transparent;
396
+ border-radius: 10px;
397
+ background: var(--si-raised);
398
+ padding: 10px 11px;
399
+ display: flex;
400
+ flex-direction: column;
401
+ gap: 8px;
402
+ transition: border-color 0.18s ease, background 0.18s ease;
403
+ }
404
+ slice-contextmanager-debugger .context-row:hover { background: var(--si-raised-2); border-left-color: var(--si-accent); }
405
+
406
+ slice-contextmanager-debugger .context-row-head {
407
+ display: flex;
408
+ align-items: center;
409
+ justify-content: space-between;
410
+ gap: 10px;
411
+ }
412
+
413
+ slice-contextmanager-debugger .context-name {
414
+ font-weight: 600;
415
+ font-size: 12.5px;
416
+ color: var(--si-text);
417
+ font-family: var(--si-mono);
418
+ }
419
+
420
+ slice-contextmanager-debugger .context-keys {
421
+ font-size: 10px;
422
+ letter-spacing: 0.04em;
423
+ text-transform: uppercase;
424
+ color: var(--si-accent);
425
+ background: rgba(var(--si-accent-rgb), 0.12);
426
+ border: 1px solid rgba(var(--si-accent-rgb), 0.25);
427
+ padding: 1px 8px;
428
+ border-radius: 999px;
429
+ white-space: nowrap;
430
+ }
431
+
432
+ slice-contextmanager-debugger .context-preview {
433
+ background: rgba(0, 0, 0, 0.3);
434
+ border-radius: 8px;
435
+ padding: 10px;
436
+ border: 1px solid var(--si-border);
437
+ max-height: 200px;
438
+ overflow: auto;
439
+ font-size: 11px;
440
+ line-height: 1.55;
441
+ font-family: var(--si-mono);
442
+ color: #c5cad8;
443
+ white-space: pre;
444
+ margin: 0;
445
+ }
446
+ slice-contextmanager-debugger .context-preview::-webkit-scrollbar { width: 8px; height: 8px; }
447
+ slice-contextmanager-debugger .context-preview::-webkit-scrollbar-thumb {
448
+ background: var(--si-raised-2);
449
+ border-radius: 8px;
450
+ border: 2px solid transparent;
451
+ background-clip: padding-box;
452
+ }
453
+
454
+ slice-contextmanager-debugger .empty {
455
+ color: var(--si-dim);
456
+ font-size: 11px;
457
+ letter-spacing: 0.04em;
458
+ text-align: center;
459
+ padding: 22px 0;
460
+ }
461
+
462
+ @media (prefers-reduced-motion: reduce) {
463
+ slice-contextmanager-debugger #context-debugger.active { animation: none; }
464
+ slice-contextmanager-debugger .status-dot { animation: none; }
465
+ }
466
+ `;
467
+ }
468
+ }
469
+
470
+ customElements.define('slice-contextmanager-debugger', ContextManagerDebugger);