@symbiote-native/sensors 0.2.1 → 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 (157) hide show
  1. package/README.md +61 -21
  2. package/build/angular/index.d.ts +1 -1
  3. package/build/angular/index.js +1 -1
  4. package/build/angular/services/accelerometer.service/index.js +8 -13
  5. package/build/angular/services/barometer.service/index.js +8 -13
  6. package/build/angular/services/device-motion.service/index.js +8 -13
  7. package/build/angular/services/gyroscope.service/index.js +8 -13
  8. package/build/angular/services/light-sensor.service/index.js +8 -13
  9. package/build/angular/services/magnetometer-uncalibrated.service/index.js +10 -14
  10. package/build/angular/services/magnetometer.service/index.js +8 -13
  11. package/build/angular/services/pedometer.service/index.js +7 -11
  12. package/build/core/device-motion.js +3 -4
  13. package/build/core/index.d.ts +5 -5
  14. package/build/core/index.js +5 -5
  15. package/build/react/hooks/use-magnetometer-uncalibrated/index.js +1 -1
  16. package/build/react/index.d.ts +1 -1
  17. package/build/react/index.js +1 -1
  18. package/build/solid/index.d.ts +10 -0
  19. package/build/solid/index.js +17 -0
  20. package/build/solid/primitives/create-accelerometer.d.ts +4 -0
  21. package/build/solid/primitives/create-accelerometer.js +5 -0
  22. package/build/solid/primitives/create-barometer.d.ts +4 -0
  23. package/build/solid/primitives/create-barometer.js +5 -0
  24. package/build/solid/primitives/create-device-motion.d.ts +4 -0
  25. package/build/solid/primitives/create-device-motion.js +5 -0
  26. package/build/solid/primitives/create-gyroscope.d.ts +4 -0
  27. package/build/solid/primitives/create-gyroscope.js +5 -0
  28. package/build/solid/primitives/create-light-sensor.d.ts +4 -0
  29. package/build/solid/primitives/create-light-sensor.js +5 -0
  30. package/build/solid/primitives/create-magnetometer-uncalibrated.d.ts +4 -0
  31. package/build/solid/primitives/create-magnetometer-uncalibrated.js +5 -0
  32. package/build/solid/primitives/create-magnetometer.d.ts +4 -0
  33. package/build/solid/primitives/create-magnetometer.js +5 -0
  34. package/build/solid/primitives/create-pedometer.d.ts +3 -0
  35. package/build/solid/primitives/create-pedometer.js +22 -0
  36. package/build/solid/primitives/device-sensor-accessor.d.ts +9 -0
  37. package/build/solid/primitives/device-sensor-accessor.js +66 -0
  38. package/build/svelte/index.d.ts +16 -0
  39. package/build/svelte/index.js +14 -0
  40. package/build/svelte/runes/use-accelerometer.svelte.d.ts +4 -0
  41. package/build/svelte/runes/use-accelerometer.svelte.js +31 -0
  42. package/build/svelte/runes/use-barometer.svelte.d.ts +4 -0
  43. package/build/svelte/runes/use-barometer.svelte.js +22 -0
  44. package/build/svelte/runes/use-device-motion.svelte.d.ts +4 -0
  45. package/build/svelte/runes/use-device-motion.svelte.js +22 -0
  46. package/build/svelte/runes/use-gyroscope.svelte.d.ts +4 -0
  47. package/build/svelte/runes/use-gyroscope.svelte.js +22 -0
  48. package/build/svelte/runes/use-light-sensor.svelte.d.ts +4 -0
  49. package/build/svelte/runes/use-light-sensor.svelte.js +22 -0
  50. package/build/svelte/runes/use-magnetometer-uncalibrated.svelte.d.ts +4 -0
  51. package/build/svelte/runes/use-magnetometer-uncalibrated.svelte.js +22 -0
  52. package/build/svelte/runes/use-magnetometer.svelte.d.ts +4 -0
  53. package/build/svelte/runes/use-magnetometer.svelte.js +22 -0
  54. package/build/svelte/runes/use-pedometer.svelte.d.ts +4 -0
  55. package/build/svelte/runes/use-pedometer.svelte.js +20 -0
  56. package/build/vue/composables/use-barometer/index.js +1 -1
  57. package/build/vue/composables/use-device-motion/index.js +1 -1
  58. package/build/vue/composables/use-gyroscope/index.js +1 -1
  59. package/build/vue/composables/use-light-sensor/index.js +1 -1
  60. package/build/vue/composables/use-magnetometer/index.js +1 -1
  61. package/build/vue/composables/use-pedometer/index.js +1 -1
  62. package/build/vue/index.d.ts +1 -1
  63. package/build/vue/index.js +1 -1
  64. package/build-ngc/angular/index.d.ts +1 -1
  65. package/build-ngc/angular/index.js +1 -1
  66. package/build-ngc/angular/index.js.map +1 -1
  67. package/build-ngc/angular/services/accelerometer.service/index.js +11 -16
  68. package/build-ngc/angular/services/accelerometer.service/index.js.map +1 -1
  69. package/build-ngc/angular/services/barometer.service/index.js +11 -16
  70. package/build-ngc/angular/services/barometer.service/index.js.map +1 -1
  71. package/build-ngc/angular/services/device-motion.service/index.js +11 -16
  72. package/build-ngc/angular/services/device-motion.service/index.js.map +1 -1
  73. package/build-ngc/angular/services/gyroscope.service/index.js +11 -16
  74. package/build-ngc/angular/services/gyroscope.service/index.js.map +1 -1
  75. package/build-ngc/angular/services/light-sensor.service/index.js +11 -16
  76. package/build-ngc/angular/services/light-sensor.service/index.js.map +1 -1
  77. package/build-ngc/angular/services/magnetometer-uncalibrated.service/index.js +13 -17
  78. package/build-ngc/angular/services/magnetometer-uncalibrated.service/index.js.map +1 -1
  79. package/build-ngc/angular/services/magnetometer.service/index.js +11 -16
  80. package/build-ngc/angular/services/magnetometer.service/index.js.map +1 -1
  81. package/build-ngc/angular/services/pedometer.service/index.js +10 -14
  82. package/build-ngc/angular/services/pedometer.service/index.js.map +1 -1
  83. package/build-ngc/core/barometer.js.map +1 -1
  84. package/build-ngc/core/device-motion.js +3 -4
  85. package/build-ngc/core/device-motion.js.map +1 -1
  86. package/build-ngc/core/device-sensor.js.map +1 -1
  87. package/build-ngc/core/gyroscope.js.map +1 -1
  88. package/build-ngc/core/index.d.ts +5 -5
  89. package/build-ngc/core/index.js +5 -5
  90. package/build-ngc/core/index.js.map +1 -1
  91. package/build-ngc/core/magnetometer-uncalibrated.js.map +1 -1
  92. package/build-ngc/core/native/exponent-barometer.js.map +1 -1
  93. package/build-ngc/core/native/exponent-device-motion.js.map +1 -1
  94. package/build-ngc/core/native/exponent-gyroscope.js.map +1 -1
  95. package/build-ngc/core/native/exponent-light-sensor/index.ios.js.map +1 -1
  96. package/build-ngc/core/native/exponent-magnetometer-uncalibrated.js.map +1 -1
  97. package/build-ngc/core/native/exponent-pedometer.js.map +1 -1
  98. package/build-ngc/core/pedometer.js.map +1 -1
  99. package/package.json +42 -14
  100. package/src/angular/index.ts +5 -1
  101. package/src/angular/services/accelerometer.service/index.ts +18 -14
  102. package/src/angular/services/barometer.service/index.ts +18 -14
  103. package/src/angular/services/device-motion.service/index.ts +18 -14
  104. package/src/angular/services/gyroscope.service/index.ts +18 -14
  105. package/src/angular/services/light-sensor.service/index.ts +18 -14
  106. package/src/angular/services/magnetometer-uncalibrated.service/index.ts +29 -17
  107. package/src/angular/services/magnetometer.service/index.ts +18 -14
  108. package/src/angular/services/pedometer.service/index.ts +14 -11
  109. package/src/core/barometer.ts +4 -1
  110. package/src/core/device-motion.ts +15 -6
  111. package/src/core/device-sensor.ts +8 -2
  112. package/src/core/gyroscope.ts +4 -1
  113. package/src/core/index.ts +25 -5
  114. package/src/core/magnetometer-uncalibrated.ts +2 -1
  115. package/src/core/native/exponent-barometer.ts +3 -3
  116. package/src/core/native/exponent-device-motion.ts +8 -6
  117. package/src/core/native/exponent-gyroscope.ts +3 -3
  118. package/src/core/native/exponent-light-sensor/index.ios.ts +7 -6
  119. package/src/core/native/exponent-magnetometer-uncalibrated.ts +2 -1
  120. package/src/core/native/exponent-pedometer.ts +4 -1
  121. package/src/core/pedometer.ts +7 -2
  122. package/src/react/hooks/use-accelerometer/index.ts +5 -2
  123. package/src/react/hooks/use-barometer/index.ts +6 -2
  124. package/src/react/hooks/use-device-motion/index.ts +5 -2
  125. package/src/react/hooks/use-gyroscope/index.ts +6 -2
  126. package/src/react/hooks/use-light-sensor/index.ts +5 -2
  127. package/src/react/hooks/use-magnetometer/index.ts +5 -2
  128. package/src/react/hooks/use-magnetometer-uncalibrated/index.ts +6 -2
  129. package/src/react/index.ts +5 -1
  130. package/src/solid/index.ts +19 -0
  131. package/src/solid/primitives/create-accelerometer.ts +16 -0
  132. package/src/solid/primitives/create-barometer.ts +16 -0
  133. package/src/solid/primitives/create-device-motion.ts +16 -0
  134. package/src/solid/primitives/create-gyroscope.ts +16 -0
  135. package/src/solid/primitives/create-light-sensor.ts +16 -0
  136. package/src/solid/primitives/create-magnetometer-uncalibrated.ts +19 -0
  137. package/src/solid/primitives/create-magnetometer.ts +16 -0
  138. package/src/solid/primitives/create-pedometer.ts +31 -0
  139. package/src/solid/primitives/device-sensor-accessor.ts +105 -0
  140. package/src/svelte/index.ts +33 -0
  141. package/src/svelte/runes/use-accelerometer.svelte.ts +40 -0
  142. package/src/svelte/runes/use-barometer.svelte.ts +31 -0
  143. package/src/svelte/runes/use-device-motion.svelte.ts +31 -0
  144. package/src/svelte/runes/use-gyroscope.svelte.ts +31 -0
  145. package/src/svelte/runes/use-light-sensor.svelte.ts +31 -0
  146. package/src/svelte/runes/use-magnetometer-uncalibrated.svelte.ts +32 -0
  147. package/src/svelte/runes/use-magnetometer.svelte.ts +31 -0
  148. package/src/svelte/runes/use-pedometer.svelte.ts +27 -0
  149. package/src/svelte/svelte-ambient.d.ts +6 -0
  150. package/src/vue/composables/use-accelerometer/index.ts +3 -1
  151. package/src/vue/composables/use-barometer/index.ts +8 -2
  152. package/src/vue/composables/use-device-motion/index.ts +8 -2
  153. package/src/vue/composables/use-gyroscope/index.ts +8 -2
  154. package/src/vue/composables/use-light-sensor/index.ts +8 -2
  155. package/src/vue/composables/use-magnetometer/index.ts +8 -2
  156. package/src/vue/composables/use-pedometer/index.ts +5 -1
  157. package/src/vue/index.ts +5 -1
@@ -1 +1 @@
1
- {"version":3,"file":"exponent-device-motion.js","sourceRoot":"","sources":["../../../src/core/native/exponent-device-motion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAIxD,MAAM,kCAAkC,GAAG,sBAAsB,CAAC;AAQlE,MAAM,CAAC,MAAM,oBAAoB,GAAG,mBAAmB,CACrD,kCAAkC,CACnC,CAAC"}
1
+ {"version":3,"file":"exponent-device-motion.js","sourceRoot":"","sources":["../../../src/core/native/exponent-device-motion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAIxD,MAAM,kCAAkC,GAAG,sBAAsB,CAAC;AASlE,MAAM,CAAC,MAAM,oBAAoB,GAC/B,mBAAmB,CACjB,kCAAkC,CACnC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"exponent-gyroscope.js","sourceRoot":"","sources":["../../../src/core/native/exponent-gyroscope.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAIxD,MAAM,8BAA8B,GAAG,mBAAmB,CAAC;AAE3D,MAAM,CAAC,MAAM,iBAAiB,GAAG,mBAAmB,CAClD,8BAA8B,CAC/B,CAAC"}
1
+ {"version":3,"file":"exponent-gyroscope.js","sourceRoot":"","sources":["../../../src/core/native/exponent-gyroscope.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAIxD,MAAM,8BAA8B,GAAG,mBAAmB,CAAC;AAE3D,MAAM,CAAC,MAAM,iBAAiB,GAAG,mBAAmB,CAElD,8BAA8B,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.ios.js","sourceRoot":"","sources":["../../../../src/core/native/exponent-light-sensor/index.ios.ts"],"names":[],"mappings":"AAMA,MAAM,CAAC,MAAM,mBAAmB,GAAiD;IAC/E,WAAW,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,GAAE,CAAC,EAAE,CAAC;IACzC,aAAa,EAAE,GAAG,EAAE,CAAC,CAAC;IACtB,kBAAkB,EAAE,GAAG,EAAE,GAAE,CAAC;IAC5B,gBAAgB,EAAE,KAAK,IAAI,EAAE,CAAC,KAAK;CACpC,CAAC"}
1
+ {"version":3,"file":"index.ios.js","sourceRoot":"","sources":["../../../../src/core/native/exponent-light-sensor/index.ios.ts"],"names":[],"mappings":"AAMA,MAAM,CAAC,MAAM,mBAAmB,GAC9B;IACE,WAAW,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,GAAE,CAAC,EAAE,CAAC;IACzC,aAAa,EAAE,GAAG,EAAE,CAAC,CAAC;IACtB,kBAAkB,EAAE,GAAG,EAAE,GAAE,CAAC;IAC5B,gBAAgB,EAAE,KAAK,IAAI,EAAE,CAAC,KAAK;CACpC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"exponent-magnetometer-uncalibrated.js","sourceRoot":"","sources":["../../../src/core/native/exponent-magnetometer-uncalibrated.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAIxD,MAAM,8CAA8C,GAAG,kCAAkC,CAAC;AAE1F,MAAM,CAAC,MAAM,gCAAgC,GAAG,mBAAmB,CAEjE,8CAA8C,CAAC,CAAC"}
1
+ {"version":3,"file":"exponent-magnetometer-uncalibrated.js","sourceRoot":"","sources":["../../../src/core/native/exponent-magnetometer-uncalibrated.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAIxD,MAAM,8CAA8C,GAClD,kCAAkC,CAAC;AAErC,MAAM,CAAC,MAAM,gCAAgC,GAAG,mBAAmB,CAEjE,8CAA8C,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"exponent-pedometer.js","sourceRoot":"","sources":["../../../src/core/native/exponent-pedometer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAIxD,MAAM,8BAA8B,GAAG,mBAAmB,CAAC;AAU3D,MAAM,CAAC,MAAM,iBAAiB,GAAG,mBAAmB,CAClD,8BAA8B,CAC/B,CAAC"}
1
+ {"version":3,"file":"exponent-pedometer.js","sourceRoot":"","sources":["../../../src/core/native/exponent-pedometer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAIxD,MAAM,8BAA8B,GAAG,mBAAmB,CAAC;AAa3D,MAAM,CAAC,MAAM,iBAAiB,GAAG,mBAAmB,CAClD,8BAA8B,CAC/B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"pedometer.js","sourceRoot":"","sources":["../../src/core/pedometer.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,iGAAiG;AACjG,4FAA4F;AAC5F,6DAA6D;AAC7D,OAAO,EACL,gBAAgB,EAChB,mBAAmB,GAGpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAQhE,4FAA4F;AAC5F,kEAAkE;AAClE,MAAM,2BAA2B,GAAG,0BAA0B,CAAC;AAE/D,MAAM,2BAA2B,GAAuB;IACtD,OAAO,EAAE,IAAI;IACb,OAAO,EAAE,OAAO;IAChB,WAAW,EAAE,IAAI;IACjB,MAAM,EAAE,gBAAgB,CAAC,OAAO;CACjC,CAAC;AAEF,MAAM,UAAU,cAAc,CAAC,QAAkC;IAC/D,OAAO,iBAAiB,CAAC,WAAW,CAAC,2BAA2B,EAAE,QAAQ,CAAC,CAAC;AAC9E,CAAC;AAED,sFAAsF;AACtF,wEAAwE;AACxE,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,KAAW,EAAE,GAAS;IAC5D,IAAI,CAAC,iBAAiB,CAAC,iBAAiB,EAAE,CAAC;QACzC,MAAM,IAAI,mBAAmB,CAAC,mBAAmB,EAAE,mBAAmB,CAAC,CAAC;IAC1E,CAAC;IACD,IAAI,KAAK,GAAG,GAAG,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;IAC1E,CAAC;IACD,OAAO,iBAAiB,CAAC,iBAAiB,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;AAC7E,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,gBAAgB;IACpC,OAAO,iBAAiB,CAAC,gBAAgB,EAAE,CAAC;AAC9C,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,mBAAmB;IACvC,IAAI,CAAC,iBAAiB,CAAC,mBAAmB,EAAE,CAAC;QAC3C,OAAO,2BAA2B,CAAC;IACrC,CAAC;IACD,OAAO,iBAAiB,CAAC,mBAAmB,EAAE,CAAC;AACjD,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,uBAAuB;IAC3C,IAAI,CAAC,iBAAiB,CAAC,uBAAuB,EAAE,CAAC;QAC/C,OAAO,2BAA2B,CAAC;IACrC,CAAC;IACD,OAAO,iBAAiB,CAAC,uBAAuB,EAAE,CAAC;AACrD,CAAC"}
1
+ {"version":3,"file":"pedometer.js","sourceRoot":"","sources":["../../src/core/pedometer.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,iGAAiG;AACjG,4FAA4F;AAC5F,6DAA6D;AAC7D,OAAO,EACL,gBAAgB,EAChB,mBAAmB,GAGpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAQhE,4FAA4F;AAC5F,kEAAkE;AAClE,MAAM,2BAA2B,GAAG,0BAA0B,CAAC;AAE/D,MAAM,2BAA2B,GAAuB;IACtD,OAAO,EAAE,IAAI;IACb,OAAO,EAAE,OAAO;IAChB,WAAW,EAAE,IAAI;IACjB,MAAM,EAAE,gBAAgB,CAAC,OAAO;CACjC,CAAC;AAEF,MAAM,UAAU,cAAc,CAC5B,QAAkC;IAElC,OAAO,iBAAiB,CAAC,WAAW,CAAC,2BAA2B,EAAE,QAAQ,CAAC,CAAC;AAC9E,CAAC;AAED,sFAAsF;AACtF,wEAAwE;AACxE,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,KAAW,EACX,GAAS;IAET,IAAI,CAAC,iBAAiB,CAAC,iBAAiB,EAAE,CAAC;QACzC,MAAM,IAAI,mBAAmB,CAAC,mBAAmB,EAAE,mBAAmB,CAAC,CAAC;IAC1E,CAAC;IACD,IAAI,KAAK,GAAG,GAAG,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;IAC1E,CAAC;IACD,OAAO,iBAAiB,CAAC,iBAAiB,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;AAC7E,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,gBAAgB;IACpC,OAAO,iBAAiB,CAAC,gBAAgB,EAAE,CAAC;AAC9C,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,mBAAmB;IACvC,IAAI,CAAC,iBAAiB,CAAC,mBAAmB,EAAE,CAAC;QAC3C,OAAO,2BAA2B,CAAC;IACrC,CAAC;IACD,OAAO,iBAAiB,CAAC,mBAAmB,EAAE,CAAC;AACjD,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,uBAAuB;IAC3C,IAAI,CAAC,iBAAiB,CAAC,uBAAuB,EAAE,CAAC;QAC/C,OAAO,2BAA2B,CAAC;IACrC,CAAC;IACD,OAAO,iBAAiB,CAAC,uBAAuB,EAAE,CAAC;AACrD,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@symbiote-native/sensors",
3
- "version": "0.2.1",
4
- "description": "expo-sensors wrapped for SymbioteNative — one framework-agnostic core, built once and reachable from the React, Vue, and Angular adapters. Accelerometer, Barometer, DeviceMotion, Gyroscope, LightSensor, Magnetometer, MagnetometerUncalibrated, Pedometer.",
3
+ "version": "0.4.0",
4
+ "description": "expo-sensors wrapped for SymbioteNative — one framework-agnostic core, built once and reachable from the React, Vue, Svelte, Solid, and Angular adapters. Accelerometer, Barometer, DeviceMotion, Gyroscope, LightSensor, Magnetometer, MagnetometerUncalibrated, Pedometer.",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
@@ -30,6 +30,14 @@
30
30
  "types": "./build/react/index.d.ts",
31
31
  "default": "./build/react/index.js"
32
32
  },
33
+ "./svelte": {
34
+ "types": "./build/svelte/index.d.ts",
35
+ "default": "./build/svelte/index.js"
36
+ },
37
+ "./solid": {
38
+ "types": "./build/solid/index.d.ts",
39
+ "default": "./build/solid/index.js"
40
+ },
33
41
  "./angular": {
34
42
  "types": "./build-ngc/angular/index.d.ts",
35
43
  "react-native": "./build-ngc/angular/index.js",
@@ -53,15 +61,19 @@
53
61
  "expo-modules-core": "57.0.5"
54
62
  },
55
63
  "peerDependencies": {
64
+ "@symbiote-native/angular": ">=0.6.2",
56
65
  "@symbiote-native/engine": ">=0.1.7",
66
+ "@symbiote-native/react": ">=0.2.8",
67
+ "@symbiote-native/solid": ">=0.0.1",
68
+ "@symbiote-native/svelte": ">=0.1.0",
69
+ "@symbiote-native/vue": ">=0.3.8",
57
70
  "@angular/core": ">=20",
58
71
  "@vue/runtime-core": "^3.5.13",
59
72
  "react": ">=19.0.0",
60
73
  "react-native": ">=0.86",
61
- "vue": ">=3.5.0",
62
- "@symbiote-native/angular": "0.6.2",
63
- "@symbiote-native/react": "0.2.8",
64
- "@symbiote-native/vue": "0.3.8"
74
+ "svelte": ">=5.56.0",
75
+ "solid-js": ">=1.9.0",
76
+ "vue": ">=3.5.0"
65
77
  },
66
78
  "peerDependenciesMeta": {
67
79
  "@symbiote-native/angular": {
@@ -70,6 +82,12 @@
70
82
  "@symbiote-native/react": {
71
83
  "optional": true
72
84
  },
85
+ "@symbiote-native/solid": {
86
+ "optional": true
87
+ },
88
+ "@symbiote-native/svelte": {
89
+ "optional": true
90
+ },
73
91
  "@symbiote-native/vue": {
74
92
  "optional": true
75
93
  },
@@ -82,24 +100,34 @@
82
100
  "react": {
83
101
  "optional": true
84
102
  },
103
+ "svelte": {
104
+ "optional": true
105
+ },
106
+ "solid-js": {
107
+ "optional": true
108
+ },
85
109
  "vue": {
86
110
  "optional": true
87
111
  }
88
112
  },
89
113
  "devDependencies": {
90
- "@angular/compiler": "^22",
91
- "@angular/compiler-cli": "^22",
92
- "@angular/core": "^22",
114
+ "@angular/compiler": "~22.0.8",
115
+ "@angular/compiler-cli": "~22.0.8",
116
+ "@angular/core": "~22.0.8",
93
117
  "@types/node": "^26.0.0",
94
118
  "@types/react": "^19.2.0",
95
119
  "@vue/runtime-core": "^3.5.13",
96
120
  "react": "19.2.3",
121
+ "solid-js": "^1.9.14",
122
+ "svelte": "^5.56.0",
97
123
  "typescript": "~6.0.0",
98
- "@symbiote-native/angular": "0.6.2",
99
- "@symbiote-native/engine": "0.1.7",
100
- "@symbiote-native/react": "0.2.8",
101
- "@symbiote-native/test-utils": "0.1.6",
102
- "@symbiote-native/vue": "0.3.8"
124
+ "@symbiote-native/angular": "0.8.0",
125
+ "@symbiote-native/engine": "0.3.0",
126
+ "@symbiote-native/react": "0.4.0",
127
+ "@symbiote-native/solid": "0.1.0",
128
+ "@symbiote-native/svelte": "0.3.0",
129
+ "@symbiote-native/test-utils": "0.2.0",
130
+ "@symbiote-native/vue": "0.5.0"
103
131
  },
104
132
  "scripts": {
105
133
  "typecheck": "tsc --build",
@@ -5,7 +5,11 @@ export type { IAccelerometerMeasurement } from '../core';
5
5
  export { BarometerService } from './services/barometer.service';
6
6
  export type { IBarometerMeasurement } from '../core';
7
7
  export { DeviceMotionService } from './services/device-motion.service';
8
- export { DeviceMotionOrientation, gravity, type IDeviceMotionMeasurement } from '../core';
8
+ export {
9
+ DeviceMotionOrientation,
10
+ gravity,
11
+ type IDeviceMotionMeasurement,
12
+ } from '../core';
9
13
  export { GyroscopeService } from './services/gyroscope.service';
10
14
  export type { IGyroscopeMeasurement } from '../core';
11
15
  export { LightSensorService } from './services/light-sensor.service';
@@ -1,23 +1,23 @@
1
- import { effect, inject, Injectable, Injector, signal, type Signal } from '@angular/core';
1
+ import {
2
+ effect,
3
+ inject,
4
+ Injectable,
5
+ Injector,
6
+ signal,
7
+ type Signal,
8
+ } from '@angular/core';
2
9
  import { Accelerometer, type IAccelerometerMeasurement } from '../../../core';
3
10
 
4
- // Angular twin of React's `useAccelerometer` hook and Vue's `useAccelerometer` composable.
5
- // Angular has no per-instance hook — state and lifecycle live in DI instead, so `connect()`
6
- // stands in for the hook's role: call it ONCE (typically from a component's field initializer,
7
- // inside an injection context).
11
+ // Angular twin of React's `useAccelerometer` hook / Vue's `useAccelerometer` composable.
12
+ // Angular has no per-instance hook, so `connect()` stands in: call it ONCE, inside an injection
13
+ // context (typically a component's field initializer).
8
14
  //
9
15
  // readonly measurement = inject(AccelerometerService).connect();
10
16
  // // template: {{ measurement()?.x }}
11
- //
12
- // Unlike HideAnimationService.connect(), there is no per-render config to re-sync — the
13
- // subscription doesn't depend on anything the caller's own signals could change between
14
- // renders — so a single effect() that subscribes once and cleans up once is enough; no
15
- // `updateConfig`-style effect that re-runs on every read is needed here.
16
17
  @Injectable({ providedIn: 'root' })
17
18
  export class AccelerometerService {
18
- // Captured in the constructor (itself always run inside an injection context by Angular's
19
- // own DI) so `connect()` can create an `effect()` even when called from plain field-initializer
20
- // code that is not, on its own, an active injection context — mirrors HideAnimationService.
19
+ // Captured in the constructor (always an injection context) so `connect()` can build an
20
+ // `effect()` even when called from a field initializer that isn't one on its own.
21
21
  private readonly injector = inject(Injector);
22
22
 
23
23
  connect(updateIntervalMs?: number): Signal<IAccelerometerMeasurement | null> {
@@ -25,10 +25,14 @@ export class AccelerometerService {
25
25
 
26
26
  effect(
27
27
  onCleanup => {
28
+ // updateIntervalMs applies once, at connect time — the effect has no reactive read to
29
+ // re-run on, so a later change is not picked up.
28
30
  if (updateIntervalMs !== undefined) {
29
31
  Accelerometer.setUpdateInterval(updateIntervalMs);
30
32
  }
31
- const subscription = Accelerometer.addListener(next => measurement.set(next));
33
+ const subscription = Accelerometer.addListener(next =>
34
+ measurement.set(next),
35
+ );
32
36
  onCleanup(() => subscription.remove());
33
37
  },
34
38
  { injector: this.injector },
@@ -1,23 +1,23 @@
1
- import { effect, inject, Injectable, Injector, signal, type Signal } from '@angular/core';
1
+ import {
2
+ effect,
3
+ inject,
4
+ Injectable,
5
+ Injector,
6
+ signal,
7
+ type Signal,
8
+ } from '@angular/core';
2
9
  import { Barometer, type IBarometerMeasurement } from '../../../core';
3
10
 
4
- // Angular twin of React's `useBarometer` hook and Vue's `useBarometer` composable.
5
- // Angular has no per-instance hook — state and lifecycle live in DI instead, so `connect()`
6
- // stands in for the hook's role: call it ONCE (typically from a component's field initializer,
7
- // inside an injection context).
11
+ // Angular twin of React's `useBarometer` hook / Vue's `useBarometer` composable. Angular has no
12
+ // per-instance hook, so `connect()` stands in: call it ONCE, inside an injection context
13
+ // (typically a component's field initializer).
8
14
  //
9
15
  // readonly measurement = inject(BarometerService).connect();
10
16
  // // template: {{ measurement()?.pressure }}
11
- //
12
- // Unlike HideAnimationService.connect(), there is no per-render config to re-sync — the
13
- // subscription doesn't depend on anything the caller's own signals could change between
14
- // renders — so a single effect() that subscribes once and cleans up once is enough; no
15
- // `updateConfig`-style effect that re-runs on every read is needed here.
16
17
  @Injectable({ providedIn: 'root' })
17
18
  export class BarometerService {
18
- // Captured in the constructor (itself always run inside an injection context by Angular's
19
- // own DI) so `connect()` can create an `effect()` even when called from plain field-initializer
20
- // code that is not, on its own, an active injection context — mirrors HideAnimationService.
19
+ // Captured in the constructor (always an injection context) so `connect()` can build an
20
+ // `effect()` even when called from a field initializer that isn't one on its own.
21
21
  private readonly injector = inject(Injector);
22
22
 
23
23
  connect(updateIntervalMs?: number): Signal<IBarometerMeasurement | null> {
@@ -25,10 +25,14 @@ export class BarometerService {
25
25
 
26
26
  effect(
27
27
  onCleanup => {
28
+ // updateIntervalMs applies once, at connect time — the effect has no reactive read to
29
+ // re-run on, so a later change is not picked up.
28
30
  if (updateIntervalMs !== undefined) {
29
31
  Barometer.setUpdateInterval(updateIntervalMs);
30
32
  }
31
- const subscription = Barometer.addListener(next => measurement.set(next));
33
+ const subscription = Barometer.addListener(next =>
34
+ measurement.set(next),
35
+ );
32
36
  onCleanup(() => subscription.remove());
33
37
  },
34
38
  { injector: this.injector },
@@ -1,23 +1,23 @@
1
- import { effect, inject, Injectable, Injector, signal, type Signal } from '@angular/core';
1
+ import {
2
+ effect,
3
+ inject,
4
+ Injectable,
5
+ Injector,
6
+ signal,
7
+ type Signal,
8
+ } from '@angular/core';
2
9
  import { DeviceMotion, type IDeviceMotionMeasurement } from '../../../core';
3
10
 
4
- // Angular twin of React's `useDeviceMotion` hook and Vue's `useDeviceMotion` composable.
5
- // Angular has no per-instance hook — state and lifecycle live in DI instead, so `connect()`
6
- // stands in for the hook's role: call it ONCE (typically from a component's field initializer,
7
- // inside an injection context).
11
+ // Angular twin of React's `useDeviceMotion` hook / Vue's `useDeviceMotion` composable. Angular
12
+ // has no per-instance hook, so `connect()` stands in: call it ONCE, inside an injection context
13
+ // (typically a component's field initializer).
8
14
  //
9
15
  // readonly measurement = inject(DeviceMotionService).connect();
10
16
  // // template: {{ measurement()?.rotation?.alpha }}
11
- //
12
- // Unlike HideAnimationService.connect(), there is no per-render config to re-sync — the
13
- // subscription doesn't depend on anything the caller's own signals could change between
14
- // renders — so a single effect() that subscribes once and cleans up once is enough; no
15
- // `updateConfig`-style effect that re-runs on every read is needed here.
16
17
  @Injectable({ providedIn: 'root' })
17
18
  export class DeviceMotionService {
18
- // Captured in the constructor (itself always run inside an injection context by Angular's
19
- // own DI) so `connect()` can create an `effect()` even when called from plain field-initializer
20
- // code that is not, on its own, an active injection context — mirrors HideAnimationService.
19
+ // Captured in the constructor (always an injection context) so `connect()` can build an
20
+ // `effect()` even when called from a field initializer that isn't one on its own.
21
21
  private readonly injector = inject(Injector);
22
22
 
23
23
  connect(updateIntervalMs?: number): Signal<IDeviceMotionMeasurement | null> {
@@ -25,10 +25,14 @@ export class DeviceMotionService {
25
25
 
26
26
  effect(
27
27
  onCleanup => {
28
+ // updateIntervalMs applies once, at connect time — the effect has no reactive read to
29
+ // re-run on, so a later change is not picked up.
28
30
  if (updateIntervalMs !== undefined) {
29
31
  DeviceMotion.setUpdateInterval(updateIntervalMs);
30
32
  }
31
- const subscription = DeviceMotion.addListener(next => measurement.set(next));
33
+ const subscription = DeviceMotion.addListener(next =>
34
+ measurement.set(next),
35
+ );
32
36
  onCleanup(() => subscription.remove());
33
37
  },
34
38
  { injector: this.injector },
@@ -1,23 +1,23 @@
1
- import { effect, inject, Injectable, Injector, signal, type Signal } from '@angular/core';
1
+ import {
2
+ effect,
3
+ inject,
4
+ Injectable,
5
+ Injector,
6
+ signal,
7
+ type Signal,
8
+ } from '@angular/core';
2
9
  import { Gyroscope, type IGyroscopeMeasurement } from '../../../core';
3
10
 
4
- // Angular twin of React's `useGyroscope` hook and Vue's `useGyroscope` composable.
5
- // Angular has no per-instance hook — state and lifecycle live in DI instead, so `connect()`
6
- // stands in for the hook's role: call it ONCE (typically from a component's field initializer,
7
- // inside an injection context).
11
+ // Angular twin of React's `useGyroscope` hook / Vue's `useGyroscope` composable. Angular has no
12
+ // per-instance hook, so `connect()` stands in: call it ONCE, inside an injection context
13
+ // (typically a component's field initializer).
8
14
  //
9
15
  // readonly measurement = inject(GyroscopeService).connect();
10
16
  // // template: {{ measurement()?.x }}
11
- //
12
- // Unlike HideAnimationService.connect(), there is no per-render config to re-sync — the
13
- // subscription doesn't depend on anything the caller's own signals could change between
14
- // renders — so a single effect() that subscribes once and cleans up once is enough; no
15
- // `updateConfig`-style effect that re-runs on every read is needed here.
16
17
  @Injectable({ providedIn: 'root' })
17
18
  export class GyroscopeService {
18
- // Captured in the constructor (itself always run inside an injection context by Angular's
19
- // own DI) so `connect()` can create an `effect()` even when called from plain field-initializer
20
- // code that is not, on its own, an active injection context — mirrors HideAnimationService.
19
+ // Captured in the constructor (always an injection context) so `connect()` can build an
20
+ // `effect()` even when called from a field initializer that isn't one on its own.
21
21
  private readonly injector = inject(Injector);
22
22
 
23
23
  connect(updateIntervalMs?: number): Signal<IGyroscopeMeasurement | null> {
@@ -25,10 +25,14 @@ export class GyroscopeService {
25
25
 
26
26
  effect(
27
27
  onCleanup => {
28
+ // updateIntervalMs applies once, at connect time — the effect has no reactive read to
29
+ // re-run on, so a later change is not picked up.
28
30
  if (updateIntervalMs !== undefined) {
29
31
  Gyroscope.setUpdateInterval(updateIntervalMs);
30
32
  }
31
- const subscription = Gyroscope.addListener(next => measurement.set(next));
33
+ const subscription = Gyroscope.addListener(next =>
34
+ measurement.set(next),
35
+ );
32
36
  onCleanup(() => subscription.remove());
33
37
  },
34
38
  { injector: this.injector },
@@ -1,23 +1,23 @@
1
- import { effect, inject, Injectable, Injector, signal, type Signal } from '@angular/core';
1
+ import {
2
+ effect,
3
+ inject,
4
+ Injectable,
5
+ Injector,
6
+ signal,
7
+ type Signal,
8
+ } from '@angular/core';
2
9
  import { LightSensor, type ILightSensorMeasurement } from '../../../core';
3
10
 
4
- // Angular twin of React's `useLightSensor` hook and Vue's `useLightSensor` composable.
5
- // Angular has no per-instance hook — state and lifecycle live in DI instead, so `connect()`
6
- // stands in for the hook's role: call it ONCE (typically from a component's field initializer,
7
- // inside an injection context).
11
+ // Angular twin of React's `useLightSensor` hook / Vue's `useLightSensor` composable. Angular
12
+ // has no per-instance hook, so `connect()` stands in: call it ONCE, inside an injection context
13
+ // (typically a component's field initializer).
8
14
  //
9
15
  // readonly measurement = inject(LightSensorService).connect();
10
16
  // // template: {{ measurement()?.illuminance }}
11
- //
12
- // Unlike HideAnimationService.connect(), there is no per-render config to re-sync — the
13
- // subscription doesn't depend on anything the caller's own signals could change between
14
- // renders — so a single effect() that subscribes once and cleans up once is enough; no
15
- // `updateConfig`-style effect that re-runs on every read is needed here.
16
17
  @Injectable({ providedIn: 'root' })
17
18
  export class LightSensorService {
18
- // Captured in the constructor (itself always run inside an injection context by Angular's
19
- // own DI) so `connect()` can create an `effect()` even when called from plain field-initializer
20
- // code that is not, on its own, an active injection context — mirrors HideAnimationService.
19
+ // Captured in the constructor (always an injection context) so `connect()` can build an
20
+ // `effect()` even when called from a field initializer that isn't one on its own.
21
21
  private readonly injector = inject(Injector);
22
22
 
23
23
  connect(updateIntervalMs?: number): Signal<ILightSensorMeasurement | null> {
@@ -25,10 +25,14 @@ export class LightSensorService {
25
25
 
26
26
  effect(
27
27
  onCleanup => {
28
+ // updateIntervalMs applies once, at connect time — the effect has no reactive read to
29
+ // re-run on, so a later change is not picked up.
28
30
  if (updateIntervalMs !== undefined) {
29
31
  LightSensor.setUpdateInterval(updateIntervalMs);
30
32
  }
31
- const subscription = LightSensor.addListener(next => measurement.set(next));
33
+ const subscription = LightSensor.addListener(next =>
34
+ measurement.set(next),
35
+ );
32
36
  onCleanup(() => subscription.remove());
33
37
  },
34
38
  { injector: this.injector },
@@ -1,34 +1,46 @@
1
- import { effect, inject, Injectable, Injector, signal, type Signal } from '@angular/core';
2
- import { MagnetometerUncalibrated, type IMagnetometerUncalibratedMeasurement } from '../../../core';
1
+ import {
2
+ effect,
3
+ inject,
4
+ Injectable,
5
+ Injector,
6
+ signal,
7
+ type Signal,
8
+ } from '@angular/core';
9
+ import {
10
+ MagnetometerUncalibrated,
11
+ type IMagnetometerUncalibratedMeasurement,
12
+ } from '../../../core';
3
13
 
4
- // Angular twin of React's `useMagnetometerUncalibrated` hook and Vue's
5
- // `useMagnetometerUncalibrated` composable. Angular has no per-instance hook — state and
6
- // lifecycle live in DI instead, so `connect()` stands in for the hook's role: call it ONCE
7
- // (typically from a component's field initializer, inside an injection context).
14
+ // Angular twin of React's `useMagnetometerUncalibrated` hook / Vue's
15
+ // `useMagnetometerUncalibrated` composable. Angular has no per-instance hook, so `connect()`
16
+ // stands in: call it ONCE, inside an injection context (typically a component's field
17
+ // initializer).
8
18
  //
9
19
  // readonly measurement = inject(MagnetometerUncalibratedService).connect();
10
20
  // // template: {{ measurement()?.x }}
11
- //
12
- // Unlike HideAnimationService.connect(), there is no per-render config to re-sync — the
13
- // subscription doesn't depend on anything the caller's own signals could change between
14
- // renders — so a single effect() that subscribes once and cleans up once is enough; no
15
- // `updateConfig`-style effect that re-runs on every read is needed here.
16
21
  @Injectable({ providedIn: 'root' })
17
22
  export class MagnetometerUncalibratedService {
18
- // Captured in the constructor (itself always run inside an injection context by Angular's
19
- // own DI) so `connect()` can create an `effect()` even when called from plain field-initializer
20
- // code that is not, on its own, an active injection context — mirrors HideAnimationService.
23
+ // Captured in the constructor (always an injection context) so `connect()` can build an
24
+ // `effect()` even when called from a field initializer that isn't one on its own.
21
25
  private readonly injector = inject(Injector);
22
26
 
23
- connect(updateIntervalMs?: number): Signal<IMagnetometerUncalibratedMeasurement | null> {
24
- const measurement = signal<IMagnetometerUncalibratedMeasurement | null>(null);
27
+ connect(
28
+ updateIntervalMs?: number,
29
+ ): Signal<IMagnetometerUncalibratedMeasurement | null> {
30
+ const measurement = signal<IMagnetometerUncalibratedMeasurement | null>(
31
+ null,
32
+ );
25
33
 
26
34
  effect(
27
35
  onCleanup => {
36
+ // updateIntervalMs applies once, at connect time — the effect has no reactive read to
37
+ // re-run on, so a later change is not picked up.
28
38
  if (updateIntervalMs !== undefined) {
29
39
  MagnetometerUncalibrated.setUpdateInterval(updateIntervalMs);
30
40
  }
31
- const subscription = MagnetometerUncalibrated.addListener(next => measurement.set(next));
41
+ const subscription = MagnetometerUncalibrated.addListener(next =>
42
+ measurement.set(next),
43
+ );
32
44
  onCleanup(() => subscription.remove());
33
45
  },
34
46
  { injector: this.injector },
@@ -1,23 +1,23 @@
1
- import { effect, inject, Injectable, Injector, signal, type Signal } from '@angular/core';
1
+ import {
2
+ effect,
3
+ inject,
4
+ Injectable,
5
+ Injector,
6
+ signal,
7
+ type Signal,
8
+ } from '@angular/core';
2
9
  import { Magnetometer, type IMagnetometerMeasurement } from '../../../core';
3
10
 
4
- // Angular twin of React's `useMagnetometer` hook and Vue's `useMagnetometer` composable.
5
- // Angular has no per-instance hook — state and lifecycle live in DI instead, so `connect()`
6
- // stands in for the hook's role: call it ONCE (typically from a component's field initializer,
7
- // inside an injection context).
11
+ // Angular twin of React's `useMagnetometer` hook / Vue's `useMagnetometer` composable. Angular
12
+ // has no per-instance hook, so `connect()` stands in: call it ONCE, inside an injection context
13
+ // (typically a component's field initializer).
8
14
  //
9
15
  // readonly measurement = inject(MagnetometerService).connect();
10
16
  // // template: {{ measurement()?.x }}
11
- //
12
- // Unlike HideAnimationService.connect(), there is no per-render config to re-sync — the
13
- // subscription doesn't depend on anything the caller's own signals could change between
14
- // renders — so a single effect() that subscribes once and cleans up once is enough; no
15
- // `updateConfig`-style effect that re-runs on every read is needed here.
16
17
  @Injectable({ providedIn: 'root' })
17
18
  export class MagnetometerService {
18
- // Captured in the constructor (itself always run inside an injection context by Angular's
19
- // own DI) so `connect()` can create an `effect()` even when called from plain field-initializer
20
- // code that is not, on its own, an active injection context — mirrors HideAnimationService.
19
+ // Captured in the constructor (always an injection context) so `connect()` can build an
20
+ // `effect()` even when called from a field initializer that isn't one on its own.
21
21
  private readonly injector = inject(Injector);
22
22
 
23
23
  connect(updateIntervalMs?: number): Signal<IMagnetometerMeasurement | null> {
@@ -25,10 +25,14 @@ export class MagnetometerService {
25
25
 
26
26
  effect(
27
27
  onCleanup => {
28
+ // updateIntervalMs applies once, at connect time — the effect has no reactive read to
29
+ // re-run on, so a later change is not picked up.
28
30
  if (updateIntervalMs !== undefined) {
29
31
  Magnetometer.setUpdateInterval(updateIntervalMs);
30
32
  }
31
- const subscription = Magnetometer.addListener(next => measurement.set(next));
33
+ const subscription = Magnetometer.addListener(next =>
34
+ measurement.set(next),
35
+ );
32
36
  onCleanup(() => subscription.remove());
33
37
  },
34
38
  { injector: this.injector },
@@ -1,21 +1,24 @@
1
- import { effect, inject, Injectable, Injector, signal, type Signal } from '@angular/core';
1
+ import {
2
+ effect,
3
+ inject,
4
+ Injectable,
5
+ Injector,
6
+ signal,
7
+ type Signal,
8
+ } from '@angular/core';
2
9
  import { watchStepCount, type IPedometerResult } from '../../../core';
3
10
 
4
- // Angular twin of React's `usePedometer` hook and Vue's `usePedometer` composable. Angular has
5
- // no per-instance hook — state and lifecycle live in DI instead, so `connect()` stands in for
6
- // the hook's role: call it ONCE (typically from a component's field initializer, inside an
7
- // injection context).
11
+ // Angular twin of React's `usePedometer` hook / Vue's `usePedometer` composable. Angular has no
12
+ // per-instance hook, so `connect()` stands in: call it ONCE, inside an injection context
13
+ // (typically a component's field initializer). Pedometer has no setUpdateInterval, unlike the
14
+ // other sensor services, so there is no interval param here.
8
15
  //
9
16
  // readonly result = inject(PedometerService).connect();
10
17
  // // template: {{ result()?.steps }}
11
- //
12
- // Unlike AccelerometerService.connect(), there is no updateIntervalMs to apply — Pedometer has
13
- // no setUpdateInterval — so a single effect() that subscribes once and cleans up once is enough.
14
18
  @Injectable({ providedIn: 'root' })
15
19
  export class PedometerService {
16
- // Captured in the constructor (itself always run inside an injection context by Angular's own
17
- // DI) so `connect()` can create an `effect()` even when called from plain field-initializer
18
- // code that is not, on its own, an active injection context — mirrors AccelerometerService.
20
+ // Captured in the constructor (always an injection context) so `connect()` can build an
21
+ // `effect()` even when called from a field initializer that isn't one on its own.
19
22
  private readonly injector = inject(Injector);
20
23
 
21
24
  connect(): Signal<IPedometerResult | null> {
@@ -12,4 +12,7 @@ export class BarometerSensor extends DeviceSensor<IBarometerMeasurement> {}
12
12
 
13
13
  const BAROMETER_DID_UPDATE_EVENT_NAME = 'barometerDidUpdate';
14
14
 
15
- export const Barometer = new BarometerSensor(exponentBarometer, BAROMETER_DID_UPDATE_EVENT_NAME);
15
+ export const Barometer = new BarometerSensor(
16
+ exponentBarometer,
17
+ BAROMETER_DID_UPDATE_EVENT_NAME,
18
+ );
@@ -7,9 +7,19 @@ import { exponentDeviceMotion } from './native/exponent-device-motion';
7
7
  // from raw acceleration.
8
8
  export type IDeviceMotionMeasurement = {
9
9
  acceleration: null | { x: number; y: number; z: number; timestamp: number };
10
- accelerationIncludingGravity: { x: number; y: number; z: number; timestamp: number };
10
+ accelerationIncludingGravity: {
11
+ x: number;
12
+ y: number;
13
+ z: number;
14
+ timestamp: number;
15
+ };
11
16
  rotation: { alpha: number; beta: number; gamma: number; timestamp: number };
12
- rotationRate: null | { alpha: number; beta: number; gamma: number; timestamp: number };
17
+ rotationRate: null | {
18
+ alpha: number;
19
+ beta: number;
20
+ gamma: number;
21
+ timestamp: number;
22
+ };
13
23
  interval: number;
14
24
  orientation: DeviceMotionOrientation;
15
25
  };
@@ -24,8 +34,8 @@ export enum DeviceMotionOrientation {
24
34
 
25
35
  export class DeviceMotionSensor extends DeviceSensor<IDeviceMotionMeasurement> {
26
36
  // Standard gravitational acceleration for Earth (m/s^2), read off the native module rather
27
- // than hardcoded — mirrors upstream's dual exposure as both an instance property and the
28
- // standalone `gravity` export below.
37
+ // than hardcoded — mirrors upstream's dual exposure as an instance property and this
38
+ // standalone export.
29
39
  readonly gravity: number = exponentDeviceMotion.Gravity;
30
40
  }
31
41
 
@@ -36,6 +46,5 @@ export const DeviceMotion = new DeviceMotionSensor(
36
46
  DEVICE_MOTION_DID_UPDATE_EVENT_NAME,
37
47
  );
38
48
 
39
- // Standalone export mirroring the instance property above, for callers that only need the
40
- // constant and not the full sensor singleton.
49
+ // Same value as `DeviceMotion.gravity`, for callers that only need the constant.
41
50
  export const gravity: number = exponentDeviceMotion.Gravity;