@yh-ui/nuxt 0.1.56 → 1.0.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/README.md +5 -4
- package/dist/module.cjs +9 -4
- package/dist/module.d.cts +1 -1
- package/dist/module.d.mts +1 -1
- package/dist/module.d.ts +1 -1
- package/dist/module.mjs +9 -4
- package/dist/runtime/plugin.cjs +14 -0
- package/dist/runtime/plugin.d.cts +12 -0
- package/dist/runtime/plugin.d.mts +12 -0
- package/dist/runtime/plugin.d.ts +12 -0
- package/dist/runtime/plugin.mjs +12 -0
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -65,7 +65,7 @@ export default defineNuxtConfig({
|
|
|
65
65
|
})
|
|
66
66
|
```
|
|
67
67
|
|
|
68
|
-
开启 `importStyle` 时,Nuxt
|
|
68
|
+
开启 `importStyle` 时,Nuxt 模块会直接把显式 CSS 子路径 `@yh-ui/components/style.css` 注入到 `nuxt.options.css`,不会依赖应用侧的 Sass 环境,也能避免 Nuxt SSR 样式提取告警。
|
|
69
69
|
|
|
70
70
|
### 第 2 步:直接使用组件
|
|
71
71
|
|
|
@@ -95,7 +95,8 @@ const columns = [{ prop: 'name', label: '名称' }]
|
|
|
95
95
|
<script setup lang="ts">
|
|
96
96
|
// 以下 composable 均无需 import,直接使用
|
|
97
97
|
const ns = useNamespace('my-component') // BEM 类名
|
|
98
|
-
const id = useId() //
|
|
98
|
+
const id = useId() // Vue/Nuxt 原生稳定唯一 ID
|
|
99
|
+
const yhId = useYhId() // YH-UI hooks 别名导入
|
|
99
100
|
const { nextZIndex } = useZIndex() // z-index 管理
|
|
100
101
|
const { t } = useLocale() // i18n 翻译
|
|
101
102
|
</script>
|
|
@@ -139,7 +140,7 @@ export default defineNuxtConfig({
|
|
|
139
140
|
| `importStyle` | `boolean` | `true` | 是否自动注入 YH-UI CSS 样式 |
|
|
140
141
|
| `locale` | `string` | `'zh-CN'` | 默认语言代码(67 种可选) |
|
|
141
142
|
|
|
142
|
-
`importStyle` 为 `true`
|
|
143
|
+
`importStyle` 为 `true` 时,模块会直接向 `nuxt.options.css` 注入 `@yh-ui/components/style.css`。
|
|
143
144
|
|
|
144
145
|
---
|
|
145
146
|
|
|
@@ -181,7 +182,7 @@ YhAiBubble YhAiSender YhAiProvider ... 共 77+ 个
|
|
|
181
182
|
## 🪝 自动导入的 Composable
|
|
182
183
|
|
|
183
184
|
```
|
|
184
|
-
useNamespace
|
|
185
|
+
useNamespace useYhId useZIndex useLocale
|
|
185
186
|
useFormItem useConfig useCache useClickOutside
|
|
186
187
|
useEventListener useScrollLock useCountdown useSKU
|
|
187
188
|
useVirtualScroll useAI
|
package/dist/module.cjs
CHANGED
|
@@ -13,6 +13,7 @@ if (typeof crypto__default.hash !== "function") {
|
|
|
13
13
|
return crypto__default.createHash(algorithm).update(data).digest(outputEncoding);
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
|
+
const PUBLISHED_CSS_ENTRY = "@yh-ui/components/style.css";
|
|
16
17
|
const yhNuxtModule = kit.defineNuxtModule({
|
|
17
18
|
meta: {
|
|
18
19
|
name: "@yh-ui/nuxt",
|
|
@@ -31,10 +32,10 @@ const yhNuxtModule = kit.defineNuxtModule({
|
|
|
31
32
|
},
|
|
32
33
|
setup(options, nuxt) {
|
|
33
34
|
const { resolve } = kit.createResolver((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('module.cjs', document.baseURI).href)));
|
|
34
|
-
kit.addPlugin(resolve("./runtime/plugin"));
|
|
35
|
+
kit.addPlugin(resolve("./runtime/plugin.mjs"));
|
|
35
36
|
if (options.importStyle) {
|
|
36
|
-
if (!nuxt.options.css.includes(
|
|
37
|
-
nuxt.options.css.push(
|
|
37
|
+
if (!nuxt.options.css.includes(PUBLISHED_CSS_ENTRY)) {
|
|
38
|
+
nuxt.options.css.push(PUBLISHED_CSS_ENTRY);
|
|
38
39
|
}
|
|
39
40
|
}
|
|
40
41
|
if (options.buildTranspile) {
|
|
@@ -200,7 +201,6 @@ const yhNuxtModule = kit.defineNuxtModule({
|
|
|
200
201
|
"useFormItem",
|
|
201
202
|
"createZIndexCounter",
|
|
202
203
|
"useGlobalNamespace",
|
|
203
|
-
"useId",
|
|
204
204
|
"useVirtualScroll",
|
|
205
205
|
"useCache",
|
|
206
206
|
"useEventListener",
|
|
@@ -243,6 +243,11 @@ const yhNuxtModule = kit.defineNuxtModule({
|
|
|
243
243
|
from: "@yh-ui/hooks"
|
|
244
244
|
});
|
|
245
245
|
});
|
|
246
|
+
kit.addImports({
|
|
247
|
+
name: "useId",
|
|
248
|
+
as: "useYhId",
|
|
249
|
+
from: "@yh-ui/hooks"
|
|
250
|
+
});
|
|
246
251
|
const globalMethods = [
|
|
247
252
|
"YhMessage",
|
|
248
253
|
"YhNotification",
|
package/dist/module.d.cts
CHANGED
|
@@ -3,7 +3,7 @@ import * as _nuxt_schema from '@nuxt/schema';
|
|
|
3
3
|
interface ModuleOptions {
|
|
4
4
|
/**
|
|
5
5
|
* Whether to automatically inject published CSS styles.
|
|
6
|
-
* If true, it will import
|
|
6
|
+
* If true, it will import the published CSS entry.
|
|
7
7
|
* @default true
|
|
8
8
|
*/
|
|
9
9
|
importStyle?: boolean;
|
package/dist/module.d.mts
CHANGED
|
@@ -3,7 +3,7 @@ import * as _nuxt_schema from '@nuxt/schema';
|
|
|
3
3
|
interface ModuleOptions {
|
|
4
4
|
/**
|
|
5
5
|
* Whether to automatically inject published CSS styles.
|
|
6
|
-
* If true, it will import
|
|
6
|
+
* If true, it will import the published CSS entry.
|
|
7
7
|
* @default true
|
|
8
8
|
*/
|
|
9
9
|
importStyle?: boolean;
|
package/dist/module.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import * as _nuxt_schema from '@nuxt/schema';
|
|
|
3
3
|
interface ModuleOptions {
|
|
4
4
|
/**
|
|
5
5
|
* Whether to automatically inject published CSS styles.
|
|
6
|
-
* If true, it will import
|
|
6
|
+
* If true, it will import the published CSS entry.
|
|
7
7
|
* @default true
|
|
8
8
|
*/
|
|
9
9
|
importStyle?: boolean;
|
package/dist/module.mjs
CHANGED
|
@@ -6,6 +6,7 @@ if (typeof crypto.hash !== "function") {
|
|
|
6
6
|
return crypto.createHash(algorithm).update(data).digest(outputEncoding);
|
|
7
7
|
};
|
|
8
8
|
}
|
|
9
|
+
const PUBLISHED_CSS_ENTRY = "@yh-ui/components/style.css";
|
|
9
10
|
const yhNuxtModule = defineNuxtModule({
|
|
10
11
|
meta: {
|
|
11
12
|
name: "@yh-ui/nuxt",
|
|
@@ -24,10 +25,10 @@ const yhNuxtModule = defineNuxtModule({
|
|
|
24
25
|
},
|
|
25
26
|
setup(options, nuxt) {
|
|
26
27
|
const { resolve } = createResolver(import.meta.url);
|
|
27
|
-
addPlugin(resolve("./runtime/plugin"));
|
|
28
|
+
addPlugin(resolve("./runtime/plugin.mjs"));
|
|
28
29
|
if (options.importStyle) {
|
|
29
|
-
if (!nuxt.options.css.includes(
|
|
30
|
-
nuxt.options.css.push(
|
|
30
|
+
if (!nuxt.options.css.includes(PUBLISHED_CSS_ENTRY)) {
|
|
31
|
+
nuxt.options.css.push(PUBLISHED_CSS_ENTRY);
|
|
31
32
|
}
|
|
32
33
|
}
|
|
33
34
|
if (options.buildTranspile) {
|
|
@@ -193,7 +194,6 @@ const yhNuxtModule = defineNuxtModule({
|
|
|
193
194
|
"useFormItem",
|
|
194
195
|
"createZIndexCounter",
|
|
195
196
|
"useGlobalNamespace",
|
|
196
|
-
"useId",
|
|
197
197
|
"useVirtualScroll",
|
|
198
198
|
"useCache",
|
|
199
199
|
"useEventListener",
|
|
@@ -236,6 +236,11 @@ const yhNuxtModule = defineNuxtModule({
|
|
|
236
236
|
from: "@yh-ui/hooks"
|
|
237
237
|
});
|
|
238
238
|
});
|
|
239
|
+
addImports({
|
|
240
|
+
name: "useId",
|
|
241
|
+
as: "useYhId",
|
|
242
|
+
from: "@yh-ui/hooks"
|
|
243
|
+
});
|
|
239
244
|
const globalMethods = [
|
|
240
245
|
"YhMessage",
|
|
241
246
|
"YhNotification",
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const app = require('nuxt/app');
|
|
4
|
+
const hooks = require('@yh-ui/hooks');
|
|
5
|
+
const components = require('@yh-ui/components');
|
|
6
|
+
|
|
7
|
+
const plugin = app.defineNuxtPlugin((nuxtApp) => {
|
|
8
|
+
const zIndexCounter = hooks.createZIndexCounter();
|
|
9
|
+
nuxtApp.vueApp.provide(hooks.zIndexCounterKey, zIndexCounter);
|
|
10
|
+
nuxtApp.vueApp.directive("yh-loading", components.vLoading);
|
|
11
|
+
nuxtApp.vueApp.directive("yh-infinite-scroll", components.vYhInfiniteScroll);
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
module.exports = plugin;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { defineNuxtPlugin } from 'nuxt/app';
|
|
2
|
+
import { createZIndexCounter, zIndexCounterKey } from '@yh-ui/hooks';
|
|
3
|
+
import { vLoading, vYhInfiniteScroll } from '@yh-ui/components';
|
|
4
|
+
|
|
5
|
+
var plugin = defineNuxtPlugin((nuxtApp) => {
|
|
6
|
+
const zIndexCounter = createZIndexCounter();
|
|
7
|
+
nuxtApp.vueApp.provide(zIndexCounterKey, zIndexCounter);
|
|
8
|
+
nuxtApp.vueApp.directive("yh-loading", vLoading);
|
|
9
|
+
nuxtApp.vueApp.directive("yh-infinite-scroll", vYhInfiniteScroll);
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export = plugin;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { defineNuxtPlugin } from 'nuxt/app';
|
|
2
|
+
import { createZIndexCounter, zIndexCounterKey } from '@yh-ui/hooks';
|
|
3
|
+
import { vLoading, vYhInfiniteScroll } from '@yh-ui/components';
|
|
4
|
+
|
|
5
|
+
var plugin = defineNuxtPlugin((nuxtApp) => {
|
|
6
|
+
const zIndexCounter = createZIndexCounter();
|
|
7
|
+
nuxtApp.vueApp.provide(zIndexCounterKey, zIndexCounter);
|
|
8
|
+
nuxtApp.vueApp.directive("yh-loading", vLoading);
|
|
9
|
+
nuxtApp.vueApp.directive("yh-infinite-scroll", vYhInfiniteScroll);
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export { plugin as default };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { defineNuxtPlugin } from 'nuxt/app';
|
|
2
|
+
import { createZIndexCounter, zIndexCounterKey } from '@yh-ui/hooks';
|
|
3
|
+
import { vLoading, vYhInfiniteScroll } from '@yh-ui/components';
|
|
4
|
+
|
|
5
|
+
var plugin = defineNuxtPlugin((nuxtApp) => {
|
|
6
|
+
const zIndexCounter = createZIndexCounter();
|
|
7
|
+
nuxtApp.vueApp.provide(zIndexCounterKey, zIndexCounter);
|
|
8
|
+
nuxtApp.vueApp.directive("yh-loading", vLoading);
|
|
9
|
+
nuxtApp.vueApp.directive("yh-infinite-scroll", vYhInfiniteScroll);
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export = plugin;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { defineNuxtPlugin } from 'nuxt/app';
|
|
2
|
+
import { createZIndexCounter, zIndexCounterKey } from '@yh-ui/hooks';
|
|
3
|
+
import { vLoading, vYhInfiniteScroll } from '@yh-ui/components';
|
|
4
|
+
|
|
5
|
+
const plugin = defineNuxtPlugin((nuxtApp) => {
|
|
6
|
+
const zIndexCounter = createZIndexCounter();
|
|
7
|
+
nuxtApp.vueApp.provide(zIndexCounterKey, zIndexCounter);
|
|
8
|
+
nuxtApp.vueApp.directive("yh-loading", vLoading);
|
|
9
|
+
nuxtApp.vueApp.directive("yh-infinite-scroll", vYhInfiniteScroll);
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export { plugin as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yh-ui/nuxt",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Nuxt module for YH-UI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/module.cjs",
|
|
@@ -18,8 +18,9 @@
|
|
|
18
18
|
],
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@nuxt/kit": "^3.11.0 || ^4.0.0",
|
|
21
|
-
"@yh-ui/components": "^0.1
|
|
22
|
-
"@yh-ui/
|
|
21
|
+
"@yh-ui/components": "^1.0.1",
|
|
22
|
+
"@yh-ui/hooks": "^1.0.1",
|
|
23
|
+
"@yh-ui/theme": "^1.0.1"
|
|
23
24
|
},
|
|
24
25
|
"devDependencies": {
|
|
25
26
|
"@nuxt/schema": "^3.11.0 || ^4.0.0",
|