@maccesar/titools 2.2.12 → 2.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.
- package/README.md +255 -713
- package/bin/titools.js +9 -1
- package/lib/cache.js +49 -0
- package/lib/commands/auto-update.js +138 -0
- package/lib/commands/skills.js +11 -0
- package/lib/commands/uninstall.js +17 -1
- package/lib/commands/update.js +5 -6
- package/lib/config.js +3 -0
- package/lib/downloader.js +10 -0
- package/lib/hooks.js +59 -0
- package/lib/utils.js +1 -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 +46 -45
- 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/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,673 +1,474 @@
|
|
|
1
|
-
# PurgeTSS Deep
|
|
1
|
+
# PurgeTSS Configuration Deep Dive
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## The `config` File
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
> **ℹ️ INFO**
|
|
6
|
+
> The configuration file is named `config.cjs` (it used to be `config.js`). The structure is the same. Legacy mode was removed in PurgeTSS v7.2.x along with its related options.
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
:::
|
|
8
|
+
By default, PurgeTSS looks for `./purgetss/config.cjs`, where you can define customizations.
|
|
10
9
|
|
|
11
|
-
##
|
|
10
|
+
## Create the `config.cjs` File
|
|
12
11
|
|
|
13
|
-
|
|
12
|
+
> **ℹ️ INFO**
|
|
13
|
+
> `config.cjs` is created automatically the first time you run `purgetss` in a project.
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
If you want a clean `config.cjs`, delete the existing one and run:
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
```bash
|
|
18
|
+
purgetss init
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
This creates a minimal `./purgetss/config.cjs` file:
|
|
18
22
|
|
|
19
23
|
```javascript
|
|
20
24
|
module.exports = {
|
|
21
25
|
purge: {
|
|
22
26
|
mode: 'all',
|
|
23
|
-
method: 'sync',
|
|
27
|
+
method: 'sync', // How to execute the auto-purging task: sync or async
|
|
28
|
+
|
|
29
|
+
// These options are passed directly to PurgeTSS
|
|
24
30
|
options: {
|
|
25
|
-
missing: true,
|
|
26
|
-
widgets: false,
|
|
27
|
-
safelist: [],
|
|
28
|
-
plugins: []
|
|
31
|
+
missing: true, // Reports missing classes
|
|
32
|
+
widgets: false, // Purges widgets too
|
|
33
|
+
safelist: [], // Array of classes to keep
|
|
34
|
+
plugins: [] // Array of properties to ignore
|
|
29
35
|
}
|
|
30
36
|
},
|
|
31
37
|
theme: {
|
|
32
38
|
extend: {}
|
|
33
39
|
}
|
|
34
|
-
}
|
|
40
|
+
};
|
|
35
41
|
```
|
|
36
42
|
|
|
37
|
-
|
|
38
|
-
Every section of the config file is optional, so you only need to specify what you'd like to change. Any missing sections will fall back to the default configuration.
|
|
39
|
-
:::
|
|
43
|
+
Every section is optional. Only add what you want to change. Anything missing falls back to the defaults.
|
|
40
44
|
|
|
41
|
-
|
|
45
|
+
## Structure
|
|
42
46
|
|
|
43
|
-
|
|
47
|
+
The config file has two main sections: `purge` and `theme`.
|
|
44
48
|
|
|
45
|
-
|
|
46
|
-
purgetss init
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
## The `purge` Section
|
|
49
|
+
### `purge` Section
|
|
50
50
|
|
|
51
|
-
The `purge` section controls how
|
|
52
|
-
|
|
53
|
-
### `mode` Property
|
|
51
|
+
The `purge` section controls how PurgeTSS removes unused classes or keeps the ones you want.
|
|
54
52
|
|
|
55
53
|
```javascript
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
**`mode: 'all'` (default)**
|
|
63
|
-
- Scans EVERYWHERE in XML files (comments, attributes, classes, IDs, Ti Elements)
|
|
64
|
-
- **REQUIRED** if you want PurgeTSS to parse any Ti Elements styled in `config.cjs`
|
|
65
|
-
- Most complete but a bit slower
|
|
66
|
-
|
|
67
|
-
**`mode: 'class'`**
|
|
68
|
-
- Searches only in `class` and ID attributes in XML files
|
|
69
|
-
- Faster processing
|
|
70
|
-
- Cannot parse Ti Elements from `config.cjs`
|
|
71
|
-
|
|
72
|
-
:::info
|
|
73
|
-
**This mode is necessary if you want PurgeTSS to parse any Ti Elements that you've styled in `config.cjs`.**
|
|
74
|
-
:::
|
|
75
|
-
|
|
76
|
-
### `method` Property
|
|
77
|
-
|
|
78
|
-
Determines how the **auto-purge** task will be executed: `sync` (default) or `async`.
|
|
79
|
-
|
|
80
|
-
:::tip
|
|
81
|
-
If you don't see any changes reflected when changing and rebuilding a project with TiKit Components and LiveView, set the compile method to `async`.
|
|
82
|
-
:::
|
|
83
|
-
|
|
84
|
-
### `options` Properties
|
|
54
|
+
module.exports = {
|
|
55
|
+
purge: {
|
|
56
|
+
mode: 'all',
|
|
57
|
+
method: 'sync', // How to execute the auto-purging task: sync or async
|
|
85
58
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
59
|
+
// These options are passed through directly to PurgeTSS
|
|
60
|
+
options: {
|
|
61
|
+
missing: true, // Reports missing classes
|
|
62
|
+
widgets: false, // Purges widgets too
|
|
63
|
+
safelist: [], // Array of classes to keep
|
|
64
|
+
plugins: [] // Array of properties to ignore
|
|
65
|
+
}
|
|
93
66
|
}
|
|
94
|
-
}
|
|
67
|
+
};
|
|
95
68
|
```
|
|
96
69
|
|
|
97
|
-
**`
|
|
98
|
-
|
|
99
|
-
Set to `true` to get a list of missing or misspelled classes at the end of `app.tss`.
|
|
70
|
+
- **`mode: 'all'`**
|
|
100
71
|
|
|
101
|
-
|
|
102
|
-
This is very useful if you want to check if you forgot to add a class definition or if you forgot to remove non-existing classes from your views, especially if you have upgraded from PurgeTSS v5 to v6.
|
|
103
|
-
:::
|
|
72
|
+
By default, PurgeTSS searches XML files everywhere: comments, attributes, classes, IDs, and Ti Elements.
|
|
104
73
|
|
|
105
|
-
|
|
74
|
+
Use this mode if you want PurgeTSS to parse Ti Elements you style in `config.cjs`.
|
|
106
75
|
|
|
107
|
-
|
|
76
|
+
- **`method: 'sync'` or `method: 'async'`**
|
|
108
77
|
|
|
109
|
-
|
|
78
|
+
The `method` setting controls how the auto-purge task runs: `sync` (default) or `async`.
|
|
110
79
|
|
|
111
|
-
|
|
80
|
+
If changes are not showing up when rebuilding a project with TiKit Components and LiveView, set the method to `async`.
|
|
112
81
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
```javascript
|
|
116
|
-
// ./purgetss/safelist.js
|
|
117
|
-
exports.safelist = [
|
|
118
|
-
'Label', 'Button', 'Window',
|
|
119
|
-
'bg-indigo-50', 'bg-indigo-100', /* ... */
|
|
120
|
-
'bg-indigo-800', 'bg-indigo-900',
|
|
121
|
-
];
|
|
122
|
-
|
|
123
|
-
// ./purgetss/config.cjs
|
|
124
|
-
module.exports = {
|
|
125
|
-
purge: {
|
|
126
|
-
options: {
|
|
127
|
-
safelist: require('./safelist')
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
```
|
|
82
|
+
- **`mode: 'class'`**
|
|
132
83
|
|
|
133
|
-
|
|
134
|
-
You should put the safelist inside the `purgetss` folder to keep everything organized.
|
|
135
|
-
:::
|
|
84
|
+
Use `class` to search only class and ID attributes in XML files.
|
|
136
85
|
|
|
137
|
-
**`options.
|
|
86
|
+
- **`options.missing`**
|
|
138
87
|
|
|
139
|
-
|
|
88
|
+
Set `missing` to `true` if you want a list of missing or misspelled classes at the end of `app.tss`.
|
|
140
89
|
|
|
141
|
-
|
|
142
|
-
plugins: [
|
|
143
|
-
'opacity', // Disable all opacity classes
|
|
144
|
-
'borderRadius' // Disable all border-radius classes
|
|
145
|
-
]
|
|
146
|
-
```
|
|
90
|
+
This is useful when you want to confirm you did not forget class definitions or when upgrading older projects.
|
|
147
91
|
|
|
148
|
-
|
|
92
|
+
- **`options.widgets`**
|
|
149
93
|
|
|
150
|
-
|
|
94
|
+
Set `widgets` to `true` to also parse all XML files under the Widgets folder.
|
|
151
95
|
|
|
152
|
-
|
|
96
|
+
- **`options.safelist`**
|
|
153
97
|
|
|
154
|
-
|
|
98
|
+
The `safelist` is a list of classes and Ti Elements you want to keep no matter the purge mode or whether they appear in XML.
|
|
155
99
|
|
|
156
|
-
|
|
157
|
-
theme: {
|
|
158
|
-
opacity: {
|
|
159
|
-
15: '0.15',
|
|
160
|
-
35: '0.35',
|
|
161
|
-
65: '0.65',
|
|
162
|
-
85: '0.85'
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
```
|
|
100
|
+
If the list is large, put it in a CommonJS module and require it in `config.cjs`:
|
|
166
101
|
|
|
167
|
-
|
|
102
|
+
```javascript
|
|
103
|
+
module.exports = {
|
|
104
|
+
purge: {
|
|
105
|
+
options: {
|
|
106
|
+
safelist: require('./safelist')
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Keep the safelist inside the `purgetss` folder:
|
|
113
|
+
|
|
114
|
+
```javascript
|
|
115
|
+
// ./purgetss/safelist.js
|
|
116
|
+
exports.safelist = [
|
|
117
|
+
'Label',
|
|
118
|
+
'Button',
|
|
119
|
+
'Window',
|
|
120
|
+
'ListView',
|
|
121
|
+
'TableView',
|
|
122
|
+
'ScrollView',
|
|
123
|
+
'ScrollableView',
|
|
124
|
+
'bg-indigo-50',
|
|
125
|
+
'bg-indigo-100',
|
|
126
|
+
'bg-indigo-800',
|
|
127
|
+
'bg-indigo-900'
|
|
128
|
+
];
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
- **`options.plugins`**
|
|
132
|
+
|
|
133
|
+
The `plugins` option lets you disable classes PurgeTSS would normally generate.
|
|
134
|
+
|
|
135
|
+
To disable specific classes, provide an array of properties (or plugins) to disable:
|
|
136
|
+
|
|
137
|
+
```javascript
|
|
138
|
+
module.exports = {
|
|
139
|
+
purge: {
|
|
140
|
+
options: {
|
|
141
|
+
plugins: [
|
|
142
|
+
'opacity',
|
|
143
|
+
'borderRadius'
|
|
144
|
+
]
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
```
|
|
168
149
|
|
|
169
|
-
|
|
170
|
-
Note that any keys you do not provide will be inherited from the default theme, so in the above example, the default theme configuration for things like colors, spacing, border radius, background position, etc. will be preserved.
|
|
171
|
-
:::
|
|
150
|
+
### `theme` Section
|
|
172
151
|
|
|
173
|
-
|
|
152
|
+
The `theme` section defines your project's color palette, type scale, font stacks, border radius values, and other properties.
|
|
174
153
|
|
|
175
154
|
```javascript
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
155
|
+
module.exports = {
|
|
156
|
+
theme: {
|
|
157
|
+
fontFamily: {
|
|
158
|
+
display: 'AlfaSlabOne-Regular',
|
|
159
|
+
body: 'BarlowSemiCondensed-Regular'
|
|
160
|
+
},
|
|
161
|
+
borderWidth: {
|
|
162
|
+
DEFAULT: 1,
|
|
163
|
+
0: 0,
|
|
164
|
+
2: 2,
|
|
165
|
+
4: 4
|
|
166
|
+
},
|
|
167
|
+
extend: {
|
|
168
|
+
colors: {
|
|
169
|
+
cyan: '#9cdbff'
|
|
170
|
+
},
|
|
171
|
+
spacing: {
|
|
172
|
+
96: '24rem',
|
|
173
|
+
128: '32rem'
|
|
174
|
+
}
|
|
180
175
|
}
|
|
181
176
|
}
|
|
182
|
-
}
|
|
177
|
+
};
|
|
183
178
|
```
|
|
184
179
|
|
|
185
|
-
|
|
180
|
+
## Overriding and Extending Properties
|
|
186
181
|
|
|
187
|
-
|
|
182
|
+
By default, your project inherits values from the default theme. You have two options depending on your goal.
|
|
188
183
|
|
|
189
|
-
|
|
190
|
-
theme: {
|
|
191
|
-
opacity: { /* ... */ }, // Override
|
|
192
|
-
extend: {
|
|
193
|
-
colors: { /* ... */ } // Extend
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
```
|
|
197
|
-
|
|
198
|
-
## Customizing Colors
|
|
199
|
-
|
|
200
|
-
### Color Object Syntax
|
|
184
|
+
### Override Properties
|
|
201
185
|
|
|
202
|
-
|
|
186
|
+
To override a default property, add it directly in the `theme` section.
|
|
203
187
|
|
|
204
188
|
```javascript
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
//
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
primary: {
|
|
214
|
-
solid: '#002359',
|
|
215
|
-
dark: '#000030',
|
|
216
|
-
transparent: '#D9002359'
|
|
217
|
-
},
|
|
218
|
-
|
|
219
|
-
// Shade scales
|
|
220
|
-
brand: {
|
|
221
|
-
50: '#edfaff',
|
|
222
|
-
100: '#d6f2ff',
|
|
223
|
-
200: '#b5eaff',
|
|
224
|
-
300: '#83dfff',
|
|
225
|
-
400: '#48cbff',
|
|
226
|
-
500: '#1eacff',
|
|
227
|
-
600: '#068eff',
|
|
228
|
-
700: '#007aff',
|
|
229
|
-
800: '#085dc5',
|
|
230
|
-
900: '#0d519b',
|
|
231
|
-
950: '#0e315d',
|
|
232
|
-
default: '#007aff'
|
|
189
|
+
module.exports = {
|
|
190
|
+
theme: {
|
|
191
|
+
// Replaces all of the default `opacity` values
|
|
192
|
+
opacity: {
|
|
193
|
+
15: '0.15',
|
|
194
|
+
35: '0.35',
|
|
195
|
+
65: '0.65',
|
|
196
|
+
85: '0.85'
|
|
233
197
|
}
|
|
234
198
|
}
|
|
235
|
-
}
|
|
199
|
+
};
|
|
236
200
|
```
|
|
237
201
|
|
|
238
|
-
|
|
202
|
+
This completely replaces the original default `opacity` values with the new ones.
|
|
203
|
+
|
|
204
|
+
> **ℹ️ INFO**
|
|
205
|
+
> Keys you do not provide are inherited from the default theme. In the example above, colors, spacing, border radius, background position, and other defaults remain.
|
|
206
|
+
|
|
207
|
+
### Extend Properties
|
|
239
208
|
|
|
240
|
-
|
|
209
|
+
If you want to keep the defaults and add new values, place them under `theme.extend`.
|
|
241
210
|
|
|
242
|
-
|
|
211
|
+
For example, if you want to add an extra color but preserve the existing ones, you could extend the `colors` section:
|
|
243
212
|
|
|
244
213
|
```javascript
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
200: '#dfdfdf',
|
|
252
|
-
300: '#c8c8c8',
|
|
253
|
-
400: '#adadad',
|
|
254
|
-
500: '#9e9e9e',
|
|
255
|
-
600: '#888888',
|
|
256
|
-
700: '#7b7b7b',
|
|
257
|
-
800: '#676767',
|
|
258
|
-
900: '#545454'
|
|
214
|
+
module.exports = {
|
|
215
|
+
theme: {
|
|
216
|
+
extend: {
|
|
217
|
+
// Adds a new color in addition to the default colors
|
|
218
|
+
colors: {
|
|
219
|
+
primary: '#002359'
|
|
259
220
|
}
|
|
260
221
|
}
|
|
261
222
|
}
|
|
262
|
-
}
|
|
223
|
+
};
|
|
263
224
|
```
|
|
264
225
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
Add new colors without modifying defaults:
|
|
226
|
+
You can override some parts of the default theme and extend others within the same configuration:
|
|
268
227
|
|
|
269
228
|
```javascript
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
229
|
+
module.exports = {
|
|
230
|
+
theme: {
|
|
231
|
+
opacity: {
|
|
232
|
+
15: '0.15',
|
|
233
|
+
35: '0.35',
|
|
234
|
+
65: '0.65',
|
|
235
|
+
85: '0.85'
|
|
236
|
+
},
|
|
237
|
+
extend: {
|
|
238
|
+
colors: {
|
|
239
|
+
primary: '#002359'
|
|
240
|
+
}
|
|
274
241
|
}
|
|
275
242
|
}
|
|
276
|
-
}
|
|
243
|
+
};
|
|
277
244
|
```
|
|
278
245
|
|
|
279
|
-
|
|
280
|
-
You can use the `shades` command to generate a range of shades for a given color, automatically adding them to your `config.cjs` file.
|
|
281
|
-
:::
|
|
246
|
+
## Customize Colors
|
|
282
247
|
|
|
283
|
-
|
|
248
|
+
PurgeTSS includes Tailwind's default color palette. Customize it under the `colors` key in the `theme` section of your `config.cjs` file.
|
|
284
249
|
|
|
285
|
-
|
|
250
|
+
### Use Custom Colors
|
|
286
251
|
|
|
287
|
-
|
|
288
|
-
theme: {
|
|
289
|
-
spacing: {
|
|
290
|
-
sm: 8,
|
|
291
|
-
md: 12,
|
|
292
|
-
lg: 16,
|
|
293
|
-
xl: 24,
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
```
|
|
297
|
-
|
|
298
|
-
### Shared Spacing Behavior
|
|
299
|
-
|
|
300
|
-
:::info
|
|
301
|
-
When you include the `spacing` section, PurgeTSS will automatically generate all spacing-related properties and merge them with any other spacing-related properties present in the configuration file.
|
|
302
|
-
:::
|
|
303
|
-
|
|
304
|
-
For example:
|
|
252
|
+
To replace the default color palette, add your colors directly under `theme.colors`:
|
|
305
253
|
|
|
306
254
|
```javascript
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
255
|
+
module.exports = {
|
|
256
|
+
theme: {
|
|
257
|
+
colors: {
|
|
258
|
+
transparent: 'transparent',
|
|
259
|
+
white: '#ffffff',
|
|
260
|
+
purple: '#3f3cbb',
|
|
261
|
+
midnight: '#121063',
|
|
262
|
+
metal: '#565584',
|
|
263
|
+
tahiti: '#3ab7bf',
|
|
264
|
+
silver: '#ecebff',
|
|
265
|
+
'bubble-gum': '#ff77e9',
|
|
266
|
+
bermuda: '#78dcca'
|
|
267
|
+
}
|
|
318
268
|
}
|
|
319
|
-
}
|
|
269
|
+
};
|
|
320
270
|
```
|
|
321
271
|
|
|
322
|
-
|
|
323
|
-
- `m-tight`, `m-loose`, `p-tight`, `p-loose`, etc.
|
|
324
|
-
- `w-banner`
|
|
325
|
-
- `h-xl`, `h-1/3`
|
|
326
|
-
|
|
327
|
-
## List of Customizable Properties
|
|
328
|
-
|
|
329
|
-
### Global Properties
|
|
330
|
-
|
|
331
|
-
All color properties inherit from `theme.colors`. All spacing properties inherit from `theme.spacing`.
|
|
332
|
-
|
|
333
|
-
### Color Properties (50+ properties)
|
|
334
|
-
|
|
335
|
-
All of these support your custom colors:
|
|
336
|
-
- `activeTintColor`, `activeTitleColor`, `backgroundColor`, `backgroundDisabledColor`, `backgroundFocusedColor`, `backgroundSelectedColor`, `backgroundSelectedGradient`, `badgeColor`, `barColor`, `borderColor`, `color`, `colors`, `contentScrimColor`, `currentPageIndicatorColor`, `dateTimeColor`, `disabledColor`, `highlightedColor`, `hintTextColor`, `iconColor`, `imageTouchFeedbackColor`, `indicatorColor`, `keyboardToolbarColor`, `lightColor`, `navigationIconColor`, `navTintColor`, `onTintColor`, `pageIndicatorColor`, `pagingControlColor`, `pullBackgroundColor`, `resultsBackgroundColor`, `resultsSeparatorColor`, `selectedBackgroundColor`, `selectedButtonColor`, `selectedColor`, `selectedSubtitleColor`, `selectedTextColor`, `separatorColor`, `shadowColor`, `statusBarBackgroundColor`, `subtitleColor`, `subtitleTextColor`, `tabsBackgroundColor`, `tabsBackgroundSelectedColor`, `thumbTintColor`, `tint`, `tintColor`, `titleAttributes`, `titleColor`, `titleTextColor`, `touchFeedbackColor`, `trackTintColor`, `viewShadowColor`
|
|
272
|
+
These colors are available across utilities like text, border, and background colors.
|
|
337
273
|
|
|
338
|
-
###
|
|
339
|
-
|
|
340
|
-
- `activeTab`, `backgroundLeftCap`, `backgroundPaddingBottom`, `backgroundPaddingLeft`, `backgroundPaddingRight`, `backgroundPaddingTop`, `backgroundTopCap`, `borderRadius`, `borderWidth`, `bottom`, `cacheSize`, `columnCount`, `contentHeight`, `contentWidth`, `countDownDuration`, `delay`, `duration`, `elevation`, `fontFamily`, `fontSize`, `horizontalMargin`, `indentionLevel`, `keyboardToolbarHeight`, `left`, `leftButtonPadding`, `leftTrackLeftCap`, `leftTrackTopCap`, `leftWidth`, `lineHeightMultiple`, `lines`, `lineSpacing`, `maxElevation`, `maximumLineHeight`, `maxLines`, `maxRowHeight`, `maxZoomScale`, `minimumFontSize`, `minimumLineHeight`, `minRowHeight`, `minZoomScale`, `opacity`, `padding`, `paddingBottom`, `paddingLeft`, `paddingRight`, `paddingTop`, `pageHeight`, `pageWidth`, `pagingControlAlpha`, `pagingControlHeight`, `pagingControlTimeout`, `paragraphSpacingAfter`, `paragraphSpacingBefore`, `repeat`, `repeatCount`, `right`, `rightButtonPadding`, `rightTrackLeftCap`, `rightTrackTopCap`, `rightWidth`, `rotate`, `rowCount`, `rowHeight`, `scale`, `scalesPageToFit`, `scaleX`, `scaleY`, `sectionHeaderTopPadding`, `separatorHeight`, `shadowRadius`, `shiftMode`, `timeout`, `top`, `uprightHeight`, `uprightWidth`, `verticalMargin`, `width`, `xOffset`, `yOffset`, `zIndex`, `zoomScale`
|
|
341
|
-
|
|
342
|
-
## Custom Rules & Ti Elements
|
|
343
|
-
|
|
344
|
-
Style any **Ti Element**, **ID**, or **class** with platform/device specificity.
|
|
345
|
-
|
|
346
|
-
### Modifier Key
|
|
347
|
-
|
|
348
|
-
- **Ti Elements**: Use exact name: `Label`, `Button`, `ScrollView`
|
|
349
|
-
- **IDs**: Use `camelCase`: `#mainBanner`, `sidebarWidget`
|
|
350
|
-
- **Classes**: Use `kebab-case`: `.my-custom-class`, `.feature-card` (required for PurgeTSS v6.x+)
|
|
351
|
-
|
|
352
|
-
:::caution PurgeTSS v5 or earlier projects
|
|
353
|
-
For projects created with PurgeTSS v5 or earlier that are now using version 7.x.x or above, please set `purge.options.missing` to true in `config.cjs` to get a report (at the end of `app.tss`) of any missing classes so you can update them to the new naming convention.
|
|
354
|
-
:::
|
|
355
|
-
|
|
356
|
-
### Default, Platform, Device, or Conditional Blocks
|
|
357
|
-
|
|
358
|
-
- **`DEFAULT` or `default`**: Global style
|
|
359
|
-
- **`ios`** or **`android`**: Platform-specific
|
|
360
|
-
- **`tablet`** or **`handheld`**: Device-specific
|
|
361
|
-
- **`[if=globalVariableName]`**: Conditional with global variable
|
|
362
|
-
|
|
363
|
-
### Property Values
|
|
364
|
-
|
|
365
|
-
- **Titanium constants**: Enclose in quotes: `'Ti.UI.SIZE'`, `'Ti.UI.FILL'`
|
|
366
|
-
- **Alloy Configuration Values**: Enclose in quotes: `'Alloy.CFG.someValue'`
|
|
367
|
-
- **Global Variables**: Enclose in quotes: `'Alloy.Globals.someValue'`
|
|
368
|
-
- **Colors**: Use `hex`, `8-digit hex`, `rgb(R,G,B)`, `rgba(R,G,B,A)`, `transparent`, or color names
|
|
369
|
-
- **Spacing values**: Use `em`, `rem`, `%`, `px`, `dp`, `cm`, `in`
|
|
370
|
-
|
|
371
|
-
**Unit conversions:**
|
|
372
|
-
- `%`, `px`, `cm`, `in` - Passed without conversion
|
|
373
|
-
- `em` or `rem` - Converted: `value * 16`
|
|
374
|
-
- `dp` - Unit removed, value remains intact
|
|
274
|
+
### Color Object Syntax
|
|
375
275
|
|
|
376
|
-
|
|
276
|
+
Colors can be defined as a simple list of key-value pairs or as nested objects. Nested keys are added to the base color name as modifiers.
|
|
377
277
|
|
|
378
278
|
```javascript
|
|
379
279
|
module.exports = {
|
|
380
280
|
theme: {
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
ios: {
|
|
388
|
-
clipMode: 'Ti.UI.iOS.CLIP_MODE_DISABLED'
|
|
389
|
-
}
|
|
390
|
-
},
|
|
391
|
-
|
|
392
|
-
// Custom class with device variants
|
|
393
|
-
'.gallery': {
|
|
394
|
-
DEFAULT: {
|
|
395
|
-
height: 'Ti.UI.SIZE'
|
|
396
|
-
},
|
|
397
|
-
ios: {
|
|
398
|
-
clipMode: 'Ti.UI.iOS.CLIP_MODE_ENABLED'
|
|
399
|
-
},
|
|
400
|
-
android: {
|
|
401
|
-
hiddenBehavior: 'Ti.UI.HIDDEN_BEHAVIOR_GONE'
|
|
402
|
-
},
|
|
403
|
-
handheld: {
|
|
404
|
-
width: '250px'
|
|
405
|
-
},
|
|
406
|
-
tablet: {
|
|
407
|
-
width: '500px'
|
|
408
|
-
}
|
|
409
|
-
},
|
|
410
|
-
|
|
411
|
-
// Ti Element styling
|
|
412
|
-
TextField: {
|
|
413
|
-
DEFAULT: {
|
|
414
|
-
top: 10,
|
|
415
|
-
left: 20,
|
|
416
|
-
right: 20,
|
|
417
|
-
bottom: 0
|
|
418
|
-
},
|
|
419
|
-
'[if=Alloy.Globals.iPhoneX]': {
|
|
420
|
-
bottom: 'Alloy.CFG.iPhoneXNotchSize'
|
|
281
|
+
colors: {
|
|
282
|
+
highlight: '#ffff00',
|
|
283
|
+
primary: {
|
|
284
|
+
solid: '#002359',
|
|
285
|
+
dark: '#000030',
|
|
286
|
+
transparent: '#D9002359'
|
|
421
287
|
},
|
|
422
|
-
|
|
423
|
-
|
|
288
|
+
tahiti: {
|
|
289
|
+
100: '#cffafe',
|
|
290
|
+
200: '#a5f3fc',
|
|
291
|
+
300: '#67e8f9',
|
|
292
|
+
400: '#22d3ee',
|
|
293
|
+
500: '#06b6d4',
|
|
294
|
+
600: '#0891b2',
|
|
295
|
+
700: '#0e7490',
|
|
296
|
+
800: '#155e75',
|
|
297
|
+
900: '#164e63'
|
|
424
298
|
}
|
|
425
299
|
}
|
|
426
300
|
}
|
|
427
|
-
}
|
|
301
|
+
};
|
|
428
302
|
```
|
|
429
303
|
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
Extract repetitive patterns into reusable classes.
|
|
433
|
-
|
|
434
|
-
```javascript
|
|
435
|
-
'.btn-primary': {
|
|
436
|
-
apply: 'bg-blue-600 text-white rounded-lg px-4 py-2 font-bold'
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
'.card-shadow': {
|
|
440
|
-
apply: 'shadow-md'
|
|
441
|
-
}
|
|
442
|
-
```
|
|
443
|
-
|
|
444
|
-
:::tip
|
|
445
|
-
The `apply` directive is perfect for creating component-specific utility classes that combine multiple PurgeTSS utilities into a single, semantic class name.
|
|
446
|
-
:::
|
|
447
|
-
|
|
448
|
-
### Platform-Specific Classes with `@apply`
|
|
449
|
-
|
|
450
|
-
Several classes in `utilities.tss` are platform-specific to prevent polluting objects with properties that are not specific to a particular platform.
|
|
304
|
+
The nested keys are combined with the parent key to form class names like `bg-tahiti-400` or `text-tahiti-400`.
|
|
451
305
|
|
|
452
|
-
|
|
453
|
-
To properly apply these platform styles when creating custom rules, you must specify the platform variant in the `apply` directive.
|
|
306
|
+
### Override a Default Color
|
|
454
307
|
|
|
455
|
-
|
|
456
|
-
:::
|
|
308
|
+
If you want to override one of the default colors but keep the rest, provide the new values in `theme.extend.colors`.
|
|
457
309
|
|
|
458
|
-
|
|
310
|
+
For example, replacing the default cool grays with a neutral gray palette:
|
|
459
311
|
|
|
460
312
|
```javascript
|
|
461
313
|
module.exports = {
|
|
462
314
|
theme: {
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
315
|
+
extend: {
|
|
316
|
+
colors: {
|
|
317
|
+
gray: {
|
|
318
|
+
50: '#f7f7f7',
|
|
319
|
+
100: '#ededed',
|
|
320
|
+
200: '#dfdfdf',
|
|
321
|
+
300: '#c8c8c8',
|
|
322
|
+
400: '#adadad',
|
|
323
|
+
500: '#9e9e9e',
|
|
324
|
+
600: '#888888',
|
|
325
|
+
700: '#7b7b7b',
|
|
326
|
+
800: '#676767',
|
|
327
|
+
900: '#545454'
|
|
328
|
+
}
|
|
467
329
|
}
|
|
468
330
|
}
|
|
469
|
-
}
|
|
470
|
-
}
|
|
331
|
+
}
|
|
332
|
+
};
|
|
471
333
|
```
|
|
472
334
|
|
|
473
|
-
|
|
474
|
-
```tss
|
|
475
|
-
/* Custom Classes */
|
|
476
|
-
'.my-view[platform=ios]': { backgroundColor: '#22c55e', clipMode: Ti.UI.iOS.CLIP_MODE_ENABLED, width: 128, height: 128 }
|
|
477
|
-
```
|
|
335
|
+
### Extend the Default Palette
|
|
478
336
|
|
|
479
|
-
|
|
337
|
+
If you want to extend the default color palette, use `theme.extend.colors`.
|
|
480
338
|
|
|
481
339
|
```javascript
|
|
482
340
|
module.exports = {
|
|
483
341
|
theme: {
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
342
|
+
extend: {
|
|
343
|
+
colors: {
|
|
344
|
+
'regal-blue': '#243c5a'
|
|
345
|
+
}
|
|
487
346
|
}
|
|
488
|
-
}
|
|
489
|
-
}
|
|
490
|
-
```
|
|
491
|
-
|
|
492
|
-
**Generated output (MISSING the clipMode property):**
|
|
493
|
-
```tss
|
|
494
|
-
/* Omitting the platform variant in config.cjs will not generate the corresponding property. */
|
|
495
|
-
/* Missing the property related to `clip-enabled`. */
|
|
496
|
-
'.my-view': { backgroundColor: '#22c55e', width: 128, height: 128 }
|
|
347
|
+
}
|
|
348
|
+
};
|
|
497
349
|
```
|
|
498
350
|
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
Certain Titanium properties are platform-specific and will only work when properly scoped:
|
|
351
|
+
This generates classes like `bg-regal-blue` in addition to all of Tailwind's default colors.
|
|
502
352
|
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
| `clipMode` | iOS only | `ios:clip-enabled`, `ios:clip-disabled` |
|
|
506
|
-
| `touchFeedback` | Android only | `android:touch-feedback` |
|
|
507
|
-
| `hires` | iOS only (ImageView) | `ios:hires` |
|
|
353
|
+
> **ℹ️ INFO**
|
|
354
|
+
> You can use the `shades` command to generate a range of shades for a color and add them to `config.cjs`. See [CLI Commands](./cli-commands.md#shades-command).
|
|
508
355
|
|
|
509
|
-
|
|
356
|
+
## Customize Spacing
|
|
510
357
|
|
|
511
|
-
|
|
358
|
+
The `spacing` section sets the global spacing and sizing scale.
|
|
512
359
|
|
|
513
360
|
```javascript
|
|
514
361
|
module.exports = {
|
|
515
362
|
theme: {
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
android: {
|
|
524
|
-
apply: 'android:touch-feedback'
|
|
525
|
-
},
|
|
526
|
-
handheld: {
|
|
527
|
-
apply: 'w-full'
|
|
528
|
-
},
|
|
529
|
-
tablet: {
|
|
530
|
-
apply: 'w-3/4'
|
|
531
|
-
}
|
|
363
|
+
spacing: {
|
|
364
|
+
1: '8px',
|
|
365
|
+
2: '12px',
|
|
366
|
+
3: '16px',
|
|
367
|
+
4: '24px',
|
|
368
|
+
5: '32px',
|
|
369
|
+
6: '48px'
|
|
532
370
|
}
|
|
533
371
|
}
|
|
534
|
-
}
|
|
535
|
-
```
|
|
536
|
-
|
|
537
|
-
**Generated output:**
|
|
538
|
-
```tss
|
|
539
|
-
/* Platform and device specific styles */
|
|
540
|
-
'.responsive-card': { backgroundColor: '#ffffff', borderRadius: 8, top: 16, right: 16, bottom: 16, left: 16 }
|
|
541
|
-
'.responsive-card[platform=ios]': { clipMode: Ti.UI.iOS.CLIP_MODE_ENABLED }
|
|
542
|
-
'.responsive-card[platform=android]': { touchFeedback: true }
|
|
543
|
-
'.responsive-card[formFactor=handheld]': { width: '100%' }
|
|
544
|
-
'.responsive-card[formFactor=tablet]': { width: '75%' }
|
|
545
|
-
```
|
|
546
|
-
|
|
547
|
-
### String vs Array Syntax
|
|
548
|
-
|
|
549
|
-
You can use either a string or an array for the `apply` directive:
|
|
550
|
-
|
|
551
|
-
```javascript
|
|
552
|
-
// String syntax
|
|
553
|
-
'.btn': {
|
|
554
|
-
apply: 'font-bold border-2 rounded wh-auto my-0.5'
|
|
555
|
-
}
|
|
556
|
-
|
|
557
|
-
// Array syntax (easier to read for long lists)
|
|
558
|
-
'.btn-corporate': {
|
|
559
|
-
apply: [
|
|
560
|
-
'bg-corporate-500',
|
|
561
|
-
'text-corporate-100',
|
|
562
|
-
'border-corporate-200'
|
|
563
|
-
]
|
|
564
|
-
}
|
|
372
|
+
};
|
|
565
373
|
```
|
|
566
374
|
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
Conditional styling directly in the `class` attribute using colon notation.
|
|
375
|
+
By default, the spacing scale is inherited by the padding, margin, width, height, and gap core plugins.
|
|
570
376
|
|
|
571
|
-
###
|
|
377
|
+
### Shared Spacing
|
|
572
378
|
|
|
573
|
-
|
|
574
|
-
<!-- iOS-specific styling -->
|
|
575
|
-
<Label class="ios:text-blue-600 android:text-gray-600" />
|
|
379
|
+
The `spacing` section is shared by the `padding`, `margin`, `width`, and `height` properties.
|
|
576
380
|
|
|
577
|
-
|
|
578
|
-
<View class="ios:bg-blue-100 android:bg-gray-100" />
|
|
579
|
-
```
|
|
580
|
-
|
|
581
|
-
### Device Modifiers
|
|
381
|
+
When you include the `spacing` section, PurgeTSS automatically generates all spacing-related properties and merges them with any other spacing-related properties present in the configuration file.
|
|
582
382
|
|
|
583
|
-
```
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
383
|
+
```javascript
|
|
384
|
+
module.exports = {
|
|
385
|
+
theme: {
|
|
386
|
+
spacing: {
|
|
387
|
+
tight: '0.25rem',
|
|
388
|
+
loose: '1.0rem'
|
|
389
|
+
},
|
|
390
|
+
width: {
|
|
391
|
+
banner: '5rem'
|
|
392
|
+
},
|
|
393
|
+
height: {
|
|
394
|
+
xl: '3rem',
|
|
395
|
+
'1/3': '33.333333%'
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
};
|
|
593
399
|
```
|
|
594
400
|
|
|
595
|
-
## Icon Font Support
|
|
596
|
-
|
|
597
|
-
PurgeTSS automatically maps icon classes to both `text` and `title` properties, making them work on both Labels and Buttons.
|
|
598
|
-
|
|
599
401
|
```tss
|
|
600
|
-
/*
|
|
601
|
-
'.
|
|
602
|
-
'.
|
|
402
|
+
/* width */
|
|
403
|
+
'.w-tight': { width: 4 }
|
|
404
|
+
'.w-loose': { width: 16 }
|
|
405
|
+
'.w-banner': { width: 80 }
|
|
406
|
+
|
|
407
|
+
/* height */
|
|
408
|
+
'.h-tight': { height: 4 }
|
|
409
|
+
'.h-loose': { height: 16 }
|
|
410
|
+
'.h-xl': { height: 48 }
|
|
411
|
+
'.h-1/3': { height: '33.333334%' }
|
|
412
|
+
|
|
413
|
+
/* margin */
|
|
414
|
+
'.m-tight': { top: 4, right: 4, bottom: 4, left: 4 }
|
|
415
|
+
'.m-loose': { top: 16, right: 16, bottom: 16, left: 16 }
|
|
416
|
+
'.my-tight': { top: 4, bottom: 4 }
|
|
417
|
+
'.my-loose': { top: 16, bottom: 16 }
|
|
418
|
+
|
|
419
|
+
/* padding */
|
|
420
|
+
'.p-tight': { padding: { top: 4, right: 4, bottom: 4, left: 4 } }
|
|
421
|
+
'.p-loose': { padding: { top: 16, right: 16, bottom: 16, left: 16 } }
|
|
422
|
+
'.py-tight': { padding: { top: 4, bottom: 4 } }
|
|
423
|
+
'.py-loose': { padding: { top: 16, bottom: 16 } }
|
|
603
424
|
```
|
|
604
425
|
|
|
605
|
-
|
|
606
|
-
```xml
|
|
607
|
-
<!-- Works on Labels -->
|
|
608
|
-
<Label class="fas fa-home" />
|
|
426
|
+
### Override the Default Spacing Scale
|
|
609
427
|
|
|
610
|
-
|
|
611
|
-
<Button class="fas fa-home" />
|
|
612
|
-
```
|
|
613
|
-
|
|
614
|
-
## Theme Extension Best Practices
|
|
615
|
-
|
|
616
|
-
### 1. Use `extend` for Additions
|
|
428
|
+
If you want to override the default spacing scale, use `theme.spacing` in `config.cjs`:
|
|
617
429
|
|
|
618
430
|
```javascript
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
431
|
+
module.exports = {
|
|
432
|
+
theme: {
|
|
433
|
+
spacing: {
|
|
434
|
+
sm: 8,
|
|
435
|
+
md: 12,
|
|
436
|
+
lg: 16,
|
|
437
|
+
xl: 24
|
|
623
438
|
}
|
|
624
439
|
}
|
|
625
|
-
}
|
|
440
|
+
};
|
|
626
441
|
```
|
|
627
442
|
|
|
628
|
-
|
|
443
|
+
This disables the default spacing scale and generates classes like `p-sm` for padding, `m-md` for margin, `w-lg` for width, and `h-xl` for height.
|
|
444
|
+
|
|
445
|
+
### Extend the Default Spacing Scale
|
|
446
|
+
|
|
447
|
+
If you want to extend the default spacing scale, use `theme.extend.spacing`:
|
|
629
448
|
|
|
630
449
|
```javascript
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
450
|
+
module.exports = {
|
|
451
|
+
theme: {
|
|
452
|
+
extend: {
|
|
453
|
+
spacing: {
|
|
454
|
+
72: '18rem',
|
|
455
|
+
84: '21rem',
|
|
456
|
+
96: '24rem'
|
|
457
|
+
}
|
|
637
458
|
}
|
|
638
459
|
}
|
|
639
|
-
}
|
|
460
|
+
};
|
|
640
461
|
```
|
|
641
462
|
|
|
642
|
-
|
|
463
|
+
This generates classes like `p-72`, `m-84`, and `h-96` in addition to all of the default spacing and sizing utilities.
|
|
643
464
|
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
// Override some
|
|
647
|
-
opacity: { /* custom values */ },
|
|
465
|
+
> **WARNING: Titanium Layout Constraint**
|
|
466
|
+
> Titanium does not support native `padding` on `View`, `Window`, `ScrollView`, or `TableView`. Even if PurgeTSS can generate spacing-related utilities, prefer margins on children for those elements.
|
|
648
467
|
|
|
649
|
-
|
|
650
|
-
extend: {
|
|
651
|
-
colors: { /* additional colors */ }
|
|
652
|
-
}
|
|
653
|
-
}
|
|
654
|
-
```
|
|
655
|
-
|
|
656
|
-
## Summary Checklist
|
|
468
|
+
## List of Customizable Properties
|
|
657
469
|
|
|
658
|
-
|
|
659
|
-
- [ ] Use `method: 'async'` for LiveView compatibility issues
|
|
660
|
-
- [ ] Enable `missing: true` during development to catch typos
|
|
661
|
-
- [ ] Use `kebab-case` for custom class names (v6.x+ requirement)
|
|
662
|
-
- [ ] Use `camelCase` for IDs
|
|
663
|
-
- [ ] Use exact names for Ti Elements
|
|
664
|
-
- [ ] Prefer `extend` over overriding for colors/spacing
|
|
665
|
-
- [ ] Use `@apply` for component-specific utility combinations
|
|
470
|
+
The official guide ends with an exhaustive list of color and configurable properties. In this skill, that list is maintained separately in [Configurable Properties](./configurable-properties.md) so this guide stays focused on config structure and usage patterns.
|
|
666
471
|
|
|
667
|
-
##
|
|
472
|
+
## Custom Rules and Ti Elements
|
|
668
473
|
|
|
669
|
-
|
|
670
|
-
- [Configurable Properties](configurable-properties.md) - Complete list of 80+ customizable properties
|
|
671
|
-
- [Custom Rules](custom-rules.md) - Styling Ti Elements, IDs, and classes
|
|
672
|
-
- [Apply Directive](apply-directive.md) - Extracting utility combinations into reusable classes
|
|
673
|
-
- [Platform Modifiers](platform-modifiers.md) - ios:, android:, tablet:, handheld: prefixes
|
|
474
|
+
Create your own custom rules and include Ti Elements with any number of attributes or conditional statements. See [Custom Rules](./custom-rules.md) for the rule syntax and examples.
|