You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It's clear that composition alone can't handle all dynamic cases.
82
82
What about dynamic cases?
83
83
84
-
The solution is known as [`UI = f(state)`](https://docs.flutter.dev/data-and-backend/state-mgmt/declarative) and is It's simple.
84
+
The solution is known as [`UI = f(state)`](https://docs.flutter.dev/data-and-backend/state-mgmt/declarative) and it's simple.
85
85
86
86
If so, is there any reason for Style to not be a function?
87
87
This is the same as [fela's approach](https://fela.js.org/docs/latest/intro/principles).
@@ -185,7 +185,7 @@ It leaves the way out open, but we need to find a way to make it as declarative
185
185
186
186
[Variants](https://stitches.dev/docs/variants), made famous by [stitches](https://stitches.dev/), makes some control flows declarative.
187
187
188
-
Vanilla extract, which this project is based on, is called [recipe](https://vanilla-extract.style/documentation/packages/recipes/).
188
+
The Vanilla extract, which this project is based on, is called [recipe](https://vanilla-extract.style/documentation/packages/recipes/).
189
189
190
190
```typescript
191
191
const avatar =recipe({
@@ -714,10 +714,10 @@ const button = rules({
714
714
});
715
715
```
716
716
717
-
First method is original method in stitches's compound variants, and it is still good way for it.
717
+
The first method is the original method in stitches's compound variants, and it is still a good way for it.
718
718
So we keep it.
719
719
720
-
And second method we present will provide a more comfortable way to write the conditions.
720
+
And the second method we present will provide a more comfortable way to write the conditions.
721
721
This feature checks existing variants and provides automatic completion.
722
722
723
723
**Compiled:**
@@ -745,50 +745,210 @@ button({
745
745
746
746
## 7. Default Variants
747
747
748
+
The way of [Stitches's Default Variants](https://stitches.dev/docs/variants#default-variants) is already good to use, so we keep this method in ours.
749
+
748
750
**Code:**
749
751
750
752
```typescript
753
+
const button =rules({
754
+
// base styles
751
755
756
+
variants: {
757
+
color: {
758
+
brand: {
759
+
color: "#FFFFA0",
760
+
backgroundColor: "blueviolet"
761
+
},
762
+
accent: {
763
+
color: "#FFE4B5",
764
+
backgroundColor: "slateblue"
765
+
}
766
+
}
767
+
},
768
+
defaultVariants: {
769
+
color: "brand"
770
+
}
771
+
});
752
772
```
753
773
754
774
## 8. Composition
755
775
756
776
**Code:**
757
777
778
+
[Vanilla Extract's Composition](https://vanilla-extract.style/documentation/style-composition/) is enough to use already. So we maintain this basically.
779
+
And It gonna inherit base rules like [Stitches's Composing Components](https://stitches.dev/docs/composing-components).
Inspired by the [PandaCSS's `defineSlotRecipe()`](https://panda-css.com/docs/concepts/slot-recipes#config-slot-recipe).
848
+
Inspired by the [PandaCSS's `defineSlotRecipe()`](https://panda-css.com/docs/concepts/slot-recipes#config-slot-recipe).
849
+
And at the same time, We refer to [Vanilla Extract's `styleVariants`](https://vanilla-extract.style/documentation/api/style-variants/) for code style for now. It could be change to [sub functions](https://github.com/mincho-js/mincho/issues/59).
773
850
774
851
This is a combination of `rules()` and `cssVariants()`.
0 commit comments