@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,167 @@
1
+ # Alloy Samples
2
+
3
+ ## Table of Contents
4
+
5
+ - [Alloy Samples](#alloy-samples)
6
+ - [Table of Contents](#table-of-contents)
7
+ - [Kitchen Sink](#kitchen-sink)
8
+ - [Controller Sample](#controller-sample)
9
+ - [Conditional Statements in Views](#conditional-statements-in-views)
10
+ - [The Problem with Traditional Approaches](#the-problem-with-traditional-approaches)
11
+ - [The Solution: IF Attributes in XML](#the-solution-if-attributes-in-xml)
12
+ - [Conditional Queries in TSS](#conditional-queries-in-tss)
13
+ - [Data-Binding with Conditional Queries](#data-binding-with-conditional-queries)
14
+
15
+ ---
16
+
17
+ ## Kitchen Sink
18
+
19
+ See the [KitchenSink-v2 application on GitHub](https://github.com/tidev/kitchensink-v2) for Alloy samples in a real app.
20
+
21
+ ## Controller Sample
22
+
23
+ **index.js**
24
+ ```javascript
25
+ // These "builtin" requires are detected by alloy compile process
26
+ // Automatically included as Resources/alloy/animation.js and Resources/alloy/string.js
27
+ const animation = require('alloy/animation');
28
+ const string = require('alloy/string');
29
+
30
+ function shake(e) {
31
+ animation.shake($.mover, 0, () => {
32
+ alert("Shake ended.");
33
+ });
34
+ }
35
+
36
+ function flash(e) {
37
+ animation.flash($.mover);
38
+ }
39
+
40
+ function trim(e) {
41
+ $.label.text = string.trim($.label.text);
42
+ }
43
+
44
+ if (OS_IOS) {
45
+ function flip(e) {
46
+ let front, back;
47
+ e.bubbleParent = false;
48
+ if (e.source === $.back) {
49
+ front = $.back;
50
+ back = $.front;
51
+ } else {
52
+ front = $.front;
53
+ back = $.back;
54
+ }
55
+ animation.flipHorizontal(front, back, 500, (e) => {
56
+ Ti.API.info('flipped');
57
+ });
58
+ }
59
+ }
60
+
61
+ $.index.open();
62
+
63
+ // Runtime unit tests
64
+ if (!ENV_PROD) {
65
+ require('specs/index')($);
66
+ }
67
+ ```
68
+
69
+ ## Conditional Statements in Views
70
+
71
+ Alloy separates business logic (controllers) from UI definition (XML/TSS). A common challenge is showing/hiding content based on app state (e.g., login status).
72
+
73
+ ### The Problem with Traditional Approaches
74
+
75
+ **Approach 1: show/hide (in controller)**
76
+ ```javascript
77
+ if (Alloy.Globals.isLoggedIn()) {
78
+ $.loggedIn.show();
79
+ $.notLoggedIn.hide();
80
+ } else {
81
+ $.loggedIn.hide();
82
+ $.notLoggedIn.show();
83
+ }
84
+ ```
85
+ **Problem:** Both views render initially when the window opens. If the user isn't logged in, there's a big white space where the logged-in view was originally placed before it was hidden.
86
+
87
+ **Approach 2: setHeight (in controller)**
88
+ ```javascript
89
+ if (Alloy.Globals.isLoggedIn()) {
90
+ $.loggedIn.setHeight(Ti.UI.SIZE);
91
+ $.notLoggedIn.setHeight(0);
92
+ } else {
93
+ $.loggedIn.setHeight(0);
94
+ $.notLoggedIn.setHeight(Ti.UI.SIZE);
95
+ }
96
+ ```
97
+ **Problem:** This works but is messy and forces you to manage specific height values (`Ti.UI.SIZE`) in JavaScript logic, which should ideally stay in TSS.
98
+
99
+ ### The Solution: IF Attributes in XML
100
+
101
+ Use `if` attributes directly within the XML View. These conditions are evaluated **before** rendering, providing a smoother experience.
102
+
103
+ **index.xml**
104
+ ```xml
105
+ <Alloy>
106
+ <Window>
107
+ <View>
108
+ <!-- Only one of these will ever be rendered -->
109
+ <View if="Alloy.Globals.isLoggedIn()" id="notLoggedIn" class="vertical">
110
+ <Label text="Not logged in" />
111
+ </View>
112
+ <View if="!Alloy.Globals.isLoggedIn()" id="loggedIn" class="vertical">
113
+ <Label text="Logged in" />
114
+ </View>
115
+ </View>
116
+ </Window>
117
+ </Alloy>
118
+ ```
119
+
120
+ **Benefits:**
121
+ - **No White Space:** Only the view that matches the condition is rendered to the UI.
122
+ - **Pre-rendering Evaluation:** The UI is correct from the first frame.
123
+ - **Cleaner Code:** No need for visibility logic in your controllers.
124
+
125
+ ### Conditional Queries in TSS
126
+
127
+ Use IF attributes in TSS definitions:
128
+
129
+ ```tss
130
+ "#info[if=Alloy.Globals.isIos7Plus]": {
131
+ font: {
132
+ textStyle: Ti.UI.TEXT_STYLE_FOOTNOTE
133
+ }
134
+ },
135
+ "#title[if=Alloy.Globals.isIos7Plus]": {
136
+ top: "25dp",
137
+ font: {
138
+ textStyle: Ti.UI.TEXT_STYLE_HEADLINE
139
+ }
140
+ },
141
+ "#content[if=Alloy.Globals.isIos7Plus]": {
142
+ font: {
143
+ textStyle: Ti.UI.TEXT_STYLE_CAPTION1
144
+ }
145
+ },
146
+ "ScrollView[if=Alloy.Globals.iPhoneTall]": {
147
+ height: "500dp"
148
+ }
149
+ ```
150
+
151
+ ### Data-Binding with Conditional Queries
152
+
153
+ Define custom methods in models and render based on those methods:
154
+
155
+ **Model Method:** `shouldShowCommentRow()` returns `true`
156
+
157
+ **XML View:**
158
+ ```xml
159
+ <Alloy>
160
+ <TableViewRow id="commentRow" hasChild="false" if="$model.shouldShowCommentRow()" onClick="onSelectComment">
161
+ <Label id="commentPlaceholderLabel" class="commentRowPreviewLabel placeholderLabel" text="Ti.App.L('AddComment')" />
162
+ <Label id="commentRowLabel" class="commentRowPreviewLabel" text="{Comment}" />
163
+ </TableViewRow>
164
+ </Alloy>
165
+ ```
166
+
167
+ See [Custom Query Styles](/guide/Alloy_Framework/Alloy_Guide/Alloy_Views/Alloy_Styles_and_Themes/#custom-query-styles) for more details.
@@ -0,0 +1,442 @@
1
+ ---
2
+ name: purgetss
3
+ description: "Titanium PurgeTSS utility-first styling toolkit. Use when styling, reviewing, analyzing, or examining Titanium UI with utility classes, configuring config.cjs, creating dynamic components with $.UI.create(), building animations, using grid layouts, setting up icon fonts, or working with TSS styles. Never suggest other CSS framework classes - verify in class-index.md first."
4
+ argument-hint: "[class-name]"
5
+ allowed-tools: Read, Grep, Glob, Edit, Write, Bash(purgetss *), Bash(node *)
6
+ ---
7
+
8
+ # PurgeTSS Expert
9
+
10
+ Utility-first styling toolkit for Titanium/Alloy mobile apps.
11
+
12
+ ## Project Detection
13
+
14
+ :::info AUTO-DETECTS PURGETSS PROJECTS
15
+ This skill automatically detects PurgeTSS usage when invoked and provides utility-first styling guidance.
16
+
17
+ **Detection occurs automatically** - no manual command needed.
18
+
19
+ **PurgeTSS project indicators:**
20
+ - `purgetss/` folder
21
+ - `purgetss/config.cjs` configuration file
22
+ - `purgetss/styles/utilities.tss` utility classes
23
+ - `app/styles/app.tss` (auto-generated)
24
+
25
+ **Behavior based on detection:**
26
+ - **PurgeTSS detected** → Provides PurgeTSS-specific guidance, recommends utility classes, suggests `$.UI.create()` for dynamic components
27
+ - **Not detected** → Does NOT suggest PurgeTSS utility classes, does NOT recommend `$.UI.create()`, does NOT reference PurgeTSS-specific patterns
28
+ :::
29
+
30
+ ## Table of Contents
31
+
32
+ - [PurgeTSS Expert](#purgetss-expert)
33
+ - [Project Detection](#project-detection)
34
+ - [Table of Contents](#table-of-contents)
35
+ - [Core Workflow](#core-workflow)
36
+ - [Project Structure](#project-structure)
37
+ - [Understanding `app.tss` vs `_app.tss`](#understanding-apptss-vs-_apptss)
38
+ - [Checking for Unused/Unsupported Classes](#checking-for-unusedunsupported-classes)
39
+ - [How `utilities.tss` Works](#how-utilitiestss-works)
40
+ - [Quick Start](#quick-start)
41
+ - [Critical Rules (Low Freedom)](#critical-rules-low-freedom)
42
+ - [⭐ PREFER `$.UI.create()` for Dynamic Components](#-prefer-uicreate-for-dynamic-components)
43
+ - [🚨 RESPECT USER FILES](#-respect-user-files)
44
+ - [🚨 NO FLEXBOX - Titanium Doesn't Support It](#-no-flexbox---titanium-doesnt-support-it)
45
+ - [🚨 PLATFORM-SPECIFIC PROPERTIES REQUIRE MODIFIERS](#-platform-specific-properties-require-modifiers)
46
+ - [Other Mandatory Rules](#other-mandatory-rules)
47
+ - [Common Anti-Patterns](#common-anti-patterns)
48
+ - [Class Verification Workflow](#class-verification-workflow)
49
+ - [Verification Steps](#verification-steps)
50
+ - [What HAS Classes vs What DOESN'T](#what-has-classes-vs-what-doesnt)
51
+ - [Reference Guides](#reference-guides)
52
+ - [Essential References](#essential-references)
53
+ - [Setup \& Configuration](#setup--configuration)
54
+ - [Customization](#customization)
55
+ - [Layout \& Styling](#layout--styling)
56
+ - [Fonts \& Animations](#fonts--animations)
57
+ - [Examples](#examples)
58
+ - [Related Skills](#related-skills)
59
+
60
+ ---
61
+
62
+ ## Core Workflow
63
+
64
+ 1. **Setup**: `purgetss create 'name'` or `purgetss init` for existing projects
65
+ 2. **Build**: Write XML with utility classes → PurgeTSS auto-generates `app.tss`
66
+ 3. **Configure**: Customize via `purgetss/config.cjs`
67
+
68
+ ## Project Structure
69
+
70
+ ```bash
71
+ ./purgetss/
72
+ ├─ fonts/ # Custom font files (.ttf, .otf)
73
+ ├─ styles/
74
+ │ ├─ definitions.css # For VS Code IntelliSense
75
+ │ └─ utilities.tss # All PurgeTSS utility classes
76
+ └─ config.cjs # Theme configuration
77
+
78
+ ./app/styles/
79
+ ├─ app.tss # AUTO-GENERATED - DO NOT EDIT DIRECTLY
80
+ └─ _app.tss # YOUR CUSTOM STYLES (persists across runs)
81
+ ```
82
+
83
+ ### Understanding `app.tss` vs `_app.tss`
84
+
85
+ :::warning CRITICAL: app.tss IS AUTO-GENERATED
86
+ **`app.tss` is ALWAYS regenerated** every time the app compiles.
87
+
88
+ PurgeTSS scans ALL XMLs and Controllers for utility classes, then generates a fresh `app.tss` containing only the classes actually used.
89
+
90
+ **NEVER edit `app.tss` directly** - your changes WILL be overwritten on the next build.
91
+ :::
92
+
93
+ :::info THE `_app.tss` BACKUP FILE
94
+ On **first run**, PurgeTSS backs up your original `app.tss` to `_app.tss`.
95
+
96
+ **`_app.tss` is your custom styles file** - it persists across all PurgeTSS runs.
97
+
98
+ Every build, PurgeTSS:
99
+ 1. Scans XMLs and Controllers for used classes
100
+ 2. Regenerates `app.tss` from scratch
101
+ 3. Copies `_app.tss` content into the generated `app.tss`
102
+
103
+ Better approach: define custom classes in `config.cjs` instead of `_app.tss`.
104
+ :::
105
+
106
+ ### Checking for Unused/Unsupported Classes
107
+
108
+ :::danger ALWAYS CHECK `app.tss` FOR ERRORS
109
+ At the **end of every generated `app.tss`**, look for this section:
110
+
111
+ ```tss
112
+ // Unused or unsupported classes
113
+ // .my-typo-class
114
+ // .non-existent-utility
115
+ ```
116
+
117
+ **These are classes used in your XMLs or Controllers that have NO definition anywhere:**
118
+ - Not in `utilities.tss` (generated from PurgeTSS utilities)
119
+ - Not in `_app.tss` (your custom styles)
120
+ - Not in any other `.tss` file in the `styles/` folder
121
+
122
+ **This means:**
123
+ 1. You have a **typo** in your class name
124
+ 2. You're using a class that **doesn't exist** in PurgeTSS
125
+ 3. You need to **define the class** in `_app.tss` or `config.cjs`
126
+
127
+ **As part of any analysis, ALWAYS check the end of `app.tss` and report any unused/unsupported classes to the user!**
128
+ :::
129
+
130
+ ### How `utilities.tss` Works
131
+
132
+ :::info UTILITIES.TSS REGENERATION
133
+ `./purgetss/styles/utilities.tss` contains ALL available PurgeTSS utility classes.
134
+
135
+ **It regenerates when `./purgetss/config.cjs` changes** - this is where you define:
136
+ - Custom colors
137
+ - Custom spacing scales
138
+ - Ti Element styles
139
+ - Any project-specific utilities
140
+
141
+ If a class appears in "Unused or unsupported classes" in `app.tss`, it means it's truly not defined anywhere - not even in your `config.cjs` customizations.
142
+ :::
143
+
144
+ ## Quick Start
145
+
146
+ ```bash
147
+ purgetss create 'MyApp' -d -v fa
148
+ # -d: Install dev dependencies (ESLint, Tailwind)
149
+ # -v: Copy icon fonts (fa, mi, ms, f7)
150
+ ```
151
+
152
+ :::tip NEW PROJECT: Clean Up Default app.tss
153
+ For new projects created with `purgetss create`, the default `app/styles/app.tss` contains a large commented template.
154
+
155
+ **You can safely DELETE this file** - PurgeTSS will regenerate it on the first build with only the classes you actually use, and create a clean `_app.tss` backup.
156
+
157
+ This prevents carrying around unnecessary commented code and ensures a fresh start.
158
+ :::
159
+
160
+ ## Critical Rules (Low Freedom)
161
+
162
+ ### ⭐ PREFER `$.UI.create()` for Dynamic Components
163
+
164
+ :::tip RECOMMENDED FOR DYNAMIC COMPONENTS
165
+ When creating components dynamically in Controllers, **use `$.UI.create()` instead of `Ti.UI.create()`** to get full PurgeTSS utility class support:
166
+
167
+ ```javascript
168
+ // ✅ RECOMMENDED - Full PurgeTSS support
169
+ const view = $.UI.create('View', {
170
+ classes: ['w-screen', 'h-auto', 'bg-white', 'rounded-lg']
171
+ })
172
+
173
+ // ❌ AVOID - No PurgeTSS classes
174
+ const view = Ti.UI.createView({
175
+ width: Ti.UI.FILL,
176
+ height: Ti.UI.SIZE,
177
+ backgroundColor: '#ffffff',
178
+ borderRadius: 8
179
+ })
180
+ ```
181
+
182
+ See [Dynamic Component Creation](references/dynamic-component-creation.md) for complete guide.
183
+ :::
184
+
185
+ ### 🚨 RESPECT USER FILES
186
+ **NEVER delete any existing `.tss` files** (like `index.tss`, `detail.tss`) or other project files without explicit user consent.
187
+
188
+ **How to handle migration to PurgeTSS:**
189
+ 1. **ONLY** replace custom classes with PurgeTSS utility classes if the user explicitly requests it.
190
+ 2. When requested:
191
+ - Analyze the definitions in the existing `.tss` files.
192
+ - Update the XML/Controller components with equivalent PurgeTSS utility classes.
193
+ - **WAIT** for user confirmation before suggesting or performing any file deletion.
194
+ 3. If the user prefers keeping manual `.tss` files for specific styles, respect that choice and only use PurgeTSS for new or requested changes.
195
+
196
+ ### 🚨 NO FLEXBOX - Titanium Doesn't Support It
197
+
198
+ :::danger FLEXBOX CLASSES DO NOT EXIST
199
+ The following are **NOT supported**:
200
+ - ❌ `flex`, `flex-row`, `flex-col`
201
+ - ❌ `justify-between`, `justify-center`, `justify-start`, `justify-end`
202
+ - ❌ `items-center` for alignment (exists but sets `width/height: FILL`)
203
+
204
+ **Use Titanium layouts instead:**
205
+ - ✅ `horizontal` - Children left to right
206
+ - ✅ `vertical` - Children top to bottom
207
+ - ✅ Omit layout class - Defaults to `composite` (absolute positioning)
208
+
209
+ :::tip CRITICAL: Understanding Layout Composition
210
+ When building complex UIs, carefully choose the layout mode for each container:
211
+
212
+ **`vertical`** - Stack elements top to bottom (most common):
213
+ ```xml
214
+ <ScrollView class="vertical">
215
+ <View class="mb-4">Item 1</View>
216
+ <View class="mb-4">Item 2</View>
217
+ <View>Item 3</View>
218
+ </ScrollView>
219
+ ```
220
+
221
+ **`horizontal`** - Arrange elements left to right:
222
+ ```xml
223
+ <View class="horizontal w-screen">
224
+ <Label text="Left" />
225
+ <View class="w-screen" /> <!-- Spacer -->
226
+ <Label text="Right" />
227
+ </View>
228
+ ```
229
+
230
+ **`composite`** (default) - Absolute positioning with `top`, `left`, etc.:
231
+ ```xml
232
+ <View class="w-screen h-screen">
233
+ <View class="absolute top-0 left-0 bg-red-500 wh-12" />
234
+ <View class="absolute bottom-0 right-0 bg-blue-500 wh-12" />
235
+ </View>
236
+ ```
237
+
238
+ **Common Issue:** If you see elements appearing in unexpected positions (e.g., a header bar "behind" content), check if parent containers have conflicting layout modes. Each container's layout affects its direct children only.
239
+ :::
240
+
241
+
242
+ ### 🚨 PLATFORM-SPECIFIC PROPERTIES REQUIRE MODIFIERS
243
+
244
+ :::danger CRITICAL: Platform-Specific Properties Require Modifiers
245
+ Using `Ti.UI.iOS.*` or `Ti.UI.Android.*` properties WITHOUT platform modifiers causes cross-platform compilation failures.
246
+
247
+ **WRONG - Adds iOS code to Android (causes failure):**
248
+ ```tss
249
+ // ❌ BAD - Adds Ti.UI.iOS to Android project
250
+ "#mainWindow": {
251
+ statusBarStyle: Ti.UI.iOS.StatusBar.LIGHT_CONTENT
252
+ }
253
+ ```
254
+
255
+ **CORRECT - Use platform modifiers in TSS:**
256
+ ```tss
257
+ // ✅ GOOD - Only adds to iOS
258
+ "#mainWindow[platform=ios]": {
259
+ statusBarStyle: Ti.UI.iOS.StatusBar.LIGHT_CONTENT
260
+ }
261
+ ```
262
+
263
+ **OR use PurgeTSS platform modifier classes:**
264
+ ```xml
265
+ <!-- ✅ GOOD - Platform-specific classes -->
266
+ <Window class="ios:status-bar-light android:status-bar-dark">
267
+ ```
268
+
269
+ **Properties that ALWAYS require platform modifiers:**
270
+ - iOS: `statusBarStyle`, `modalStyle`, `modalTransitionStyle`, `systemButton`
271
+ - Android: `actionBar` configuration
272
+ - ANY `Ti.UI.iOS.*`, `Ti.UI.Android.*` constant
273
+
274
+ **When suggesting platform-specific code:**
275
+ 1. Check if user's project supports that platform
276
+ 2. ALWAYS use `[platform=ios]` or `[platform=android]` TSS modifier
277
+ 3. OR use PurgeTSS platform classes like `ios:bg-blue-500`
278
+
279
+ **For complete reference on platform modifiers, see** [Platform Modifiers](references/platform-modifiers.md).
280
+ :::
281
+
282
+ ### Other Mandatory Rules
283
+
284
+ - **NO `p-` padding classes**: Titanium does NOT support a native `padding` property on `View`, `Window`, `ScrollView`, or `TableView`. Always use **margins on children** (`m-`) to simulate internal spacing.
285
+ - **View defaults to `SIZE`**: Use `w-screen`/`h-screen` to fill space when needed.
286
+ - **`rounded-full`**: To get a perfect circle, use `rounded-full-XX` (where XX is the width/height of the square element).
287
+ - **`rounded-full-XX` includes size**: These classes already set `width`, `height`, and `borderRadius`. Do **not** add `w-XX h-XX`/`wh-XX` unless you need to override.
288
+ - **`m-xx` on FILL elements**: Adding `m-4` to a `w-screen` element pins it to all four edges (top, bottom, left, right). This will **stretch the component vertically** to fill the parent unless you explicitly add `h-auto` (`Ti.UI.SIZE`) to constrain it to its content.
289
+ - **`w-XX` + `h-XX` → `wh-XX`**: If both width and height use the same scale value, prefer a single `wh-XX` (order doesn't matter: `w-10 h-10` and `h-10 w-10` are equivalent).
290
+ - **Use `wh-` shortcuts**: PurgeTSS provides a complete scale of combined width/height utilities:
291
+ - **Numeric Scale**: `wh-0` to `wh-96` (e.g., `wh-16` sets both to 64px).
292
+ - **Fractions**: `wh-1/2`, `wh-3/4`, up to `wh-11/12` for proportional sizing.
293
+ - **Special Values**: `wh-auto` (explicit `SIZE`), `wh-full` (`100%`), and `wh-screen` (`FILL`).
294
+ - Using these instead of separate `w-` and `h-` classes improves XML readability and reduces generated TSS size.
295
+
296
+ :::tip LAYOUT TIP: EDGE PINNING
297
+ If using margins (`m-`) causes your `Label` or `Button` to stretch unexpectedly, it is due to Titanium's **Edge Pinning** rule (2 opposite pins = computed dimension). Use the `wh-auto` class to explicitly force `SIZE` behavior and prevent stretching.
298
+ :::
299
+
300
+ - **NEVER add `composite` class explicitly** - That's the default, use `horizontal`/`vertical` when needed
301
+ - **Arbitrary values use parentheses**: `w-(100px)`, `bg-(#ff0000)` - NO square brackets
302
+ - **`mode: 'all'` required** in `config.cjs` for Ti Elements styling
303
+ - **Classes use `kebab-case`**: `.my-class`, IDs use `camelCase`: `#myId`
304
+
305
+ ## Common Anti-Patterns
306
+
307
+ **WRONG:**
308
+ ```xml
309
+ <View class="flex-row justify-between"> <!-- Flexbox doesn't exist -->
310
+ <View class="p-4"> <!-- No padding on Views -->
311
+ <View class="composite"> <!-- Never add composite explicitly -->
312
+ ```
313
+
314
+ **CORRECT:**
315
+ ```xml
316
+ <View class="horizontal">
317
+ <View class="m-4"> <!-- Use margins on children -->
318
+ <View> <!-- Omit layout = composite by default -->
319
+ ```
320
+
321
+ **WRONG (Dynamic Components):**
322
+ ```javascript
323
+ // Manual styling with Ti.UI.create()
324
+ const view = Ti.UI.createView({
325
+ width: Ti.UI.FILL,
326
+ backgroundColor: '#fff',
327
+ borderRadius: 8
328
+ })
329
+ ```
330
+
331
+ **CORRECT (Dynamic Components):**
332
+ ```javascript
333
+ // PurgeTSS classes with $.UI.create()
334
+ const view = $.UI.create('View', {
335
+ classes: ['w-screen', 'bg-white', 'rounded-lg']
336
+ })
337
+ ```
338
+
339
+ ## Class Verification Workflow
340
+
341
+ :::danger CRITICAL: VERIFY CLASSES BEFORE SUGGESTING
342
+ **NEVER guess or hallucinate classes based on other CSS Frameworks knowledge!**
343
+
344
+ PurgeTSS shares naming with some CSS Frameworks but has DIFFERENT classes for Titanium.
345
+ Always verify a class exists before suggesting it.
346
+ :::
347
+
348
+ ### Verification Steps
349
+
350
+ 1. **Check if it's a KNOWN anti-pattern**
351
+ - See [PROHIBITED Classes](references/class-index.md#prohibited-tailwind-classes-that-do-not-exist)
352
+ - Common mistakes: `flex-row`, `justify-between`, `p-4` on Views (p-* not supported on Views)
353
+
354
+ 2. **Check the Class Index**
355
+ - See [Class Index](references/class-index.md) for available patterns
356
+ - Constant properties like `keyboard-type-*`, `return-key-type-*` have dedicated classes
357
+
358
+ 3. **Search the project when unsure**
359
+ ```bash
360
+ # Search for a class pattern in the project's utilities.tss
361
+ grep -E "keyboard-type-" ./purgetss/styles/utilities.tss
362
+ grep -E "return-key-type-" ./purgetss/styles/utilities.tss
363
+ grep -E "^'bg-" ./purgetss/styles/utilities.tss
364
+ ```
365
+
366
+ 4. **After making changes**
367
+ - Check `app.tss` for "Unused or unsupported classes" section at the end
368
+ - Report any typos or non-existent classes to the user
369
+
370
+ ### What HAS Classes vs What DOESN'T
371
+
372
+ | Has Classes in PurgeTSS | Does NOT Have Classes |
373
+ | ----------------------- | ------------------------------------- |
374
+ | `keyboard-type-email` | `hintText` (use attribute) |
375
+ | `return-key-type-next` | `passwordMask` (use attribute) |
376
+ | `text-center` | `autocorrect` (use attribute) |
377
+ | `bg-blue-500` | `autocapitalization` (use attribute) |
378
+ | `w-screen` | `flex-row` → use `horizontal` |
379
+ | `wh-16` | `justify-between` → use margins |
380
+ | `rounded-lg` | `w-full` → use `w-screen` |
381
+ | `m-4`, `gap-4` | `p-4` on View → use `m-4` on children |
382
+
383
+ :::tip
384
+ When in doubt, prefer using the search command above to verify. It's better to spend 5 seconds verifying than suggesting a class that doesn't exist and will appear in the "unused classes" warning.
385
+ :::
386
+
387
+ ## Reference Guides
388
+
389
+ Load these only when needed:
390
+
391
+ ### Essential References
392
+ - **[Class Index](references/class-index.md)** - Quick patterns, prohibited classes, verification commands (LOAD FIRST when unsure about a class)
393
+ - **[Dynamic Component Creation](references/dynamic-component-creation.md)** - `$.UI.create()` and `Alloy.createStyle()` for creating components in Controllers (READ FIRST for dynamic components)
394
+
395
+ ### Setup & Configuration
396
+ - [Installation & Setup](references/installation-setup.md) - First run, VS Code, LiveView
397
+ - [CLI Commands](references/cli-commands.md) - All `purgetss` commands
398
+
399
+ ### Customization
400
+ - [Deep Customization](references/customization-deep-dive.md) - config.cjs, colors, spacing, Ti Elements
401
+ - [Custom Rules](references/custom-rules.md) - Styling Ti Elements, IDs, classes
402
+ - [Apply Directive](references/apply-directive.md) - Extracting utility combinations
403
+ - [Configurable Properties](references/configurable-properties.md) - All 80+ customizable properties
404
+
405
+ ### Layout & Styling
406
+ - **[UI/UX Design Patterns](references/ui-ux-design.md)** - Complete guide to mobile UI components with PurgeTSS (cards, lists, forms, buttons, navigation, modals, accessibility)
407
+ - [Grid Layout System](references/grid-layout.md) - 12-column grid, responsive layouts
408
+ - [Smart Mappings](references/smart-mappings.md) - How gap, shadows, and grid work under the hood
409
+ - [Arbitrary Values](references/arbitrary-values.md) - Parentheses notation for custom values
410
+ - [Platform Modifiers](references/platform-modifiers.md) - ios:, android:, tablet:, handheld:
411
+ - [Opacity Modifier](references/opacity-modifier.md) - Color transparency with /50 syntax
412
+ - [Titanium Resets](references/titanium-resets.md) - Default styles for Ti elements
413
+
414
+ ### Fonts & Animations
415
+ - [Icon Fonts](references/icon-fonts.md) - Font Awesome 7, Material Icons, custom icon libraries
416
+ - [Animation Component](references/animation-system.md) - Declarative `<Animation>` API
417
+
418
+ :::tip TEXT FONTS (Google Fonts, Roboto, etc.)
419
+ For text fonts, see [CLI Commands → build-fonts](references/cli-commands.md#purgetss-build-fonts-alias-bf).
420
+ :::
421
+
422
+ ## Examples
423
+
424
+ For complete WRONG vs CORRECT examples including:
425
+ - Titanium layout patterns (horizontal, vertical, composite)
426
+ - Grid with percentages
427
+ - Gap usage
428
+ - Manual .tss anti-patterns
429
+ - Dynamic component creation with `$.UI.create()` and `Alloy.createStyle()`
430
+
431
+ See [EXAMPLES.md](references/EXAMPLES.md) and [Dynamic Component Creation](references/dynamic-component-creation.md)
432
+
433
+ ## Related Skills
434
+
435
+ For tasks beyond styling, use these complementary skills:
436
+
437
+ | Task | Use This Skill |
438
+ | -------------------------------------------- | -------------- |
439
+ | Project architecture, services, controllers | `alloy-expert` |
440
+ | Complex UI components, ListViews, gestures | `ti-ui` |
441
+ | Alloy MVC concepts, data binding, TSS syntax | `alloy-guides` |
442
+ | Native features (camera, location, push) | `ti-howtos` |
@@ -0,0 +1,17 @@
1
+ module.exports = {
2
+ purge: {
3
+ mode: 'all',
4
+ method: 'sync',
5
+ options: {
6
+ missing: true,
7
+ widgets: false,
8
+ safelist: []
9
+ }
10
+ },
11
+ theme: {
12
+ extend: {
13
+ colors: {},
14
+ spacing: {}
15
+ }
16
+ }
17
+ }