@maccesar/titools 5.2.5 → 5.4.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/CONTRIBUTING.md +1 -1
- package/README.md +58 -97
- package/agents/ti-pro.md +4 -2
- package/commands/ti-audit.md +7 -5
- package/docs/examples.md +24 -13
- package/docs/knowledge-index.md +2 -1
- package/lib/config.js +1 -0
- package/package.json +1 -1
- package/skills/alloy-guides/SKILL.md +18 -179
- package/skills/alloy-guides/references/CLI_TASKS.md +17 -216
- package/skills/alloy-guides/references/CONCEPTS.md +27 -162
- package/skills/alloy-guides/references/CONTROLLERS.md +38 -236
- package/skills/alloy-guides/references/MODELS.md +47 -723
- package/skills/alloy-guides/references/MODELS_ADVANCED.md +21 -482
- package/skills/alloy-guides/references/VIEWS_DYNAMIC.md +12 -222
- package/skills/alloy-guides/references/VIEWS_STYLES.md +39 -358
- package/skills/alloy-guides/references/VIEWS_XML.md +36 -552
- package/skills/alloy-guides/references/WIDGETS.md +49 -127
- package/skills/alloy-howtos/SKILL.md +14 -169
- package/skills/alloy-howtos/references/best_practices.md +9 -113
- package/skills/alloy-howtos/references/cli_reference.md +18 -223
- package/skills/alloy-howtos/references/config_files.md +50 -133
- package/skills/alloy-howtos/references/debugging_troubleshooting.md +19 -63
- package/skills/alloy-howtos/references/samples.md +21 -138
- package/skills/ti-api/SKILL.md +10 -2
- package/skills/ti-api/references/api-android.md +36 -2
- package/skills/ti-api/references/api-app-platform.md +39 -3
- package/skills/ti-api/references/api-core.md +50 -18
- package/skills/ti-api/references/api-data-network.md +49 -35
- package/skills/ti-api/references/api-media.md +45 -27
- package/skills/ti-api/references/api-services.md +39 -9
- package/skills/ti-api/references/api-ui-android.md +33 -13
- package/skills/ti-api/references/api-ui-extras.md +41 -15
- package/skills/ti-api/references/api-ui-ios-animator.md +42 -26
- package/skills/ti-api/references/api-ui-ios.md +74 -2
- package/skills/ti-api/references/api-ui-lists.md +32 -16
- package/skills/ti-api/references/api-ui-text-input.md +34 -17
- package/skills/ti-api/references/api-ui-views.md +27 -1
- package/skills/ti-api/references/api-ui-windows-navigation.md +32 -18
- package/skills/ti-api/references/api-xml-global.md +66 -16
- package/skills/ti-create-release/SKILL.md +98 -0
- package/skills/ti-create-release/references/module-discovery.md +69 -0
- package/skills/ti-expert/references/adaptive-layouts.md +1 -1
- package/skills/ti-guides/SKILL.md +37 -76
- package/skills/ti-guides/references/advanced-data-and-images.md +122 -126
- package/skills/ti-guides/references/android-manifest.md +24 -83
- package/skills/ti-guides/references/app-distribution.md +31 -377
- package/skills/ti-guides/references/application-frameworks.md +127 -335
- package/skills/ti-guides/references/cli-reference.md +184 -633
- package/skills/ti-guides/references/commonjs-advanced.md +81 -231
- package/skills/ti-guides/references/compatibility-matrix.md +36 -75
- package/skills/ti-guides/references/hello-world.md +95 -70
- package/skills/ti-guides/references/hyperloop-native-access.md +52 -448
- package/skills/ti-guides/references/resources.md +174 -142
- package/skills/ti-guides/references/sdk-release-notes.md +28 -71
- package/skills/ti-guides/references/tiapp-config.md +222 -598
- package/skills/ti-howtos/SKILL.md +23 -123
- package/skills/ti-howtos/references/cross-platform-development.md +119 -324
- package/skills/ti-howtos/references/debugging-profiling.md +77 -445
- package/skills/ti-howtos/references/extending-titanium.md +199 -673
- package/skills/ti-howtos/references/local-data-sources.md +87 -300
- package/skills/ti-howtos/references/location-and-maps.md +86 -213
- package/skills/ti-howtos/references/media-apis.md +103 -223
- package/skills/ti-howtos/references/notification-services.md +86 -506
- package/skills/ti-howtos/references/remote-data-sources.md +97 -316
- package/skills/ti-howtos/references/using-modules.md +77 -133
- package/skills/ti-synthengine/SKILL.md +62 -111
- package/skills/ti-synthengine/assets/example/README.md +50 -59
- package/skills/ti-synthengine/assets/example/app.js +67 -65
- package/skills/ti-synthengine/assets/example/lib/sequenceOwner.js +39 -40
- package/skills/ti-synthengine/assets/example/lib/soundPreset.js +34 -0
- package/skills/ti-synthengine/assets/index.d.ts +122 -2
- package/skills/ti-synthengine/references/advanced-examples.md +4 -4
- package/skills/ti-synthengine/references/api.md +40 -18
- package/skills/ti-synthengine/references/audio-engine.md +15 -57
- package/skills/ti-synthengine/references/examples.md +63 -6
- package/skills/ti-synthengine/references/guide.md +61 -57
- package/skills/ti-synthengine/references/instruments-and-effects.md +15 -15
- package/skills/ti-synthengine/references/native-variation.md +53 -14
- package/skills/ti-synthengine/references/recipes-interaction.md +25 -20
- package/skills/ti-synthengine/references/recipes.md +19 -16
- package/skills/ti-synthengine/references/recommendations.md +12 -12
- package/skills/ti-synthengine/references/sound-api.md +197 -0
- package/skills/ti-synthengine/references/sound-design.md +7 -7
- package/skills/ti-synthengine/references/source-notes.md +62 -172
- package/skills/ti-synthengine/references/troubleshooting.md +17 -19
- package/skills/ti-synthengine/references/upgrade-2.0.0.md +40 -0
- package/skills/ti-ui/SKILL.md +28 -143
- package/skills/ti-ui/references/icons-and-splash-screens.md +74 -403
- package/skills/ti-ui/references/layouts-and-positioning.md +175 -402
- package/skills/ti-ui/references/listviews-and-performance.md +100 -703
- package/skills/ti-ui/references/platform-conventions.md +180 -0
- package/skills/ti-ui/references/user-interface.md +43 -0
- package/skills/alloy-guides/references/VIEWS_WITHOUT_CONTROLLERS.md +0 -102
- package/skills/alloy-howtos/references/custom_tags.md +0 -148
- package/skills/ti-guides/references/coding-best-practices.md +0 -149
- package/skills/ti-guides/references/javascript-primer.md +0 -414
- package/skills/ti-guides/references/reserved-words.md +0 -36
- package/skills/ti-guides/references/style-and-conventions.md +0 -103
- package/skills/ti-howtos/references/android-platform-deep-dives.md +0 -624
- package/skills/ti-howtos/references/automation-fastlane-appium.md +0 -96
- package/skills/ti-howtos/references/buffer-codec-streams.md +0 -162
- package/skills/ti-howtos/references/google-maps-v2.md +0 -172
- package/skills/ti-howtos/references/ios-map-kit.md +0 -149
- package/skills/ti-howtos/references/ios-platform-deep-dives.md +0 -611
- package/skills/ti-howtos/references/tutorials.md +0 -565
- package/skills/ti-howtos/references/web-content-integration.md +0 -287
- package/skills/ti-howtos/references/webpack-build-pipeline.md +0 -124
- package/skills/ti-synthengine/references/android-sim80-correction-evidence.zip +0 -0
- package/skills/ti-synthengine/references/android-sim80-correction.json +0 -162
- package/skills/ti-synthengine/references/audio-pipeline-validation.md +0 -19
- package/skills/ti-synthengine/references/bypass-physical-recheck-evidence.zip +0 -0
- package/skills/ti-synthengine/references/frontier-android-evidence.zip +0 -0
- package/skills/ti-synthengine/references/frontier-ipad-evidence.zip +0 -0
- package/skills/ti-synthengine/references/frontier-physical-validation.json +0 -1918
- package/skills/ti-synthengine/references/native-tone-repetition-validation.md +0 -59
- package/skills/ti-synthengine/references/native-variation-proposal.md +0 -182
- package/skills/ti-synthengine/references/native-variation-validation.md +0 -63
- package/skills/ti-synthengine/references/performance-review-evidence.zip +0 -0
- package/skills/ti-synthengine/references/performance-review.json +0 -1146
- package/skills/ti-synthengine/references/physical-validation.json +0 -1457
- package/skills/ti-synthengine/references/source-snapshot.json +0 -542
- package/skills/ti-synthengine/references/stats-performance.json +0 -2992
- package/skills/ti-synthengine/references/stats-performance.md +0 -82
- package/skills/ti-synthengine/references/studio-validation.json +0 -6202
- package/skills/ti-synthengine/references/unified-bypass-performance.json +0 -22425
- package/skills/ti-synthengine/references/unified-validation.json +0 -314
- package/skills/ti-ui/references/accessibility-deep-dive.md +0 -288
- package/skills/ti-ui/references/animation-and-matrices.md +0 -569
- package/skills/ti-ui/references/application-structures.md +0 -626
- package/skills/ti-ui/references/custom-fonts-styling.md +0 -549
- package/skills/ti-ui/references/event-handling.md +0 -401
- package/skills/ti-ui/references/gestures.md +0 -448
- package/skills/ti-ui/references/orientation.md +0 -374
- package/skills/ti-ui/references/platform-ui-android.md +0 -727
- package/skills/ti-ui/references/platform-ui-ios.md +0 -576
- package/skills/ti-ui/references/scrolling-views.md +0 -288
- package/skills/ti-ui/references/tableviews.md +0 -542
|
@@ -1,188 +1,27 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: alloy-guides
|
|
3
|
-
description:
|
|
3
|
+
description: Use when writing or reviewing Titanium Alloy XML views, TSS styles, controllers, models and collections, persistent list binding, widgets or build-time themes. Applies to app/views, app/styles, app/controllers and app/models. Uses the current official Titanium guides; Alloy is a compiler over the Titanium API, not web MVC.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
#
|
|
6
|
+
# Alloy guides
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Use this skill for Alloy screen structure, styling, controller lifecycle, persistent data and reusable widgets. Load the relevant reference before writing code.
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
| Task | Reference |
|
|
11
|
+
| --- | --- |
|
|
12
|
+
| MVC, project directories and generated output | [Concepts](references/CONCEPTS.md) |
|
|
13
|
+
| Arguments, opening windows, shared modules and cleanup | [Controllers](references/CONTROLLERS.md) |
|
|
14
|
+
| Model definition, ListView binding, filters and transforms | [Models](references/MODELS.md) |
|
|
15
|
+
| Persistence choices and schema migrations | [Persistence](references/MODELS_ADVANCED.md) |
|
|
16
|
+
| XML, IDs, namespaces, conditional elements and composition | [Views](references/VIEWS_XML.md) |
|
|
17
|
+
| TSS selectors, precedence, queries and build-time themes | [Styles](references/VIEWS_STYLES.md) |
|
|
18
|
+
| Runtime class changes and their required class tracking | [Dynamic styles](references/VIEWS_DYNAMIC.md) |
|
|
19
|
+
| Creating, declaring, using and isolating widgets | [Widgets](references/WIDGETS.md) |
|
|
20
|
+
| Creating, converting and running an Alloy app | [App workflow](references/CLI_TASKS.md) |
|
|
21
|
+
| PurgeTSS integration, with its independent source | [PurgeTSS](references/PURGETSS.md) |
|
|
11
22
|
|
|
12
|
-
|
|
23
|
+
Keep XML, TSS and JavaScript in their corresponding `app` directories. `Resources/` and `build/` are generated; do not edit or commit them. A controller creates its views but does not automatically open a Window. Read `$.args` at the top, export deliberate operations and clean up listeners/subscriptions separately from `$.destroy()`.
|
|
13
24
|
|
|
14
|
-
Use
|
|
25
|
+
For configuration, compiler constants, hooks and debugging use `alloy-howtos`. For API signatures and platform availability use `ti-api`. Use `ti-guides` for toolchain, native modules and distribution, `ti-howtos` for service setup, and `ti-ui` for current Titanium layout and list behavior.
|
|
15
26
|
|
|
16
|
-
|
|
17
|
-
- Writing or reviewing Alloy XML markup (`<Alloy>`, `<Window>`, `<View>`, ...)
|
|
18
|
-
- Writing or reviewing TSS styles (static and conditional/dynamic)
|
|
19
|
-
- Defining Backbone models/collections, data binding, or sync adapters
|
|
20
|
-
- Creating, consuming, or packaging widgets
|
|
21
|
-
- Understanding the Alloy compilation pipeline (`alloy.jmk`, code generation)
|
|
22
|
-
- Diagnosing TSS, XML, or model schema issues
|
|
23
|
-
|
|
24
|
-
Do NOT use for:
|
|
25
|
-
|
|
26
|
-
- Alloy CLI usage and configuration files (use `alloy-howtos`)
|
|
27
|
-
- Titanium SDK fundamentals, `tiapp.xml`, distribution (use `ti-guides`)
|
|
28
|
-
- Looking up Titanium API surfaces (use `ti-api`)
|
|
29
|
-
- Native module dependency updates (use `ti-module-update`)
|
|
30
|
-
|
|
31
|
-
## Quick reference
|
|
32
|
-
|
|
33
|
-
| Topic | Reference |
|
|
34
|
-
|---|---|
|
|
35
|
-
| Core concepts, MVC, Backbone.js, conventions | [CONCEPTS.md](references/CONCEPTS.md) |
|
|
36
|
-
| Controllers, events, conditional code, arguments | [CONTROLLERS.md](references/CONTROLLERS.md) |
|
|
37
|
-
| Models, collections, data binding | [MODELS.md](references/MODELS.md) |
|
|
38
|
-
| Sync adapters, migrations, plain Backbone, Backbone version migration | [MODELS_ADVANCED.md](references/MODELS_ADVANCED.md) |
|
|
39
|
-
| XML markup, elements, attributes, events | [VIEWS_XML.md](references/VIEWS_XML.md) |
|
|
40
|
-
| TSS styling, themes, platform-specific styles | [VIEWS_STYLES.md](references/VIEWS_STYLES.md) |
|
|
41
|
-
| Dynamic styles, autostyle, runtime styling | [VIEWS_DYNAMIC.md](references/VIEWS_DYNAMIC.md) |
|
|
42
|
-
| Controllers-less views, patterns | [VIEWS_WITHOUT_CONTROLLERS.md](references/VIEWS_WITHOUT_CONTROLLERS.md) |
|
|
43
|
-
| Creating and using widgets | [WIDGETS.md](references/WIDGETS.md) |
|
|
44
|
-
| CLI commands, code generation | [CLI_TASKS.md](references/CLI_TASKS.md) |
|
|
45
|
-
| PurgeTSS integration (optional addon) | [PURGETSS.md](references/PURGETSS.md) |
|
|
46
|
-
|
|
47
|
-
## Project structure
|
|
48
|
-
|
|
49
|
-
Standard Alloy project layout:
|
|
50
|
-
|
|
51
|
-
```
|
|
52
|
-
app/
|
|
53
|
-
├── alloy.js # Initializer file
|
|
54
|
-
├── alloy.jmk # Build configuration
|
|
55
|
-
├── config.json # Project configuration
|
|
56
|
-
├── assets/ # Images, fonts, files (→ Resources/)
|
|
57
|
-
├── controllers/ # Controller files (.js)
|
|
58
|
-
├── i18n/ # Localization strings (→ i18n/)
|
|
59
|
-
├── lib/ # CommonJS modules
|
|
60
|
-
├── migrations/ # DB migrations (<DATETIME>_<name>.js)
|
|
61
|
-
├── models/ # Model definitions (.js)
|
|
62
|
-
├── platform/ # Platform-specific resources (→ platform/)
|
|
63
|
-
├── specs/ # Test-only files (dev/test only)
|
|
64
|
-
├── styles/ # TSS files (.tss)
|
|
65
|
-
├── themes/ # Theme folders
|
|
66
|
-
├── views/ # XML markup files (.xml)
|
|
67
|
-
└── widgets/ # Widget components
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
## MVC quick start
|
|
71
|
-
|
|
72
|
-
**Controller** (`app/controllers/index.js`)
|
|
73
|
-
```javascript
|
|
74
|
-
function doClick (e) {
|
|
75
|
-
alert($.label.text);
|
|
76
|
-
}
|
|
77
|
-
$.index.open();
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
**View** (`app/views/index.xml`)
|
|
81
|
-
```xml
|
|
82
|
-
<Alloy>
|
|
83
|
-
<Window class="container">
|
|
84
|
-
<Label id="label" onClick="doClick">Hello, World</Label>
|
|
85
|
-
</Window>
|
|
86
|
-
</Alloy>
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
**Style** (`app/styles/index.tss`)
|
|
90
|
-
```javascript
|
|
91
|
-
'.container': { backgroundColor: 'white' }
|
|
92
|
-
'Label': { color: '#000' }
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
## Key concepts
|
|
96
|
-
|
|
97
|
-
- **Models / Collections** — Backbone.js objects with sync adapters (`sql`, `properties`)
|
|
98
|
-
- **Views** — XML markup with TSS styling
|
|
99
|
-
- **Controllers** — JavaScript logic with `$` reference to view components
|
|
100
|
-
- **Data Binding** — Bind collections to UI components automatically
|
|
101
|
-
- **Widgets** — Reusable components with their own MVC structure
|
|
102
|
-
- **Conventions** — File naming and placement drive code generation
|
|
103
|
-
|
|
104
|
-
## Critical rules
|
|
105
|
-
|
|
106
|
-
### Platform-specific properties in TSS
|
|
107
|
-
|
|
108
|
-
> **Warning: Platform-specific properties require modifiers**
|
|
109
|
-
>
|
|
110
|
-
> Using `Ti.UI.iOS.*` or `Ti.UI.Android.*` properties in TSS without platform modifiers causes cross-platform compilation failures.
|
|
111
|
-
>
|
|
112
|
-
> ```tss
|
|
113
|
-
> // WRONG — adds Ti.UI.iOS to Android project
|
|
114
|
-
> '#mainWindow': {
|
|
115
|
-
> statusBarStyle: Ti.UI.iOS.StatusBar.LIGHT_CONTENT // FAILS on Android
|
|
116
|
-
> }
|
|
117
|
-
>
|
|
118
|
-
> // CORRECT — only adds to iOS
|
|
119
|
-
> '#mainWindow[platform=ios]': {
|
|
120
|
-
> statusBarStyle: Ti.UI.iOS.StatusBar.LIGHT_CONTENT
|
|
121
|
-
> }
|
|
122
|
-
>
|
|
123
|
-
> // CORRECT — only adds to Android
|
|
124
|
-
> '#mainWindow[platform=android]': {
|
|
125
|
-
> actionBar: { displayHomeAsUp: true }
|
|
126
|
-
> }
|
|
127
|
-
> ```
|
|
128
|
-
>
|
|
129
|
-
> Properties that always require platform modifiers:
|
|
130
|
-
>
|
|
131
|
-
> - **iOS:** `statusBarStyle`, `modalStyle`, `modalTransitionStyle`, anything under `Ti.UI.iOS.*`
|
|
132
|
-
> - **Android:** `actionBar` config, anything under `Ti.UI.Android.*`
|
|
133
|
-
>
|
|
134
|
-
> Available modifiers: `[platform=ios]`, `[platform=android]`, `[formFactor=handheld]`, `[formFactor=tablet]`, `[if=Alloy.Globals.<expression>]`
|
|
135
|
-
>
|
|
136
|
-
> See [VIEWS_DYNAMIC.md](references/VIEWS_DYNAMIC.md) for the full set of conditional / platform modifier patterns.
|
|
137
|
-
|
|
138
|
-
## Common patterns
|
|
139
|
-
|
|
140
|
-
### Creating a model
|
|
141
|
-
|
|
142
|
-
```bash
|
|
143
|
-
alloy generate model book sql title:string author:string
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
### Data binding
|
|
147
|
-
|
|
148
|
-
```xml
|
|
149
|
-
<Collection src="book" />
|
|
150
|
-
<TableView dataCollection="book">
|
|
151
|
-
<TableViewRow title="{title}" />
|
|
152
|
-
</TableView>
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
### Platform-specific code
|
|
156
|
-
|
|
157
|
-
```javascript
|
|
158
|
-
if (OS_IOS) {
|
|
159
|
-
// iOS-only code
|
|
160
|
-
}
|
|
161
|
-
if (OS_ANDROID) {
|
|
162
|
-
// Android-only code
|
|
163
|
-
}
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
### Widget usage
|
|
167
|
-
|
|
168
|
-
```xml
|
|
169
|
-
<Widget src="mywidget" id="foo" />
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
## Compilation process
|
|
173
|
-
|
|
174
|
-
1. **Cleanup** — `Resources` folder cleaned
|
|
175
|
-
2. **Build config** — `alloy.jmk` loaded (`pre:load` task)
|
|
176
|
-
3. **Framework files** — Backbone.js, Underscore.js, sync adapters copied
|
|
177
|
-
4. **MVC generation** — Models, widgets, views, controllers compiled to JS
|
|
178
|
-
5. **Main app** — `app.js` generated from template
|
|
179
|
-
6. **Optimization** — UglifyJS optimization, platform-specific code removal
|
|
180
|
-
|
|
181
|
-
## Related skills
|
|
182
|
-
|
|
183
|
-
| Task | Use this skill |
|
|
184
|
-
|---|---|
|
|
185
|
-
| Alloy CLI, `alloy.jmk`, `config.json`, debugging compilation | `alloy-howtos` |
|
|
186
|
-
| Titanium SDK config, Hyperloop, app distribution | `ti-guides` |
|
|
187
|
-
| Titanium API lookup (Ti.UI, Ti.Network, modules) | `ti-api` |
|
|
188
|
-
| Native module dependency updates | `ti-module-update` |
|
|
27
|
+
The current guide pages are at [titaniumsdk.com/docs/alloy.md](https://titaniumsdk.com/docs/alloy.md). References include released-compiler caveats where a published recipe conflicts with released behavior. PurgeTSS keeps its own source and is outside the official Alloy guide refresh.
|
|
@@ -1,233 +1,34 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Create and run an Alloy app
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
## Creating a New Application
|
|
6
|
-
|
|
7
|
-
> **Recommended:** Use `ti create --alloy` to create a new Alloy project in one step.
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
ti create -t app --alloy --id com.example.myapp -n MyApp -p android,ios
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
This creates a complete Alloy project structure with the `app` folder containing controllers, views, styles, models, and migrations.
|
|
14
|
-
|
|
15
|
-
**Alternative (interactive):**
|
|
16
|
-
```bash
|
|
17
|
-
ti create
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
You will be prompted to enter an application name and application ID. When prompted for project type, select **Alloy**.
|
|
21
|
-
|
|
22
|
-
**Legacy method (not recommended):**
|
|
23
|
-
```bash
|
|
24
|
-
ti create
|
|
25
|
-
cd PROJECTDIRECTORY
|
|
26
|
-
alloy new
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
This two-step approach is discouraged in favor of using `--alloy` directly.
|
|
30
|
-
|
|
31
|
-
## Creating a New Application Using a Test Application
|
|
32
|
-
|
|
33
|
-
You can generate a new Alloy project using a test application from the Alloy Github repo.
|
|
3
|
+
Check the toolchain with `ti info` and finish environment setup before diagnosing a failed build as an Alloy problem.
|
|
34
4
|
|
|
35
5
|
```bash
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
6
|
+
npm install -g alloy
|
|
7
|
+
ti create --type app --alloy --name Hello --id com.example.hello --platforms android,ios --workspace-dir .
|
|
8
|
+
cd Hello
|
|
9
|
+
ti build --platform android
|
|
39
10
|
```
|
|
40
11
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
The CLI can generate skeleton controllers (with views and styles), models, database migrations and widgets.
|
|
12
|
+
Use a reverse-DNS app ID from a domain you control: changing it after publication means a new listing in both stores. `--name` chooses the directory and icon label. `ios` selects iPhone and iPad; `iphone` selects iPhone only. In noninteractive creation, supply `--type` and `--workspace-dir` as shown; `ti create` without arguments prompts.
|
|
44
13
|
|
|
45
|
-
|
|
14
|
+
`--alloy` invokes `alloy new` after creating the project. Alloy must be on `PATH`; otherwise the project remains Classic and the CLI reports what to install. To convert an existing Classic project, run `alloy new` in its root.
|
|
46
15
|
|
|
47
|
-
|
|
16
|
+
## Build and iterate
|
|
48
17
|
|
|
49
18
|
```bash
|
|
50
|
-
|
|
19
|
+
ti build --platform ios
|
|
20
|
+
ti build --platform android --build-only
|
|
21
|
+
ti build --platform android --liveview
|
|
51
22
|
```
|
|
52
23
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
### Generating a View
|
|
56
|
-
|
|
57
|
-
To generate a view and style **without** a controller:
|
|
58
|
-
|
|
59
|
-
```bash
|
|
60
|
-
alloy generate view <name> [--widgetname <widget_name>] [-o path_to_project/app] [--platform <platform>]
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
This creates `app/styles/<name>.tss` and `app/views/<name>.xml`.
|
|
64
|
-
|
|
65
|
-
### Generating a Style
|
|
66
|
-
|
|
67
|
-
To generate a style for a view-controller:
|
|
68
|
-
|
|
69
|
-
```bash
|
|
70
|
-
alloy generate style <name> [--widgetname <widget_name>]
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
Alloy uses the id and attribute names in the markup file to populate the skeleton style file. This creates `app/styles/<name>.tss`. If you add new `id` or `class` attributes to the markup file, running either of these commands updates the style file with the new attributes.
|
|
74
|
-
|
|
75
|
-
To generate style files for all view-controllers:
|
|
76
|
-
|
|
77
|
-
```bash
|
|
78
|
-
alloy generate style --all
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
### Generating a Model
|
|
82
|
-
|
|
83
|
-
To generate a model:
|
|
84
|
-
|
|
85
|
-
```bash
|
|
86
|
-
alloy generate model <name> <adapter> [<col_name_1>:<col_type_1> <col_name_2>:<col_type_2> ...] [-o path_to_project/app]
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
The fourth parameter selects the adapter type: `sql` for SQLite or `properties` for local storage. The fifth parameter defines the table schema. This is required for `sql` and `properties` adapter types.
|
|
90
|
-
|
|
91
|
-
This creates `app/models/<name>.js`, and `app/migrations/DATETIME_<name>.js` if the adapter type is 'sql'.
|
|
92
|
-
|
|
93
|
-
### Generating a Migration
|
|
94
|
-
|
|
95
|
-
To generate a standalone migration for a specific model:
|
|
96
|
-
|
|
97
|
-
```bash
|
|
98
|
-
alloy generate migration <name> [-o path_to_project/app]
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
This creates `app/migrations/DATETIME_<name>.js`.
|
|
102
|
-
|
|
103
|
-
### Generating a Widget
|
|
104
|
-
|
|
105
|
-
To generate a basic widget:
|
|
106
|
-
|
|
107
|
-
```bash
|
|
108
|
-
alloy generate widget <name> [-o path_to_project/app]
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
This creates `app/widgets/<name>/widget.json`, `app/widgets/<name>/controllers/widget.js`, `app/widgets/<name>/styles/widget.tss`, and `app/widgets/<name>/views/widget.xml`. The widget is automatically added to `config.json`.
|
|
112
|
-
|
|
113
|
-
### Generating alloy.jmk
|
|
114
|
-
|
|
115
|
-
To generate the build customization file:
|
|
116
|
-
|
|
117
|
-
```bash
|
|
118
|
-
alloy generate jmk [-o path_to_project/app]
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
This creates `app/alloy.jmk` with a few task hooks in place.
|
|
122
|
-
|
|
123
|
-
## Extracting Localization Strings
|
|
124
|
-
|
|
125
|
-
The `alloy extract-i18n` command inspects your JS, TSS and XML files (since Alloy 1.6.0) for instances of Titanium's localization functions and adds those strings to an i18n strings.xml file.
|
|
126
|
-
|
|
127
|
-
```bash
|
|
128
|
-
alloy extract-i18n [language] [--apply]
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
**Parameters**:
|
|
132
|
-
|
|
133
|
-
* `language` – Optional. Two-letter language code (`en`, `es`, etc.). Default is `en`.
|
|
134
|
-
* `--apply` – Optional. Writes new entries to `strings.xml`. Without it, displays a preview. This is a safe operation: it only adds new entries and never removes existing ones.
|
|
135
|
-
|
|
136
|
-
Supported functions:
|
|
137
|
-
|
|
138
|
-
* `Titanium.Locale.getString()`
|
|
139
|
-
* `Ti.Locale.getString()`
|
|
140
|
-
* `L()`
|
|
141
|
-
|
|
142
|
-
**Example**:
|
|
143
|
-
|
|
144
|
-
```javascript
|
|
145
|
-
// In JavaScript/TSS
|
|
146
|
-
const name = Ti.Locale.getString('name');
|
|
147
|
-
const color = Titanium.Locale.getString('color');
|
|
148
|
-
const currency = L('currency');
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
```xml
|
|
152
|
-
<!-- In XML (since Alloy 1.6.0) -->
|
|
153
|
-
<Label textid="greeting" />
|
|
154
|
-
<Button titleid="submit_button" />
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
**Preview Output** (without --apply):
|
|
158
|
-
|
|
159
|
-
```
|
|
160
|
-
[INFO] ######## BEFORE ########
|
|
161
|
-
[INFO] <?xml version="1.0" encoding="UTF-8"?>
|
|
162
|
-
[INFO] <resources>
|
|
163
|
-
[INFO] </resources>
|
|
164
|
-
[INFO]
|
|
165
|
-
[INFO] ######## AFTER ########
|
|
166
|
-
[INFO] <?xml version="1.0" encoding="UTF-8"?>
|
|
167
|
-
[INFO] <resources>
|
|
168
|
-
[INFO] <string name="name">name</string>
|
|
169
|
-
[INFO] <string name="color">color</string>
|
|
170
|
-
[INFO] <string name="currency">currency</string>
|
|
171
|
-
[INFO] <string name="greeting">greeting</string>
|
|
172
|
-
[INFO] <string name="submit_button">submit_button</string>
|
|
173
|
-
[INFO] </resources>
|
|
174
|
-
```
|
|
175
|
-
|
|
176
|
-
Running with `--apply`:
|
|
177
|
-
|
|
178
|
-
```bash
|
|
179
|
-
alloy extract-i18n --apply
|
|
180
|
-
```
|
|
181
|
-
|
|
182
|
-
Generates `app/i18n/en/strings.xml`.
|
|
183
|
-
|
|
184
|
-
To generate strings for another language, pass the language code:
|
|
185
|
-
|
|
186
|
-
```bash
|
|
187
|
-
alloy extract-i18n es --apply
|
|
188
|
-
```
|
|
189
|
-
|
|
190
|
-
This generates `app/i18n/es/strings.xml`.
|
|
191
|
-
|
|
192
|
-
```xml
|
|
193
|
-
<resources>
|
|
194
|
-
<string name="name">name</string>
|
|
195
|
-
<string name="color">color</string>
|
|
196
|
-
<string name="currency">currency</string>
|
|
197
|
-
<string name="greeting">greeting</string>
|
|
198
|
-
<string name="submit_button">submit_button</string>
|
|
199
|
-
</resources>
|
|
200
|
-
```
|
|
201
|
-
|
|
202
|
-
## Compiling a Specific View-Controller
|
|
203
|
-
|
|
204
|
-
To select which Alloy view-controller to compile to Titanium code:
|
|
205
|
-
|
|
206
|
-
```bash
|
|
207
|
-
alloy compile --config platform=<platform>,file=<file>
|
|
208
|
-
|
|
209
|
-
## Example
|
|
210
|
-
alloy compile --config platform=android,file=app/controller/index.js
|
|
211
|
-
```
|
|
212
|
-
|
|
213
|
-
## Building an Application
|
|
214
|
-
|
|
215
|
-
To build and run an application:
|
|
216
|
-
|
|
217
|
-
```bash
|
|
218
|
-
ti build --platform <platform> [--project-dir <value>] [--sdk <value>] [<platform_build_options>]
|
|
219
|
-
```
|
|
220
|
-
|
|
221
|
-
Running this from the root directory of the project compiles the files to the correct location automatically.
|
|
222
|
-
|
|
223
|
-
## Installing Special Project Components
|
|
24
|
+
Default targets are Android emulator and iOS simulator. With several available devices, the CLI prompts; use `--device-id` to choose explicitly. iOS builds require macOS and Xcode. Initial native builds are slower than incremental builds. A successful build reports `Project built successfully`; terminal logs continue until Ctrl-C. `--build-only` skips installation and launch; LiveView reloads JavaScript on save.
|
|
224
25
|
|
|
225
|
-
|
|
26
|
+
For real devices, use `--target device`. Android needs developer options, USB debugging and USB authorization; check `ti info -t android`. iOS needs a development certificate and a matching provisioning profile containing the device; connect, unlock and trust the Mac. Select a UDID from `ti info -t ios` with `--device-id`. Use `ti-guides` for full setup and signing.
|
|
226
27
|
|
|
227
|
-
To
|
|
28
|
+
To generate the widget described by the current guide:
|
|
228
29
|
|
|
229
30
|
```bash
|
|
230
|
-
alloy
|
|
31
|
+
alloy generate widget com.example.rating
|
|
231
32
|
```
|
|
232
33
|
|
|
233
|
-
|
|
34
|
+
Sources: [first app](https://titaniumsdk.com/docs/build/first-app.md), [Alloy](https://titaniumsdk.com/docs/alloy.md), [widgets](https://titaniumsdk.com/docs/alloy/widgets.md).
|