@ng-native/template 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/AGENTS.md +11 -3
- package/app.json +2 -2
- package/package.json +10 -13
- package/src/app/app.ts +22 -4
- package/src/main.ts +4 -0
package/AGENTS.md
CHANGED
|
@@ -31,9 +31,17 @@ change; both are fast.
|
|
|
31
31
|
imported from `@ng-native/components` into the component's `imports`, like any Angular
|
|
32
32
|
component: `imports: [View, Text]`. `<View>` compiles to an empty template, and an element used
|
|
33
33
|
without its import renders as a plain view.
|
|
34
|
-
- **There is no DOM.** No `document`, no `window`, no `<
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
- **There is no DOM.** No `document`, no `window`, no `<button>`, `<a>`, `<input>` or `<img>`, no
|
|
35
|
+
`@angular/platform-browser`, and no `@angular/animations`. Use the native elements above. HTML's
|
|
36
|
+
text elements (`p`, `span`, `h1`, `strong`) draw as text and its layout elements (`div`,
|
|
37
|
+
`section`, `ul`) as plain views, with none of a browser's default styles.
|
|
38
|
+
- **A component's host is a flex item.** `<app-case-list />` commits as a view of its own, with no
|
|
39
|
+
`flex`, so a `flex: 1` scroll view inside it gets a height of zero and shows nothing. A component
|
|
40
|
+
that fills the space it is given sets `host: { style: 'flex: 1' }` (or `:host { flex: 1; }`).
|
|
41
|
+
- **Text is drawn in a text element.** `<text>` is the one with inputs and outputs (`numberOfLines`,
|
|
42
|
+
`(press)`). `p`, `span` and the other HTML text elements are text while they hold only text and
|
|
43
|
+
other text elements; one that holds a view is a view. Text written straight into a view is given
|
|
44
|
+
a paragraph of its own, one per run, and never flows inline with the elements beside it.
|
|
37
45
|
- **Events are native:** `(press)` on `<pressable>`, not `(click)`; `[(value)]` or `(changeText)` on
|
|
38
46
|
`<text-input>`; `(scroll)`, `(layout)`. A pressable text is `<text pressable (press)="...">`.
|
|
39
47
|
- **Signals, zoneless, AOT.** State is signals and `computed()`; there is no zone.js, so nothing
|
package/app.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"platforms": ["ios", "android"],
|
|
7
7
|
"orientation": "portrait",
|
|
8
8
|
"icon": "./assets/icon.png",
|
|
9
|
-
"userInterfaceStyle": "
|
|
9
|
+
"userInterfaceStyle": "automatic",
|
|
10
10
|
"ios": {
|
|
11
11
|
"supportsTablet": true
|
|
12
12
|
},
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
},
|
|
20
20
|
"predictiveBackGestureEnabled": false
|
|
21
21
|
},
|
|
22
|
-
"scheme": "
|
|
22
|
+
"scheme": "helloworld",
|
|
23
23
|
"extra": {
|
|
24
24
|
"router": {
|
|
25
25
|
"root": "src/app"
|
package/package.json
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ng-native/template",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "An Angular app rendering real native views. Use with create-expo-app --template.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "src/main.ts",
|
|
7
7
|
"dependencies": {
|
|
8
|
+
"@ng-native/components": "0.4.0",
|
|
9
|
+
"@ng-native/device": "0.4.0",
|
|
10
|
+
"@ng-native/fabric": "0.4.0",
|
|
11
|
+
"@ng-native/metro": "0.4.0",
|
|
12
|
+
"@ng-native/platform": "0.4.0",
|
|
8
13
|
"@angular/common": "^22.0.0",
|
|
9
14
|
"@angular/core": "^22.0.0",
|
|
10
15
|
"expo": "~57.0.26",
|
|
@@ -12,34 +17,26 @@
|
|
|
12
17
|
"expo-system-ui": "~57.0.4",
|
|
13
18
|
"react": "19.2.3",
|
|
14
19
|
"react-native": "0.86.3",
|
|
15
|
-
"react-native-safe-area-context": "~5.7.0"
|
|
16
|
-
"@ng-native/device": "0.2.0",
|
|
17
|
-
"@ng-native/platform": "0.2.0",
|
|
18
|
-
"@ng-native/fabric": "0.2.0",
|
|
19
|
-
"@ng-native/metro": "0.2.0",
|
|
20
|
-
"@ng-native/components": "0.2.0"
|
|
20
|
+
"react-native-safe-area-context": "~5.7.0"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@angular/compiler-cli": "^22.0.0",
|
|
24
24
|
"@babel/core": "^7.29.7",
|
|
25
|
+
"@ng-native/testing": "0.4.0",
|
|
25
26
|
"@types/react": "~19.2.2",
|
|
26
27
|
"typescript": "~6.0.3",
|
|
27
|
-
"vitest": "^5.0.0"
|
|
28
|
-
"@ng-native/testing": "0.2.0"
|
|
28
|
+
"vitest": "^5.0.0"
|
|
29
29
|
},
|
|
30
30
|
"repository": {
|
|
31
31
|
"type": "git",
|
|
32
32
|
"url": "git+https://github.com/ng-native/ng-native.git",
|
|
33
33
|
"directory": "template"
|
|
34
34
|
},
|
|
35
|
-
"publishConfig": {
|
|
36
|
-
"access": "public"
|
|
37
|
-
},
|
|
38
35
|
"scripts": {
|
|
39
36
|
"start": "expo start",
|
|
40
37
|
"android": "expo start --android",
|
|
41
38
|
"ios": "expo start --ios",
|
|
42
|
-
"typecheck": "ngc -p tsconfig.json --noEmit",
|
|
39
|
+
"typecheck": "node metro.config.js && ngc -p tsconfig.json --noEmit",
|
|
43
40
|
"test": "vitest run"
|
|
44
41
|
}
|
|
45
42
|
}
|
package/src/app/app.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { Component, signal } from '@angular/core';
|
|
1
|
+
import { Component, inject, signal } from '@angular/core';
|
|
2
2
|
import { Pressable, SafeAreaProvider, SafeAreaView, Text, View } from '@ng-native/components';
|
|
3
|
+
import { StatusBar } from '@ng-native/device';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Element names are lowercase, and that is load-bearing rather than style: an uppercase name is
|
|
@@ -28,7 +29,7 @@ import { Pressable, SafeAreaProvider, SafeAreaView, Text, View } from '@ng-nativ
|
|
|
28
29
|
}
|
|
29
30
|
.screen {
|
|
30
31
|
flex: 1;
|
|
31
|
-
background-color: #
|
|
32
|
+
background-color: #f5f5f7;
|
|
32
33
|
}
|
|
33
34
|
.body {
|
|
34
35
|
flex: 1;
|
|
@@ -37,12 +38,12 @@ import { Pressable, SafeAreaProvider, SafeAreaView, Text, View } from '@ng-nativ
|
|
|
37
38
|
padding: 24px;
|
|
38
39
|
}
|
|
39
40
|
.title {
|
|
40
|
-
color: #
|
|
41
|
+
color: #101014;
|
|
41
42
|
font-size: 28px;
|
|
42
43
|
font-weight: 700;
|
|
43
44
|
}
|
|
44
45
|
.hint {
|
|
45
|
-
color: #
|
|
46
|
+
color: #5f5f6b;
|
|
46
47
|
font-size: 15px;
|
|
47
48
|
}
|
|
48
49
|
.button {
|
|
@@ -57,8 +58,25 @@ import { Pressable, SafeAreaProvider, SafeAreaView, Text, View } from '@ng-nativ
|
|
|
57
58
|
font-size: 16px;
|
|
58
59
|
font-weight: 600;
|
|
59
60
|
}
|
|
61
|
+
@media (prefers-color-scheme: dark) {
|
|
62
|
+
.screen {
|
|
63
|
+
background-color: #101014;
|
|
64
|
+
}
|
|
65
|
+
.title {
|
|
66
|
+
color: #ffffff;
|
|
67
|
+
}
|
|
68
|
+
.hint {
|
|
69
|
+
color: #8b8b96;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
60
72
|
`,
|
|
61
73
|
})
|
|
62
74
|
export class App {
|
|
63
75
|
protected readonly count = signal(0);
|
|
76
|
+
|
|
77
|
+
constructor() {
|
|
78
|
+
// Dark status bar icons in light mode and light ones in dark mode. Unclaimed, Android keeps
|
|
79
|
+
// light icons whatever the scheme.
|
|
80
|
+
inject(StatusBar).set({ style: 'auto' });
|
|
81
|
+
}
|
|
64
82
|
}
|
package/src/main.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
// Expo's runtime: its fetch, whose response streams a body, and URL, TextDecoderStream and
|
|
2
|
+
// structuredClone. Metro runs it before this file only when something imports it, and nothing
|
|
3
|
+
// else does in a release build, which would then get React Native's fetch, with no body.
|
|
4
|
+
import 'expo';
|
|
1
5
|
import { AppRegistry, Image, Platform, processColor } from 'react-native';
|
|
2
6
|
import { mount } from '@ng-native/platform';
|
|
3
7
|
import { currentConditions, deviceTokens, watchConditions } from '@ng-native/device';
|