@maccesar/titools 2.2.11 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +255 -713
- package/bin/titools.js +1 -1
- package/lib/commands/update.js +5 -6
- package/lib/config.js +1 -0
- package/lib/downloader.js +10 -0
- package/package.json +1 -1
- package/skills/alloy-guides/SKILL.md +46 -48
- package/skills/alloy-guides/references/CONTROLLERS.md +4 -6
- package/skills/alloy-guides/references/MODELS.md +340 -184
- package/skills/alloy-guides/references/VIEWS_DYNAMIC.md +3 -4
- package/skills/alloy-guides/references/VIEWS_STYLES.md +44 -46
- package/skills/alloy-guides/references/VIEWS_WITHOUT_CONTROLLERS.md +4 -5
- package/skills/alloy-guides/references/VIEWS_XML.md +51 -17
- package/skills/alloy-guides/references/WIDGETS.md +1 -1
- package/skills/alloy-howtos/SKILL.md +12 -13
- package/skills/alloy-howtos/references/cli_reference.md +40 -41
- package/skills/alloy-howtos/references/samples.md +3 -4
- package/skills/purgetss/SKILL.md +369 -356
- package/skills/purgetss/references/EXAMPLES.md +24 -25
- package/skills/purgetss/references/animation-advanced.md +555 -0
- package/skills/purgetss/references/animation-system.md +395 -995
- package/skills/purgetss/references/apply-directive.md +111 -141
- package/skills/purgetss/references/arbitrary-values.md +206 -480
- package/skills/purgetss/references/class-categories.md +277 -0
- package/skills/purgetss/references/class-index.md +1 -420
- package/skills/purgetss/references/cli-commands.md +446 -556
- package/skills/purgetss/references/configurable-properties.md +163 -599
- package/skills/purgetss/references/custom-rules.md +33 -76
- package/skills/purgetss/references/customization-deep-dive.md +319 -518
- package/skills/purgetss/references/dynamic-component-creation.md +33 -37
- package/skills/purgetss/references/grid-layout.md +42 -371
- package/skills/purgetss/references/icon-fonts.md +82 -475
- package/skills/purgetss/references/installation-setup.md +159 -331
- package/skills/purgetss/references/migration-guide.md +54 -109
- package/skills/purgetss/references/opacity-modifier.md +25 -222
- package/skills/purgetss/references/performance-tips.md +2 -2
- package/skills/purgetss/references/platform-modifiers.md +21 -407
- package/skills/purgetss/references/tikit-components.md +237 -104
- package/skills/purgetss/references/titanium-resets.md +20 -21
- package/skills/purgetss/references/ui-ux-design.md +171 -1702
- package/skills/ti-api/SKILL.md +109 -0
- package/skills/ti-api/references/api-android.md +675 -0
- package/skills/ti-api/references/api-app-platform.md +636 -0
- package/skills/ti-api/references/api-core.md +764 -0
- package/skills/ti-api/references/api-data-network.md +641 -0
- package/skills/ti-api/references/api-media.md +655 -0
- package/skills/ti-api/references/api-modules-ble-bluetooth.md +657 -0
- package/skills/ti-api/references/api-modules-coremotion-urlsession.md +411 -0
- package/skills/ti-api/references/api-modules-map.md +632 -0
- package/skills/ti-api/references/api-modules-nfc.md +725 -0
- package/skills/ti-api/references/api-modules-social-misc.md +526 -0
- package/skills/ti-api/references/api-services.md +700 -0
- package/skills/ti-api/references/api-ui-android.md +499 -0
- package/skills/ti-api/references/api-ui-extras.md +702 -0
- package/skills/ti-api/references/api-ui-ios-animator.md +378 -0
- package/skills/ti-api/references/api-ui-ios.md +756 -0
- package/skills/ti-api/references/api-ui-lists.md +581 -0
- package/skills/ti-api/references/api-ui-text-input.md +607 -0
- package/skills/ti-api/references/api-ui-views.md +572 -0
- package/skills/ti-api/references/api-ui-windows-navigation.md +676 -0
- package/skills/ti-api/references/api-xml-global.md +743 -0
- package/skills/ti-expert/SKILL.md +106 -138
- package/skills/ti-expert/references/adaptive-layouts.md +414 -0
- package/skills/ti-expert/references/alloy-builtins.md +16 -20
- package/skills/ti-expert/references/alloy-structure.md +40 -42
- package/skills/ti-expert/references/anti-patterns.md +34 -0
- package/skills/ti-expert/references/architecture-tiers.md +248 -0
- package/skills/ti-expert/references/code-conventions.md +5 -3
- package/skills/ti-expert/references/error-handling.md +14 -7
- package/skills/ti-expert/references/examples.md +4 -2
- package/skills/ti-expert/references/performance-optimization.md +26 -24
- package/skills/ti-expert/references/security-device.md +17 -14
- package/skills/ti-expert/references/security-fundamentals.md +60 -101
- package/skills/ti-expert/references/state-management.md +15 -14
- package/skills/ti-expert/references/testing-e2e-ci.md +30 -21
- package/skills/ti-expert/references/theming.md +12 -20
- package/skills/ti-guides/SKILL.md +13 -17
- package/skills/ti-guides/references/advanced-data-and-images.md +30 -10
- package/skills/ti-guides/references/application-frameworks.md +3 -3
- package/skills/ti-guides/references/coding-best-practices.md +31 -2
- package/skills/ti-guides/references/commonjs-advanced.md +46 -4
- package/skills/ti-guides/references/hello-world.md +9 -13
- package/skills/ti-guides/references/hyperloop-native-access.md +4 -1
- package/skills/ti-guides/references/javascript-primer.md +13 -5
- package/skills/ti-guides/references/resources.md +0 -2
- package/skills/ti-guides/references/style-and-conventions.md +1 -0
- package/skills/ti-guides/references/tiapp-config.md +0 -32
- package/skills/ti-howtos/SKILL.md +43 -45
- package/skills/ti-howtos/references/buffer-codec-streams.md +25 -3
- package/skills/ti-howtos/references/debugging-profiling.md +14 -25
- package/skills/ti-howtos/references/google-maps-v2.md +3 -3
- package/skills/ti-howtos/references/ios-map-kit.md +8 -1
- package/skills/ti-howtos/references/notification-services.md +0 -1
- package/skills/ti-howtos/references/webpack-build-pipeline.md +3 -0
- package/skills/ti-ui/SKILL.md +47 -49
- package/skills/ti-ui/references/application-structures.md +3 -2
- package/skills/ti-ui/references/orientation.md +17 -9
- package/skills/ti-ui/references/platform-ui-ios.md +63 -0
- package/skills/ti-ui/references/scrolling-views.md +39 -0
package/bin/titools.js
CHANGED
|
@@ -40,7 +40,7 @@ program
|
|
|
40
40
|
// Update command
|
|
41
41
|
program
|
|
42
42
|
.command('update')
|
|
43
|
-
.description('
|
|
43
|
+
.description('Check for newer CLI versions, then sync installed knowledge packages and agent')
|
|
44
44
|
.option('-l, --local', 'Update local skills in the current project')
|
|
45
45
|
.action(updateCommand);
|
|
46
46
|
|
package/lib/commands/update.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Update command
|
|
3
|
-
*
|
|
3
|
+
* Checks for a newer CLI version, then syncs skills and docs from the installed package
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import chalk from 'chalk';
|
|
@@ -105,7 +105,6 @@ export async function updateCommand(options) {
|
|
|
105
105
|
if (!options.local) {
|
|
106
106
|
const projectDir = process.cwd();
|
|
107
107
|
const isProject = isTitaniumProject(projectDir);
|
|
108
|
-
const localPlatforms = detectPlatforms(projectDir);
|
|
109
108
|
const hasLocalSkills = isProject && hasSkillsAt(projectDir);
|
|
110
109
|
const hasGlobalSkills = hasSkillsAt(undefined);
|
|
111
110
|
|
|
@@ -177,7 +176,7 @@ export async function updateCommand(options) {
|
|
|
177
176
|
try {
|
|
178
177
|
const hasUpdate = await checkForUpdate(PACKAGE_VERSION);
|
|
179
178
|
|
|
180
|
-
// If there's a newer version on npm,
|
|
179
|
+
// If there's a newer version on npm, instruct the user to update the CLI first
|
|
181
180
|
if (hasUpdate) {
|
|
182
181
|
let latestVersion = '(newer)';
|
|
183
182
|
try {
|
|
@@ -188,14 +187,14 @@ export async function updateCommand(options) {
|
|
|
188
187
|
|
|
189
188
|
spinner.warn('New version available');
|
|
190
189
|
console.log('');
|
|
191
|
-
console.log(chalk.yellow('A newer version is available on npm:'));
|
|
190
|
+
console.log(chalk.yellow('A newer version of titools is available on npm:'));
|
|
192
191
|
console.log(` Current: ${chalk.gray('v' + PACKAGE_VERSION)}`);
|
|
193
192
|
console.log(` Latest: ${chalk.green(latestVersion)}`);
|
|
194
193
|
console.log('');
|
|
195
|
-
console.log('
|
|
194
|
+
console.log('Update the CLI with:');
|
|
196
195
|
console.log(` ${chalk.cyan('npm update -g @maccesar/titools')}`);
|
|
197
196
|
console.log('');
|
|
198
|
-
console.log('
|
|
197
|
+
console.log('After updating, run this command again:');
|
|
199
198
|
console.log(` ${chalk.cyan('titools update')}`);
|
|
200
199
|
console.log('');
|
|
201
200
|
return;
|
package/lib/config.js
CHANGED
package/lib/downloader.js
CHANGED
|
@@ -11,6 +11,11 @@ import { unlink } from 'fs/promises';
|
|
|
11
11
|
import { extract } from 'tar';
|
|
12
12
|
import { REPO_API_URL, REPO_RAW_URL, GITHUB_API_HEADERS } from './config.js';
|
|
13
13
|
|
|
14
|
+
function getTestLatestNpmVersion() {
|
|
15
|
+
const value = process.env.TITOOLS_TEST_NPM_LATEST_VERSION;
|
|
16
|
+
return value && value.trim() ? value.trim() : null;
|
|
17
|
+
}
|
|
18
|
+
|
|
14
19
|
/**
|
|
15
20
|
* Fetch latest release info from GitHub API
|
|
16
21
|
* @returns {Promise<Object>} Release information
|
|
@@ -116,6 +121,11 @@ export async function downloadRawFile(filePath, destPath, ref = 'main') {
|
|
|
116
121
|
* @returns {Promise<string>} Latest version number
|
|
117
122
|
*/
|
|
118
123
|
export async function fetchLatestNpmVersion() {
|
|
124
|
+
const testVersion = getTestLatestNpmVersion();
|
|
125
|
+
if (testVersion) {
|
|
126
|
+
return testVersion;
|
|
127
|
+
}
|
|
128
|
+
|
|
119
129
|
const response = await fetch('https://registry.npmjs.org/@maccesar/titools');
|
|
120
130
|
|
|
121
131
|
if (!response.ok) {
|
package/package.json
CHANGED
|
@@ -11,20 +11,19 @@ Reference for building Titanium mobile applications with the Alloy MVC framework
|
|
|
11
11
|
|
|
12
12
|
## Project detection
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
This skill automatically detects Alloy projects when invoked and provides framework-specific guidance.
|
|
16
|
-
|
|
17
|
-
**Detection occurs automatically** - no manual command needed.
|
|
18
|
-
|
|
19
|
-
**Alloy project indicators:**
|
|
20
|
-
- `app/` folder (MVC structure)
|
|
21
|
-
- `app/views/`, `app/controllers/` folders
|
|
22
|
-
- `app/models/` folder
|
|
23
|
-
|
|
24
|
-
**Behavior based on detection:**
|
|
25
|
-
- **Alloy detected** → Provides Alloy MVC documentation, Backbone.js patterns, TSS styling, widgets
|
|
26
|
-
- **Not detected** → Indicates this skill is for Alloy projects only, does not suggest Alloy-specific features
|
|
27
|
-
:::
|
|
14
|
+
> **️ℹ️ AUTO-DETECTS ALLOY PROJECTS**
|
|
15
|
+
> This skill automatically detects Alloy projects when invoked and provides framework-specific guidance.
|
|
16
|
+
>
|
|
17
|
+
> **Detection occurs automatically** - no manual command needed.
|
|
18
|
+
>
|
|
19
|
+
> **Alloy project indicators:**
|
|
20
|
+
> - `app/` folder (MVC structure)
|
|
21
|
+
> - `app/views/`, `app/controllers/` folders
|
|
22
|
+
> - `app/models/` folder
|
|
23
|
+
>
|
|
24
|
+
> **Behavior based on detection:**
|
|
25
|
+
> - **Alloy detected** → Provides Alloy MVC documentation, Backbone.js patterns, TSS styling, widgets
|
|
26
|
+
> - **Not detected** → Indicates this skill is for Alloy projects only, does not suggest Alloy-specific features
|
|
28
27
|
|
|
29
28
|
## Quick reference
|
|
30
29
|
|
|
@@ -102,40 +101,39 @@ $.index.open();
|
|
|
102
101
|
|
|
103
102
|
### Platform-specific properties in TSS
|
|
104
103
|
|
|
105
|
-
|
|
106
|
-
Using `Ti.UI.iOS.*` or `Ti.UI.Android.*` properties in TSS without platform modifiers causes cross-platform compilation failures.
|
|
107
|
-
|
|
108
|
-
Example of the failure:
|
|
109
|
-
```tss
|
|
110
|
-
// WRONG - Adds Ti.UI.iOS to Android project
|
|
111
|
-
"#mainWindow": {
|
|
112
|
-
|
|
113
|
-
}
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
Correct approach - use platform modifiers:
|
|
117
|
-
```tss
|
|
118
|
-
// CORRECT - Only adds to iOS
|
|
119
|
-
"#mainWindow[platform=ios]": {
|
|
120
|
-
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
// CORRECT - Only adds to Android
|
|
124
|
-
"#mainWindow[platform=android]": {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
}
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
Properties that always require platform modifiers:
|
|
132
|
-
- iOS: `statusBarStyle`, `modalStyle`, `modalTransitionStyle`, any `Ti.UI.iOS.*`
|
|
133
|
-
- Android: `actionBar` config, any `Ti.UI.Android.*` constant
|
|
134
|
-
|
|
135
|
-
**Available modifiers:** `[platform=ios]`, `[platform=android]`, `[formFactor=handheld]`, `[formFactor=tablet]`, `[if=Alloy.Globals.customVar]`
|
|
136
|
-
|
|
137
|
-
For more platform-specific patterns, see [Code conventions (ti-expert)](skills/ti-expert/references/code-conventions.md#platform--device-modifiers) or [Platform UI guides (ti-ui)](skills/ti-ui/references/platform-ui-ios.md).
|
|
138
|
-
:::
|
|
104
|
+
> **🚨 CRITICAL: Platform-specific properties require modifiers**
|
|
105
|
+
> Using `Ti.UI.iOS.*` or `Ti.UI.Android.*` properties in TSS without platform modifiers causes cross-platform compilation failures.
|
|
106
|
+
>
|
|
107
|
+
> Example of the failure:
|
|
108
|
+
> ```tss
|
|
109
|
+
> // WRONG - Adds Ti.UI.iOS to Android project
|
|
110
|
+
> "#mainWindow": {
|
|
111
|
+
> statusBarStyle: Ti.UI.iOS.StatusBar.LIGHT_CONTENT // FAILS on Android!
|
|
112
|
+
> }
|
|
113
|
+
> ```
|
|
114
|
+
>
|
|
115
|
+
> Correct approach - use platform modifiers:
|
|
116
|
+
> ```tss
|
|
117
|
+
> // CORRECT - Only adds to iOS
|
|
118
|
+
> "#mainWindow[platform=ios]": {
|
|
119
|
+
> statusBarStyle: Ti.UI.iOS.StatusBar.LIGHT_CONTENT
|
|
120
|
+
> }
|
|
121
|
+
>
|
|
122
|
+
> // CORRECT - Only adds to Android
|
|
123
|
+
> "#mainWindow[platform=android]": {
|
|
124
|
+
> actionBar: {
|
|
125
|
+
> displayHomeAsUp: true
|
|
126
|
+
> }
|
|
127
|
+
> }
|
|
128
|
+
> ```
|
|
129
|
+
>
|
|
130
|
+
> Properties that always require platform modifiers:
|
|
131
|
+
> - iOS: `statusBarStyle`, `modalStyle`, `modalTransitionStyle`, any `Ti.UI.iOS.*`
|
|
132
|
+
> - Android: `actionBar` config, any `Ti.UI.Android.*` constant
|
|
133
|
+
>
|
|
134
|
+
> **Available modifiers:** `[platform=ios]`, `[platform=android]`, `[formFactor=handheld]`, `[formFactor=tablet]`, `[if=Alloy.Globals.customVar]`
|
|
135
|
+
>
|
|
136
|
+
> For more platform-specific patterns, see [Code conventions (ti-expert)](skills/ti-expert/references/code-conventions.md#platform--device-modifiers) or [Platform UI guides (ti-ui)](skills/ti-ui/references/platform-ui-ios.md).
|
|
139
137
|
|
|
140
138
|
## Common patterns
|
|
141
139
|
|
|
@@ -116,15 +116,14 @@ The following are the constants defined by Alloy for use in the controller code:
|
|
|
116
116
|
* `ENV_TEST` : true if the current compiler target is built for testing on a device
|
|
117
117
|
* `ENV_PRODUCTION` : true if the current compiler target is built for production (running after a packaged installation)
|
|
118
118
|
* `DIST_ADHOC` (since Alloy 1.4.0) : true if the current compiler target is built for iOS Ad Hoc distribution, for example, if you set the `-T dist-adhoc` option when building with the Titanium CLI. Note that `ENV_PRODUCTION` will be true too since this deployment is only for production builds.
|
|
119
|
-
* `DIST_STORE` (since Alloy 1.4.0) : true if the current compiler target is built for deployment to the Google Play Store or iTunes App Store, for example, if you set the `-T dist-
|
|
119
|
+
* `DIST_STORE` (since Alloy 1.4.0) : true if the current compiler target is built for deployment to the Google Play Store or iTunes App Store, for example, if you set the `-T dist-store` option when building with the Titanium CLI. Note that `ENV_PRODUCTION` will be true too since this deployment is only for production builds.
|
|
120
120
|
|
|
121
121
|
For example, since iOS devices do not include a back button, the application can conditionally add one to a window controller:
|
|
122
122
|
|
|
123
123
|
```javascript
|
|
124
124
|
if (OS_IOS) {
|
|
125
125
|
const closeButton = Ti.UI.createButton({
|
|
126
|
-
title: 'Close'
|
|
127
|
-
style: Ti.UI.iPhone.SystemButtonStyle.PLAIN
|
|
126
|
+
title: 'Close'
|
|
128
127
|
});
|
|
129
128
|
|
|
130
129
|
closeButton.addEventListener('click', () => {
|
|
@@ -223,9 +222,8 @@ const lib = require('library_name');
|
|
|
223
222
|
lib.foo();
|
|
224
223
|
```
|
|
225
224
|
|
|
226
|
-
|
|
227
|
-
Titanium and Alloy do not support the Node.js concept of "folders as modules". That is, requiring a folder name does not automatically load the `index.js` or `index.json` file inside the folder, or use the `package.json` file to locate the main entry point. You need to explicitly require the file that serves as the main entry point to the library.
|
|
228
|
-
:::
|
|
225
|
+
> **⚠️ ⚠️ Warning**
|
|
226
|
+
> Titanium and Alloy do not support the Node.js concept of "folders as modules". That is, requiring a folder name does not automatically load the `index.js` or `index.json` file inside the folder, or use the `package.json` file to locate the main entry point. You need to explicitly require the file that serves as the main entry point to the library.
|
|
229
227
|
|
|
230
228
|
### Specs Folder
|
|
231
229
|
|