sveld 0.40.5 → 0.40.6

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
@@ -78,14 +78,20 @@ interface PendingConstDefaultCandidate {
78
78
  location: "props" | "moduleExports";
79
79
  importSource: string;
80
80
  importedName: string;
81
- /** Members read off the import, through namespace exports: `["DELAY"]` for `C.timing.DELAY`. */
81
+ /**
82
+ * Members read off the import, through namespace exports: `["DELAY"]`
83
+ * for `C.timing.DELAY`.
84
+ */
82
85
  members?: string[];
83
86
  }
84
87
 
85
88
  interface PendingContextKeyCandidate {
86
89
  importSource: string;
87
90
  importedName: string;
88
- /** Members read off the import, through namespace exports: `["THEME"]` for `ns.keys.THEME`. */
91
+ /**
92
+ * Members read off the import, through namespace exports: `["THEME"]`
93
+ * for `ns.keys.THEME`.
94
+ */
89
95
  members?: string[];
90
96
  /** See {@link ComponentContext.type}. */
91
97
  type?: string;
@@ -102,7 +108,10 @@ interface PendingContextKeyCandidate {
102
108
  interface PendingDispatchEscapeCandidate {
103
109
  importSource: string;
104
110
  importedName: string;
105
- /** Members read off the import, through namespace exports: `["helper"]` for `ns.helper`. */
111
+ /**
112
+ * Members read off the import, through namespace exports: `["helper"]`
113
+ * for `ns.helper`.
114
+ */
106
115
  members?: string[];
107
116
  /** Callee as written, for messages. */
108
117
  calleeText: string;
@@ -110,7 +119,10 @@ interface PendingDispatchEscapeCandidate {
110
119
  dispatcherName: string;
111
120
  /** Argument position the dispatcher is passed at. */
112
121
  argumentIndex: number;
113
- /** Set when passed as an object literal property (`{ dispatch }`): that property's key. */
122
+ /**
123
+ * Set when passed as an object literal property (`{ dispatch }`): that
124
+ * property's key.
125
+ */
114
126
  property?: string;
115
127
  /** Source range of the call, when available. */
116
128
  source?: SourceRange;
@@ -125,7 +137,8 @@ interface PendingCrossFileCandidates {
125
137
  pendingDispatchEscapeCandidates?: PendingDispatchEscapeCandidate[];
126
138
  /**
127
139
  * `event-no-source` diagnostics held back while the dispatcher escapes to
128
- * imported functions: the cross-file pass keeps those the functions don't dispatch.
140
+ * imported functions: the cross-file pass keeps those the functions
141
+ * don't dispatch.
129
142
  */
130
143
  deferredEventNoSourceDiagnostics?: SveldDiagnostic[];
131
144
  /**
@@ -139,7 +152,10 @@ interface ParsedComponentTypeScriptMetadata extends PendingCrossFileCandidates {
139
152
  canonicalPropsType?: string;
140
153
  canonicalPropNames: string[];
141
154
  localTypeDeclarations: string[];
142
- /** Types the module script exports (`export interface Item`), emitted with `export`. */
155
+ /**
156
+ * Types the module script exports (`export interface Item`), emitted
157
+ * with `export`.
158
+ */
143
159
  moduleTypeDeclarations?: string[];
144
160
  typeImportStatements: string[];
145
161
  }
@@ -176,25 +192,41 @@ interface ComponentPropParam {
176
192
  interface ComponentPropReExport {
177
193
  /** Module specifier as written in the source (e.g. `"./utils.js"`). */
178
194
  from: string;
179
- /** Name `from` exports: `"default"` for a default import, `"*"` for `export *` or a namespace import. */
195
+ /**
196
+ * Name `from` exports: `"default"` for a default import, `"*"` for
197
+ * `export *` or a namespace import.
198
+ */
180
199
  imported: string;
181
200
  }
182
201
 
183
202
  interface ComponentClassMember {
184
203
  /**
185
- * `"property"` covers fields, constructor parameter properties, and getter/setter pairs;
186
- * `"index"` is an index signature (`[key: string]: unknown`).
204
+ * `"property"` covers fields, constructor parameter properties, and
205
+ * getter/setter pairs; `"index"` is an index
206
+ * signature (`[key: string]: unknown`).
187
207
  */
188
208
  kind: "constructor" | "method" | "property" | "index";
189
- /** Member name; `"constructor"` for the constructor, the bracketed key (`[key: string]`) for an index signature. */
209
+ /**
210
+ * Member name; `"constructor"` for the constructor, the bracketed key
211
+ * (`[key: string]`) for an index signature.
212
+ */
190
213
  name: string;
191
214
  /** Property type text; `"any"` when neither TypeScript nor JSDoc types it. */
192
215
  type?: string;
193
- /** Method or constructor parameters, typed from TypeScript or JSDoc `@param`, else `"any"`. A rest parameter's name starts with `...`. */
216
+ /**
217
+ * Method or constructor parameters, typed from TypeScript or JSDoc
218
+ * `@param`, else `"any"`. A rest parameter's name starts with `...`.
219
+ */
194
220
  params?: ComponentPropParam[];
195
- /** Method return type from TypeScript or JSDoc `@returns`; unset when neither gives one. */
221
+ /**
222
+ * Method return type from TypeScript or JSDoc `@returns`; unset when
223
+ * neither gives one.
224
+ */
196
225
  returnType?: string;
197
- /** A method's own type parameter list (`U extends object`), without the angle brackets. */
226
+ /**
227
+ * A method's own type parameter list (`U extends object`), without the
228
+ * angle brackets.
229
+ */
198
230
  typeParameters?: string;
199
231
  static?: true;
200
232
  /** A `readonly` field, or a getter with no setter. */
@@ -220,15 +252,27 @@ interface ComponentProp {
220
252
  /** True when declared with `const`. */
221
253
  constant: boolean;
222
254
  type?: string;
223
- /** Conservative provenance for the prop type. See the precedence rule on {@link ComponentProp}. */
255
+ /**
256
+ * Conservative provenance for the prop type. See the precedence rule on
257
+ * {@link ComponentProp}.
258
+ */
224
259
  typeSource?: ComponentPropTypeSource;
225
260
  /** Local binding when it differs from the public name. */
226
261
  localName?: string;
227
- /** Default value as source text; unset when the prop has no initializer/default. */
262
+ /**
263
+ * Default value as source text; unset when the prop has
264
+ * no initializer/default.
265
+ */
228
266
  value?: string;
229
- /** Structured default value metadata for docs UIs; set alongside `value` from the same initializer. */
267
+ /**
268
+ * Structured default value metadata for docs UIs; set alongside `value`
269
+ * from the same initializer.
270
+ */
230
271
  defaultValue?: ComponentPropDefaultValue;
231
- /** From JSDoc, or a matching `@typedef`'s own description (legacy only; see {@link ComponentProp}). */
272
+ /**
273
+ * From JSDoc, or a matching `@typedef`'s own description (legacy only; see
274
+ * {@link ComponentProp}).
275
+ */
232
276
  description?: string;
233
277
  /** From JSDoc `@param` on function props. */
234
278
  params?: ComponentPropParam[];
@@ -237,17 +281,23 @@ interface ComponentProp {
237
281
  /**
238
282
  * A function's own type parameter list from its `@template` tags (e.g.
239
283
  * `T extends { id: string }`), without the angle brackets. Also prefixed
240
- * onto `type` when that signature is built from `@param`/`@returns`.
241
- * For a `"class"`, the class's type parameters, from TypeScript or `@template`.
284
+ * onto `type` when that signature is built from `@param`/`@returns`. For a
285
+ * `"class"`, the class's type parameters, from TypeScript or `@template`.
242
286
  */
243
287
  typeParameters?: string;
244
- /** Set when `kind` is `"class"`: its public constructor, methods, and properties, in source order. */
288
+ /**
289
+ * Set when `kind` is `"class"`: its public constructor, methods, and
290
+ * properties, in source order.
291
+ */
245
292
  members?: ComponentClassMember[];
246
293
  /** Set when `kind` is `"class"` and the class is `abstract`. */
247
294
  abstract?: true;
248
295
  /** Set when `kind` is `"class"` and it extends a base class: `Base<T>`. */
249
296
  extends?: string;
250
- /** Set when `kind` is `"class"` and it implements interfaces: `["Disposable"]`. */
297
+ /**
298
+ * Set when `kind` is `"class"` and it
299
+ * implements interfaces: `["Disposable"]`.
300
+ */
251
301
  implements?: string[];
252
302
  /**
253
303
  * True for arrow/function-expression initializers and bare `function`
@@ -271,7 +321,10 @@ interface ComponentProp {
271
321
  deprecated?: DeprecatedValue;
272
322
  /** `@since` / `@example` tags in source order. */
273
323
  tags?: JsDocPassthroughTag[];
274
- /** True from `@ignore`/`@internal` JSDoc; excluded from every output by `buildComponentApiDocument`. */
324
+ /**
325
+ * True from `@ignore`/`@internal` JSDoc; excluded from every output
326
+ * by `buildComponentApiDocument`.
327
+ */
275
328
  internal?: boolean;
276
329
  /** Set when `kind` is `"re-export"`. */
277
330
  reExport?: ComponentPropReExport;
@@ -290,9 +343,15 @@ interface ComponentSlot {
290
343
  description?: string;
291
344
  /** From `@deprecated` JSDoc. */
292
345
  deprecated?: DeprecatedValue;
293
- /** Tags between the description and `@slot`/`@snippet` (e.g. `@example`), in source order. */
346
+ /**
347
+ * Tags between the description and `@slot`/`@snippet` (e.g. `@example`),
348
+ * in source order.
349
+ */
294
350
  tags?: JsDocPassthroughTag[];
295
- /** True from `@ignore`/`@internal` JSDoc; excluded from every output by `buildComponentApiDocument`. */
351
+ /**
352
+ * True from `@ignore`/`@internal` JSDoc; excluded from every output
353
+ * by `buildComponentApiDocument`.
354
+ */
296
355
  internal?: boolean;
297
356
  source?: SourceRange;
298
357
  }
@@ -307,7 +366,10 @@ interface DispatchedEvent {
307
366
  deprecated?: DeprecatedValue;
308
367
  /** `@since` / `@example` tags in source order. */
309
368
  tags?: JsDocPassthroughTag[];
310
- /** True from `@ignore`/`@internal` JSDoc; excluded from every output by `buildComponentApiDocument`. */
369
+ /**
370
+ * True from `@ignore`/`@internal` JSDoc; excluded from every output
371
+ * by `buildComponentApiDocument`.
372
+ */
311
373
  internal?: boolean;
312
374
  source?: SourceRange;
313
375
  }
@@ -325,7 +387,10 @@ interface SerializedForwardedEvent {
325
387
  detail?: string;
326
388
  /** `@since` / `@example` tags in source order. */
327
389
  tags?: JsDocPassthroughTag[];
328
- /** True from `@ignore`/`@internal` JSDoc; excluded from every output by `buildComponentApiDocument`. */
390
+ /**
391
+ * True from `@ignore`/`@internal` JSDoc; excluded from every output
392
+ * by `buildComponentApiDocument`.
393
+ */
329
394
  internal?: boolean;
330
395
  source?: SourceRange;
331
396
  }
@@ -339,9 +404,15 @@ interface TypeDef {
339
404
  description?: string;
340
405
  /** Full `type` alias declaration text. */
341
406
  ts: string;
342
- /** Tags in the same block (e.g. `@since`, `@example`, `@see`), in source order. */
407
+ /**
408
+ * Tags in the same block (e.g. `@since`, `@example`, `@see`), in
409
+ * source order.
410
+ */
343
411
  tags?: JsDocPassthroughTag[];
344
- /** True from `@ignore`/`@internal` JSDoc; excluded from every output by `buildComponentApiDocument`. */
412
+ /**
413
+ * True from `@ignore`/`@internal` JSDoc; excluded from every output
414
+ * by `buildComponentApiDocument`.
415
+ */
345
416
  internal?: boolean;
346
417
  /** Source range of the `@typedef`/`@callback` tag, when available. */
347
418
  source?: SourceRange;
@@ -358,7 +429,8 @@ interface ComponentElement {
358
429
  type: "Element";
359
430
  name: string;
360
431
  /**
361
- * Static tag for `svelte:element this="div"`. Undefined when `this` is dynamic.
432
+ * Static tag for `svelte:element this="div"`. Undefined when `this`
433
+ * is dynamic.
362
434
  *
363
435
  * @example
364
436
  * ```svelte
@@ -393,7 +465,11 @@ interface Extends {
393
465
  type CustomElementPropType = "String" | "Boolean" | "Number" | "Array" | "Object";
394
466
 
395
467
  interface CustomElementPropConfig {
396
- /** Explicit attribute name. Svelte itself always observes every prop as an attribute; sveld's own output omits the attribute entirely when this is `false`. */
468
+ /**
469
+ * Explicit attribute name. Svelte itself always observes every prop as an
470
+ * attribute; sveld's own output omits the attribute entirely when this
471
+ * is `false`.
472
+ */
397
473
  attribute?: string | false;
398
474
  reflect?: boolean;
399
475
  type?: CustomElementPropType;
@@ -424,7 +500,10 @@ interface ComponentContextProp {
424
500
  type: string;
425
501
  description?: string;
426
502
  optional: boolean;
427
- /** True from `@ignore`/`@internal` JSDoc; excluded from every output by `buildComponentApiDocument`. */
503
+ /**
504
+ * True from `@ignore`/`@internal` JSDoc; excluded from every output
505
+ * by `buildComponentApiDocument`.
506
+ */
428
507
  internal?: boolean;
429
508
  }
430
509
 
@@ -433,17 +512,23 @@ interface ComponentContext {
433
512
  /** Generated type name (e.g. `"ModalContext"`). */
434
513
  typeName: string;
435
514
  /**
436
- * The context's whole type, when the `setContext` value is a variable whose
437
- * type isn't an object type literal (`ModalAPI`, `Writable<number>`, or `any`
438
- * when untyped). `properties` is empty then.
515
+ * The context's whole type, when the `setContext` value is a variable
516
+ * whose type isn't an object type literal (`ModalAPI`, `Writable<number>`,
517
+ * or `any` when untyped). `properties` is empty then.
439
518
  */
440
519
  type?: string;
441
520
  description?: string;
442
521
  /** Empty when {@link ComponentContext.type} is set. */
443
522
  properties: ComponentContextProp[];
444
- /** True when a `{...spread}` in the context's object literal couldn't be resolved; the generated type intersects with `Record<string, any>`. */
523
+ /**
524
+ * True when a `{...spread}` in the context's object literal couldn't be
525
+ * resolved; the generated type intersects with `Record<string, any>`.
526
+ */
445
527
  hasUnresolvedSpread?: boolean;
446
- /** True from `@ignore`/`@internal` JSDoc on the `setContext` call; excluded from every output by `buildComponentApiDocument`. */
528
+ /**
529
+ * True from `@ignore`/`@internal` JSDoc on the `setContext` call; excluded
530
+ * from every output by `buildComponentApiDocument`.
531
+ */
447
532
  internal?: boolean;
448
533
  /** Source range of the `setContext(...)` call, when available. */
449
534
  source?: SourceRange;
@@ -453,9 +538,16 @@ interface ParsedComponent {
453
538
  source?: SourceRange;
454
539
  syntaxMode: SyntaxMode;
455
540
  scriptLanguage?: ScriptLanguage;
456
- /** Instance-level props (`export let`/`export function`, or runes `$props()`). See {@link ComponentProp} for the shared IR these are built from. */
541
+ /**
542
+ * Instance-level props (`export let`/`export function`, or runes
543
+ * `$props()`). See {@link ComponentProp} for the shared IR these are
544
+ * built from.
545
+ */
457
546
  props: ComponentProp[];
458
- /** Exports from `<script context="module">`. Same {@link ComponentProp} shape as `props`, resolved through the same shared decisions. */
547
+ /**
548
+ * Exports from `<script context="module">`. Same {@link ComponentProp}
549
+ * shape as `props`, resolved through the same shared decisions.
550
+ */
459
551
  moduleExports: ComponentProp[];
460
552
  slots: ComponentSlot[];
461
553
  /** Serialized events for JSON/API output. */
@@ -469,13 +561,19 @@ interface ParsedComponent {
469
561
  componentCommentSource?: SourceRange;
470
562
  contexts?: ComponentContext[];
471
563
  customElementTag?: string;
472
- /** Full `<svelte:options customElement=... />` config (shorthand or object form), when present. */
564
+ /**
565
+ * Full `<svelte:options customElement=... />` config (shorthand or object
566
+ * form), when present.
567
+ */
473
568
  customElement?: CustomElementOptions;
474
569
  /** From component-level `@csspart` JSDoc tags. */
475
570
  cssParts?: ComponentCssPart[];
476
571
  /** From component-level `@cssprop`/`@cssproperty` JSDoc tags. */
477
572
  cssProperties?: ComponentCssProperty[];
478
- /** Type guesses from this parse (unknown props, `any` contexts, orphan `@event` tags). */
573
+ /**
574
+ * Type guesses from this parse (unknown props, `any` contexts, orphan
575
+ * `@event` tags).
576
+ */
479
577
  diagnostics?: SveldDiagnostic[];
480
578
  /** Writer-only TypeScript metadata. Not serialized to JSON. */
481
579
  [PARSED_COMPONENT_TYPE_SCRIPT_METADATA]?: ParsedComponentTypeScriptMetadata;
@@ -493,19 +591,25 @@ export interface SveldDiagnostic {
493
591
  */
494
592
  component: string;
495
593
  kind: SveldDiagnosticKind;
496
- /** Stable, namespaced identifier for `kind` (e.g. `"sveld/prop-unknown-type"`). */
594
+ /**
595
+ * Stable, namespaced identifier for `kind`
596
+ * (e.g. `"sveld/prop-unknown-type"`).
597
+ */
497
598
  code: string;
498
599
  severity: SveldDiagnosticSeverity;
499
600
  /** Prop, context field, or event name. */
500
601
  name: string;
501
602
  /** What went wrong and what type sveld used. */
502
603
  message: string;
503
- /** Where in the component source this diagnostic points, when the parser holds a stable position. */
604
+ /**
605
+ * Where in the component source this diagnostic points, when the parser
606
+ * holds a stable position.
607
+ */
504
608
  source?: SourceRange;
505
609
  /**
506
- * True when suppressed by an inline `@sveld-ignore` tag or a `diagnostics.ignore`
507
- * config matcher. Still present here (and counted in the summary) but never
508
- * fails `--strict` / `--strict=errors`.
610
+ * True when suppressed by an inline `@sveld-ignore` tag or a
611
+ * `diagnostics.ignore` config matcher. Still present here (and counted in
612
+ * the summary) but never fails `--strict` / `--strict=errors`.
509
613
  */
510
614
  ignored?: boolean;
511
615
  }
@@ -515,7 +619,10 @@ declare const PARSED_COMPONENT_TYPE_SCRIPT_METADATA: unique symbol;
515
619
  declare const PARSED_COMPONENT_PROP_IGNORES: unique symbol;
516
620
 
517
621
  export interface FinalizeWithoutCrossFileResolutionOptions {
518
- /** Path recorded on the new diagnostics. Defaults to the component's own `filePath`, if it has one. */
622
+ /**
623
+ * Path recorded on the new diagnostics. Defaults to the component's own
624
+ * `filePath`, if it has one.
625
+ */
519
626
  filePath?: string;
520
627
  }
521
628
 
@@ -544,7 +651,10 @@ interface EntryExport {
544
651
  deprecated?: DeprecatedValue;
545
652
  /** `@since` / `@example` / `@see` tags in source order. */
546
653
  tags?: JsDocPassthroughTag[];
547
- /** True from `@ignore`/`@internal` JSDoc; excluded from every output by `buildComponentApiDocument`. */
654
+ /**
655
+ * True from `@ignore`/`@internal` JSDoc; excluded from every output
656
+ * by `buildComponentApiDocument`.
657
+ */
548
658
  internal?: boolean;
549
659
  /** Declaring module, relative to the entry file. */
550
660
  source?: string;
@@ -579,7 +689,10 @@ export declare function buildComponentApiDocument(components: ComponentDocs, opt
579
689
  export type AppendType = "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "quote" | "p" | "divider" | "raw";
580
690
 
581
691
  export interface TocLine {
582
- /** Leading space count; 0 for the top-level (`h2`) entries the TOC currently lists. */
692
+ /**
693
+ * Leading space count; 0 for the top-level (`h2`) entries the TOC
694
+ * currently lists.
695
+ */
583
696
  indent: number;
584
697
  raw: string;
585
698
  }
@@ -623,10 +736,11 @@ export declare function getContextDefs(def: Pick<ComponentDocApi, "contexts" | "
623
736
  export interface WriteTsDefinitionOptions {
624
737
  /**
625
738
  * `"class"` (default) extends the deprecated `SvelteComponentTyped`.
626
- * `"component"` emits `declare const X: Component<Props, Exports, Bindings>`
627
- * instead, for Svelte 5+ consumers. Generic components and components with
628
- * events get a per-component interface instead, since a `declare const`
629
- * can't carry a generic type parameter and `Component` has no events slot.
739
+ * `"component"` emits
740
+ * `declare const X: Component<Props, Exports, Bindings>` instead, for
741
+ * Svelte 5+ consumers. Generic components and components with events get a
742
+ * per-component interface instead, since a `declare const` can't carry a
743
+ * generic type parameter and `Component` has no events slot.
630
744
  */
631
745
  format?: "class" | "component";
632
746
  }