@maccesar/titools 2.0.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 (120) hide show
  1. package/AGENTS-TEMPLATE.md +173 -0
  2. package/README.md +867 -0
  3. package/agents/ti-researcher.md +108 -0
  4. package/bin/titools.js +53 -0
  5. package/lib/commands/agents.js +126 -0
  6. package/lib/commands/install.js +188 -0
  7. package/lib/commands/uninstall.js +215 -0
  8. package/lib/commands/update.js +159 -0
  9. package/lib/config.js +119 -0
  10. package/lib/downloader.js +153 -0
  11. package/lib/installer.js +253 -0
  12. package/lib/platform.js +108 -0
  13. package/lib/symlink.js +142 -0
  14. package/lib/utils.js +270 -0
  15. package/package.json +67 -0
  16. package/skills/alloy-expert/SKILL.md +247 -0
  17. package/skills/alloy-expert/assets/ControllerAutoCleanup.js +182 -0
  18. package/skills/alloy-expert/references/alloy-structure.md +381 -0
  19. package/skills/alloy-expert/references/anti-patterns.md +133 -0
  20. package/skills/alloy-expert/references/code-conventions.md +469 -0
  21. package/skills/alloy-expert/references/contracts.md +280 -0
  22. package/skills/alloy-expert/references/controller-patterns.md +520 -0
  23. package/skills/alloy-expert/references/error-handling.md +484 -0
  24. package/skills/alloy-expert/references/examples.md +735 -0
  25. package/skills/alloy-expert/references/migration-patterns.md +298 -0
  26. package/skills/alloy-expert/references/patterns.md +448 -0
  27. package/skills/alloy-expert/references/performance-patterns.md +855 -0
  28. package/skills/alloy-expert/references/security-patterns.md +847 -0
  29. package/skills/alloy-expert/references/state-management.md +779 -0
  30. package/skills/alloy-expert/references/testing.md +872 -0
  31. package/skills/alloy-guides/SKILL.md +214 -0
  32. package/skills/alloy-guides/references/CLI_TASKS.md +243 -0
  33. package/skills/alloy-guides/references/CONCEPTS.md +191 -0
  34. package/skills/alloy-guides/references/CONTROLLERS.md +298 -0
  35. package/skills/alloy-guides/references/MODELS.md +1028 -0
  36. package/skills/alloy-guides/references/PURGETSS.md +56 -0
  37. package/skills/alloy-guides/references/VIEWS_DYNAMIC.md +242 -0
  38. package/skills/alloy-guides/references/VIEWS_STYLES.md +388 -0
  39. package/skills/alloy-guides/references/VIEWS_WITHOUT_CONTROLLERS.md +109 -0
  40. package/skills/alloy-guides/references/VIEWS_XML.md +558 -0
  41. package/skills/alloy-guides/references/WIDGETS.md +176 -0
  42. package/skills/alloy-howtos/SKILL.md +203 -0
  43. package/skills/alloy-howtos/references/best_practices.md +138 -0
  44. package/skills/alloy-howtos/references/cli_reference.md +253 -0
  45. package/skills/alloy-howtos/references/config_files.md +87 -0
  46. package/skills/alloy-howtos/references/custom_tags.md +147 -0
  47. package/skills/alloy-howtos/references/debugging_troubleshooting.md +101 -0
  48. package/skills/alloy-howtos/references/samples.md +167 -0
  49. package/skills/purgetss/SKILL.md +442 -0
  50. package/skills/purgetss/assets/purgetss.config.cjs +17 -0
  51. package/skills/purgetss/references/EXAMPLES.md +247 -0
  52. package/skills/purgetss/references/animation-system.md +1294 -0
  53. package/skills/purgetss/references/apply-directive.md +375 -0
  54. package/skills/purgetss/references/arbitrary-values.md +612 -0
  55. package/skills/purgetss/references/class-index.md +1350 -0
  56. package/skills/purgetss/references/cli-commands.md +948 -0
  57. package/skills/purgetss/references/configurable-properties.md +654 -0
  58. package/skills/purgetss/references/custom-rules.md +161 -0
  59. package/skills/purgetss/references/customization-deep-dive.md +722 -0
  60. package/skills/purgetss/references/dynamic-component-creation.md +489 -0
  61. package/skills/purgetss/references/grid-layout.md +455 -0
  62. package/skills/purgetss/references/icon-fonts.md +609 -0
  63. package/skills/purgetss/references/installation-setup.md +366 -0
  64. package/skills/purgetss/references/opacity-modifier.md +291 -0
  65. package/skills/purgetss/references/platform-modifiers.md +479 -0
  66. package/skills/purgetss/references/smart-mappings.md +42 -0
  67. package/skills/purgetss/references/titanium-resets.md +359 -0
  68. package/skills/purgetss/references/ui-ux-design.md +1526 -0
  69. package/skills/ti-guides/SKILL.md +94 -0
  70. package/skills/ti-guides/references/advanced-data-and-images.md +19 -0
  71. package/skills/ti-guides/references/alloy-cli-advanced.md +84 -0
  72. package/skills/ti-guides/references/alloy-data-mastery.md +29 -0
  73. package/skills/ti-guides/references/alloy-widgets-and-themes.md +19 -0
  74. package/skills/ti-guides/references/android-manifest.md +97 -0
  75. package/skills/ti-guides/references/app-distribution.md +258 -0
  76. package/skills/ti-guides/references/application-frameworks.md +377 -0
  77. package/skills/ti-guides/references/cli-reference.md +402 -0
  78. package/skills/ti-guides/references/coding-best-practices.md +102 -0
  79. package/skills/ti-guides/references/commonjs-advanced.md +134 -0
  80. package/skills/ti-guides/references/hello-world.md +100 -0
  81. package/skills/ti-guides/references/hyperloop-native-access.md +62 -0
  82. package/skills/ti-guides/references/javascript-primer.md +411 -0
  83. package/skills/ti-guides/references/reserved-words.md +36 -0
  84. package/skills/ti-guides/references/resources.md +183 -0
  85. package/skills/ti-guides/references/style-and-conventions.md +48 -0
  86. package/skills/ti-guides/references/tiapp-config.md +609 -0
  87. package/skills/ti-howtos/SKILL.md +174 -0
  88. package/skills/ti-howtos/references/android-platform-deep-dives.md +658 -0
  89. package/skills/ti-howtos/references/automation-fastlane-appium.md +95 -0
  90. package/skills/ti-howtos/references/buffer-codec-streams.md +140 -0
  91. package/skills/ti-howtos/references/cross-platform-development.md +348 -0
  92. package/skills/ti-howtos/references/debugging-profiling.md +543 -0
  93. package/skills/ti-howtos/references/extending-titanium.md +723 -0
  94. package/skills/ti-howtos/references/google-maps-v2.md +169 -0
  95. package/skills/ti-howtos/references/ios-map-kit.md +143 -0
  96. package/skills/ti-howtos/references/ios-platform-deep-dives.md +783 -0
  97. package/skills/ti-howtos/references/local-data-sources.md +301 -0
  98. package/skills/ti-howtos/references/location-and-maps.md +252 -0
  99. package/skills/ti-howtos/references/media-apis.md +210 -0
  100. package/skills/ti-howtos/references/notification-services.md +599 -0
  101. package/skills/ti-howtos/references/remote-data-sources.md +349 -0
  102. package/skills/ti-howtos/references/tutorials.md +502 -0
  103. package/skills/ti-howtos/references/using-modules.md +237 -0
  104. package/skills/ti-howtos/references/web-content-integration.md +307 -0
  105. package/skills/ti-howtos/references/webpack-build-pipeline.md +78 -0
  106. package/skills/ti-ui/SKILL.md +179 -0
  107. package/skills/ti-ui/references/accessibility-deep-dive.md +242 -0
  108. package/skills/ti-ui/references/animation-and-matrices.md +599 -0
  109. package/skills/ti-ui/references/application-structures.md +655 -0
  110. package/skills/ti-ui/references/custom-fonts-styling.md +579 -0
  111. package/skills/ti-ui/references/event-handling.md +393 -0
  112. package/skills/ti-ui/references/gestures.md +473 -0
  113. package/skills/ti-ui/references/icons-and-splash-screens.md +409 -0
  114. package/skills/ti-ui/references/layouts-and-positioning.md +462 -0
  115. package/skills/ti-ui/references/listviews-and-performance.md +619 -0
  116. package/skills/ti-ui/references/orientation.md +362 -0
  117. package/skills/ti-ui/references/platform-ui-android.md +635 -0
  118. package/skills/ti-ui/references/platform-ui-ios.md +469 -0
  119. package/skills/ti-ui/references/scrolling-views.md +252 -0
  120. package/skills/ti-ui/references/tableviews.md +568 -0
@@ -0,0 +1,362 @@
1
+ # Orientation
2
+
3
+ ## Table of Contents
4
+
5
+ - [Orientation](#orientation)
6
+ - [Table of Contents](#table-of-contents)
7
+ - [1. Overview](#1-overview)
8
+ - [2. Orientation Modes](#2-orientation-modes)
9
+ - [Supported Orientations](#supported-orientations)
10
+ - [3. Locking Orientation](#3-locking-orientation)
11
+ - [Lock to Specific Orientation](#lock-to-specific-orientation)
12
+ - [Android Orientation Values](#android-orientation-values)
13
+ - [Runtime Orientation Lock (iOS)](#runtime-orientation-lock-ios)
14
+ - [4. Handling Orientation Changes](#4-handling-orientation-changes)
15
+ - [Detect Orientation Change](#detect-orientation-change)
16
+ - [Window Orientation Events](#window-orientation-events)
17
+ - [5. Adapting UI to Orientation](#5-adapting-ui-to-orientation)
18
+ - [Responsive Layout Example](#responsive-layout-example)
19
+ - [Orientation-Specific Components](#orientation-specific-components)
20
+ - [6. Platform Differences](#6-platform-differences)
21
+ - [iOS Orientation](#ios-orientation)
22
+ - [Android Orientation](#android-orientation)
23
+ - [7. Checking Current Orientation](#7-checking-current-orientation)
24
+ - [8. Disabling Orientation Change](#8-disabling-orientation-change)
25
+ - [Disable All Rotation](#disable-all-rotation)
26
+ - [Disable Rotation for Specific Window (iOS)](#disable-rotation-for-specific-window-ios)
27
+ - [9. Orientation Lock During Specific Operation](#9-orientation-lock-during-specific-operation)
28
+ - [Temporarily Lock Orientation](#temporarily-lock-orientation)
29
+ - [10. Best Practices](#10-best-practices)
30
+ - [11. Common Issues](#11-common-issues)
31
+ - [Orientation Not Changing](#orientation-not-changing)
32
+ - [UI Doesn't Adapt](#ui-doesnt-adapt)
33
+ - [Upside-Down Orientation](#upside-down-orientation)
34
+
35
+ ---
36
+
37
+ ## 1. Overview
38
+
39
+ Orientation refers to whether the app displays in portrait or landscape mode, and how to handle orientation changes.
40
+
41
+ ## 2. Orientation Modes
42
+
43
+ ### Supported Orientations
44
+
45
+ | Mode | Description |
46
+ | ----------------------- | -------------------------------- |
47
+ | `Ti.UI.PORTRAIT` | Upright, home button at bottom |
48
+ | `Ti.UI.UPSIDE_PORTRAIT` | Upright, home button at top |
49
+ | `Ti.UI.LANDSCAPE_LEFT` | Landscape, home button on right |
50
+ | `Ti.UI.LANDSCAPE_RIGHT` | Landscape, home button on left |
51
+ | `Ti.UI.FACE_UP` | Device face up (flat on table) |
52
+ | `Ti.UI.FACE_DOWN` | Device face down (flat on table) |
53
+ | `Ti.UI.AUTO` | Let system decide |
54
+
55
+ ## 3. Locking Orientation
56
+
57
+ ### Lock to Specific Orientation
58
+
59
+ **In tiapp.xml** (preferred):
60
+
61
+ ```xml
62
+ <ios>
63
+ <plist>
64
+ <dict>
65
+ <key>UISupportedInterfaceOrientations</key>
66
+ <array>
67
+ <string>UIInterfaceOrientationPortrait</string>
68
+ <string>UIInterfaceOrientationPortraitUpsideDown</string>
69
+ </array>
70
+ </dict>
71
+ </plist>
72
+ </ios>
73
+
74
+ <android>
75
+ <manifest>
76
+ <activity>
77
+ <android:screenOrientation="portrait"/>
78
+ </activity>
79
+ </manifest>
80
+ </android>
81
+ ```
82
+
83
+ ### Android Orientation Values
84
+
85
+ ```xml
86
+ <activity android:screenOrientation="portrait"/>
87
+ <activity android:screenOrientation="landscape"/>
88
+ <activity android:screenOrientation="reversePortrait"/>
89
+ <activity android:screenOrientation="reverseLandscape"/>
90
+ <activity android:screenOrientation="sensorPortrait"/>
91
+ <activity android:screenOrientation="sensorLandscape"/>
92
+ <activity android:screenOrientation="fullSensor"/>
93
+ <activity android:screenOrientation="nosensor"/>
94
+ <activity android:screenOrientation="userPortrait"/>
95
+ <activity android:screenOrientation="userLandscape"/>
96
+ <activity android:screenOrientation="sensor"/>
97
+ ```
98
+
99
+ **Common values**:
100
+ - `portrait` - Portrait mode
101
+ - `landscape` - Landscape mode
102
+ - `sensor` - Uses accelerometer to determine
103
+ - `fullSensor` - All 4 orientations (including upside-down)
104
+ - `nosensor` - Ignores accelerometer (orientation changes only)
105
+ - `user` - User's preference
106
+
107
+ ### Runtime Orientation Lock (iOS)
108
+
109
+ ```javascript
110
+ // Set orientation at runtime
111
+ Ti.UI.iPhone.setStatusBarStyle(Ti.UI.iPhone.StatusBar.DEFAULT);
112
+
113
+ // Note: In iOS, orientation is primarily controlled by Info.plist
114
+ // Use tiapp.xml configuration for consistent behavior
115
+ ```
116
+
117
+ ## 4. Handling Orientation Changes
118
+
119
+ ### Detect Orientation Change
120
+
121
+ ```javascript
122
+ Ti.Gesture.addEventListener('orientationchange', (e) => {
123
+ Ti.API.info(`Orientation changed to: ${e.orientation}`);
124
+
125
+ if (e.orientation === Ti.UI.PORTRAIT) {
126
+ adjustForPortrait();
127
+ } else if (e.orientation === Ti.UI.LANDSCAPE_LEFT ||
128
+ e.orientation === Ti.UI.LANDSCAPE_RIGHT) {
129
+ adjustForLandscape();
130
+ }
131
+ });
132
+ ```
133
+ ...
134
+ ### Window Orientation Events
135
+
136
+ ```javascript
137
+ const win = Ti.UI.createWindow();
138
+
139
+ win.addEventListener('focus', () => {
140
+ Ti.API.info(`Current orientation: ${Ti.Gesture.orientation}`);
141
+ });
142
+
143
+ win.addEventListener('orientationchange', (e) => {
144
+ Ti.API.info('Window orientation changed');
145
+ });
146
+ ```
147
+
148
+ ## 5. Adapting UI to Orientation
149
+
150
+ ### Responsive Layout Example
151
+
152
+ ```javascript
153
+ const container = Ti.UI.createView({
154
+ width: Ti.UI.FILL,
155
+ height: Ti.UI.FILL,
156
+ layout: 'vertical'
157
+ });
158
+
159
+ function updateLayout() {
160
+ const orientation = Ti.Gesture.orientation;
161
+
162
+ if (orientation === Ti.UI.PORTRAIT ||
163
+ orientation === Ti.UI.UPSIDE_PORTRAIT) {
164
+ // Portrait layout
165
+ container.width = Ti.UI.FILL;
166
+ container.height = Ti.UI.FILL;
167
+ container.layout = 'vertical';
168
+ } else {
169
+ // Landscape layout
170
+ container.width = Ti.UI.FILL;
171
+ container.height = Ti.UI.FILL;
172
+ container.layout = 'horizontal';
173
+ }
174
+ }
175
+
176
+ Ti.Gesture.addEventListener('orientationchange', updateLayout);
177
+ ```
178
+
179
+ ### Orientation-Specific Components
180
+
181
+ ```javascript
182
+ function createPortraitLayout() {
183
+ return Ti.UI.createView({
184
+ layout: 'vertical'
185
+ });
186
+ }
187
+
188
+ function createLandscapeLayout() {
189
+ return Ti.UI.createView({
190
+ layout: 'horizontal'
191
+ });
192
+ }
193
+
194
+ let currentLayout;
195
+
196
+ function switchLayout() {
197
+ const orientation = Ti.Gesture.orientation;
198
+ const isPortrait = (orientation === Ti.UI.PORTRAIT ||
199
+ orientation === Ti.UI.UPSIDE_PORTRAIT);
200
+
201
+ const newLayout = isPortrait ? createPortraitLayout() : createLandscapeLayout();
202
+
203
+ if (currentLayout) {
204
+ win.remove(currentLayout);
205
+ }
206
+
207
+ currentLayout = newLayout;
208
+ win.add(currentLayout);
209
+ }
210
+
211
+ Ti.Gesture.addEventListener('orientationchange', switchLayout);
212
+ ```
213
+
214
+ ## 6. Platform Differences
215
+
216
+ ### iOS Orientation
217
+
218
+ - Controlled by `UISupportedInterfaceOrientations` in Info.plist
219
+ - Shake to rotate can be disabled
220
+ - Status bar orientation matches window orientation
221
+ - Supports all orientations including upside-down
222
+
223
+ ### Android Orientation
224
+
225
+ - Controlled by `screenOrientation` in AndroidManifest.xml
226
+ - Can be set per-activity
227
+ - More granular control (sensor, user, nosensor)
228
+ - May ignore upside-down depending on device
229
+
230
+ ## 7. Checking Current Orientation
231
+
232
+ ```javascript
233
+ // Get current orientation
234
+ const currentOrientation = Ti.Gesture.orientation;
235
+
236
+ Ti.API.info(`Current: ${currentOrientation}`);
237
+
238
+ // Check if portrait
239
+ const isPortrait = (currentOrientation === Ti.UI.PORTRAIT ||
240
+ currentOrientation === Ti.UI.UPSIDE_PORTRAIT);
241
+
242
+ // Check if landscape
243
+ const isLandscape = (currentOrientation === Ti.UI.LANDSCAPE_LEFT ||
244
+ currentOrientation === Ti.UI.LANDSCAPE_RIGHT);
245
+ ```
246
+
247
+ ## 8. Disabling Orientation Change
248
+
249
+ ### Disable All Rotation
250
+
251
+ **iOS (tiapp.xml)**:
252
+ ```xml
253
+ <ios>
254
+ <plist>
255
+ <dict>
256
+ <key>UISupportedInterfaceOorientations</key>
257
+ <array>
258
+ <string>UIInterfaceOrientationPortrait</string>
259
+ </array>
260
+ </dict>
261
+ </plist>
262
+ </ios>
263
+ ```
264
+
265
+ **Android (tiapp.xml)**:
266
+ ```xml
267
+ <android>
268
+ <manifest>
269
+ <activity android:screenOrientation="portrait"/>
270
+ </manifest>
271
+ </android>
272
+ ```
273
+
274
+ ### Disable Rotation for Specific Window (iOS)
275
+
276
+ ```javascript
277
+ const win = Ti.UI.createWindow({
278
+ orientationModes: [Ti.UI.PORTRAIT]
279
+ });
280
+ ```
281
+
282
+ **Note**: Window-level orientation control is limited; app-level configuration is preferred.
283
+
284
+ ## 9. Orientation Lock During Specific Operation
285
+
286
+ ### Temporarily Lock Orientation
287
+
288
+ ```javascript
289
+ let originalOrientation = null;
290
+
291
+ function lockOrientation() {
292
+ // Save current orientation
293
+ originalOrientation = Ti.Gesture.orientation;
294
+
295
+ // Force portrait
296
+ if (Ti.Platform.osname === 'iphone' || Ti.Platform.osname === 'ipad') {
297
+ // iOS doesn't support runtime orientation lock
298
+ // This is controlled at app level
299
+ Ti.API.warn('iOS orientation must be locked in tiapp.xml');
300
+ }
301
+ }
302
+
303
+ function unlockOrientation() {
304
+ // Would restore orientation
305
+ // Not fully supported on all platforms
306
+ }
307
+
308
+ // Use case: During video playback
309
+ const videoPlayer = Ti.Media.createVideoPlayer({
310
+ url: 'video.mp4'
311
+ });
312
+
313
+ videoPlayer.addEventListener('playbackstart', () => {
314
+ lockOrientation();
315
+ });
316
+
317
+ videoPlayer.addEventListener('playbackcomplete', () => {
318
+ unlockOrientation();
319
+ });
320
+ ```
321
+
322
+ ## 10. Best Practices
323
+
324
+ 1. **Test on multiple devices** - Orientation behavior varies
325
+ 2. **Test rotation scenarios** - How does your UI adapt?
326
+ 3. **Consider user preference** - Allow rotation when appropriate
327
+ 4. **Lock when needed** - Video, games, camera capture
328
+ 5. **Use responsive layouts** - Adapt UI to orientation
329
+ 6. **Test upside-down** - Some devices support it, some don't
330
+ 7. **Handle edge cases** - What happens during phone calls?
331
+ 8. **Consider tablets** - Default orientation may differ
332
+
333
+ ## 11. Common Issues
334
+
335
+ ### Orientation Not Changing
336
+
337
+ **Problem**: App doesn't rotate when device rotates.
338
+
339
+ **Solutions**:
340
+ 1. Check `tiapp.xml` orientation settings
341
+ 2. Ensure all orientations are enabled
342
+ 3. Test on physical device (simulator may not reflect real behavior)
343
+ 4. Check for custom orientation locking code
344
+
345
+ ### UI Doesn't Adapt
346
+
347
+ **Problem**: App rotates but layout doesn't adjust.
348
+
349
+ **Solutions**:
350
+ 1. Implement `orientationchange` event listener
351
+ 2. Use responsive layout techniques
352
+ 3. Test both portrait and landscape layouts
353
+ 4. Consider using different layouts for each orientation
354
+
355
+ ### Upside-Down Orientation
356
+
357
+ **Problem**: App appears upside-down.
358
+
359
+ **Solutions**:
360
+ 1. Add `UIInterfaceOrientationPortraitUpsideDown` to supported orientations (iOS)
361
+ 2. Use `reversePortrait` or `fullSensor` (Android)
362
+ 3. Consider whether upside-down is needed for your use case