@maccesar/titools 2.2.3 → 2.2.8
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 +28 -27
- package/lib/commands/update.js +80 -101
- package/package.json +1 -1
- package/skills/alloy-guides/SKILL.md +31 -31
- package/skills/alloy-guides/references/CONCEPTS.md +3 -3
- package/skills/alloy-guides/references/CONTROLLERS.md +1 -1
- package/skills/alloy-guides/references/MODELS.md +6 -6
- package/skills/alloy-guides/references/VIEWS_WITHOUT_CONTROLLERS.md +1 -1
- package/skills/alloy-guides/references/VIEWS_XML.md +1 -1
- package/skills/alloy-guides/references/WIDGETS.md +1 -1
- package/skills/alloy-howtos/SKILL.md +27 -27
- package/skills/alloy-howtos/references/best_practices.md +9 -9
- package/skills/alloy-howtos/references/cli_reference.md +14 -14
- package/skills/alloy-howtos/references/config_files.md +16 -16
- package/skills/alloy-howtos/references/custom_tags.md +16 -16
- package/skills/alloy-howtos/references/debugging_troubleshooting.md +11 -15
- package/skills/alloy-howtos/references/samples.md +19 -19
- package/skills/purgetss/SKILL.md +11 -1
- package/skills/purgetss/references/animation-system.md +1 -1
- package/skills/purgetss/references/cli-commands.md +3 -3
- package/skills/purgetss/references/customization-deep-dive.md +1 -1
- package/skills/purgetss/references/dynamic-component-creation.md +1 -1
- package/skills/purgetss/references/icon-fonts.md +4 -0
- package/skills/purgetss/references/installation-setup.md +8 -1
- package/skills/purgetss/references/migration-guide.md +4 -0
- package/skills/purgetss/references/tikit-components.md +193 -204
- package/skills/purgetss/references/ui-ux-design.md +1 -1
- package/skills/ti-expert/SKILL.md +78 -118
- package/skills/ti-expert/references/alloy-builtins.md +18 -18
- package/skills/ti-expert/references/alloy-structure.md +21 -21
- package/skills/ti-expert/references/anti-patterns.md +15 -15
- package/skills/ti-expert/references/cli-expert.md +15 -15
- package/skills/ti-expert/references/code-conventions.md +38 -38
- package/skills/ti-expert/references/contracts.md +8 -8
- package/skills/ti-expert/references/controller-patterns.md +14 -14
- package/skills/ti-expert/references/error-handling.md +11 -11
- package/skills/ti-expert/references/examples.md +12 -12
- package/skills/ti-expert/references/migration-patterns.md +24 -24
- package/skills/ti-expert/references/patterns.md +10 -10
- package/skills/ti-expert/references/performance-listview.md +16 -16
- package/skills/ti-expert/references/performance-optimization.md +41 -41
- package/skills/ti-expert/references/security-device.md +22 -22
- package/skills/ti-expert/references/security-fundamentals.md +19 -19
- package/skills/ti-expert/references/state-management.md +33 -33
- package/skills/ti-expert/references/testing-e2e-ci.md +25 -25
- package/skills/ti-expert/references/testing-unit.md +24 -24
- package/skills/ti-expert/references/theming.md +15 -15
- package/skills/ti-guides/SKILL.md +58 -60
- package/skills/ti-guides/references/advanced-data-and-images.md +33 -33
- package/skills/ti-guides/references/android-manifest.md +15 -15
- package/skills/ti-guides/references/app-distribution.md +70 -166
- package/skills/ti-guides/references/application-frameworks.md +96 -114
- package/skills/ti-guides/references/cli-reference.md +294 -294
- package/skills/ti-guides/references/coding-best-practices.md +42 -33
- package/skills/ti-guides/references/commonjs-advanced.md +57 -51
- package/skills/ti-guides/references/hello-world.md +36 -36
- package/skills/ti-guides/references/hyperloop-native-access.md +66 -66
- package/skills/ti-guides/references/javascript-primer.md +83 -101
- package/skills/ti-guides/references/reserved-words.md +9 -9
- package/skills/ti-guides/references/resources.md +75 -83
- package/skills/ti-guides/references/style-and-conventions.md +35 -28
- package/skills/ti-guides/references/tiapp-config.md +110 -74
- package/skills/ti-howtos/SKILL.md +88 -92
- package/skills/ti-howtos/references/android-platform-deep-dives.md +104 -104
- package/skills/ti-howtos/references/automation-fastlane-appium.md +39 -39
- package/skills/ti-howtos/references/buffer-codec-streams.md +60 -60
- package/skills/ti-howtos/references/cross-platform-development.md +115 -136
- package/skills/ti-howtos/references/debugging-profiling.md +167 -181
- package/skills/ti-howtos/references/extending-titanium.md +121 -121
- package/skills/ti-howtos/references/google-maps-v2.md +84 -82
- package/skills/ti-howtos/references/ios-map-kit.md +65 -60
- package/skills/ti-howtos/references/ios-platform-deep-dives.md +123 -123
- package/skills/ti-howtos/references/local-data-sources.md +79 -78
- package/skills/ti-howtos/references/location-and-maps.md +116 -120
- package/skills/ti-howtos/references/media-apis.md +87 -86
- package/skills/ti-howtos/references/notification-services.md +250 -260
- package/skills/ti-howtos/references/remote-data-sources.md +98 -93
- package/skills/ti-howtos/references/tutorials.md +226 -216
- package/skills/ti-howtos/references/using-modules.md +73 -102
- package/skills/ti-howtos/references/web-content-integration.md +101 -103
- package/skills/ti-howtos/references/webpack-build-pipeline.md +52 -44
- package/skills/ti-ui/SKILL.md +85 -85
- package/skills/ti-ui/references/accessibility-deep-dive.md +57 -57
- package/skills/ti-ui/references/animation-and-matrices.md +79 -79
- package/skills/ti-ui/references/application-structures.md +96 -99
- package/skills/ti-ui/references/custom-fonts-styling.md +99 -99
- package/skills/ti-ui/references/event-handling.md +58 -58
- package/skills/ti-ui/references/gestures.md +62 -64
- package/skills/ti-ui/references/icons-and-splash-screens.md +88 -88
- package/skills/ti-ui/references/layouts-and-positioning.md +87 -97
- package/skills/ti-ui/references/listviews-and-performance.md +107 -107
- package/skills/ti-ui/references/orientation.md +87 -88
- package/skills/ti-ui/references/platform-ui-android.md +87 -81
- package/skills/ti-ui/references/platform-ui-ios.md +63 -61
- package/skills/ti-ui/references/scrolling-views.md +29 -29
- package/skills/ti-ui/references/tableviews.md +56 -56
|
@@ -1,30 +1,22 @@
|
|
|
1
|
-
# Application
|
|
1
|
+
# Application frameworks
|
|
2
2
|
|
|
3
|
-
Framework options and
|
|
3
|
+
Framework options and architecture patterns for Titanium applications.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
2. [Classic Titanium](#classic-titanium)
|
|
7
|
-
3. [Choosing a Framework](#choosing-a-framework)
|
|
8
|
-
4. [Architecture Patterns](#architecture-patterns)
|
|
5
|
+
## Alloy framework
|
|
9
6
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
## Alloy Framework
|
|
7
|
+
Alloy is the official MVC framework for Titanium. It was developed by Appcelerator and is now maintained by TiDev.
|
|
13
8
|
|
|
14
|
-
|
|
9
|
+
### What Alloy provides
|
|
15
10
|
|
|
16
|
-
|
|
11
|
+
- MVC structure with models, views, and controllers
|
|
12
|
+
- Built-in libraries (Backbone.js, Underscore.js)
|
|
13
|
+
- XML views for declarative UI
|
|
14
|
+
- TSS for CSS-like styling
|
|
15
|
+
- Data binding between views and models
|
|
16
|
+
- Widgets for reusable UI components
|
|
17
|
+
- Model and collection sync with REST and SQL adapters
|
|
17
18
|
|
|
18
|
-
|
|
19
|
-
- **MVC Architecture** - Separate models, views, and controllers
|
|
20
|
-
- **Built-in Libraries** - Backbone.js, Underscore.js
|
|
21
|
-
- **XML Views** - Declarative UI markup
|
|
22
|
-
- **TSS Styling** - CSS-like styling system
|
|
23
|
-
- **Data Binding** - Automatic view-to-model synchronization
|
|
24
|
-
- **Widgets** - Reusable UI components
|
|
25
|
-
- **Model/Collection Sync** - Built-in REST and SQL adapters
|
|
26
|
-
|
|
27
|
-
### Project Structure
|
|
19
|
+
### Project structure
|
|
28
20
|
|
|
29
21
|
```
|
|
30
22
|
app/
|
|
@@ -39,9 +31,9 @@ app/
|
|
|
39
31
|
└── alloy.js # Entry point
|
|
40
32
|
```
|
|
41
33
|
|
|
42
|
-
### Sample Alloy
|
|
34
|
+
### Sample Alloy code
|
|
43
35
|
|
|
44
|
-
|
|
36
|
+
View (XML):
|
|
45
37
|
```xml
|
|
46
38
|
<Alloy>
|
|
47
39
|
<Window class="container">
|
|
@@ -50,7 +42,7 @@ app/
|
|
|
50
42
|
</Alloy>
|
|
51
43
|
```
|
|
52
44
|
|
|
53
|
-
|
|
45
|
+
Style (TSS):
|
|
54
46
|
```css
|
|
55
47
|
".container": {
|
|
56
48
|
backgroundColor: "#fff"
|
|
@@ -62,7 +54,7 @@ app/
|
|
|
62
54
|
}
|
|
63
55
|
```
|
|
64
56
|
|
|
65
|
-
|
|
57
|
+
Controller (JS):
|
|
66
58
|
```javascript
|
|
67
59
|
const doClick = (e) => {
|
|
68
60
|
alert('Clicked!');
|
|
@@ -71,42 +63,42 @@ const doClick = (e) => {
|
|
|
71
63
|
$.index.open();
|
|
72
64
|
```
|
|
73
65
|
|
|
74
|
-
### Alloy
|
|
66
|
+
### Alloy resources
|
|
75
67
|
|
|
76
|
-
-
|
|
77
|
-
-
|
|
78
|
-
-
|
|
79
|
-
-
|
|
68
|
+
- Alloy guides: see the `alloy-guides` skill
|
|
69
|
+
- Alloy CLI: see `alloy-cli-advanced.md`
|
|
70
|
+
- Alloy data: see `alloy-data-mastery.md`
|
|
71
|
+
- Alloy widgets: see `alloy-widgets-and-themes.md`
|
|
80
72
|
|
|
81
|
-
### Angular
|
|
73
|
+
### Angular integration
|
|
82
74
|
|
|
83
|
-
Angular integration with Titanium SDK was under development but is no longer
|
|
75
|
+
Angular integration with Titanium SDK was under development but is no longer maintained.
|
|
84
76
|
|
|
85
|
-
### React
|
|
77
|
+
### React community framework
|
|
86
78
|
|
|
87
|
-
A community
|
|
79
|
+
A community React integration exists at https://github.com/nicolomonili/react-titanium (experimental).
|
|
88
80
|
|
|
89
|
-
### When to
|
|
81
|
+
### When to use Alloy
|
|
90
82
|
|
|
91
|
-
|
|
83
|
+
Use Alloy for:
|
|
92
84
|
- New projects (default choice)
|
|
93
|
-
- Teams
|
|
94
|
-
- Projects
|
|
85
|
+
- Teams that want MVC structure
|
|
86
|
+
- Projects that need data binding
|
|
95
87
|
- Rapid development with XML views
|
|
96
88
|
- Reusable components (widgets)
|
|
97
89
|
|
|
98
|
-
|
|
99
|
-
- Very simple apps
|
|
100
|
-
- Teams
|
|
90
|
+
Consider alternatives for:
|
|
91
|
+
- Very simple apps
|
|
92
|
+
- Teams that prefer pure JavaScript
|
|
101
93
|
- Projects with unique architectural needs
|
|
102
94
|
|
|
103
95
|
---
|
|
104
96
|
|
|
105
97
|
## Classic Titanium
|
|
106
98
|
|
|
107
|
-
Classic Titanium
|
|
99
|
+
Classic Titanium means building apps without Alloy, using JavaScript and CommonJS modules.
|
|
108
100
|
|
|
109
|
-
### Project
|
|
101
|
+
### Project structure
|
|
110
102
|
|
|
111
103
|
```
|
|
112
104
|
Resources/
|
|
@@ -119,9 +111,9 @@ Resources/
|
|
|
119
111
|
└── assets/ # Images, etc.
|
|
120
112
|
```
|
|
121
113
|
|
|
122
|
-
### Sample Classic
|
|
114
|
+
### Sample Classic code
|
|
123
115
|
|
|
124
|
-
|
|
116
|
+
app.js:
|
|
125
117
|
```javascript
|
|
126
118
|
// Single namespace pattern
|
|
127
119
|
const app = {};
|
|
@@ -134,7 +126,7 @@ app.mainWindow = app.ui.createApplicationWindow();
|
|
|
134
126
|
app.mainWindow.open();
|
|
135
127
|
```
|
|
136
128
|
|
|
137
|
-
|
|
129
|
+
ui/ApplicationWindow.js:
|
|
138
130
|
```javascript
|
|
139
131
|
// Extend namespace
|
|
140
132
|
app.ui = app.ui || {};
|
|
@@ -155,9 +147,9 @@ app.ui.createApplicationWindow = () => {
|
|
|
155
147
|
};
|
|
156
148
|
```
|
|
157
149
|
|
|
158
|
-
### CommonJS
|
|
150
|
+
### CommonJS pattern (recommended)
|
|
159
151
|
|
|
160
|
-
|
|
152
|
+
myModule.js:
|
|
161
153
|
```javascript
|
|
162
154
|
// Private variables
|
|
163
155
|
const privateData = 'secret';
|
|
@@ -174,65 +166,55 @@ exports.getData = () => {
|
|
|
174
166
|
};
|
|
175
167
|
```
|
|
176
168
|
|
|
177
|
-
|
|
169
|
+
app.js:
|
|
178
170
|
```javascript
|
|
179
171
|
const myModule = require('myModule');
|
|
180
172
|
const win = myModule.createWindow();
|
|
181
173
|
win.open();
|
|
182
174
|
```
|
|
183
175
|
|
|
184
|
-
### When to
|
|
176
|
+
### When to use Classic
|
|
185
177
|
|
|
186
|
-
|
|
178
|
+
Use Classic for:
|
|
187
179
|
- Simple projects
|
|
188
180
|
- Developers who prefer pure JavaScript
|
|
189
181
|
- Migrating from older Titanium projects
|
|
190
182
|
- Fine-grained control over UI creation
|
|
191
183
|
- Learning the Titanium API directly
|
|
192
184
|
|
|
193
|
-
|
|
185
|
+
Consider Alloy for:
|
|
194
186
|
- Large teams
|
|
195
187
|
- Complex apps with many screens
|
|
196
|
-
- Projects
|
|
188
|
+
- Projects that need built-in MVC
|
|
197
189
|
- Data-heavy applications
|
|
198
190
|
|
|
199
191
|
---
|
|
200
192
|
|
|
201
|
-
## Choosing a
|
|
193
|
+
## Choosing a framework
|
|
202
194
|
|
|
203
195
|
### Comparison
|
|
204
196
|
|
|
205
|
-
| Feature
|
|
206
|
-
|
|
|
207
|
-
|
|
|
208
|
-
|
|
|
209
|
-
|
|
|
210
|
-
|
|
|
211
|
-
|
|
|
212
|
-
|
|
|
213
|
-
|
|
|
197
|
+
| Feature | Alloy | Classic |
|
|
198
|
+
| ----------------- | ----------------------- | ------------------ |
|
|
199
|
+
| Learning curve | Steeper (XML, TSS, MVC) | Easier (just JS) |
|
|
200
|
+
| Boilerplate | Less (declarative) | More (imperative) |
|
|
201
|
+
| Structure | Enforced (MVC) | Manual |
|
|
202
|
+
| Data binding | Built-in | Manual |
|
|
203
|
+
| Styling | TSS (CSS-like) | Inline JS |
|
|
204
|
+
| Team size | Better for large teams | Flexible |
|
|
205
|
+
| Rapid development | Faster once learned | Slower (more code) |
|
|
214
206
|
|
|
215
207
|
### Recommendation
|
|
216
208
|
|
|
217
|
-
|
|
218
|
-
- Built-in best practices
|
|
219
|
-
- MVC structure from day one
|
|
220
|
-
- Less code to write
|
|
221
|
-
- Better team collaboration
|
|
222
|
-
- Official support and updates
|
|
223
|
-
|
|
224
|
-
**Switch to Classic** if:
|
|
225
|
-
- Alloy feels too complex for your needs
|
|
226
|
-
- You prefer pure JavaScript
|
|
227
|
-
- Your app is very simple
|
|
209
|
+
Start with Alloy if you are building a new app or expect multiple contributors. If Alloy feels like overhead or the app is very small, Classic is fine.
|
|
228
210
|
|
|
229
211
|
---
|
|
230
212
|
|
|
231
|
-
## Architecture
|
|
213
|
+
## Architecture patterns
|
|
232
214
|
|
|
233
|
-
### Namespaced
|
|
215
|
+
### Namespaced pattern
|
|
234
216
|
|
|
235
|
-
Classic Titanium pattern with single global namespace:
|
|
217
|
+
Classic Titanium pattern with a single global namespace:
|
|
236
218
|
|
|
237
219
|
```javascript
|
|
238
220
|
const app = {
|
|
@@ -253,11 +235,11 @@ app.init();
|
|
|
253
235
|
app.run();
|
|
254
236
|
```
|
|
255
237
|
|
|
256
|
-
### CommonJS
|
|
238
|
+
### CommonJS modules
|
|
257
239
|
|
|
258
240
|
Modern JavaScript pattern for Titanium:
|
|
259
241
|
|
|
260
|
-
|
|
242
|
+
models/user.js:
|
|
261
243
|
```javascript
|
|
262
244
|
exports.create = (attrs) => {
|
|
263
245
|
return {
|
|
@@ -270,7 +252,7 @@ exports.create = (attrs) => {
|
|
|
270
252
|
};
|
|
271
253
|
```
|
|
272
254
|
|
|
273
|
-
|
|
255
|
+
controllers/user.js:
|
|
274
256
|
```javascript
|
|
275
257
|
const User = require('models/user');
|
|
276
258
|
|
|
@@ -281,7 +263,7 @@ exports.register = (data) => {
|
|
|
281
263
|
};
|
|
282
264
|
```
|
|
283
265
|
|
|
284
|
-
### MVC with Alloy (
|
|
266
|
+
### MVC with Alloy (built-in)
|
|
285
267
|
|
|
286
268
|
Alloy enforces MVC:
|
|
287
269
|
|
|
@@ -292,11 +274,11 @@ app/
|
|
|
292
274
|
└── views/userView.xml # Presentation
|
|
293
275
|
```
|
|
294
276
|
|
|
295
|
-
### Repository
|
|
277
|
+
### Repository pattern
|
|
296
278
|
|
|
297
279
|
Separate data access from business logic:
|
|
298
280
|
|
|
299
|
-
|
|
281
|
+
repositories/userRepository.js:
|
|
300
282
|
```javascript
|
|
301
283
|
exports.findById = (id) => {
|
|
302
284
|
// Database call
|
|
@@ -309,7 +291,7 @@ exports.save = (user) => {
|
|
|
309
291
|
};
|
|
310
292
|
```
|
|
311
293
|
|
|
312
|
-
|
|
294
|
+
services/userService.js:
|
|
313
295
|
```javascript
|
|
314
296
|
const repo = require('repositories/userRepository');
|
|
315
297
|
|
|
@@ -324,7 +306,7 @@ exports.register = (data) => {
|
|
|
324
306
|
|
|
325
307
|
---
|
|
326
308
|
|
|
327
|
-
## Framework
|
|
309
|
+
## Framework interoperability
|
|
328
310
|
|
|
329
311
|
### Mix Alloy and Classic
|
|
330
312
|
|
|
@@ -339,46 +321,46 @@ $.label.text = data;
|
|
|
339
321
|
|
|
340
322
|
### Migrate Classic to Alloy
|
|
341
323
|
|
|
342
|
-
1. Create new Alloy project
|
|
343
|
-
2. Move business logic to `controllers/` or `lib
|
|
344
|
-
3. Convert UI creation to `views/` (XML)
|
|
345
|
-
4. Create `styles/` (TSS) from inline styles
|
|
346
|
-
5. Update data access to use `models
|
|
324
|
+
1. Create a new Alloy project.
|
|
325
|
+
2. Move business logic to `controllers/` or `lib/`.
|
|
326
|
+
3. Convert UI creation to `views/` (XML).
|
|
327
|
+
4. Create `styles/` (TSS) from inline styles.
|
|
328
|
+
5. Update data access to use `models/`.
|
|
347
329
|
|
|
348
330
|
---
|
|
349
331
|
|
|
350
|
-
## Best
|
|
332
|
+
## Best practices
|
|
351
333
|
|
|
352
|
-
### For Alloy
|
|
334
|
+
### For Alloy projects
|
|
353
335
|
|
|
354
|
-
1.
|
|
355
|
-
2.
|
|
356
|
-
3.
|
|
357
|
-
4.
|
|
358
|
-
5.
|
|
336
|
+
1. Follow MVC strictly. Keep models in `models/`, views in `views/`, and controller logic in `controllers/`.
|
|
337
|
+
2. Use data binding and avoid manual view updates.
|
|
338
|
+
3. Use widgets for reusable UI.
|
|
339
|
+
4. Use themes for styling variants.
|
|
340
|
+
5. Keep controllers lean and move business logic to `lib/`.
|
|
359
341
|
|
|
360
|
-
### For Classic
|
|
342
|
+
### For Classic projects
|
|
361
343
|
|
|
362
|
-
1.
|
|
363
|
-
2.
|
|
364
|
-
3.
|
|
365
|
-
4.
|
|
366
|
-
5.
|
|
344
|
+
1. Use CommonJS modules instead of `Ti.include()`.
|
|
345
|
+
2. Keep a single global namespace.
|
|
346
|
+
3. Protect global scope with IIFEs.
|
|
347
|
+
4. Separate concerns with `models/`, `views/`, and `controllers/` folders.
|
|
348
|
+
5. Document patterns so the team shares the same structure.
|
|
367
349
|
|
|
368
|
-
### For
|
|
350
|
+
### For both
|
|
369
351
|
|
|
370
|
-
1.
|
|
371
|
-
2.
|
|
372
|
-
3.
|
|
373
|
-
4.
|
|
374
|
-
5.
|
|
352
|
+
1. Clean up listeners and null heavy objects.
|
|
353
|
+
2. Add try/catch around critical code paths.
|
|
354
|
+
3. Use `Ti.API` for logging.
|
|
355
|
+
4. Follow `style-and-conventions.md` for code style.
|
|
356
|
+
5. Write unit tests for business logic.
|
|
375
357
|
|
|
376
358
|
---
|
|
377
359
|
|
|
378
360
|
## Resources
|
|
379
361
|
|
|
380
|
-
-
|
|
381
|
-
-
|
|
382
|
-
-
|
|
383
|
-
-
|
|
384
|
-
-
|
|
362
|
+
- Alloy guides: see the `alloy-guides` skill
|
|
363
|
+
- CommonJS advanced: see `commonjs-advanced.md`
|
|
364
|
+
- Coding best practices: see `coding-best-practices.md`
|
|
365
|
+
- JavaScript primer: see `javascript-primer.md`
|
|
366
|
+
- Alloy CLI: see `alloy-cli-advanced.md`
|