@danielito1996/compose-svelted 0.2.2 → 0.2.5

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 (150) hide show
  1. package/dist/components/AppRoot.svelte +15 -0
  2. package/dist/components/AppRoot.svelte.d.ts +30 -0
  3. package/dist/components/ContentScale.d.ts +10 -0
  4. package/dist/components/ContentScale.js +9 -0
  5. package/dist/components/Icon.svelte +47 -0
  6. package/dist/components/Icon.svelte.d.ts +24 -0
  7. package/dist/components/Image.svelte +31 -0
  8. package/dist/components/Image.svelte.d.ts +25 -0
  9. package/dist/components/Spacer.svelte +11 -0
  10. package/dist/components/Spacer.svelte.d.ts +24 -0
  11. package/dist/components/Surface.svelte +19 -0
  12. package/dist/components/Surface.svelte.d.ts +32 -0
  13. package/dist/components/Text.svelte +23 -0
  14. package/dist/components/Text.svelte.d.ts +34 -0
  15. package/dist/components/TonalButton.svelte +34 -0
  16. package/dist/components/TonalButton.svelte.d.ts +36 -0
  17. package/dist/components/buttons/Button.svelte +34 -0
  18. package/dist/components/buttons/Button.svelte.d.ts +36 -0
  19. package/dist/components/buttons/ButtonWithIcon.svelte +0 -0
  20. package/dist/components/buttons/ButtonWithIcon.svelte.d.ts +26 -0
  21. package/dist/components/buttons/CheckButton.svelte +77 -0
  22. package/dist/components/buttons/CheckButton.svelte.d.ts +35 -0
  23. package/dist/components/buttons/IconButton.svelte +0 -0
  24. package/dist/components/buttons/IconButton.svelte.d.ts +26 -0
  25. package/dist/components/buttons/OutlinedButton.svelte +0 -0
  26. package/dist/components/buttons/OutlinedButton.svelte.d.ts +26 -0
  27. package/dist/components/buttons/OutlinedButtonWithIcon.svelte +0 -0
  28. package/dist/components/buttons/OutlinedButtonWithIcon.svelte.d.ts +26 -0
  29. package/dist/components/buttons/OutlinedIconButton.svelte +0 -0
  30. package/dist/components/buttons/OutlinedIconButton.svelte.d.ts +26 -0
  31. package/dist/components/buttons/TextButton.svelte +0 -0
  32. package/dist/components/buttons/TextButton.svelte.d.ts +26 -0
  33. package/dist/components/cards/Card.svelte +26 -0
  34. package/dist/components/cards/Card.svelte.d.ts +33 -0
  35. package/dist/components/cards/OutlinedCard.svelte +0 -0
  36. package/dist/components/cards/OutlinedCard.svelte.d.ts +26 -0
  37. package/dist/components/custom/CodeBlock.svelte +41 -0
  38. package/dist/components/custom/CodeBlock.svelte.d.ts +32 -0
  39. package/dist/components/layouts/Alignment.d.ts +20 -0
  40. package/dist/components/layouts/Alignment.js +20 -0
  41. package/dist/components/layouts/Arrangement.d.ts +23 -0
  42. package/dist/components/layouts/Arrangement.js +46 -0
  43. package/dist/components/layouts/Box.svelte +25 -0
  44. package/dist/components/layouts/Box.svelte.d.ts +32 -0
  45. package/dist/components/layouts/Column.svelte +23 -0
  46. package/dist/components/layouts/Column.svelte.d.ts +34 -0
  47. package/dist/components/layouts/LazyColumn.svelte +107 -0
  48. package/dist/components/layouts/LazyColumn.svelte.d.ts +39 -0
  49. package/dist/components/layouts/LazyRow.svelte +71 -0
  50. package/dist/components/layouts/LazyRow.svelte.d.ts +42 -0
  51. package/dist/components/layouts/Row.svelte +23 -0
  52. package/dist/components/layouts/Row.svelte.d.ts +34 -0
  53. package/dist/components/layouts/Scaffold.svelte +73 -0
  54. package/dist/components/layouts/Scaffold.svelte.d.ts +38 -0
  55. package/dist/components/menus/DropdownMenu.svelte +0 -0
  56. package/dist/components/menus/DropdownMenu.svelte.d.ts +26 -0
  57. package/dist/components/menus/DropdownMenuItem.svelte +0 -0
  58. package/dist/components/menus/DropdownMenuItem.svelte.d.ts +26 -0
  59. package/dist/components/motion/AnimatedContent.svelte +34 -0
  60. package/dist/components/motion/AnimatedContent.svelte.d.ts +31 -0
  61. package/dist/components/motion/AnimatedVisibility.svelte +59 -0
  62. package/dist/components/motion/AnimatedVisibility.svelte.d.ts +32 -0
  63. package/dist/components/textFields/BaseTextField.svelte +188 -0
  64. package/dist/components/textFields/BaseTextField.svelte.d.ts +41 -0
  65. package/dist/components/textFields/OutlinedTextField.svelte +64 -0
  66. package/dist/components/textFields/OutlinedTextField.svelte.d.ts +46 -0
  67. package/dist/components/textFields/TextField.svelte +49 -0
  68. package/dist/components/textFields/TextField.svelte.d.ts +46 -0
  69. package/dist/components/textFields/TextFieldColors.d.ts +12 -0
  70. package/dist/components/textFields/TextFieldColors.js +1 -0
  71. package/dist/components/textFields/TextFieldDefaults.d.ts +11 -0
  72. package/dist/components/textFields/TextFieldDefaults.js +42 -0
  73. package/dist/core/elevation/elevation.d.ts +1 -0
  74. package/dist/core/elevation/elevation.js +6 -0
  75. package/dist/core/helpers/painterResource.d.ts +12 -0
  76. package/dist/core/helpers/painterResource.js +22 -0
  77. package/dist/core/modifier/Modifier.d.ts +195 -0
  78. package/dist/core/modifier/Modifier.js +237 -0
  79. package/dist/core/modifier/ModifierImpl.d.ts +38 -0
  80. package/dist/core/modifier/ModifierImpl.js +214 -0
  81. package/dist/core/motion/AnimationSpec.d.ts +6 -0
  82. package/dist/core/motion/AnimationSpec.js +1 -0
  83. package/dist/core/motion/ContentTransition.d.ts +5 -0
  84. package/dist/core/motion/ContentTransition.js +1 -0
  85. package/dist/core/motion/applyAnimation.d.ts +0 -0
  86. package/dist/core/motion/applyAnimation.js +0 -0
  87. package/dist/core/motion/contentTransitions.d.ts +4 -0
  88. package/dist/core/motion/contentTransitions.js +22 -0
  89. package/dist/core/motion/transitions.d.ts +7 -0
  90. package/dist/core/motion/transitions.js +70 -0
  91. package/dist/core/navigation/NavBackStackEntry.d.ts +4 -0
  92. package/dist/core/navigation/NavBackStackEntry.js +1 -0
  93. package/dist/core/navigation/NavController.d.ts +9 -0
  94. package/dist/core/navigation/NavController.js +31 -0
  95. package/dist/core/navigation/NavHost.svelte +45 -0
  96. package/dist/core/navigation/NavHost.svelte.d.ts +31 -0
  97. package/dist/core/navigation/NavStore.d.ts +7 -0
  98. package/dist/core/navigation/NavStore.js +24 -0
  99. package/dist/core/navigation/Route.d.ts +3 -0
  100. package/dist/core/navigation/Route.js +1 -0
  101. package/dist/core/navigation/composable.d.ts +5 -0
  102. package/dist/core/navigation/composable.js +6 -0
  103. package/dist/core/navigation/rememberNavController.d.ts +2 -0
  104. package/dist/core/navigation/rememberNavController.js +4 -0
  105. package/dist/core/shapes/RoundedCornerShape.d.ts +13 -0
  106. package/dist/core/shapes/RoundedCornerShape.js +27 -0
  107. package/dist/core/shapes/Shape.d.ts +3 -0
  108. package/dist/core/shapes/Shape.js +1 -0
  109. package/dist/core/theme/ColorScheme.d.ts +17 -0
  110. package/dist/core/theme/ColorScheme.js +15 -0
  111. package/dist/core/theme/ComposeTheme.svelte +22 -0
  112. package/dist/core/theme/ComposeTheme.svelte.d.ts +32 -0
  113. package/dist/core/theme/Density.d.ts +5 -0
  114. package/dist/core/theme/Density.js +4 -0
  115. package/dist/core/theme/TextStyle.d.ts +19 -0
  116. package/dist/core/theme/TextStyle.js +17 -0
  117. package/dist/core/theme/colors.d.ts +15 -0
  118. package/dist/core/theme/colors.js +1 -0
  119. package/dist/core/theme/cssVars.d.ts +2 -0
  120. package/dist/core/theme/cssVars.js +29 -0
  121. package/dist/core/theme/defaults/darkColors.d.ts +2 -0
  122. package/dist/core/theme/defaults/darkColors.js +15 -0
  123. package/dist/core/theme/defaults/defaultTheme.d.ts +3 -0
  124. package/dist/core/theme/defaults/defaultTheme.js +40 -0
  125. package/dist/core/theme/defaults/lightColors.d.ts +2 -0
  126. package/dist/core/theme/defaults/lightColors.js +15 -0
  127. package/dist/core/theme/defaults/typography.d.ts +2 -0
  128. package/dist/core/theme/defaults/typography.js +120 -0
  129. package/dist/core/theme/elevation.d.ts +7 -0
  130. package/dist/core/theme/elevation.js +1 -0
  131. package/dist/core/theme/getCurrentColor.d.ts +1 -0
  132. package/dist/core/theme/getCurrentColor.js +9 -0
  133. package/dist/core/theme/resolve.d.ts +5 -0
  134. package/dist/core/theme/resolve.js +17 -0
  135. package/dist/core/theme/shapes.d.ts +7 -0
  136. package/dist/core/theme/shapes.js +1 -0
  137. package/dist/core/theme/spacing.d.ts +7 -0
  138. package/dist/core/theme/spacing.js +1 -0
  139. package/dist/core/theme/store.d.ts +7 -0
  140. package/dist/core/theme/store.js +15 -0
  141. package/dist/core/theme/systemTheme.d.ts +2 -0
  142. package/dist/core/theme/systemTheme.js +14 -0
  143. package/dist/core/theme/theme.d.ts +13 -0
  144. package/dist/core/theme/theme.js +1 -0
  145. package/dist/core/theme/typography.d.ts +24 -0
  146. package/dist/core/theme/typography.js +1 -0
  147. package/dist/index.d.ts +22 -45
  148. package/package.json +46 -12
  149. package/dist/index.js +0 -1164
  150. package/dist/vite.svg +0 -1
@@ -0,0 +1,195 @@
1
+ import { ModifierImpl } from "./ModifierImpl";
2
+ import type { BoxAlignment } from "../../components/layouts/Alignment";
3
+ import type { Shape } from "../shapes/Shape";
4
+ import type { ColorToken } from "../theme/ColorScheme";
5
+ /**
6
+ * Modifier
7
+ *
8
+ * Modifier is an immutable, chainable object used to decorate or augment
9
+ * a UI component.
10
+ *
11
+ * Inspired by Jetpack Compose Modifier.
12
+ *
13
+ * Usage:
14
+ * ```
15
+ * Modifier
16
+ * .padding(16)
17
+ * .fillMaxWidth()
18
+ * .background(ColorScheme.Surface)
19
+ * ```
20
+ */
21
+ export declare const Modifier: {
22
+ /**
23
+ * Returns an empty Modifier with no effects.
24
+ *
25
+ * Useful as a default value or starting point.
26
+ */
27
+ readonly empty: () => ModifierImpl;
28
+ /**
29
+ * Adds padding around the content.
30
+ *
31
+ * Can be used with:
32
+ * - a single number (uniform padding)
33
+ * - an object with directional values
34
+ *
35
+ * Examples:
36
+ * ```
37
+ * Modifier.padding(16)
38
+ * Modifier.padding({ top: 8, bottom: 8 })
39
+ * ```
40
+ */
41
+ readonly padding: (valueOrParams?: number | {
42
+ top?: number;
43
+ bottom?: number;
44
+ start?: number;
45
+ end?: number;
46
+ }, unit?: string) => ModifierImpl;
47
+ /**
48
+ * Adds horizontal padding (left and right).
49
+ */
50
+ readonly paddingHorizontal: (value: number) => ModifierImpl;
51
+ /**
52
+ * Adds a border around the component.
53
+ *
54
+ * Optionally accepts a Shape to match rounded corners.
55
+ *
56
+ * Examples:
57
+ * ```
58
+ * Modifier.border(1, ColorScheme.Outline)
59
+ * Modifier.border(2, "#FF0000", RoundedCornerShape(12))
60
+ * ```
61
+ */
62
+ readonly border: (width: number, color: string, shape?: Shape) => ModifierImpl;
63
+ /**
64
+ * Marks the component as clickable.
65
+ *
66
+ * This modifier applies interaction semantics such as:
67
+ * - pointer cursor
68
+ * - user-select disabling
69
+ *
70
+ * Note:
71
+ * The click handler must still be attached at the component level.
72
+ *
73
+ * Example:
74
+ * ```
75
+ * <Box
76
+ * on:click={onClick}
77
+ * modifier={Modifier.clickable(onClick)}
78
+ * />
79
+ * ```
80
+ */
81
+ readonly clickable: (onClick: () => void) => ModifierImpl;
82
+ /**
83
+ * Offsets the component visually without affecting its layout.
84
+ *
85
+ * Equivalent to Jetpack Compose Modifier.offset.
86
+ *
87
+ * Note:
88
+ * This uses CSS transform and does not affect surrounding layout.
89
+ */
90
+ readonly offset: (x: number, y: number) => ModifierImpl;
91
+ /**
92
+ * Enables vertical scrolling for the component.
93
+ *
94
+ * Useful for Column or large content containers.
95
+ */
96
+ readonly verticalScroll: (enabled?: boolean) => ModifierImpl;
97
+ /**
98
+ * Enables horizontal scrolling for the component.
99
+ */
100
+ readonly horizontalScroll: (enabled?: boolean) => ModifierImpl;
101
+ /**
102
+ * Adds vertical padding (top and bottom).
103
+ */
104
+ readonly paddingVertical: (value: number) => ModifierImpl;
105
+ /**
106
+ * Aligns the component inside a Box.
107
+ *
108
+ * ⚠️ This modifier is intended to be used only inside Box layouts.
109
+ *
110
+ * Example:
111
+ * ```
112
+ * Modifier.align(Alignment.Center)
113
+ * ```
114
+ */
115
+ readonly align: (alignment: BoxAlignment) => ModifierImpl;
116
+ /**
117
+ * Makes the component fill the maximum available width.
118
+ */
119
+ readonly fillMaxWidth: () => ModifierImpl;
120
+ /**
121
+ * Makes the component fill the maximum available height.
122
+ */
123
+ readonly fillMaxHeight: () => ModifierImpl;
124
+ /**
125
+ * Makes the component fill both width and height.
126
+ */
127
+ readonly fillMaxSize: () => ModifierImpl;
128
+ /**
129
+ * Sets a fixed height for the component.
130
+ *
131
+ * Accepts either a number (px by default) or a CSS size string.
132
+ */
133
+ readonly height: (value: number | string, unit?: string) => ModifierImpl;
134
+ /**
135
+ * Sets a fixed width for the component.
136
+ *
137
+ * Accepts either a number (px by default) or a CSS size string.
138
+ */
139
+ readonly width: (value: number | string, unit?: string) => ModifierImpl;
140
+ /**
141
+ * Applies a background color to the component.
142
+ *
143
+ * Accepts either:
144
+ * - A CSS color string (e.g. "#2A2A2A", "transparent")
145
+ * - A Compose color token (e.g. ColorScheme.Surface)
146
+ *
147
+ * Examples:
148
+ * ```
149
+ * Modifier.background(ColorScheme.Surface)
150
+ * Modifier.background("#121212")
151
+ * ```
152
+ */
153
+ readonly background: (color: ColorToken | string) => ModifierImpl;
154
+ /**
155
+ * Assigns a proportional weight to the component inside
156
+ * a Row or Column.
157
+ *
158
+ * Similar to flex-grow.
159
+ *
160
+ * Example:
161
+ * ```
162
+ * Modifier.weight(1)
163
+ * ```
164
+ */
165
+ readonly weight: (weight: number, fill?: boolean) => ModifierImpl;
166
+ /**
167
+ * Assigns weight without forcing fill behavior.
168
+ */
169
+ readonly weightNoFill: (weight: number) => ModifierImpl;
170
+ /**
171
+ * Adds top margin to the component.
172
+ */
173
+ readonly marginTop: (value: number, unit?: string) => ModifierImpl;
174
+ /**
175
+ * Clips the component using the provided Shape.
176
+ *
177
+ * Example:
178
+ * ```
179
+ * Modifier.clip(RoundedCornerShape(16))
180
+ * ```
181
+ */
182
+ readonly clip: (shape: Shape) => ModifierImpl;
183
+ /**
184
+ * Sets both width and height to the same value.
185
+ *
186
+ * Useful for icons and square components.
187
+ *
188
+ * Example:
189
+ * ```
190
+ * Modifier.size(24)
191
+ * ```
192
+ */
193
+ readonly size: (value: number | string, unit?: string) => ModifierImpl;
194
+ };
195
+ export type Modifier = ModifierImpl;
@@ -0,0 +1,237 @@
1
+ import { ModifierImpl } from "./ModifierImpl";
2
+ /**
3
+ * Modifier
4
+ *
5
+ * Modifier is an immutable, chainable object used to decorate or augment
6
+ * a UI component.
7
+ *
8
+ * Inspired by Jetpack Compose Modifier.
9
+ *
10
+ * Usage:
11
+ * ```
12
+ * Modifier
13
+ * .padding(16)
14
+ * .fillMaxWidth()
15
+ * .background(ColorScheme.Surface)
16
+ * ```
17
+ */
18
+ export var Modifier = {
19
+ /**
20
+ * Returns an empty Modifier with no effects.
21
+ *
22
+ * Useful as a default value or starting point.
23
+ */
24
+ empty: function () {
25
+ return new ModifierImpl();
26
+ },
27
+ /**
28
+ * Adds padding around the content.
29
+ *
30
+ * Can be used with:
31
+ * - a single number (uniform padding)
32
+ * - an object with directional values
33
+ *
34
+ * Examples:
35
+ * ```
36
+ * Modifier.padding(16)
37
+ * Modifier.padding({ top: 8, bottom: 8 })
38
+ * ```
39
+ */
40
+ padding: function (valueOrParams, unit) {
41
+ if (valueOrParams === void 0) { valueOrParams = 0; }
42
+ if (unit === void 0) { unit = 'px'; }
43
+ return new ModifierImpl().padding(valueOrParams, unit);
44
+ },
45
+ /**
46
+ * Adds horizontal padding (left and right).
47
+ */
48
+ paddingHorizontal: function (value) {
49
+ return new ModifierImpl().paddingHorizontal(value);
50
+ },
51
+ /**
52
+ * Adds a border around the component.
53
+ *
54
+ * Optionally accepts a Shape to match rounded corners.
55
+ *
56
+ * Examples:
57
+ * ```
58
+ * Modifier.border(1, ColorScheme.Outline)
59
+ * Modifier.border(2, "#FF0000", RoundedCornerShape(12))
60
+ * ```
61
+ */
62
+ border: function (width, color, shape) {
63
+ return new ModifierImpl().border(width, color, shape);
64
+ },
65
+ /**
66
+ * Marks the component as clickable.
67
+ *
68
+ * This modifier applies interaction semantics such as:
69
+ * - pointer cursor
70
+ * - user-select disabling
71
+ *
72
+ * Note:
73
+ * The click handler must still be attached at the component level.
74
+ *
75
+ * Example:
76
+ * ```
77
+ * <Box
78
+ * on:click={onClick}
79
+ * modifier={Modifier.clickable(onClick)}
80
+ * />
81
+ * ```
82
+ */
83
+ clickable: function (onClick) {
84
+ return new ModifierImpl().clickable(onClick);
85
+ },
86
+ /**
87
+ * Offsets the component visually without affecting its layout.
88
+ *
89
+ * Equivalent to Jetpack Compose Modifier.offset.
90
+ *
91
+ * Note:
92
+ * This uses CSS transform and does not affect surrounding layout.
93
+ */
94
+ offset: function (x, y) {
95
+ return new ModifierImpl().offset(x, y);
96
+ },
97
+ /**
98
+ * Enables vertical scrolling for the component.
99
+ *
100
+ * Useful for Column or large content containers.
101
+ */
102
+ verticalScroll: function (enabled) {
103
+ if (enabled === void 0) { enabled = true; }
104
+ return new ModifierImpl().verticalScroll(enabled);
105
+ },
106
+ /**
107
+ * Enables horizontal scrolling for the component.
108
+ */
109
+ horizontalScroll: function (enabled) {
110
+ if (enabled === void 0) { enabled = true; }
111
+ return new ModifierImpl().horizontalScroll(enabled);
112
+ },
113
+ /**
114
+ * Adds vertical padding (top and bottom).
115
+ */
116
+ paddingVertical: function (value) {
117
+ return new ModifierImpl().paddingVertical(value);
118
+ },
119
+ /**
120
+ * Aligns the component inside a Box.
121
+ *
122
+ * ⚠️ This modifier is intended to be used only inside Box layouts.
123
+ *
124
+ * Example:
125
+ * ```
126
+ * Modifier.align(Alignment.Center)
127
+ * ```
128
+ */
129
+ align: function (alignment) {
130
+ return new ModifierImpl().align(alignment);
131
+ },
132
+ /**
133
+ * Makes the component fill the maximum available width.
134
+ */
135
+ fillMaxWidth: function () {
136
+ return new ModifierImpl().fillMaxWidth();
137
+ },
138
+ /**
139
+ * Makes the component fill the maximum available height.
140
+ */
141
+ fillMaxHeight: function () {
142
+ return new ModifierImpl().fillMaxHeight();
143
+ },
144
+ /**
145
+ * Makes the component fill both width and height.
146
+ */
147
+ fillMaxSize: function () {
148
+ return new ModifierImpl().fillMaxSize();
149
+ },
150
+ /**
151
+ * Sets a fixed height for the component.
152
+ *
153
+ * Accepts either a number (px by default) or a CSS size string.
154
+ */
155
+ height: function (value, unit) {
156
+ if (unit === void 0) { unit = 'px'; }
157
+ return new ModifierImpl().height(value, unit);
158
+ },
159
+ /**
160
+ * Sets a fixed width for the component.
161
+ *
162
+ * Accepts either a number (px by default) or a CSS size string.
163
+ */
164
+ width: function (value, unit) {
165
+ if (unit === void 0) { unit = 'px'; }
166
+ return new ModifierImpl().width(value, unit);
167
+ },
168
+ /**
169
+ * Applies a background color to the component.
170
+ *
171
+ * Accepts either:
172
+ * - A CSS color string (e.g. "#2A2A2A", "transparent")
173
+ * - A Compose color token (e.g. ColorScheme.Surface)
174
+ *
175
+ * Examples:
176
+ * ```
177
+ * Modifier.background(ColorScheme.Surface)
178
+ * Modifier.background("#121212")
179
+ * ```
180
+ */
181
+ background: function (color) {
182
+ return new ModifierImpl().background(color);
183
+ },
184
+ /**
185
+ * Assigns a proportional weight to the component inside
186
+ * a Row or Column.
187
+ *
188
+ * Similar to flex-grow.
189
+ *
190
+ * Example:
191
+ * ```
192
+ * Modifier.weight(1)
193
+ * ```
194
+ */
195
+ weight: function (weight, fill) {
196
+ if (fill === void 0) { fill = true; }
197
+ return new ModifierImpl().weight(weight, fill);
198
+ },
199
+ /**
200
+ * Assigns weight without forcing fill behavior.
201
+ */
202
+ weightNoFill: function (weight) {
203
+ return this.weight(weight, false);
204
+ },
205
+ /**
206
+ * Adds top margin to the component.
207
+ */
208
+ marginTop: function (value, unit) {
209
+ if (unit === void 0) { unit = 'px'; }
210
+ return new ModifierImpl().marginTop(value, unit);
211
+ },
212
+ /**
213
+ * Clips the component using the provided Shape.
214
+ *
215
+ * Example:
216
+ * ```
217
+ * Modifier.clip(RoundedCornerShape(16))
218
+ * ```
219
+ */
220
+ clip: function (shape) {
221
+ return new ModifierImpl().clip(shape);
222
+ },
223
+ /**
224
+ * Sets both width and height to the same value.
225
+ *
226
+ * Useful for icons and square components.
227
+ *
228
+ * Example:
229
+ * ```
230
+ * Modifier.size(24)
231
+ * ```
232
+ */
233
+ size: function (value, unit) {
234
+ if (unit === void 0) { unit = "px"; }
235
+ return new ModifierImpl().size(value, unit);
236
+ }
237
+ };
@@ -0,0 +1,38 @@
1
+ import type { BoxAlignment } from "../../components/layouts/Alignment";
2
+ import type { Shape } from "../shapes/Shape";
3
+ import type { ColorToken } from "../theme/ColorScheme";
4
+ export type ModifierEntry = {
5
+ className?: string;
6
+ style?: string;
7
+ };
8
+ export declare class ModifierImpl {
9
+ private readonly entries;
10
+ constructor(entries?: ModifierEntry[]);
11
+ then(other: ModifierImpl): ModifierImpl;
12
+ paddingHorizontal(value: number): ModifierImpl;
13
+ verticalScroll(enabled?: boolean): ModifierImpl;
14
+ horizontalScroll(enabled?: boolean): ModifierImpl;
15
+ paddingVertical(value: number): ModifierImpl;
16
+ fillMaxWidth(): ModifierImpl;
17
+ fillMaxHeight(): ModifierImpl;
18
+ fillMaxSize(): ModifierImpl;
19
+ background(color: ColorToken | string): ModifierImpl;
20
+ weight(weight: number, fill?: boolean): ModifierImpl;
21
+ align(alignment: BoxAlignment): ModifierImpl;
22
+ padding(valueOrParams?: number | {
23
+ top?: number;
24
+ bottom?: number;
25
+ start?: number;
26
+ end?: number;
27
+ }, unit?: string): ModifierImpl;
28
+ width(value: number | string, unit?: string): ModifierImpl;
29
+ height(value: number | string, unit?: string): ModifierImpl;
30
+ marginTop(value: number, unit?: string): ModifierImpl;
31
+ clip(shape: Shape): ModifierImpl;
32
+ size(value: number | string, unit?: string): ModifierImpl;
33
+ offset(x: number, y: number): ModifierImpl;
34
+ clickable(onClick: () => void): ModifierImpl;
35
+ border(width: number, color: string, shape?: Shape): ModifierImpl;
36
+ toStyle(): string;
37
+ toClass(): string;
38
+ }
@@ -0,0 +1,214 @@
1
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
2
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
3
+ if (ar || !(i in from)) {
4
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
5
+ ar[i] = from[i];
6
+ }
7
+ }
8
+ return to.concat(ar || Array.prototype.slice.call(from));
9
+ };
10
+ import { resolveColor } from "../theme/resolve";
11
+ var ModifierImpl = /** @class */ (function () {
12
+ function ModifierImpl(entries) {
13
+ if (entries === void 0) { entries = []; }
14
+ this.entries = entries;
15
+ }
16
+ ModifierImpl.prototype.then = function (other) {
17
+ return new ModifierImpl(__spreadArray(__spreadArray([], this.entries, true), other.entries, true));
18
+ };
19
+ ModifierImpl.prototype.paddingHorizontal = function (value) {
20
+ return this.then(new ModifierImpl([
21
+ { style: "padding-left:".concat(value, "px;padding-right:").concat(value, "px;") },
22
+ ]));
23
+ };
24
+ ModifierImpl.prototype.verticalScroll = function (enabled) {
25
+ if (enabled === void 0) { enabled = true; }
26
+ return this.then(new ModifierImpl([{
27
+ style: enabled
28
+ ? "overflow-y:auto;overflow-x:hidden;-webkit-overflow-scrolling:touch;"
29
+ : ''
30
+ }]));
31
+ };
32
+ ModifierImpl.prototype.horizontalScroll = function (enabled) {
33
+ if (enabled === void 0) { enabled = true; }
34
+ return this.then(new ModifierImpl([{
35
+ style: enabled
36
+ ? "overflow-x:auto;overflow-y:hidden;-webkit-overflow-scrolling:touch;white-space:nowrap;"
37
+ : ''
38
+ }]));
39
+ };
40
+ ModifierImpl.prototype.paddingVertical = function (value) {
41
+ return this.then(new ModifierImpl([
42
+ { style: "padding-top:".concat(value, "px;padding-bottom:").concat(value, "px;") },
43
+ ]));
44
+ };
45
+ ModifierImpl.prototype.fillMaxWidth = function () {
46
+ return this.then(new ModifierImpl([{ style: "width:100%;" }]));
47
+ };
48
+ ModifierImpl.prototype.fillMaxHeight = function () {
49
+ return this.then(new ModifierImpl([{ style: "height:100%;" }]));
50
+ };
51
+ ModifierImpl.prototype.fillMaxSize = function () {
52
+ return this.then(new ModifierImpl([{ style: "width:100%;height:100%;" }]));
53
+ };
54
+ ModifierImpl.prototype.background = function (color) {
55
+ var resolved;
56
+ if (typeof color === "string" &&
57
+ (color.startsWith("#") ||
58
+ color.startsWith("rgb") ||
59
+ color.startsWith("hsl") ||
60
+ color === "transparent" ||
61
+ color === "currentColor")) {
62
+ // Color CSS directo
63
+ resolved = color;
64
+ }
65
+ else {
66
+ // Token de ComposeTheme
67
+ resolved = resolveColor(color);
68
+ }
69
+ return this.then(new ModifierImpl([
70
+ { style: "background:".concat(resolved, ";") }
71
+ ]));
72
+ };
73
+ ModifierImpl.prototype.weight = function (weight, fill) {
74
+ if (fill === void 0) { fill = true; }
75
+ if (weight <= 0) {
76
+ console.warn("Modifier.weight() debe ser > 0");
77
+ return this;
78
+ }
79
+ var styleParts = [
80
+ "flex-grow: ".concat(weight, ";"),
81
+ "flex-shrink: ".concat(fill ? 1 : 0, ";"),
82
+ "flex-basis: 0%;" // importante para que el peso funcione bien
83
+ ];
84
+ return this.then(new ModifierImpl([{ style: styleParts.join(" ") }]));
85
+ };
86
+ ModifierImpl.prototype.align = function (alignment) {
87
+ var parts = alignment.split(' ');
88
+ var horizontal = parts[0]; // flex-start, center, flex-end
89
+ var vertical = parts[1] || parts[0]; // para casos simples como "center"
90
+ var style = 'position: absolute;';
91
+ // Vertical
92
+ if (vertical === 'flex-start') {
93
+ style += 'top: 0;';
94
+ }
95
+ else if (vertical === 'flex-end') {
96
+ style += 'bottom: 0;';
97
+ }
98
+ else if (vertical === 'center') {
99
+ style += 'top: 50%; transform: translateY(-50%);';
100
+ }
101
+ // Horizontal
102
+ if (horizontal === 'flex-start') {
103
+ style += 'left: 0;';
104
+ }
105
+ else if (horizontal === 'flex-end') {
106
+ style += 'right: 0;';
107
+ }
108
+ else if (horizontal === 'center') {
109
+ style += 'left: 50%;';
110
+ // Combinar transform si ya hay translateY
111
+ if (style.includes('translateY')) {
112
+ style = style.replace('translateY(-50%)', 'translate(-50%, -50%)');
113
+ }
114
+ else {
115
+ style += 'transform: translateX(-50%);';
116
+ }
117
+ }
118
+ return this.then(new ModifierImpl([{ style: style }]));
119
+ };
120
+ ModifierImpl.prototype.padding = function (valueOrParams, unit) {
121
+ if (valueOrParams === void 0) { valueOrParams = 0; }
122
+ if (unit === void 0) { unit = 'px'; }
123
+ var style = '';
124
+ if (typeof valueOrParams === 'number') {
125
+ // Padding uniforme
126
+ style = "padding:".concat(valueOrParams).concat(unit, ";");
127
+ }
128
+ else {
129
+ // Padding direccional
130
+ var _a = valueOrParams.top, top = _a === void 0 ? 0 : _a, _b = valueOrParams.bottom, bottom = _b === void 0 ? 0 : _b, _c = valueOrParams.start, start = _c === void 0 ? 0 : _c, _d = valueOrParams.end, end = _d === void 0 ? 0 : _d;
131
+ style = "\n padding-top:".concat(top).concat(unit, ";\n padding-bottom:").concat(bottom).concat(unit, ";\n padding-left:").concat(start).concat(unit, ";\n //padding-right:").concat(end).concat(unit, ";\n ").trim();
132
+ }
133
+ return this.then(new ModifierImpl([{ style: style }]));
134
+ };
135
+ ModifierImpl.prototype.width = function (value, unit) {
136
+ if (unit === void 0) { unit = 'px'; }
137
+ var size = typeof value === 'number' ? "".concat(value).concat(unit) : value;
138
+ return this.then(new ModifierImpl([{ style: "width:".concat(size, ";") }]));
139
+ };
140
+ ModifierImpl.prototype.height = function (value, unit) {
141
+ if (unit === void 0) { unit = 'px'; }
142
+ var size = typeof value === 'number' ? "".concat(value).concat(unit) : value;
143
+ return this.then(new ModifierImpl([{ style: "height:".concat(size, ";") }]));
144
+ };
145
+ ModifierImpl.prototype.marginTop = function (value, unit) {
146
+ if (unit === void 0) { unit = 'px'; }
147
+ return this.then(new ModifierImpl([{ style: "margin-top:".concat(value).concat(unit, ";") }]));
148
+ };
149
+ ModifierImpl.prototype.clip = function (shape) {
150
+ return this.then(new ModifierImpl([
151
+ {
152
+ style: "\n border-radius:".concat(shape.toCssBorderRadius(), ";\n overflow:hidden;\n ")
153
+ }
154
+ ]));
155
+ };
156
+ ModifierImpl.prototype.size = function (value, unit) {
157
+ if (unit === void 0) { unit = "px"; }
158
+ if (value === null || value === undefined) {
159
+ return this;
160
+ }
161
+ var resolved;
162
+ if (typeof value === "number") {
163
+ if (isNaN(value))
164
+ return this;
165
+ resolved = "".concat(value).concat(unit);
166
+ }
167
+ else {
168
+ if (value.trim() === "")
169
+ return this;
170
+ resolved = value;
171
+ }
172
+ return this.then(new ModifierImpl([
173
+ {
174
+ style: "width:".concat(resolved, ";height:").concat(resolved, ";")
175
+ }
176
+ ]));
177
+ };
178
+ ModifierImpl.prototype.offset = function (x, y) {
179
+ if (isNaN(x) || isNaN(y))
180
+ return this;
181
+ return this.then(new ModifierImpl([
182
+ {
183
+ style: "transform: translate(".concat(x, "px, ").concat(y, "px);")
184
+ }
185
+ ]));
186
+ };
187
+ ModifierImpl.prototype.clickable = function (onClick) {
188
+ return this.then(new ModifierImpl([
189
+ {
190
+ className: "compose-clickable",
191
+ style: "\n cursor: pointer;\n user-select: none;\n "
192
+ }
193
+ ]));
194
+ };
195
+ ModifierImpl.prototype.border = function (width, color, shape) {
196
+ if (width <= 0)
197
+ return this;
198
+ var radius = shape ? shape.toCssBorderRadius() : undefined;
199
+ return this.then(new ModifierImpl([
200
+ {
201
+ style: "\n border:".concat(width, "px solid ").concat(color, ";\n ").concat(radius ? "border-radius:".concat(radius, ";") : "", "\n ")
202
+ }
203
+ ]));
204
+ };
205
+ // ---- consumo interno ----
206
+ ModifierImpl.prototype.toStyle = function () {
207
+ return this.entries.map(function (e) { var _a; return (_a = e.style) !== null && _a !== void 0 ? _a : ""; }).join("");
208
+ };
209
+ ModifierImpl.prototype.toClass = function () {
210
+ return this.entries.map(function (e) { var _a; return (_a = e.className) !== null && _a !== void 0 ? _a : ""; }).join(" ");
211
+ };
212
+ return ModifierImpl;
213
+ }());
214
+ export { ModifierImpl };
@@ -0,0 +1,6 @@
1
+ export type AnimationSpec = {
2
+ base: string;
3
+ from: string;
4
+ to: string;
5
+ duration: number;
6
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ export type ContentTransition = {
2
+ enter: string;
3
+ exit: string;
4
+ duration: number;
5
+ };
@@ -0,0 +1 @@
1
+ export {};