@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.
Files changed (99) hide show
  1. package/README.md +255 -713
  2. package/bin/titools.js +1 -1
  3. package/lib/commands/update.js +5 -6
  4. package/lib/config.js +1 -0
  5. package/lib/downloader.js +10 -0
  6. package/package.json +1 -1
  7. package/skills/alloy-guides/SKILL.md +46 -48
  8. package/skills/alloy-guides/references/CONTROLLERS.md +4 -6
  9. package/skills/alloy-guides/references/MODELS.md +340 -184
  10. package/skills/alloy-guides/references/VIEWS_DYNAMIC.md +3 -4
  11. package/skills/alloy-guides/references/VIEWS_STYLES.md +44 -46
  12. package/skills/alloy-guides/references/VIEWS_WITHOUT_CONTROLLERS.md +4 -5
  13. package/skills/alloy-guides/references/VIEWS_XML.md +51 -17
  14. package/skills/alloy-guides/references/WIDGETS.md +1 -1
  15. package/skills/alloy-howtos/SKILL.md +12 -13
  16. package/skills/alloy-howtos/references/cli_reference.md +40 -41
  17. package/skills/alloy-howtos/references/samples.md +3 -4
  18. package/skills/purgetss/SKILL.md +369 -356
  19. package/skills/purgetss/references/EXAMPLES.md +24 -25
  20. package/skills/purgetss/references/animation-advanced.md +555 -0
  21. package/skills/purgetss/references/animation-system.md +395 -995
  22. package/skills/purgetss/references/apply-directive.md +111 -141
  23. package/skills/purgetss/references/arbitrary-values.md +206 -480
  24. package/skills/purgetss/references/class-categories.md +277 -0
  25. package/skills/purgetss/references/class-index.md +1 -420
  26. package/skills/purgetss/references/cli-commands.md +446 -556
  27. package/skills/purgetss/references/configurable-properties.md +163 -599
  28. package/skills/purgetss/references/custom-rules.md +33 -76
  29. package/skills/purgetss/references/customization-deep-dive.md +319 -518
  30. package/skills/purgetss/references/dynamic-component-creation.md +33 -37
  31. package/skills/purgetss/references/grid-layout.md +42 -371
  32. package/skills/purgetss/references/icon-fonts.md +82 -475
  33. package/skills/purgetss/references/installation-setup.md +159 -331
  34. package/skills/purgetss/references/migration-guide.md +54 -109
  35. package/skills/purgetss/references/opacity-modifier.md +25 -222
  36. package/skills/purgetss/references/performance-tips.md +2 -2
  37. package/skills/purgetss/references/platform-modifiers.md +21 -407
  38. package/skills/purgetss/references/tikit-components.md +237 -104
  39. package/skills/purgetss/references/titanium-resets.md +20 -21
  40. package/skills/purgetss/references/ui-ux-design.md +171 -1702
  41. package/skills/ti-api/SKILL.md +109 -0
  42. package/skills/ti-api/references/api-android.md +675 -0
  43. package/skills/ti-api/references/api-app-platform.md +636 -0
  44. package/skills/ti-api/references/api-core.md +764 -0
  45. package/skills/ti-api/references/api-data-network.md +641 -0
  46. package/skills/ti-api/references/api-media.md +655 -0
  47. package/skills/ti-api/references/api-modules-ble-bluetooth.md +657 -0
  48. package/skills/ti-api/references/api-modules-coremotion-urlsession.md +411 -0
  49. package/skills/ti-api/references/api-modules-map.md +632 -0
  50. package/skills/ti-api/references/api-modules-nfc.md +725 -0
  51. package/skills/ti-api/references/api-modules-social-misc.md +526 -0
  52. package/skills/ti-api/references/api-services.md +700 -0
  53. package/skills/ti-api/references/api-ui-android.md +499 -0
  54. package/skills/ti-api/references/api-ui-extras.md +702 -0
  55. package/skills/ti-api/references/api-ui-ios-animator.md +378 -0
  56. package/skills/ti-api/references/api-ui-ios.md +756 -0
  57. package/skills/ti-api/references/api-ui-lists.md +581 -0
  58. package/skills/ti-api/references/api-ui-text-input.md +607 -0
  59. package/skills/ti-api/references/api-ui-views.md +572 -0
  60. package/skills/ti-api/references/api-ui-windows-navigation.md +676 -0
  61. package/skills/ti-api/references/api-xml-global.md +743 -0
  62. package/skills/ti-expert/SKILL.md +106 -138
  63. package/skills/ti-expert/references/adaptive-layouts.md +414 -0
  64. package/skills/ti-expert/references/alloy-builtins.md +16 -20
  65. package/skills/ti-expert/references/alloy-structure.md +40 -42
  66. package/skills/ti-expert/references/anti-patterns.md +34 -0
  67. package/skills/ti-expert/references/architecture-tiers.md +248 -0
  68. package/skills/ti-expert/references/code-conventions.md +5 -3
  69. package/skills/ti-expert/references/error-handling.md +14 -7
  70. package/skills/ti-expert/references/examples.md +4 -2
  71. package/skills/ti-expert/references/performance-optimization.md +26 -24
  72. package/skills/ti-expert/references/security-device.md +17 -14
  73. package/skills/ti-expert/references/security-fundamentals.md +60 -101
  74. package/skills/ti-expert/references/state-management.md +15 -14
  75. package/skills/ti-expert/references/testing-e2e-ci.md +30 -21
  76. package/skills/ti-expert/references/theming.md +12 -20
  77. package/skills/ti-guides/SKILL.md +13 -17
  78. package/skills/ti-guides/references/advanced-data-and-images.md +30 -10
  79. package/skills/ti-guides/references/application-frameworks.md +3 -3
  80. package/skills/ti-guides/references/coding-best-practices.md +31 -2
  81. package/skills/ti-guides/references/commonjs-advanced.md +46 -4
  82. package/skills/ti-guides/references/hello-world.md +9 -13
  83. package/skills/ti-guides/references/hyperloop-native-access.md +4 -1
  84. package/skills/ti-guides/references/javascript-primer.md +13 -5
  85. package/skills/ti-guides/references/resources.md +0 -2
  86. package/skills/ti-guides/references/style-and-conventions.md +1 -0
  87. package/skills/ti-guides/references/tiapp-config.md +0 -32
  88. package/skills/ti-howtos/SKILL.md +43 -45
  89. package/skills/ti-howtos/references/buffer-codec-streams.md +25 -3
  90. package/skills/ti-howtos/references/debugging-profiling.md +14 -25
  91. package/skills/ti-howtos/references/google-maps-v2.md +3 -3
  92. package/skills/ti-howtos/references/ios-map-kit.md +8 -1
  93. package/skills/ti-howtos/references/notification-services.md +0 -1
  94. package/skills/ti-howtos/references/webpack-build-pipeline.md +3 -0
  95. package/skills/ti-ui/SKILL.md +47 -49
  96. package/skills/ti-ui/references/application-structures.md +3 -2
  97. package/skills/ti-ui/references/orientation.md +17 -9
  98. package/skills/ti-ui/references/platform-ui-ios.md +63 -0
  99. package/skills/ti-ui/references/scrolling-views.md +39 -0
@@ -1,52 +1,45 @@
1
- # Custom Rules for Ti Elements, IDs, and Classes
1
+ # Custom Rules
2
2
 
3
- Custom rules in PurgeTSS allow you to style **Titanium elements**, **IDs**, and **classes** with flexibility and precision. Configure these rules in the `config.cjs` file with optional platform, device, or conditional targeting.
3
+ Custom rules in PurgeTSS let you style Titanium elements, IDs, and classes in `config.cjs`. You can also target specific platforms, devices, or conditional blocks using global variables. Handy when a project spans iOS and Android and you want to keep styles in one place.
4
4
 
5
- :::info
6
- This feature is particularly useful for meeting visual and design requirements across multiple platforms (iOS and Android).
7
- :::
5
+ ## Classes, IDs, and Ti Elements
8
6
 
9
- ## Naming Conventions
7
+ Whether you want to style a Ti Element (also known as a markup element), a custom ID prefixed with a hash (`#`), or a custom class prefixed with a period (`.`), the structure is the same.
10
8
 
11
- | Target Type | Naming Convention | Example |
12
- | --------------- | ------------------ | ----------------------------------- |
13
- | **Ti Elements** | Exact element name | `Label`, `Button`, `ScrollView` |
14
- | **IDs** | camelCase | `#mainBanner`, `#sidebarWidget` |
15
- | **Classes** | kebab-case | `.my-custom-class`, `.feature-card` |
9
+ ### Modifier Key
16
10
 
17
- :::caution PurgeTSS v5 or earlier
18
- For projects upgraded from PurgeTSS v5 or earlier, set `purge.options.missing` to `true` in `config.cjs` to get a report of any missing classes at the end of `app.tss`.
19
- :::
11
+ - For Titanium elements, use the exact name of the element, such as `Label`, `Button`, or `ScrollView`.
12
+ - For IDs, use `camelCase` to match the JavaScript convention.
13
+ - For classes, use `kebab-case` to stay compatible with PurgeTSS v6.x and above. For example, use `.my-custom-class-name` instead of `.myCustomClassName`.
20
14
 
21
- ## Modifier Keys
15
+ > **CAUTION -- PurgeTSS v5 or Earlier Projects**
16
+ > If your project started on PurgeTSS v5 or earlier and you now use 7.x.x or later, set `purge.options.missing` to `true` in `config.cjs`. It will report missing classes at the end of `app.tss` so you can update them to the new naming convention.
22
17
 
23
- ### Platform, Device, and Conditional Blocks
18
+ ### Default, Platform, Device, or Conditional Blocks
24
19
 
25
- | Modifier | Description |
26
- | ------------------------- | -------------------------------------- |
27
- | `DEFAULT` / `default` | Global style |
28
- | `ios` | iOS-specific |
29
- | `android` | Android-specific |
30
- | `tablet` | Tablet devices |
31
- | `handheld` | Handheld devices |
32
- | `[if=globalVariableName]` | Conditional block with global variable |
20
+ - To generate a global style, use either the lowercase `default` or the uppercase `DEFAULT` keyword.
21
+ - To target a specific platform, use the `ios` or `android` keywords.
22
+ - To target a specific device, use the `tablet` or `handheld` keywords.
23
+ - To target a condition with a global variable, use the `[if=globalVariableName]` keyword.
33
24
 
34
- ## Property Values
25
+ ### Property Values
35
26
 
36
- - **Titanium constants, Alloy config, Global Variables**: Always enclose in quotes
37
- - **Colors**: hex, 8-digit hex, `rgb(R,G,B)`, `rgba(R,G,B,A)`, `transparent`, or color names
38
- - **Spacing**: `em`, `rem`, `%`, `px`, `dp`, `cm`, or `in`
39
- - `%`, `px`, `cm`, `in` - Passed without conversion
40
- - `em` / `rem` - Converted: `value * 16`
41
- - `dp` - Unit removed, value intact
27
+ - For `Titanium` constants, `Alloy Configuration Values`, or `Global Variables`, always enclose them in quotes.
28
+ - For `color` values, you can use `hex`, `8-digit hex`, `rgb(R,G,B)`, `rgba(R,G,B,A)`, `transparent`, or any of the standard color names. Use hex values if you want to avoid issues with the opacity modifier.
29
+ - For `spacing` values, you can use different types of units: `em`, `rem`, `%`, `px`, `dp`, `cm`, or `in`.
30
+ - `%`, `px`, `cm`, or `in` are passed through without conversion.
31
+ - `em` or `rem` values are converted with this formula: `value * 16`.
32
+ - `dp` removes the unit and keeps the value as-is.
42
33
 
43
- ## Config Example
34
+ > **Platform-Specific Constants**
35
+ > If a rule uses `Ti.UI.iOS.*` or `Ti.UI.Android.*` constants, keep that property inside the matching `ios` or `android` block to avoid cross-platform compilation failures.
44
36
 
37
+ ## `config.cjs` File Example
38
+
39
+ `./purgetss/config.cjs`
45
40
  ```javascript
46
- // purgetss/config.cjs
47
41
  module.exports = {
48
42
  theme: {
49
- // ID with platform-specific styles
50
43
  '#main-banner': {
51
44
  DEFAULT: {
52
45
  width: '300px',
@@ -56,8 +49,6 @@ module.exports = {
56
49
  clipMode: 'Ti.UI.iOS.CLIP_MODE_DISABLED'
57
50
  }
58
51
  },
59
-
60
- // Class with device targeting
61
52
  '.gallery': {
62
53
  DEFAULT: {
63
54
  height: 'Ti.UI.SIZE'
@@ -75,8 +66,6 @@ module.exports = {
75
66
  width: '500px'
76
67
  }
77
68
  },
78
-
79
- // Ti Element with conditional block
80
69
  TextField: {
81
70
  DEFAULT: {
82
71
  top: 10,
@@ -92,56 +81,24 @@ module.exports = {
92
81
  }
93
82
  }
94
83
  }
95
- }
84
+ };
96
85
  ```
97
86
 
98
- ## Generated TSS Output
99
-
100
- ```css
101
- /* Ti Element */
87
+ `./purgetss/styles/utilities.tss`
88
+ ```tss
89
+ /* Property: TextField */
90
+ /* Description: A single line text field. */
102
91
  'TextField': { top: 10, left: 20, right: 20, bottom: 0 }
103
92
  'TextField[if=Alloy.Globals.iPhoneX]': { bottom: Alloy.CFG.iPhoneXNotchSize }
104
93
  'TextField[platform=android]': { touchFeedback: true }
105
94
 
106
- /* Custom IDs */
95
+ /* Custom Classes */
107
96
  '#main-banner': { width: '300px', height: '80px' }
108
97
  '#main-banner[platform=ios]': { clipMode: Ti.UI.iOS.CLIP_MODE_DISABLED }
109
98
 
110
- /* Custom Classes */
111
99
  '.gallery': { height: Ti.UI.SIZE }
112
100
  '.gallery[platform=ios]': { clipMode: Ti.UI.iOS.CLIP_MODE_ENABLED }
113
101
  '.gallery[platform=android]': { hiddenBehavior: Ti.UI.HIDDEN_BEHAVIOR_GONE }
114
102
  '.gallery[formFactor=handheld]': { width: '250px' }
115
103
  '.gallery[formFactor=tablet]': { width: '500px' }
116
104
  ```
117
-
118
- ## Complete Styling Example
119
-
120
- ```javascript
121
- // config.cjs - Styling a custom card component
122
- module.exports = {
123
- theme: {
124
- '.card': {
125
- DEFAULT: {
126
- apply: 'bg-white rounded-lg shadow-md p-4 m-2'
127
- },
128
- ios: {
129
- apply: 'ios:shadow-offset-0'
130
- }
131
- },
132
- '.card-title': {
133
- DEFAULT: {
134
- apply: 'text-lg font-bold text-gray-900 mb-2'
135
- }
136
- },
137
- '.card-button': {
138
- DEFAULT: {
139
- apply: 'bg-blue-500 text-white px-4 py-2 rounded mt-4'
140
- },
141
- android: {
142
- apply: 'android:ripple-enabled'
143
- }
144
- }
145
- }
146
- }
147
- ```