sveld 0.25.10 → 0.25.12
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 +34 -19
- package/lib/ComponentParser.d.ts +714 -5
- package/lib/ComponentParser.js +1640 -332
- package/lib/cli.d.ts +14 -0
- package/lib/cli.js +14 -0
- package/lib/create-exports.d.ts +41 -0
- package/lib/create-exports.js +107 -16
- package/lib/element-tag-map.d.ts +69 -0
- package/lib/element-tag-map.js +73 -6
- package/lib/index.js +4 -4
- package/lib/parse-exports.d.ts +22 -0
- package/lib/parse-exports.js +22 -0
- package/lib/resolve-alias.d.ts +48 -0
- package/lib/resolve-alias.js +83 -15
- package/lib/rollup-plugin.d.ts +41 -0
- package/lib/rollup-plugin.js +97 -8
- package/lib/sveld.d.ts +21 -0
- package/lib/sveld.js +21 -0
- package/lib/writer/MarkdownWriterBase.d.ts +29 -0
- package/lib/writer/MarkdownWriterBase.js +70 -0
- package/lib/writer/Writer.d.ts +77 -0
- package/lib/writer/Writer.js +78 -0
- package/lib/writer/WriterMarkdown.d.ts +28 -9
- package/lib/writer/WriterMarkdown.js +37 -48
- package/lib/writer/markdown-format-utils.d.ts +106 -0
- package/lib/writer/markdown-format-utils.js +108 -3
- package/lib/writer/markdown-render-utils.d.ts +16 -0
- package/lib/writer/markdown-render-utils.js +89 -0
- package/lib/writer/writer-json.d.ts +26 -0
- package/lib/writer/writer-json.js +80 -3
- package/lib/writer/writer-markdown-core.d.ts +19 -14
- package/lib/writer/writer-markdown-core.js +22 -114
- package/lib/writer/writer-markdown.d.ts +22 -0
- package/lib/writer/writer-markdown.js +24 -54
- package/lib/writer/writer-ts-definitions-core.d.ts +22 -0
- package/lib/writer/writer-ts-definitions-core.js +337 -104
- package/lib/writer/writer-ts-definitions.d.ts +58 -0
- package/lib/writer/writer-ts-definitions.js +43 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
|
|
9
9
|
The purpose of this project is to make third party Svelte component libraries compatible with the Svelte Language Server and TypeScript with minimal effort required by the author. For example, TypeScript definitions may be used during development via intelligent code completion in Integrated Development Environments (IDE) like VSCode.
|
|
10
10
|
|
|
11
|
-
[Carbon Components Svelte](https://github.com/
|
|
11
|
+
[Carbon Components Svelte](https://github.com/carbon-design-system/carbon-components-svelte) uses this library to auto-generate component types and API metadata:
|
|
12
12
|
|
|
13
|
-
- [TypeScript definitions](https://github.com/
|
|
14
|
-
- [Component Index](https://github.com/
|
|
15
|
-
- [Component API](https://github.com/
|
|
13
|
+
- [TypeScript definitions](https://github.com/carbon-design-system/carbon-components-svelte/blob/master/types): Component TypeScript definitions
|
|
14
|
+
- [Component Index](https://github.com/carbon-design-system/carbon-components-svelte/blob/master/COMPONENT_INDEX.md): Markdown file documenting component props, slots, and events
|
|
15
|
+
- [Component API](https://github.com/carbon-design-system/carbon-components-svelte/blob/master/docs/src/COMPONENT_API.json): Component API metadata in JSON format
|
|
16
16
|
|
|
17
17
|
**Note:** `sveld` supports Svelte 3, 4, and 5, but does not support Svelte 5-specific syntax or runes-only usage. Components must use traditional Svelte syntax (e.g., `export let` for props, not `$props()`).
|
|
18
18
|
|
|
@@ -430,9 +430,12 @@ Output:
|
|
|
430
430
|
|
|
431
431
|
```ts
|
|
432
432
|
export type User = {
|
|
433
|
-
/** The user's full name */
|
|
434
|
-
|
|
435
|
-
/** The user's
|
|
433
|
+
/** The user's full name */
|
|
434
|
+
name: string;
|
|
435
|
+
/** The user's email address */
|
|
436
|
+
email: string;
|
|
437
|
+
/** The user's age in years */
|
|
438
|
+
age: number;
|
|
436
439
|
};
|
|
437
440
|
|
|
438
441
|
export type ComponentProps = {
|
|
@@ -478,10 +481,14 @@ Output:
|
|
|
478
481
|
|
|
479
482
|
```ts
|
|
480
483
|
export type ComponentConfig = {
|
|
481
|
-
/** Whether the component is enabled */
|
|
482
|
-
|
|
483
|
-
/**
|
|
484
|
-
|
|
484
|
+
/** Whether the component is enabled */
|
|
485
|
+
enabled: boolean;
|
|
486
|
+
/** The component theme */
|
|
487
|
+
theme: string;
|
|
488
|
+
/** Optional timeout in milliseconds @default 5000 */
|
|
489
|
+
timeout?: number;
|
|
490
|
+
/** Optional debug mode flag */
|
|
491
|
+
debug?: boolean;
|
|
485
492
|
};
|
|
486
493
|
|
|
487
494
|
export type ComponentProps = {
|
|
@@ -735,9 +742,12 @@ export default class Component extends SvelteComponentTyped<
|
|
|
735
742
|
{
|
|
736
743
|
/** Fired when the user submits the form */
|
|
737
744
|
submit: CustomEvent<{
|
|
738
|
-
/** The user's name */
|
|
739
|
-
|
|
740
|
-
/**
|
|
745
|
+
/** The user's name */
|
|
746
|
+
name: string;
|
|
747
|
+
/** The user's email address */
|
|
748
|
+
email: string;
|
|
749
|
+
/** Whether the user opted into the newsletter */
|
|
750
|
+
newsletter: boolean;
|
|
741
751
|
}>;
|
|
742
752
|
},
|
|
743
753
|
Record<string, never>
|
|
@@ -782,10 +792,14 @@ export default class Component extends SvelteComponentTyped<
|
|
|
782
792
|
{
|
|
783
793
|
/** Snowball event fired when throwing a snowball */
|
|
784
794
|
snowball: CustomEvent<{
|
|
785
|
-
/** Indicates whether the snowball is tightly packed */
|
|
786
|
-
|
|
787
|
-
/**
|
|
788
|
-
|
|
795
|
+
/** Indicates whether the snowball is tightly packed */
|
|
796
|
+
isPacked: boolean;
|
|
797
|
+
/** The speed of the snowball in mph */
|
|
798
|
+
speed: number;
|
|
799
|
+
/** Optional color of the snowball */
|
|
800
|
+
color?: string;
|
|
801
|
+
/** Optional density with default value @default 0.9 */
|
|
802
|
+
density?: number;
|
|
789
803
|
}>;
|
|
790
804
|
},
|
|
791
805
|
Record<string, never>
|
|
@@ -1171,7 +1185,8 @@ Output:
|
|
|
1171
1185
|
|
|
1172
1186
|
```ts
|
|
1173
1187
|
export type NotificationData = {
|
|
1174
|
-
/** Optional id for deduplication */
|
|
1188
|
+
/** Optional id for deduplication */
|
|
1189
|
+
id?: string;
|
|
1175
1190
|
kind?: "error" | "info" | "success";
|
|
1176
1191
|
};
|
|
1177
1192
|
|