@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.
Files changed (65) hide show
  1. package/README.md +44 -41
  2. package/dist/components/AppRoot.svelte +26 -11
  3. package/dist/components/Surface.svelte +29 -19
  4. package/dist/components/Text.svelte +37 -23
  5. package/dist/components/buttons/Button.svelte +66 -34
  6. package/dist/components/buttons/CheckButton.svelte +2 -2
  7. package/dist/components/layouts/Alignment.d.ts +40 -18
  8. package/dist/components/layouts/Alignment.js +40 -18
  9. package/dist/components/layouts/Arrangement.d.ts +27 -11
  10. package/dist/components/layouts/Arrangement.js +34 -41
  11. package/dist/components/layouts/Box.svelte +54 -47
  12. package/dist/components/layouts/Box.svelte.d.ts +19 -3
  13. package/dist/components/layouts/Column.svelte +52 -46
  14. package/dist/components/layouts/Column.svelte.d.ts +10 -2
  15. package/dist/components/layouts/Row.svelte +52 -46
  16. package/dist/components/layouts/Row.svelte.d.ts +10 -2
  17. package/dist/components/layouts/Scaffold.svelte +86 -53
  18. package/dist/components/layouts/Scaffold.svelte.d.ts +5 -2
  19. package/dist/components/layouts/resolveAlignment.d.ts +25 -4
  20. package/dist/components/layouts/resolveAlignment.js +46 -42
  21. package/dist/components/layouts/resolveFlexAlignSelf.d.ts +5 -1
  22. package/dist/components/layouts/resolveFlexAlignSelf.js +6 -8
  23. package/dist/components/motion/motion/AnimatedContent.svelte +41 -0
  24. package/dist/components/motion/{AnimatedContent.svelte.d.ts → motion/AnimatedContent.svelte.d.ts} +1 -1
  25. package/dist/components/motion/{AnimatedVisibility.svelte → motion/AnimatedVisibility.svelte} +3 -3
  26. package/dist/components/motion/{AnimatedVisibility.svelte.d.ts → motion/AnimatedVisibility.svelte.d.ts} +1 -1
  27. package/dist/components/motion/motion/AnimationSpec.d.ts +6 -0
  28. package/dist/components/motion/motion/AnimationSpec.js +1 -0
  29. package/dist/components/motion/motion/ContentTransition.d.ts +5 -0
  30. package/dist/components/motion/motion/ContentTransition.js +1 -0
  31. package/dist/components/motion/motion/applyAnimation.d.ts +0 -0
  32. package/dist/components/motion/motion/applyAnimation.js +0 -0
  33. package/dist/components/motion/motion/contentTransitions.d.ts +4 -0
  34. package/dist/components/motion/motion/contentTransitions.js +22 -0
  35. package/dist/components/motion/motion/transitions.d.ts +7 -0
  36. package/dist/components/motion/motion/transitions.js +70 -0
  37. package/dist/components/textFields/BaseTextField.svelte +4 -3
  38. package/dist/components/textFields/BaseTextField.svelte.d.ts +1 -0
  39. package/dist/components/textFields/OutlinedTextField.svelte +8 -7
  40. package/dist/components/textFields/TextField.svelte +8 -8
  41. package/dist/core/modifier/Modifier.d.ts +11 -171
  42. package/dist/core/modifier/Modifier.js +8 -170
  43. package/dist/core/modifier/ModifierImpl.d.ts +24 -6
  44. package/dist/core/modifier/ModifierImpl.js +96 -47
  45. package/dist/core/motion/AnimationSpec.d.ts +1 -6
  46. package/dist/core/motion/ContentTransition.d.ts +1 -5
  47. package/dist/core/motion/applyAnimation.d.ts +2 -0
  48. package/dist/core/motion/applyAnimation.js +3 -0
  49. package/dist/core/motion/contentTransitions.d.ts +1 -4
  50. package/dist/core/motion/contentTransitions.js +1 -22
  51. package/dist/core/motion/transitions.d.ts +1 -7
  52. package/dist/core/motion/transitions.js +1 -70
  53. package/dist/core/navigation/NavHost.svelte +46 -45
  54. package/dist/core/styles/baseline-safe.css +34 -0
  55. package/dist/core/styles/baseline.css +44 -48
  56. package/dist/core/theme/ColorScheme.d.ts +2 -0
  57. package/dist/core/theme/ColorScheme.js +2 -0
  58. package/dist/core/theme/ComposeTheme.svelte +36 -21
  59. package/dist/core/theme/colors.d.ts +2 -0
  60. package/dist/core/theme/defaults/darkColors.js +2 -0
  61. package/dist/core/theme/defaults/lightColors.js +2 -0
  62. package/dist/index.d.ts +48 -129
  63. package/dist/index.js +7 -3
  64. package/package.json +73 -59
  65. package/dist/components/motion/AnimatedContent.svelte +0 -34
package/README.md CHANGED
@@ -97,6 +97,27 @@ Navigation without external routers.
97
97
  - Core V2 closed
98
98
  - Core V3 planned
99
99
 
100
+ ## Project Zones
101
+
102
+ - `src/lib`: publishable library source.
103
+ - `playground`: local app for developing and validating the library against live source changes.
104
+ - `src/App.svelte` and `src/samples`: legacy examples, not part of the active library/playground workflow.
105
+
106
+ ## Development Commands
107
+
108
+ ```bash
109
+ npm install
110
+ npm run dev
111
+ npm run build
112
+ npm run check
113
+ npm run playground:build
114
+ ```
115
+
116
+ - `npm run dev`: starts the playground.
117
+ - `npm run build`: packages the library into `dist/`.
118
+ - `npm run check`: type-checks the playground against the current library source.
119
+ - `playground/vite.config.ts` aliases `@danielito1996/compose-svelted` to `src/lib/index.ts`, so playground changes reflect library source immediately.
120
+
100
121
  ---
101
122
 
102
123
  ## 🔮 Roadmap
@@ -110,44 +131,31 @@ Navigation without external routers.
110
131
 
111
132
  ## ⚠️ CSS Baseline (Required)
112
133
 
113
- Compose Svelted assumes a neutral CSS baseline.
134
+ Compose Svelted is **layout-deterministic**, assumes a neutral CSS baseline.
114
135
 
115
136
  You MUST include the following reset in your app:
116
137
 
117
- ```css
118
- *,
119
- *::before,
120
- *::after {
121
- box-sizing: border-box;
122
- }
123
-
124
- html,
125
- body {
126
- margin: 0;
127
- padding: 0;
128
- min-height: 100vh;
129
- }
130
- ```
131
-
132
- ## 📄 License
138
+ To avoid layout regressions in existing apps, use one of these two paths:
133
139
 
134
- MIT
140
+ ### Path A (Primary): import baseline from the package
135
141
 
136
- ---
142
+ - **Strict baseline** (Compose-like deterministic behavior):
137
143
 
138
- ## ⚠️ CSS Baseline Requirement (Important)
144
+ ```ts
145
+ import "@danielito1996/compose-svelted/baseline.css";
146
+ ```
139
147
 
140
- Compose Svelted is **layout-deterministic**.
148
+ - **Safe baseline** (less intrusive for existing projects):
141
149
 
142
- To guarantee consistent and predictable behavior of layout components such as
143
- `Box`, `Column`, `Row`, `Surface`, `Scaffold`, and navigation containers,
144
- a **neutral CSS baseline is required** in the host application.
150
+ ```ts
151
+ import "@danielito1996/compose-svelted/baseline-safe.css";
152
+ ```
145
153
 
146
- This is **intentional** and mirrors the contract-based approach of **Jetpack Compose**.
154
+ Use `baseline-safe.css` if your app already has strong global styles and you want minimal interference.
147
155
 
148
- ### Required baseline
156
+ ### Path B (Alternative): do not import baseline, adapt your own `app.css`
149
157
 
150
- You must include the following reset in your global styles:
158
+ If you prefer full control, keep your app stylesheet and ensure at least:
151
159
 
152
160
  ```css
153
161
  *,
@@ -156,14 +164,20 @@ You must include the following reset in your global styles:
156
164
  box-sizing: border-box;
157
165
  }
158
166
 
159
- html,
160
- body {
167
+ html, body, #app {
168
+ width: 100%;
169
+ height: 100%;
161
170
  margin: 0;
162
171
  padding: 0;
163
- min-height: 100vh;
164
172
  }
165
173
  ```
166
174
 
175
+ To guarantee consistent and predictable behavior of layout components such as
176
+ `Box`, `Column`, `Row`, `Surface`, `Scaffold`, and navigation containers,
177
+ a **neutral CSS baseline is required** in the host application.
178
+
179
+ This is **intentional** and mirrors the contract-based approach of **Jetpack Compose**.
180
+
167
181
  ### Why this matters
168
182
 
169
183
  Compose Svelted does **not**:
@@ -180,14 +194,3 @@ Compose Svelted **does not require Tailwind CSS**.
180
194
 
181
195
  Tailwind is used internally as an implementation detail for predictable styling,
182
196
  but consumers of the library are **not required** to install or configure Tailwind.
183
-
184
- ### Future (Core V3)
185
-
186
- A reusable `baseline.css` helper will be provided as an **optional import**
187
- to simplify adoption:
188
-
189
- ```ts
190
- import "@danielito1996/compose-svelted/baseline.css";
191
- ```
192
-
193
- This will remain optional and opt-in.
@@ -1,12 +1,27 @@
1
- <script lang="ts">
2
- import { Modifier } from "../core/modifier/Modifier";
3
-
4
- export let modifier: Modifier = Modifier.empty();
5
- </script>
6
-
7
- <div
8
- class="compose-relative"
9
- style={`width:100vw;height:100vh;${modifier.toStyle()}`}
10
- >
11
- <slot />
1
+ <script lang="ts">
2
+ import { Modifier } from "../core/modifier/Modifier";
3
+
4
+ export let modifier: Modifier = Modifier.empty();
5
+ </script>
6
+
7
+ <!--
8
+ AppRoot — ancla de toda la aplicación.
9
+
10
+ Ocupa el 100% del contenedor padre (que gracias a baseline.css es el viewport).
11
+ overflow:hidden garantiza que ningún hijo desborde el viewport accidentalmente.
12
+ position:relative es el contexto de posicionamiento para capas absolutas internas.
13
+ Se añade display:flex para actuar como raíz sólida para el crecimiento de hijos.
14
+ -->
15
+ <div
16
+ class="cs-relative"
17
+ style={`
18
+ display: flex;
19
+ flex-direction: column;
20
+ width: 100%;
21
+ height: 100%;
22
+ overflow: hidden;
23
+ ${modifier.toStyle()}
24
+ `}
25
+ >
26
+ <slot />
12
27
  </div>
@@ -1,19 +1,29 @@
1
- <script lang="ts">
2
- import { Modifier } from "../core/modifier/Modifier";
3
- import { resolveColor } from "../core/theme/resolve";
4
- import type { ColorToken } from "../core/theme/ColorScheme";
5
-
6
- // default = no-op modifier
7
- export let modifier: Modifier = Modifier.empty();
8
- export let color: ColorToken = "surface";
9
- </script>
10
-
11
- <div
12
- class="block"
13
- style={`
14
- background:${resolveColor(color)};
15
- ${modifier.toStyle()}
16
- `}
17
- >
18
- <slot />
19
- </div>
1
+ <script lang="ts">
2
+ import { Modifier } from "../core/modifier/Modifier";
3
+ import { resolveColor } from "../core/theme/resolve";
4
+ import type { ColorToken } from "../core/theme/ColorScheme";
5
+
6
+ export let modifier: Modifier = Modifier.empty();
7
+ export let color: ColorToken = "surface";
8
+ </script>
9
+
10
+ <!--
11
+ Surface — Contenedor base de Material 3.
12
+ Sin dependencias de Tailwind.
13
+ -->
14
+ <div
15
+ class="cs-surface"
16
+ style={`
17
+ background:${resolveColor(color)};
18
+ ${modifier.toStyle()}
19
+ `}
20
+ >
21
+ <slot />
22
+ </div>
23
+
24
+ <style>
25
+ .cs-surface {
26
+ display: block;
27
+ box-sizing: border-box;
28
+ }
29
+ </style>
@@ -1,23 +1,37 @@
1
- <script lang="ts">
2
- import { Modifier } from "../core/modifier/Modifier";
3
- import { resolveTextStyle, resolveColor } from "../core/theme/resolve";
4
- import type { TextStyleToken } from "../core/theme/TextStyle";
5
- import { ColorScheme, type ColorToken } from "../core/theme/ColorScheme";
6
-
7
- export let modifier: Modifier = Modifier.empty();
8
- export let textStyle: TextStyleToken = "bodyMedium";
9
-
10
- // Aceptamos token o string directo
11
- export let color: ColorToken | string = "onSurface"; // string literal por defecto
12
-
13
- // Usamos la misma lógica que Surface (que ya funciona)
14
- $: resolvedColor = typeof color === "string" ? resolveColor(color as ColorToken) : color;
15
- </script>
16
-
17
- <p class="block m-0" style={`
18
- ${resolveTextStyle(textStyle)};
19
- color: ${resolvedColor};
20
- ${modifier.toStyle()}
21
- `}>
22
- <slot />
23
- </p>
1
+ <script lang="ts">
2
+ import { Modifier } from "../core/modifier/Modifier";
3
+ import { resolveTextStyle, resolveColor } from "../core/theme/resolve";
4
+ import type { TextStyleToken } from "../core/theme/TextStyle";
5
+ import { ColorScheme, type ColorToken } from "../core/theme/ColorScheme";
6
+
7
+ export let modifier: Modifier = Modifier.empty();
8
+ export let textStyle: TextStyleToken = "bodyMedium";
9
+
10
+ // Aceptamos token o string directo
11
+ export let color: ColorToken | string = "onSurface";
12
+
13
+ $: resolvedColor = typeof color === "string" ? resolveColor(color as ColorToken) : color;
14
+ </script>
15
+
16
+ <!--
17
+ Text Componente Material 3 independiente.
18
+ No depende de Tailwind.
19
+ -->
20
+ <p
21
+ class="cs-text"
22
+ style={`
23
+ ${resolveTextStyle(textStyle)};
24
+ color: ${resolvedColor};
25
+ ${modifier.toStyle()}
26
+ `}
27
+ >
28
+ <slot />
29
+ </p>
30
+
31
+ <style>
32
+ .cs-text {
33
+ display: block;
34
+ margin: 0;
35
+ padding: 0;
36
+ }
37
+ </style>
@@ -1,34 +1,66 @@
1
- <script lang="ts">
2
- import { Modifier } from "../../core/modifier/Modifier";
3
- import { resolveColor } from "../../core/theme/resolve";
4
- import { ColorScheme, type ColorToken } from "../../core/theme/ColorScheme";
5
-
6
- export let onClick: () => void = () => {};
7
- export let modifier: Modifier = Modifier.empty();
8
-
9
- export let color: ColorToken | string = "primary";
10
- export let onColor: ColorToken | string = "onPrimary";
11
-
12
- export let shape: "none" | "extraSmall" | "small" | "medium" | "large" = "large";
13
- export let elevation: "level0" | "level1" | "level2" | "level3" | "level4" = "level1";
14
-
15
- $: backgroundColor = typeof color === "string" ? resolveColor(color as ColorToken) : color;
16
- $: contentColor = typeof onColor === "string" ? resolveColor(onColor as ColorToken) : onColor;
17
- $: borderRadius = `var(--md-sys-shape-${shape})`;
18
- $: boxShadow = `var(--md-sys-elevation-${elevation})`;
19
- </script>
20
-
21
- <button
22
- on:click={onClick}
23
- class="border-0 cursor-pointer inline-flex items-center justify-center gap-8 font-medium tracking-wider transition-all hover:opacity-90 active:scale-95"
24
- style={`
25
- background: ${backgroundColor};
26
- color: ${contentColor};
27
- border-radius: ${borderRadius};
28
- box-shadow: ${boxShadow};
29
- padding: 10px 24px; <!-- Padding moderado: vertical 10px, horizontal 24px (como Compose) -->
30
- ${modifier.toStyle()}
31
- `}
32
- >
33
- <slot />
34
- </button>
1
+ <script lang="ts">
2
+ import { Modifier } from "../../core/modifier/Modifier";
3
+ import { resolveColor } from "../../core/theme/resolve";
4
+ import { ColorScheme, type ColorToken } from "../../core/theme/ColorScheme";
5
+
6
+ export let onClick: () => void = () => {};
7
+ export let modifier: Modifier = Modifier.empty();
8
+
9
+ export let color: ColorToken | string = "primary";
10
+ export let onColor: ColorToken | string = "onPrimary";
11
+
12
+ export let shape: "none" | "extraSmall" | "small" | "medium" | "large" = "large";
13
+ export let elevation: "level0" | "level1" | "level2" | "level3" | "level4" = "level1";
14
+
15
+ $: backgroundColor = typeof color === "string" ? resolveColor(color as ColorToken) : color;
16
+ $: contentColor = typeof onColor === "string" ? resolveColor(onColor as ColorToken) : onColor;
17
+ $: borderRadius = `var(--md-sys-shape-${shape})`;
18
+ $: boxShadow = `var(--md-sys-elevation-${elevation})`;
19
+ </script>
20
+
21
+ <!--
22
+ Button — Componente Material 3 independiente.
23
+ No depende de Tailwind.
24
+ -->
25
+ <button
26
+ on:click={onClick}
27
+ class="cs-button"
28
+ style={`
29
+ background: ${backgroundColor};
30
+ color: ${contentColor};
31
+ border-radius: ${borderRadius};
32
+ box-shadow: ${boxShadow};
33
+ ${modifier.toStyle()}
34
+ `}
35
+ >
36
+ <slot />
37
+ </button>
38
+
39
+ <style>
40
+ .cs-button {
41
+ display: inline-flex;
42
+ align-items: center;
43
+ justify-content: center;
44
+ border: none;
45
+ cursor: pointer;
46
+ padding: 10px 24px;
47
+ gap: 8px;
48
+ font-family: inherit;
49
+ font-weight: 500;
50
+ letter-spacing: 0.1px;
51
+ transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
52
+ user-select: none;
53
+ -webkit-tap-highlight-color: transparent;
54
+ outline: none;
55
+ }
56
+
57
+ .cs-button:hover {
58
+ opacity: 0.92;
59
+ box-shadow: var(--md-sys-elevation-level2);
60
+ }
61
+
62
+ .cs-button:active {
63
+ transform: scale(0.97);
64
+ opacity: 0.85;
65
+ }
66
+ </style>
@@ -3,7 +3,7 @@
3
3
  import { ColorScheme } from "../../core/theme/ColorScheme";
4
4
  import { resolveColor } from "../../core/theme/resolve";
5
5
  import { RoundedCornerShape } from "../../core/shapes/RoundedCornerShape";
6
- import AnimatedVisibility from "../motion/AnimatedVisibility.svelte";
6
+ import AnimatedVisibility from "../motion/motion/AnimatedVisibility.svelte";
7
7
  import { scaleIn, scaleOut } from "../../core/motion/transitions";
8
8
  import type { Shape } from "../../core/shapes/Shape";
9
9
 
@@ -74,4 +74,4 @@
74
74
 
75
75
  <!-- Content -->
76
76
  <slot />
77
- </button>
77
+ </button>
@@ -1,20 +1,42 @@
1
+ /**
2
+ * Alignment — tokens de alineación type-safe con branded types.
3
+ *
4
+ * Los objetos son opacos: nunca se puede pasar un VerticalAlignment donde
5
+ * se espera un HorizontalAlignment, aunque ambos representen "center" en CSS.
6
+ *
7
+ * Filosofía Jetpack Compose:
8
+ * - HorizontalAlignment → eje cross de Column
9
+ * - VerticalAlignment → eje cross de Row
10
+ * - BoxAlignment → alineación compuesta para Box (stack)
11
+ */
12
+ export type HorizontalAlignment = {
13
+ readonly _brand: 'HorizontalAlignment';
14
+ readonly cssValue: string;
15
+ };
16
+ export type VerticalAlignment = {
17
+ readonly _brand: 'VerticalAlignment';
18
+ readonly cssValue: string;
19
+ };
20
+ /** Alineación compuesta para Box — encapsula horizontal + vertical */
21
+ export type BoxAlignment = {
22
+ readonly _brand: 'BoxAlignment';
23
+ readonly horizontal: string;
24
+ readonly vertical: string;
25
+ };
1
26
  export declare const Alignment: {
2
- readonly Start: "flex-start";
3
- readonly CenterHorizontally: "center";
4
- readonly End: "flex-end";
5
- readonly Top: "flex-start";
6
- readonly CenterVertically: "center";
7
- readonly Bottom: "flex-end";
8
- readonly TopStart: "flex-start flex-start";
9
- readonly TopCenter: "center flex-start";
10
- readonly TopEnd: "flex-end flex-start";
11
- readonly CenterStart: "flex-start center";
12
- readonly Center: "center center";
13
- readonly CenterEnd: "flex-end center";
14
- readonly BottomStart: "flex-start flex-end";
15
- readonly BottomCenter: "center flex-end";
16
- readonly BottomEnd: "flex-end flex-end";
27
+ readonly Start: HorizontalAlignment;
28
+ readonly CenterHorizontally: HorizontalAlignment;
29
+ readonly End: HorizontalAlignment;
30
+ readonly Top: VerticalAlignment;
31
+ readonly CenterVertically: VerticalAlignment;
32
+ readonly Bottom: VerticalAlignment;
33
+ readonly TopStart: BoxAlignment;
34
+ readonly TopCenter: BoxAlignment;
35
+ readonly TopEnd: BoxAlignment;
36
+ readonly CenterStart: BoxAlignment;
37
+ readonly Center: BoxAlignment;
38
+ readonly CenterEnd: BoxAlignment;
39
+ readonly BottomStart: BoxAlignment;
40
+ readonly BottomCenter: BoxAlignment;
41
+ readonly BottomEnd: BoxAlignment;
17
42
  };
18
- export type HorizontalAlignment = typeof Alignment.Start | typeof Alignment.CenterHorizontally | typeof Alignment.End;
19
- export type VerticalAlignment = typeof Alignment.Top | typeof Alignment.CenterVertically | typeof Alignment.Bottom;
20
- export type BoxAlignment = typeof Alignment[keyof typeof Alignment];
@@ -1,20 +1,42 @@
1
+ /**
2
+ * Alignment — tokens de alineación type-safe con branded types.
3
+ *
4
+ * Los objetos son opacos: nunca se puede pasar un VerticalAlignment donde
5
+ * se espera un HorizontalAlignment, aunque ambos representen "center" en CSS.
6
+ *
7
+ * Filosofía Jetpack Compose:
8
+ * - HorizontalAlignment → eje cross de Column
9
+ * - VerticalAlignment → eje cross de Row
10
+ * - BoxAlignment → alineación compuesta para Box (stack)
11
+ */
12
+ // ─── Helpers internos ────────────────────────────────────────────────────────
13
+ function h(cssValue) {
14
+ return { _brand: 'HorizontalAlignment', cssValue: cssValue };
15
+ }
16
+ function v(cssValue) {
17
+ return { _brand: 'VerticalAlignment', cssValue: cssValue };
18
+ }
19
+ function box(horizontal, vertical) {
20
+ return { _brand: 'BoxAlignment', horizontal: horizontal, vertical: vertical };
21
+ }
22
+ // ─── Tokens públicos ─────────────────────────────────────────────────────────
1
23
  export var Alignment = {
2
- // Horizontal only (para Column)
3
- Start: "flex-start",
4
- CenterHorizontally: "center",
5
- End: "flex-end",
6
- // Vertical only (para Row)
7
- Top: "flex-start",
8
- CenterVertically: "center",
9
- Bottom: "flex-end",
10
- // Compuestos (para Box y layouts avanzados)
11
- TopStart: "flex-start flex-start",
12
- TopCenter: "center flex-start",
13
- TopEnd: "flex-end flex-start",
14
- CenterStart: "flex-start center",
15
- Center: "center center",
16
- CenterEnd: "flex-end center",
17
- BottomStart: "flex-start flex-end",
18
- BottomCenter: "center flex-end",
19
- BottomEnd: "flex-end flex-end",
24
+ // Horizontal eje cross de Column
25
+ Start: h('flex-start'),
26
+ CenterHorizontally: h('center'),
27
+ End: h('flex-end'),
28
+ // Vertical eje cross de Row
29
+ Top: v('flex-start'),
30
+ CenterVertically: v('center'),
31
+ Bottom: v('flex-end'),
32
+ // Box alineación compuesta (stack)
33
+ TopStart: box('flex-start', 'flex-start'),
34
+ TopCenter: box('center', 'flex-start'),
35
+ TopEnd: box('flex-end', 'flex-start'),
36
+ CenterStart: box('flex-start', 'center'),
37
+ Center: box('center', 'center'),
38
+ CenterEnd: box('flex-end', 'center'),
39
+ BottomStart: box('flex-start', 'flex-end'),
40
+ BottomCenter: box('center', 'flex-end'),
41
+ BottomEnd: box('flex-end', 'flex-end'),
20
42
  };
@@ -1,23 +1,39 @@
1
1
  /**
2
- * Arrangement — eje principal (main axis)
3
- * Fiel a Jetpack Compose
2
+ * Arrangement — eje principal (main axis).
3
+ *
4
+ * Fiel a Jetpack Compose:
5
+ * - Arrangement.Start, Center, End, SpaceBetween, SpaceAround, SpaceEvenly
6
+ * - Arrangement.spacedBy(gap) → gap entre hijos, con justificación base opcional
7
+ * - Arrangement.spacedBy(gap, Arrangement.Center) → centrado + gap
4
8
  */
9
+ type JustifyContent = 'flex-start' | 'center' | 'flex-end' | 'space-between' | 'space-around' | 'space-evenly';
5
10
  export type ArrangementValue = {
6
- type: "static";
7
- justifyContent: string;
11
+ readonly type: 'static';
12
+ readonly justifyContent: JustifyContent;
13
+ readonly gap?: never;
8
14
  } | {
9
- type: "spaced";
10
- gap: number;
11
- justifyContent: string;
15
+ readonly type: 'spaced';
16
+ readonly justifyContent: JustifyContent;
17
+ readonly gap: number;
12
18
  };
13
19
  export declare const Arrangement: {
20
+ readonly Top: ArrangementValue;
21
+ readonly Bottom: ArrangementValue;
14
22
  readonly Start: ArrangementValue;
15
- readonly Center: ArrangementValue;
16
23
  readonly End: ArrangementValue;
17
- readonly Bottom: ArrangementValue;
18
- readonly Top: ArrangementValue;
24
+ readonly Center: ArrangementValue;
19
25
  readonly SpaceBetween: ArrangementValue;
20
26
  readonly SpaceAround: ArrangementValue;
21
27
  readonly SpaceEvenly: ArrangementValue;
22
- readonly spacedBy: (value: number) => ArrangementValue;
28
+ /**
29
+ * Espaciado uniforme entre hijos con gap en px.
30
+ * @param gap Espacio en píxeles entre elementos
31
+ * @param baseAlign Alineación base del main-axis (por defecto flex-start)
32
+ *
33
+ * @example
34
+ * Arrangement.spacedBy(16)
35
+ * Arrangement.spacedBy(16, Arrangement.Center)
36
+ */
37
+ readonly spacedBy: (gap: number, baseAlign?: ArrangementValue) => ArrangementValue;
23
38
  };
39
+ export {};
@@ -1,46 +1,39 @@
1
1
  /**
2
- * Arrangement — eje principal (main axis)
3
- * Fiel a Jetpack Compose
2
+ * Arrangement — eje principal (main axis).
3
+ *
4
+ * Fiel a Jetpack Compose:
5
+ * - Arrangement.Start, Center, End, SpaceBetween, SpaceAround, SpaceEvenly
6
+ * - Arrangement.spacedBy(gap) → gap entre hijos, con justificación base opcional
7
+ * - Arrangement.spacedBy(gap, Arrangement.Center) → centrado + gap
4
8
  */
9
+ // ─── Tokens estáticos ────────────────────────────────────────────────────────
10
+ var staticArrangement = function (justifyContent) {
11
+ return ({ type: 'static', justifyContent: justifyContent });
12
+ };
13
+ // ─── Arrangement public API ──────────────────────────────────────────────────
5
14
  export var Arrangement = {
6
- // --- simples ---
7
- Start: {
8
- type: "static",
9
- justifyContent: "flex-start",
10
- },
11
- Center: {
12
- type: "static",
13
- justifyContent: "center",
14
- },
15
- End: {
16
- type: "static",
17
- justifyContent: "flex-end",
18
- },
19
- Bottom: {
20
- type: "static",
21
- justifyContent: "flex-end"
22
- },
23
- Top: {
24
- type: "static",
25
- justifyContent: "flex-start"
26
- },
27
- SpaceBetween: {
28
- type: "static",
29
- justifyContent: "space-between",
30
- },
31
- SpaceAround: {
32
- type: "static",
33
- justifyContent: "space-around",
34
- },
35
- SpaceEvenly: {
36
- type: "static",
37
- justifyContent: "space-evenly",
38
- },
39
- spacedBy: function (value) {
40
- return {
41
- type: "spaced",
42
- gap: value,
43
- justifyContent: "flex-start",
44
- };
15
+ // Column main-axis (vertical)
16
+ Top: staticArrangement('flex-start'),
17
+ Bottom: staticArrangement('flex-end'),
18
+ // Row main-axis (horizontal)
19
+ Start: staticArrangement('flex-start'),
20
+ End: staticArrangement('flex-end'),
21
+ // Compartidos
22
+ Center: staticArrangement('center'),
23
+ SpaceBetween: staticArrangement('space-between'),
24
+ SpaceAround: staticArrangement('space-around'),
25
+ SpaceEvenly: staticArrangement('space-evenly'),
26
+ /**
27
+ * Espaciado uniforme entre hijos con gap en px.
28
+ * @param gap Espacio en píxeles entre elementos
29
+ * @param baseAlign Alineación base del main-axis (por defecto flex-start)
30
+ *
31
+ * @example
32
+ * Arrangement.spacedBy(16)
33
+ * Arrangement.spacedBy(16, Arrangement.Center)
34
+ */
35
+ spacedBy: function (gap, baseAlign) {
36
+ if (baseAlign === void 0) { baseAlign = staticArrangement('flex-start'); }
37
+ return { type: 'spaced', gap: gap, justifyContent: baseAlign.justifyContent };
45
38
  },
46
39
  };