@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.
- package/AGENTS-TEMPLATE.md +173 -0
- package/README.md +867 -0
- package/agents/ti-researcher.md +108 -0
- package/bin/titools.js +53 -0
- package/lib/commands/agents.js +126 -0
- package/lib/commands/install.js +188 -0
- package/lib/commands/uninstall.js +215 -0
- package/lib/commands/update.js +159 -0
- package/lib/config.js +119 -0
- package/lib/downloader.js +153 -0
- package/lib/installer.js +253 -0
- package/lib/platform.js +108 -0
- package/lib/symlink.js +142 -0
- package/lib/utils.js +270 -0
- package/package.json +67 -0
- package/skills/alloy-expert/SKILL.md +247 -0
- package/skills/alloy-expert/assets/ControllerAutoCleanup.js +182 -0
- package/skills/alloy-expert/references/alloy-structure.md +381 -0
- package/skills/alloy-expert/references/anti-patterns.md +133 -0
- package/skills/alloy-expert/references/code-conventions.md +469 -0
- package/skills/alloy-expert/references/contracts.md +280 -0
- package/skills/alloy-expert/references/controller-patterns.md +520 -0
- package/skills/alloy-expert/references/error-handling.md +484 -0
- package/skills/alloy-expert/references/examples.md +735 -0
- package/skills/alloy-expert/references/migration-patterns.md +298 -0
- package/skills/alloy-expert/references/patterns.md +448 -0
- package/skills/alloy-expert/references/performance-patterns.md +855 -0
- package/skills/alloy-expert/references/security-patterns.md +847 -0
- package/skills/alloy-expert/references/state-management.md +779 -0
- package/skills/alloy-expert/references/testing.md +872 -0
- package/skills/alloy-guides/SKILL.md +214 -0
- package/skills/alloy-guides/references/CLI_TASKS.md +243 -0
- package/skills/alloy-guides/references/CONCEPTS.md +191 -0
- package/skills/alloy-guides/references/CONTROLLERS.md +298 -0
- package/skills/alloy-guides/references/MODELS.md +1028 -0
- package/skills/alloy-guides/references/PURGETSS.md +56 -0
- package/skills/alloy-guides/references/VIEWS_DYNAMIC.md +242 -0
- package/skills/alloy-guides/references/VIEWS_STYLES.md +388 -0
- package/skills/alloy-guides/references/VIEWS_WITHOUT_CONTROLLERS.md +109 -0
- package/skills/alloy-guides/references/VIEWS_XML.md +558 -0
- package/skills/alloy-guides/references/WIDGETS.md +176 -0
- package/skills/alloy-howtos/SKILL.md +203 -0
- package/skills/alloy-howtos/references/best_practices.md +138 -0
- package/skills/alloy-howtos/references/cli_reference.md +253 -0
- package/skills/alloy-howtos/references/config_files.md +87 -0
- package/skills/alloy-howtos/references/custom_tags.md +147 -0
- package/skills/alloy-howtos/references/debugging_troubleshooting.md +101 -0
- package/skills/alloy-howtos/references/samples.md +167 -0
- package/skills/purgetss/SKILL.md +442 -0
- package/skills/purgetss/assets/purgetss.config.cjs +17 -0
- package/skills/purgetss/references/EXAMPLES.md +247 -0
- package/skills/purgetss/references/animation-system.md +1294 -0
- package/skills/purgetss/references/apply-directive.md +375 -0
- package/skills/purgetss/references/arbitrary-values.md +612 -0
- package/skills/purgetss/references/class-index.md +1350 -0
- package/skills/purgetss/references/cli-commands.md +948 -0
- package/skills/purgetss/references/configurable-properties.md +654 -0
- package/skills/purgetss/references/custom-rules.md +161 -0
- package/skills/purgetss/references/customization-deep-dive.md +722 -0
- package/skills/purgetss/references/dynamic-component-creation.md +489 -0
- package/skills/purgetss/references/grid-layout.md +455 -0
- package/skills/purgetss/references/icon-fonts.md +609 -0
- package/skills/purgetss/references/installation-setup.md +366 -0
- package/skills/purgetss/references/opacity-modifier.md +291 -0
- package/skills/purgetss/references/platform-modifiers.md +479 -0
- package/skills/purgetss/references/smart-mappings.md +42 -0
- package/skills/purgetss/references/titanium-resets.md +359 -0
- package/skills/purgetss/references/ui-ux-design.md +1526 -0
- package/skills/ti-guides/SKILL.md +94 -0
- package/skills/ti-guides/references/advanced-data-and-images.md +19 -0
- package/skills/ti-guides/references/alloy-cli-advanced.md +84 -0
- package/skills/ti-guides/references/alloy-data-mastery.md +29 -0
- package/skills/ti-guides/references/alloy-widgets-and-themes.md +19 -0
- package/skills/ti-guides/references/android-manifest.md +97 -0
- package/skills/ti-guides/references/app-distribution.md +258 -0
- package/skills/ti-guides/references/application-frameworks.md +377 -0
- package/skills/ti-guides/references/cli-reference.md +402 -0
- package/skills/ti-guides/references/coding-best-practices.md +102 -0
- package/skills/ti-guides/references/commonjs-advanced.md +134 -0
- package/skills/ti-guides/references/hello-world.md +100 -0
- package/skills/ti-guides/references/hyperloop-native-access.md +62 -0
- package/skills/ti-guides/references/javascript-primer.md +411 -0
- package/skills/ti-guides/references/reserved-words.md +36 -0
- package/skills/ti-guides/references/resources.md +183 -0
- package/skills/ti-guides/references/style-and-conventions.md +48 -0
- package/skills/ti-guides/references/tiapp-config.md +609 -0
- package/skills/ti-howtos/SKILL.md +174 -0
- package/skills/ti-howtos/references/android-platform-deep-dives.md +658 -0
- package/skills/ti-howtos/references/automation-fastlane-appium.md +95 -0
- package/skills/ti-howtos/references/buffer-codec-streams.md +140 -0
- package/skills/ti-howtos/references/cross-platform-development.md +348 -0
- package/skills/ti-howtos/references/debugging-profiling.md +543 -0
- package/skills/ti-howtos/references/extending-titanium.md +723 -0
- package/skills/ti-howtos/references/google-maps-v2.md +169 -0
- package/skills/ti-howtos/references/ios-map-kit.md +143 -0
- package/skills/ti-howtos/references/ios-platform-deep-dives.md +783 -0
- package/skills/ti-howtos/references/local-data-sources.md +301 -0
- package/skills/ti-howtos/references/location-and-maps.md +252 -0
- package/skills/ti-howtos/references/media-apis.md +210 -0
- package/skills/ti-howtos/references/notification-services.md +599 -0
- package/skills/ti-howtos/references/remote-data-sources.md +349 -0
- package/skills/ti-howtos/references/tutorials.md +502 -0
- package/skills/ti-howtos/references/using-modules.md +237 -0
- package/skills/ti-howtos/references/web-content-integration.md +307 -0
- package/skills/ti-howtos/references/webpack-build-pipeline.md +78 -0
- package/skills/ti-ui/SKILL.md +179 -0
- package/skills/ti-ui/references/accessibility-deep-dive.md +242 -0
- package/skills/ti-ui/references/animation-and-matrices.md +599 -0
- package/skills/ti-ui/references/application-structures.md +655 -0
- package/skills/ti-ui/references/custom-fonts-styling.md +579 -0
- package/skills/ti-ui/references/event-handling.md +393 -0
- package/skills/ti-ui/references/gestures.md +473 -0
- package/skills/ti-ui/references/icons-and-splash-screens.md +409 -0
- package/skills/ti-ui/references/layouts-and-positioning.md +462 -0
- package/skills/ti-ui/references/listviews-and-performance.md +619 -0
- package/skills/ti-ui/references/orientation.md +362 -0
- package/skills/ti-ui/references/platform-ui-android.md +635 -0
- package/skills/ti-ui/references/platform-ui-ios.md +469 -0
- package/skills/ti-ui/references/scrolling-views.md +252 -0
- package/skills/ti-ui/references/tableviews.md +568 -0
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
# PurgeTSS Installation & Setup
|
|
2
|
+
|
|
3
|
+
PurgeTSS must be installed globally and initialized within each Titanium Alloy project to enable its utility-first workflow.
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
|
|
7
|
+
- [PurgeTSS Installation \& Setup](#purgetss-installation--setup)
|
|
8
|
+
- [Table of Contents](#table-of-contents)
|
|
9
|
+
- [Prerequisites](#prerequisites)
|
|
10
|
+
- [Global Installation](#global-installation)
|
|
11
|
+
- [Initial Project Setup](#initial-project-setup)
|
|
12
|
+
- [Running PurgeTSS for the First Time](#running-purgetss-for-the-first-time)
|
|
13
|
+
- [What Happens on First Run](#what-happens-on-first-run)
|
|
14
|
+
- [1. Auto-Run Hook Setup](#1-auto-run-hook-setup)
|
|
15
|
+
- [2. purgetss Folder Structure](#2-purgetss-folder-structure)
|
|
16
|
+
- [3. app.tss Backup](#3-apptss-backup)
|
|
17
|
+
- [Creating a Fresh config.cjs](#creating-a-fresh-configcjs)
|
|
18
|
+
- [Visual Studio Code Integration](#visual-studio-code-integration)
|
|
19
|
+
- [Quick Setup with install-dependencies](#quick-setup-with-install-dependencies)
|
|
20
|
+
- [Manual Extension Setup](#manual-extension-setup)
|
|
21
|
+
- [Extension Configuration](#extension-configuration)
|
|
22
|
+
- [Tailwind Config for VS Code](#tailwind-config-for-vs-code)
|
|
23
|
+
- [LiveView Development](#liveview-development)
|
|
24
|
+
- [Enabling LiveView](#enabling-liveview)
|
|
25
|
+
- [LiveView with TiKit Components](#liveview-with-tikit-components)
|
|
26
|
+
- [LiveView Development Workflow](#liveview-development-workflow)
|
|
27
|
+
- [Common LiveView Issues](#common-liveview-issues)
|
|
28
|
+
- [First Run Example](#first-run-example)
|
|
29
|
+
- [Quick Start with Example Files](#quick-start-with-example-files)
|
|
30
|
+
- [Troubleshooting](#troubleshooting)
|
|
31
|
+
- [PurgeTSS Not Running on Compile](#purgetss-not-running-on-compile)
|
|
32
|
+
- [Classes Not Appearing in IntelliSense](#classes-not-appearing-in-intellisense)
|
|
33
|
+
- [Missing Classes Report](#missing-classes-report)
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Prerequisites
|
|
38
|
+
|
|
39
|
+
:::caution Node.js 20+ Required
|
|
40
|
+
PurgeTSS has been thoroughly tested and proven to be compatible with Node 20.0.0 or higher.
|
|
41
|
+
:::
|
|
42
|
+
|
|
43
|
+
## Global Installation
|
|
44
|
+
|
|
45
|
+
Install PurgeTSS globally on your machine using NPM:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
[sudo] npm install -g purgetss
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
:::info
|
|
52
|
+
On macOS/Linux systems, you may need to use `sudo` for global NPM installations. On Windows, run your terminal as Administrator if needed.
|
|
53
|
+
:::
|
|
54
|
+
|
|
55
|
+
## Initial Project Setup
|
|
56
|
+
|
|
57
|
+
:::info
|
|
58
|
+
**You only need to execute `purgetss` once within your project to automatically generate the required files and folders.**
|
|
59
|
+
|
|
60
|
+
Subsequently, whenever you build your application, **PurgeTSS** will parse all your XML files and generate a clean `app.tss` file containing only the classes used in your project.
|
|
61
|
+
:::
|
|
62
|
+
|
|
63
|
+
### Running PurgeTSS for the First Time
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
cd /path/to/your/alloy/project
|
|
67
|
+
purgetss
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### What Happens on First Run
|
|
71
|
+
|
|
72
|
+
When you run `purgetss` for the first time in your project, it will perform the following tasks:
|
|
73
|
+
|
|
74
|
+
#### 1. Auto-Run Hook Setup
|
|
75
|
+
|
|
76
|
+
**PurgeTSS** adds a task in `alloy.jmk` to auto-run `purgetss` every time you compile your app.
|
|
77
|
+
|
|
78
|
+
**This is especially useful when using `liveview`** - changes to XML files are automatically reflected in your app.
|
|
79
|
+
|
|
80
|
+
Your `alloy.jmk` will contain:
|
|
81
|
+
|
|
82
|
+
```javascript
|
|
83
|
+
task('pre:compile', function(event, logger) {
|
|
84
|
+
require('child_process').execSync('purgetss', logger.warn('::PurgeTSS:: Auto-Purging ' + event.dir.project));
|
|
85
|
+
})
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
#### 2. purgetss Folder Structure
|
|
89
|
+
|
|
90
|
+
PurgeTSS creates a `purgetss` folder at the root of your project:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
./purgetss
|
|
94
|
+
├─ fonts/ # Place custom font files (.ttf, .otf) here
|
|
95
|
+
├─ styles/
|
|
96
|
+
│ ├─ definitions.css # Used for VS Code IntelliSense
|
|
97
|
+
│ └─ utilities.tss # All PurgeTSS utility classes
|
|
98
|
+
└─ config.cjs # Your project's theme configuration
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
**File descriptions:**
|
|
102
|
+
|
|
103
|
+
- **`config.cjs`**: Where you customize colors, spacing, fonts, border radius, and add custom rules for Ti Elements
|
|
104
|
+
- **`styles/utilities.tss`**: All Tailwind-like utility classes + any custom classes from `config.cjs`
|
|
105
|
+
- **`styles/definitions.css`**: Special CSS file incorporating ALL classes from `utilities.tss`, `_app.tss`, remaining `.tss` files, and `fonts.tss`. Used by VS Code extension for IntelliSense
|
|
106
|
+
- **`fonts/`**: Directory for custom fonts (Icon, Serif, Sans-Serif, Cursive, Fantasy, Monospace). Use `purgetss build-fonts` after adding fonts
|
|
107
|
+
|
|
108
|
+
#### 3. app.tss Backup
|
|
109
|
+
|
|
110
|
+
:::caution IMPORTANT NOTICE!!!
|
|
111
|
+
**PurgeTSS will OVERWRITE your existing `app.tss` file.**
|
|
112
|
+
|
|
113
|
+
Upon the initial execution of **PurgeTSS**, your `app.tss` file is backed up to `_app.tss`.
|
|
114
|
+
|
|
115
|
+
From this point forward, you have the option to add, delete, or update your custom classes in `_app.tss`.
|
|
116
|
+
|
|
117
|
+
Alternatively, a better approach is to include your custom values in `config.cjs`.
|
|
118
|
+
:::
|
|
119
|
+
|
|
120
|
+
Every time `purgetss` runs, it copies the content of `_app.tss` to `app.tss` (if it exists).
|
|
121
|
+
|
|
122
|
+
## Creating a Fresh config.cjs
|
|
123
|
+
|
|
124
|
+
If you need to start with a fresh `config.cjs` file, delete the existing one and run:
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
purgetss init
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
This will create a minimal `./purgetss/config.cjs`:
|
|
131
|
+
|
|
132
|
+
```javascript
|
|
133
|
+
module.exports = {
|
|
134
|
+
purge: {
|
|
135
|
+
mode: 'all',
|
|
136
|
+
method: 'sync', // How to execute the auto-purging task: sync or async
|
|
137
|
+
|
|
138
|
+
// These options are passed directly to PurgeTSS
|
|
139
|
+
options: {
|
|
140
|
+
missing: true, // Reports missing classes
|
|
141
|
+
widgets: false, // Purges widgets too
|
|
142
|
+
safelist: [], // Array of classes to keep
|
|
143
|
+
plugins: [] // Array of properties to ignore
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
theme: {
|
|
147
|
+
extend: {}
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
:::info
|
|
153
|
+
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.
|
|
154
|
+
:::
|
|
155
|
+
|
|
156
|
+
## Visual Studio Code Integration
|
|
157
|
+
|
|
158
|
+
For the best development experience with PurgeTSS, we recommend installing and configuring the following VS Code extensions.
|
|
159
|
+
|
|
160
|
+
### Quick Setup with install-dependencies
|
|
161
|
+
|
|
162
|
+
The fastest way to set up VS Code integration is to use the `install-dependencies` command:
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
purgetss install-dependencies
|
|
166
|
+
# or
|
|
167
|
+
purgetss id
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
This command automatically installs and configures:
|
|
171
|
+
- ESLint with Titanium-specific rules
|
|
172
|
+
- Tailwind CSS (for IntelliSense integration)
|
|
173
|
+
- VS Code settings and recommended extensions
|
|
174
|
+
- Configuration files (`.editorconfig`, `eslint.config.js`, `tailwind.config.js`, `.vscode/extensions.json`, `.vscode/settings.json`)
|
|
175
|
+
|
|
176
|
+
:::caution
|
|
177
|
+
This command will overwrite existing `extensions.json` and `settings.json` files. Create a backup if you want to preserve them.
|
|
178
|
+
:::
|
|
179
|
+
|
|
180
|
+
### Manual Extension Setup
|
|
181
|
+
|
|
182
|
+
If you prefer manual setup, install these extensions:
|
|
183
|
+
|
|
184
|
+
1. **[XML Tools](https://marketplace.visualstudio.com/items?itemName=DotJoshJohnson.xml)** - For XML formatting
|
|
185
|
+
2. **[ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)** - Code quality and consistency
|
|
186
|
+
3. **[Tailwind CSS IntelliSense](https://marketplace.visualstudio.com/items?itemName=bradlc.vscode-tailwindcss)** - Intelligent PurgeTSS class support
|
|
187
|
+
4. **[Tailwind RAW Reorder](https://marketplace.visualstudio.com/items?itemName=KevinYouu.tailwind-raw-reorder-tw4)** - Opinionated class sorter for better readability
|
|
188
|
+
5. **[IntelliSense for CSS class names in HTML](https://marketplace.visualstudio.com/items?itemName=Zignd.html-css-class-completion)** - Class name completion based on your PurgeTSS definitions
|
|
189
|
+
|
|
190
|
+
### Extension Configuration
|
|
191
|
+
|
|
192
|
+
Add this to your VS Code `settings.json`:
|
|
193
|
+
|
|
194
|
+
```json
|
|
195
|
+
{
|
|
196
|
+
"html-css-class-completion.HTMLLanguages": [
|
|
197
|
+
"html",
|
|
198
|
+
"vue",
|
|
199
|
+
"razor",
|
|
200
|
+
"blade",
|
|
201
|
+
"handlebars",
|
|
202
|
+
"twig",
|
|
203
|
+
"django-html",
|
|
204
|
+
"php",
|
|
205
|
+
"markdown",
|
|
206
|
+
"erb",
|
|
207
|
+
"ejs",
|
|
208
|
+
"svelte",
|
|
209
|
+
"xml"
|
|
210
|
+
],
|
|
211
|
+
"html-css-class-completion.excludeGlobPattern": "**/node_modules/**,purgetss/fonts/**/*.{css,html}"
|
|
212
|
+
}
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
This enables:
|
|
216
|
+
- Class name completion in XML files
|
|
217
|
+
- Exclusion of generated files from caching
|
|
218
|
+
- IntelliSense based on your actual PurgeTSS configuration
|
|
219
|
+
|
|
220
|
+
### Tailwind Config for VS Code
|
|
221
|
+
|
|
222
|
+
Create or update `tailwind.config.js` at your project root for optimal IntelliSense:
|
|
223
|
+
|
|
224
|
+
```javascript
|
|
225
|
+
/** @type {import('tailwindcss').Config} */
|
|
226
|
+
module.exports = {
|
|
227
|
+
content: [
|
|
228
|
+
"./app/views/**/*.xml",
|
|
229
|
+
"./purgetss/**/*.cjs"
|
|
230
|
+
],
|
|
231
|
+
theme: {
|
|
232
|
+
extend: {}
|
|
233
|
+
},
|
|
234
|
+
plugins: []
|
|
235
|
+
}
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
This helps Tailwind CSS IntelliSense understand your project structure.
|
|
239
|
+
|
|
240
|
+
## LiveView Development
|
|
241
|
+
|
|
242
|
+
:::tip
|
|
243
|
+
We recommend using `liveview` to speed up testing and development time. **LiveView provides instant feedback** when you make changes to your XML files or styles.
|
|
244
|
+
:::
|
|
245
|
+
|
|
246
|
+
### Enabling LiveView
|
|
247
|
+
|
|
248
|
+
LiveView is typically enabled through Titanium's development tools. When using LiveView with PurgeTSS:
|
|
249
|
+
|
|
250
|
+
1. **Auto-purge is automatically enabled** when you run `purgetss`
|
|
251
|
+
2. Changes to XML files trigger auto-purge on next compile
|
|
252
|
+
3. LiveView reloads your app with the new styles
|
|
253
|
+
|
|
254
|
+
### LiveView with TiKit Components
|
|
255
|
+
|
|
256
|
+
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` in `config.cjs`:
|
|
257
|
+
|
|
258
|
+
```javascript
|
|
259
|
+
module.exports = {
|
|
260
|
+
purge: {
|
|
261
|
+
mode: 'all',
|
|
262
|
+
method: 'async' // Use async for LiveView + TiKit compatibility
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
### LiveView Development Workflow
|
|
268
|
+
|
|
269
|
+
**Optimal workflow with LiveView:**
|
|
270
|
+
|
|
271
|
+
1. **Enable auto-purge** (done automatically by `purgetss`)
|
|
272
|
+
2. **Set method to 'async'** if using TiKit Components
|
|
273
|
+
3. **Make changes to XML or config.cjs**
|
|
274
|
+
4. **Save file** (triggers auto-compile)
|
|
275
|
+
5. **LiveView automatically reflects changes**
|
|
276
|
+
|
|
277
|
+
**Example workflow:**
|
|
278
|
+
```bash
|
|
279
|
+
# Terminal 1: Run LiveView
|
|
280
|
+
appc run --liveview
|
|
281
|
+
|
|
282
|
+
# Terminal 2: Make changes
|
|
283
|
+
# Edit app/views/index.xml
|
|
284
|
+
# Save file - LiveView auto-reloads with new styles
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
### Common LiveView Issues
|
|
288
|
+
|
|
289
|
+
**Problem:** Styles not updating in LiveView
|
|
290
|
+
|
|
291
|
+
**Solutions:**
|
|
292
|
+
1. Verify `alloy.jmk` has the pre:compile task
|
|
293
|
+
2. Try `method: 'async'` in `config.cjs`
|
|
294
|
+
3. Ensure `purgetss` ran successfully (check console output)
|
|
295
|
+
4. Manually trigger compile if auto-compile isn't working
|
|
296
|
+
|
|
297
|
+
**Problem:** Changes to `config.cjs` not reflected
|
|
298
|
+
|
|
299
|
+
**Solutions:**
|
|
300
|
+
1. Run `purgetss build` manually after config changes
|
|
301
|
+
2. Check that `utilities.tss` was regenerated
|
|
302
|
+
3. Verify your config syntax is correct (no trailing commas, etc.)
|
|
303
|
+
|
|
304
|
+
## First Run Example
|
|
305
|
+
|
|
306
|
+
After running `purgetss`, here's what your generated `app.tss` will look like:
|
|
307
|
+
|
|
308
|
+
```tss
|
|
309
|
+
/* PurgeTSS v7.2.7 */
|
|
310
|
+
/* Created by César Estrada */
|
|
311
|
+
/* https://purgetss.com */
|
|
312
|
+
|
|
313
|
+
/* _app.tss styles */
|
|
314
|
+
'.my-custom-class': {
|
|
315
|
+
backgroundColor: '#002359'
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
/* Ti Elements */
|
|
319
|
+
'ImageView[platform=ios]': { hires: true }
|
|
320
|
+
'View': { width: Ti.UI.SIZE, height: Ti.UI.SIZE }
|
|
321
|
+
'Window': { backgroundColor: '#FFFFFF' }
|
|
322
|
+
|
|
323
|
+
/* Main Styles */
|
|
324
|
+
'.bg-white': { backgroundColor: '#ffffff' }
|
|
325
|
+
'.font-semibold': { font: { fontWeight: 'semibold' } }
|
|
326
|
+
'.h-16': { height: 64 }
|
|
327
|
+
'.h-auto': { height: Ti.UI.SIZE }
|
|
328
|
+
'.horizontal': { layout: 'horizontal' }
|
|
329
|
+
// ... all other classes used in your XML files
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
:::info
|
|
333
|
+
After running `purgetss`, you will have a new `app.tss` file with only the classes used in the XML files. Your original `app.tss` file is backed up in `_app.tss`. You can use this file to add, delete, or update any of your original styles. Every time `purgetss` runs, it will copy the content of `_app.tss` to `app.tss`.
|
|
334
|
+
:::
|
|
335
|
+
|
|
336
|
+
## Quick Start with Example Files
|
|
337
|
+
|
|
338
|
+
PurgeTSS includes example files to get you started:
|
|
339
|
+
|
|
340
|
+
1. Copy the content of `index.xml` into a new Alloy project
|
|
341
|
+
2. Install Font Awesome: `purgetss icon-library --vendor=fontawesome`
|
|
342
|
+
3. Run `purgetss` once to generate necessary files
|
|
343
|
+
4. Compile your app as usual
|
|
344
|
+
5. Use `liveview` for faster iteration
|
|
345
|
+
|
|
346
|
+
For more examples, see the [Tailwind TSS Sample App](https://github.com/macCesar/utilities.tss-sample-app).
|
|
347
|
+
|
|
348
|
+
## Troubleshooting
|
|
349
|
+
|
|
350
|
+
### PurgeTSS Not Running on Compile
|
|
351
|
+
|
|
352
|
+
Check that `alloy.jmk` exists in your project root and contains the pre:compile task. If missing, run `purgetss` again.
|
|
353
|
+
|
|
354
|
+
### Classes Not Appearing in IntelliSense
|
|
355
|
+
|
|
356
|
+
1. Ensure `definitions.css` is being generated (check `purgetss/styles/definitions.css`)
|
|
357
|
+
2. Verify VS Code extension is installed and configured
|
|
358
|
+
3. Try reloading VS Code after running `purgetss`
|
|
359
|
+
|
|
360
|
+
### Missing Classes Report
|
|
361
|
+
|
|
362
|
+
If `purge.options.missing` is set to `true`, check the end of your `app.tss` file for a list of missing or misspelled classes.
|
|
363
|
+
|
|
364
|
+
:::info
|
|
365
|
+
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.
|
|
366
|
+
:::
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
# Opacity Modifier
|
|
2
|
+
|
|
3
|
+
The opacity modifier allows you to add transparency to **ANY color property** by appending an opacity value between 0 and 100, separated by a slash (`/`).
|
|
4
|
+
|
|
5
|
+
:::info
|
|
6
|
+
You can add an **opacity modifier to ANY of the available color properties** by adding an **opacity value** between 0 and 100 to the end of the color name separated by a slash ( / ).
|
|
7
|
+
:::
|
|
8
|
+
|
|
9
|
+
## Table of Contents
|
|
10
|
+
|
|
11
|
+
- [Opacity Modifier](#opacity-modifier)
|
|
12
|
+
- [Table of Contents](#table-of-contents)
|
|
13
|
+
- [Basic Syntax](#basic-syntax)
|
|
14
|
+
- [How It Works](#how-it-works)
|
|
15
|
+
- [Usage in XML](#usage-in-xml)
|
|
16
|
+
- [Background Colors](#background-colors)
|
|
17
|
+
- [Text Colors](#text-colors)
|
|
18
|
+
- [Border Colors](#border-colors)
|
|
19
|
+
- [All Color Properties](#all-color-properties)
|
|
20
|
+
- [Usage with `@apply` Directive](#usage-with-apply-directive)
|
|
21
|
+
- [Complete List of Supported Color Properties](#complete-list-of-supported-color-properties)
|
|
22
|
+
- [Background Properties](#background-properties)
|
|
23
|
+
- [Text Properties](#text-properties)
|
|
24
|
+
- [Border Properties](#border-properties)
|
|
25
|
+
- [UI Element Properties](#ui-element-properties)
|
|
26
|
+
- [Navigation Properties](#navigation-properties)
|
|
27
|
+
- [Indicator Properties](#indicator-properties)
|
|
28
|
+
- [Tint Properties](#tint-properties)
|
|
29
|
+
- [Miscellaneous Properties](#miscellaneous-properties)
|
|
30
|
+
- [Opacity Value Reference](#opacity-value-reference)
|
|
31
|
+
- [Common Patterns](#common-patterns)
|
|
32
|
+
- [Hover/Active States](#hoveractive-states)
|
|
33
|
+
- [Disabled Appearance](#disabled-appearance)
|
|
34
|
+
- [Overlay/Backdrop](#overlaybackdrop)
|
|
35
|
+
- [Glassmorphism Effect](#glassmorphism-effect)
|
|
36
|
+
- [Gradient Fades](#gradient-fades)
|
|
37
|
+
- [Limitations](#limitations)
|
|
38
|
+
- [Performance Considerations](#performance-considerations)
|
|
39
|
+
- [Combining with Arbitrary Colors](#combining-with-arbitrary-colors)
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Basic Syntax
|
|
44
|
+
|
|
45
|
+
```xml
|
|
46
|
+
<Label class="bg-blue-500/50 text-purple-900/75" />
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
The opacity value (0-100) is converted to a decimal (0.0-1.0) and applied as an 8-digit hex color with alpha channel.
|
|
50
|
+
|
|
51
|
+
## How It Works
|
|
52
|
+
|
|
53
|
+
Given `bg-blue-500/50`:
|
|
54
|
+
- `blue-500` = `#3b82f6` (RGB: 59, 130, 246)
|
|
55
|
+
- Opacity 50% = `0x80` (hex) = `128` (decimal)
|
|
56
|
+
- Result: `#803b82f6` (80% of the way to transparent)
|
|
57
|
+
|
|
58
|
+
## Usage in XML
|
|
59
|
+
|
|
60
|
+
### Background Colors
|
|
61
|
+
|
|
62
|
+
```xml
|
|
63
|
+
<!-- Semi-transparent backgrounds -->
|
|
64
|
+
<View class="bg-red-500/25" /> <!-- 25% opacity -->
|
|
65
|
+
<View class="bg-green-500/50" /> <!-- 50% opacity -->
|
|
66
|
+
<View class="bg-blue-500/75" /> <!-- 75% opacity -->
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Text Colors
|
|
70
|
+
|
|
71
|
+
```xml
|
|
72
|
+
<Label class="text-gray-900/50" text="Faded text" />
|
|
73
|
+
<Label class="text-brand-600/80" text="Mostly opaque" />
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Border Colors
|
|
77
|
+
|
|
78
|
+
```xml
|
|
79
|
+
<View class="border-2 border-purple-500/30" />
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### All Color Properties
|
|
83
|
+
|
|
84
|
+
```xml
|
|
85
|
+
<Window class="bg-indigo-500/20">
|
|
86
|
+
<View class="border-(#ff0000)/50 shadow-(#000)/30">
|
|
87
|
+
<Label class="text-white/90 placeholder-gray-400/50" />
|
|
88
|
+
</View>
|
|
89
|
+
</Window>
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Usage with `@apply` Directive
|
|
93
|
+
|
|
94
|
+
You can also use color opacity modifiers in the `apply` directive in `config.cjs`:
|
|
95
|
+
|
|
96
|
+
```javascript
|
|
97
|
+
module.exports = {
|
|
98
|
+
theme: {
|
|
99
|
+
extend: {
|
|
100
|
+
colors: {
|
|
101
|
+
primary: '#ce10cc'
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
'.main-banner': {
|
|
105
|
+
apply: [
|
|
106
|
+
'bg-primary/35',
|
|
107
|
+
'border-primary/75'
|
|
108
|
+
]
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
**Generated classes:**
|
|
115
|
+
```tss
|
|
116
|
+
/* Custom Styles */
|
|
117
|
+
'.main-banner': { backgroundColor: '#59ce10cc', borderColor: '#bfce10cc' }
|
|
118
|
+
|
|
119
|
+
/* Color Properties */
|
|
120
|
+
'.bg-primary': { backgroundColor: '#ce10cc' }
|
|
121
|
+
'.bg-primary/35': { backgroundColor: '#59ce10cc' }
|
|
122
|
+
'.border-primary': { borderColor: '#ce10cc' }
|
|
123
|
+
'.border-primary/75': { borderColor: '#bfce10cc' }
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Complete List of Supported Color Properties
|
|
127
|
+
|
|
128
|
+
The opacity modifier works with **ALL** color properties:
|
|
129
|
+
|
|
130
|
+
### Background Properties
|
|
131
|
+
- `bg-*` - backgroundColor
|
|
132
|
+
- `bg-focused-*` - backgroundFocusedColor
|
|
133
|
+
- `bg-selected-*` - backgroundSelectedColor
|
|
134
|
+
- `from-*` - backgroundGradient (start)
|
|
135
|
+
- `to-*` - backgroundGradient (end)
|
|
136
|
+
|
|
137
|
+
### Text Properties
|
|
138
|
+
- `text-*` - color / textColor
|
|
139
|
+
- `title-*` - titleColor / titleTextColor
|
|
140
|
+
- `subtitle-*` - subtitleColor / subtitleTextColor
|
|
141
|
+
- `placeholder-*` - hintTextColor
|
|
142
|
+
|
|
143
|
+
### Border Properties
|
|
144
|
+
- `border-*` - borderColor
|
|
145
|
+
- `separator-*` - separatorColor
|
|
146
|
+
- `bar-*` - barColor
|
|
147
|
+
|
|
148
|
+
### UI Element Properties
|
|
149
|
+
- `badge-*` - badgeColor
|
|
150
|
+
- `disabled-*` - disabledColor
|
|
151
|
+
- `highlighted-*` - highlightedColor
|
|
152
|
+
- `selected-*` - selectedColor
|
|
153
|
+
- `selected-button-*` - selectedButtonColor
|
|
154
|
+
- `selected-subtitle-*` - selectedSubtitleColor
|
|
155
|
+
- `selected-text-*` - selectedTextColor
|
|
156
|
+
|
|
157
|
+
### Navigation Properties
|
|
158
|
+
- `nav-tint-*` - navTintColor
|
|
159
|
+
- `active-tint-*` - activeTintColor
|
|
160
|
+
- `on-tint-*` - onTintColor
|
|
161
|
+
- `thumb-tint-*` - thumbTintColor
|
|
162
|
+
- `track-tint-*` - trackTintColor
|
|
163
|
+
|
|
164
|
+
### Indicator Properties
|
|
165
|
+
- `indicator-*` - indicatorColor
|
|
166
|
+
- `current-page-indicator-*` - currentPageIndicatorColor
|
|
167
|
+
- `page-indicator-*` - pageIndicatorColor
|
|
168
|
+
- `paging-control-*` - pagingControlColor
|
|
169
|
+
|
|
170
|
+
### Tint Properties
|
|
171
|
+
- `tint-*` - tintColor
|
|
172
|
+
- `shadow-*` - shadowColor / viewShadowColor
|
|
173
|
+
- `drop-shadow-*` - dropShadow color
|
|
174
|
+
|
|
175
|
+
### Miscellaneous Properties
|
|
176
|
+
- `active-title-*` - activeTitleColor
|
|
177
|
+
- `date-time-*` - dateTimeColor
|
|
178
|
+
- `image-touch-feedback-*` - imageTouchFeedbackColor
|
|
179
|
+
- `keyboard-toolbar-*` - keyboardToolbarColor
|
|
180
|
+
- `light-*` - lightColor
|
|
181
|
+
- `navigation-icon-*` - navigationIconColor
|
|
182
|
+
- `pull-bg-*` - pullBackgroundColor
|
|
183
|
+
- `results-bg-*` - resultsBackgroundColor
|
|
184
|
+
- `results-separator-*` - resultsSeparatorColor
|
|
185
|
+
- `tabs-bg-*` - tabsBackgroundColor
|
|
186
|
+
- `tabs-bg-selected-*` - tabsBackgroundSelectedColor
|
|
187
|
+
- `title-attributes-*` - titleAttributes color
|
|
188
|
+
- `title-attributes-shadow-*` - titleAttributes shadow color
|
|
189
|
+
- `touch-feedback-*` - touchFeedbackColor
|
|
190
|
+
|
|
191
|
+
## Opacity Value Reference
|
|
192
|
+
|
|
193
|
+
| Opacity Value | Decimal | Hex Alpha | Result |
|
|
194
|
+
| ------------- | ------- | --------- | ----------------- |
|
|
195
|
+
| `/0` | 0.00 | `00` | Fully transparent |
|
|
196
|
+
| `/10` | 0.10 | `1A` | 10% visible |
|
|
197
|
+
| `/20` | 0.20 | `33` | 20% visible |
|
|
198
|
+
| `/25` | 0.25 | `40` | 25% visible |
|
|
199
|
+
| `/30` | 0.30 | `4D` | 30% visible |
|
|
200
|
+
| `/40` | 0.40 | `66` | 40% visible |
|
|
201
|
+
| `/50` | 0.50 | `80` | 50% visible |
|
|
202
|
+
| `/60` | 0.60 | `99` | 60% visible |
|
|
203
|
+
| `/70` | 0.70 | `B3` | 70% visible |
|
|
204
|
+
| `/75` | 0.75 | `BF` | 75% visible |
|
|
205
|
+
| `/80` | 0.80 | `CC` | 80% visible |
|
|
206
|
+
| `/90` | 0.90 | `E6` | 90% visible |
|
|
207
|
+
| `/95` | 0.95 | `F2` | 95% visible |
|
|
208
|
+
| `/100` | 1.00 | `FF` | Fully opaque |
|
|
209
|
+
|
|
210
|
+
## Common Patterns
|
|
211
|
+
|
|
212
|
+
### Hover/Active States
|
|
213
|
+
|
|
214
|
+
```xml
|
|
215
|
+
<Button class="bg-brand-500 active:bg-brand-600/80" />
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
### Disabled Appearance
|
|
219
|
+
|
|
220
|
+
```xml
|
|
221
|
+
<Label class="text-gray-800 disabled:text-gray-400/50" />
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
### Overlay/Backdrop
|
|
225
|
+
|
|
226
|
+
```xml
|
|
227
|
+
<!-- Semi-transparent overlay -->
|
|
228
|
+
<View class="absolute inset-0 bg-black/50" />
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
### Glassmorphism Effect
|
|
232
|
+
|
|
233
|
+
```xml
|
|
234
|
+
<View class="border-white/30 bg-white/20 backdrop-blur-md" />
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
### Gradient Fades
|
|
238
|
+
|
|
239
|
+
```xml
|
|
240
|
+
<View class="from-brand-500/100 to-brand-500/0" />
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
## Limitations
|
|
244
|
+
|
|
245
|
+
:::caution Semantic Colors Cannot Use Opacity Modifier
|
|
246
|
+
|
|
247
|
+
Semantic colors (defined as objects with light/dark values) cannot be modified with the opacity modifier because they are defined as an object with light and dark values, not as a single color value.
|
|
248
|
+
|
|
249
|
+
**This won't work:**
|
|
250
|
+
```javascript
|
|
251
|
+
// In config.cjs
|
|
252
|
+
colors: {
|
|
253
|
+
semantic: {
|
|
254
|
+
light: '#ffffff',
|
|
255
|
+
dark: '#000000'
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
```xml
|
|
261
|
+
<!-- This will NOT work -->
|
|
262
|
+
<View class="bg-semantic/50" />
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
**Solution:** Use standard color scales instead:
|
|
266
|
+
```javascript
|
|
267
|
+
colors: {
|
|
268
|
+
semantic: '#888888'
|
|
269
|
+
}
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
```xml
|
|
273
|
+
<!-- This WILL work -->
|
|
274
|
+
<View class="bg-semantic/50" />
|
|
275
|
+
```
|
|
276
|
+
:::
|
|
277
|
+
|
|
278
|
+
## Performance Considerations
|
|
279
|
+
|
|
280
|
+
Using opacity modifiers is as performant as regular color classes since the conversion happens at build time, not runtime. The generated `app.tss` contains the final hex values with alpha channels.
|
|
281
|
+
|
|
282
|
+
## Combining with Arbitrary Colors
|
|
283
|
+
|
|
284
|
+
You can combine opacity modifiers with arbitrary color values:
|
|
285
|
+
|
|
286
|
+
```xml
|
|
287
|
+
<View class="bg-(#4C61E4)/50" />
|
|
288
|
+
<Label class="text-(rgba(255,0,0,0.5))" />
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
Note: When using `rgba()` directly, the opacity modifier is redundant since `rgba()` already includes alpha.
|