@maccesar/titools 2.10.1 → 3.1.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.
Files changed (81) hide show
  1. package/AGENTS-VERCEL-RESEARCH.md +23 -12
  2. package/README.md +81 -182
  3. package/agents/ti-pro.md +8 -14
  4. package/lib/cleanup.js +13 -0
  5. package/lib/commands/skills.js +2 -1
  6. package/lib/config.js +9 -11
  7. package/lib/platform.js +1 -1
  8. package/package.json +2 -3
  9. package/skills/alloy-guides/SKILL.md +0 -190
  10. package/skills/alloy-guides/references/CLI_TASKS.md +0 -233
  11. package/skills/alloy-guides/references/CONCEPTS.md +0 -171
  12. package/skills/alloy-guides/references/CONTROLLERS.md +0 -279
  13. package/skills/alloy-guides/references/MODELS.md +0 -1214
  14. package/skills/alloy-guides/references/PURGETSS.md +0 -46
  15. package/skills/alloy-guides/references/VIEWS_DYNAMIC.md +0 -235
  16. package/skills/alloy-guides/references/VIEWS_STYLES.md +0 -375
  17. package/skills/alloy-guides/references/VIEWS_WITHOUT_CONTROLLERS.md +0 -102
  18. package/skills/alloy-guides/references/VIEWS_XML.md +0 -581
  19. package/skills/alloy-guides/references/WIDGETS.md +0 -160
  20. package/skills/alloy-howtos/SKILL.md +0 -181
  21. package/skills/alloy-howtos/references/best_practices.md +0 -121
  22. package/skills/alloy-howtos/references/cli_reference.md +0 -230
  23. package/skills/alloy-howtos/references/config_files.md +0 -158
  24. package/skills/alloy-howtos/references/custom_tags.md +0 -148
  25. package/skills/alloy-howtos/references/debugging_troubleshooting.md +0 -78
  26. package/skills/alloy-howtos/references/samples.md +0 -156
  27. package/skills/ti-api/SKILL.md +0 -109
  28. package/skills/ti-api/references/api-android.md +0 -675
  29. package/skills/ti-api/references/api-app-platform.md +0 -636
  30. package/skills/ti-api/references/api-core.md +0 -764
  31. package/skills/ti-api/references/api-data-network.md +0 -641
  32. package/skills/ti-api/references/api-media.md +0 -655
  33. package/skills/ti-api/references/api-modules-ble-bluetooth.md +0 -657
  34. package/skills/ti-api/references/api-modules-coremotion-urlsession.md +0 -411
  35. package/skills/ti-api/references/api-modules-map.md +0 -632
  36. package/skills/ti-api/references/api-modules-nfc.md +0 -725
  37. package/skills/ti-api/references/api-modules-social-misc.md +0 -526
  38. package/skills/ti-api/references/api-services.md +0 -700
  39. package/skills/ti-api/references/api-ui-android.md +0 -499
  40. package/skills/ti-api/references/api-ui-extras.md +0 -702
  41. package/skills/ti-api/references/api-ui-ios-animator.md +0 -378
  42. package/skills/ti-api/references/api-ui-ios.md +0 -756
  43. package/skills/ti-api/references/api-ui-lists.md +0 -581
  44. package/skills/ti-api/references/api-ui-text-input.md +0 -607
  45. package/skills/ti-api/references/api-ui-views.md +0 -572
  46. package/skills/ti-api/references/api-ui-windows-navigation.md +0 -676
  47. package/skills/ti-api/references/api-xml-global.md +0 -743
  48. package/skills/ti-guides/SKILL.md +0 -75
  49. package/skills/ti-guides/references/advanced-data-and-images.md +0 -155
  50. package/skills/ti-guides/references/android-manifest.md +0 -97
  51. package/skills/ti-guides/references/app-distribution.md +0 -373
  52. package/skills/ti-guides/references/application-frameworks.md +0 -366
  53. package/skills/ti-guides/references/cli-reference.md +0 -700
  54. package/skills/ti-guides/references/coding-best-practices.md +0 -150
  55. package/skills/ti-guides/references/commonjs-advanced.md +0 -279
  56. package/skills/ti-guides/references/hello-world.md +0 -99
  57. package/skills/ti-guides/references/hyperloop-native-access.md +0 -458
  58. package/skills/ti-guides/references/javascript-primer.md +0 -402
  59. package/skills/ti-guides/references/reserved-words.md +0 -36
  60. package/skills/ti-guides/references/resources.md +0 -172
  61. package/skills/ti-guides/references/style-and-conventions.md +0 -104
  62. package/skills/ti-guides/references/tiapp-config.md +0 -655
  63. package/skills/ti-howtos/SKILL.md +0 -143
  64. package/skills/ti-howtos/references/android-platform-deep-dives.md +0 -609
  65. package/skills/ti-howtos/references/automation-fastlane-appium.md +0 -96
  66. package/skills/ti-howtos/references/buffer-codec-streams.md +0 -162
  67. package/skills/ti-howtos/references/cross-platform-development.md +0 -358
  68. package/skills/ti-howtos/references/debugging-profiling.md +0 -473
  69. package/skills/ti-howtos/references/extending-titanium.md +0 -684
  70. package/skills/ti-howtos/references/google-maps-v2.md +0 -172
  71. package/skills/ti-howtos/references/ios-map-kit.md +0 -149
  72. package/skills/ti-howtos/references/ios-platform-deep-dives.md +0 -595
  73. package/skills/ti-howtos/references/local-data-sources.md +0 -310
  74. package/skills/ti-howtos/references/location-and-maps.md +0 -267
  75. package/skills/ti-howtos/references/media-apis.md +0 -268
  76. package/skills/ti-howtos/references/notification-services.md +0 -539
  77. package/skills/ti-howtos/references/remote-data-sources.md +0 -339
  78. package/skills/ti-howtos/references/tutorials.md +0 -552
  79. package/skills/ti-howtos/references/using-modules.md +0 -182
  80. package/skills/ti-howtos/references/web-content-integration.md +0 -288
  81. package/skills/ti-howtos/references/webpack-build-pipeline.md +0 -125
@@ -1,158 +0,0 @@
1
- # Alloy configuration files reference
2
-
3
- ## Build configuration file (alloy.jmk)
4
-
5
- Alloy exposes hooks to customize compilation with a JS Makefile (JMK).
6
-
7
- **Location:** `app/alloy.jmk`
8
-
9
- **Example:**
10
- ```javascript
11
- task('pre:compile', (event, logger) => {
12
- logger.showTimestamp = true;
13
- logger.info(`building project at ${event.dir.project}`);
14
- });
15
-
16
- task('post:compile', (event, logger) => {
17
- logger.info('compile finished!');
18
- });
19
- ```
20
-
21
- ### Compiler tasks (event names)
22
-
23
- | Task | When Called |
24
- | ---------------- | --------------------------------------------------------- |
25
- | `pre:load` | After project clean, before copying assets to `Resources` |
26
- | `pre:compile` | Before compiler starts |
27
- | `post:compile` | After compiler finishes, before exit |
28
- | `compile:app.js` | After compiling `app.js`, before writing to disk |
29
-
30
- ### Event object
31
-
32
- | Property | Type | Description |
33
- | -------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
34
- | `adapters` | Array | List of adapters |
35
- | `alloyConfig` | Object | Compiler config: `platform` (android/ios), `file` (selective compile), `deploytype` (development/test/production), `beautify` (Boolean) |
36
- | `autoStyle` | Boolean | Autostyle enabled for project |
37
- | `dependencies` | Object | Value of `dependencies` key in config.json |
38
- | `dir` | Object | Directory paths: `home` (app path), `project` (root path), `resources`, `resourcesAlloy`, `assets`, `config`, `controllers`, `migrations`, `models`, `styles`, `themes`, `views`, `widgets`, `builtins`, `template` |
39
- | `sourcemap` | Boolean | If `true`, generates mapping files to link generated Titanium files in `Resources` back to the source files in `app` for debugging. |
40
- | `theme` | String | Theme name being used |
41
- | `code` | String | *(compile:app.js only)* Contents of `app.js` |
42
- | `appJSFile` | String | *(compile:app.js only)* Absolute path to `app.js` |
43
-
44
- ### Logger object
45
-
46
- The `logger` object controls compilation log output.
47
-
48
- #### Properties
49
-
50
- | Property | Type | Description |
51
- | --------------- | ------- | ----------------------------------------------- |
52
- | `DEBUG` | Number | READONLY. Output all log messages. |
53
- | `INFO` | Number | READONLY. Output all except debug messages. |
54
- | `WARN` | Number | READONLY. Output only warning and error. |
55
- | `ERROR` | Number | READONLY. Output only error messages. |
56
- | `NONE` | Number | READONLY. Disable log messages. |
57
- | `logLevel` | Number | Sets which log messages to output. |
58
- | `showTimestamp` | Boolean | If `true`, outputs timestamp with log messages. |
59
- | `stripColors` | Boolean | If `true`, suppresses color output. |
60
-
61
- #### Methods
62
-
63
- | Method | Description |
64
- | -------------------- | ------------------------------ |
65
- | `debug(msg: String)` | Outputs a debug log message. |
66
- | `info(msg: String)` | Outputs an info log message. |
67
- | `warn(msg: String)` | Outputs a warning log message. |
68
- | `error(msg: String)` | Outputs an error log message. |
69
-
70
- ---
71
-
72
- ## Global initializer (alloy.js)
73
-
74
- **Location:** `app/alloy.js`
75
-
76
- Runs before any controllers load. Use it to set up globals and singletons.
77
-
78
- Common uses:
79
- - Creating `Alloy.Collections` (e.g., `Alloy.Collections.myModel = Alloy.createCollection('myModel');`)
80
- - Setting up `Alloy.Globals` (shared references, utility functions)
81
- - Initializing singletons (analytics, logging, network managers)
82
- - Configuring global event listeners
83
-
84
- **Example:**
85
- ```javascript
86
- // app/alloy.js
87
- Alloy.Globals.loading = Alloy.createWidget('com.example.loading');
88
- Alloy.Collections.users = Alloy.createCollection('user');
89
-
90
- // Global utility
91
- Alloy.Globals.alert = (title, message) => {
92
- Ti.UI.createAlertDialog({ title, message }).show();
93
- };
94
- ```
95
-
96
- ---
97
-
98
- ## Project configuration file (config.json)
99
-
100
- **Location:** `app/config.json`
101
-
102
- Alloy uses `config.json` for global values, environment and platform overrides, and widget dependencies.
103
- ### Objects
104
-
105
- | Object | Description |
106
- | ----------------- | ----------------------------------------------------------- |
107
- | `global` | Key-value pairs for all environments and platforms |
108
- | `env:development` | Development builds (simulator/emulator) |
109
- | `env:test` | Test builds on device |
110
- | `env:production` | Production builds (after package installation) |
111
- | `os:android` | Android-specific values |
112
- | `os:ios` | iOS-specific values |
113
- | `dependencies` | Widget dependencies (name: version) |
114
- | `autoStyle` | Enable autostyle for entire project |
115
- | `backbone` | Backbone.js version: `0.9.2` (default), `1.1.2`, or `1.3.3` |
116
-
117
- **Precedence:** `os` > `env` > `global`. Combinations (for example, `os:ios env:production`) override single values.
118
-
119
- **Runtime access:** Values are available at runtime via `Alloy.CFG.<key>`.
120
-
121
- **Example:**
122
-
123
- ```json
124
- {
125
- "global": { "foo": 1 },
126
- "env:development": { "foo": 2 },
127
- "env:test": { "foo": 3 },
128
- "env:production": { "foo": 4 },
129
- "os:ios env:production": { "foo": 5 },
130
- "os:ios env:development": { "foo": 6 },
131
- "os:ios env:test": { "foo": 7 },
132
- "os:android": { "foo": 8 },
133
- "dependencies": {
134
- "com.foo.widget": "1.0"
135
- }
136
- }
137
- ```
138
-
139
- Accessing values: `Ti.API.info(Alloy.CFG.foo)` on iPhone simulator returns `6`.
140
-
141
- ---
142
-
143
- ## Widget configuration file (widget.json)
144
-
145
- **Location:** Root directory of the widget. Follows the npm `package.json` format with a few exceptions.
146
- ### Keys
147
-
148
- | Key | Type | Required | Description |
149
- | ---------------------- | ------ | -------- | ------------------------------------- |
150
- | `id` | String | Yes | Must match widget root folder name |
151
- | `copyright` | String | No | Copyright information |
152
- | `license` | String | No | License information |
153
- | `min-alloy-version` | Float | No* | Minimum Alloy version required |
154
- | `min-titanium-version` | Float | No* | Minimum Titanium version required |
155
- | `tags` | String | No | Comma-delimited keywords |
156
- | `platforms` | String | No* | Supported platforms (comma-delimited) |
157
-
158
- (*) Currently, `min-alloy-version`, `min-titanium-version`, and `platforms` are not strictly enforced, but Alloy will perform checks against these in future versions.
@@ -1,148 +0,0 @@
1
- # Creating custom tags in Titanium with Alloy
2
-
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
-
5
- ## Why use custom tags?
6
-
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
-
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
-
13
- ## Basic setup
14
-
15
- 1. Create a file in `app/lib/` (e.g., `checkbox.js`)
16
- 2. Export a `create<TagName>` function
17
- 3. Use in XML with the `module` attribute
18
-
19
- **view.xml**
20
- ```xml
21
- <CheckBox module="checkbox" id="termsAccepted"
22
- caption="I agree to the terms of use"
23
- underline="true"
24
- onCaptionClick="doShowTerms"
25
- onChange="onCheckChange" />
26
- ```
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
-
29
- ## Robust example: CheckBox
30
-
31
- **app/lib/checkbox.js**
32
- ```javascript
33
- exports.createCheckBox = args => {
34
- // Wrapper view for all components
35
- const wrapper = Ti.UI.createView({
36
- top: args.top || 5,
37
- width: Ti.UI.SIZE,
38
- height: Ti.UI.SIZE,
39
- layout: "horizontal",
40
- left: args.left || 20,
41
- right: args.right || null,
42
- checked: args.checked || false
43
- });
44
-
45
- // The box itself
46
- const box = Ti.UI.createView({
47
- width: 15,
48
- height: 15,
49
- borderWidth: 1,
50
- borderColor: "#02A9F4"
51
- });
52
-
53
- // Attributed string for styled caption (e.g. underline)
54
- const attr = Ti.UI.createAttributedString({
55
- text: args.caption
56
- });
57
-
58
- if (args.underline) {
59
- attr.applyProperties({
60
- attributes: [{
61
- type: Ti.UI.ATTRIBUTE_UNDERLINES_STYLE,
62
- value: Ti.UI.ATTRIBUTE_UNDERLINE_STYLE_SINGLE,
63
- range: [0, args.caption.length]
64
- }]
65
- });
66
- }
67
-
68
- const caption = Ti.UI.createLabel({
69
- color: "#000",
70
- attributedString: attr,
71
- left: 10,
72
- text: args.caption,
73
- font: { fontSize: 10 }
74
- });
75
-
76
- // The tick (using Unicode to avoid assets)
77
- const tick = Ti.UI.createLabel({
78
- text: "\u2713",
79
- left: 1,
80
- color: "#02A9F4",
81
- font: { fontWeight: "bold" },
82
- visible: args.checked || false
83
- });
84
-
85
- // Handle clicks
86
- caption.addEventListener("click", () => {
87
- wrapper.fireEvent("captionClick");
88
- });
89
-
90
- box.addEventListener("click", () => {
91
- tick.visible = !tick.visible;
92
- wrapper.checked = !wrapper.checked;
93
- wrapper.fireEvent("change", { checked: wrapper.checked });
94
- });
95
-
96
- box.add(tick);
97
- wrapper.add(box);
98
- wrapper.add(caption);
99
-
100
- return wrapper;
101
- };
102
- ```
103
-
104
- ## Global module override
105
-
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
-
108
- ```xml
109
- <Alloy module="ui">
110
- <Window>
111
- <CustomButton /> <!-- Looks for createCustomButton in app/lib/ui.js -->
112
- <Label /> <!-- Checks ui.js for createLabel first -->
113
- </Window>
114
- </Alloy>
115
- ```
116
- This is useful for adding default colors or properties (for example, a black default color for Android Labels) across a project.
117
-
118
- ## Key points
119
-
120
- | Aspect | Description |
121
- | ------------- | ------------------------------------------------------------- |
122
- | File location | `app/lib/<module_name>.js` |
123
- | Function name | `create<TagName>` (e.g., `createCheckBox` for `<CheckBox>`) |
124
- | Return value | Must return a `Ti.UI.*` component (View, Button, Label, etc.) |
125
- | Arguments | Receives all XML/TSS attributes in a single `args` object |
126
-
127
- ## Using Custom Tags Without Alloy XML
128
-
129
- You can also use custom tags from plain JavaScript via `require()`:
130
-
131
- ```javascript
132
- const checkbox = require("checkbox").createCheckBox({
133
- caption: "I agree",
134
- underline: true
135
- });
136
- win.add(checkbox);
137
- ```
138
-
139
- This works because custom tags are standard CommonJS modules. The `module` attribute in XML is a convenience.
140
-
141
- ## Custom tags vs widgets
142
-
143
- | Custom Tags | Widgets |
144
- | ------------------------------------- | ---------------------------------------- |
145
- | Single file in `app/lib/` | Separate folder structure |
146
- | No `config.json` dependency needed | Requires `dependencies` in `config.json` |
147
- | Simpler for single-component controls | Better for complex multi-view components |
148
- | Easier to share across projects | More formal packaging |
@@ -1,78 +0,0 @@
1
- # Alloy debugging and troubleshooting
2
-
3
- ## Debugging
4
-
5
- ### Compiler error messages
6
-
7
- The Alloy compiler reports syntax errors in JavaScript, JSON, TSS, and XML. Error messages include:
8
- - File path
9
- - Line and character position
10
- - Description of the error
11
-
12
- ## Troubleshooting
13
-
14
- ### Error: No app.js found
15
-
16
- **Error:** `[ERROR] No app.js found. Ensure the app.js file exists in your project's Resources directory.`
17
-
18
- **Solution:** If part of the contents of your `Resources` folder were deleted, run:
19
- ```bash
20
- alloy compile --config platform=<platform>
21
- ```
22
-
23
- ### Android: images, HTML, and assets not displaying
24
-
25
- **Problem:** Assets display on iOS and Mobile Web but not Android.
26
-
27
- **Solution:** Android requires absolute paths. Precede asset paths with a slash ('/'). iOS and Mobile Web accept both relative and absolute paths.
28
-
29
- ### Android runtime error: cannot call method of undefined
30
-
31
- **Error:** `Uncaught TypeError: Cannot call method xxx of undefined`
32
-
33
- **Causes:**
34
- 1. Creating an iOS-only Titanium object. Use the `platform` attribute in views to enforce platform-specific objects.
35
- 2. Top-level UI component has an assigned ID. The controller cannot use `$.<controller_name>` to reference it; use the assigned ID instead.
36
-
37
- ### Android runtime error: Alloy is not defined
38
-
39
- **Error:** `Uncaught ReferenceError: Alloy is not defined`
40
-
41
- **Cause:** Non-controller JavaScript files are not automatically wrapped by Alloy. See [best_practices.md](best_practices.md) for the safe require pattern for non-controller files.
42
-
43
- **Solution:** Require the 'alloy' module:
44
- ```javascript
45
- const Alloy = require('alloy');
46
- ```
47
-
48
- ### iOS application error: invalid method passed to UIModule
49
-
50
- **Error:** `invalid method (xxx) passed to UIModule (unknown file)`
51
-
52
- **Cause:** Trying to create an Android-only Titanium object.
53
-
54
- **Solution:** Use the `platform` attribute in the view to enforce platform-specific objects.
55
-
56
- ### iOS application error: undefined is not an object
57
-
58
- **Error:** `undefined is not an object (evaluating $.xxx.open) (unknown file)`
59
-
60
- **Cause:** Top-level UI component has an assigned ID in XML markup.
61
-
62
- **Solution:** The controller cannot use `$.<controller_name>` to reference it; use the assigned ID instead.
63
-
64
- ## Getting help
65
-
66
- Use the [TiDev Community Slack](https://slack.tidev.io/) or [GitHub Discussions](https://github.com/tidev/titanium-sdk/discussions):
67
- - Include 'alloy' as a tag
68
- - Include the Alloy version (run `alloy --version`)
69
- - Include platform information
70
-
71
- ## Submitting a bug report
72
-
73
- Search [existing issues](https://github.com/tidev/alloy/issues) first to avoid duplicates. If none match, create a new issue:
74
- - Select 'Alloy' as the component
75
- - Include Alloy version (`alloy --version`)
76
- - Include environment information
77
-
78
- For detailed instructions, see [How to Report a Bug or Make a Feature Request](https://titaniumsdk.com/guide/Titanium_SDK/Titanium_SDK_Guide/Contributing_to_Titanium/How_to_Report_a_Bug_or_Make_a_Feature_Request/).
@@ -1,156 +0,0 @@
1
- # Alloy samples
2
-
3
- ## Kitchen sink
4
-
5
- See the [KitchenSink-v2 application on GitHub](https://github.com/tidev/kitchensink-v2) for Alloy samples in a full app.
6
-
7
- ## Controller sample
8
-
9
- **index.js**
10
- ```javascript
11
- // These "builtin" requires are detected by alloy compile process
12
- // Automatically included as Resources/alloy/animation.js and Resources/alloy/string.js
13
- const animation = require('alloy/animation');
14
- const string = require('alloy/string');
15
-
16
- function shake(e) {
17
- animation.shake($.mover, 0, () => {
18
- alert("Shake ended.");
19
- });
20
- }
21
-
22
- function flash(e) {
23
- animation.flash($.mover);
24
- }
25
-
26
- function trim(e) {
27
- $.label.text = string.trim($.label.text);
28
- }
29
-
30
- if (OS_IOS) {
31
- function flip(e) {
32
- let front, back;
33
- e.bubbleParent = false;
34
- if (e.source === $.back) {
35
- front = $.back;
36
- back = $.front;
37
- } else {
38
- front = $.front;
39
- back = $.back;
40
- }
41
- animation.flipHorizontal(front, back, 500, (e) => {
42
- Ti.API.info('flipped');
43
- });
44
- }
45
- }
46
-
47
- $.index.open();
48
-
49
- // Runtime unit tests
50
- if (!ENV_PROD) {
51
- require('specs/index')($);
52
- }
53
- ```
54
-
55
- ## Conditional statements in views
56
-
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
-
59
- > **💡 TSS defaults**
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
-
62
- ### Problems with traditional approaches
63
-
64
- **Approach 1: show/hide (in controller)**
65
- ```javascript
66
- if (Alloy.Globals.isLoggedIn()) {
67
- $.loggedIn.show();
68
- $.notLoggedIn.hide();
69
- } else {
70
- $.loggedIn.hide();
71
- $.notLoggedIn.show();
72
- }
73
- ```
74
- **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.
75
-
76
- **Approach 2: setHeight (in controller)**
77
- ```javascript
78
- if (Alloy.Globals.isLoggedIn()) {
79
- $.loggedIn.setHeight(Ti.UI.SIZE);
80
- $.notLoggedIn.setHeight(0);
81
- } else {
82
- $.loggedIn.setHeight(0);
83
- $.notLoggedIn.setHeight(Ti.UI.SIZE);
84
- }
85
- ```
86
- **Problem:** This works, but it forces you to manage height values (`Ti.UI.SIZE`) in JavaScript instead of TSS.
87
-
88
- ### Solution: IF attributes in XML
89
-
90
- Use `if` attributes directly in the XML view. These conditions are evaluated before rendering.
91
-
92
- **index.xml**
93
- ```xml
94
- <Alloy>
95
- <Window>
96
- <View>
97
- <!-- Only one of these will ever be rendered -->
98
- <View if="Alloy.Globals.isLoggedIn()" id="notLoggedIn" class="vertical">
99
- <Label text="Not logged in" />
100
- </View>
101
- <View if="!Alloy.Globals.isLoggedIn()" id="loggedIn" class="vertical">
102
- <Label text="Logged in" />
103
- </View>
104
- </View>
105
- </Window>
106
- </Alloy>
107
- ```
108
-
109
- Benefits:
110
- - Only the view that matches the condition is rendered.
111
- - The UI is correct from the first frame.
112
- - No visibility logic in controllers.
113
-
114
- ### Conditional queries in TSS
115
-
116
- Use `if` attributes in TSS definitions:
117
-
118
- ```tss
119
- "#info[if=Alloy.Globals.isIos7Plus]": {
120
- font: {
121
- textStyle: Ti.UI.TEXT_STYLE_FOOTNOTE
122
- }
123
- },
124
- "#title[if=Alloy.Globals.isIos7Plus]": {
125
- top: "25dp",
126
- font: {
127
- textStyle: Ti.UI.TEXT_STYLE_HEADLINE
128
- }
129
- },
130
- "#content[if=Alloy.Globals.isIos7Plus]": {
131
- font: {
132
- textStyle: Ti.UI.TEXT_STYLE_CAPTION1
133
- }
134
- },
135
- "ScrollView[if=Alloy.Globals.iPhoneTall]": {
136
- height: "500dp"
137
- }
138
- ```
139
-
140
- ### Data-binding with conditional queries
141
-
142
- Define custom methods in models and render based on those methods:
143
-
144
- **Model Method:** `shouldShowCommentRow()` returns `true`
145
-
146
- **XML View:**
147
- ```xml
148
- <Alloy>
149
- <TableViewRow id="commentRow" hasChild="false" if="$model.shouldShowCommentRow()" onClick="onSelectComment">
150
- <Label id="commentPlaceholderLabel" class="commentRowPreviewLabel placeholderLabel" text="Ti.App.L('AddComment')" />
151
- <Label id="commentRowLabel" class="commentRowPreviewLabel" text="{Comment}" />
152
- </TableViewRow>
153
- </Alloy>
154
- ```
155
-
156
- See `VIEWS_STYLES.md` in the `alloy-guides` skill (Custom Query Styles section) for more details.
@@ -1,109 +0,0 @@
1
- ---
2
- name: ti-api
3
- description: "Titanium SDK complete API reference. Use when looking up properties, methods, events, constants, or type signatures for any Ti.* or Modules.* API. Covers Ti.UI, Ti.Android, Ti.App, Ti.Media, Ti.Network, Ti.Database, Ti.Filesystem, Ti.Geolocation, Ti.Contacts, Ti.Calendar, Global, and third-party modules (Map, BLE, NFC, Facebook, Identity, CoreMotion). AUTO-DETECT: If tiapp.xml exists in the project, this is a Titanium project — invoke this skill BEFORE writing any code that uses Ti.* APIs. Do NOT rely on training data for Titanium APIs; always check the reference files in this skill first."
4
- argument-hint: "[Ti.UI.Window | Ti.Network.HTTPClient | Modules.Map.View | ...]"
5
- allowed-tools: Read, Grep, Glob
6
- ---
7
-
8
- # Titanium API Reference
9
-
10
- Quick lookup for properties, methods, events, and constants across all Titanium SDK and module APIs.
11
-
12
- ## How to use this skill
13
-
14
- 1. Identify which namespace the API belongs to
15
- 2. Look up the reference file in the table below
16
- 3. Read the reference file for full property/method/event tables
17
-
18
- ## Namespace Lookup
19
-
20
- | Namespace | Reference File | Contents |
21
- |-----------|---------------|----------|
22
- | Titanium.UI.View, Titanium.UI.Label, Titanium.UI.Button, Titanium.UI.ImageView, ... | [api-ui-views.md](references/api-ui-views.md) | Ti.UI Core Views (13 APIs) |
23
- | Titanium.UI.Window, Titanium.UI.NavigationWindow, Titanium.UI.TabGroup, Titanium.UI.Tab, ... | [api-ui-windows-navigation.md](references/api-ui-windows-navigation.md) | Ti.UI Windows & Navigation (7 APIs) |
24
- | Titanium.UI.TextField, Titanium.UI.TextArea, Titanium.UI.SearchBar, Titanium.UI.AttributedString, ... | [api-ui-text-input.md](references/api-ui-text-input.md) | Ti.UI Text & Input (9 APIs) |
25
- | Titanium.UI.ListView, Titanium.UI.ListItem, Titanium.UI.ListSection, Titanium.UI.ListViewScrollPosition, ... | [api-ui-lists.md](references/api-ui-lists.md) | Ti.UI Lists & Tables (8 APIs) |
26
- | Titanium.UI.Animation, Titanium.UI.Matrix2D, Titanium.UI.Matrix3D, Titanium.UI.WebView, ... | [api-ui-extras.md](references/api-ui-extras.md) | Ti.UI Extras (13 APIs) |
27
- | Titanium.UI.iOS | [api-ui-ios.md](references/api-ui-ios.md) | Ti.UI.iOS (36 APIs) |
28
- | Titanium.UI.iOS | [api-ui-ios-animator.md](references/api-ui-ios-animator.md) | Ti.UI.iOS Animator & Physics (8 APIs) |
29
- | Titanium.UI.Android, Titanium.UI.iPad | [api-ui-android.md](references/api-ui-android.md) | Ti.UI.Android (10 APIs) |
30
- | Titanium.Android, Titanium.Android.ActionBar, Titanium.Android.Activity, Titanium.Android.BigPictureStyle, ... | [api-android.md](references/api-android.md) | Ti.Android (17 APIs) |
31
- | Titanium.App, Titanium.App.Android, Titanium.App.Properties, Titanium.App.iOS, ... | [api-app-platform.md](references/api-app-platform.md) | Ti.App & Ti.Platform (18 APIs) |
32
- | Titanium.Media, Titanium.Media.Android, Titanium.Media.AudioPlayer, Titanium.Media.AudioRecorder, ... | [api-media.md](references/api-media.md) | Ti.Media (9 APIs) |
33
- | Titanium.Database, Titanium.Database.DB, Titanium.Database.ResultSet, Titanium.Filesystem, ... | [api-data-network.md](references/api-data-network.md) | Ti.Network, Ti.Database & Ti.Filesystem (14 APIs) |
34
- | Titanium.Calendar, Titanium.Calendar.Alert, Titanium.Calendar.Attendee, Titanium.Calendar.Calendar, ... | [api-services.md](references/api-services.md) | Ti.Geolocation, Ti.Contacts, Ti.Calendar & Ti.WatchSession (15 APIs) |
35
- | Titanium, Titanium.UI, Titanium.API, Titanium.Accelerometer, ... | [api-core.md](references/api-core.md) | Ti Core (16 APIs) |
36
- | Titanium.XML, Titanium.XML.Attr, Titanium.XML.CDATASection, Titanium.XML.CharacterData, ... | [api-xml-global.md](references/api-xml-global.md) | Ti.XML & Global (25 APIs) |
37
- | Modules.Map, Modules.Map.Annotation, Modules.Map.Camera, Modules.Map.Circle, ... | [api-modules-map.md](references/api-modules-map.md) | Modules: Map (11 APIs) |
38
- | Modules.Applesignin, Modules.Applesignin.LoginButton, Modules.Barcode, Modules.Crypto, ... | [api-modules-social-misc.md](references/api-modules-social-misc.md) | Modules: Facebook, Identity, Crypto & More (16 APIs) |
39
- | Modules.BLE, Modules.BLE.Beacon, Modules.BLE.BeaconIdentityConstraint, Modules.BLE.BeaconRegion, ... | [api-modules-ble-bluetooth.md](references/api-modules-ble-bluetooth.md) | Modules: BLE & Bluetooth (20 APIs) |
40
- | Modules.Nfc, Modules.Nfc.MifareTagTechnology, Modules.Nfc.NativeTagTechnology, Modules.Nfc.NdefMessage, ... | [api-modules-nfc.md](references/api-modules-nfc.md) | Modules: NFC (28 APIs) |
41
- | Modules.CoreMotion, Modules.CoreMotion.Accelerometer, Modules.CoreMotion.Altimeter, Modules.CoreMotion.DeviceMotion, ... | [api-modules-coremotion-urlsession.md](references/api-modules-coremotion-urlsession.md) | Modules: CoreMotion & URLSession (12 APIs) |
42
-
43
- ## Quick lookup by common task
44
-
45
- | Task | API | Reference |
46
- |------|-----|-----------|
47
- | Create a window | Ti.UI.Window | [api-ui-windows-navigation.md](references/api-ui-windows-navigation.md) |
48
- | HTTP request | Ti.Network.HTTPClient | [api-data-network.md](references/api-data-network.md) |
49
- | Show an alert | Ti.UI.AlertDialog | [api-ui-windows-navigation.md](references/api-ui-windows-navigation.md) |
50
- | Play audio | Ti.Media.AudioPlayer | [api-media.md](references/api-media.md) |
51
- | Read a file | Ti.Filesystem.File | [api-data-network.md](references/api-data-network.md) |
52
- | SQLite query | Ti.Database.DB | [api-data-network.md](references/api-data-network.md) |
53
- | GPS location | Ti.Geolocation | [api-services.md](references/api-services.md) |
54
- | Push notification | Ti.App.iOS | [api-app-platform.md](references/api-app-platform.md) |
55
- | ListView | Ti.UI.ListView | [api-ui-lists.md](references/api-ui-lists.md) |
56
- | Camera/gallery | Ti.Media | [api-media.md](references/api-media.md) |
57
- | Map view | Modules.Map.View | [api-modules-map.md](references/api-modules-map.md) |
58
- | BLE scanning | Modules.BLE | [api-modules-ble-bluetooth.md](references/api-modules-ble-bluetooth.md) |
59
- | Animation | Ti.UI.Animation | [api-ui-extras.md](references/api-ui-extras.md) |
60
- | WebView | Ti.UI.WebView | [api-ui-extras.md](references/api-ui-extras.md) |
61
- | Contacts | Ti.Contacts | [api-services.md](references/api-services.md) |
62
-
63
- ## Reading the reference tables
64
-
65
- Each API entry includes:
66
-
67
- - **Summary** — one-line description
68
- - **Extends** — parent type (inherited properties/methods not repeated)
69
- - **Platforms** — `both` (android + ios), `android`, or `ios`
70
- - **Properties table** — unique properties (not inherited), with type, default, platform
71
- - **Methods table** — unique methods with parameters, return type, platform
72
- - **Events table** — unique events with platform and description
73
- - **Related Types** — inline struct definitions used by that API
74
-
75
- ### Property counts
76
-
77
- Tables show `unique: X/Y` where X is properties defined on this class and Y is total including inherited. To see inherited properties, check the parent class.
78
-
79
- ## API coverage
80
-
81
- | Category | APIs | Reference File |
82
- |----------|------|---------------|
83
- | Ti.UI Core Views | 13 | api-ui-views.md |
84
- | Ti.UI Windows & Navigation | 7 | api-ui-windows-navigation.md |
85
- | Ti.UI Text & Input | 9 | api-ui-text-input.md |
86
- | Ti.UI Lists & Tables | 8 | api-ui-lists.md |
87
- | Ti.UI Extras | 13 | api-ui-extras.md |
88
- | Ti.UI.iOS | 36 | api-ui-ios.md |
89
- | Ti.UI.iOS Animator & Physics | 8 | api-ui-ios-animator.md |
90
- | Ti.UI.Android | 10 | api-ui-android.md |
91
- | Ti.Android | 17 | api-android.md |
92
- | Ti.App & Ti.Platform | 18 | api-app-platform.md |
93
- | Ti.Media | 9 | api-media.md |
94
- | Ti.Network, Ti.Database & Ti.Filesystem | 14 | api-data-network.md |
95
- | Ti.Geolocation, Ti.Contacts, Ti.Calendar & Ti.WatchSession | 15 | api-services.md |
96
- | Ti Core | 16 | api-core.md |
97
- | Ti.XML & Global | 25 | api-xml-global.md |
98
- | Modules: Map | 11 | api-modules-map.md |
99
- | Modules: Facebook, Identity, Crypto & More | 16 | api-modules-social-misc.md |
100
- | Modules: BLE & Bluetooth | 20 | api-modules-ble-bluetooth.md |
101
- | Modules: NFC | 28 | api-modules-nfc.md |
102
- | Modules: CoreMotion & URLSession | 12 | api-modules-coremotion-urlsession.md |
103
-
104
- ## Related skills
105
-
106
- - **ti-ui** — UI/UX patterns, layout strategies, performance tips (narrative)
107
- - **ti-expert** — Architecture patterns, memory management, anti-patterns
108
- - **ti-howtos** — Integration guides for push, camera, maps, networking
109
- - **ti-guides** — SDK fundamentals, tiapp.xml, Hyperloop