skinsuite 0.3.0 → 0.3.1
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/docs/onboarding.md +13 -3
- package/package.json +1 -1
package/docs/onboarding.md
CHANGED
|
@@ -169,7 +169,12 @@ defineThemeDevice({
|
|
|
169
169
|
所以库只留**注入点**,判定由宿主实现并通过 `app.use(theme, { resolveDevice })` 传进来:
|
|
170
170
|
|
|
171
171
|
```ts
|
|
172
|
-
// src/
|
|
172
|
+
// src/utils/device-resolve.ts(宿主侧)
|
|
173
|
+
//
|
|
174
|
+
// 🔴 别把这段放进 `src/theme/views/`:那是主题域的**纯声明目录**
|
|
175
|
+
// (defineThemePage / defineThemeDevice),会被 virtual:theme 当声明副作用 import,
|
|
176
|
+
// 判定代码会跟着主题域一起进包;而且「theme/ 整包搬到另一个前端」就不成立了。
|
|
177
|
+
// theme/views/devices.ts 只留设备声明(有哪些设备、容器在哪、占哪条路由)。
|
|
173
178
|
import type { DeviceDomainContext } from 'skinsuite/vue';
|
|
174
179
|
import { fallbackDevice, isKnownDevice } from 'skinsuite/vue';
|
|
175
180
|
import { isMobileViewport } from '@/utils/device';
|
|
@@ -196,8 +201,13 @@ import { watchViewport } from '@/utils/device';
|
|
|
196
201
|
watchViewport(() => refreshDevice());
|
|
197
202
|
```
|
|
198
203
|
|
|
199
|
-
**加一种设备**要动的四处:`
|
|
200
|
-
容器组件 / 主题包里加设备目录。库零改动。
|
|
204
|
+
**加一种设备**要动的四处:`theme/views/devices.ts` 一条 `defineThemeDevice` 声明 /
|
|
205
|
+
`utils/device-resolve.ts` 一条判定分支 / 容器组件 / 主题包里加设备目录。库零改动。
|
|
206
|
+
|
|
207
|
+
⚠️ 判定函数依赖「设备域已注册的清单」(`isKnownDevice` / `fallbackDevice`),
|
|
208
|
+
所以 `bootstrap.ts` 要在 `app.use(theme)` **之前** import 一次声明模块
|
|
209
|
+
(`import './theme/views/devices'`)—— 通常 `virtual:theme` 会拉齐,但显式 import
|
|
210
|
+
能让顺序确定,不依赖插件产物。
|
|
201
211
|
|
|
202
212
|
### 4.2 页面契约 `views/<page>.ts`
|
|
203
213
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "skinsuite",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "多主题 / 多版式机制的纯内核(零运行时依赖):目录名与默认值的白名单常量、主题包契约类型、明暗 mode 与色系 tone、CSS 变量 token 的安全校验、设备维度 URL 参数读取。不碰 DOM / 构建器 / 路由,可在任意前端(Vue / React / Node / SSR)复用。",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|