hotwire_native_version_gate 1.1.0 → 1.2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 82aeb1d4b3df07819f0139ef15823d609d7c0b9aecd997ab6c66ce688af5a4eb
4
- data.tar.gz: ad201566715e4092834b9b6dab4fb3938df20768e5de42d8c216a6957e397920
3
+ metadata.gz: 2b97bba1a1e02a907c1e5cafb0ec08cec2bb737a6908eac6f31f05faacadbdaf
4
+ data.tar.gz: e5a764d6f3b9cc83a68064a567dcad5188000c9fb6ec3538e78ba450ca4a1961
5
5
  SHA512:
6
- metadata.gz: 0c3de617885b7dd0db677dfa453ede08723af66876d787546c939fb93172df86d45f09c0cf7ab167d9661b367b11f51e13fa76b9c6662930b8a61938897c52f2
7
- data.tar.gz: 9f44ebb33a9eecd21ab310944a238eb7030422a4ad854ed43dc97128e44572fa437050eda9eb62b72a273aebecf2f29c1d21649ac8284df967b2e541f0851e2d
6
+ metadata.gz: 64f478dc48e9b1a9dcb31860533e6db3aefbc22271dddbb56c9b01c7f3eb6ea398110389cc2bf726e096ab5adecb815e0a5adddc0c63ccd0a498267336859129
7
+ data.tar.gz: f644a5ffe8d3a47298247936879f59f73144d2f16f63ae9d5735dc9c720d98f92dc8af69326bf1324565181dbe2057bfa94227d85a1e9cbaf4606aec745f2fca
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.0
1
+ 1.2.0
@@ -20,7 +20,7 @@ module HotwireNativeVersionGate
20
20
 
21
21
  included do
22
22
  if respond_to?(:helper_method)
23
- helper_method :native_feature?, :native_ios?, :native_android?, :native_app_version, :native_app_platform
23
+ helper_method :native_feature?, :native_ios?, :native_android?, :native_app_version, :native_app_platform, :hotwire_native_html_attributes
24
24
  end
25
25
  end
26
26
 
@@ -54,5 +54,20 @@ module HotwireNativeVersionGate
54
54
  user_agent = respond_to?(:request) && request.respond_to?(:user_agent) ? request.user_agent : nil
55
55
  VersionGate.app_platform(user_agent)
56
56
  end
57
+
58
+ # Space-separated data attributes for the root <html> tag, for Tailwind custom variants.
59
+ #
60
+ # <html <%= hotwire_native_html_attributes %>>
61
+ #
62
+ # Emits e.g. `data-hotwire-native data-native-ios` for iOS, or an empty string in the browser.
63
+ # Uses `hotwire_native_app?` from turbo-rails when available; otherwise falls back to platform helpers.
64
+ def hotwire_native_html_attributes
65
+ attrs = []
66
+ hotwire_native = respond_to?(:hotwire_native_app?) ? hotwire_native_app? : (native_ios? || native_android?)
67
+ attrs << "data-hotwire-native" if hotwire_native
68
+ attrs << "data-native-ios" if native_ios?
69
+ attrs << "data-native-android" if native_android?
70
+ attrs.join(" ")
71
+ end
57
72
  end
58
73
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hotwire_native_version_gate
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stuart Yamartino