@danielito1996/compose-svelted 0.2.7-alpha04 → 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 +44 -41
- package/dist/components/AppRoot.svelte +26 -11
- 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 -47
- package/dist/components/layouts/Box.svelte.d.ts +19 -3
- package/dist/components/layouts/Column.svelte +52 -46
- package/dist/components/layouts/Column.svelte.d.ts +10 -2
- package/dist/components/layouts/Row.svelte +52 -46
- package/dist/components/layouts/Row.svelte.d.ts +10 -2
- package/dist/components/layouts/Scaffold.svelte +86 -53
- package/dist/components/layouts/Scaffold.svelte.d.ts +5 -2
- package/dist/components/layouts/resolveAlignment.d.ts +25 -4
- package/dist/components/layouts/resolveAlignment.js +46 -42
- package/dist/components/layouts/resolveFlexAlignSelf.d.ts +5 -1
- package/dist/components/layouts/resolveFlexAlignSelf.js +6 -8
- 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 +24 -6
- package/dist/core/modifier/ModifierImpl.js +96 -47
- 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 +44 -48
- 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 -3
- package/package.json +73 -59
- package/dist/components/motion/AnimatedContent.svelte +0 -34
|
@@ -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,14 +1,21 @@
|
|
|
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
4
|
export type ModifierMeta = {
|
|
5
|
-
align
|
|
5
|
+
/** Alineación de este hijo dentro de su contenedor (place-self en grid, align-self en flex) */
|
|
6
|
+
align?: BoxAlignment | HorizontalAlignment | VerticalAlignment;
|
|
6
7
|
};
|
|
7
8
|
export type ModifierEntry = {
|
|
8
9
|
className?: string;
|
|
9
10
|
style?: string;
|
|
10
11
|
meta?: ModifierMeta;
|
|
11
12
|
};
|
|
13
|
+
type PaddingValue = number | {
|
|
14
|
+
top?: number;
|
|
15
|
+
bottom?: number;
|
|
16
|
+
start?: number;
|
|
17
|
+
end?: number;
|
|
18
|
+
};
|
|
12
19
|
export declare class ModifierImpl {
|
|
13
20
|
private readonly entries;
|
|
14
21
|
constructor(entries?: ModifierEntry[]);
|
|
@@ -16,17 +23,28 @@ export declare class ModifierImpl {
|
|
|
16
23
|
fillMaxWidth(): ModifierImpl;
|
|
17
24
|
fillMaxHeight(): ModifierImpl;
|
|
18
25
|
fillMaxSize(): ModifierImpl;
|
|
26
|
+
width(value: number | string, unit?: string): ModifierImpl;
|
|
27
|
+
height(value: number | string, unit?: string): ModifierImpl;
|
|
28
|
+
size(value: number | string, unit?: string): ModifierImpl;
|
|
19
29
|
weight(weight: number, fill?: boolean): ModifierImpl;
|
|
20
|
-
padding(
|
|
30
|
+
padding(valueOrParams?: PaddingValue, unit?: string): ModifierImpl;
|
|
21
31
|
paddingHorizontal(value: number): ModifierImpl;
|
|
22
32
|
paddingVertical(value: number): ModifierImpl;
|
|
23
|
-
marginTop(value: number): ModifierImpl;
|
|
33
|
+
marginTop(value: number, unit?: string): ModifierImpl;
|
|
24
34
|
background(color: ColorToken | string): ModifierImpl;
|
|
25
35
|
border(width: number, color: string, shape?: Shape): ModifierImpl;
|
|
26
36
|
clip(shape: Shape): ModifierImpl;
|
|
27
|
-
|
|
28
|
-
|
|
37
|
+
offset(x: number, y: number): ModifierImpl;
|
|
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;
|
|
29
46
|
toStyle(): string;
|
|
30
47
|
toClass(): string;
|
|
31
48
|
getMeta(): ModifierMeta;
|
|
32
49
|
}
|
|
50
|
+
export {};
|
|
@@ -19,107 +19,156 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
19
19
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
20
20
|
};
|
|
21
21
|
import { resolveColor } from "../theme/resolve";
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
import { resolveBoxPlaceSelf, resolveColumnAlignSelf, resolveRowAlignSelf } from "../../components/layouts/resolveAlignment";
|
|
23
|
+
function toCssLength(value, unit) {
|
|
24
|
+
if (unit === void 0) { unit = "px"; }
|
|
25
|
+
return typeof value === "number" ? "".concat(value).concat(unit) : value;
|
|
26
|
+
}
|
|
25
27
|
var ModifierImpl = /** @class */ (function () {
|
|
26
28
|
function ModifierImpl(entries) {
|
|
27
29
|
if (entries === void 0) { entries = []; }
|
|
28
30
|
this.entries = entries;
|
|
29
31
|
}
|
|
30
|
-
/* -------- composición -------- */
|
|
31
32
|
ModifierImpl.prototype.then = function (other) {
|
|
32
33
|
return new ModifierImpl(__spreadArray(__spreadArray([], this.entries, true), other.entries, true));
|
|
33
34
|
};
|
|
34
|
-
/* -------- layout size -------- */
|
|
35
35
|
ModifierImpl.prototype.fillMaxWidth = function () {
|
|
36
|
-
|
|
36
|
+
// En flexbox, width:100% y align-self:stretch aseguran ocupar el ancho
|
|
37
|
+
return this.then(new ModifierImpl([{ style: "width:100%;align-self:stretch;" }]));
|
|
37
38
|
};
|
|
38
39
|
ModifierImpl.prototype.fillMaxHeight = function () {
|
|
39
|
-
|
|
40
|
+
// En flexbox (como Row), align-self:stretch es clave para llenar el alto transversal
|
|
41
|
+
// height:100% ayuda en contextos de bloque o flex-direction: column
|
|
42
|
+
return this.then(new ModifierImpl([{ style: "height:100%;align-self:stretch;" }]));
|
|
40
43
|
};
|
|
41
44
|
ModifierImpl.prototype.fillMaxSize = function () {
|
|
42
|
-
return this.then(new ModifierImpl([{ style: "width:100%;height:100%;" }]));
|
|
45
|
+
return this.then(new ModifierImpl([{ style: "width:100%;height:100%;align-self:stretch;" }]));
|
|
46
|
+
};
|
|
47
|
+
ModifierImpl.prototype.width = function (value, unit) {
|
|
48
|
+
if (unit === void 0) { unit = "px"; }
|
|
49
|
+
return this.then(new ModifierImpl([{ style: "width:".concat(toCssLength(value, unit), ";") }]));
|
|
50
|
+
};
|
|
51
|
+
ModifierImpl.prototype.height = function (value, unit) {
|
|
52
|
+
if (unit === void 0) { unit = "px"; }
|
|
53
|
+
return this.then(new ModifierImpl([{ style: "height:".concat(toCssLength(value, unit), ";") }]));
|
|
54
|
+
};
|
|
55
|
+
ModifierImpl.prototype.size = function (value, unit) {
|
|
56
|
+
if (unit === void 0) { unit = "px"; }
|
|
57
|
+
var cssValue = toCssLength(value, unit);
|
|
58
|
+
return this.then(new ModifierImpl([{ style: "width:".concat(cssValue, ";height:").concat(cssValue, ";") }]));
|
|
43
59
|
};
|
|
44
60
|
ModifierImpl.prototype.weight = function (weight, fill) {
|
|
45
61
|
if (fill === void 0) { fill = true; }
|
|
46
|
-
if (weight <= 0)
|
|
62
|
+
if (weight <= 0) {
|
|
47
63
|
return this;
|
|
64
|
+
}
|
|
48
65
|
return this.then(new ModifierImpl([
|
|
49
66
|
{
|
|
50
|
-
style: "
|
|
51
|
-
}
|
|
67
|
+
style: "flex-grow:".concat(weight, ";flex-shrink:").concat(fill ? 1 : 0, ";flex-basis:0%;")
|
|
68
|
+
}
|
|
52
69
|
]));
|
|
53
70
|
};
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
71
|
+
ModifierImpl.prototype.padding = function (valueOrParams, unit) {
|
|
72
|
+
if (valueOrParams === void 0) { valueOrParams = 0; }
|
|
73
|
+
if (unit === void 0) { unit = "px"; }
|
|
74
|
+
if (typeof valueOrParams === "number") {
|
|
75
|
+
return this.then(new ModifierImpl([{ style: "padding:".concat(valueOrParams).concat(unit, ";") }]));
|
|
76
|
+
}
|
|
77
|
+
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;
|
|
78
|
+
return this.then(new ModifierImpl([
|
|
79
|
+
{
|
|
80
|
+
style: [
|
|
81
|
+
"padding-top:".concat(top).concat(unit, ";"),
|
|
82
|
+
"padding-bottom:".concat(bottom).concat(unit, ";"),
|
|
83
|
+
"padding-left:".concat(start).concat(unit, ";"),
|
|
84
|
+
"padding-right:".concat(end).concat(unit, ";")
|
|
85
|
+
].join("")
|
|
86
|
+
}
|
|
87
|
+
]));
|
|
57
88
|
};
|
|
58
89
|
ModifierImpl.prototype.paddingHorizontal = function (value) {
|
|
59
90
|
return this.then(new ModifierImpl([
|
|
60
|
-
{ style: "padding-left:".concat(value, "px;padding-right:").concat(value, "px;") }
|
|
91
|
+
{ style: "padding-left:".concat(value, "px;padding-right:").concat(value, "px;") }
|
|
61
92
|
]));
|
|
62
93
|
};
|
|
63
94
|
ModifierImpl.prototype.paddingVertical = function (value) {
|
|
64
95
|
return this.then(new ModifierImpl([
|
|
65
|
-
{ style: "padding-top:".concat(value, "px;padding-bottom:").concat(value, "px;") }
|
|
96
|
+
{ style: "padding-top:".concat(value, "px;padding-bottom:").concat(value, "px;") }
|
|
66
97
|
]));
|
|
67
98
|
};
|
|
68
|
-
ModifierImpl.prototype.marginTop = function (value) {
|
|
69
|
-
|
|
99
|
+
ModifierImpl.prototype.marginTop = function (value, unit) {
|
|
100
|
+
if (unit === void 0) { unit = "px"; }
|
|
101
|
+
return this.then(new ModifierImpl([{ style: "margin-top:".concat(value).concat(unit, ";") }]));
|
|
70
102
|
};
|
|
71
|
-
/* -------- background / border -------- */
|
|
72
103
|
ModifierImpl.prototype.background = function (color) {
|
|
73
|
-
var resolved = typeof color === "string"
|
|
74
|
-
? color
|
|
75
|
-
: resolveColor(color);
|
|
104
|
+
var resolved = typeof color === "string" ? color : resolveColor(color);
|
|
76
105
|
return this.then(new ModifierImpl([{ style: "background:".concat(resolved, ";") }]));
|
|
77
106
|
};
|
|
78
107
|
ModifierImpl.prototype.border = function (width, color, shape) {
|
|
79
|
-
if (width <= 0)
|
|
108
|
+
if (width <= 0) {
|
|
80
109
|
return this;
|
|
110
|
+
}
|
|
111
|
+
var borderRadius = shape ? "border-radius:".concat(shape.toCssBorderRadius(), ";") : "";
|
|
81
112
|
return this.then(new ModifierImpl([
|
|
82
|
-
{
|
|
83
|
-
style: "\n border:".concat(width, "px solid ").concat(color, ";\n ").concat(shape ? "border-radius:".concat(shape.toCssBorderRadius(), ";") : "", "\n "),
|
|
84
|
-
},
|
|
113
|
+
{ style: "border:".concat(width, "px solid ").concat(color, ";").concat(borderRadius) }
|
|
85
114
|
]));
|
|
86
115
|
};
|
|
87
116
|
ModifierImpl.prototype.clip = function (shape) {
|
|
88
117
|
return this.then(new ModifierImpl([
|
|
89
|
-
{
|
|
90
|
-
style: "\n border-radius:".concat(shape.toCssBorderRadius(), ";\n overflow:hidden;\n "),
|
|
91
|
-
},
|
|
118
|
+
{ style: "border-radius:".concat(shape.toCssBorderRadius(), ";overflow:hidden;") }
|
|
92
119
|
]));
|
|
93
120
|
};
|
|
94
|
-
|
|
95
|
-
ModifierImpl.prototype.align = function (alignment) {
|
|
121
|
+
ModifierImpl.prototype.offset = function (x, y) {
|
|
96
122
|
return this.then(new ModifierImpl([
|
|
97
|
-
{
|
|
98
|
-
meta: { align: alignment }
|
|
99
|
-
}
|
|
123
|
+
{ style: "transform:translate(".concat(x, "px, ").concat(y, "px);") }
|
|
100
124
|
]));
|
|
101
125
|
};
|
|
102
|
-
|
|
103
|
-
|
|
126
|
+
/**
|
|
127
|
+
* Sobreescribe la alineación de este hijo dentro de un contenedor (Box, Column, Row).
|
|
128
|
+
* Equivalente a Modifier.align() en Jetpack Compose.
|
|
129
|
+
*/
|
|
130
|
+
ModifierImpl.prototype.align = function (alignment) {
|
|
131
|
+
return this.then(new ModifierImpl([{ meta: { align: alignment } }]));
|
|
132
|
+
};
|
|
133
|
+
ModifierImpl.prototype.clickable = function (_onClick) {
|
|
104
134
|
return this.then(new ModifierImpl([
|
|
105
|
-
{
|
|
106
|
-
className: "compose-clickable",
|
|
107
|
-
style: "cursor:pointer;user-select:none;",
|
|
108
|
-
},
|
|
135
|
+
{ className: "compose-clickable", style: "cursor:pointer;user-select:none;" }
|
|
109
136
|
]));
|
|
110
137
|
};
|
|
111
|
-
|
|
138
|
+
ModifierImpl.prototype.verticalScroll = function (enabled) {
|
|
139
|
+
if (enabled === void 0) { enabled = true; }
|
|
140
|
+
return enabled
|
|
141
|
+
? this.then(new ModifierImpl([{ style: "overflow-y:auto;" }]))
|
|
142
|
+
: this;
|
|
143
|
+
};
|
|
144
|
+
ModifierImpl.prototype.horizontalScroll = function (enabled) {
|
|
145
|
+
if (enabled === void 0) { enabled = true; }
|
|
146
|
+
return enabled
|
|
147
|
+
? this.then(new ModifierImpl([{ style: "overflow-x:auto;" }]))
|
|
148
|
+
: this;
|
|
149
|
+
};
|
|
112
150
|
ModifierImpl.prototype.toStyle = function () {
|
|
113
|
-
|
|
151
|
+
var meta = this.getMeta();
|
|
152
|
+
var alignStyle = "";
|
|
153
|
+
if (meta.align) {
|
|
154
|
+
var a = meta.align;
|
|
155
|
+
if (a._brand === 'BoxAlignment') {
|
|
156
|
+
alignStyle = resolveBoxPlaceSelf(a);
|
|
157
|
+
}
|
|
158
|
+
else if (a._brand === 'HorizontalAlignment') {
|
|
159
|
+
alignStyle = resolveColumnAlignSelf(a);
|
|
160
|
+
}
|
|
161
|
+
else if (a._brand === 'VerticalAlignment') {
|
|
162
|
+
alignStyle = resolveRowAlignSelf(a);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
return this.entries.map(function (entry) { var _a; return (_a = entry.style) !== null && _a !== void 0 ? _a : ""; }).join("") + alignStyle;
|
|
114
166
|
};
|
|
115
167
|
ModifierImpl.prototype.toClass = function () {
|
|
116
|
-
return this.entries.map(function (
|
|
168
|
+
return this.entries.map(function (entry) { var _a; return (_a = entry.className) !== null && _a !== void 0 ? _a : ""; }).filter(Boolean).join(" ");
|
|
117
169
|
};
|
|
118
170
|
ModifierImpl.prototype.getMeta = function () {
|
|
119
|
-
return this.entries.reduce(function (acc,
|
|
120
|
-
var _a;
|
|
121
|
-
return (__assign(__assign({}, acc), ((_a = e.meta) !== null && _a !== void 0 ? _a : {})));
|
|
122
|
-
}, {});
|
|
171
|
+
return this.entries.reduce(function (acc, entry) { var _a; return (__assign(__assign({}, acc), ((_a = entry.meta) !== null && _a !== void 0 ? _a : {}))); }, {});
|
|
123
172
|
};
|
|
124
173
|
return ModifierImpl;
|
|
125
174
|
}());
|
|
@@ -1,4 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare function slideHorizontal(): ContentTransition;
|
|
3
|
-
export declare function scaleFade(): ContentTransition;
|
|
4
|
-
export declare function fade(duration?: number): ContentTransition;
|
|
1
|
+
export { fade, scaleFade, slideHorizontal } from "../../components/motion/motion/contentTransitions";
|
|
@@ -1,22 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
return {
|
|
3
|
-
enter: "transition-transform duration-200 ease-out translate-x-0",
|
|
4
|
-
exit: "transition-transform duration-200 ease-in -translate-x-full",
|
|
5
|
-
duration: 200
|
|
6
|
-
};
|
|
7
|
-
}
|
|
8
|
-
export function scaleFade() {
|
|
9
|
-
return {
|
|
10
|
-
enter: "transition-all duration-220 ease-out opacity-100 scale-100",
|
|
11
|
-
exit: "transition-all duration-180 ease-in opacity-0 scale-95",
|
|
12
|
-
duration: 220
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
export function fade(duration) {
|
|
16
|
-
if (duration === void 0) { duration = 300; }
|
|
17
|
-
return {
|
|
18
|
-
enter: "animate-fade-in",
|
|
19
|
-
exit: "animate-fade-out",
|
|
20
|
-
duration: duration
|
|
21
|
-
};
|
|
22
|
-
}
|
|
1
|
+
export { fade, scaleFade, slideHorizontal } from "../../components/motion/motion/contentTransitions";
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare function fadeIn(duration?: number): AnimationSpec;
|
|
3
|
-
export declare function fadeOut(duration?: number): AnimationSpec;
|
|
4
|
-
export declare function scaleIn(duration?: number): AnimationSpec;
|
|
5
|
-
export declare function scaleOut(duration?: number): AnimationSpec;
|
|
6
|
-
export declare function slideIn(duration?: number, direction?: "left" | "right" | "up" | "down"): AnimationSpec;
|
|
7
|
-
export declare function slideOut(duration?: number, direction?: "left" | "right" | "up" | "down"): AnimationSpec;
|
|
1
|
+
export { fadeIn, fadeOut, scaleIn, scaleOut, slideIn, slideOut } from "../../components/motion/motion/transitions";
|
|
@@ -1,70 +1 @@
|
|
|
1
|
-
|
|
2
|
-
var defaultExit = 220;
|
|
3
|
-
export function fadeIn(duration) {
|
|
4
|
-
if (duration === void 0) { duration = defaultEnter; }
|
|
5
|
-
return {
|
|
6
|
-
base: "transition-opacity duration-[".concat(duration, "ms] ease-out"),
|
|
7
|
-
from: "opacity-0",
|
|
8
|
-
to: "opacity-100",
|
|
9
|
-
duration: duration
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
export function fadeOut(duration) {
|
|
13
|
-
if (duration === void 0) { duration = defaultExit; }
|
|
14
|
-
return {
|
|
15
|
-
base: "transition-opacity duration-[".concat(duration, "ms] ease-in"),
|
|
16
|
-
from: "opacity-100",
|
|
17
|
-
to: "opacity-0",
|
|
18
|
-
duration: duration
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
export function scaleIn(duration) {
|
|
22
|
-
if (duration === void 0) { duration = defaultEnter; }
|
|
23
|
-
return {
|
|
24
|
-
base: "transition-all duration-[".concat(duration, "ms] ease-out"),
|
|
25
|
-
from: "opacity-0 scale-95",
|
|
26
|
-
to: "opacity-100 scale-100",
|
|
27
|
-
duration: duration
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
export function scaleOut(duration) {
|
|
31
|
-
if (duration === void 0) { duration = defaultExit; }
|
|
32
|
-
return {
|
|
33
|
-
base: "transition-all duration-[".concat(duration, "ms] ease-in"),
|
|
34
|
-
from: "opacity-100 scale-100",
|
|
35
|
-
to: "opacity-0 scale-95",
|
|
36
|
-
duration: duration
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
export function slideIn(duration, direction) {
|
|
40
|
-
if (duration === void 0) { duration = defaultEnter; }
|
|
41
|
-
if (direction === void 0) { direction = "right"; }
|
|
42
|
-
var fromMap = {
|
|
43
|
-
left: "-translate-x-4",
|
|
44
|
-
right: "translate-x-4",
|
|
45
|
-
up: "-translate-y-4",
|
|
46
|
-
down: "translate-y-4"
|
|
47
|
-
};
|
|
48
|
-
return {
|
|
49
|
-
base: "transition-all duration-[".concat(duration, "ms] ease-out"),
|
|
50
|
-
from: "opacity-0 ".concat(fromMap[direction]),
|
|
51
|
-
to: "opacity-100 translate-x-0 translate-y-0",
|
|
52
|
-
duration: duration
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
export function slideOut(duration, direction) {
|
|
56
|
-
if (duration === void 0) { duration = defaultExit; }
|
|
57
|
-
if (direction === void 0) { direction = "right"; }
|
|
58
|
-
var toMap = {
|
|
59
|
-
left: "-translate-x-4",
|
|
60
|
-
right: "translate-x-4",
|
|
61
|
-
up: "-translate-y-4",
|
|
62
|
-
down: "translate-y-4"
|
|
63
|
-
};
|
|
64
|
-
return {
|
|
65
|
-
base: "transition-all duration-[".concat(duration, "ms] ease-in"),
|
|
66
|
-
from: "opacity-100 translate-x-0 translate-y-0",
|
|
67
|
-
to: "opacity-0 ".concat(toMap[direction]),
|
|
68
|
-
duration: duration
|
|
69
|
-
};
|
|
70
|
-
}
|
|
1
|
+
export { fadeIn, fadeOut, scaleIn, scaleOut, slideIn, slideOut } from "../../components/motion/motion/transitions";
|