@movk/nuxt 1.8.0 → 1.8.2

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/.nuxt/movk-ui.css CHANGED
@@ -1,3 +1,3 @@
1
- @source "/Users/yixuanmiao/Projects/movk-nuxt/**/*";
1
+ @source "/home/runner/work/movk-nuxt/movk-nuxt/**/*";
2
2
  @source "./movk-ui";
3
3
  @source inline("{,sm:,md:,lg:,xl:}grid-cols-{1,2,3,4,5,6,7,8,9,10,11,12}");
package/dist/module.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@movk/nuxt",
3
- "version": "1.8.0",
3
+ "version": "1.8.2",
4
4
  "configKey": "movk",
5
5
  "compatibility": {
6
6
  "nuxt": ">=4.4.2"
package/dist/module.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { resolveAlias, useLogger, addPlugin, defineNuxtModule, createResolver, addComponentsDir, addImportsDir } from '@nuxt/kit';
2
2
  import defu, { defu as defu$1 } from 'defu';
3
- import { U as UI_COMPONENTS, r as resolveMovkIcons, f as formatMissingCollections, a as addTemplates } from './shared/nuxt.BT5mXYjs.mjs';
3
+ import { U as UI_COMPONENTS, r as resolveMovkIcons, f as formatMissingCollections, a as addTemplates } from './shared/nuxt.C7xx2FPO.mjs';
4
4
  import { getPackageJsonMetadata } from '../dist/runtime/utils/meta.js';
5
5
  import { kebabCase } from 'scule';
6
6
  import { updateSiteConfig } from 'nuxt-site-config/kit';
@@ -15,7 +15,7 @@ import 'pathe';
15
15
  import 'tinyglobby';
16
16
 
17
17
  const name = "@movk/nuxt";
18
- const version = "1.8.0";
18
+ const version = "1.8.2";
19
19
 
20
20
  const MOVK_CSS_IMPORT = /@import\s+["']@movk\/nuxt["']/;
21
21
  async function checkMovkCss(nuxt) {
@@ -14,6 +14,8 @@ import { Tree, useInfiniteScrollBinding, separate } from "@movk/core";
14
14
  import theme from "#build/movk-ui/data-table";
15
15
  import tableTheme from "#build/ui/table";
16
16
  import DataTablePagination from "../domains/data-table/components/Pagination.vue";
17
+ const HEADER_SLOT_SUFFIX = "-header";
18
+ const PAGINATION_SLOTS = ["pagination", "pagination-summary", "pagination-actions"];
17
19
  const props = defineProps({
18
20
  rowKey: { type: [String, Object], required: false },
19
21
  columns: { type: Array, required: false },
@@ -76,8 +78,17 @@ const columnVisibilityKeysState = defineModel("columnVisibilityKeys", { type: Ar
76
78
  const columnVisibilityExcludeKeysState = defineModel("columnVisibilityExcludeKeys", { type: Array });
77
79
  const rowSelectionKeysState = defineModel("rowSelectionKeys", { type: Array });
78
80
  const expandedKeysState = defineModel("expandedKeys", { type: Array });
79
- defineSlots();
80
- const resolved = computed(() => resolveColumns(props.columns || [], props));
81
+ const slots = defineSlots();
82
+ const slotRecord = slots;
83
+ const headerSlots = Object.fromEntries(
84
+ Object.keys(slots).filter((name) => name.endsWith(HEADER_SLOT_SUFFIX)).map((name) => [name, (ctx) => slotRecord[name]?.(ctx) ?? []])
85
+ );
86
+ const resolved = computed(() => resolveColumns(props.columns || [], props, headerSlots));
87
+ const forwardSlots = computed(() => Object.keys(slots).filter((name) => {
88
+ if (PAGINATION_SLOTS.includes(name)) return false;
89
+ if (!name.endsWith(HEADER_SLOT_SUFFIX)) return true;
90
+ return !resolved.value.allColumnIds.includes(name.slice(0, -HEADER_SLOT_SUFFIX.length));
91
+ }));
81
92
  function hasEntries(v) {
82
93
  return typeof v === "object" && v !== null && Object.keys(v).length > 0;
83
94
  }
@@ -556,28 +567,9 @@ defineExpose({
556
567
  :style="borderedStyle"
557
568
  v-bind="uTableProps"
558
569
  >
559
- <template v-if="$slots.expanded" #expanded="{ row }">
560
- <slot name="expanded" :row="row" />
561
- </template>
562
-
563
- <template v-if="$slots.empty" #empty>
564
- <slot name="empty" />
565
- </template>
566
-
567
- <template v-if="$slots.loading" #loading>
568
- <slot name="loading" />
569
- </template>
570
-
571
- <template v-if="$slots.caption" #caption>
572
- <slot name="caption" />
573
- </template>
574
-
575
- <template v-if="$slots['body-top']" #body-top>
576
- <slot name="body-top" />
577
- </template>
578
-
579
- <template v-if="$slots['body-bottom']" #body-bottom>
580
- <slot name="body-bottom" />
570
+ <!-- 插槽名是联合类型,vue-tsc 会把作用域参数收敛成全部插槽 props 的交叉类型,转发时只能绕过 -->
571
+ <template v-for="name in forwardSlots" #[name]="slotProps" :key="name">
572
+ <slot :name="name" v-bind="slotProps ?? {}" />
581
573
  </template>
582
574
  </UTable>
583
575
 
@@ -25,10 +25,10 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
25
25
  onDragStart?: (() => any) | undefined;
26
26
  onDragEnd?: ((success: boolean) => any) | undefined;
27
27
  }>, {
28
- icon: import("@nuxt/ui").IconProps["name"];
28
+ icon: any;
29
29
  text: string;
30
30
  successText: string;
31
- successIcon: import("@nuxt/ui").IconProps["name"];
31
+ successIcon: any;
32
32
  threshold: number;
33
33
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
34
34
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
@@ -25,10 +25,10 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
25
25
  onDragStart?: (() => any) | undefined;
26
26
  onDragEnd?: ((success: boolean) => any) | undefined;
27
27
  }>, {
28
- icon: import("@nuxt/ui").IconProps["name"];
28
+ icon: any;
29
29
  text: string;
30
30
  successText: string;
31
- successIcon: import("@nuxt/ui").IconProps["name"];
31
+ successIcon: any;
32
32
  threshold: number;
33
33
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
34
34
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
@@ -474,8 +474,8 @@ declare const DEFAULT_CONTROL_COMPONENTS: {
474
474
  };
475
475
  readonly slideVerify: {
476
476
  new (...args: any[]): import("vue").CreateComponentPublicInstanceWithMixins<Readonly<import("../../types").SlideVerifyProps & {
477
- size?: import("@nuxt/ui").ComponentConfig<typeof UInput, import("nuxt/schema").AppConfig, "slideVerify">["variants"]["size"];
478
- ui?: import("@nuxt/ui").ComponentConfig<typeof UInput, import("nuxt/schema").AppConfig, "slideVerify">["slots"];
477
+ size?: import("@nuxt/ui").ComponentConfig<typeof UInput, import("@nuxt/schema").AppConfig, "slideVerify">["variants"]["size"];
478
+ ui?: import("@nuxt/ui").ComponentConfig<typeof UInput, import("@nuxt/schema").AppConfig, "slideVerify">["slots"];
479
479
  } & {
480
480
  modelValue?: boolean;
481
481
  }> & Readonly<{
@@ -491,10 +491,10 @@ declare const DEFAULT_CONTROL_COMPONENTS: {
491
491
  dragStart: () => any;
492
492
  dragEnd: (success: boolean) => any;
493
493
  }, import("vue").PublicProps, {
494
- icon: import("@nuxt/ui").IconProps["name"];
494
+ icon: any;
495
495
  text: string;
496
496
  successText: string;
497
- successIcon: import("@nuxt/ui").IconProps["name"];
497
+ successIcon: any;
498
498
  threshold: number;
499
499
  }, false, {}, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {}, any, import("vue").ComponentProvideOptions, {
500
500
  P: {};
@@ -504,8 +504,8 @@ declare const DEFAULT_CONTROL_COMPONENTS: {
504
504
  M: {};
505
505
  Defaults: {};
506
506
  }, Readonly<import("../../types").SlideVerifyProps & {
507
- size?: import("@nuxt/ui").ComponentConfig<typeof UInput, import("nuxt/schema").AppConfig, "slideVerify">["variants"]["size"];
508
- ui?: import("@nuxt/ui").ComponentConfig<typeof UInput, import("nuxt/schema").AppConfig, "slideVerify">["slots"];
507
+ size?: import("@nuxt/ui").ComponentConfig<typeof UInput, import("@nuxt/schema").AppConfig, "slideVerify">["variants"]["size"];
508
+ ui?: import("@nuxt/ui").ComponentConfig<typeof UInput, import("@nuxt/schema").AppConfig, "slideVerify">["slots"];
509
509
  } & {
510
510
  modelValue?: boolean;
511
511
  }> & Readonly<{
@@ -516,18 +516,18 @@ declare const DEFAULT_CONTROL_COMPONENTS: {
516
516
  }>, {
517
517
  reset: () => void;
518
518
  }, {}, {}, {}, {
519
- icon: import("@nuxt/ui").IconProps["name"];
519
+ icon: any;
520
520
  text: string;
521
521
  successText: string;
522
- successIcon: import("@nuxt/ui").IconProps["name"];
522
+ successIcon: any;
523
523
  threshold: number;
524
524
  }>;
525
525
  __isFragment?: never;
526
526
  __isTeleport?: never;
527
527
  __isSuspense?: never;
528
528
  } & import("vue").ComponentOptionsBase<Readonly<import("../../types").SlideVerifyProps & {
529
- size?: import("@nuxt/ui").ComponentConfig<typeof UInput, import("nuxt/schema").AppConfig, "slideVerify">["variants"]["size"];
530
- ui?: import("@nuxt/ui").ComponentConfig<typeof UInput, import("nuxt/schema").AppConfig, "slideVerify">["slots"];
529
+ size?: import("@nuxt/ui").ComponentConfig<typeof UInput, import("@nuxt/schema").AppConfig, "slideVerify">["variants"]["size"];
530
+ ui?: import("@nuxt/ui").ComponentConfig<typeof UInput, import("@nuxt/schema").AppConfig, "slideVerify">["slots"];
531
531
  } & {
532
532
  modelValue?: boolean;
533
533
  }> & Readonly<{
@@ -543,10 +543,10 @@ declare const DEFAULT_CONTROL_COMPONENTS: {
543
543
  dragStart: () => any;
544
544
  dragEnd: (success: boolean) => any;
545
545
  }, string, {
546
- icon: import("@nuxt/ui").IconProps["name"];
546
+ icon: any;
547
547
  text: string;
548
548
  successText: string;
549
- successIcon: import("@nuxt/ui").IconProps["name"];
549
+ successIcon: any;
550
550
  threshold: number;
551
551
  }, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & (new () => {
552
552
  $slots: import("../../types").SlideVerifySlots;
@@ -1,4 +1,5 @@
1
- import type { ColumnDef, ColumnMeta, ColumnPinningState, ColumnSizingState, VisibilityState } from '@tanstack/vue-table';
1
+ import type { ColumnDef, ColumnMeta, ColumnPinningState, ColumnSizingState, HeaderContext, VisibilityState } from '@tanstack/vue-table';
2
+ import type { VNode } from 'vue';
2
3
  import type { DataTableDensityPreset, DataTableSizePreset, DataTableTreeSelectionStrategy } from '../../../types/data-table';
3
4
  import type { DataTableProps } from '../../../types/data-table/component';
4
5
  export declare const DENSITY_PRESETS: Record<DataTableDensityPreset, {
@@ -30,8 +31,12 @@ export interface ResolvedColumnState<T> {
30
31
  subRowSelection?: boolean;
31
32
  allColumnIds: string[];
32
33
  }
34
+ /** 列表头插槽渲染器,键为 `<columnId>-header` */
35
+ export type HeaderSlotMap<T> = Record<string, ((ctx: HeaderContext<T, unknown>) => VNode[]) | undefined>;
33
36
  export interface ResolveContext<T> {
34
37
  options: DataTableProps<T>;
38
+ /** 用户提供的表头插槽,命中列 id 时取代该列 header 标签 */
39
+ headerSlots?: HeaderSlotMap<T>;
35
40
  density: ColumnMeta<T, unknown>['class'] | null;
36
41
  pinning: ColumnPinningState;
37
42
  visibility: VisibilityState;
@@ -1,4 +1,4 @@
1
1
  import type { DataTableColumn } from '../../../types/data-table';
2
- import type { ResolvedColumnState } from './constants';
2
+ import type { HeaderSlotMap, ResolvedColumnState } from './constants';
3
3
  import type { DataTableProps } from '../../../types/data-table/component';
4
- export declare function resolveColumns<T>(columns: DataTableColumn<T>[], options: DataTableProps<T>): ResolvedColumnState<T>;
4
+ export declare function resolveColumns<T>(columns: DataTableColumn<T>[], options: DataTableProps<T>, headerSlots?: HeaderSlotMap<T>): ResolvedColumnState<T>;
@@ -29,10 +29,11 @@ function resolveColumn(col, ctx, inheritedFixed) {
29
29
  }
30
30
  return col;
31
31
  }
32
- export function resolveColumns(columns, options) {
32
+ export function resolveColumns(columns, options, headerSlots) {
33
33
  let groupCounter = 0;
34
34
  const ctx = {
35
35
  options,
36
+ headerSlots,
36
37
  density: options.density ? isString(options.density) ? DENSITY_PRESETS[options.density] : options.density : null,
37
38
  pinning: { left: [], right: [] },
38
39
  visibility: {},
@@ -1,4 +1,4 @@
1
- import { h, isVNode } from "vue";
1
+ import { Fragment, h, isVNode } from "vue";
2
2
  import { resolveCallbackValue, resolveColumnFlag, resolveTemplate } from "./utils.js";
3
3
  import DataTableCellTooltip from "../components/CellTooltip.vue";
4
4
  import { UButton } from "#components";
@@ -112,7 +112,7 @@ export function renderHeaderActions(ctx, col, options, label, sortable, pinable,
112
112
  const leading = actions.filter((a) => a.position === "leading").map((a) => a.render(ctx));
113
113
  const trailing = actions.filter((a) => a.position === "trailing").map((a) => a.render(ctx));
114
114
  const resizeHandle = resizable ? buildResizeHandle(ctx, options) : null;
115
- const labelNode = isVNode(label) ? label : h("span", { class: "truncate" }, String(label ?? ""));
115
+ const labelNode = Array.isArray(label) ? h(Fragment, label) : isVNode(label) ? label : h("span", { class: "truncate" }, String(label ?? ""));
116
116
  return h("div", { class: "flex items-center gap-1 group" }, [
117
117
  ...leading,
118
118
  labelNode,
@@ -133,9 +133,10 @@ export function resolveDataColumn(col, ctx, inheritedFixed) {
133
133
  if (col.visibility === false) ctx.visibility[id] = false;
134
134
  ctx.allColumnIds.push(id);
135
135
  const cellRenderer = buildDataCellRenderer(col, options);
136
+ const headerSlot = ctx.headerSlots?.[`${id}-header`];
136
137
  const def = {
137
138
  accessorKey: id,
138
- header: effectiveSortable || effectivePinable || effectiveResizable ? (hctx) => renderHeaderActions(hctx, col, options, col.header ?? id, effectiveSortable, effectivePinable, effectiveResizable) : col.header ?? id,
139
+ header: effectiveSortable || effectivePinable || effectiveResizable ? (hctx) => renderHeaderActions(hctx, col, options, headerSlot ? headerSlot(hctx) : col.header ?? id, effectiveSortable, effectivePinable, effectiveResizable) : headerSlot ? (hctx) => headerSlot(hctx) : col.header ?? id,
139
140
  ...col.minSize != null && { minSize: col.minSize },
140
141
  ...col.maxSize != null && { maxSize: col.maxSize },
141
142
  ...resolvedSize != null && { size: resolvedSize },
@@ -42,10 +42,11 @@ function buildSpecialColumnDef(col, type, ctx, render) {
42
42
  ctx.flags.hasResizing ||= effectiveResizable;
43
43
  const effectiveAlign = col.align ?? defaults.align;
44
44
  const alignClass = resolveAlignClass(effectiveAlign);
45
+ const headerSlot = ctx.headerSlots?.[`${id}-header`];
45
46
  const resolvedHeader = effectivePinable || effectiveResizable ? (hctx) => {
46
- const label = isFunction(render.header) ? render.header(hctx) : render.header ?? "";
47
+ const label = headerSlot ? headerSlot(hctx) : isFunction(render.header) ? render.header(hctx) : render.header ?? "";
47
48
  return renderHeaderActions(hctx, col, options, label, false, effectivePinable, effectiveResizable);
48
- } : render.header;
49
+ } : headerSlot ? (hctx) => headerSlot(hctx) : render.header;
49
50
  const classMeta = buildClassMeta(density, alignClass, effectiveResizable, defaults.tdClass);
50
51
  const checkboxClass = type === "selection" ? {
51
52
  td: [classMeta?.td, "[&:has([role=checkbox])]:px-0"].filter(Boolean).join(" "),
@@ -1,4 +1,5 @@
1
- import type { $Fetch } from 'nitropack/types';
1
+ import type { $Fetch, AvailableRouterMethod } from 'nitropack/types';
2
+ import type { MaybeRefOrGetter } from 'vue';
2
3
  import type { FetchError } from 'ofetch';
3
4
  import type { UseFetchOptions as NuxtUseFetchOptions, AsyncData } from 'nuxt/app';
4
5
  import type { RequestToastOptions, ApiError } from './response';
@@ -33,7 +34,9 @@ export type ApiInstance = $Fetch & {
33
34
  * @template T - 业务数据类型(已解包)
34
35
  * @template DataT - transform 转换后的类型(默认等于 T)
35
36
  */
36
- export type UseApiFetchOptions<T = unknown, DataT = T> = Omit<NuxtUseFetchOptions<T, DataT>, '$fetch' | 'context'> & {
37
+ export type UseApiFetchOptions<T = unknown, DataT = T> = Omit<NuxtUseFetchOptions<T, DataT>, '$fetch' | 'context' | 'method'> & {
38
+ /** 请求方法;请求经端点 baseURL 发往外部服务,不按本地 Nitro 路由收窄 */
39
+ method?: MaybeRefOrGetter<AvailableRouterMethod<string> | Uppercase<AvailableRouterMethod<string>>>;
37
40
  /** 使用的端点名称(默认使用 defaultEndpoint) */
38
41
  endpoint?: MovkApiEndpointName;
39
42
  /** Toast 提示配置,设置为 false 禁用提示 */
@@ -1,4 +1,4 @@
1
- import type { CellContext, ColumnDefTemplate, ColumnMeta, PaginationState, Row, Table, TableMeta } from '@tanstack/vue-table';
1
+ import type { CellContext, ColumnDefTemplate, ColumnMeta, HeaderContext, PaginationState, Row, Table, TableMeta } from '@tanstack/vue-table';
2
2
  import type { ButtonProps, TableData, TableProps, TableRow, TooltipProps } from '@nuxt/ui';
3
3
  import type { FirstParameter, OmitByKey } from '@movk/core';
4
4
  import type { VNode } from 'vue';
@@ -180,7 +180,7 @@ export interface DataTablePaginationSlotProps<T extends TableData> {
180
180
  setPage: (page: number) => void;
181
181
  setPageSize: (pageSize: unknown) => void;
182
182
  }
183
- export interface DataTableSlots<T extends TableData> {
183
+ interface DataTableNamedSlots<T extends TableData> {
184
184
  'expanded'(props: {
185
185
  row: Row<T>;
186
186
  }): VNode[];
@@ -193,3 +193,11 @@ export interface DataTableSlots<T extends TableData> {
193
193
  'pagination-summary'(props: FirstParameter<DataTablePaginationSlots<T>['summary']>): VNode[];
194
194
  'pagination-actions'(props: FirstParameter<DataTablePaginationSlots<T>['actions']>): VNode[];
195
195
  }
196
+ /**
197
+ * 按列 id 命名的动态插槽,转发至 UTable:
198
+ * `<id>-header` 由 MDataTable 注入列表头标签位(排序/固定按钮与 resize 手柄保留),
199
+ * `<id>-cell` / `<id>-footer` 整体替换单元格与表尾内容
200
+ */
201
+ type DataTableColumnSlots<T extends TableData> = Record<`${string}-header` | `${string}-footer`, (props: HeaderContext<T, unknown>) => VNode[]> & Record<`${string}-cell`, (props: CellContext<T, unknown>) => VNode[]>;
202
+ export type DataTableSlots<T extends TableData> = DataTableNamedSlots<T> & Partial<DataTableColumnSlots<T>>;
203
+ export {};
@@ -612,14 +612,6 @@ declare module 'nuxt/schema' {
612
612
  ['movk']: ModuleOptions
613
613
  }
614
614
 
615
- interface AppConfig {
616
- /**
617
- * Movk UI theme configuration
618
- * @see https://nuxt.mhaibaraai.cn/docs/getting-started/theme
619
- */
620
- movk?: AppConfigUI
621
- }
622
-
623
615
  interface PublicRuntimeConfig {
624
616
  movkApi: MovkApiPublicConfig
625
617
  }
@@ -641,6 +633,10 @@ declare module '@nuxt/schema' {
641
633
  */
642
634
  movk?: AppConfigUI
643
635
  }
636
+
637
+ interface CustomAppConfig {
638
+ movk?: AppConfigUI
639
+ }
644
640
  }
645
641
 
646
642
  export {}
package/dist/unplugin.mjs CHANGED
@@ -8,7 +8,7 @@ import MagicString from 'magic-string';
8
8
  import { resolvePathSync } from 'mlly';
9
9
  import fs from 'node:fs';
10
10
  import path from 'node:path';
11
- import { U as UI_COMPONENTS, g as getTemplates, r as resolveMovkIcons, f as formatMissingCollections } from './shared/nuxt.BT5mXYjs.mjs';
11
+ import { U as UI_COMPONENTS, g as getTemplates, r as resolveMovkIcons, f as formatMissingCollections } from './shared/nuxt.C7xx2FPO.mjs';
12
12
  import { kebabCase } from 'scule';
13
13
  import { getDefaultConfig } from '../dist/runtime/utils/theme-defaults.js';
14
14
  import { getPackageJsonMetadata } from '../dist/runtime/utils/meta.js';
@@ -142,6 +142,7 @@ const UI_COLOR_DEFAULTS = {
142
142
  neutral: "slate"
143
143
  };
144
144
  function MovkAppConfigPlugin(options) {
145
+ const defuPath = resolvePathSync("defu", { url: import.meta.url });
145
146
  const movkDefault = JSON.stringify(getDefaultConfig(options.theme));
146
147
  const colorDefaults = JSON.stringify(UI_COLOR_DEFAULTS);
147
148
  let movkSite = JSON.stringify(options.site ?? {});
@@ -160,7 +161,7 @@ function MovkAppConfigPlugin(options) {
160
161
  if (!id.includes("nuxt-ui-app-config")) return;
161
162
  if (!code.includes("export default")) return;
162
163
  const injected = [
163
- `import { defu as __movkDefu } from 'defu'`,
164
+ `import { defu as __movkDefu } from ${JSON.stringify(defuPath)}`,
164
165
  code.replace("export default", "const __movkUiAppConfig ="),
165
166
  `export default __movkDefu({`,
166
167
  ` movk: ${movkDefault},`,
@@ -216,6 +217,64 @@ function MovkFontPlugin(options) {
216
217
  };
217
218
  }
218
219
 
220
+ const DOCS_URL = "https://nuxt.mhaibaraai.cn/docs/getting-started/vue";
221
+ const RESET_SELECTOR_RE = /(?:^|[}\s])(?:\*\s*,\s*::?(?:before|after)|button\s*,\s*input)\b/;
222
+ function stripLayerBlocks(css) {
223
+ let out = "";
224
+ let i = 0;
225
+ while (i < css.length) {
226
+ const start = css.indexOf("@layer", i);
227
+ if (start === -1) {
228
+ out += css.slice(i);
229
+ break;
230
+ }
231
+ out += css.slice(i, start);
232
+ const open = css.indexOf("{", start);
233
+ const semi = css.indexOf(";", start);
234
+ if (open === -1 || semi !== -1 && semi < open) {
235
+ i = semi === -1 ? css.length : semi + 1;
236
+ continue;
237
+ }
238
+ let depth = 1;
239
+ let j = open + 1;
240
+ while (j < css.length && depth > 0) {
241
+ if (css[j] === "{") depth++;
242
+ else if (css[j] === "}") depth--;
243
+ j++;
244
+ }
245
+ i = j;
246
+ }
247
+ return out;
248
+ }
249
+ function hasUnlayeredReset(css) {
250
+ return RESET_SELECTOR_RE.test(stripLayerBlocks(css));
251
+ }
252
+ const WARNING = [
253
+ "UnoCSS \u8F93\u51FA\u4E86\u672A\u5206\u5C42\u7684 reset\uFF08preflights\uFF09\uFF0C\u4F1A\u8986\u76D6 Nuxt UI \u4F4D\u4E8E @layer utilities \u7684\u6837\u5F0F\uFF08\u80CC\u666F\u3001\u5185\u8FB9\u8DDD\u3001\u5706\u89D2\u7B49\u5931\u6548\uFF09\u3002",
254
+ "\u8BF7\u5728 uno.config \u4E2D\u5173\u95ED\uFF1ApresetWind4({ preflights: { reset: false } })\uFF0CTailwind \u7684 @layer base \u5DF2\u63D0\u4F9B\u7B49\u4EF7 reset\u3002",
255
+ `\u8BE6\u89C1 ${DOCS_URL}`
256
+ ].join("\n");
257
+ function MovkCompatPlugin() {
258
+ return {
259
+ name: "movk:compat",
260
+ vite: {
261
+ apply: "serve",
262
+ async configResolved(config) {
263
+ const unoApi = config.plugins.find((p) => p.name === "unocss:api")?.api;
264
+ if (!unoApi) return;
265
+ try {
266
+ const ctx = unoApi.getContext();
267
+ await ctx.ready;
268
+ if (ctx.uno.config.outputToCssLayers) return;
269
+ const { css } = await ctx.uno.generate("", { preflights: true });
270
+ if (hasUnlayeredReset(css)) console.warn(`[movk] ${WARNING}`);
271
+ } catch {
272
+ }
273
+ }
274
+ }
275
+ };
276
+ }
277
+
219
278
  const runtimeDir = normalize(fileURLToPath(new URL("./runtime", import.meta.url)));
220
279
  const MOVK_COMPOSABLES = {
221
280
  useAutoForm: ["useAutoForm", "defineControl", "DEFAULT_CONTROLS", "getAutoFormMetadata"],
@@ -280,7 +339,8 @@ const MovkPlugin = createUnplugin((_options = {}, meta) => {
280
339
  ...Array.isArray(uiPlugins) ? uiPlugins : [uiPlugins],
281
340
  MovkTemplatePlugin(options),
282
341
  MovkFontPlugin(options),
283
- MovkPluginsPlugin(options)
342
+ MovkPluginsPlugin(options),
343
+ MovkCompatPlugin()
284
344
  ].flat(1);
285
345
  });
286
346
 
package/dist/vite.mjs CHANGED
@@ -9,7 +9,7 @@ import 'magic-string';
9
9
  import 'mlly';
10
10
  import 'node:fs';
11
11
  import 'node:path';
12
- import './shared/nuxt.BT5mXYjs.mjs';
12
+ import './shared/nuxt.C7xx2FPO.mjs';
13
13
  import 'scule';
14
14
  import '@nuxt/kit';
15
15
  import '../dist/runtime/domains/theme/theme-font.js';
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@movk/nuxt",
3
3
  "type": "module",
4
- "version": "1.8.0",
5
- "packageManager": "pnpm@11.22.0",
4
+ "version": "1.8.2",
5
+ "packageManager": "pnpm@12.11.2",
6
6
  "description": "An engineering suite built on Nuxt UI: schema-driven AutoForm (Zod v4), a full-featured DataTable, standalone UI components and composables. Get the full capabilities — including API integration with auth & progress — in Nuxt 4, and use its UI, forms, tables and theming in plain Vue + Vite via the Vite plugin.",
7
7
  "author": "YiXuan <mhaibaraai@gmail.com>",
8
8
  "license": "MIT",
@@ -128,7 +128,7 @@
128
128
  "dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxt prepare playgrounds/play && nuxt prepare docs && pnpm dev:vue:build",
129
129
  "docs": "nuxt dev docs --uiDev",
130
130
  "docs:build": "nuxt build docs",
131
- "release": "release-it && npm publish",
131
+ "release": "release-it",
132
132
  "lint": "eslint .",
133
133
  "lint:fix": "eslint . --fix",
134
134
  "typecheck": "vue-tsc --noEmit && nuxt typecheck playgrounds/play && nuxt typecheck docs && cd playgrounds/vue && vue-tsc --noEmit",
@@ -137,50 +137,50 @@
137
137
  "test:vue": "vitest --project vue"
138
138
  },
139
139
  "dependencies": {
140
- "@internationalized/date": "^3.12.3",
141
- "@movk/core": "^1.4.1",
140
+ "@internationalized/date": "^3.12.4",
141
+ "@movk/core": "^1.5.0",
142
142
  "@nuxt/image": "^2.1.0",
143
- "@nuxt/ui": "^4.10.0",
143
+ "@nuxt/ui": "^4.11.3",
144
144
  "@tanstack/vue-table": "^8.21.3",
145
- "@vueuse/core": "^14.4.0",
146
- "@vueuse/nuxt": "^14.4.0",
145
+ "@vueuse/core": "^15.0.0",
146
+ "@vueuse/nuxt": "^15.0.0",
147
147
  "colortranslator": "^6.1.1",
148
148
  "defu": "^6.1.7",
149
- "eventsource-parser": "^4.0.0",
150
- "magic-string": "^1.2.0",
151
- "maska": "^3.2.0",
149
+ "eventsource-parser": "^4.1.1",
150
+ "magic-string": "^1.4.3",
151
+ "maska": "^3.2.2",
152
152
  "mlly": "^1.8.2",
153
- "nuxt-auth-utils": "^0.5.30",
153
+ "nuxt-auth-utils": "^0.5.31",
154
154
  "nuxt-site-config": "^4.2.3",
155
155
  "pathe": "^2.0.3",
156
- "reka-ui": "2.10.1",
156
+ "reka-ui": "2.10.5",
157
157
  "scule": "^1.3.0",
158
158
  "tailwind-variants": "^3.3.1",
159
159
  "tailwindcss": "^4.3.3",
160
160
  "tinyglobby": "^0.2.17",
161
- "unplugin": "^3.3.0",
162
- "zod": "^4.4.3"
161
+ "unplugin": "^3.4.0",
162
+ "zod": "^4.6.5"
163
163
  },
164
164
  "devDependencies": {
165
- "@iconify-json/lucide": "^1.2.123",
165
+ "@iconify-json/lucide": "^1.2.142",
166
166
  "@iconify-json/ph": "^1.2.2",
167
- "@iconify-json/tabler": "^1.2.38",
167
+ "@iconify-json/tabler": "^1.2.42",
168
168
  "@nuxt/eslint-config": "^1.17.0",
169
- "@nuxt/kit": "^4.5.2",
169
+ "@nuxt/kit": "^4.6.1",
170
170
  "@nuxt/module-builder": "^1.0.3",
171
- "@nuxt/schema": "^4.5.2",
172
- "@release-it/conventional-changelog": "^12.0.0",
173
- "ai": "^7.0.68",
174
- "eslint": "^10.8.1",
175
- "happy-dom": "^20.11.2",
176
- "nuxt": "^4.5.2",
177
- "release-it": "^21.0.2",
171
+ "@nuxt/schema": "^4.6.1",
172
+ "@release-it/conventional-changelog": "^12.0.2",
173
+ "ai": "^7.0.137",
174
+ "eslint": "^10.12.0",
175
+ "happy-dom": "^20.14.6",
176
+ "nuxt": "^4.6.1",
177
+ "release-it": "^21.1.1",
178
178
  "typescript": "^6.0.3",
179
179
  "unbuild": "^3.6.1",
180
180
  "unplugin-auto-import": "^21.1.0",
181
181
  "unplugin-vue-components": "^32.1.0",
182
- "vitest": "^4.1.10",
183
- "vue": "^3.5.41",
184
- "vue-tsc": "^3.3.10"
182
+ "vitest": "^5.0.3",
183
+ "vue": "^3.5.43",
184
+ "vue-tsc": "^3.3.13"
185
185
  }
186
186
  }