sveld 0.30.1 → 0.30.2

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 CHANGED
@@ -133,6 +133,7 @@ export default class Button extends SvelteComponentTyped<
133
133
  - [@typedef](#typedef)
134
134
  - [@callback](#callback)
135
135
  - [@slot / @snippet](#slot--snippet)
136
+ - [Extra JSDoc tags before `@slot`](#extra-jsdoc-tags-before-slot)
136
137
  - [Svelte 5 Snippet Compatibility](#svelte-5-snippet-compatibility)
137
138
  - [@event](#event)
138
139
  - [Context API](#context-api)
@@ -787,7 +788,7 @@ When `@returns` is omitted, the return type defaults to `void`. When no `@param`
787
788
 
788
789
  Use the `@slot` tag for typing component slots. For Svelte 5 runes components, `@snippet` is also supported as an alias. Both are non-standard JSDoc tags.
789
790
 
790
- Descriptions are optional for named slots. Currently, the default slot cannot have a description.
791
+ Descriptions are optional for every slot, including the default slot: use prose lines in the same `/** */` block above `@slot` / `@snippet`, and/or an inline description on the `@slot` line for named slots.
791
792
 
792
793
  **Signature:**
793
794
 
@@ -853,6 +854,32 @@ Omit the `slot-name` to type the default slot.
853
854
  </p>
854
855
  ```
855
856
 
857
+ #### Extra JSDoc tags before `@slot`
858
+
859
+ Tags such as `@example`, `@deprecated`, `@see`, or `@since` that appear **after** the prose description and **before** the `@slot` / `@snippet` line are carried into generated `.d.ts` files: the emitted JSDoc above each slot’s snippet prop (and the traditional `SlotDefs` shape) contains the description, then those tags in source order. The same entries are available on each slot in JSON output as `tags: [{ "name", "body" }, ...]`.
860
+
861
+ Put `@slot` / `@snippet` last in the block (`description` → optional extra tags → slot tag). Tags placed after `@slot` / `@snippet` in the same comment are not tied to that slot. Unknown tag names are passed through as-is (no allowlist). Markdown docs do not render slot descriptions or these tags yet; use TypeScript hover or JSON for that metadata.
862
+
863
+ **Example (default slot with `@example` and `@deprecated`):**
864
+
865
+ ````svelte
866
+ <script>
867
+ /**
868
+ * Spread `props` onto a custom element.
869
+ * @example
870
+ * ```svelte
871
+ * <Item let:props>
872
+ * <a {...props} href="/">Home</a>
873
+ * </Item>
874
+ * ```
875
+ * @deprecated Prefer the `link` snippet.
876
+ * @slot {{ props?: { class: string } }}
877
+ */
878
+ </script>
879
+
880
+ <slot props={{ class: "bx--link" }} />
881
+ ````
882
+
856
883
  #### Svelte 5 Snippet Compatibility
857
884
 
858
885
  For Svelte 5 compatibility, `sveld` automatically generates optional snippet props for all slots. This allows consumers to use either the traditional slot syntax or Svelte 5's `{#snippet}` syntax.
@@ -92,6 +92,14 @@ interface ComponentSlot {
92
92
  slot_props?: string;
93
93
  /** Description extracted from JSDoc `@slot` or `@snippet` tags */
94
94
  description?: string;
95
+ /**
96
+ * JSDoc tags that appeared after the prose description and before `@slot` / `@snippet`
97
+ * (e.g. `@example`, `@deprecated`), in source order.
98
+ */
99
+ tags?: Array<{
100
+ name: string;
101
+ body: string;
102
+ }>;
95
103
  }
96
104
  /**
97
105
  * Event that is forwarded from a child component or element.