@maccesar/titools 2.2.11 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +255 -713
- package/bin/titools.js +1 -1
- package/lib/commands/update.js +5 -6
- package/lib/config.js +1 -0
- package/lib/downloader.js +10 -0
- package/package.json +1 -1
- package/skills/alloy-guides/SKILL.md +46 -48
- package/skills/alloy-guides/references/CONTROLLERS.md +4 -6
- package/skills/alloy-guides/references/MODELS.md +340 -184
- package/skills/alloy-guides/references/VIEWS_DYNAMIC.md +3 -4
- package/skills/alloy-guides/references/VIEWS_STYLES.md +44 -46
- package/skills/alloy-guides/references/VIEWS_WITHOUT_CONTROLLERS.md +4 -5
- package/skills/alloy-guides/references/VIEWS_XML.md +51 -17
- package/skills/alloy-guides/references/WIDGETS.md +1 -1
- package/skills/alloy-howtos/SKILL.md +12 -13
- package/skills/alloy-howtos/references/cli_reference.md +40 -41
- package/skills/alloy-howtos/references/samples.md +3 -4
- package/skills/purgetss/SKILL.md +369 -356
- package/skills/purgetss/references/EXAMPLES.md +24 -25
- package/skills/purgetss/references/animation-advanced.md +555 -0
- package/skills/purgetss/references/animation-system.md +395 -995
- package/skills/purgetss/references/apply-directive.md +111 -141
- package/skills/purgetss/references/arbitrary-values.md +206 -480
- package/skills/purgetss/references/class-categories.md +277 -0
- package/skills/purgetss/references/class-index.md +1 -420
- package/skills/purgetss/references/cli-commands.md +446 -556
- package/skills/purgetss/references/configurable-properties.md +163 -599
- package/skills/purgetss/references/custom-rules.md +33 -76
- package/skills/purgetss/references/customization-deep-dive.md +319 -518
- package/skills/purgetss/references/dynamic-component-creation.md +33 -37
- package/skills/purgetss/references/grid-layout.md +42 -371
- package/skills/purgetss/references/icon-fonts.md +82 -475
- package/skills/purgetss/references/installation-setup.md +159 -331
- package/skills/purgetss/references/migration-guide.md +54 -109
- package/skills/purgetss/references/opacity-modifier.md +25 -222
- package/skills/purgetss/references/performance-tips.md +2 -2
- package/skills/purgetss/references/platform-modifiers.md +21 -407
- package/skills/purgetss/references/tikit-components.md +237 -104
- package/skills/purgetss/references/titanium-resets.md +20 -21
- package/skills/purgetss/references/ui-ux-design.md +171 -1702
- package/skills/ti-api/SKILL.md +109 -0
- package/skills/ti-api/references/api-android.md +675 -0
- package/skills/ti-api/references/api-app-platform.md +636 -0
- package/skills/ti-api/references/api-core.md +764 -0
- package/skills/ti-api/references/api-data-network.md +641 -0
- package/skills/ti-api/references/api-media.md +655 -0
- package/skills/ti-api/references/api-modules-ble-bluetooth.md +657 -0
- package/skills/ti-api/references/api-modules-coremotion-urlsession.md +411 -0
- package/skills/ti-api/references/api-modules-map.md +632 -0
- package/skills/ti-api/references/api-modules-nfc.md +725 -0
- package/skills/ti-api/references/api-modules-social-misc.md +526 -0
- package/skills/ti-api/references/api-services.md +700 -0
- package/skills/ti-api/references/api-ui-android.md +499 -0
- package/skills/ti-api/references/api-ui-extras.md +702 -0
- package/skills/ti-api/references/api-ui-ios-animator.md +378 -0
- package/skills/ti-api/references/api-ui-ios.md +756 -0
- package/skills/ti-api/references/api-ui-lists.md +581 -0
- package/skills/ti-api/references/api-ui-text-input.md +607 -0
- package/skills/ti-api/references/api-ui-views.md +572 -0
- package/skills/ti-api/references/api-ui-windows-navigation.md +676 -0
- package/skills/ti-api/references/api-xml-global.md +743 -0
- package/skills/ti-expert/SKILL.md +106 -138
- package/skills/ti-expert/references/adaptive-layouts.md +414 -0
- package/skills/ti-expert/references/alloy-builtins.md +16 -20
- package/skills/ti-expert/references/alloy-structure.md +40 -42
- package/skills/ti-expert/references/anti-patterns.md +34 -0
- package/skills/ti-expert/references/architecture-tiers.md +248 -0
- package/skills/ti-expert/references/code-conventions.md +5 -3
- package/skills/ti-expert/references/error-handling.md +14 -7
- package/skills/ti-expert/references/examples.md +4 -2
- package/skills/ti-expert/references/performance-optimization.md +26 -24
- package/skills/ti-expert/references/security-device.md +17 -14
- package/skills/ti-expert/references/security-fundamentals.md +60 -101
- package/skills/ti-expert/references/state-management.md +15 -14
- package/skills/ti-expert/references/testing-e2e-ci.md +30 -21
- package/skills/ti-expert/references/theming.md +12 -20
- package/skills/ti-guides/SKILL.md +13 -17
- package/skills/ti-guides/references/advanced-data-and-images.md +30 -10
- package/skills/ti-guides/references/application-frameworks.md +3 -3
- package/skills/ti-guides/references/coding-best-practices.md +31 -2
- package/skills/ti-guides/references/commonjs-advanced.md +46 -4
- package/skills/ti-guides/references/hello-world.md +9 -13
- package/skills/ti-guides/references/hyperloop-native-access.md +4 -1
- package/skills/ti-guides/references/javascript-primer.md +13 -5
- package/skills/ti-guides/references/resources.md +0 -2
- package/skills/ti-guides/references/style-and-conventions.md +1 -0
- package/skills/ti-guides/references/tiapp-config.md +0 -32
- package/skills/ti-howtos/SKILL.md +43 -45
- package/skills/ti-howtos/references/buffer-codec-streams.md +25 -3
- package/skills/ti-howtos/references/debugging-profiling.md +14 -25
- package/skills/ti-howtos/references/google-maps-v2.md +3 -3
- package/skills/ti-howtos/references/ios-map-kit.md +8 -1
- package/skills/ti-howtos/references/notification-services.md +0 -1
- package/skills/ti-howtos/references/webpack-build-pipeline.md +3 -0
- package/skills/ti-ui/SKILL.md +47 -49
- package/skills/ti-ui/references/application-structures.md +3 -2
- package/skills/ti-ui/references/orientation.md +17 -9
- package/skills/ti-ui/references/platform-ui-ios.md +63 -0
- package/skills/ti-ui/references/scrolling-views.md +39 -0
|
@@ -1,52 +1,45 @@
|
|
|
1
|
-
# Custom Rules
|
|
1
|
+
# Custom Rules
|
|
2
2
|
|
|
3
|
-
Custom rules in PurgeTSS
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
18
|
-
For
|
|
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
|
-
|
|
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,
|
|
18
|
+
### Default, Platform, Device, or Conditional Blocks
|
|
24
19
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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
|
-
|
|
25
|
+
### Property Values
|
|
35
26
|
|
|
36
|
-
-
|
|
37
|
-
-
|
|
38
|
-
-
|
|
39
|
-
- `%`, `px`, `cm`, `in`
|
|
40
|
-
- `em`
|
|
41
|
-
- `dp`
|
|
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
|
-
|
|
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
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
/*
|
|
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
|
|
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
|
-
```
|