@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,44 +1,48 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
1
|
+
/**
|
|
2
|
+
* resolveAlignment.ts
|
|
3
|
+
*
|
|
4
|
+
* Funciones puras que traducen los tokens de Alignment a CSS inline.
|
|
5
|
+
* Trabajan con el nuevo shape de BoxAlignment (objeto con .horizontal / .vertical).
|
|
6
|
+
*/
|
|
7
|
+
// ─── Box (CSS Grid stacking) ──────────────────────────────────────────────────
|
|
8
|
+
/**
|
|
9
|
+
* Resuelve el `place-items` de un Box stack container.
|
|
10
|
+
* CSS Grid: "align-items justify-items"
|
|
11
|
+
*/
|
|
12
|
+
export function resolveBoxPlaceItems(alignment) {
|
|
13
|
+
// grid place-items = "<vertical> <horizontal>"
|
|
14
|
+
var v = resolveCssAlign(alignment.vertical);
|
|
15
|
+
var h = resolveCssAlign(alignment.horizontal);
|
|
16
|
+
return "".concat(v, " ").concat(h);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Resuelve el `place-self` de un hijo de Box que sobreescribe su alineación.
|
|
20
|
+
* Usado por Modifier.align() dentro de un Box.
|
|
21
|
+
*/
|
|
22
|
+
export function resolveBoxPlaceSelf(alignment) {
|
|
23
|
+
var v = resolveCssAlign(alignment.vertical);
|
|
24
|
+
var h = resolveCssAlign(alignment.horizontal);
|
|
25
|
+
return "place-self:".concat(v, " ").concat(h, ";");
|
|
26
|
+
}
|
|
27
|
+
// ─── Flex (Column / Row cross-axis align-self) ────────────────────────────────
|
|
28
|
+
/**
|
|
29
|
+
* Resuelve `align-self` para un hijo de Column (eje horizontal).
|
|
30
|
+
*/
|
|
31
|
+
export function resolveColumnAlignSelf(alignment) {
|
|
32
|
+
return "align-self:".concat(alignment.cssValue, ";");
|
|
30
33
|
}
|
|
31
|
-
|
|
32
|
-
*
|
|
33
|
-
|
|
34
|
-
export function
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
:
|
|
42
|
-
|
|
43
|
-
|
|
34
|
+
/**
|
|
35
|
+
* Resuelve `align-self` para un hijo de Row (eje vertical).
|
|
36
|
+
*/
|
|
37
|
+
export function resolveRowAlignSelf(alignment) {
|
|
38
|
+
return "align-self:".concat(alignment.cssValue, ";");
|
|
39
|
+
}
|
|
40
|
+
// ─── Internos ─────────────────────────────────────────────────────────────────
|
|
41
|
+
/** Normaliza los valores CSS de flex a los equivalentes de grid */
|
|
42
|
+
function resolveCssAlign(value) {
|
|
43
|
+
switch (value) {
|
|
44
|
+
case 'flex-start': return 'start';
|
|
45
|
+
case 'flex-end': return 'end';
|
|
46
|
+
default: return 'center';
|
|
47
|
+
}
|
|
44
48
|
}
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
import { BoxAlignment } from
|
|
1
|
+
import type { BoxAlignment } from './Alignment';
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated Usar resolveBoxPlaceSelf desde resolveAlignment.ts
|
|
4
|
+
* Mantenido por compatibilidad interna durante la transición.
|
|
5
|
+
*/
|
|
2
6
|
export declare function resolveFlexAlignSelf(alignment: BoxAlignment): string;
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
+
import { resolveBoxPlaceSelf } from './resolveAlignment';
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated Usar resolveBoxPlaceSelf desde resolveAlignment.ts
|
|
4
|
+
* Mantenido por compatibilidad interna durante la transición.
|
|
5
|
+
*/
|
|
1
6
|
export function resolveFlexAlignSelf(alignment) {
|
|
2
|
-
|
|
3
|
-
var parts = alignment.split(" ");
|
|
4
|
-
var vertical = (_a = parts[1]) !== null && _a !== void 0 ? _a : parts[0];
|
|
5
|
-
if (vertical === "flex-start")
|
|
6
|
-
return "align-self:flex-start;";
|
|
7
|
-
if (vertical === "flex-end")
|
|
8
|
-
return "align-self:flex-end;";
|
|
9
|
-
return "align-self:center;";
|
|
7
|
+
return resolveBoxPlaceSelf(alignment);
|
|
10
8
|
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { ContentTransition } from "../../../core/motion/ContentTransition";
|
|
3
|
+
import { fade } from "../../../core/motion/contentTransitions";
|
|
4
|
+
|
|
5
|
+
export let targetState: any;
|
|
6
|
+
export let transition: ContentTransition = fade();
|
|
7
|
+
|
|
8
|
+
let currentKey = targetState;
|
|
9
|
+
let exiting = false;
|
|
10
|
+
let timeoutId: ReturnType<typeof setTimeout> | null = null;
|
|
11
|
+
|
|
12
|
+
$: if (targetState !== currentKey) {
|
|
13
|
+
exiting = true;
|
|
14
|
+
if (timeoutId) clearTimeout(timeoutId);
|
|
15
|
+
timeoutId = setTimeout(() => {
|
|
16
|
+
currentKey = targetState;
|
|
17
|
+
exiting = false;
|
|
18
|
+
timeoutId = null;
|
|
19
|
+
}, transition.duration);
|
|
20
|
+
}
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<!--
|
|
24
|
+
Contenedor de transición — ocupa todo el espacio del padre.
|
|
25
|
+
Se añade display:flex y flex-direction:column para asegurar que los hijos
|
|
26
|
+
con height:100% o flex:1 se expandan correctamente.
|
|
27
|
+
-->
|
|
28
|
+
<div style="position:relative;width:100%;height:100%;overflow:hidden;display:flex;flex-direction:column;">
|
|
29
|
+
<div
|
|
30
|
+
style={`
|
|
31
|
+
width: 100%;
|
|
32
|
+
height: 100%;
|
|
33
|
+
display: flex;
|
|
34
|
+
flex-direction: column;
|
|
35
|
+
transition: opacity ${transition.duration}ms ease, transform ${transition.duration}ms ease;
|
|
36
|
+
${exiting ? transition.exit : transition.enter}
|
|
37
|
+
`}
|
|
38
|
+
>
|
|
39
|
+
<slot />
|
|
40
|
+
</div>
|
|
41
|
+
</div>
|
package/dist/components/motion/{AnimatedContent.svelte.d.ts → motion/AnimatedContent.svelte.d.ts}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ContentTransition } from "
|
|
1
|
+
import type { ContentTransition } from "../../../core/motion/ContentTransition";
|
|
2
2
|
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
3
3
|
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
4
|
$$bindings?: Bindings;
|
package/dist/components/motion/{AnimatedVisibility.svelte → motion/AnimatedVisibility.svelte}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type { AnimationSpec } from "
|
|
3
|
-
import { fadeIn, fadeOut } from "
|
|
2
|
+
import type { AnimationSpec } from "../../../core/motion/AnimationSpec";
|
|
3
|
+
import { fadeIn, fadeOut } from "../../../core/motion/transitions";
|
|
4
4
|
|
|
5
5
|
export let visible: boolean;
|
|
6
6
|
|
|
@@ -56,4 +56,4 @@
|
|
|
56
56
|
<div class={classes}>
|
|
57
57
|
<slot />
|
|
58
58
|
</div>
|
|
59
|
-
{/if}
|
|
59
|
+
{/if}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AnimationSpec } from "
|
|
1
|
+
import type { AnimationSpec } from "../../../core/motion/AnimationSpec";
|
|
2
2
|
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
3
3
|
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
4
|
$$bindings?: Bindings;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export function slideHorizontal() {
|
|
2
|
+
return {
|
|
3
|
+
enter: "transform: translateX(0); opacity: 1;",
|
|
4
|
+
exit: "transform: translateX(-100%); opacity: 0;",
|
|
5
|
+
duration: 300
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
export function scaleFade() {
|
|
9
|
+
return {
|
|
10
|
+
enter: "transform: scale(1); opacity: 1;",
|
|
11
|
+
exit: "transform: scale(0.95); opacity: 0;",
|
|
12
|
+
duration: 220
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export function fade(duration) {
|
|
16
|
+
if (duration === void 0) { duration = 300; }
|
|
17
|
+
return {
|
|
18
|
+
enter: "opacity: 1;",
|
|
19
|
+
exit: "opacity: 0;",
|
|
20
|
+
duration: duration
|
|
21
|
+
};
|
|
22
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { AnimationSpec } from "./AnimationSpec";
|
|
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;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
var defaultEnter = 280;
|
|
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
|
+
}
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
export let onValueChange = (_value: string) => {};
|
|
14
14
|
export let label = "";
|
|
15
15
|
export let placeholder = "";
|
|
16
|
-
export let supportingText: string | undefined;
|
|
16
|
+
export let supportingText: string | undefined;
|
|
17
|
+
export let floatingLabelScale = 0.72;
|
|
17
18
|
|
|
18
19
|
export let singleLine = true;
|
|
19
20
|
export let textStyle: TextStyleToken = "bodyLarge";
|
|
@@ -111,7 +112,7 @@
|
|
|
111
112
|
top:${floating ? "2px" : "50%"};
|
|
112
113
|
transform:
|
|
113
114
|
translateY(${floating ? "0" : "-50%"})
|
|
114
|
-
scale(${floating ?
|
|
115
|
+
scale(${floating ? floatingLabelScale : 1});
|
|
115
116
|
color:${labelColor};
|
|
116
117
|
`}
|
|
117
118
|
>
|
|
@@ -185,4 +186,4 @@
|
|
|
185
186
|
{supportingText}
|
|
186
187
|
</div>
|
|
187
188
|
{/if}
|
|
188
|
-
</div>
|
|
189
|
+
</div>
|
|
@@ -40,12 +40,13 @@
|
|
|
40
40
|
${modifier.toStyle()}
|
|
41
41
|
`}
|
|
42
42
|
>
|
|
43
|
-
<BaseTextField
|
|
44
|
-
value={value}
|
|
45
|
-
supportingText={supportingText}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
43
|
+
<BaseTextField
|
|
44
|
+
value={value}
|
|
45
|
+
supportingText={supportingText}
|
|
46
|
+
floatingLabelScale={floatingLabelScale}
|
|
47
|
+
density={density}
|
|
48
|
+
readOnly={readOnly}
|
|
49
|
+
enabled={enabled}
|
|
49
50
|
isError={isError}
|
|
50
51
|
onValueChange={onValueChange}
|
|
51
52
|
label={label}
|
|
@@ -61,4 +62,4 @@
|
|
|
61
62
|
<slot name="leadingIcon" slot="leadingIcon" />
|
|
62
63
|
<slot name="trailingIcon" slot="trailingIcon" />
|
|
63
64
|
</BaseTextField>
|
|
64
|
-
</div>
|
|
65
|
+
</div>
|
|
@@ -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 {};
|