@flightlesslabs/dodo-ui 0.17.1 → 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.
Files changed (40) hide show
  1. package/dist/stories/Home.mdx +2 -1
  2. package/dist/stories/components/Form/Button/Button.svelte +0 -2
  3. package/dist/stories/components/Form/Radio/Radio.svelte +0 -1
  4. package/dist/stories/developer tools/Intro.mdx +1 -0
  5. package/dist/stories/developer tools/customize/AutoCustomize/AutoCustomize.mdx +4 -0
  6. package/dist/stories/developer tools/customize/AutoCustomize/Tool/Config/ColorTool/ColorButton.svelte +42 -0
  7. package/dist/stories/developer tools/customize/AutoCustomize/Tool/Config/ColorTool/ColorButton.svelte.d.ts +8 -0
  8. package/dist/stories/developer tools/customize/AutoCustomize/Tool/Config/ColorTool/ColorTool.svelte +21 -0
  9. package/dist/stories/developer tools/customize/AutoCustomize/Tool/Config/ColorTool/ColorTool.svelte.d.ts +9 -0
  10. package/dist/stories/developer tools/customize/AutoCustomize/Tool/Config/Config.svelte +144 -0
  11. package/dist/stories/developer tools/customize/AutoCustomize/Tool/Config/Config.svelte.d.ts +18 -0
  12. package/dist/stories/developer tools/customize/AutoCustomize/Tool/Config/Export.svelte +123 -0
  13. package/dist/stories/developer tools/customize/AutoCustomize/Tool/Config/Export.svelte.d.ts +18 -0
  14. package/dist/stories/developer tools/customize/AutoCustomize/Tool/Config/ValueSilder/ValueSilder.svelte +32 -0
  15. package/dist/stories/developer tools/customize/AutoCustomize/Tool/Config/ValueSilder/ValueSilder.svelte.d.ts +11 -0
  16. package/dist/stories/developer tools/customize/AutoCustomize/Tool/Preview/Preview.svelte +192 -0
  17. package/dist/stories/developer tools/customize/AutoCustomize/Tool/Preview/Preview.svelte.d.ts +3 -0
  18. package/dist/stories/developer tools/customize/AutoCustomize/Tool/Tool.stories.svelte +9 -0
  19. package/dist/stories/developer tools/customize/AutoCustomize/Tool/Tool.stories.svelte.d.ts +19 -0
  20. package/dist/stories/developer tools/customize/AutoCustomize/Tool/Tool.svelte +13 -0
  21. package/dist/stories/developer tools/customize/AutoCustomize/Tool/Tool.svelte.d.ts +18 -0
  22. package/dist/stories/developer tools/customize/AutoCustomize/Tool/helpers/download-file.d.ts +1 -0
  23. package/dist/stories/developer tools/customize/AutoCustomize/Tool/helpers/download-file.js +10 -0
  24. package/dist/stories/developer tools/customize/AutoCustomize/Tool/stores/config.svelte.d.ts +27 -0
  25. package/dist/stories/developer tools/customize/AutoCustomize/Tool/stores/config.svelte.js +70 -0
  26. package/dist/stories/developer tools/customize/Intro.mdx +8 -0
  27. package/dist/styles/_colors.css +1 -1
  28. package/package.json +4 -2
  29. package/src/lib/stories/components/Form/Button/Button.svelte +0 -2
  30. package/src/lib/stories/components/Form/Radio/Radio.svelte +0 -1
  31. package/src/lib/stories/developer tools/customize/AutoCustomize/Tool/Config/ColorTool/ColorButton.svelte +56 -0
  32. package/src/lib/stories/developer tools/customize/AutoCustomize/Tool/Config/ColorTool/ColorTool.svelte +32 -0
  33. package/src/lib/stories/developer tools/customize/AutoCustomize/Tool/Config/Config.svelte +149 -0
  34. package/src/lib/stories/developer tools/customize/AutoCustomize/Tool/Config/Export.svelte +172 -0
  35. package/src/lib/stories/developer tools/customize/AutoCustomize/Tool/Config/ValueSilder/ValueSilder.svelte +47 -0
  36. package/src/lib/stories/developer tools/customize/AutoCustomize/Tool/Preview/Preview.svelte +227 -0
  37. package/src/lib/stories/developer tools/customize/AutoCustomize/Tool/Tool.svelte +16 -0
  38. package/src/lib/stories/developer tools/customize/AutoCustomize/Tool/helpers/download-file.ts +11 -0
  39. package/src/lib/stories/developer tools/customize/AutoCustomize/Tool/stores/config.svelte.ts +107 -0
  40. package/src/lib/styles/_colors.css +1 -1
@@ -0,0 +1,149 @@
1
+ <script lang="ts">
2
+ import Button from '$lib/stories/components/Form/Button/Button.svelte';
3
+ import { useAutoCustomizeConfigStore } from '../stores/config.svelte.js';
4
+ import ColorTool from './ColorTool/ColorTool.svelte';
5
+ import Export from './Export.svelte';
6
+ import ValueSilder from './ValueSilder/ValueSilder.svelte';
7
+ </script>
8
+
9
+ <div class="Config">
10
+ <h3>Auto Customize</h3>
11
+ <ColorTool
12
+ label="Primary Color:"
13
+ onclick={(color) => useAutoCustomizeConfigStore.updateDataColor({ primary: color })}
14
+ selectedColor={useAutoCustomizeConfigStore.data.colors?.primary}
15
+ colors={[
16
+ 'violet',
17
+ 'red',
18
+ 'orange',
19
+ 'amber',
20
+ 'yellow',
21
+ 'lime',
22
+ 'green',
23
+ 'emerald',
24
+ 'teal',
25
+ 'cyan',
26
+ 'blue',
27
+ 'indigo',
28
+ 'purple',
29
+ 'fuchsia',
30
+ 'pink',
31
+ 'rose',
32
+ ]}
33
+ />
34
+
35
+ <ColorTool
36
+ label="Secondary Color:"
37
+ onclick={(color) => useAutoCustomizeConfigStore.updateDataColor({ secondary: color })}
38
+ selectedColor={useAutoCustomizeConfigStore.data.colors?.secondary}
39
+ colors={[
40
+ 'blue',
41
+ 'red',
42
+ 'orange',
43
+ 'amber',
44
+ 'yellow',
45
+ 'lime',
46
+ 'green',
47
+ 'emerald',
48
+ 'teal',
49
+ 'cyan',
50
+ 'indigo',
51
+ 'violet',
52
+ 'purple',
53
+ 'fuchsia',
54
+ 'pink',
55
+ 'rose',
56
+ ]}
57
+ />
58
+
59
+ <ColorTool
60
+ label="Neutral Color:"
61
+ onclick={(color) => useAutoCustomizeConfigStore.updateDataColor({ neutral: color })}
62
+ selectedColor={useAutoCustomizeConfigStore.data.colors?.neutral}
63
+ colors={['gray', 'slate', 'zinc', 'neutral', 'stone']}
64
+ />
65
+
66
+ <ColorTool
67
+ label="Safe Color:"
68
+ onclick={(color) => useAutoCustomizeConfigStore.updateDataColor({ safe: color })}
69
+ selectedColor={useAutoCustomizeConfigStore.data.colors?.safe}
70
+ colors={['emerald', 'lime', 'green', 'teal']}
71
+ />
72
+
73
+ <ColorTool
74
+ label="Warning Color:"
75
+ onclick={(color) => useAutoCustomizeConfigStore.updateDataColor({ warning: color })}
76
+ selectedColor={useAutoCustomizeConfigStore.data.colors?.warning}
77
+ colors={['amber', 'red', 'rose', 'orange', 'yellow']}
78
+ />
79
+
80
+ <ColorTool
81
+ label="Danger Color:"
82
+ onclick={(color) => useAutoCustomizeConfigStore.updateDataColor({ danger: color })}
83
+ selectedColor={useAutoCustomizeConfigStore.data.colors?.danger}
84
+ colors={['red', 'orange', 'amber', 'yellow', 'pink', 'rose']}
85
+ />
86
+
87
+ <ValueSilder
88
+ label="Roundness:"
89
+ value={useAutoCustomizeConfigStore.data.components?.roundness || 0}
90
+ min={-5}
91
+ max={7}
92
+ oninput={(value) => useAutoCustomizeConfigStore.updateDataComponents({ roundness: value })}
93
+ />
94
+
95
+ <ValueSilder
96
+ label="Size:"
97
+ value={useAutoCustomizeConfigStore.data.components?.elementHeight || 0}
98
+ min={-5}
99
+ max={7}
100
+ oninput={(value) => useAutoCustomizeConfigStore.updateDataComponents({ elementHeight: value })}
101
+ />
102
+
103
+ <ValueSilder
104
+ label="Border:"
105
+ value={useAutoCustomizeConfigStore.data.components?.borderWidth || 0}
106
+ min={0}
107
+ max={7}
108
+ oninput={(value) => useAutoCustomizeConfigStore.updateDataComponents({ borderWidth: value })}
109
+ />
110
+
111
+ <ValueSilder
112
+ label="Space:"
113
+ value={useAutoCustomizeConfigStore.data.space || 0}
114
+ min={-5}
115
+ max={15}
116
+ oninput={(value) => useAutoCustomizeConfigStore.updateData({ space: value })}
117
+ />
118
+
119
+ <div class="Export">
120
+ <Export />
121
+ </div>
122
+
123
+ <div class="Reset">
124
+ <Button onclick={() => useAutoCustomizeConfigStore.reset()} variant="text" color="danger">
125
+ Reset
126
+ </Button>
127
+ </div>
128
+ </div>
129
+
130
+ <style lang="scss">
131
+ @use '../../../../../../styles/scss' as *;
132
+
133
+ .Config {
134
+ width: 100%;
135
+ display: flex;
136
+ flex-direction: column;
137
+ padding: calc(var(--dodo-ui-space) * 2);
138
+
139
+ @media (min-width: $breakpoints-lg) {
140
+ max-width: 300px;
141
+ height: calc(100vh - 130px);
142
+ overflow: auto;
143
+ }
144
+
145
+ .Reset {
146
+ margin-top: calc(var(--dodo-ui-space) * 4);
147
+ }
148
+ }
149
+ </style>
@@ -0,0 +1,172 @@
1
+ <script lang="ts">
2
+ import Button from '$lib/stories/components/Form/Button/Button.svelte';
3
+ import {
4
+ colorPalette,
5
+ colorPaletteValues,
6
+ } from '$lib/stories/developer tools/philosophy/Colors/utils/color.js';
7
+ import { downloadFile } from '../helpers/download-file.js';
8
+ import {
9
+ autoCustomizeConfigdefaultData,
10
+ useAutoCustomizeConfigStore,
11
+ type AutoCustomizeConfigDataColors,
12
+ } from '../stores/config.svelte.js';
13
+
14
+ async function onclick() {
15
+ try {
16
+ let rawText = `/* dodo-ui-custom.css */
17
+ :root {`;
18
+
19
+ for (let index = 0; index < colorPalette.length; index++) {
20
+ const colorName = colorPalette[index];
21
+
22
+ const fieldName = `${colorName}` as keyof AutoCustomizeConfigDataColors;
23
+
24
+ const dataPoint =
25
+ useAutoCustomizeConfigStore.data.colors &&
26
+ useAutoCustomizeConfigStore.data.colors[fieldName]
27
+ ? useAutoCustomizeConfigStore.data.colors[fieldName]
28
+ : undefined;
29
+
30
+ const defaultValue =
31
+ autoCustomizeConfigdefaultData.colors && autoCustomizeConfigdefaultData.colors[fieldName]
32
+ ? autoCustomizeConfigdefaultData.colors[fieldName]
33
+ : undefined;
34
+
35
+ const pass = dataPoint && dataPoint !== defaultValue ? true : false;
36
+
37
+ if (!pass) {
38
+ continue;
39
+ }
40
+
41
+ rawText += `
42
+ /* ${colorName} color */`;
43
+
44
+ for (let index = 0; index < colorPaletteValues.length; index++) {
45
+ const weight = colorPaletteValues[index];
46
+
47
+ rawText += `
48
+ --dodo-color-${colorName}-${weight}: var(--dodo-color-base-${dataPoint}-${weight});`;
49
+
50
+ if (colorPaletteValues[index] === colorPaletteValues[colorPaletteValues.length - 1]) {
51
+ rawText += `
52
+ `;
53
+ }
54
+ }
55
+ }
56
+
57
+ if (useAutoCustomizeConfigStore.data.components?.roundness) {
58
+ const roundness = useAutoCustomizeConfigStore.data.components?.roundness / 8;
59
+
60
+ rawText += `
61
+
62
+ /* Component: Roundness */
63
+ --dodo-ui-element-roundness-1: ${0.4375 + roundness}em;
64
+ --dodo-ui-element-roundness-2: ${0.8125 + roundness}em;
65
+ --dodo-ui-element-roundness-3: ${1.9375 + roundness}em;`;
66
+ }
67
+
68
+ if (useAutoCustomizeConfigStore.data.components?.elementHeight) {
69
+ const elementHeight = useAutoCustomizeConfigStore.data.components.elementHeight + 2;
70
+ const elementHeightTrack = useAutoCustomizeConfigStore.data.components.elementHeight / 2;
71
+
72
+ rawText += `
73
+
74
+ /* Component: Size */
75
+ --dodo-ui-element-height-small: ${34 + elementHeight}px;
76
+ --dodo-ui-element-height-normal: ${40 + elementHeight}px;
77
+ --dodo-ui-element-height-large: ${50 + elementHeight}px;
78
+ --dodo-ui-track-element-height-small: ${6 + elementHeightTrack}px;
79
+ --dodo-ui-track-element-height-normal: ${8 + elementHeightTrack}px;
80
+ --dodo-ui-track-element-height-large: ${10 + elementHeightTrack}px;`;
81
+ }
82
+
83
+ if (useAutoCustomizeConfigStore.data.components?.borderWidth) {
84
+ const borderWidth = useAutoCustomizeConfigStore.data.components.borderWidth;
85
+
86
+ rawText += `
87
+
88
+ /* Component: Border */
89
+ --dodo-ui-element-border-width: ${2 + borderWidth}px;`;
90
+ }
91
+
92
+ if (useAutoCustomizeConfigStore.data.space) {
93
+ const space = useAutoCustomizeConfigStore.data.space;
94
+
95
+ rawText += `
96
+
97
+ /* Space */
98
+ --dodo-ui-space-small: ${6 + space}px;
99
+ --dodo-ui-space: ${8 + space}px;
100
+ --dodo-ui-space-large: ${10 + space}px;`;
101
+ }
102
+
103
+ // end
104
+ rawText += `
105
+ }`;
106
+
107
+ rawText += `
108
+
109
+ .dodo-theme--dark {`;
110
+
111
+ for (let index = 0; index < colorPalette.length; index++) {
112
+ const colorName = colorPalette[index];
113
+
114
+ const fieldName = `${colorName}` as keyof AutoCustomizeConfigDataColors;
115
+
116
+ const dataPoint =
117
+ useAutoCustomizeConfigStore.data.colors &&
118
+ useAutoCustomizeConfigStore.data.colors[fieldName]
119
+ ? useAutoCustomizeConfigStore.data.colors[fieldName]
120
+ : undefined;
121
+
122
+ const defaultValue =
123
+ autoCustomizeConfigdefaultData.colors && autoCustomizeConfigdefaultData.colors[fieldName]
124
+ ? autoCustomizeConfigdefaultData.colors[fieldName]
125
+ : undefined;
126
+
127
+ const pass = dataPoint && dataPoint !== defaultValue ? true : false;
128
+
129
+ if (!pass) {
130
+ continue;
131
+ }
132
+
133
+ rawText += `
134
+
135
+ /* Dark: ${colorName} color */`;
136
+
137
+ const colorPaletteValuesReversed = [...colorPaletteValues].reverse();
138
+
139
+ for (let index = 0; index < colorPaletteValues.length; index++) {
140
+ const weight = colorPaletteValues[index];
141
+ const weightReversed = colorPaletteValuesReversed[index];
142
+
143
+ rawText += `
144
+ --dodo-color-${colorName}-${weight}: var(--dodo-color-base-${dataPoint}-${weightReversed});`;
145
+ }
146
+
147
+ if (
148
+ colorPaletteValuesReversed[index] ===
149
+ colorPaletteValuesReversed[colorPaletteValuesReversed.length - 1]
150
+ ) {
151
+ rawText += `
152
+ `;
153
+ }
154
+ }
155
+
156
+ // end
157
+ rawText += `
158
+ }`;
159
+
160
+ const data = new Blob([rawText], { type: 'text/plain' });
161
+
162
+ await downloadFile(`dodo-ui-custom.css`, data);
163
+ } catch (e) {
164
+ console.error(e);
165
+ }
166
+ }
167
+ </script>
168
+
169
+ <Button {onclick}>Export CSS</Button>
170
+
171
+ <style lang="scss">
172
+ </style>
@@ -0,0 +1,47 @@
1
+ <script lang="ts">
2
+ import FormControl from '$lib/stories/components/Form/FormControl/FormControl.svelte';
3
+ import RangeSlider from '$lib/stories/components/Form/RangeSlider/RangeSlider.svelte';
4
+
5
+ interface ValueSilderProps {
6
+ label?: string;
7
+ value: number;
8
+ min: number;
9
+ max: number;
10
+ /** oninput event handler */
11
+ oninput?: (value: number) => void;
12
+ }
13
+
14
+ const { label, value, min, max, oninput }: ValueSilderProps = $props();
15
+
16
+ let displayValue = $state(0);
17
+
18
+ function oninputMod(e: Event) {
19
+ const target = e.target as HTMLInputElement;
20
+
21
+ if (oninput) {
22
+ oninput(Number(target.value));
23
+ }
24
+ }
25
+
26
+ $effect(() => {
27
+ if (value === 0) {
28
+ displayValue = 1;
29
+ } else if (value < 0) {
30
+ displayValue = value;
31
+ } else {
32
+ displayValue = value + 1;
33
+ }
34
+ });
35
+ </script>
36
+
37
+ <div class="ValueSilder">
38
+ <FormControl label={`${label} ${displayValue}x`}>
39
+ <RangeSlider {value} {min} {max} oninput={oninputMod} size="small" />
40
+ </FormControl>
41
+ </div>
42
+
43
+ <style lang="scss">
44
+ .ValueSilder {
45
+ margin-bottom: calc(var(--dodo-ui-space) * 2.5);
46
+ }
47
+ </style>
@@ -0,0 +1,227 @@
1
+ <script lang="ts">
2
+ import Button from '$lib/stories/components/Form/Button/Button.svelte';
3
+ import RangeSlider from '$lib/stories/components/Form/RangeSlider/RangeSlider.svelte';
4
+ import Column from '$lib/stories/components/Layout/Grid/Column/Column.svelte';
5
+ import Grid from '$lib/stories/components/Layout/Grid/Grid.svelte';
6
+ import Paper from '$lib/stories/components/Layout/Paper/Paper.svelte';
7
+ import {
8
+ colorPalette,
9
+ colorPaletteValues,
10
+ } from '$lib/stories/developer tools/philosophy/Colors/utils/color.js';
11
+ import {
12
+ useAutoCustomizeConfigStore,
13
+ type AutoCustomizeConfigDataColors,
14
+ } from '../stores/config.svelte.js';
15
+
16
+ let cssVariables = $state<string[]>([]);
17
+
18
+ $effect(() => {
19
+ const newCssvariables: string[] = [];
20
+
21
+ for (let index = 0; index < colorPalette.length; index++) {
22
+ const colorName = colorPalette[index];
23
+ const fieldName = `${colorName}` as keyof AutoCustomizeConfigDataColors;
24
+
25
+ const dataPoint =
26
+ useAutoCustomizeConfigStore.data.colors &&
27
+ useAutoCustomizeConfigStore.data.colors[fieldName]
28
+ ? useAutoCustomizeConfigStore.data.colors[fieldName]
29
+ : undefined;
30
+
31
+ if (dataPoint) {
32
+ for (let index = 0; index < colorPaletteValues.length; index++) {
33
+ const weight = colorPaletteValues[index];
34
+
35
+ newCssvariables.push(
36
+ `--dodo-color-${colorName}-${weight}: var(--dodo-color-base-${dataPoint}-${weight})`,
37
+ );
38
+ }
39
+
40
+ newCssvariables.push(
41
+ ...[
42
+ `--dodo-ui-Button-outline-${colorName}: var(--dodo-color-base-${dataPoint}-400)`,
43
+ `--dodo-ui-Button-text-${colorName}-bg: var(--dodo-color-base-${dataPoint}-100)`,
44
+ `--dodo-ui-Button-text-${colorName}-hover-bg: var(--dodo-color-base-${dataPoint}-200)`,
45
+ `--dodo-ui-Button-text-${colorName}-active-bg: var(--dodo-color-base-${dataPoint}-300)`,
46
+ `--dodo-ui-Button-solid-${colorName}-bg: var(--dodo-color-base-${dataPoint}-500)`,
47
+ `--dodo-ui-Button-solid-${colorName}-hover-bg: var(--dodo-color-base-${dataPoint}-600)`,
48
+ `--dodo-ui-Button-solid-${colorName}-active-bg: var(--dodo-color-base-${dataPoint}-700)`,
49
+ `--dodo-ui-RangeSlider-thumb-${colorName}-bg: var(--dodo-color-base-${dataPoint}-500)`,
50
+ `--dodo-ui-RangeSlider-thumb-${colorName}-hover-bg: var(--dodo-color-base-${dataPoint}-600)`,
51
+ `--dodo-ui-RangeSlider-thumb-${colorName}-active-bg: var(--dodo-color-base-${dataPoint}-700)`,
52
+ `--dodo-ui-RangeSlider-track-filled-${colorName}-bg: var(--dodo-color-base-${dataPoint}-500)`,
53
+ ],
54
+ );
55
+ }
56
+ }
57
+
58
+ if (useAutoCustomizeConfigStore.data.components?.roundness) {
59
+ const roundness = useAutoCustomizeConfigStore.data.components.roundness / 8;
60
+
61
+ newCssvariables.push(`--dodo-ui-element-roundness-1: ${0.4375 + roundness}em`);
62
+ newCssvariables.push(`--dodo-ui-element-roundness-2: ${0.8125 + roundness}em`);
63
+ newCssvariables.push(`--dodo-ui-element-roundness-3: ${1.9375 + roundness}em`);
64
+ }
65
+
66
+ if (useAutoCustomizeConfigStore.data.components?.elementHeight) {
67
+ const elementHeight = useAutoCustomizeConfigStore.data.components.elementHeight + 2;
68
+ const elementHeightTrack = useAutoCustomizeConfigStore.data.components.elementHeight / 2;
69
+
70
+ newCssvariables.push(`--dodo-ui-element-height-small: ${34 + elementHeight}px`);
71
+ newCssvariables.push(`--dodo-ui-element-height-normal: ${40 + elementHeight}px`);
72
+ newCssvariables.push(`--dodo-ui-element-height-large: ${50 + elementHeight}px`);
73
+
74
+ newCssvariables.push(`--dodo-ui-track-element-height-small: ${6 + elementHeightTrack}px`);
75
+ newCssvariables.push(`--dodo-ui-track-element-height-normal: ${8 + elementHeightTrack}px`);
76
+ newCssvariables.push(`--dodo-ui-track-element-height-large: ${10 + elementHeightTrack}px`);
77
+ }
78
+
79
+ if (useAutoCustomizeConfigStore.data.components?.borderWidth) {
80
+ const borderWidth = useAutoCustomizeConfigStore.data.components.borderWidth;
81
+
82
+ newCssvariables.push(`--dodo-ui-element-border-width: ${1 + borderWidth}px`);
83
+ }
84
+
85
+ if (useAutoCustomizeConfigStore.data.space) {
86
+ const space = useAutoCustomizeConfigStore.data.space;
87
+
88
+ newCssvariables.push(`--dodo-ui-space-small: ${6 + space}px`);
89
+ newCssvariables.push(`--dodo-ui-space: ${8 + space}px`);
90
+ newCssvariables.push(`--dodo-ui-space-large: ${10 + space}px`);
91
+ }
92
+
93
+ cssVariables = [...newCssvariables];
94
+ });
95
+ </script>
96
+
97
+ <div class="Preview" style={cssVariables.join(';')}>
98
+ <div class="section">
99
+ <div class="column">
100
+ <Button>Primary</Button>
101
+ </div>
102
+ <div class="column">
103
+ <Button color="secondary">Secondary</Button>
104
+ </div>
105
+ <div class="column">
106
+ <Button color="neutral">Neutral</Button>
107
+ </div>
108
+ <div class="column">
109
+ <Button color="safe">Safe</Button>
110
+ </div>
111
+ <div class="column">
112
+ <Button color="warning">Warning</Button>
113
+ </div>
114
+ <div class="column">
115
+ <Button color="danger">Danger</Button>
116
+ </div>
117
+ </div>
118
+
119
+ <div class="section">
120
+ <div class="column">
121
+ <Button variant="text" outline>Primary</Button>
122
+ </div>
123
+ <div class="column">
124
+ <Button variant="text" outline color="secondary">Secondary</Button>
125
+ </div>
126
+ <div class="column">
127
+ <Button variant="text" outline color="neutral">Neutral</Button>
128
+ </div>
129
+ <div class="column">
130
+ <Button variant="text" outline color="safe">Safe</Button>
131
+ </div>
132
+ <div class="column">
133
+ <Button variant="text" outline color="warning">Warning</Button>
134
+ </div>
135
+ <div class="column">
136
+ <Button variant="text" outline color="danger">Danger</Button>
137
+ </div>
138
+ </div>
139
+
140
+ <div class="section">
141
+ <div class="column">
142
+ <Paper shadow={1} width="150px" height="180px">
143
+ <div style="padding: var(--dodo-ui-space)">Hola!</div>
144
+ </Paper>
145
+ </div>
146
+ <div class="column">
147
+ <RangeSlider value={50} min={20} max={70} />
148
+ </div>
149
+ </div>
150
+
151
+ <div class="section">
152
+ <Grid class="GridSection">
153
+ <Column md={6}>
154
+ <Paper shadow={1}>
155
+ <div style="padding: var(--dodo-ui-space)">Hola!</div>
156
+ </Paper>
157
+ </Column>
158
+ <Column md={6}>
159
+ <Paper shadow={1}>
160
+ <div style="padding: var(--dodo-ui-space)">Hola!</div>
161
+ </Paper>
162
+ </Column>
163
+ <Column md={4}>
164
+ <Paper shadow={1}>
165
+ <div style="padding: var(--dodo-ui-space)">Hola!</div>
166
+ </Paper>
167
+ </Column>
168
+ <Column md={3}>
169
+ <Paper shadow={1}>
170
+ <div style="padding: var(--dodo-ui-space)">Hola!</div>
171
+ </Paper>
172
+ </Column>
173
+ <Column md={2}>
174
+ <Paper shadow={1}>
175
+ <div style="padding: var(--dodo-ui-space)">Hola!</div>
176
+ </Paper>
177
+ </Column>
178
+ <Column md={3}>
179
+ <Paper shadow={1}>
180
+ <div style="padding: var(--dodo-ui-space)">Hola!</div>
181
+ </Paper>
182
+ </Column>
183
+ </Grid>
184
+ </div>
185
+ </div>
186
+
187
+ <style lang="scss">
188
+ @use '../../../../../../styles/scss' as *;
189
+
190
+ :global(:root) {
191
+ --AutoCustomize-Preview-bgColor: var(--dodo-color-base-gray-100);
192
+ }
193
+
194
+ :global(.dodo-theme--dark) {
195
+ --AutoCustomize-Preview-bgColor: var(--dodo-color-base-gray-800);
196
+ }
197
+
198
+ .Preview {
199
+ background-color: var(--AutoCustomize-Preview-bgColor);
200
+ padding: calc(var(--dodo-ui-space) * 2);
201
+ border-radius: var(--dodo-ui-element-roundness-2);
202
+ width: 100%;
203
+
204
+ @media (min-width: $breakpoints-lg) {
205
+ flex: 1;
206
+ width: initial;
207
+ height: calc(100vh - 130px);
208
+ overflow: auto;
209
+ }
210
+
211
+ .section {
212
+ width: 100%;
213
+ margin: var(--dodo-ui-space) 0;
214
+ display: flex;
215
+ flex-wrap: wrap;
216
+ }
217
+
218
+ .column {
219
+ margin: 4px;
220
+ display: inline-flex;
221
+ }
222
+
223
+ :global(.GridSection) {
224
+ width: 100%;
225
+ }
226
+ }
227
+ </style>
@@ -0,0 +1,16 @@
1
+ <script lang="ts">
2
+ import Config from './Config/Config.svelte';
3
+ import Preview from './Preview/Preview.svelte';
4
+ </script>
5
+
6
+ <div class="Tool">
7
+ <Config />
8
+ <Preview />
9
+ </div>
10
+
11
+ <style lang="scss">
12
+ .Tool {
13
+ display: flex;
14
+ flex-wrap: wrap;
15
+ }
16
+ </style>
@@ -0,0 +1,11 @@
1
+ import { saveAs } from 'file-saver';
2
+
3
+ export async function downloadFile(fileName: string, data: Blob) {
4
+ try {
5
+ saveAs(data, fileName);
6
+
7
+ return Promise.resolve();
8
+ } catch (e) {
9
+ return Promise.reject(e);
10
+ }
11
+ }