@flightlesslabs/dodo-ui 0.17.1 → 0.18.0
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/index.d.ts +5 -1
- package/dist/index.js +2 -0
- package/dist/stories/Home.mdx +2 -1
- package/dist/stories/components/Form/Button/Button.svelte +0 -2
- package/dist/stories/components/Form/Radio/Radio.svelte +0 -1
- package/dist/stories/components/Form/Select/Select.svelte.d.ts +2 -2
- package/dist/stories/components/Layout/Accordian/Accordian.stories.svelte +52 -0
- package/dist/stories/components/Layout/Accordian/Accordian.stories.svelte.d.ts +21 -0
- package/dist/stories/components/Layout/Accordian/Accordian.svelte +121 -0
- package/dist/stories/components/Layout/Accordian/Accordian.svelte.d.ts +34 -0
- package/dist/stories/components/Layout/Accordian/Customize/Customize.stories.svelte +69 -0
- package/dist/stories/components/Layout/Accordian/Customize/Customize.stories.svelte.d.ts +18 -0
- package/dist/stories/components/Layout/Accordian/Events/Events.stories.svelte +30 -0
- package/dist/stories/components/Layout/Accordian/Events/Events.stories.svelte.d.ts +18 -0
- package/dist/stories/components/Layout/Accordian/Size/Size.stories.svelte +48 -0
- package/dist/stories/components/Layout/Accordian/Size/Size.stories.svelte.d.ts +26 -0
- 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/dist/types/special.d.ts +1 -0
- package/dist/types/special.js +1 -0
- package/package.json +8 -6
- package/src/lib/index.ts +10 -5
- package/src/lib/stories/components/Form/Button/Button.svelte +0 -2
- package/src/lib/stories/components/Form/Radio/Radio.svelte +0 -1
- package/src/lib/stories/components/Form/Select/Select.svelte +2 -3
- package/src/lib/stories/components/Layout/Accordian/Accordian.svelte +195 -0
- 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/src/lib/types/special.ts +1 -0
|
@@ -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;
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
<script lang="ts">import Button from '../../../../../components/Form/Button/Button.svelte';
|
|
2
|
+
import RangeSlider from '../../../../../components/Form/RangeSlider/RangeSlider.svelte';
|
|
3
|
+
import Column from '../../../../../components/Layout/Grid/Column/Column.svelte';
|
|
4
|
+
import Grid from '../../../../../components/Layout/Grid/Grid.svelte';
|
|
5
|
+
import Paper from '../../../../../components/Layout/Paper/Paper.svelte';
|
|
6
|
+
import { colorPalette, colorPaletteValues, } from '../../../../philosophy/Colors/utils/color.js';
|
|
7
|
+
import { useAutoCustomizeConfigStore, } from '../stores/config.svelte.js';
|
|
8
|
+
let cssVariables = $state([]);
|
|
9
|
+
$effect(() => {
|
|
10
|
+
const newCssvariables = [];
|
|
11
|
+
for (let index = 0; index < colorPalette.length; index++) {
|
|
12
|
+
const colorName = colorPalette[index];
|
|
13
|
+
const fieldName = `${colorName}`;
|
|
14
|
+
const dataPoint = useAutoCustomizeConfigStore.data.colors &&
|
|
15
|
+
useAutoCustomizeConfigStore.data.colors[fieldName]
|
|
16
|
+
? useAutoCustomizeConfigStore.data.colors[fieldName]
|
|
17
|
+
: undefined;
|
|
18
|
+
if (dataPoint) {
|
|
19
|
+
for (let index = 0; index < colorPaletteValues.length; index++) {
|
|
20
|
+
const weight = colorPaletteValues[index];
|
|
21
|
+
newCssvariables.push(`--dodo-color-${colorName}-${weight}: var(--dodo-color-base-${dataPoint}-${weight})`);
|
|
22
|
+
}
|
|
23
|
+
newCssvariables.push(...[
|
|
24
|
+
`--dodo-ui-Button-outline-${colorName}: var(--dodo-color-base-${dataPoint}-400)`,
|
|
25
|
+
`--dodo-ui-Button-text-${colorName}-bg: var(--dodo-color-base-${dataPoint}-100)`,
|
|
26
|
+
`--dodo-ui-Button-text-${colorName}-hover-bg: var(--dodo-color-base-${dataPoint}-200)`,
|
|
27
|
+
`--dodo-ui-Button-text-${colorName}-active-bg: var(--dodo-color-base-${dataPoint}-300)`,
|
|
28
|
+
`--dodo-ui-Button-solid-${colorName}-bg: var(--dodo-color-base-${dataPoint}-500)`,
|
|
29
|
+
`--dodo-ui-Button-solid-${colorName}-hover-bg: var(--dodo-color-base-${dataPoint}-600)`,
|
|
30
|
+
`--dodo-ui-Button-solid-${colorName}-active-bg: var(--dodo-color-base-${dataPoint}-700)`,
|
|
31
|
+
`--dodo-ui-RangeSlider-thumb-${colorName}-bg: var(--dodo-color-base-${dataPoint}-500)`,
|
|
32
|
+
`--dodo-ui-RangeSlider-thumb-${colorName}-hover-bg: var(--dodo-color-base-${dataPoint}-600)`,
|
|
33
|
+
`--dodo-ui-RangeSlider-thumb-${colorName}-active-bg: var(--dodo-color-base-${dataPoint}-700)`,
|
|
34
|
+
`--dodo-ui-RangeSlider-track-filled-${colorName}-bg: var(--dodo-color-base-${dataPoint}-500)`,
|
|
35
|
+
]);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
if (useAutoCustomizeConfigStore.data.components?.roundness) {
|
|
39
|
+
const roundness = useAutoCustomizeConfigStore.data.components.roundness / 8;
|
|
40
|
+
newCssvariables.push(`--dodo-ui-element-roundness-1: ${0.4375 + roundness}em`);
|
|
41
|
+
newCssvariables.push(`--dodo-ui-element-roundness-2: ${0.8125 + roundness}em`);
|
|
42
|
+
newCssvariables.push(`--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
|
+
newCssvariables.push(`--dodo-ui-element-height-small: ${34 + elementHeight}px`);
|
|
48
|
+
newCssvariables.push(`--dodo-ui-element-height-normal: ${40 + elementHeight}px`);
|
|
49
|
+
newCssvariables.push(`--dodo-ui-element-height-large: ${50 + elementHeight}px`);
|
|
50
|
+
newCssvariables.push(`--dodo-ui-track-element-height-small: ${6 + elementHeightTrack}px`);
|
|
51
|
+
newCssvariables.push(`--dodo-ui-track-element-height-normal: ${8 + elementHeightTrack}px`);
|
|
52
|
+
newCssvariables.push(`--dodo-ui-track-element-height-large: ${10 + elementHeightTrack}px`);
|
|
53
|
+
}
|
|
54
|
+
if (useAutoCustomizeConfigStore.data.components?.borderWidth) {
|
|
55
|
+
const borderWidth = useAutoCustomizeConfigStore.data.components.borderWidth;
|
|
56
|
+
newCssvariables.push(`--dodo-ui-element-border-width: ${1 + borderWidth}px`);
|
|
57
|
+
}
|
|
58
|
+
if (useAutoCustomizeConfigStore.data.space) {
|
|
59
|
+
const space = useAutoCustomizeConfigStore.data.space;
|
|
60
|
+
newCssvariables.push(`--dodo-ui-space-small: ${6 + space}px`);
|
|
61
|
+
newCssvariables.push(`--dodo-ui-space: ${8 + space}px`);
|
|
62
|
+
newCssvariables.push(`--dodo-ui-space-large: ${10 + space}px`);
|
|
63
|
+
}
|
|
64
|
+
cssVariables = [...newCssvariables];
|
|
65
|
+
});
|
|
66
|
+
</script>
|
|
67
|
+
|
|
68
|
+
<div class="Preview" style={cssVariables.join(';')}>
|
|
69
|
+
<div class="section">
|
|
70
|
+
<div class="column">
|
|
71
|
+
<Button>Primary</Button>
|
|
72
|
+
</div>
|
|
73
|
+
<div class="column">
|
|
74
|
+
<Button color="secondary">Secondary</Button>
|
|
75
|
+
</div>
|
|
76
|
+
<div class="column">
|
|
77
|
+
<Button color="neutral">Neutral</Button>
|
|
78
|
+
</div>
|
|
79
|
+
<div class="column">
|
|
80
|
+
<Button color="safe">Safe</Button>
|
|
81
|
+
</div>
|
|
82
|
+
<div class="column">
|
|
83
|
+
<Button color="warning">Warning</Button>
|
|
84
|
+
</div>
|
|
85
|
+
<div class="column">
|
|
86
|
+
<Button color="danger">Danger</Button>
|
|
87
|
+
</div>
|
|
88
|
+
</div>
|
|
89
|
+
|
|
90
|
+
<div class="section">
|
|
91
|
+
<div class="column">
|
|
92
|
+
<Button variant="text" outline>Primary</Button>
|
|
93
|
+
</div>
|
|
94
|
+
<div class="column">
|
|
95
|
+
<Button variant="text" outline color="secondary">Secondary</Button>
|
|
96
|
+
</div>
|
|
97
|
+
<div class="column">
|
|
98
|
+
<Button variant="text" outline color="neutral">Neutral</Button>
|
|
99
|
+
</div>
|
|
100
|
+
<div class="column">
|
|
101
|
+
<Button variant="text" outline color="safe">Safe</Button>
|
|
102
|
+
</div>
|
|
103
|
+
<div class="column">
|
|
104
|
+
<Button variant="text" outline color="warning">Warning</Button>
|
|
105
|
+
</div>
|
|
106
|
+
<div class="column">
|
|
107
|
+
<Button variant="text" outline color="danger">Danger</Button>
|
|
108
|
+
</div>
|
|
109
|
+
</div>
|
|
110
|
+
|
|
111
|
+
<div class="section">
|
|
112
|
+
<div class="column">
|
|
113
|
+
<Paper shadow={1} width="150px" height="180px">
|
|
114
|
+
<div style="padding: var(--dodo-ui-space)">Hola!</div>
|
|
115
|
+
</Paper>
|
|
116
|
+
</div>
|
|
117
|
+
<div class="column">
|
|
118
|
+
<RangeSlider value={50} min={20} max={70} />
|
|
119
|
+
</div>
|
|
120
|
+
</div>
|
|
121
|
+
|
|
122
|
+
<div class="section">
|
|
123
|
+
<Grid class="GridSection">
|
|
124
|
+
<Column md={6}>
|
|
125
|
+
<Paper shadow={1}>
|
|
126
|
+
<div style="padding: var(--dodo-ui-space)">Hola!</div>
|
|
127
|
+
</Paper>
|
|
128
|
+
</Column>
|
|
129
|
+
<Column md={6}>
|
|
130
|
+
<Paper shadow={1}>
|
|
131
|
+
<div style="padding: var(--dodo-ui-space)">Hola!</div>
|
|
132
|
+
</Paper>
|
|
133
|
+
</Column>
|
|
134
|
+
<Column md={4}>
|
|
135
|
+
<Paper shadow={1}>
|
|
136
|
+
<div style="padding: var(--dodo-ui-space)">Hola!</div>
|
|
137
|
+
</Paper>
|
|
138
|
+
</Column>
|
|
139
|
+
<Column md={3}>
|
|
140
|
+
<Paper shadow={1}>
|
|
141
|
+
<div style="padding: var(--dodo-ui-space)">Hola!</div>
|
|
142
|
+
</Paper>
|
|
143
|
+
</Column>
|
|
144
|
+
<Column md={2}>
|
|
145
|
+
<Paper shadow={1}>
|
|
146
|
+
<div style="padding: var(--dodo-ui-space)">Hola!</div>
|
|
147
|
+
</Paper>
|
|
148
|
+
</Column>
|
|
149
|
+
<Column md={3}>
|
|
150
|
+
<Paper shadow={1}>
|
|
151
|
+
<div style="padding: var(--dodo-ui-space)">Hola!</div>
|
|
152
|
+
</Paper>
|
|
153
|
+
</Column>
|
|
154
|
+
</Grid>
|
|
155
|
+
</div>
|
|
156
|
+
</div>
|
|
157
|
+
|
|
158
|
+
<style>:global(:root) {
|
|
159
|
+
--AutoCustomize-Preview-bgColor: var(--dodo-color-base-gray-100);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
:global(.dodo-theme--dark) {
|
|
163
|
+
--AutoCustomize-Preview-bgColor: var(--dodo-color-base-gray-800);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.Preview {
|
|
167
|
+
background-color: var(--AutoCustomize-Preview-bgColor);
|
|
168
|
+
padding: calc(var(--dodo-ui-space) * 2);
|
|
169
|
+
border-radius: var(--dodo-ui-element-roundness-2);
|
|
170
|
+
width: 100%;
|
|
171
|
+
}
|
|
172
|
+
@media (min-width: 64rem) {
|
|
173
|
+
.Preview {
|
|
174
|
+
flex: 1;
|
|
175
|
+
width: initial;
|
|
176
|
+
height: calc(100vh - 130px);
|
|
177
|
+
overflow: auto;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
.Preview .section {
|
|
181
|
+
width: 100%;
|
|
182
|
+
margin: var(--dodo-ui-space) 0;
|
|
183
|
+
display: flex;
|
|
184
|
+
flex-wrap: wrap;
|
|
185
|
+
}
|
|
186
|
+
.Preview .column {
|
|
187
|
+
margin: 4px;
|
|
188
|
+
display: inline-flex;
|
|
189
|
+
}
|
|
190
|
+
.Preview :global(.GridSection) {
|
|
191
|
+
width: 100%;
|
|
192
|
+
}</style>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<script module lang="ts">import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
2
|
+
import Tool from './Tool.svelte';
|
|
3
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
|
|
4
|
+
const { Story } = defineMeta({
|
|
5
|
+
component: Tool,
|
|
6
|
+
});
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<Story name="Main" />
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import Tool from './Tool.svelte';
|
|
2
|
+
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> {
|
|
3
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
|
+
$$bindings?: Bindings;
|
|
5
|
+
} & Exports;
|
|
6
|
+
(internal: unknown, props: {
|
|
7
|
+
$$events?: Events;
|
|
8
|
+
$$slots?: Slots;
|
|
9
|
+
}): Exports & {
|
|
10
|
+
$set?: any;
|
|
11
|
+
$on?: any;
|
|
12
|
+
};
|
|
13
|
+
z_$$bindings?: Bindings;
|
|
14
|
+
}
|
|
15
|
+
declare const Tool: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
16
|
+
[evt: string]: CustomEvent<any>;
|
|
17
|
+
}, {}, {}, string>;
|
|
18
|
+
type Tool = InstanceType<typeof Tool>;
|
|
19
|
+
export default Tool;
|
|
@@ -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 Tool: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
15
|
+
[evt: string]: CustomEvent<any>;
|
|
16
|
+
}, {}, {}, string>;
|
|
17
|
+
type Tool = InstanceType<typeof Tool>;
|
|
18
|
+
export default Tool;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function downloadFile(fileName: string, data: Blob): Promise<void>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export type AutoCustomizeConfigDataColors = {
|
|
2
|
+
primary?: string;
|
|
3
|
+
secondary?: string;
|
|
4
|
+
neutral?: string;
|
|
5
|
+
safe?: string;
|
|
6
|
+
warning?: string;
|
|
7
|
+
danger?: string;
|
|
8
|
+
};
|
|
9
|
+
export type AutoCustomizeConfigDataComponents = {
|
|
10
|
+
roundness?: number;
|
|
11
|
+
elementHeight?: number;
|
|
12
|
+
borderWidth?: number;
|
|
13
|
+
};
|
|
14
|
+
export type AutoCustomizeConfigData = {
|
|
15
|
+
colors?: AutoCustomizeConfigDataColors;
|
|
16
|
+
components?: AutoCustomizeConfigDataComponents;
|
|
17
|
+
space?: number;
|
|
18
|
+
};
|
|
19
|
+
export declare const autoCustomizeConfigdefaultData: AutoCustomizeConfigData;
|
|
20
|
+
export declare const useAutoCustomizeConfigStore: {
|
|
21
|
+
readonly data: AutoCustomizeConfigData;
|
|
22
|
+
readonly updatedAt: number;
|
|
23
|
+
updateData(newData: Partial<AutoCustomizeConfigData>): void;
|
|
24
|
+
updateDataColor(newData: Partial<AutoCustomizeConfigDataColors>): void;
|
|
25
|
+
updateDataComponents(newData: Partial<AutoCustomizeConfigDataComponents>): void;
|
|
26
|
+
reset(): void;
|
|
27
|
+
};
|