@maccesar/titools 2.2.4 → 2.2.9

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 (98) hide show
  1. package/README.md +23 -23
  2. package/agents/ti-pro.md +17 -17
  3. package/lib/commands/update.js +6 -14
  4. package/lib/downloader.js +17 -2
  5. package/package.json +1 -1
  6. package/skills/alloy-guides/SKILL.md +31 -31
  7. package/skills/alloy-guides/references/CONCEPTS.md +3 -3
  8. package/skills/alloy-guides/references/CONTROLLERS.md +1 -1
  9. package/skills/alloy-guides/references/MODELS.md +6 -6
  10. package/skills/alloy-guides/references/VIEWS_WITHOUT_CONTROLLERS.md +1 -1
  11. package/skills/alloy-guides/references/VIEWS_XML.md +1 -1
  12. package/skills/alloy-guides/references/WIDGETS.md +1 -1
  13. package/skills/alloy-howtos/SKILL.md +27 -27
  14. package/skills/alloy-howtos/references/best_practices.md +9 -9
  15. package/skills/alloy-howtos/references/cli_reference.md +14 -14
  16. package/skills/alloy-howtos/references/config_files.md +16 -16
  17. package/skills/alloy-howtos/references/custom_tags.md +16 -16
  18. package/skills/alloy-howtos/references/debugging_troubleshooting.md +11 -15
  19. package/skills/alloy-howtos/references/samples.md +19 -19
  20. package/skills/purgetss/SKILL.md +11 -1
  21. package/skills/purgetss/references/animation-system.md +1 -1
  22. package/skills/purgetss/references/cli-commands.md +3 -3
  23. package/skills/purgetss/references/customization-deep-dive.md +1 -1
  24. package/skills/purgetss/references/dynamic-component-creation.md +1 -1
  25. package/skills/purgetss/references/icon-fonts.md +4 -0
  26. package/skills/purgetss/references/installation-setup.md +8 -1
  27. package/skills/purgetss/references/migration-guide.md +4 -0
  28. package/skills/purgetss/references/tikit-components.md +193 -204
  29. package/skills/purgetss/references/ui-ux-design.md +1 -1
  30. package/skills/ti-expert/SKILL.md +78 -118
  31. package/skills/ti-expert/references/alloy-builtins.md +18 -18
  32. package/skills/ti-expert/references/alloy-structure.md +21 -21
  33. package/skills/ti-expert/references/anti-patterns.md +15 -15
  34. package/skills/ti-expert/references/cli-expert.md +15 -15
  35. package/skills/ti-expert/references/code-conventions.md +38 -38
  36. package/skills/ti-expert/references/contracts.md +8 -8
  37. package/skills/ti-expert/references/controller-patterns.md +14 -14
  38. package/skills/ti-expert/references/error-handling.md +11 -11
  39. package/skills/ti-expert/references/examples.md +12 -12
  40. package/skills/ti-expert/references/migration-patterns.md +24 -24
  41. package/skills/ti-expert/references/patterns.md +10 -10
  42. package/skills/ti-expert/references/performance-listview.md +16 -16
  43. package/skills/ti-expert/references/performance-optimization.md +41 -41
  44. package/skills/ti-expert/references/security-device.md +22 -22
  45. package/skills/ti-expert/references/security-fundamentals.md +19 -19
  46. package/skills/ti-expert/references/state-management.md +33 -33
  47. package/skills/ti-expert/references/testing-e2e-ci.md +25 -25
  48. package/skills/ti-expert/references/testing-unit.md +24 -24
  49. package/skills/ti-expert/references/theming.md +15 -15
  50. package/skills/ti-guides/SKILL.md +58 -60
  51. package/skills/ti-guides/references/advanced-data-and-images.md +33 -33
  52. package/skills/ti-guides/references/android-manifest.md +15 -15
  53. package/skills/ti-guides/references/app-distribution.md +70 -166
  54. package/skills/ti-guides/references/application-frameworks.md +96 -114
  55. package/skills/ti-guides/references/cli-reference.md +294 -294
  56. package/skills/ti-guides/references/coding-best-practices.md +42 -33
  57. package/skills/ti-guides/references/commonjs-advanced.md +57 -51
  58. package/skills/ti-guides/references/hello-world.md +36 -36
  59. package/skills/ti-guides/references/hyperloop-native-access.md +66 -66
  60. package/skills/ti-guides/references/javascript-primer.md +83 -101
  61. package/skills/ti-guides/references/reserved-words.md +9 -9
  62. package/skills/ti-guides/references/resources.md +75 -83
  63. package/skills/ti-guides/references/style-and-conventions.md +35 -28
  64. package/skills/ti-guides/references/tiapp-config.md +110 -74
  65. package/skills/ti-howtos/SKILL.md +88 -92
  66. package/skills/ti-howtos/references/android-platform-deep-dives.md +104 -104
  67. package/skills/ti-howtos/references/automation-fastlane-appium.md +39 -39
  68. package/skills/ti-howtos/references/buffer-codec-streams.md +60 -60
  69. package/skills/ti-howtos/references/cross-platform-development.md +115 -136
  70. package/skills/ti-howtos/references/debugging-profiling.md +167 -181
  71. package/skills/ti-howtos/references/extending-titanium.md +121 -121
  72. package/skills/ti-howtos/references/google-maps-v2.md +84 -82
  73. package/skills/ti-howtos/references/ios-map-kit.md +65 -60
  74. package/skills/ti-howtos/references/ios-platform-deep-dives.md +123 -123
  75. package/skills/ti-howtos/references/local-data-sources.md +79 -78
  76. package/skills/ti-howtos/references/location-and-maps.md +116 -120
  77. package/skills/ti-howtos/references/media-apis.md +87 -86
  78. package/skills/ti-howtos/references/notification-services.md +250 -260
  79. package/skills/ti-howtos/references/remote-data-sources.md +98 -93
  80. package/skills/ti-howtos/references/tutorials.md +226 -216
  81. package/skills/ti-howtos/references/using-modules.md +73 -102
  82. package/skills/ti-howtos/references/web-content-integration.md +101 -103
  83. package/skills/ti-howtos/references/webpack-build-pipeline.md +52 -44
  84. package/skills/ti-ui/SKILL.md +85 -85
  85. package/skills/ti-ui/references/accessibility-deep-dive.md +57 -57
  86. package/skills/ti-ui/references/animation-and-matrices.md +79 -79
  87. package/skills/ti-ui/references/application-structures.md +96 -99
  88. package/skills/ti-ui/references/custom-fonts-styling.md +99 -99
  89. package/skills/ti-ui/references/event-handling.md +58 -58
  90. package/skills/ti-ui/references/gestures.md +62 -64
  91. package/skills/ti-ui/references/icons-and-splash-screens.md +88 -88
  92. package/skills/ti-ui/references/layouts-and-positioning.md +87 -97
  93. package/skills/ti-ui/references/listviews-and-performance.md +107 -107
  94. package/skills/ti-ui/references/orientation.md +87 -88
  95. package/skills/ti-ui/references/platform-ui-android.md +87 -81
  96. package/skills/ti-ui/references/platform-ui-ios.md +63 -61
  97. package/skills/ti-ui/references/scrolling-views.md +29 -29
  98. package/skills/ti-ui/references/tableviews.md +56 -56
@@ -1,89 +1,79 @@
1
- # Layouts, Positioning, and View Hierarchy
1
+ # Layouts, positioning, and view hierarchy
2
2
 
3
- ## 🚨 CRITICAL: Platform-Specific Properties Require Modifiers
3
+ ## Critical: platform-specific properties require modifiers
4
4
 
5
- :::danger NEVER use platform-specific properties directly
6
- **Using `Ti.UI.iOS.*` or `Ti.UI.Android.*` properties WITHOUT modifiers will:**
5
+ Do not use `Ti.UI.iOS.*` or `Ti.UI.Android.*` properties without modifiers. It will break builds.
7
6
 
8
- 1. **Add iOS code to Android builds** → compilation failures
9
- 2. **Add Android code to iOS builds** → compilation failures
10
- 3. **Create invalid cross-platform code**
11
-
12
- **REAL EXAMPLE of the damage:**
7
+ Example of the problem:
13
8
  ```javascript
14
- // WRONG - Adds Ti.UI.iOS to Android project
9
+ // WRONG - Adds Ti.UI.iOS to Android project
15
10
  const win = Ti.UI.createWindow({
16
- statusBarStyle: Ti.UI.iOS.StatusBar.LIGHT_CONTENT // FAILS on Android!
11
+ statusBarStyle: Ti.UI.iOS.StatusBar.LIGHT_CONTENT // Fails on Android
17
12
  })
18
13
  ```
19
14
 
20
- **CORRECT approaches:**
15
+ Correct approaches:
21
16
 
22
- **Option 1 - TSS modifier (Alloy projects):**
17
+ Option 1: TSS modifier (Alloy projects)
23
18
  ```tss
24
- // CORRECT - Only adds to iOS
19
+ // CORRECT - Only adds to iOS
25
20
  "#mainWindow[platform=ios]": {
26
21
  statusBarStyle: Ti.UI.iOS.StatusBar.LIGHT_CONTENT
27
22
  }
28
23
  ```
29
24
 
30
- **Option 2 - Conditional code:**
25
+ Option 2: conditional code
31
26
  ```javascript
32
27
  if (OS_IOS) {
33
28
  $.mainWindow.statusBarStyle = Ti.UI.iOS.StatusBar.LIGHT_CONTENT
34
29
  }
35
30
  ```
36
31
 
37
- **Common platform-specific properties that REQUIRE modifiers:**
32
+ Common platform-specific properties that require modifiers:
38
33
  - iOS: `statusBarStyle`, `modalStyle`, `modalTransitionStyle`, any `Ti.UI.iOS.*`
39
34
  - Android: `actionBar` config, any `Ti.Android.*` constant
40
- :::
41
35
 
42
- ## 1. Units of Measurement
36
+ ## 1. Units of measurement
43
37
 
44
- ### Available Units
38
+ ### Available units
45
39
 
46
- | Unit | Description | Platform Notes |
47
- | ------------ | -------------------------- | ------------------------------------------- |
48
- | `dp` / `dip` | Density-independent pixels | **Recommended** for cross-platform |
49
- | `px` | Absolute pixels | Use sparingly - varies by screen density |
50
- | `%` | Percentage of parent size | Relative to parent's dimension |
51
- | `mm` | Millimeters | Absolute physical unit |
52
- | `cm` | Centimeters | Absolute physical unit |
53
- | `in` | Inches | Absolute physical unit |
54
- | `system` | Platform default | iOS = dip, Android = px (unless configured) |
40
+ | Unit | Description | Platform notes |
41
+ | ------------ | -------------------------- | ---------------------------------------- |
42
+ | `dp` / `dip` | Density-independent pixels | Recommended for cross-platform |
43
+ | `px` | Absolute pixels | Use sparingly, varies by density |
44
+ | `%` | Percentage of parent size | Relative to parent dimension |
45
+ | `mm` | Millimeters | Absolute physical unit |
46
+ | `cm` | Centimeters | Absolute physical unit |
47
+ | `in` | Inches | Absolute physical unit |
48
+ | `system` | Platform default | iOS = dip, Android = px (unless changed) |
55
49
 
56
- ### Density-Independent Pixels (dp)
50
+ ### Density-independent pixels (dp)
57
51
 
58
- **Android**: `actual pixels = dip × (screen density) / 160`
52
+ Android: `actual pixels = dip * (screen density) / 160`
59
53
  - mdpi (160 dpi): 1dp = 1px
60
54
  - hdpi (240 dpi): 1dp = 1.5px
61
55
  - xhdpi (320 dpi): 1dp = 2px
62
56
  - xxhdpi (480 dpi): 1dp = 3px
63
57
 
64
- **iOS**: Effectively `1dip = 1px` on non-retina, `1dip = 2px` on retina
58
+ iOS: effectively `1dip = 1px` on non-retina, `1dip = 2px` on retina.
65
59
 
66
- ### Default Units in tiapp.xml
60
+ ### Default units in tiapp.xml
67
61
 
68
- You can set app-wide default units via the `ti.ui.defaultunit` property in `tiapp.xml`:
62
+ You can set app-wide default units via `ti.ui.defaultunit` in `tiapp.xml`:
69
63
 
70
64
  ```xml
71
65
  <property name="ti.ui.defaultunit" type="string">dp</property>
72
66
  ```
73
67
 
74
- When set, numeric values without explicit units (e.g., `width: 100`) use this unit instead of the platform default.
68
+ When set, numeric values without explicit units (for example, `width: 100`) use this unit instead of the platform default.
75
69
 
76
- ### Platform Coordinate Grid Differences
70
+ ### Platform coordinate grid differences
77
71
 
78
- > **Important**: iOS and Android use different default coordinate systems:
79
- > - **iOS** uses a density-independent grid (e.g., 320×480 dip for iPhone classic, 1024×768 for iPad). Values are always in dip.
80
- > - **Android** uses a pixel-based grid by default (varies by device: HVGA 320×480px, WVGA800 480×800px, etc.).
81
- >
82
- > This is why setting `ti.ui.defaultunit` to `dp` is recommended for cross-platform consistency — it normalizes Android's behavior to match iOS's density-independent approach.
72
+ iOS uses a density-independent grid. Android uses a pixel-based grid by default. That is why setting `ti.ui.defaultunit` to `dp` is the safest cross-platform choice.
83
73
 
84
- ### Best Practice
74
+ ### Best practice
85
75
 
86
- Always use `dp` for consistent sizing across devices:
76
+ Use `dp` for consistent sizing across devices:
87
77
 
88
78
  ```javascript
89
79
  // GOOD
@@ -99,9 +89,9 @@ const view = Ti.UI.createView({
99
89
  });
100
90
  ```
101
91
 
102
- ## 2. Positioning Properties
92
+ ## 2. Positioning properties
103
93
 
104
- ### Edge-Based Positioning
94
+ ### Edge-based positioning
105
95
 
106
96
  Relative to parent edges:
107
97
 
@@ -114,7 +104,7 @@ const view = Ti.UI.createView({
114
104
  });
115
105
  ```
116
106
 
117
- ### Center Positioning
107
+ ### Center positioning
118
108
 
119
109
  ```javascript
120
110
  const view = Ti.UI.createView({
@@ -122,7 +112,7 @@ const view = Ti.UI.createView({
122
112
  });
123
113
  ```
124
114
 
125
- ### Dynamic Sizing
115
+ ### Dynamic sizing
126
116
 
127
117
  Omit a dimension to calculate dynamically:
128
118
 
@@ -135,9 +125,9 @@ const view = Ti.UI.createView({
135
125
  });
136
126
  ```
137
127
 
138
- ## 3. Layout Modes
128
+ ## 3. Layout modes
139
129
 
140
- ### Composite (Default)
130
+ ### Composite (default)
141
131
 
142
132
  Views stack on top of each other:
143
133
 
@@ -161,13 +151,13 @@ container.add(view2);
161
151
  // view2 appears on top of view1
162
152
  ```
163
153
 
164
- Stacking order controlled by:
154
+ Stacking order is controlled by:
165
155
  - Addition order
166
- - `zIndex` property (higher = on top)
156
+ - `zIndex` (higher is on top)
167
157
 
168
- > **Android limitation**: `zIndex` is only supported by composite layouts. The `zIndex` property is ignored by horizontal and vertical layouts.
158
+ Android limitation: `zIndex` is only supported by composite layouts. It is ignored by horizontal and vertical layouts.
169
159
 
170
- ### Vertical Layout
160
+ ### Vertical layout
171
161
 
172
162
  Children stack vertically:
173
163
 
@@ -193,12 +183,12 @@ container.add(label2);
193
183
  // label2 appears below label1 with 10dp gap
194
184
  ```
195
185
 
196
- **Vertical Layout Rules**:
197
- - Children's `top` property acts as **offset** from previous sibling
198
- - Children are **horizontally centered** by default
199
- - Set `horizontalWrap: false` to prevent wrapping
186
+ Vertical layout rules:
187
+ - `top` is an offset from the previous sibling.
188
+ - Children are horizontally centered by default.
189
+ - Set `horizontalWrap: false` to prevent wrapping.
200
190
 
201
- ### Horizontal Layout
191
+ ### Horizontal layout
202
192
 
203
193
  Children line up left to right:
204
194
 
@@ -225,12 +215,12 @@ container.add(view2);
225
215
  // view2 appears to right of view1 with 10dp gap
226
216
  ```
227
217
 
228
- **Horizontal Layout Rules**:
229
- - Children's `left` property acts as **offset** from previous sibling
230
- - `horizontalWrap: true` (default) - moves to next row if insufficient space
231
- - `horizontalWrap: false` - continues on same row (may overflow)
218
+ Horizontal layout rules:
219
+ - `left` is an offset from the previous sibling.
220
+ - `horizontalWrap: true` (default) moves to the next row if needed.
221
+ - `horizontalWrap: false` keeps items on one row and may overflow.
232
222
 
233
- ## 4. Auto-Size Behaviors
223
+ ## 4. Auto-size behaviors
234
224
 
235
225
  ### Ti.UI.SIZE
236
226
 
@@ -255,19 +245,19 @@ const view = Ti.UI.createView({
255
245
  });
256
246
  ```
257
247
 
258
- ### Component Defaults
248
+ ### Component defaults
259
249
 
260
- | SIZE Components | FILL Components | Mixed |
261
- | :-------------- | :-------------- | :------------------------------------- |
250
+ | SIZE components | FILL components | Mixed |
251
+ | --------------- | --------------- | -------------------------------------- |
262
252
  | Button | Window | TableViewRow (FILL width, SIZE height) |
263
253
  | Label | View | Slider (FILL width, SIZE height) |
264
254
  | ImageView | ScrollView | Toolbar (FILL width, SIZE height) |
265
255
  | Switch | WebView | |
266
256
  | TextField | ScrollableView | |
267
257
 
268
- ### ScrollView Auto-Sizing
258
+ ### ScrollView auto-sizing
269
259
 
270
- When a `ScrollView`'s `contentWidth` or `contentHeight` is set to `"auto"` or `Ti.UI.SIZE`, the scroll view's content area grows based on the bottom/right offsets of its child views:
260
+ When a `ScrollView` has `contentWidth` or `contentHeight` set to `"auto"` or `Ti.UI.SIZE`, its content area grows based on the bottom and right offsets of its children:
271
261
 
272
262
  ```javascript
273
263
  const scrollView = Ti.UI.createScrollView({
@@ -277,15 +267,15 @@ const scrollView = Ti.UI.createScrollView({
277
267
  });
278
268
  ```
279
269
 
280
- ### Auto-Size in Layout Modes
270
+ ### Auto-size in layout modes
281
271
 
282
- In `vertical`/`horizontal` layouts:
283
- - `FILL` takes into account previously added siblings
284
- - Example: First child `FILL`, second child `SIZE` second gets remaining space
272
+ In vertical and horizontal layouts:
273
+ - `FILL` takes into account previously added siblings.
274
+ - Example: First child `FILL`, second child `SIZE` means the second gets remaining space.
285
275
 
286
- ## 5. Combining Layouts
276
+ ## 5. Combining layouts
287
277
 
288
- ### Nested Layouts
278
+ ### Nested layouts
289
279
 
290
280
  ```javascript
291
281
  const outerContainer = Ti.UI.createView({
@@ -324,9 +314,9 @@ outerContainer.add(header);
324
314
  outerContainer.add(content);
325
315
  ```
326
316
 
327
- ## 6. View Hierarchy and Z-Index
317
+ ## 6. View hierarchy and zIndex
328
318
 
329
- ### Stacking Order
319
+ ### Stacking order
330
320
 
331
321
  Views added later appear on top:
332
322
 
@@ -346,9 +336,9 @@ win.add(view1);
346
336
  win.add(view2); // view2 appears on top of view1
347
337
  ```
348
338
 
349
- ### The `size` Property and `postlayout` Event
339
+ ### The `size` property and `postlayout` event
350
340
 
351
- The read-only `size` property provides the width and height of a view after layout. This property won't return accurate values until a `postlayout` event has been received:
341
+ The read-only `size` property gives the width and height of a view after layout. It is accurate only after `postlayout` fires:
352
342
 
353
343
  ```javascript
354
344
  const view = Ti.UI.createView({ width: '50%', height: Ti.UI.SIZE });
@@ -358,7 +348,7 @@ view.addEventListener('postlayout', () => {
358
348
  });
359
349
  ```
360
350
 
361
- ### Explicit Z-Index
351
+ ### Explicit zIndex
362
352
 
363
353
  ```javascript
364
354
  const view1 = Ti.UI.createView({
@@ -378,9 +368,9 @@ win.add(view2);
378
368
  win.add(view1); // Still below view2 due to zIndex
379
369
  ```
380
370
 
381
- ## 7. Common Layout Patterns
371
+ ## 7. Common layout patterns
382
372
 
383
- ### Full-Screen Overlay
373
+ ### Full-screen overlay
384
374
 
385
375
  ```javascript
386
376
  const overlay = Ti.UI.createView({
@@ -401,7 +391,7 @@ overlay.add(dialog);
401
391
  win.add(overlay);
402
392
  ```
403
393
 
404
- ### Centered Content
394
+ ### Centered content
405
395
 
406
396
  ```javascript
407
397
  const container = Ti.UI.createView({
@@ -419,7 +409,7 @@ const centered = Ti.UI.createView({
419
409
  container.add(centered);
420
410
  ```
421
411
 
422
- ### Bottom-Aligned Content
412
+ ### Bottom-aligned content
423
413
 
424
414
  ```javascript
425
415
  const footer = Ti.UI.createView({
@@ -429,7 +419,7 @@ const footer = Ti.UI.createView({
429
419
  });
430
420
  ```
431
421
 
432
- ### Percentage-Based Layout
422
+ ### Percentage-based layout
433
423
 
434
424
  ```javascript
435
425
  const leftPanel = Ti.UI.createView({
@@ -446,25 +436,25 @@ const rightPanel = Ti.UI.createView({
446
436
  });
447
437
  ```
448
438
 
449
- ## 8. Platform Considerations
439
+ ## 8. Platform considerations
450
440
 
451
- ### Android Density-Specific Resources
441
+ ### Android density-specific resources
452
442
 
453
443
  Place resources in appropriate directories:
454
444
  - `res-ldpi`, `res-mdpi`, `res-hdpi`, `res-xhdpi`, `res-xxhdpi`
455
445
 
456
- ### iOS Asset Catalog
446
+ ### iOS asset catalog
457
447
 
458
- PNG/JPEG images with naming convention:
459
- - `foo.png` - Non-retina
460
- - `foo@2x.png` - Retina
461
- - `foo@3x.png` - iPhone 6 Plus
448
+ PNG or JPEG images with naming conventions:
449
+ - `foo.png` for non-retina
450
+ - `foo@2x.png` for retina
451
+ - `foo@3x.png` for iPhone Plus sizes
462
452
 
463
- ## Best Practices
453
+ ## Best practices
464
454
 
465
- 1. **Use `dp` units** for cross-platform consistency
466
- 2. **Prefer `Ti.UI.FILL`** over percentages for containers
467
- 3. **Avoid `Ti.UI.SIZE` in ListViews** for performance
468
- 4. **Use layout modes** instead of manual positioning when possible
469
- 5. **Test on multiple devices** with different screen sizes
470
- 6. **Use `zIndex` sparingly** - rely on addition order when possible
455
+ 1. Use `dp` units for cross-platform consistency.
456
+ 2. Prefer `Ti.UI.FILL` over percentages for containers.
457
+ 3. Avoid `Ti.UI.SIZE` in ListViews for performance.
458
+ 4. Use layout modes instead of manual positioning when possible.
459
+ 5. Test on multiple devices with different screen sizes.
460
+ 6. Use `zIndex` sparingly and rely on add order where possible.