@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,57 +1,68 @@
|
|
|
1
1
|
# Welcome to TiKit UI Components
|
|
2
2
|
|
|
3
|
-
TiKit is a
|
|
3
|
+
Building consistent UIs in Titanium SDK can feel repetitive. TiKit is a small library of UI components built with Alloy and PurgeTSS to reduce that work. It gives you reusable building blocks for common UI patterns, so you can focus on the parts of your app that are unique.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
TiKit is meant to help you move faster without fighting styling details.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
7
|
+
### Why TiKit
|
|
8
|
+
|
|
9
|
+
- Alerts, Avatars, Buttons, Cards, and Tabs with practical defaults.
|
|
10
|
+
- Styled with PurgeTSS utility classes instead of large TSS files.
|
|
11
|
+
- Dynamic updates -- change text, images, and icons without recreating the component.
|
|
12
|
+
- Works with FontAwesome, Material Icons, and other icon fonts.
|
|
13
|
+
- Customizable colors and styles via `classes` property.
|
|
14
|
+
- You only pass what you need.
|
|
15
15
|
|
|
16
16
|
## Getting Started
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
First, install the TiKit CLI:
|
|
19
19
|
|
|
20
20
|
```bash
|
|
21
21
|
npm install -g tikit
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Make sure you also have PurgeTSS installed globally:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
22
27
|
npm install -g purgetss
|
|
23
28
|
```
|
|
24
29
|
|
|
25
30
|
## Setting Up Your Project
|
|
26
31
|
|
|
27
|
-
1. Create a PurgeTSS project
|
|
28
|
-
1. Run `tikit install` inside your project:
|
|
32
|
+
1. Create a PurgeTSS project. If you haven't already, create a new Alloy project using PurgeTSS. Make sure you've configured the `app.idprefix` and `app.theme` settings as required by PurgeTSS:
|
|
29
33
|
|
|
30
|
-
```bash
|
|
31
|
-
purgetss create myApp
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
#
|
|
39
|
-
#
|
|
40
|
-
#
|
|
41
|
-
|
|
34
|
+
```bash
|
|
35
|
+
purgetss create myApp
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
2. Install TiKit components. Navigate into your new project directory (`cd myApp`) and run the TiKit installer. It will guide you through picking the components you want:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
tikit install
|
|
42
|
+
# ? Choose a component to install › - Use arrow-keys. Return to submit.
|
|
43
|
+
# ❯ all components
|
|
44
|
+
# alerts
|
|
45
|
+
# avatars
|
|
46
|
+
# buttons
|
|
47
|
+
# cards
|
|
48
|
+
```
|
|
42
49
|
|
|
43
50
|
## Component Default Values
|
|
44
51
|
|
|
52
|
+
TiKit components work out of the box with sensible defaults. Here's a summary of what each primary component uses when a property isn't specified:
|
|
53
|
+
|
|
45
54
|
| Component | Property | Default Value | Description |
|
|
46
55
|
| --------- | --------- | ------------------------------------------------------------------------------ | ---------------------------- |
|
|
47
56
|
| Alerts | `color` | `"dark"` | The alert's color scheme |
|
|
48
|
-
|
|
|
57
|
+
| | `variant` | `"pop"` (with text) or `"solid"` (without text) | The alert's visual style |
|
|
49
58
|
| Avatars | `size` | `"base"` | The avatar's size |
|
|
50
|
-
|
|
|
59
|
+
| | `variant` | `"chip"` (with name) or `"square"` (without name) | The avatar's shape and style |
|
|
51
60
|
| Buttons | `size` | `"base"` | The button's size |
|
|
52
|
-
|
|
|
61
|
+
| | `variant` | `"icon-left"` (with icon) or `"filled"` (without icon) | The button's visual style |
|
|
53
62
|
| Cards | `color` | `"dark"` | The card's color scheme |
|
|
54
|
-
|
|
|
63
|
+
| | `variant` | `"showcase"` (with image) or `"content"` (with subtitle) or `"code"` (default) | The card's layout style |
|
|
64
|
+
|
|
65
|
+
This means you can use components with minimal properties. For example:
|
|
55
66
|
|
|
56
67
|
```xml
|
|
57
68
|
<!-- Uses variant="pop", color="dark" by default -->
|
|
@@ -75,26 +86,28 @@ tikit install
|
|
|
75
86
|
|
|
76
87
|
## Alerts
|
|
77
88
|
|
|
78
|
-
Common properties: `variant`, `color`, `classes`, `title`, `text`
|
|
89
|
+
> Common properties: `variant`, `color`, `classes`, `title`, `text`
|
|
79
90
|
|
|
80
|
-
Alerts are for short, important messages that
|
|
91
|
+
Alerts are for short, important messages that don't block the user.
|
|
81
92
|
|
|
82
|
-
|
|
93
|
+
TiKit Alert variants:
|
|
83
94
|
|
|
84
95
|
- `callout`: Simple message with title and text.
|
|
85
96
|
- `pop`: Includes an icon alongside the title and text.
|
|
86
|
-
- `solid`:
|
|
97
|
+
- `solid`: A full-width banner style, usually with just a title and icon.
|
|
87
98
|
|
|
88
|
-
Colors:
|
|
99
|
+
Colors: Each variant comes in `success`, `danger`, `warning`, `info`, `dark`, and `light`. You can also define `primary` and `secondary` custom colors using PurgeTSS:
|
|
89
100
|
|
|
90
|
-
|
|
91
|
-
|
|
101
|
+
```bash
|
|
102
|
+
purgetss shades '#yourHexCode1' primary
|
|
103
|
+
purgetss shades '#yourHexCode2' secondary
|
|
104
|
+
```
|
|
92
105
|
|
|
93
106
|
Extra controls:
|
|
94
107
|
|
|
95
|
-
- `delay` (
|
|
96
|
-
- `duration` (
|
|
97
|
-
- `dismissible` (boolean):
|
|
108
|
+
- `delay` (milliseconds): Wait before showing the alert.
|
|
109
|
+
- `duration` (milliseconds): Control the animation speed.
|
|
110
|
+
- `dismissible` (boolean): Set to `true` to let users tap/click the alert to close it.
|
|
98
111
|
|
|
99
112
|
```xml
|
|
100
113
|
<Alert module="tikit.ui" variant="pop" color="info" delay="500" dismissible="true"
|
|
@@ -103,6 +116,10 @@ Extra controls:
|
|
|
103
116
|
|
|
104
117
|
### `callout`
|
|
105
118
|
|
|
119
|
+
> Properties: `title`, `text`
|
|
120
|
+
|
|
121
|
+
A basic alert for straightforward messages.
|
|
122
|
+
|
|
106
123
|
```xml
|
|
107
124
|
<Alert module="tikit.ui" variant="callout" color="success"
|
|
108
125
|
title="Success!" text="Your changes have been saved." />
|
|
@@ -110,7 +127,9 @@ Extra controls:
|
|
|
110
127
|
|
|
111
128
|
### `pop`
|
|
112
129
|
|
|
113
|
-
|
|
130
|
+
> Properties: `title`, `text`, `icon`
|
|
131
|
+
|
|
132
|
+
Adds a visual cue with an icon. You can customize the icon and its size using PurgeTSS classes in the `icon` property.
|
|
114
133
|
|
|
115
134
|
```xml
|
|
116
135
|
<Alert module="tikit.ui" variant="pop" color="primary"
|
|
@@ -120,6 +139,10 @@ Use the `icon` property with PurgeTSS classes for size and color.
|
|
|
120
139
|
|
|
121
140
|
### `solid`
|
|
122
141
|
|
|
142
|
+
> Properties: `title`, `icon`
|
|
143
|
+
|
|
144
|
+
A full-width banner. Customize the icon just like the `pop` variant.
|
|
145
|
+
|
|
123
146
|
```xml
|
|
124
147
|
<Alert module="tikit.ui" variant="solid" color="warning"
|
|
125
148
|
title="Maintenance Soon" icon="mi mi-warning text-2xl" />
|
|
@@ -127,9 +150,11 @@ Use the `icon` property with PurgeTSS classes for size and color.
|
|
|
127
150
|
|
|
128
151
|
## Avatars
|
|
129
152
|
|
|
130
|
-
Common properties: `variant`, `size`, `classes`, `image`
|
|
153
|
+
> Common properties: `variant`, `size`, `classes`, `image`
|
|
131
154
|
|
|
132
|
-
|
|
155
|
+
Avatars represent users or objects visually.
|
|
156
|
+
|
|
157
|
+
TiKit Avatar variants:
|
|
133
158
|
|
|
134
159
|
- `chip`: Image with a name label next to it.
|
|
135
160
|
- `circular`: Standard round avatar.
|
|
@@ -138,7 +163,7 @@ Variants:
|
|
|
138
163
|
- `square`: Simple square avatar.
|
|
139
164
|
- `stacked`: Designed to overlap slightly in a horizontal group.
|
|
140
165
|
|
|
141
|
-
Sizes: `xs`, `sm`, `base`, `lg`, `xl`, `2xl`.
|
|
166
|
+
Sizes: `xs`, `sm`, `base`, `lg`, `xl`, and `2xl`.
|
|
142
167
|
|
|
143
168
|
```xml
|
|
144
169
|
<Avatar module="tikit.ui" variant="circular" size="lg" image="path/to/your/image.jpg" />
|
|
@@ -146,6 +171,10 @@ Sizes: `xs`, `sm`, `base`, `lg`, `xl`, `2xl`.
|
|
|
146
171
|
|
|
147
172
|
### `chip`
|
|
148
173
|
|
|
174
|
+
> Properties: `name`, `image`
|
|
175
|
+
|
|
176
|
+
Shows an image and a name. Good for lists or mentions. Default background/text is gray, but you can change it with `classes`.
|
|
177
|
+
|
|
149
178
|
```xml
|
|
150
179
|
<Avatar module="tikit.ui" variant="chip" size="base" name="Jane Doe"
|
|
151
180
|
image="https://randomuser.me/api/portraits/women/86.jpg"
|
|
@@ -154,7 +183,9 @@ Sizes: `xs`, `sm`, `base`, `lg`, `xl`, `2xl`.
|
|
|
154
183
|
|
|
155
184
|
### `circular` and `square`
|
|
156
185
|
|
|
157
|
-
|
|
186
|
+
> Properties: `name` (optional, for accessibility), `image`, `border` (boolean)
|
|
187
|
+
|
|
188
|
+
Classic avatar shapes. Set `border="true"` for a default white border. Customize the border color using `classes` (for example, `border-blue-500`).
|
|
158
189
|
|
|
159
190
|
```xml
|
|
160
191
|
<Avatar module="tikit.ui" variant="circular" size="base" border="true"
|
|
@@ -164,7 +195,9 @@ Set `border="true"` for a default white border. Override border color with `clas
|
|
|
164
195
|
|
|
165
196
|
### `portrait` and `landscape`
|
|
166
197
|
|
|
167
|
-
|
|
198
|
+
> Properties: `name` (optional), `image`
|
|
199
|
+
|
|
200
|
+
Rectangular avatars with a default gray border (`border-gray-500`). Override it using `classes`.
|
|
168
201
|
|
|
169
202
|
```xml
|
|
170
203
|
<Avatar module="tikit.ui" variant="portrait" size="base"
|
|
@@ -174,7 +207,9 @@ Default gray border (`border-gray-500`). Override with `classes`.
|
|
|
174
207
|
|
|
175
208
|
### `stacked`
|
|
176
209
|
|
|
177
|
-
|
|
210
|
+
> Properties: `image`, `last` (boolean)
|
|
211
|
+
|
|
212
|
+
Use these inside a `<View class="horizontal">` to create an overlapping stack. Set `last="true"` on the final avatar in the stack to fix its right margin.
|
|
178
213
|
|
|
179
214
|
```xml
|
|
180
215
|
<View class="horizontal">
|
|
@@ -191,18 +226,20 @@ Use inside a `<View class="horizontal">` and set `last="true"` on the final avat
|
|
|
191
226
|
|
|
192
227
|
## Buttons
|
|
193
228
|
|
|
194
|
-
Common properties: `variant`, `size`, `classes`, `title`
|
|
229
|
+
> Common properties: `variant`, `size`, `classes`, `title`
|
|
195
230
|
|
|
196
|
-
|
|
231
|
+
Buttons are for user actions and choices.
|
|
197
232
|
|
|
198
|
-
|
|
199
|
-
- `border-rounded`
|
|
200
|
-
- `filled`
|
|
201
|
-
- `filled-rounded`
|
|
202
|
-
- `icon-left`
|
|
203
|
-
- `icon-right`
|
|
233
|
+
TiKit Button variants:
|
|
204
234
|
|
|
205
|
-
|
|
235
|
+
- `border`: Text with an outline border.
|
|
236
|
+
- `border-rounded`: Like `border`, but with rounded corners.
|
|
237
|
+
- `filled`: Solid background color with text.
|
|
238
|
+
- `filled-rounded`: Like `filled`, but with rounded corners.
|
|
239
|
+
- `icon-left`: Icon on the left, text on the right.
|
|
240
|
+
- `icon-right`: Text on the left, icon on the right.
|
|
241
|
+
|
|
242
|
+
Sizes: `xs`, `sm`, `base`, `lg`, `xl`, and `2xl`.
|
|
206
243
|
|
|
207
244
|
```xml
|
|
208
245
|
<Button module="tikit.ui" variant="filled" size="lg" title="Submit"
|
|
@@ -211,6 +248,10 @@ Sizes: `xs`, `sm`, `base`, `lg`, `xl`, `2xl`.
|
|
|
211
248
|
|
|
212
249
|
### `border` and `border-rounded`
|
|
213
250
|
|
|
251
|
+
> Property: `title`
|
|
252
|
+
|
|
253
|
+
Outlined buttons. Use `classes` to control the border and text color (for example, `border-purple-500 text-purple-500`).
|
|
254
|
+
|
|
214
255
|
```xml
|
|
215
256
|
<Button module="tikit.ui" variant="border" size="base" title="Cancel"
|
|
216
257
|
classes="border-red-500 text-red-500" />
|
|
@@ -218,6 +259,10 @@ Sizes: `xs`, `sm`, `base`, `lg`, `xl`, `2xl`.
|
|
|
218
259
|
|
|
219
260
|
### `filled` and `filled-rounded`
|
|
220
261
|
|
|
262
|
+
> Property: `title`
|
|
263
|
+
|
|
264
|
+
Solid background buttons. Use `classes` to set background and text colors (for example, `bg-green-600 text-white`).
|
|
265
|
+
|
|
221
266
|
```xml
|
|
222
267
|
<Button module="tikit.ui" variant="filled-rounded" size="base" title="Confirm"
|
|
223
268
|
classes="bg-green-600 text-white" />
|
|
@@ -225,7 +270,9 @@ Sizes: `xs`, `sm`, `base`, `lg`, `xl`, `2xl`.
|
|
|
225
270
|
|
|
226
271
|
### `icon-left` and `icon-right`
|
|
227
272
|
|
|
228
|
-
|
|
273
|
+
> Properties: `title`, `icon`
|
|
274
|
+
|
|
275
|
+
Buttons with text and an icon. Use the `icon` property to specify the icon class (for example, `fa fa-save`) and `classes` for background/text colors.
|
|
229
276
|
|
|
230
277
|
```xml
|
|
231
278
|
<Button module="tikit.ui" variant="icon-left" size="base" title="Save"
|
|
@@ -234,6 +281,8 @@ Use the `icon` property with the icon class and any PurgeTSS size or color class
|
|
|
234
281
|
|
|
235
282
|
### Using Custom Icons in Buttons
|
|
236
283
|
|
|
284
|
+
You can use any icon font loaded via PurgeTSS. Specify the font prefix and icon name in the `icon` property, along with any size or color classes from PurgeTSS.
|
|
285
|
+
|
|
237
286
|
```xml
|
|
238
287
|
<Button module="tikit.ui" variant="icon-right" size="lg" title="Settings"
|
|
239
288
|
icon="mi mi-settings text-lg text-gray-100"
|
|
@@ -242,20 +291,34 @@ Use the `icon` property with the icon class and any PurgeTSS size or color class
|
|
|
242
291
|
|
|
243
292
|
## Cards
|
|
244
293
|
|
|
245
|
-
Common properties: `variant`, `color`, `classes`
|
|
294
|
+
> Common properties: `variant`, `color`, `classes`
|
|
295
|
+
|
|
296
|
+
Cards group related content for summaries or showcases.
|
|
246
297
|
|
|
247
|
-
|
|
298
|
+
TiKit Card variants:
|
|
248
299
|
|
|
249
|
-
- `code`: Display code snippets, optional copy button.
|
|
250
|
-
- `content`:
|
|
251
|
-
- `quote`:
|
|
252
|
-
- `showcase`:
|
|
300
|
+
- `code`: Display code snippets, with an optional copy button.
|
|
301
|
+
- `content`: Blocks of text with a main title and highlighted subtitle.
|
|
302
|
+
- `quote`: A quote with attribution.
|
|
303
|
+
- `showcase`: An image with a title and description.
|
|
253
304
|
|
|
254
|
-
Colors: `black`, `dark`, `light`, `white
|
|
305
|
+
Colors: `black`, `dark`, `light`, and `white` themes that affect background and text colors.
|
|
306
|
+
|
|
307
|
+
```xml
|
|
308
|
+
<Card module="tikit.ui" variant="showcase" color="light"
|
|
309
|
+
title="Featured Item" text="A brief description goes here."
|
|
310
|
+
image="images/feature.png" />
|
|
311
|
+
```
|
|
255
312
|
|
|
256
313
|
### `code`
|
|
257
314
|
|
|
258
|
-
|
|
315
|
+
> Properties: `title`, `text`, `copy` (boolean)
|
|
316
|
+
|
|
317
|
+
Use this for code examples. Set `copy="true"` to add a copy button.
|
|
318
|
+
|
|
319
|
+
**Pro tip:** For best results, install a monospaced font (like Fira Code or JetBrains Mono) and configure `font-mono` in your PurgeTSS config.
|
|
320
|
+
|
|
321
|
+
**Localization:** The copy button uses `L('copy', 'Copy')` for its title and `L('code_copied', 'Code copied!')` for the confirmation message. Add these keys to your `strings.xml` files for translation.
|
|
259
322
|
|
|
260
323
|
```xml
|
|
261
324
|
<Card module="tikit.ui" variant="code" color="dark" copy="true"
|
|
@@ -264,7 +327,9 @@ Colors: `black`, `dark`, `light`, `white`.
|
|
|
264
327
|
|
|
265
328
|
### `showcase`
|
|
266
329
|
|
|
267
|
-
|
|
330
|
+
> Properties: `title`, `text`, `image`, `rounded` (integer)
|
|
331
|
+
|
|
332
|
+
Displays an image with a title and description. The `rounded` property accepts any integer value (0 or greater) to control the border radius. Use `rounded=0` for sharp corners, or increase the value (like `rounded=12`) for more rounded corners.
|
|
268
333
|
|
|
269
334
|
```xml
|
|
270
335
|
<Card module="tikit.ui" variant="showcase" color="black"
|
|
@@ -274,6 +339,10 @@ Use `rounded` (integer >= 0) to control border radius.
|
|
|
274
339
|
|
|
275
340
|
### `quote`
|
|
276
341
|
|
|
342
|
+
> Properties: `name`, `text`
|
|
343
|
+
|
|
344
|
+
Display a quote attributed to someone.
|
|
345
|
+
|
|
277
346
|
```xml
|
|
278
347
|
<Card module="tikit.ui" variant="quote" color="white"
|
|
279
348
|
name="Jane Austen" text="There is no charm equal to tenderness of heart." />
|
|
@@ -281,6 +350,10 @@ Use `rounded` (integer >= 0) to control border radius.
|
|
|
281
350
|
|
|
282
351
|
### `content`
|
|
283
352
|
|
|
353
|
+
> Properties: `title`, `subtitle`, `text`
|
|
354
|
+
|
|
355
|
+
Use this for text content with a clear hierarchy: a large title, a highlighted subtitle, and the main body text.
|
|
356
|
+
|
|
284
357
|
```xml
|
|
285
358
|
<Card module="tikit.ui" variant="content" color="light"
|
|
286
359
|
title="About TiKit" subtitle="Making UI Easier"
|
|
@@ -289,7 +362,11 @@ Use `rounded` (integer >= 0) to control border radius.
|
|
|
289
362
|
|
|
290
363
|
## Tabs
|
|
291
364
|
|
|
292
|
-
Properties: `title`, `icon`, `activeIcon` (iOS only) plus standard `Titanium.UI.Tab` properties
|
|
365
|
+
> Properties: `title`, `icon`, `activeIcon` (iOS only) plus standard `Titanium.UI.Tab` properties
|
|
366
|
+
|
|
367
|
+
Tabs with icon font support for FontAwesome, Material Icons, and others.
|
|
368
|
+
|
|
369
|
+
Specify the icon using `icon="fa fa-home"` or `icon="mi mi-settings"`. On iOS, you can provide a different icon for the active state using `activeIcon`.
|
|
293
370
|
|
|
294
371
|
```xml
|
|
295
372
|
<Tab module="tikit.ui" title="Home" icon="fa fa-home" activeIcon="fas fa-home">
|
|
@@ -299,6 +376,8 @@ Properties: `title`, `icon`, `activeIcon` (iOS only) plus standard `Titanium.UI.
|
|
|
299
376
|
|
|
300
377
|
### Styling Tabs Further
|
|
301
378
|
|
|
379
|
+
Because these are `Titanium.UI.Tab` objects, you can use standard properties and PurgeTSS classes. For example, change the active tint color:
|
|
380
|
+
|
|
302
381
|
```xml
|
|
303
382
|
<Tab module="tikit.ui"
|
|
304
383
|
class="active-tint-indigo-600 active-title-indigo-600"
|
|
@@ -311,72 +390,126 @@ Properties: `title`, `icon`, `activeIcon` (iOS only) plus standard `Titanium.UI.
|
|
|
311
390
|
|
|
312
391
|
## Updating Components Dynamically
|
|
313
392
|
|
|
314
|
-
|
|
393
|
+
TiKit components do not need to be destroyed and recreated just to change simple things like text or an image. When you give a component an `id` in your XML, you can call update methods in your controller (`.js` file).
|
|
315
394
|
|
|
316
|
-
|
|
395
|
+
Why this is useful:
|
|
317
396
|
|
|
318
|
-
-
|
|
319
|
-
-
|
|
320
|
-
-
|
|
321
|
-
-
|
|
322
|
-
- `updateImage(newImage)`
|
|
323
|
-
- `updateIcon(newIcon)`
|
|
324
|
-
- `update(args)` for multiple properties (`title`, `subtitle`, `text`, `name`, `image`, `icon`)
|
|
397
|
+
- Update a Card's text after data loads from an API.
|
|
398
|
+
- Change an Avatar image after the user uploads a new photo.
|
|
399
|
+
- Modify an Alert message based on user actions.
|
|
400
|
+
- Change a Button's title or icon (for example, from "Save" to "Saving..." and back).
|
|
325
401
|
|
|
326
|
-
|
|
402
|
+
### Available Update Methods
|
|
327
403
|
|
|
328
|
-
|
|
329
|
-
- Avatars: `image`, `name` (mostly for `chip`)
|
|
330
|
-
- Alerts: `title`, `text`, `icon` (`text` not applicable to `solid`)
|
|
331
|
-
- Buttons: `title`, `icon` (`icon` for `icon-left`/`icon-right`)
|
|
404
|
+
You can call these on your component's proxy (for example, `$.myCard.updateTitle(...)`):
|
|
332
405
|
|
|
333
|
-
|
|
406
|
+
| Method | Description |
|
|
407
|
+
| --- | --- |
|
|
408
|
+
| `updateTitle(newTitle)` | Changes the main title |
|
|
409
|
+
| `updateSubtitle(newSubtitle)` | Changes the subtitle (mainly for Cards) |
|
|
410
|
+
| `updateText(newText)` | Changes the main text content |
|
|
411
|
+
| `updateName(newName)` | Changes the name (useful for Avatar `chip` variant) |
|
|
412
|
+
| `updateImage(newImage)` | Changes the image (path or blob) |
|
|
413
|
+
| `updateIcon(newIcon)` | Changes the icon class string (for Alerts and Buttons) |
|
|
414
|
+
| `update(args)` | Shortcut to update multiple properties at once. Pass an object like `{ title: 'New', text: 'Updated text' }`. Supports `title`, `subtitle`, `text`, `name`, `image`, and `icon` |
|
|
334
415
|
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
416
|
+
### Which Components Support Updates
|
|
417
|
+
|
|
418
|
+
- **Cards** (`<Card>`): `title`, `subtitle`, `text`, `image` (works across variants where applicable).
|
|
419
|
+
- **Avatars** (`<Avatar>`): `image`, `name` (`name` mostly for `chip`).
|
|
420
|
+
- **Alerts** (`<Alert>`): `title`, `text`, `icon` (`text` not applicable to `solid`).
|
|
421
|
+
- **Buttons** (`<Button>`): `title`, `icon` (`icon` for `icon-left`/`icon-right`).
|
|
338
422
|
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
423
|
+
### Example: Updating a Card
|
|
424
|
+
|
|
425
|
+
View (index.xml):
|
|
426
|
+
|
|
427
|
+
```xml
|
|
428
|
+
<Alloy>
|
|
429
|
+
<Window>
|
|
430
|
+
<View class="vertical mx-4 my-8">
|
|
431
|
+
<Card id="statusCard" module="tikit.ui" variant="content" color="light"
|
|
432
|
+
title="Status"
|
|
433
|
+
subtitle="Current"
|
|
434
|
+
text="Waiting for update..." />
|
|
435
|
+
|
|
436
|
+
<Button module="tikit.ui" variant="filled" size="base"
|
|
437
|
+
title="Fetch Status" onClick="fetchStatus"
|
|
438
|
+
classes="mt-4 bg-blue-500 text-white" />
|
|
439
|
+
</View>
|
|
440
|
+
</Window>
|
|
441
|
+
</Alloy>
|
|
342
442
|
```
|
|
343
443
|
|
|
444
|
+
Controller (index.js):
|
|
445
|
+
|
|
344
446
|
```javascript
|
|
345
|
-
|
|
447
|
+
const fetchStatus = () => {
|
|
346
448
|
$.statusCard.update({
|
|
347
449
|
title: 'Status Updated!',
|
|
348
450
|
subtitle: 'Just Now',
|
|
349
451
|
text: 'Everything looks good. System operational.'
|
|
350
452
|
});
|
|
351
|
-
|
|
453
|
+
|
|
454
|
+
// You could also update individually:
|
|
455
|
+
// $.statusCard.updateTitle('Status Updated!');
|
|
456
|
+
// $.statusCard.updateSubtitle('Just Now');
|
|
457
|
+
// $.statusCard.updateText('Everything looks good...');
|
|
458
|
+
};
|
|
352
459
|
```
|
|
353
460
|
|
|
354
461
|
## Working with Icon Fonts
|
|
355
462
|
|
|
356
|
-
|
|
463
|
+
PurgeTSS manages icon fonts for you.
|
|
464
|
+
|
|
465
|
+
### Using Official Icon Fonts
|
|
357
466
|
|
|
358
|
-
|
|
467
|
+
To add popular free icon sets, run:
|
|
359
468
|
|
|
360
469
|
```bash
|
|
470
|
+
# Add Font Awesome (fa), Material Icons (mi), Material Symbols (ms), Framework7 (f7)
|
|
361
471
|
purgetss icon-library --vendor=fa,mi,ms,f7
|
|
362
472
|
```
|
|
363
473
|
|
|
364
|
-
|
|
474
|
+
This copies the font files and CSS into your project, ready to use.
|
|
365
475
|
|
|
366
|
-
|
|
367
|
-
1. Run `purgetss build-fonts`.
|
|
368
|
-
1. Use in TiKit components:
|
|
476
|
+
### Adding Your Own Custom Icon Fonts
|
|
369
477
|
|
|
370
|
-
|
|
371
|
-
<Button module="tikit.ui" variant="icon-left" title="Launch"
|
|
372
|
-
icon="myicon myicon-rocket text-lg"
|
|
373
|
-
classes="bg-purple-600 text-white" />
|
|
478
|
+
If you use a custom icon font, follow these steps:
|
|
374
479
|
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
480
|
+
1. **Organize files.** Place your font (`.ttf` or `.otf`) and its CSS file (mapping icon names to Unicode characters) in the PurgeTSS fonts directory:
|
|
481
|
+
|
|
482
|
+
```
|
|
483
|
+
YourProject/
|
|
484
|
+
└── purgetss/
|
|
485
|
+
└── fonts/
|
|
486
|
+
└── your-cool-font-name/
|
|
487
|
+
├── cool-font.css
|
|
488
|
+
└── cool-font.ttf
|
|
489
|
+
```
|
|
490
|
+
|
|
491
|
+
2. **Build fonts.** Run the PurgeTSS command to process them:
|
|
492
|
+
|
|
493
|
+
```bash
|
|
494
|
+
purgetss build-fonts
|
|
495
|
+
```
|
|
496
|
+
|
|
497
|
+
This generates the necessary TSS classes in `fonts.tss`.
|
|
498
|
+
|
|
499
|
+
3. **Use in TiKit.** Now you can use your custom icons just like the built-in ones:
|
|
500
|
+
|
|
501
|
+
```xml
|
|
502
|
+
<Button module="tikit.ui" variant="icon-left" title="Launch"
|
|
503
|
+
icon="myicon myicon-rocket text-lg"
|
|
504
|
+
classes="bg-purple-600 text-white" />
|
|
505
|
+
|
|
506
|
+
<Alert module="tikit.ui" variant="pop" color="info"
|
|
507
|
+
title="Update Available"
|
|
508
|
+
icon="myicon myicon-download text-2xl" />
|
|
509
|
+
```
|
|
510
|
+
|
|
511
|
+
You can mix and match icons from different libraries throughout your app.
|
|
379
512
|
|
|
380
513
|
## License
|
|
381
514
|
|
|
382
|
-
TiKit UI Components is open source under the MIT License.
|
|
515
|
+
TiKit UI Components is open source under the MIT License (Copyright 2023-2025 Cesar Estrada).
|
|
@@ -30,13 +30,16 @@ The most important reset is for the `View` element. By default, `View` is set to
|
|
|
30
30
|
- Grow to accommodate explicit dimensions (`w-64`, `h-32`, etc.)
|
|
31
31
|
- Expand to fill margins (`m-4`, `mx-2`, `mt-6 mb-4`, etc.)
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
In Titanium,
|
|
35
|
-
|
|
36
|
-
According to the **UI Composite Layout Behavior Spec**, if a dimension is `undefined` and you apply two opposite pins (e.g., `left` and `right` via `
|
|
37
|
-
|
|
38
|
-
**PurgeTSS** recommends
|
|
39
|
-
|
|
33
|
+
> **💡 EXPLICIT SIZE VS NATIVE UNDEFINED**
|
|
34
|
+
> In Titanium, components like `Label`, `Button`, and `Switch` default to `SIZE` behavior, but their property values are `undefined`. This applies to **any component whose default size is `Ti.UI.SIZE`**, not just `Label` and `Button`.
|
|
35
|
+
>
|
|
36
|
+
> According to the **UI Composite Layout Behavior Spec**, if a dimension is `undefined` and you apply two opposite pins (e.g., `left` and `right` via `mx-*`, or `top` and `bottom` via `my-*`), the motor will **compute the dimension based on the pins**, causing the element to stretch.
|
|
37
|
+
>
|
|
38
|
+
> **PurgeTSS** recommends adding an explicit `SIZE` reset on the affected axis:
|
|
39
|
+
>
|
|
40
|
+
> - Use `h-auto` when `mt-*` + `mb-*` or `my-*` would otherwise stretch the height.
|
|
41
|
+
> - Use `w-auto` when `ml-*` + `mr-*` or `mx-*` would otherwise stretch the width.
|
|
42
|
+
> - Use `wh-auto` as the safe reset when both axes may be affected.
|
|
40
43
|
|
|
41
44
|
### Practical Examples
|
|
42
45
|
|
|
@@ -110,9 +113,8 @@ On iOS, `ImageView` automatically gets `hires: true` for high-resolution image d
|
|
|
110
113
|
'ImageView[platform=ios]': { hires: true }
|
|
111
114
|
```
|
|
112
115
|
|
|
113
|
-
|
|
114
|
-
This ensures images look crisp on Retina displays without manual configuration.
|
|
115
|
-
:::
|
|
116
|
+
> **️ℹ️ INFO**
|
|
117
|
+
> This ensures images look crisp on Retina displays without manual configuration.
|
|
116
118
|
|
|
117
119
|
## Window Reset: White Background
|
|
118
120
|
|
|
@@ -181,9 +183,8 @@ PurgeTSS provides `wh-` shortcuts to set both width and height simultaneously. T
|
|
|
181
183
|
- **Numeric**: `wh-0` (0px) up to `wh-96` (384px) following the spacing scale.
|
|
182
184
|
- **Fractions**: `wh-1/2` (50%), `wh-1/3` (33%), up to `wh-11/12` (91%).
|
|
183
185
|
|
|
184
|
-
|
|
185
|
-
Always prefer `wh-screen` (FILL) over `wh-full` (100%) for better native performance in Titanium, unless you specifically need percentage-based calculations against a parent's dimension.
|
|
186
|
-
:::
|
|
186
|
+
> **💡 TIP**
|
|
187
|
+
> Always prefer `wh-screen` (FILL) over `wh-full` (100%) for better native performance in Titanium, unless you specifically need percentage-based calculations against a parent's dimension.
|
|
187
188
|
|
|
188
189
|
### Color Inheritance
|
|
189
190
|
|
|
@@ -228,15 +229,14 @@ This generates classes for ALL color properties:
|
|
|
228
229
|
<Label text="Content" />
|
|
229
230
|
</View>
|
|
230
231
|
|
|
231
|
-
<!-- CORRECT: Margin on children -->
|
|
232
|
+
<!-- CORRECT: Margin on children, with explicit SIZE reset -->
|
|
232
233
|
<View class="bg-white">
|
|
233
|
-
<Label class="m-4" text="Content" />
|
|
234
|
+
<Label class="m-4 wh-auto" text="Content" />
|
|
234
235
|
</View>
|
|
235
236
|
```
|
|
236
237
|
|
|
237
|
-
|
|
238
|
-
Do not use `p-` on `View`, `Window`, or `
|
|
239
|
-
:::
|
|
238
|
+
> **⚠️ CAUTION**
|
|
239
|
+
> Do not use `p-` on `View`, `Window`, `ScrollView`, or `TableView`. Use margins on children instead.
|
|
240
240
|
|
|
241
241
|
### 3. Not using w-screen for percentage calculations
|
|
242
242
|
|
|
@@ -318,9 +318,8 @@ module.exports = {
|
|
|
318
318
|
}
|
|
319
319
|
```
|
|
320
320
|
|
|
321
|
-
|
|
322
|
-
Prefer `config.cjs` for custom defaults because they're preserved when PurgeTSS regenerates `app.tss`.
|
|
323
|
-
:::
|
|
321
|
+
> **💡 TIP**
|
|
322
|
+
> Prefer `config.cjs` for custom defaults because they're preserved when PurgeTSS regenerates `app.tss`.
|
|
324
323
|
|
|
325
324
|
## Summary Table
|
|
326
325
|
|