@theaiplatform/miniapp-sdk 0.1.0-dev.e198ea6 → 0.1.0-pr.6741.5c5a5b4

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/dist/web.js CHANGED
@@ -101,14 +101,10 @@ async function openEditorProject(options) {
101
101
  if ("u" < typeof window) throw new Error('The miniapp host is unavailable.');
102
102
  await requestHostAction(OPEN_EDITOR_PROJECT_ACTION, options);
103
103
  }
104
- const MINIAPP_UI_SCALE_MIN = 12;
105
- const MINIAPP_UI_SCALE_MAX = 20;
106
- const MINIAPP_UI_SCALE_DEFAULT = 16;
107
104
  const MINIAPP_THEME_CHANGED_EVENTS = new Set([
108
105
  'zephyr-app-theme-changed',
109
106
  'tap-miniapp-theme-changed'
110
107
  ]);
111
- const MINIAPP_UI_SCALE_CHANGED_EVENT = 'zephyr-app-ui-scale-changed';
112
108
  function isMiniAppTheme(value) {
113
109
  return 'light' === value || 'dark' === value;
114
110
  }
@@ -127,21 +123,6 @@ function applyMiniAppTheme(theme) {
127
123
  document.documentElement.classList.toggle('light', 'light' === theme);
128
124
  document.documentElement.style.colorScheme = theme;
129
125
  }
130
- function isMiniAppUiScale(value) {
131
- return 'number' == typeof value && Number.isInteger(value) && value >= MINIAPP_UI_SCALE_MIN && value <= MINIAPP_UI_SCALE_MAX;
132
- }
133
- function getMiniAppUiScaleFromSearch(search = "u" < typeof window ? '' : window.location.search) {
134
- const params = 'string' == typeof search ? new URLSearchParams(search.startsWith('?') ? search.slice(1) : search) : search;
135
- const rawScale = params.get('appUiScale');
136
- if (null === rawScale || '' === rawScale.trim()) return MINIAPP_UI_SCALE_DEFAULT;
137
- const scale = Number(rawScale);
138
- return isMiniAppUiScale(scale) ? scale : MINIAPP_UI_SCALE_DEFAULT;
139
- }
140
- function applyMiniAppUiScale(scale) {
141
- if ("u" < typeof document || !isMiniAppUiScale(scale)) return;
142
- document.documentElement.dataset.uiScale = String(scale);
143
- document.documentElement.style.setProperty('--app-font-size', `${scale}px`);
144
- }
145
126
  function installMiniAppThemeSync({ applyTheme = applyMiniAppTheme, search } = {}) {
146
127
  applyTheme(getMiniAppThemeFromSearch(search));
147
128
  if ("u" < typeof window) return ()=>void 0;
@@ -161,22 +142,5 @@ function installMiniAppThemeSync({ applyTheme = applyMiniAppTheme, search } = {}
161
142
  window.removeEventListener('message', handleMessage);
162
143
  };
163
144
  }
164
- function installMiniAppAppearanceSync({ applyTheme = applyMiniAppTheme, applyUiScale = applyMiniAppUiScale, search } = {}) {
165
- applyTheme(getMiniAppThemeFromSearch(search));
166
- applyUiScale(getMiniAppUiScaleFromSearch(search));
167
- if ("u" < typeof window) return ()=>void 0;
168
- const hostOrigin = getHostOrigin();
169
- const parent = window.parent;
170
- if (!hostOrigin || !parent || parent === window) return ()=>void 0;
171
- const handleMessage = (event)=>{
172
- if (event.source !== parent || event.origin !== hostOrigin) return;
173
- if ('object' != typeof event.data || null === event.data) return;
174
- const record = event.data;
175
- if ('string' == typeof record.type && MINIAPP_THEME_CHANGED_EVENTS.has(record.type) && isMiniAppTheme(record.appTheme)) return void applyTheme(record.appTheme);
176
- if (record.type === MINIAPP_UI_SCALE_CHANGED_EVENT && isMiniAppUiScale(record.appUiScale)) applyUiScale(record.appUiScale);
177
- };
178
- window.addEventListener('message', handleMessage);
179
- return ()=>window.removeEventListener('message', handleMessage);
180
- }
181
145
  export { sdk as app } from "./sdk.js";
182
- export { MINIAPP_UI_SCALE_DEFAULT, MINIAPP_UI_SCALE_MAX, MINIAPP_UI_SCALE_MIN, applyMiniAppTheme, applyMiniAppUiScale, getMiniAppThemeFromSearch, getMiniAppUiScaleFromSearch, getPlatform, installMiniAppAppearanceSync, installMiniAppThemeSync, openEditorProject, platformSatisfiesApp };
146
+ export { applyMiniAppTheme, getMiniAppThemeFromSearch, getPlatform, installMiniAppThemeSync, openEditorProject, platformSatisfiesApp };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theaiplatform/miniapp-sdk",
3
- "version": "0.1.0-dev.e198ea6",
3
+ "version": "0.1.0-pr.6741.5c5a5b4",
4
4
  "description": "Public SDK for building portable miniapps that run in The AI Platform.",
5
5
  "type": "module",
6
6
  "engines": {
@@ -27,13 +27,6 @@
27
27
  "types": "./dist/web.d.ts",
28
28
  "import": "./dist/web.js"
29
29
  },
30
- "./ui": {
31
- "types": "./dist/ui.d.ts",
32
- "import": "./dist/ui.js"
33
- },
34
- "./ui/styles.css": "./dist/ui/styles.css",
35
- "./ui/tailwind.css": "./dist/ui/tailwind.css",
36
- "./ui-components.json": "./ui-components.json",
37
30
  "./surface": {
38
31
  "types": "./dist/surface.d.ts",
39
32
  "import": "./dist/surface.js"
@@ -53,14 +46,13 @@
53
46
  "files": [
54
47
  "dist",
55
48
  "config-schema.json",
56
- "ui-components.json",
57
49
  "README.md",
58
50
  "LICENSE.md",
59
51
  "THIRD_PARTY_NOTICES.md"
60
52
  ],
61
53
  "scripts": {
62
54
  "prepack": "pnpm run build",
63
- "build": "rm -rf dist && rslib build && node scripts/copy-rspack-loaders.mjs && node scripts/build-ui-styles.mjs",
55
+ "build": "rm -rf dist && rslib build && node scripts/copy-rspack-loaders.mjs",
64
56
  "test": "rstest run",
65
57
  "typecheck": "tsc --noEmit"
66
58
  },
@@ -83,13 +75,6 @@
83
75
  "types": "./dist/web.d.ts",
84
76
  "import": "./dist/web.js"
85
77
  },
86
- "./ui": {
87
- "types": "./dist/ui.d.ts",
88
- "import": "./dist/ui.js"
89
- },
90
- "./ui/styles.css": "./dist/ui/styles.css",
91
- "./ui/tailwind.css": "./dist/ui/tailwind.css",
92
- "./ui-components.json": "./ui-components.json",
93
78
  "./surface": {
94
79
  "types": "./dist/surface.d.ts",
95
80
  "import": "./dist/surface.js"
@@ -148,37 +133,11 @@
148
133
  "@rsbuild/core": "^2.1.4",
149
134
  "@rslib/core": "^0.23.2",
150
135
  "@rstest/core": "catalog:rstest",
151
- "@tailwindcss/postcss": "^4.3.0",
152
136
  "@types/node": "catalog:node",
153
- "postcss": "^8.5.6",
154
- "tailwindcss": "^4.3.0",
155
- "tw-animate-css": "^1.4.0",
156
137
  "typescript": "catalog:typescript"
157
138
  },
158
139
  "dependencies": {
159
- "@radix-ui/react-alert-dialog": "^1.1.15",
160
- "@radix-ui/react-checkbox": "^1.3.3",
161
- "@radix-ui/react-compose-refs": "^1.1.2",
162
- "@radix-ui/react-dialog": "^1.1.15",
163
- "@radix-ui/react-label": "^2.1.8",
164
- "@radix-ui/react-progress": "^1.1.8",
165
- "@radix-ui/react-radio-group": "^1.3.8",
166
- "@radix-ui/react-scroll-area": "^1.2.10",
167
- "@radix-ui/react-select": "^2.2.6",
168
- "@radix-ui/react-separator": "^1.1.8",
169
- "@radix-ui/react-slider": "^1.3.6",
170
- "@radix-ui/react-slot": "^1.2.4",
171
- "@radix-ui/react-tabs": "^1.1.13",
172
- "@radix-ui/react-toggle": "^1.1.10",
173
- "@radix-ui/react-toggle-group": "^1.1.11",
174
- "@radix-ui/react-tooltip": "^1.2.8",
175
140
  "ajv": "^8.20.0",
176
- "class-variance-authority": "^0.7.1",
177
- "clsx": "^2.1.1",
178
- "lucide-react": "^1.14.0",
179
- "prism-react-renderer": "^2.4.1",
180
- "react-resizable-panels": "^4.11.1",
181
- "saxes": "^6.0.0",
182
- "tailwind-merge": "^3.6.0"
141
+ "saxes": "^6.0.0"
183
142
  }
184
143
  }