@stackflow/plugin-basic-ui 1.9.1-canary.0 → 1.9.2-canary.0

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.
@@ -1,7 +1,7 @@
1
1
  import { style } from "@vanilla-extract/css";
2
2
  import { recipe } from "@vanilla-extract/recipes";
3
3
 
4
- import { android, cupertino, globalVars } from "../basicUIPlugin.css";
4
+ import { globalVars } from "../basicUIPlugin.css";
5
5
  import { f } from "../styles";
6
6
  import {
7
7
  background,
@@ -40,17 +40,18 @@ export const appBar = recipe({
40
40
  zIndex: vars.zIndexes.appBar,
41
41
  transition: transitions(appBarCommonTransition),
42
42
  selectors: {
43
- [`${cupertino} &`]: {
43
+ ":root[data-stackflow-plugin-basic-ui-theme=cupertino] &": {
44
44
  position: "absolute",
45
45
  },
46
- [`${cupertino} ${exitActive} &`]: {
47
- transform: "translate3d(100%, 0, 0)",
48
- transition: transitions({
49
- ...appBarCommonTransition,
50
- transform: "0s",
51
- }),
52
- },
53
- [`${android} &`]: {
46
+ [`:root[data-stackflow-plugin-basic-ui-theme=cupertino] ${exitActive} &`]:
47
+ {
48
+ transform: "translate3d(100%, 0, 0)",
49
+ transition: transitions({
50
+ ...appBarCommonTransition,
51
+ transform: "0s",
52
+ }),
53
+ },
54
+ ":root[data-stackflow-plugin-basic-ui-theme=android] &": {
54
55
  opacity: 0,
55
56
  transform: "translate3d(0, 10rem, 0)",
56
57
  transition: transitions({
@@ -60,8 +61,8 @@ export const appBar = recipe({
60
61
  }),
61
62
  },
62
63
  [`
63
- ${android} ${enterActive} &,
64
- ${android} ${enterDone} &
64
+ :root[data-stackflow-plugin-basic-ui-theme=android] ${enterActive} &,
65
+ :root[data-stackflow-plugin-basic-ui-theme=android] ${enterDone} &
65
66
  `]: {
66
67
  opacity: 1,
67
68
  transform: "translate3d(0, 0, 0)",
@@ -78,7 +79,7 @@ export const appBar = recipe({
78
79
  modalPresentationStyle: {
79
80
  fullScreen: {
80
81
  selectors: {
81
- [`${cupertino} &`]: {
82
+ ":root[data-stackflow-plugin-basic-ui-theme=cupertino] &": {
82
83
  transform: "translate3d(0, 100vh, 0)",
83
84
  transition: transitions({
84
85
  ...appBarCommonTransition,
@@ -87,36 +88,38 @@ export const appBar = recipe({
87
88
  }),
88
89
  },
89
90
  [`
90
- ${cupertino} ${enterActive} &,
91
- ${cupertino} ${enterDone} &
91
+ :root[data-stackflow-plugin-basic-ui-theme=cupertino] ${enterActive} &,
92
+ :root[data-stackflow-plugin-basic-ui-theme=cupertino] ${enterDone} &
92
93
  `]: {
93
94
  transform: "translate3d(0, 0, 0)",
94
95
  },
95
- [`${cupertino} ${exitActive} &`]: {
96
- transform: "translate3d(0, 100vh, 0)",
97
- transition: transitions({
98
- ...appBarCommonTransition,
99
- transform: vars.transitionDuration,
100
- opacity: vars.transitionDuration,
101
- }),
102
- },
96
+ [`:root[data-stackflow-plugin-basic-ui-theme=cupertino] ${exitActive} &`]:
97
+ {
98
+ transform: "translate3d(0, 100vh, 0)",
99
+ transition: transitions({
100
+ ...appBarCommonTransition,
101
+ transform: vars.transitionDuration,
102
+ opacity: vars.transitionDuration,
103
+ }),
104
+ },
103
105
  },
104
106
  },
105
107
  },
106
108
  activityEnterStyle: {
107
109
  slideInLeft: {
108
110
  selectors: {
109
- [`${android} &`]: {
111
+ ":root[data-stackflow-plugin-basic-ui-theme=android] &": {
110
112
  opacity: 1,
111
113
  transform: "translate3d(0, 0, 0)",
112
114
  },
113
- [`${android} ${exitActive} &`]: {
114
- transform: "translate3d(100%, 0, 0)",
115
- transition: transitions({
116
- ...appBarCommonTransition,
117
- transform: "0s",
118
- }),
119
- },
115
+ [`:root[data-stackflow-plugin-basic-ui-theme=android] ${exitActive} &`]:
116
+ {
117
+ transform: "translate3d(100%, 0, 0)",
118
+ transition: transitions({
119
+ ...appBarCommonTransition,
120
+ transform: "0s",
121
+ }),
122
+ },
120
123
  },
121
124
  },
122
125
  },
@@ -189,7 +192,7 @@ export const centerMain = recipe({
189
192
  color: globalVars.appBar.textColorTransitionDuration,
190
193
  }),
191
194
  selectors: {
192
- [`${android} &`]: {
195
+ ":root[data-stackflow-plugin-basic-ui-theme=android] &": {
193
196
  width: "100%",
194
197
  justifyContent: "flex-start",
195
198
  paddingLeft: "1rem",
@@ -198,7 +201,7 @@ export const centerMain = recipe({
198
201
  fontWeight: "bold",
199
202
  boxSizing: "border-box",
200
203
  },
201
- [`${cupertino} &`]: {
204
+ ":root[data-stackflow-plugin-basic-ui-theme=cupertino] &": {
202
205
  position: "absolute",
203
206
  display: "flex",
204
207
  alignItems: "center",
@@ -221,7 +224,7 @@ export const centerMain = recipe({
221
224
  hasLeft: {
222
225
  true: {
223
226
  selectors: {
224
- [`${android} &`]: {
227
+ ":root[data-stackflow-plugin-basic-ui-theme=android] &": {
225
228
  paddingLeft: "0.375rem",
226
229
  },
227
230
  },
@@ -243,7 +246,7 @@ export const centerMainEdge = style([
243
246
  display: "none",
244
247
  width: vars.appBar.center.mainWidth,
245
248
  selectors: {
246
- [`${cupertino} &`]: {
249
+ ":root[data-stackflow-plugin-basic-ui-theme=cupertino] &": {
247
250
  display: "block",
248
251
  },
249
252
  },
@@ -273,7 +276,7 @@ export const right = style([
273
276
  display: "none",
274
277
  },
275
278
  selectors: {
276
- [`${android} &`]: {
279
+ ":root[data-stackflow-plugin-basic-ui-theme=android] &": {
277
280
  padding: "0 0.5rem 0 0",
278
281
  },
279
282
  },
@@ -1,7 +1,7 @@
1
1
  import { createThemeContract, style } from "@vanilla-extract/css";
2
2
  import { recipe } from "@vanilla-extract/recipes";
3
3
 
4
- import { android, cupertino, globalVars } from "../basicUIPlugin.css";
4
+ import { globalVars } from "../basicUIPlugin.css";
5
5
  import { f } from "../styles";
6
6
 
7
7
  export const vars = createThemeContract({
@@ -59,7 +59,7 @@ export const dim = style([
59
59
  opacity: 0,
60
60
  zIndex: vars.zIndexes.dim,
61
61
  selectors: {
62
- [`${android} &`]: {
62
+ ":root[data-stackflow-plugin-basic-ui-theme=android] &": {
63
63
  height: "10rem",
64
64
  background: `linear-gradient(${globalVars.dimBackgroundColor}, rgba(0, 0, 0, 0))`,
65
65
  },
@@ -92,22 +92,22 @@ export const paper = recipe({
92
92
  },
93
93
  zIndex: vars.zIndexes.paper,
94
94
  selectors: {
95
- [`${cupertino} &`]: {
95
+ ":root[data-stackflow-plugin-basic-ui-theme=cupertino] &": {
96
96
  transform: "translate3d(100%, 0, 0)",
97
97
  },
98
98
  [`
99
- ${cupertino} ${enterActive} &,
100
- ${cupertino} ${enterDone} &
99
+ :root[data-stackflow-plugin-basic-ui-theme=cupertino] ${enterActive} &,
100
+ :root[data-stackflow-plugin-basic-ui-theme=cupertino] ${enterDone} &
101
101
  `]: {
102
102
  transform: "translate3d(0, 0, 0)",
103
103
  },
104
- [`${android} &`]: {
104
+ ":root[data-stackflow-plugin-basic-ui-theme=android] &": {
105
105
  opacity: 0,
106
106
  transform: "translate3d(0, 10rem, 0)",
107
107
  },
108
108
  [`
109
- ${android} ${enterActive} &,
110
- ${android} ${enterDone} &
109
+ :root[data-stackflow-plugin-basic-ui-theme=android] ${enterActive} &,
110
+ :root[data-stackflow-plugin-basic-ui-theme=android] ${enterDone} &
111
111
  `]: {
112
112
  opacity: 1,
113
113
  transform: "translate3d(0, 0, 0)",
@@ -146,7 +146,7 @@ export const paper = recipe({
146
146
  modalPresentationStyle: {
147
147
  fullScreen: {
148
148
  selectors: {
149
- [`${cupertino} &`]: {
149
+ ":root[data-stackflow-plugin-basic-ui-theme=cupertino] &": {
150
150
  transform: "translate3d(0, 100%, 0)",
151
151
  },
152
152
  },
@@ -155,7 +155,7 @@ export const paper = recipe({
155
155
  activityEnterStyle: {
156
156
  slideInLeft: {
157
157
  selectors: {
158
- [`${android} &`]: {
158
+ ":root[data-stackflow-plugin-basic-ui-theme=android] &": {
159
159
  transform: "translate3d(50%, 0, 0)",
160
160
  },
161
161
  },
@@ -0,0 +1,27 @@
1
+ import { useLayoutEffect } from "react";
2
+
3
+ export type RootStylesProps = {
4
+ theme: "android" | "cupertino";
5
+ styles: {
6
+ [cssVarName: string]: string | undefined;
7
+ };
8
+ };
9
+ export function RootStyles({ theme, styles }: RootStylesProps) {
10
+ useLayoutEffect(() => {
11
+ const root = document.querySelector(":root") as HTMLHtmlElement;
12
+
13
+ if (!root) {
14
+ return;
15
+ }
16
+
17
+ for (const [key, value] of Object.entries(styles)) {
18
+ if (value) {
19
+ root.style.setProperty(key, value);
20
+ }
21
+ }
22
+
23
+ root.dataset.stackflowPluginBasicUiTheme = theme;
24
+ }, [styles, theme]);
25
+
26
+ return null;
27
+ }