sveld 0.38.1 → 0.38.3

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/browser.d.ts CHANGED
@@ -14,11 +14,6 @@ interface ComponentParserDiagnostics {
14
14
  }
15
15
 
16
16
  export class ComponentParser {
17
- /**
18
- * All per-parse mutable state (props, slots, events, scopes, source, etc.).
19
- * See {@link ParserContext} for field-by-field documentation. Replaced
20
- * wholesale by `cleanup()` between parses.
21
- */
22
17
  private ctx;
23
18
  /**
24
19
  * Resets parser state for reuse between parses.
@@ -59,9 +54,9 @@ interface JsDocPassthroughTag {
59
54
  type DeprecatedValue = string | true;
60
55
 
61
56
  interface SourcePosition {
62
- /** 1-based source line number */
57
+ /** 1-based. */
63
58
  line: number;
64
- /** 0-based source column number */
59
+ /** 0-based. */
65
60
  column: number;
66
61
  }
67
62
 
@@ -124,13 +119,9 @@ interface PendingDispatchEscapeCandidate {
124
119
  }
125
120
 
126
121
  interface PendingCrossFileCandidates {
127
- /** Unresolved CallExpression defaults. */
128
122
  pendingCallDefaultCandidates?: PendingCallDefaultCandidate[];
129
- /** Imported-identifier defaults. */
130
123
  pendingConstDefaultCandidates?: PendingConstDefaultCandidate[];
131
- /** Unresolved `setContext` import keys. */
132
124
  pendingContextKeyCandidates?: PendingContextKeyCandidate[];
133
- /** Dispatchers passed to imported functions. */
134
125
  pendingDispatchEscapeCandidates?: PendingDispatchEscapeCandidate[];
135
126
  /**
136
127
  * `event-no-source` diagnostics held back while the dispatcher escapes to
@@ -176,13 +167,9 @@ interface ComponentPropDefaultValue {
176
167
  type ComponentPropBinding = "readonly" | "writable";
177
168
 
178
169
  interface ComponentPropParam {
179
- /** Parameter name. */
180
170
  name: string;
181
- /** Parameter type (e.g. `"string"`, `"CustomType"`). */
182
171
  type: string;
183
- /** From JSDoc `@param`. */
184
172
  description?: string;
185
- /** True when optional. */
186
173
  optional?: boolean;
187
174
  }
188
175
 
@@ -229,7 +216,6 @@ interface ComponentProp {
229
216
  kind: "let" | "const" | "function" | "re-export" | "class";
230
217
  /** True when declared with `const`. */
231
218
  constant: boolean;
232
- /** TypeScript type text. */
233
219
  type?: string;
234
220
  /** Conservative provenance for the prop type. See the precedence rule on {@link ComponentProp}. */
235
221
  typeSource?: ComponentPropTypeSource;
@@ -266,7 +252,6 @@ interface ComponentProp {
266
252
  * type/JSDoc signature in runes only (see {@link ComponentProp}).
267
253
  */
268
254
  isFunction: boolean;
269
- /** True for `function` declarations. */
270
255
  isFunctionDeclaration: boolean;
271
256
  /** True when declared with `let` and no default. */
272
257
  isRequired: boolean;
@@ -287,14 +272,12 @@ interface ComponentProp {
287
272
  internal?: boolean;
288
273
  /** Set when `kind` is `"re-export"`. */
289
274
  reExport?: ComponentPropReExport;
290
- /** Source range when available. */
291
275
  source?: SourceRange;
292
276
  }
293
277
 
294
278
  interface ComponentSlot {
295
- /** Slot name (`null` for the default slot). */
279
+ /** `null` for the default slot. */
296
280
  name?: string | null;
297
- /** True for the default slot. */
298
281
  default: boolean;
299
282
  /** Fallback content when the slot is empty. */
300
283
  fallback?: string;
@@ -308,16 +291,12 @@ interface ComponentSlot {
308
291
  tags?: JsDocPassthroughTag[];
309
292
  /** True from `@ignore`/`@internal` JSDoc; excluded from every output by `buildComponentApiDocument`. */
310
293
  internal?: boolean;
311
- /** Source range when available. */
312
294
  source?: SourceRange;
313
295
  }
314
296
 
315
297
  interface DispatchedEvent {
316
- /** Discriminator: `"dispatched"`. */
317
298
  type: "dispatched";
318
- /** Event name. */
319
299
  name: string;
320
- /** Detail type text. */
321
300
  detail?: string;
322
301
  /** From JSDoc `@event`. */
323
302
  description?: string;
@@ -327,14 +306,11 @@ interface DispatchedEvent {
327
306
  tags?: JsDocPassthroughTag[];
328
307
  /** True from `@ignore`/`@internal` JSDoc; excluded from every output by `buildComponentApiDocument`. */
329
308
  internal?: boolean;
330
- /** Source range when available. */
331
309
  source?: SourceRange;
332
310
  }
333
311
 
334
312
  interface SerializedForwardedEvent {
335
- /** Discriminator: `"forwarded"`. */
336
313
  type: "forwarded";
337
- /** Event name. */
338
314
  name: string;
339
315
  /** Element name as a string for JSON output. */
340
316
  element: string;
@@ -348,7 +324,6 @@ interface SerializedForwardedEvent {
348
324
  tags?: JsDocPassthroughTag[];
349
325
  /** True from `@ignore`/`@internal` JSDoc; excluded from every output by `buildComponentApiDocument`. */
350
326
  internal?: boolean;
351
- /** Source range when available. */
352
327
  source?: SourceRange;
353
328
  }
354
329
 
@@ -357,9 +332,7 @@ export type SerializedComponentEvent = SerializedForwardedEvent | DispatchedEven
357
332
  interface TypeDef {
358
333
  /** Type text (e.g. `"{ x: number; y: number }"`). */
359
334
  type: string;
360
- /** Type name. */
361
335
  name: string;
362
- /** From JSDoc. */
363
336
  description?: string;
364
337
  /** Full `type` alias declaration text. */
365
338
  ts: string;
@@ -374,9 +347,7 @@ interface TypeDef {
374
347
  type ComponentGenerics = [name: string, type: string] | null;
375
348
 
376
349
  interface ComponentInlineElement {
377
- /** Discriminator: `"InlineComponent"`. */
378
350
  type: "InlineComponent";
379
- /** Component name. */
380
351
  name: string;
381
352
  }
382
353
 
@@ -441,20 +412,15 @@ interface ComponentCssProperty {
441
412
  }
442
413
 
443
414
  interface ComponentContextProp {
444
- /** Property name. */
445
415
  name: string;
446
- /** Property type text. */
447
416
  type: string;
448
- /** From JSDoc. */
449
417
  description?: string;
450
- /** True when optional. */
451
418
  optional: boolean;
452
419
  /** True from `@ignore`/`@internal` JSDoc; excluded from every output by `buildComponentApiDocument`. */
453
420
  internal?: boolean;
454
421
  }
455
422
 
456
423
  interface ComponentContext {
457
- /** Context key from `setContext`. */
458
424
  key: string;
459
425
  /** Generated type name (e.g. `"ModalContext"`). */
460
426
  typeName: string;
@@ -464,9 +430,8 @@ interface ComponentContext {
464
430
  * when untyped). `properties` is empty then.
465
431
  */
466
432
  type?: string;
467
- /** From JSDoc. */
468
433
  description?: string;
469
- /** Context object properties. Empty when {@link ComponentContext.type} is set. */
434
+ /** Empty when {@link ComponentContext.type} is set. */
470
435
  properties: ComponentContextProp[];
471
436
  /** True when a `{...spread}` in the context's object literal couldn't be resolved; the generated type intersects with `Record<string, any>`. */
472
437
  hasUnresolvedSpread?: boolean;
@@ -477,7 +442,6 @@ interface ComponentContext {
477
442
  }
478
443
 
479
444
  interface ParsedComponent {
480
- /** Source range of the parsed file. */
481
445
  source?: SourceRange;
482
446
  syntaxMode: SyntaxMode;
483
447
  scriptLanguage?: ScriptLanguage;
@@ -503,15 +467,13 @@ interface ParsedComponent {
503
467
  cssParts?: ComponentCssPart[];
504
468
  /** From component-level `@cssprop`/`@cssproperty` JSDoc tags. */
505
469
  cssProperties?: ComponentCssProperty[];
506
- /**
507
- * Type guesses from this parse (unknown props, `any` contexts, orphan `@event` tags).
508
- */
470
+ /** Type guesses from this parse (unknown props, `any` contexts, orphan `@event` tags). */
509
471
  diagnostics?: SveldDiagnostic[];
510
472
  /** Writer-only TypeScript metadata. Not serialized to JSON. */
511
473
  [PARSED_COMPONENT_TYPE_SCRIPT_METADATA]?: ParsedComponentTypeScriptMetadata;
512
474
  }
513
475
 
514
- export type SveldDiagnosticKind = "prop-unknown-type" | "context-any-type" | "slot-missing-type" | "event-no-source" | "dispatch-escapes" | "example-compile-error" | "example-syntax-error" | "syntax-skipped" | "type-syntax-error" | "rest-props-unresolved" | "context-duplicate-key" | "context-key-unresolved" | "context-value-unresolved" | "spread-unresolved" | "export-unresolved" | "module-export-conflict" | "extend-props-target-missing" | "extend-props-duplicate" | "extend-props-override" | "jsdoc-unknown-tag" | "typedef-duplicate" | "property-duplicate" | "generics-conflict" | "event-description-ambiguous" | "jsdoc-tag-dropped" | "internal-typedef-referenced" | "cross-file-unresolved" | "export-ambiguous";
476
+ export type SveldDiagnosticKind = "prop-unknown-type" | "context-any-type" | "slot-missing-type" | "slot-not-rendered" | "event-no-source" | "dispatch-escapes" | "example-compile-error" | "example-syntax-error" | "syntax-skipped" | "type-syntax-error" | "rest-props-unresolved" | "context-duplicate-key" | "context-key-unresolved" | "context-value-unresolved" | "spread-unresolved" | "export-unresolved" | "module-export-conflict" | "extend-props-target-missing" | "extend-props-duplicate" | "extend-props-override" | "jsdoc-unknown-tag" | "typedef-duplicate" | "property-duplicate" | "generics-conflict" | "event-description-ambiguous" | "jsdoc-tag-dropped" | "internal-typedef-referenced" | "cross-file-unresolved" | "export-ambiguous";
515
477
 
516
478
  type SveldDiagnosticSeverity = "error" | "warning";
517
479
 
@@ -645,10 +607,9 @@ export interface WriteTsDefinitionOptions {
645
607
  /**
646
608
  * `"class"` (default) extends the deprecated `SvelteComponentTyped`.
647
609
  * `"component"` emits `declare const X: Component<Props, Exports, Bindings>`
648
- * instead, for Svelte 5+ consumers. Generic components get a per-component
649
- * interface with a generic call signature instead of `Component<...>`
650
- * directly, since a `declare const` can't itself carry a generic type
651
- * parameter (see `genGenericComponentDeclaration`).
610
+ * instead, for Svelte 5+ consumers. Generic components and components with
611
+ * events get a per-component interface instead, since a `declare const`
612
+ * can't carry a generic type parameter and `Component` has no events slot.
652
613
  */
653
614
  format?: "class" | "component";
654
615
  }