@teiler/svelte 0.0.2 → 0.0.4
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 +9 -0
- package/dist/teiler-svelte.cjs.js +1 -1
- package/dist/teiler-svelte.cjs.js.map +1 -1
- package/dist/teiler-svelte.d.ts +14 -8
- 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 +7 -3
- package/src/Styled.svelte +1 -1
- package/src/index.ts +23 -18
- package/.storybook/main.ts +0 -21
- package/.storybook/preview.js +0 -9
- package/.turbo/turbo-storybook.log +0 -0
- package/rollup.config.js +0 -80
- package/stories/Buttons.stories.svelte +0 -53
- package/stories/Buttons.svelte +0 -29
- package/stories/Introduction.stories.mdx +0 -197
- package/stories/buttons.ts +0 -69
package/.storybook/main.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { StorybookConfig } from '@storybook/svelte-vite';
|
|
2
|
-
|
|
3
|
-
const config: StorybookConfig = {
|
|
4
|
-
stories: ['../**/*.stories.mdx', '../**/*.stories.@(js|jsx|ts|tsx|svelte)'],
|
|
5
|
-
addons: ['@storybook/addon-links', '@storybook/addon-essentials', '@storybook/addon-svelte-csf', '@storybook/addon-interactions', '@storybook/addon-mdx-gfm'],
|
|
6
|
-
features: {
|
|
7
|
-
buildStoriesJson: true
|
|
8
|
-
},
|
|
9
|
-
typescript: {
|
|
10
|
-
check: false,
|
|
11
|
-
},
|
|
12
|
-
framework: '@storybook/svelte-vite',
|
|
13
|
-
docs: {
|
|
14
|
-
autodocs: true
|
|
15
|
-
},
|
|
16
|
-
async viteFinal(config, options) {
|
|
17
|
-
return config
|
|
18
|
-
},
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export default config
|
package/.storybook/preview.js
DELETED
|
File without changes
|
package/rollup.config.js
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import commonjs from '@rollup/plugin-commonjs'
|
|
2
|
-
import { nodeResolve } from '@rollup/plugin-node-resolve'
|
|
3
|
-
import json from '@rollup/plugin-json'
|
|
4
|
-
import svelte from 'rollup-plugin-svelte'
|
|
5
|
-
import sveltePreprocess from 'svelte-preprocess'
|
|
6
|
-
import esbuild from 'rollup-plugin-esbuild'
|
|
7
|
-
import dts from 'rollup-plugin-dts'
|
|
8
|
-
import { transformSync } from 'esbuild'
|
|
9
|
-
|
|
10
|
-
import { terser } from 'rollup-plugin-terser'
|
|
11
|
-
|
|
12
|
-
const globals = {
|
|
13
|
-
'svelte/internal': 'svelte/internal',
|
|
14
|
-
svelte: 'svelte',
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const defaultPlugins = [
|
|
18
|
-
commonjs(),
|
|
19
|
-
nodeResolve({ resolveOnly: [/^(?!svelte.*$)/] }),
|
|
20
|
-
json(),
|
|
21
|
-
esbuild.default({ sourceMap: true }),
|
|
22
|
-
svelte({
|
|
23
|
-
emitCss: false,
|
|
24
|
-
compilerOptions: {
|
|
25
|
-
// dev: production === false,
|
|
26
|
-
sourcemap: true,
|
|
27
|
-
// generate: 'ssr',
|
|
28
|
-
},
|
|
29
|
-
preprocess: sveltePreprocess({
|
|
30
|
-
typescript({ content }) {
|
|
31
|
-
const { code, map } = transformSync(content, {
|
|
32
|
-
loader: 'ts',
|
|
33
|
-
tsconfigRaw: {
|
|
34
|
-
compilerOptions: {
|
|
35
|
-
importsNotUsedAsValues: 'error',
|
|
36
|
-
preserveValueImports: true,
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
})
|
|
40
|
-
return { code, map }
|
|
41
|
-
},
|
|
42
|
-
}),
|
|
43
|
-
}),
|
|
44
|
-
]
|
|
45
|
-
|
|
46
|
-
export default [
|
|
47
|
-
{
|
|
48
|
-
input: 'src/index.ts',
|
|
49
|
-
output: [
|
|
50
|
-
{
|
|
51
|
-
file: 'dist/teiler-svelte.umd.js',
|
|
52
|
-
name: 'teiler-svelte',
|
|
53
|
-
format: 'umd',
|
|
54
|
-
sourcemap: true,
|
|
55
|
-
globals,
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
file: 'dist/teiler-svelte.cjs.js',
|
|
59
|
-
format: 'cjs',
|
|
60
|
-
sourcemap: true,
|
|
61
|
-
globals,
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
file: 'dist/teiler-svelte.esm.js',
|
|
65
|
-
format: 'esm',
|
|
66
|
-
sourcemap: true,
|
|
67
|
-
globals,
|
|
68
|
-
},
|
|
69
|
-
],
|
|
70
|
-
plugins: [...defaultPlugins, terser()],
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
input: 'src/index.ts',
|
|
74
|
-
output: {
|
|
75
|
-
file: `dist/teiler-svelte.d.ts`,
|
|
76
|
-
format: 'es',
|
|
77
|
-
},
|
|
78
|
-
plugins: [...defaultPlugins, dts.default()],
|
|
79
|
-
},
|
|
80
|
-
]
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { Meta, Template, Story } from "@storybook/addon-svelte-csf";
|
|
3
|
-
import Buttons from "./Buttons.svelte";
|
|
4
|
-
</script>
|
|
5
|
-
|
|
6
|
-
<Meta
|
|
7
|
-
title="Svelte/Button"
|
|
8
|
-
component={Buttons}
|
|
9
|
-
argTypes={{
|
|
10
|
-
label: { control: "text" },
|
|
11
|
-
_primary: { control: "boolean" },
|
|
12
|
-
_primaryColor: { control: "color" },
|
|
13
|
-
_size: {
|
|
14
|
-
control: { type: "select", options: ["small", "medium", "large"] },
|
|
15
|
-
},
|
|
16
|
-
onClick: { action: "onClick" },
|
|
17
|
-
}}
|
|
18
|
-
/>
|
|
19
|
-
|
|
20
|
-
<Template let:args>
|
|
21
|
-
<Buttons {...args} on:click={args.onClick} />
|
|
22
|
-
</Template>
|
|
23
|
-
|
|
24
|
-
<Story
|
|
25
|
-
name="Primary"
|
|
26
|
-
args={{
|
|
27
|
-
_primary: true,
|
|
28
|
-
label: "Button",
|
|
29
|
-
}}
|
|
30
|
-
/>
|
|
31
|
-
|
|
32
|
-
<Story
|
|
33
|
-
name="Secondary"
|
|
34
|
-
args={{
|
|
35
|
-
label: "Button",
|
|
36
|
-
}}
|
|
37
|
-
/>
|
|
38
|
-
|
|
39
|
-
<Story
|
|
40
|
-
name="Small"
|
|
41
|
-
args={{
|
|
42
|
-
_size: "small",
|
|
43
|
-
label: "Button",
|
|
44
|
-
}}
|
|
45
|
-
/>
|
|
46
|
-
|
|
47
|
-
<Story
|
|
48
|
-
name="Disabled"
|
|
49
|
-
args={{
|
|
50
|
-
disabled: true,
|
|
51
|
-
label: "Button",
|
|
52
|
-
}}
|
|
53
|
-
/>
|
package/stories/Buttons.svelte
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { Button, ExtendedButton } from './buttons'
|
|
3
|
-
|
|
4
|
-
// import teiler from '@teiler/svelte'
|
|
5
|
-
import { createEventDispatcher } from 'svelte'
|
|
6
|
-
|
|
7
|
-
export let _primary = false
|
|
8
|
-
export let _primaryColor = "#f18805"
|
|
9
|
-
|
|
10
|
-
export let _size: 'normal' | 'small' = 'normal'
|
|
11
|
-
|
|
12
|
-
export let label = ''
|
|
13
|
-
|
|
14
|
-
export let disabled
|
|
15
|
-
|
|
16
|
-
const dispatch = createEventDispatcher()
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Optional click handler
|
|
20
|
-
*/
|
|
21
|
-
function onClick(event) {
|
|
22
|
-
dispatch('click', event)
|
|
23
|
-
}
|
|
24
|
-
</script>
|
|
25
|
-
|
|
26
|
-
<Button {_primary} {_size} {_primaryColor} {disabled} on:click={onClick}>
|
|
27
|
-
{label}
|
|
28
|
-
</Button>
|
|
29
|
-
<ExtendedButton {_primary} {_size} {_primaryColor}>Test</ExtendedButton>
|
|
@@ -1,197 +0,0 @@
|
|
|
1
|
-
import { Meta } from '@storybook/addon-docs';
|
|
2
|
-
|
|
3
|
-
<Meta title="Example/Introduction" />
|
|
4
|
-
|
|
5
|
-
<style>
|
|
6
|
-
{`
|
|
7
|
-
.subheading {
|
|
8
|
-
--mediumdark: '#999999';
|
|
9
|
-
font-weight: 900;
|
|
10
|
-
font-size: 13px;
|
|
11
|
-
color: #999;
|
|
12
|
-
letter-spacing: 6px;
|
|
13
|
-
line-height: 24px;
|
|
14
|
-
text-transform: uppercase;
|
|
15
|
-
margin-bottom: 12px;
|
|
16
|
-
margin-top: 40px;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.link-list {
|
|
20
|
-
display: grid;
|
|
21
|
-
grid-template-columns: 1fr;
|
|
22
|
-
grid-template-rows: 1fr 1fr;
|
|
23
|
-
row-gap: 10px;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
@media (min-width: 620px) {
|
|
27
|
-
.link-list {
|
|
28
|
-
row-gap: 20px;
|
|
29
|
-
column-gap: 20px;
|
|
30
|
-
grid-template-columns: 1fr 1fr;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
@media all and (-ms-high-contrast:none) {
|
|
35
|
-
.link-list {
|
|
36
|
-
display: -ms-grid;
|
|
37
|
-
-ms-grid-columns: 1fr 1fr;
|
|
38
|
-
-ms-grid-rows: 1fr 1fr;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.link-item {
|
|
43
|
-
display: block;
|
|
44
|
-
padding: 20px 30px 20px 15px;
|
|
45
|
-
border: 1px solid #00000010;
|
|
46
|
-
border-radius: 5px;
|
|
47
|
-
transition: background 150ms ease-out, border 150ms ease-out, transform 150ms ease-out;
|
|
48
|
-
color: #333333;
|
|
49
|
-
display: flex;
|
|
50
|
-
align-items: flex-start;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
.link-item:hover {
|
|
54
|
-
border-color: #1EA7FD50;
|
|
55
|
-
transform: translate3d(0, -3px, 0);
|
|
56
|
-
box-shadow: rgba(0, 0, 0, 0.08) 0 3px 10px 0;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
.link-item:active {
|
|
60
|
-
border-color: #1EA7FD;
|
|
61
|
-
transform: translate3d(0, 0, 0);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
.link-item strong {
|
|
65
|
-
font-weight: 700;
|
|
66
|
-
display: block;
|
|
67
|
-
margin-bottom: 2px;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
.link-item img {
|
|
71
|
-
height: 40px;
|
|
72
|
-
width: 40px;
|
|
73
|
-
margin-right: 15px;
|
|
74
|
-
flex: none;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
.link-item span {
|
|
78
|
-
font-size: 14px;
|
|
79
|
-
line-height: 20px;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
.tip {
|
|
83
|
-
display: inline-block;
|
|
84
|
-
border-radius: 1em;
|
|
85
|
-
font-size: 11px;
|
|
86
|
-
line-height: 12px;
|
|
87
|
-
font-weight: 700;
|
|
88
|
-
background: #E7FDD8;
|
|
89
|
-
color: #66BF3C;
|
|
90
|
-
padding: 4px 12px;
|
|
91
|
-
margin-right: 10px;
|
|
92
|
-
vertical-align: top;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
.tip-wrapper {
|
|
96
|
-
font-size: 13px;
|
|
97
|
-
line-height: 20px;
|
|
98
|
-
margin-top: 40px;
|
|
99
|
-
margin-bottom: 40px;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
.tip-wrapper code {
|
|
103
|
-
font-size: 12px;
|
|
104
|
-
display: inline-block;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
`}
|
|
109
|
-
</style>
|
|
110
|
-
|
|
111
|
-
# Welcome to Storybook
|
|
112
|
-
|
|
113
|
-
Storybook helps you build UI components in isolation from your app's business logic, data, and context.
|
|
114
|
-
That makes it easy to develop hard-to-reach states. Save these UI states as **stories** to revisit during development, testing, or QA.
|
|
115
|
-
|
|
116
|
-
Browse example stories now by navigating to them in the sidebar.
|
|
117
|
-
View their code in the `src/stories` directory to learn how they work.
|
|
118
|
-
We recommend building UIs with a [**component-driven**](https://componentdriven.org) process starting with atomic components and ending with pages.
|
|
119
|
-
|
|
120
|
-
<div className="subheading">Configure</div>
|
|
121
|
-
|
|
122
|
-
<div className="link-list">
|
|
123
|
-
<a
|
|
124
|
-
className="link-item"
|
|
125
|
-
href="https://storybook.js.org/docs/react/addons/addon-types"
|
|
126
|
-
target="_blank"
|
|
127
|
-
>
|
|
128
|
-
<span>
|
|
129
|
-
<strong>Presets for popular tools</strong>
|
|
130
|
-
Easy setup for TypeScript, SCSS and more.
|
|
131
|
-
</span>
|
|
132
|
-
</a>
|
|
133
|
-
<a
|
|
134
|
-
className="link-item"
|
|
135
|
-
href="https://storybook.js.org/docs/react/configure/webpack"
|
|
136
|
-
target="_blank"
|
|
137
|
-
>
|
|
138
|
-
<span>
|
|
139
|
-
<strong>Build configuration</strong>
|
|
140
|
-
How to customize webpack and Babel
|
|
141
|
-
</span>
|
|
142
|
-
</a>
|
|
143
|
-
<a
|
|
144
|
-
className="link-item"
|
|
145
|
-
href="https://storybook.js.org/docs/react/configure/styling-and-css"
|
|
146
|
-
target="_blank"
|
|
147
|
-
>
|
|
148
|
-
<span>
|
|
149
|
-
<strong>Styling</strong>
|
|
150
|
-
How to load and configure CSS libraries
|
|
151
|
-
</span>
|
|
152
|
-
</a>
|
|
153
|
-
<a
|
|
154
|
-
className="link-item"
|
|
155
|
-
href="https://storybook.js.org/docs/react/get-started/setup#configure-storybook-for-your-stack"
|
|
156
|
-
target="_blank"
|
|
157
|
-
>
|
|
158
|
-
<span>
|
|
159
|
-
<strong>Data</strong>
|
|
160
|
-
Providers and mocking for data libraries
|
|
161
|
-
</span>
|
|
162
|
-
</a>
|
|
163
|
-
</div>
|
|
164
|
-
|
|
165
|
-
<div className="subheading">Learn</div>
|
|
166
|
-
|
|
167
|
-
<div className="link-list">
|
|
168
|
-
<a className="link-item" href="https://storybook.js.org/docs" target="_blank">
|
|
169
|
-
<span>
|
|
170
|
-
<strong>Storybook documentation</strong>
|
|
171
|
-
Configure, customize, and extend
|
|
172
|
-
</span>
|
|
173
|
-
</a>
|
|
174
|
-
<a className="link-item" href="https://storybook.js.org/tutorials/" target="_blank">
|
|
175
|
-
<span>
|
|
176
|
-
<strong>In-depth guides</strong>
|
|
177
|
-
Best practices from leading teams
|
|
178
|
-
</span>
|
|
179
|
-
</a>
|
|
180
|
-
<a className="link-item" href="https://github.com/storybookjs/storybook" target="_blank">
|
|
181
|
-
<span>
|
|
182
|
-
<strong>GitHub project</strong>
|
|
183
|
-
View the source and add issues
|
|
184
|
-
</span>
|
|
185
|
-
</a>
|
|
186
|
-
<a className="link-item" href="https://discord.gg/storybook" target="_blank">
|
|
187
|
-
<span>
|
|
188
|
-
<strong>Discord chat</strong>
|
|
189
|
-
Chat with maintainers and the community
|
|
190
|
-
</span>
|
|
191
|
-
</a>
|
|
192
|
-
</div>
|
|
193
|
-
|
|
194
|
-
<div className="tip-wrapper">
|
|
195
|
-
<span className="tip">Tip</span>Edit the Markdown in{' '}
|
|
196
|
-
<code>src/stories/Introduction.stories.mdx</code>
|
|
197
|
-
</div>
|
package/stories/buttons.ts
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import component from '@teiler/svelte'
|
|
2
|
-
|
|
3
|
-
const Button = component.button<{
|
|
4
|
-
_primary: boolean
|
|
5
|
-
_size: 'normal' | 'small',
|
|
6
|
-
_primaryColor: string,
|
|
7
|
-
}>`
|
|
8
|
-
border-radius: 4px;
|
|
9
|
-
box-shadow: none;
|
|
10
|
-
display: inline-block;
|
|
11
|
-
padding: 0.5rem 1.6rem;
|
|
12
|
-
text-align: center;
|
|
13
|
-
font-size: 0.8rem;
|
|
14
|
-
line-height: 1.5rem;
|
|
15
|
-
background: transparent;
|
|
16
|
-
box-shadow: 0 0 0 3px #CBCBCB inset;
|
|
17
|
-
border: 0;
|
|
18
|
-
color: #0f121a;
|
|
19
|
-
appearance: none;
|
|
20
|
-
cursor: pointer;
|
|
21
|
-
font-weight: 700;
|
|
22
|
-
font-family: Roboto;
|
|
23
|
-
|
|
24
|
-
&:hover {
|
|
25
|
-
text-decoration: none;
|
|
26
|
-
color: #fcfbff;
|
|
27
|
-
background: ${( { _primaryColor } ) => _primaryColor};
|
|
28
|
-
box-shadow: 0 0 0 3px ${( { _primaryColor } ) => _primaryColor} inset;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
${({ _primary, _primaryColor }) =>
|
|
32
|
-
_primary &&
|
|
33
|
-
`
|
|
34
|
-
color: #fff;
|
|
35
|
-
box-shadow: none;
|
|
36
|
-
background: ${_primaryColor};
|
|
37
|
-
|
|
38
|
-
&:hover {
|
|
39
|
-
opacity: 0.9;
|
|
40
|
-
}
|
|
41
|
-
`}
|
|
42
|
-
|
|
43
|
-
${({ _size }) =>
|
|
44
|
-
_size === 'small' &&
|
|
45
|
-
`
|
|
46
|
-
font-size: 0.81rem;
|
|
47
|
-
padding: 0.3rem 1.2rem;
|
|
48
|
-
min-width: auto;
|
|
49
|
-
`}
|
|
50
|
-
|
|
51
|
-
&[disabled] {
|
|
52
|
-
background-image: none !important;
|
|
53
|
-
background-color: #C0C0C0 !important;
|
|
54
|
-
box-shadow: 0 0 0 3px #C0C0C0 inset !important;
|
|
55
|
-
color: #fff !important;
|
|
56
|
-
cursor: not-allowed;
|
|
57
|
-
}
|
|
58
|
-
`
|
|
59
|
-
|
|
60
|
-
const ExtendedButton = component(Button)<{test?: boolean}>`
|
|
61
|
-
font-weight: 300;
|
|
62
|
-
background: red;
|
|
63
|
-
|
|
64
|
-
${(props) => `
|
|
65
|
-
color: ${props.test ? 'red' : 'blue'};
|
|
66
|
-
`}
|
|
67
|
-
`
|
|
68
|
-
|
|
69
|
-
export { Button, ExtendedButton }
|