@flightlesslabs/dodo-ui 0.17.0-beta-2 → 0.17.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/dist/stories/Home.mdx +2 -1
- package/dist/stories/components/Form/Button/Button.svelte +3 -3
- package/dist/stories/components/Form/Button/Button.svelte.d.ts +2 -0
- package/dist/stories/components/Form/Radio/Radio.svelte +0 -1
- package/dist/stories/developer tools/Intro.mdx +1 -0
- package/dist/stories/developer tools/customize/AutoCustomize/AutoCustomize.mdx +4 -0
- package/dist/stories/developer tools/customize/AutoCustomize/Tool/Config/ColorTool/ColorButton.svelte +42 -0
- package/dist/stories/developer tools/customize/AutoCustomize/Tool/Config/ColorTool/ColorButton.svelte.d.ts +8 -0
- package/dist/stories/developer tools/customize/AutoCustomize/Tool/Config/ColorTool/ColorTool.svelte +21 -0
- package/dist/stories/developer tools/customize/AutoCustomize/Tool/Config/ColorTool/ColorTool.svelte.d.ts +9 -0
- package/dist/stories/developer tools/customize/AutoCustomize/Tool/Config/Config.svelte +144 -0
- package/dist/stories/developer tools/customize/AutoCustomize/Tool/Config/Config.svelte.d.ts +18 -0
- package/dist/stories/developer tools/customize/AutoCustomize/Tool/Config/Export.svelte +123 -0
- package/dist/stories/developer tools/customize/AutoCustomize/Tool/Config/Export.svelte.d.ts +18 -0
- package/dist/stories/developer tools/customize/AutoCustomize/Tool/Config/ValueSilder/ValueSilder.svelte +32 -0
- package/dist/stories/developer tools/customize/AutoCustomize/Tool/Config/ValueSilder/ValueSilder.svelte.d.ts +11 -0
- package/dist/stories/developer tools/customize/AutoCustomize/Tool/Preview/Preview.svelte +192 -0
- package/dist/stories/developer tools/customize/AutoCustomize/Tool/Preview/Preview.svelte.d.ts +3 -0
- package/dist/stories/developer tools/customize/AutoCustomize/Tool/Tool.stories.svelte +9 -0
- package/dist/stories/developer tools/customize/AutoCustomize/Tool/Tool.stories.svelte.d.ts +19 -0
- package/dist/stories/developer tools/customize/AutoCustomize/Tool/Tool.svelte +13 -0
- package/dist/stories/developer tools/customize/AutoCustomize/Tool/Tool.svelte.d.ts +18 -0
- package/dist/stories/developer tools/customize/AutoCustomize/Tool/helpers/download-file.d.ts +1 -0
- package/dist/stories/developer tools/customize/AutoCustomize/Tool/helpers/download-file.js +10 -0
- package/dist/stories/developer tools/customize/AutoCustomize/Tool/stores/config.svelte.d.ts +27 -0
- package/dist/stories/developer tools/customize/AutoCustomize/Tool/stores/config.svelte.js +70 -0
- package/dist/stories/developer tools/customize/Intro.mdx +8 -0
- package/dist/styles/_colors.css +1 -1
- package/package.json +16 -14
- package/src/lib/stories/components/Form/Button/Button.svelte +5 -2
- package/src/lib/stories/components/Form/Radio/Radio.svelte +0 -1
- package/src/lib/stories/developer tools/customize/AutoCustomize/Tool/Config/ColorTool/ColorButton.svelte +56 -0
- package/src/lib/stories/developer tools/customize/AutoCustomize/Tool/Config/ColorTool/ColorTool.svelte +32 -0
- package/src/lib/stories/developer tools/customize/AutoCustomize/Tool/Config/Config.svelte +149 -0
- package/src/lib/stories/developer tools/customize/AutoCustomize/Tool/Config/Export.svelte +172 -0
- package/src/lib/stories/developer tools/customize/AutoCustomize/Tool/Config/ValueSilder/ValueSilder.svelte +47 -0
- package/src/lib/stories/developer tools/customize/AutoCustomize/Tool/Preview/Preview.svelte +227 -0
- package/src/lib/stories/developer tools/customize/AutoCustomize/Tool/Tool.svelte +16 -0
- package/src/lib/stories/developer tools/customize/AutoCustomize/Tool/helpers/download-file.ts +11 -0
- package/src/lib/stories/developer tools/customize/AutoCustomize/Tool/stores/config.svelte.ts +107 -0
- package/src/lib/styles/_colors.css +1 -1
package/dist/stories/Home.mdx
CHANGED
|
@@ -11,7 +11,7 @@ import item from '../../../package.json?raw';
|
|
|
11
11
|
|
|
12
12
|
<h3 style={{ fontWeight: 400 }}>An open-source, opinionated UI framework for Svelte.</h3>
|
|
13
13
|
|
|
14
|
-
### [Github](https://github.com/flightlesslabs/dodo-ui) - [npm](https://www.npmjs.com/package/@flightlesslabs/dodo-ui)
|
|
14
|
+
### [Github](https://github.com/flightlesslabs/dodo-ui) - [npm](https://www.npmjs.com/package/@flightlesslabs/dodo-ui) - [Customize](?path=/docs/developer-tools-customize-autocustomize--docs)
|
|
15
15
|
|
|
16
16
|
</main>
|
|
17
17
|
|
|
@@ -68,4 +68,5 @@ import { Button } '@flightlesslabs/dodo-ui';
|
|
|
68
68
|
|
|
69
69
|
- [Dark Theme](?path=/docs/developer-tools-philosophy-themes--docs#dark-theme)
|
|
70
70
|
- [Colors](?path=/docs/developer-tools-philosophy-colors--docs)
|
|
71
|
+
- [Customize](?path=/docs/developer-tools-customize-autocustomize--docs)
|
|
71
72
|
- [Adjust Color Opacity](?path=/docs/developer-tools-philosophy-colors--docs#adjusting-opacity)
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
</script>
|
|
3
3
|
|
|
4
4
|
<script lang="ts">"use strict";
|
|
5
|
-
let { children, type = 'button', size = 'normal', color = 'primary', roundness = 1, variant = 'solid', outline = false, compact = false, fullWidth = false, name, id, title, class: className = '', disabled = false, onclick, before, after, href, download, hreflang, media, ping, rel, target, anchorMediaType, referrerpolicy, ref = $bindable(), } = $props();
|
|
5
|
+
let { children, type = 'button', size = 'normal', color = 'primary', roundness = 1, variant = 'solid', outline = false, compact = false, fullWidth = false, name, id, title, class: className = '', disabled = false, onclick, before, after, 'aria-label': ariaLabel, href, download, hreflang, media, ping, rel, target, anchorMediaType, referrerpolicy, ref = $bindable(), } = $props();
|
|
6
6
|
</script>
|
|
7
7
|
|
|
8
8
|
{#snippet buttonContent()}
|
|
@@ -36,6 +36,7 @@ let { children, type = 'button', size = 'normal', color = 'primary', roundness =
|
|
|
36
36
|
{target}
|
|
37
37
|
type={anchorMediaType}
|
|
38
38
|
{referrerpolicy}
|
|
39
|
+
aria-label={ariaLabel}
|
|
39
40
|
class:outline
|
|
40
41
|
class:compact
|
|
41
42
|
class:disabled
|
|
@@ -57,6 +58,7 @@ let { children, type = 'button', size = 'normal', color = 'primary', roundness =
|
|
|
57
58
|
class:outline
|
|
58
59
|
class:compact
|
|
59
60
|
class:fullWidth
|
|
61
|
+
aria-label={ariaLabel}
|
|
60
62
|
class={[
|
|
61
63
|
'dodo-ui-Button',
|
|
62
64
|
`size--${size}`,
|
|
@@ -269,7 +271,6 @@ let { children, type = 'button', size = 'normal', color = 'primary', roundness =
|
|
|
269
271
|
|
|
270
272
|
.dodo-ui-Button {
|
|
271
273
|
cursor: pointer;
|
|
272
|
-
outline: none;
|
|
273
274
|
transition: all 150ms;
|
|
274
275
|
text-decoration: none;
|
|
275
276
|
margin: 0;
|
|
@@ -281,7 +282,6 @@ let { children, type = 'button', size = 'normal', color = 'primary', roundness =
|
|
|
281
282
|
border-style: solid;
|
|
282
283
|
border-width: var(--dodo-ui-element-border-width);
|
|
283
284
|
border-color: transparent;
|
|
284
|
-
outline: 0;
|
|
285
285
|
color: inherit;
|
|
286
286
|
letter-spacing: 0.3px;
|
|
287
287
|
}
|
|
@@ -48,6 +48,8 @@ export interface ButtonProps {
|
|
|
48
48
|
class?: string;
|
|
49
49
|
/** The onclick event handler */
|
|
50
50
|
onclick?: MouseEventHandler<HTMLButtonElement>;
|
|
51
|
+
/** Aria label */
|
|
52
|
+
'aria-label'?: string;
|
|
51
53
|
/** Turn Button into link */
|
|
52
54
|
href?: string;
|
|
53
55
|
/** Link button: download */
|
|
@@ -239,7 +239,6 @@ let { children, size = 'normal', color = 'primary', roundness = 'full', name, id
|
|
|
239
239
|
border-style: solid;
|
|
240
240
|
border-width: calc(var(--dodo-ui-element-border-width) * 2);
|
|
241
241
|
border-color: var(--dodo-ui-Radio-border-color);
|
|
242
|
-
outline: 0;
|
|
243
242
|
letter-spacing: 0.3px;
|
|
244
243
|
border-radius: inherit;
|
|
245
244
|
position: relative;
|
|
@@ -4,6 +4,7 @@ A set of components and tools used internally in dodo-ui.
|
|
|
4
4
|
|
|
5
5
|
## Explore More
|
|
6
6
|
|
|
7
|
+
- [Customize](?path=/docs/developer-tools-customize-autocustomize--docs)
|
|
7
8
|
- [Utility Button](?path=/docs/developer-tools-components-utilitybutton--docs)
|
|
8
9
|
- [Colors](?path=/docs/developer-tools-philosophy-colors--docs)
|
|
9
10
|
- [Adjust Color Opacity](?path=/docs/developer-tools-philosophy-colors--docs#adjusting-opacity)
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<script lang="ts">import Icon from '@iconify/svelte';
|
|
2
|
+
const { color, selectedColor, onclick } = $props();
|
|
3
|
+
function onClickMod() {
|
|
4
|
+
if (onclick) {
|
|
5
|
+
onclick(color);
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<button
|
|
11
|
+
class="ColorButton"
|
|
12
|
+
class:selectedColor={selectedColor === color}
|
|
13
|
+
onclick={onClickMod}
|
|
14
|
+
aria-label={`color button ${color}`}
|
|
15
|
+
style={`background-color: var(--dodo-color-base-${color}-400);`}
|
|
16
|
+
>
|
|
17
|
+
<Icon icon="material-symbols:check-small" width="24" height="24" />
|
|
18
|
+
</button>
|
|
19
|
+
|
|
20
|
+
<style>.ColorButton {
|
|
21
|
+
width: 22px;
|
|
22
|
+
height: 22px;
|
|
23
|
+
border-radius: 50%;
|
|
24
|
+
margin: 4px;
|
|
25
|
+
cursor: pointer;
|
|
26
|
+
color: var(--dodo-color-constant-white);
|
|
27
|
+
display: inline-flex;
|
|
28
|
+
align-items: center;
|
|
29
|
+
justify-content: center;
|
|
30
|
+
position: relative;
|
|
31
|
+
border: 3px solid transparent;
|
|
32
|
+
}
|
|
33
|
+
.ColorButton :global(svg) {
|
|
34
|
+
position: absolute;
|
|
35
|
+
display: none;
|
|
36
|
+
}
|
|
37
|
+
.ColorButton.selectedColor {
|
|
38
|
+
border-color: var(--dodo-color-primary-600);
|
|
39
|
+
}
|
|
40
|
+
.ColorButton.selectedColor :global(svg) {
|
|
41
|
+
display: block;
|
|
42
|
+
}</style>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
interface ColorButtonProps {
|
|
2
|
+
color: string;
|
|
3
|
+
selectedColor?: string;
|
|
4
|
+
onclick?: (color: string) => void;
|
|
5
|
+
}
|
|
6
|
+
declare const ColorButton: import("svelte").Component<ColorButtonProps, {}, "">;
|
|
7
|
+
type ColorButton = ReturnType<typeof ColorButton>;
|
|
8
|
+
export default ColorButton;
|
package/dist/stories/developer tools/customize/AutoCustomize/Tool/Config/ColorTool/ColorTool.svelte
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<script lang="ts">import FormControl from '../../../../../../components/Form/FormControl/FormControl.svelte';
|
|
2
|
+
import { colorPaletteBase } from '../../../../../philosophy/Colors/utils/color.js';
|
|
3
|
+
import ColorButton from './ColorButton.svelte';
|
|
4
|
+
const { colors = colorPaletteBase, selectedColor, onclick, label } = $props();
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<div class="ColorTool">
|
|
8
|
+
<FormControl {label}>
|
|
9
|
+
{#each colors as color (color)}
|
|
10
|
+
<ColorButton {color} {onclick} {selectedColor} />
|
|
11
|
+
{/each}
|
|
12
|
+
</FormControl>
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
<style>.ColorTool {
|
|
16
|
+
display: flex;
|
|
17
|
+
flex-wrap: wrap;
|
|
18
|
+
margin-bottom: calc(var(--dodo-ui-space) * 2.5);
|
|
19
|
+
margin-left: -4px;
|
|
20
|
+
margin-right: -4px;
|
|
21
|
+
}</style>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
interface ColorToolProps {
|
|
2
|
+
label?: string;
|
|
3
|
+
colors?: string[];
|
|
4
|
+
selectedColor?: string;
|
|
5
|
+
onclick?: (color: string) => void;
|
|
6
|
+
}
|
|
7
|
+
declare const ColorTool: import("svelte").Component<ColorToolProps, {}, "">;
|
|
8
|
+
type ColorTool = ReturnType<typeof ColorTool>;
|
|
9
|
+
export default ColorTool;
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
<script lang="ts">import Button from '../../../../../components/Form/Button/Button.svelte';
|
|
2
|
+
import { useAutoCustomizeConfigStore } from '../stores/config.svelte.js';
|
|
3
|
+
import ColorTool from './ColorTool/ColorTool.svelte';
|
|
4
|
+
import Export from './Export.svelte';
|
|
5
|
+
import ValueSilder from './ValueSilder/ValueSilder.svelte';
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<div class="Config">
|
|
9
|
+
<h3>Auto Customize</h3>
|
|
10
|
+
<ColorTool
|
|
11
|
+
label="Primary Color:"
|
|
12
|
+
onclick={(color) => useAutoCustomizeConfigStore.updateDataColor({ primary: color })}
|
|
13
|
+
selectedColor={useAutoCustomizeConfigStore.data.colors?.primary}
|
|
14
|
+
colors={[
|
|
15
|
+
'violet',
|
|
16
|
+
'red',
|
|
17
|
+
'orange',
|
|
18
|
+
'amber',
|
|
19
|
+
'yellow',
|
|
20
|
+
'lime',
|
|
21
|
+
'green',
|
|
22
|
+
'emerald',
|
|
23
|
+
'teal',
|
|
24
|
+
'cyan',
|
|
25
|
+
'blue',
|
|
26
|
+
'indigo',
|
|
27
|
+
'purple',
|
|
28
|
+
'fuchsia',
|
|
29
|
+
'pink',
|
|
30
|
+
'rose',
|
|
31
|
+
]}
|
|
32
|
+
/>
|
|
33
|
+
|
|
34
|
+
<ColorTool
|
|
35
|
+
label="Secondary Color:"
|
|
36
|
+
onclick={(color) => useAutoCustomizeConfigStore.updateDataColor({ secondary: color })}
|
|
37
|
+
selectedColor={useAutoCustomizeConfigStore.data.colors?.secondary}
|
|
38
|
+
colors={[
|
|
39
|
+
'blue',
|
|
40
|
+
'red',
|
|
41
|
+
'orange',
|
|
42
|
+
'amber',
|
|
43
|
+
'yellow',
|
|
44
|
+
'lime',
|
|
45
|
+
'green',
|
|
46
|
+
'emerald',
|
|
47
|
+
'teal',
|
|
48
|
+
'cyan',
|
|
49
|
+
'indigo',
|
|
50
|
+
'violet',
|
|
51
|
+
'purple',
|
|
52
|
+
'fuchsia',
|
|
53
|
+
'pink',
|
|
54
|
+
'rose',
|
|
55
|
+
]}
|
|
56
|
+
/>
|
|
57
|
+
|
|
58
|
+
<ColorTool
|
|
59
|
+
label="Neutral Color:"
|
|
60
|
+
onclick={(color) => useAutoCustomizeConfigStore.updateDataColor({ neutral: color })}
|
|
61
|
+
selectedColor={useAutoCustomizeConfigStore.data.colors?.neutral}
|
|
62
|
+
colors={['gray', 'slate', 'zinc', 'neutral', 'stone']}
|
|
63
|
+
/>
|
|
64
|
+
|
|
65
|
+
<ColorTool
|
|
66
|
+
label="Safe Color:"
|
|
67
|
+
onclick={(color) => useAutoCustomizeConfigStore.updateDataColor({ safe: color })}
|
|
68
|
+
selectedColor={useAutoCustomizeConfigStore.data.colors?.safe}
|
|
69
|
+
colors={['emerald', 'lime', 'green', 'teal']}
|
|
70
|
+
/>
|
|
71
|
+
|
|
72
|
+
<ColorTool
|
|
73
|
+
label="Warning Color:"
|
|
74
|
+
onclick={(color) => useAutoCustomizeConfigStore.updateDataColor({ warning: color })}
|
|
75
|
+
selectedColor={useAutoCustomizeConfigStore.data.colors?.warning}
|
|
76
|
+
colors={['amber', 'red', 'rose', 'orange', 'yellow']}
|
|
77
|
+
/>
|
|
78
|
+
|
|
79
|
+
<ColorTool
|
|
80
|
+
label="Danger Color:"
|
|
81
|
+
onclick={(color) => useAutoCustomizeConfigStore.updateDataColor({ danger: color })}
|
|
82
|
+
selectedColor={useAutoCustomizeConfigStore.data.colors?.danger}
|
|
83
|
+
colors={['red', 'orange', 'amber', 'yellow', 'pink', 'rose']}
|
|
84
|
+
/>
|
|
85
|
+
|
|
86
|
+
<ValueSilder
|
|
87
|
+
label="Roundness:"
|
|
88
|
+
value={useAutoCustomizeConfigStore.data.components?.roundness || 0}
|
|
89
|
+
min={-5}
|
|
90
|
+
max={7}
|
|
91
|
+
oninput={(value) => useAutoCustomizeConfigStore.updateDataComponents({ roundness: value })}
|
|
92
|
+
/>
|
|
93
|
+
|
|
94
|
+
<ValueSilder
|
|
95
|
+
label="Size:"
|
|
96
|
+
value={useAutoCustomizeConfigStore.data.components?.elementHeight || 0}
|
|
97
|
+
min={-5}
|
|
98
|
+
max={7}
|
|
99
|
+
oninput={(value) => useAutoCustomizeConfigStore.updateDataComponents({ elementHeight: value })}
|
|
100
|
+
/>
|
|
101
|
+
|
|
102
|
+
<ValueSilder
|
|
103
|
+
label="Border:"
|
|
104
|
+
value={useAutoCustomizeConfigStore.data.components?.borderWidth || 0}
|
|
105
|
+
min={0}
|
|
106
|
+
max={7}
|
|
107
|
+
oninput={(value) => useAutoCustomizeConfigStore.updateDataComponents({ borderWidth: value })}
|
|
108
|
+
/>
|
|
109
|
+
|
|
110
|
+
<ValueSilder
|
|
111
|
+
label="Space:"
|
|
112
|
+
value={useAutoCustomizeConfigStore.data.space || 0}
|
|
113
|
+
min={-5}
|
|
114
|
+
max={15}
|
|
115
|
+
oninput={(value) => useAutoCustomizeConfigStore.updateData({ space: value })}
|
|
116
|
+
/>
|
|
117
|
+
|
|
118
|
+
<div class="Export">
|
|
119
|
+
<Export />
|
|
120
|
+
</div>
|
|
121
|
+
|
|
122
|
+
<div class="Reset">
|
|
123
|
+
<Button onclick={() => useAutoCustomizeConfigStore.reset()} variant="text" color="danger">
|
|
124
|
+
Reset
|
|
125
|
+
</Button>
|
|
126
|
+
</div>
|
|
127
|
+
</div>
|
|
128
|
+
|
|
129
|
+
<style>.Config {
|
|
130
|
+
width: 100%;
|
|
131
|
+
display: flex;
|
|
132
|
+
flex-direction: column;
|
|
133
|
+
padding: calc(var(--dodo-ui-space) * 2);
|
|
134
|
+
}
|
|
135
|
+
@media (min-width: 64rem) {
|
|
136
|
+
.Config {
|
|
137
|
+
max-width: 300px;
|
|
138
|
+
height: calc(100vh - 130px);
|
|
139
|
+
overflow: auto;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
.Config .Reset {
|
|
143
|
+
margin-top: calc(var(--dodo-ui-space) * 4);
|
|
144
|
+
}</style>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
2
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
|
+
$$bindings?: Bindings;
|
|
4
|
+
} & Exports;
|
|
5
|
+
(internal: unknown, props: {
|
|
6
|
+
$$events?: Events;
|
|
7
|
+
$$slots?: Slots;
|
|
8
|
+
}): Exports & {
|
|
9
|
+
$set?: any;
|
|
10
|
+
$on?: any;
|
|
11
|
+
};
|
|
12
|
+
z_$$bindings?: Bindings;
|
|
13
|
+
}
|
|
14
|
+
declare const Config: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
15
|
+
[evt: string]: CustomEvent<any>;
|
|
16
|
+
}, {}, {}, string>;
|
|
17
|
+
type Config = InstanceType<typeof Config>;
|
|
18
|
+
export default Config;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
<script lang="ts">import Button from '../../../../../components/Form/Button/Button.svelte';
|
|
2
|
+
import { colorPalette, colorPaletteValues, } from '../../../../philosophy/Colors/utils/color.js';
|
|
3
|
+
import { downloadFile } from '../helpers/download-file.js';
|
|
4
|
+
import { autoCustomizeConfigdefaultData, useAutoCustomizeConfigStore, } from '../stores/config.svelte.js';
|
|
5
|
+
async function onclick() {
|
|
6
|
+
try {
|
|
7
|
+
let rawText = `/* dodo-ui-custom.css */
|
|
8
|
+
:root {`;
|
|
9
|
+
for (let index = 0; index < colorPalette.length; index++) {
|
|
10
|
+
const colorName = colorPalette[index];
|
|
11
|
+
const fieldName = `${colorName}`;
|
|
12
|
+
const dataPoint = useAutoCustomizeConfigStore.data.colors &&
|
|
13
|
+
useAutoCustomizeConfigStore.data.colors[fieldName]
|
|
14
|
+
? useAutoCustomizeConfigStore.data.colors[fieldName]
|
|
15
|
+
: undefined;
|
|
16
|
+
const defaultValue = autoCustomizeConfigdefaultData.colors && autoCustomizeConfigdefaultData.colors[fieldName]
|
|
17
|
+
? autoCustomizeConfigdefaultData.colors[fieldName]
|
|
18
|
+
: undefined;
|
|
19
|
+
const pass = dataPoint && dataPoint !== defaultValue ? true : false;
|
|
20
|
+
if (!pass) {
|
|
21
|
+
continue;
|
|
22
|
+
}
|
|
23
|
+
rawText += `
|
|
24
|
+
/* ${colorName} color */`;
|
|
25
|
+
for (let index = 0; index < colorPaletteValues.length; index++) {
|
|
26
|
+
const weight = colorPaletteValues[index];
|
|
27
|
+
rawText += `
|
|
28
|
+
--dodo-color-${colorName}-${weight}: var(--dodo-color-base-${dataPoint}-${weight});`;
|
|
29
|
+
if (colorPaletteValues[index] === colorPaletteValues[colorPaletteValues.length - 1]) {
|
|
30
|
+
rawText += `
|
|
31
|
+
`;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
if (useAutoCustomizeConfigStore.data.components?.roundness) {
|
|
36
|
+
const roundness = useAutoCustomizeConfigStore.data.components?.roundness / 8;
|
|
37
|
+
rawText += `
|
|
38
|
+
|
|
39
|
+
/* Component: Roundness */
|
|
40
|
+
--dodo-ui-element-roundness-1: ${0.4375 + roundness}em;
|
|
41
|
+
--dodo-ui-element-roundness-2: ${0.8125 + roundness}em;
|
|
42
|
+
--dodo-ui-element-roundness-3: ${1.9375 + roundness}em;`;
|
|
43
|
+
}
|
|
44
|
+
if (useAutoCustomizeConfigStore.data.components?.elementHeight) {
|
|
45
|
+
const elementHeight = useAutoCustomizeConfigStore.data.components.elementHeight + 2;
|
|
46
|
+
const elementHeightTrack = useAutoCustomizeConfigStore.data.components.elementHeight / 2;
|
|
47
|
+
rawText += `
|
|
48
|
+
|
|
49
|
+
/* Component: Size */
|
|
50
|
+
--dodo-ui-element-height-small: ${34 + elementHeight}px;
|
|
51
|
+
--dodo-ui-element-height-normal: ${40 + elementHeight}px;
|
|
52
|
+
--dodo-ui-element-height-large: ${50 + elementHeight}px;
|
|
53
|
+
--dodo-ui-track-element-height-small: ${6 + elementHeightTrack}px;
|
|
54
|
+
--dodo-ui-track-element-height-normal: ${8 + elementHeightTrack}px;
|
|
55
|
+
--dodo-ui-track-element-height-large: ${10 + elementHeightTrack}px;`;
|
|
56
|
+
}
|
|
57
|
+
if (useAutoCustomizeConfigStore.data.components?.borderWidth) {
|
|
58
|
+
const borderWidth = useAutoCustomizeConfigStore.data.components.borderWidth;
|
|
59
|
+
rawText += `
|
|
60
|
+
|
|
61
|
+
/* Component: Border */
|
|
62
|
+
--dodo-ui-element-border-width: ${2 + borderWidth}px;`;
|
|
63
|
+
}
|
|
64
|
+
if (useAutoCustomizeConfigStore.data.space) {
|
|
65
|
+
const space = useAutoCustomizeConfigStore.data.space;
|
|
66
|
+
rawText += `
|
|
67
|
+
|
|
68
|
+
/* Space */
|
|
69
|
+
--dodo-ui-space-small: ${6 + space}px;
|
|
70
|
+
--dodo-ui-space: ${8 + space}px;
|
|
71
|
+
--dodo-ui-space-large: ${10 + space}px;`;
|
|
72
|
+
}
|
|
73
|
+
// end
|
|
74
|
+
rawText += `
|
|
75
|
+
}`;
|
|
76
|
+
rawText += `
|
|
77
|
+
|
|
78
|
+
.dodo-theme--dark {`;
|
|
79
|
+
for (let index = 0; index < colorPalette.length; index++) {
|
|
80
|
+
const colorName = colorPalette[index];
|
|
81
|
+
const fieldName = `${colorName}`;
|
|
82
|
+
const dataPoint = useAutoCustomizeConfigStore.data.colors &&
|
|
83
|
+
useAutoCustomizeConfigStore.data.colors[fieldName]
|
|
84
|
+
? useAutoCustomizeConfigStore.data.colors[fieldName]
|
|
85
|
+
: undefined;
|
|
86
|
+
const defaultValue = autoCustomizeConfigdefaultData.colors && autoCustomizeConfigdefaultData.colors[fieldName]
|
|
87
|
+
? autoCustomizeConfigdefaultData.colors[fieldName]
|
|
88
|
+
: undefined;
|
|
89
|
+
const pass = dataPoint && dataPoint !== defaultValue ? true : false;
|
|
90
|
+
if (!pass) {
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
93
|
+
rawText += `
|
|
94
|
+
|
|
95
|
+
/* Dark: ${colorName} color */`;
|
|
96
|
+
const colorPaletteValuesReversed = [...colorPaletteValues].reverse();
|
|
97
|
+
for (let index = 0; index < colorPaletteValues.length; index++) {
|
|
98
|
+
const weight = colorPaletteValues[index];
|
|
99
|
+
const weightReversed = colorPaletteValuesReversed[index];
|
|
100
|
+
rawText += `
|
|
101
|
+
--dodo-color-${colorName}-${weight}: var(--dodo-color-base-${dataPoint}-${weightReversed});`;
|
|
102
|
+
}
|
|
103
|
+
if (colorPaletteValuesReversed[index] ===
|
|
104
|
+
colorPaletteValuesReversed[colorPaletteValuesReversed.length - 1]) {
|
|
105
|
+
rawText += `
|
|
106
|
+
`;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
// end
|
|
110
|
+
rawText += `
|
|
111
|
+
}`;
|
|
112
|
+
const data = new Blob([rawText], { type: 'text/plain' });
|
|
113
|
+
await downloadFile(`dodo-ui-custom.css`, data);
|
|
114
|
+
}
|
|
115
|
+
catch (e) {
|
|
116
|
+
console.error(e);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
</script>
|
|
120
|
+
|
|
121
|
+
<Button {onclick}>Export CSS</Button>
|
|
122
|
+
|
|
123
|
+
<style></style>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
2
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
|
+
$$bindings?: Bindings;
|
|
4
|
+
} & Exports;
|
|
5
|
+
(internal: unknown, props: {
|
|
6
|
+
$$events?: Events;
|
|
7
|
+
$$slots?: Slots;
|
|
8
|
+
}): Exports & {
|
|
9
|
+
$set?: any;
|
|
10
|
+
$on?: any;
|
|
11
|
+
};
|
|
12
|
+
z_$$bindings?: Bindings;
|
|
13
|
+
}
|
|
14
|
+
declare const Export: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
15
|
+
[evt: string]: CustomEvent<any>;
|
|
16
|
+
}, {}, {}, string>;
|
|
17
|
+
type Export = InstanceType<typeof Export>;
|
|
18
|
+
export default Export;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<script lang="ts">import FormControl from '../../../../../../components/Form/FormControl/FormControl.svelte';
|
|
2
|
+
import RangeSlider from '../../../../../../components/Form/RangeSlider/RangeSlider.svelte';
|
|
3
|
+
const { label, value, min, max, oninput } = $props();
|
|
4
|
+
let displayValue = $state(0);
|
|
5
|
+
function oninputMod(e) {
|
|
6
|
+
const target = e.target;
|
|
7
|
+
if (oninput) {
|
|
8
|
+
oninput(Number(target.value));
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
$effect(() => {
|
|
12
|
+
if (value === 0) {
|
|
13
|
+
displayValue = 1;
|
|
14
|
+
}
|
|
15
|
+
else if (value < 0) {
|
|
16
|
+
displayValue = value;
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
displayValue = value + 1;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<div class="ValueSilder">
|
|
25
|
+
<FormControl label={`${label} ${displayValue}x`}>
|
|
26
|
+
<RangeSlider {value} {min} {max} oninput={oninputMod} size="small" />
|
|
27
|
+
</FormControl>
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
<style>.ValueSilder {
|
|
31
|
+
margin-bottom: calc(var(--dodo-ui-space) * 2.5);
|
|
32
|
+
}</style>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
interface ValueSilderProps {
|
|
2
|
+
label?: string;
|
|
3
|
+
value: number;
|
|
4
|
+
min: number;
|
|
5
|
+
max: number;
|
|
6
|
+
/** oninput event handler */
|
|
7
|
+
oninput?: (value: number) => void;
|
|
8
|
+
}
|
|
9
|
+
declare const ValueSilder: import("svelte").Component<ValueSilderProps, {}, "">;
|
|
10
|
+
type ValueSilder = ReturnType<typeof ValueSilder>;
|
|
11
|
+
export default ValueSilder;
|