yaxa-svelte 2.0.4 → 2.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 +4 -2
- package/dist/components/blocks/FAQ.svelte.d.ts +1 -1
- package/dist/components/blocks/FeatureGrid.svelte.d.ts +1 -1
- package/dist/components/blocks/Testimonials.svelte.d.ts +1 -1
- package/dist/components/elements/Avatar.svelte.d.ts +7 -25
- package/dist/components/elements/Badge.svelte.d.ts +15 -57
- package/dist/components/elements/Button.svelte.d.ts +19 -77
- package/dist/components/elements/Carousel.svelte.d.ts +2 -54
- package/dist/components/elements/CodeBlock.svelte +237 -8
- package/dist/components/elements/CodeBlock.test.js +227 -0
- package/dist/components/elements/CodeDiff.svelte +14 -0
- package/dist/components/elements/CodeDiff.test.js +16 -0
- package/dist/components/elements/EmptyState.svelte.d.ts +6 -26
- package/dist/components/elements/Icon.svelte.d.ts +6 -22
- package/dist/components/elements/Kbd.svelte.d.ts +5 -19
- package/dist/components/elements/Progress.svelte.d.ts +9 -35
- package/dist/components/elements/Skeleton.svelte.d.ts +8 -32
- package/dist/components/elements/Terminal.svelte.d.ts +1 -1
- package/dist/components/elements/Timeline.svelte.d.ts +4 -16
- package/dist/components/elements/Tree.svelte.d.ts +3 -13
- package/dist/components/elements/VirtualList.svelte.d.ts +3 -13
- package/dist/components/forms/Combobox.svelte.d.ts +7 -29
- package/dist/components/forms/Input.svelte.d.ts +9 -35
- package/dist/components/forms/MultiSelect.svelte.d.ts +7 -29
- package/dist/components/forms/NumberInput.svelte.d.ts +7 -29
- package/dist/components/forms/Select.svelte.d.ts +7 -29
- package/dist/components/forms/Switch.svelte.d.ts +8 -32
- package/dist/components/forms/Textarea.svelte.d.ts +11 -45
- package/dist/components/layout/Card.svelte.d.ts +10 -42
- package/dist/components/layout/Container.svelte.d.ts +7 -25
- package/dist/components/layout/DashboardShell.svelte.d.ts +1 -31
- package/dist/components/layout/ResizablePanels.svelte.d.ts +1 -35
- package/dist/components/navigation/CommandPalette.dom.test.d.ts +1 -0
- package/dist/components/navigation/CommandPalette.dom.test.js +76 -0
- package/dist/components/navigation/Stepper.svelte.d.ts +3 -13
- package/dist/components/overlays/Alert.svelte.d.ts +5 -19
- package/dist/components/overlays/Drawer.svelte.d.ts +3 -13
- package/dist/components/overlays/Modal.svelte.d.ts +6 -22
- package/dist/components/overlays/NotificationCenter.svelte.d.ts +1 -1
- package/dist/components/overlays/Slideover.svelte.d.ts +5 -19
- package/dist/components/overlays/Toast.svelte.d.ts +12 -44
- package/dist/components/saas/OrgSwitcher.svelte.d.ts +1 -1
- package/dist/components/saas/PasskeyUI.svelte.d.ts +1 -1
- package/dist/server/polar/index.d.ts +2 -1
- package/dist/server/polar/index.js +9 -8
- package/dist/server/polar/webhook.js +14 -11
- package/dist/server/polar/webhook.test.js +81 -0
- package/dist/testing/index.d.ts +2 -0
- package/dist/testing/index.js +12 -1
- package/dist/utils/cn.d.ts +2 -2
- package/package.json +11 -13
|
@@ -48,6 +48,36 @@ describe('tokenizeCode', () => {
|
|
|
48
48
|
const line4 = tokens[4].map((t) => ({ text: t.text, type: t.type }));
|
|
49
49
|
expect(line4).toContainEqual({ text: 'assert', type: 'keyword' });
|
|
50
50
|
});
|
|
51
|
+
it('tokenizes Python 3.13+ syntax: type parameters, TypeIs narrowing, match/case and decorators', () => {
|
|
52
|
+
const pyCode = `type Point[T = int] = tuple[T, T]
|
|
53
|
+
@deprecated
|
|
54
|
+
def is_str(val: object) -> TypeIs[str]:
|
|
55
|
+
match val:
|
|
56
|
+
case str():
|
|
57
|
+
return True
|
|
58
|
+
case _:
|
|
59
|
+
return False`;
|
|
60
|
+
const tokens = tokenizeCode(pyCode, 'python');
|
|
61
|
+
expect(tokens).toHaveLength(8);
|
|
62
|
+
// Line 0: type Point[T = int] = tuple[T, T]
|
|
63
|
+
const line0 = tokens[0].map((t) => ({ text: t.text, type: t.type }));
|
|
64
|
+
expect(line0).toContainEqual({ text: 'type', type: 'keyword' });
|
|
65
|
+
expect(line0).toContainEqual({ text: 'int', type: 'macro' });
|
|
66
|
+
expect(line0).toContainEqual({ text: 'tuple', type: 'macro' });
|
|
67
|
+
// Line 1: @deprecated
|
|
68
|
+
const line1 = tokens[1].map((t) => ({ text: t.text, type: t.type }));
|
|
69
|
+
expect(line1).toContainEqual({ text: '@deprecated', type: 'decorator' });
|
|
70
|
+
// Line 2: def is_str(val: object) -> TypeIs[str]:
|
|
71
|
+
const line2 = tokens[2].map((t) => ({ text: t.text, type: t.type }));
|
|
72
|
+
expect(line2).toContainEqual({ text: 'def', type: 'keyword' });
|
|
73
|
+
expect(line2).toContainEqual({ text: 'TypeIs', type: 'macro' });
|
|
74
|
+
expect(line2).toContainEqual({ text: 'str', type: 'macro' });
|
|
75
|
+
// Line 3 & 4: match / case
|
|
76
|
+
const line3 = tokens[3].map((t) => ({ text: t.text, type: t.type }));
|
|
77
|
+
expect(line3).toContainEqual({ text: 'match', type: 'keyword' });
|
|
78
|
+
const line4 = tokens[4].map((t) => ({ text: t.text, type: t.type }));
|
|
79
|
+
expect(line4).toContainEqual({ text: 'case', type: 'keyword' });
|
|
80
|
+
});
|
|
51
81
|
it('tokenizes tailwind css v4 at-rules, variables and hex colors', () => {
|
|
52
82
|
const cssCode = `@theme {
|
|
53
83
|
--color-primary-500: #ff3e00;
|
|
@@ -150,4 +180,201 @@ type TaskResult = Awaited<Promise<Record<string, unknown>>>;`;
|
|
|
150
180
|
const line11 = tokens[11].map((t) => ({ text: t.text, type: t.type }));
|
|
151
181
|
expect(line11).toContainEqual({ text: 'Awaited', type: 'macro' });
|
|
152
182
|
});
|
|
183
|
+
it('tokenizes YAML keys, anchors, aliases, tags, booleans and document markers', () => {
|
|
184
|
+
const yamlCode = `---
|
|
185
|
+
# App configuration
|
|
186
|
+
name: "yaxa-app"
|
|
187
|
+
version: 2.1
|
|
188
|
+
enabled: true
|
|
189
|
+
maintenance: off
|
|
190
|
+
defaults: &base_config
|
|
191
|
+
timeout: 30
|
|
192
|
+
production: *base_config
|
|
193
|
+
tag_demo: !custom_tag
|
|
194
|
+
created_at: 2026-10-27`;
|
|
195
|
+
const tokens = tokenizeCode(yamlCode, 'yaml');
|
|
196
|
+
expect(tokens).toHaveLength(11);
|
|
197
|
+
// Line 0: ---
|
|
198
|
+
expect(tokens[0][0]).toEqual({ text: '---', type: 'punctuation' });
|
|
199
|
+
// Line 1: # App configuration
|
|
200
|
+
expect(tokens[1][0]).toEqual({ text: '# App configuration', type: 'comment' });
|
|
201
|
+
// Line 2: name: "yaxa-app"
|
|
202
|
+
const line2 = tokens[2].map((t) => ({ text: t.text, type: t.type }));
|
|
203
|
+
expect(line2).toContainEqual({ text: 'name', type: 'attr' });
|
|
204
|
+
expect(line2).toContainEqual({ text: '"yaxa-app"', type: 'string' });
|
|
205
|
+
// Line 4: enabled: true
|
|
206
|
+
const line4 = tokens[4].map((t) => ({ text: t.text, type: t.type }));
|
|
207
|
+
expect(line4).toContainEqual({ text: 'enabled', type: 'attr' });
|
|
208
|
+
expect(line4).toContainEqual({ text: 'true', type: 'keyword' });
|
|
209
|
+
// Line 5: maintenance: off
|
|
210
|
+
const line5 = tokens[5].map((t) => ({ text: t.text, type: t.type }));
|
|
211
|
+
expect(line5).toContainEqual({ text: 'maintenance', type: 'attr' });
|
|
212
|
+
expect(line5).toContainEqual({ text: 'off', type: 'keyword' });
|
|
213
|
+
// Line 6: defaults: &base_config
|
|
214
|
+
const line6 = tokens[6].map((t) => ({ text: t.text, type: t.type }));
|
|
215
|
+
expect(line6).toContainEqual({ text: 'defaults', type: 'attr' });
|
|
216
|
+
expect(line6).toContainEqual({ text: '&base_config', type: 'macro' });
|
|
217
|
+
// Line 8: production: *base_config
|
|
218
|
+
const line8 = tokens[8].map((t) => ({ text: t.text, type: t.type }));
|
|
219
|
+
expect(line8).toContainEqual({ text: 'production', type: 'attr' });
|
|
220
|
+
expect(line8).toContainEqual({ text: '*base_config', type: 'macro' });
|
|
221
|
+
// Line 9: tag_demo: !custom_tag
|
|
222
|
+
const line9 = tokens[9].map((t) => ({ text: t.text, type: t.type }));
|
|
223
|
+
expect(line9).toContainEqual({ text: 'tag_demo', type: 'attr' });
|
|
224
|
+
expect(line9).toContainEqual({ text: '!custom_tag', type: 'directive' });
|
|
225
|
+
// Line 10: created_at: 2026-10-27
|
|
226
|
+
const line10 = tokens[10].map((t) => ({ text: t.text, type: t.type }));
|
|
227
|
+
expect(line10).toContainEqual({ text: 'created_at', type: 'attr' });
|
|
228
|
+
expect(line10).toContainEqual({ text: '2026-10-27', type: 'number' });
|
|
229
|
+
});
|
|
230
|
+
it('tokenizes TOML table headers, keys, dates, and multiline strings', () => {
|
|
231
|
+
const tomlCode = `[server]
|
|
232
|
+
port = 8080
|
|
233
|
+
enabled = true
|
|
234
|
+
started = 1979-05-27T07:32:00Z
|
|
235
|
+
bio = """
|
|
236
|
+
Hello World
|
|
237
|
+
Multilined
|
|
238
|
+
"""`;
|
|
239
|
+
const tokens = tokenizeCode(tomlCode, 'toml');
|
|
240
|
+
expect(tokens).toHaveLength(8);
|
|
241
|
+
// Line 0: [server]
|
|
242
|
+
expect(tokens[0][0]).toEqual({ text: '[server]', type: 'directive' });
|
|
243
|
+
// Line 1: port = 8080
|
|
244
|
+
const line1 = tokens[1].map((t) => ({ text: t.text, type: t.type }));
|
|
245
|
+
expect(line1).toContainEqual({ text: 'port', type: 'attr' });
|
|
246
|
+
expect(line1).toContainEqual({ text: '8080', type: 'number' });
|
|
247
|
+
// Line 2: enabled = true
|
|
248
|
+
const line2 = tokens[2].map((t) => ({ text: t.text, type: t.type }));
|
|
249
|
+
expect(line2).toContainEqual({ text: 'enabled', type: 'attr' });
|
|
250
|
+
expect(line2).toContainEqual({ text: 'true', type: 'keyword' });
|
|
251
|
+
// Line 3: started = 1979-05-27T07:32:00Z
|
|
252
|
+
const line3 = tokens[3].map((t) => ({ text: t.text, type: t.type }));
|
|
253
|
+
expect(line3).toContainEqual({ text: 'started', type: 'attr' });
|
|
254
|
+
expect(line3).toContainEqual({ text: '1979-05-27T07:32:00Z', type: 'number' });
|
|
255
|
+
// Multiline string across lines 4, 5, 6, 7
|
|
256
|
+
expect(tokens[4].some((t) => t.type === 'string')).toBe(true);
|
|
257
|
+
expect(tokens[5][0].type).toBe('string');
|
|
258
|
+
expect(tokens[6][0].type).toBe('string');
|
|
259
|
+
expect(tokens[7].some((t) => t.type === 'string')).toBe(true);
|
|
260
|
+
});
|
|
261
|
+
it('tokenizes Rust attributes, macros, lifetimes, and standard types to Tier 1 standard', () => {
|
|
262
|
+
const rustCode = `#[derive(Debug, Clone)]
|
|
263
|
+
pub fn process<'a>(name: &'a str) -> Option<String> {
|
|
264
|
+
let items: Vec<i32> = vec![1, 2, 3];
|
|
265
|
+
println!("Processed: {}", name);
|
|
266
|
+
Some(name.to_string())
|
|
267
|
+
}`;
|
|
268
|
+
const tokens = tokenizeCode(rustCode, 'rust');
|
|
269
|
+
expect(tokens).toHaveLength(6);
|
|
270
|
+
// Line 0: #[derive(Debug, Clone)]
|
|
271
|
+
expect(tokens[0][0].type).toBe('decorator');
|
|
272
|
+
// Line 1: pub fn process<'a>(name: &'a str) -> Option<String>
|
|
273
|
+
const line1 = tokens[1].map((t) => ({ text: t.text, type: t.type }));
|
|
274
|
+
expect(line1).toContainEqual({ text: 'pub', type: 'keyword' });
|
|
275
|
+
expect(line1).toContainEqual({ text: 'fn', type: 'keyword' });
|
|
276
|
+
expect(line1).toContainEqual({ text: "'a", type: 'macro' });
|
|
277
|
+
expect(line1).toContainEqual({ text: 'str', type: 'macro' });
|
|
278
|
+
expect(line1).toContainEqual({ text: 'Option', type: 'macro' });
|
|
279
|
+
expect(line1).toContainEqual({ text: 'String', type: 'macro' });
|
|
280
|
+
// Line 2: let items: Vec<i32> = vec![1, 2, 3];
|
|
281
|
+
const line2 = tokens[2].map((t) => ({ text: t.text, type: t.type }));
|
|
282
|
+
expect(line2).toContainEqual({ text: 'Vec', type: 'macro' });
|
|
283
|
+
expect(line2).toContainEqual({ text: 'i32', type: 'macro' });
|
|
284
|
+
expect(line2).toContainEqual({ text: 'vec!', type: 'macro' });
|
|
285
|
+
// Line 3: println!("...")
|
|
286
|
+
const line3 = tokens[3].map((t) => ({ text: t.text, type: t.type }));
|
|
287
|
+
expect(line3).toContainEqual({ text: 'println!', type: 'macro' });
|
|
288
|
+
// Line 4: Some(...)
|
|
289
|
+
const line4 = tokens[4].map((t) => ({ text: t.text, type: t.type }));
|
|
290
|
+
expect(line4).toContainEqual({ text: 'Some', type: 'macro' });
|
|
291
|
+
});
|
|
292
|
+
it('tokenizes Go built-in functions and primitive types to Tier 1 standard', () => {
|
|
293
|
+
const goCode = `package main
|
|
294
|
+
func NewBuffer(size int) (error, any) {
|
|
295
|
+
buf := make([]byte, size)
|
|
296
|
+
println(len(buf))
|
|
297
|
+
return nil, buf
|
|
298
|
+
}`;
|
|
299
|
+
const tokens = tokenizeCode(goCode, 'go');
|
|
300
|
+
expect(tokens).toHaveLength(6);
|
|
301
|
+
// Line 0: package main
|
|
302
|
+
expect(tokens[0].some((t) => t.text === 'package' && t.type === 'keyword')).toBe(true);
|
|
303
|
+
// Line 1: func NewBuffer(size int) (error, any)
|
|
304
|
+
const line1 = tokens[1].map((t) => ({ text: t.text, type: t.type }));
|
|
305
|
+
expect(line1).toContainEqual({ text: 'func', type: 'keyword' });
|
|
306
|
+
expect(line1).toContainEqual({ text: 'int', type: 'macro' });
|
|
307
|
+
expect(line1).toContainEqual({ text: 'error', type: 'macro' });
|
|
308
|
+
expect(line1).toContainEqual({ text: 'any', type: 'macro' });
|
|
309
|
+
// Line 2: make([]byte)
|
|
310
|
+
const line2 = tokens[2].map((t) => ({ text: t.text, type: t.type }));
|
|
311
|
+
expect(line2).toContainEqual({ text: 'make', type: 'function' });
|
|
312
|
+
expect(line2).toContainEqual({ text: 'byte', type: 'macro' });
|
|
313
|
+
// Line 3: len(buf)
|
|
314
|
+
const line3 = tokens[3].map((t) => ({ text: t.text, type: t.type }));
|
|
315
|
+
expect(line3).toContainEqual({ text: 'len', type: 'function' });
|
|
316
|
+
});
|
|
317
|
+
it('tokenizes SQL DDL, constraints, clauses, and data types to Tier 1 standard', () => {
|
|
318
|
+
const sqlCode = `CREATE TABLE users (
|
|
319
|
+
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
320
|
+
email VARCHAR(255) NOT NULL UNIQUE,
|
|
321
|
+
metadata JSONB,
|
|
322
|
+
created_at TIMESTAMPTZ DEFAULT NOW()
|
|
323
|
+
);
|
|
324
|
+
SELECT id, email FROM users WHERE id IS NOT NULL ORDER BY created_at DESC LIMIT 10;`;
|
|
325
|
+
const tokens = tokenizeCode(sqlCode, 'sql');
|
|
326
|
+
expect(tokens).toHaveLength(7);
|
|
327
|
+
// Line 0: CREATE TABLE users (
|
|
328
|
+
const line0 = tokens[0].map((t) => ({ text: t.text.toUpperCase(), type: t.type }));
|
|
329
|
+
expect(line0).toContainEqual({ text: 'CREATE', type: 'keyword' });
|
|
330
|
+
expect(line0).toContainEqual({ text: 'TABLE', type: 'keyword' });
|
|
331
|
+
// Line 1: id UUID PRIMARY KEY DEFAULT ...
|
|
332
|
+
const line1 = tokens[1].map((t) => ({ text: t.text.toUpperCase(), type: t.type }));
|
|
333
|
+
expect(line1).toContainEqual({ text: 'UUID', type: 'macro' });
|
|
334
|
+
expect(line1).toContainEqual({ text: 'PRIMARY', type: 'keyword' });
|
|
335
|
+
expect(line1).toContainEqual({ text: 'KEY', type: 'keyword' });
|
|
336
|
+
expect(line1).toContainEqual({ text: 'DEFAULT', type: 'keyword' });
|
|
337
|
+
// Line 2: VARCHAR
|
|
338
|
+
const line2 = tokens[2].map((t) => ({ text: t.text.toUpperCase(), type: t.type }));
|
|
339
|
+
expect(line2).toContainEqual({ text: 'VARCHAR', type: 'macro' });
|
|
340
|
+
expect(line2).toContainEqual({ text: 'NOT', type: 'keyword' });
|
|
341
|
+
expect(line2).toContainEqual({ text: 'NULL', type: 'keyword' });
|
|
342
|
+
expect(line2).toContainEqual({ text: 'UNIQUE', type: 'keyword' });
|
|
343
|
+
// Line 3: JSONB
|
|
344
|
+
const line3 = tokens[3].map((t) => ({ text: t.text.toUpperCase(), type: t.type }));
|
|
345
|
+
expect(line3).toContainEqual({ text: 'JSONB', type: 'macro' });
|
|
346
|
+
// Line 4: TIMESTAMPTZ
|
|
347
|
+
const line4 = tokens[4].map((t) => ({ text: t.text.toUpperCase(), type: t.type }));
|
|
348
|
+
expect(line4).toContainEqual({ text: 'TIMESTAMPTZ', type: 'macro' });
|
|
349
|
+
// Line 6: SELECT query
|
|
350
|
+
const line6 = tokens[6].map((t) => ({ text: t.text.toUpperCase(), type: t.type }));
|
|
351
|
+
expect(line6).toContainEqual({ text: 'SELECT', type: 'keyword' });
|
|
352
|
+
expect(line6).toContainEqual({ text: 'FROM', type: 'keyword' });
|
|
353
|
+
expect(line6).toContainEqual({ text: 'WHERE', type: 'keyword' });
|
|
354
|
+
expect(line6).toContainEqual({ text: 'ORDER', type: 'keyword' });
|
|
355
|
+
expect(line6).toContainEqual({ text: 'BY', type: 'keyword' });
|
|
356
|
+
expect(line6).toContainEqual({ text: 'DESC', type: 'keyword' });
|
|
357
|
+
expect(line6).toContainEqual({ text: 'LIMIT', type: 'keyword' });
|
|
358
|
+
});
|
|
359
|
+
it('tokenizes GraphQL queries, variables, directives, and scalar types to Tier 1 standard', () => {
|
|
360
|
+
const gqlCode = `query GetUser($userId: ID!, $withDetails: Boolean = true) {
|
|
361
|
+
user(id: $userId) {
|
|
362
|
+
id
|
|
363
|
+
name
|
|
364
|
+
email @include(if: $withDetails)
|
|
365
|
+
}
|
|
366
|
+
}`;
|
|
367
|
+
const tokens = tokenizeCode(gqlCode, 'graphql');
|
|
368
|
+
expect(tokens).toHaveLength(7);
|
|
369
|
+
// Line 0: query GetUser($userId: ID!, $withDetails: Boolean = true)
|
|
370
|
+
const line0 = tokens[0].map((t) => ({ text: t.text, type: t.type }));
|
|
371
|
+
expect(line0).toContainEqual({ text: 'query', type: 'keyword' });
|
|
372
|
+
expect(line0).toContainEqual({ text: '$userId', type: 'macro' });
|
|
373
|
+
expect(line0).toContainEqual({ text: 'ID', type: 'macro' });
|
|
374
|
+
expect(line0).toContainEqual({ text: '$withDetails', type: 'macro' });
|
|
375
|
+
expect(line0).toContainEqual({ text: 'Boolean', type: 'macro' });
|
|
376
|
+
// Line 4: email @include(if: $withDetails)
|
|
377
|
+
const line4 = tokens[4].map((t) => ({ text: t.text, type: t.type }));
|
|
378
|
+
expect(line4).toContainEqual({ text: '@include', type: 'decorator' });
|
|
379
|
+
});
|
|
153
380
|
});
|
|
@@ -318,6 +318,8 @@
|
|
|
318
318
|
>{token.text}</span
|
|
319
319
|
>{:else if token.type === 'macro'}<span
|
|
320
320
|
class="font-semibold text-indigo-600 dark:text-indigo-400">{token.text}</span
|
|
321
|
+
>{:else if token.type === 'decorator'}<span
|
|
322
|
+
class="text-purple-600 dark:text-purple-400">{token.text}</span
|
|
321
323
|
>{:else if token.type === 'number'}<span
|
|
322
324
|
class="text-purple-600 dark:text-purple-400">{token.text}</span
|
|
323
325
|
>{:else if token.type === 'punctuation'}<span
|
|
@@ -378,6 +380,12 @@
|
|
|
378
380
|
<span class="text-amber-600 dark:text-amber-300">{token.text}</span>
|
|
379
381
|
{:else if token.type === 'function'}
|
|
380
382
|
<span class="text-sky-600 dark:text-sky-400">{token.text}</span>
|
|
383
|
+
{:else if token.type === 'macro'}
|
|
384
|
+
<span class="font-semibold text-indigo-600 dark:text-indigo-400"
|
|
385
|
+
>{token.text}</span
|
|
386
|
+
>
|
|
387
|
+
{:else if token.type === 'decorator'}
|
|
388
|
+
<span class="text-purple-600 dark:text-purple-400">{token.text}</span>
|
|
381
389
|
{:else if token.type === 'number'}
|
|
382
390
|
<span class="text-purple-600 dark:text-purple-400">{token.text}</span>
|
|
383
391
|
{:else if token.type === 'punctuation'}
|
|
@@ -437,6 +445,12 @@
|
|
|
437
445
|
<span class="text-amber-600 dark:text-amber-300">{token.text}</span>
|
|
438
446
|
{:else if token.type === 'function'}
|
|
439
447
|
<span class="text-sky-600 dark:text-sky-400">{token.text}</span>
|
|
448
|
+
{:else if token.type === 'macro'}
|
|
449
|
+
<span class="font-semibold text-indigo-600 dark:text-indigo-400"
|
|
450
|
+
>{token.text}</span
|
|
451
|
+
>
|
|
452
|
+
{:else if token.type === 'decorator'}
|
|
453
|
+
<span class="text-purple-600 dark:text-purple-400">{token.text}</span>
|
|
440
454
|
{:else if token.type === 'number'}
|
|
441
455
|
<span class="text-purple-600 dark:text-purple-400">{token.text}</span>
|
|
442
456
|
{:else if token.type === 'punctuation'}
|
|
@@ -49,4 +49,20 @@ describe('CodeDiff Component & Diff Algorithm', () => {
|
|
|
49
49
|
expect(target.textContent).toContain('Greeting.svelte');
|
|
50
50
|
cleanup();
|
|
51
51
|
});
|
|
52
|
+
it('should highlight modern Python 3.13 and macro tokens in diff view', () => {
|
|
53
|
+
const original = `def check(val: object):\n return False`;
|
|
54
|
+
const modified = `@deprecated\ndef check(val: object) -> TypeIs[str]:\n return True`;
|
|
55
|
+
const { target, cleanup } = renderComponent(CodeDiff, {
|
|
56
|
+
original,
|
|
57
|
+
modified,
|
|
58
|
+
filename: 'validator.py',
|
|
59
|
+
language: 'python',
|
|
60
|
+
viewMode: 'unified'
|
|
61
|
+
});
|
|
62
|
+
expect(target.textContent).toContain('@deprecated');
|
|
63
|
+
expect(target.textContent).toContain('TypeIs');
|
|
64
|
+
expect(target.textContent).toContain('+3');
|
|
65
|
+
expect(target.textContent).toContain('-2');
|
|
66
|
+
cleanup();
|
|
67
|
+
});
|
|
52
68
|
});
|
|
@@ -3,35 +3,15 @@ import type { Snippet } from 'svelte';
|
|
|
3
3
|
import type { IconSource } from './Icon.svelte';
|
|
4
4
|
export declare const emptyStateVariants: import("tailwind-variants").TVReturnType<{
|
|
5
5
|
size: {
|
|
6
|
-
sm:
|
|
7
|
-
md:
|
|
8
|
-
lg:
|
|
6
|
+
sm: string;
|
|
7
|
+
md: string;
|
|
8
|
+
lg: string;
|
|
9
9
|
};
|
|
10
10
|
bordered: {
|
|
11
|
-
true:
|
|
12
|
-
false:
|
|
11
|
+
true: string;
|
|
12
|
+
false: string;
|
|
13
13
|
};
|
|
14
|
-
}, undefined, "flex flex-col items-center justify-center text-center p-8 rounded-2xl bg-white dark:bg-neutral-900/50",
|
|
15
|
-
size: {
|
|
16
|
-
sm: "py-6 px-4 gap-2";
|
|
17
|
-
md: "py-10 px-6 gap-3";
|
|
18
|
-
lg: "py-16 px-8 gap-4";
|
|
19
|
-
};
|
|
20
|
-
bordered: {
|
|
21
|
-
true: "border border-dashed border-neutral-300 dark:border-neutral-800";
|
|
22
|
-
false: "border-0";
|
|
23
|
-
};
|
|
24
|
-
}, undefined, import("tailwind-variants").TVReturnTypeLike<{
|
|
25
|
-
size: {
|
|
26
|
-
sm: "py-6 px-4 gap-2";
|
|
27
|
-
md: "py-10 px-6 gap-3";
|
|
28
|
-
lg: "py-16 px-8 gap-4";
|
|
29
|
-
};
|
|
30
|
-
bordered: {
|
|
31
|
-
true: "border border-dashed border-neutral-300 dark:border-neutral-800";
|
|
32
|
-
false: "border-0";
|
|
33
|
-
};
|
|
34
|
-
}, undefined>>;
|
|
14
|
+
}, undefined, "flex flex-col items-center justify-center text-center p-8 rounded-2xl bg-white dark:bg-neutral-900/50", undefined, undefined, undefined>;
|
|
35
15
|
export type EmptyStateProps = VariantProps<typeof emptyStateVariants> & {
|
|
36
16
|
title?: string;
|
|
37
17
|
description?: string;
|
|
@@ -1,29 +1,13 @@
|
|
|
1
1
|
import type { Component, Snippet } from 'svelte';
|
|
2
2
|
export declare const iconVariants: import("tailwind-variants").TVReturnType<{
|
|
3
3
|
size: {
|
|
4
|
-
xs:
|
|
5
|
-
sm:
|
|
6
|
-
md:
|
|
7
|
-
lg:
|
|
8
|
-
xl:
|
|
4
|
+
xs: string;
|
|
5
|
+
sm: string;
|
|
6
|
+
md: string;
|
|
7
|
+
lg: string;
|
|
8
|
+
xl: string;
|
|
9
9
|
};
|
|
10
|
-
}, undefined, "inline-flex shrink-0 items-center justify-center",
|
|
11
|
-
size: {
|
|
12
|
-
xs: "w-3.5 h-3.5";
|
|
13
|
-
sm: "w-4 h-4";
|
|
14
|
-
md: "w-5 h-5";
|
|
15
|
-
lg: "w-6 h-6";
|
|
16
|
-
xl: "w-8 h-8";
|
|
17
|
-
};
|
|
18
|
-
}, undefined, import("tailwind-variants").TVReturnTypeLike<{
|
|
19
|
-
size: {
|
|
20
|
-
xs: "w-3.5 h-3.5";
|
|
21
|
-
sm: "w-4 h-4";
|
|
22
|
-
md: "w-5 h-5";
|
|
23
|
-
lg: "w-6 h-6";
|
|
24
|
-
xl: "w-8 h-8";
|
|
25
|
-
};
|
|
26
|
-
}, undefined>>;
|
|
10
|
+
}, undefined, "inline-flex shrink-0 items-center justify-center", undefined, undefined, undefined>;
|
|
27
11
|
export type IconSource = string | Component<{
|
|
28
12
|
class?: string;
|
|
29
13
|
size?: string | number;
|
|
@@ -2,26 +2,12 @@ import { type VariantProps } from '../../utils/cn.js';
|
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
3
|
export declare const kbdVariants: import("tailwind-variants").TVReturnType<{
|
|
4
4
|
size: {
|
|
5
|
-
xs:
|
|
6
|
-
sm:
|
|
7
|
-
md:
|
|
8
|
-
lg:
|
|
5
|
+
xs: string;
|
|
6
|
+
sm: string;
|
|
7
|
+
md: string;
|
|
8
|
+
lg: string;
|
|
9
9
|
};
|
|
10
|
-
}, undefined, "inline-flex items-center justify-center font-mono font-medium rounded border border-neutral-300 bg-neutral-100 text-neutral-700 shadow-xs dark:border-neutral-700 dark:bg-neutral-800 dark:text-neutral-300 select-none",
|
|
11
|
-
size: {
|
|
12
|
-
xs: "h-4 min-w-[16px] px-1 text-[10px]";
|
|
13
|
-
sm: "h-5 min-w-[20px] px-1.5 text-xs";
|
|
14
|
-
md: "h-6 min-w-[24px] px-2 text-xs";
|
|
15
|
-
lg: "h-7 min-w-[28px] px-2.5 text-sm";
|
|
16
|
-
};
|
|
17
|
-
}, undefined, import("tailwind-variants").TVReturnTypeLike<{
|
|
18
|
-
size: {
|
|
19
|
-
xs: "h-4 min-w-[16px] px-1 text-[10px]";
|
|
20
|
-
sm: "h-5 min-w-[20px] px-1.5 text-xs";
|
|
21
|
-
md: "h-6 min-w-[24px] px-2 text-xs";
|
|
22
|
-
lg: "h-7 min-w-[28px] px-2.5 text-sm";
|
|
23
|
-
};
|
|
24
|
-
}, undefined>>;
|
|
10
|
+
}, undefined, "inline-flex items-center justify-center font-mono font-medium rounded border border-neutral-300 bg-neutral-100 text-neutral-700 shadow-xs dark:border-neutral-700 dark:bg-neutral-800 dark:text-neutral-300 select-none", undefined, undefined, undefined>;
|
|
25
11
|
export type KbdProps = VariantProps<typeof kbdVariants> & {
|
|
26
12
|
value?: string;
|
|
27
13
|
keys?: string[];
|
|
@@ -1,44 +1,18 @@
|
|
|
1
1
|
import { type VariantProps } from '../../utils/cn.js';
|
|
2
2
|
export declare const progressVariants: import("tailwind-variants").TVReturnType<{
|
|
3
3
|
size: {
|
|
4
|
-
xs:
|
|
5
|
-
sm:
|
|
6
|
-
md:
|
|
7
|
-
lg:
|
|
4
|
+
xs: string;
|
|
5
|
+
sm: string;
|
|
6
|
+
md: string;
|
|
7
|
+
lg: string;
|
|
8
8
|
};
|
|
9
9
|
color: {
|
|
10
|
-
primary:
|
|
11
|
-
success:
|
|
12
|
-
warning:
|
|
13
|
-
error:
|
|
10
|
+
primary: string;
|
|
11
|
+
success: string;
|
|
12
|
+
warning: string;
|
|
13
|
+
error: string;
|
|
14
14
|
};
|
|
15
|
-
}, undefined, "relative w-full overflow-hidden rounded-full bg-neutral-200 dark:bg-neutral-800",
|
|
16
|
-
size: {
|
|
17
|
-
xs: "h-1";
|
|
18
|
-
sm: "h-1.5";
|
|
19
|
-
md: "h-2.5";
|
|
20
|
-
lg: "h-4";
|
|
21
|
-
};
|
|
22
|
-
color: {
|
|
23
|
-
primary: "[&>div]:bg-primary-600";
|
|
24
|
-
success: "[&>div]:bg-emerald-600";
|
|
25
|
-
warning: "[&>div]:bg-amber-600";
|
|
26
|
-
error: "[&>div]:bg-rose-600";
|
|
27
|
-
};
|
|
28
|
-
}, undefined, import("tailwind-variants").TVReturnTypeLike<{
|
|
29
|
-
size: {
|
|
30
|
-
xs: "h-1";
|
|
31
|
-
sm: "h-1.5";
|
|
32
|
-
md: "h-2.5";
|
|
33
|
-
lg: "h-4";
|
|
34
|
-
};
|
|
35
|
-
color: {
|
|
36
|
-
primary: "[&>div]:bg-primary-600";
|
|
37
|
-
success: "[&>div]:bg-emerald-600";
|
|
38
|
-
warning: "[&>div]:bg-amber-600";
|
|
39
|
-
error: "[&>div]:bg-rose-600";
|
|
40
|
-
};
|
|
41
|
-
}, undefined>>;
|
|
15
|
+
}, undefined, "relative w-full overflow-hidden rounded-full bg-neutral-200 dark:bg-neutral-800", undefined, undefined, undefined>;
|
|
42
16
|
export type ProgressProps = VariantProps<typeof progressVariants> & {
|
|
43
17
|
value?: number;
|
|
44
18
|
max?: number;
|
|
@@ -1,41 +1,17 @@
|
|
|
1
1
|
import { type VariantProps } from '../../utils/cn.js';
|
|
2
2
|
export declare const skeletonVariants: import("tailwind-variants").TVReturnType<{
|
|
3
3
|
variant: {
|
|
4
|
-
pulse:
|
|
5
|
-
shimmer:
|
|
6
|
-
none:
|
|
4
|
+
pulse: string;
|
|
5
|
+
shimmer: string;
|
|
6
|
+
none: string;
|
|
7
7
|
};
|
|
8
8
|
shape: {
|
|
9
|
-
rectangle:
|
|
10
|
-
circle:
|
|
11
|
-
pill:
|
|
12
|
-
text:
|
|
9
|
+
rectangle: string;
|
|
10
|
+
circle: string;
|
|
11
|
+
pill: string;
|
|
12
|
+
text: string;
|
|
13
13
|
};
|
|
14
|
-
}, undefined, "relative overflow-hidden bg-neutral-200 select-none motion-reduce:animate-none dark:bg-neutral-800",
|
|
15
|
-
variant: {
|
|
16
|
-
pulse: "animate-pulse";
|
|
17
|
-
shimmer: "before:absolute before:inset-0 before:-translate-x-full before:animate-[yaxa-shimmer-slide_1.5s_infinite] before:bg-gradient-to-r before:from-transparent before:via-white/60 before:to-transparent motion-reduce:before:animate-none dark:before:via-white/20";
|
|
18
|
-
none: "";
|
|
19
|
-
};
|
|
20
|
-
shape: {
|
|
21
|
-
rectangle: "rounded-lg";
|
|
22
|
-
circle: "rounded-full aspect-square";
|
|
23
|
-
pill: "rounded-full";
|
|
24
|
-
text: "rounded h-4 my-1";
|
|
25
|
-
};
|
|
26
|
-
}, undefined, import("tailwind-variants").TVReturnTypeLike<{
|
|
27
|
-
variant: {
|
|
28
|
-
pulse: "animate-pulse";
|
|
29
|
-
shimmer: "before:absolute before:inset-0 before:-translate-x-full before:animate-[yaxa-shimmer-slide_1.5s_infinite] before:bg-gradient-to-r before:from-transparent before:via-white/60 before:to-transparent motion-reduce:before:animate-none dark:before:via-white/20";
|
|
30
|
-
none: "";
|
|
31
|
-
};
|
|
32
|
-
shape: {
|
|
33
|
-
rectangle: "rounded-lg";
|
|
34
|
-
circle: "rounded-full aspect-square";
|
|
35
|
-
pill: "rounded-full";
|
|
36
|
-
text: "rounded h-4 my-1";
|
|
37
|
-
};
|
|
38
|
-
}, undefined>>;
|
|
14
|
+
}, undefined, "relative overflow-hidden bg-neutral-200 select-none motion-reduce:animate-none dark:bg-neutral-800", undefined, undefined, undefined>;
|
|
39
15
|
export type SkeletonRecipe = 'card' | 'user' | 'table-row' | 'metric';
|
|
40
16
|
export type SkeletonProps = VariantProps<typeof skeletonVariants> & {
|
|
41
17
|
recipe?: SkeletonRecipe;
|
|
@@ -5,7 +5,7 @@ export interface TerminalLine {
|
|
|
5
5
|
comment?: string;
|
|
6
6
|
prompt?: string;
|
|
7
7
|
}
|
|
8
|
-
export declare const terminalVariants: import("tailwind-variants").TVReturnType<{}
|
|
8
|
+
export declare const terminalVariants: import("tailwind-variants").TVReturnType<{}, undefined, "w-full overflow-hidden rounded-xl border border-neutral-800 bg-neutral-950 font-mono shadow-2xl transition-all", undefined, undefined, undefined>;
|
|
9
9
|
export type TerminalProps = VariantProps<typeof terminalVariants> & {
|
|
10
10
|
title?: string;
|
|
11
11
|
lines?: TerminalLine[];
|
|
@@ -12,23 +12,11 @@ export interface TimelineItem {
|
|
|
12
12
|
}
|
|
13
13
|
export declare const timelineVariants: import("tailwind-variants").TVReturnType<{
|
|
14
14
|
size: {
|
|
15
|
-
sm:
|
|
16
|
-
md:
|
|
17
|
-
lg:
|
|
15
|
+
sm: string;
|
|
16
|
+
md: string;
|
|
17
|
+
lg: string;
|
|
18
18
|
};
|
|
19
|
-
}, undefined, "relative space-y-6",
|
|
20
|
-
size: {
|
|
21
|
-
sm: "space-y-4 text-xs";
|
|
22
|
-
md: "space-y-6 text-sm";
|
|
23
|
-
lg: "space-y-8 text-base";
|
|
24
|
-
};
|
|
25
|
-
}, undefined, import("tailwind-variants").TVReturnTypeLike<{
|
|
26
|
-
size: {
|
|
27
|
-
sm: "space-y-4 text-xs";
|
|
28
|
-
md: "space-y-6 text-sm";
|
|
29
|
-
lg: "space-y-8 text-base";
|
|
30
|
-
};
|
|
31
|
-
}, undefined>>;
|
|
19
|
+
}, undefined, "relative space-y-6", undefined, undefined, undefined>;
|
|
32
20
|
export type TimelineProps = VariantProps<typeof timelineVariants> & {
|
|
33
21
|
items?: TimelineItem[];
|
|
34
22
|
itemSnippet?: Snippet<[TimelineItem]>;
|
|
@@ -10,20 +10,10 @@ export interface TreeNode {
|
|
|
10
10
|
}
|
|
11
11
|
export declare const treeVariants: import("tailwind-variants").TVReturnType<{
|
|
12
12
|
size: {
|
|
13
|
-
sm:
|
|
14
|
-
md:
|
|
13
|
+
sm: string;
|
|
14
|
+
md: string;
|
|
15
15
|
};
|
|
16
|
-
}, undefined, "w-full select-none font-sans text-xs",
|
|
17
|
-
size: {
|
|
18
|
-
sm: "text-xs";
|
|
19
|
-
md: "text-sm";
|
|
20
|
-
};
|
|
21
|
-
}, undefined, import("tailwind-variants").TVReturnTypeLike<{
|
|
22
|
-
size: {
|
|
23
|
-
sm: "text-xs";
|
|
24
|
-
md: "text-sm";
|
|
25
|
-
};
|
|
26
|
-
}, undefined>>;
|
|
16
|
+
}, undefined, "w-full select-none font-sans text-xs", undefined, undefined, undefined>;
|
|
27
17
|
export type TreeProps = VariantProps<typeof treeVariants> & {
|
|
28
18
|
items?: TreeNode[];
|
|
29
19
|
selectedId?: string;
|
|
@@ -2,20 +2,10 @@ import { type VariantProps } from '../../utils/cn.js';
|
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
3
|
export declare const virtualListVariants: import("tailwind-variants").TVReturnType<{
|
|
4
4
|
bordered: {
|
|
5
|
-
true:
|
|
6
|
-
false:
|
|
5
|
+
true: string;
|
|
6
|
+
false: string;
|
|
7
7
|
};
|
|
8
|
-
}, undefined, "relative w-full overflow-y-auto rounded-xl border border-neutral-200 bg-white dark:border-neutral-800 dark:bg-neutral-900",
|
|
9
|
-
bordered: {
|
|
10
|
-
true: "border border-neutral-200 dark:border-neutral-800";
|
|
11
|
-
false: "border-0";
|
|
12
|
-
};
|
|
13
|
-
}, undefined, import("tailwind-variants").TVReturnTypeLike<{
|
|
14
|
-
bordered: {
|
|
15
|
-
true: "border border-neutral-200 dark:border-neutral-800";
|
|
16
|
-
false: "border-0";
|
|
17
|
-
};
|
|
18
|
-
}, undefined>>;
|
|
8
|
+
}, undefined, "relative w-full overflow-y-auto rounded-xl border border-neutral-200 bg-white dark:border-neutral-800 dark:bg-neutral-900", undefined, undefined, undefined>;
|
|
19
9
|
export type VirtualListProps<T> = VariantProps<typeof virtualListVariants> & {
|
|
20
10
|
items: T[];
|
|
21
11
|
itemHeight?: number;
|
|
@@ -10,38 +10,16 @@ export interface ComboboxOption {
|
|
|
10
10
|
}
|
|
11
11
|
export declare const comboboxVariants: import("tailwind-variants").TVReturnType<{
|
|
12
12
|
size: {
|
|
13
|
-
sm:
|
|
14
|
-
md:
|
|
15
|
-
lg:
|
|
13
|
+
sm: string;
|
|
14
|
+
md: string;
|
|
15
|
+
lg: string;
|
|
16
16
|
};
|
|
17
17
|
status: {
|
|
18
|
-
default:
|
|
19
|
-
error:
|
|
20
|
-
success:
|
|
18
|
+
default: string;
|
|
19
|
+
error: string;
|
|
20
|
+
success: string;
|
|
21
21
|
};
|
|
22
|
-
}, undefined, "flex w-full items-center justify-between rounded-lg border bg-white text-neutral-900 transition-all duration-150 focus:outline-none focus:ring-2 disabled:cursor-not-allowed disabled:opacity-50 dark:bg-neutral-900 dark:text-neutral-100",
|
|
23
|
-
size: {
|
|
24
|
-
sm: "h-9 px-3 text-xs gap-2";
|
|
25
|
-
md: "h-10 px-3.5 text-sm gap-2.5";
|
|
26
|
-
lg: "h-12 px-4 text-base gap-3";
|
|
27
|
-
};
|
|
28
|
-
status: {
|
|
29
|
-
default: "border-neutral-300 focus:border-primary-500 focus:ring-primary-500/20 dark:border-neutral-700";
|
|
30
|
-
error: "border-rose-500 text-rose-900 focus:border-rose-500 focus:ring-rose-500/20 dark:text-rose-100";
|
|
31
|
-
success: "border-emerald-500 focus:border-emerald-500 focus:ring-emerald-500/20 dark:border-emerald-500";
|
|
32
|
-
};
|
|
33
|
-
}, undefined, import("tailwind-variants").TVReturnTypeLike<{
|
|
34
|
-
size: {
|
|
35
|
-
sm: "h-9 px-3 text-xs gap-2";
|
|
36
|
-
md: "h-10 px-3.5 text-sm gap-2.5";
|
|
37
|
-
lg: "h-12 px-4 text-base gap-3";
|
|
38
|
-
};
|
|
39
|
-
status: {
|
|
40
|
-
default: "border-neutral-300 focus:border-primary-500 focus:ring-primary-500/20 dark:border-neutral-700";
|
|
41
|
-
error: "border-rose-500 text-rose-900 focus:border-rose-500 focus:ring-rose-500/20 dark:text-rose-100";
|
|
42
|
-
success: "border-emerald-500 focus:border-emerald-500 focus:ring-emerald-500/20 dark:border-emerald-500";
|
|
43
|
-
};
|
|
44
|
-
}, undefined>>;
|
|
22
|
+
}, undefined, "flex w-full items-center justify-between rounded-lg border bg-white text-neutral-900 transition-all duration-150 focus:outline-none focus:ring-2 disabled:cursor-not-allowed disabled:opacity-50 dark:bg-neutral-900 dark:text-neutral-100", undefined, undefined, undefined>;
|
|
45
23
|
export type ComboboxProps = VariantProps<typeof comboboxVariants> & {
|
|
46
24
|
id?: string;
|
|
47
25
|
value?: string;
|