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
@@ -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,87 @@ function generateIOSProject(appJs, config) {
15
16
  content: readFileSync(join(templateDir, name), "utf-8")
16
17
  })),
17
18
  { path: `${target}/app.js`, content: appJs },
19
+ // images from public/ are copied in here by the build; this keeps the folder
20
+ { path: `${target}/public/.orvyn`, content: "" },
21
+ { path: `${target}-Info.plist`, content: infoPlist(config) },
22
+ { path: `${target}/PrivacyInfo.xcprivacy`, content: PRIVACY },
23
+ ...assets(target, config),
18
24
  { path: `${target}.xcodeproj/project.pbxproj`, content: pbxproj(target, config) }
19
25
  ];
20
26
  }
27
+ const plist = (body) => `<?xml version="1.0" encoding="UTF-8"?>
28
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
29
+ <plist version="1.0">
30
+ <dict>
31
+ ${body}
32
+ </dict>
33
+ </plist>
34
+ `;
35
+ const xmlText = (value) => value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
36
+ function infoPlist(config) {
37
+ const lines = [];
38
+ for (const [name, reason] of Object.entries(config.permissions ?? {})) {
39
+ for (const key of PERMISSIONS[name].ios) {
40
+ lines.push(` <key>${key}</key>`, ` <string>${xmlText(reason || `${config.appName} needs to ${PERMISSIONS[name].why}.`)}</string>`);
41
+ }
42
+ }
43
+ if (config.splash) {
44
+ lines.push(" <key>UILaunchScreen</key>", " <dict>", " <key>UIColorName</key>", " <string>LaunchBackground</string>");
45
+ if (config.splash.image) lines.push(" <key>UIImageName</key>", " <string>LaunchImage</string>");
46
+ lines.push(" </dict>");
47
+ }
48
+ return plist(lines.join("\n"));
49
+ }
50
+ const PRIVACY = plist(` <key>NSPrivacyTracking</key>
51
+ <false/>
52
+ <key>NSPrivacyAccessedAPITypes</key>
53
+ <array>
54
+ <dict>
55
+ <key>NSPrivacyAccessedAPIType</key>
56
+ <string>NSPrivacyAccessedAPICategoryUserDefaults</string>
57
+ <key>NSPrivacyAccessedAPITypeReasons</key>
58
+ <array>
59
+ <string>CA92.1</string>
60
+ </array>
61
+ </dict>
62
+ </array>`);
63
+ function assets(target, config) {
64
+ const dir = `${target}/Assets.xcassets`;
65
+ const info = { author: "xcode", version: 1 };
66
+ const json = (path, value) => ({ path: `${dir}/${path}Contents.json`, content: JSON.stringify({ ...value, info }, null, 2) });
67
+ const copy = (path, copyFrom) => ({ path: `${dir}/${path}`, content: "", copyFrom });
68
+ const files = [json("", {})];
69
+ files.push(json("AppIcon.appiconset/", {
70
+ images: [{ idiom: "universal", platform: "ios", size: "1024x1024", ...config.icon ? { filename: "icon.png" } : {} }]
71
+ }));
72
+ if (config.icon) files.push(copy("AppIcon.appiconset/icon.png", config.icon));
73
+ if (config.splash) {
74
+ const [red, green, blue] = [1, 3, 5].map((i) => `0x${config.splash.color.slice(i, i + 2).toUpperCase()}`);
75
+ files.push(json("LaunchBackground.colorset/", {
76
+ colors: [{ idiom: "universal", color: { "color-space": "srgb", components: { red, green, blue, alpha: "1.000" } } }]
77
+ }));
78
+ if (config.splash.image) {
79
+ files.push(json("LaunchImage.imageset/", { images: [{ idiom: "universal", filename: "splash.png" }] }));
80
+ files.push(copy("LaunchImage.imageset/splash.png", config.splash.image));
81
+ }
82
+ }
83
+ return files;
84
+ }
21
85
  function pbxproj(target, config) {
22
86
  const deployment = config.iosDeploymentTarget || "16.0";
23
87
  const team = config.teamId || "";
24
88
  const q = (value) => JSON.stringify(value);
25
89
  const targetSettings = (extra) => `
90
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
26
91
  CODE_SIGN_STYLE = Automatic;
27
- CURRENT_PROJECT_VERSION = 1;
92
+ CURRENT_PROJECT_VERSION = ${config.build ?? 1};
28
93
  DEVELOPMENT_TEAM = ${q(team)};
29
94
  GENERATE_INFOPLIST_FILE = YES;
95
+ INFOPLIST_FILE = ${q(`${target}-Info.plist`)};
30
96
  INFOPLIST_KEY_CFBundleDisplayName = ${q(config.appName)};
31
97
  INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
32
- INFOPLIST_KEY_UILaunchScreen_Generation = YES;
98
+ INFOPLIST_KEY_UILaunchScreen_Generation = ${config.splash ? "NO" : "YES"};
99
+ "INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad" = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
33
100
  INFOPLIST_KEY_UISupportedInterfaceOrientations = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
34
101
  IPHONEOS_DEPLOYMENT_TARGET = ${deployment};
35
102
  LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
@@ -51,6 +118,9 @@ function pbxproj(target, config) {
51
118
  0A0000000000000000000002 /* OrvynEngine.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0B0000000000000000000002 /* OrvynEngine.swift */; };
52
119
  0A0000000000000000000003 /* OrvynViews.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0B0000000000000000000003 /* OrvynViews.swift */; };
53
120
  0A0000000000000000000004 /* app.js in Resources */ = {isa = PBXBuildFile; fileRef = 0B0000000000000000000004 /* app.js */; };
121
+ 0A0000000000000000000005 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 0B0000000000000000000005 /* Assets.xcassets */; };
122
+ 0A0000000000000000000006 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 0B0000000000000000000006 /* PrivacyInfo.xcprivacy */; };
123
+ 0A0000000000000000000007 /* public in Resources */ = {isa = PBXBuildFile; fileRef = 0B0000000000000000000007 /* public */; };
54
124
  /* End PBXBuildFile section */
55
125
 
56
126
  /* Begin PBXFileReference section */
@@ -58,6 +128,9 @@ function pbxproj(target, config) {
58
128
  0B0000000000000000000002 /* OrvynEngine.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OrvynEngine.swift; sourceTree = "<group>"; };
59
129
  0B0000000000000000000003 /* OrvynViews.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OrvynViews.swift; sourceTree = "<group>"; };
60
130
  0B0000000000000000000004 /* app.js */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.javascript; path = app.js; sourceTree = "<group>"; };
131
+ 0B0000000000000000000005 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
132
+ 0B0000000000000000000006 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
133
+ 0B0000000000000000000007 /* public */ = {isa = PBXFileReference; lastKnownFileType = folder; path = public; sourceTree = "<group>"; };
61
134
  0B0000000000000000000010 /* ${target}.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ${q(`${target}.app`)}; sourceTree = BUILT_PRODUCTS_DIR; };
62
135
  /* End PBXFileReference section */
63
136
 
@@ -87,6 +160,9 @@ function pbxproj(target, config) {
87
160
  0B0000000000000000000002 /* OrvynEngine.swift */,
88
161
  0B0000000000000000000003 /* OrvynViews.swift */,
89
162
  0B0000000000000000000004 /* app.js */,
163
+ 0B0000000000000000000005 /* Assets.xcassets */,
164
+ 0B0000000000000000000006 /* PrivacyInfo.xcprivacy */,
165
+ 0B0000000000000000000007 /* public */,
90
166
  );
91
167
  path = ${q(target)};
92
168
  sourceTree = "<group>";
@@ -153,6 +229,9 @@ function pbxproj(target, config) {
153
229
  buildActionMask = 2147483647;
154
230
  files = (
155
231
  0A0000000000000000000004 /* app.js in Resources */,
232
+ 0A0000000000000000000005 /* Assets.xcassets in Resources */,
233
+ 0A0000000000000000000006 /* PrivacyInfo.xcprivacy in Resources */,
234
+ 0A0000000000000000000007 /* public in Resources */,
156
235
  );
157
236
  runOnlyForDeploymentPostprocessing = 0;
158
237
  };