@maccesar/titools 2.2.3 → 2.2.8

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 (96) hide show
  1. package/README.md +28 -27
  2. package/lib/commands/update.js +80 -101
  3. package/package.json +1 -1
  4. package/skills/alloy-guides/SKILL.md +31 -31
  5. package/skills/alloy-guides/references/CONCEPTS.md +3 -3
  6. package/skills/alloy-guides/references/CONTROLLERS.md +1 -1
  7. package/skills/alloy-guides/references/MODELS.md +6 -6
  8. package/skills/alloy-guides/references/VIEWS_WITHOUT_CONTROLLERS.md +1 -1
  9. package/skills/alloy-guides/references/VIEWS_XML.md +1 -1
  10. package/skills/alloy-guides/references/WIDGETS.md +1 -1
  11. package/skills/alloy-howtos/SKILL.md +27 -27
  12. package/skills/alloy-howtos/references/best_practices.md +9 -9
  13. package/skills/alloy-howtos/references/cli_reference.md +14 -14
  14. package/skills/alloy-howtos/references/config_files.md +16 -16
  15. package/skills/alloy-howtos/references/custom_tags.md +16 -16
  16. package/skills/alloy-howtos/references/debugging_troubleshooting.md +11 -15
  17. package/skills/alloy-howtos/references/samples.md +19 -19
  18. package/skills/purgetss/SKILL.md +11 -1
  19. package/skills/purgetss/references/animation-system.md +1 -1
  20. package/skills/purgetss/references/cli-commands.md +3 -3
  21. package/skills/purgetss/references/customization-deep-dive.md +1 -1
  22. package/skills/purgetss/references/dynamic-component-creation.md +1 -1
  23. package/skills/purgetss/references/icon-fonts.md +4 -0
  24. package/skills/purgetss/references/installation-setup.md +8 -1
  25. package/skills/purgetss/references/migration-guide.md +4 -0
  26. package/skills/purgetss/references/tikit-components.md +193 -204
  27. package/skills/purgetss/references/ui-ux-design.md +1 -1
  28. package/skills/ti-expert/SKILL.md +78 -118
  29. package/skills/ti-expert/references/alloy-builtins.md +18 -18
  30. package/skills/ti-expert/references/alloy-structure.md +21 -21
  31. package/skills/ti-expert/references/anti-patterns.md +15 -15
  32. package/skills/ti-expert/references/cli-expert.md +15 -15
  33. package/skills/ti-expert/references/code-conventions.md +38 -38
  34. package/skills/ti-expert/references/contracts.md +8 -8
  35. package/skills/ti-expert/references/controller-patterns.md +14 -14
  36. package/skills/ti-expert/references/error-handling.md +11 -11
  37. package/skills/ti-expert/references/examples.md +12 -12
  38. package/skills/ti-expert/references/migration-patterns.md +24 -24
  39. package/skills/ti-expert/references/patterns.md +10 -10
  40. package/skills/ti-expert/references/performance-listview.md +16 -16
  41. package/skills/ti-expert/references/performance-optimization.md +41 -41
  42. package/skills/ti-expert/references/security-device.md +22 -22
  43. package/skills/ti-expert/references/security-fundamentals.md +19 -19
  44. package/skills/ti-expert/references/state-management.md +33 -33
  45. package/skills/ti-expert/references/testing-e2e-ci.md +25 -25
  46. package/skills/ti-expert/references/testing-unit.md +24 -24
  47. package/skills/ti-expert/references/theming.md +15 -15
  48. package/skills/ti-guides/SKILL.md +58 -60
  49. package/skills/ti-guides/references/advanced-data-and-images.md +33 -33
  50. package/skills/ti-guides/references/android-manifest.md +15 -15
  51. package/skills/ti-guides/references/app-distribution.md +70 -166
  52. package/skills/ti-guides/references/application-frameworks.md +96 -114
  53. package/skills/ti-guides/references/cli-reference.md +294 -294
  54. package/skills/ti-guides/references/coding-best-practices.md +42 -33
  55. package/skills/ti-guides/references/commonjs-advanced.md +57 -51
  56. package/skills/ti-guides/references/hello-world.md +36 -36
  57. package/skills/ti-guides/references/hyperloop-native-access.md +66 -66
  58. package/skills/ti-guides/references/javascript-primer.md +83 -101
  59. package/skills/ti-guides/references/reserved-words.md +9 -9
  60. package/skills/ti-guides/references/resources.md +75 -83
  61. package/skills/ti-guides/references/style-and-conventions.md +35 -28
  62. package/skills/ti-guides/references/tiapp-config.md +110 -74
  63. package/skills/ti-howtos/SKILL.md +88 -92
  64. package/skills/ti-howtos/references/android-platform-deep-dives.md +104 -104
  65. package/skills/ti-howtos/references/automation-fastlane-appium.md +39 -39
  66. package/skills/ti-howtos/references/buffer-codec-streams.md +60 -60
  67. package/skills/ti-howtos/references/cross-platform-development.md +115 -136
  68. package/skills/ti-howtos/references/debugging-profiling.md +167 -181
  69. package/skills/ti-howtos/references/extending-titanium.md +121 -121
  70. package/skills/ti-howtos/references/google-maps-v2.md +84 -82
  71. package/skills/ti-howtos/references/ios-map-kit.md +65 -60
  72. package/skills/ti-howtos/references/ios-platform-deep-dives.md +123 -123
  73. package/skills/ti-howtos/references/local-data-sources.md +79 -78
  74. package/skills/ti-howtos/references/location-and-maps.md +116 -120
  75. package/skills/ti-howtos/references/media-apis.md +87 -86
  76. package/skills/ti-howtos/references/notification-services.md +250 -260
  77. package/skills/ti-howtos/references/remote-data-sources.md +98 -93
  78. package/skills/ti-howtos/references/tutorials.md +226 -216
  79. package/skills/ti-howtos/references/using-modules.md +73 -102
  80. package/skills/ti-howtos/references/web-content-integration.md +101 -103
  81. package/skills/ti-howtos/references/webpack-build-pipeline.md +52 -44
  82. package/skills/ti-ui/SKILL.md +85 -85
  83. package/skills/ti-ui/references/accessibility-deep-dive.md +57 -57
  84. package/skills/ti-ui/references/animation-and-matrices.md +79 -79
  85. package/skills/ti-ui/references/application-structures.md +96 -99
  86. package/skills/ti-ui/references/custom-fonts-styling.md +99 -99
  87. package/skills/ti-ui/references/event-handling.md +58 -58
  88. package/skills/ti-ui/references/gestures.md +62 -64
  89. package/skills/ti-ui/references/icons-and-splash-screens.md +88 -88
  90. package/skills/ti-ui/references/layouts-and-positioning.md +87 -97
  91. package/skills/ti-ui/references/listviews-and-performance.md +107 -107
  92. package/skills/ti-ui/references/orientation.md +87 -88
  93. package/skills/ti-ui/references/platform-ui-android.md +87 -81
  94. package/skills/ti-ui/references/platform-ui-ios.md +63 -61
  95. package/skills/ti-ui/references/scrolling-views.md +29 -29
  96. package/skills/ti-ui/references/tableviews.md +56 -56
@@ -1,66 +1,66 @@
1
- # Location Services and Maps
1
+ # Location services and maps
2
2
 
3
- ## 1. GPS Position Tracking
3
+ ## 1. GPS position tracking
4
4
 
5
5
  ### FusedLocationProvider (Android)
6
6
  Since TiSDK 7.1.0, Titanium supports `FusedLocationProvider` for significant battery savings.
7
- **Requirement**: Include the `ti.playservices` module in your project.
7
+ Requirement: include the `ti.playservices` module in your project.
8
8
 
9
- ### Accuracy Configuration
9
+ ### Accuracy configuration
10
10
 
11
- **iOS Accuracy Levels:**
12
- - `ACCURACY_BEST` - Highest power (GPS)
13
- - `ACCURACY_NEAREST_TEN_METERS` - Medium-high power
14
- - `ACCURACY_HUNDRED_METERS` - Medium power
15
- - `ACCURACY_KILOMETER` - Low power
16
- - `ACCURACY_THREE_KILOMETERS` - Lowest power (cell/wifi)
11
+ iOS accuracy levels:
12
+ - `ACCURACY_BEST` - highest power (GPS)
13
+ - `ACCURACY_NEAREST_TEN_METERS` - medium-high power
14
+ - `ACCURACY_HUNDRED_METERS` - medium power
15
+ - `ACCURACY_KILOMETER` - low power
16
+ - `ACCURACY_THREE_KILOMETERS` - lowest power (cell/wifi)
17
17
 
18
- **Key Properties:**
18
+ Key properties:
19
19
  ```javascript
20
20
  Ti.Geolocation.accuracy = Ti.Geolocation.ACCURACY_BEST;
21
21
  Ti.Geolocation.distanceFilter = 10; // meters - only fire if moved X meters
22
- Ti.Geolocation.headingFilter = 5; // degrees - only fire if heading changed X degrees
22
+ Ti.Geolocation.headingFilter = 5; // degrees - only fire if heading changed X degrees
23
23
  Ti.Geolocation.preferredProvider = Ti.Geolocation.PROVIDER_GPS; // or PROVIDER_NETWORK
24
24
  ```
25
25
 
26
- > **Note**: On many Android devices, a low-precision "passive" location provider is always enabled, even when the user disables GPS and Network providers. Therefore `Ti.Geolocation.locationServicesEnabled` may always return `true` on these devices.
26
+ Note: on many Android devices, a low-precision passive location provider is always enabled, even when the user disables GPS and Network providers. `Ti.Geolocation.locationServicesEnabled` may always return `true` on those devices.
27
27
 
28
- ### Android Configuration Modes
28
+ ### Android configuration modes
29
29
 
30
- **Simple Mode** (ACCURACY_HIGH/LOW):
30
+ Simple mode (ACCURACY_HIGH/LOW):
31
31
  ```javascript
32
32
  Ti.Geolocation.accuracy = Ti.Geolocation.ACCURACY_HIGH;
33
33
  ```
34
34
 
35
- **Manual Mode** (fine-grained control):
35
+ Manual mode (fine-grained control):
36
36
  ```javascript
37
37
  const providerGps = Ti.Geolocation.Android.createLocationProvider({
38
- name: Ti.Geolocation.PROVIDER_GPS,
39
- minUpdateDistance: 0.0,
40
- minUpdateTime: 0
38
+ name: Ti.Geolocation.PROVIDER_GPS,
39
+ minUpdateDistance: 0.0,
40
+ minUpdateTime: 0
41
41
  });
42
42
  Ti.Geolocation.Android.addLocationProvider(providerGps);
43
43
  Ti.Geolocation.Android.manualMode = true;
44
44
  ```
45
45
 
46
- ### Location Permissions
46
+ ### Location permissions
47
47
 
48
48
  ```javascript
49
49
  // Check permissions
50
50
  if (Ti.Geolocation.hasLocationPermissions(Ti.Geolocation.AUTHORIZATION_WHEN_IN_USE)) {
51
- startTracking();
51
+ startTracking();
52
52
  } else {
53
- Ti.Geolocation.requestLocationPermissions(Ti.Geolocation.AUTHORIZATION_WHEN_IN_USE, (e) => {
54
- if (e.success) {
55
- startTracking();
56
- } else {
57
- Ti.API.error(`Permission denied: ${e.error}`);
58
- }
59
- });
53
+ Ti.Geolocation.requestLocationPermissions(Ti.Geolocation.AUTHORIZATION_WHEN_IN_USE, (e) => {
54
+ if (e.success) {
55
+ startTracking();
56
+ } else {
57
+ Ti.API.error(`Permission denied: ${e.error}`);
58
+ }
59
+ });
60
60
  }
61
61
  ```
62
62
 
63
- **iOS plist keys** (tiapp.xml):
63
+ iOS plist keys (tiapp.xml):
64
64
  ```xml
65
65
  <key>NSLocationWhenInUseUsageDescription</key>
66
66
  <string>We need your location to show nearby places</string>
@@ -69,58 +69,58 @@ if (Ti.Geolocation.hasLocationPermissions(Ti.Geolocation.AUTHORIZATION_WHEN_IN_U
69
69
  <string>We need background location for navigation</string>
70
70
  ```
71
71
 
72
- > **Note (iOS 11+)**: You must include `NSLocationAlwaysAndWhenInUseUsageDescription` even when requesting "Always" permission. Users can still choose "When in Use" even if your app requests "Always".
72
+ Note (iOS 11+): you must include `NSLocationAlwaysAndWhenInUseUsageDescription` even when requesting "Always" permission. Users can still choose "When in Use".
73
73
 
74
- ### One-Time Position
74
+ ### One-time position
75
75
 
76
76
  ```javascript
77
77
  if (Ti.Geolocation.locationServicesEnabled) {
78
- Ti.Geolocation.getCurrentPosition((e) => {
79
- if (e.error) {
80
- Ti.API.error(`Error: ${e.error}`);
81
- } else {
82
- const coords = e.coords;
83
- // { latitude, longitude, altitude, accuracy, heading, speed, timestamp }
84
- }
85
- });
78
+ Ti.Geolocation.getCurrentPosition((e) => {
79
+ if (e.error) {
80
+ Ti.API.error(`Error: ${e.error}`);
81
+ } else {
82
+ const coords = e.coords;
83
+ // { latitude, longitude, altitude, accuracy, heading, speed, timestamp }
84
+ }
85
+ });
86
86
  }
87
87
  ```
88
88
 
89
- ### Continuous Monitoring
89
+ ### Continuous monitoring
90
90
 
91
91
  ```javascript
92
92
  Ti.Geolocation.addEventListener('location', (e) => {
93
- if (e.error) {
94
- Ti.API.error(`Error: ${e.error}`);
95
- } else {
96
- Ti.API.info(`${e.coords.latitude}, ${e.coords.longitude}`);
97
- }
93
+ if (e.error) {
94
+ Ti.API.error(`Error: ${e.error}`);
95
+ } else {
96
+ Ti.API.info(`${e.coords.latitude}, ${e.coords.longitude}`);
97
+ }
98
98
  });
99
99
  ```
100
100
 
101
- ### Lifecycle Management (Critical for Battery)
101
+ ### Lifecycle management (critical for battery)
102
102
 
103
- **Android Activity Events:**
103
+ Android Activity events:
104
104
  ```javascript
105
105
  let locationAdded = false;
106
106
  const handleLocation = (e) => {
107
- if (!e.error) {
108
- Ti.API.info(e.coords);
109
- }
107
+ if (!e.error) {
108
+ Ti.API.info(e.coords);
109
+ }
110
110
  };
111
111
 
112
112
  function addHandler() {
113
- if (!locationAdded) {
114
- Ti.Geolocation.addEventListener('location', handleLocation);
115
- locationAdded = true;
116
- }
113
+ if (!locationAdded) {
114
+ Ti.Geolocation.addEventListener('location', handleLocation);
115
+ locationAdded = true;
116
+ }
117
117
  }
118
118
 
119
119
  function removeHandler() {
120
- if (locationAdded) {
121
- Ti.Geolocation.removeEventListener('location', handleLocation);
122
- locationAdded = false;
123
- }
120
+ if (locationAdded) {
121
+ Ti.Geolocation.removeEventListener('location', handleLocation);
122
+ locationAdded = false;
123
+ }
124
124
  }
125
125
 
126
126
  // Add listeners
@@ -128,144 +128,140 @@ addHandler();
128
128
 
129
129
  const activity = Ti.Android.currentActivity;
130
130
  activity.addEventListener('destroy', removeHandler);
131
- activity.addEventListener('pause', removeHandler); // Stop when in background
132
- activity.addEventListener('resume', addHandler); // Resume when foreground
131
+ activity.addEventListener('pause', removeHandler); // Stop when in background
132
+ activity.addEventListener('resume', addHandler); // Resume when foreground
133
133
  ```
134
134
 
135
- ### Compass/Heading
135
+ ### Compass/heading
136
136
 
137
137
  ```javascript
138
138
  // One-time heading
139
139
  Ti.Geolocation.getCurrentHeading((e) => {
140
- Ti.API.info(e.heading.magneticHeading); // degrees from magnetic north
141
- Ti.API.info(e.heading.trueHeading); // degrees from true north
140
+ Ti.API.info(e.heading.magneticHeading); // degrees from magnetic north
141
+ Ti.API.info(e.heading.trueHeading); // degrees from true north
142
142
  });
143
143
 
144
144
  // Continuous heading monitoring
145
145
  Ti.Geolocation.addEventListener('heading', (e) => {
146
- if (!e.error) {
147
- Ti.API.info(`Heading: ${e.heading.magneticHeading}`);
148
- }
146
+ if (!e.error) {
147
+ Ti.API.info(`Heading: ${e.heading.magneticHeading}`);
148
+ }
149
149
  });
150
150
  ```
151
151
 
152
152
  The heading event object includes:
153
- - `heading.magneticHeading` degrees relative to magnetic north
154
- - `heading.trueHeading` degrees relative to true north (requires location)
155
- - `heading.accuracy` deviation in degrees (lower is better)
156
- - `heading.x`, `heading.y`, `heading.z` raw magnetometer data (microteslas)
157
-
158
- ---
153
+ - `heading.magneticHeading` - degrees relative to magnetic north
154
+ - `heading.trueHeading` - degrees relative to true north (requires location)
155
+ - `heading.accuracy` - deviation in degrees (lower is better)
156
+ - `heading.x`, `heading.y`, `heading.z` - raw magnetometer data (microteslas)
159
157
 
160
158
  ## Geocoding
161
159
 
162
- ### Forward Geocoding (AddressCoordinates)
160
+ ### Forward geocoding (addresscoordinates)
163
161
 
164
162
  ```javascript
165
163
  Ti.Geolocation.forwardGeocoder('440 Bernardo Ave Mountain View CA', (e) => {
166
- if (e.success) {
167
- Ti.API.info(`Lat: ${e.latitude}, Lon: ${e.longitude}`);
168
- }
164
+ if (e.success) {
165
+ Ti.API.info(`Lat: ${e.latitude}, Lon: ${e.longitude}`);
166
+ }
169
167
  });
170
168
  ```
171
169
 
172
- **With error handling:**
170
+ With error handling:
173
171
  ```javascript
174
172
  Ti.Geolocation.forwardGeocoder('1600 Amphitheatre Pkwy, Mountain View, CA', (e) => {
175
- if (!e.success || e.error) {
176
- Ti.API.error(`Geocoding failed: ${e.error}`);
177
- return;
178
- }
179
- Ti.API.info(`Lat: ${e.latitude}, Lng: ${e.longitude}`);
173
+ if (!e.success || e.error) {
174
+ Ti.API.error(`Geocoding failed: ${e.error}`);
175
+ return;
176
+ }
177
+ Ti.API.info(`Lat: ${e.latitude}, Lng: ${e.longitude}`);
180
178
  });
181
179
  ```
182
180
 
183
- ### Reverse Geocoding (CoordinatesPlaces)
181
+ ### Reverse geocoding (coordinatesplaces)
184
182
 
185
183
  ```javascript
186
184
  Ti.Geolocation.reverseGeocoder(37.389569, -122.050212, (e) => {
187
- if (e.success) {
188
- e.places.forEach((place) => {
189
- Ti.API.info(place.address); // Full address
190
- Ti.API.info(place.city); // City name
191
- Ti.API.info(place.country); // Country
192
- Ti.API.info(place.zipcode); // Postal code
193
- });
194
- }
185
+ if (e.success) {
186
+ e.places.forEach((place) => {
187
+ Ti.API.info(place.address); // Full address
188
+ Ti.API.info(place.city); // City name
189
+ Ti.API.info(place.country); // Country
190
+ Ti.API.info(place.zipcode); // Postal code
191
+ });
192
+ }
195
193
  });
196
194
  ```
197
195
 
198
- ## 2. Native Maps (Platform-Specific Details)
196
+ ## 2. Native maps (platform-specific details)
199
197
 
200
198
  Due to the complexity of modern native maps, refer to the detailed guides:
201
199
 
202
- - [Google Maps v2 for Android](./google-maps-v2.md): API Keys configuration, Google Play Services, and advanced controls.
203
- - [iOS Map Kit](./ios-map-kit.md): 3D Camera, system buttons, and Info.plist configuration.
204
-
205
- ---
200
+ - Google Maps v2 for Android: `google-maps-v2.md`
201
+ - iOS Map Kit: `ios-map-kit.md`
206
202
 
207
- ## Common Map Patterns
203
+ ## Common map patterns
208
204
 
209
- ### Add Annotation After Map Creation
205
+ ### Add annotation after map creation
210
206
 
211
207
  ```javascript
212
208
  mapview.addAnnotation(annotation);
213
209
  ```
214
210
 
215
- ### Remove Annotation
211
+ ### Remove annotation
216
212
 
217
213
  ```javascript
218
214
  mapview.removeAnnotation(annotation);
219
215
  ```
220
216
 
221
- ### Remove All Annotations
217
+ ### Remove all annotations
222
218
 
223
219
  ```javascript
224
220
  mapview.removeAllAnnotations();
225
221
  ```
226
222
 
227
- ### Select Annotation Programmatically
223
+ ### Select annotation programmatically
228
224
 
229
225
  ```javascript
230
226
  mapview.selectAnnotation(annotation);
231
227
  ```
232
228
 
233
- ### Deselect Annotation
229
+ ### Deselect annotation
234
230
 
235
231
  ```javascript
236
232
  mapview.deselectAnnotation(annotation);
237
233
  ```
238
234
 
239
- ### Set Region with Animation
235
+ ### Set region with animation
240
236
 
241
237
  ```javascript
242
238
  mapview.setLocation({
243
- latitude: 37.389569,
244
- longitude: -122.050212,
245
- animate: true
239
+ latitude: 37.389569,
240
+ longitude: -122.050212,
241
+ animate: true
246
242
  });
247
243
 
248
244
  // Or for region
249
245
  mapview.setRegion({
250
- latitude: 37.389569,
251
- longitude: -122.050212,
252
- latitudeDelta: 0.05,
253
- longitudeDelta: 0.05,
254
- animate: true
246
+ latitude: 37.389569,
247
+ longitude: -122.050212,
248
+ latitudeDelta: 0.05,
249
+ longitudeDelta: 0.05,
250
+ animate: true
255
251
  });
256
252
  ```
257
253
 
258
- ### Zoom to Annotations
254
+ ### Zoom to annotations
259
255
 
260
256
  ```javascript
261
- mapview.showAnnotations([annotation1, annotation2], true); // true = animate
257
+ mapview.showAnnotations([annotation1, annotation2], true); // true = animate
262
258
  ```
263
259
 
264
- ### Best Practices
260
+ ### Best practices
265
261
 
266
- 1. **Battery Life**: Always remove location listeners when not needed. Use `distanceFilter` to reduce updates.
267
- 2. **Accuracy**: Use the lowest accuracy that meets your needs.
268
- 3. **Permissions**: Check permissions before requesting location. Handle denial gracefully.
269
- 4. **Maps on Android**: Only one map view per application (legacy). Use ti.map module for multiple views.
270
- 5. **API Keys**: Google Maps API key required for Android (both debug and production).
271
- 6. **User Location**: Requires location permissions (`NSLocationWhenInUseUsageDescription` for iOS).
262
+ 1. Battery life: remove location listeners when not needed. Use `distanceFilter` to reduce updates.
263
+ 2. Accuracy: use the lowest accuracy that meets your needs.
264
+ 3. Permissions: check permissions before requesting location. Handle denial gracefully.
265
+ 4. Maps on Android: only one map view per application (legacy). Use `ti.map` for multiple views.
266
+ 5. API keys: Google Maps API key required for Android (debug and production).
267
+ 6. User location: requires location permissions (`NSLocationWhenInUseUsageDescription` for iOS).