@danielito1996/compose-svelted 0.2.7 → 0.2.8-alpha01
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/README.md +196 -113
- package/dist/components/AppRoot.svelte +26 -14
- package/dist/components/Surface.svelte +29 -19
- package/dist/components/Text.svelte +37 -23
- package/dist/components/buttons/Button.svelte +66 -34
- package/dist/components/buttons/CheckButton.svelte +2 -2
- package/dist/components/layouts/Alignment.d.ts +40 -18
- package/dist/components/layouts/Alignment.js +40 -18
- package/dist/components/layouts/Arrangement.d.ts +27 -11
- package/dist/components/layouts/Arrangement.js +34 -41
- package/dist/components/layouts/Box.svelte +54 -25
- package/dist/components/layouts/Box.svelte.d.ts +8 -1
- package/dist/components/layouts/Column.svelte +52 -23
- package/dist/components/layouts/Column.svelte.d.ts +10 -2
- package/dist/components/layouts/LayoutContext.d.ts +1 -0
- package/dist/components/layouts/LayoutContext.js +1 -0
- package/dist/components/layouts/LazyColumn.svelte +12 -12
- package/dist/components/layouts/LazyRow.svelte +81 -45
- package/dist/components/layouts/LazyRow.svelte.d.ts +3 -6
- package/dist/components/layouts/Row.svelte +52 -23
- package/dist/components/layouts/Row.svelte.d.ts +10 -2
- package/dist/components/layouts/Scaffold.svelte +86 -73
- package/dist/components/layouts/Scaffold.svelte.d.ts +5 -1
- package/dist/components/layouts/resolveAlignment.d.ts +25 -0
- package/dist/components/layouts/resolveAlignment.js +48 -0
- package/dist/components/layouts/resolveFlexAlignSelf.d.ts +6 -0
- package/dist/components/layouts/resolveFlexAlignSelf.js +8 -0
- package/dist/components/motion/motion/AnimatedContent.svelte +41 -0
- package/dist/components/motion/{AnimatedContent.svelte.d.ts → motion/AnimatedContent.svelte.d.ts} +1 -1
- package/dist/components/motion/{AnimatedVisibility.svelte → motion/AnimatedVisibility.svelte} +3 -3
- package/dist/components/motion/{AnimatedVisibility.svelte.d.ts → motion/AnimatedVisibility.svelte.d.ts} +1 -1
- package/dist/components/motion/motion/AnimationSpec.d.ts +6 -0
- package/dist/components/motion/motion/AnimationSpec.js +1 -0
- package/dist/components/motion/motion/ContentTransition.d.ts +5 -0
- package/dist/components/motion/motion/ContentTransition.js +1 -0
- package/dist/components/motion/motion/applyAnimation.d.ts +0 -0
- package/dist/components/motion/motion/applyAnimation.js +0 -0
- package/dist/components/motion/motion/contentTransitions.d.ts +4 -0
- package/dist/components/motion/motion/contentTransitions.js +22 -0
- package/dist/components/motion/motion/transitions.d.ts +7 -0
- package/dist/components/motion/motion/transitions.js +70 -0
- package/dist/components/textFields/BaseTextField.svelte +4 -3
- package/dist/components/textFields/BaseTextField.svelte.d.ts +1 -0
- package/dist/components/textFields/OutlinedTextField.svelte +8 -7
- package/dist/components/textFields/TextField.svelte +8 -8
- package/dist/core/modifier/Modifier.d.ts +11 -171
- package/dist/core/modifier/Modifier.js +8 -170
- package/dist/core/modifier/ModifierImpl.d.ts +29 -17
- package/dist/core/modifier/ModifierImpl.js +112 -151
- package/dist/core/motion/AnimationSpec.d.ts +1 -6
- package/dist/core/motion/ContentTransition.d.ts +1 -5
- package/dist/core/motion/applyAnimation.d.ts +2 -0
- package/dist/core/motion/applyAnimation.js +3 -0
- package/dist/core/motion/contentTransitions.d.ts +1 -4
- package/dist/core/motion/contentTransitions.js +1 -22
- package/dist/core/motion/transitions.d.ts +1 -7
- package/dist/core/motion/transitions.js +1 -70
- package/dist/core/navigation/NavHost.svelte +46 -45
- package/dist/core/styles/baseline-safe.css +34 -0
- package/dist/core/styles/baseline.css +45 -0
- package/dist/core/theme/ColorScheme.d.ts +2 -0
- package/dist/core/theme/ColorScheme.js +2 -0
- package/dist/core/theme/ComposeTheme.svelte +36 -21
- package/dist/core/theme/colors.d.ts +2 -0
- package/dist/core/theme/defaults/darkColors.js +2 -0
- package/dist/core/theme/defaults/lightColors.js +2 -0
- package/dist/index.d.ts +48 -129
- package/dist/index.js +7 -2
- package/package.json +73 -58
- package/dist/components/motion/AnimatedContent.svelte +0 -34
|
@@ -27,13 +27,13 @@
|
|
|
27
27
|
export let colors: TextFieldColors = TextFieldDefaults.filledColors();
|
|
28
28
|
</script>
|
|
29
29
|
|
|
30
|
-
<BaseTextField
|
|
31
|
-
value={value}
|
|
32
|
-
onValueChange={onValueChange}
|
|
33
|
-
supportingText={supportingText}
|
|
34
|
-
enabled={enabled}
|
|
35
|
-
isError={isError}
|
|
36
|
-
floatingLabelScale={floatingLabelScale}
|
|
30
|
+
<BaseTextField
|
|
31
|
+
value={value}
|
|
32
|
+
onValueChange={onValueChange}
|
|
33
|
+
supportingText={supportingText}
|
|
34
|
+
enabled={enabled}
|
|
35
|
+
isError={isError}
|
|
36
|
+
floatingLabelScale={floatingLabelScale}
|
|
37
37
|
label={label}
|
|
38
38
|
density={density}
|
|
39
39
|
readOnly={readOnly}
|
|
@@ -46,4 +46,4 @@
|
|
|
46
46
|
>
|
|
47
47
|
<slot name="leadingIcon" slot="leadingIcon" />
|
|
48
48
|
<slot name="trailingIcon" slot="trailingIcon" />
|
|
49
|
-
</BaseTextField>
|
|
49
|
+
</BaseTextField>
|
|
@@ -1,195 +1,35 @@
|
|
|
1
1
|
import { ModifierImpl } from "./ModifierImpl";
|
|
2
|
-
import type { BoxAlignment } from "../../components/layouts/Alignment";
|
|
2
|
+
import type { BoxAlignment, HorizontalAlignment, VerticalAlignment } from "../../components/layouts/Alignment";
|
|
3
3
|
import type { Shape } from "../shapes/Shape";
|
|
4
4
|
import type { ColorToken } from "../theme/ColorScheme";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
* Inspired by Jetpack Compose Modifier.
|
|
12
|
-
*
|
|
13
|
-
* Usage:
|
|
14
|
-
* ```
|
|
15
|
-
* Modifier
|
|
16
|
-
* .padding(16)
|
|
17
|
-
* .fillMaxWidth()
|
|
18
|
-
* .background(ColorScheme.Surface)
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
5
|
+
type PaddingValue = number | {
|
|
6
|
+
top?: number;
|
|
7
|
+
bottom?: number;
|
|
8
|
+
start?: number;
|
|
9
|
+
end?: number;
|
|
10
|
+
};
|
|
21
11
|
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
12
|
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
|
-
*/
|
|
13
|
+
readonly padding: (valueOrParams?: PaddingValue, unit?: string) => ModifierImpl;
|
|
50
14
|
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
|
-
*/
|
|
15
|
+
readonly paddingVertical: (value: number) => ModifierImpl;
|
|
62
16
|
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
17
|
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
18
|
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
19
|
readonly verticalScroll: (enabled?: boolean) => ModifierImpl;
|
|
97
|
-
/**
|
|
98
|
-
* Enables horizontal scrolling for the component.
|
|
99
|
-
*/
|
|
100
20
|
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
|
-
*/
|
|
21
|
+
readonly align: (alignment: BoxAlignment | HorizontalAlignment | VerticalAlignment) => ModifierImpl;
|
|
119
22
|
readonly fillMaxWidth: () => ModifierImpl;
|
|
120
|
-
/**
|
|
121
|
-
* Makes the component fill the maximum available height.
|
|
122
|
-
*/
|
|
123
23
|
readonly fillMaxHeight: () => ModifierImpl;
|
|
124
|
-
/**
|
|
125
|
-
* Makes the component fill both width and height.
|
|
126
|
-
*/
|
|
127
24
|
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
25
|
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
26
|
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
27
|
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
28
|
readonly weight: (weight: number, fill?: boolean) => ModifierImpl;
|
|
166
|
-
/**
|
|
167
|
-
* Assigns weight without forcing fill behavior.
|
|
168
|
-
*/
|
|
169
29
|
readonly weightNoFill: (weight: number) => ModifierImpl;
|
|
170
|
-
/**
|
|
171
|
-
* Adds top margin to the component.
|
|
172
|
-
*/
|
|
173
30
|
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
31
|
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
32
|
readonly size: (value: number | string, unit?: string) => ModifierImpl;
|
|
194
33
|
};
|
|
195
34
|
export type Modifier = ModifierImpl;
|
|
35
|
+
export {};
|
|
@@ -1,235 +1,73 @@
|
|
|
1
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
2
|
export var Modifier = {
|
|
19
|
-
/**
|
|
20
|
-
* Returns an empty Modifier with no effects.
|
|
21
|
-
*
|
|
22
|
-
* Useful as a default value or starting point.
|
|
23
|
-
*/
|
|
24
3
|
empty: function () {
|
|
25
4
|
return new ModifierImpl();
|
|
26
5
|
},
|
|
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
6
|
padding: function (valueOrParams, unit) {
|
|
41
7
|
if (valueOrParams === void 0) { valueOrParams = 0; }
|
|
42
|
-
if (unit === void 0) { unit =
|
|
8
|
+
if (unit === void 0) { unit = "px"; }
|
|
43
9
|
return new ModifierImpl().padding(valueOrParams, unit);
|
|
44
10
|
},
|
|
45
|
-
/**
|
|
46
|
-
* Adds horizontal padding (left and right).
|
|
47
|
-
*/
|
|
48
11
|
paddingHorizontal: function (value) {
|
|
49
12
|
return new ModifierImpl().paddingHorizontal(value);
|
|
50
13
|
},
|
|
51
|
-
|
|
52
|
-
|
|
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
|
-
*/
|
|
14
|
+
paddingVertical: function (value) {
|
|
15
|
+
return new ModifierImpl().paddingVertical(value);
|
|
16
|
+
},
|
|
62
17
|
border: function (width, color, shape) {
|
|
63
18
|
return new ModifierImpl().border(width, color, shape);
|
|
64
19
|
},
|
|
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
20
|
clickable: function (onClick) {
|
|
84
21
|
return new ModifierImpl().clickable(onClick);
|
|
85
22
|
},
|
|
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
23
|
offset: function (x, y) {
|
|
95
24
|
return new ModifierImpl().offset(x, y);
|
|
96
25
|
},
|
|
97
|
-
/**
|
|
98
|
-
* Enables vertical scrolling for the component.
|
|
99
|
-
*
|
|
100
|
-
* Useful for Column or large content containers.
|
|
101
|
-
*/
|
|
102
26
|
verticalScroll: function (enabled) {
|
|
103
27
|
if (enabled === void 0) { enabled = true; }
|
|
104
28
|
return new ModifierImpl().verticalScroll(enabled);
|
|
105
29
|
},
|
|
106
|
-
/**
|
|
107
|
-
* Enables horizontal scrolling for the component.
|
|
108
|
-
*/
|
|
109
30
|
horizontalScroll: function (enabled) {
|
|
110
31
|
if (enabled === void 0) { enabled = true; }
|
|
111
32
|
return new ModifierImpl().horizontalScroll(enabled);
|
|
112
33
|
},
|
|
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
34
|
align: function (alignment) {
|
|
130
35
|
return new ModifierImpl().align(alignment);
|
|
131
36
|
},
|
|
132
|
-
/**
|
|
133
|
-
* Makes the component fill the maximum available width.
|
|
134
|
-
*/
|
|
135
37
|
fillMaxWidth: function () {
|
|
136
38
|
return new ModifierImpl().fillMaxWidth();
|
|
137
39
|
},
|
|
138
|
-
/**
|
|
139
|
-
* Makes the component fill the maximum available height.
|
|
140
|
-
*/
|
|
141
40
|
fillMaxHeight: function () {
|
|
142
41
|
return new ModifierImpl().fillMaxHeight();
|
|
143
42
|
},
|
|
144
|
-
/**
|
|
145
|
-
* Makes the component fill both width and height.
|
|
146
|
-
*/
|
|
147
43
|
fillMaxSize: function () {
|
|
148
44
|
return new ModifierImpl().fillMaxSize();
|
|
149
45
|
},
|
|
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
46
|
height: function (value, unit) {
|
|
156
|
-
if (unit === void 0) { unit =
|
|
47
|
+
if (unit === void 0) { unit = "px"; }
|
|
157
48
|
return new ModifierImpl().height(value, unit);
|
|
158
49
|
},
|
|
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
50
|
width: function (value, unit) {
|
|
165
|
-
if (unit === void 0) { unit =
|
|
51
|
+
if (unit === void 0) { unit = "px"; }
|
|
166
52
|
return new ModifierImpl().width(value, unit);
|
|
167
53
|
},
|
|
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
54
|
background: function (color) {
|
|
182
55
|
return new ModifierImpl().background(color);
|
|
183
56
|
},
|
|
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
57
|
weight: function (weight, fill) {
|
|
196
58
|
if (fill === void 0) { fill = true; }
|
|
197
59
|
return new ModifierImpl().weight(weight, fill);
|
|
198
60
|
},
|
|
199
|
-
/**
|
|
200
|
-
* Assigns weight without forcing fill behavior.
|
|
201
|
-
*/
|
|
202
61
|
weightNoFill: function (weight) {
|
|
203
|
-
return
|
|
62
|
+
return new ModifierImpl().weight(weight, false);
|
|
204
63
|
},
|
|
205
|
-
/**
|
|
206
|
-
* Adds top margin to the component.
|
|
207
|
-
*/
|
|
208
64
|
marginTop: function (value, unit) {
|
|
209
|
-
if (unit === void 0) { unit =
|
|
65
|
+
if (unit === void 0) { unit = "px"; }
|
|
210
66
|
return new ModifierImpl().marginTop(value, unit);
|
|
211
67
|
},
|
|
212
|
-
/**
|
|
213
|
-
* Clips the component using the provided Shape.
|
|
214
|
-
*
|
|
215
|
-
* Example:
|
|
216
|
-
* ```
|
|
217
|
-
* Modifier.clip(RoundedCornerShape(16))
|
|
218
|
-
* ```
|
|
219
|
-
*/
|
|
220
68
|
clip: function (shape) {
|
|
221
69
|
return new ModifierImpl().clip(shape);
|
|
222
70
|
},
|
|
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
71
|
size: function (value, unit) {
|
|
234
72
|
if (unit === void 0) { unit = "px"; }
|
|
235
73
|
return new ModifierImpl().size(value, unit);
|
|
@@ -1,38 +1,50 @@
|
|
|
1
|
-
import type { BoxAlignment } from "../../components/layouts/Alignment";
|
|
1
|
+
import type { BoxAlignment, HorizontalAlignment, VerticalAlignment } from "../../components/layouts/Alignment";
|
|
2
2
|
import type { Shape } from "../shapes/Shape";
|
|
3
3
|
import type { ColorToken } from "../theme/ColorScheme";
|
|
4
|
+
export type ModifierMeta = {
|
|
5
|
+
/** Alineación de este hijo dentro de su contenedor (place-self en grid, align-self en flex) */
|
|
6
|
+
align?: BoxAlignment | HorizontalAlignment | VerticalAlignment;
|
|
7
|
+
};
|
|
4
8
|
export type ModifierEntry = {
|
|
5
9
|
className?: string;
|
|
6
10
|
style?: string;
|
|
11
|
+
meta?: ModifierMeta;
|
|
12
|
+
};
|
|
13
|
+
type PaddingValue = number | {
|
|
14
|
+
top?: number;
|
|
15
|
+
bottom?: number;
|
|
16
|
+
start?: number;
|
|
17
|
+
end?: number;
|
|
7
18
|
};
|
|
8
19
|
export declare class ModifierImpl {
|
|
9
20
|
private readonly entries;
|
|
10
21
|
constructor(entries?: ModifierEntry[]);
|
|
11
22
|
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
23
|
fillMaxWidth(): ModifierImpl;
|
|
17
24
|
fillMaxHeight(): ModifierImpl;
|
|
18
25
|
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
26
|
width(value: number | string, unit?: string): ModifierImpl;
|
|
29
27
|
height(value: number | string, unit?: string): ModifierImpl;
|
|
28
|
+
size(value: number | string, unit?: string): ModifierImpl;
|
|
29
|
+
weight(weight: number, fill?: boolean): ModifierImpl;
|
|
30
|
+
padding(valueOrParams?: PaddingValue, unit?: string): ModifierImpl;
|
|
31
|
+
paddingHorizontal(value: number): ModifierImpl;
|
|
32
|
+
paddingVertical(value: number): ModifierImpl;
|
|
30
33
|
marginTop(value: number, unit?: string): ModifierImpl;
|
|
34
|
+
background(color: ColorToken | string): ModifierImpl;
|
|
35
|
+
border(width: number, color: string, shape?: Shape): ModifierImpl;
|
|
31
36
|
clip(shape: Shape): ModifierImpl;
|
|
32
|
-
size(value: number | string, unit?: string): ModifierImpl;
|
|
33
37
|
offset(x: number, y: number): ModifierImpl;
|
|
34
|
-
|
|
35
|
-
|
|
38
|
+
/**
|
|
39
|
+
* Sobreescribe la alineación de este hijo dentro de un contenedor (Box, Column, Row).
|
|
40
|
+
* Equivalente a Modifier.align() en Jetpack Compose.
|
|
41
|
+
*/
|
|
42
|
+
align(alignment: BoxAlignment | HorizontalAlignment | VerticalAlignment): ModifierImpl;
|
|
43
|
+
clickable(_onClick?: () => void): ModifierImpl;
|
|
44
|
+
verticalScroll(enabled?: boolean): ModifierImpl;
|
|
45
|
+
horizontalScroll(enabled?: boolean): ModifierImpl;
|
|
36
46
|
toStyle(): string;
|
|
37
47
|
toClass(): string;
|
|
48
|
+
getMeta(): ModifierMeta;
|
|
38
49
|
}
|
|
50
|
+
export {};
|