orvyn-lang 0.2.0 → 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 (55) hide show
  1. package/GUIDE.md +149 -0
  2. package/LANGUAGE.md +744 -27
  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 +186 -10
  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 +428 -57
  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 +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 +518 -44
  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 +266 -4
  30. package/src/lang/native/ios/OrvynViews.swift +429 -34
  31. package/src/lang/native/ios.js +75 -2
  32. package/src/lang/native-runtime.js +406 -56
  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 +792 -10
  39. package/src/lang/runtime.js +362 -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/vite-plugin.js +82 -3
  48. package/src/lang/web-overlay.js +578 -0
  49. package/src/lang/widgets.js +94 -0
  50. package/src/lang/words.js +38 -0
  51. package/src/runtime/mount.js +116 -27
  52. package/src/runtime/patch.js +90 -11
  53. package/src/runtime/style.js +11 -1
  54. package/src/styling/fluid.js +91 -4
  55. package/src/styling/spec.js +306 -0
@@ -1,6 +1,7 @@
1
1
  import { readFileSync } from "node:fs";
2
2
  import { fileURLToPath } from "node:url";
3
3
  import { join } from "node:path";
4
+ import { PERMISSIONS } from "./config.js";
4
5
  const templateDir = fileURLToPath(new URL("./ios/", import.meta.url));
5
6
  function iosTargetName(appName) {
6
7
  const cleaned = appName.replace(/[^A-Za-z0-9]/g, "");
@@ -15,21 +16,85 @@ function generateIOSProject(appJs, config) {
15
16
  content: readFileSync(join(templateDir, name), "utf-8")
16
17
  })),
17
18
  { path: `${target}/app.js`, content: appJs },
19
+ { path: `${target}-Info.plist`, content: infoPlist(config) },
20
+ { path: `${target}/PrivacyInfo.xcprivacy`, content: PRIVACY },
21
+ ...assets(target, config),
18
22
  { path: `${target}.xcodeproj/project.pbxproj`, content: pbxproj(target, config) }
19
23
  ];
20
24
  }
25
+ const plist = (body) => `<?xml version="1.0" encoding="UTF-8"?>
26
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
27
+ <plist version="1.0">
28
+ <dict>
29
+ ${body}
30
+ </dict>
31
+ </plist>
32
+ `;
33
+ const xmlText = (value) => value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
34
+ function infoPlist(config) {
35
+ const lines = [];
36
+ for (const [name, reason] of Object.entries(config.permissions ?? {})) {
37
+ for (const key of PERMISSIONS[name].ios) {
38
+ lines.push(` <key>${key}</key>`, ` <string>${xmlText(reason || `${config.appName} needs to ${PERMISSIONS[name].why}.`)}</string>`);
39
+ }
40
+ }
41
+ if (config.splash) {
42
+ lines.push(" <key>UILaunchScreen</key>", " <dict>", " <key>UIColorName</key>", " <string>LaunchBackground</string>");
43
+ if (config.splash.image) lines.push(" <key>UIImageName</key>", " <string>LaunchImage</string>");
44
+ lines.push(" </dict>");
45
+ }
46
+ return plist(lines.join("\n"));
47
+ }
48
+ const PRIVACY = plist(` <key>NSPrivacyTracking</key>
49
+ <false/>
50
+ <key>NSPrivacyAccessedAPITypes</key>
51
+ <array>
52
+ <dict>
53
+ <key>NSPrivacyAccessedAPIType</key>
54
+ <string>NSPrivacyAccessedAPICategoryUserDefaults</string>
55
+ <key>NSPrivacyAccessedAPITypeReasons</key>
56
+ <array>
57
+ <string>CA92.1</string>
58
+ </array>
59
+ </dict>
60
+ </array>`);
61
+ function assets(target, config) {
62
+ const dir = `${target}/Assets.xcassets`;
63
+ const info = { author: "xcode", version: 1 };
64
+ const json = (path, value) => ({ path: `${dir}/${path}Contents.json`, content: JSON.stringify({ ...value, info }, null, 2) });
65
+ const copy = (path, copyFrom) => ({ path: `${dir}/${path}`, content: "", copyFrom });
66
+ const files = [json("", {})];
67
+ files.push(json("AppIcon.appiconset/", {
68
+ images: [{ idiom: "universal", platform: "ios", size: "1024x1024", ...config.icon ? { filename: "icon.png" } : {} }]
69
+ }));
70
+ if (config.icon) files.push(copy("AppIcon.appiconset/icon.png", config.icon));
71
+ if (config.splash) {
72
+ const [red, green, blue] = [1, 3, 5].map((i) => `0x${config.splash.color.slice(i, i + 2).toUpperCase()}`);
73
+ files.push(json("LaunchBackground.colorset/", {
74
+ colors: [{ idiom: "universal", color: { "color-space": "srgb", components: { red, green, blue, alpha: "1.000" } } }]
75
+ }));
76
+ if (config.splash.image) {
77
+ files.push(json("LaunchImage.imageset/", { images: [{ idiom: "universal", filename: "splash.png" }] }));
78
+ files.push(copy("LaunchImage.imageset/splash.png", config.splash.image));
79
+ }
80
+ }
81
+ return files;
82
+ }
21
83
  function pbxproj(target, config) {
22
84
  const deployment = config.iosDeploymentTarget || "16.0";
23
85
  const team = config.teamId || "";
24
86
  const q = (value) => JSON.stringify(value);
25
87
  const targetSettings = (extra) => `
88
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
26
89
  CODE_SIGN_STYLE = Automatic;
27
- CURRENT_PROJECT_VERSION = 1;
90
+ CURRENT_PROJECT_VERSION = ${config.build ?? 1};
28
91
  DEVELOPMENT_TEAM = ${q(team)};
29
92
  GENERATE_INFOPLIST_FILE = YES;
93
+ INFOPLIST_FILE = ${q(`${target}-Info.plist`)};
30
94
  INFOPLIST_KEY_CFBundleDisplayName = ${q(config.appName)};
31
95
  INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
32
- INFOPLIST_KEY_UILaunchScreen_Generation = YES;
96
+ INFOPLIST_KEY_UILaunchScreen_Generation = ${config.splash ? "NO" : "YES"};
97
+ "INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad" = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
33
98
  INFOPLIST_KEY_UISupportedInterfaceOrientations = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
34
99
  IPHONEOS_DEPLOYMENT_TARGET = ${deployment};
35
100
  LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
@@ -51,6 +116,8 @@ function pbxproj(target, config) {
51
116
  0A0000000000000000000002 /* OrvynEngine.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0B0000000000000000000002 /* OrvynEngine.swift */; };
52
117
  0A0000000000000000000003 /* OrvynViews.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0B0000000000000000000003 /* OrvynViews.swift */; };
53
118
  0A0000000000000000000004 /* app.js in Resources */ = {isa = PBXBuildFile; fileRef = 0B0000000000000000000004 /* app.js */; };
119
+ 0A0000000000000000000005 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 0B0000000000000000000005 /* Assets.xcassets */; };
120
+ 0A0000000000000000000006 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 0B0000000000000000000006 /* PrivacyInfo.xcprivacy */; };
54
121
  /* End PBXBuildFile section */
55
122
 
56
123
  /* Begin PBXFileReference section */
@@ -58,6 +125,8 @@ function pbxproj(target, config) {
58
125
  0B0000000000000000000002 /* OrvynEngine.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OrvynEngine.swift; sourceTree = "<group>"; };
59
126
  0B0000000000000000000003 /* OrvynViews.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OrvynViews.swift; sourceTree = "<group>"; };
60
127
  0B0000000000000000000004 /* app.js */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.javascript; path = app.js; sourceTree = "<group>"; };
128
+ 0B0000000000000000000005 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
129
+ 0B0000000000000000000006 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
61
130
  0B0000000000000000000010 /* ${target}.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ${q(`${target}.app`)}; sourceTree = BUILT_PRODUCTS_DIR; };
62
131
  /* End PBXFileReference section */
63
132
 
@@ -87,6 +156,8 @@ function pbxproj(target, config) {
87
156
  0B0000000000000000000002 /* OrvynEngine.swift */,
88
157
  0B0000000000000000000003 /* OrvynViews.swift */,
89
158
  0B0000000000000000000004 /* app.js */,
159
+ 0B0000000000000000000005 /* Assets.xcassets */,
160
+ 0B0000000000000000000006 /* PrivacyInfo.xcprivacy */,
90
161
  );
91
162
  path = ${q(target)};
92
163
  sourceTree = "<group>";
@@ -153,6 +224,8 @@ function pbxproj(target, config) {
153
224
  buildActionMask = 2147483647;
154
225
  files = (
155
226
  0A0000000000000000000004 /* app.js in Resources */,
227
+ 0A0000000000000000000005 /* Assets.xcassets in Resources */,
228
+ 0A0000000000000000000006 /* PrivacyInfo.xcprivacy in Resources */,
156
229
  );
157
230
  runOnlyForDeploymentPostprocessing = 0;
158
231
  };