@teiler/svelte 0.0.25 → 0.0.27
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/CHANGELOG.md +17 -0
- package/dist/teiler-svelte.cjs.js +1 -1
- package/dist/teiler-svelte.cjs.js.map +1 -1
- package/dist/teiler-svelte.d.ts +2 -2
- package/dist/teiler-svelte.esm.js +1 -1
- package/dist/teiler-svelte.esm.js.map +1 -1
- package/dist/teiler-svelte.umd.js +1 -1
- package/dist/teiler-svelte.umd.js.map +1 -1
- package/package.json +26 -22
- package/src/Styled.svelte +11 -2
- package/src/component.ts +10 -8
- package/src/sheet.ts +1 -1
- package/tsconfig.json +2 -3
package/src/component.ts
CHANGED
|
@@ -6,11 +6,13 @@ import Styled from './Styled.svelte'
|
|
|
6
6
|
|
|
7
7
|
type SvelteTeilerComponent<Target extends HTMLElements, Props> = TeilerComponent<Target, Props> & ComponentType<SvelteComponent>
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
type Options = ConstructorParameters<typeof Styled>[0]
|
|
10
|
+
|
|
11
|
+
const createComponent = <Target extends HTMLElements, Props extends object = {}>(styleDefinition: StyleDefinition<Target, Props>): SvelteTeilerComponent<Target, Props> => {
|
|
12
|
+
return class extends Styled<{}, Props> {
|
|
11
13
|
static styleDefinition = styleDefinition
|
|
12
14
|
|
|
13
|
-
constructor(options) {
|
|
15
|
+
constructor(options: Options) {
|
|
14
16
|
super({
|
|
15
17
|
...options,
|
|
16
18
|
props: {
|
|
@@ -34,7 +36,7 @@ type Global = {
|
|
|
34
36
|
<Props extends object = {}>(string: TemplateStringsArray, ...properties: Properties<Props>[]): SvelteTeilerComponent<HTMLElements, Props>
|
|
35
37
|
}
|
|
36
38
|
|
|
37
|
-
type ComponentWithTags = Component<'div'> & { [K in HTMLElements]: Component<K> }
|
|
39
|
+
type ComponentWithTags = Component<'div'> & { [K in Exclude<HTMLElements, null>]: Component<K> }
|
|
38
40
|
|
|
39
41
|
const construct = (tag: HTMLElements, compiler: Compiler) => {
|
|
40
42
|
return <Props extends object = {}>(stringOrBinded: TeilerComponent<HTMLElements, Props> | TemplateStringsArray, ...properties: Properties<Props>[]) => {
|
|
@@ -42,14 +44,14 @@ const construct = (tag: HTMLElements, compiler: Compiler) => {
|
|
|
42
44
|
}
|
|
43
45
|
}
|
|
44
46
|
|
|
45
|
-
const
|
|
47
|
+
const svelteComponent = construct('div', component) as ComponentWithTags
|
|
46
48
|
|
|
47
49
|
tags.forEach((tag) => {
|
|
48
|
-
|
|
50
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
51
|
+
// @ts-expect-error
|
|
52
|
+
svelteComponent[tag] = construct(tag, component)
|
|
49
53
|
})
|
|
50
54
|
|
|
51
|
-
const svelteComponent = baseComponent as ComponentWithTags
|
|
52
|
-
|
|
53
55
|
const svelteGlobal = construct(null, global) as Global
|
|
54
56
|
|
|
55
57
|
export { svelteComponent as component, svelteGlobal as global, keyframes, createComponent }
|
package/src/sheet.ts
CHANGED
package/tsconfig.json
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"include": [
|
|
3
|
-
"src/**/*"
|
|
4
|
-
"stories/stories.d.ts"
|
|
3
|
+
"src/**/*"
|
|
5
4
|
],
|
|
6
5
|
"exclude": [
|
|
7
6
|
"node_modules"
|
|
@@ -16,7 +15,7 @@
|
|
|
16
15
|
"importHelpers": true,
|
|
17
16
|
"moduleResolution": "node",
|
|
18
17
|
"experimentalDecorators": true,
|
|
19
|
-
"strict":
|
|
18
|
+
"strict": true,
|
|
20
19
|
"strictPropertyInitialization": false,
|
|
21
20
|
"sourceMap": true,
|
|
22
21
|
"allowSyntheticDefaultImports": true,
|