@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
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
# Appearance Module
|
|
2
|
+
|
|
3
|
+
The `Appearance` export from `purgetss.ui` (added in **v7.5.3**) handles Light / Dark / System mode switching and persists the user's choice across app restarts. It is a thin, deterministic wrapper around Titanium's native `Ti.UI.overrideUserInterfaceStyle` plus `Ti.App.Properties`, exposed as a singleton so every controller in the app reads and writes the same state.
|
|
4
|
+
|
|
5
|
+
This file covers the four public methods, the required setup, a full Settings-view example, and the lifecycle that keeps the saved mode in sync with the UI. For the color wiring that actually makes the UI *respond* to mode changes, see [semantic-colors.md](./semantic-colors.md).
|
|
6
|
+
|
|
7
|
+
> **INFO**
|
|
8
|
+
>
|
|
9
|
+
> Requires PurgeTSS **>= 7.5.3**. On older versions the `Appearance` export does not exist — the `require('purgetss.ui')` call will succeed, but `Appearance` will be `undefined`. Run `purgetss --version` in the project root to confirm.
|
|
10
|
+
|
|
11
|
+
## Setup
|
|
12
|
+
|
|
13
|
+
Call `Appearance.init()` **once** at app startup, before opening the first window. The standard place is the top of `app/controllers/index.js`.
|
|
14
|
+
|
|
15
|
+
`app/controllers/index.js`
|
|
16
|
+
```js
|
|
17
|
+
const { Appearance } = require('purgetss.ui')
|
|
18
|
+
|
|
19
|
+
Appearance.init()
|
|
20
|
+
|
|
21
|
+
$.navWin.open()
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
`init()` reads the saved preference from `Ti.App.Properties` (key: `userInterfaceStyle`) and applies it through `Ti.UI.overrideUserInterfaceStyle`. If nothing has been saved yet, the system default is used, and semantic colors resolve against whatever the OS reports.
|
|
25
|
+
|
|
26
|
+
> **WARNING**
|
|
27
|
+
>
|
|
28
|
+
> Call `Appearance.init()` **before** `$.navWin.open()` (or whichever window you open first). If the window opens first, it will render once against the system default and then flicker to the saved mode when `init()` runs — a visible flash on cold launch.
|
|
29
|
+
|
|
30
|
+
## Methods
|
|
31
|
+
|
|
32
|
+
| Method | Description |
|
|
33
|
+
| ------------ | --------------------------------------------------------------------------- |
|
|
34
|
+
| `init()` | Restore the saved mode from `Ti.App.Properties` and apply it via `Ti.UI.overrideUserInterfaceStyle`. Call once at app startup before opening the first window. |
|
|
35
|
+
| `set(mode)` | Apply and persist a mode. Accepts `'system'`, `'light'`, or `'dark'`. Any other value is silently ignored. |
|
|
36
|
+
| `get()` | Returns the current mode as a string: `'system'`, `'light'`, or `'dark'`. |
|
|
37
|
+
| `toggle()` | Switch between `'light'` and `'dark'`. Skips `'system'` — if current mode is `'system'` the next call produces `'dark'`. |
|
|
38
|
+
|
|
39
|
+
All four methods are **synchronous**. They do not fire events; if you need to react to a mode change, call your update logic right after `Appearance.set(...)`.
|
|
40
|
+
|
|
41
|
+
## Full Settings-view example
|
|
42
|
+
|
|
43
|
+
A three-row settings panel — System / Light / Dark — where each row shows a `fa-solid fa-circle-check` icon next to the currently active mode. Tapping a row calls `Appearance.set(...)` and updates the check icons.
|
|
44
|
+
|
|
45
|
+
### View
|
|
46
|
+
|
|
47
|
+
`app/views/settings.xml`
|
|
48
|
+
```xml
|
|
49
|
+
<Alloy>
|
|
50
|
+
<Window class="bg-surface title-attributes-on-surface bar-surface nav-tint-accent" title="Settings">
|
|
51
|
+
<ScrollView class="vertical content-w-screen content-h-auto">
|
|
52
|
+
|
|
53
|
+
<Label class="mx-4 mb-2 mt-6 h-auto text-xs font-semibold text-on-surface-variant">APPEARANCE</Label>
|
|
54
|
+
|
|
55
|
+
<View class="mx-4 mb-4 h-auto w-screen rounded-xl bg-surface-high shadow-sm vertical clip-enabled">
|
|
56
|
+
|
|
57
|
+
<!-- System -->
|
|
58
|
+
<View class="horizontal mx-4 h-12 w-screen" onClick="selectSystem">
|
|
59
|
+
<Label class="fa-solid fa-mobile-screen ml-0 h-12 w-8 text-blue-500" />
|
|
60
|
+
<Label class="h-12 text-sm font-semibold text-on-surface">System</Label>
|
|
61
|
+
<Label id="themeSystemCheck" class="fa-solid fa-circle-check mr-0 h-12 w-screen text-right text-green-500" />
|
|
62
|
+
</View>
|
|
63
|
+
|
|
64
|
+
<View class="h-px w-screen bg-border" />
|
|
65
|
+
|
|
66
|
+
<!-- Light -->
|
|
67
|
+
<View class="horizontal mx-4 h-12 w-screen" onClick="selectLight">
|
|
68
|
+
<Label class="fa-solid fa-sun ml-0 h-12 w-8 text-amber-500" />
|
|
69
|
+
<Label class="h-12 text-sm font-semibold text-on-surface">Light</Label>
|
|
70
|
+
<Label id="themeLightCheck" class="fa-solid fa-circle-check mr-0 hidden h-12 w-screen text-right text-green-500" />
|
|
71
|
+
</View>
|
|
72
|
+
|
|
73
|
+
<View class="h-px w-screen bg-border" />
|
|
74
|
+
|
|
75
|
+
<!-- Dark -->
|
|
76
|
+
<View class="horizontal mx-4 h-12 w-screen" onClick="selectDark">
|
|
77
|
+
<Label class="fa-solid fa-moon ml-0 h-12 w-8 text-purple-500" />
|
|
78
|
+
<Label class="h-12 text-sm font-semibold text-on-surface">Dark</Label>
|
|
79
|
+
<Label id="themeDarkCheck" class="fa-solid fa-circle-check mr-0 hidden h-12 w-screen text-right text-green-500" />
|
|
80
|
+
</View>
|
|
81
|
+
|
|
82
|
+
</View>
|
|
83
|
+
|
|
84
|
+
</ScrollView>
|
|
85
|
+
</Window>
|
|
86
|
+
</Alloy>
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Controller
|
|
90
|
+
|
|
91
|
+
`app/controllers/settings.js`
|
|
92
|
+
```js
|
|
93
|
+
const { Appearance } = require('purgetss.ui')
|
|
94
|
+
|
|
95
|
+
// Sync check icons with the mode saved at app startup.
|
|
96
|
+
updateUI(Appearance.get())
|
|
97
|
+
|
|
98
|
+
const selectDark = () => selectAppearance('dark')
|
|
99
|
+
const selectLight = () => selectAppearance('light')
|
|
100
|
+
const selectSystem = () => selectAppearance('system')
|
|
101
|
+
|
|
102
|
+
const selectAppearance = (value) => {
|
|
103
|
+
Appearance.set(value)
|
|
104
|
+
updateUI(value)
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const updateUI = (value) => {
|
|
108
|
+
$.themeDarkCheck.visible = (value === 'dark')
|
|
109
|
+
$.themeLightCheck.visible = (value === 'light')
|
|
110
|
+
$.themeSystemCheck.visible = (value === 'system')
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
The background, text, border, and icon colors in the XML come from semantic color classes (`bg-surface`, `bg-surface-high`, `text-on-surface`, `bg-border`, etc.) — see [semantic-colors.md](./semantic-colors.md) for how to wire those up so the whole view flips when `Appearance.set('dark')` fires.
|
|
115
|
+
|
|
116
|
+
## Lifecycle
|
|
117
|
+
|
|
118
|
+
How the four moving parts — `Appearance.init()`, `Ti.App.Properties`, `Ti.UI.overrideUserInterfaceStyle`, and semantic colors — cooperate:
|
|
119
|
+
|
|
120
|
+
```
|
|
121
|
+
app startup
|
|
122
|
+
|
|
|
123
|
+
+-- 1. Appearance.init()
|
|
124
|
+
| |
|
|
125
|
+
| +-- reads key 'userInterfaceStyle' from Ti.App.Properties
|
|
126
|
+
| +-- sets Ti.UI.overrideUserInterfaceStyle to the saved value
|
|
127
|
+
| +-- stores 'system' | 'light' | 'dark' in the singleton's currentMode
|
|
128
|
+
|
|
|
129
|
+
+-- 2. First window opens
|
|
130
|
+
| |
|
|
131
|
+
| +-- semantic colors resolve against the now-applied mode
|
|
132
|
+
| +-- bg-surface -> surfaceColor -> light or dark hex
|
|
133
|
+
| +-- text-on-surface -> textColor -> light or dark hex
|
|
134
|
+
|
|
|
135
|
+
+-- 3. User taps "Dark" in Settings
|
|
136
|
+
|
|
|
137
|
+
+-- Appearance.set('dark')
|
|
138
|
+
| |
|
|
139
|
+
| +-- Ti.UI.overrideUserInterfaceStyle = USER_INTERFACE_STYLE_DARK
|
|
140
|
+
| +-- Ti.App.Properties.setInt('userInterfaceStyle', ...)
|
|
141
|
+
|
|
|
142
|
+
+-- All semantic colors repaint instantly
|
|
143
|
+
+-- Preference survives the next cold launch
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
`Ti.App.Properties` is the persistence layer — the value written during `set(...)` is what `init()` reads on the next launch. Clearing app storage or reinstalling resets to `'system'`.
|
|
147
|
+
|
|
148
|
+
> **INFO**
|
|
149
|
+
>
|
|
150
|
+
> `toggle()` intentionally skips `'system'`. If the current mode is `'system'`, calling `toggle()` produces `'dark'`. If you want a three-way cycle (System -> Light -> Dark -> System), build it in userland with `Appearance.get()` + `Appearance.set(...)`; do not expect `toggle()` to do it.
|
|
151
|
+
|
|
152
|
+
## Related
|
|
153
|
+
|
|
154
|
+
- [semantic-colors.md](./semantic-colors.md) — defining `app/assets/semantic.colors.json` and mapping the color names in `config.cjs` so views actually respond to mode changes.
|
|
155
|
+
- [cli-commands.md#semantic-command](./cli-commands.md#semantic-command) — the `purgetss semantic` command, which writes both the JSON and the `config.cjs` mapping for you.
|
|
156
|
+
- [customization-deep-dive.md](./customization-deep-dive.md) — full `config.cjs` structure, including the `theme.extend.colors` section where semantic names are registered.
|
|
157
|
+
|
|
158
|
+
## Community-Discovered Patterns
|
|
159
|
+
|
|
160
|
+
- **Always call `Appearance.init()` before opening the first window.** Opening the window first causes a visible flicker on cold launch as the UI repaints from the system default to the saved mode. The official best-practices guide puts `Appearance.init()` on line 3 of `app/controllers/index.js`, immediately before `$.navWin.open()`, for exactly this reason.
|
|
161
|
+
- **`toggle()` is not a three-state cycle.** It only alternates between `'light'` and `'dark'`. If the saved mode is `'system'`, the first `toggle()` call lands on `'dark'`. Build a cycle yourself with `get()` + `set(...)` when you need one.
|
|
@@ -203,6 +203,81 @@ theme: {
|
|
|
203
203
|
'.btn[if=Alloy.Globals.iPhoneX]': { bottom: 48 }
|
|
204
204
|
```
|
|
205
205
|
|
|
206
|
+
## Customizing Window, View, and ImageView
|
|
207
|
+
|
|
208
|
+
`Window`, `View`, and `ImageView` have built-in defaults (white Window background, `Ti.UI.SIZE` on View, `hires: true` on ImageView for iOS). To change those defaults globally, put the customization under `theme.extend` — the same place you would extend `colors` or `spacing`:
|
|
209
|
+
|
|
210
|
+
`./purgetss/config.cjs`
|
|
211
|
+
```javascript
|
|
212
|
+
module.exports = {
|
|
213
|
+
theme: {
|
|
214
|
+
extend: {
|
|
215
|
+
Window: {
|
|
216
|
+
apply: 'exit-on-close-false bg-blue-500'
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
Now every `<Window>` in the project picks up `backgroundColor: '#3b82f6'` and `exitOnClose: false`.
|
|
224
|
+
|
|
225
|
+
The same pattern works for `View` and `ImageView`. For example, to make all `ImageView` elements use `hires: true` on iOS (which PurgeTSS already does by default on iOS), or to set a different default for `View`:
|
|
226
|
+
|
|
227
|
+
`./purgetss/config.cjs`
|
|
228
|
+
```javascript
|
|
229
|
+
module.exports = {
|
|
230
|
+
theme: {
|
|
231
|
+
extend: {
|
|
232
|
+
ImageView: {
|
|
233
|
+
ios: {
|
|
234
|
+
apply: 'hires-true'
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
View: {
|
|
238
|
+
apply: 'wh-auto'
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
};
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
### Shorthand: no `default:` wrapper needed
|
|
246
|
+
|
|
247
|
+
The examples above use `{ apply: '...' }` directly. Internally that gets normalized to `{ default: { apply: '...' } }`, so both forms produce the same TSS:
|
|
248
|
+
|
|
249
|
+
```javascript
|
|
250
|
+
// Both of these work
|
|
251
|
+
Window: { apply: 'exit-on-close-false bg-blue-500' }
|
|
252
|
+
Window: { default: { apply: 'exit-on-close-false bg-blue-500' } }
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
Use the explicit `default:` wrapper when you also need platform blocks (`ios:`, `android:`) next to it. For the common case of one bundle of defaults, the shorthand reads better.
|
|
256
|
+
|
|
257
|
+
### Apply Wins Over Static Defaults
|
|
258
|
+
|
|
259
|
+
If `apply` sets a property that the component already has as a built-in default, the applied value replaces the original instead of both ending up in the final TSS:
|
|
260
|
+
|
|
261
|
+
`./purgetss/config.cjs`
|
|
262
|
+
```javascript
|
|
263
|
+
module.exports = {
|
|
264
|
+
theme: {
|
|
265
|
+
extend: {
|
|
266
|
+
Window: { apply: 'bg-blue-500' }
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
};
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
`./purgetss/styles/utilities.tss`
|
|
273
|
+
```tss
|
|
274
|
+
/* Before dedup: { backgroundColor: '#FFFFFF', backgroundColor: '#3b82f6' } */
|
|
275
|
+
/* After dedup: */
|
|
276
|
+
'Window': { backgroundColor: '#3b82f6' }
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
Without the dedup, both `backgroundColor` entries would land in the file; the last one would win at runtime anyway, but reading the TSS with two copies of the same property is confusing. The builder keeps only the applied value.
|
|
280
|
+
|
|
206
281
|
## Platform-Specific Classes
|
|
207
282
|
|
|
208
283
|
Several classes in `utilities.tss` are platform-specific (e.g., `clip-enabled`, `status-bar-style-light-content`). These only exist with a `[platform=ios]` or `[platform=android]` suffix.
|
|
@@ -276,16 +351,21 @@ module.exports = {
|
|
|
276
351
|
'.my-view': { backgroundColor: '#22c55e', width: 128, height: 128 }
|
|
277
352
|
```
|
|
278
353
|
|
|
279
|
-
> **Titanium Fill Rule**
|
|
280
|
-
> When composing layout utilities inside `apply`, prefer `w-screen` for fill behavior. `w-full` maps to `100%`, not `Ti.UI.FILL`.
|
|
281
|
-
|
|
282
354
|
## Community-Discovered Patterns
|
|
283
355
|
|
|
356
|
+
### Titanium Fill Rule
|
|
357
|
+
|
|
358
|
+
When composing layout utilities inside `apply`, prefer `w-screen` for fill behavior. `w-full` maps to `100%`, not `Ti.UI.FILL`. In Titanium, `Ti.UI.FILL` is the layout primitive that makes a view fill its parent; a literal `100%` can behave unexpectedly inside nested containers.
|
|
359
|
+
|
|
360
|
+
### Platform-Specific Constants in `apply`
|
|
361
|
+
|
|
362
|
+
Constants like `Ti.UI.iOS.CLIP_MODE_ENABLED` or `Ti.UI.iOS.StatusBar.LIGHT_CONTENT` only exist on the platform that defines them. PurgeTSS utility classes such as `clip-enabled` or `status-bar-style-light-content` therefore only exist with a `[platform=ios]` or `[platform=android]` suffix in `utilities.tss`. When you reference them from `apply`, put them inside the correct platform block (`ios:` / `android:`) so PurgeTSS resolves them — otherwise the class silently drops on the wrong platform and can throw a runtime error if it reaches it. See the "Platform-Specific Classes" section above for the resolution rules.
|
|
363
|
+
|
|
284
364
|
### Global Window defaults for Large Titles + ScrollView (iOS)
|
|
285
365
|
|
|
286
|
-
|
|
366
|
+
**See the dedicated reference: [`ios-large-titles.md`](./ios-large-titles.md)** — it covers the full pattern (three-property pairing, global-defaults recipe, TabGroup implicit NavigationWindow behavior, detail-window opt-out, and the ScrollView `content-w-screen` / `content-h-auto` pairing).
|
|
287
367
|
|
|
288
|
-
|
|
368
|
+
Minimal recap — when Large Titles are in use, set the base iOS Window defaults once via `apply` in `config.cjs` rather than repeating them in every XML view:
|
|
289
369
|
|
|
290
370
|
`./purgetss/config.cjs`
|
|
291
371
|
```javascript
|
|
@@ -293,35 +373,11 @@ module.exports = {
|
|
|
293
373
|
theme: {
|
|
294
374
|
Window: {
|
|
295
375
|
ios: {
|
|
296
|
-
apply: 'auto-adjust-scroll-view-insets extend-edges-all
|
|
376
|
+
apply: 'auto-adjust-scroll-view-insets extend-edges-all large-title-enabled'
|
|
297
377
|
}
|
|
298
378
|
}
|
|
299
379
|
}
|
|
300
380
|
};
|
|
301
381
|
```
|
|
302
382
|
|
|
303
|
-
|
|
304
|
-
```tss
|
|
305
|
-
'Window[platform=ios]': { autoAdjustScrollViewInsets: true, extendEdges: [ Ti.UI.EXTEND_EDGE_ALL ], statusBarStyle: Ti.UI.iOS.StatusBar.LIGHT_CONTENT }
|
|
306
|
-
```
|
|
307
|
-
|
|
308
|
-
Then in each view XML, only add `largeTitleEnabled` and `largeTitleDisplayMode` as needed:
|
|
309
|
-
|
|
310
|
-
```xml
|
|
311
|
-
<Window title="Home" class="large-title-enabled">
|
|
312
|
-
<ScrollView class="vertical w-screen" contentHeight="Ti.UI.SIZE">
|
|
313
|
-
<!-- Content starts below the nav bar automatically -->
|
|
314
|
-
</ScrollView>
|
|
315
|
-
</Window>
|
|
316
|
-
```
|
|
317
|
-
|
|
318
|
-
This works for both NavigationWindow and TabGroup — on iOS, TabGroup wraps each Tab in an implicit NavigationWindow.
|
|
319
|
-
|
|
320
|
-
| Class | Property | Value |
|
|
321
|
-
|---|---|---|
|
|
322
|
-
| `auto-adjust-scroll-view-insets` | `autoAdjustScrollViewInsets` | `true` |
|
|
323
|
-
| `extend-edges-all` | `extendEdges` | `[ Ti.UI.EXTEND_EDGE_ALL ]` |
|
|
324
|
-
| `large-title-enabled` | `largeTitleEnabled` | `true` |
|
|
325
|
-
| `large-title-display-mode` | `largeTitleDisplayMode` | Uses `LARGE_TITLE_DISPLAY_MODE_*` constants |
|
|
326
|
-
|
|
327
|
-
> **Why `ios:` block instead of inline `ios:` prefix?** The three classes (`auto-adjust-scroll-view-insets`, `extend-edges-all`, `status-bar-style-light-content`) are platform-specific — they only exist with `[platform=ios]` suffix in `utilities.tss`. Using the `ios:` block in `config.cjs` ensures PurgeTSS resolves them correctly. See "Platform-Specific Classes" above.
|
|
383
|
+
The `ios:` block (not an inline `ios:` prefix) is required because these classes only exist with a `[platform=ios]` suffix — see "Platform-Specific Classes" above. The *why* (rendering delay vs content-behind-nav-bar), the display-mode constants, and per-window overrides live in [`ios-large-titles.md`](./ios-large-titles.md) and in the official PurgeTSS docs at [Best Practices → Large Titles on iOS](https://purgetss.com/docs/best-practices/3-large-titles-on-ios).
|
|
@@ -306,6 +306,10 @@ Try this example on an iPad or tablet.
|
|
|
306
306
|
</Alloy>
|
|
307
307
|
```
|
|
308
308
|
|
|
309
|
+
## Community-Discovered Patterns
|
|
310
|
+
|
|
311
|
+
These constraints reflect community experience using arbitrary values against the realities of the Titanium layout engine. They are not part of the official reference but prevent common mistakes.
|
|
312
|
+
|
|
309
313
|
> **Titanium Layout Constraint**
|
|
310
314
|
> Prefer `w-screen` instead of `w-full` when you need fill behavior. `w-full` maps to `100%`, not `Ti.UI.FILL`.
|
|
311
315
|
|
|
@@ -21,12 +21,13 @@ Complete inventory of all class prefixes organized by functional category. For n
|
|
|
21
21
|
| `content-*` | ~20 | `content-h-*`, `content-w-*` |
|
|
22
22
|
| `aspect-*` | 2 | `aspect-ratio-16-9`, `aspect-ratio-4-3` |
|
|
23
23
|
|
|
24
|
-
**
|
|
25
|
-
|
|
26
|
-
- `w-
|
|
27
|
-
- `
|
|
28
|
-
- `h-
|
|
29
|
-
- `
|
|
24
|
+
> **Community-Discovered Pattern: `w-full` vs `w-screen`**
|
|
25
|
+
>
|
|
26
|
+
> - `w-full` → `width: '100%'` — 100% of parent container
|
|
27
|
+
> - `w-screen` → `width: Ti.UI.FILL` — Fills all available space in parent
|
|
28
|
+
> - `h-full` → `height: '100%'` — 100% of parent container
|
|
29
|
+
> - `h-screen` → `height: Ti.UI.FILL` — Fills all available space in parent
|
|
30
|
+
> - `wh-full` → Both `'100%'`
|
|
30
31
|
|
|
31
32
|
### Spacing (Margins & Padding)
|
|
32
33
|
|
|
@@ -108,7 +109,7 @@ Complete inventory of all class prefixes organized by functional category. For n
|
|
|
108
109
|
| Prefix | Count | Examples |
|
|
109
110
|
| --- | --- | --- |
|
|
110
111
|
| `text-*` | 273 | Text colors, sizes, alignment |
|
|
111
|
-
| `font-*` |
|
|
112
|
+
| `font-*` | 12 | Weights: `font-thin`, `font-light`, `font-normal`, `font-medium`, `font-semibold`, `font-bold`, `font-extrabold`, `font-black`. Families (v7.5.3+): `font-sans`, `font-serif`, `font-mono` |
|
|
112
113
|
| `line-h-multiple-*` | ~85 | Line height as multiple |
|
|
113
114
|
| `line-spacing-*` | ~85 | Line spacing |
|
|
114
115
|
| `line-break-mode-*` | 7 | `line-break-mode-attribute-by-word-wrapping`, etc. |
|
|
@@ -192,6 +193,8 @@ Complete inventory of all class prefixes organized by functional category. For n
|
|
|
192
193
|
| `duration-*` | 22 | `duration-0`, `duration-50` to `duration-5000` |
|
|
193
194
|
| `delay-*` | 22 | `delay-0`, `delay-50` to `delay-5000` |
|
|
194
195
|
| `repeat-*` | ~31 | `repeat-*` variants |
|
|
196
|
+
| `snap-*` (v7.4.0+) | 6 | `snap-back`, `snap-back-false`, `snap-center`, `snap-center-false`, `snap-magnet`, `snap-magnet-false` — drop behaviors for draggable views |
|
|
197
|
+
| `keep-z-index` (v7.4.0+) | 2 | `keep-z-index`, `keep-z-index-false` — preserves z-order during drag when using `transition` layouts |
|
|
195
198
|
|
|
196
199
|
### Shadows & Elevation
|
|
197
200
|
|
|
@@ -120,10 +120,11 @@ Some PurgeTSS classes combine multiple Titanium properties under a single class
|
|
|
120
120
|
| `dragging-*` | `draggingType` | Animation module dragging |
|
|
121
121
|
| `filter-attribute-*` | `filterAttribute` | ListView filtering |
|
|
122
122
|
| `flip-*` | `flip` | Animation flipping |
|
|
123
|
-
| `font-*` | `fontFamily`, `fontSize`, `fontStyle`, `fontWeight` | Typography
|
|
123
|
+
| `font-*` | `fontFamily`, `fontSize`, `fontStyle`, `fontWeight` | Typography (v7.5.3+: `font-sans`, `font-serif`, `font-mono` family classes) |
|
|
124
124
|
| `grid-*` | Various | Grid layout system |
|
|
125
125
|
| `h-*` | `height` | All components |
|
|
126
126
|
| `hint-*` | `hintTextColor` | TextField placeholder |
|
|
127
|
+
| `keep-z-index` | `animationProperties.keepZIndex` (v7.4.0+) | Preserves z-order during drag when used with `transition` |
|
|
127
128
|
| `layout-*` | `layout` | View layout modes |
|
|
128
129
|
| `minimum-font-size-*` | `minimumFontSize` | Label auto-shrink |
|
|
129
130
|
| `navigation-*` | `navigationMode` | Navigation modes |
|
|
@@ -135,6 +136,7 @@ Some PurgeTSS classes combine multiple Titanium properties under a single class
|
|
|
135
136
|
| `scroll-type-*` | `scrollType` | Android scroll type |
|
|
136
137
|
| `shadow-*` | `shadowOffset`, `shadowRadius`, `shadowColor` | Box shadows |
|
|
137
138
|
| `show-*scroll-indicator` | `showHorizontalScrollIndicator`, `showVerticalScrollIndicator` | ScrollView |
|
|
139
|
+
| `snap-*` | `animationProperties.snap.{back, center, magnet}` (v7.4.0+) | Draggable drop behaviors |
|
|
138
140
|
| `status-bar-style-*` | `statusBarStyle` | iOS status bar |
|
|
139
141
|
| `tint-*` | `tintColor` | View/Button tinting |
|
|
140
142
|
| `title-*` | `titleAttributes: color/shadow` | iOS title styling |
|
|
@@ -759,7 +761,11 @@ For the complete prefix inventory organized by category (Layout, Spacing, Colors
|
|
|
759
761
|
|
|
760
762
|
---
|
|
761
763
|
|
|
762
|
-
##
|
|
764
|
+
## Community-Discovered Patterns
|
|
765
|
+
|
|
766
|
+
The rest of this document collects conventions, prohibitions, and insights surfaced by PurgeTSS users in real Titanium projects. They reflect how the utility system is actually used, not just how it is defined.
|
|
767
|
+
|
|
768
|
+
### PROHIBITED: CSS Classes (DO NOT EXIST)
|
|
763
769
|
|
|
764
770
|
| CSS Class | Issue | PurgeTSS Alternative |
|
|
765
771
|
| ----------------- | --------------------------------- | ------------------------------------------- |
|
|
@@ -779,10 +785,26 @@ For the complete prefix inventory organized by category (Layout, Spacing, Colors
|
|
|
779
785
|
| `leading-*` | Uses different prefix | Use `line-h-multiple-*` or `line-spacing-*` |
|
|
780
786
|
| `tracking-*` | Uses different prefix | Use `letter-spacing-*` |
|
|
781
787
|
|
|
788
|
+
### Key Insights from Real Data
|
|
789
|
+
|
|
790
|
+
1. **21,236 unique classes** across **364 unique prefixes** - Far more than initially documented
|
|
791
|
+
2. **Extensive state management** - Hundreds of `*enabled`, `*-false` classes for UI states
|
|
792
|
+
3. **Platform-specific classes** - Many iOS/Android specific variants (like `[platform=ios]`)
|
|
793
|
+
4. **Complete color coverage** - All 22 Tailwind v3 colors with 11 shades each (50-950) = 242 color variants per prefix
|
|
794
|
+
5. **Boolean class pattern** - For properties like `editable`, `enabled`, `visible` → `class` and `class-false`
|
|
795
|
+
6. **UI component state variants** - `selected-*`, `badge-*`, `title-*`, `disabled-*` with full color coverage
|
|
796
|
+
7. **Keyboard toolbar styling** - Extensive `keyboard-toolbar-*` classes for custom keyboard accessories
|
|
797
|
+
8. **Status bar & navigation** - `status-bar-*`, `tabs-*`, `nav-*` for system UI customization
|
|
798
|
+
9. **Accessibility support** - `accessibility-*` classes for a11y properties
|
|
799
|
+
10. **Animation system** - `duration-*`, `delay-*`, `rotate-*`, `scale-*` for PurgeTSS Animation component
|
|
800
|
+
|
|
782
801
|
---
|
|
783
802
|
|
|
784
803
|
## All 364 Unique Prefixes (Alphabetical)
|
|
785
804
|
|
|
805
|
+
> **NOTE**: Recent additions — v7.4.0 introduced `snap-back`, `snap-back-false`, `snap-center`, `snap-center-false`, `snap-magnet`, `snap-magnet-false`, `keep-z-index`, and `keep-z-index-false` for the Animation module drop/drag system. v7.5.3 introduced font-family classes `font-sans`, `font-serif`, `font-mono` alongside the existing weight classes.
|
|
806
|
+
|
|
807
|
+
|
|
786
808
|
```
|
|
787
809
|
accessibility, accessory, accuracy, action, active, activity, alignment, all, allow, allows,
|
|
788
810
|
amber, anchor, animated, app, arrow, aspect, audio, authentication, auto, autocapitalization,
|
|
@@ -809,7 +831,7 @@ pl, placeholder, platform, playback, pointer, portrait, position, pr, prevent, p
|
|
|
809
831
|
prune, pt, pull, purple, px, py, ready, recording, red, remote, repeat, requires, results,
|
|
810
832
|
return, reverse, right, role, rose, rotate, rounded, row, running, save, scale, scales,
|
|
811
833
|
scaling, scroll, scrollable, scrolling, scrolls, search, section, secure, selected, selection,
|
|
812
|
-
sentences, separator, shadow, shift, show, shows, shuffle, size, sky, slate, smooth, sorted,
|
|
834
|
+
sentences, separator, shadow, shift, show, shows, shuffle, size, sky, slate, smooth, snap, sorted,
|
|
813
835
|
source, split, state, status, stone, stopped, style, submit, subtitle, success, suppress,
|
|
814
836
|
suppresses, sustained, swipe, swipeable, tab, tabs, target, teal, text, theme, throw, thumb,
|
|
815
837
|
timeout, tint, title, tls, to, toggle, toolbar, top, torch, touch, trace, track, translucent,
|
|
@@ -868,18 +890,3 @@ These properties are NOT styled with classes in PurgeTSS - use as XML attributes
|
|
|
868
890
|
| `bindId` | `bindId="myData"` | ListView data binding |
|
|
869
891
|
|
|
870
892
|
**Note:** For `autocapitalization`, `editable`, `enabled`, `visible`, `autocorrect` - PurgeTSS DOES have classes (see above), so you CAN use either the class or the attribute depending on your preference.
|
|
871
|
-
|
|
872
|
-
---
|
|
873
|
-
|
|
874
|
-
## Key Insights from Real Data
|
|
875
|
-
|
|
876
|
-
1. **21,236 unique classes** across **364 unique prefixes** - Far more than initially documented
|
|
877
|
-
2. **Extensive state management** - Hundreds of `*enabled`, `*-false` classes for UI states
|
|
878
|
-
3. **Platform-specific classes** - Many iOS/Android specific variants (like `[platform=ios]`)
|
|
879
|
-
4. **Complete color coverage** - All 22 Tailwind v3 colors with 11 shades each (50-950) = 242 color variants per prefix
|
|
880
|
-
5. **Boolean class pattern** - For properties like `editable`, `enabled`, `visible` → `class` and `class-false`
|
|
881
|
-
6. **UI component state variants** - `selected-*`, `badge-*`, `title-*`, `disabled-*` with full color coverage
|
|
882
|
-
7. **Keyboard toolbar styling** - Extensive `keyboard-toolbar-*` classes for custom keyboard accessories
|
|
883
|
-
8. **Status bar & navigation** - `status-bar-*`, `tabs-*`, `nav-*` for system UI customization
|
|
884
|
-
9. **Accessibility support** - `accessibility-*` classes for a11y properties
|
|
885
|
-
10. **Animation system** - `duration-*`, `delay-*`, `rotate-*`, `scale-*` for PurgeTSS Animation component
|