@maccesar/titools 5.3.0 → 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.
Files changed (98) hide show
  1. package/CONTRIBUTING.md +1 -1
  2. package/README.md +31 -60
  3. package/agents/ti-pro.md +3 -1
  4. package/commands/ti-audit.md +6 -4
  5. package/docs/examples.md +9 -0
  6. package/docs/knowledge-index.md +2 -1
  7. package/lib/config.js +1 -0
  8. package/package.json +1 -1
  9. package/skills/alloy-guides/SKILL.md +18 -179
  10. package/skills/alloy-guides/references/CLI_TASKS.md +17 -216
  11. package/skills/alloy-guides/references/CONCEPTS.md +27 -162
  12. package/skills/alloy-guides/references/CONTROLLERS.md +38 -236
  13. package/skills/alloy-guides/references/MODELS.md +47 -723
  14. package/skills/alloy-guides/references/MODELS_ADVANCED.md +21 -482
  15. package/skills/alloy-guides/references/VIEWS_DYNAMIC.md +12 -222
  16. package/skills/alloy-guides/references/VIEWS_STYLES.md +39 -358
  17. package/skills/alloy-guides/references/VIEWS_XML.md +36 -552
  18. package/skills/alloy-guides/references/WIDGETS.md +49 -127
  19. package/skills/alloy-howtos/SKILL.md +14 -169
  20. package/skills/alloy-howtos/references/best_practices.md +9 -113
  21. package/skills/alloy-howtos/references/cli_reference.md +18 -223
  22. package/skills/alloy-howtos/references/config_files.md +50 -133
  23. package/skills/alloy-howtos/references/debugging_troubleshooting.md +19 -63
  24. package/skills/alloy-howtos/references/samples.md +21 -138
  25. package/skills/ti-api/SKILL.md +10 -2
  26. package/skills/ti-api/references/api-android.md +36 -2
  27. package/skills/ti-api/references/api-app-platform.md +39 -3
  28. package/skills/ti-api/references/api-core.md +50 -18
  29. package/skills/ti-api/references/api-data-network.md +49 -35
  30. package/skills/ti-api/references/api-media.md +45 -27
  31. package/skills/ti-api/references/api-services.md +39 -9
  32. package/skills/ti-api/references/api-ui-android.md +33 -13
  33. package/skills/ti-api/references/api-ui-extras.md +41 -15
  34. package/skills/ti-api/references/api-ui-ios-animator.md +42 -26
  35. package/skills/ti-api/references/api-ui-ios.md +74 -2
  36. package/skills/ti-api/references/api-ui-lists.md +32 -16
  37. package/skills/ti-api/references/api-ui-text-input.md +34 -17
  38. package/skills/ti-api/references/api-ui-views.md +27 -1
  39. package/skills/ti-api/references/api-ui-windows-navigation.md +32 -18
  40. package/skills/ti-api/references/api-xml-global.md +66 -16
  41. package/skills/ti-create-release/SKILL.md +98 -0
  42. package/skills/ti-create-release/references/module-discovery.md +69 -0
  43. package/skills/ti-expert/references/adaptive-layouts.md +1 -1
  44. package/skills/ti-guides/SKILL.md +37 -76
  45. package/skills/ti-guides/references/advanced-data-and-images.md +122 -126
  46. package/skills/ti-guides/references/android-manifest.md +24 -83
  47. package/skills/ti-guides/references/app-distribution.md +31 -377
  48. package/skills/ti-guides/references/application-frameworks.md +127 -335
  49. package/skills/ti-guides/references/cli-reference.md +184 -633
  50. package/skills/ti-guides/references/commonjs-advanced.md +81 -231
  51. package/skills/ti-guides/references/compatibility-matrix.md +36 -75
  52. package/skills/ti-guides/references/hello-world.md +95 -70
  53. package/skills/ti-guides/references/hyperloop-native-access.md +52 -448
  54. package/skills/ti-guides/references/resources.md +174 -142
  55. package/skills/ti-guides/references/sdk-release-notes.md +28 -71
  56. package/skills/ti-guides/references/tiapp-config.md +222 -598
  57. package/skills/ti-howtos/SKILL.md +23 -123
  58. package/skills/ti-howtos/references/cross-platform-development.md +119 -324
  59. package/skills/ti-howtos/references/debugging-profiling.md +77 -445
  60. package/skills/ti-howtos/references/extending-titanium.md +199 -673
  61. package/skills/ti-howtos/references/local-data-sources.md +87 -300
  62. package/skills/ti-howtos/references/location-and-maps.md +86 -213
  63. package/skills/ti-howtos/references/media-apis.md +103 -223
  64. package/skills/ti-howtos/references/notification-services.md +86 -506
  65. package/skills/ti-howtos/references/remote-data-sources.md +97 -316
  66. package/skills/ti-howtos/references/using-modules.md +77 -133
  67. package/skills/ti-ui/SKILL.md +28 -143
  68. package/skills/ti-ui/references/icons-and-splash-screens.md +74 -403
  69. package/skills/ti-ui/references/layouts-and-positioning.md +175 -402
  70. package/skills/ti-ui/references/listviews-and-performance.md +100 -703
  71. package/skills/ti-ui/references/platform-conventions.md +180 -0
  72. package/skills/ti-ui/references/user-interface.md +43 -0
  73. package/skills/alloy-guides/references/VIEWS_WITHOUT_CONTROLLERS.md +0 -102
  74. package/skills/alloy-howtos/references/custom_tags.md +0 -148
  75. package/skills/ti-guides/references/coding-best-practices.md +0 -149
  76. package/skills/ti-guides/references/javascript-primer.md +0 -414
  77. package/skills/ti-guides/references/reserved-words.md +0 -36
  78. package/skills/ti-guides/references/style-and-conventions.md +0 -103
  79. package/skills/ti-howtos/references/android-platform-deep-dives.md +0 -624
  80. package/skills/ti-howtos/references/automation-fastlane-appium.md +0 -96
  81. package/skills/ti-howtos/references/buffer-codec-streams.md +0 -162
  82. package/skills/ti-howtos/references/google-maps-v2.md +0 -172
  83. package/skills/ti-howtos/references/ios-map-kit.md +0 -149
  84. package/skills/ti-howtos/references/ios-platform-deep-dives.md +0 -611
  85. package/skills/ti-howtos/references/tutorials.md +0 -565
  86. package/skills/ti-howtos/references/web-content-integration.md +0 -287
  87. package/skills/ti-howtos/references/webpack-build-pipeline.md +0 -124
  88. package/skills/ti-ui/references/accessibility-deep-dive.md +0 -288
  89. package/skills/ti-ui/references/animation-and-matrices.md +0 -569
  90. package/skills/ti-ui/references/application-structures.md +0 -626
  91. package/skills/ti-ui/references/custom-fonts-styling.md +0 -549
  92. package/skills/ti-ui/references/event-handling.md +0 -401
  93. package/skills/ti-ui/references/gestures.md +0 -448
  94. package/skills/ti-ui/references/orientation.md +0 -374
  95. package/skills/ti-ui/references/platform-ui-android.md +0 -727
  96. package/skills/ti-ui/references/platform-ui-ios.md +0 -576
  97. package/skills/ti-ui/references/scrolling-views.md +0 -288
  98. package/skills/ti-ui/references/tableviews.md +0 -542
@@ -1,99 +1,124 @@
1
- # Hello world: project creation
1
+ # Hello world: setup, project creation and first run
2
2
 
3
- Quick guide to creating your first Titanium project.
3
+ ## Prepare the toolchain
4
4
 
5
- ## Creating a new project
5
+ Android builds work on macOS, Windows and Linux; iOS and Catalyst require macOS with Xcode. See [compatibility](compatibility-matrix.md) for the released SDK 13.4.1 baseline. The current CLI requires Node 22.19+ or 24; Node 24 avoids the SDK's Node 26 native-binding problem. Install Node with a version manager or an official installer, reopen the shell, and verify `node -v`. On Homebrew `node@24` is keg-only: add its `bin` directory to PATH. Windows LTS installers follow the current LTS, so check the installed version.
6
6
 
7
- ### Using CLI
7
+ Install a JDK, for example Temurin 21, and set `JAVA_HOME` to its installation directory. On macOS `/usr/libexec/java_home -v 21` locates it; on Linux derive it from the resolved `javac` executable; on Windows set a user environment variable and reopen PowerShell. Verify both `javac -version` and the `javac` under `JAVA_HOME`; a shell and Gradle can otherwise use different JDKs.
8
8
 
9
- ```bash
10
- ti create -t app --id <APP_ID> -n <APP_NAME> -p <PLATFORMS> -d <WORKSPACE>
9
+ ```sh
10
+ npm install -g titanium
11
+ ti -v
12
+ ti sdk install 13.4.1.GA
13
+ ti sdk list
11
14
  ```
12
15
 
13
- Example:
14
- ```bash
15
- ti create -t app --id com.example.hello -n HelloWorld -p android,ios -d ~/Projects
16
+ `titanium` and `ti` are the same command. `pnpm add -g titanium` is an alternative. Use a writable Node/npm installation or the appropriate permissions for its global directory. No SDK version installs the newest stable; an explicit version makes this walkthrough reproducible.
17
+
18
+ Install Android SDK Platform 36, Build Tools 35.0.0, Platform Tools and Emulator through Android Studio's SDK Manager or command-line tools. Extract command-line tools to `<sdk>/cmdline-tools/latest`, not directly into the SDK root:
19
+
20
+ ```sh
21
+ sdkmanager "platforms;android-36" "build-tools;35.0.0" "platform-tools" "emulator"
22
+ ti setup android
16
23
  ```
17
24
 
18
- ### Using VS Code
25
+ The wizard records `android.sdkPath`. `ANDROID_SDK_ROOT` or `ANDROID_SDK` also work; `ANDROID_HOME` alone is not read by the app builder. Conventional SDK locations are `~/Library/Android/sdk` on macOS, `~/Android/Sdk` on Linux and `%LOCALAPPDATA%\Android\Sdk` on Windows. Keep SDK paths free of spaces/ampersands on Windows and writable by your user on Linux. Pin newer Build Tools with `ti config android.buildTools.selectedVersion 35.0.0` if an unsupported version causes failures.
19
26
 
20
- VS Code with the Titanium extension supports project creation via the command palette. The CLI is the most reliable method and works in any editor.
27
+ Create an emulator through Android Studio Device Manager or `avdmanager`. Apple silicon uses an `arm64-v8a` image; Linux needs KVM and membership of its group (log out/in after changing it); Windows needs supported hardware acceleration such as Windows Hypervisor Platform. Physical Android devices need USB debugging/authorization, a vendor driver on Windows and suitable udev rules on Linux. A CPU virtualization flag alone does not prove working KVM access; check `/dev/kvm` permissions.
21
28
 
22
- ## Project fields
29
+ For iOS install a supported Xcode, open it once to complete setup, install command-line tools, and select the intended installation:
23
30
 
24
- | Field | Description | Rules |
25
- | ------------------ | ----------------------- | -------------------------- |
26
- | Project name | App name shown to users | - |
27
- | App ID | Reverse domain notation | `com.company.appname` |
28
- | Company URL | Your website | - |
29
- | SDK Version | Titanium SDK to use | Use latest |
30
- | Deployment Targets | Platforms to support | android, ios, ipad, iphone |
31
+ ```sh
32
+ xcode-select --install
33
+ sudo xcode-select -s /Applications/Xcode.app
34
+ xcode-select -p
35
+ ```
31
36
 
32
- ### App ID naming guidelines
37
+ Install additional runtimes through Xcode Settings → Components. SDK 13.4.1 needs iOS 15+ devices/runtimes. Development devices need an Apple Development certificate plus a matching provisioning profile: add your Apple ID in Xcode Settings → Accounts, create the certificate in Manage Certificates, connect/register the device, and let Xcode create a profile. The private key must be in the keychain, not just a downloaded certificate. Distribution needs a paid account; simulator builds do not need signing.
33
38
 
34
- - Use Java package style: `com.yourdomain.yourappname`
35
- - No spaces or special characters
36
- - All lowercase (Android issues with uppercase)
37
- - No Java keywords (`case`, `package`, etc.)
38
- - Cannot change after publishing
39
- - On iOS, the App ID must match the Bundle Identifier. On Android, it becomes the Application Package Name.
39
+ Run `ti info` and fix actual errors before creating a project. `ti info -t ios` or `-t android` narrows detection. Newer-tool and unused-NDK warnings can be harmless. If `ti` is missing, reopen the terminal and check npm's global prefix is on PATH. Antivirus file locking on Windows may require excluding generated `build/`; do not disable protection for the whole machine.
40
40
 
41
- ## Project structure
41
+ ## Create Classic or Alloy
42
42
 
43
- ```
44
- MyApp/
45
- ├── app/ # Alloy app source
46
- │ ├── assets/ # Images, fonts
47
- │ ├── controllers/ # JS controllers
48
- │ ├── models/ # Backbone models
49
- │ ├── views/ # XML views
50
- │ └── styles/ # TSS styles
51
- ├── platform/ # Platform-specific files
52
- │ ├── android/
53
- │ └── ios/
54
- ├── Resources/ # Code files and graphics with platform-specific subdirectories
55
- │ ├── android/ # Android-specific assets
56
- │ └── iphone/ # iOS-specific assets
57
- ├── i18n/ # Internationalization
58
- ├── tiapp.xml # App configuration
59
- ├── config.json # Alloy config
60
- └── app.js # Bootstrap file loaded first when app launches
61
- ```
43
+ Classic uses JavaScript directly. Alloy adds XML views, TSS styles, controllers, models and reusable widgets; it compiles to the same runtime API. Choose Alloy for a growing app and Classic for a small tool or prototype.
62
44
 
63
- ## Running your app
45
+ ```sh
46
+ # Classic
47
+ ti create --type app --name Hello --id com.example.hello --platforms android,ios --workspace-dir .
64
48
 
65
- ### iOS simulator
66
- ```bash
67
- ti build -p ios -C "iPhone 15"
49
+ # Alloy: install once, then create
50
+ npm install -g alloy
51
+ ti create --type app --alloy --name Hello --id com.example.hello --platforms android,ios --workspace-dir .
68
52
  ```
69
53
 
70
- ### Android emulator
71
- ```bash
72
- ti build -p android -C "Pixel_4_API_34"
54
+ `--alloy` runs `alloy new` after creation and requires Alloy on PATH; without it the created project remains Classic. Existing Classic projects can be converted with `alloy new` after backing up source. Interactive creation prompts for values. In scripts add `--no-prompt` and explicitly provide `--type` and `--workspace-dir`.
55
+
56
+ Use a lower-case reverse-DNS app ID whose domain you control; it becomes the Android package and iOS bundle identifier. Avoid spaces, special characters and Java keywords. Changing it after publication creates a new listing. `--name` sets the project directory and display name. `--platforms ios` targets iPhone and iPad; `iphone` targets iPhone only. Pin `<sdk-version>13.4.1.GA</sdk-version>` in `tiapp.xml`; `--sdk` overrides it for one build.
57
+
58
+ ## Source and generated files
59
+
60
+ | Purpose | Classic | Alloy |
61
+ | --- | --- | --- |
62
+ | Entry source | `Resources/app.js` | `app/alloy.js` for bootstrap; `app/controllers/index.js` for first controller |
63
+ | UI | JavaScript in `Resources/` | `app/views/`, `app/styles/`, `app/controllers/` |
64
+ | Libraries | `Resources/` CommonJS modules | `app/lib/` |
65
+ | Assets | `Resources/`, platform subdirectories | `app/assets/`, platform subdirectories |
66
+ | Native platform files | `platform/android/`, `platform/ios/` | `app/platform/android/`, `app/platform/ios/` |
67
+ | Alloy settings | Not applicable | `app/config.json` |
68
+
69
+ `tiapp.xml`, `i18n/`, `modules/`, `plugins/` and `hooks/` live at the project root. Alloy generates `Resources/`; editing that output is lost on the next compilation. `build/` is generated for both. Commit source and reproducible dependency declarations, not generated output or signing credentials. Asset paths are runtime-relative: `app/assets/images/logo.png` becomes `images/logo.png`.
70
+
71
+ ## Run and change the app
72
+
73
+ ```sh
74
+ cd Hello
75
+ ti build --platform android
76
+ ti build --platform ios
73
77
  ```
74
78
 
75
- ### Physical device
76
- ```bash
77
- ti build -p ios -T device
78
- ti build -p android -T device
79
+ Defaults are Android emulator and iOS simulator. Multiple targets prompt for selection; get IDs from `ti info` and pass `--device-id`. `--build-only` compiles without installing/launching; `--liveview` reloads changes on save; Ctrl-C stops the command/log session. First builds are slower because subsequent builds reuse generated work.
80
+
81
+ For Classic put this in `Resources/app.js`:
82
+
83
+ ```javascript
84
+ const win = Ti.UI.createWindow({ backgroundColor: 'white' });
85
+ const label = Ti.UI.createLabel({ text: 'Tap the button', top: 80 });
86
+ const button = Ti.UI.createButton({ title: 'Say hello', top: 140 });
87
+ button.addEventListener('click', () => {
88
+ label.text = 'Hello from Titanium';
89
+ });
90
+ win.add(label);
91
+ win.add(button);
92
+ win.open();
79
93
  ```
80
94
 
81
- ## Simulator vs emulator
95
+ For Alloy use a named root window so the controller route is explicit:
82
96
 
83
- - iOS simulator: simulates the environment within an iOS device. It is a macOS executable that runs your cross-compiled code.
84
- - Android emulator: provides a virtual hardware environment that runs the Android OS and platform components.
97
+ ```xml
98
+ <Alloy>
99
+ <Window id="index" backgroundColor="white">
100
+ <Label id="label" top="80">Tap the button</Label>
101
+ <Button top="140" onClick="sayHello">Say hello</Button>
102
+ </Window>
103
+ </Alloy>
104
+ ```
105
+
106
+ ```javascript
107
+ function sayHello() {
108
+ $.label.text = 'Hello from Titanium';
109
+ }
110
+ $.index.open();
111
+ ```
85
112
 
86
- Neither environment is a perfect representation of a physical device. Always test on real hardware before publishing.
113
+ A view `id` becomes `$.id` in the controller and `#id` in TSS. Template semantic colors come from `Resources/semantic.colors.json` or `app/assets/semantic.colors.json`; they resolve differently in light/dark mode, unlike arbitrary color names.
87
114
 
88
- ## How Titanium works (under the covers)
115
+ ## Real devices and distribution
89
116
 
90
- 1. Pre-compile: JavaScript is minified and statically analyzed to build a dependency hierarchy of Titanium APIs used.
91
- 2. Stub generation: a front-end compiler creates native stub files, native project files, and platform-specific code needed for compilation.
92
- 3. Native build: Titanium calls platform-specific compilers (for example, `xcodebuild` for iOS and Gradle for Android) to build the native app.
93
- 4. Encryption: JavaScript code is encrypted when building for production (release) or for device. Original code is not retrievable in human-readable form.
117
+ ```sh
118
+ ti build -p android -T device --device-id <android-id>
119
+ ti build -p ios -T device --device-id <ios-udid>
120
+ ```
94
121
 
95
- ## Best practices
122
+ Android: enable Developer options (usually tap Build number seven times), enable USB debugging, connect and accept authorization. Debug signing is generated automatically. iOS: unlock the phone, trust the computer, and use a profile/certificate matching the app ID and device; selection prompts if several match. Free provisioning expires quickly (typically seven days), paid profiles commonly last a year; inspect the actual profile expiry. Simulators/emulators do not reproduce camera, GPS, notifications, hardware or real network conditions. Test physical hardware before release.
96
123
 
97
- 1. Test on physical devices. The simulator/emulator is not a perfect proxy.
98
- 2. Use Alloy for new projects for better structure and maintainability.
99
- 3. Keep the App ID consistent. Match Bundle ID (iOS) and Package ID (Android).
124
+ Titanium analyzes/transpiles JavaScript, generates native projects, then invokes Gradle or `xcodebuild`. It still executes JavaScript through a runtime; it does not translate every JavaScript statement to native machine code. Test/production JavaScript encryption raises the cost of inspection and does not protect secrets. See [distribution](app-distribution.md), [frameworks](application-frameworks.md), and [official first app](https://titaniumsdk.com/docs/build/first-app.md).