@maccesar/titools 3.3.0 → 4.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/README.md +27 -61
- package/lib/cleanup.js +29 -0
- package/lib/commands/agents.js +8 -7
- package/lib/commands/skills.js +118 -23
- package/lib/config.js +13 -15
- package/lib/installer.js +5 -3
- package/lib/utils.js +36 -0
- package/package.json +1 -1
- package/skills/alloy-guides/SKILL.md +188 -0
- package/skills/alloy-guides/references/CLI_TASKS.md +233 -0
- package/skills/alloy-guides/references/CONCEPTS.md +171 -0
- package/skills/alloy-guides/references/CONTROLLERS.md +279 -0
- package/skills/alloy-guides/references/MODELS.md +742 -0
- package/skills/alloy-guides/references/MODELS_ADVANCED.md +482 -0
- package/skills/alloy-guides/references/PURGETSS.md +57 -0
- package/skills/alloy-guides/references/VIEWS_DYNAMIC.md +235 -0
- package/skills/alloy-guides/references/VIEWS_STYLES.md +375 -0
- package/skills/alloy-guides/references/VIEWS_WITHOUT_CONTROLLERS.md +102 -0
- package/skills/alloy-guides/references/VIEWS_XML.md +581 -0
- package/skills/alloy-guides/references/WIDGETS.md +160 -0
- package/skills/alloy-howtos/SKILL.md +179 -0
- package/skills/alloy-howtos/references/best_practices.md +121 -0
- package/skills/alloy-howtos/references/cli_reference.md +230 -0
- package/skills/alloy-howtos/references/config_files.md +158 -0
- package/skills/alloy-howtos/references/custom_tags.md +148 -0
- package/skills/alloy-howtos/references/debugging_troubleshooting.md +78 -0
- package/skills/alloy-howtos/references/samples.md +156 -0
- package/skills/purgetss/SKILL.md +6 -3
- package/skills/purgetss/references/EXAMPLES.md +8 -6
- package/skills/purgetss/references/app-branding.md +5 -0
- package/skills/purgetss/references/apply-directive.md +1 -1
- package/skills/purgetss/references/class-categories.md +1 -1
- package/skills/purgetss/references/class-index-properties.md +618 -0
- package/skills/purgetss/references/class-index.md +4 -610
- package/skills/purgetss/references/cli-commands.md +15 -0
- package/skills/purgetss/references/custom-fonts.md +39 -36
- package/skills/purgetss/references/custom-rules.md +1 -1
- package/skills/purgetss/references/customization-deep-dive.md +64 -1
- package/skills/purgetss/references/icon-fonts.md +2 -0
- package/skills/purgetss/references/migration-guide.md +53 -1
- package/skills/purgetss/references/multi-density-images.md +53 -2
- package/skills/purgetss/references/svg-pipeline.md +249 -0
- package/skills/purgetss/references/tikit-components.md +2 -2
- package/skills/purgetss/references/titanium-resets.md +2 -2
- package/skills/purgetss/references/ui-ux-design.md +7 -5
- package/skills/purgetss/references/version-history.md +12 -0
- package/skills/ti-api/SKILL.md +128 -0
- package/skills/ti-api/references/api-android.md +675 -0
- package/skills/ti-api/references/api-app-platform.md +636 -0
- package/skills/ti-api/references/api-core.md +764 -0
- package/skills/ti-api/references/api-data-network.md +641 -0
- package/skills/ti-api/references/api-media.md +655 -0
- package/skills/ti-api/references/api-modules-ble-bluetooth.md +657 -0
- package/skills/ti-api/references/api-modules-coremotion-urlsession.md +411 -0
- package/skills/ti-api/references/api-modules-map.md +632 -0
- package/skills/ti-api/references/api-modules-nfc.md +725 -0
- package/skills/ti-api/references/api-modules-social-misc.md +526 -0
- package/skills/ti-api/references/api-services.md +700 -0
- package/skills/ti-api/references/api-ui-android.md +499 -0
- package/skills/ti-api/references/api-ui-extras.md +702 -0
- package/skills/ti-api/references/api-ui-ios-animator.md +378 -0
- package/skills/ti-api/references/api-ui-ios.md +756 -0
- package/skills/ti-api/references/api-ui-lists.md +581 -0
- package/skills/ti-api/references/api-ui-text-input.md +607 -0
- package/skills/ti-api/references/api-ui-views.md +572 -0
- package/skills/ti-api/references/api-ui-windows-navigation.md +676 -0
- package/skills/ti-api/references/api-xml-global.md +743 -0
- package/skills/ti-guides/SKILL.md +82 -0
- package/skills/ti-guides/references/advanced-data-and-images.md +155 -0
- package/skills/ti-guides/references/android-manifest.md +97 -0
- package/skills/ti-guides/references/app-distribution.md +373 -0
- package/skills/ti-guides/references/application-frameworks.md +366 -0
- package/skills/ti-guides/references/cli-reference.md +700 -0
- package/skills/ti-guides/references/coding-best-practices.md +150 -0
- package/skills/ti-guides/references/commonjs-advanced.md +279 -0
- package/skills/ti-guides/references/hello-world.md +99 -0
- package/skills/ti-guides/references/hyperloop-native-access.md +458 -0
- package/skills/ti-guides/references/javascript-primer.md +402 -0
- package/skills/ti-guides/references/reserved-words.md +36 -0
- package/skills/ti-guides/references/resources.md +172 -0
- package/skills/ti-guides/references/style-and-conventions.md +104 -0
- package/skills/ti-guides/references/tiapp-config.md +655 -0
- package/skills/ti-howtos/SKILL.md +131 -0
- package/skills/ti-howtos/references/android-platform-deep-dives.md +609 -0
- package/skills/ti-howtos/references/automation-fastlane-appium.md +96 -0
- package/skills/ti-howtos/references/buffer-codec-streams.md +162 -0
- package/skills/ti-howtos/references/cross-platform-development.md +358 -0
- package/skills/ti-howtos/references/debugging-profiling.md +473 -0
- package/skills/ti-howtos/references/extending-titanium.md +684 -0
- package/skills/ti-howtos/references/google-maps-v2.md +172 -0
- package/skills/ti-howtos/references/ios-map-kit.md +149 -0
- package/skills/ti-howtos/references/ios-platform-deep-dives.md +595 -0
- package/skills/ti-howtos/references/local-data-sources.md +310 -0
- package/skills/ti-howtos/references/location-and-maps.md +267 -0
- package/skills/ti-howtos/references/media-apis.md +268 -0
- package/skills/ti-howtos/references/notification-services.md +539 -0
- package/skills/ti-howtos/references/remote-data-sources.md +339 -0
- package/skills/ti-howtos/references/tutorials.md +552 -0
- package/skills/ti-howtos/references/using-modules.md +182 -0
- package/skills/ti-howtos/references/web-content-integration.md +288 -0
- package/skills/ti-howtos/references/webpack-build-pipeline.md +125 -0
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
# SVG-Aware Compile-Time Image Pipeline
|
|
2
|
+
|
|
3
|
+
Added in PurgeTSS v7.11.0 (refined in v7.11.1), the SVG pipeline runs as a **post-step of `purgetss`** — after the regular purge finishes and `app.tss` is finalized. It scans your views and controllers for SVG references, resolves each SVG's display size from the utility classes on the same node, and generates the matching multi-density PNGs. You do **not** call `purgetss images` separately or declare dimensions anywhere else. The cascade of `w-*` / `h-*` classes in your XML decides the size.
|
|
4
|
+
|
|
5
|
+
For the standalone `purgetss images` command (all files under `purgetss/images/`, CLI flags, format conversion), see [Multi-density images](./multi-density-images.md).
|
|
6
|
+
|
|
7
|
+
> **INFO — At a glance**
|
|
8
|
+
>
|
|
9
|
+
> Drop an SVG into `purgetss/images/`, reference it from a view as `image="/images/<sub>/<name>.svg"` with a numeric `w-*` or `h-*` class, and run `purgetss`. The pipeline emits 8 density variants (5 Android + 3 iPhone PNGs). Titanium loads the generated `.png` at runtime even though your XML still says `.svg`. The SVG attribute in your source is never rewritten.
|
|
10
|
+
|
|
11
|
+
## Why this exists
|
|
12
|
+
|
|
13
|
+
Titanium doesn't load `.svg` files natively in `Ti.UI.ImageView`. Without help you have two options, both manual:
|
|
14
|
+
|
|
15
|
+
1. Hand-rasterize every SVG into `app/assets/{iphone,android}/images/.../*.png` for every density. Tedious, easy to get wrong, and easy to forget when you swap a logo.
|
|
16
|
+
2. Run `purgetss images` manually after every SVG edit. Better, but still manual, and you have to know the dimensions in advance.
|
|
17
|
+
|
|
18
|
+
The SVG pipeline removes both chores: you reference the `.svg` from a view, size it with the same utility classes you use everywhere else, and `purgetss` generates the PNGs on the next run.
|
|
19
|
+
|
|
20
|
+
## The runtime trick
|
|
21
|
+
|
|
22
|
+
When a view requests `image="/foo.svg"` and Titanium cannot use that file as SVG, the image loader falls back to a `.png` with the same basename in the platform assets folder. If PurgeTSS writes `foo.png` plus `@2x`, `@3x`, and the Android densities, the view loads correctly even though the XML still references `.svg`. The pipeline never touches the `.svg` string in your source.
|
|
23
|
+
|
|
24
|
+
## How it works (the short version)
|
|
25
|
+
|
|
26
|
+
```text
|
|
27
|
+
purgetss
|
|
28
|
+
├─ regular purge → writes app.tss with .w-32, .h-auto, .w-(300), etc.
|
|
29
|
+
└─ SVG post-step:
|
|
30
|
+
1. Parse app.tss → class → props map
|
|
31
|
+
2. Scan views (.xml) and controllers (.js) for SVG references
|
|
32
|
+
3. For each SVG, resolve width/height by applying its classes against app.tss
|
|
33
|
+
4. Sync images.files in config.cjs (autoSync ON)
|
|
34
|
+
5. Generate PNGs with Sharp, using a hash-based cache to skip unchanged files
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
The pipeline only touches SVGs you actually reference from views or controllers. Files that sit in `purgetss/images/` but are not referenced anywhere are ignored by the pipeline (the standalone `purgetss images` command still processes them).
|
|
38
|
+
|
|
39
|
+
## What gets detected
|
|
40
|
+
|
|
41
|
+
**XML views:** any node attribute ending in `.svg` is captured along with its `class=""` attribute:
|
|
42
|
+
|
|
43
|
+
```xml
|
|
44
|
+
<ImageView class="w-32 h-auto" image="/images/logos/logo.svg" />
|
|
45
|
+
<ImageView class="w-(300) bg-red-500" image="/images/banners/hero.svg" />
|
|
46
|
+
<View backgroundImage="/images/textures/grain.svg" class="wh-screen" />
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Both `image` and `backgroundImage` (and any other attribute whose value ends in `.svg`) are picked up.
|
|
50
|
+
|
|
51
|
+
**Controllers:** objects passed to `$.UI.create(...)` (or similar) that mix `image: '...svg'` and `classes: '...'` are captured by an AST walker:
|
|
52
|
+
|
|
53
|
+
```javascript
|
|
54
|
+
$.UI.create('ImageView', {
|
|
55
|
+
image: '/images/logos/logo.svg',
|
|
56
|
+
classes: 'w-(300) bg-red-500'
|
|
57
|
+
})
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Static-scanner limitation
|
|
61
|
+
|
|
62
|
+
The scanner sees **literal string values only**, not computed paths. Dynamically composed paths are not detected:
|
|
63
|
+
|
|
64
|
+
```javascript
|
|
65
|
+
// NOT detected — path is concatenated at runtime
|
|
66
|
+
image: '/images/' + variant + '.svg'
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
For dynamic references, pin the dimensions manually under `images.files` (see [Manual pinning](#manual-pinning-for-undetected-references)) so the pipeline still generates the PNGs.
|
|
70
|
+
|
|
71
|
+
## How dimensions get resolved
|
|
72
|
+
|
|
73
|
+
For each SVG reference, the cascade of classes is applied against `app.tss` in declaration order (later-wins, matching Alloy semantics). The pipeline pulls the final `width` and `height` numbers:
|
|
74
|
+
|
|
75
|
+
| Class on the view | What `app.tss` resolves | What the pipeline pins |
|
|
76
|
+
| ------------------------------ | ---------------------------------- | -------------------------------------------------------------- |
|
|
77
|
+
| `class="w-32"` | `width: 128` | `widthDp = 128` |
|
|
78
|
+
| `class="w-40 h-12"` | `width: 160`, `height: 48` | `widthDp = 160`, `heightDp = 48` |
|
|
79
|
+
| `class="w-(300)"` | `width: 300` (arbitrary value) | `widthDp = 300` |
|
|
80
|
+
| `class="h-44"` (no `w-*`) | `height: 176` | `heightDp = 176`; width derived from viewBox at generation time |
|
|
81
|
+
| `class="w-32 h-auto"` | `width: 128`, `height: Ti.UI.SIZE` | `widthDp = 128`; height derived from viewBox |
|
|
82
|
+
| `class="w-full"` (non-numeric) | `width: Ti.UI.FILL` | skipped with a warning; no usable dim |
|
|
83
|
+
|
|
84
|
+
Note the spacing convention: PurgeTSS multiplies the Tailwind-style numeric scale, so `w-32` resolves to `width: 128` (128 dp), not 32.
|
|
85
|
+
|
|
86
|
+
### Auto-derived dimensions stay out of config
|
|
87
|
+
|
|
88
|
+
If you used `h-auto` (or no `h-*`), the height field does **not** appear in the `images.files` entry. The generator re-derives it from the SVG's `viewBox` on every run. The same applies to width when only `h-*` is pinned. This keeps stale values out of `config.cjs` — the unpinned side stays `null` and is always recomputed from the current viewBox.
|
|
89
|
+
|
|
90
|
+
## Multiple references to the same SVG
|
|
91
|
+
|
|
92
|
+
If two views reference the same SVG with different classes, the pipeline takes the **max of each dimension across all references**. The generated PNGs are then sharp enough for the largest use:
|
|
93
|
+
|
|
94
|
+
```xml
|
|
95
|
+
<!-- view A -->
|
|
96
|
+
<ImageView class="w-32" image="/images/logos/logo.svg" />
|
|
97
|
+
<!-- view B -->
|
|
98
|
+
<ImageView class="w-(800)" image="/images/logos/logo.svg" />
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Resolved: `widthDp = 800`. The generated PNGs cover both views; the smaller one just downsamples at runtime.
|
|
102
|
+
|
|
103
|
+
## How `config.cjs` is synced (autoSync ON)
|
|
104
|
+
|
|
105
|
+
After resolving dimensions, the pipeline upserts an entry in `images.files`:
|
|
106
|
+
|
|
107
|
+
```javascript title="./purgetss/config.cjs"
|
|
108
|
+
images: {
|
|
109
|
+
autoSync: true,
|
|
110
|
+
files: [
|
|
111
|
+
{ filename: 'images/logos/logo.svg', width: 176 }
|
|
112
|
+
]
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### The current run wins (v7.11.1 cascade policy)
|
|
117
|
+
|
|
118
|
+
Policy in plain terms: **the current run's cascade wins.** If you change `w-32` to `w-40`, the entry updates to `width: 160`. If you bump back to `w-32`, it updates back to `128`. On every run, the entry mirrors what the views ask for.
|
|
119
|
+
|
|
120
|
+
This is **not** a high-water mark. The old (pre-7.11.1) policy used `max(existing, derived)`, which froze sizes when you shrank a class — for example `h-52` → `h-16` kept the 208 dp height cemented in config. The 7.11.1 policy follows the cascade, so shrinks propagate correctly. Manual pinning is still available via `autoSync: false`.
|
|
121
|
+
|
|
122
|
+
### Symmetric width/height cascade (v7.11.1)
|
|
123
|
+
|
|
124
|
+
`deriveDimensions` accepts width-only, height-only, or both. The unpinned side stays `null` in `images.files`, and `gen-scales` derives it from the SVG viewBox on every run — no more stale auto-derived heights cemented in config. For a height-only source, `gen-scales` computes the width from the inverse aspect ratio.
|
|
125
|
+
|
|
126
|
+
### No gratuitous rewrites (v7.11.1)
|
|
127
|
+
|
|
128
|
+
If a run is byte-identical to the previous one (no inserts, no updates — `inserted === 0 && updated === 0`), `config.cjs` is **not** rewritten. Its `mtime` does not change, so downstream `utilities.tss` rebuilds are not triggered for nothing.
|
|
129
|
+
|
|
130
|
+
### Manual mode: `autoSync: false`
|
|
131
|
+
|
|
132
|
+
```javascript title="./purgetss/config.cjs"
|
|
133
|
+
images: {
|
|
134
|
+
autoSync: false,
|
|
135
|
+
files: [
|
|
136
|
+
{ filename: 'images/logos/logo.svg', width: 1024 }
|
|
137
|
+
]
|
|
138
|
+
}
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
With `autoSync: false`:
|
|
142
|
+
|
|
143
|
+
- The pipeline still derives dimensions and generates PNGs, using the values you wrote in `images.files` — or the cascade fallback for files not listed.
|
|
144
|
+
- `config.cjs` is **never** written. Those entries are yours to maintain.
|
|
145
|
+
|
|
146
|
+
Use this when you want to pin sizes by hand and not have PurgeTSS overwrite your work.
|
|
147
|
+
|
|
148
|
+
## Force-PNG output
|
|
149
|
+
|
|
150
|
+
The SVG pipeline **always emits `.png`**, regardless of `images.format`. This is deliberate:
|
|
151
|
+
|
|
152
|
+
1. Titanium's `image="/foo.svg"` fallback resolves to `.png` only. `.webp`, `.jpeg`, and `.avif` are not picked up through the `.svg` reference.
|
|
153
|
+
2. Having a sibling `.webp` (or any non-`.png`) next to `.png` on disk for the same basename **breaks the fallback entirely**. Titanium then shows nothing.
|
|
154
|
+
|
|
155
|
+
So even if you set `format: 'webp'` (which is honored by `purgetss images` for raster sources and unlisted SVGs), the post-purge pipeline emits `.png` for every SVG it processes. The `--debug` output line reads `png (forced; ignores format: webp)`.
|
|
156
|
+
|
|
157
|
+
If you genuinely want a `.webp` of an SVG, reference it as `image="/.../foo.webp"` in your XML, not as `.svg`. The standalone `purgetss images` command will then generate `.webp` for that file. See the [WebP and SVG warning](./multi-density-images.md) in the multi-density reference.
|
|
158
|
+
|
|
159
|
+
## The PNG cache
|
|
160
|
+
|
|
161
|
+
PurgeTSS keeps a cache at `purgetss/.cache/svg-images.json`:
|
|
162
|
+
|
|
163
|
+
```json
|
|
164
|
+
{
|
|
165
|
+
"logos/logo.svg": {
|
|
166
|
+
"svgHash": "<sha1>",
|
|
167
|
+
"widthDp": 176,
|
|
168
|
+
"heightDp": null,
|
|
169
|
+
"targets": [
|
|
170
|
+
"app/assets/android/images/res-mdpi/logos/logo.png",
|
|
171
|
+
"app/assets/iphone/images/logos/logo@2x.png",
|
|
172
|
+
"..."
|
|
173
|
+
]
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
A cached entry is reused, and Sharp is **not** invoked, when all of these hold:
|
|
179
|
+
|
|
180
|
+
- The SVG's bytes haven't changed (SHA-1 match).
|
|
181
|
+
- `widthDp` resolved is the same as cached.
|
|
182
|
+
- `heightDp` resolved is the same as cached.
|
|
183
|
+
- Every target PNG path matches and exists on disk.
|
|
184
|
+
|
|
185
|
+
Otherwise, PurgeTSS regenerates the image. If you `git clean`, delete a PNG by hand, or change a class in XML/JS, the next run regenerates only the affected SVGs. Unaffected entries stay cached.
|
|
186
|
+
|
|
187
|
+
> **Add `purgetss/.cache/` to `.gitignore`.** It is a per-machine artifact.
|
|
188
|
+
|
|
189
|
+
## Manual pinning for undetected references
|
|
190
|
+
|
|
191
|
+
When the static scanner cannot see a reference (dynamic/concatenated paths) or a view has no resolvable `w-*` / `h-*` class, pin the entry by hand so the pipeline still generates the PNGs:
|
|
192
|
+
|
|
193
|
+
```javascript title="./purgetss/config.cjs"
|
|
194
|
+
images: {
|
|
195
|
+
files: [
|
|
196
|
+
{ filename: 'images/<sub>/<name>.svg', width: 256 }
|
|
197
|
+
]
|
|
198
|
+
}
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
## Standalone command vs post-purge pipeline
|
|
202
|
+
|
|
203
|
+
| Aspect | `purgetss` (post-purge SVG pipeline) | `purgetss images` (standalone) |
|
|
204
|
+
| ----------------------- | ------------------------------------ | ------------------------------------------------- |
|
|
205
|
+
| What it processes | Only SVGs referenced from XML/JS | All files under `purgetss/images/` |
|
|
206
|
+
| Source of dimensions | Class cascade in `app.tss` | CLI `--width` > `images.files` > viewBox / source |
|
|
207
|
+
| Touches `images.files`? | Yes (autoSync ON) | No; only reads it as overrides |
|
|
208
|
+
| Output format for SVGs | Always PNG | PNG for SVGs in `files`; `format` otherwise |
|
|
209
|
+
| When to run | Automatic on every `purgetss` | Manual, after raster source edits |
|
|
210
|
+
|
|
211
|
+
Both share the same `images.files` array and the same generation engine (`gen-scales`). They do not fight each other: the pipeline edits `images.files`; the standalone command reads it as overrides. Run either, or both.
|
|
212
|
+
|
|
213
|
+
## Troubleshooting
|
|
214
|
+
|
|
215
|
+
### "no class resolved width or height to a number; skipping"
|
|
216
|
+
|
|
217
|
+
The SVG is referenced from a view with no resolvable `w-*` or `h-*` class (just `w-full`, `w-screen`, `bg-*`, etc.). Add a numeric `w-*` or `h-*` utility, or pin the size manually in `images.files`:
|
|
218
|
+
|
|
219
|
+
```javascript
|
|
220
|
+
files: [
|
|
221
|
+
{ filename: 'images/<sub>/<name>.svg', width: 256 }
|
|
222
|
+
]
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### My change to a class didn't update the PNG
|
|
226
|
+
|
|
227
|
+
Check that the class actually exists in `app.tss` after purging. The Tailwind-style spacing scale skips numbers like `h-50`; only `h-48`, `h-52`, `h-56` are emitted by default. Add custom values under `theme.extend.spacing` if you need them, or use arbitrary values: `h-(50)`, `h-(200px)`, `h-(12.5rem)`.
|
|
228
|
+
|
|
229
|
+
If the class is correct but the image didn't refresh on device, it might be the Titanium simulator's image cache. Do a clean build.
|
|
230
|
+
|
|
231
|
+
### The pipeline didn't detect my SVG reference
|
|
232
|
+
|
|
233
|
+
The static scanner sees literal string values, not computed paths. Concatenated strings (`'/images/' + variant + '.svg'`) are not detected. Pin the entry in `images.files` manually so the pipeline still generates the PNGs.
|
|
234
|
+
|
|
235
|
+
### `<ImageView image="/.../foo.svg" />` shows nothing
|
|
236
|
+
|
|
237
|
+
Two common causes:
|
|
238
|
+
|
|
239
|
+
1. There is no `.png` next to the `.svg`. Titanium falls back from `.svg` references to `.png` siblings; if the pipeline hasn't generated them yet, the fallback can't fire. Run `purgetss` (or `purgetss images`) and verify the `.png` exists under `app/assets/iphone/images/` and `app/assets/android/images/res-*/`.
|
|
240
|
+
2. Both `.png` and `.webp` (or another non-png) sit next to each other for the same basename. That breaks the fallback entirely. Delete the non-`.png` siblings, or let the force-PNG pipeline own the SVG.
|
|
241
|
+
|
|
242
|
+
### I want to opt out for a specific run
|
|
243
|
+
|
|
244
|
+
Switch `autoSync: false` and manage the `images.files` entries yourself, or delete the SVG cache entry. The pipeline still derives dimensions and generates the PNGs so views keep working, but it does not write to `config.cjs`.
|
|
245
|
+
|
|
246
|
+
## See also
|
|
247
|
+
|
|
248
|
+
- [Multi-density images](./multi-density-images.md) — the standalone `purgetss images` command, `--width`, format conversion, and `images.files` overrides.
|
|
249
|
+
- [PurgeTSS Configuration Deep Dive](./customization-deep-dive.md) — the `images:` config block and the config syntax validator.
|
|
@@ -316,7 +316,7 @@ Colors: `black`, `dark`, `light`, and `white` themes that affect background and
|
|
|
316
316
|
|
|
317
317
|
Use this for code examples. Set `copy="true"` to add a copy button.
|
|
318
318
|
|
|
319
|
-
**Pro tip — recommended monospace fonts:** For best results, install a monospaced font (like Fira Code or JetBrains Mono) and configure `font-mono` in your PurgeTSS config. (Source: official tikit docs
|
|
319
|
+
**Pro tip — recommended monospace fonts:** For best results, install a monospaced font (like Fira Code or JetBrains Mono) and configure `font-mono` in your PurgeTSS config. (Source: the official tikit docs.)
|
|
320
320
|
|
|
321
321
|
**Localization:** The copy button uses `L('copy', 'Copy')` for its title and `L('code_copied', 'Code copied!')` for the confirmation message. Add these keys to your `strings.xml` files for translation.
|
|
322
322
|
|
|
@@ -512,4 +512,4 @@ You can mix and match icons from different libraries throughout your app.
|
|
|
512
512
|
|
|
513
513
|
## License
|
|
514
514
|
|
|
515
|
-
TiKit UI Components is open source under the MIT License (Copyright 2023-2025
|
|
515
|
+
TiKit UI Components is open source under the MIT License (Copyright (c) 2023-2025 César Estrada).
|
|
@@ -30,7 +30,7 @@ The most important reset is for the `View` element. By default, `View` is set to
|
|
|
30
30
|
- Grow to accommodate explicit dimensions (`w-64`, `h-32`, etc.)
|
|
31
31
|
- Expand to fill margins (`m-4`, `mx-2`, `mt-6 mb-4`, etc.)
|
|
32
32
|
|
|
33
|
-
> **See also**:
|
|
33
|
+
> **See also**: [Width/Height Inheritance](#widthheight-inheritance) explains when to use `h-auto`, `w-auto`, and `wh-auto` to prevent unwanted stretching.
|
|
34
34
|
|
|
35
35
|
### Practical Examples
|
|
36
36
|
|
|
@@ -264,7 +264,7 @@ This generates classes for ALL color properties:
|
|
|
264
264
|
When PurgeTSS generates your `app.tss`, these resets appear first:
|
|
265
265
|
|
|
266
266
|
```tss
|
|
267
|
-
/* PurgeTSS v7.
|
|
267
|
+
/* PurgeTSS v7.11.1 */
|
|
268
268
|
/* Created by César Estrada */
|
|
269
269
|
/* https://purgetss.com */
|
|
270
270
|
|
|
@@ -75,7 +75,8 @@ The catalog below collects real-world UI patterns verified against Titanium's co
|
|
|
75
75
|
```xml
|
|
76
76
|
<View class="horizontal border-b border-gray-200 bg-white">
|
|
77
77
|
<View class="ml-4 my-4 rounded-full-12 bg-blue-500">
|
|
78
|
-
|
|
78
|
+
<!-- A child with no top/left centers itself in a composite parent -->
|
|
79
|
+
<Label class="text-lg font-bold text-white" text="JD" />
|
|
79
80
|
</View>
|
|
80
81
|
|
|
81
82
|
<View class="vertical ml-3 my-4">
|
|
@@ -93,7 +94,7 @@ The catalog below collects real-world UI patterns verified against Titanium's co
|
|
|
93
94
|
<ItemTemplate name="cardTemplate" class="h-20">
|
|
94
95
|
<View bindId="container" class="horizontal mx-4 my-2 rounded-lg bg-white shadow-lg">
|
|
95
96
|
<View bindId="iconWrap" class="ml-4 my-4 rounded-full-10 bg-blue-100">
|
|
96
|
-
<Label bindId="icon" class="
|
|
97
|
+
<Label bindId="icon" class="fas fa-home text-blue-500" />
|
|
97
98
|
</View>
|
|
98
99
|
|
|
99
100
|
<View class="vertical ml-3 my-4">
|
|
@@ -190,8 +191,9 @@ For an icon-with-text pair, use a horizontal `View` containing an icon `Label` a
|
|
|
190
191
|
|
|
191
192
|
```xml
|
|
192
193
|
<View class="h-14 w-screen bg-white border-b border-gray-200">
|
|
193
|
-
|
|
194
|
-
<Label class="
|
|
194
|
+
<!-- Omitting top/bottom lets each child center vertically in the composite bar -->
|
|
195
|
+
<Label class="left-4 text-lg font-bold text-gray-800" text="Dashboard" />
|
|
196
|
+
<Label class="right-4 fas fa-bars text-gray-700" />
|
|
195
197
|
</View>
|
|
196
198
|
```
|
|
197
199
|
|
|
@@ -267,7 +269,7 @@ For an icon-with-text pair, use a horizontal `View` containing an icon `Label` a
|
|
|
267
269
|
<Window class="bg-gray-100">
|
|
268
270
|
<View class="vertical h-screen w-screen">
|
|
269
271
|
<View class="h-14 w-screen border-b border-gray-200 bg-white">
|
|
270
|
-
<Label class="left-4
|
|
272
|
+
<Label class="left-4 text-xl font-bold text-gray-800" text="Screen Title" />
|
|
271
273
|
</View>
|
|
272
274
|
|
|
273
275
|
<ScrollView class="vertical content-w-screen content-h-auto">
|
|
@@ -8,6 +8,18 @@ When in doubt about whether a class, flag, or config key exists in the user's in
|
|
|
8
8
|
|
|
9
9
|
---
|
|
10
10
|
|
|
11
|
+
## v7.11.1
|
|
12
|
+
- Symmetric width/height cascade in the SVG image pipeline: a class can pin width-only, height-only, or both; the unpinned side stays `null` in `images.files` and is re-derived from the SVG viewBox on every run (no stale auto-derived dimensions frozen in config).
|
|
13
|
+
- `syncConfigImages` mirrors the **current** run instead of taking `max()` across past runs — shrinking a class (e.g. `h-52` → `h-16`) now propagates to `config.cjs`. Pin manually with `images.autoSync: false`.
|
|
14
|
+
- Fix: `purgetss images` respects `--yes` for overwrite confirmations (prompt no longer reappears).
|
|
15
|
+
- Fix: SVGs listed in `images.files` always emit `.png` regardless of `images.format` (Titanium's `.svg → .png`-only runtime fallback). Raster files and SVGs not in `images.files` still honor `format`.
|
|
16
|
+
|
|
17
|
+
## v7.11.0
|
|
18
|
+
- SVG-aware compile-time image pipeline runs as a `purgetss` post-step. When XML/controllers reference `image="/images/x.svg"` (or `backgroundImage`) alongside utility classes that resolve to numeric width/height (`w-32`, `w-(300)`, `h-auto`), purge compiles the SVG into the 8 Titanium density PNGs (5 Android + 3 iPhone) using dimensions resolved from `app.tss`. Titanium loads the generated `.png` at runtime; the `.svg` attribute in your source is never rewritten. Cache: `purgetss/.cache/svg-images.json` (add to `.gitignore`). See [multi-density-images.md](multi-density-images.md).
|
|
19
|
+
- `images.files` array in `config.cjs` — per-file width/height override: `[{ filename: 'images/logos/logo.png', width: 128, height: 52 }]`. CLI `--width` still wins over entries. SVGs detected by the pipeline populate entries automatically (subject to `images.autoSync`); hand-added raster entries survive untouched.
|
|
20
|
+
- `images.autoSync` boolean (default `true`) — opt-out for devs managing `images.files` by hand. When `false`, purge still computes dimensions and generates PNGs but never writes back to `config.cjs`.
|
|
21
|
+
- `config.cjs` syntax validator emits a formatted `Config Syntax Error` block (file, JSON path, context, issue, fix snippet) for type mismatches in known fields, currently `theme.fontFamily.*` — must be a **string** — replacing cryptic crashes like `rule.startsWith is not a function`.
|
|
22
|
+
|
|
11
23
|
## v7.10.2
|
|
12
24
|
- Pre-v7.7.0 `brand:` configs (flat layout: `brand.padding: <number>`, `brand.iosPadding`, `brand.bgColor`, top-level `brand.notification`/`brand.splash`) auto-migrate to the grouped layout in memory. A one-time per-session notice lists the migrated keys.
|
|
13
25
|
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ti-api
|
|
3
|
+
description: 'Use when looking up properties, methods, events, constants, or type signatures for any Titanium API: `Ti.UI`, `Ti.Android`, `Ti.App`, `Ti.Media`, `Ti.Network`, `Ti.Database`, `Ti.Filesystem`, `Ti.Geolocation`, `Ti.Contacts`, `Ti.Calendar`, `Global`, `Ti.XML`, or third-party modules (Map, BLE, NFC, Facebook, Identity, CoreMotion, URLSession). Triggers include `tiapp.xml` in the project root, or any code that references `Ti.*` or `Modules.*`.'
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# ti-api
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
API reference for the Titanium SDK and TiDev-maintained modules. Use it to look up properties, methods, events, constants, and type signatures across ~360 APIs grouped into 20 reference files.
|
|
11
|
+
|
|
12
|
+
## When to use
|
|
13
|
+
|
|
14
|
+
Use this skill when:
|
|
15
|
+
|
|
16
|
+
- Writing or reviewing code that calls any `Ti.*` or `Modules.*` API
|
|
17
|
+
- Verifying a property name, type, default, or platform availability
|
|
18
|
+
- Confirming a method signature, parameter list, or return type
|
|
19
|
+
- Looking up event names and event-object payloads
|
|
20
|
+
- Checking platform support (`android`, `ios`, or `both`) for an API
|
|
21
|
+
|
|
22
|
+
Do NOT use for:
|
|
23
|
+
|
|
24
|
+
- Alloy MVC concepts, controllers, models (use `alloy-guides`)
|
|
25
|
+
- Alloy CLI and configuration files (use `alloy-howtos`)
|
|
26
|
+
- Titanium project setup, `tiapp.xml`, distribution, Hyperloop (use `ti-guides`)
|
|
27
|
+
- Native module dependency updates (use `ti-module-update`)
|
|
28
|
+
|
|
29
|
+
## How to use this skill
|
|
30
|
+
|
|
31
|
+
1. Identify which namespace the API belongs to.
|
|
32
|
+
2. Look up the matching reference file in the table below.
|
|
33
|
+
3. Read the reference file for full property / method / event tables.
|
|
34
|
+
|
|
35
|
+
## Namespace lookup
|
|
36
|
+
|
|
37
|
+
| Namespace examples | Reference | Coverage |
|
|
38
|
+
|---|---|---|
|
|
39
|
+
| `Ti.UI.View`, `Ti.UI.Label`, `Ti.UI.Button`, `Ti.UI.ImageView`, ... | [api-ui-views.md](references/api-ui-views.md) | Ti.UI Core Views (13 APIs) |
|
|
40
|
+
| `Ti.UI.Window`, `Ti.UI.NavigationWindow`, `Ti.UI.TabGroup`, `Ti.UI.Tab`, ... | [api-ui-windows-navigation.md](references/api-ui-windows-navigation.md) | Ti.UI Windows & Navigation (7 APIs) |
|
|
41
|
+
| `Ti.UI.TextField`, `Ti.UI.TextArea`, `Ti.UI.SearchBar`, `Ti.UI.AttributedString`, ... | [api-ui-text-input.md](references/api-ui-text-input.md) | Ti.UI Text & Input (9 APIs) |
|
|
42
|
+
| `Ti.UI.ListView`, `Ti.UI.ListItem`, `Ti.UI.ListSection`, `Ti.UI.TableView`, ... | [api-ui-lists.md](references/api-ui-lists.md) | Ti.UI Lists & Tables (8 APIs) |
|
|
43
|
+
| `Ti.UI.Animation`, `Ti.UI.Matrix2D`, `Ti.UI.Matrix3D`, `Ti.UI.WebView`, ... | [api-ui-extras.md](references/api-ui-extras.md) | Ti.UI Extras (13 APIs) |
|
|
44
|
+
| `Ti.UI.iOS` | [api-ui-ios.md](references/api-ui-ios.md) | Ti.UI.iOS (36 APIs) |
|
|
45
|
+
| `Ti.UI.iOS` Animator / Physics | [api-ui-ios-animator.md](references/api-ui-ios-animator.md) | Ti.UI.iOS Animator & Physics (8 APIs) |
|
|
46
|
+
| `Ti.UI.Android`, `Ti.UI.iPad` | [api-ui-android.md](references/api-ui-android.md) | Ti.UI.Android (10 APIs) |
|
|
47
|
+
| `Ti.Android`, `Ti.Android.ActionBar`, `Ti.Android.Activity`, ... | [api-android.md](references/api-android.md) | Ti.Android (17 APIs) |
|
|
48
|
+
| `Ti.App`, `Ti.App.Properties`, `Ti.App.iOS`, `Ti.Platform`, ... | [api-app-platform.md](references/api-app-platform.md) | Ti.App & Ti.Platform (18 APIs) |
|
|
49
|
+
| `Ti.Media`, `Ti.Media.AudioPlayer`, `Ti.Media.AudioRecorder`, ... | [api-media.md](references/api-media.md) | Ti.Media (9 APIs) |
|
|
50
|
+
| `Ti.Network`, `Ti.Database`, `Ti.Database.DB`, `Ti.Filesystem`, ... | [api-data-network.md](references/api-data-network.md) | Ti.Network, Ti.Database & Ti.Filesystem (14 APIs) |
|
|
51
|
+
| `Ti.Geolocation`, `Ti.Contacts`, `Ti.Calendar`, `Ti.WatchSession`, ... | [api-services.md](references/api-services.md) | Ti.Geolocation, Ti.Contacts, Ti.Calendar & Ti.WatchSession (15 APIs) |
|
|
52
|
+
| `Titanium`, `Ti.UI` (root), `Ti.API`, `Ti.Accelerometer`, ... | [api-core.md](references/api-core.md) | Ti Core (16 APIs) |
|
|
53
|
+
| `Ti.XML`, `Ti.XML.Attr`, `Ti.XML.CDATASection`, Global APIs | [api-xml-global.md](references/api-xml-global.md) | Ti.XML & Global (25 APIs) |
|
|
54
|
+
| `Modules.Map`, `Modules.Map.Annotation`, `Modules.Map.Camera`, ... | [api-modules-map.md](references/api-modules-map.md) | Modules: Map (11 APIs) |
|
|
55
|
+
| `Modules.Applesignin`, `Modules.Barcode`, `Modules.Crypto`, Facebook, Identity, ... | [api-modules-social-misc.md](references/api-modules-social-misc.md) | Modules: Facebook, Identity, Crypto & More (16 APIs) |
|
|
56
|
+
| `Modules.BLE`, `Modules.BLE.Beacon`, `Modules.BLE.BeaconRegion`, ... | [api-modules-ble-bluetooth.md](references/api-modules-ble-bluetooth.md) | Modules: BLE & Bluetooth (20 APIs) |
|
|
57
|
+
| `Modules.Nfc`, `Modules.Nfc.MifareTagTechnology`, `Modules.Nfc.NdefMessage`, ... | [api-modules-nfc.md](references/api-modules-nfc.md) | Modules: NFC (28 APIs) |
|
|
58
|
+
| `Modules.CoreMotion`, `Modules.CoreMotion.Accelerometer`, URLSession, ... | [api-modules-coremotion-urlsession.md](references/api-modules-coremotion-urlsession.md) | Modules: CoreMotion & URLSession (12 APIs) |
|
|
59
|
+
|
|
60
|
+
## Quick lookup by common task
|
|
61
|
+
|
|
62
|
+
| Task | API | Reference |
|
|
63
|
+
|---|---|---|
|
|
64
|
+
| Create a window | `Ti.UI.Window` | [api-ui-windows-navigation.md](references/api-ui-windows-navigation.md) |
|
|
65
|
+
| HTTP request | `Ti.Network.HTTPClient` | [api-data-network.md](references/api-data-network.md) |
|
|
66
|
+
| Show an alert | `Ti.UI.AlertDialog` | [api-ui-windows-navigation.md](references/api-ui-windows-navigation.md) |
|
|
67
|
+
| Play audio | `Ti.Media.AudioPlayer` | [api-media.md](references/api-media.md) |
|
|
68
|
+
| Read a file | `Ti.Filesystem.File` | [api-data-network.md](references/api-data-network.md) |
|
|
69
|
+
| SQLite query | `Ti.Database.DB` | [api-data-network.md](references/api-data-network.md) |
|
|
70
|
+
| GPS location | `Ti.Geolocation` | [api-services.md](references/api-services.md) |
|
|
71
|
+
| Push notifications | `Ti.App.iOS` / Android FCM | [api-app-platform.md](references/api-app-platform.md) |
|
|
72
|
+
| ListView | `Ti.UI.ListView` | [api-ui-lists.md](references/api-ui-lists.md) |
|
|
73
|
+
| Camera / gallery | `Ti.Media` | [api-media.md](references/api-media.md) |
|
|
74
|
+
| Map view | `Modules.Map.View` | [api-modules-map.md](references/api-modules-map.md) |
|
|
75
|
+
| BLE scanning | `Modules.BLE` | [api-modules-ble-bluetooth.md](references/api-modules-ble-bluetooth.md) |
|
|
76
|
+
| Animation | `Ti.UI.Animation` | [api-ui-extras.md](references/api-ui-extras.md) |
|
|
77
|
+
| WebView | `Ti.UI.WebView` | [api-ui-extras.md](references/api-ui-extras.md) |
|
|
78
|
+
| Contacts | `Ti.Contacts` | [api-services.md](references/api-services.md) |
|
|
79
|
+
|
|
80
|
+
## Reading the reference tables
|
|
81
|
+
|
|
82
|
+
Each API entry includes:
|
|
83
|
+
|
|
84
|
+
- **Summary** — one-line description
|
|
85
|
+
- **Extends** — parent type (inherited properties / methods are not repeated)
|
|
86
|
+
- **Platforms** — `both` (Android + iOS), `android`, or `ios`
|
|
87
|
+
- **Properties table** — unique properties (not inherited), with type, default, platform
|
|
88
|
+
- **Methods table** — unique methods with parameters, return type, platform
|
|
89
|
+
- **Events table** — unique events with platform and description
|
|
90
|
+
- **Related Types** — inline struct definitions used by that API
|
|
91
|
+
|
|
92
|
+
### Property counts
|
|
93
|
+
|
|
94
|
+
Tables show `unique: X / Y` where `X` is properties defined on this class and `Y` is total including inherited. For inherited properties, check the parent class.
|
|
95
|
+
|
|
96
|
+
## API coverage
|
|
97
|
+
|
|
98
|
+
| Category | APIs | Reference |
|
|
99
|
+
|---|---|---|
|
|
100
|
+
| Ti.UI Core Views | 13 | `api-ui-views.md` |
|
|
101
|
+
| Ti.UI Windows & Navigation | 7 | `api-ui-windows-navigation.md` |
|
|
102
|
+
| Ti.UI Text & Input | 9 | `api-ui-text-input.md` |
|
|
103
|
+
| Ti.UI Lists & Tables | 8 | `api-ui-lists.md` |
|
|
104
|
+
| Ti.UI Extras | 13 | `api-ui-extras.md` |
|
|
105
|
+
| Ti.UI.iOS | 36 | `api-ui-ios.md` |
|
|
106
|
+
| Ti.UI.iOS Animator & Physics | 8 | `api-ui-ios-animator.md` |
|
|
107
|
+
| Ti.UI.Android | 10 | `api-ui-android.md` |
|
|
108
|
+
| Ti.Android | 17 | `api-android.md` |
|
|
109
|
+
| Ti.App & Ti.Platform | 18 | `api-app-platform.md` |
|
|
110
|
+
| Ti.Media | 9 | `api-media.md` |
|
|
111
|
+
| Ti.Network, Ti.Database & Ti.Filesystem | 14 | `api-data-network.md` |
|
|
112
|
+
| Ti.Geolocation, Ti.Contacts, Ti.Calendar & Ti.WatchSession | 15 | `api-services.md` |
|
|
113
|
+
| Ti Core | 16 | `api-core.md` |
|
|
114
|
+
| Ti.XML & Global | 25 | `api-xml-global.md` |
|
|
115
|
+
| Modules: Map | 11 | `api-modules-map.md` |
|
|
116
|
+
| Modules: Facebook, Identity, Crypto & More | 16 | `api-modules-social-misc.md` |
|
|
117
|
+
| Modules: BLE & Bluetooth | 20 | `api-modules-ble-bluetooth.md` |
|
|
118
|
+
| Modules: NFC | 28 | `api-modules-nfc.md` |
|
|
119
|
+
| Modules: CoreMotion & URLSession | 12 | `api-modules-coremotion-urlsession.md` |
|
|
120
|
+
|
|
121
|
+
## Related skills
|
|
122
|
+
|
|
123
|
+
| Task | Use this skill |
|
|
124
|
+
|---|---|
|
|
125
|
+
| Alloy MVC concepts, controllers, models, data binding | `alloy-guides` |
|
|
126
|
+
| Alloy CLI, `alloy.jmk`, `config.json`, debugging | `alloy-howtos` |
|
|
127
|
+
| Titanium SDK config, Hyperloop, app distribution | `ti-guides` |
|
|
128
|
+
| Native module dependency updates | `ti-module-update` |
|