@danielito1996/compose-svelted 0.0.1 → 0.2.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.
Files changed (118) hide show
  1. package/README.md +113 -274
  2. package/dist/components/ContentScale.d.ts +10 -0
  3. package/dist/components/layouts/Alignment.d.ts +20 -0
  4. package/dist/components/layouts/Arrangement.d.ts +23 -0
  5. package/{src/lib/components/textFields/TextFieldColors.ts → dist/components/textFields/TextFieldColors.d.ts} +12 -11
  6. package/dist/components/textFields/TextFieldDefaults.d.ts +11 -0
  7. package/dist/core/elevation/elevation.d.ts +1 -0
  8. package/dist/core/helpers/painterResource.d.ts +12 -0
  9. package/{src/lib/core/modifier/Modifier.ts → dist/core/modifier/Modifier.d.ts} +195 -259
  10. package/dist/core/modifier/ModifierImpl.d.ts +38 -0
  11. package/dist/core/motion/AnimationSpec.d.ts +6 -0
  12. package/dist/core/motion/ContentTransition.d.ts +5 -0
  13. package/dist/core/motion/contentTransitions.d.ts +4 -0
  14. package/dist/core/motion/transitions.d.ts +7 -0
  15. package/dist/core/navigation/NavBackStackEntry.d.ts +4 -0
  16. package/dist/core/navigation/NavController.d.ts +8 -0
  17. package/dist/core/navigation/NavStore.d.ts +6 -0
  18. package/dist/core/navigation/Route.d.ts +3 -0
  19. package/dist/core/navigation/composable.d.ts +5 -0
  20. package/dist/core/navigation/rememberNavController.d.ts +2 -0
  21. package/dist/core/shapes/RoundedCornerShape.d.ts +13 -0
  22. package/{src/lib/core/shapes/Shape.ts → dist/core/shapes/Shape.d.ts} +3 -3
  23. package/dist/core/theme/ColorScheme.d.ts +17 -0
  24. package/dist/core/theme/Density.d.ts +5 -0
  25. package/dist/core/theme/TextStyle.d.ts +19 -0
  26. package/{src/lib/core/theme/colors.ts → dist/core/theme/colors.d.ts} +15 -21
  27. package/dist/core/theme/cssVars.d.ts +2 -0
  28. package/dist/core/theme/defaults/darkColors.d.ts +2 -0
  29. package/dist/core/theme/defaults/defaultTheme.d.ts +3 -0
  30. package/dist/core/theme/defaults/lightColors.d.ts +2 -0
  31. package/dist/core/theme/defaults/typography.d.ts +2 -0
  32. package/{src/lib/core/theme/elevation.ts → dist/core/theme/elevation.d.ts} +7 -7
  33. package/dist/core/theme/getCurrentColor.d.ts +1 -0
  34. package/dist/core/theme/resolve.d.ts +5 -0
  35. package/{src/lib/core/theme/shapes.ts → dist/core/theme/shapes.d.ts} +7 -7
  36. package/{src/lib/core/theme/spacing.ts → dist/core/theme/spacing.d.ts} +7 -7
  37. package/dist/core/theme/store.d.ts +2 -0
  38. package/dist/core/theme/systemTheme.d.ts +2 -0
  39. package/{src/lib/core/theme/theme.ts → dist/core/theme/theme.d.ts} +13 -15
  40. package/{src/lib/core/theme/typography.ts → dist/core/theme/typography.d.ts} +24 -29
  41. package/dist/index.d.ts +152 -0
  42. package/dist/index.js +1164 -0
  43. package/package.json +9 -35
  44. package/.vscode/extensions.json +0 -3
  45. package/docs/assets/components/button/button.png +0 -0
  46. package/docs/assets/components/surface/surface_simple.png +0 -0
  47. package/docs/assets/components/text/text.png +0 -0
  48. package/docs/assets/components/textfield/textfield_simple.png +0 -0
  49. package/docs/assets/svelted.png +0 -0
  50. package/docs/assets/svelted.svg +0 -41
  51. package/docs/getting_started.md +0 -116
  52. package/docs/index.md +0 -106
  53. package/index.html +0 -14
  54. package/screenshots/Captura de pantalla 2025-12-20 022710.png +0 -0
  55. package/screenshots/capturas.txt +0 -1
  56. package/src/App.svelte +0 -39
  57. package/src/app.css +0 -23
  58. package/src/assets/img/hav3m.png +0 -0
  59. package/src/assets/img/vessel.jpg +0 -0
  60. package/src/assets/raw/boat.svg +0 -15
  61. package/src/assets/raw/cash.svg +0 -39
  62. package/src/assets/raw/police.json +0 -1
  63. package/src/assets/raw/svelte.svg +0 -1
  64. package/src/lib/Counter.svelte +0 -10
  65. package/src/lib/components/AppRoot.svelte +0 -15
  66. package/src/lib/components/ContentScale.ts +0 -12
  67. package/src/lib/components/Icon.svelte +0 -47
  68. package/src/lib/components/Image.svelte +0 -31
  69. package/src/lib/components/Spacer.svelte +0 -11
  70. package/src/lib/components/Surface.svelte +0 -19
  71. package/src/lib/components/Text.svelte +0 -23
  72. package/src/lib/components/TonalButton.svelte +0 -34
  73. package/src/lib/components/buttons/Button.svelte +0 -34
  74. package/src/lib/components/buttons/IconButton.svelte +0 -0
  75. package/src/lib/components/buttons/OutlinedButton.svelte +0 -0
  76. package/src/lib/components/buttons/OutlinedButtonWithIcon.svelte +0 -0
  77. package/src/lib/components/buttons/OutlinedIconButton.svelte +0 -0
  78. package/src/lib/components/buttons/TextButton.svelte +0 -0
  79. package/src/lib/components/cards/Card.svelte +0 -0
  80. package/src/lib/components/cards/OutlinedCard.svelte +0 -0
  81. package/src/lib/components/layouts/Alignment.ts +0 -37
  82. package/src/lib/components/layouts/Arrangement.ts +0 -66
  83. package/src/lib/components/layouts/Box.svelte +0 -25
  84. package/src/lib/components/layouts/Column.svelte +0 -23
  85. package/src/lib/components/layouts/LazyColumn.svelte +0 -0
  86. package/src/lib/components/layouts/LazyRow.svelte +0 -0
  87. package/src/lib/components/layouts/Row.svelte +0 -23
  88. package/src/lib/components/layouts/Scafold.svelte +0 -0
  89. package/src/lib/components/menus/DropdownMenu.svelte +0 -0
  90. package/src/lib/components/menus/DropdownMenuItem.svelte +0 -0
  91. package/src/lib/components/textFields/BaseTextField.svelte +0 -130
  92. package/src/lib/components/textFields/OutlinedTextField.svelte +0 -52
  93. package/src/lib/components/textFields/TextField.svelte +0 -36
  94. package/src/lib/components/textFields/TextFieldDefaults.ts +0 -48
  95. package/src/lib/core/helpers/painterResource.ts +0 -26
  96. package/src/lib/core/modifier/ModifierImpl.ts +0 -275
  97. package/src/lib/core/shapes/RoundedCornerShape.ts +0 -53
  98. package/src/lib/core/theme/ColorScheme.ts +0 -25
  99. package/src/lib/core/theme/ComposeTheme.svelte +0 -22
  100. package/src/lib/core/theme/TextStyle.ts +0 -25
  101. package/src/lib/core/theme/cssVars.ts +0 -32
  102. package/src/lib/core/theme/defaults/darkColors.ts +0 -17
  103. package/src/lib/core/theme/defaults/defaultTheme.ts +0 -35
  104. package/src/lib/core/theme/defaults/lightColors.ts +0 -17
  105. package/src/lib/core/theme/defaults/typography.ts +0 -128
  106. package/src/lib/core/theme/getCurrentColor.ts +0 -10
  107. package/src/lib/core/theme/resolve.ts +0 -29
  108. package/src/lib/core/theme/store.ts +0 -26
  109. package/src/lib/core/theme/systemTheme.ts +0 -20
  110. package/src/lib/index.ts +0 -42
  111. package/src/main.ts +0 -9
  112. package/svelte.config.js +0 -8
  113. package/tsconfig.app.json +0 -21
  114. package/tsconfig.json +0 -7
  115. package/tsconfig.node.json +0 -26
  116. package/vite.config.ts +0 -11
  117. /package/{src/lib/components/buttons/ButtonWithIcon.svelte → dist/core/motion/applyAnimation.d.ts} +0 -0
  118. /package/{public → dist}/vite.svg +0 -0
@@ -1,36 +0,0 @@
1
- <script lang="ts">
2
- import BaseTextField from "./BaseTextField.svelte";
3
- import { TextFieldDefaults } from "./TextFieldDefaults";
4
- import type { TextFieldColors } from "./TextFieldColors";
5
- import { Modifier } from "../../core/modifier/Modifier";
6
- import { RoundedCornerShape } from "../../core/shapes/RoundedCornerShape";
7
- import type { Shape } from "../../core/shapes/Shape";
8
- import type { TextStyleToken } from "../../core/theme/TextStyle";
9
-
10
- export let value = "";
11
- export let onValueChange = (v: string) => {};
12
- export let label = "";
13
- export let placeholder = "";
14
- export let singleLine = true;
15
- export let textStyle: TextStyleToken = "bodyLarge";
16
- export let modifier: Modifier = Modifier.empty();
17
- export let shape: Shape = RoundedCornerShape(12);
18
-
19
- // 🔒 FilledTextField SIEMPRE usa filledColors por defecto
20
- export let colors: TextFieldColors = TextFieldDefaults.filledColors();
21
- </script>
22
-
23
- <BaseTextField
24
- value={value}
25
- onValueChange={onValueChange}
26
- label={label}
27
- placeholder={placeholder}
28
- singleLine={singleLine}
29
- textStyle={textStyle}
30
- modifier={modifier}
31
- shape={shape}
32
- colors={colors}
33
- >
34
- <slot name="leadingIcon" slot="leadingIcon" />
35
- <slot name="trailingIcon" slot="trailingIcon" />
36
- </BaseTextField>
@@ -1,48 +0,0 @@
1
- import { resolveColor } from "../../core/theme/resolve";
2
- import type { TextFieldColors } from "./TextFieldColors";
3
-
4
- export const TextFieldDefaults = {
5
- /**
6
- * FilledTextField (Material default)
7
- */
8
- filledColors(): TextFieldColors {
9
- return {
10
- // Container
11
- container: resolveColor("surfaceVariant"),
12
-
13
- // Content
14
- label: resolveColor("onSurfaceVariant"),
15
- placeholder: resolveColor("onSurfaceVariant"),
16
- text: resolveColor("onSurface"),
17
- cursor: resolveColor("primary"),
18
-
19
- // Indicator (bottom line)
20
- indicatorFocused: resolveColor("primary"),
21
- indicatorUnfocused: resolveColor("onSurfaceVariant"),
22
- };
23
- },
24
-
25
- /**
26
- * OutlinedTextField
27
- */
28
- outlinedColors(): TextFieldColors {
29
- return {
30
- // Container
31
- container: "transparent",
32
-
33
- // Content
34
- label: resolveColor("onSurfaceVariant"),
35
- placeholder: resolveColor("onSurfaceVariant"),
36
- text: resolveColor("onSurface"),
37
- cursor: resolveColor("primary"),
38
-
39
- // Indicator (used only if needed)
40
- indicatorFocused: resolveColor("primary"),
41
- indicatorUnfocused: resolveColor("outline"),
42
-
43
- // Border (outlined specific)
44
- borderFocused: resolveColor("primary"),
45
- borderUnfocused: resolveColor("outline"),
46
- };
47
- }
48
- };
@@ -1,26 +0,0 @@
1
- /**
2
- * painterResource - como en Jetpack Compose
3
- * Carga un recurso local desde src/lib/assets/
4
- * Soporta SVG (?raw para string) e imágenes (?url para URL)
5
- */
6
- export const Res = {
7
- raw(fileName: string): string {
8
- return "raw/"+fileName;
9
- },
10
-
11
- image(fileName: string): string {
12
- return "img/"+fileName;
13
- },
14
-
15
- values(fileName: string): string {
16
- return "values/"+fileName;
17
- },
18
-
19
- fonts(fileName: string): string {
20
- return "fonts/"+fileName;
21
- }
22
- } as const;
23
-
24
- export function painterResource(resourceName: string): string {
25
- return "/src/assets/"+resourceName;
26
- }
@@ -1,275 +0,0 @@
1
- import type {BoxAlignment} from "../../components/layouts/Alignment";
2
- import type {Shape} from "../shapes/Shape";
3
- import type {ColorToken} from "../theme/ColorScheme";
4
- import {resolveColor} from "../theme/resolve";
5
-
6
- export type ModifierEntry = {
7
- className?: string;
8
- style?: string;
9
- };
10
-
11
- export class ModifierImpl {
12
- private readonly entries: ModifierEntry[];
13
-
14
- constructor(entries: ModifierEntry[] = []) {
15
- this.entries = entries;
16
- }
17
-
18
- then(other: ModifierImpl): ModifierImpl {
19
- return new ModifierImpl([...this.entries, ...other.entries]);
20
- }
21
-
22
- paddingHorizontal(value: number): ModifierImpl {
23
- return this.then(
24
- new ModifierImpl([
25
- { style: `padding-left:${value}px;padding-right:${value}px;` },
26
- ])
27
- );
28
- }
29
-
30
- verticalScroll(enabled: boolean = true): ModifierImpl {
31
- return this.then(
32
- new ModifierImpl([{
33
- style: enabled
34
- ? `overflow-y:auto;overflow-x:hidden;-webkit-overflow-scrolling:touch;`
35
- : ''
36
- }])
37
- );
38
- }
39
-
40
- horizontalScroll(enabled: boolean = true): ModifierImpl {
41
- return this.then(
42
- new ModifierImpl([{
43
- style: enabled
44
- ? `overflow-x:auto;overflow-y:hidden;-webkit-overflow-scrolling:touch;white-space:nowrap;`
45
- : ''
46
- }])
47
- );
48
- }
49
-
50
- paddingVertical(value: number): ModifierImpl {
51
- return this.then(
52
- new ModifierImpl([
53
- { style: `padding-top:${value}px;padding-bottom:${value}px;` },
54
- ])
55
- );
56
- }
57
-
58
- fillMaxWidth(): ModifierImpl {
59
- return this.then(
60
- new ModifierImpl([{ style: `width:100%;` }])
61
- );
62
- }
63
-
64
- fillMaxHeight(): ModifierImpl {
65
- return this.then(
66
- new ModifierImpl([{ style: `height:100%;` }])
67
- );
68
- }
69
-
70
- fillMaxSize(): ModifierImpl {
71
- return this.then(
72
- new ModifierImpl([{ style: `width:100%;height:100%;` }])
73
- );
74
- }
75
-
76
- background(color: ColorToken | string): ModifierImpl {
77
- let resolved: string;
78
-
79
- if (
80
- typeof color === "string" &&
81
- (
82
- color.startsWith("#") ||
83
- color.startsWith("rgb") ||
84
- color.startsWith("hsl") ||
85
- color === "transparent" ||
86
- color === "currentColor"
87
- )
88
- ) {
89
- // Color CSS directo
90
- resolved = color;
91
- } else {
92
- // Token de ComposeTheme
93
- resolved = resolveColor(color as ColorToken);
94
- }
95
-
96
- return this.then(
97
- new ModifierImpl([
98
- { style: `background:${resolved};` }
99
- ])
100
- );
101
- }
102
-
103
- weight(weight: number, fill: boolean = true): ModifierImpl {
104
- if (weight <= 0) {
105
- console.warn("Modifier.weight() debe ser > 0");
106
- return this;
107
- }
108
-
109
- const styleParts = [
110
- `flex-grow: ${weight};`,
111
- `flex-shrink: ${fill ? 1 : 0};`,
112
- `flex-basis: 0%;` // importante para que el peso funcione bien
113
- ];
114
-
115
- return this.then(new ModifierImpl([{ style: styleParts.join(" ") }]));
116
- }
117
-
118
- align(alignment: BoxAlignment): ModifierImpl {
119
- const parts = alignment.split(' ');
120
- const horizontal = parts[0]; // flex-start, center, flex-end
121
- const vertical = parts[1] || parts[0]; // para casos simples como "center"
122
-
123
- let style = 'position: absolute;';
124
-
125
- // Vertical
126
- if (vertical === 'flex-start') {
127
- style += 'top: 0;';
128
- } else if (vertical === 'flex-end') {
129
- style += 'bottom: 0;';
130
- } else if (vertical === 'center') {
131
- style += 'top: 50%; transform: translateY(-50%);';
132
- }
133
-
134
- // Horizontal
135
- if (horizontal === 'flex-start') {
136
- style += 'left: 0;';
137
- } else if (horizontal === 'flex-end') {
138
- style += 'right: 0;';
139
- } else if (horizontal === 'center') {
140
- style += 'left: 50%;';
141
- // Combinar transform si ya hay translateY
142
- if (style.includes('translateY')) {
143
- style = style.replace('translateY(-50%)', 'translate(-50%, -50%)');
144
- } else {
145
- style += 'transform: translateX(-50%);';
146
- }
147
- }
148
-
149
- return this.then(new ModifierImpl([{ style }]));
150
- }
151
-
152
- padding(valueOrParams: number | { top?: number; bottom?: number; start?: number; end?: number } = 0, unit: string = 'px'): ModifierImpl {
153
- let style = '';
154
-
155
- if (typeof valueOrParams === 'number') {
156
- // Padding uniforme
157
- style = `padding:${valueOrParams}${unit};`;
158
- } else {
159
- // Padding direccional
160
- const { top = 0, bottom = 0, start = 0, end = 0 } = valueOrParams;
161
- style = `
162
- padding-top:${top}${unit};
163
- padding-bottom:${bottom}${unit};
164
- padding-left:${start}${unit};
165
- //padding-right:${end}${unit};
166
- `.trim();
167
- }
168
-
169
- return this.then(new ModifierImpl([{ style }]));
170
- }
171
-
172
- width(value: number | string, unit = 'px'): ModifierImpl {
173
- const size = typeof value === 'number' ? `${value}${unit}` : value;
174
- return this.then(new ModifierImpl([{ style: `width:${size};` }]));
175
- }
176
-
177
- height(value: number | string, unit = 'px'): ModifierImpl {
178
- const size = typeof value === 'number' ? `${value}${unit}` : value;
179
- return this.then(new ModifierImpl([{ style: `height:${size};` }]));
180
- }
181
-
182
- marginTop(value: number, unit = 'px'): ModifierImpl {
183
- return this.then(new ModifierImpl([{ style: `margin-top:${value}${unit};` }]));
184
- }
185
-
186
- clip(shape: Shape): ModifierImpl {
187
- return this.then(
188
- new ModifierImpl([
189
- {
190
- style: `
191
- border-radius:${shape.toCssBorderRadius()};
192
- overflow:hidden;
193
- `
194
- }
195
- ])
196
- );
197
- }
198
-
199
- size(value: number | string, unit: string = "px"): ModifierImpl {
200
- if (value === null || value === undefined) {
201
- return this;
202
- }
203
-
204
- let resolved: string;
205
-
206
- if (typeof value === "number") {
207
- if (isNaN(value)) return this;
208
- resolved = `${value}${unit}`;
209
- } else {
210
- if (value.trim() === "") return this;
211
- resolved = value;
212
- }
213
-
214
- return this.then(
215
- new ModifierImpl([
216
- {
217
- style: `width:${resolved};height:${resolved};`
218
- }
219
- ])
220
- );
221
- }
222
-
223
- offset(x: number, y: number): ModifierImpl {
224
- if (isNaN(x) || isNaN(y)) return this;
225
-
226
- return this.then(
227
- new ModifierImpl([
228
- {
229
- style: `transform: translate(${x}px, ${y}px);`
230
- }
231
- ])
232
- );
233
- }
234
-
235
- clickable(onClick: () => void): ModifierImpl {
236
- return this.then(
237
- new ModifierImpl([
238
- {
239
- className: "compose-clickable",
240
- style: `
241
- cursor: pointer;
242
- user-select: none;
243
- `
244
- }
245
- ])
246
- );
247
- }
248
-
249
- border(width: number, color: string, shape?: Shape): ModifierImpl {
250
- if (width <= 0) return this;
251
-
252
- const radius = shape ? shape.toCssBorderRadius() : undefined;
253
-
254
- return this.then(
255
- new ModifierImpl([
256
- {
257
- style: `
258
- border:${width}px solid ${color};
259
- ${radius ? `border-radius:${radius};` : ""}
260
- `
261
- }
262
- ])
263
- );
264
- }
265
-
266
- // ---- consumo interno ----
267
-
268
- toStyle(): string {
269
- return this.entries.map(e => e.style ?? "").join("");
270
- }
271
-
272
- toClass(): string {
273
- return this.entries.map(e => e.className ?? "").join(" ");
274
- }
275
- }
@@ -1,53 +0,0 @@
1
- import type { Shape } from "./Shape";
2
-
3
- type CornerSize = number | string;
4
-
5
- type RoundedCornerParams =
6
- | CornerSize
7
- | {
8
- topStart?: CornerSize;
9
- topEnd?: CornerSize;
10
- bottomEnd?: CornerSize;
11
- bottomStart?: CornerSize;
12
- };
13
-
14
- function toCss(value?: CornerSize): string {
15
- if (value === undefined) return "0px";
16
- return typeof value === "number" ? `${value}px` : value;
17
- }
18
-
19
- class RoundedCornerShapeImpl implements Shape {
20
- constructor(private readonly params: RoundedCornerParams) {}
21
-
22
- toCssBorderRadius(): string {
23
- // Caso: un solo valor → todas las esquinas
24
- if (typeof this.params === "number" || typeof this.params === "string") {
25
- const v = toCss(this.params);
26
- return `${v} ${v} ${v} ${v}`;
27
- }
28
-
29
- const {
30
- topStart = 0,
31
- topEnd = 0,
32
- bottomEnd = 0,
33
- bottomStart = 0,
34
- } = this.params;
35
-
36
- // CSS: top-left, top-right, bottom-right, bottom-left
37
- return `
38
- ${toCss(topStart)}
39
- ${toCss(topEnd)}
40
- ${toCss(bottomEnd)}
41
- ${toCss(bottomStart)}
42
- `.trim();
43
- }
44
- }
45
-
46
- /**
47
- * Compose-like factory
48
- */
49
- export function RoundedCornerShape(
50
- params: RoundedCornerParams
51
- ): Shape {
52
- return new RoundedCornerShapeImpl(params);
53
- }
@@ -1,25 +0,0 @@
1
- import type { ColorScheme as Def } from "./colors";
2
-
3
- export type ColorToken = keyof Def;
4
-
5
- export const ColorScheme = {
6
- Primary: "primary",
7
- OnPrimary: "onPrimary",
8
-
9
- Secondary: "secondary",
10
- OnSecondary: "onSecondary",
11
-
12
- Background: "background",
13
- OnBackground: "onBackground",
14
-
15
- Surface: "surface",
16
- OnSurface: "onSurface",
17
-
18
- SurfaceVariant: "surfaceVariant",
19
- OnSurfaceVariant: "onSurfaceVariant",
20
-
21
- Outline: "outline",
22
-
23
- Error: "error",
24
- OnError: "onError",
25
- } as const;
@@ -1,22 +0,0 @@
1
- <script lang="ts">
2
- import { themeState, resolvedTheme } from "./store";
3
- import { themeToCssVars } from "./cssVars";
4
- import { defaultLightTheme, defaultDarkTheme } from "./defaults/defaultTheme";
5
- import type { ComposeTheme as Theme, ThemeMode } from "./theme";
6
-
7
- export let light: Theme | undefined = undefined;
8
- export let dark: Theme | undefined = undefined;
9
- export let mode: ThemeMode = "system";
10
-
11
- $: themeState.set({
12
- light: light ?? defaultLightTheme,
13
- dark: dark ?? defaultDarkTheme,
14
- mode,
15
- });
16
-
17
- $: css = $resolvedTheme ? themeToCssVars($resolvedTheme) : "";
18
- </script>
19
-
20
- <div style={css}>
21
- <slot />
22
- </div>
@@ -1,25 +0,0 @@
1
- import type { Typography } from "./typography";
2
-
3
- export type TextStyleToken = keyof Typography;
4
-
5
- export const TextStyle = {
6
- DisplayLarge: "displayLarge",
7
- DisplayMedium: "displayMedium",
8
- DisplaySmall: "displaySmall",
9
-
10
- HeadlineLarge: "headlineLarge",
11
- HeadlineMedium: "headlineMedium",
12
- HeadlineSmall: "headlineSmall",
13
-
14
- TitleLarge: "titleLarge",
15
- TitleMedium: "titleMedium",
16
- TitleSmall: "titleSmall",
17
-
18
- BodyLarge: "bodyLarge",
19
- BodyMedium: "bodyMedium",
20
- BodySmall: "bodySmall",
21
-
22
- LabelLarge: "labelLarge",
23
- LabelMedium: "labelMedium",
24
- LabelSmall: "labelSmall",
25
- } as const;
@@ -1,32 +0,0 @@
1
- import type { ComposeTheme } from "./theme";
2
-
3
- export function themeToCssVars(theme: ComposeTheme): string {
4
- const vars: string[] = [];
5
-
6
- Object.entries(theme.colorScheme).forEach(([k, v]) =>
7
- vars.push(`--md-sys-color-${k}: ${v};`)
8
- );
9
-
10
- // === Tipografía: una variable por cada propiedad (¡esto soluciona el bug!) ===
11
- Object.entries(theme.typography).forEach(([styleKey, style]) => {
12
- vars.push(`--md-sys-typescale-${styleKey}-font-family: ${style.fontFamily};`);
13
- vars.push(`--md-sys-typescale-${styleKey}-font-size: ${style.fontSize};`);
14
- vars.push(`--md-sys-typescale-${styleKey}-line-height: ${style.lineHeight};`);
15
- vars.push(`--md-sys-typescale-${styleKey}-letter-spacing: ${style.letterSpacing};`);
16
- vars.push(`--md-sys-typescale-${styleKey}-font-weight: ${style.fontWeight};`);
17
- });
18
-
19
- Object.entries(theme.shapes).forEach(([k, v]) =>
20
- vars.push(`--md-sys-shape-${k}: ${v};`)
21
- );
22
-
23
- Object.entries(theme.elevation).forEach(([k, v]) =>
24
- vars.push(`--md-sys-elevation-${k}: ${v};`)
25
- );
26
-
27
- Object.entries(theme.spacing).forEach(([k, v]) =>
28
- vars.push(`--md-sys-spacing-${k}: ${v};`)
29
- );
30
-
31
- return vars.join("\n");
32
- }
@@ -1,17 +0,0 @@
1
- import type { ColorScheme } from "../colors";
2
-
3
- export const darkColors: ColorScheme = {
4
- primary: "#FFD700",
5
- onPrimary: "#080808",
6
- secondary: "#3A3E49",
7
- onSecondary: "#E6E6E6",
8
- background: "#080808",
9
- onBackground: "#E6E6E6",
10
- surface: "#101010",
11
- onSurface: "#E6E6E6",
12
- surfaceVariant: "#1E1E1E",
13
- onSurfaceVariant: "#CAC4D0",
14
- outline: "#4A4A4A",
15
- error: "#FF6F61",
16
- onError: "#080808",
17
- };
@@ -1,35 +0,0 @@
1
- import { lightColors } from "./lightColors"
2
- import { darkColors } from "./darkColors"
3
- import { defaultTypography } from "./typography"
4
- import type { ComposeTheme } from "../theme"
5
-
6
- export const defaultLightTheme: ComposeTheme = {
7
- colorScheme: lightColors,
8
- typography: defaultTypography,
9
- shapes: {
10
- none: "0px",
11
- extraSmall: "4px",
12
- small: "8px",
13
- medium: "12px",
14
- large: "16px",
15
- },
16
- spacing: {
17
- xs: "4px",
18
- sm: "8px",
19
- md: "16px",
20
- lg: "24px",
21
- xl: "32px",
22
- },
23
- elevation: {
24
- level0: "none",
25
- level1: "0 1px 2px rgba(0,0,0,0.2)",
26
- level2: "0 2px 6px rgba(0,0,0,0.2)",
27
- level3: "0 6px 12px rgba(0,0,0,0.25)",
28
- level4: "0 12px 24px rgba(0,0,0,0.3)",
29
- },
30
- }
31
-
32
- export const defaultDarkTheme: ComposeTheme = {
33
- ...defaultLightTheme,
34
- colorScheme: darkColors,
35
- }
@@ -1,17 +0,0 @@
1
- import type { ColorScheme } from "../colors";
2
-
3
- export const lightColors: ColorScheme = {
4
- primary: "#D4AF37", // Violeta más intenso
5
- onPrimary: "#080808",
6
- secondary: "#3A3E49", // Teal vibrante
7
- onSecondary: "#FFFFFF",
8
- background: "#FFFBF2",
9
- onBackground: "#1C1B1F",
10
- surface: "#FFFFFF",
11
- onSurface: "#1C1B1F",
12
- surfaceVariant: "#F8F9FA",
13
- onSurfaceVariant: "#DEE1E6",
14
- outline: "#B0B0B0",
15
- error: "#BA1A1A",
16
- onError: "#FFFFFF",
17
- };