ruby_everywhere 0.1.15 → 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 (61) hide show
  1. checksums.yaml +4 -4
  2. data/bridge/README.md +105 -2
  3. data/bridge/everywhere/bridge.js +1131 -9
  4. data/bridge/everywhere/native.css +203 -0
  5. data/bridge/package.json +6 -3
  6. data/lib/everywhere/builders/ios.rb +396 -0
  7. data/lib/everywhere/cli.rb +2 -0
  8. data/lib/everywhere/commands/build.rb +17 -1
  9. data/lib/everywhere/commands/clean.rb +19 -10
  10. data/lib/everywhere/commands/dev.rb +182 -19
  11. data/lib/everywhere/commands/doctor.rb +45 -3
  12. data/lib/everywhere/commands/icon.rb +14 -0
  13. data/lib/everywhere/commands/install.rb +37 -6
  14. data/lib/everywhere/commands/logs.rb +56 -0
  15. data/lib/everywhere/commands/platform/build.rb +3 -3
  16. data/lib/everywhere/commands/platform/runner.rb +1 -1
  17. data/lib/everywhere/commands/release.rb +1 -1
  18. data/lib/everywhere/commands/shell_dir.rb +11 -4
  19. data/lib/everywhere/config.rb +469 -1
  20. data/lib/everywhere/engine.rb +42 -1
  21. data/lib/everywhere/icon.rb +50 -0
  22. data/lib/everywhere/log_filter.rb +28 -2
  23. data/lib/everywhere/mobile_config_endpoint.rb +88 -0
  24. data/lib/everywhere/mobile_configs_controller.rb +64 -0
  25. data/lib/everywhere/native_helper.rb +352 -0
  26. data/lib/everywhere/paths.rb +41 -0
  27. data/lib/everywhere/raster.rb +17 -0
  28. data/lib/everywhere/shellout.rb +3 -1
  29. data/lib/everywhere/simulator.rb +74 -0
  30. data/lib/everywhere/ui.rb +18 -0
  31. data/lib/everywhere/version.rb +1 -1
  32. data/support/mobile/ios/App/App.xcconfig +6 -0
  33. data/support/mobile/ios/App/AppDelegate.swift +164 -0
  34. data/support/mobile/ios/App/Assets.xcassets/AccentColor.colorset/Contents.json +20 -0
  35. data/support/mobile/ios/App/Assets.xcassets/AppIcon.appiconset/AppIcon.png +0 -0
  36. data/support/mobile/ios/App/Assets.xcassets/AppIcon.appiconset/Contents.json +14 -0
  37. data/support/mobile/ios/App/Assets.xcassets/Contents.json +6 -0
  38. data/support/mobile/ios/App/Assets.xcassets/LaunchBackground.colorset/Contents.json +38 -0
  39. data/support/mobile/ios/App/Base.lproj/LaunchScreen.storyboard +32 -0
  40. data/support/mobile/ios/App/Bridge/BiometricsComponent.swift +276 -0
  41. data/support/mobile/ios/App/Bridge/HapticsComponent.swift +47 -0
  42. data/support/mobile/ios/App/Bridge/MenuComponent.swift +192 -0
  43. data/support/mobile/ios/App/Bridge/NotificationComponent.swift +56 -0
  44. data/support/mobile/ios/App/Bridge/PermissionsComponent.swift +142 -0
  45. data/support/mobile/ios/App/Bridge/StorageComponent.swift +63 -0
  46. data/support/mobile/ios/App/ErrorViewController.swift +64 -0
  47. data/support/mobile/ios/App/EverywhereConfig.swift +289 -0
  48. data/support/mobile/ios/App/EverywhereHost.swift +34 -0
  49. data/support/mobile/ios/App/Extensions/EverywhereExtensions.swift +32 -0
  50. data/support/mobile/ios/App/Info.plist +28 -0
  51. data/support/mobile/ios/App/Resources/everywhere.json +8 -0
  52. data/support/mobile/ios/App/Resources/path-configuration.json +19 -0
  53. data/support/mobile/ios/App/SceneDelegate.swift +484 -0
  54. data/support/mobile/ios/App.xcodeproj/project.pbxproj +458 -0
  55. data/support/mobile/ios/App.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  56. data/support/mobile/ios/App.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +14 -0
  57. data/support/mobile/ios/App.xcodeproj/xcshareddata/xcschemes/App.xcscheme +77 -0
  58. data/support/mobile/ios/NativeExtensions/Package.swift +26 -0
  59. data/support/mobile/ios/NativeExtensions/Sources/NativeExtensions/Exports.swift +5 -0
  60. data/support/mobile/ios/README.md +73 -0
  61. metadata +37 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 63effa5f5f00816aa20ada48ca9e1d29fd016dc98b294da2bc0c7d8e1e09d853
4
- data.tar.gz: 9f998859661f637feac481d87de6964de030b45fdf197b0c4f72286a1f80fb63
3
+ metadata.gz: b255975aa8724cb4980606ddbde415eea3a238c193ffce8530028ef5fdc63c24
4
+ data.tar.gz: 386145d42d750984da4fa800ea9b63417371937dbf67d49642a229cd92cfbb71
5
5
  SHA512:
6
- metadata.gz: 86c4032c3973f6e85dcfbb4e8e203f30acd41639c261fc1df07e43dd1c9ee31f681eb445c2a4197d656ec3e96c3b7de94ddd22bd9e3e60ac8ad392038229d0bc
7
- data.tar.gz: cc951a4ebdc8ecefffee7d418a871fe4e50fd74b676810a522792d0463aebb638307c7aaed124c2699f9b153f4e74ec8201907731a1049a43d8b8caa68c6c7ac
6
+ metadata.gz: 6af24db6e60c693ae855fa47832564074d887c18248a63be23c343c5e85c7d84cf4210017ba6bb26dae9950bb6b1394255f02cbea4d278f9407952a22f37dd6c
7
+ data.tar.gz: 368f12504a2a5748aa30eaf641eadf5b85bbd54b99e0f372015b9621510f01dc5779ca6e3e37cfab594083768815e40e48200e2c3649195c5b5e800cc7cf5557
data/bridge/README.md CHANGED
@@ -33,10 +33,108 @@ Everywhere.confirm("Sure?") // Promise<boolean>, native dialog when pos
33
33
  Everywhere.on("menu", handler) // shell events; returns an unsubscribe fn
34
34
  Everywhere.visit("/settings") // Turbo.visit with location fallback
35
35
 
36
+ Everywhere.menu({ title, items }) // Promise<item | null> — native action
37
+ // sheet in the shell, a styled bottom
38
+ // sheet everywhere else. items:
39
+ // [{ title, id?, style?, disabled? }]
40
+
36
41
  Everywhere.clipboard.write(text) // Promise<void>
37
42
  Everywhere.clipboard.read() // Promise<string | null>
43
+
44
+ Everywhere.haptics.impact("medium") // real haptics in the mobile shell;
45
+ Everywhere.haptics.notification("success") // Vibration API in browsers, no-op elsewhere
46
+ Everywhere.haptics.selection()
47
+
48
+ Everywhere.badge.set(3) // app icon badge (mobile / installed PWAs)
49
+ Everywhere.badge.clear()
50
+ Everywhere.badge.setTab("/inbox", 3) // native tab bar badge (mobile)
51
+ Everywhere.badge.clearTab("/inbox")
52
+
53
+ Everywhere.permissions.query("camera") // Promise<{name, status}>
54
+ Everywhere.permissions.request("camera") // prompts when possible
55
+ Everywhere.permissions.openSettings() // for the denied dead-end (iOS asks once)
56
+ // status: "granted" | "denied" | "prompt" | "undeclared" | "unsupported"
57
+ // mobile permissions must be declared in everywhere.yml (camera/location
58
+ // declarations carry the usage string iOS shows) — undeclared never prompts
59
+
60
+ Everywhere.storage.get("key") // Promise<any | null> — device-local settings
61
+ Everywhere.storage.set("key", value) // Promise<boolean>; any JSON value round-trips
62
+ Everywhere.storage.remove("key") // Promise<boolean>
63
+ Everywhere.storage.clear() // Promise<boolean> — clears app keys only
64
+ // UserDefaults in the mobile shell (survives web view resets and cache
65
+ // clears, unlike localStorage); localStorage-backed in browsers and the
66
+ // desktop shell. Settings, not secrets — tokens go in biometrics.credential.
67
+ ```
68
+
69
+ ### Native chrome (nav bar buttons, menus, action sheets)
70
+
71
+ Tag ordinary markup, and inside the mobile shell the bridge lifts it into real
72
+ native controls — a nav-bar button, a pull-down / overflow menu, or an action
73
+ sheet. Tapping the native control just `.click()`s the element it mirrors, so a
74
+ link navigates, a submit submits, and behavior stays defined once in the DOM. In
75
+ a browser the same markup is the plain HTML it already is. No JavaScript, no
76
+ Stimulus — CSP-safe.
77
+
78
+ ```html
79
+ <!-- becomes a nav-bar button (right side); icons are per-platform like tabs -->
80
+ <a href="/notes/new" data-everywhere-nav-button
81
+ data-everywhere-nav-title="New"
82
+ data-everywhere-nav-icon-ios="plus"
83
+ data-everywhere-nav-icon-android="add">New</a>
84
+
85
+ <!-- a submit button in the nav bar -->
86
+ <button type="submit" data-everywhere-nav-button
87
+ data-everywhere-nav-title="Save" data-everywhere-nav-style="done">Save</button>
88
+
89
+ <!-- a nav-bar pull-down / overflow menu (defaults to the ⋯ icon) -->
90
+ <div data-everywhere-nav-menu data-everywhere-nav-title="More">
91
+ <a href="/share" data-everywhere-menu-item data-everywhere-menu-title="Share">Share</a>
92
+ <button form="delete_1" data-everywhere-menu-item
93
+ data-everywhere-menu-title="Delete"
94
+ data-everywhere-menu-style="destructive">Delete</button>
95
+ </div>
96
+
97
+ <!-- an in-content action sheet: a trigger and the items it opens -->
98
+ <div data-everywhere-menu>
99
+ <button data-everywhere-menu-trigger>Options</button>
100
+ <div data-everywhere-menu-items>
101
+ <a href="/x/edit" data-everywhere-menu-item>Edit</a>
102
+ </div>
103
+ </div>
104
+ ```
105
+
106
+ Rails ships helpers that emit exactly this — `everywhere_nav_button`,
107
+ `everywhere_submit_button`, `everywhere_nav_menu` / `everywhere_menu_item`,
108
+ `everywhere_menu`, and `everywhere_fab` (a floating action button). Include
109
+ `everywhere/native.css` for the FAB, the action-sheet fallback, and the
110
+ safe-area utilities.
111
+
112
+ ### Multi-instance apps
113
+
114
+ Apps whose users pick a server — one hosted platform, many instances — opt in
115
+ with `remote.instances: true` in `everywhere.yml`. The mobile shell then boots
116
+ into `remote.url` (your hosted picker page) until that page picks an instance:
117
+
118
+ ```js
119
+ Everywhere.instance.supported // true in a shell built with remote.instances
120
+ Everywhere.instance.current // active instance URL, or null (= built-in root)
121
+
122
+ Everywhere.instance.set("https://acme.example.com")
123
+ // validates, persists, and fully resets the app onto the instance — every
124
+ // later launch boots straight there. {to: "/path"} lands somewhere specific.
125
+
126
+ Everywhere.instance.clear() // back to the picker (and resets again)
38
127
  ```
39
128
 
129
+ In a plain browser `set()` simply navigates to the URL — going there is what
130
+ picking an instance means on the web.
131
+
132
+ Declarative forms need no JS: elements with `data-everywhere-haptic`
133
+ (`"light"`, `"impact:heavy"`, `"notification:error"`, `"selection"`) play on
134
+ tap, and `<meta name="everywhere:badge">` / `<meta name="everywhere:tab-badge">`
135
+ tags (the `everywhere_badge` / `everywhere_tab_badge` Rails helpers) are
136
+ applied on every Turbo visit.
137
+
40
138
  ### Auto-updates
41
139
 
42
140
  Inside the desktop shell, apps with an update feed configured can check,
@@ -69,8 +167,13 @@ In a plain browser tab the updates API is inert: `check()` resolves
69
167
  clipboard, shell events, and auto-updates are native.
70
168
  - **browser** — honest web fallbacks: the Notification API, `window.confirm`,
71
169
  `navigator.clipboard`, DOM CustomEvents.
72
- - **mobile** — Hotwire Native detection is live; behavior currently falls back
73
- to the browser adapter until the bridge-component adapter lands.
170
+ - **mobile** — Hotwire Native (iOS shell). `notify()` delivers a native local
171
+ notification via the shell's `everywhere--notification` bridge component
172
+ (web-bridge handshake is installed automatically unless the app already
173
+ loads `@hotwired/hotwire-native-bridge` — first one wins, like the official
174
+ package). `confirm()`/clipboard use the browser fallbacks, which are native
175
+ in a WKWebView anyway. Everything degrades to browser behavior outside the
176
+ shell.
74
177
 
75
178
  ## License
76
179