@wc-toolkit/svelte-types 1.0.1 → 1.0.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 +13 -1
- package/dist/index.cjs +12 -2
- package/dist/index.d.cts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +10 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -22,10 +22,11 @@ Generated declarations include:
|
|
|
22
22
|
|
|
23
23
|
## Usage
|
|
24
24
|
|
|
25
|
-
This package supports
|
|
25
|
+
This package supports three generation workflows:
|
|
26
26
|
|
|
27
27
|
1. Calling a function in your build pipeline
|
|
28
28
|
2. Using a plugin for the [Custom Element Manifest Analyzer](https://custom-elements-manifest.open-wc.org/)
|
|
29
|
+
3. Using a plugin for [`@wc-toolkit/cem-generator`](https://github.com/wc-toolkit/cem-generator)
|
|
29
30
|
|
|
30
31
|
### Install
|
|
31
32
|
|
|
@@ -75,6 +76,17 @@ export default {
|
|
|
75
76
|
};
|
|
76
77
|
```
|
|
77
78
|
|
|
79
|
+
### cem-generator Plugin
|
|
80
|
+
|
|
81
|
+
```ts
|
|
82
|
+
import { generateCem } from "@wc-toolkit/cem-generator";
|
|
83
|
+
import { svelteTypesGeneratorPlugin } from "@wc-toolkit/svelte-types";
|
|
84
|
+
|
|
85
|
+
generateCem({
|
|
86
|
+
plugins: [svelteTypesGeneratorPlugin({ outdir: "./src" })],
|
|
87
|
+
});
|
|
88
|
+
```
|
|
89
|
+
|
|
78
90
|
## Implementation
|
|
79
91
|
|
|
80
92
|
The generated file declares `svelteHTML.IntrinsicElements`, so Svelte projects only need to include the file in their TypeScript project.
|
package/dist/index.cjs
CHANGED
|
@@ -31,7 +31,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
33
|
customElementSveltePlugin: () => customElementSveltePlugin,
|
|
34
|
-
generateSvelteTypes: () => generateSvelteTypes
|
|
34
|
+
generateSvelteTypes: () => generateSvelteTypes,
|
|
35
|
+
svelteTypesGeneratorPlugin: () => svelteTypesGeneratorPlugin
|
|
35
36
|
});
|
|
36
37
|
module.exports = __toCommonJS(index_exports);
|
|
37
38
|
|
|
@@ -828,8 +829,17 @@ function customElementSveltePlugin(options = {}) {
|
|
|
828
829
|
}
|
|
829
830
|
};
|
|
830
831
|
}
|
|
832
|
+
function svelteTypesGeneratorPlugin(options = {}) {
|
|
833
|
+
return {
|
|
834
|
+
name: "@wc-toolkit/svelte-types:cem-generator",
|
|
835
|
+
afterGenerate(manifest2) {
|
|
836
|
+
generateSvelteTypes(manifest2, options);
|
|
837
|
+
}
|
|
838
|
+
};
|
|
839
|
+
}
|
|
831
840
|
// Annotate the CommonJS export names for ESM import in node:
|
|
832
841
|
0 && (module.exports = {
|
|
833
842
|
customElementSveltePlugin,
|
|
834
|
-
generateSvelteTypes
|
|
843
|
+
generateSvelteTypes,
|
|
844
|
+
svelteTypesGeneratorPlugin
|
|
835
845
|
});
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ComponentDescriptionOptions } from '@wc-toolkit/cem-utilities';
|
|
2
|
+
import { Plugin } from '@wc-toolkit/cem-generator';
|
|
2
3
|
|
|
3
4
|
type SvelteTypesOptions = {
|
|
4
5
|
/** Used to get a specific path for a given component */
|
|
@@ -38,6 +39,8 @@ declare function customElementSveltePlugin(options?: SvelteTypesOptions): {
|
|
|
38
39
|
name: string;
|
|
39
40
|
packageLinkPhase({ customElementsManifest }: any): void;
|
|
40
41
|
};
|
|
42
|
+
/** Plugin for @wc-toolkit/cem-generator that generates Svelte types from the finalized CEM. */
|
|
43
|
+
declare function svelteTypesGeneratorPlugin(options?: SvelteTypesOptions): Plugin;
|
|
41
44
|
|
|
42
45
|
/**
|
|
43
46
|
* @license
|
|
@@ -789,4 +792,4 @@ interface Demo {
|
|
|
789
792
|
/** Generates Svelte type declarations from a Custom Elements Manifest. */
|
|
790
793
|
declare function generateSvelteTypes(manifest: Package, options?: SvelteTypesOptions): string | undefined;
|
|
791
794
|
|
|
792
|
-
export { type SvelteTypesOptions, customElementSveltePlugin, generateSvelteTypes };
|
|
795
|
+
export { type SvelteTypesOptions, customElementSveltePlugin, generateSvelteTypes, svelteTypesGeneratorPlugin };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ComponentDescriptionOptions } from '@wc-toolkit/cem-utilities';
|
|
2
|
+
import { Plugin } from '@wc-toolkit/cem-generator';
|
|
2
3
|
|
|
3
4
|
type SvelteTypesOptions = {
|
|
4
5
|
/** Used to get a specific path for a given component */
|
|
@@ -38,6 +39,8 @@ declare function customElementSveltePlugin(options?: SvelteTypesOptions): {
|
|
|
38
39
|
name: string;
|
|
39
40
|
packageLinkPhase({ customElementsManifest }: any): void;
|
|
40
41
|
};
|
|
42
|
+
/** Plugin for @wc-toolkit/cem-generator that generates Svelte types from the finalized CEM. */
|
|
43
|
+
declare function svelteTypesGeneratorPlugin(options?: SvelteTypesOptions): Plugin;
|
|
41
44
|
|
|
42
45
|
/**
|
|
43
46
|
* @license
|
|
@@ -789,4 +792,4 @@ interface Demo {
|
|
|
789
792
|
/** Generates Svelte type declarations from a Custom Elements Manifest. */
|
|
790
793
|
declare function generateSvelteTypes(manifest: Package, options?: SvelteTypesOptions): string | undefined;
|
|
791
794
|
|
|
792
|
-
export { type SvelteTypesOptions, customElementSveltePlugin, generateSvelteTypes };
|
|
795
|
+
export { type SvelteTypesOptions, customElementSveltePlugin, generateSvelteTypes, svelteTypesGeneratorPlugin };
|
package/dist/index.js
CHANGED
|
@@ -791,7 +791,16 @@ function customElementSveltePlugin(options = {}) {
|
|
|
791
791
|
}
|
|
792
792
|
};
|
|
793
793
|
}
|
|
794
|
+
function svelteTypesGeneratorPlugin(options = {}) {
|
|
795
|
+
return {
|
|
796
|
+
name: "@wc-toolkit/svelte-types:cem-generator",
|
|
797
|
+
afterGenerate(manifest2) {
|
|
798
|
+
generateSvelteTypes(manifest2, options);
|
|
799
|
+
}
|
|
800
|
+
};
|
|
801
|
+
}
|
|
794
802
|
export {
|
|
795
803
|
customElementSveltePlugin,
|
|
796
|
-
generateSvelteTypes
|
|
804
|
+
generateSvelteTypes,
|
|
805
|
+
svelteTypesGeneratorPlugin
|
|
797
806
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wc-toolkit/svelte-types",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "This package generates Svelte types for custom elements / web components",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -50,6 +50,7 @@
|
|
|
50
50
|
"vitest": "^3.0.4"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
+
"@wc-toolkit/cem-generator": "^0.1.1",
|
|
53
54
|
"@prettier/sync": "^0.6.1"
|
|
54
55
|
},
|
|
55
56
|
"keywords": [
|