@maccesar/titools 2.2.11 → 2.3.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 (99) hide show
  1. package/README.md +255 -713
  2. package/bin/titools.js +1 -1
  3. package/lib/commands/update.js +5 -6
  4. package/lib/config.js +1 -0
  5. package/lib/downloader.js +10 -0
  6. package/package.json +1 -1
  7. package/skills/alloy-guides/SKILL.md +46 -48
  8. package/skills/alloy-guides/references/CONTROLLERS.md +4 -6
  9. package/skills/alloy-guides/references/MODELS.md +340 -184
  10. package/skills/alloy-guides/references/VIEWS_DYNAMIC.md +3 -4
  11. package/skills/alloy-guides/references/VIEWS_STYLES.md +44 -46
  12. package/skills/alloy-guides/references/VIEWS_WITHOUT_CONTROLLERS.md +4 -5
  13. package/skills/alloy-guides/references/VIEWS_XML.md +51 -17
  14. package/skills/alloy-guides/references/WIDGETS.md +1 -1
  15. package/skills/alloy-howtos/SKILL.md +12 -13
  16. package/skills/alloy-howtos/references/cli_reference.md +40 -41
  17. package/skills/alloy-howtos/references/samples.md +3 -4
  18. package/skills/purgetss/SKILL.md +369 -356
  19. package/skills/purgetss/references/EXAMPLES.md +24 -25
  20. package/skills/purgetss/references/animation-advanced.md +555 -0
  21. package/skills/purgetss/references/animation-system.md +395 -995
  22. package/skills/purgetss/references/apply-directive.md +111 -141
  23. package/skills/purgetss/references/arbitrary-values.md +206 -480
  24. package/skills/purgetss/references/class-categories.md +277 -0
  25. package/skills/purgetss/references/class-index.md +1 -420
  26. package/skills/purgetss/references/cli-commands.md +446 -556
  27. package/skills/purgetss/references/configurable-properties.md +163 -599
  28. package/skills/purgetss/references/custom-rules.md +33 -76
  29. package/skills/purgetss/references/customization-deep-dive.md +319 -518
  30. package/skills/purgetss/references/dynamic-component-creation.md +33 -37
  31. package/skills/purgetss/references/grid-layout.md +42 -371
  32. package/skills/purgetss/references/icon-fonts.md +82 -475
  33. package/skills/purgetss/references/installation-setup.md +159 -331
  34. package/skills/purgetss/references/migration-guide.md +54 -109
  35. package/skills/purgetss/references/opacity-modifier.md +25 -222
  36. package/skills/purgetss/references/performance-tips.md +2 -2
  37. package/skills/purgetss/references/platform-modifiers.md +21 -407
  38. package/skills/purgetss/references/tikit-components.md +237 -104
  39. package/skills/purgetss/references/titanium-resets.md +20 -21
  40. package/skills/purgetss/references/ui-ux-design.md +171 -1702
  41. package/skills/ti-api/SKILL.md +109 -0
  42. package/skills/ti-api/references/api-android.md +675 -0
  43. package/skills/ti-api/references/api-app-platform.md +636 -0
  44. package/skills/ti-api/references/api-core.md +764 -0
  45. package/skills/ti-api/references/api-data-network.md +641 -0
  46. package/skills/ti-api/references/api-media.md +655 -0
  47. package/skills/ti-api/references/api-modules-ble-bluetooth.md +657 -0
  48. package/skills/ti-api/references/api-modules-coremotion-urlsession.md +411 -0
  49. package/skills/ti-api/references/api-modules-map.md +632 -0
  50. package/skills/ti-api/references/api-modules-nfc.md +725 -0
  51. package/skills/ti-api/references/api-modules-social-misc.md +526 -0
  52. package/skills/ti-api/references/api-services.md +700 -0
  53. package/skills/ti-api/references/api-ui-android.md +499 -0
  54. package/skills/ti-api/references/api-ui-extras.md +702 -0
  55. package/skills/ti-api/references/api-ui-ios-animator.md +378 -0
  56. package/skills/ti-api/references/api-ui-ios.md +756 -0
  57. package/skills/ti-api/references/api-ui-lists.md +581 -0
  58. package/skills/ti-api/references/api-ui-text-input.md +607 -0
  59. package/skills/ti-api/references/api-ui-views.md +572 -0
  60. package/skills/ti-api/references/api-ui-windows-navigation.md +676 -0
  61. package/skills/ti-api/references/api-xml-global.md +743 -0
  62. package/skills/ti-expert/SKILL.md +106 -138
  63. package/skills/ti-expert/references/adaptive-layouts.md +414 -0
  64. package/skills/ti-expert/references/alloy-builtins.md +16 -20
  65. package/skills/ti-expert/references/alloy-structure.md +40 -42
  66. package/skills/ti-expert/references/anti-patterns.md +34 -0
  67. package/skills/ti-expert/references/architecture-tiers.md +248 -0
  68. package/skills/ti-expert/references/code-conventions.md +5 -3
  69. package/skills/ti-expert/references/error-handling.md +14 -7
  70. package/skills/ti-expert/references/examples.md +4 -2
  71. package/skills/ti-expert/references/performance-optimization.md +26 -24
  72. package/skills/ti-expert/references/security-device.md +17 -14
  73. package/skills/ti-expert/references/security-fundamentals.md +60 -101
  74. package/skills/ti-expert/references/state-management.md +15 -14
  75. package/skills/ti-expert/references/testing-e2e-ci.md +30 -21
  76. package/skills/ti-expert/references/theming.md +12 -20
  77. package/skills/ti-guides/SKILL.md +13 -17
  78. package/skills/ti-guides/references/advanced-data-and-images.md +30 -10
  79. package/skills/ti-guides/references/application-frameworks.md +3 -3
  80. package/skills/ti-guides/references/coding-best-practices.md +31 -2
  81. package/skills/ti-guides/references/commonjs-advanced.md +46 -4
  82. package/skills/ti-guides/references/hello-world.md +9 -13
  83. package/skills/ti-guides/references/hyperloop-native-access.md +4 -1
  84. package/skills/ti-guides/references/javascript-primer.md +13 -5
  85. package/skills/ti-guides/references/resources.md +0 -2
  86. package/skills/ti-guides/references/style-and-conventions.md +1 -0
  87. package/skills/ti-guides/references/tiapp-config.md +0 -32
  88. package/skills/ti-howtos/SKILL.md +43 -45
  89. package/skills/ti-howtos/references/buffer-codec-streams.md +25 -3
  90. package/skills/ti-howtos/references/debugging-profiling.md +14 -25
  91. package/skills/ti-howtos/references/google-maps-v2.md +3 -3
  92. package/skills/ti-howtos/references/ios-map-kit.md +8 -1
  93. package/skills/ti-howtos/references/notification-services.md +0 -1
  94. package/skills/ti-howtos/references/webpack-build-pipeline.md +3 -0
  95. package/skills/ti-ui/SKILL.md +47 -49
  96. package/skills/ti-ui/references/application-structures.md +3 -2
  97. package/skills/ti-ui/references/orientation.md +17 -9
  98. package/skills/ti-ui/references/platform-ui-ios.md +63 -0
  99. package/skills/ti-ui/references/scrolling-views.md +39 -0
@@ -1,673 +1,474 @@
1
- # PurgeTSS Deep Customization
1
+ # PurgeTSS Configuration Deep Dive
2
2
 
3
- PurgeTSS allows for extreme customization through its configuration file, custom rules for Ti Elements, and advanced class syntaxes.
3
+ ## The `config` File
4
4
 
5
- :::info What's New in v7.2.x
6
- **Configuration File Change**: The configuration file has been renamed from `config.js` to `config.cjs` for better CommonJS compatibility. The content structure remains exactly the same.
5
+ > **ℹ️ INFO**
6
+ > The configuration file is named `config.cjs` (it used to be `config.js`). The structure is the same. Legacy mode was removed in PurgeTSS v7.2.x along with its related options.
7
7
 
8
- **Legacy Mode Removed**: Legacy mode has been completely removed from PurgeTSS v7.2.x. All legacy-related options have been eliminated for a cleaner, modern codebase.
9
- :::
8
+ By default, PurgeTSS looks for `./purgetss/config.cjs`, where you can define customizations.
10
9
 
11
- ## The `config.cjs` File
10
+ ## Create the `config.cjs` File
12
11
 
13
- By default, **PurgeTSS** will look for a `./purgetss/config.cjs` file where you can define customizations.
12
+ > **ℹ️ INFO**
13
+ > `config.cjs` is created automatically the first time you run `purgetss` in a project.
14
14
 
15
- ### File Structure
15
+ If you want a clean `config.cjs`, delete the existing one and run:
16
16
 
17
- The config file consists of two main sections: `purge` and `theme`.
17
+ ```bash
18
+ purgetss init
19
+ ```
20
+
21
+ This creates a minimal `./purgetss/config.cjs` file:
18
22
 
19
23
  ```javascript
20
24
  module.exports = {
21
25
  purge: {
22
26
  mode: 'all',
23
- method: 'sync',
27
+ method: 'sync', // How to execute the auto-purging task: sync or async
28
+
29
+ // These options are passed directly to PurgeTSS
24
30
  options: {
25
- missing: true,
26
- widgets: false,
27
- safelist: [],
28
- plugins: []
31
+ missing: true, // Reports missing classes
32
+ widgets: false, // Purges widgets too
33
+ safelist: [], // Array of classes to keep
34
+ plugins: [] // Array of properties to ignore
29
35
  }
30
36
  },
31
37
  theme: {
32
38
  extend: {}
33
39
  }
34
- }
40
+ };
35
41
  ```
36
42
 
37
- :::info
38
- Every section of the config file is optional, so you only need to specify what you'd like to change. Any missing sections will fall back to the default configuration.
39
- :::
43
+ Every section is optional. Only add what you want to change. Anything missing falls back to the defaults.
40
44
 
41
- ### Creating a Fresh config.cjs
45
+ ## Structure
42
46
 
43
- If you need to start with a fresh `config.cjs` file, delete the existing one and run:
47
+ The config file has two main sections: `purge` and `theme`.
44
48
 
45
- ```bash
46
- purgetss init
47
- ```
48
-
49
- ## The `purge` Section
49
+ ### `purge` Section
50
50
 
51
- The `purge` section controls how **PurgeTSS** will remove unused classes or keep the ones you want.
52
-
53
- ### `mode` Property
51
+ The `purge` section controls how PurgeTSS removes unused classes or keeps the ones you want.
54
52
 
55
53
  ```javascript
56
- purge: {
57
- mode: 'all', // or 'class'
58
- method: 'sync' // or 'async'
59
- }
60
- ```
61
-
62
- **`mode: 'all'` (default)**
63
- - Scans EVERYWHERE in XML files (comments, attributes, classes, IDs, Ti Elements)
64
- - **REQUIRED** if you want PurgeTSS to parse any Ti Elements styled in `config.cjs`
65
- - Most complete but a bit slower
66
-
67
- **`mode: 'class'`**
68
- - Searches only in `class` and ID attributes in XML files
69
- - Faster processing
70
- - Cannot parse Ti Elements from `config.cjs`
71
-
72
- :::info
73
- **This mode is necessary if you want PurgeTSS to parse any Ti Elements that you've styled in `config.cjs`.**
74
- :::
75
-
76
- ### `method` Property
77
-
78
- Determines how the **auto-purge** task will be executed: `sync` (default) or `async`.
79
-
80
- :::tip
81
- If you don't see any changes reflected when changing and rebuilding a project with TiKit Components and LiveView, set the compile method to `async`.
82
- :::
83
-
84
- ### `options` Properties
54
+ module.exports = {
55
+ purge: {
56
+ mode: 'all',
57
+ method: 'sync', // How to execute the auto-purging task: sync or async
85
58
 
86
- ```javascript
87
- purge: {
88
- options: {
89
- missing: true, // Reports missing classes
90
- widgets: false, // Purges widgets folder too
91
- safelist: [], // Array of classes to keep
92
- plugins: [] // Array of properties to disable
59
+ // These options are passed through directly to PurgeTSS
60
+ options: {
61
+ missing: true, // Reports missing classes
62
+ widgets: false, // Purges widgets too
63
+ safelist: [], // Array of classes to keep
64
+ plugins: [] // Array of properties to ignore
65
+ }
93
66
  }
94
- }
67
+ };
95
68
  ```
96
69
 
97
- **`options.missing`**
98
-
99
- Set to `true` to get a list of missing or misspelled classes at the end of `app.tss`.
70
+ - **`mode: 'all'`**
100
71
 
101
- :::info
102
- This is very useful if you want to check if you forgot to add a class definition or if you forgot to remove non-existing classes from your views, especially if you have upgraded from PurgeTSS v5 to v6.
103
- :::
72
+ By default, PurgeTSS searches XML files everywhere: comments, attributes, classes, IDs, and Ti Elements.
104
73
 
105
- **`options.widgets`**
74
+ Use this mode if you want PurgeTSS to parse Ti Elements you style in `config.cjs`.
106
75
 
107
- Set to `true` to also parse all XML files found in the **Widgets** folder.
76
+ - **`method: 'sync'` or `method: 'async'`**
108
77
 
109
- **`options.safelist`**
78
+ The `method` setting controls how the auto-purge task runs: `sync` (default) or `async`.
110
79
 
111
- Array of classes and Ti Elements to keep regardless of purge mode or usage in XML files.
80
+ If changes are not showing up when rebuilding a project with TiKit Components and LiveView, set the method to `async`.
112
81
 
113
- For large safelists, create a separate module:
114
-
115
- ```javascript
116
- // ./purgetss/safelist.js
117
- exports.safelist = [
118
- 'Label', 'Button', 'Window',
119
- 'bg-indigo-50', 'bg-indigo-100', /* ... */
120
- 'bg-indigo-800', 'bg-indigo-900',
121
- ];
122
-
123
- // ./purgetss/config.cjs
124
- module.exports = {
125
- purge: {
126
- options: {
127
- safelist: require('./safelist')
128
- }
129
- }
130
- }
131
- ```
82
+ - **`mode: 'class'`**
132
83
 
133
- :::tip
134
- You should put the safelist inside the `purgetss` folder to keep everything organized.
135
- :::
84
+ Use `class` to search only class and ID attributes in XML files.
136
85
 
137
- **`options.plugins`**
86
+ - **`options.missing`**
138
87
 
139
- Array of properties (plugins) to completely disable:
88
+ Set `missing` to `true` if you want a list of missing or misspelled classes at the end of `app.tss`.
140
89
 
141
- ```javascript
142
- plugins: [
143
- 'opacity', // Disable all opacity classes
144
- 'borderRadius' // Disable all border-radius classes
145
- ]
146
- ```
90
+ This is useful when you want to confirm you did not forget class definitions or when upgrading older projects.
147
91
 
148
- ## The `theme` Section
92
+ - **`options.widgets`**
149
93
 
150
- The `theme` section is where you define your project's design system - colors, spacing, typography, borders, and more.
94
+ Set `widgets` to `true` to also parse all XML files under the Widgets folder.
151
95
 
152
- ### Overriding vs Extending
96
+ - **`options.safelist`**
153
97
 
154
- **Overriding** - Replaces default values:
98
+ The `safelist` is a list of classes and Ti Elements you want to keep no matter the purge mode or whether they appear in XML.
155
99
 
156
- ```javascript
157
- theme: {
158
- opacity: {
159
- 15: '0.15',
160
- 35: '0.35',
161
- 65: '0.65',
162
- 85: '0.85'
163
- }
164
- }
165
- ```
100
+ If the list is large, put it in a CommonJS module and require it in `config.cjs`:
166
101
 
167
- This completely replaces the original default `opacity` values.
102
+ ```javascript
103
+ module.exports = {
104
+ purge: {
105
+ options: {
106
+ safelist: require('./safelist')
107
+ }
108
+ }
109
+ };
110
+ ```
111
+
112
+ Keep the safelist inside the `purgetss` folder:
113
+
114
+ ```javascript
115
+ // ./purgetss/safelist.js
116
+ exports.safelist = [
117
+ 'Label',
118
+ 'Button',
119
+ 'Window',
120
+ 'ListView',
121
+ 'TableView',
122
+ 'ScrollView',
123
+ 'ScrollableView',
124
+ 'bg-indigo-50',
125
+ 'bg-indigo-100',
126
+ 'bg-indigo-800',
127
+ 'bg-indigo-900'
128
+ ];
129
+ ```
130
+
131
+ - **`options.plugins`**
132
+
133
+ The `plugins` option lets you disable classes PurgeTSS would normally generate.
134
+
135
+ To disable specific classes, provide an array of properties (or plugins) to disable:
136
+
137
+ ```javascript
138
+ module.exports = {
139
+ purge: {
140
+ options: {
141
+ plugins: [
142
+ 'opacity',
143
+ 'borderRadius'
144
+ ]
145
+ }
146
+ }
147
+ };
148
+ ```
168
149
 
169
- :::info
170
- Note that any keys you do not provide will be inherited from the default theme, so in the above example, the default theme configuration for things like colors, spacing, border radius, background position, etc. will be preserved.
171
- :::
150
+ ### `theme` Section
172
151
 
173
- **Extending** - Adds to default values:
152
+ The `theme` section defines your project's color palette, type scale, font stacks, border radius values, and other properties.
174
153
 
175
154
  ```javascript
176
- theme: {
177
- extend: {
178
- colors: {
179
- primary: '#002359',
155
+ module.exports = {
156
+ theme: {
157
+ fontFamily: {
158
+ display: 'AlfaSlabOne-Regular',
159
+ body: 'BarlowSemiCondensed-Regular'
160
+ },
161
+ borderWidth: {
162
+ DEFAULT: 1,
163
+ 0: 0,
164
+ 2: 2,
165
+ 4: 4
166
+ },
167
+ extend: {
168
+ colors: {
169
+ cyan: '#9cdbff'
170
+ },
171
+ spacing: {
172
+ 96: '24rem',
173
+ 128: '32rem'
174
+ }
180
175
  }
181
176
  }
182
- }
177
+ };
183
178
  ```
184
179
 
185
- This adds `primary` in addition to all default colors.
180
+ ## Overriding and Extending Properties
186
181
 
187
- You can both override and extend in the same config:
182
+ By default, your project inherits values from the default theme. You have two options depending on your goal.
188
183
 
189
- ```javascript
190
- theme: {
191
- opacity: { /* ... */ }, // Override
192
- extend: {
193
- colors: { /* ... */ } // Extend
194
- }
195
- }
196
- ```
197
-
198
- ## Customizing Colors
199
-
200
- ### Color Object Syntax
184
+ ### Override Properties
201
185
 
202
- Colors can be defined as simple key-value pairs or nested objects:
186
+ To override a default property, add it directly in the `theme` section.
203
187
 
204
188
  ```javascript
205
- theme: {
206
- colors: {
207
- // Simple values
208
- transparent: 'transparent',
209
- white: '#ffffff',
210
- purple: '#3f3cbb',
211
-
212
- // Nested objects (modifiers)
213
- primary: {
214
- solid: '#002359',
215
- dark: '#000030',
216
- transparent: '#D9002359'
217
- },
218
-
219
- // Shade scales
220
- brand: {
221
- 50: '#edfaff',
222
- 100: '#d6f2ff',
223
- 200: '#b5eaff',
224
- 300: '#83dfff',
225
- 400: '#48cbff',
226
- 500: '#1eacff',
227
- 600: '#068eff',
228
- 700: '#007aff',
229
- 800: '#085dc5',
230
- 900: '#0d519b',
231
- 950: '#0e315d',
232
- default: '#007aff'
189
+ module.exports = {
190
+ theme: {
191
+ // Replaces all of the default `opacity` values
192
+ opacity: {
193
+ 15: '0.15',
194
+ 35: '0.35',
195
+ 65: '0.65',
196
+ 85: '0.85'
233
197
  }
234
198
  }
235
- }
199
+ };
236
200
  ```
237
201
 
238
- Nested keys are combined with parent to form classes like `bg-primary-solid` or `text-brand-600`.
202
+ This completely replaces the original default `opacity` values with the new ones.
203
+
204
+ > **ℹ️ INFO**
205
+ > Keys you do not provide are inherited from the default theme. In the example above, colors, spacing, border radius, background position, and other defaults remain.
206
+
207
+ ### Extend Properties
239
208
 
240
- ### Overriding Default Colors
209
+ If you want to keep the defaults and add new values, place them under `theme.extend`.
241
210
 
242
- To override a default color while preserving others:
211
+ For example, if you want to add an extra color but preserve the existing ones, you could extend the `colors` section:
243
212
 
244
213
  ```javascript
245
- theme: {
246
- extend: {
247
- colors: {
248
- gray: {
249
- 50: '#f7f7f7',
250
- 100: '#ededed',
251
- 200: '#dfdfdf',
252
- 300: '#c8c8c8',
253
- 400: '#adadad',
254
- 500: '#9e9e9e',
255
- 600: '#888888',
256
- 700: '#7b7b7b',
257
- 800: '#676767',
258
- 900: '#545454'
214
+ module.exports = {
215
+ theme: {
216
+ extend: {
217
+ // Adds a new color in addition to the default colors
218
+ colors: {
219
+ primary: '#002359'
259
220
  }
260
221
  }
261
222
  }
262
- }
223
+ };
263
224
  ```
264
225
 
265
- ### Extending the Palette
266
-
267
- Add new colors without modifying defaults:
226
+ You can override some parts of the default theme and extend others within the same configuration:
268
227
 
269
228
  ```javascript
270
- theme: {
271
- extend: {
272
- colors: {
273
- 'regal-blue': '#243c5a',
229
+ module.exports = {
230
+ theme: {
231
+ opacity: {
232
+ 15: '0.15',
233
+ 35: '0.35',
234
+ 65: '0.65',
235
+ 85: '0.85'
236
+ },
237
+ extend: {
238
+ colors: {
239
+ primary: '#002359'
240
+ }
274
241
  }
275
242
  }
276
- }
243
+ };
277
244
  ```
278
245
 
279
- :::info
280
- You can use the `shades` command to generate a range of shades for a given color, automatically adding them to your `config.cjs` file.
281
- :::
246
+ ## Customize Colors
282
247
 
283
- ## Customizing Spacing
248
+ PurgeTSS includes Tailwind's default color palette. Customize it under the `colors` key in the `theme` section of your `config.cjs` file.
284
249
 
285
- The `spacing` section is shared by `padding`, `margin`, `width`, `height`, and `gap` properties.
250
+ ### Use Custom Colors
286
251
 
287
- ```javascript
288
- theme: {
289
- spacing: {
290
- sm: 8,
291
- md: 12,
292
- lg: 16,
293
- xl: 24,
294
- }
295
- }
296
- ```
297
-
298
- ### Shared Spacing Behavior
299
-
300
- :::info
301
- When you include the `spacing` section, PurgeTSS will automatically generate all spacing-related properties and merge them with any other spacing-related properties present in the configuration file.
302
- :::
303
-
304
- For example:
252
+ To replace the default color palette, add your colors directly under `theme.colors`:
305
253
 
306
254
  ```javascript
307
- theme: {
308
- spacing: {
309
- tight: '0.25rem',
310
- loose: '1.0rem'
311
- },
312
- width: {
313
- banner: '5rem'
314
- },
315
- height: {
316
- xl: '3rem',
317
- '1/3': '33.333333%'
255
+ module.exports = {
256
+ theme: {
257
+ colors: {
258
+ transparent: 'transparent',
259
+ white: '#ffffff',
260
+ purple: '#3f3cbb',
261
+ midnight: '#121063',
262
+ metal: '#565584',
263
+ tahiti: '#3ab7bf',
264
+ silver: '#ecebff',
265
+ 'bubble-gum': '#ff77e9',
266
+ bermuda: '#78dcca'
267
+ }
318
268
  }
319
- }
269
+ };
320
270
  ```
321
271
 
322
- This generates:
323
- - `m-tight`, `m-loose`, `p-tight`, `p-loose`, etc.
324
- - `w-banner`
325
- - `h-xl`, `h-1/3`
326
-
327
- ## List of Customizable Properties
328
-
329
- ### Global Properties
330
-
331
- All color properties inherit from `theme.colors`. All spacing properties inherit from `theme.spacing`.
332
-
333
- ### Color Properties (50+ properties)
334
-
335
- All of these support your custom colors:
336
- - `activeTintColor`, `activeTitleColor`, `backgroundColor`, `backgroundDisabledColor`, `backgroundFocusedColor`, `backgroundSelectedColor`, `backgroundSelectedGradient`, `badgeColor`, `barColor`, `borderColor`, `color`, `colors`, `contentScrimColor`, `currentPageIndicatorColor`, `dateTimeColor`, `disabledColor`, `highlightedColor`, `hintTextColor`, `iconColor`, `imageTouchFeedbackColor`, `indicatorColor`, `keyboardToolbarColor`, `lightColor`, `navigationIconColor`, `navTintColor`, `onTintColor`, `pageIndicatorColor`, `pagingControlColor`, `pullBackgroundColor`, `resultsBackgroundColor`, `resultsSeparatorColor`, `selectedBackgroundColor`, `selectedButtonColor`, `selectedColor`, `selectedSubtitleColor`, `selectedTextColor`, `separatorColor`, `shadowColor`, `statusBarBackgroundColor`, `subtitleColor`, `subtitleTextColor`, `tabsBackgroundColor`, `tabsBackgroundSelectedColor`, `thumbTintColor`, `tint`, `tintColor`, `titleAttributes`, `titleColor`, `titleTextColor`, `touchFeedbackColor`, `trackTintColor`, `viewShadowColor`
272
+ These colors are available across utilities like text, border, and background colors.
337
273
 
338
- ### Configurable Properties (80+ properties)
339
-
340
- - `activeTab`, `backgroundLeftCap`, `backgroundPaddingBottom`, `backgroundPaddingLeft`, `backgroundPaddingRight`, `backgroundPaddingTop`, `backgroundTopCap`, `borderRadius`, `borderWidth`, `bottom`, `cacheSize`, `columnCount`, `contentHeight`, `contentWidth`, `countDownDuration`, `delay`, `duration`, `elevation`, `fontFamily`, `fontSize`, `horizontalMargin`, `indentionLevel`, `keyboardToolbarHeight`, `left`, `leftButtonPadding`, `leftTrackLeftCap`, `leftTrackTopCap`, `leftWidth`, `lineHeightMultiple`, `lines`, `lineSpacing`, `maxElevation`, `maximumLineHeight`, `maxLines`, `maxRowHeight`, `maxZoomScale`, `minimumFontSize`, `minimumLineHeight`, `minRowHeight`, `minZoomScale`, `opacity`, `padding`, `paddingBottom`, `paddingLeft`, `paddingRight`, `paddingTop`, `pageHeight`, `pageWidth`, `pagingControlAlpha`, `pagingControlHeight`, `pagingControlTimeout`, `paragraphSpacingAfter`, `paragraphSpacingBefore`, `repeat`, `repeatCount`, `right`, `rightButtonPadding`, `rightTrackLeftCap`, `rightTrackTopCap`, `rightWidth`, `rotate`, `rowCount`, `rowHeight`, `scale`, `scalesPageToFit`, `scaleX`, `scaleY`, `sectionHeaderTopPadding`, `separatorHeight`, `shadowRadius`, `shiftMode`, `timeout`, `top`, `uprightHeight`, `uprightWidth`, `verticalMargin`, `width`, `xOffset`, `yOffset`, `zIndex`, `zoomScale`
341
-
342
- ## Custom Rules & Ti Elements
343
-
344
- Style any **Ti Element**, **ID**, or **class** with platform/device specificity.
345
-
346
- ### Modifier Key
347
-
348
- - **Ti Elements**: Use exact name: `Label`, `Button`, `ScrollView`
349
- - **IDs**: Use `camelCase`: `#mainBanner`, `sidebarWidget`
350
- - **Classes**: Use `kebab-case`: `.my-custom-class`, `.feature-card` (required for PurgeTSS v6.x+)
351
-
352
- :::caution PurgeTSS v5 or earlier projects
353
- For projects created with PurgeTSS v5 or earlier that are now using version 7.x.x or above, please set `purge.options.missing` to true in `config.cjs` to get a report (at the end of `app.tss`) of any missing classes so you can update them to the new naming convention.
354
- :::
355
-
356
- ### Default, Platform, Device, or Conditional Blocks
357
-
358
- - **`DEFAULT` or `default`**: Global style
359
- - **`ios`** or **`android`**: Platform-specific
360
- - **`tablet`** or **`handheld`**: Device-specific
361
- - **`[if=globalVariableName]`**: Conditional with global variable
362
-
363
- ### Property Values
364
-
365
- - **Titanium constants**: Enclose in quotes: `'Ti.UI.SIZE'`, `'Ti.UI.FILL'`
366
- - **Alloy Configuration Values**: Enclose in quotes: `'Alloy.CFG.someValue'`
367
- - **Global Variables**: Enclose in quotes: `'Alloy.Globals.someValue'`
368
- - **Colors**: Use `hex`, `8-digit hex`, `rgb(R,G,B)`, `rgba(R,G,B,A)`, `transparent`, or color names
369
- - **Spacing values**: Use `em`, `rem`, `%`, `px`, `dp`, `cm`, `in`
370
-
371
- **Unit conversions:**
372
- - `%`, `px`, `cm`, `in` - Passed without conversion
373
- - `em` or `rem` - Converted: `value * 16`
374
- - `dp` - Unit removed, value remains intact
274
+ ### Color Object Syntax
375
275
 
376
- ### Complete Example
276
+ Colors can be defined as a simple list of key-value pairs or as nested objects. Nested keys are added to the base color name as modifiers.
377
277
 
378
278
  ```javascript
379
279
  module.exports = {
380
280
  theme: {
381
- // Custom ID with platform variants
382
- '#main-banner': {
383
- DEFAULT: {
384
- width: '300px',
385
- height: '80px'
386
- },
387
- ios: {
388
- clipMode: 'Ti.UI.iOS.CLIP_MODE_DISABLED'
389
- }
390
- },
391
-
392
- // Custom class with device variants
393
- '.gallery': {
394
- DEFAULT: {
395
- height: 'Ti.UI.SIZE'
396
- },
397
- ios: {
398
- clipMode: 'Ti.UI.iOS.CLIP_MODE_ENABLED'
399
- },
400
- android: {
401
- hiddenBehavior: 'Ti.UI.HIDDEN_BEHAVIOR_GONE'
402
- },
403
- handheld: {
404
- width: '250px'
405
- },
406
- tablet: {
407
- width: '500px'
408
- }
409
- },
410
-
411
- // Ti Element styling
412
- TextField: {
413
- DEFAULT: {
414
- top: 10,
415
- left: 20,
416
- right: 20,
417
- bottom: 0
418
- },
419
- '[if=Alloy.Globals.iPhoneX]': {
420
- bottom: 'Alloy.CFG.iPhoneXNotchSize'
281
+ colors: {
282
+ highlight: '#ffff00',
283
+ primary: {
284
+ solid: '#002359',
285
+ dark: '#000030',
286
+ transparent: '#D9002359'
421
287
  },
422
- android: {
423
- touchFeedback: true
288
+ tahiti: {
289
+ 100: '#cffafe',
290
+ 200: '#a5f3fc',
291
+ 300: '#67e8f9',
292
+ 400: '#22d3ee',
293
+ 500: '#06b6d4',
294
+ 600: '#0891b2',
295
+ 700: '#0e7490',
296
+ 800: '#155e75',
297
+ 900: '#164e63'
424
298
  }
425
299
  }
426
300
  }
427
- }
301
+ };
428
302
  ```
429
303
 
430
- ## The `@apply` Directive
431
-
432
- Extract repetitive patterns into reusable classes.
433
-
434
- ```javascript
435
- '.btn-primary': {
436
- apply: 'bg-blue-600 text-white rounded-lg px-4 py-2 font-bold'
437
- }
438
-
439
- '.card-shadow': {
440
- apply: 'shadow-md'
441
- }
442
- ```
443
-
444
- :::tip
445
- The `apply` directive is perfect for creating component-specific utility classes that combine multiple PurgeTSS utilities into a single, semantic class name.
446
- :::
447
-
448
- ### Platform-Specific Classes with `@apply`
449
-
450
- Several classes in `utilities.tss` are platform-specific to prevent polluting objects with properties that are not specific to a particular platform.
304
+ The nested keys are combined with the parent key to form class names like `bg-tahiti-400` or `text-tahiti-400`.
451
305
 
452
- :::caution IMPORTANT!
453
- To properly apply these platform styles when creating custom rules, you must specify the platform variant in the `apply` directive.
306
+ ### Override a Default Color
454
307
 
455
- **Even if you are not targeting a specific platform, you must specify the platform variant.**
456
- :::
308
+ If you want to override one of the default colors but keep the rest, provide the new values in `theme.extend.colors`.
457
309
 
458
- #### Correct Usage - With Platform Variant
310
+ For example, replacing the default cool grays with a neutral gray palette:
459
311
 
460
312
  ```javascript
461
313
  module.exports = {
462
314
  theme: {
463
- '.my-view': {
464
- // Targeting iOS with platform variant
465
- 'ios': {
466
- 'apply': 'bg-green-500 wh-32 ios:clip-enabled'
315
+ extend: {
316
+ colors: {
317
+ gray: {
318
+ 50: '#f7f7f7',
319
+ 100: '#ededed',
320
+ 200: '#dfdfdf',
321
+ 300: '#c8c8c8',
322
+ 400: '#adadad',
323
+ 500: '#9e9e9e',
324
+ 600: '#888888',
325
+ 700: '#7b7b7b',
326
+ 800: '#676767',
327
+ 900: '#545454'
328
+ }
467
329
  }
468
330
  }
469
- },
470
- }
331
+ }
332
+ };
471
333
  ```
472
334
 
473
- **Generated output:**
474
- ```tss
475
- /* Custom Classes */
476
- '.my-view[platform=ios]': { backgroundColor: '#22c55e', clipMode: Ti.UI.iOS.CLIP_MODE_ENABLED, width: 128, height: 128 }
477
- ```
335
+ ### Extend the Default Palette
478
336
 
479
- #### Wrong Usage - Omitting Platform Variant
337
+ If you want to extend the default color palette, use `theme.extend.colors`.
480
338
 
481
339
  ```javascript
482
340
  module.exports = {
483
341
  theme: {
484
- // Missing platform variant in clip-enabled
485
- '.my-view': {
486
- 'apply': 'wh-32 clip-enabled bg-green-500'
342
+ extend: {
343
+ colors: {
344
+ 'regal-blue': '#243c5a'
345
+ }
487
346
  }
488
- },
489
- }
490
- ```
491
-
492
- **Generated output (MISSING the clipMode property):**
493
- ```tss
494
- /* Omitting the platform variant in config.cjs will not generate the corresponding property. */
495
- /* Missing the property related to `clip-enabled`. */
496
- '.my-view': { backgroundColor: '#22c55e', width: 128, height: 128 }
347
+ }
348
+ };
497
349
  ```
498
350
 
499
- #### Why Platform Variants Are Required
500
-
501
- Certain Titanium properties are platform-specific and will only work when properly scoped:
351
+ This generates classes like `bg-regal-blue` in addition to all of Tailwind's default colors.
502
352
 
503
- | Property | Platform | Class |
504
- | --------------- | -------------------- | --------------------------------------- |
505
- | `clipMode` | iOS only | `ios:clip-enabled`, `ios:clip-disabled` |
506
- | `touchFeedback` | Android only | `android:touch-feedback` |
507
- | `hires` | iOS only (ImageView) | `ios:hires` |
353
+ > **ℹ️ INFO**
354
+ > You can use the `shades` command to generate a range of shades for a color and add them to `config.cjs`. See [CLI Commands](./cli-commands.md#shades-command).
508
355
 
509
- When using `@apply` with these properties, you MUST specify the platform variant in the `apply` string so PurgeTSS knows which platform's property to include.
356
+ ## Customize Spacing
510
357
 
511
- #### Combining Platform Variants
358
+ The `spacing` section sets the global spacing and sizing scale.
512
359
 
513
360
  ```javascript
514
361
  module.exports = {
515
362
  theme: {
516
- '.responsive-card': {
517
- DEFAULT: {
518
- apply: 'bg-white rounded-lg p-4'
519
- },
520
- ios: {
521
- apply: 'shadow-md ios:clip-enabled'
522
- },
523
- android: {
524
- apply: 'android:touch-feedback'
525
- },
526
- handheld: {
527
- apply: 'w-full'
528
- },
529
- tablet: {
530
- apply: 'w-3/4'
531
- }
363
+ spacing: {
364
+ 1: '8px',
365
+ 2: '12px',
366
+ 3: '16px',
367
+ 4: '24px',
368
+ 5: '32px',
369
+ 6: '48px'
532
370
  }
533
371
  }
534
- }
535
- ```
536
-
537
- **Generated output:**
538
- ```tss
539
- /* Platform and device specific styles */
540
- '.responsive-card': { backgroundColor: '#ffffff', borderRadius: 8, top: 16, right: 16, bottom: 16, left: 16 }
541
- '.responsive-card[platform=ios]': { clipMode: Ti.UI.iOS.CLIP_MODE_ENABLED }
542
- '.responsive-card[platform=android]': { touchFeedback: true }
543
- '.responsive-card[formFactor=handheld]': { width: '100%' }
544
- '.responsive-card[formFactor=tablet]': { width: '75%' }
545
- ```
546
-
547
- ### String vs Array Syntax
548
-
549
- You can use either a string or an array for the `apply` directive:
550
-
551
- ```javascript
552
- // String syntax
553
- '.btn': {
554
- apply: 'font-bold border-2 rounded wh-auto my-0.5'
555
- }
556
-
557
- // Array syntax (easier to read for long lists)
558
- '.btn-corporate': {
559
- apply: [
560
- 'bg-corporate-500',
561
- 'text-corporate-100',
562
- 'border-corporate-200'
563
- ]
564
- }
372
+ };
565
373
  ```
566
374
 
567
- ## Platform & Device Modifiers in XML
568
-
569
- Conditional styling directly in the `class` attribute using colon notation.
375
+ By default, the spacing scale is inherited by the padding, margin, width, height, and gap core plugins.
570
376
 
571
- ### Platform Modifiers
377
+ ### Shared Spacing
572
378
 
573
- ```xml
574
- <!-- iOS-specific styling -->
575
- <Label class="ios:text-blue-600 android:text-gray-600" />
379
+ The `spacing` section is shared by the `padding`, `margin`, `width`, and `height` properties.
576
380
 
577
- <!-- Multiple platforms -->
578
- <View class="ios:bg-blue-100 android:bg-gray-100" />
579
- ```
580
-
581
- ### Device Modifiers
381
+ When you include the `spacing` section, PurgeTSS automatically generates all spacing-related properties and merges them with any other spacing-related properties present in the configuration file.
582
382
 
583
- ```xml
584
- <!-- Tablet vs handheld -->
585
- <View class="tablet:w-3/4 handheld:w-full" />
586
- ```
587
-
588
- ### Custom Conditional Modifiers
589
-
590
- ```xml
591
- <!-- Using global variables -->
592
- <View class="[if=Alloy.Globals.isIPhoneX]:pb-24" />
383
+ ```javascript
384
+ module.exports = {
385
+ theme: {
386
+ spacing: {
387
+ tight: '0.25rem',
388
+ loose: '1.0rem'
389
+ },
390
+ width: {
391
+ banner: '5rem'
392
+ },
393
+ height: {
394
+ xl: '3rem',
395
+ '1/3': '33.333333%'
396
+ }
397
+ }
398
+ };
593
399
  ```
594
400
 
595
- ## Icon Font Support
596
-
597
- PurgeTSS automatically maps icon classes to both `text` and `title` properties, making them work on both Labels and Buttons.
598
-
599
401
  ```tss
600
- /* Auto-generated for FontAwesome */
601
- '.fa-home': { text: '\uf015', title: '\uf015' }
602
- '.fas': { font: { fontFamily: 'FontAwesome7Free-Solid' } }
402
+ /* width */
403
+ '.w-tight': { width: 4 }
404
+ '.w-loose': { width: 16 }
405
+ '.w-banner': { width: 80 }
406
+
407
+ /* height */
408
+ '.h-tight': { height: 4 }
409
+ '.h-loose': { height: 16 }
410
+ '.h-xl': { height: 48 }
411
+ '.h-1/3': { height: '33.333334%' }
412
+
413
+ /* margin */
414
+ '.m-tight': { top: 4, right: 4, bottom: 4, left: 4 }
415
+ '.m-loose': { top: 16, right: 16, bottom: 16, left: 16 }
416
+ '.my-tight': { top: 4, bottom: 4 }
417
+ '.my-loose': { top: 16, bottom: 16 }
418
+
419
+ /* padding */
420
+ '.p-tight': { padding: { top: 4, right: 4, bottom: 4, left: 4 } }
421
+ '.p-loose': { padding: { top: 16, right: 16, bottom: 16, left: 16 } }
422
+ '.py-tight': { padding: { top: 4, bottom: 4 } }
423
+ '.py-loose': { padding: { top: 16, bottom: 16 } }
603
424
  ```
604
425
 
605
- This allows:
606
- ```xml
607
- <!-- Works on Labels -->
608
- <Label class="fas fa-home" />
426
+ ### Override the Default Spacing Scale
609
427
 
610
- <!-- Works on Buttons too! -->
611
- <Button class="fas fa-home" />
612
- ```
613
-
614
- ## Theme Extension Best Practices
615
-
616
- ### 1. Use `extend` for Additions
428
+ If you want to override the default spacing scale, use `theme.spacing` in `config.cjs`:
617
429
 
618
430
  ```javascript
619
- theme: {
620
- extend: {
621
- colors: {
622
- brand: '#007AFF', // Adds to existing colors
431
+ module.exports = {
432
+ theme: {
433
+ spacing: {
434
+ sm: 8,
435
+ md: 12,
436
+ lg: 16,
437
+ xl: 24
623
438
  }
624
439
  }
625
- }
440
+ };
626
441
  ```
627
442
 
628
- ### 2. Use Direct Properties for Overrides
443
+ This disables the default spacing scale and generates classes like `p-sm` for padding, `m-md` for margin, `w-lg` for width, and `h-xl` for height.
444
+
445
+ ### Extend the Default Spacing Scale
446
+
447
+ If you want to extend the default spacing scale, use `theme.extend.spacing`:
629
448
 
630
449
  ```javascript
631
- theme: {
632
- colors: {
633
- // Completely replaces default grays
634
- gray: {
635
- 50: '#f7f7f7',
636
- // ... etc
450
+ module.exports = {
451
+ theme: {
452
+ extend: {
453
+ spacing: {
454
+ 72: '18rem',
455
+ 84: '21rem',
456
+ 96: '24rem'
457
+ }
637
458
  }
638
459
  }
639
- }
460
+ };
640
461
  ```
641
462
 
642
- ### 3. Mix Both When Needed
463
+ This generates classes like `p-72`, `m-84`, and `h-96` in addition to all of the default spacing and sizing utilities.
643
464
 
644
- ```javascript
645
- theme: {
646
- // Override some
647
- opacity: { /* custom values */ },
465
+ > **WARNING: Titanium Layout Constraint**
466
+ > Titanium does not support native `padding` on `View`, `Window`, `ScrollView`, or `TableView`. Even if PurgeTSS can generate spacing-related utilities, prefer margins on children for those elements.
648
467
 
649
- // Extend others
650
- extend: {
651
- colors: { /* additional colors */ }
652
- }
653
- }
654
- ```
655
-
656
- ## Summary Checklist
468
+ ## List of Customizable Properties
657
469
 
658
- - [ ] Set `mode: 'all'` if styling Ti Elements in `config.cjs`
659
- - [ ] Use `method: 'async'` for LiveView compatibility issues
660
- - [ ] Enable `missing: true` during development to catch typos
661
- - [ ] Use `kebab-case` for custom class names (v6.x+ requirement)
662
- - [ ] Use `camelCase` for IDs
663
- - [ ] Use exact names for Ti Elements
664
- - [ ] Prefer `extend` over overriding for colors/spacing
665
- - [ ] Use `@apply` for component-specific utility combinations
470
+ The official guide ends with an exhaustive list of color and configurable properties. In this skill, that list is maintained separately in [Configurable Properties](./configurable-properties.md) so this guide stays focused on config structure and usage patterns.
666
471
 
667
- ## Related References
472
+ ## Custom Rules and Ti Elements
668
473
 
669
- - [Opacity Modifier](opacity-modifier.md) - Add transparency to ANY color with `/50` syntax
670
- - [Configurable Properties](configurable-properties.md) - Complete list of 80+ customizable properties
671
- - [Custom Rules](custom-rules.md) - Styling Ti Elements, IDs, and classes
672
- - [Apply Directive](apply-directive.md) - Extracting utility combinations into reusable classes
673
- - [Platform Modifiers](platform-modifiers.md) - ios:, android:, tablet:, handheld: prefixes
474
+ Create your own custom rules and include Ti Elements with any number of attributes or conditional statements. See [Custom Rules](./custom-rules.md) for the rule syntax and examples.