nuxt-telegram-mini-app 0.0.2 → 0.0.4

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.
@@ -0,0 +1,6 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: "npm"
4
+ directory: "/"
5
+ schedule:
6
+ interval: "weekly"
@@ -0,0 +1,63 @@
1
+ name: Deploy to GitHub Pages
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ workflow_dispatch:
8
+
9
+ permissions:
10
+ contents: read
11
+ pages: write
12
+ id-token: write
13
+
14
+ concurrency:
15
+ group: pages
16
+ cancel-in-progress: false
17
+
18
+ jobs:
19
+ build:
20
+ runs-on: ubuntu-latest
21
+ env:
22
+ BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
23
+
24
+ steps:
25
+ - name: Checkout
26
+ uses: actions/checkout@v4
27
+
28
+ - name: Setup Node
29
+ uses: actions/setup-node@v4
30
+ with:
31
+ node-version: 22
32
+ cache: npm
33
+
34
+ - name: Setup Pages
35
+ uses: actions/configure-pages@v5
36
+
37
+ - name: Install dependencies
38
+ run: npm ci
39
+
40
+ - name: Run tests
41
+ run: npm test
42
+
43
+ - name: Generate static site
44
+ run: npm run generate
45
+ env:
46
+ NUXT_APP_BASE_URL: /nuxt-telegram-mini-app/
47
+
48
+ - name: Upload artifact
49
+ uses: actions/upload-pages-artifact@v3
50
+ with:
51
+ path: ./.output/public
52
+
53
+ deploy:
54
+ environment:
55
+ name: github-pages
56
+ url: ${{ steps.deployment.outputs.page_url }}
57
+ runs-on: ubuntu-latest
58
+ needs: build
59
+
60
+ steps:
61
+ - name: Deploy to GitHub Pages
62
+ id: deployment
63
+ uses: actions/deploy-pages@v4
package/README.md CHANGED
@@ -7,6 +7,9 @@ A comprehensive template for building Telegram Mini Apps using Nuxt 4, Vue 3, Ty
7
7
  ![Vue](https://img.shields.io/badge/Vue-3.x-4FC08D)
8
8
  ![TypeScript](https://img.shields.io/badge/TypeScript-5.x-3178C6)
9
9
  ![Tailwind](https://img.shields.io/badge/Tailwind-3.x-38B2AC)
10
+ ![Telegram API](https://img.shields.io/badge/Telegram%20API-6.2-26A5E4)
11
+
12
+ <img height="600" alt="Localhost" src="https://github.com/user-attachments/assets/2bbf6549-25db-42d5-b380-fc4f20884538" />
10
13
 
11
14
  ## ✨ Features
12
15
 
@@ -31,7 +34,9 @@ A comprehensive template for building Telegram Mini Apps using Nuxt 4, Vue 3, Ty
31
34
  - **⬅️ Back Button** - Navigation back button control
32
35
  - **👤 User Data** - Access to Telegram user information
33
36
  - **🎨 Theme Integration** - Automatic Telegram theme colors
34
- - **📐 Viewport Control** - Responsive viewport management
37
+ - **📐 Viewport Control** - Fullscreen, safe-area, and responsive viewport management
38
+ - **🏠 Home Screen Shortcuts** - Add/check Mini App shortcut support
39
+ - **📍 Device APIs** - Feature-detected storage, location, and motion access
35
40
  - **🔗 Deep Linking** - External and Telegram link handling
36
41
  - **📤 Sharing** - Built-in sharing functionality
37
42
 
@@ -159,7 +164,10 @@ import {
159
164
  useBackButton,
160
165
  useHapticFeedback,
161
166
  useInitData,
162
- useThemeParams
167
+ useThemeParams,
168
+ useViewport,
169
+ useHomeScreen,
170
+ useTelegramStorage
163
171
  } from '~/composables/telegram'
164
172
 
165
173
  const main = useMainButton()
@@ -167,6 +175,9 @@ const back = useBackButton()
167
175
  const haptic = useHapticFeedback()
168
176
  const init = useInitData()
169
177
  const theme = useThemeParams()
178
+ const viewport = useViewport()
179
+ const homeScreen = useHomeScreen()
180
+ const storage = useTelegramStorage('device')
170
181
 
171
182
  // Configure main button
172
183
  onMounted(() => {
@@ -188,6 +199,17 @@ onMounted(() => {
188
199
  // Access user data
189
200
  const userName = computed(() => init.user.value?.first_name || 'Guest')
190
201
 
202
+ // Newer Telegram APIs are feature-detected
203
+ function openFullscreen() {
204
+ if (!viewport.fullscreen.value) {
205
+ viewport.requestFullscreen()
206
+ }
207
+ }
208
+
209
+ function rememberPreference() {
210
+ storage.setItem('preferred_mode', theme.dark.value ? 'dark' : 'light')
211
+ }
212
+
191
213
  // Use theme colors
192
214
  const bgColor = computed(() => theme.backgroundColor.value)
193
215
  </script>
@@ -399,6 +421,7 @@ export default {
399
421
  - `setParams(params)` - Configure button
400
422
  - `onClick(callback)` - Handle clicks
401
423
  - `visible` - Visibility state
424
+ - Supports shine effect, custom emoji icon, and other current BottomButton params
402
425
 
403
426
  #### `useBackButton()`
404
427
  - `show()` / `hide()` - Control visibility
@@ -420,6 +443,26 @@ export default {
420
443
  - `buttonColor` - Theme button color
421
444
  - And more theme colors...
422
445
 
446
+ #### `useViewport()`
447
+ - `requestFullscreen()` / `exitFullscreen()` - Toggle Telegram fullscreen when supported
448
+ - `insets` - Device safe-area insets
449
+ - `contentInsets` - Content safe-area insets
450
+
451
+ #### `useMiniApp()`
452
+ - `hideKeyboard()` - Hide the native keyboard when supported
453
+ - `lockOrientation()` / `unlockOrientation()` - Control device orientation when supported
454
+ - `enableVerticalSwipes()` / `disableVerticalSwipes()` - Control vertical swipe gestures
455
+
456
+ #### New Telegram APIs
457
+ - `useSecondaryButton()` - Control Telegram's secondary bottom button
458
+ - `useSettingsButton()` - Control the Mini App settings menu button
459
+ - `useHomeScreen()` - Add/check home screen shortcuts
460
+ - `useEmojiStatus()` - Request emoji status access and open the set-status dialog
461
+ - `useTelegramStorage(type)` - Use `cloud`, `device`, or `secure` Telegram storage
462
+ - `useLocationManager()` - Initialize and request native location data
463
+ - `useDeviceMotion()` - Access accelerometer, orientation, and gyroscope objects
464
+ - `shareToStory()`, `shareMessage()`, `downloadFile()`, `requestChat()` - Wrappers for newer Telegram actions
465
+
423
466
  ### Components
424
467
 
425
468
  #### `<TgButton>`
@@ -605,8 +648,7 @@ export default defineNuxtConfig({
605
648
  app: {
606
649
  head: {
607
650
  script: [{
608
- src: 'https://telegram.org/js/telegram-web-app.js?58',
609
- defer: true
651
+ src: 'https://telegram.org/js/telegram-web-app.js?62'
610
652
  }]
611
653
  }
612
654
  }
@@ -615,7 +657,7 @@ export default defineNuxtConfig({
615
657
 
616
658
  ### Telegram WebApp Script
617
659
 
618
- The template automatically includes the Telegram WebApp script. The version can be updated in the Nuxt config.
660
+ The template automatically includes the Telegram WebApp script. The wrapper feature-detects newer APIs because the available API version depends on the user's Telegram client.
619
661
 
620
662
  ## 🤝 Contributing
621
663