@maccesar/titools 2.0.7 → 2.2.1

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 (133) hide show
  1. package/AGENTS-VERCEL-RESEARCH.md +172 -0
  2. package/README.md +408 -389
  3. package/agents/{ti-researcher.md → ti-pro.md} +14 -13
  4. package/bin/titools.js +16 -12
  5. package/lib/cleanup.js +95 -0
  6. package/lib/commands/agents.js +146 -70
  7. package/lib/commands/skills.js +349 -0
  8. package/lib/commands/uninstall.js +189 -154
  9. package/lib/commands/update.js +104 -21
  10. package/lib/config.js +26 -20
  11. package/lib/downloader.js +1 -1
  12. package/lib/installer.js +37 -97
  13. package/lib/platform.js +9 -5
  14. package/lib/prompts/checkboxCancel.js +264 -0
  15. package/lib/prompts/selectCancel.js +204 -0
  16. package/lib/symlink.js +19 -7
  17. package/lib/utils.js +17 -17
  18. package/package.json +10 -10
  19. package/skills/alloy-guides/SKILL.md +8 -30
  20. package/skills/alloy-guides/references/CLI_TASKS.md +14 -24
  21. package/skills/alloy-guides/references/CONCEPTS.md +5 -25
  22. package/skills/alloy-guides/references/CONTROLLERS.md +2 -19
  23. package/skills/alloy-guides/references/MODELS.md +40 -10
  24. package/skills/alloy-guides/references/PURGETSS.md +1 -11
  25. package/skills/alloy-guides/references/VIEWS_DYNAMIC.md +8 -14
  26. package/skills/alloy-guides/references/VIEWS_STYLES.md +14 -25
  27. package/skills/alloy-guides/references/VIEWS_WITHOUT_CONTROLLERS.md +2 -8
  28. package/skills/alloy-guides/references/VIEWS_XML.md +29 -40
  29. package/skills/alloy-guides/references/WIDGETS.md +1 -17
  30. package/skills/alloy-howtos/SKILL.md +1 -22
  31. package/skills/alloy-howtos/references/best_practices.md +0 -17
  32. package/skills/alloy-howtos/references/cli_reference.md +1 -23
  33. package/skills/alloy-howtos/references/config_files.md +86 -15
  34. package/skills/alloy-howtos/references/custom_tags.md +14 -13
  35. package/skills/alloy-howtos/references/debugging_troubleshooting.md +3 -22
  36. package/skills/alloy-howtos/references/samples.md +4 -14
  37. package/skills/purgetss/SKILL.md +11 -37
  38. package/skills/purgetss/references/EXAMPLES.md +106 -17
  39. package/skills/purgetss/references/animation-system.md +0 -67
  40. package/skills/purgetss/references/apply-directive.md +0 -18
  41. package/skills/purgetss/references/arbitrary-values.md +0 -25
  42. package/skills/purgetss/references/class-index.md +0 -46
  43. package/skills/purgetss/references/cli-commands.md +0 -41
  44. package/skills/purgetss/references/configurable-properties.md +0 -55
  45. package/skills/purgetss/references/custom-rules.md +0 -14
  46. package/skills/purgetss/references/customization-deep-dive.md +0 -49
  47. package/skills/purgetss/references/dynamic-component-creation.md +56 -37
  48. package/skills/purgetss/references/grid-layout.md +0 -32
  49. package/skills/purgetss/references/icon-fonts.md +0 -50
  50. package/skills/purgetss/references/installation-setup.md +61 -32
  51. package/skills/purgetss/references/migration-guide.md +127 -0
  52. package/skills/purgetss/references/opacity-modifier.md +0 -34
  53. package/skills/purgetss/references/performance-tips.md +261 -0
  54. package/skills/purgetss/references/platform-modifiers.md +0 -46
  55. package/skills/purgetss/references/smart-mappings.md +0 -12
  56. package/skills/purgetss/references/tikit-components.md +393 -0
  57. package/skills/purgetss/references/titanium-resets.md +1 -27
  58. package/skills/purgetss/references/ui-ux-design.md +467 -117
  59. package/skills/{alloy-expert → ti-expert}/SKILL.md +45 -54
  60. package/skills/ti-expert/references/alloy-builtins.md +387 -0
  61. package/skills/{alloy-expert → ti-expert}/references/alloy-structure.md +147 -40
  62. package/skills/ti-expert/references/anti-patterns.md +90 -0
  63. package/skills/ti-expert/references/cli-expert.md +109 -0
  64. package/skills/{alloy-expert → ti-expert}/references/code-conventions.md +182 -49
  65. package/skills/{alloy-expert → ti-expert}/references/controller-patterns.md +103 -93
  66. package/skills/{alloy-expert → ti-expert}/references/error-handling.md +12 -12
  67. package/skills/{alloy-expert → ti-expert}/references/examples.md +144 -85
  68. package/skills/{alloy-expert → ti-expert}/references/migration-patterns.md +38 -36
  69. package/skills/{alloy-expert → ti-expert}/references/patterns.md +8 -8
  70. package/skills/ti-expert/references/performance-listview.md +251 -0
  71. package/skills/{alloy-expert/references/performance-patterns.md → ti-expert/references/performance-optimization.md} +67 -283
  72. package/skills/{alloy-expert/references/security-patterns.md → ti-expert/references/security-device.md} +12 -295
  73. package/skills/ti-expert/references/security-fundamentals.md +284 -0
  74. package/skills/{alloy-expert → ti-expert}/references/state-management.md +10 -10
  75. package/skills/ti-expert/references/testing-e2e-ci.md +432 -0
  76. package/skills/ti-expert/references/testing-unit.md +433 -0
  77. package/skills/ti-expert/references/theming.md +394 -0
  78. package/skills/ti-guides/SKILL.md +1 -14
  79. package/skills/ti-guides/references/advanced-data-and-images.md +126 -10
  80. package/skills/ti-guides/references/app-distribution.md +48 -10
  81. package/skills/ti-guides/references/application-frameworks.md +9 -2
  82. package/skills/ti-guides/references/cli-reference.md +338 -82
  83. package/skills/ti-guides/references/coding-best-practices.md +14 -4
  84. package/skills/ti-guides/references/commonjs-advanced.md +103 -6
  85. package/skills/ti-guides/references/hello-world.md +5 -2
  86. package/skills/ti-guides/references/hyperloop-native-access.md +439 -46
  87. package/skills/ti-guides/references/javascript-primer.md +4 -3
  88. package/skills/ti-guides/references/resources.md +0 -1
  89. package/skills/ti-guides/references/style-and-conventions.md +57 -9
  90. package/skills/ti-guides/references/tiapp-config.md +48 -6
  91. package/skills/ti-howtos/SKILL.md +2 -27
  92. package/skills/ti-howtos/references/android-platform-deep-dives.md +41 -90
  93. package/skills/ti-howtos/references/automation-fastlane-appium.md +15 -14
  94. package/skills/ti-howtos/references/buffer-codec-streams.md +22 -22
  95. package/skills/ti-howtos/references/cross-platform-development.md +68 -37
  96. package/skills/ti-howtos/references/debugging-profiling.md +8 -53
  97. package/skills/ti-howtos/references/extending-titanium.md +12 -51
  98. package/skills/ti-howtos/references/google-maps-v2.md +30 -29
  99. package/skills/ti-howtos/references/ios-map-kit.md +19 -25
  100. package/skills/ti-howtos/references/ios-platform-deep-dives.md +95 -283
  101. package/skills/ti-howtos/references/local-data-sources.md +45 -37
  102. package/skills/ti-howtos/references/location-and-maps.md +47 -28
  103. package/skills/ti-howtos/references/media-apis.md +84 -27
  104. package/skills/ti-howtos/references/notification-services.md +40 -89
  105. package/skills/ti-howtos/references/remote-data-sources.md +21 -36
  106. package/skills/ti-howtos/references/tutorials.md +79 -39
  107. package/skills/ti-howtos/references/using-modules.md +4 -30
  108. package/skills/ti-howtos/references/web-content-integration.md +28 -45
  109. package/skills/ti-howtos/references/webpack-build-pipeline.md +54 -18
  110. package/skills/ti-ui/SKILL.md +1 -21
  111. package/skills/ti-ui/references/accessibility-deep-dive.md +71 -25
  112. package/skills/ti-ui/references/animation-and-matrices.md +0 -47
  113. package/skills/ti-ui/references/application-structures.md +0 -46
  114. package/skills/ti-ui/references/custom-fonts-styling.md +9 -57
  115. package/skills/ti-ui/references/event-handling.md +32 -40
  116. package/skills/ti-ui/references/gestures.md +0 -40
  117. package/skills/ti-ui/references/icons-and-splash-screens.md +21 -44
  118. package/skills/ti-ui/references/layouts-and-positioning.md +47 -39
  119. package/skills/ti-ui/references/listviews-and-performance.md +187 -73
  120. package/skills/ti-ui/references/orientation.md +57 -71
  121. package/skills/ti-ui/references/platform-ui-android.md +114 -48
  122. package/skills/ti-ui/references/platform-ui-ios.md +63 -38
  123. package/skills/ti-ui/references/scrolling-views.md +14 -23
  124. package/skills/ti-ui/references/tableviews.md +6 -56
  125. package/AGENTS-TEMPLATE.md +0 -174
  126. package/lib/commands/install.js +0 -188
  127. package/skills/alloy-expert/references/anti-patterns.md +0 -133
  128. package/skills/alloy-expert/references/testing.md +0 -872
  129. package/skills/ti-guides/references/alloy-cli-advanced.md +0 -84
  130. package/skills/ti-guides/references/alloy-data-mastery.md +0 -29
  131. package/skills/ti-guides/references/alloy-widgets-and-themes.md +0 -19
  132. /package/skills/{alloy-expert → ti-expert}/assets/ControllerAutoCleanup.js +0 -0
  133. /package/skills/{alloy-expert → ti-expert}/references/contracts.md +0 -0
@@ -1,7 +1,5 @@
1
1
  # Alloy Models
2
2
 
3
- ## Table of Contents
4
-
5
3
  1. [Overview](#overview)
6
4
  2. [Alloy Collection and Model Objects](#alloy-collection-and-model-objects)
7
5
  3. [Alloy Data Binding](#alloy-data-binding)
@@ -347,6 +345,8 @@ library.on('change:title', e => {
347
345
  This only works if the Backbone method fires the change event and does not enable `{silent: true}` as an option.
348
346
  :::
349
347
 
348
+ If you want to suppress an update, specify `{silent: true}` in the `options` parameters when calling Backbone methods to change model data. The data-bound view will not be updated to reflect the changes.
349
+
350
350
  ### Bind Deep Object Properties
351
351
 
352
352
  You can bind deep object properties:
@@ -380,6 +380,16 @@ You can bind models and properties that use names with special characters like d
380
380
  </Alloy>
381
381
  ```
382
382
 
383
+ ### Use $.args Values in XML (CLI 7.1.0+)
384
+
385
+ Since CLI 7.1.0, values passed at creation time can be used directly in XML:
386
+
387
+ ```xml
388
+ <Alloy>
389
+ <Label text="$.args.foo" />
390
+ </Alloy>
391
+ ```
392
+
383
393
  ### Bind Multiple Models to the Same View
384
394
 
385
395
  You have the ability to bind multiple models to the same view:
@@ -426,6 +436,10 @@ exports.definition = {
426
436
  };
427
437
  ```
428
438
 
439
+ ::: warning ⚠️ Warning
440
+ The `transform` method must return **all** bound properties, not just the transformed ones. Until Alloy 1.8.1, simple collection data binding did not require this and automatically fell back to the model attributes.
441
+ :::
442
+
429
443
  ### Lazy Transformation (Performance Tip)
430
444
 
431
445
  The advantage of defining transformations in the model is that you don't need to repeat them in every controller. A possible disadvantage is that everywhere you bind the model all transformations are computed where you might only need some.
@@ -511,7 +525,7 @@ You need to specify additional attributes in the markup, which are only specific
511
525
  * `dataCollection`: specifies the collection singleton or instance to bind to the table. This is the name of the model file for singletons or the ID prefixed with the controller symbol ('$') for instances.
512
526
  * `dataTransform`: specifies an optional callback to use to format model attributes. The passed argument is a model and the return value is a modified model as a JSON object.
513
527
  * `dataFilter`: specifies an optional callback to use to filter data in the collection. The passed argument is a collection and the return value is an array of models.
514
- * `dataFunction`: set to an arbitrary identifier (name) for a function call. Use this identifier to call a function in the controller to manually update the view.
528
+ * `dataFunction`: set to an arbitrary identifier (name) for a function call. This is not a declared function in the controller. This attribute creates an alias to access the underlying binding function, which is part of the Alloy data-view binding framework. Use this identifier to call a function in the controller to manually update the view.
515
529
 
516
530
  Next, create a repeater object (refer to the table above) and place it inline with the view object with the `dataCollection` attribute, or place it in a separate view and use the `Require` tag to import it.
517
531
 
@@ -527,6 +541,16 @@ $.win.addEventListener("close", () => {
527
541
  $.destroy();
528
542
  });
529
543
  ```
544
+
545
+ For global singletons, to properly release them you should also remove event handlers with `off()` and set the reference to null:
546
+
547
+ ```javascript
548
+ $.win.addEventListener("close", () => {
549
+ $.destroy();
550
+ Alloy.Collections.book.off();
551
+ Alloy.Collections.book = null;
552
+ });
553
+ ```
530
554
  :::
531
555
 
532
556
  #### Collection-View Binding Example
@@ -634,6 +658,8 @@ In Alloy, a sync adapter allows you to store and load your models to a persisten
634
658
 
635
659
  Backbone syncs your models to persistent storage devices based on the implementation of the [Backbone.sync method](https://titaniumsdk.com/guide/Alloy_Framework/Alloy_Guide/Alloy_Models/Alloy_Sync_Adapters_and_Migrations.html). Since Backbone's primary use is for web applications, by default, the Backbone.sync method executes RESTful JSON requests to a URL specified by the Model.urlRoot or Collection.url attribute, when these classes are created.
636
660
 
661
+ Models are accessed from persistent storage based on the `id` attribute. To override this, set the `idAttribute` property of the model. The `cid` (client ID) is a special property of models that is automatically assigned when they are first created. Client IDs are useful when the model has not yet been saved to the server and does not have its real `id` yet.
662
+
637
663
  The sync method depends on calls to other Backbone methods as described in the table below.
638
664
 
639
665
  | **Backbone Method** | **Sync CRUD Method** | **Equivalent HTTP Method** | **Equivalent SQL Method** |
@@ -649,7 +675,7 @@ The sync method depends on calls to other Backbone methods as described in the t
649
675
  Alloy provides a few ready-made sync adapters. In the 'adapter' object, set the 'type' to use one of the following:
650
676
 
651
677
  * `sql` for the SQLite database on the Android and iOS platform.
652
- * `properties` for storing data locally in the Titanium SDK context.
678
+ * `properties` for storing data locally in the Titanium SDK context. You do not need to define the `columns` object in the `config` object. If defined, the object is ignored.
653
679
  * `localStorage` for HTML5 localStorage on the Mobile Web platform. Deprecated since Alloy 1.5.0. Use the `properties` adapter instead.
654
680
 
655
681
  These adapters are part of Alloy and are copied to the `Resources/alloy/sync` folder during compilation. These sync adapters assign the `id` attribute of the models, which means if you assign an ID when creating a model, it is overridden by any sync operations.
@@ -706,11 +732,11 @@ exports.definition = {
706
732
 
707
733
  **Specify columns property as primary ID**
708
734
 
709
- Define the `idAttribute` key-value pair in the `config.adapter` object to use a `config.columns` key as the primary ID for the SQLite table.
735
+ Define the `idAttribute` key-value pair in the `config.adapter` object to use a `config.columns` key as the primary ID for the SQLite table. If this key is not set, Alloy creates the `alloy_id` column in the table and generates a default GUID as the model ID.
710
736
 
711
737
  **Specify a migration to use**
712
738
 
713
- Define the `migration` key-value pair in the `config.adapter` object to specify the database version to use. The value of this key is the datatime code of the migration file. Alloy upgrades or rolls back the database based on this value.
739
+ Define the `migration` key-value pair in the `config.adapter` object to specify the database version to use. The value of this key is the datetime code of the migration file. Alloy upgrades or rolls back the database based on this value. If left undefined, Alloy upgrades the database based on the newest migration file.
714
740
 
715
741
  **Specify a database to use**
716
742
 
@@ -718,7 +744,7 @@ Define the `db_name` key-value pair in the `config.adapter` object to specify th
718
744
 
719
745
  **Specify a database file to preload**
720
746
 
721
- Define the `db_file` key-value pair in the `config.adapter` object to specify the database file ('myfile.sqlite') to preload. Place this file in the `app/assets` directory of your Alloy project.
747
+ Define the `db_file` key-value pair in the `config.adapter` object to specify the database file ('myfile.sqlite') to preload. Place this file in the `app/assets` directory of your Alloy project. Alloy creates a database using the name of the database file minus the file extension if one does not exist.
722
748
 
723
749
  ### Custom Sync Adapters
724
750
 
@@ -734,7 +760,9 @@ The sync adapter exports three functions:
734
760
 
735
761
  ### Migrations
736
762
 
737
- A migration is a description of incremental changes to a database, which takes your database from version 1 to version X, with a migration file for each step in the evolution of your database schema.
763
+ A migration is a description of incremental changes to a database, which takes your database from version 1 to version X, with a migration file for each step in the evolution of your database schema. This is helpful to keep different versions of a database in sync. For example, when version 7 of your application is deployed, migrations are able to successfully update the database from versions 1 through 6. Currently, migrations are only used with the `sql` sync adapter.
764
+
765
+ The `migration.up` function upgrades the database from the previous version, while the `migration.down` function rolls back the changes to the previous version.
738
766
 
739
767
  In Alloy, migrations are defined by JavaScript files located in the `app/migrations` folder of the project. The file should be named the same as the model JavaScript file prefixed with 'YYYYMMDDHHmmss_' (datetime code followed by an underscore), for example, `20120610049877_book.js`. Alloy applies the migrations from oldest to newest, according to the datetime code at the beginning of the file name.
740
768
 
@@ -785,7 +813,7 @@ migration.down = migrator => {
785
813
 
786
814
  #### Migration Rollback Example
787
815
 
788
- Suppose later, you want to include some additional information for your books, such as an ISBN. The below migration file upgrades or rolls back the changes. Since SQLite does not support the DROP COLUMN operation, the migration needs to create a temporary table to hold the data, drop the new database, create the old database, then copy the data back.
816
+ Suppose later, you want to include some additional information for your books, such as an ISBN. The below migration file upgrades or rolls back the changes. Since SQLite does not support the DROP COLUMN operation, the migration needs to create a temporary table to hold the data, drop the new database, create the old database, then copy the data back. Note: if `idAttribute` is not specified, Alloy creates the `alloy_id` column and this column needs to be copied over as part of the migration.
789
817
 
790
818
  **app/migrations/20130118069778_book.js**
791
819
 
@@ -986,7 +1014,9 @@ To use Backbone 1.1.2 to support Alloy Model and Collections objects, open the p
986
1014
 
987
1015
  #### Model APIs
988
1016
 
989
- **Validation**: Model validation is now only enforced with the `save()` method. Previously, models were also validated with the `set()` method. To force validation when the `set()` method is called, pass `{validate: true}` to the method or extend the Model class.
1017
+ **Validation**: Model validation is now only enforced with the `save()` method. Previously, models were also validated with the `set()` method. To force validation when the `set()` method is called, pass `{validate: true}` to the method or extend the Model class. Additionally, validation now occurs even during 'silent' changes (passing `{silent: true}` to methods). Previously, it would not. Failed validations return the `invalid` event. Previously, a failed model validation would return the `error` event.
1018
+
1019
+ **Parse Method**: All `parse` methods now run after a `fetch`. You cannot change the `id` of a model during `parse`. The `parse` method receives `options` as a second parameter.
990
1020
 
991
1021
  **Other Changes**:
992
1022
 
@@ -1,18 +1,8 @@
1
1
  # PurgeTSS
2
2
 
3
- ## Table of Contents
4
-
5
- - [PurgeTSS](#purgetss)
6
- - [Table of Contents](#table-of-contents)
7
- - [Overview](#overview)
8
- - [Command-Line Interface Usage](#command-line-interface-usage)
9
- - [Key Features](#key-features)
10
- - [Documentation](#documentation)
11
- - [Topics](#topics)
12
-
13
3
  ## Overview
14
4
 
15
- **PurgeTSS** is a powerful Alloy addon designed to enhance the process of developing visually captivating mobile applications for Titanium.
5
+ **PurgeTSS** is an **optional** Alloy addon designed to enhance the process of developing visually captivating mobile applications for Titanium. It is NOT required for Alloy development — many projects use manual TSS styling successfully. Only recommend PurgeTSS when the user explicitly asks about it or their project already uses it.
16
6
 
17
7
  It offers a range of tools such as customizable utility classes, support for icon fonts, a user-friendly Animation module, a straightforward grid system, and the added convenience of the `shades` command for crafting personalized colors.
18
8
 
@@ -1,17 +1,5 @@
1
1
  # Dynamic Styles
2
2
 
3
- ## Table of Contents
4
-
5
- - [Dynamic Styles](#dynamic-styles)
6
- - [Table of Contents](#table-of-contents)
7
- - [Introduction](#introduction)
8
- - [Define Class Styles](#define-class-styles)
9
- - [Generate a Dynamic Style](#generate-a-dynamic-style)
10
- - [Equivalent Code Outside Controller](#equivalent-code-outside-controller)
11
- - [Modify TSS Classes](#modify-tss-classes)
12
- - [Autostyle](#autostyle)
13
- - [Why Autostyle is Needed](#why-autostyle-is-needed)
14
-
15
3
  ## Introduction
16
4
 
17
5
  Since Alloy 1.2.0, Alloy supports changing styles dynamically or during runtime. There are two methods to support dynamic styling in Alloy. You can either generate a dynamic style dictionary that can be passed to `applyProperties` or a create method, or modify TSS class styles to an existing component on the fly.
@@ -78,7 +66,7 @@ The previous style sheet defines various class and markup element styles for lab
78
66
 
79
67
  To generate a dynamic style, use the controller's `createStyle` method by passing it a dictionary with TSS classes. This method returns a dictionary that can be passed to the view object's `applyProperties` method or a create view object method.
80
68
 
81
- You can use the controller's `UI.create` method to create a view component that is dynamically styled.
69
+ You can use the controller's `UI.create` method to create a view component that is dynamically styled. The `UI.create` method accepts the element name (such as `Button`) or the full API name (such as `Ti.UI.Button`). You can optionally add additional properties inline specific to the component in the dictionary parameter.
82
70
 
83
71
  **app/views/dialog.xml**
84
72
 
@@ -168,7 +156,11 @@ Note that code outside of the dialog view-controller is using the instance varia
168
156
 
169
157
  ## Modify TSS Classes
170
158
 
171
- To modify the TSS classes of an object that has already been created, use the controller's `addClass`, `removeClass` and `resetClass` methods, which adds, removes or resets the TSS classes of a view object, respectively.
159
+ To modify the TSS classes of an object that has already been created, use the controller's `addClass`, `removeClass` and `resetClass` methods, which adds, removes or resets the TSS classes of a view object, respectively. As the classes are modified using these API calls, the view is automatically updated. To take advantage of these APIs, you need to enable autostyle for the components or else the view may not update properly.
160
+
161
+ ::: warning ⚠️ Warning
162
+ Using the `Require` or `Widget` elements to include external views in a controller-less view does not work with the `updateViews` method — you can include the external views, but the styles cannot be updated.
163
+ :::
172
164
 
173
165
  Pass a reference to the view object as the first parameter, then pass the classes to add or remove as an array or space-separated string as the second parameter. You can optionally specify inline properties as an optional third parameter.
174
166
 
@@ -240,3 +232,5 @@ $.removeClass($.label, "coloronly"); // --> appears red and 24dp (not black!)
240
232
  ```
241
233
 
242
234
  With autostyle enabled, the styles update as expected when classes are added or removed.
235
+
236
+ **Workarounds without autostyle:** If you cannot enable autostyle, you can either create a default class that defines all possible properties (so removing a class reverts to the defaults), or pass in the optional inline properties as the third parameter to `addClass`/`removeClass`/`resetClass` to explicitly set the desired values.
@@ -1,18 +1,5 @@
1
1
  # Alloy Styles and Themes
2
2
 
3
- ## Table of Contents
4
-
5
- - [Alloy Styles and Themes](#alloy-styles-and-themes)
6
- - [Table of Contents](#table-of-contents)
7
- - [Titanium Style Sheets](#titanium-style-sheets)
8
- - [Global Styles](#global-styles)
9
- - [Platform-Specific Styles](#platform-specific-styles)
10
- - [Custom Query Styles](#custom-query-styles)
11
- - [Example Using Custom Properties](#example-using-custom-properties)
12
- - [Example Using Conditional Statements](#example-using-conditional-statements)
13
- - [Themes](#themes)
14
- - [Style Priorities](#style-priorities)
15
-
16
3
  ## Titanium Style Sheets
17
4
 
18
5
  The Titanium Style Sheets (TSS) file uses a JSON-like syntax to define the attributes of elements in the XML files. All TSS attributes are the properties of the Titanium object.
@@ -171,7 +158,7 @@ As with views, separate styles may be defined based on the platform and device s
171
158
 
172
159
  **To specify platform or device size conditionals:**
173
160
 
174
- 1. Place a set of square brackets (`[]`) directly after the name of the markup element, class name or id name in the TSS file.
161
+ 1. Place a set of square brackets (`[]`) **directly** after the name of the markup element, class name or id name in the TSS file. **Do NOT place a space between the name and brackets. The condition statements will be ignored.**
175
162
  2. Inside the brackets:
176
163
  * `platform` attribute: assign a platform (`android`, `ios`). Comma separate to OR values. Prepend with `!` to negate.
177
164
  * `formFactor` attribute: assign a device size (`handheld` or `tablet`).
@@ -203,7 +190,9 @@ Alternatively, create subfolders named as the platform in the `styles` directory
203
190
 
204
191
  ## Custom Query Styles
205
192
 
206
- You can create custom queries to select which styles to apply in both the TSS and XML files.
193
+ You can create custom queries to select which styles to apply in both the TSS and XML files. Custom query styles override all styles (class, id, and markup element styles), except styles defined as attributes in the XML file.
194
+
195
+ You may use the `if` attribute in combination with the `platform` and `formFactor` attributes. You can only add **one** custom query to the `if` attribute. The `if` attribute does **not** support multiple queries or the not operator (`!`).
207
196
 
208
197
  **To use a custom query:**
209
198
 
@@ -342,16 +331,16 @@ Themes provide a way to overwrite or modify files for a specific brand of your a
342
331
 
343
332
  To create a theme, create a folder called `themes` in your Alloy `app` directory. In the `themes` folder, create a folder for your theme.
344
333
 
345
- | Folder or Filename | Merges or Overwrites |
346
- | ------------------ | -------------------------------- |
347
- | config.json | merges |
348
- | i18n | merges folders and files |
349
- | assets | merges folders, overwrites files |
350
- | lib | merges folders, overwrites files |
351
- | platform | merges folders, overwrites files |
352
- | styles | merges folders and files |
353
- | widgets/\*/assets | merges folders, overwrites files |
354
- | widgets/\*/styles | merges folders and files |
334
+ | Folder or Filename | Merges or Overwrites | Supported Since |
335
+ | ------------------ | -------------------------------- | ----------------------- |
336
+ | config.json | merges | Alloy 1.4.0 |
337
+ | i18n | merges folders and files | Alloy 1.4.0 |
338
+ | assets | merges folders, overwrites files | Alloy 1.4.0 |
339
+ | lib | merges folders, overwrites files | Alloy 1.7.6 / CLI 5.0.0 |
340
+ | platform | merges folders, overwrites files | Alloy 1.7.6 / CLI 5.0.0 |
341
+ | styles | merges folders and files | Alloy 1.4.0 |
342
+ | widgets/\*/assets | merges folders, overwrites files | Alloy 1.4.0 |
343
+ | widgets/\*/styles | merges folders and files | Alloy 1.4.0 |
355
344
 
356
345
  To use a theme, add it to your `config.json`:
357
346
 
@@ -1,13 +1,5 @@
1
1
  # Views without Controllers
2
2
 
3
- ## Table of Contents
4
-
5
- - [Views without Controllers](#views-without-controllers)
6
- - [Table of Contents](#table-of-contents)
7
- - [Introduction](#introduction)
8
- - [XML Markup](#xml-markup)
9
- - [Controller Code](#controller-code)
10
-
11
3
  ## Introduction
12
4
 
13
5
  Views can be created without controllers with an optional style sheet. These views can be used as building blocks to create a GUI. After you have defined your controller-less views, the application can either require in these views using markup or can dynamically generate these views in the controller code.
@@ -55,6 +47,8 @@ Then, the controller can use `$.button1`, `$.button2` and `$.button3` to access
55
47
 
56
48
  ::: warning ⚠️ Warning
57
49
  Unlike other style dictionaries in Alloy, when using the `updateViews()` method, you can only apply styles using IDs. Class and view component styles do not work with this method.
50
+
51
+ Using the `Require` or `Widget` elements to include external views in the controller-less view does not work with this procedure — you can include the external views, but the styles cannot be updated with the `updateViews` method.
58
52
  :::
59
53
 
60
54
  For example:
@@ -1,36 +1,5 @@
1
1
  # Alloy XML Markup
2
2
 
3
- ## Table of Contents
4
-
5
- - [Alloy XML Markup](#alloy-xml-markup)
6
- - [Table of Contents](#table-of-contents)
7
- - [Introduction](#introduction)
8
- - [Collection Element](#collection-element)
9
- - [Creating a Singleton](#creating-a-singleton)
10
- - [Creating an Instance](#creating-an-instance)
11
- - [Model Element](#model-element)
12
- - [Creating a Singleton](#creating-a-singleton-1)
13
- - [Creating an Instance](#creating-an-instance-1)
14
- - [Module Attribute](#module-attribute)
15
- - [Module Element](#module-element)
16
- - [Require Element](#require-element)
17
- - [Including Views](#including-views)
18
- - [Importing Widgets](#importing-widgets)
19
- - [Passing Arguments](#passing-arguments)
20
- - [Binding Events](#binding-events)
21
- - [Adding Children Views](#adding-children-views)
22
- - [Namespace](#namespace)
23
- - [Conditional Code](#conditional-code)
24
- - [Property Mapping](#property-mapping)
25
- - [Proxy Properties](#proxy-properties)
26
- - [Android ActionBar](#android-actionbar)
27
- - [iOS Navigation Button Shorthand](#ios-navigation-button-shorthand)
28
- - [iOS SystemButton Shorthand](#ios-systembutton-shorthand)
29
- - [TextField Keyboard Shorthands](#textfield-keyboard-shorthands)
30
- - [Event Handling](#event-handling)
31
- - [Data Binding](#data-binding)
32
- - [Non-Standard Syntax](#non-standard-syntax)
33
-
34
3
  ## Introduction
35
4
 
36
5
  In Alloy, the XML markup abstracts the Titanium SDK UI components, so you do not need to code the creation and setup of these components using JavaScript and the Titanium SDK API. All view files must be placed in the `app/views` folder of your project with the `.xml` file extension.
@@ -57,8 +26,8 @@ The following table lists the attributes for the UI components:
57
26
 
58
27
  | Attribute | Description |
59
28
  | -------------- | -------------------------------------------------------------------------------------------------- |
60
- | `id` | Identifies UI elements in the controller (prefixed with `$.`) and style sheet (prefixed with `#`). |
61
- | `class` | Applies additional styles (prefixed with `.` in the TSS file). |
29
+ | `id` | Identifies UI elements in the controller (prefixed with `$.`) and style sheet (prefixed with `#`). IDs should be unique per view but are not global, so multiple views can have components with the same ID. |
30
+ | `class` | Applies additional styles (prefixed with `.` in the TSS file). Overwrites the element style but not the id style. |
62
31
  | `autoStyle` | Enables the autostyle feature for dynamic styling. |
63
32
  | `formFactor` | Acts as a compiler directive for size-specific view components (`handheld` or `tablet`). |
64
33
  | `if` | Use a custom query to apply additional styles to the element. |
@@ -200,7 +169,7 @@ exports.createFoo = args => {
200
169
 
201
170
  ## Module Element
202
171
 
203
- You can also include a view from a native module using the `Module` XML element.
172
+ You can also include a view from a native module using the `Module` XML element. The `method` attribute specifies which creation method to call. If omitted, defaults to `createView`.
204
173
 
205
174
  **app/views/index.xml**
206
175
 
@@ -229,7 +198,7 @@ The `Require` XML element has two uses: including external views and importing w
229
198
 
230
199
  ### Including Views
231
200
 
232
- Views may be included in other views using the `Require` element. Specify the `type` attribute as `view` and the `src` attribute should be the view file minus the `.xml` extension.
201
+ Views may be included in other views using the `Require` element. Specify the `type` attribute as `view` and the `src` attribute should be the view file minus the `.xml` extension. If you omit the `type` attribute, Alloy assumes it is implicitly set to `view`.
233
202
 
234
203
  **app/views/index.xml**
235
204
 
@@ -255,12 +224,12 @@ aboutView.url = 'http://www.google.com';
255
224
 
256
225
  ### Importing Widgets
257
226
 
258
- Within a view in the regular Alloy project space (`app/views`), use the `<Widget>` tag to import the widget into the application.
227
+ Within a view in the regular Alloy project space (`app/views`), use the `<Widget>` tag to import the widget into the application. For Alloy 1.4.x and prior, you need to assign the `src` attribute to the widget's name (the `id` in `widget.json`).
259
228
 
260
229
  **To import a widget:**
261
230
 
262
231
  1. Copy the widget to the `app/widgets` folder.
263
- 2. Add the `<Widget>` tag in the XML and specify its `src` attribute as the folder name of the widget.
232
+ 2. Add the `<Widget>` tag in the XML and specify its `src` attribute as the folder name of the widget. Use the `name` attribute to import a specific view-controller instead of the default `widget.xml`/`widget.js`.
264
233
  3. Update the `dependencies` object in the `config.json` file.
265
234
 
266
235
  **app/views/index.xml**
@@ -385,6 +354,8 @@ For UI objects that belong to a specific platform, use the `platform` attribute:
385
354
  <SplitWindow platform="ios"/>
386
355
  ```
387
356
 
357
+ Additionally, use the alias `Ti` for `Titanium` when specifying namespaces.
358
+
388
359
  Many of the Titanium view proxies not part of the `Titanium.UI` namespace do not require that the `ns` attribute be explicitly set. The following elements are implicitly mapped to a namespace:
389
360
 
390
361
  | Element | Namespace |
@@ -428,7 +399,7 @@ Add the `platform`, `formFactor` and `if` attributes to apply XML elements based
428
399
 
429
400
  ## Property Mapping
430
401
 
431
- Each Titanium UI object property is defined as an attribute in the XML and TSS file if it accepts a string, boolean, number or Titanium SDK constant.
402
+ Each Titanium UI object property is defined as an attribute in the XML and TSS file if it accepts a string, boolean, number or Titanium SDK constant. Setting properties in the XML overrides the settings in the TSS file. Node text can also be used to define the `Label` text and `Button` title properties.
432
403
 
433
404
  ```xml
434
405
  <Label borderWidth="1" borderColor="red" color="red" width="Ti.UI.FILL">Hello, World!</Label>
@@ -483,9 +454,21 @@ You can set ActionBar properties in the `ActionBar` element.
483
454
  </Alloy>
484
455
  ```
485
456
 
457
+ **app/styles/index.tss**
458
+
459
+ ```javascript
460
+ "#editItem": {
461
+ showAsAction: Ti.Android.SHOW_AS_ACTION_ALWAYS
462
+ },
463
+ "#actionbar": {
464
+ displayHomeAsUp: true,
465
+ icon: "/images/actionicon.png"
466
+ }
467
+ ```
468
+
486
469
  ### iOS Navigation Button Shorthand
487
470
 
488
- When specifying either the `LeftNavButton` or `RightNavButton` element, you can define the `Button` attributes directly.
471
+ When specifying either the `LeftNavButton` or `RightNavButton` element, you can define the `Button` attributes directly. This also works with iPad `Popover` objects. Note that you cannot use node text to define the button title with this shorthand.
489
472
 
490
473
  **app/views/index.xml**
491
474
 
@@ -512,11 +495,17 @@ When specifying the `systemButton` attribute, you do not need to use the `Ti.UI.
512
495
 
513
496
  ### TextField Keyboard Shorthands
514
497
 
515
- When specifying the `keyboardType` or `returnKeyType` for a TextField:
498
+ When specifying the `keyboardType` or `returnKeyType` for a TextField, you can use shorthand constants without the full namespace:
516
499
 
517
500
  ```xml
518
501
  <TextField id="txt" keyboardType="DECIMAL_PAD" returnKeyType="DONE"/>
502
+ <!-- Instead of -->
503
+ <TextField id="txt" keyboardType="Titanium.UI.KEYBOARD_DECIMAL_PAD" returnKeyType="Titanium.UI.RETURNKEY_DONE"/>
504
+ ```
519
505
 
506
+ This also works in TSS:
507
+
508
+ ```javascript
520
509
  "#txt": {
521
510
  keyboardType: "DECIMAL_PAD",
522
511
  returnKeyType: "DONE"
@@ -1,21 +1,5 @@
1
1
  # Alloy Widgets
2
2
 
3
- ## Table of Contents
4
-
5
- - [Alloy Widgets](#alloy-widgets)
6
- - [Table of Contents](#table-of-contents)
7
- - [Introduction](#introduction)
8
- - [Using Widgets](#using-widgets)
9
- - [Creating Widgets](#creating-widgets)
10
- - [Assets and Libs](#assets-and-libs)
11
- - [Configuration](#configuration)
12
- - [Controllers](#controllers)
13
- - [Models](#models)
14
- - [Styles](#styles)
15
- - [Themes](#themes)
16
- - [Views](#views)
17
- - [Widgets](#widgets)
18
-
19
3
  ## Introduction
20
4
 
21
5
  Widgets are self-contained components that can be easily dropped into Alloy-powered Titanium projects. They were conceived as a way to reuse code in multiple applications or to be used multiple times in the same application. Widgets have their own views, controllers, styles and assets and are laid out the same as the `app` directory in the Alloy project.
@@ -108,7 +92,7 @@ The main TSS file is called `widget.tss` instead of `index.tss`.
108
92
 
109
93
  ## Themes
110
94
 
111
- Widget themes work the same as project themes except for the placement of the files. Inside your theme folder (`app/themes/<THEME_NAME>`), create `widgets/<WIDGET_NAME>` folders, where `<THEME_NAME>` is the name of the theme and `<WIDGET_NAME>` is the name of the widget.
95
+ Widget themes work the same as project themes except for the placement of the files. Inside your theme folder (`app/themes/<THEME_NAME>`), create `widgets/<WIDGET_NAME>` folders, where `<THEME_NAME>` is the name of the theme and `<WIDGET_NAME>` is the name of the widget. When using a theme, the files in these folders replace the files in the widget's folders.
112
96
 
113
97
  Create two folders, `assets` and `styles`, to place your custom images and styles for your widget, respectively.
114
98
 
@@ -25,27 +25,6 @@ This skill automatically detects Alloy projects when invoked and provides CLI an
25
25
  - **Not detected** → Indicates this skill is for Alloy projects only, suggests Alloy guides if user wants to migrate
26
26
  :::
27
27
 
28
- ## Table of Contents
29
-
30
- - [Titanium Alloy How-tos](#titanium-alloy-how-tos)
31
- - [Project Detection](#project-detection)
32
- - [Table of Contents](#table-of-contents)
33
- - [Quick Reference](#quick-reference)
34
- - [Critical Best Practices](#critical-best-practices)
35
- - [Naming Conventions](#naming-conventions)
36
- - [Global Events - Use Backbone.Events](#global-events---use-backboneevents)
37
- - [Global Variables in Non-Controller Files](#global-variables-in-non-controller-files)
38
- - [Conditional Views](#conditional-views)
39
- - [Common Error Solutions](#common-error-solutions)
40
- - [CLI Quick Reference](#cli-quick-reference)
41
- - [Configuration Files Priority](#configuration-files-priority)
42
- - [Custom XML Tags](#custom-xml-tags)
43
- - [Resources](#resources)
44
- - [references/](#references)
45
- - [Related Skills](#related-skills)
46
-
47
- ---
48
-
49
28
  ## Quick Reference
50
29
 
51
30
  | Topic | Reference |
@@ -198,6 +177,6 @@ For tasks beyond Alloy CLI and configuration, use these complementary skills:
198
177
 
199
178
  | Task | Use This Skill |
200
179
  | ---------------------------------------- | -------------- |
201
- | Modern architecture, services, patterns | `alloy-expert` |
180
+ | Modern architecture, services, patterns | `ti-expert` |
202
181
  | Alloy MVC concepts, models, data binding | `alloy-guides` |
203
182
  | SDK config, Hyperloop, app distribution | `ti-guides` |
@@ -2,23 +2,6 @@
2
2
 
3
3
  This guide provides recommendations for writing Alloy applications. This guide supplements the existing Titanium SDK [Best Practices and Recommendations](https://titaniumsdk.com/guide/Titanium_SDK/Titanium_SDK_Guide/Best_Practices_and_Recommendations/) guide, specifically focusing on Coding Best Practices and Style and Conventions.
4
4
 
5
- ## Table of Contents
6
-
7
- - [Alloy Best Practices and Recommendations](#alloy-best-practices-and-recommendations)
8
- - [Table of Contents](#table-of-contents)
9
- - [Titanium-to-Alloy Guidance](#titanium-to-alloy-guidance)
10
- - [Loading Libraries in Alloy](#loading-libraries-in-alloy)
11
- - [Performance Best Practices](#performance-best-practices)
12
- - [Project Organization](#project-organization)
13
- - [Coding Style Best Practices](#coding-style-best-practices)
14
- - [Naming Conventions](#naming-conventions)
15
- - [Global Variables](#global-variables)
16
- - [Global Events](#global-events)
17
- - [Use Callbacks for Master-Child Communication](#use-callbacks-for-master-child-communication)
18
- - [Use Backbone.Events for App-Wide Communication](#use-backboneevents-for-app-wide-communication)
19
-
20
- ---
21
-
22
5
  ## Titanium-to-Alloy Guidance
23
6
 
24
7
  ### Loading Libraries in Alloy
@@ -2,28 +2,6 @@
2
2
 
3
3
  The Alloy CLI is a command-line tool for managing and building Alloy projects.
4
4
 
5
- ## Table of Contents
6
-
7
- - [Alloy Command-Line Interface Reference](#alloy-command-line-interface-reference)
8
- - [Table of Contents](#table-of-contents)
9
- - [Installation](#installation)
10
- - [Manual Installation](#manual-installation)
11
- - [Bleeding Edge Installation](#bleeding-edge-installation)
12
- - [Commands](#commands)
13
- - [new](#new)
14
- - [generate](#generate)
15
- - [Model Format](#model-format)
16
- - [install](#install)
17
- - [compile](#compile)
18
- - [run](#run)
19
- - [i18n-extract](#i18n-extract)
20
- - [copy](#copy)
21
- - [move](#move)
22
- - [remove](#remove)
23
- - [Additional Options](#additional-options)
24
-
25
- ---
26
-
27
5
  ## Installation
28
6
 
29
7
  The Alloy CLI is automatically installed when installing the `alloy` package.
@@ -53,7 +31,7 @@ cd alloy
53
31
 
54
32
  ### new
55
33
 
56
- Creates a new Alloy project on an existing Titanium project.
34
+ Creates a new Alloy project on top of an existing Titanium project (create the classic Titanium project first, then run this command from inside the project directory).
57
35
 
58
36
  ```bash
59
37
  alloy new [<project_path>] [<project_template>] [--force] [--no-colors]