@maccesar/titools 2.8.0 → 2.9.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/package.json +1 -1
- package/skills/purgetss/SKILL.md +25 -0
- package/skills/purgetss/references/EXAMPLES.md +86 -24
- package/skills/purgetss/references/app-branding.md +412 -0
- package/skills/purgetss/references/appearance-module.md +161 -0
- package/skills/purgetss/references/apply-directive.md +87 -31
- package/skills/purgetss/references/arbitrary-values.md +4 -0
- package/skills/purgetss/references/class-categories.md +10 -7
- package/skills/purgetss/references/class-index.md +25 -18
- package/skills/purgetss/references/cli-commands.md +219 -8
- package/skills/purgetss/references/configurable-properties.md +11 -7
- package/skills/purgetss/references/custom-rules.md +7 -3
- package/skills/purgetss/references/customization-deep-dive.md +52 -4
- package/skills/purgetss/references/dynamic-component-creation.md +29 -14
- package/skills/purgetss/references/grid-layout.md +20 -8
- package/skills/purgetss/references/icon-fonts.md +4 -0
- package/skills/purgetss/references/installation-setup.md +3 -8
- package/skills/purgetss/references/ios-large-titles.md +141 -0
- package/skills/purgetss/references/migration-guide.md +162 -25
- package/skills/purgetss/references/multi-density-images.md +363 -0
- package/skills/purgetss/references/opacity-modifier.md +4 -0
- package/skills/purgetss/references/performance-tips.md +5 -0
- package/skills/purgetss/references/platform-modifiers.md +4 -0
- package/skills/purgetss/references/semantic-colors.md +386 -0
- package/skills/purgetss/references/smart-mappings.md +50 -28
- package/skills/purgetss/references/tikit-components.md +3 -1
- package/skills/purgetss/references/titanium-resets.md +46 -15
- package/skills/purgetss/references/ui-ux-design.md +32 -6
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# PurgeTSS CLI Commands
|
|
2
2
|
|
|
3
|
-
> **Info: What's new in v7.
|
|
4
|
-
> -
|
|
5
|
-
> -
|
|
6
|
-
> - Titanium
|
|
7
|
-
> - **
|
|
8
|
-
> -
|
|
9
|
-
> -
|
|
3
|
+
> **Info: What's new in v7.5.3 / v7.6.0**
|
|
4
|
+
> - **New `brand` command (v7.6.0)** — generates the complete Titanium branding set (launcher icons, adaptive icons, iOS 18+ Dark/Tinted variants, marketplace artwork, optional notification/splash) from a single SVG or PNG logo. See [`brand` Command](#brand-command) and the deep-dive [app-branding.md](./app-branding.md).
|
|
5
|
+
> - **New `images` command (v7.6.0)** — generates multi-density UI images (Android `res-*` densities + iPhone `@1x`/`@2x`/`@3x` scales) from sources in `./purgetss/images/`. See [`images` Command](#images-command) and the deep-dive [multi-density-images.md](./multi-density-images.md).
|
|
6
|
+
> - **New `semantic` command (v7.6.0)** — generates Titanium semantic colors (Light/Dark) into `app/assets/semantic.colors.json` with two modes (tonal palette vs. single purpose-based color). See [`semantic` Command](#semantic-command) and the deep-dive [semantic-colors.md](./semantic-colors.md).
|
|
7
|
+
> - **`brand:` and `images:` config sections** auto-injected into `purgetss/config.cjs` on first run. Percentages may be written as quoted strings like `'15%'` or as plain numbers.
|
|
8
|
+
> - **Default font family classes (v7.5.3)** — `font-sans`, `font-serif`, and `font-mono` generated automatically with platform-appropriate values.
|
|
9
|
+
> - **XML validation (v7.5.3)** — detects illegal `--` sequences inside XML comments during pre-validation.
|
|
10
10
|
|
|
11
11
|
This page lists the commands available in PurgeTSS.
|
|
12
12
|
|
|
@@ -14,6 +14,8 @@ This page lists the commands available in PurgeTSS.
|
|
|
14
14
|
|
|
15
15
|
- `init`: Initializes PurgeTSS on an existing Alloy project.
|
|
16
16
|
- `create`: Creates a new Alloy project with PurgeTSS already set up.
|
|
17
|
+
- `brand`: Generates the Titanium branding set from a single logo. See [`brand` Command](#brand-command).
|
|
18
|
+
- `images`: Generates multi-density UI images from sources in `./purgetss/images/`. See [`images` Command](#images-command).
|
|
17
19
|
|
|
18
20
|
## Development Commands
|
|
19
21
|
|
|
@@ -28,6 +30,7 @@ This page lists the commands available in PurgeTSS.
|
|
|
28
30
|
## Utility Commands
|
|
29
31
|
|
|
30
32
|
- `shades`: Generates shades and tints for a color and writes the palette to `config.cjs`.
|
|
33
|
+
- `semantic`: Generates Titanium semantic colors (Light/Dark) into `app/assets/semantic.colors.json`. See [`semantic` Command](#semantic-command).
|
|
31
34
|
- `color-module`: Creates `./app/lib/purgetss.colors.js` with the colors defined in `config.cjs`.
|
|
32
35
|
- `module`: Installs `purgetss.ui.js` in the `lib` folder.
|
|
33
36
|
|
|
@@ -64,14 +67,30 @@ module.exports = {
|
|
|
64
67
|
plugins: [] // Array of properties to ignore
|
|
65
68
|
}
|
|
66
69
|
},
|
|
70
|
+
brand: {
|
|
71
|
+
splash: false, // also generate splash_icon.png × 5
|
|
72
|
+
padding: '15%', // Android safe-zone. Range: 12% tight (mature logos) — 20% conservative. Spec floor 19.44%.
|
|
73
|
+
iosPadding: '4%', // iOS aesthetic. Range: 2% bold — 8% conservative. No launcher mask.
|
|
74
|
+
darkBgColor: null, // opaque dark bg for DefaultIcon-Dark.png (null = transparent per Apple HIG)
|
|
75
|
+
bgColor: '#FFFFFF', // Android adaptive bg + iOS/marketplace flatten
|
|
76
|
+
notification: false, // also generate ic_stat_notify.png × 5
|
|
77
|
+
confirmOverwrites: true // prompt before overwriting files (set false to skip)
|
|
78
|
+
},
|
|
79
|
+
images: {
|
|
80
|
+
quality: 85, // JPEG/WebP/AVIF quality (0-100)
|
|
81
|
+
format: null, // null = keep original; 'webp' | 'jpeg' | 'png' to convert every image
|
|
82
|
+
confirmOverwrites: true // prompt before overwriting files (set false to skip)
|
|
83
|
+
},
|
|
67
84
|
theme: {
|
|
68
85
|
extend: {}
|
|
69
86
|
}
|
|
70
87
|
};
|
|
71
88
|
```
|
|
72
89
|
|
|
90
|
+
`init` also creates empty `purgetss/fonts/`, `purgetss/brand/`, and `purgetss/images/` folders so you can see where each kind of asset goes.
|
|
91
|
+
|
|
73
92
|
> **Tip**
|
|
74
|
-
> PurgeTSS looks for `./purgetss/config.cjs`. Each section is optional and can be customized. Missing sections use the default configuration.
|
|
93
|
+
> PurgeTSS looks for `./purgetss/config.cjs`. Each section is optional and can be customized. Missing sections use the default configuration. The `brand:` and `images:` sections are auto-injected into older configs on first run in v7.6.0+.
|
|
75
94
|
|
|
76
95
|
## `create` Command
|
|
77
96
|
|
|
@@ -143,6 +162,185 @@ Recommended VSCode extensions:
|
|
|
143
162
|
|
|
144
163
|
`purgetss create "Name of the Project" [--dependencies --vendor=fa,mi,ms,f7]` runs: `ti config` (reads idprefix/workspace), `ti create -t app -p all -n "Name"`, `alloy new`, `purgetss w`, `purgetss b`, optional `--vendor` (copies fonts + CommonJS module), optional `--dependencies` (installs Tailwind CSS, ESLint with Titanium plugins, and config files), then opens the project in VS Code, Sublime Text, or Finder.
|
|
145
164
|
|
|
165
|
+
## `brand` Command
|
|
166
|
+
|
|
167
|
+
Introduced in v7.6.0. Generates the complete Titanium branding set (launcher icons, adaptive icons, iOS 18+ Dark/Tinted variants, marketplace artwork, optional notification/splash icons) from a single logo image. Alloy and Classic projects are auto-detected.
|
|
168
|
+
|
|
169
|
+
> **Tip**
|
|
170
|
+
> This is a quick reference. See [app-branding.md](./app-branding.md) for the complete guide — workflow, padding guidance, Android dark mode, iOS 18+ variants, alpha channel handling, and troubleshooting.
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
purgetss brand # uses purgetss/brand/logo.{svg,png} + config
|
|
174
|
+
purgetss brand path/to/logo.svg # positional logo path override
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### Flags
|
|
178
|
+
|
|
179
|
+
| Flag | Purpose |
|
|
180
|
+
| --- | --- |
|
|
181
|
+
| `--project <path>` | Project root (defaults to cwd). |
|
|
182
|
+
| `--dry-run` | Preview what would be generated without writing any files. |
|
|
183
|
+
| `--output <dir>` | Stage into `<dir>` instead of writing in place. |
|
|
184
|
+
| `-y, --yes` | Skip the overwrite confirmation prompt for this invocation. |
|
|
185
|
+
| `--bg-color <hex>` | Background color for Android adaptive + iOS/marketplace flatten. |
|
|
186
|
+
| `--padding <n>` | Android safe-zone percentage (range `12-20`, default `15`). |
|
|
187
|
+
| `--ios-padding <n>` | iOS aesthetic padding percentage (range `2-8`, default `4`). |
|
|
188
|
+
| `--notification` | Also emit `ic_stat_notify.png × 5`. |
|
|
189
|
+
| `--splash` | Also emit `splash_icon.png × 5`. |
|
|
190
|
+
| `--monochrome-logo <path>` | Override `purgetss/brand/logo-mono.{svg,png}`. |
|
|
191
|
+
| `--dark-logo <path>` | Override `purgetss/brand/logo-dark.{svg,png}`. |
|
|
192
|
+
| `--dark-bg-color <hex>` | Opaque dark bg for `DefaultIcon-Dark.png` (default: transparent per Apple HIG). |
|
|
193
|
+
| `--tinted-logo <path>` | Override `purgetss/brand/logo-tinted.{svg,png}`. |
|
|
194
|
+
| `--no-dark` | Skip `DefaultIcon-Dark.png`. |
|
|
195
|
+
| `--no-tinted` | Skip `DefaultIcon-Tinted.png`. |
|
|
196
|
+
| `--cleanup-legacy` | Remove obsolete branding artifacts (reads `tiapp.xml` for safety rules). |
|
|
197
|
+
| `--aggressive` | With `--cleanup-legacy`, also remove `ldpi` density folders. |
|
|
198
|
+
| `--notes` | Print full `tiapp.xml` snippets + padding tuning guide. |
|
|
199
|
+
| `--debug` | Print extra diagnostics. |
|
|
200
|
+
|
|
201
|
+
### Positional argument
|
|
202
|
+
|
|
203
|
+
- `[logo-path]` (optional) — overrides auto-discovery of `purgetss/brand/logo.{svg,png}`.
|
|
204
|
+
|
|
205
|
+
### Config block
|
|
206
|
+
|
|
207
|
+
Defaults live under `brand:` in `purgetss/config.cjs` and are injected automatically:
|
|
208
|
+
|
|
209
|
+
```javascript
|
|
210
|
+
brand: {
|
|
211
|
+
splash: false, // also generate splash_icon.png × 5
|
|
212
|
+
padding: '15%', // Android safe-zone. Range 12-20%.
|
|
213
|
+
iosPadding: '4%', // iOS aesthetic padding. Range 2-8%.
|
|
214
|
+
darkBgColor: null, // opaque dark bg for DefaultIcon-Dark.png (null = transparent per Apple HIG)
|
|
215
|
+
bgColor: '#FFFFFF', // Android adaptive bg + iOS/marketplace flatten
|
|
216
|
+
notification: false, // also generate ic_stat_notify.png × 5
|
|
217
|
+
confirmOverwrites: true // prompt before overwriting files
|
|
218
|
+
}
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
### Confirmation prompt
|
|
222
|
+
|
|
223
|
+
`brand` writes in place, so it asks `Continue? [y/N/a]` before overwriting anything. Choose `a` (always) to write `confirmOverwrites: false` into `config.cjs` and silence the prompt on future runs. The prompt is skipped automatically when `stdin` is not a TTY (`alloy.jmk` hook, CI, pipes), when `-y`/`--yes` is passed, or when `PURGETSS_YES=1` is set.
|
|
224
|
+
|
|
225
|
+
### Examples
|
|
226
|
+
|
|
227
|
+
```bash
|
|
228
|
+
purgetss brand # uses purgetss/brand/logo.svg + config
|
|
229
|
+
purgetss brand --bg-color "#0B1326" # override bg color
|
|
230
|
+
purgetss brand --notification --splash # add notification + splash
|
|
231
|
+
purgetss brand --no-tinted # skip iOS 18+ tinted variant
|
|
232
|
+
purgetss brand --dry-run # preview without writing
|
|
233
|
+
purgetss brand --cleanup-legacy --dry-run # preview legacy cleanup
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
## `images` Command
|
|
237
|
+
|
|
238
|
+
Introduced in v7.6.0. Generates multi-density variants of your UI images (buttons, illustrations, logos, screen graphics) from a single high-resolution source per image. Alloy and Classic projects are auto-detected.
|
|
239
|
+
|
|
240
|
+
> **Tip**
|
|
241
|
+
> This is a quick reference. See [multi-density-images.md](./multi-density-images.md) for the complete guide — 4× source convention, re-processing single files, format conversion, subdirectory preservation, and troubleshooting.
|
|
242
|
+
|
|
243
|
+
```bash
|
|
244
|
+
purgetss images # uses purgetss/images/ + config
|
|
245
|
+
purgetss images background/pink-texture.png # re-process one file (short path)
|
|
246
|
+
purgetss images background/ # re-process one subfolder
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
### Flags
|
|
250
|
+
|
|
251
|
+
| Flag | Purpose |
|
|
252
|
+
| --- | --- |
|
|
253
|
+
| `--android` | Only emit Android density variants. Mutually exclusive with `--ios`. |
|
|
254
|
+
| `--ios` | Only emit iPhone scale variants. Mutually exclusive with `--android`. |
|
|
255
|
+
| `--format <ext>` | Convert all outputs to `webp`, `jpeg`, `png`, `avif`, `gif`, or `tiff`. Default: keep source format. |
|
|
256
|
+
| `--quality <n>` | Quality `0-100` for lossy formats. Default `85`. |
|
|
257
|
+
| `--dry-run` | Preview without writing any files. |
|
|
258
|
+
| `--project <path>` | Project root (defaults to cwd). |
|
|
259
|
+
| `-y, --yes` | Skip the overwrite confirmation prompt. |
|
|
260
|
+
| `--debug` | Print extra diagnostics. |
|
|
261
|
+
|
|
262
|
+
### Positional argument
|
|
263
|
+
|
|
264
|
+
- `[source]` (optional) — path to override auto-discovery. Resolves first against `purgetss/images/` (short paths like `buttons/btn.png`), then against cwd.
|
|
265
|
+
|
|
266
|
+
### Config block
|
|
267
|
+
|
|
268
|
+
Defaults live under `images:` in `purgetss/config.cjs`:
|
|
269
|
+
|
|
270
|
+
```javascript
|
|
271
|
+
images: {
|
|
272
|
+
quality: 85, // JPEG/WebP/AVIF quality (0-100)
|
|
273
|
+
format: null, // null = keep original; 'webp' | 'jpeg' | 'png' | 'avif' | 'gif' | 'tiff'
|
|
274
|
+
confirmOverwrites: true // prompt before overwriting files
|
|
275
|
+
}
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
Like `brand`, `images` writes in place and asks `Continue? [y/N/a]` before overwriting. Selecting `a` flips `confirmOverwrites: false` in `config.cjs`. Skipped automatically when `stdin` is not a TTY, when `-y`/`--yes` is passed, or when `PURGETSS_YES=1` is set.
|
|
279
|
+
|
|
280
|
+
### Examples
|
|
281
|
+
|
|
282
|
+
```bash
|
|
283
|
+
purgetss images # uses purgetss/images/ + config
|
|
284
|
+
purgetss images background/pink-texture.png # re-process one file (short path)
|
|
285
|
+
purgetss images background/ # re-process one subfolder
|
|
286
|
+
purgetss images --android # only Android densities
|
|
287
|
+
purgetss images --format webp --quality 90 # convert all outputs to WebP
|
|
288
|
+
purgetss images --dry-run # preview
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
## `semantic` Command
|
|
292
|
+
|
|
293
|
+
Introduced in v7.6.0. Generates Titanium semantic colors (Light/Dark mode aware) into `app/assets/semantic.colors.json`. The command dispatches between two distinct modes based on whether `--single` is passed.
|
|
294
|
+
|
|
295
|
+
> **Tip**
|
|
296
|
+
> This is a quick reference. See [semantic-colors.md](./semantic-colors.md) for the complete guide — mirror inversion math, Titanium semantic color spec, class mapping conventions, and strategies for purpose-based design systems.
|
|
297
|
+
|
|
298
|
+
### Palette mode (no `--single`)
|
|
299
|
+
|
|
300
|
+
One base hex, 11-shade tonal palette with mirror-by-index Light/Dark inversion anchored at shade `500`. Writes both files in one step: the JSON gets 11 entries, and `config.cjs` gets the family mapped to those semantic keys.
|
|
301
|
+
|
|
302
|
+
```bash
|
|
303
|
+
purgetss semantic <hex> <name>
|
|
304
|
+
purgetss semantic '#15803d' amazon
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
Usage produces classes like `bg-amazon-50`, `text-amazon-500`, `border-amazon-950` that flip tonal contrast automatically with the system appearance.
|
|
308
|
+
|
|
309
|
+
### Single mode (`--single`)
|
|
310
|
+
|
|
311
|
+
Explicit per-mode hex values for purpose-based semantic colors (`surfaceColor`, `textColor`, `borderColor`, `overlayColor`, etc.). Writes the JSON entry AND auto-maps it to a class in `config.cjs` by stripping the conventional `Color` suffix (e.g. `surfaceColor` → class `surface`).
|
|
312
|
+
|
|
313
|
+
```bash
|
|
314
|
+
purgetss semantic --single <hex> <name> [--dark <hex>] [--alpha <0-100>]
|
|
315
|
+
|
|
316
|
+
# Examples:
|
|
317
|
+
purgetss semantic --single '#F9FAFB' surfaceColor --dark '#0f172a'
|
|
318
|
+
purgetss semantic --single '#111827' textColor --dark '#f1f5f9'
|
|
319
|
+
purgetss semantic --single '#3B82F6' accentColor --dark '#60a5fa' --alpha 80
|
|
320
|
+
purgetss semantic --single '#000000' overlayColor --alpha 50
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
When `--dark` is omitted, it defaults to the light hex — useful for overlays/glass surfaces where alpha is the only variation.
|
|
324
|
+
|
|
325
|
+
### Smart in-place updates
|
|
326
|
+
|
|
327
|
+
If a `--single` name matches an existing palette shade — e.g. `purgetss semantic --single '#000' amazon500` while palette `amazon` exists — PurgeTSS narrows the operation to an in-place JSON value edit. The entry stays in its original position, and `config.cjs` is left untouched (the palette already maps to that key).
|
|
328
|
+
|
|
329
|
+
Re-running on the same palette family fully replaces it: PurgeTSS strips prior keys belonging to that family (bare name + 11 shade keys) before writing the new entries. Unrelated palettes and manually-defined entries survive.
|
|
330
|
+
|
|
331
|
+
### Flags
|
|
332
|
+
|
|
333
|
+
| Flag | Purpose |
|
|
334
|
+
| --- | --- |
|
|
335
|
+
| `-s, --single` | Generate a single purpose-based semantic color (requires explicit per-mode hex). |
|
|
336
|
+
| `-d, --dark <hex>` | With `--single`, the dark-mode hex (defaults to the light value). |
|
|
337
|
+
| `-a, --alpha <0-100>` | With `--single`, wraps both modes in `{ color, alpha }` per the Titanium spec. |
|
|
338
|
+
| `-n, --name <name>` | Specify the name (alternative to the positional argument). |
|
|
339
|
+
| `-r, --random` | Palette mode — use a random base color. |
|
|
340
|
+
| `-o, --override` | Place the mapping in `theme.colors` instead of `theme.extend.colors`. |
|
|
341
|
+
| `-q, --quotes` | Keep double quotes in `config.cjs`. |
|
|
342
|
+
| `-l, --log` | Preview the JSON without writing any files. |
|
|
343
|
+
|
|
146
344
|
## `install-dependencies` Command
|
|
147
345
|
|
|
148
346
|
This command installs dev dependencies and configuration files in existing PurgeTSS projects, and sets up Visual Studio Code support.
|
|
@@ -795,3 +993,16 @@ purgetss sudo-update
|
|
|
795
993
|
# alias:
|
|
796
994
|
purgetss su
|
|
797
995
|
```
|
|
996
|
+
|
|
997
|
+
## Community-Discovered Patterns
|
|
998
|
+
|
|
999
|
+
### v7.2.x environment notes
|
|
1000
|
+
|
|
1001
|
+
These items were surfaced in community threads during the v7.2.x rollout and remain relevant operational context for anyone upgrading from pre-v7.2 installs:
|
|
1002
|
+
|
|
1003
|
+
- Node.js 20+ required (due to the `inquirer` v13 upgrade).
|
|
1004
|
+
- Font Awesome 7 support, including the CSS custom properties format.
|
|
1005
|
+
- Titanium SDK 13.1.x support, with new properties from 13.1.0.GA.
|
|
1006
|
+
- Removed deprecated commands: `copy-fonts` and `build-legacy` are no longer available — scripts referencing either will fail.
|
|
1007
|
+
- Install size reduced by ~45MB (non-essential assets moved to dev dependencies).
|
|
1008
|
+
- Improved Unicode extraction for more formats and direct character mappings in `build-fonts`.
|
|
@@ -65,9 +65,6 @@ You can customize any of the following properties individually by adding them in
|
|
|
65
65
|
- `trackTintColor`
|
|
66
66
|
- `viewShadowColor`
|
|
67
67
|
|
|
68
|
-
> **ℹ️ `backgroundGradient`**
|
|
69
|
-
> For custom gradient rules, `backgroundGradient.colors` can use arrays of `{ color, offset }` objects. PurgeTSS v7.4.0 fixed serialization for those nested object arrays in `utilities.tss`.
|
|
70
|
-
|
|
71
68
|
## Configurable Properties
|
|
72
69
|
|
|
73
70
|
- `activeTab`
|
|
@@ -152,12 +149,19 @@ You can customize any of the following properties individually by adding them in
|
|
|
152
149
|
- `zIndex`
|
|
153
150
|
- `zoomScale`
|
|
154
151
|
|
|
152
|
+
## Custom Rules and Ti Elements
|
|
153
|
+
|
|
154
|
+
Create your own custom rules and include Ti Elements with any number of attributes or conditional statements. See [Custom Rules](./custom-rules.md) for rule syntax and examples.
|
|
155
|
+
|
|
156
|
+
## Community-Discovered Patterns
|
|
157
|
+
|
|
158
|
+
The following notes come from community experience applying PurgeTSS configurable properties against Titanium's native layout constraints. They are not part of the official reference but prevent common mistakes.
|
|
159
|
+
|
|
160
|
+
> **ℹ️ `backgroundGradient`**
|
|
161
|
+
> For custom gradient rules, `backgroundGradient.colors` can use arrays of `{ color, offset }` objects. PurgeTSS v7.4.0 fixed serialization for those nested object arrays in `utilities.tss`.
|
|
162
|
+
|
|
155
163
|
> **WARNING: Titanium Padding Constraint**
|
|
156
164
|
> Titanium does not support native `padding` on `View`, `Window`, `ScrollView`, or `TableView`. Even if `padding*` is configurable, use margins on children for those elements.
|
|
157
165
|
|
|
158
166
|
> **WARNING: Width Fill Constraint**
|
|
159
167
|
> For full-width Titanium layouts, prefer `w-screen` (`Ti.UI.FILL`) instead of `w-full` (`100%`).
|
|
160
|
-
|
|
161
|
-
## Custom Rules and Ti Elements
|
|
162
|
-
|
|
163
|
-
Create your own custom rules and include Ti Elements with any number of attributes or conditional statements. See [Custom Rules](./custom-rules.md) for rule syntax and examples.
|
|
@@ -31,9 +31,6 @@ Whether you want to style a Ti Element (also known as a markup element), a custo
|
|
|
31
31
|
- `em` or `rem` values are converted with this formula: `value * 16`.
|
|
32
32
|
- `dp` removes the unit and keeps the value as-is.
|
|
33
33
|
|
|
34
|
-
> **Platform-Specific Constants**
|
|
35
|
-
> If a rule uses `Ti.UI.iOS.*` or `Ti.UI.Android.*` constants, keep that property inside the matching `ios` or `android` block to avoid cross-platform compilation failures.
|
|
36
|
-
|
|
37
34
|
## `config.cjs` File Example
|
|
38
35
|
|
|
39
36
|
`./purgetss/config.cjs`
|
|
@@ -102,3 +99,10 @@ module.exports = {
|
|
|
102
99
|
'.gallery[formFactor=handheld]': { width: '250px' }
|
|
103
100
|
'.gallery[formFactor=tablet]': { width: '500px' }
|
|
104
101
|
```
|
|
102
|
+
|
|
103
|
+
## Community-Discovered Patterns
|
|
104
|
+
|
|
105
|
+
The following guidance comes from community experience using PurgeTSS custom rules in real projects. It is not part of the official reference but addresses common pitfalls.
|
|
106
|
+
|
|
107
|
+
> **Platform-Specific Constants**
|
|
108
|
+
> If a rule uses `Ti.UI.iOS.*` or `Ti.UI.Android.*` constants, keep that property inside the matching `ios` or `android` block to avoid cross-platform compilation failures.
|
|
@@ -18,7 +18,7 @@ If you want a clean `config.cjs`, delete the existing one and run:
|
|
|
18
18
|
purgetss init
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
This creates a
|
|
21
|
+
This creates a `./purgetss/config.cjs` file with the default sections:
|
|
22
22
|
|
|
23
23
|
```javascript
|
|
24
24
|
module.exports = {
|
|
@@ -34,17 +34,35 @@ module.exports = {
|
|
|
34
34
|
plugins: [] // Array of properties to ignore
|
|
35
35
|
}
|
|
36
36
|
},
|
|
37
|
+
brand: {
|
|
38
|
+
splash: false, // also generate splash_icon.png × 5
|
|
39
|
+
padding: '15%', // Android safe-zone. Range: 12% tight (mature logos) — 20% conservative. Spec floor 19.44%.
|
|
40
|
+
iosPadding: '4%', // iOS aesthetic. Range: 2% bold — 8% conservative. No launcher mask.
|
|
41
|
+
darkBgColor: null, // opaque dark bg for DefaultIcon-Dark.png (null = transparent per Apple HIG)
|
|
42
|
+
bgColor: '#FFFFFF', // Android adaptive bg + iOS/marketplace flatten
|
|
43
|
+
notification: false, // also generate ic_stat_notify.png × 5
|
|
44
|
+
confirmOverwrites: true // prompt before overwriting files (set false to skip)
|
|
45
|
+
},
|
|
46
|
+
images: {
|
|
47
|
+
quality: 85, // JPEG/WebP/AVIF quality (0-100)
|
|
48
|
+
format: null, // null = keep original; 'webp' | 'jpeg' | 'png' to convert every image
|
|
49
|
+
confirmOverwrites: true // prompt before overwriting files (set false to skip)
|
|
50
|
+
},
|
|
37
51
|
theme: {
|
|
38
52
|
extend: {}
|
|
39
53
|
}
|
|
40
54
|
};
|
|
41
55
|
```
|
|
42
56
|
|
|
57
|
+
`init` also creates empty `purgetss/fonts/`, `purgetss/brand/`, and `purgetss/images/` folders on first run, so you can see where each kind of asset goes.
|
|
58
|
+
|
|
43
59
|
Every section is optional. Only add what you want to change. Anything missing falls back to the defaults.
|
|
44
60
|
|
|
45
61
|
## Structure
|
|
46
62
|
|
|
47
|
-
The config file has
|
|
63
|
+
The config file has four main sections: `purge`, `brand`, `images`, and `theme`.
|
|
64
|
+
|
|
65
|
+
`brand:` and `images:` configure the matching CLI commands — see [CLI Commands: `brand`](./cli-commands.md#brand-command) and [CLI Commands: `images`](./cli-commands.md#images-command) for the full option lists. The rest of this page covers `purge` and `theme`.
|
|
48
66
|
|
|
49
67
|
### `purge` Section
|
|
50
68
|
|
|
@@ -177,6 +195,31 @@ module.exports = {
|
|
|
177
195
|
};
|
|
178
196
|
```
|
|
179
197
|
|
|
198
|
+
### Default `font-sans`, `font-serif`, `font-mono`
|
|
199
|
+
|
|
200
|
+
PurgeTSS generates three `fontFamily` classes by default, even when `theme.fontFamily` is not set in `config.cjs`. iOS and Android get different values on purpose so each platform picks its native system font:
|
|
201
|
+
|
|
202
|
+
| Class | iOS | Android |
|
|
203
|
+
| ------------ | ---------------- | ------------ |
|
|
204
|
+
| `font-sans` | `Helvetica Neue` | `sans-serif` |
|
|
205
|
+
| `font-serif` | `Georgia` | `serif` |
|
|
206
|
+
| `font-mono` | `monospace` | `monospace` |
|
|
207
|
+
|
|
208
|
+
If you define a value for `sans`, `serif`, or `mono` in `theme.fontFamily` (or `theme.extend.fontFamily`), your value replaces the default on both platforms — no per-platform fork needed:
|
|
209
|
+
|
|
210
|
+
`./purgetss/config.cjs`
|
|
211
|
+
```javascript
|
|
212
|
+
module.exports = {
|
|
213
|
+
theme: {
|
|
214
|
+
extend: {
|
|
215
|
+
fontFamily: {
|
|
216
|
+
sans: 'Inter-Regular' // replaces Helvetica Neue / sans-serif on both platforms
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
```
|
|
222
|
+
|
|
180
223
|
## Overriding and Extending Properties
|
|
181
224
|
|
|
182
225
|
By default, your project inherits values from the default theme. You have two options depending on your goal.
|
|
@@ -462,8 +505,13 @@ module.exports = {
|
|
|
462
505
|
|
|
463
506
|
This generates classes like `p-72`, `m-84`, and `h-96` in addition to all of the default spacing and sizing utilities.
|
|
464
507
|
|
|
465
|
-
|
|
466
|
-
|
|
508
|
+
## Community-Discovered Patterns
|
|
509
|
+
|
|
510
|
+
### Titanium Layout Constraint: `padding` on View / Window / ScrollView / TableView
|
|
511
|
+
|
|
512
|
+
Titanium does not support native `padding` on `View`, `Window`, `ScrollView`, or `TableView`. Even if PurgeTSS generates spacing-related utilities (`p-*`, `px-*`, `py-*`), applying them to those elements is silently ignored at runtime. Prefer margins on the children of those containers instead — `m-*`, `mt-*`, `mb-*`, etc. — which Titanium honors correctly.
|
|
513
|
+
|
|
514
|
+
This is a Titanium platform constraint, not a PurgeTSS bug. `Button`, `Label`, and `TextField` do accept `padding` natively.
|
|
467
515
|
|
|
468
516
|
## List of Customizable Properties
|
|
469
517
|
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Dynamic Component Creation with PurgeTSS
|
|
2
2
|
|
|
3
|
+
> **SCOPE NOTE**
|
|
4
|
+
>
|
|
5
|
+
> This reference covers dynamic component creation using **Alloy's `$.UI.create()` helper** and **`Alloy.createStyle()` + `applyProperties()`**, both combined with PurgeTSS utility classes. It is an Alloy + PurgeTSS integration guide, **not** documentation for the `purgetss.ui` native module (see [animation-system.md](./animation-system.md) and [animation-advanced.md](./animation-advanced.md) for that module).
|
|
6
|
+
>
|
|
7
|
+
> For general Alloy controller and view patterns, refer to the `alloy-guides` and `alloy-howtos` skills.
|
|
8
|
+
|
|
9
|
+
## Community-Discovered Patterns
|
|
10
|
+
|
|
11
|
+
The guidance in this file reflects patterns that PurgeTSS users have converged on when building components imperatively from Alloy controllers. It complements — but is not a substitute for — official Alloy documentation.
|
|
12
|
+
|
|
3
13
|
## Overview
|
|
4
14
|
|
|
5
15
|
When creating components dynamically in Controllers (not declaratively in XML), PurgeTSS provides two methods to apply utility classes:
|
|
@@ -7,8 +17,9 @@ When creating components dynamically in Controllers (not declaratively in XML),
|
|
|
7
17
|
1. **`$.UI.create()`** - Create components with PurgeTSS classes (Recommended)
|
|
8
18
|
2. **`Alloy.createStyle()` + `applyProperties()`** - Apply PurgeTSS styles to existing components
|
|
9
19
|
|
|
10
|
-
>
|
|
11
|
-
>
|
|
20
|
+
> **BEST PRACTICE**
|
|
21
|
+
>
|
|
22
|
+
> Always prefer `$.UI.create()` for dynamic components — it's cleaner, more readable, and PurgeTSS will process the classes automatically during build.
|
|
12
23
|
|
|
13
24
|
---
|
|
14
25
|
|
|
@@ -333,24 +344,25 @@ function createIconGrid(items) {
|
|
|
333
344
|
|
|
334
345
|
### PurgeTSS Processes Classes During Build
|
|
335
346
|
|
|
336
|
-
>
|
|
347
|
+
> **NOTE — HOW IT WORKS**
|
|
348
|
+
>
|
|
337
349
|
> When you use `$.UI.create()` or `Alloy.createStyle()` with classes:
|
|
338
350
|
>
|
|
339
351
|
> 1. PurgeTSS scans your controllers for these class references
|
|
340
352
|
> 2. It adds the classes to the generated `app.tss`
|
|
341
353
|
> 3. At runtime, Alloy applies the styles to your components
|
|
342
354
|
>
|
|
343
|
-
> This means you get
|
|
355
|
+
> This means you get the full PurgeTSS utility surface even with dynamic components.
|
|
344
356
|
|
|
345
357
|
### Class Verification
|
|
346
358
|
|
|
347
|
-
Just like with XML views,
|
|
359
|
+
Just like with XML views, always verify classes exist before using them:
|
|
348
360
|
|
|
349
361
|
```javascript
|
|
350
|
-
//
|
|
362
|
+
// CORRECT - Verified classes
|
|
351
363
|
classes: ['w-screen', 'h-auto', 'bg-white', 'rounded-lg']
|
|
352
364
|
|
|
353
|
-
//
|
|
365
|
+
// WRONG - These classes don't exist
|
|
354
366
|
classes: ['flex-row', 'justify-center', 'p-4'] // No flexbox, no p-* on View
|
|
355
367
|
```
|
|
356
368
|
|
|
@@ -425,7 +437,8 @@ function setState(state) {
|
|
|
425
437
|
}
|
|
426
438
|
```
|
|
427
439
|
|
|
428
|
-
>
|
|
440
|
+
> **NOTE — When to use `classes` vs `applyProperties`**
|
|
441
|
+
>
|
|
429
442
|
> - Use `classes` when you want to swap entire style sets (e.g., active/inactive states)
|
|
430
443
|
> - Use `applyProperties` with direct values when changing individual properties (e.g., text, enabled)
|
|
431
444
|
> - Combine both for complex state changes
|
|
@@ -434,7 +447,7 @@ function setState(state) {
|
|
|
434
447
|
|
|
435
448
|
## Anti-Patterns to Avoid
|
|
436
449
|
|
|
437
|
-
###
|
|
450
|
+
### Don't use `Ti.UI.create()` with Manual Styles
|
|
438
451
|
|
|
439
452
|
```javascript
|
|
440
453
|
// WRONG - Manual styling, no PurgeTSS benefits
|
|
@@ -446,7 +459,7 @@ const view = Ti.UI.createView({
|
|
|
446
459
|
})
|
|
447
460
|
```
|
|
448
461
|
|
|
449
|
-
###
|
|
462
|
+
### Use `$.UI.create()` with PurgeTSS classes
|
|
450
463
|
|
|
451
464
|
```javascript
|
|
452
465
|
// CORRECT - Full PurgeTSS power
|
|
@@ -455,7 +468,7 @@ const view = $.UI.create('View', {
|
|
|
455
468
|
})
|
|
456
469
|
```
|
|
457
470
|
|
|
458
|
-
###
|
|
471
|
+
### Don't mix inline styles and classes
|
|
459
472
|
|
|
460
473
|
```javascript
|
|
461
474
|
// CONFUSING - Mix of styles and classes
|
|
@@ -465,7 +478,7 @@ const view = $.UI.create('View', {
|
|
|
465
478
|
})
|
|
466
479
|
```
|
|
467
480
|
|
|
468
|
-
###
|
|
481
|
+
### Use only classes (or only styles)
|
|
469
482
|
|
|
470
483
|
```javascript
|
|
471
484
|
// CORRECT - Pure PurgeTSS
|
|
@@ -494,8 +507,10 @@ view.applyProperties(Alloy.createStyle('index', {
|
|
|
494
507
|
| **`Alloy.createStyle()`** | Styling existing components | `Alloy.createStyle('view', { classes: 'bg-white' })` |
|
|
495
508
|
| **`applyProperties()`** | Apply style to component | `component.applyProperties(style)` |
|
|
496
509
|
|
|
497
|
-
>
|
|
498
|
-
>
|
|
510
|
+
> **NOTE — REMEMBER**
|
|
511
|
+
>
|
|
512
|
+
> Both methods give you full access to PurgeTSS utilities:
|
|
513
|
+
>
|
|
499
514
|
> - All color classes (`bg-*`, `text-*`, `border-*`)
|
|
500
515
|
> - All spacing classes (`m-*`, `gap-*`, and `p-*` where the Titanium component supports padding)
|
|
501
516
|
> - All layout classes (`horizontal`, `vertical`)
|
|
@@ -2,9 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
The grid system is a small layout tool that lets you build rows and columns with utility classes.
|
|
4
4
|
|
|
5
|
-
> **WARNING**
|
|
6
|
-
> PurgeTSS grid is not CSS Grid. It is a Titanium-oriented layout helper built around horizontal and vertical layout behavior.
|
|
7
|
-
|
|
8
5
|
The snippet below shows the simplest layout. From there, you can mix columns and rows as needed.
|
|
9
6
|
|
|
10
7
|
```xml
|
|
@@ -85,10 +82,25 @@ These are the available utilities to control the grid.
|
|
|
85
82
|
|
|
86
83
|
Control horizontal alignment of elements within a row:
|
|
87
84
|
|
|
88
|
-
| Class | Effect |
|
|
89
|
-
| --- | --- |
|
|
90
|
-
| `start` | Align to the start of the row |
|
|
91
|
-
| `end` | Align to the end of the row |
|
|
92
|
-
| `center` | Align to the center of the row |
|
|
85
|
+
| Class | Effect |
|
|
86
|
+
| --- | --- |
|
|
87
|
+
| `start` | Align to the start of the row |
|
|
88
|
+
| `end` | Align to the end of the row |
|
|
89
|
+
| `center` | Align to the center of the row |
|
|
93
90
|
|
|
94
91
|
These apply to child views inside a `grid-cols-*` container and control horizontal placement within the grid cell.
|
|
92
|
+
|
|
93
|
+
## Community-Discovered Patterns
|
|
94
|
+
|
|
95
|
+
The following notes come from community experience using the PurgeTSS grid system in Titanium projects. They clarify how the grid relates to Titanium's layout engine (not CSS Grid) and offer common use cases for row placement.
|
|
96
|
+
|
|
97
|
+
> **WARNING**
|
|
98
|
+
> PurgeTSS grid is not CSS Grid. It is a Titanium-oriented layout helper built around horizontal and vertical layout behavior.
|
|
99
|
+
|
|
100
|
+
### Common Use Cases for Row Placement
|
|
101
|
+
|
|
102
|
+
| Class | Use case |
|
|
103
|
+
| --- | --- |
|
|
104
|
+
| `start` | Left-aligned content |
|
|
105
|
+
| `end` | Right-aligned buttons or labels |
|
|
106
|
+
| `center` | Centered content blocks |
|
|
@@ -166,5 +166,9 @@ exports.icons = icons;
|
|
|
166
166
|
> **DANGER**
|
|
167
167
|
> Make sure the new prefix remains unique to avoid conflicts with other class prefixes.
|
|
168
168
|
|
|
169
|
+
## Community-Discovered Patterns
|
|
170
|
+
|
|
171
|
+
The following note reflects community experience working with icon fonts that depend on multiple glyphs per icon.
|
|
172
|
+
|
|
169
173
|
> **Font Awesome Duotone**
|
|
170
174
|
> Titanium cannot render Font Awesome duotone icons correctly because each icon uses two glyphs. If you work with Font Awesome Pro, avoid documenting duotone as supported.
|
|
@@ -12,16 +12,11 @@ Install PurgeTSS globally on your machine using [NPM](https://www.npmjs.com/).
|
|
|
12
12
|
> Node.js 20+ required.
|
|
13
13
|
> PurgeTSS requires Node 20.0.0 or higher.
|
|
14
14
|
|
|
15
|
-
##
|
|
15
|
+
## XML Validation
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
- `deviceInfo()` now works in Alloy and Classic Titanium projects.
|
|
19
|
-
- If an upgrade behaves unexpectedly, a clean reinstall is the recommended recovery step:
|
|
17
|
+
PurgeTSS v7.5.3 added XML validation that flags any `--` (double-dash) sequence inside XML comments. Titanium's XML parser treats `--` in comments as invalid, and PurgeTSS now detects those sequences before they break the compile step.
|
|
20
18
|
|
|
21
|
-
|
|
22
|
-
npm uninstall -g purgetss
|
|
23
|
-
npm install -g purgetss
|
|
24
|
-
```
|
|
19
|
+
If you see a validation warning from PurgeTSS pointing at a view file, replace the offending comment with an alternative marker (for example, `//` or `==`) and re-run the build.
|
|
25
20
|
|
|
26
21
|
## Run PurgeTSS the First Time
|
|
27
22
|
|