@maccesar/titools 2.2.4 → 2.2.8
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 +23 -23
- package/lib/commands/update.js +4 -12
- package/package.json +1 -1
- package/skills/alloy-guides/SKILL.md +31 -31
- package/skills/alloy-guides/references/CONCEPTS.md +3 -3
- package/skills/alloy-guides/references/CONTROLLERS.md +1 -1
- package/skills/alloy-guides/references/MODELS.md +6 -6
- package/skills/alloy-guides/references/VIEWS_WITHOUT_CONTROLLERS.md +1 -1
- package/skills/alloy-guides/references/VIEWS_XML.md +1 -1
- package/skills/alloy-guides/references/WIDGETS.md +1 -1
- package/skills/alloy-howtos/SKILL.md +27 -27
- package/skills/alloy-howtos/references/best_practices.md +9 -9
- package/skills/alloy-howtos/references/cli_reference.md +14 -14
- package/skills/alloy-howtos/references/config_files.md +16 -16
- package/skills/alloy-howtos/references/custom_tags.md +16 -16
- package/skills/alloy-howtos/references/debugging_troubleshooting.md +11 -15
- package/skills/alloy-howtos/references/samples.md +19 -19
- package/skills/purgetss/SKILL.md +11 -1
- package/skills/purgetss/references/animation-system.md +1 -1
- package/skills/purgetss/references/cli-commands.md +3 -3
- package/skills/purgetss/references/customization-deep-dive.md +1 -1
- package/skills/purgetss/references/dynamic-component-creation.md +1 -1
- package/skills/purgetss/references/icon-fonts.md +4 -0
- package/skills/purgetss/references/installation-setup.md +8 -1
- package/skills/purgetss/references/migration-guide.md +4 -0
- package/skills/purgetss/references/tikit-components.md +193 -204
- package/skills/purgetss/references/ui-ux-design.md +1 -1
- package/skills/ti-expert/SKILL.md +78 -118
- package/skills/ti-expert/references/alloy-builtins.md +18 -18
- package/skills/ti-expert/references/alloy-structure.md +21 -21
- package/skills/ti-expert/references/anti-patterns.md +15 -15
- package/skills/ti-expert/references/cli-expert.md +15 -15
- package/skills/ti-expert/references/code-conventions.md +38 -38
- package/skills/ti-expert/references/contracts.md +8 -8
- package/skills/ti-expert/references/controller-patterns.md +14 -14
- package/skills/ti-expert/references/error-handling.md +11 -11
- package/skills/ti-expert/references/examples.md +12 -12
- package/skills/ti-expert/references/migration-patterns.md +24 -24
- package/skills/ti-expert/references/patterns.md +10 -10
- package/skills/ti-expert/references/performance-listview.md +16 -16
- package/skills/ti-expert/references/performance-optimization.md +41 -41
- package/skills/ti-expert/references/security-device.md +22 -22
- package/skills/ti-expert/references/security-fundamentals.md +19 -19
- package/skills/ti-expert/references/state-management.md +33 -33
- package/skills/ti-expert/references/testing-e2e-ci.md +25 -25
- package/skills/ti-expert/references/testing-unit.md +24 -24
- package/skills/ti-expert/references/theming.md +15 -15
- package/skills/ti-guides/SKILL.md +58 -60
- package/skills/ti-guides/references/advanced-data-and-images.md +33 -33
- package/skills/ti-guides/references/android-manifest.md +15 -15
- package/skills/ti-guides/references/app-distribution.md +70 -166
- package/skills/ti-guides/references/application-frameworks.md +96 -114
- package/skills/ti-guides/references/cli-reference.md +294 -294
- package/skills/ti-guides/references/coding-best-practices.md +42 -33
- package/skills/ti-guides/references/commonjs-advanced.md +57 -51
- package/skills/ti-guides/references/hello-world.md +36 -36
- package/skills/ti-guides/references/hyperloop-native-access.md +66 -66
- package/skills/ti-guides/references/javascript-primer.md +83 -101
- package/skills/ti-guides/references/reserved-words.md +9 -9
- package/skills/ti-guides/references/resources.md +75 -83
- package/skills/ti-guides/references/style-and-conventions.md +35 -28
- package/skills/ti-guides/references/tiapp-config.md +110 -74
- package/skills/ti-howtos/SKILL.md +88 -92
- package/skills/ti-howtos/references/android-platform-deep-dives.md +104 -104
- package/skills/ti-howtos/references/automation-fastlane-appium.md +39 -39
- package/skills/ti-howtos/references/buffer-codec-streams.md +60 -60
- package/skills/ti-howtos/references/cross-platform-development.md +115 -136
- package/skills/ti-howtos/references/debugging-profiling.md +167 -181
- package/skills/ti-howtos/references/extending-titanium.md +121 -121
- package/skills/ti-howtos/references/google-maps-v2.md +84 -82
- package/skills/ti-howtos/references/ios-map-kit.md +65 -60
- package/skills/ti-howtos/references/ios-platform-deep-dives.md +123 -123
- package/skills/ti-howtos/references/local-data-sources.md +79 -78
- package/skills/ti-howtos/references/location-and-maps.md +116 -120
- package/skills/ti-howtos/references/media-apis.md +87 -86
- package/skills/ti-howtos/references/notification-services.md +250 -260
- package/skills/ti-howtos/references/remote-data-sources.md +98 -93
- package/skills/ti-howtos/references/tutorials.md +226 -216
- package/skills/ti-howtos/references/using-modules.md +73 -102
- package/skills/ti-howtos/references/web-content-integration.md +101 -103
- package/skills/ti-howtos/references/webpack-build-pipeline.md +52 -44
- package/skills/ti-ui/SKILL.md +85 -85
- package/skills/ti-ui/references/accessibility-deep-dive.md +57 -57
- package/skills/ti-ui/references/animation-and-matrices.md +79 -79
- package/skills/ti-ui/references/application-structures.md +96 -99
- package/skills/ti-ui/references/custom-fonts-styling.md +99 -99
- package/skills/ti-ui/references/event-handling.md +58 -58
- package/skills/ti-ui/references/gestures.md +62 -64
- package/skills/ti-ui/references/icons-and-splash-screens.md +88 -88
- package/skills/ti-ui/references/layouts-and-positioning.md +87 -97
- package/skills/ti-ui/references/listviews-and-performance.md +107 -107
- package/skills/ti-ui/references/orientation.md +87 -88
- package/skills/ti-ui/references/platform-ui-android.md +87 -81
- package/skills/ti-ui/references/platform-ui-ios.md +63 -61
- package/skills/ti-ui/references/scrolling-views.md +29 -29
- package/skills/ti-ui/references/tableviews.md +56 -56
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
# Alloy
|
|
1
|
+
# Alloy command-line interface reference
|
|
2
2
|
|
|
3
|
-
The Alloy CLI
|
|
3
|
+
The Alloy CLI manages and builds Alloy projects.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
|
-
The Alloy CLI is
|
|
7
|
+
The Alloy CLI is installed when you install the `alloy` package.
|
|
8
8
|
|
|
9
9
|
### Manual Installation
|
|
10
10
|
|
|
@@ -19,7 +19,7 @@ For a specific version:
|
|
|
19
19
|
sudo npm install -g alloy@1.10.0
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
-
###
|
|
22
|
+
### Development install
|
|
23
23
|
|
|
24
24
|
```bash
|
|
25
25
|
git clone https://github.com/tidev/alloy.git
|
|
@@ -71,7 +71,7 @@ alloy generate <component> [--widgetname <widget_name>] [--outputPath <output_pa
|
|
|
71
71
|
| `-f, --force` | Force execution |
|
|
72
72
|
| `-n, --no-colors` | Disable color output |
|
|
73
73
|
|
|
74
|
-
#### Model
|
|
74
|
+
#### Model format
|
|
75
75
|
|
|
76
76
|
Select adapter type:
|
|
77
77
|
- `sql` - SQLite database for Android/iOS (also generates a migration file)
|
|
@@ -125,29 +125,29 @@ Compiler options reference the `event.alloyConfig` object in [Build Configuratio
|
|
|
125
125
|
|
|
126
126
|
Use `titanium build` command to run Alloy projects. See [Titanium Command-Line Interface Reference](https://titaniumsdk.com/guide/Titanium_SDK/Titanium_SDK_Guide/Titanium_Command-Line_Interface_Reference/).
|
|
127
127
|
|
|
128
|
-
:::tip
|
|
128
|
+
:::tip Common ti build pitfalls
|
|
129
129
|
|
|
130
|
-
|
|
130
|
+
Using `-C` flag without UDID:
|
|
131
131
|
```bash
|
|
132
|
-
#
|
|
132
|
+
# Prompts for simulator selection interactively
|
|
133
133
|
ti build -p ios -T simulator -C
|
|
134
134
|
```
|
|
135
135
|
|
|
136
|
-
|
|
136
|
+
Correct approach for simulator:
|
|
137
137
|
```bash
|
|
138
|
-
#
|
|
138
|
+
# Runs on default simulator
|
|
139
139
|
ti build -p ios -T simulator
|
|
140
140
|
```
|
|
141
141
|
|
|
142
|
-
|
|
142
|
+
Using `--no-prompt` incorrectly:
|
|
143
143
|
```bash
|
|
144
144
|
# Still may prompt for device selection if not specific
|
|
145
145
|
ti build -p ios --no-prompt
|
|
146
146
|
```
|
|
147
147
|
|
|
148
|
-
|
|
148
|
+
Always specify target:
|
|
149
149
|
```bash
|
|
150
|
-
#
|
|
150
|
+
# Clear target specification
|
|
151
151
|
ti build -p ios -T simulator --no-prompt
|
|
152
152
|
```
|
|
153
153
|
|
|
@@ -184,7 +184,7 @@ Supported functions:
|
|
|
184
184
|
- `Ti.Locale.getString()`
|
|
185
185
|
- `L()`
|
|
186
186
|
|
|
187
|
-
Usage
|
|
187
|
+
Usage examples:
|
|
188
188
|
```bash
|
|
189
189
|
# Preview changes for default (English)
|
|
190
190
|
alloy extract-i18n
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
# Alloy
|
|
1
|
+
# Alloy configuration files reference
|
|
2
2
|
|
|
3
|
-
## Build
|
|
3
|
+
## Build configuration file (alloy.jmk)
|
|
4
4
|
|
|
5
|
-
Alloy
|
|
5
|
+
Alloy exposes hooks to customize compilation with a JS Makefile (JMK).
|
|
6
6
|
|
|
7
7
|
**Location:** `app/alloy.jmk`
|
|
8
8
|
|
|
@@ -18,7 +18,7 @@ task('post:compile', (event, logger) => {
|
|
|
18
18
|
});
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
### Compiler
|
|
21
|
+
### Compiler tasks (event names)
|
|
22
22
|
|
|
23
23
|
| Task | When Called |
|
|
24
24
|
| ---------------- | --------------------------------------------------------- |
|
|
@@ -27,7 +27,7 @@ task('post:compile', (event, logger) => {
|
|
|
27
27
|
| `post:compile` | After compiler finishes, before exit |
|
|
28
28
|
| `compile:app.js` | After compiling `app.js`, before writing to disk |
|
|
29
29
|
|
|
30
|
-
### Event
|
|
30
|
+
### Event object
|
|
31
31
|
|
|
32
32
|
| Property | Type | Description |
|
|
33
33
|
| -------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
@@ -41,9 +41,9 @@ task('post:compile', (event, logger) => {
|
|
|
41
41
|
| `code` | String | *(compile:app.js only)* Contents of `app.js` |
|
|
42
42
|
| `appJSFile` | String | *(compile:app.js only)* Absolute path to `app.js` |
|
|
43
43
|
|
|
44
|
-
### Logger
|
|
44
|
+
### Logger object
|
|
45
45
|
|
|
46
|
-
The `logger` object
|
|
46
|
+
The `logger` object controls compilation log output.
|
|
47
47
|
|
|
48
48
|
#### Properties
|
|
49
49
|
|
|
@@ -69,13 +69,13 @@ The `logger` object provides methods and properties to control compilation log o
|
|
|
69
69
|
|
|
70
70
|
---
|
|
71
71
|
|
|
72
|
-
## Global
|
|
72
|
+
## Global initializer (alloy.js)
|
|
73
73
|
|
|
74
74
|
**Location:** `app/alloy.js`
|
|
75
75
|
|
|
76
|
-
|
|
76
|
+
Runs before any controllers load. Use it to set up globals and singletons.
|
|
77
77
|
|
|
78
|
-
|
|
78
|
+
Common uses:
|
|
79
79
|
- Creating `Alloy.Collections` (e.g., `Alloy.Collections.myModel = Alloy.createCollection('myModel');`)
|
|
80
80
|
- Setting up `Alloy.Globals` (shared references, utility functions)
|
|
81
81
|
- Initializing singletons (analytics, logging, network managers)
|
|
@@ -95,11 +95,11 @@ Alloy.Globals.alert = (title, message) => {
|
|
|
95
95
|
|
|
96
96
|
---
|
|
97
97
|
|
|
98
|
-
## Project
|
|
98
|
+
## Project configuration file (config.json)
|
|
99
99
|
|
|
100
100
|
**Location:** `app/config.json`
|
|
101
101
|
|
|
102
|
-
Alloy uses `config.json`
|
|
102
|
+
Alloy uses `config.json` for global values, environment and platform overrides, and widget dependencies.
|
|
103
103
|
### Objects
|
|
104
104
|
|
|
105
105
|
| Object | Description |
|
|
@@ -114,9 +114,9 @@ Alloy uses `config.json` to specify global values, conditional environment and p
|
|
|
114
114
|
| `autoStyle` | Enable autostyle for entire project |
|
|
115
115
|
| `backbone` | Backbone.js version: `0.9.2` (default), `1.1.2`, or `1.3.3` |
|
|
116
116
|
|
|
117
|
-
**Precedence:** `os` > `env` > `global`. Combinations (
|
|
117
|
+
**Precedence:** `os` > `env` > `global`. Combinations (for example, `os:ios env:production`) override single values.
|
|
118
118
|
|
|
119
|
-
**Runtime
|
|
119
|
+
**Runtime access:** Values are available at runtime via `Alloy.CFG.<key>`.
|
|
120
120
|
|
|
121
121
|
**Example:**
|
|
122
122
|
|
|
@@ -136,11 +136,11 @@ Alloy uses `config.json` to specify global values, conditional environment and p
|
|
|
136
136
|
}
|
|
137
137
|
```
|
|
138
138
|
|
|
139
|
-
Accessing values: `Ti.API.info(Alloy.CFG.foo)`
|
|
139
|
+
Accessing values: `Ti.API.info(Alloy.CFG.foo)` on iPhone simulator returns `6`.
|
|
140
140
|
|
|
141
141
|
---
|
|
142
142
|
|
|
143
|
-
## Widget
|
|
143
|
+
## Widget configuration file (widget.json)
|
|
144
144
|
|
|
145
145
|
**Location:** Root directory of the widget. Follows the npm `package.json` format with a few exceptions.
|
|
146
146
|
### Keys
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
# Creating
|
|
1
|
+
# Creating custom tags in Titanium with Alloy
|
|
2
2
|
|
|
3
|
-
Custom tags
|
|
3
|
+
Custom tags let you create reusable UI components without the overhead of widgets. You can keep controls in a single file under `app/lib`.
|
|
4
4
|
|
|
5
|
-
## Why
|
|
5
|
+
## Why use custom tags?
|
|
6
6
|
|
|
7
|
-
When building cross-platform
|
|
7
|
+
When building cross-platform apps, you often need UI controls (like a web-style checkbox) that do not exist natively. You have three approaches:
|
|
8
8
|
|
|
9
|
-
1. **Direct XML/JS:** Copy
|
|
10
|
-
2. **Widgets:**
|
|
11
|
-
3. **Custom
|
|
9
|
+
1. **Direct XML/JS:** Copy and paste code into each view. Not reusable and easy to drift.
|
|
10
|
+
2. **Widgets:** Reusable, but require a folder structure and `dependencies` in `config.json`.
|
|
11
|
+
3. **Custom tags:** Single file in `app/lib/`, no config dependency, easy to share. They reduce platform-specific code in views.
|
|
12
12
|
|
|
13
|
-
## Basic
|
|
13
|
+
## Basic setup
|
|
14
14
|
|
|
15
15
|
1. Create a file in `app/lib/` (e.g., `checkbox.js`)
|
|
16
16
|
2. Export a `create<TagName>` function
|
|
@@ -24,9 +24,9 @@ When building cross-platform applications, you often need specific UI controls (
|
|
|
24
24
|
onCaptionClick="doShowTerms"
|
|
25
25
|
onChange="onCheckChange" />
|
|
26
26
|
```
|
|
27
|
-
The `module` attribute tells Alloy to look in `checkbox.js` for a `createCheckBox` function
|
|
27
|
+
The `module` attribute tells Alloy to look in `checkbox.js` for a `createCheckBox` function. Alloy passes the XML/TSS arguments and expects a `Ti.UI.*` component back.
|
|
28
28
|
|
|
29
|
-
## Robust
|
|
29
|
+
## Robust example: CheckBox
|
|
30
30
|
|
|
31
31
|
**app/lib/checkbox.js**
|
|
32
32
|
```javascript
|
|
@@ -101,9 +101,9 @@ exports.createCheckBox = args => {
|
|
|
101
101
|
};
|
|
102
102
|
```
|
|
103
103
|
|
|
104
|
-
## Global
|
|
104
|
+
## Global module override
|
|
105
105
|
|
|
106
|
-
Apply a module to all tags in a view by updating the `Alloy` tag. Alloy
|
|
106
|
+
Apply a module to all tags in a view by updating the `Alloy` tag. Alloy checks your file for tag creation overrides before using default implementations:
|
|
107
107
|
|
|
108
108
|
```xml
|
|
109
109
|
<Alloy module="ui">
|
|
@@ -113,9 +113,9 @@ Apply a module to all tags in a view by updating the `Alloy` tag. Alloy will che
|
|
|
113
113
|
</Window>
|
|
114
114
|
</Alloy>
|
|
115
115
|
```
|
|
116
|
-
This is
|
|
116
|
+
This is useful for adding default colors or properties (for example, a black default color for Android Labels) across a project.
|
|
117
117
|
|
|
118
|
-
## Key
|
|
118
|
+
## Key points
|
|
119
119
|
|
|
120
120
|
| Aspect | Description |
|
|
121
121
|
| ------------- | ------------------------------------------------------------- |
|
|
@@ -136,9 +136,9 @@ const checkbox = require("checkbox").createCheckBox({
|
|
|
136
136
|
win.add(checkbox);
|
|
137
137
|
```
|
|
138
138
|
|
|
139
|
-
This works because custom tags are standard CommonJS modules
|
|
139
|
+
This works because custom tags are standard CommonJS modules. The `module` attribute in XML is a convenience.
|
|
140
140
|
|
|
141
|
-
## Custom
|
|
141
|
+
## Custom tags vs widgets
|
|
142
142
|
|
|
143
143
|
| Custom Tags | Widgets |
|
|
144
144
|
| ------------------------------------- | ---------------------------------------- |
|
|
@@ -1,21 +1,17 @@
|
|
|
1
|
-
# Alloy
|
|
2
|
-
|
|
3
|
-
## Overview
|
|
4
|
-
|
|
5
|
-
This guide covers debugging and troubleshooting Alloy applications.
|
|
1
|
+
# Alloy debugging and troubleshooting
|
|
6
2
|
|
|
7
3
|
## Debugging
|
|
8
4
|
|
|
9
|
-
### Compiler
|
|
5
|
+
### Compiler error messages
|
|
10
6
|
|
|
11
|
-
The Alloy compiler
|
|
7
|
+
The Alloy compiler reports syntax errors in JavaScript, JSON, TSS, and XML. Error messages include:
|
|
12
8
|
- File path
|
|
13
9
|
- Line and character position
|
|
14
10
|
- Description of the error
|
|
15
11
|
|
|
16
12
|
## Troubleshooting
|
|
17
13
|
|
|
18
|
-
### Error: No app.js
|
|
14
|
+
### Error: No app.js found
|
|
19
15
|
|
|
20
16
|
**Error:** `[ERROR] No app.js found. Ensure the app.js file exists in your project's Resources directory.`
|
|
21
17
|
|
|
@@ -24,13 +20,13 @@ The Alloy compiler generates error messages for syntax errors in JavaScript, JSO
|
|
|
24
20
|
alloy compile --config platform=<platform>
|
|
25
21
|
```
|
|
26
22
|
|
|
27
|
-
### Android:
|
|
23
|
+
### Android: images, HTML, and assets not displaying
|
|
28
24
|
|
|
29
25
|
**Problem:** Assets display on iOS and Mobile Web but not Android.
|
|
30
26
|
|
|
31
27
|
**Solution:** Android requires absolute paths. Precede asset paths with a slash ('/'). iOS and Mobile Web accept both relative and absolute paths.
|
|
32
28
|
|
|
33
|
-
### Android
|
|
29
|
+
### Android runtime error: cannot call method of undefined
|
|
34
30
|
|
|
35
31
|
**Error:** `Uncaught TypeError: Cannot call method xxx of undefined`
|
|
36
32
|
|
|
@@ -38,7 +34,7 @@ alloy compile --config platform=<platform>
|
|
|
38
34
|
1. Creating an iOS-only Titanium object. Use the `platform` attribute in views to enforce platform-specific objects.
|
|
39
35
|
2. Top-level UI component has an assigned ID. The controller cannot use `$.<controller_name>` to reference it; use the assigned ID instead.
|
|
40
36
|
|
|
41
|
-
### Android
|
|
37
|
+
### Android runtime error: Alloy is not defined
|
|
42
38
|
|
|
43
39
|
**Error:** `Uncaught ReferenceError: Alloy is not defined`
|
|
44
40
|
|
|
@@ -49,7 +45,7 @@ alloy compile --config platform=<platform>
|
|
|
49
45
|
const Alloy = require('alloy');
|
|
50
46
|
```
|
|
51
47
|
|
|
52
|
-
### iOS
|
|
48
|
+
### iOS application error: invalid method passed to UIModule
|
|
53
49
|
|
|
54
50
|
**Error:** `invalid method (xxx) passed to UIModule (unknown file)`
|
|
55
51
|
|
|
@@ -57,7 +53,7 @@ const Alloy = require('alloy');
|
|
|
57
53
|
|
|
58
54
|
**Solution:** Use the `platform` attribute in the view to enforce platform-specific objects.
|
|
59
55
|
|
|
60
|
-
### iOS
|
|
56
|
+
### iOS application error: undefined is not an object
|
|
61
57
|
|
|
62
58
|
**Error:** `undefined is not an object (evaluating $.xxx.open) (unknown file)`
|
|
63
59
|
|
|
@@ -65,14 +61,14 @@ const Alloy = require('alloy');
|
|
|
65
61
|
|
|
66
62
|
**Solution:** The controller cannot use `$.<controller_name>` to reference it; use the assigned ID instead.
|
|
67
63
|
|
|
68
|
-
## Getting
|
|
64
|
+
## Getting help
|
|
69
65
|
|
|
70
66
|
Use the [TiDev Community Slack](https://slack.tidev.io/) or [GitHub Discussions](https://github.com/tidev/titanium-sdk/discussions):
|
|
71
67
|
- Include 'alloy' as a tag
|
|
72
68
|
- Include the Alloy version (run `alloy --version`)
|
|
73
69
|
- Include platform information
|
|
74
70
|
|
|
75
|
-
## Submitting a
|
|
71
|
+
## Submitting a bug report
|
|
76
72
|
|
|
77
73
|
Search [existing issues](https://github.com/tidev/alloy/issues) first to avoid duplicates. If none match, create a new issue:
|
|
78
74
|
- Select 'Alloy' as the component
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
# Alloy
|
|
1
|
+
# Alloy samples
|
|
2
2
|
|
|
3
|
-
## Kitchen
|
|
3
|
+
## Kitchen sink
|
|
4
4
|
|
|
5
|
-
See the [KitchenSink-v2 application on GitHub](https://github.com/tidev/kitchensink-v2) for Alloy samples in a
|
|
5
|
+
See the [KitchenSink-v2 application on GitHub](https://github.com/tidev/kitchensink-v2) for Alloy samples in a full app.
|
|
6
6
|
|
|
7
|
-
## Controller
|
|
7
|
+
## Controller sample
|
|
8
8
|
|
|
9
9
|
**index.js**
|
|
10
10
|
```javascript
|
|
@@ -52,15 +52,15 @@ if (!ENV_PROD) {
|
|
|
52
52
|
}
|
|
53
53
|
```
|
|
54
54
|
|
|
55
|
-
## Conditional
|
|
55
|
+
## Conditional statements in views
|
|
56
56
|
|
|
57
|
-
Alloy separates business logic (controllers) from UI definition (XML/TSS). A common challenge is showing
|
|
57
|
+
Alloy separates business logic (controllers) from UI definition (XML/TSS). A common challenge is showing or hiding content based on app state (for example, login status).
|
|
58
58
|
|
|
59
|
-
:::tip TSS
|
|
59
|
+
:::tip TSS defaults
|
|
60
60
|
The samples below assume some additional TSS: views and windows use a vertical layout, and the `View` tag has a default height and width of `Ti.UI.SIZE`.
|
|
61
61
|
:::
|
|
62
62
|
|
|
63
|
-
###
|
|
63
|
+
### Problems with traditional approaches
|
|
64
64
|
|
|
65
65
|
**Approach 1: show/hide (in controller)**
|
|
66
66
|
```javascript
|
|
@@ -72,7 +72,7 @@ if (Alloy.Globals.isLoggedIn()) {
|
|
|
72
72
|
$.notLoggedIn.show();
|
|
73
73
|
}
|
|
74
74
|
```
|
|
75
|
-
**Problem:** Both views render
|
|
75
|
+
**Problem:** Both views render when the window opens. If the user isn't logged in, there is empty space where the logged-in view was.
|
|
76
76
|
|
|
77
77
|
**Approach 2: setHeight (in controller)**
|
|
78
78
|
```javascript
|
|
@@ -84,11 +84,11 @@ if (Alloy.Globals.isLoggedIn()) {
|
|
|
84
84
|
$.notLoggedIn.setHeight(Ti.UI.SIZE);
|
|
85
85
|
}
|
|
86
86
|
```
|
|
87
|
-
**Problem:** This works but
|
|
87
|
+
**Problem:** This works, but it forces you to manage height values (`Ti.UI.SIZE`) in JavaScript instead of TSS.
|
|
88
88
|
|
|
89
|
-
###
|
|
89
|
+
### Solution: IF attributes in XML
|
|
90
90
|
|
|
91
|
-
Use `if` attributes directly
|
|
91
|
+
Use `if` attributes directly in the XML view. These conditions are evaluated before rendering.
|
|
92
92
|
|
|
93
93
|
**index.xml**
|
|
94
94
|
```xml
|
|
@@ -107,14 +107,14 @@ Use `if` attributes directly within the XML View. These conditions are evaluated
|
|
|
107
107
|
</Alloy>
|
|
108
108
|
```
|
|
109
109
|
|
|
110
|
-
|
|
111
|
-
-
|
|
112
|
-
-
|
|
113
|
-
-
|
|
110
|
+
Benefits:
|
|
111
|
+
- Only the view that matches the condition is rendered.
|
|
112
|
+
- The UI is correct from the first frame.
|
|
113
|
+
- No visibility logic in controllers.
|
|
114
114
|
|
|
115
|
-
### Conditional
|
|
115
|
+
### Conditional queries in TSS
|
|
116
116
|
|
|
117
|
-
Use
|
|
117
|
+
Use `if` attributes in TSS definitions:
|
|
118
118
|
|
|
119
119
|
```tss
|
|
120
120
|
"#info[if=Alloy.Globals.isIos7Plus]": {
|
|
@@ -138,7 +138,7 @@ Use IF attributes in TSS definitions:
|
|
|
138
138
|
}
|
|
139
139
|
```
|
|
140
140
|
|
|
141
|
-
### Data-
|
|
141
|
+
### Data-binding with conditional queries
|
|
142
142
|
|
|
143
143
|
Define custom methods in models and render based on those methods:
|
|
144
144
|
|
package/skills/purgetss/SKILL.md
CHANGED
|
@@ -40,7 +40,7 @@ This skill automatically detects PurgeTSS usage when invoked and provides utilit
|
|
|
40
40
|
├─ fonts/ # Custom font files (.ttf, .otf)
|
|
41
41
|
├─ styles/
|
|
42
42
|
│ ├─ definitions.css # For VS Code IntelliSense
|
|
43
|
-
│ └─ utilities.tss # All PurgeTSS utility classes
|
|
43
|
+
│ └─ utilities.tss # All PurgeTSS utility classes (renamed from tailwind.tss in v7.3)
|
|
44
44
|
└─ config.cjs # Theme configuration
|
|
45
45
|
|
|
46
46
|
./app/styles/
|
|
@@ -117,6 +117,16 @@ purgetss create 'MyApp' -d -v fa
|
|
|
117
117
|
# -v: Copy icon fonts (fa, mi, ms, f7)
|
|
118
118
|
```
|
|
119
119
|
|
|
120
|
+
## What's New in v7.3.x
|
|
121
|
+
|
|
122
|
+
- `tailwind.tss` was renamed to `utilities.tss` (update any scripts or references).
|
|
123
|
+
- XML syntax validation now runs before processing and reports line-level errors (for example, missing `<`).
|
|
124
|
+
- `deviceInfo()` works in both Alloy and Classic (no `Alloy.isTablet`/`Alloy.isHandheld` dependency).
|
|
125
|
+
- Node.js 20+ is required.
|
|
126
|
+
- Font Awesome 7 is supported, including the new `--fa:` CSS custom properties.
|
|
127
|
+
- VS Code: `KevinYouu.tailwind-raw-reorder-tw4` is recommended for class ordering.
|
|
128
|
+
- If you hit issues after upgrading, try: `npm uninstall -g purgetss && npm install -g purgetss`.
|
|
129
|
+
|
|
120
130
|
:::tip NEW PROJECT: Clean Up Default app.tss
|
|
121
131
|
For new projects created with `purgetss create`, the default `app/styles/app.tss` contains a large commented template.
|
|
122
132
|
|
|
@@ -171,7 +171,7 @@ The `open` and `close` methods provide a clear and straightforward way to manage
|
|
|
171
171
|
|
|
172
172
|
By using these methods, you can ensure consistent and manageable animation behavior across your application, as opposed to using the `play` or `toggle` methods, which alternate between the `open` and `close` states based on the current state of the view.
|
|
173
173
|
|
|
174
|
-
This explicit control helps in scenarios where the exact state of the view is
|
|
174
|
+
This explicit control helps in scenarios where the exact state of the view is important for the UI or application logic.
|
|
175
175
|
|
|
176
176
|
### `open(views, [callback])`
|
|
177
177
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# PurgeTSS CLI Commands Guide
|
|
2
2
|
|
|
3
|
-
PurgeTSS provides a
|
|
3
|
+
PurgeTSS provides a full set of CLI commands for project setup, asset management, and development workflow automation.
|
|
4
4
|
|
|
5
5
|
:::info What's New in v7.2.x
|
|
6
|
-
**FontAwesome 7 &
|
|
6
|
+
**FontAwesome 7 & Performance Updates**: PurgeTSS v7.2 adds full support for **FontAwesome 7**, including the new CSS custom properties format. It also reduces installation size and refactors internals for performance and maintainability.
|
|
7
7
|
|
|
8
8
|
**Key Changes:**
|
|
9
9
|
- **Node.js 20+** required (due to "inquirer" v13 upgrade)
|
|
@@ -149,7 +149,7 @@ purgetss w -o
|
|
|
149
149
|
|
|
150
150
|
**Default behavior:** Activates auto-purge (runs on every compile)
|
|
151
151
|
|
|
152
|
-
This
|
|
152
|
+
This is especially useful with LiveView: it auto-purges on changes, gives fast feedback, and speeds up prototyping.
|
|
153
153
|
|
|
154
154
|
**What it installs in `alloy.jmk`:**
|
|
155
155
|
```javascript
|
|
@@ -62,7 +62,7 @@ purge: {
|
|
|
62
62
|
**`mode: 'all'` (default)**
|
|
63
63
|
- Scans EVERYWHERE in XML files (comments, attributes, classes, IDs, Ti Elements)
|
|
64
64
|
- **REQUIRED** if you want PurgeTSS to parse any Ti Elements styled in `config.cjs`
|
|
65
|
-
- Most
|
|
65
|
+
- Most complete but a bit slower
|
|
66
66
|
|
|
67
67
|
**`mode: 'class'`**
|
|
68
68
|
- Searches only in `class` and ID attributes in XML files
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## Overview
|
|
4
4
|
|
|
5
|
-
When creating components dynamically in Controllers (not declaratively in XML), PurgeTSS provides two
|
|
5
|
+
When creating components dynamically in Controllers (not declaratively in XML), PurgeTSS provides two methods to apply utility classes:
|
|
6
6
|
|
|
7
7
|
1. **`$.UI.create()`** - Create components with PurgeTSS classes (Recommended)
|
|
8
8
|
2. **`Alloy.createStyle()` + `applyProperties()`** - Apply PurgeTSS styles to existing components
|
|
@@ -84,6 +84,10 @@ Font Awesome 7 uses different style prefixes:
|
|
|
84
84
|
<Label class="fab fa-twitter fa-facebook fa-github" />
|
|
85
85
|
```
|
|
86
86
|
|
|
87
|
+
:::tip
|
|
88
|
+
PurgeTSS handles Font Awesome 7 CSS custom properties automatically (the `--fa:` format), so you do not need to edit icon CSS by hand.
|
|
89
|
+
:::
|
|
90
|
+
|
|
87
91
|
### Material Icons
|
|
88
92
|
|
|
89
93
|
```xml
|
|
@@ -8,6 +8,13 @@ PurgeTSS must be installed globally and initialized within each Titanium Alloy p
|
|
|
8
8
|
PurgeTSS has been thoroughly tested and proven to be compatible with Node 20.0.0 or higher.
|
|
9
9
|
:::
|
|
10
10
|
|
|
11
|
+
## Upgrade Notes (v7.3.x)
|
|
12
|
+
|
|
13
|
+
- `tailwind.tss` was renamed to `utilities.tss`. Update any scripts or paths that reference the old filename.
|
|
14
|
+
- PurgeTSS validates XML syntax before processing and reports line-level errors (for example, missing `<`).
|
|
15
|
+
- `deviceInfo()` now works in both Alloy and Classic projects (no `Alloy.isTablet`/`Alloy.isHandheld` dependency).
|
|
16
|
+
- If you hit issues after upgrading, try a clean reinstall: `npm uninstall -g purgetss && npm install -g purgetss`.
|
|
17
|
+
|
|
11
18
|
## Global Installation
|
|
12
19
|
|
|
13
20
|
Install PurgeTSS globally on your machine using NPM:
|
|
@@ -69,7 +76,7 @@ PurgeTSS creates a `purgetss` folder at the root of your project:
|
|
|
69
76
|
**File descriptions:**
|
|
70
77
|
|
|
71
78
|
- **`config.cjs`**: Where you customize colors, spacing, fonts, border radius, and add custom rules for Ti Elements
|
|
72
|
-
- **`styles/utilities.tss`**: All
|
|
79
|
+
- **`styles/utilities.tss`**: All utility classes + any custom classes from `config.cjs`
|
|
73
80
|
- **`styles/definitions.css`**: Special CSS file incorporating ALL classes from `utilities.tss`, `_app.tss`, remaining `.tss` files, and `fonts.tss`. Used by VS Code extension for IntelliSense
|
|
74
81
|
- **`fonts/`**: Directory for custom fonts (Icon, Serif, Sans-Serif, Cursive, Fantasy, Monospace). Use `purgetss build-fonts` after adding fonts
|
|
75
82
|
|
|
@@ -14,6 +14,10 @@ Before migrating, evaluate styling in the current codebase:
|
|
|
14
14
|
| Manual 2D Matrix animations | PurgeTSS Animation component |
|
|
15
15
|
| Platform conditionals in controllers | PurgeTSS platform modifiers (`ios:mt-10`) |
|
|
16
16
|
|
|
17
|
+
:::info v7.3 Upgrade Note
|
|
18
|
+
If your project or scripts reference `tailwind.tss`, update them to `utilities.tss` (the file was renamed in v7.3).
|
|
19
|
+
:::
|
|
20
|
+
|
|
17
21
|
## Step 1: Initialize PurgeTSS
|
|
18
22
|
|
|
19
23
|
```bash
|