@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,359 @@
1
+ # Titanium Element Resets
2
+
3
+ PurgeTSS automatically resets certain Titanium elements to facilitate UI layout. Understanding these resets is critical for effective PurgeTSS usage.
4
+
5
+ ## Table of Contents
6
+
7
+ - [Titanium Element Resets](#titanium-element-resets)
8
+ - [Table of Contents](#table-of-contents)
9
+ - [The Three Default Resets](#the-three-default-resets)
10
+ - [View Reset: `Ti.UI.SIZE`](#view-reset-tiuisize)
11
+ - [What `Ti.UI.SIZE` Means](#what-tiuisize-means)
12
+ - [Practical Examples](#practical-examples)
13
+ - [View in Different Layouts](#view-in-different-layouts)
14
+ - [ImageView Reset: iOS Hi-Res](#imageview-reset-ios-hi-res)
15
+ - [Window Reset: White Background](#window-reset-white-background)
16
+ - [Width/Height Inheritance](#widthheight-inheritance)
17
+ - [Shared Spacing Scale](#shared-spacing-scale)
18
+ - [Combined Utilities (`wh-`)](#combined-utilities-wh-)
19
+ - [Color Inheritance](#color-inheritance)
20
+ - [Common Pitfalls](#common-pitfalls)
21
+ - [1. Assuming View fills parent](#1-assuming-view-fills-parent)
22
+ - [2. Padding on View/Window](#2-padding-on-viewwindow)
23
+ - [3. Not using w-screen for percentage calculations](#3-not-using-w-screen-for-percentage-calculations)
24
+ - [4. Confusion about h-screen](#4-confusion-about-h-screen)
25
+ - [Reset Behavior in Generated app.tss](#reset-behavior-in-generated-apptss)
26
+ - [Overriding Resets](#overriding-resets)
27
+ - [Summary Table](#summary-table)
28
+
29
+ ---
30
+
31
+ ## The Three Default Resets
32
+
33
+ ```tss
34
+ // Ti Elements
35
+ // Property: View
36
+ // Description: An empty drawing surface or container
37
+ 'View': { width: Ti.UI.SIZE, height: Ti.UI.SIZE }
38
+
39
+ // Property: ImageView
40
+ // Description: A view to display a single image or series of animated images.
41
+ 'ImageView[platform=ios]': { hires: true }
42
+
43
+ // Property: Window
44
+ // Description: The Window is an empty drawing surface or container.
45
+ 'Window': { backgroundColor: '#FFFFFF' }
46
+ ```
47
+
48
+ ## View Reset: `Ti.UI.SIZE`
49
+
50
+ The most important reset is for the `View` element. By default, `View` is set to `Ti.UI.SIZE` for both width and height.
51
+
52
+ ### What `Ti.UI.SIZE` Means
53
+
54
+ `Ti.UI.SIZE` means the element will:
55
+ - Occupy **ONLY the space needed for its content**
56
+ - Grow to accommodate explicit dimensions (`w-64`, `h-32`, etc.)
57
+ - Expand to fill margins (`m-4`, `mx-2`, `mt-6 mb-4`, etc.)
58
+
59
+ :::tip EXPLICIT SIZE VS NATIVE UNDEFINED
60
+ In Titanium, most elements like `Label` and `Button` default to `SIZE` behavior, but their property values are `undefined`.
61
+
62
+ According to the **UI Composite Layout Behavior Spec**, if a dimension is `undefined` and you apply two opposite pins (e.g., `left` and `right` via `m-xx`), the motor will **compute the dimension based on the pins**, causing the element to stretch.
63
+
64
+ **PurgeTSS** recommends using the `wh-auto` class (which sets explicit `Ti.UI.SIZE` for both width and height) to override this pinning effect and ensure the element only occupies the space needed for its content regardless of margins.
65
+ :::
66
+
67
+ ### Practical Examples
68
+
69
+ ```xml
70
+ <!-- View without any classes = SIZE of its content -->
71
+ <View>
72
+ <Label text="Hello" />
73
+ </View>
74
+ <!-- Result: View wraps the label tightly -->
75
+
76
+ <!-- View with explicit dimensions -->
77
+ <View class="h-32 w-64 bg-white">
78
+ <Label text="Hello" />
79
+ </View>
80
+ <!-- Result: View is exactly 256px wide x 128px tall, label inside -->
81
+
82
+ <!-- View with margins (expands to include margins) -->
83
+ <View class="m-4 bg-blue-500">
84
+ <Label text="Hello" />
85
+ </View>
86
+ <!-- Result: View is 16px larger on all sides (content + 16px margins) -->
87
+
88
+ <!-- View with w-screen (fills parent) -->
89
+ <View class="h-16 w-screen bg-red-500">
90
+ <Label text="Full width banner" />
91
+ </View>
92
+ <!-- Result: View fills parent's width, 64px tall -->
93
+ ```
94
+
95
+ ### View in Different Layouts
96
+
97
+ **In `vertical` layout:**
98
+ ```xml
99
+ <View class="vertical">
100
+ <View class="bg-blue-500">
101
+ <!-- This View will be SIZE of its content -->
102
+ </View>
103
+ <View class="h-20 w-screen bg-red-500">
104
+ <!-- This View fills width, fixed height -->
105
+ </View>
106
+ </View>
107
+ ```
108
+
109
+ **In `horizontal` layout:**
110
+ ```xml
111
+ <View class="horizontal">
112
+ <View class="bg-blue-500">
113
+ <!-- SIZE of content, may be very small -->
114
+ </View>
115
+ <View class="h-32 w-32 bg-red-500">
116
+ <!-- Fixed 128x128 -->
117
+ </View>
118
+ </View>
119
+ ```
120
+
121
+ **In `composite` layout (default):**
122
+ ```xml
123
+ <View>
124
+ <!-- No layout class = composite = default -->
125
+ <View class="left-10 top-20 h-32 w-64 bg-blue-500">
126
+ <!-- Positioning works, can overlap other Views -->
127
+ </View>
128
+ </View>
129
+ ```
130
+
131
+ ## ImageView Reset: iOS Hi-Res
132
+
133
+ On iOS, `ImageView` automatically gets `hires: true` for high-resolution image display.
134
+
135
+ ```tss
136
+ 'ImageView[platform=ios]': { hires: true }
137
+ ```
138
+
139
+ :::info
140
+ This ensures images look crisp on Retina displays without manual configuration.
141
+ :::
142
+
143
+ ## Window Reset: White Background
144
+
145
+ Every `Window` gets a white background by default:
146
+
147
+ ```tss
148
+ 'Window': { backgroundColor: '#FFFFFF' }
149
+ ```
150
+
151
+ You can override this with classes:
152
+
153
+ ```xml
154
+ <!-- Custom background color -->
155
+ <Window class="bg-gray-900">
156
+ <!-- Dark themed window -->
157
+ </Window>
158
+
159
+ <!-- Gradient background -->
160
+ <Window class="from-(#4C61E4) to-(#804C61E4)">
161
+ <!-- Gradient window -->
162
+ </Window>
163
+
164
+ <!-- Transparent background -->
165
+ <Window class="bg-transparent">
166
+ <!-- For overlays/modals -->
167
+ </Window>
168
+ ```
169
+
170
+ ## Width/Height Inheritance
171
+
172
+ These resets affect how width and height properties work throughout your app.
173
+
174
+ ### Shared Spacing Scale
175
+
176
+ The `spacing` section in `config.cjs` is shared by multiple properties:
177
+
178
+ ```javascript
179
+ theme: {
180
+ spacing: {
181
+ sm: 8,
182
+ md: 12,
183
+ lg: 16,
184
+ xl: 24,
185
+ }
186
+ }
187
+ ```
188
+
189
+ This automatically generates:
190
+ - **Margin**: `m-sm`, `m-md`, `m-lg`, `m-xl`
191
+ - **Padding**: `p-sm`, `p-md`, `p-lg`, `p-xl`
192
+ - **Width**: `w-sm`, `w-md`, `w-lg`, `w-xl`
193
+ - **Height**: `h-sm`, `h-md`, `h-lg`, `h-xl`
194
+ - **Gap**: `gap-sm`, `gap-md`, `gap-lg`, `gap-xl`
195
+
196
+ ### Combined Utilities (`wh-`)
197
+
198
+ PurgeTSS provides `wh-` shortcuts to set both width and height simultaneously. This is more than just a convenience; it ensures consistent dimension resets for components.
199
+
200
+ | Class | Titanium Value | Purpose |
201
+ | ------------ | --------------------------------------- | ----------------------------------------------------- |
202
+ | `.wh-auto` | `width: Ti.UI.SIZE, height: Ti.UI.SIZE` | Explicitly force size-to-content. **The Safe Reset.** |
203
+ | `.wh-screen` | `width: Ti.UI.FILL, height: Ti.UI.FILL` | Fill all available parent space. |
204
+ | `.wh-full` | `width: '100%', height: '100%'` | Relative 100% sizing. |
205
+
206
+ **The `wh-` Scale:**
207
+ - **Numeric**: `wh-0` (0px) up to `wh-96` (384px) following the spacing scale.
208
+ - **Fractions**: `wh-1/2` (50%), `wh-1/3` (33%), up to `wh-11/12` (91%).
209
+
210
+ :::tip
211
+ Always prefer `wh-screen` (FILL) over `wh-full` (100%) for better native performance in Titanium, unless you specifically need percentage-based calculations against a parent's dimension.
212
+ :::
213
+
214
+ ### Color Inheritance
215
+
216
+ All color properties inherit from `theme.colors`:
217
+
218
+ ```javascript
219
+ theme: {
220
+ colors: {
221
+ brand: '#007AFF',
222
+ }
223
+ }
224
+ ```
225
+
226
+ This generates classes for ALL color properties:
227
+ - `bg-brand` (backgroundColor)
228
+ - `text-brand` (color/textColor)
229
+ - `border-brand` (borderColor)
230
+ - `tint-brand` (tint)
231
+ - And 50+ more color properties
232
+
233
+ ## Common Pitfalls
234
+
235
+ ### 1. Assuming View fills parent
236
+
237
+ ```xml
238
+ <!-- WRONG: Assumes View fills available space -->
239
+ <View class="bg-blue-500">
240
+ <!-- On most devices, this will be tiny or invisible -->
241
+ </View>
242
+
243
+ <!-- CORRECT: Explicitly set dimensions -->
244
+ <View class="h-64 w-screen bg-blue-500">
245
+ <!-- Fills parent width, 256px tall -->
246
+ </View>
247
+ ```
248
+
249
+ ### 2. Padding on View/Window
250
+
251
+ ```xml
252
+ <!-- WRONG: Padding on base elements -->
253
+ <View class="bg-white p-4">
254
+ <Label text="Content" />
255
+ </View>
256
+
257
+ <!-- CORRECT: Margin on children -->
258
+ <View class="bg-white">
259
+ <Label class="m-4" text="Content" />
260
+ </View>
261
+ ```
262
+
263
+ :::caution
264
+ Do not use `p-` on `View`, `Window`, or `Label`. Use margins on children instead.
265
+ :::
266
+
267
+ ### 3. Not using w-screen for percentage calculations
268
+
269
+ ```xml
270
+ <!-- WRONG: % widths without w-screen on parent -->
271
+ <View class="horizontal m-4">
272
+ <View class="w-(50%)">...</view> <!-- 50% of what? -->
273
+ <View class="w-(50%)">...</view>
274
+ </View>
275
+
276
+ <!-- CORRECT: Parent has w-screen -->
277
+ <View class="horizontal m-4 w-screen">
278
+ <View class="w-(50%)">...</view> <!-- 50% of parent -->
279
+ <View class="w-(50%)">...</view>
280
+ </View>
281
+ ```
282
+
283
+ ### 4. Confusion about h-screen
284
+
285
+ ```xml
286
+ <!-- In a ScrollView with vertical layout -->
287
+ <ScrollView class="vertical h-screen">
288
+ <!-- h-screen = FILL = grows to available space -->
289
+ <View class="w-screen">
290
+ <!-- Content here -->
291
+ </View>
292
+ </ScrollView>
293
+ ```
294
+
295
+ `h-screen` in PurgeTSS = `Ti.UI.FILL`, which means "fill available space" not "device screen height".
296
+
297
+ ## Reset Behavior in Generated app.tss
298
+
299
+ When PurgeTSS generates your `app.tss`, these resets appear first:
300
+
301
+ ```tss
302
+ /* PurgeTSS v7.2.7 */
303
+ /* Created by César Estrada */
304
+ /* https://purgetss.com */
305
+
306
+ // Ti Elements
307
+ 'View': { width: Ti.UI.SIZE, height: Ti.UI.SIZE }
308
+ 'ImageView[platform=ios]': { hires: true }
309
+ 'Window': { backgroundColor: '#FFFFFF' }
310
+
311
+ /* Main Styles */
312
+ '.bg-white': { backgroundColor: '#ffffff' }
313
+ '.h-screen': { height: Ti.UI.FILL }
314
+ '.w-screen': { width: Ti.UI.FILL }
315
+ // ... your custom classes
316
+ ```
317
+
318
+ These are **always included** - they're fundamental to how PurgeTSS works.
319
+
320
+ ## Overriding Resets
321
+
322
+ If you need different default behavior, add custom rules to `_app.tss` or `config.cjs`:
323
+
324
+ **In `_app.tss`:**
325
+ ```tss
326
+ // Override View default
327
+ 'View': {
328
+ width: Ti.UI.FILL, // Default to fill width
329
+ height: Ti.UI.SIZE // But size to content vertically
330
+ }
331
+ ```
332
+
333
+ **In `config.cjs` (preferred):**
334
+ ```javascript
335
+ module.exports = {
336
+ theme: {
337
+ View: {
338
+ DEFAULT: {
339
+ width: Ti.UI.FILL,
340
+ height: Ti.UI.SIZE
341
+ }
342
+ }
343
+ }
344
+ }
345
+ ```
346
+
347
+ :::tip
348
+ Prefer `config.cjs` for custom defaults because they're preserved when PurgeTSS regenerates `app.tss`.
349
+ :::
350
+
351
+ ## Summary Table
352
+
353
+ | Element | Reset Property | Reset Value | Impact |
354
+ | ------------------------- | --------------- | ------------ | ------------------------------------- |
355
+ | `View` | width/height | `Ti.UI.SIZE` | Occupies only content size by default |
356
+ | `ImageView[platform=ios]` | hires | `true` | High-res images on Retina displays |
357
+ | `Window` | backgroundColor | `'#FFFFFF'` | White background by default |
358
+
359
+ Understanding these resets is essential for predictable layouts in PurgeTSS.