@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,542 +0,0 @@
1
- # TableViews
2
-
3
- <!-- TOC-START -->
4
- ## Contents
5
-
6
- - [1. Overview](#1-overview)
7
- - [2. TableView vs ListView](#2-tableview-vs-listview)
8
- - [3. Creating a TableView](#3-creating-a-tableview)
9
- - [4. Creating rows](#4-creating-rows)
10
- - [5. Row properties](#5-row-properties)
11
- - [6. Custom rows](#6-custom-rows)
12
- - [7. Headers and footers](#7-headers-and-footers)
13
- - [8. Grouped table style (iOS)](#8-grouped-table-style-ios)
14
- - [9. Editing mode](#9-editing-mode)
15
- - [10. TableView events](#10-tableview-events)
16
- - [11. Searching](#11-searching)
17
- - [12. Updating table data](#12-updating-table-data)
18
- - [13. TableView sections](#13-tableview-sections)
19
- - [14. Performance optimization](#14-performance-optimization)
20
- - [15. Common patterns](#15-common-patterns)
21
- - [16. Platform differences](#16-platform-differences)
22
- - [17. Migration: TableView to ListView](#17-migration-tableview-to-listview)
23
- - [Best practices](#best-practices)
24
-
25
- <!-- TOC-END -->
26
-
27
- ## 1. Overview
28
-
29
- TableView is a scrolling list component that displays rows of data. ListView is the recommended modern API for most cases, but TableView is still useful for:
30
- - Complex row animations
31
- - Direct child view access
32
- - Legacy code compatibility
33
- - UI patterns that need direct row manipulation
34
-
35
- ## 2. TableView vs ListView
36
-
37
- | Feature | TableView | ListView |
38
- | ------------------- | ------------------------------- | ---------------------------- |
39
- | Recommended for | Legacy apps, complex animations | New apps, large datasets |
40
- | Data binding | Direct row object access | Template-based binding |
41
- | Performance | Good for small datasets | Optimized for large datasets |
42
- | Row access | Direct children access | Virtual, data-only updates |
43
- | Animations | Full row animation support | Limited |
44
- | Complexity | Simpler for basic needs | More setup required |
45
-
46
- ## 3. Creating a TableView
47
-
48
- ### Basic TableView
49
-
50
- ```javascript
51
- const table = Ti.UI.createTableView({
52
- height: Ti.UI.FILL,
53
- width: Ti.UI.FILL,
54
- backgroundColor: 'white',
55
- rowHeight: 50,
56
- minRowHeight: 40,
57
- maxRowHeight: 80,
58
- separatorColor: '#ccc',
59
- scrollable: true // Set false to disable scrolling
60
- });
61
-
62
- win.add(table);
63
- ```
64
- ...
65
- ## 4. Creating rows
66
-
67
- ### Object literal rows (simple)
68
-
69
- ```javascript
70
- const data = [
71
- { title: 'Row 1' },
72
- { title: 'Row 2' },
73
- { title: 'Row 3' }
74
- ];
75
-
76
- const table = Ti.UI.createTableView({
77
- data: data
78
- });
79
-
80
- win.add(table);
81
- ```
82
-
83
- ### Explicit TableViewRow objects
84
-
85
- ```javascript
86
- const row = Ti.UI.createTableViewRow({
87
- title: 'Row 1',
88
- // Performance optimization
89
- className: 'row'
90
- });
91
-
92
- table.appendRow(row);
93
-
94
- // With explicit row, you can call methods
95
- const imgCapture = row.toImage();
96
- ```
97
-
98
- ### Performance: setData() vs appendRow()
99
-
100
- ```javascript
101
- // GOOD - Batch assignment
102
- const rows = [];
103
- for (let i = 0; i < 100; i++) {
104
- rows.push({ title: `Row ${i}` });
105
- }
106
- table.setData(rows); // Fast
107
-
108
- // AVOID - Adding one by one (slow for many rows)
109
- for (let i = 0; i < 100; i++) {
110
- table.appendRow({ title: `Row ${i}` });
111
- }
112
- ```
113
-
114
- Best practice: use `setData()` for multiple rows. `appendRow()` is significantly slower.
115
-
116
- ## 5. Row properties
117
-
118
- ### Built-in row properties
119
-
120
- | Property | Description |
121
- | ----------------- | --------------------------------- |
122
- | `title` | Row title text |
123
- | `className` | Reuse identifier for performance |
124
- | `leftImage` | Image to left of title |
125
- | `rightImage` | Image to right of title |
126
- | `backgroundImage` | Row background image |
127
- | `backgroundColor` | Row background color |
128
- | `hasChild` | Shows > indicator (iOS/Android) |
129
- | `hasDetail` | Shows detail indicator (iOS only) |
130
- | `hasCheck` | Shows checkmark indicator |
131
- | `header` | Section header text |
132
- | `footer` | Section footer text |
133
-
134
- ### Styled rows example
135
-
136
- ```javascript
137
- const data = [
138
- { title: 'Row 1', leftImage: 'icon.png', hasChild: true },
139
- { title: 'Row 2', rightImage: 'arrow.png', hasDetail: true },
140
- { title: 'Row 3', backgroundColor: '#fdd', hasCheck: true }
141
- ];
142
-
143
- const table = Ti.UI.createTableView({ data: data });
144
- ```
145
-
146
- ### Row indicators
147
-
148
- Row indicators provide visual cues:
149
-
150
- ```javascript
151
- // iOS and Android
152
- { title: 'Sub-items', hasChild: true } // > arrow
153
-
154
- // iOS only
155
- { title: 'Details', hasDetail: true } // circle with i
156
-
157
- // Both platforms
158
- { title: 'Selected', hasCheck: true } // checkmark
159
- ```
160
-
161
- ## 6. Custom rows
162
-
163
- ### Add child views
164
-
165
- ```javascript
166
- const data = [];
167
-
168
- for (let i = 0; i < 10; i++) {
169
- const row = Ti.UI.createTableViewRow({
170
- height: 60,
171
- className: 'customRow'
172
- });
173
-
174
- const label = Ti.UI.createLabel({
175
- left: 10,
176
- text: `Row ${i + 1}`,
177
- font: { fontSize: 16 }
178
- });
179
-
180
- const image = Ti.UI.createImageView({
181
- right: 10,
182
- image: 'icon.png'
183
- });
184
-
185
- const button = Ti.UI.createButton({
186
- right: 60,
187
- width: 80,
188
- height: 30,
189
- title: 'Action'
190
- });
191
-
192
- row.add(label);
193
- row.add(image);
194
- row.add(button);
195
-
196
- data.push(row);
197
- }
198
-
199
- const table = Ti.UI.createTableView({ data: data });
200
- ```
201
-
202
- ### Performance warning
203
-
204
- Warning: complex rows have performance costs. Each extra UI element multiplies resource use across rows. Test on device and simplify if needed.
205
-
206
- ## 7. Headers and footers
207
-
208
- ### Table-level headers and footers
209
-
210
- ```javascript
211
- const table = Ti.UI.createTableView({
212
- data: data,
213
- headerTitle: 'Table Header',
214
- footerTitle: 'Table Footer'
215
- });
216
- ```
217
-
218
- ### Custom header and footer views
219
-
220
- ```javascript
221
- function createCustomView(title) {
222
- const view = Ti.UI.createView({
223
- height: 40,
224
- backgroundColor: '#222'
225
- });
226
-
227
- const text = Ti.UI.createLabel({
228
- left: 20,
229
- text: title,
230
- color: '#fff'
231
- });
232
-
233
- view.add(text);
234
- return view;
235
- }
236
-
237
- const table = Ti.UI.createTableView({
238
- data: data,
239
- headerView: createCustomView('Header View'),
240
- footerView: createCustomView('Footer View')
241
- });
242
- ```
243
-
244
- ### Section headers and footers
245
-
246
- ```javascript
247
- const data = [
248
- { title: 'Row 1', header: 'Section 1' },
249
- { title: 'Row 2' },
250
- { title: 'Row 3' },
251
- { title: 'Row 4', header: 'Section 2' },
252
- { title: 'Row 5' }
253
- ];
254
-
255
- const table = Ti.UI.createTableView({ data: data });
256
- ```
257
-
258
- ## 8. Grouped table style (iOS)
259
-
260
- ```javascript
261
- const data = [
262
- { title: 'row 1', header: 'Header 1' },
263
- { title: 'row 2' },
264
- { title: 'row 3' },
265
- { title: 'row 4', header: 'Header 2' },
266
- { title: 'row 5' }
267
- ];
268
-
269
- const table = Ti.UI.createTableView({
270
- data: data,
271
- style: Ti.UI.iPhone.TableViewStyle.GROUPED
272
- });
273
- ```
274
-
275
- ## 9. Editing mode
276
-
277
- ```javascript
278
- table.editing = true;
279
-
280
- // Allow row movement
281
- table.moving = true;
282
-
283
- // Allow deletion
284
- const data = [
285
- { title: 'Row 1', canEdit: true },
286
- { title: 'Row 2', canEdit: false } // Cannot be deleted
287
- ];
288
- ```
289
-
290
- ## 10. TableView events
291
-
292
- ### Click event
293
-
294
- ```javascript
295
- table.addEventListener('click', (e) => {
296
- // e.index: row index
297
- // e.row: TableViewRow object
298
- // e.rowData: row data object
299
- // e.section: section (if using sections)
300
-
301
- Ti.API.info(`Clicked row: ${e.index}`);
302
- Ti.API.info(`Row title: ${e.row.title}`);
303
- });
304
- ```
305
-
306
- ### Delete event
307
-
308
- ```javascript
309
- table.addEventListener('delete', (e) => {
310
- Ti.API.info(`Deleted row: ${e.row.title}`);
311
- });
312
- ```
313
-
314
- ### Scroll events
315
-
316
- ```javascript
317
- table.addEventListener('scroll', (e) => {
318
- Ti.API.info(`Scrolling... y=${e.y}`);
319
- });
320
-
321
- table.addEventListener('scrollEnd', (e) => {
322
- Ti.API.info(`Scroll ended at y=${e.y}`);
323
- });
324
- ```
325
-
326
- ## 11. Searching
327
-
328
- ```javascript
329
- const search = Ti.UI.createSearchBar({
330
- top: 0,
331
- height: 43,
332
- showCancel: true
333
- });
334
-
335
- const table = Ti.UI.createTableView({
336
- search: search, // Attach search bar
337
- searchHidden: false // Initially visible
338
- });
339
- ```
340
-
341
- ## 12. Updating table data
342
-
343
- ### Append rows
344
-
345
- ```javascript
346
- table.appendRow({ title: 'New Row' });
347
-
348
- // Append multiple
349
- table.appendRow([
350
- { title: 'Row 1' },
351
- { title: 'Row 2' }
352
- ]);
353
- ```
354
-
355
- ### Insert rows
356
-
357
- ```javascript
358
- table.insertRowBefore(2, { title: 'Inserted at index 2' });
359
- table.insertRowAfter(5, { title: 'Inserted after index 5' });
360
- ```
361
-
362
- ### Delete rows
363
-
364
- ```javascript
365
- table.deleteRow(3); // Delete row at index 3
366
-
367
- // Clear all rows
368
- table.setData([]);
369
- // NOT: table.data = null or undefined (causes unexpected behavior)
370
- // Use table.setData([]) or table.data = [] to clear
371
- ```
372
-
373
- ### Update a specific row
374
-
375
- ```javascript
376
- const data = table.data;
377
- data[2].title = 'Updated Title';
378
- table.setData(data);
379
- ```
380
-
381
- ## 13. TableView sections
382
-
383
- ### Create sections
384
-
385
- ```javascript
386
- const section1 = Ti.UI.createTableViewSection({
387
- headerTitle: 'Section 1'
388
- });
389
-
390
- section1.add(Ti.UI.createTableViewRow({ title: 'Row 1' }));
391
- section1.add(Ti.UI.createTableViewRow({ title: 'Row 2' }));
392
-
393
- const section2 = Ti.UI.createTableViewSection({
394
- headerTitle: 'Section 2',
395
- footerTitle: 'Section Footer'
396
- });
397
-
398
- section2.add(Ti.UI.createTableViewRow({ title: 'Row 3' }));
399
-
400
- const table = Ti.UI.createTableView({
401
- data: [section1, section2]
402
- });
403
- ```
404
-
405
- ### Custom section headers
406
-
407
- ```javascript
408
- const section = Ti.UI.createTableViewSection({
409
- headerView: createCustomView('Custom Header')
410
- });
411
- ```
412
-
413
- ## 14. Performance optimization
414
-
415
- ### Use className
416
-
417
- ```javascript
418
- // GOOD - Rows with same structure share className
419
- const row1 = Ti.UI.createTableViewRow({
420
- title: 'Row 1',
421
- className: 'standardRow'
422
- });
423
-
424
- const row2 = Ti.UI.createTableViewRow({
425
- title: 'Row 2',
426
- // Reuses row1's template
427
- className: 'standardRow'
428
- });
429
- ```
430
-
431
- `className` lets the OS reuse scrolled-out rows for faster rendering.
432
-
433
- ### Avoid too many rows
434
-
435
- If you have thousands of rows, consider:
436
- - Pagination
437
- - ListView instead
438
- - Filtering
439
- - Drill-down interface
440
-
441
- ### Optimize custom rows
442
-
443
- - Test on device
444
- - Use simple layouts
445
- - Minimize child views per row
446
- - Avoid nested ScrollViews
447
-
448
- ## 15. Common patterns
449
-
450
- ### Detail view navigation
451
-
452
- ```javascript
453
- table.addEventListener('click', (e) => {
454
- const detailWin = Ti.UI.createWindow({
455
- title: e.row.title,
456
- backgroundColor: 'white'
457
- });
458
-
459
- const detailLabel = Ti.UI.createLabel({
460
- text: `Details for ${e.row.title}`
461
- });
462
-
463
- detailWin.add(detailLabel);
464
- detailWin.open();
465
- });
466
- ```
467
-
468
- ### Row actions (swipe to delete)
469
-
470
- ```javascript
471
- table.setEditable(true);
472
-
473
- table.addEventListener('delete', () => {
474
- // Confirm deletion
475
- const dialog = Ti.UI.createAlertDialog({
476
- title: 'Delete',
477
- message: 'Delete this row?',
478
- buttonNames: ['Delete', 'Cancel']
479
- });
480
-
481
- dialog.addEventListener('click', (evt) => {
482
- if (evt.index === 0) {
483
- // Delete confirmed
484
- // e.row is automatically removed
485
- }
486
- });
487
-
488
- dialog.show();
489
- });
490
- ```
491
-
492
- ### Refresh control
493
-
494
- ```javascript
495
- const table = Ti.UI.createTableView({
496
- refreshControl: Ti.UI.createRefreshControl({
497
- tintColor: 'blue'
498
- })
499
- });
500
-
501
- table.refreshControl.addEventListener('refreshstart', () => {
502
- // Load data
503
- loadData(() => {
504
- table.refreshControl.endRefreshing();
505
- });
506
- });
507
- ```
508
-
509
- ## 16. Platform differences
510
-
511
- ### iOS
512
- - Supports `GROUPED` style
513
- - Supports `hasDetail` indicator
514
- - Modal windows fill screen
515
- - NavigationController integration
516
-
517
- ### Android
518
- - No `GROUPED` style
519
- - `hasDetail` not supported
520
- - Windows always fill screen
521
- - Back button closes windows
522
-
523
- ## 17. Migration: TableView to ListView
524
-
525
- When to migrate:
526
- - New app development
527
- - Large datasets (more than 100 rows)
528
- - Performance issues
529
- - Need modern features (templates, binding)
530
-
531
- Key differences:
532
- - TableView: `data` property with row objects
533
- - ListView: `sections` property with templates
534
-
535
- ## Best practices
536
-
537
- 1. Use ListView for new apps - better performance and features
538
- 2. Use className to enable row reuse
539
- 3. Batch updates with `setData()` instead of many `appendRow()` calls
540
- 4. Test on device; simulator performance differs
541
- 5. Limit row complexity; fewer children means better scrolling
542
- 6. Consider pagination; avoid showing thousands of rows at once