@teiler/svelte 0.0.3 → 0.0.5
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 +8 -4
- 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 +23 -19
- package/src/Styled.svelte +1 -1
- package/src/index.ts +13 -13
- package/src/sheet.ts +1 -1
- package/.storybook/main.ts +0 -21
- package/.storybook/preview.js +0 -9
- package/.turbo/turbo-storybook.log +0 -59
- 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/Palette.stories.svelte +0 -53
- package/stories/Palette.svelte +0 -29
- package/stories/buttons.ts +0 -69
- package/stories/palette.ts +0 -28
package/src/index.ts
CHANGED
|
@@ -1,17 +1,13 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Compile, Properties, Style, Target, TeilerComponent } from '@teiler/core'
|
|
2
|
+
import type { ComponentType, SvelteComponent } from 'svelte'
|
|
2
3
|
|
|
3
|
-
import
|
|
4
|
-
import type { SvelteComponent, ComponentType } from 'svelte'
|
|
4
|
+
import { component, global, keyframes, styled } from '@teiler/core'
|
|
5
5
|
import Styled from './Styled.svelte'
|
|
6
6
|
import tags from './tags'
|
|
7
7
|
|
|
8
8
|
type SvelteTeilerComponent<Target, Props> = TeilerComponent<Target, Props> & ComponentType<SvelteComponent>
|
|
9
9
|
|
|
10
|
-
let componentsIds = 0
|
|
11
10
|
const createComponent = <Target, Props>(compile: Compile, tag: Target, styles: Array<Style<Props>>): SvelteTeilerComponent<Target, Props> => {
|
|
12
|
-
const componentId = componentsIds++;
|
|
13
|
-
console.log('create component', componentId)
|
|
14
|
-
|
|
15
11
|
return class extends Styled {
|
|
16
12
|
static styles = styles
|
|
17
13
|
static tag = tag
|
|
@@ -34,16 +30,20 @@ type InferProps<Component, Props> = Component extends SvelteTeilerComponent<Targ
|
|
|
34
30
|
type InferComponent<Component, Props> = Component extends SvelteTeilerComponent<infer E, infer P> ? SvelteTeilerComponent<E, Props & P> : SvelteTeilerComponent<Target, Props>
|
|
35
31
|
|
|
36
32
|
type Component<Target> = {
|
|
37
|
-
<Props extends object = {}>(string: TemplateStringsArray, ...
|
|
38
|
-
<Component>(binded: Component): <Props extends object = {}>(string: TemplateStringsArray, ...
|
|
33
|
+
<Props extends object = {}>(string: TemplateStringsArray, ...properties: Properties<Props>[]): SvelteTeilerComponent<Target, Props>
|
|
34
|
+
<Component>(binded: Component): <Props extends object = {}>(string: TemplateStringsArray, ...properties: Properties<InferProps<Component, Props>>[]) => InferComponent<Component, Props>
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
type Global = {
|
|
38
|
+
<Props extends object = {}>(string: TemplateStringsArray, ...properties: Properties<Props>[]): SvelteTeilerComponent<unknown, Props>
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
type ComponentWithTags = Component<'div'> & { [K in (typeof tags)[number]]: Component<K> }
|
|
42
42
|
|
|
43
43
|
const construct = (tag: string, compile: Compile) => {
|
|
44
|
-
return <Props extends object = {}>(stringOrBinded: TeilerComponent<Target, Props> | TemplateStringsArray, ...
|
|
44
|
+
return <Props extends object = {}>(stringOrBinded: TeilerComponent<Target, Props> | TemplateStringsArray, ...properties: Properties<Props>[]) => {
|
|
45
45
|
const binded = createComponent.bind(null, compile, (stringOrBinded as TeilerComponent<Target, Props>).tag || tag)
|
|
46
|
-
return styled<Props, SvelteTeilerComponent<Target, Props>>(binded, stringOrBinded, ...
|
|
46
|
+
return styled<Props, SvelteTeilerComponent<Target, Props>>(binded, stringOrBinded, ...properties)
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
|
|
@@ -53,7 +53,7 @@ tags.forEach((tag) => {
|
|
|
53
53
|
svelteComponent[tag] = construct(tag, component)
|
|
54
54
|
})
|
|
55
55
|
|
|
56
|
-
const svelteGlobal = construct(null, global)
|
|
56
|
+
const svelteGlobal = construct(null, global) as Global
|
|
57
57
|
|
|
58
|
-
export { svelteGlobal as global, createComponent }
|
|
58
|
+
export { svelteGlobal as global, keyframes, createComponent }
|
|
59
59
|
export default svelteComponent as ComponentWithTags
|
package/src/sheet.ts
CHANGED
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
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
@storybook/cli v7.0.23
|
|
2
|
-
|
|
3
|
-
WARN The "@storybook/addon-mdx-gfm" addon is meant as a migration assistant for Storybook 7.0; and will likely be removed in a future version.
|
|
4
|
-
WARN It's recommended you read this document:
|
|
5
|
-
WARN https://storybook.js.org/docs/react/writing-docs/mdx#lack-of-github-flavored-markdown-gfm
|
|
6
|
-
WARN
|
|
7
|
-
WARN Once you've made the necessary changes, you can remove the addon from your package.json and storybook config.
|
|
8
|
-
info => Starting manager..
|
|
9
|
-
╭─────────────────────────────────────────────────────────────────────╮
|
|
10
|
-
│ │
|
|
11
|
-
│ Storybook 7.0.23 for svelte-vite started │
|
|
12
|
-
│ 4.62 s for manager and 2.09 s for preview │
|
|
13
|
-
│ │
|
|
14
|
-
│ Local: http://localhost:6006/ │
|
|
15
|
-
│ On your network: http://192.168.2.2:6006/ │
|
|
16
|
-
│ │
|
|
17
|
-
│ A new version (7.0.26) is available! │
|
|
18
|
-
│ │
|
|
19
|
-
│ Upgrade now: npx storybook@latest upgrade │
|
|
20
|
-
│ │
|
|
21
|
-
│ Read full changelog: │
|
|
22
|
-
│ https://github.com/storybookjs/storybook/blob/next/CHANGELOG.md │
|
|
23
|
-
│ │
|
|
24
|
-
╰─────────────────────────────────────────────────────────────────────╯
|
|
25
|
-
6:30:09 AM [vite] hmr update /stories/Palette.svelte
|
|
26
|
-
6:30:28 AM [vite] hmr update /stories/Palette.svelte
|
|
27
|
-
6:30:34 AM [vite] hmr update /stories/Palette.svelte
|
|
28
|
-
6:30:44 AM [vite] hmr update /stories/Palette.svelte
|
|
29
|
-
6:30:51 AM [vite] hmr update /stories/Palette.svelte
|
|
30
|
-
6:30:58 AM [vite] hmr update /stories/Palette.svelte
|
|
31
|
-
6:31:07 AM [vite] hmr update /stories/Palette.svelte
|
|
32
|
-
6:32:12 AM [vite] hmr update /stories/Palette.svelte
|
|
33
|
-
6:32:14 AM [vite] hmr update /stories/Palette.svelte, /stories/Buttons.svelte
|
|
34
|
-
6:32:30 AM [vite] hmr update /stories/Palette.svelte
|
|
35
|
-
6:32:32 AM [vite] hmr update /stories/Palette.svelte, /stories/Buttons.svelte
|
|
36
|
-
6:33:09 AM [vite] hmr update /stories/Palette.svelte
|
|
37
|
-
6:33:11 AM [vite] hmr update /stories/Palette.svelte, /stories/Buttons.svelte
|
|
38
|
-
6:33:38 AM [vite] hmr update /stories/Palette.svelte
|
|
39
|
-
6:33:40 AM [vite] hmr update /stories/Palette.svelte, /stories/Buttons.svelte
|
|
40
|
-
6:56:14 AM [vite] hmr update /stories/Palette.svelte
|
|
41
|
-
6:56:17 AM [vite] hmr update /stories/Palette.svelte, /stories/Buttons.svelte
|
|
42
|
-
6:57:35 AM [vite] hmr update /stories/Palette.svelte
|
|
43
|
-
6:57:37 AM [vite] hmr update /stories/Palette.svelte, /stories/Buttons.svelte
|
|
44
|
-
7:02:16 AM [vite] hmr update /stories/Palette.svelte
|
|
45
|
-
7:02:18 AM [vite] hmr update /stories/Palette.svelte, /stories/Buttons.svelte
|
|
46
|
-
7:11:45 AM [vite] hmr update /stories/Palette.svelte
|
|
47
|
-
7:11:48 AM [vite] hmr update /stories/Palette.svelte, /stories/Buttons.svelte
|
|
48
|
-
7:12:01 AM [vite] hmr update /stories/Palette.svelte
|
|
49
|
-
7:12:03 AM [vite] hmr update /stories/Palette.svelte, /stories/Buttons.svelte
|
|
50
|
-
7:12:14 AM [vite] hmr update /stories/Palette.svelte
|
|
51
|
-
7:12:15 AM [vite] hmr update /stories/Palette.svelte, /stories/Buttons.svelte
|
|
52
|
-
7:13:14 AM [vite] hmr update /stories/Palette.svelte
|
|
53
|
-
7:13:16 AM [vite] hmr update /stories/Palette.svelte, /stories/Buttons.svelte
|
|
54
|
-
7:14:39 AM [vite] hmr update /stories/Palette.svelte
|
|
55
|
-
7:14:41 AM [vite] hmr update /stories/Palette.svelte, /stories/Buttons.svelte
|
|
56
|
-
7:14:45 AM [vite] hmr update /stories/Palette.svelte
|
|
57
|
-
7:14:47 AM [vite] hmr update /stories/Palette.svelte, /stories/Buttons.svelte
|
|
58
|
-
7:17:50 AM [vite] hmr update /stories/Palette.svelte
|
|
59
|
-
7:17:52 AM [vite] hmr
|
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>
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { Meta, Template, Story } from "@storybook/addon-svelte-csf";
|
|
3
|
-
import Palette from "./Palette.svelte";
|
|
4
|
-
</script>
|
|
5
|
-
|
|
6
|
-
<Meta
|
|
7
|
-
title="Svelte/Palette"
|
|
8
|
-
component={Palette}
|
|
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
|
-
<Palette {...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/Palette.svelte
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { Button, ExtendedButton} from './palette'
|
|
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>
|
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 }
|