@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,375 @@
1
+ # The `apply` Directive
2
+
3
+ ## Table of Contents
4
+
5
+ - [The `apply` Directive](#the-apply-directive)
6
+ - [Table of Contents](#table-of-contents)
7
+ - [Create Complex Classes and IDs](#create-complex-classes-and-ids)
8
+ - [Set Any ID, Class, or Ti Element](#set-any-id-class-or-ti-element)
9
+ - [Use Any of the Default Classes](#use-any-of-the-default-classes)
10
+ - [Use Arbitrary Values](#use-arbitrary-values)
11
+ - [Use Any Newly Defined Class in config.cjs](#use-any-newly-defined-class-in-configcjs)
12
+ - [Set a String of Classes or an Array of Classes](#set-a-string-of-classes-or-an-array-of-classes)
13
+ - [Combine with Any Platform, Device, or Conditional-Block Properties](#combine-with-any-platform-device-or-conditional-block-properties)
14
+ - [Platform-Specific Classes](#platform-specific-classes)
15
+ - [Omitting the Platform Variant](#omitting-the-platform-variant)
16
+ - [Complete Example with Platform Variants](#complete-example-with-platform-variants)
17
+ - [Composing Component Libraries](#composing-component-libraries)
18
+
19
+ ---
20
+
21
+ ## Create Complex Classes and IDs
22
+
23
+ :::info
24
+ Use the `apply` directive to compose multiple classes into reusable components, extract repetitive patterns, or create platform-specific variants.
25
+ :::
26
+
27
+ The `apply` directive allows you to:
28
+ - Set any ID, class, or Ti Element
29
+ - Use default PurgeTSS classes
30
+ - Use arbitrary values
31
+ - Use newly defined classes in `config.cjs`
32
+ - Set a string or array of classes
33
+ - Combine with platform, device, or conditional properties
34
+
35
+ ## Set Any ID, Class, or Ti Element
36
+
37
+ ```javascript
38
+ // purgetss/config.cjs
39
+ theme: {
40
+ extend: {},
41
+ Label: {
42
+ apply: 'text-base font-bold text-gray-700'
43
+ },
44
+ fontWeight: {
45
+ bold: 'bold'
46
+ },
47
+ fontFamily: {
48
+ 'saira-condensed': 'SairaCondensed-Regular'
49
+ },
50
+ '#carrousel': {
51
+ apply: 'w-screen h-auto bg-teal-200 mx-2 my-4 horizontal'
52
+ },
53
+ '.my-custom-class': {
54
+ apply: 'font-bold border-2 rounded wh-auto my-0.5 font-saira-condensed'
55
+ }
56
+ }
57
+ ```
58
+
59
+ **Generated TSS:**
60
+
61
+ ```css
62
+ 'Label': { color: '#374151', textColor: '#374151', font: { fontSize: 16, fontWeight: 'bold' } }
63
+
64
+ /* Custom Classes */
65
+ '#carrousel': { backgroundColor: '#99f6e4', height: Ti.UI.SIZE, layout: 'horizontal', right: 8, left: 8, top: 16, bottom: 16, width: Ti.UI.FILL }
66
+ '.my-custom-class': { borderRadius: 4, borderWidth: 2, top: 2, bottom: 2, width: Ti.UI.SIZE, height: Ti.UI.SIZE, font: { fontFamily: 'SairaCondensed-Regular', fontWeight: 'bold' } }
67
+ '.font-saira-condensed': { font: { fontFamily: 'SairaCondensed-Regular' } }
68
+ '.font-bold': { font: { fontWeight: 'bold' } }
69
+ ```
70
+
71
+ ## Use Any of the Default Classes
72
+
73
+ ```javascript
74
+ // purgetss/config.cjs
75
+ theme: {
76
+ '.btn': {
77
+ apply: 'font-bold border-2 rounded wh-auto my-0.5 font-saira-condensed'
78
+ },
79
+ '.btn-primary': {
80
+ apply: 'bg-green-500 text-green-100 border-green-200'
81
+ },
82
+ }
83
+ ```
84
+
85
+ **Generated TSS:**
86
+
87
+ ```css
88
+ /* Custom Classes */
89
+ '.btn': { borderRadius: 4, borderWidth: 2, top: 2, bottom: 2, width: Ti.UI.SIZE, height: Ti.UI.SIZE, font: { fontFamily: 'SairaCondensed-Regular', fontWeight: 'bold' } }
90
+ '.btn-primary': { backgroundColor: '#22c55e', borderColor: '#bbf7d0', color: '#dcfce7', textColor: '#dcfce7' }
91
+ ```
92
+
93
+ ## Use Arbitrary Values
94
+
95
+ You can use arbitrary values to define your custom classes.
96
+
97
+ ```javascript
98
+ // purgetss/config.cjs
99
+ theme: {
100
+ extend: {},
101
+ '.progress': {
102
+ apply: 'h-(1rem) horizontal bg-(#e9ecef) text-(.75rem) rounded-(.25rem)'
103
+ }
104
+ }
105
+ ```
106
+
107
+ **Generated TSS:**
108
+
109
+ ```css
110
+ /* Custom Classes */
111
+ '.progress': { backgroundColor: '#e9ecef', borderRadius: 4, height: 16, layout: 'horizontal', font: { fontSize: 12 } }
112
+ ```
113
+
114
+ ## Use Any Newly Defined Class in config.cjs
115
+
116
+ In the following example, we are creating `corporate` color classes so we can use them in the `apply` directive with `bg-corporate-500`, `text-corporate-100`, and `border-corporate-200`.
117
+
118
+ ```javascript
119
+ // purgetss/config.cjs
120
+ theme: {
121
+ extend: {
122
+ colors: {
123
+ // New color values that will generate bg-colors, text-colors, border-colors classes.
124
+ corporate: {
125
+ 100: '#dddfe1', 200: '#babfc4', 500: '#53606b'
126
+ }
127
+ }
128
+ },
129
+ '.btn': {
130
+ apply: 'wh-auto font-bold border-2 rounded my-0.5'
131
+ },
132
+ '.btn-corporate': {
133
+ // Newly created classes ( see extend.colors.corporate )
134
+ apply: 'bg-corporate-500 text-corporate-100 border-corporate-200'
135
+ }
136
+ }
137
+ ```
138
+
139
+ **Generated TSS:**
140
+
141
+ ```css
142
+ /* Custom Classes */
143
+ '.btn': { borderRadius: 4, borderWidth: 2, top: 2, bottom: 2, width: Ti.UI.SIZE, height: Ti.UI.SIZE, font: { fontWeight: 'bold' } }
144
+ '.btn-corporate': { backgroundColor: '#53606b', borderColor: '#babfc4', color: '#dddfe1', textColor: '#dddfe1' }
145
+ /* ... */
146
+ /* color Property */
147
+ '.text-corporate-100': { color: '#dddfe1', textColor: '#dddfe1' }
148
+ '.text-corporate-200': { color: '#babfc4', textColor: '#babfc4' }
149
+ '.text-corporate-500': { color: '#53606b', textColor: '#53606b' }
150
+ /* backgroundColor Property */
151
+ '.bg-corporate-100': { backgroundColor: '#dddfe1' }
152
+ '.bg-corporate-200': { backgroundColor: '#babfc4' }
153
+ '.bg-corporate-500': { backgroundColor: '#53606b' }
154
+ /* borderColor Property */
155
+ '.border-corporate-100': { borderColor: '#dddfe1' }
156
+ '.border-corporate-200': { borderColor: '#babfc4' }
157
+ '.border-corporate-500': { borderColor: '#53606b' }
158
+ /* And the rest of color properties! */
159
+ ```
160
+
161
+ ## Set a String of Classes or an Array of Classes
162
+
163
+ ```javascript
164
+ // purgetss/config.cjs
165
+ theme: {
166
+ extend: {
167
+ colors: {
168
+ corporate: {
169
+ 100: '#dddfe1', 200: '#babfc4', 500: '#53606b'
170
+ }
171
+ }
172
+ },
173
+ // Use a string of classes
174
+ '.btn': {
175
+ apply: 'font-bold border-2 rounded wh-auto my-0.5'
176
+ },
177
+ // or an array of classes
178
+ '.btn-corporate': {
179
+ apply: [
180
+ 'bg-corporate-500',
181
+ 'text-corporate-100',
182
+ 'border-corporate-200'
183
+ ]
184
+ }
185
+ }
186
+ ```
187
+
188
+ **Generated TSS:**
189
+
190
+ ```css
191
+ /* Custom Classes */
192
+ '.btn': { borderRadius: 4, borderWidth: 2, top: 2, bottom: 2, width: Ti.UI.SIZE, height: Ti.UI.SIZE, font: { fontWeight: 'bold' } }
193
+ '.btn-corporate': { backgroundColor: '#53606b', borderColor: '#babfc4', color: '#dddfe1', textColor: '#dddfe1' }
194
+ ```
195
+
196
+ ## Combine with Any Platform, Device, or Conditional-Block Properties
197
+
198
+ ```javascript
199
+ // purgetss/config.cjs
200
+ theme: {
201
+ '.btn': {
202
+ // Default .btn
203
+ apply: 'font-bold border-2 rounded wh-auto my-0.5',
204
+
205
+ // Specific to iOS devices
206
+ ios: {
207
+ apply: 'w-screen mx-4'
208
+ },
209
+
210
+ // Specific to handheld devices
211
+ handheld: {
212
+ apply: 'h-20'
213
+ },
214
+
215
+ // Specific to iPhoneX (if Alloy.Global.iPhoneX is set)
216
+ '[if=Alloy.Globals.iPhoneX]': {
217
+ apply: 'mb-12'
218
+ }
219
+ },
220
+ }
221
+ ```
222
+
223
+ **Generated TSS:**
224
+
225
+ ```css
226
+ /* Custom Classes */
227
+ '.btn': { borderRadius: 4, borderWidth: 2, top: 2, bottom: 2, width: Ti.UI.SIZE, height: Ti.UI.SIZE, font: { fontWeight: 'bold' } }
228
+ '.btn[platform=ios]': { right: 16, left: 16, width: Ti.UI.FILL }
229
+ '.btn[formFactor=handheld]': { height: 80 }
230
+ '.btn[if=Alloy.Globals.iPhoneX]': { bottom: 48 }
231
+ ```
232
+
233
+ ## Platform-Specific Classes
234
+
235
+ Several classes in `utilities.tss` are platform-specific to prevent polluting objects with properties that are not specific to a particular platform.
236
+
237
+ :::caution IMPORTANT
238
+ To properly apply these platform styles when creating custom rules, you **must specify the platform variant** in the `apply` directive.
239
+
240
+ **Even if you are not targeting a specific platform, you must specify the platform variant.**
241
+ :::
242
+
243
+ ```javascript
244
+ // purgetss/config.cjs
245
+ module.exports = {
246
+ theme: {
247
+ '.my-view': {
248
+ // Targeting iOS.
249
+ 'ios': {
250
+ 'apply': 'bg-green-500 wh-32 ios:clip-enabled'
251
+ }
252
+ }
253
+ },
254
+ };
255
+ ```
256
+
257
+ **Generated TSS:**
258
+
259
+ ```css
260
+ /* Custom Classes */
261
+ '.my-view[platform=ios]': { backgroundColor: '#22c55e', clipMode: Ti.UI.iOS.CLIP_MODE_ENABLED, width: 128, height: 128 }
262
+ ```
263
+
264
+ ### Omitting the Platform Variant
265
+
266
+ If you omit the platform variant, **PurgeTSS** won't be able to determine which platform you are targeting, and the custom class will not have the corresponding property.
267
+
268
+ ```javascript
269
+ // purgetss/config.cjs
270
+ module.exports = {
271
+ theme: {
272
+ // Even if you are not targeting a specific platform, you must specify the platform variant
273
+ '.my-view': {
274
+ // Missing platform variant in clip-enabled
275
+ 'apply': 'wh-32 clip-enabled bg-green-500'
276
+ }
277
+ },
278
+ };
279
+ ```
280
+
281
+ **Generated TSS (missing clip-enabled property):**
282
+
283
+ ```css
284
+ /* Omitting the platform variant in `config.cjs` will not generate the corresponding property. */
285
+ /* Missing the property related to `clip-enabled`. */
286
+ '.my-view': { backgroundColor: '#22c55e', width: 128, height: 128 }
287
+ ```
288
+
289
+ ## Complete Example with Platform Variants
290
+
291
+ ```javascript
292
+ // config.cjs
293
+ module.exports = {
294
+ theme: {
295
+ extend: {
296
+ colors: {
297
+ corporate: {
298
+ 100: '#dddfe1',
299
+ 200: '#babfc4',
300
+ 500: '#53606b'
301
+ }
302
+ }
303
+ },
304
+ '.btn': {
305
+ // Default button
306
+ apply: 'wh-auto font-bold border-2 rounded my-0.5',
307
+ // iOS variant
308
+ ios: {
309
+ apply: 'w-screen mx-4'
310
+ },
311
+ // Handheld variant
312
+ handheld: {
313
+ apply: 'h-20'
314
+ },
315
+ // Conditional variant
316
+ '[if=Alloy.Globals.iPhoneX]': {
317
+ apply: 'mb-12'
318
+ }
319
+ },
320
+ '.btn-corporate': {
321
+ // Use custom colors
322
+ apply: [
323
+ 'bg-corporate-500',
324
+ 'text-corporate-100',
325
+ 'border-corporate-200'
326
+ ],
327
+ // Platform-specific
328
+ ios: {
329
+ apply: 'ios:shadow-offset-0'
330
+ }
331
+ }
332
+ }
333
+ }
334
+ ```
335
+
336
+ **Generated TSS:**
337
+
338
+ ```css
339
+ '.btn': { borderRadius: 4, borderWidth: 2, top: 2, bottom: 2, width: Ti.UI.SIZE, height: Ti.UI.SIZE, font: { fontWeight: 'bold' } }
340
+ '.btn[platform=ios]': { right: 16, left: 16, width: Ti.UI.FILL }
341
+ '.btn[formFactor=handheld]': { height: 80 }
342
+ '.btn[if=Alloy.Globals.iPhoneX]': { bottom: 48 }
343
+
344
+ '.btn-corporate': { backgroundColor: '#53606b', borderColor: '#babfc4', color: '#dddfe1', textColor: '#dddfe1' }
345
+ '.btn-corporate[platform=ios]': { shadowOffset: { x: 0, y: 0 } }
346
+ ```
347
+
348
+ ## Composing Component Libraries
349
+
350
+ ```javascript
351
+ // config.cjs - Building a component library
352
+ theme: {
353
+ // Base button
354
+ '.btn': {
355
+ apply: 'px-4 py-2 rounded font-semibold text-center cursor-pointer'
356
+ },
357
+ // Variants
358
+ '.btn-primary': {
359
+ apply: 'bg-blue-500 text-white hover:bg-blue-600'
360
+ },
361
+ '.btn-secondary': {
362
+ apply: 'bg-gray-200 text-gray-800 hover:bg-gray-300'
363
+ },
364
+ '.btn-danger': {
365
+ apply: 'bg-red-500 text-white hover:bg-red-600'
366
+ },
367
+ // Sizes
368
+ '.btn-sm': {
369
+ apply: 'px-2 py-1 text-sm'
370
+ },
371
+ '.btn-lg': {
372
+ apply: 'px-6 py-3 text-lg'
373
+ }
374
+ }
375
+ ```