@hkdigital/lib-sveltekit 0.1.0 → 0.1.1
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/components/area/HkArea.svelte +1 -1
- package/dist/components/area/HkGridArea.svelte +1 -1
- package/dist/components/boxes/game-box/GameBox.svelte +112 -0
- package/dist/components/boxes/game-box/GameBox.svelte.d.ts +13 -0
- package/dist/components/boxes/game-box/gamebox.util.d.ts +32 -0
- package/dist/components/boxes/game-box/gamebox.util.js +83 -0
- package/dist/components/boxes/index.d.ts +2 -0
- package/dist/components/boxes/index.js +2 -0
- package/dist/components/boxes/virtual-viewport/VirtualViewport.svelte +199 -0
- package/dist/components/boxes/virtual-viewport/VirtualViewport.svelte.d.ts +20 -0
- package/dist/components/buttons/button/Button.svelte +75 -0
- package/dist/components/buttons/button/Button.svelte.d.ts +19 -0
- package/dist/components/buttons/button-text/TextButton.svelte +21 -0
- package/dist/components/buttons/button-text/TextButton.svelte.d.ts +5 -0
- package/dist/components/buttons/index.d.ts +2 -1
- package/dist/components/buttons/index.js +2 -1
- package/dist/components/hkdev/blocks/TextBlock.svelte +47 -0
- package/dist/components/hkdev/blocks/TextBlock.svelte.d.ts +11 -0
- package/dist/components/hkdev/buttons/CheckButton.svelte +63 -0
- package/dist/components/hkdev/buttons/CheckButton.svelte.d.ts +16 -0
- package/dist/components/icon/HkIcon.svelte +1 -1
- package/dist/components/icon/HkTabIcon.svelte +6 -2
- package/dist/components/image/EnhancedImage.svelte__ +1 -1
- package/dist/components/image/ResponsiveImage.svelte +1 -1
- package/dist/components/image/ResponsiveImage.svelte__ +1 -1
- package/dist/components/inputs/text-input/TestTextInput.svelte__ +2 -2
- package/dist/components/inputs/text-input/TextInput.svelte +1 -1
- package/dist/components/inputs/text-input/TextInput.svelte___ +1 -1
- package/dist/components/layout/HkGridLayers.svelte +1 -1
- package/dist/components/panels/plain-panel/PlainPanel.svelte +1 -1
- package/dist/components/rows/panel-grid-row/PanelGridRow.svelte +1 -1
- package/dist/components/rows/panel-row-2/PanelRow2.svelte +1 -1
- package/dist/components/tab-bar/HkTabBar.svelte +1 -1
- package/dist/components/tab-bar/HkTabBarSelector.svelte +1 -1
- package/dist/design-system/design-config.d.ts +156 -0
- package/dist/design-system/design-config.js +73 -0
- package/dist/design-system/tailwind-theme-extend.d.ts +23 -0
- package/dist/design-system/tailwind-theme-extend.js +151 -0
- package/dist/themes/hkdev/components/blocks/text-block.postcss +41 -0
- package/dist/themes/hkdev/components/buttons/button-text.postcss +34 -0
- package/dist/themes/hkdev/components/buttons/button.postcss +138 -0
- package/dist/themes/hkdev/components/buttons/button.postcss__ +40 -0
- package/dist/themes/hkdev/components/buttons/button.postcss___ +91 -0
- package/dist/themes/hkdev/components.postcss +8 -2
- package/dist/themes/hkdev/globals.postcss +5 -6
- package/dist/util/css/css-vars.d.ts +24 -0
- package/dist/util/css/css-vars.js +83 -0
- package/dist/util/css/index.d.ts +1 -0
- package/dist/util/css/index.js +1 -0
- package/dist/util/design-system/components/states.d.ts +15 -0
- package/dist/util/design-system/components/states.js +22 -0
- package/dist/util/design-system/css/clamp.d.ts +17 -0
- package/dist/util/design-system/css/clamp.js +66 -0
- package/dist/util/design-system/css/root-design-vars.d.ts +77 -0
- package/dist/util/design-system/css/root-design-vars.js +100 -0
- package/dist/util/design-system/index.d.ts +5 -0
- package/dist/util/design-system/index.js +5 -0
- package/dist/util/design-system/layout/scaling.d.ts +44 -0
- package/dist/util/design-system/layout/scaling.js +97 -0
- package/dist/util/design-system/tailwind.d.ts +176 -0
- package/dist/util/design-system/tailwind.js +289 -0
- package/package.json +1 -1
- package/dist/components/buttons/plain-button/PlainButton.svelte +0 -37
- package/dist/components/buttons/plain-button/PlainButton.svelte.d.ts +0 -10
- package/dist/config/tailwind.extend.d.ts +0 -56
- package/dist/config/tailwind.extend.js +0 -64
- package/dist/themes/hkdev/components/buttons/plain-button.postcss +0 -73
@@ -0,0 +1,63 @@
|
|
1
|
+
<script>
|
2
|
+
/**
|
3
|
+
*
|
4
|
+
* @type {{
|
5
|
+
* checked?: boolean,
|
6
|
+
* activeChild?: boolean,
|
7
|
+
* inactiveChild?: boolean,
|
8
|
+
* iconActiveBase?: string,
|
9
|
+
* classes?: string
|
10
|
+
* disabled?: boolean,
|
11
|
+
* title: string,
|
12
|
+
* iconInactiveBase?: string,
|
13
|
+
* inactiveClasses?: string,
|
14
|
+
* activeClasses: string,
|
15
|
+
* onclick?: () => void,
|
16
|
+
* onchange?: () => void,
|
17
|
+
* topic?: string,
|
18
|
+
* }}
|
19
|
+
*/
|
20
|
+
let {
|
21
|
+
classes,
|
22
|
+
checked = $bindable(false),
|
23
|
+
iconInactiveBase = 'pointer-events-none',
|
24
|
+
iconActiveBase = 'pointer-events-none',
|
25
|
+
disabled = false,
|
26
|
+
topic,
|
27
|
+
title,
|
28
|
+
onchange = () => {},
|
29
|
+
inactiveChild,
|
30
|
+
activeChild,
|
31
|
+
activeClasses,
|
32
|
+
inactiveClasses,
|
33
|
+
onclick = () => {}
|
34
|
+
} = $props();
|
35
|
+
|
36
|
+
|
37
|
+
</script>
|
38
|
+
|
39
|
+
<button
|
40
|
+
class="variant-filled btn {classes} {checked
|
41
|
+
? activeClasses
|
42
|
+
: inactiveClasses}"
|
43
|
+
>
|
44
|
+
{title}
|
45
|
+
{#if checked && activeChild}
|
46
|
+
<svg
|
47
|
+
width="10"
|
48
|
+
height="10"
|
49
|
+
viewBox="0 0 10 10"
|
50
|
+
fill="none"
|
51
|
+
xmlns="http://www.w3.org/2000/svg"
|
52
|
+
>
|
53
|
+
<path
|
54
|
+
d="M1 9L9 1M1 1L9 9"
|
55
|
+
stroke="white"
|
56
|
+
stroke-width="1.5"
|
57
|
+
stroke-linecap="round"
|
58
|
+
stroke-linejoin="round"
|
59
|
+
/>
|
60
|
+
</svg>
|
61
|
+
{/if}
|
62
|
+
</button>
|
63
|
+
|
@@ -0,0 +1,16 @@
|
|
1
|
+
export default CheckButton;
|
2
|
+
declare const CheckButton: import("svelte").Component<{
|
3
|
+
checked?: boolean;
|
4
|
+
activeChild?: boolean;
|
5
|
+
inactiveChild?: boolean;
|
6
|
+
iconActiveBase?: string;
|
7
|
+
classes?: string;
|
8
|
+
disabled?: boolean;
|
9
|
+
title: string;
|
10
|
+
iconInactiveBase?: string;
|
11
|
+
inactiveClasses?: string;
|
12
|
+
activeClasses: string;
|
13
|
+
onclick?: () => void;
|
14
|
+
onchange?: () => void;
|
15
|
+
topic?: string;
|
16
|
+
}, {}, "checked">;
|
@@ -36,7 +36,7 @@
|
|
36
36
|
* iconHeight?: string,
|
37
37
|
* labelClasses? : string,
|
38
38
|
* rect?: DOMRect,
|
39
|
-
* } & { [attr: string]:
|
39
|
+
* } & { [attr: string]: any }}
|
40
40
|
*
|
41
41
|
*
|
42
42
|
*/
|
@@ -74,7 +74,11 @@
|
|
74
74
|
</script>
|
75
75
|
|
76
76
|
{#snippet contents()}
|
77
|
-
<div
|
77
|
+
<div
|
78
|
+
data-hk--icon-box
|
79
|
+
class="flex aspect-square w-full justify-center"
|
80
|
+
bind:this={iconBoxElem}
|
81
|
+
>
|
78
82
|
<HkIcon {src} size="100%" theme={iconTheme} classes={iconClasses} />
|
79
83
|
</div>
|
80
84
|
|
@@ -29,7 +29,7 @@
|
|
29
29
|
* onload?: ( e: (Event|{ type: string, target: HTMLImageElement }) ) => void,
|
30
30
|
* onerror?: ( e: (Event|{ type: string, target: HTMLImageElement }) ) => void,
|
31
31
|
* loading?: string
|
32
|
-
* } & { [attr: string]:
|
32
|
+
* } & { [attr: string]: any }}
|
33
33
|
*/
|
34
34
|
let {
|
35
35
|
// Style
|
@@ -17,7 +17,7 @@
|
|
17
17
|
* valid?: boolean,
|
18
18
|
* pristine?: boolean,
|
19
19
|
* validate?: (value: string) => string | undefined,
|
20
|
-
* } & { [attr: string]:
|
20
|
+
* } & { [attr: string]: any }}
|
21
21
|
*/
|
22
22
|
let {
|
23
23
|
base = '',
|
@@ -27,7 +27,7 @@
|
|
27
27
|
fieldClasses,
|
28
28
|
fieldError,
|
29
29
|
|
30
|
-
legendBase = 'ml-
|
30
|
+
legendBase = 'ml-16tp px-8tp',
|
31
31
|
legendClasses,
|
32
32
|
legendError,
|
33
33
|
|
@@ -0,0 +1,156 @@
|
|
1
|
+
export namespace DESIGN {
|
2
|
+
let width: number;
|
3
|
+
let height: number;
|
4
|
+
}
|
5
|
+
export namespace CLAMPING {
|
6
|
+
namespace ui {
|
7
|
+
let min: number;
|
8
|
+
let max: number;
|
9
|
+
}
|
10
|
+
namespace textContent {
|
11
|
+
let min_1: number;
|
12
|
+
export { min_1 as min };
|
13
|
+
let max_1: number;
|
14
|
+
export { max_1 as max };
|
15
|
+
}
|
16
|
+
namespace textHeading {
|
17
|
+
let min_2: number;
|
18
|
+
export { min_2 as min };
|
19
|
+
let max_2: number;
|
20
|
+
export { max_2 as max };
|
21
|
+
}
|
22
|
+
namespace textUi {
|
23
|
+
let min_3: number;
|
24
|
+
export { min_3 as min };
|
25
|
+
let max_3: number;
|
26
|
+
export { max_3 as max };
|
27
|
+
}
|
28
|
+
}
|
29
|
+
export const TEXT_POINT_SIZES: number[];
|
30
|
+
export const VIEWPORT_POINT_SIZES: number[];
|
31
|
+
export namespace TEXT_CONTENT_SIZES {
|
32
|
+
namespace sm {
|
33
|
+
let size: number;
|
34
|
+
let lineHeight: number;
|
35
|
+
}
|
36
|
+
namespace base {
|
37
|
+
let size_1: number;
|
38
|
+
export { size_1 as size };
|
39
|
+
let lineHeight_1: number;
|
40
|
+
export { lineHeight_1 as lineHeight };
|
41
|
+
}
|
42
|
+
namespace lg {
|
43
|
+
let size_2: number;
|
44
|
+
export { size_2 as size };
|
45
|
+
let lineHeight_2: number;
|
46
|
+
export { lineHeight_2 as lineHeight };
|
47
|
+
}
|
48
|
+
}
|
49
|
+
export namespace TEXT_HEADING_SIZES {
|
50
|
+
namespace h1 {
|
51
|
+
let size_3: number;
|
52
|
+
export { size_3 as size };
|
53
|
+
let lineHeight_3: number;
|
54
|
+
export { lineHeight_3 as lineHeight };
|
55
|
+
}
|
56
|
+
namespace h2 {
|
57
|
+
let size_4: number;
|
58
|
+
export { size_4 as size };
|
59
|
+
let lineHeight_4: number;
|
60
|
+
export { lineHeight_4 as lineHeight };
|
61
|
+
}
|
62
|
+
namespace h3 {
|
63
|
+
let size_5: number;
|
64
|
+
export { size_5 as size };
|
65
|
+
let lineHeight_5: number;
|
66
|
+
export { lineHeight_5 as lineHeight };
|
67
|
+
}
|
68
|
+
namespace h4 {
|
69
|
+
let size_6: number;
|
70
|
+
export { size_6 as size };
|
71
|
+
let lineHeight_6: number;
|
72
|
+
export { lineHeight_6 as lineHeight };
|
73
|
+
}
|
74
|
+
namespace h5 {
|
75
|
+
let size_7: number;
|
76
|
+
export { size_7 as size };
|
77
|
+
let lineHeight_7: number;
|
78
|
+
export { lineHeight_7 as lineHeight };
|
79
|
+
}
|
80
|
+
}
|
81
|
+
export namespace TEXT_UI_SIZES {
|
82
|
+
export namespace sm_1 {
|
83
|
+
let size_8: number;
|
84
|
+
export { size_8 as size };
|
85
|
+
let lineHeight_8: number;
|
86
|
+
export { lineHeight_8 as lineHeight };
|
87
|
+
}
|
88
|
+
export { sm_1 as sm };
|
89
|
+
export namespace base_1 {
|
90
|
+
let size_9: number;
|
91
|
+
export { size_9 as size };
|
92
|
+
let lineHeight_9: number;
|
93
|
+
export { lineHeight_9 as lineHeight };
|
94
|
+
}
|
95
|
+
export { base_1 as base };
|
96
|
+
export namespace lg_1 {
|
97
|
+
let size_10: number;
|
98
|
+
export { size_10 as size };
|
99
|
+
let lineHeight_10: number;
|
100
|
+
export { lineHeight_10 as lineHeight };
|
101
|
+
}
|
102
|
+
export { lg_1 as lg };
|
103
|
+
}
|
104
|
+
export namespace RADIUS_SIZES {
|
105
|
+
export let none: string;
|
106
|
+
export namespace xs {
|
107
|
+
let size_11: number;
|
108
|
+
export { size_11 as size };
|
109
|
+
}
|
110
|
+
export namespace sm_2 {
|
111
|
+
let size_12: number;
|
112
|
+
export { size_12 as size };
|
113
|
+
}
|
114
|
+
export { sm_2 as sm };
|
115
|
+
export namespace md {
|
116
|
+
let size_13: number;
|
117
|
+
export { size_13 as size };
|
118
|
+
}
|
119
|
+
export namespace lg_2 {
|
120
|
+
let size_14: number;
|
121
|
+
export { size_14 as size };
|
122
|
+
}
|
123
|
+
export { lg_2 as lg };
|
124
|
+
export let full: string;
|
125
|
+
}
|
126
|
+
export namespace BORDER_WIDTH_SIZES {
|
127
|
+
namespace thin {
|
128
|
+
let size_15: number;
|
129
|
+
export { size_15 as size };
|
130
|
+
}
|
131
|
+
namespace normal {
|
132
|
+
let size_16: number;
|
133
|
+
export { size_16 as size };
|
134
|
+
}
|
135
|
+
namespace thick {
|
136
|
+
let size_17: number;
|
137
|
+
export { size_17 as size };
|
138
|
+
}
|
139
|
+
}
|
140
|
+
export namespace STROKE_WIDTH_SIZES {
|
141
|
+
export namespace thin_1 {
|
142
|
+
let size_18: number;
|
143
|
+
export { size_18 as size };
|
144
|
+
}
|
145
|
+
export { thin_1 as thin };
|
146
|
+
export namespace normal_1 {
|
147
|
+
let size_19: number;
|
148
|
+
export { size_19 as size };
|
149
|
+
}
|
150
|
+
export { normal_1 as normal };
|
151
|
+
export namespace thick_1 {
|
152
|
+
let size_20: number;
|
153
|
+
export { size_20 as size };
|
154
|
+
}
|
155
|
+
export { thick_1 as thick };
|
156
|
+
}
|
@@ -0,0 +1,73 @@
|
|
1
|
+
/* == Design dimensions == */
|
2
|
+
|
3
|
+
export const DESIGN = {
|
4
|
+
width: 1024,
|
5
|
+
height: 768
|
6
|
+
};
|
7
|
+
|
8
|
+
/* == Scaling-clamping behaviour == */
|
9
|
+
|
10
|
+
export const CLAMPING = {
|
11
|
+
ui: { min: 0.3, max: 2 },
|
12
|
+
textContent: { min: 0.75, max: 1.5 },
|
13
|
+
textHeading: { min: 0.75, max: 2.25 },
|
14
|
+
textUi: { min: 0.5, max: 1.25 }
|
15
|
+
};
|
16
|
+
|
17
|
+
/* == Text == */
|
18
|
+
|
19
|
+
export const TEXT_POINT_SIZES = [
|
20
|
+
1, 2, 4, 6, 8, 10, 11, 12, 16, 20, 24, 28, 32, 36, 50
|
21
|
+
];
|
22
|
+
|
23
|
+
export const VIEWPORT_POINT_SIZES = [
|
24
|
+
1, 2, 4, 5, 6, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 120, 140, 160, 180,
|
25
|
+
200
|
26
|
+
];
|
27
|
+
|
28
|
+
export const TEXT_CONTENT_SIZES = {
|
29
|
+
sm: { size: 14, lineHeight: 1.5 },
|
30
|
+
base: { size: 16, lineHeight: 1.5 },
|
31
|
+
lg: { size: 18, lineHeight: 1.4 }
|
32
|
+
};
|
33
|
+
|
34
|
+
export const TEXT_HEADING_SIZES = {
|
35
|
+
h1: { size: 32, lineHeight: 1.1 },
|
36
|
+
h2: { size: 28, lineHeight: 1.1 },
|
37
|
+
h3: { size: 24, lineHeight: 1.2 },
|
38
|
+
h4: { size: 20, lineHeight: 1.2 },
|
39
|
+
h5: { size: 16, lineHeight: 1.3 }
|
40
|
+
};
|
41
|
+
|
42
|
+
export const TEXT_UI_SIZES = {
|
43
|
+
sm: { size: 14, lineHeight: 1.1 },
|
44
|
+
base: { size: 16, lineHeight: 1.1 },
|
45
|
+
lg: { size: 18, lineHeight: 1.1 }
|
46
|
+
};
|
47
|
+
|
48
|
+
/* == Border radius == */
|
49
|
+
|
50
|
+
export const RADIUS_SIZES = {
|
51
|
+
none: '0px',
|
52
|
+
xs: { size: 1 },
|
53
|
+
sm: { size: 2 },
|
54
|
+
md: { size: 4 },
|
55
|
+
lg: { size: 8 },
|
56
|
+
full: '9999px'
|
57
|
+
};
|
58
|
+
|
59
|
+
/* == Border width == */
|
60
|
+
|
61
|
+
export const BORDER_WIDTH_SIZES = {
|
62
|
+
thin: { size: 1 },
|
63
|
+
normal: { size: 2 },
|
64
|
+
thick: { size: 4 }
|
65
|
+
};
|
66
|
+
|
67
|
+
/* == Stroke width == */
|
68
|
+
|
69
|
+
export const STROKE_WIDTH_SIZES = {
|
70
|
+
thin: { size: 1 },
|
71
|
+
normal: { size: 2 },
|
72
|
+
thick: { size: 4 }
|
73
|
+
};
|
@@ -0,0 +1,23 @@
|
|
1
|
+
export const spacing: {
|
2
|
+
[x: string]: string;
|
3
|
+
};
|
4
|
+
export const fontSize: {
|
5
|
+
[x: string]: string | [string, {
|
6
|
+
lineHeight: number;
|
7
|
+
}];
|
8
|
+
};
|
9
|
+
export const borderRadius: {
|
10
|
+
[x: string]: string;
|
11
|
+
};
|
12
|
+
export const borderWidth: {
|
13
|
+
[x: string]: string;
|
14
|
+
};
|
15
|
+
export const strokeWidth: {
|
16
|
+
[x: string]: string;
|
17
|
+
};
|
18
|
+
export const outlineWidth: {
|
19
|
+
[x: string]: string;
|
20
|
+
};
|
21
|
+
export const outlineOffset: {
|
22
|
+
[x: string]: string;
|
23
|
+
};
|
@@ -0,0 +1,151 @@
|
|
1
|
+
/**
|
2
|
+
* Design System Configuration
|
3
|
+
* Using CSS Custom Properties (variables) for consistent scaling
|
4
|
+
*
|
5
|
+
* @note
|
6
|
+
* Make sure to import scaling.vars.postcss in your application.
|
7
|
+
* It contains CSS variables used by the Tailwind theme extensions defined
|
8
|
+
* below
|
9
|
+
*
|
10
|
+
*
|
11
|
+
*
|
12
|
+
* FIXME>>>
|
13
|
+
*
|
14
|
+
* e.g. in your app.postcss:
|
15
|
+
*
|
16
|
+
* // @import "../src/lib/tailwind/extend/scaling/vars.postcss";
|
17
|
+
*
|
18
|
+
* <<<FIXME
|
19
|
+
*
|
20
|
+
* Base units:
|
21
|
+
* --scale-w: 0.052vw (Viewport Width Point)
|
22
|
+
* --scale-h: 0.09259vh (Viewport Height Point)
|
23
|
+
* --scale-viewport: min(var(--scale-w), var(--scale-h)) (Viewport Point)
|
24
|
+
* --scale-ui: clamp(0.3, var(--scale-viewport), 2) (UI Point)
|
25
|
+
* --scale-text-content: clamp(0.75, var(--scale-viewport), 1.5) (Content Text)
|
26
|
+
* --scale-text-heading: clamp(0.75, var(--scale-viewport), 2.25) (Heading Text)
|
27
|
+
* --scale-text-ui: clamp(0.5, var(--scale-viewport), 1.25) (UI Text)
|
28
|
+
*
|
29
|
+
* --
|
30
|
+
*
|
31
|
+
* UI Points (p) - Clamped scaling values
|
32
|
+
* Based on viewport scaling with minimum and maximum bounds
|
33
|
+
* to ensure usability across all screen sizes
|
34
|
+
*
|
35
|
+
* > PREFERRED METHOD FOR UI ELEMENT SCALING
|
36
|
+
*
|
37
|
+
* Examples:
|
38
|
+
* 5p = 5px at design size (clamps between 1.5px and 10px)
|
39
|
+
* 10p = 10px at design size (clamps between 3px and 20px)
|
40
|
+
* 20p = 20px at design size (clamps between 6px and 40px)
|
41
|
+
*
|
42
|
+
* Used for:
|
43
|
+
* - Component padding and margins
|
44
|
+
* - Interface element sizing
|
45
|
+
* - Any UI element that needs responsive scaling with guardrails
|
46
|
+
*
|
47
|
+
* --
|
48
|
+
*
|
49
|
+
* Text-Based Spacing Units (ut, ct, ht)
|
50
|
+
* Scaled by their respective text scaling variables
|
51
|
+
*
|
52
|
+
* > PREFERRED METHOD FOR TEXT-RELATED SPACING
|
53
|
+
*
|
54
|
+
* Examples:
|
55
|
+
* 4ut = calc(4px * var(--scale-text-ui)) // UI text spacing
|
56
|
+
* 4ct = calc(4px * var(--scale-text-content)) // Content text spacing
|
57
|
+
* 4ht = calc(4px * var(--scale-text-heading)) // Heading text spacing
|
58
|
+
*
|
59
|
+
* Used for:
|
60
|
+
* - ut: Button padding, form spacing, UI component margins
|
61
|
+
* - ct: Paragraph margins, list spacing, content gaps
|
62
|
+
* - ht: Heading margins, title spacing
|
63
|
+
*
|
64
|
+
* --
|
65
|
+
*
|
66
|
+
* Viewport Points (vp, wp, hp) - Responsive scaling values
|
67
|
+
* vp: Uses min of width/height scaling
|
68
|
+
* wp: Uses width-based scaling (1920px reference)
|
69
|
+
* hp: Uses height-based scaling (1080px reference)
|
70
|
+
*
|
71
|
+
* > ALTERNATIVE SCALING METHODS
|
72
|
+
*
|
73
|
+
* Examples:
|
74
|
+
* 10vp = calc(10px * var(--scale-viewport))
|
75
|
+
* 10wp = calc(10px * var(--scale-w))
|
76
|
+
* 10hp = calc(10px * var(--scale-h))
|
77
|
+
*
|
78
|
+
* Used for:
|
79
|
+
* - Interface scaling that needs to fit both width and height
|
80
|
+
* - Maintaining aspect ratio of design
|
81
|
+
* - Preventing overflow in either direction
|
82
|
+
*/
|
83
|
+
import {
|
84
|
+
generateTextBasedSpacing,
|
85
|
+
generateViewportBasedSpacing,
|
86
|
+
generateTextStyles,
|
87
|
+
generateBorderRadiusStyles,
|
88
|
+
generateWidthStyles
|
89
|
+
} from '../util/design-system/tailwind.js';
|
90
|
+
|
91
|
+
import {
|
92
|
+
TEXT_POINT_SIZES,
|
93
|
+
VIEWPORT_POINT_SIZES,
|
94
|
+
TEXT_CONTENT_SIZES,
|
95
|
+
TEXT_HEADING_SIZES,
|
96
|
+
TEXT_UI_SIZES,
|
97
|
+
RADIUS_SIZES,
|
98
|
+
BORDER_WIDTH_SIZES,
|
99
|
+
STROKE_WIDTH_SIZES
|
100
|
+
} from './design-config.js';
|
101
|
+
|
102
|
+
/* == Internals */
|
103
|
+
|
104
|
+
const TEXT_BASED_SPACING = generateTextBasedSpacing(TEXT_POINT_SIZES);
|
105
|
+
const VIEWPORT_BASED_SPACING =
|
106
|
+
generateViewportBasedSpacing(VIEWPORT_POINT_SIZES);
|
107
|
+
|
108
|
+
/* == Exports */
|
109
|
+
|
110
|
+
export const spacing = {
|
111
|
+
...VIEWPORT_BASED_SPACING,
|
112
|
+
...TEXT_BASED_SPACING
|
113
|
+
};
|
114
|
+
|
115
|
+
export const fontSize = {
|
116
|
+
...TEXT_BASED_SPACING,
|
117
|
+
|
118
|
+
// Named styles
|
119
|
+
...generateTextStyles(TEXT_CONTENT_SIZES, 'content'),
|
120
|
+
...generateTextStyles(TEXT_HEADING_SIZES, 'heading'),
|
121
|
+
...generateTextStyles(TEXT_UI_SIZES, 'ui')
|
122
|
+
};
|
123
|
+
|
124
|
+
export const borderRadius = {
|
125
|
+
// Named styles
|
126
|
+
...generateBorderRadiusStyles(RADIUS_SIZES)
|
127
|
+
};
|
128
|
+
|
129
|
+
export const borderWidth = {
|
130
|
+
// Named styles
|
131
|
+
...generateWidthStyles(BORDER_WIDTH_SIZES, 'width')
|
132
|
+
};
|
133
|
+
|
134
|
+
export const strokeWidth = {
|
135
|
+
// Named styles
|
136
|
+
...generateWidthStyles(STROKE_WIDTH_SIZES, 'width')
|
137
|
+
};
|
138
|
+
|
139
|
+
export const outlineWidth = {
|
140
|
+
// Named styles
|
141
|
+
...generateWidthStyles(STROKE_WIDTH_SIZES, '')
|
142
|
+
};
|
143
|
+
|
144
|
+
export const outlineOffset = {
|
145
|
+
// Named styles
|
146
|
+
...generateWidthStyles(STROKE_WIDTH_SIZES, '')
|
147
|
+
};
|
148
|
+
|
149
|
+
// console.log('borderWidth', borderWidth);
|
150
|
+
// console.log('outlineWidth', outlineWidth);
|
151
|
+
// console.log('outlineOffset', outlineOffset);
|
@@ -0,0 +1,41 @@
|
|
1
|
+
@define-mixin text_block {
|
2
|
+
|
3
|
+
/* .on-primary-dark
|
4
|
+
{
|
5
|
+
& [data-title-text-button-block] {
|
6
|
+
& > .title-box {
|
7
|
+
@apply text-white;
|
8
|
+
}
|
9
|
+
|
10
|
+
& > .text-box {
|
11
|
+
...text color
|
12
|
+
}
|
13
|
+
}
|
14
|
+
} */
|
15
|
+
|
16
|
+
[data-title-text-button-block] {
|
17
|
+
|
18
|
+
&.block-width {
|
19
|
+
@apply w-1/2;
|
20
|
+
}
|
21
|
+
|
22
|
+
& > .title-box {
|
23
|
+
@apply text-heading-h3;
|
24
|
+
@apply uppercase;
|
25
|
+
}
|
26
|
+
|
27
|
+
& > .content-box .p {
|
28
|
+
@apply text-content-base;
|
29
|
+
}
|
30
|
+
|
31
|
+
& > .content-box:has( + .footer-box )
|
32
|
+
{
|
33
|
+
@apply mb-30p; /* 10p + 20p */
|
34
|
+
}
|
35
|
+
|
36
|
+
& > .footer-box {
|
37
|
+
}
|
38
|
+
}
|
39
|
+
|
40
|
+
|
41
|
+
}
|