@nocturnium/svelte-ide 1.0.3 → 1.0.5
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/dist/components/ai/AIPanel.svelte +6 -1
- package/dist/components/ai/AIToolCallDisplay.svelte +1 -1
- package/dist/components/core/Avatar.svelte +14 -14
- package/dist/components/core/Badge.svelte +2 -2
- package/dist/components/core/Button.svelte +2 -2
- package/dist/components/editor/AIFocusLayer.svelte +3 -3
- package/dist/components/editor/CognitiveLoadMeter.svelte +15 -15
- package/dist/components/editor/CommandPalette.svelte +17 -17
- package/dist/components/editor/ComplexityLayer.svelte +6 -6
- package/dist/components/editor/ConflictZoneLayer.svelte +8 -8
- package/dist/components/editor/ContextLens.svelte +16 -10
- package/dist/components/editor/EchoCursorLayer.svelte +43 -11
- package/dist/components/editor/FileIcon.svelte +2 -1
- package/dist/components/editor/GhostBracketLayer.svelte +38 -25
- package/dist/components/editor/GitBlameLayer.svelte +8 -8
- package/dist/components/editor/InlineDiffLayer.svelte +12 -12
- package/dist/components/editor/PluginPreviewSandbox.svelte +21 -21
- package/dist/components/editor/SnippetPalette.svelte +21 -21
- package/dist/components/editor/StructureMap.svelte +47 -30
- package/dist/components/editor/TimelineScrubber.svelte +11 -11
- package/dist/components/editor/core/complexity-analyzer.d.ts +4 -0
- package/dist/components/editor/core/complexity-analyzer.js +45 -8
- package/dist/components/editor/core/diagnostics.js +4 -4
- package/dist/components/editor/core/semantic-analyzer.js +13 -1
- package/dist/components/editor/core/structure-layout.d.ts +31 -0
- package/dist/components/editor/core/structure-layout.js +64 -0
- package/dist/services/mock-ai.js +1 -1
- package/dist/stores/ai.svelte.js +1 -1
- package/dist/styles/theme.css +24 -0
- package/package.json +1 -1
|
@@ -14,6 +14,10 @@
|
|
|
14
14
|
import type { SemanticCategory } from './core/semantic-analyzer';
|
|
15
15
|
import { getSemanticAnalyzer } from './core/semantic-analyzer';
|
|
16
16
|
import type { ComplexityMetrics } from './core/complexity-analyzer';
|
|
17
|
+
import { layoutStructureRows } from './core/structure-layout';
|
|
18
|
+
|
|
19
|
+
/** Minimum legible height of a single node row, in px (kept in sync with CSS). */
|
|
20
|
+
const ROW_HEIGHT = 18;
|
|
17
21
|
|
|
18
22
|
interface StructureNode {
|
|
19
23
|
/** Stable unique id (keyed-each safe — multiple regions can share a start line) */
|
|
@@ -134,27 +138,39 @@
|
|
|
134
138
|
// Sort by line number
|
|
135
139
|
nodes.sort((a, b) => a.startLine - b.startLine);
|
|
136
140
|
|
|
137
|
-
|
|
141
|
+
// Drop a generic `exports` node when a more specific structural node
|
|
142
|
+
// (class / function / types) begins on the same line. `export class Foo`
|
|
143
|
+
// emits both an `exports` region ("Export: class") and a `class` region
|
|
144
|
+
// ("Class: Foo") at the identical start line; without this they render as
|
|
145
|
+
// two stacked rows saying the same thing.
|
|
146
|
+
const specificStartLines = new Set(
|
|
147
|
+
nodes
|
|
148
|
+
.filter((n) => n.type === 'function' || n.type === 'class' || n.type === 'types')
|
|
149
|
+
.map((n) => n.startLine)
|
|
150
|
+
);
|
|
151
|
+
|
|
152
|
+
return nodes.filter((n) => !(n.type === 'exports' && specificStartLines.has(n.startLine)));
|
|
138
153
|
});
|
|
139
154
|
|
|
155
|
+
// Measured height of the scrollable node area, kept current by a ResizeObserver
|
|
156
|
+
// via Svelte's `bind:clientHeight`. Drives collision-free row placement.
|
|
157
|
+
let contentHeight = $state(0);
|
|
158
|
+
|
|
159
|
+
// Non-overlapping top offset (px) for each node, proportional to its start
|
|
160
|
+
// line but de-collided so labels never overprint. See structure-layout.ts.
|
|
161
|
+
let nodeTops = $derived(
|
|
162
|
+
layoutStructureRows(
|
|
163
|
+
structure.map((n) => n.startLine),
|
|
164
|
+
totalLines,
|
|
165
|
+
contentHeight,
|
|
166
|
+
ROW_HEIGHT
|
|
167
|
+
)
|
|
168
|
+
);
|
|
169
|
+
|
|
140
170
|
// Calculate viewport indicator position
|
|
141
171
|
let viewportTop = $derived((scrollLine / Math.max(1, totalLines)) * 100);
|
|
142
172
|
let viewportHeight = $derived((visibleLines / Math.max(1, totalLines)) * 100);
|
|
143
173
|
|
|
144
|
-
/**
|
|
145
|
-
* Get node height as percentage
|
|
146
|
-
*/
|
|
147
|
-
function getNodeHeight(node: StructureNode): number {
|
|
148
|
-
return ((node.endLine - node.startLine + 1) / Math.max(1, totalLines)) * 100;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* Get node top position as percentage
|
|
153
|
-
*/
|
|
154
|
-
function getNodeTop(node: StructureNode): number {
|
|
155
|
-
return (node.startLine / Math.max(1, totalLines)) * 100;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
174
|
/**
|
|
159
175
|
* Get color for node type
|
|
160
176
|
*/
|
|
@@ -231,7 +247,7 @@
|
|
|
231
247
|
<span class="structure-map__count">{structure.length}</span>
|
|
232
248
|
</div>
|
|
233
249
|
|
|
234
|
-
<div class="structure-map__content">
|
|
250
|
+
<div class="structure-map__content" bind:clientHeight={contentHeight}>
|
|
235
251
|
<!-- Viewport indicator -->
|
|
236
252
|
<div
|
|
237
253
|
class="structure-map__viewport"
|
|
@@ -239,15 +255,15 @@
|
|
|
239
255
|
></div>
|
|
240
256
|
|
|
241
257
|
<!-- Structure nodes -->
|
|
242
|
-
{#each structure as node (node.id)}
|
|
258
|
+
{#each structure as node, i (node.id)}
|
|
243
259
|
<button
|
|
244
260
|
class="structure-map__node"
|
|
245
261
|
class:structure-map__node--active={isCursorInNode(node)}
|
|
246
262
|
class:structure-map__node--complex={node.metrics.complexity &&
|
|
247
263
|
node.metrics.complexity >= 50}
|
|
248
264
|
style="
|
|
249
|
-
top: {
|
|
250
|
-
height: {
|
|
265
|
+
top: {nodeTops[i] ?? 0}px;
|
|
266
|
+
height: {ROW_HEIGHT}px;
|
|
251
267
|
--node-color: {getNodeColor(node.type)};
|
|
252
268
|
--complexity-color: {getComplexityColor(node.metrics.complexity ?? 0)};
|
|
253
269
|
"
|
|
@@ -296,8 +312,8 @@
|
|
|
296
312
|
display: flex;
|
|
297
313
|
flex-direction: column;
|
|
298
314
|
height: 100%;
|
|
299
|
-
background: var(--
|
|
300
|
-
border-left: 1px solid var(--
|
|
315
|
+
background: var(--ide-bg-secondary, #1a2744);
|
|
316
|
+
border-left: 1px solid var(--ide-border, #a8c5d9);
|
|
301
317
|
font-size: 11px;
|
|
302
318
|
user-select: none;
|
|
303
319
|
}
|
|
@@ -307,12 +323,12 @@
|
|
|
307
323
|
justify-content: space-between;
|
|
308
324
|
align-items: center;
|
|
309
325
|
padding: 8px 10px;
|
|
310
|
-
border-bottom: 1px solid var(--
|
|
326
|
+
border-bottom: 1px solid var(--ide-border, #a8c5d9);
|
|
311
327
|
}
|
|
312
328
|
|
|
313
329
|
.structure-map__title {
|
|
314
330
|
font-weight: 600;
|
|
315
|
-
color: var(--
|
|
331
|
+
color: var(--ide-text-primary, #f4f1e0);
|
|
316
332
|
text-transform: uppercase;
|
|
317
333
|
font-size: 10px;
|
|
318
334
|
letter-spacing: 0.05em;
|
|
@@ -323,7 +339,7 @@
|
|
|
323
339
|
background: rgba(255, 255, 255, 0.1);
|
|
324
340
|
border-radius: 10px;
|
|
325
341
|
font-size: 10px;
|
|
326
|
-
color: var(--
|
|
342
|
+
color: var(--ide-text-muted, #a8c5d9);
|
|
327
343
|
}
|
|
328
344
|
|
|
329
345
|
.structure-map__content {
|
|
@@ -349,7 +365,8 @@
|
|
|
349
365
|
left: 4px;
|
|
350
366
|
right: 4px;
|
|
351
367
|
display: flex;
|
|
352
|
-
align-items:
|
|
368
|
+
align-items: center;
|
|
369
|
+
box-sizing: border-box;
|
|
353
370
|
gap: 4px;
|
|
354
371
|
padding: 2px 6px;
|
|
355
372
|
background: rgba(var(--node-color-rgb, 59, 130, 246), 0.15);
|
|
@@ -358,7 +375,7 @@
|
|
|
358
375
|
border-radius: 0 3px 3px 0;
|
|
359
376
|
cursor: pointer;
|
|
360
377
|
text-align: left;
|
|
361
|
-
color: var(--
|
|
378
|
+
color: var(--ide-text-primary, #f4f1e0);
|
|
362
379
|
font-size: 10px;
|
|
363
380
|
overflow: hidden;
|
|
364
381
|
transition: background 0.15s ease;
|
|
@@ -407,17 +424,17 @@
|
|
|
407
424
|
left: 0;
|
|
408
425
|
right: 0;
|
|
409
426
|
height: 2px;
|
|
410
|
-
background: var(--
|
|
427
|
+
background: var(--ide-interactive-focus, #60a5fa);
|
|
411
428
|
pointer-events: none;
|
|
412
429
|
z-index: 10;
|
|
413
|
-
box-shadow: 0 0 4px var(--
|
|
430
|
+
box-shadow: 0 0 4px var(--ide-interactive-focus, #60a5fa);
|
|
414
431
|
}
|
|
415
432
|
|
|
416
433
|
.structure-map__legend {
|
|
417
434
|
display: flex;
|
|
418
435
|
gap: 8px;
|
|
419
436
|
padding: 6px 10px;
|
|
420
|
-
border-top: 1px solid var(--
|
|
437
|
+
border-top: 1px solid var(--ide-border, #a8c5d9);
|
|
421
438
|
flex-wrap: wrap;
|
|
422
439
|
}
|
|
423
440
|
|
|
@@ -425,7 +442,7 @@
|
|
|
425
442
|
display: flex;
|
|
426
443
|
align-items: center;
|
|
427
444
|
gap: 4px;
|
|
428
|
-
color: var(--
|
|
445
|
+
color: var(--ide-text-muted, #a8c5d9);
|
|
429
446
|
font-size: 9px;
|
|
430
447
|
}
|
|
431
448
|
|
|
@@ -277,13 +277,13 @@
|
|
|
277
277
|
gap: 8px;
|
|
278
278
|
height: 32px;
|
|
279
279
|
padding: 0 12px;
|
|
280
|
-
background: var(--
|
|
281
|
-
border-top: 1px solid var(--
|
|
280
|
+
background: var(--ide-bg-secondary, #1a2744);
|
|
281
|
+
border-top: 1px solid var(--ide-border, #a8c5d9);
|
|
282
282
|
user-select: none;
|
|
283
283
|
}
|
|
284
284
|
|
|
285
285
|
.timeline-scrubber--playback {
|
|
286
|
-
background: var(--
|
|
286
|
+
background: var(--ide-bg-elevated, #1a2744);
|
|
287
287
|
}
|
|
288
288
|
|
|
289
289
|
.timeline-scrubber__controls {
|
|
@@ -303,7 +303,7 @@
|
|
|
303
303
|
background: transparent;
|
|
304
304
|
border: none;
|
|
305
305
|
border-radius: 4px;
|
|
306
|
-
color: var(--
|
|
306
|
+
color: var(--ide-text-muted, #a8c5d9);
|
|
307
307
|
cursor: pointer;
|
|
308
308
|
transition:
|
|
309
309
|
background 0.15s ease,
|
|
@@ -312,7 +312,7 @@
|
|
|
312
312
|
|
|
313
313
|
.timeline-scrubber__btn:hover {
|
|
314
314
|
background: rgba(255, 255, 255, 0.1);
|
|
315
|
-
color: var(--
|
|
315
|
+
color: var(--ide-text-primary, #f4f1e0);
|
|
316
316
|
}
|
|
317
317
|
|
|
318
318
|
.timeline-scrubber__btn--live {
|
|
@@ -397,7 +397,7 @@
|
|
|
397
397
|
.timeline-scrubber__thumb-handle {
|
|
398
398
|
width: 14px;
|
|
399
399
|
height: 14px;
|
|
400
|
-
background: var(--
|
|
400
|
+
background: var(--ide-interactive, #4a8db7);
|
|
401
401
|
border: 2px solid #fff;
|
|
402
402
|
border-radius: 50%;
|
|
403
403
|
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
|
|
@@ -413,7 +413,7 @@
|
|
|
413
413
|
text-align: center;
|
|
414
414
|
font-size: 11px;
|
|
415
415
|
font-family: var(--font-mono, monospace);
|
|
416
|
-
color: var(--
|
|
416
|
+
color: var(--ide-text-muted, #a8c5d9);
|
|
417
417
|
}
|
|
418
418
|
|
|
419
419
|
.timeline-scrubber__live {
|
|
@@ -439,8 +439,8 @@
|
|
|
439
439
|
align-items: center;
|
|
440
440
|
gap: 8px;
|
|
441
441
|
padding: 8px 12px;
|
|
442
|
-
background: var(--
|
|
443
|
-
border: 1px solid var(--
|
|
442
|
+
background: var(--ide-bg-secondary, #1a2744);
|
|
443
|
+
border: 1px solid var(--ide-border, #a8c5d9);
|
|
444
444
|
border-radius: 6px;
|
|
445
445
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
|
|
446
446
|
pointer-events: none;
|
|
@@ -460,11 +460,11 @@
|
|
|
460
460
|
.timeline-scrubber__tooltip-label {
|
|
461
461
|
font-size: 12px;
|
|
462
462
|
font-weight: 500;
|
|
463
|
-
color: var(--
|
|
463
|
+
color: var(--ide-text-primary, #f4f1e0);
|
|
464
464
|
}
|
|
465
465
|
|
|
466
466
|
.timeline-scrubber__tooltip-time {
|
|
467
467
|
font-size: 10px;
|
|
468
|
-
color: var(--
|
|
468
|
+
color: var(--ide-text-muted, #a8c5d9);
|
|
469
469
|
}
|
|
470
470
|
</style>
|
|
@@ -87,6 +87,10 @@ export declare class ComplexityAnalyzer {
|
|
|
87
87
|
* Check if a `{` at position `ch` is the opening brace of a function/class definition
|
|
88
88
|
*/
|
|
89
89
|
private isDefOpeningBrace;
|
|
90
|
+
/**
|
|
91
|
+
* Extract a definition candidate before its body brace is seen.
|
|
92
|
+
*/
|
|
93
|
+
private getDefinitionCandidate;
|
|
90
94
|
/**
|
|
91
95
|
* Analyze a specific region
|
|
92
96
|
*/
|
|
@@ -117,10 +117,21 @@ export class ComplexityAnalyzer {
|
|
|
117
117
|
// Track blocks with their brace depth at push time
|
|
118
118
|
const blockStack = [];
|
|
119
119
|
let braceDepth = 0;
|
|
120
|
+
let pendingDef;
|
|
120
121
|
for (let i = 0; i < lines.length; i++) {
|
|
121
122
|
const text = lines[i].text;
|
|
122
123
|
// Check for function/class definition
|
|
123
124
|
const funcMatch = text.match(PATTERNS.functionDef);
|
|
125
|
+
const currentBlock = blockStack[blockStack.length - 1];
|
|
126
|
+
const defCandidate = this.getDefinitionCandidate(text, funcMatch, currentBlock?.type === 'class' && braceDepth === currentBlock.depth);
|
|
127
|
+
if (defCandidate) {
|
|
128
|
+
pendingDef = {
|
|
129
|
+
line: i,
|
|
130
|
+
type: defCandidate.type,
|
|
131
|
+
name: defCandidate.name,
|
|
132
|
+
depth: braceDepth
|
|
133
|
+
};
|
|
134
|
+
}
|
|
124
135
|
// Process character by character to properly match braces
|
|
125
136
|
// Skip braces inside strings and comments
|
|
126
137
|
let inString = null;
|
|
@@ -150,13 +161,16 @@ export class ComplexityAnalyzer {
|
|
|
150
161
|
if (c === '{') {
|
|
151
162
|
braceDepth++;
|
|
152
163
|
// If this is the opening brace of a function/class def, push it
|
|
153
|
-
if (
|
|
164
|
+
if (pendingDef &&
|
|
165
|
+
braceDepth === pendingDef.depth + 1 &&
|
|
166
|
+
this.isDefOpeningBrace(text, ch, pendingDef.type)) {
|
|
154
167
|
blockStack.push({
|
|
155
|
-
line:
|
|
156
|
-
type:
|
|
157
|
-
name:
|
|
168
|
+
line: pendingDef.line,
|
|
169
|
+
type: pendingDef.type,
|
|
170
|
+
name: pendingDef.name,
|
|
158
171
|
depth: braceDepth
|
|
159
172
|
});
|
|
173
|
+
pendingDef = undefined;
|
|
160
174
|
}
|
|
161
175
|
else if (!funcMatch ||
|
|
162
176
|
braceDepth > (blockStack.length > 0 ? blockStack[blockStack.length - 1].depth : 0) + 1) {
|
|
@@ -185,6 +199,9 @@ export class ComplexityAnalyzer {
|
|
|
185
199
|
}
|
|
186
200
|
}
|
|
187
201
|
braceDepth = Math.max(0, braceDepth - 1);
|
|
202
|
+
if (pendingDef && braceDepth < pendingDef.depth) {
|
|
203
|
+
pendingDef = undefined;
|
|
204
|
+
}
|
|
188
205
|
}
|
|
189
206
|
}
|
|
190
207
|
}
|
|
@@ -202,15 +219,35 @@ export class ComplexityAnalyzer {
|
|
|
202
219
|
/**
|
|
203
220
|
* Check if a `{` at position `ch` is the opening brace of a function/class definition
|
|
204
221
|
*/
|
|
205
|
-
isDefOpeningBrace(text, ch,
|
|
222
|
+
isDefOpeningBrace(text, ch, type) {
|
|
206
223
|
// For class: `class Foo {` — the `{` follows the class name
|
|
207
|
-
if (
|
|
224
|
+
if (type === 'class') {
|
|
208
225
|
return true; // First `{` on a class line is the class body
|
|
209
226
|
}
|
|
210
227
|
// For functions: the `{` should follow the parameter list closing `)`
|
|
211
|
-
// or follow `=>` for arrow functions
|
|
228
|
+
// with an optional TypeScript return type, or follow `=>` for arrow functions.
|
|
212
229
|
const before = text.slice(0, ch).trimEnd();
|
|
213
|
-
return
|
|
230
|
+
return /\)\s*(:\s*[^{};]+)?\s*$/.test(before) || before.endsWith('=>');
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Extract a definition candidate before its body brace is seen.
|
|
234
|
+
*/
|
|
235
|
+
getDefinitionCandidate(text, funcMatch, allowMethodStyle) {
|
|
236
|
+
if (funcMatch) {
|
|
237
|
+
return {
|
|
238
|
+
type: funcMatch[5] ? 'class' : 'function',
|
|
239
|
+
name: funcMatch[2] || funcMatch[3] || funcMatch[4] || funcMatch[5]
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
if (!allowMethodStyle) {
|
|
243
|
+
return undefined;
|
|
244
|
+
}
|
|
245
|
+
const trimmed = text.trim();
|
|
246
|
+
const methodMatch = trimmed.match(/^(?:(?:public|private|protected|static|async|readonly|override)\s+)*(?!(?:if|else|for|while|do|switch|try|catch|finally|with|return|throw|new|typeof|void|delete|await|yield)\b)(\w+)\s*\(/);
|
|
247
|
+
if (methodMatch) {
|
|
248
|
+
return { type: 'function', name: methodMatch[1] };
|
|
249
|
+
}
|
|
250
|
+
return undefined;
|
|
214
251
|
}
|
|
215
252
|
/**
|
|
216
253
|
* Analyze a specific region
|
|
@@ -235,13 +235,13 @@ export function getSeverityIcon(severity) {
|
|
|
235
235
|
export function getSeverityColor(severity) {
|
|
236
236
|
switch (severity) {
|
|
237
237
|
case 'error':
|
|
238
|
-
return '
|
|
238
|
+
return 'var(--ide-error)';
|
|
239
239
|
case 'warning':
|
|
240
|
-
return '
|
|
240
|
+
return 'var(--ide-warning)';
|
|
241
241
|
case 'info':
|
|
242
|
-
return '
|
|
242
|
+
return 'var(--ide-info)';
|
|
243
243
|
case 'hint':
|
|
244
|
-
return '
|
|
244
|
+
return 'var(--ide-text-muted)';
|
|
245
245
|
}
|
|
246
246
|
}
|
|
247
247
|
/**
|
|
@@ -71,8 +71,9 @@ const JAVASCRIPT_PATTERNS = new Map([
|
|
|
71
71
|
[
|
|
72
72
|
'function',
|
|
73
73
|
{
|
|
74
|
-
startPattern: /^(export\s+)?(async\s+)?function\s+(\w+)|^const\s+(\w+)\s*=\s*(async\s*)?\([^)]*\)\s
|
|
74
|
+
startPattern: /^(export\s+)?(async\s+)?function\s+(\w+)|^(?:export\s+)?const\s+(\w+)\s*=\s*(async\s*)?\([^)]*\)\s*(?::[^=]+)?=>/,
|
|
75
75
|
blockBased: true,
|
|
76
|
+
expressionBody: true,
|
|
76
77
|
getLabel: (m) => `Function: ${m[3] || m[4] || 'anonymous'}`
|
|
77
78
|
}
|
|
78
79
|
],
|
|
@@ -298,6 +299,17 @@ export class SemanticAnalyzer {
|
|
|
298
299
|
label: config.getLabel?.(match)
|
|
299
300
|
});
|
|
300
301
|
}
|
|
302
|
+
else if (match && config.expressionBody && text.includes('=>')) {
|
|
303
|
+
// Brace-less expression-bodied arrow (e.g. `export const f = () => x`):
|
|
304
|
+
// no block to track, so record it as a single-line region.
|
|
305
|
+
regions.push({
|
|
306
|
+
category,
|
|
307
|
+
startLine: i,
|
|
308
|
+
endLine: i,
|
|
309
|
+
confidence: 0.85,
|
|
310
|
+
label: config.getLabel?.(match)
|
|
311
|
+
});
|
|
312
|
+
}
|
|
301
313
|
}
|
|
302
314
|
}
|
|
303
315
|
// Update depth
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Structure Map row layout
|
|
3
|
+
*
|
|
4
|
+
* The Structure Map places one labeled row per semantic region. Rows want to sit
|
|
5
|
+
* at a position proportional to their start line (so the map reads like a
|
|
6
|
+
* minimap), but every label needs a minimum pixel height to stay legible. With
|
|
7
|
+
* pure proportional placement, regions that start on the same line (e.g. the
|
|
8
|
+
* `exports` and `class` regions of `export class Foo`) or that cluster densely
|
|
9
|
+
* (a run of test hooks) overprint each other into illegible mush.
|
|
10
|
+
*
|
|
11
|
+
* `layoutStructureRows` resolves non-overlapping vertical offsets:
|
|
12
|
+
* - pass 1 (top-down): no row sits closer than `rowHeight` below the previous
|
|
13
|
+
* one, preserving proportional placement wherever there is room;
|
|
14
|
+
* - pass 2 (bottom-up): if the de-collided stack overruns the available height,
|
|
15
|
+
* pull rows back up so the last one ends exactly at `height`, keeping the
|
|
16
|
+
* minimum spacing intact.
|
|
17
|
+
*
|
|
18
|
+
* When there are genuinely more rows than can fit (`rows * rowHeight > height`)
|
|
19
|
+
* the stack is floored at the top and rows are placed sequentially; callers are
|
|
20
|
+
* expected to clip the overflow (`overflow: hidden`).
|
|
21
|
+
*/
|
|
22
|
+
/**
|
|
23
|
+
* Resolve non-overlapping top offsets (in px) for structure-map rows.
|
|
24
|
+
*
|
|
25
|
+
* @param startLines 0-based start line of each row, in render order.
|
|
26
|
+
* @param totalLines Total line count the map represents.
|
|
27
|
+
* @param height Available height of the rendering area, in px.
|
|
28
|
+
* @param rowHeight Minimum legible height of a single row, in px.
|
|
29
|
+
* @returns Top offset in px for each input row, in the same order.
|
|
30
|
+
*/
|
|
31
|
+
export declare function layoutStructureRows(startLines: readonly number[], totalLines: number, height: number, rowHeight: number): number[];
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Structure Map row layout
|
|
3
|
+
*
|
|
4
|
+
* The Structure Map places one labeled row per semantic region. Rows want to sit
|
|
5
|
+
* at a position proportional to their start line (so the map reads like a
|
|
6
|
+
* minimap), but every label needs a minimum pixel height to stay legible. With
|
|
7
|
+
* pure proportional placement, regions that start on the same line (e.g. the
|
|
8
|
+
* `exports` and `class` regions of `export class Foo`) or that cluster densely
|
|
9
|
+
* (a run of test hooks) overprint each other into illegible mush.
|
|
10
|
+
*
|
|
11
|
+
* `layoutStructureRows` resolves non-overlapping vertical offsets:
|
|
12
|
+
* - pass 1 (top-down): no row sits closer than `rowHeight` below the previous
|
|
13
|
+
* one, preserving proportional placement wherever there is room;
|
|
14
|
+
* - pass 2 (bottom-up): if the de-collided stack overruns the available height,
|
|
15
|
+
* pull rows back up so the last one ends exactly at `height`, keeping the
|
|
16
|
+
* minimum spacing intact.
|
|
17
|
+
*
|
|
18
|
+
* When there are genuinely more rows than can fit (`rows * rowHeight > height`)
|
|
19
|
+
* the stack is floored at the top and rows are placed sequentially; callers are
|
|
20
|
+
* expected to clip the overflow (`overflow: hidden`).
|
|
21
|
+
*/
|
|
22
|
+
/**
|
|
23
|
+
* Resolve non-overlapping top offsets (in px) for structure-map rows.
|
|
24
|
+
*
|
|
25
|
+
* @param startLines 0-based start line of each row, in render order.
|
|
26
|
+
* @param totalLines Total line count the map represents.
|
|
27
|
+
* @param height Available height of the rendering area, in px.
|
|
28
|
+
* @param rowHeight Minimum legible height of a single row, in px.
|
|
29
|
+
* @returns Top offset in px for each input row, in the same order.
|
|
30
|
+
*/
|
|
31
|
+
export function layoutStructureRows(startLines, totalLines, height, rowHeight) {
|
|
32
|
+
const n = startLines.length;
|
|
33
|
+
if (n === 0)
|
|
34
|
+
return [];
|
|
35
|
+
const span = Math.max(1, totalLines);
|
|
36
|
+
const tops = startLines.map((line) => (Math.max(0, line) / span) * height);
|
|
37
|
+
// Pass 1 — top-down: enforce the minimum gap, keeping proportional order.
|
|
38
|
+
for (let i = 1; i < n; i++) {
|
|
39
|
+
const min = tops[i - 1] + rowHeight;
|
|
40
|
+
if (tops[i] < min)
|
|
41
|
+
tops[i] = min;
|
|
42
|
+
}
|
|
43
|
+
// Pass 2 — bottom-up: if the stack overflows, slide it back into bounds.
|
|
44
|
+
if (height > 0 && tops[n - 1] + rowHeight > height) {
|
|
45
|
+
tops[n - 1] = height - rowHeight;
|
|
46
|
+
for (let i = n - 2; i >= 0; i--) {
|
|
47
|
+
const max = tops[i + 1] - rowHeight;
|
|
48
|
+
if (tops[i] > max)
|
|
49
|
+
tops[i] = max;
|
|
50
|
+
}
|
|
51
|
+
// More rows than fit: floor at the top and place sequentially. Some
|
|
52
|
+
// overlap is unavoidable here, but the result is deterministic and the
|
|
53
|
+
// caller clips it.
|
|
54
|
+
if (tops[0] < 0) {
|
|
55
|
+
tops[0] = 0;
|
|
56
|
+
for (let i = 1; i < n; i++) {
|
|
57
|
+
const min = tops[i - 1] + rowHeight;
|
|
58
|
+
if (tops[i] < min)
|
|
59
|
+
tops[i] = min;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return tops;
|
|
64
|
+
}
|
package/dist/services/mock-ai.js
CHANGED
|
@@ -282,7 +282,7 @@ export function createMockMessage(role, content, options = {}) {
|
|
|
282
282
|
...options,
|
|
283
283
|
metadata: role === 'assistant'
|
|
284
284
|
? {
|
|
285
|
-
model: '
|
|
285
|
+
model: 'nocturnium-demo-mock',
|
|
286
286
|
tokensUsed: Math.floor(content.length / 4),
|
|
287
287
|
latencyMs: Math.floor(500 + Math.random() * 1500),
|
|
288
288
|
...options.metadata
|
package/dist/stores/ai.svelte.js
CHANGED
|
@@ -9,7 +9,7 @@ import { SvelteMap } from 'svelte/reactivity';
|
|
|
9
9
|
// Default configuration
|
|
10
10
|
const defaultConfig = {
|
|
11
11
|
endpoint: '/api/chat',
|
|
12
|
-
model: '
|
|
12
|
+
model: 'nocturnium-demo-mock',
|
|
13
13
|
systemPrompt: 'You are a helpful coding assistant integrated into an IDE.',
|
|
14
14
|
tools: [],
|
|
15
15
|
maxTokens: 4096,
|
package/dist/styles/theme.css
CHANGED
|
@@ -65,6 +65,12 @@
|
|
|
65
65
|
--ide-interactive-muted: color-mix(in srgb, var(--ide-interactive) 70%, transparent);
|
|
66
66
|
--ide-interactive-rgb: 74, 141, 183;
|
|
67
67
|
|
|
68
|
+
/* Primary action — the signature warm ember accent, shared as a single
|
|
69
|
+
source of truth by primary buttons and badges so "primary" reads the
|
|
70
|
+
same everywhere. */
|
|
71
|
+
--ide-primary: var(--ide-interactive-active);
|
|
72
|
+
--ide-primary-hover: var(--ide-interactive-hover);
|
|
73
|
+
|
|
68
74
|
/* IDE Accent Colors */
|
|
69
75
|
--ide-accent: var(--color-nocturnium-wave);
|
|
70
76
|
--ide-accent-hover: var(--color-nocturnium-flame);
|
|
@@ -85,11 +91,14 @@
|
|
|
85
91
|
|
|
86
92
|
/* Plugin Status Colors */
|
|
87
93
|
--ide-plugin-draft: var(--ide-text-muted);
|
|
94
|
+
--ide-plugin-submitted: var(--ide-info);
|
|
88
95
|
--ide-plugin-reviewing: var(--color-nocturnium-aurora-yellow);
|
|
89
96
|
--ide-plugin-approved: var(--color-nocturnium-aurora-green);
|
|
97
|
+
--ide-plugin-testing: var(--color-nocturnium-teal);
|
|
90
98
|
--ide-plugin-rejected: var(--ide-error);
|
|
91
99
|
--ide-plugin-deploying: var(--color-nocturnium-aurora-blue);
|
|
92
100
|
--ide-plugin-deployed: var(--color-nocturnium-aurora-green);
|
|
101
|
+
--ide-plugin-rolled_back: var(--color-nocturnium-flame);
|
|
93
102
|
|
|
94
103
|
/* CRDT Collaboration Colors */
|
|
95
104
|
--ide-collab-cursor-1: var(--color-nocturnium-aurora-blue);
|
|
@@ -397,6 +406,11 @@
|
|
|
397
406
|
color: var(--ide-plugin-draft);
|
|
398
407
|
}
|
|
399
408
|
|
|
409
|
+
.ide-plugin-status--submitted {
|
|
410
|
+
background-color: color-mix(in srgb, var(--ide-plugin-submitted) 20%, transparent);
|
|
411
|
+
color: var(--ide-plugin-submitted);
|
|
412
|
+
}
|
|
413
|
+
|
|
400
414
|
.ide-plugin-status--reviewing {
|
|
401
415
|
background-color: color-mix(in srgb, var(--ide-plugin-reviewing) 20%, transparent);
|
|
402
416
|
color: var(--ide-plugin-reviewing);
|
|
@@ -407,6 +421,11 @@
|
|
|
407
421
|
color: var(--ide-plugin-approved);
|
|
408
422
|
}
|
|
409
423
|
|
|
424
|
+
.ide-plugin-status--testing {
|
|
425
|
+
background-color: color-mix(in srgb, var(--ide-plugin-testing) 20%, transparent);
|
|
426
|
+
color: var(--ide-plugin-testing);
|
|
427
|
+
}
|
|
428
|
+
|
|
410
429
|
.ide-plugin-status--rejected {
|
|
411
430
|
background-color: color-mix(in srgb, var(--ide-plugin-rejected) 20%, transparent);
|
|
412
431
|
color: var(--ide-plugin-rejected);
|
|
@@ -422,6 +441,11 @@
|
|
|
422
441
|
color: var(--ide-plugin-deployed);
|
|
423
442
|
}
|
|
424
443
|
|
|
444
|
+
.ide-plugin-status--rolled_back {
|
|
445
|
+
background-color: color-mix(in srgb, var(--ide-plugin-rolled_back) 20%, transparent);
|
|
446
|
+
color: var(--ide-plugin-rolled_back);
|
|
447
|
+
}
|
|
448
|
+
|
|
425
449
|
/* Agent Status Animations */
|
|
426
450
|
@keyframes ide-agent-pulse {
|
|
427
451
|
0%,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocturnium/svelte-ide",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "Svelte 5 code editor and IDE building blocks — custom editor, syntax highlighting, code folding, multi-cursor, LSP client, and optional realtime collaboration.",
|
|
5
5
|
"author": "Nocturnium & Jordan Dziat <hello@nocturnium.ai> (https://nocturnium.ai)",
|
|
6
6
|
"license": "MIT",
|