create-nativue 0.2.0 → 0.4.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.
package/index.mjs CHANGED
@@ -9,7 +9,8 @@ import { parseArgs } from 'node:util'
9
9
 
10
10
  const TEMPLATE_DIRECTORY = fileURLToPath(new URL('./template', import.meta.url))
11
11
  const TEXT_FILE = /(\.(json|vue|ts|plist|pbxproj|resolved|swift|kt|kts|xml)|gitignore)$/
12
- const BUNDLE_ID = /^[a-zA-Z][a-zA-Z0-9-]*(\.[a-zA-Z][a-zA-Z0-9-]*)+$/
12
+ // Also the Android package and applicationId, which can't have hyphens.
13
+ const BUNDLE_ID = /^[a-zA-Z][a-zA-Z0-9_]*(\.[a-zA-Z][a-zA-Z0-9_]*)+$/
13
14
  const { version } = JSON.parse(readFileSync(new URL('./package.json', import.meta.url), 'utf8'))
14
15
 
15
16
  async function askProjectName() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-nativue",
3
- "version": "0.2.0",
3
+ "version": "0.4.0",
4
4
  "description": "Creates a Nativue app: npm create nativue@latest my-app",
5
5
  "keywords": [
6
6
  "vue",
@@ -7,7 +7,7 @@
7
7
 
8
8
  <activity
9
9
  android:name=".MainActivity"
10
- android:configChanges="orientation|screenSize|screenLayout|keyboard|keyboardHidden|uiMode|density"
10
+ android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout|keyboard|keyboardHidden|uiMode|fontScale|locale|layoutDirection"
11
11
  android:exported="true"
12
12
  android:launchMode="singleTask"
13
13
  android:windowSoftInputMode="adjustResize">
@@ -1,10 +1,15 @@
1
1
  <resources xmlns:tools="http://schemas.android.com/tools">
2
- <!-- Dark status and navigation bar icons over the app's light screens. The splash screen (Android
3
- 12+) matches the iOS launch screen: the logo, 120dp, on white. -->
4
- <style name="AppTheme" parent="@android:style/Theme.Material.Light.NoActionBar">
5
- <item name="android:windowLightStatusBar">true</item>
6
- <item name="android:windowLightNavigationBar">true</item>
7
- <item name="android:windowSplashScreenBackground" tools:targetApi="31">@android:color/white</item>
2
+ <!-- Light or dark with the system: values-night/styles.xml has the dark ones. -->
3
+ <style name="AppTheme.Base" parent="@android:style/Theme.Material.Light.NoActionBar" />
4
+ <bool name="light_system_bars">true</bool>
5
+ <color name="splash_background">#FFFFFF</color>
6
+
7
+ <!-- Status and navigation bar icons that contrast with the screens. The splash screen (Android
8
+ 12+) matches the iOS launch screen: the logo, 120dp, on white, or on ink in dark mode. -->
9
+ <style name="AppTheme" parent="AppTheme.Base">
10
+ <item name="android:windowLightStatusBar">@bool/light_system_bars</item>
11
+ <item name="android:windowLightNavigationBar">@bool/light_system_bars</item>
12
+ <item name="android:windowSplashScreenBackground" tools:targetApi="31">@color/splash_background</item>
8
13
  <item name="android:windowSplashScreenAnimatedIcon" tools:targetApi="31">@drawable/splash_logo</item>
9
14
  </style>
10
15
  </resources>
@@ -0,0 +1,5 @@
1
+ <resources>
2
+ <style name="AppTheme.Base" parent="@android:style/Theme.Material.NoActionBar" />
3
+ <bool name="light_system_bars">false</bool>
4
+ <color name="splash_background">#0B1220</color>
5
+ </resources>
@@ -17,3 +17,5 @@ rootProject.name = "__DISPLAY_NAME__"
17
17
  include(":app")
18
18
  include(":nativue")
19
19
  project(":nativue").projectDir = file("../node_modules/@nativue/core/android")
20
+ // The Android side of the app's packages (see the file)
21
+ apply(from = "../node_modules/@nativue/core/android/nativue.settings.gradle.kts")
@@ -1,11 +1,12 @@
1
1
  import SwiftUI
2
- import Nativue
2
+ // NativuePlugins: nativue and the native side of the app's packages (generated by the nativue CLI)
3
+ import NativuePlugins
3
4
 
4
5
  @main
5
6
  struct MainApp: App {
6
7
  var body: some Scene {
7
8
  WindowGroup {
8
- NativueView()
9
+ NativueView(plugins: nativuePlugins)
9
10
  }
10
11
  }
11
12
  }
@@ -1,4 +1,38 @@
1
- {"colors":[
2
- {"color":{"color-space":"srgb","components":{"red":"1.000","green":"1.000","blue":"1.000","alpha":"1.000"}},"idiom":"universal"},
3
- {"appearances":[{"appearance":"luminosity","value":"dark"}],"color":{"color-space":"srgb","components":{"red":"0.000","green":"0.000","blue":"0.000","alpha":"1.000"}},"idiom":"universal"}
4
- ],"info":{"author":"xcode","version":1}}
1
+ {
2
+ "colors": [
3
+ {
4
+ "color": {
5
+ "color-space": "srgb",
6
+ "components": {
7
+ "red": "1.000",
8
+ "green": "1.000",
9
+ "blue": "1.000",
10
+ "alpha": "1.000"
11
+ }
12
+ },
13
+ "idiom": "universal"
14
+ },
15
+ {
16
+ "appearances": [
17
+ {
18
+ "appearance": "luminosity",
19
+ "value": "dark"
20
+ }
21
+ ],
22
+ "color": {
23
+ "color-space": "srgb",
24
+ "components": {
25
+ "red": "0.043",
26
+ "green": "0.071",
27
+ "blue": "0.125",
28
+ "alpha": "1.000"
29
+ }
30
+ },
31
+ "idiom": "universal"
32
+ }
33
+ ],
34
+ "info": {
35
+ "author": "xcode",
36
+ "version": 1
37
+ }
38
+ }
@@ -1 +1,11 @@
1
- {"images":[{"filename":"logo@1x.png","idiom":"universal","scale":"1x"},{"filename":"logo@2x.png","idiom":"universal","scale":"2x"},{"filename":"logo@3x.png","idiom":"universal","scale":"3x"}],"info":{"author":"xcode","version":1}}
1
+ {
2
+ "images" : [
3
+ { "filename" : "logo@1x.png", "idiom" : "universal", "scale" : "1x" },
4
+ { "appearances" : [ { "appearance" : "luminosity", "value" : "dark" } ], "filename" : "logo-dark@1x.png", "idiom" : "universal", "scale" : "1x" },
5
+ { "filename" : "logo@2x.png", "idiom" : "universal", "scale" : "2x" },
6
+ { "appearances" : [ { "appearance" : "luminosity", "value" : "dark" } ], "filename" : "logo-dark@2x.png", "idiom" : "universal", "scale" : "2x" },
7
+ { "filename" : "logo@3x.png", "idiom" : "universal", "scale" : "3x" },
8
+ { "appearances" : [ { "appearance" : "luminosity", "value" : "dark" } ], "filename" : "logo-dark@3x.png", "idiom" : "universal", "scale" : "3x" }
9
+ ],
10
+ "info" : { "author" : "xcode", "version" : 1 }
11
+ }
@@ -7,7 +7,7 @@
7
7
  objects = {
8
8
 
9
9
  /* Begin PBXBuildFile section */
10
- AA0000000000000000000010 /* Nativue in Frameworks */ = {isa = PBXBuildFile; productRef = AA0000000000000000000012 /* Nativue */; };
10
+ AA0000000000000000000010 /* NativuePlugins in Frameworks */ = {isa = PBXBuildFile; productRef = AA0000000000000000000012 /* NativuePlugins */; };
11
11
  /* End PBXBuildFile section */
12
12
 
13
13
  /* Begin PBXFileReference section */
@@ -27,7 +27,7 @@
27
27
  isa = PBXFrameworksBuildPhase;
28
28
  buildActionMask = 2147483647;
29
29
  files = (
30
- AA0000000000000000000010 /* Nativue in Frameworks */,
30
+ AA0000000000000000000010 /* NativuePlugins in Frameworks */,
31
31
  );
32
32
  runOnlyForDeploymentPostprocessing = 0;
33
33
  };
@@ -71,7 +71,7 @@
71
71
  );
72
72
  name = App;
73
73
  packageProductDependencies = (
74
- AA0000000000000000000012 /* Nativue */,
74
+ AA0000000000000000000012 /* NativuePlugins */,
75
75
  );
76
76
  productName = App;
77
77
  productReference = AA0000000000000000000001 /* App.app */;
@@ -97,7 +97,7 @@
97
97
  mainGroup = AA0000000000000000000004;
98
98
  minimizedProjectReferenceProxies = 1;
99
99
  packageReferences = (
100
- AA0000000000000000000011 /* XCLocalSwiftPackageReference "../../../packages/core" */,
100
+ AA0000000000000000000011 /* XCLocalSwiftPackageReference "NativuePlugins" */,
101
101
  );
102
102
  preferredProjectObjectVersion = 77;
103
103
  productRefGroup = AA0000000000000000000005 /* Products */;
@@ -233,16 +233,16 @@
233
233
  /* End XCConfigurationList section */
234
234
 
235
235
  /* Begin XCLocalSwiftPackageReference section */
236
- AA0000000000000000000011 /* XCLocalSwiftPackageReference "../../../packages/core" */ = {
236
+ AA0000000000000000000011 /* XCLocalSwiftPackageReference "NativuePlugins" */ = {
237
237
  isa = XCLocalSwiftPackageReference;
238
- relativePath = "../node_modules/@nativue/core";
238
+ relativePath = NativuePlugins;
239
239
  };
240
240
  /* End XCLocalSwiftPackageReference section */
241
241
 
242
242
  /* Begin XCSwiftPackageProductDependency section */
243
- AA0000000000000000000012 /* Nativue */ = {
243
+ AA0000000000000000000012 /* NativuePlugins */ = {
244
244
  isa = XCSwiftPackageProductDependency;
245
- productName = Nativue;
245
+ productName = NativuePlugins;
246
246
  };
247
247
  /* End XCSwiftPackageProductDependency section */
248
248
  };
@@ -20,8 +20,6 @@
20
20
  </dict>
21
21
  <key>NSLocalNetworkUsageDescription</key>
22
22
  <string>Connects to the Nativue dev server on your Mac for hot reload.</string>
23
- <key>UIUserInterfaceStyle</key>
24
- <string>Light</string>
25
23
  <key>UILaunchScreen</key>
26
24
  <dict>
27
25
  <key>UIColorName</key>
@@ -0,0 +1,13 @@
1
+ // swift-tools-version: 5.9
2
+ // Generated by nativue from the app's packages (packages/core/cli/link.mjs): rewritten on every build.
3
+ import PackageDescription
4
+
5
+ let package = Package(
6
+ name: "NativuePlugins",
7
+ platforms: [.iOS(.v17)],
8
+ products: [.library(name: "NativuePlugins", targets: ["NativuePlugins"])],
9
+ dependencies: [.package(path: "../../node_modules/@nativue/core")],
10
+ targets: [
11
+ .target(name: "NativuePlugins", dependencies: [.product(name: "Nativue", package: "core")], path: "Sources/NativuePlugins"),
12
+ ]
13
+ )
@@ -0,0 +1,4 @@
1
+ // Generated by nativue from the app's packages (packages/core/cli/link.mjs): rewritten on every build.
2
+ @_exported import Nativue
3
+
4
+ public let nativuePlugins: [NativuePlugin] = []
@@ -1,36 +1,53 @@
1
1
  <script setup lang="ts">
2
- import { ref, StyleSheet } from 'vue'
2
+ import { computed, ref, StyleSheet, useColorScheme } from 'vue'
3
3
  import logo from '@/assets/logo.png'
4
+ import logoDark from '@/assets/logo-dark.png'
5
+
6
+ // Light or dark with the system.
7
+ const COLORS = {
8
+ light: { background: '#ffffff', title: '#0b1220', hint: '#64748b' },
9
+ dark: { background: '#0b1220', title: '#f1f5f9', hint: '#94a3b8' },
10
+ }
4
11
 
5
12
  const count = ref(0)
13
+ const colorScheme = useColorScheme()
14
+
15
+ // A computed, so the styles are made again when colorScheme changes.
16
+ const styles = computed(() => {
17
+ const colors = COLORS[colorScheme.value]
6
18
 
7
- const styles = StyleSheet.create({
8
- screen: {
9
- flex: 1,
10
- justifyContent: 'center',
11
- alignItems: 'center',
12
- gap: 16,
13
- padding: 32,
14
- backgroundColor: '#ffffff',
15
- },
16
- logo: { width: 96, height: 96, marginBottom: 8 },
17
- title: { fontSize: 28, fontWeight: '800', color: '#0b1220' },
18
- hint: { fontSize: 16, textAlign: 'center', color: '#64748b' },
19
- button: {
20
- marginTop: 16,
21
- paddingHorizontal: 24,
22
- paddingVertical: 14,
23
- borderRadius: 14,
24
- backgroundColor: '#0e9f84',
25
- },
26
- buttonPressed: { opacity: 0.85 },
27
- buttonText: { fontSize: 17, fontWeight: '600', color: '#ffffff' },
19
+ return StyleSheet.create({
20
+ screen: {
21
+ flex: 1,
22
+ justifyContent: 'center',
23
+ alignItems: 'center',
24
+ gap: 16,
25
+ padding: 32,
26
+ backgroundColor: colors.background,
27
+ },
28
+ logo: { width: 96, height: 96, marginBottom: 8 },
29
+ title: { fontSize: 28, fontWeight: '800', color: colors.title },
30
+ hint: { fontSize: 16, textAlign: 'center', color: colors.hint },
31
+ button: {
32
+ marginTop: 16,
33
+ paddingHorizontal: 24,
34
+ paddingVertical: 14,
35
+ borderRadius: 14,
36
+ backgroundColor: '#0e9f84',
37
+ },
38
+ buttonPressed: { opacity: 0.85 },
39
+ buttonText: { fontSize: 17, fontWeight: '600', color: '#ffffff' },
40
+ })
28
41
  })
29
42
  </script>
30
43
 
31
44
  <template>
32
45
  <View :style="styles.screen">
33
- <Image :source="logo" resize-mode="contain" :style="styles.logo" />
46
+ <Image
47
+ :source="colorScheme === 'dark' ? logoDark : logo"
48
+ resize-mode="contain"
49
+ :style="styles.logo"
50
+ />
34
51
  <Text :style="styles.title">Welcome to Nativue</Text>
35
52
  <Text :style="styles.hint">Edit src/app/index.vue and save to see it here.</Text>
36
53
  <Pressable :style="styles.button" :pressed-style="styles.buttonPressed" @press="count++">
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "extends": "@nativue/core/tsconfig.base.json",
3
- "include": ["src"]
3
+ "include": ["src", "nativue.config.ts"]
4
4
  }