orvyn-lang 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.
Files changed (63) hide show
  1. package/GUIDE.md +198 -0
  2. package/LANGUAGE.md +818 -30
  3. package/README.md +211 -250
  4. package/brand/orvyn-sunset-animated.svg +15 -0
  5. package/package.json +3 -1
  6. package/src/cli/orvyn.js +207 -16
  7. package/src/core/signal.js +104 -6
  8. package/src/devtools/runtime.js +25 -1
  9. package/src/lang/a11y.js +152 -0
  10. package/src/lang/auth.js +239 -0
  11. package/src/lang/bundle-native.js +10 -6
  12. package/src/lang/codegen.js +615 -58
  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 +69 -8
  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 +65 -4
  22. package/src/lang/native/android/OrvynDevice.kt +163 -0
  23. package/src/lang/native/android/OrvynEngine.kt +176 -7
  24. package/src/lang/native/android/OrvynRenderer.kt +970 -50
  25. package/src/lang/native/android.js +74 -11
  26. package/src/lang/native/assets.js +39 -0
  27. package/src/lang/native/build.js +140 -63
  28. package/src/lang/native/compatibility.js +57 -0
  29. package/src/lang/native/config.js +108 -0
  30. package/src/lang/native/ios/OrvynApp.swift +6 -0
  31. package/src/lang/native/ios/OrvynEngine.swift +291 -4
  32. package/src/lang/native/ios/OrvynViews.swift +769 -41
  33. package/src/lang/native/ios.js +81 -2
  34. package/src/lang/native-runtime.js +541 -55
  35. package/src/lang/native-size.js +53 -0
  36. package/src/lang/page-files.js +71 -0
  37. package/src/lang/page.js +63 -0
  38. package/src/lang/parser.js +278 -15
  39. package/src/lang/prerender.js +300 -0
  40. package/src/lang/read-import.js +12 -0
  41. package/src/lang/router.js +266 -0
  42. package/src/lang/runtime-shared.js +796 -10
  43. package/src/lang/runtime.js +399 -51
  44. package/src/lang/select.js +13 -0
  45. package/src/lang/server-code.js +233 -0
  46. package/src/lang/server-export.js +78 -0
  47. package/src/lang/server-libs.js +53 -0
  48. package/src/lang/server.js +409 -0
  49. package/src/lang/style-check.js +60 -0
  50. package/src/lang/test-runner.js +134 -0
  51. package/src/lang/types.js +317 -0
  52. package/src/lang/vite-plugin.js +108 -6
  53. package/src/lang/web-overlay.js +578 -0
  54. package/src/lang/widgets.js +94 -0
  55. package/src/lang/words.js +38 -0
  56. package/src/runtime/animations.js +24 -0
  57. package/src/runtime/appear.js +73 -0
  58. package/src/runtime/marquee.js +57 -0
  59. package/src/runtime/mount.js +120 -27
  60. package/src/runtime/patch.js +90 -11
  61. package/src/runtime/style.js +50 -9
  62. package/src/styling/fluid.js +129 -6
  63. package/src/styling/spec.js +319 -0
package/GUIDE.md ADDED
@@ -0,0 +1,198 @@
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
+ ### How routing works
107
+
108
+ Each `screen` gets an address from its name: `screen About` is `/about`. A file at `src/pages/about/index.orv` containing `screen About` is discovered automatically, included in the app, and pre-rendered by `orvyn build`. The screen name must match the folder name, ignoring capitalization.
109
+
110
+ For screens elsewhere, import them in `src/app.orv`:
111
+
112
+ ```text
113
+ use About from "./pages/about/index"
114
+ screen Home { Text "Home" }
115
+ ```
116
+
117
+ Keep a screen such as `Home` in `app.orv` to choose the home page explicitly. Imported screens are also pre-rendered during `orvyn build`; give each one a `page title:` and `description:` for search results.
118
+
119
+ ### One navbar and footer for every page
120
+
121
+ Write the layout once, with `slot` where each page's content goes. A shared component can `go()` to any screen in the project without importing it:
122
+
123
+ ```text
124
+ src/
125
+ app.orv screen Home
126
+ components/layout/index.orv component Layout
127
+ pages/about/index.orv screen About
128
+ pages/blog/index.orv screen Blog
129
+ ```
130
+
131
+ ```text
132
+ // src/components/layout/index.orv
133
+ component Layout {
134
+ Column {
135
+ Row gap: 16 {
136
+ Button "Home", onTap: go(Home)
137
+ Button "About", onTap: go(About)
138
+ Button "Blog", onTap: go(Blog)
139
+ }
140
+ slot
141
+ Text "© 2026"
142
+ }
143
+ }
144
+
145
+ // src/pages/about/index.orv
146
+ use Layout from "../../components/layout"
147
+ screen About {
148
+ page title: "About me", description: "Who I am"
149
+ Layout { Heading "About" }
150
+ }
151
+ ```
152
+
153
+ To add a page, create its folder and add one button to the layout.
154
+
155
+ ## 6. Check that it works
156
+
157
+ Add this at the bottom of the file:
158
+
159
+ ```orvyn
160
+ test "adds and deletes an item" {
161
+ type("What do you need?", "Milk")
162
+ tap("Add")
163
+ expect(text("Milk"))
164
+ tap("Delete")
165
+ expect(!text("Milk"))
166
+ }
167
+ ```
168
+
169
+ Open a second terminal in the same folder:
170
+
171
+ ```bash
172
+ orvyn test # does the app behave?
173
+ orvyn check # any mistakes?
174
+ ```
175
+
176
+ ## 7. Put it on a phone
177
+
178
+ ```bash
179
+ orvyn ios # iPhone simulator (needs a Mac with Xcode)
180
+ orvyn android # Android phone or emulator (needs the Android tools)
181
+ orvyn doctor # tells you what is missing
182
+ ```
183
+
184
+ ## Next
185
+
186
+ - [LANGUAGE.md](LANGUAGE.md) explains everything Orvyn can do.
187
+ - The `examples/` folder has apps with login, server data and saved storage.
188
+
189
+ ## Bonus: ask your list questions
190
+
191
+ No special symbols to learn. Write the list, then a word:
192
+
193
+ ```
194
+ Text "{items.count()} things to buy"
195
+ for item in items.search(draft) {
196
+ Text item
197
+ }
198
+ ```