orvyn-lang 0.1.1 → 0.3.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.
Files changed (74) hide show
  1. package/GUIDE.md +149 -0
  2. package/LANGUAGE.md +877 -24
  3. package/README.md +227 -131
  4. package/brand/orvyn-sunset-animated.svg +15 -0
  5. package/package.json +3 -1
  6. package/src/cli/orvyn.js +216 -489
  7. package/src/core/signal.js +104 -6
  8. package/src/devtools/runtime.js +25 -1
  9. package/src/lang/a11y.js +102 -0
  10. package/src/lang/auth.js +239 -0
  11. package/src/lang/bundle-native.js +10 -6
  12. package/src/lang/codegen.js +498 -64
  13. package/src/lang/device.js +41 -0
  14. package/src/lang/doctor.js +60 -0
  15. package/src/lang/env.js +27 -0
  16. package/src/lang/errors.js +513 -0
  17. package/src/lang/form.js +160 -0
  18. package/src/lang/index.js +2 -1
  19. package/src/lang/lexer.js +2 -0
  20. package/src/lang/list.js +44 -0
  21. package/src/lang/native/android/MainActivity.kt +43 -4
  22. package/src/lang/native/android/OrvynDevice.kt +163 -0
  23. package/src/lang/native/android/OrvynEngine.kt +154 -7
  24. package/src/lang/native/android/OrvynRenderer.kt +519 -40
  25. package/src/lang/native/android.js +74 -11
  26. package/src/lang/native/build.js +130 -60
  27. package/src/lang/native/config.js +108 -0
  28. package/src/lang/native/ios/OrvynApp.swift +6 -0
  29. package/src/lang/native/ios/OrvynEngine.swift +268 -4
  30. package/src/lang/native/ios/OrvynViews.swift +429 -31
  31. package/src/lang/native/ios.js +75 -2
  32. package/src/lang/native-runtime.js +423 -57
  33. package/src/lang/page.js +52 -0
  34. package/src/lang/parser.js +243 -15
  35. package/src/lang/prerender.js +300 -0
  36. package/src/lang/read-import.js +11 -0
  37. package/src/lang/router.js +266 -0
  38. package/src/lang/runtime-shared.js +820 -10
  39. package/src/lang/runtime.js +375 -52
  40. package/src/lang/select.js +13 -0
  41. package/src/lang/server-code.js +233 -0
  42. package/src/lang/server-export.js +78 -0
  43. package/src/lang/server-libs.js +53 -0
  44. package/src/lang/server.js +409 -0
  45. package/src/lang/test-runner.js +134 -0
  46. package/src/lang/types.js +312 -0
  47. package/src/lang/validation.js +55 -0
  48. package/src/lang/vite-plugin.js +82 -3
  49. package/src/lang/web-overlay.js +578 -0
  50. package/src/lang/widgets.js +94 -0
  51. package/src/lang/words.js +38 -0
  52. package/src/runtime/mount.js +116 -27
  53. package/src/runtime/patch.js +90 -11
  54. package/src/runtime/style.js +11 -1
  55. package/src/styling/fluid.js +91 -4
  56. package/src/styling/spec.js +306 -0
  57. package/src/core/context.js +0 -19
  58. package/src/core/lifecycle.js +0 -8
  59. package/src/core/resource.js +0 -27
  60. package/src/core/router.js +0 -20
  61. package/src/core/theme.js +0 -10
  62. package/src/devtools/devicePreview/PreviewFrame.js +0 -214
  63. package/src/devtools/devicePreview/index.js +0 -6
  64. package/src/devtools/overlay.js +0 -105
  65. package/src/runtime/createRenderer.js +0 -22
  66. package/src/runtime/h.js +0 -93
  67. package/src/runtime/hydrate.js +0 -59
  68. package/src/runtime/jsx-dev-runtime.js +0 -7
  69. package/src/runtime/jsx-runtime.js +0 -13
  70. package/src/runtime/partialHydration.js +0 -154
  71. package/src/runtime/platform.js +0 -135
  72. package/src/runtime/renderToStream.js +0 -127
  73. package/src/runtime/renderToString.js +0 -121
  74. package/src/runtime/resume.js +0 -62
package/GUIDE.md ADDED
@@ -0,0 +1,149 @@
1
+ # Your first Orvyn app
2
+
3
+ In about 10 minutes you will build a shopping list that works on the web and on phones. No experience needed.
4
+
5
+ > This guide needs Orvyn 0.3.0 or newer.
6
+
7
+ ## 1. Install
8
+
9
+ You need [Node.js](https://nodejs.org) 24 or newer. Then, in a terminal:
10
+
11
+ ```bash
12
+ npm install -g orvyn-lang
13
+ orvyn new my-list
14
+ cd my-list
15
+ orvyn dev
16
+ ```
17
+
18
+ Your app opens in the browser. Leave this running: every time you save, the page updates.
19
+
20
+ ## 2. Show something
21
+
22
+ Open `src/app.orv`, delete everything, and write:
23
+
24
+ ```orvyn
25
+ screen Home {
26
+ Column gap: 12, padding: 24 {
27
+ Heading "Shopping list"
28
+ Text "Nothing here yet"
29
+ }
30
+ }
31
+ ```
32
+
33
+ A **screen** is one page. A **Column** puts things under each other.
34
+
35
+ ## 3. Remember things
36
+
37
+ `state` is a value that can change. When it changes, the screen updates by itself.
38
+
39
+ ```orvyn
40
+ state draft = ""
41
+ state items = []
42
+
43
+ screen Home {
44
+ Column gap: 12, padding: 24 {
45
+ Heading "Shopping list"
46
+ Input "What do you need?", bind: draft
47
+ Button "Add", onTap: add()
48
+
49
+ for item in items {
50
+ Text item
51
+ }
52
+ }
53
+ }
54
+
55
+ fn add() {
56
+ if draft != "" {
57
+ items.add(draft)
58
+ draft = ""
59
+ }
60
+ }
61
+ ```
62
+
63
+ - `bind: draft` keeps the box and `draft` the same.
64
+ - `fn` is a set of steps with a name.
65
+ - `for` repeats something for every item.
66
+
67
+ ## 4. Remove items and keep them
68
+
69
+ Change `state items = []` to this, and the list is still there after closing the app:
70
+
71
+ ```orvyn
72
+ saved state items = []
73
+ ```
74
+
75
+ Then change the loop to add a delete button:
76
+
77
+ ```orvyn
78
+ for item in items {
79
+ Row gap: 8, align: center {
80
+ Text item
81
+ Button "✕", label: "Delete", onTap: items.remove(item)
82
+ }
83
+ }
84
+ ```
85
+
86
+ `label:` is what a screen reader says instead of "✕".
87
+
88
+ ## 5. Add a second page
89
+
90
+ ```orvyn
91
+ screen About {
92
+ Column gap: 12, padding: 24 {
93
+ Heading "About"
94
+ Text "My first Orvyn app"
95
+ Button "Back", onTap: back(Home)
96
+ }
97
+ }
98
+ ```
99
+
100
+ Add this button inside `Home`:
101
+
102
+ ```orvyn
103
+ Button "About", onTap: go(About)
104
+ ```
105
+
106
+ ## 6. Check that it works
107
+
108
+ Add this at the bottom of the file:
109
+
110
+ ```orvyn
111
+ test "adds and deletes an item" {
112
+ type("What do you need?", "Milk")
113
+ tap("Add")
114
+ expect(text("Milk"))
115
+ tap("Delete")
116
+ expect(!text("Milk"))
117
+ }
118
+ ```
119
+
120
+ Open a second terminal in the same folder:
121
+
122
+ ```bash
123
+ orvyn test # does the app behave?
124
+ orvyn check # any mistakes?
125
+ ```
126
+
127
+ ## 7. Put it on a phone
128
+
129
+ ```bash
130
+ orvyn ios # iPhone simulator (needs a Mac with Xcode)
131
+ orvyn android # Android phone or emulator (needs the Android tools)
132
+ orvyn doctor # tells you what is missing
133
+ ```
134
+
135
+ ## Next
136
+
137
+ - [LANGUAGE.md](LANGUAGE.md) explains everything Orvyn can do.
138
+ - The `examples/` folder has apps with login, server data and saved storage.
139
+
140
+ ## Bonus: ask your list questions
141
+
142
+ No special symbols to learn. Write the list, then a word:
143
+
144
+ ```
145
+ Text "{items.count()} things to buy"
146
+ for item in items.search(draft) {
147
+ Text item
148
+ }
149
+ ```