@maccesar/titools 2.10.1 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/AGENTS-VERCEL-RESEARCH.md +23 -12
  2. package/README.md +81 -182
  3. package/agents/ti-pro.md +8 -14
  4. package/lib/cleanup.js +13 -0
  5. package/lib/commands/skills.js +2 -1
  6. package/lib/config.js +9 -11
  7. package/lib/platform.js +1 -1
  8. package/package.json +2 -3
  9. package/skills/purgetss/SKILL.md +44 -57
  10. package/skills/purgetss/references/EXAMPLES.md +8 -1
  11. package/skills/purgetss/references/app-branding.md +96 -16
  12. package/skills/purgetss/references/apply-directive.md +26 -1
  13. package/skills/purgetss/references/arbitrary-values.md +72 -2
  14. package/skills/purgetss/references/class-categories.md +1 -1
  15. package/skills/purgetss/references/cli-commands.md +37 -13
  16. package/skills/purgetss/references/customization-deep-dive.md +18 -11
  17. package/skills/purgetss/references/dynamic-component-creation.md +0 -1
  18. package/skills/purgetss/references/migration-guide.md +162 -1
  19. package/skills/purgetss/references/multi-density-images.md +69 -0
  20. package/skills/purgetss/references/version-history.md +82 -0
  21. package/skills/ti-expert/SKILL.md +1 -1
  22. package/skills/ti-ui/SKILL.md +1 -1
  23. package/skills/alloy-guides/SKILL.md +0 -190
  24. package/skills/alloy-guides/references/CLI_TASKS.md +0 -233
  25. package/skills/alloy-guides/references/CONCEPTS.md +0 -171
  26. package/skills/alloy-guides/references/CONTROLLERS.md +0 -279
  27. package/skills/alloy-guides/references/MODELS.md +0 -1214
  28. package/skills/alloy-guides/references/PURGETSS.md +0 -46
  29. package/skills/alloy-guides/references/VIEWS_DYNAMIC.md +0 -235
  30. package/skills/alloy-guides/references/VIEWS_STYLES.md +0 -375
  31. package/skills/alloy-guides/references/VIEWS_WITHOUT_CONTROLLERS.md +0 -102
  32. package/skills/alloy-guides/references/VIEWS_XML.md +0 -581
  33. package/skills/alloy-guides/references/WIDGETS.md +0 -160
  34. package/skills/alloy-howtos/SKILL.md +0 -181
  35. package/skills/alloy-howtos/references/best_practices.md +0 -121
  36. package/skills/alloy-howtos/references/cli_reference.md +0 -230
  37. package/skills/alloy-howtos/references/config_files.md +0 -158
  38. package/skills/alloy-howtos/references/custom_tags.md +0 -148
  39. package/skills/alloy-howtos/references/debugging_troubleshooting.md +0 -78
  40. package/skills/alloy-howtos/references/samples.md +0 -156
  41. package/skills/ti-api/SKILL.md +0 -109
  42. package/skills/ti-api/references/api-android.md +0 -675
  43. package/skills/ti-api/references/api-app-platform.md +0 -636
  44. package/skills/ti-api/references/api-core.md +0 -764
  45. package/skills/ti-api/references/api-data-network.md +0 -641
  46. package/skills/ti-api/references/api-media.md +0 -655
  47. package/skills/ti-api/references/api-modules-ble-bluetooth.md +0 -657
  48. package/skills/ti-api/references/api-modules-coremotion-urlsession.md +0 -411
  49. package/skills/ti-api/references/api-modules-map.md +0 -632
  50. package/skills/ti-api/references/api-modules-nfc.md +0 -725
  51. package/skills/ti-api/references/api-modules-social-misc.md +0 -526
  52. package/skills/ti-api/references/api-services.md +0 -700
  53. package/skills/ti-api/references/api-ui-android.md +0 -499
  54. package/skills/ti-api/references/api-ui-extras.md +0 -702
  55. package/skills/ti-api/references/api-ui-ios-animator.md +0 -378
  56. package/skills/ti-api/references/api-ui-ios.md +0 -756
  57. package/skills/ti-api/references/api-ui-lists.md +0 -581
  58. package/skills/ti-api/references/api-ui-text-input.md +0 -607
  59. package/skills/ti-api/references/api-ui-views.md +0 -572
  60. package/skills/ti-api/references/api-ui-windows-navigation.md +0 -676
  61. package/skills/ti-api/references/api-xml-global.md +0 -743
  62. package/skills/ti-guides/SKILL.md +0 -75
  63. package/skills/ti-guides/references/advanced-data-and-images.md +0 -155
  64. package/skills/ti-guides/references/android-manifest.md +0 -97
  65. package/skills/ti-guides/references/app-distribution.md +0 -373
  66. package/skills/ti-guides/references/application-frameworks.md +0 -366
  67. package/skills/ti-guides/references/cli-reference.md +0 -700
  68. package/skills/ti-guides/references/coding-best-practices.md +0 -150
  69. package/skills/ti-guides/references/commonjs-advanced.md +0 -279
  70. package/skills/ti-guides/references/hello-world.md +0 -99
  71. package/skills/ti-guides/references/hyperloop-native-access.md +0 -458
  72. package/skills/ti-guides/references/javascript-primer.md +0 -402
  73. package/skills/ti-guides/references/reserved-words.md +0 -36
  74. package/skills/ti-guides/references/resources.md +0 -172
  75. package/skills/ti-guides/references/style-and-conventions.md +0 -104
  76. package/skills/ti-guides/references/tiapp-config.md +0 -655
  77. package/skills/ti-howtos/SKILL.md +0 -143
  78. package/skills/ti-howtos/references/android-platform-deep-dives.md +0 -609
  79. package/skills/ti-howtos/references/automation-fastlane-appium.md +0 -96
  80. package/skills/ti-howtos/references/buffer-codec-streams.md +0 -162
  81. package/skills/ti-howtos/references/cross-platform-development.md +0 -358
  82. package/skills/ti-howtos/references/debugging-profiling.md +0 -473
  83. package/skills/ti-howtos/references/extending-titanium.md +0 -684
  84. package/skills/ti-howtos/references/google-maps-v2.md +0 -172
  85. package/skills/ti-howtos/references/ios-map-kit.md +0 -149
  86. package/skills/ti-howtos/references/ios-platform-deep-dives.md +0 -595
  87. package/skills/ti-howtos/references/local-data-sources.md +0 -310
  88. package/skills/ti-howtos/references/location-and-maps.md +0 -267
  89. package/skills/ti-howtos/references/media-apis.md +0 -268
  90. package/skills/ti-howtos/references/notification-services.md +0 -539
  91. package/skills/ti-howtos/references/remote-data-sources.md +0 -339
  92. package/skills/ti-howtos/references/tutorials.md +0 -552
  93. package/skills/ti-howtos/references/using-modules.md +0 -182
  94. package/skills/ti-howtos/references/web-content-integration.md +0 -288
  95. package/skills/ti-howtos/references/webpack-build-pipeline.md +0 -125
@@ -1,288 +0,0 @@
1
- # Web content integration
2
-
3
- ## 1. The WebView component
4
-
5
- ### WKWebView (Titanium SDK 8.0.0+)
6
- As of Titanium SDK 8.0.0, WKWebView is the only supported web view on iOS. UIWebView was deprecated and removed. WKWebView behaves differently, so plan for that.
7
-
8
- ### Basic WebView creation
9
-
10
- Remote URL:
11
- ```javascript
12
- const webview = Ti.UI.createWebView({
13
- url: 'https://titaniumsdk.com'
14
- });
15
- win.add(webview);
16
- win.open();
17
- ```
18
-
19
- Local HTML:
20
- ```javascript
21
- const webview = Ti.UI.createWebView({
22
- url: 'local.html' // Relative to Resources or app/assets/app/lib
23
- });
24
- win.add(webview);
25
- ```
26
-
27
- Inline HTML:
28
- ```javascript
29
- const webview = Ti.UI.createWebView({
30
- html: '<html><body><h1>Hello</h1></body></html>'
31
- });
32
- ```
33
-
34
- ### Local web content with assets
35
- Local content can include CSS, JS, and images. Paths are relative to Resources (Classic) or app/assets/app/lib (Alloy).
36
-
37
- `local.html`:
38
- ```html
39
- <html>
40
- <head>
41
- <link rel="stylesheet" type="text/css" href="local.css"/>
42
- <script src="local.js"></script>
43
- </head>
44
- <body>
45
- <p>Local content</p>
46
- </body>
47
- </html>
48
- ```
49
-
50
- ### WebView properties and methods
51
-
52
- Navigation:
53
- - `canGoBack()` - returns true if possible to go back
54
- - `canGoForward()` - returns true if possible to go forward
55
- - `goBack()` - navigate back in history
56
- - `goForward()` - navigate forward in history
57
-
58
- Load control:
59
- - `loading` (Boolean) - current loading state
60
- - `reload()` - refresh the page
61
- - `stopLoading()` - stop loading
62
- - `repaint()` - force repaint
63
-
64
- Data handling:
65
- - `url` - local or remote URL
66
- - `html` - inline HTML string
67
- - `scalesPageToFit` - scale content to dimensions
68
- - `setBasicAuthentication(host, username, password)` - HTTP auth
69
-
70
- ```javascript
71
- webView.setBasicAuthentication('myDomain.com', 'username', 'password');
72
- ```
73
-
74
- Events:
75
- - `beforeload` - fires before loading begins (`e.url` contains the source)
76
- - `load` - fires when content has loaded
77
- - `error` - fires on load failures (`e.url`, `e.message`)
78
-
79
- ## 2. Communication between WebViews and Titanium
80
-
81
- ### Local web content communication
82
-
83
- Logging from WebView:
84
- Ti.API methods work inside local HTML.
85
-
86
- ```html
87
- <html>
88
- <body onload="Ti.API.info('Page loaded!');">
89
- <p>Logging works!</p>
90
- </body>
91
- </html>
92
- ```
93
-
94
- Bidirectional events with `Ti.App`:
95
-
96
- In local HTML:
97
- ```html
98
- <html>
99
- <head>
100
- <script>
101
- // Listen for events from Titanium
102
- Ti.App.addEventListener('app:fromTitanium', (e) => {
103
- alert(e.message);
104
- document.getElementById('output').textContent = e.message;
105
- });
106
-
107
- // Send event to Titanium
108
- function sendToApp() {
109
- Ti.App.fireEvent('app:fromWebView', {
110
- message: 'Hello from WebView!'
111
- });
112
- }
113
- </script>
114
- </head>
115
- <body>
116
- <button onclick="sendToApp()">Send to Titanium</button>
117
- <div id="output"></div>
118
- </body>
119
- </html>
120
- ```
121
-
122
- In Titanium:
123
- ```javascript
124
- const webview = Ti.UI.createWebView({ url: 'local.html' });
125
-
126
- // Listen for events from the WebView
127
- Ti.App.addEventListener('app:fromWebView', (e) => {
128
- alert(e.message);
129
- });
130
-
131
- // Send event to the WebView
132
- const button = Ti.UI.createButton({
133
- title: 'Send to WebView'
134
- });
135
- button.addEventListener('click', () => {
136
- Ti.App.fireEvent('app:fromTitanium', {
137
- message: 'Hello from Titanium!'
138
- });
139
- });
140
- ```
141
-
142
- ### Remote web content communication
143
-
144
- Titanium statements (`Ti.API`, `Ti.App`) do not work in remote HTML content.
145
-
146
- Warning: On iOS 12.0+, calling `evalJS()` synchronously from some contexts can deadlock. Prefer the async version with a callback.
147
-
148
- #### Using `evalJS()` for remote content
149
- Inject JavaScript and retrieve results as strings:
150
-
151
- ```javascript
152
- const webview = Ti.UI.createWebView({ url: 'https://example.com' });
153
-
154
- webview.addEventListener('load', (e) => {
155
- // Get the page title
156
- const title = webview.evalJS('document.title');
157
- Ti.API.info(`Page title: ${title}`);
158
-
159
- // Get cookies
160
- const cookies = webview.evalJS('document.cookie');
161
- Ti.API.info(`Cookies: ${cookies}`);
162
-
163
- // Execute a custom function
164
- webview.evalJS('alert("Hello from Titanium!");');
165
- });
166
- ```
167
-
168
- `evalJS()` rules:
169
- - Call it from the `load` event (page must be loaded)
170
- - Pass code as a single string
171
- - Returns a string (or null)
172
- - Use `JSON.stringify()` for complex data
173
-
174
- #### Passing data to remote content
175
-
176
- ```javascript
177
- webview.addEventListener('load', () => {
178
- const data = { user: 'John', score: 100 };
179
- webview.evalJS(`window.appData = ${JSON.stringify(data)};`);
180
- });
181
- ```
182
-
183
- Then in remote HTML:
184
- ```html
185
- <script>
186
- console.log(window.appData.user); // 'John'
187
- </script>
188
- ```
189
-
190
- ## 3. Performance and interaction concerns
191
-
192
- ### WebView performance
193
- WebView consumes significant resources:
194
- - Each WebView has its own rendering context
195
- - Memory overhead is high
196
- - Load time is independent of content complexity
197
-
198
- Best practice: if you can recreate the content with native Titanium components, do it.
199
-
200
- ### WebView in TableViews
201
- Anti-pattern: embedding WebViews in TableViewRows causes slow scrolling.
202
-
203
- ### WebView in scrollable components
204
- WebViews do not behave well inside other scrollable containers (ScrollView, TableView). They consume touch events.
205
-
206
- Workaround: set `touchEnabled: false` on the WebView if it sits inside a scrollable parent:
207
-
208
- ```javascript
209
- const webview = Ti.UI.createWebView({
210
- url: 'content.html',
211
- touchEnabled: false // Allow parent to handle touches
212
- });
213
- ```
214
-
215
- ### Viewport meta tag
216
- For mobile-optimized content, use the viewport meta tag:
217
-
218
- ```html
219
- <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
220
- ```
221
-
222
- ## 4. WebView use cases
223
-
224
- Common WebView use cases:
225
- - HTML forms: auto-scroll to focused fields, next/previous navigation, native keyboard integration
226
- - Rich text or HTML email: render styled content that is hard to replicate with native labels
227
- - Canvas/graphics: HTML5 Canvas provides 2D drawing not available in native Titanium APIs
228
- - OAuth flows: load third-party auth pages in a WebView and intercept redirects
229
-
230
- ### Authentication flows
231
- Many OAuth providers use WebView for login (for example, the Facebook module).
232
-
233
- ```javascript
234
- const authWebView = Ti.UI.createWebView({
235
- url: 'https://auth.example.com/oauth'
236
- });
237
-
238
- authWebView.addEventListener('load', (e) => {
239
- // Detect redirect to callback URL with token
240
- if (e.url.indexOf('myapp://callback') === 0) {
241
- const token = extractTokenFromUrl(e.url);
242
- Ti.App.fireEvent('auth:success', { token: token });
243
- }
244
- });
245
- ```
246
-
247
- ### Canvas and graphics
248
- For complex graphics, use HTML5 Canvas:
249
-
250
- `local.html`:
251
- ```html
252
- <canvas id="myCanvas" width="300" height="200"></canvas>
253
- <script>
254
- const ctx = document.getElementById('myCanvas').getContext('2d');
255
- ctx.fillStyle = 'green';
256
- ctx.fillRect(10, 10, 150, 100);
257
- </script>
258
- ```
259
-
260
- ## 5. WKWebView behavioral differences (iOS)
261
-
262
- - Cookies: WKWebView uses a separate cookie store from `Ti.Network`. Cookies set via HTTPClient are not shared with WebViews.
263
- - `localStorage`/`sessionStorage`: not shared between the native app and the WebView. Each WKWebView has its own storage.
264
- - `evalJS` is async: on iOS 12.0+, synchronous `evalJS()` can deadlock. Use the callback form instead:
265
-
266
- ```javascript
267
- webView.evalJS('document.title', (result) => {
268
- Ti.API.info(`Title: ${result}`);
269
- });
270
- ```
271
-
272
- - Viewport meta tag required: WKWebView needs an explicit viewport tag to scale content correctly:
273
-
274
- ```html
275
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
276
- ```
277
-
278
- - Custom fonts: use a special `@font-face` path format in WKWebView CSS. Fonts must be in the app bundle and referenced correctly.
279
- - Remote HTML limitations: `Ti.API`, `Ti.App.fireEvent()`, and other Titanium calls do not work in remotely-loaded HTML. Only local HTML can communicate with the Titanium runtime.
280
-
281
- ## Best practices summary
282
-
283
- 1. Avoid WebViews when possible. Use native components.
284
- 2. Never embed a WebView in a TableView.
285
- 3. Use local content for integration. Only local content supports `Ti.App` events.
286
- 4. Use `evalJS()` for remote content. It is the only way to interact with remote pages.
287
- 5. Wait for the `load` event before calling `evalJS()`.
288
- 6. Configure the viewport for proper mobile rendering.
@@ -1,125 +0,0 @@
1
- # Webpack build pipeline
2
-
3
- > **⚠️ Appcelerator/Axway era feature**
4
- > The Webpack pipeline documented here was introduced with Titanium SDK 9.1.0 as part of the Axway AMPLIFY toolchain (`appcd` daemon). Since Axway discontinued Appcelerator, this feature is **not maintained** in the current TiDev CLI (`ti`). If you are using the community TiDev CLI, this pipeline may not be available. Prefer the standard `ti build` pipeline unless your project already uses Webpack.
5
-
6
- Webpack integration is an alternative build pipeline starting with Titanium SDK 9.1.0. It is optional. When enabled, Webpack manages asset and code bundling.
7
-
8
- ## 1. Key benefits
9
- - Fast incremental builds: only changed files are processed.
10
- - npm support: install packages in the root and import them directly.
11
- - Build-time resolution: `require` calls are resolved during compilation, not at runtime.
12
-
13
- ## 2. The `@` alias
14
- Webpack adds the `@` alias to reference the source root without deep relative paths.
15
-
16
- | Project type | Path mapped by `@` |
17
- | :----------- | :----------------- |
18
- | Alloy | `app/lib` |
19
- | Classic | `src` |
20
-
21
- Usage example:
22
-
23
- ```javascript
24
- // Before (without webpack)
25
- import Utils from '../../utils/helper';
26
-
27
- // Now (with webpack)
28
- import Utils from '@/utils/helper';
29
- ```
30
-
31
- ## 3. npm dependency management
32
- Install a package in the project root:
33
-
34
- ```bash
35
- npm install lodash
36
- ```
37
-
38
- Use it in Titanium code:
39
-
40
- ```javascript
41
- import _ from 'lodash';
42
- const data = _.chunk(['a', 'b', 'c', 'd'], 2);
43
- ```
44
-
45
- ## 4. Platform-specific files
46
- Webpack detects platform-specific files using the `filename.<platform>.js` pattern.
47
-
48
- Example:
49
- - `utils.js` (common)
50
- - `utils.ios.js` (iOS only)
51
- - `utils.android.js` (Android only)
52
-
53
- When you `import { func } from '@/utils'`, Webpack picks the correct version for the build target.
54
-
55
- ## 5. Diagnostic web UI
56
- Webpack includes a web interface to analyze builds and asset sizes.
57
- Default URL: `http://localhost:1732/webpack/latest/web`
58
-
59
- ## 6. Project plugins
60
- Webpack support is powered by plugins chosen based on project type:
61
-
62
- | Plugin | Purpose |
63
- | ---------------------------------- | ----------------------- |
64
- | `@appcd/webpack-plugin-alloy` | Alloy project support |
65
- | `@appcd/webpack-plugin-classic` | Classic project support |
66
- | `@appcd/webpack-plugin-babel` | Babel transpilation |
67
- | `@appcd/webpack-plugin-typescript` | TypeScript support |
68
-
69
- ### Custom plugin configuration
70
- Customize with the `webpack-chain` API in `webpack.config.js`:
71
-
72
- ```javascript
73
- module.exports = (api) => {
74
- // Add a custom alias
75
- api.chainWebpack((config) => {
76
- config.resolve.alias.set('@utils', api.resolve('app/lib/utils'));
77
- });
78
- };
79
- ```
80
-
81
- Common customizations:
82
- - Add alias: `config.resolve.alias.set(name, path)`
83
- - Add loader: `config.module.rule(name).use(name).loader(loader)`
84
- - Delete plugin: `config.plugins.delete(name)`
85
-
86
- ## 7. Advanced configuration
87
- Extend configuration via plugins in `package.json`:
88
-
89
- ```json
90
- {
91
- "appcdWebpackPlugins": [
92
- "my-local-plugin.js"
93
- ]
94
- }
95
- ```
96
-
97
- ## 8. Global configuration
98
- Configure Webpack daemon settings in `~/.appcelerator/appcd/config.json`:
99
-
100
- ```json
101
- {
102
- "webpack": {
103
- "inactivityTimeout": 600000
104
- }
105
- }
106
- ```
107
-
108
- ## 9. Troubleshooting
109
-
110
- Build seems stuck: the Webpack daemon may need a restart.
111
-
112
- ```bash
113
- appcd exec /webpack/latest/stop
114
- ```
115
-
116
- View build logs:
117
-
118
- ```bash
119
- appcd logcat "*webpack*"
120
- ```
121
-
122
- ## 10. Known limitations
123
- - Hyperloop is not compatible with the Webpack pipeline.
124
- - Alloy.jmk build hooks are not supported. Use Webpack plugins instead.
125
- - The first build may be slower due to daemon startup.