create-disposabl-app 0.14.15 → 0.14.17
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/dist/disposabl.js +1 -1
- package/dist/index.js +1 -1
- package/dist/templates/default/AGENTS.md +1 -0
- package/dist/templates/default/apps/mobile/eslint.config.js +24 -0
- package/dist/templates/default/packages/disposabl-kit/mobile/billing/account-billing.tsx +15 -11
- package/dist/templates/default/packages/disposabl-kit/mobile/components/account-profile.tsx +8 -23
- package/dist/templates/default/packages/disposabl-kit/mobile/components/appearance-settings.tsx +39 -44
- package/dist/templates/default/packages/disposabl-kit/mobile/components/auth-form.tsx +20 -19
- package/dist/templates/default/packages/disposabl-kit/mobile/components/auth-ui.tsx +22 -100
- package/dist/templates/default/packages/disposabl-kit/mobile/components/email-verification.tsx +6 -6
- package/dist/templates/default/packages/disposabl-kit/mobile/components/google-button.tsx +3 -27
- package/dist/templates/default/packages/disposabl-kit/mobile/components/google-sign-in.tsx +3 -4
- package/dist/templates/default/packages/disposabl-kit/mobile/components/settings-page.tsx +12 -22
- package/dist/templates/default/packages/disposabl-kit/mobile/design/avatar.tsx +1 -1
- package/dist/templates/default/packages/disposabl-kit/mobile/design/brand-mark.tsx +2 -10
- package/dist/templates/default/packages/disposabl-kit/mobile/design/nativewind.ts +11 -0
- package/dist/templates/default/packages/disposabl-kit/mobile/design/preferences.tsx +30 -54
- package/dist/templates/default/packages/disposabl-kit/mobile/design/primitives.tsx +17 -39
- package/dist/templates/default/packages/disposabl-kit/mobile/design/themed-text.tsx +3 -5
- package/dist/templates/default/packages/disposabl-kit/mobile/global.css +8 -56
- package/dist/templates/default/packages/disposabl-kit/mobile/layout.tsx +7 -10
- package/dist/templates/default/packages/disposabl-kit/mobile/screens/account.tsx +3 -10
- package/dist/templates/default/packages/disposabl-kit/mobile/screens/change-password.tsx +13 -19
- package/dist/templates/default/packages/disposabl-kit/mobile/screens/forgot-password.tsx +17 -15
- package/dist/templates/default/packages/disposabl-kit/mobile/screens/home.tsx +75 -120
- package/dist/templates/default/packages/disposabl-kit/mobile/typography.css +59 -0
- package/dist/templates/default/packages/disposabl-kit/mobile/updates/update-prompt.tsx +69 -96
- package/dist/templates/default/packages/skill/references/design.md +3 -1
- package/dist/templates/default/packages/tests/components/mobile-google.test.mjs +1 -1
- package/dist/templates/default/packages/tests/components/mobile-updates.test.mjs +3 -1
- package/dist/templates/default/packages/tests/mobile-styling.test.ts +83 -0
- package/package.json +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { VariableContextProvider } from "nativewind";
|
|
1
2
|
import * as Updates from "expo-updates";
|
|
2
3
|
import {
|
|
3
4
|
useCallback,
|
|
@@ -7,14 +8,7 @@ import {
|
|
|
7
8
|
useState,
|
|
8
9
|
type PropsWithChildren,
|
|
9
10
|
} from "react";
|
|
10
|
-
import {
|
|
11
|
-
Alert,
|
|
12
|
-
AppState,
|
|
13
|
-
Pressable,
|
|
14
|
-
StyleSheet,
|
|
15
|
-
Text,
|
|
16
|
-
View,
|
|
17
|
-
} from "react-native";
|
|
11
|
+
import { Alert, AppState, Pressable, Text, View } from "react-native";
|
|
18
12
|
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
19
13
|
import { fetchCurrentUpdate } from "./current-update";
|
|
20
14
|
import { foregroundCheck } from "./foreground-check";
|
|
@@ -108,94 +102,73 @@ export function UpdatePrompt({ children }: PropsWithChildren) {
|
|
|
108
102
|
const visible = enabled && (isUpdatePending || state === "error");
|
|
109
103
|
|
|
110
104
|
return (
|
|
111
|
-
<
|
|
112
|
-
{
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
{state === "error"
|
|
121
|
-
? "Could not apply the update"
|
|
122
|
-
: "An update is ready"}
|
|
123
|
-
</Text>
|
|
124
|
-
<Text style={styles.description}>
|
|
125
|
-
{state === "error"
|
|
126
|
-
? "Could not update. Check your connection and try again."
|
|
127
|
-
: "Update now, or it will load the next time you start the app."}
|
|
128
|
-
</Text>
|
|
129
|
-
</View>
|
|
130
|
-
<Pressable
|
|
131
|
-
accessibilityRole="button"
|
|
132
|
-
accessibilityState={{
|
|
133
|
-
disabled: busy || isNativeBusy,
|
|
134
|
-
busy: busy || isNativeBusy,
|
|
135
|
-
}}
|
|
136
|
-
disabled={busy || isNativeBusy}
|
|
137
|
-
style={styles.button}
|
|
138
|
-
onPress={() => {
|
|
139
|
-
const confirmationGeneration = generation.current;
|
|
140
|
-
Alert.alert(
|
|
141
|
-
"Update now?",
|
|
142
|
-
"Finish or save any unsent work before restarting.",
|
|
143
|
-
[
|
|
144
|
-
{ text: "Not now", style: "cancel" },
|
|
145
|
-
{
|
|
146
|
-
text: "Update now",
|
|
147
|
-
onPress: () => {
|
|
148
|
-
if (generation.current !== confirmationGeneration) return;
|
|
149
|
-
if (running.current || nativeBusy.current) {
|
|
150
|
-
Alert.alert(
|
|
151
|
-
"Checking for updates",
|
|
152
|
-
"Please try again when the check finishes.",
|
|
153
|
-
);
|
|
154
|
-
return;
|
|
155
|
-
}
|
|
156
|
-
void refresh(true);
|
|
157
|
-
},
|
|
158
|
-
},
|
|
159
|
-
],
|
|
160
|
-
);
|
|
161
|
-
}}
|
|
105
|
+
<VariableContextProvider
|
|
106
|
+
value={{ "--update-bottom": Math.max(insets.bottom, 12) }}
|
|
107
|
+
>
|
|
108
|
+
<View className="flex-1">
|
|
109
|
+
{children}
|
|
110
|
+
{visible && (
|
|
111
|
+
<View
|
|
112
|
+
className="absolute inset-x-[16px] bottom-[var(--update-bottom)] flex-row items-center gap-[12px] rounded-[20px] bg-[#171717] p-[16px]"
|
|
113
|
+
accessibilityLiveRegion="polite"
|
|
162
114
|
>
|
|
163
|
-
<
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
115
|
+
<View className="flex-1 gap-[4px]">
|
|
116
|
+
<Text className="text-[15px] font-semibold text-white">
|
|
117
|
+
{state === "error"
|
|
118
|
+
? "Could not apply the update"
|
|
119
|
+
: "An update is ready"}
|
|
120
|
+
</Text>
|
|
121
|
+
<Text className="text-[13px] leading-[19px] text-[#d4d4d4]">
|
|
122
|
+
{state === "error"
|
|
123
|
+
? "Could not update. Check your connection and try again."
|
|
124
|
+
: "Update now, or it will load the next time you start the app."}
|
|
125
|
+
</Text>
|
|
126
|
+
</View>
|
|
127
|
+
<Pressable
|
|
128
|
+
accessibilityRole="button"
|
|
129
|
+
accessibilityState={{
|
|
130
|
+
disabled: busy || isNativeBusy,
|
|
131
|
+
busy: busy || isNativeBusy,
|
|
132
|
+
}}
|
|
133
|
+
disabled={busy || isNativeBusy}
|
|
134
|
+
className="min-h-[44px] justify-center rounded-[12px] bg-white px-[12px]"
|
|
135
|
+
onPress={() => {
|
|
136
|
+
const confirmationGeneration = generation.current;
|
|
137
|
+
Alert.alert(
|
|
138
|
+
"Update now?",
|
|
139
|
+
"Finish or save any unsent work before restarting.",
|
|
140
|
+
[
|
|
141
|
+
{ text: "Not now", style: "cancel" },
|
|
142
|
+
{
|
|
143
|
+
text: "Update now",
|
|
144
|
+
onPress: () => {
|
|
145
|
+
if (generation.current !== confirmationGeneration)
|
|
146
|
+
return;
|
|
147
|
+
if (running.current || nativeBusy.current) {
|
|
148
|
+
Alert.alert(
|
|
149
|
+
"Checking for updates",
|
|
150
|
+
"Please try again when the check finishes.",
|
|
151
|
+
);
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
void refresh(true);
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
],
|
|
158
|
+
);
|
|
159
|
+
}}
|
|
160
|
+
>
|
|
161
|
+
<Text className="text-[14px] font-semibold text-[#171717]">
|
|
162
|
+
{busy || isNativeBusy
|
|
163
|
+
? "Updating..."
|
|
164
|
+
: state === "error"
|
|
165
|
+
? "Try again"
|
|
166
|
+
: "Update now"}
|
|
167
|
+
</Text>
|
|
168
|
+
</Pressable>
|
|
169
|
+
</View>
|
|
170
|
+
)}
|
|
171
|
+
</View>
|
|
172
|
+
</VariableContextProvider>
|
|
174
173
|
);
|
|
175
174
|
}
|
|
176
|
-
|
|
177
|
-
const styles = StyleSheet.create({
|
|
178
|
-
container: { flex: 1 },
|
|
179
|
-
notice: {
|
|
180
|
-
position: "absolute",
|
|
181
|
-
left: 16,
|
|
182
|
-
right: 16,
|
|
183
|
-
borderRadius: 20,
|
|
184
|
-
padding: 16,
|
|
185
|
-
backgroundColor: "#171717",
|
|
186
|
-
flexDirection: "row",
|
|
187
|
-
gap: 12,
|
|
188
|
-
alignItems: "center",
|
|
189
|
-
},
|
|
190
|
-
copy: { flex: 1, gap: 4 },
|
|
191
|
-
title: { color: "#fff", fontSize: 15, fontWeight: "600" },
|
|
192
|
-
description: { color: "#d4d4d4", fontSize: 13, lineHeight: 19 },
|
|
193
|
-
button: {
|
|
194
|
-
minHeight: 44,
|
|
195
|
-
justifyContent: "center",
|
|
196
|
-
paddingHorizontal: 12,
|
|
197
|
-
borderRadius: 12,
|
|
198
|
-
backgroundColor: "#fff",
|
|
199
|
-
},
|
|
200
|
-
buttonText: { color: "#171717", fontWeight: "600", fontSize: 14 },
|
|
201
|
-
});
|
|
@@ -12,7 +12,9 @@ Make the design distinctive through choices that suit the product, rather than a
|
|
|
12
12
|
|
|
13
13
|
Use concise copy and real visuals suited to the product. Prioritize useful task UI over decorative filler; do not impose a fixed palette.
|
|
14
14
|
|
|
15
|
-
For native screens,
|
|
15
|
+
For native screens, use NativeWind `className` utilities and the shared theme tokens, such as `bg-background`, `text-foreground`, and `border-border`. Do not introduce StyleSheet definitions or inline layout styles. Pass measured values through NativeWind CSS variables. Keep product-specific light/dark colors in the existing theme system and preserve its appearance preference.
|
|
16
|
+
|
|
17
|
+
Use `useTheme` from `packages/disposabl-kit/mobile/design/use-theme.ts` only where native APIs need resolved colors, such as navigation headers, symbols, and status bars. Reuse the existing provider; fixed light surfaces can become unreadable when Settings switches the system chrome to Dark.
|
|
16
18
|
|
|
17
19
|
When the app exposes Light, Dark, and System settings, verify the rendered guest and signed-in screens in those modes, including after restart and an OS appearance change in System mode. A changed selector label does not prove the screen changed. Add behavior coverage for the visible colors and preference persistence in `packages/tests`.
|
|
18
20
|
|
|
@@ -23,7 +23,7 @@ mock.module("../../disposabl-kit/mobile/lib/convex", () => ({
|
|
|
23
23
|
api: { auth: {} },
|
|
24
24
|
}));
|
|
25
25
|
mock.module("../../disposabl-kit/mobile/components/auth-ui", () => ({
|
|
26
|
-
|
|
26
|
+
authClasses: {},
|
|
27
27
|
}));
|
|
28
28
|
mock.module("../../disposabl-kit/mobile/components/google-button", () => ({
|
|
29
29
|
GoogleButton: "Button",
|
|
@@ -41,11 +41,13 @@ mock.module("expo-updates", () => ({
|
|
|
41
41
|
fetchUpdateAsync: fetchUpdate,
|
|
42
42
|
reloadAsync: reload,
|
|
43
43
|
}));
|
|
44
|
+
mock.module("nativewind", () => ({
|
|
45
|
+
VariableContextProvider: ({ children }) => children,
|
|
46
|
+
}));
|
|
44
47
|
mock.module("react-native", () => ({
|
|
45
48
|
Alert: { alert: () => {} },
|
|
46
49
|
AppState: app,
|
|
47
50
|
Pressable: "Pressable",
|
|
48
|
-
StyleSheet: { create: (value) => value },
|
|
49
51
|
Text: "Text",
|
|
50
52
|
View: "View",
|
|
51
53
|
}));
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { readFileSync } from "node:fs";
|
|
3
|
+
import { createRequire } from "node:module";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
import { test } from "node:test";
|
|
6
|
+
import config from "../../disposabl.json";
|
|
7
|
+
|
|
8
|
+
// Compile the actual CSS: component defaults must not hide colors or sizes
|
|
9
|
+
// supplied by a screen, including destructive actions in Settings.
|
|
10
|
+
test(
|
|
11
|
+
"NativeWind preserves text overrides and native serif fonts",
|
|
12
|
+
{
|
|
13
|
+
skip: !config.platforms.some((platform) =>
|
|
14
|
+
["android", "ios"].includes(platform),
|
|
15
|
+
),
|
|
16
|
+
},
|
|
17
|
+
async () => {
|
|
18
|
+
const root = join(import.meta.dirname, "../..");
|
|
19
|
+
const require = createRequire(join(root, "apps/mobile/package.json"));
|
|
20
|
+
const postcss = require("postcss");
|
|
21
|
+
const tailwind = require("@tailwindcss/postcss");
|
|
22
|
+
const { compile } = require("react-native-css/compiler");
|
|
23
|
+
const path = join(root, "packages/disposabl-kit/mobile/global.css");
|
|
24
|
+
const result = await postcss([tailwind()]).process(
|
|
25
|
+
readFileSync(path, "utf8"),
|
|
26
|
+
{ from: path },
|
|
27
|
+
);
|
|
28
|
+
type Rule = { s: number[]; d: (Record<string, unknown> | unknown[])[] };
|
|
29
|
+
const stylesheet = compile(result.css, {
|
|
30
|
+
inlineVariables: false,
|
|
31
|
+
}).stylesheet();
|
|
32
|
+
const rules = new Map<string, Rule[]>(stylesheet.s);
|
|
33
|
+
const variables = new Map<string, [unknown, unknown?][]>(stylesheet.vr);
|
|
34
|
+
for (const [platform, family] of [
|
|
35
|
+
["android", "serif"],
|
|
36
|
+
["ios", "Georgia"],
|
|
37
|
+
]) {
|
|
38
|
+
const resolved = variables
|
|
39
|
+
.get("font-serif")
|
|
40
|
+
?.find(
|
|
41
|
+
([, conditions]) =>
|
|
42
|
+
JSON.stringify(conditions) ===
|
|
43
|
+
JSON.stringify([["=", "platform", platform]]),
|
|
44
|
+
);
|
|
45
|
+
assert.equal(
|
|
46
|
+
resolved?.[0],
|
|
47
|
+
family,
|
|
48
|
+
`${platform} retains its native serif font`,
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
for (const [utility, base, property, value] of [
|
|
52
|
+
["text-[#71717a]", "themed-text", "color", "#71717a"],
|
|
53
|
+
["text-[#dc2626]", "themed-text", "color", "#dc2626"],
|
|
54
|
+
["text-[19px]", "type-default", "fontSize", 19],
|
|
55
|
+
] as const) {
|
|
56
|
+
const override = rules.get(utility)!;
|
|
57
|
+
const defaults = rules.get(base)!;
|
|
58
|
+
assert.ok(
|
|
59
|
+
override?.length && defaults?.length,
|
|
60
|
+
`${utility} and ${base} compile`,
|
|
61
|
+
);
|
|
62
|
+
// Native CSS precedence stores source order first, then specificity.
|
|
63
|
+
assert.ok(
|
|
64
|
+
override.every((rule) =>
|
|
65
|
+
defaults.every(
|
|
66
|
+
(fallback) =>
|
|
67
|
+
rule.s[1] === fallback.s[1] && rule.s[0]! > fallback.s[0]!,
|
|
68
|
+
),
|
|
69
|
+
),
|
|
70
|
+
`${utility} wins over ${base}`,
|
|
71
|
+
);
|
|
72
|
+
assert.ok(
|
|
73
|
+
override.some((rule) =>
|
|
74
|
+
rule.d.some(
|
|
75
|
+
(declaration) =>
|
|
76
|
+
!Array.isArray(declaration) && declaration[property] === value,
|
|
77
|
+
),
|
|
78
|
+
),
|
|
79
|
+
`${utility} resolves ${property}`,
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
);
|