@maccesar/titools 2.2.3 → 2.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/README.md +28 -27
  2. package/lib/commands/update.js +80 -101
  3. package/package.json +1 -1
  4. package/skills/alloy-guides/SKILL.md +31 -31
  5. package/skills/alloy-guides/references/CONCEPTS.md +3 -3
  6. package/skills/alloy-guides/references/CONTROLLERS.md +1 -1
  7. package/skills/alloy-guides/references/MODELS.md +6 -6
  8. package/skills/alloy-guides/references/VIEWS_WITHOUT_CONTROLLERS.md +1 -1
  9. package/skills/alloy-guides/references/VIEWS_XML.md +1 -1
  10. package/skills/alloy-guides/references/WIDGETS.md +1 -1
  11. package/skills/alloy-howtos/SKILL.md +27 -27
  12. package/skills/alloy-howtos/references/best_practices.md +9 -9
  13. package/skills/alloy-howtos/references/cli_reference.md +14 -14
  14. package/skills/alloy-howtos/references/config_files.md +16 -16
  15. package/skills/alloy-howtos/references/custom_tags.md +16 -16
  16. package/skills/alloy-howtos/references/debugging_troubleshooting.md +11 -15
  17. package/skills/alloy-howtos/references/samples.md +19 -19
  18. package/skills/purgetss/SKILL.md +11 -1
  19. package/skills/purgetss/references/animation-system.md +1 -1
  20. package/skills/purgetss/references/cli-commands.md +3 -3
  21. package/skills/purgetss/references/customization-deep-dive.md +1 -1
  22. package/skills/purgetss/references/dynamic-component-creation.md +1 -1
  23. package/skills/purgetss/references/icon-fonts.md +4 -0
  24. package/skills/purgetss/references/installation-setup.md +8 -1
  25. package/skills/purgetss/references/migration-guide.md +4 -0
  26. package/skills/purgetss/references/tikit-components.md +193 -204
  27. package/skills/purgetss/references/ui-ux-design.md +1 -1
  28. package/skills/ti-expert/SKILL.md +78 -118
  29. package/skills/ti-expert/references/alloy-builtins.md +18 -18
  30. package/skills/ti-expert/references/alloy-structure.md +21 -21
  31. package/skills/ti-expert/references/anti-patterns.md +15 -15
  32. package/skills/ti-expert/references/cli-expert.md +15 -15
  33. package/skills/ti-expert/references/code-conventions.md +38 -38
  34. package/skills/ti-expert/references/contracts.md +8 -8
  35. package/skills/ti-expert/references/controller-patterns.md +14 -14
  36. package/skills/ti-expert/references/error-handling.md +11 -11
  37. package/skills/ti-expert/references/examples.md +12 -12
  38. package/skills/ti-expert/references/migration-patterns.md +24 -24
  39. package/skills/ti-expert/references/patterns.md +10 -10
  40. package/skills/ti-expert/references/performance-listview.md +16 -16
  41. package/skills/ti-expert/references/performance-optimization.md +41 -41
  42. package/skills/ti-expert/references/security-device.md +22 -22
  43. package/skills/ti-expert/references/security-fundamentals.md +19 -19
  44. package/skills/ti-expert/references/state-management.md +33 -33
  45. package/skills/ti-expert/references/testing-e2e-ci.md +25 -25
  46. package/skills/ti-expert/references/testing-unit.md +24 -24
  47. package/skills/ti-expert/references/theming.md +15 -15
  48. package/skills/ti-guides/SKILL.md +58 -60
  49. package/skills/ti-guides/references/advanced-data-and-images.md +33 -33
  50. package/skills/ti-guides/references/android-manifest.md +15 -15
  51. package/skills/ti-guides/references/app-distribution.md +70 -166
  52. package/skills/ti-guides/references/application-frameworks.md +96 -114
  53. package/skills/ti-guides/references/cli-reference.md +294 -294
  54. package/skills/ti-guides/references/coding-best-practices.md +42 -33
  55. package/skills/ti-guides/references/commonjs-advanced.md +57 -51
  56. package/skills/ti-guides/references/hello-world.md +36 -36
  57. package/skills/ti-guides/references/hyperloop-native-access.md +66 -66
  58. package/skills/ti-guides/references/javascript-primer.md +83 -101
  59. package/skills/ti-guides/references/reserved-words.md +9 -9
  60. package/skills/ti-guides/references/resources.md +75 -83
  61. package/skills/ti-guides/references/style-and-conventions.md +35 -28
  62. package/skills/ti-guides/references/tiapp-config.md +110 -74
  63. package/skills/ti-howtos/SKILL.md +88 -92
  64. package/skills/ti-howtos/references/android-platform-deep-dives.md +104 -104
  65. package/skills/ti-howtos/references/automation-fastlane-appium.md +39 -39
  66. package/skills/ti-howtos/references/buffer-codec-streams.md +60 -60
  67. package/skills/ti-howtos/references/cross-platform-development.md +115 -136
  68. package/skills/ti-howtos/references/debugging-profiling.md +167 -181
  69. package/skills/ti-howtos/references/extending-titanium.md +121 -121
  70. package/skills/ti-howtos/references/google-maps-v2.md +84 -82
  71. package/skills/ti-howtos/references/ios-map-kit.md +65 -60
  72. package/skills/ti-howtos/references/ios-platform-deep-dives.md +123 -123
  73. package/skills/ti-howtos/references/local-data-sources.md +79 -78
  74. package/skills/ti-howtos/references/location-and-maps.md +116 -120
  75. package/skills/ti-howtos/references/media-apis.md +87 -86
  76. package/skills/ti-howtos/references/notification-services.md +250 -260
  77. package/skills/ti-howtos/references/remote-data-sources.md +98 -93
  78. package/skills/ti-howtos/references/tutorials.md +226 -216
  79. package/skills/ti-howtos/references/using-modules.md +73 -102
  80. package/skills/ti-howtos/references/web-content-integration.md +101 -103
  81. package/skills/ti-howtos/references/webpack-build-pipeline.md +52 -44
  82. package/skills/ti-ui/SKILL.md +85 -85
  83. package/skills/ti-ui/references/accessibility-deep-dive.md +57 -57
  84. package/skills/ti-ui/references/animation-and-matrices.md +79 -79
  85. package/skills/ti-ui/references/application-structures.md +96 -99
  86. package/skills/ti-ui/references/custom-fonts-styling.md +99 -99
  87. package/skills/ti-ui/references/event-handling.md +58 -58
  88. package/skills/ti-ui/references/gestures.md +62 -64
  89. package/skills/ti-ui/references/icons-and-splash-screens.md +88 -88
  90. package/skills/ti-ui/references/layouts-and-positioning.md +87 -97
  91. package/skills/ti-ui/references/listviews-and-performance.md +107 -107
  92. package/skills/ti-ui/references/orientation.md +87 -88
  93. package/skills/ti-ui/references/platform-ui-android.md +87 -81
  94. package/skills/ti-ui/references/platform-ui-ios.md +63 -61
  95. package/skills/ti-ui/references/scrolling-views.md +29 -29
  96. package/skills/ti-ui/references/tableviews.md +56 -56
@@ -1,28 +1,28 @@
1
- # Local Data Sources
1
+ # Local data sources
2
2
 
3
- ## 1. Filesystem Access and Storage
3
+ ## 1. Filesystem access and storage
4
4
 
5
- ### Modules Overview
6
- - `Ti.Filesystem` - Top-level module for file/directory operations
7
- - `Ti.Filesystem.File` - File object with read/write methods
8
- - `Ti.Filesystem.FileStream` - Stream wrapper implementing Ti.IOStream interface
5
+ ### Modules overview
6
+ - `Ti.Filesystem` - top-level module for file/directory operations
7
+ - `Ti.Filesystem.File` - file object with read/write methods
8
+ - `Ti.Filesystem.FileStream` - stream wrapper implementing `Ti.IOStream`
9
9
 
10
- ### Storage Locations
10
+ ### Storage locations
11
11
 
12
12
  | Location | Read/Write | Persistence | Notes |
13
13
  | --------------------------- | ---------- | ---------------- | -------------------------------------- |
14
14
  | `applicationDataDirectory` | R/W | Until uninstall | Primary app data location |
15
- | `resourcesDirectory` | R-only | Until uninstall | App resources (R/W in simulator only!) |
15
+ | `resourcesDirectory` | R-only | Until uninstall | App resources (R/W in simulator only) |
16
16
  | `tempDirectory` | R/W | Until app closes | OS may delete anytime |
17
17
  | `applicationCacheDirectory` | R/W | OS may clean | For cached data |
18
18
  | `externalCacheDirectory` | R/W | OS may clean | Android SD card cache |
19
19
  | `externalStorageDirectory` | R/W | Until uninstall | Android SD card storage |
20
20
 
21
- **Always check** `Ti.Filesystem.isExternalStoragePresent()` before using external storage on Android.
21
+ Always check `Ti.Filesystem.isExternalStoragePresent()` before using external storage on Android.
22
22
 
23
- ### File Operations
23
+ ### File operations
24
24
 
25
- #### Getting a File Handle
25
+ #### Getting a file handle
26
26
  ```javascript
27
27
  const f = Ti.Filesystem.getFile(
28
28
  Ti.Filesystem.applicationDataDirectory,
@@ -30,24 +30,24 @@ const f = Ti.Filesystem.getFile(
30
30
  );
31
31
  ```
32
32
 
33
- #### Writing Files
33
+ #### Writing files
34
34
  ```javascript
35
- f.write('Content here'); // Overwrites or creates
35
+ f.write('Content here'); // Overwrites or creates
36
36
  ```
37
37
 
38
- #### Reading Files
38
+ #### Reading files
39
39
  ```javascript
40
- const contents = f.read(); // Returns Blob
41
- Ti.API.info(contents.text); // Text content
42
- Ti.API.info(contents.mimeType); // MIME type
40
+ const contents = f.read(); // Returns Blob
41
+ Ti.API.info(contents.text); // Text content
42
+ Ti.API.info(contents.mimeType); // MIME type
43
43
  ```
44
44
 
45
45
  #### Appending
46
46
  ```javascript
47
- f.append('More content\n'); // String, Blob, or File
47
+ f.append('More content\n'); // String, Blob, or File
48
48
  ```
49
49
 
50
- #### Creating/Copying
50
+ #### Creating/copying
51
51
  ```javascript
52
52
  // Auto-creates on write, but explicit option exists:
53
53
  if (!f.exists()) {
@@ -64,7 +64,7 @@ newFile.write(oldFile.read());
64
64
  ```
65
65
 
66
66
  #### Renaming
67
- **Important**: File handle still points to old name after rename!
67
+ Important: the file handle still points to the old name after rename.
68
68
 
69
69
  ```javascript
70
70
  const f = Ti.Filesystem.getFile(applicationDataDirectory, 'old.txt');
@@ -76,11 +76,11 @@ const newf = Ti.Filesystem.getFile(applicationDataDirectory, 'new.txt');
76
76
  #### Deleting
77
77
  ```javascript
78
78
  if (f.exists() && f.writable) {
79
- const success = f.deleteFile(); // Returns Boolean, no error thrown
79
+ const success = f.deleteFile(); // Returns Boolean, no error thrown
80
80
  }
81
81
  ```
82
82
 
83
- ### Directory Operations
83
+ ### Directory operations
84
84
 
85
85
  ```javascript
86
86
  // Create directory
@@ -95,16 +95,16 @@ const file = Ti.Filesystem.getFile(applicationDataDirectory, 'file.txt');
95
95
  file.move('mysubdir/file.txt');
96
96
 
97
97
  // Delete directory (must be empty or force recursive)
98
- dir.deleteDirectory(false); // Fails if not empty
99
- dir.deleteDirectory(true); // Recursive delete
98
+ dir.deleteDirectory(false); // Fails if not empty
99
+ dir.deleteDirectory(true); // Recursive delete
100
100
  ```
101
101
 
102
- ### Case Sensitivity Warning
103
- Android and Mobile Web use case-sensitive filesystems. File names referenced in code must match actual file names exactly. Recommendation: **lowercase all file names**.
102
+ ### Case sensitivity warning
103
+ Android and Mobile Web use case-sensitive filesystems. File names referenced in code must match actual file names exactly. Recommendation: use lowercase file names.
104
104
 
105
- ## 2. SQLite Database
105
+ ## 2. SQLite database
106
106
 
107
- ### Installing a Pre-populated Database
107
+ ### Installing a pre-populated database
108
108
  Ship a database with your app and install it on first launch:
109
109
  ```javascript
110
110
  // Copies db from Resources/ (or app/assets/) to applicationDataDirectory
@@ -112,7 +112,7 @@ const db = Ti.Database.install('seeds/mydata.sqlite', 'mydata');
112
112
  // On subsequent launches, install() just opens the existing database
113
113
  ```
114
114
 
115
- ### Opening Databases
115
+ ### Opening databases
116
116
 
117
117
  ```javascript
118
118
  // Install (copies from Resources if first time)
@@ -129,39 +129,39 @@ const dbFile = Ti.Filesystem.getFile(
129
129
  const db = Ti.Database.open(dbFile.nativePath);
130
130
  ```
131
131
 
132
- ### Querying Data
132
+ ### Querying data
133
133
 
134
134
  ```javascript
135
135
  const rows = db.execute('SELECT * FROM users WHERE age > ?', [18]);
136
136
 
137
137
  while (rows.isValidRow()) {
138
138
  Ti.API.info(rows.fieldByName('name'));
139
- Ti.API.info(rows.field(0)); // First column by index
139
+ Ti.API.info(rows.field(0)); // First column by index
140
140
  rows.next();
141
141
  }
142
142
 
143
- // **CRITICAL**: Always close result set
143
+ // Always close result set
144
144
  rows.close();
145
145
  ```
146
146
 
147
- ### Parameterized Queries
147
+ ### Parameterized queries
148
148
  Always use parameters to prevent SQL injection:
149
149
 
150
150
  ```javascript
151
- // SAFE - parameterized
151
+ // Safe - parameterized
152
152
  db.execute('INSERT INTO users (name, age) VALUES (?, ?)', ['John', 25]);
153
153
 
154
- // UNSAFE - never do this
154
+ // Unsafe - never do this
155
155
  db.execute(`INSERT INTO users (name, age) VALUES ('${name}', ${age})`);
156
156
  ```
157
157
 
158
- ### Data Modification
158
+ ### Data modification
159
159
 
160
160
  ```javascript
161
161
  // INSERT
162
162
  db.execute('INSERT INTO users (name, age) VALUES (?, ?)', ['Jane', 30]);
163
- const lastId = db.lastInsertRowId; // ID of the last inserted row
164
- const affected = db.rowsAffected; // number of rows changed by last statement
163
+ const lastId = db.lastInsertRowId; // ID of the last inserted row
164
+ const affected = db.rowsAffected; // number of rows changed by last statement
165
165
 
166
166
  // UPDATE
167
167
  db.execute('UPDATE users SET age = ? WHERE name = ?', [31, 'Jane']);
@@ -171,42 +171,43 @@ const rowsAffected = db.rowsAffected;
171
171
  db.execute('DELETE FROM users WHERE age < ?', [18]);
172
172
  ```
173
173
 
174
- ### Transactions for Batch Operations
175
- Use transactions to dramatically improve performance for multiple inserts/updates:
174
+ ### Transactions for batch operations
175
+ Use transactions to speed up multiple inserts or updates:
176
176
  ```javascript
177
177
  const db = Ti.Database.open('mydb');
178
178
  db.execute('BEGIN');
179
179
  try {
180
- for (let i = 0; i < items.length; i++) {
181
- db.execute('INSERT INTO products (name, price) VALUES (?, ?)', items[i].name, items[i].price);
182
- }
183
- db.execute('COMMIT');
180
+ for (let i = 0; i < items.length; i++) {
181
+ db.execute('INSERT INTO products (name, price) VALUES (?, ?)', items[i].name, items[i].price);
182
+ }
183
+ db.execute('COMMIT');
184
184
  } catch (e) {
185
- db.execute('ROLLBACK');
186
- Ti.API.error(`Transaction failed: ${e.message}`);
185
+ db.execute('ROLLBACK');
186
+ Ti.API.error(`Transaction failed: ${e.message}`);
187
187
  }
188
188
  db.close();
189
189
  ```
190
190
 
191
- > **Performance**: Wrapping 1000 inserts in a transaction can be 10-100x faster than individual inserts.
191
+ Performance: wrapping 1000 inserts in a transaction can be 10-100x faster than individual inserts.
192
192
 
193
- ### SQLite Limitations
194
- - No `FULL OUTER JOIN` support use `LEFT JOIN` with `UNION`
195
- - Limited `ALTER TABLE` can only `ADD COLUMN` or `RENAME TABLE`, cannot drop/modify columns
196
- - No built-in referential integrity (foreign key enforcement) enable with `PRAGMA foreign_keys = ON`
197
- - No native boolean type use INTEGER (0/1)
193
+ ### SQLite limitations
194
+ - No `FULL OUTER JOIN` support. Use `LEFT JOIN` with `UNION`.
195
+ - Limited `ALTER TABLE`. You can only `ADD COLUMN` or `RENAME TABLE`.
196
+ - No built-in referential integrity (foreign keys). Enable with `PRAGMA foreign_keys = ON`.
197
+ - No native boolean type. Use INTEGER (0/1).
198
198
 
199
- ### Disable iCloud Backup for Databases (iOS)
200
- iOS automatically backs up databases to iCloud. For large or recreatable databases, disable this:
199
+ ### Disable iCloud backup for databases (iOS)
200
+
201
+ iOS backs up databases to iCloud by default. For large or recreatable databases, disable this:
201
202
  ```javascript
202
203
  const db = Ti.Database.open('mydb');
203
204
  db.file.setRemoteBackup(false);
204
205
  db.close();
205
206
  ```
206
207
 
207
- > **Important**: Apple may reject apps that back up large recreatable data to iCloud.
208
+ Important: Apple may reject apps that back up large recreatable data to iCloud.
208
209
 
209
- ### **CRITICAL**: Always Close Connections
210
+ ### Always close connections
210
211
 
211
212
  ```javascript
212
213
  try {
@@ -223,11 +224,11 @@ try {
223
224
  ### Overview
224
225
  Lightweight key-value storage for simple data types. Loaded into memory at launch for fast access.
225
226
 
226
- **Warning**: No hard limit, but all properties load into memory - avoid storing large data.
227
+ Warning: there is no hard limit, but all properties load into memory. Avoid storing large data.
227
228
 
228
- ### Data Type Methods
229
+ ### Data type methods
229
230
 
230
- | Type | Get Method | Set Method |
231
+ | Type | Get method | Set method |
231
232
  | ------ | -------------------------- | ------------------------ |
232
233
  | String | `getString(name, default)` | `setString(name, value)` |
233
234
  | Int | `getInt(name, default)` | `setInt(name, value)` |
@@ -235,7 +236,7 @@ Lightweight key-value storage for simple data types. Loaded into memory at launc
235
236
  | Bool | `getBool(name, default)` | `setBool(name, value)` |
236
237
  | List | `getList(name, default)` | `setList(name, value)` |
237
238
 
238
- ### Usage Examples
239
+ ### Usage examples
239
240
 
240
241
  ```javascript
241
242
  // Set values
@@ -261,7 +262,7 @@ Ti.App.Properties.removeProperty('username');
261
262
  const allProps = Ti.App.Properties.listProperties();
262
263
  ```
263
264
 
264
- ### Storing Complex Objects as JSON
265
+ ### Storing complex objects as JSON
265
266
 
266
267
  ```javascript
267
268
  // Store object as JSON string
@@ -271,24 +272,24 @@ Ti.App.Properties.setString('weatherData', JSON.stringify(data));
271
272
  // Retrieve and parse
272
273
  const stored = Ti.App.Properties.getString('weatherData', '{}');
273
274
  const weather = JSON.parse(stored);
274
- Ti.API.info(weather.city); // 'Mountain View'
275
+ Ti.API.info(weather.city); // 'Mountain View'
275
276
  ```
276
277
 
277
- ### Platform Storage
278
- - **iOS**: `NSUserDefaults` in `.plist` file
279
- - **Android**: XML file at `/data/data/com.domain.app/shared_prefs/titanium.xml`
278
+ ### Platform storage
279
+ - iOS: `NSUserDefaults` in a `.plist` file
280
+ - Android: XML file at `/data/data/com.domain.app/shared_prefs/titanium.xml`
280
281
 
281
- ## 4. Advanced Data Manipulation (Buffer, Codec, and Streams)
282
+ ## 4. Advanced data manipulation (Buffer, Codec, and Streams)
282
283
 
283
- For binary data handling, character encoding, and large file streams, refer to the detailed guide:
284
+ For binary data handling, character encoding, and large file streams, see:
284
285
 
285
- - [Buffer, Codec, and Streams](./buffer-codec-streams.md): Using `Ti.Buffer`, `Ti.Codec` for numbers/strings, and efficient chunk-based reading.
286
+ - Buffer, Codec, and Streams: `buffer-codec-streams.md`
286
287
 
287
- ## 5. Choosing a Persistence Strategy
288
+ ## 5. Choosing a persistence strategy
288
289
 
289
- ### Decision Guide
290
+ ### Decision guide
290
291
 
291
- | Scenario | Recommended Approach |
292
+ | Scenario | Recommended approach |
292
293
  | ---------------------------------- | ---------------------------------------- |
293
294
  | User settings/preferences | `Ti.App.Properties` |
294
295
  | Small config data (< 100KB) | `Ti.App.Properties` with JSON |
@@ -299,11 +300,11 @@ For binary data handling, character encoding, and large file streams, refer to t
299
300
  | User-generated files | Filesystem (`applicationDataDirectory`) |
300
301
  | Offline-first app data | SQLite + Filesystem combo |
301
302
 
302
- ### Best Practices
303
+ ### Best practices
303
304
 
304
- 1. **Properties API**: Use only for small, frequently-accessed config data
305
- 2. **SQLite**: Always close connections and result sets; use parameterized queries
306
- 3. **Filesystem**: Check external storage availability on Android; handle case sensitivity
307
- 4. **Streams**: Use for large file operations to avoid memory issues
308
- 5. **Hybrid Approach**: Store metadata in SQLite, file paths in records, actual files on filesystem
309
- 6. **Cleanup**: Implement cleanup for temp files and cache; don't let them accumulate
305
+ 1. Properties API: use only for small, frequently accessed config data.
306
+ 2. SQLite: always close connections and result sets; use parameterized queries.
307
+ 3. Filesystem: check external storage availability on Android; handle case sensitivity.
308
+ 4. Streams: use for large file operations to avoid memory issues.
309
+ 5. Hybrid approach: store metadata in SQLite, file paths in records, actual files on filesystem.
310
+ 6. Cleanup: implement cleanup for temp files and cache; do not let them accumulate.