@yh-ui/components 1.0.43 → 1.0.44

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.
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.parseDate = exports.generateCalendar = exports.formatDate = exports.DEFAULT_FORMATS = void 0;
7
7
  var _dayjs = _interopRequireDefault(require("../../dayjs.cjs"));
8
- var _dayjsPlugins = require("../../dayjs-plugins.cjs");
8
+ var _dayjsPlugins = require("../../dayjs-plugins");
9
9
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
10
  _dayjs.default.extend(_dayjsPlugins.isBetweenPlugin);
11
11
  _dayjs.default.extend(_dayjsPlugins.weekOfYearPlugin);
@@ -6,7 +6,7 @@ import {
6
6
  isoWeekPlugin,
7
7
  quarterOfYearPlugin,
8
8
  weekOfYearPlugin
9
- } from "../../dayjs-plugins.mjs";
9
+ } from "../../dayjs-plugins";
10
10
  dayjs.extend(isBetweenPlugin);
11
11
  dayjs.extend(weekOfYearPlugin);
12
12
  dayjs.extend(isoWeekPlugin);
@@ -1,48 +1,32 @@
1
- "use strict";
1
+ 'use strict';
2
2
 
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "advancedFormatPlugin", {
7
- enumerable: true,
8
- get: function () {
9
- return _advancedFormat.default;
10
- }
11
- });
12
- Object.defineProperty(exports, "customParseFormatPlugin", {
13
- enumerable: true,
14
- get: function () {
15
- return _customParseFormat.default;
16
- }
17
- });
18
- Object.defineProperty(exports, "isBetweenPlugin", {
19
- enumerable: true,
20
- get: function () {
21
- return _isBetween.default;
22
- }
23
- });
24
- Object.defineProperty(exports, "isoWeekPlugin", {
25
- enumerable: true,
26
- get: function () {
27
- return _isoWeek.default;
28
- }
29
- });
30
- Object.defineProperty(exports, "quarterOfYearPlugin", {
31
- enumerable: true,
32
- get: function () {
33
- return _quarterOfYear.default;
34
- }
35
- });
36
- Object.defineProperty(exports, "weekOfYearPlugin", {
37
- enumerable: true,
38
- get: function () {
39
- return _weekOfYear.default;
40
- }
41
- });
42
- var _advancedFormat = _interopRequireDefault(require("dayjs/plugin/advancedFormat"));
43
- var _customParseFormat = _interopRequireDefault(require("dayjs/plugin/customParseFormat"));
44
- var _isBetween = _interopRequireDefault(require("dayjs/plugin/isBetween"));
45
- var _isoWeek = _interopRequireDefault(require("dayjs/plugin/isoWeek"));
46
- var _quarterOfYear = _interopRequireDefault(require("dayjs/plugin/quarterOfYear"));
47
- var _weekOfYear = _interopRequireDefault(require("dayjs/plugin/weekOfYear"));
48
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
3
+ const _advancedFormat = require('dayjs/plugin/advancedFormat');
4
+ const _customParseFormat = require('dayjs/plugin/customParseFormat');
5
+ const _isBetween = require('dayjs/plugin/isBetween');
6
+ const _isoWeek = require('dayjs/plugin/isoWeek');
7
+ const _quarterOfYear = require('dayjs/plugin/quarterOfYear');
8
+ const _weekOfYear = require('dayjs/plugin/weekOfYear');
9
+
10
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
11
+
12
+ const _advancedFormat__default = /*#__PURE__*/_interopDefaultCompat(_advancedFormat);
13
+ const _customParseFormat__default = /*#__PURE__*/_interopDefaultCompat(_customParseFormat);
14
+ const _isBetween__default = /*#__PURE__*/_interopDefaultCompat(_isBetween);
15
+ const _isoWeek__default = /*#__PURE__*/_interopDefaultCompat(_isoWeek);
16
+ const _quarterOfYear__default = /*#__PURE__*/_interopDefaultCompat(_quarterOfYear);
17
+ const _weekOfYear__default = /*#__PURE__*/_interopDefaultCompat(_weekOfYear);
18
+
19
+ const interop = (m) => m.default ?? m;
20
+ const advancedFormatPlugin = interop(_advancedFormat__default);
21
+ const customParseFormatPlugin = interop(_customParseFormat__default);
22
+ const isBetweenPlugin = interop(_isBetween__default);
23
+ const isoWeekPlugin = interop(_isoWeek__default);
24
+ const quarterOfYearPlugin = interop(_quarterOfYear__default);
25
+ const weekOfYearPlugin = interop(_weekOfYear__default);
26
+
27
+ exports.advancedFormatPlugin = advancedFormatPlugin;
28
+ exports.customParseFormatPlugin = customParseFormatPlugin;
29
+ exports.isBetweenPlugin = isBetweenPlugin;
30
+ exports.isoWeekPlugin = isoWeekPlugin;
31
+ exports.quarterOfYearPlugin = quarterOfYearPlugin;
32
+ exports.weekOfYearPlugin = weekOfYearPlugin;
@@ -0,0 +1,10 @@
1
+ import { PluginFunc } from 'dayjs';
2
+
3
+ declare const advancedFormatPlugin: PluginFunc;
4
+ declare const customParseFormatPlugin: PluginFunc;
5
+ declare const isBetweenPlugin: PluginFunc;
6
+ declare const isoWeekPlugin: PluginFunc;
7
+ declare const quarterOfYearPlugin: PluginFunc;
8
+ declare const weekOfYearPlugin: PluginFunc;
9
+
10
+ export { advancedFormatPlugin, customParseFormatPlugin, isBetweenPlugin, isoWeekPlugin, quarterOfYearPlugin, weekOfYearPlugin };
@@ -0,0 +1,10 @@
1
+ import { PluginFunc } from 'dayjs';
2
+
3
+ declare const advancedFormatPlugin: PluginFunc;
4
+ declare const customParseFormatPlugin: PluginFunc;
5
+ declare const isBetweenPlugin: PluginFunc;
6
+ declare const isoWeekPlugin: PluginFunc;
7
+ declare const quarterOfYearPlugin: PluginFunc;
8
+ declare const weekOfYearPlugin: PluginFunc;
9
+
10
+ export { advancedFormatPlugin, customParseFormatPlugin, isBetweenPlugin, isoWeekPlugin, quarterOfYearPlugin, weekOfYearPlugin };
@@ -1,7 +1,10 @@
1
- import advancedFormatPlugin from 'dayjs/plugin/advancedFormat';
2
- import customParseFormatPlugin from 'dayjs/plugin/customParseFormat';
3
- import isBetweenPlugin from 'dayjs/plugin/isBetween';
4
- import isoWeekPlugin from 'dayjs/plugin/isoWeek';
5
- import quarterOfYearPlugin from 'dayjs/plugin/quarterOfYear';
6
- import weekOfYearPlugin from 'dayjs/plugin/weekOfYear';
1
+ import { PluginFunc } from 'dayjs';
2
+
3
+ declare const advancedFormatPlugin: PluginFunc;
4
+ declare const customParseFormatPlugin: PluginFunc;
5
+ declare const isBetweenPlugin: PluginFunc;
6
+ declare const isoWeekPlugin: PluginFunc;
7
+ declare const quarterOfYearPlugin: PluginFunc;
8
+ declare const weekOfYearPlugin: PluginFunc;
9
+
7
10
  export { advancedFormatPlugin, customParseFormatPlugin, isBetweenPlugin, isoWeekPlugin, quarterOfYearPlugin, weekOfYearPlugin };
@@ -1,14 +1,16 @@
1
- import advancedFormatPlugin from "dayjs/plugin/advancedFormat";
2
- import customParseFormatPlugin from "dayjs/plugin/customParseFormat";
3
- import isBetweenPlugin from "dayjs/plugin/isBetween";
4
- import isoWeekPlugin from "dayjs/plugin/isoWeek";
5
- import quarterOfYearPlugin from "dayjs/plugin/quarterOfYear";
6
- import weekOfYearPlugin from "dayjs/plugin/weekOfYear";
7
- export {
8
- advancedFormatPlugin,
9
- customParseFormatPlugin,
10
- isBetweenPlugin,
11
- isoWeekPlugin,
12
- quarterOfYearPlugin,
13
- weekOfYearPlugin
14
- };
1
+ import _advancedFormat from 'dayjs/plugin/advancedFormat';
2
+ import _customParseFormat from 'dayjs/plugin/customParseFormat';
3
+ import _isBetween from 'dayjs/plugin/isBetween';
4
+ import _isoWeek from 'dayjs/plugin/isoWeek';
5
+ import _quarterOfYear from 'dayjs/plugin/quarterOfYear';
6
+ import _weekOfYear from 'dayjs/plugin/weekOfYear';
7
+
8
+ const interop = (m) => m.default ?? m;
9
+ const advancedFormatPlugin = interop(_advancedFormat);
10
+ const customParseFormatPlugin = interop(_customParseFormat);
11
+ const isBetweenPlugin = interop(_isBetween);
12
+ const isoWeekPlugin = interop(_isoWeek);
13
+ const quarterOfYearPlugin = interop(_quarterOfYear);
14
+ const weekOfYearPlugin = interop(_weekOfYear);
15
+
16
+ export { advancedFormatPlugin, customParseFormatPlugin, isBetweenPlugin, isoWeekPlugin, quarterOfYearPlugin, weekOfYearPlugin };
package/dist/dayjs.cjs CHANGED
@@ -4,10 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
 
7
- var dayjsObject = _interopRequireWildcard(require("dayjs"));
8
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
9
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
10
- const dayjs = typeof dayjsObject === "function" ? dayjsObject :
7
+ var _dayjs = _interopRequireDefault(require("dayjs"));
8
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
+ const dayjs = typeof _dayjs.default === "function" ? _dayjs.default :
11
10
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
12
- dayjsObject.default || dayjsObject;
11
+ _dayjs.default.default || _dayjs.default;
13
12
  module.exports = dayjs;
package/dist/dayjs.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import * as dayjsObject from "dayjs";
1
+ import dayjsObject from "dayjs";
2
2
  const dayjs = typeof dayjsObject === "function" ? dayjsObject : (
3
3
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
4
4
  dayjsObject.default || dayjsObject
@@ -128,12 +128,12 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
128
128
  readonly error: string;
129
129
  readonly required: boolean;
130
130
  readonly rules: FormRule | FormRule[];
131
- readonly validateStatus: ValidateStatus;
132
131
  readonly labelWidth: string | number;
133
132
  readonly showMessage: boolean;
134
133
  readonly prop: string;
135
134
  readonly validateTrigger: string | string[];
136
135
  readonly errorPosition: "left" | "center" | "right";
136
+ readonly validateStatus: ValidateStatus;
137
137
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
138
138
  declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
139
139
  export default _default;
@@ -128,12 +128,12 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
128
128
  readonly error: string;
129
129
  readonly required: boolean;
130
130
  readonly rules: FormRule | FormRule[];
131
- readonly validateStatus: ValidateStatus;
132
131
  readonly labelWidth: string | number;
133
132
  readonly showMessage: boolean;
134
133
  readonly prop: string;
135
134
  readonly validateTrigger: string | string[];
136
135
  readonly errorPosition: "left" | "center" | "right";
136
+ readonly validateStatus: ValidateStatus;
137
137
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
138
138
  declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
139
139
  export default _default;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.YhUIVitePlugin = YhUIVitePlugin;
7
+
8
+ const DAYJS_PLUGINS = ["dayjs", "dayjs/plugin/advancedFormat", "dayjs/plugin/customParseFormat", "dayjs/plugin/isBetween", "dayjs/plugin/isoWeek", "dayjs/plugin/quarterOfYear", "dayjs/plugin/weekOfYear"];
9
+ function YhUIVitePlugin(options = {}) {
10
+ const {
11
+ optimizeDayjs = true
12
+ } = options;
13
+ return {
14
+ name: "yh-ui:vite-plugin",
15
+ config() {
16
+ if (!optimizeDayjs) return {};
17
+ return {
18
+ optimizeDeps: {
19
+ // 强制 Vite 将 dayjs CJS 插件预构建为 ESM,解决 pnpm 严格模式下的 404 和
20
+ // "does not provide an export named 'default'" 报错
21
+ include: [...DAYJS_PLUGINS]
22
+ },
23
+ ssr: {
24
+ // SSR 模式下同样需要处理这些 CJS 模块
25
+ noExternal: ["dayjs"]
26
+ }
27
+ };
28
+ }
29
+ };
30
+ }
31
+ module.exports = YhUIVitePlugin;
@@ -0,0 +1,29 @@
1
+ import type { Plugin } from 'vite';
2
+ export interface YhUIVitePluginOptions {
3
+ /**
4
+ * 是否自动预构建 dayjs 及其插件(推荐保持开启)。
5
+ * 解决 pnpm + Vite 6 下 dayjs CJS 插件无 default export 的问题。
6
+ * @default true
7
+ */
8
+ optimizeDayjs?: boolean;
9
+ }
10
+ /**
11
+ * YH-UI Vite 插件。
12
+ *
13
+ * 自动处理 pnpm + Vite 6 环境下的 CJS/ESM 互操作问题,
14
+ * 无需手动配置 `optimizeDeps`。
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * // vite.config.ts
19
+ * import { defineConfig } from 'vite'
20
+ * import vue from '@vitejs/plugin-vue'
21
+ * import { YhUIVitePlugin } from '@yh-ui/components/vite-plugin'
22
+ *
23
+ * export default defineConfig({
24
+ * plugins: [vue(), YhUIVitePlugin()]
25
+ * })
26
+ * ```
27
+ */
28
+ export declare function YhUIVitePlugin(options?: YhUIVitePluginOptions): Plugin;
29
+ export default YhUIVitePlugin;
@@ -0,0 +1,30 @@
1
+ const DAYJS_PLUGINS = [
2
+ "dayjs",
3
+ "dayjs/plugin/advancedFormat",
4
+ "dayjs/plugin/customParseFormat",
5
+ "dayjs/plugin/isBetween",
6
+ "dayjs/plugin/isoWeek",
7
+ "dayjs/plugin/quarterOfYear",
8
+ "dayjs/plugin/weekOfYear"
9
+ ];
10
+ export function YhUIVitePlugin(options = {}) {
11
+ const { optimizeDayjs = true } = options;
12
+ return {
13
+ name: "yh-ui:vite-plugin",
14
+ config() {
15
+ if (!optimizeDayjs) return {};
16
+ return {
17
+ optimizeDeps: {
18
+ // 强制 Vite 将 dayjs CJS 插件预构建为 ESM,解决 pnpm 严格模式下的 404 和
19
+ // "does not provide an export named 'default'" 报错
20
+ include: [...DAYJS_PLUGINS]
21
+ },
22
+ ssr: {
23
+ // SSR 模式下同样需要处理这些 CJS 模块
24
+ noExternal: ["dayjs"]
25
+ }
26
+ };
27
+ }
28
+ };
29
+ }
30
+ export default YhUIVitePlugin;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yh-ui/components",
3
- "version": "1.0.43",
3
+ "version": "1.0.44",
4
4
  "description": "YH-UI Vue 3 Components",
5
5
  "type": "module",
6
6
  "sideEffects": [
@@ -22,6 +22,11 @@
22
22
  "import": "./dist/resolver.mjs",
23
23
  "require": "./dist/resolver.cjs"
24
24
  },
25
+ "./vite-plugin": {
26
+ "types": "./dist/vite-plugin.d.ts",
27
+ "import": "./dist/vite-plugin.mjs",
28
+ "require": "./dist/vite-plugin.cjs"
29
+ },
25
30
  "./style": "./dist/style.css",
26
31
  "./style.css": "./dist/style.css",
27
32
  "./*": {
@@ -45,10 +50,10 @@
45
50
  "dependencies": {
46
51
  "@webcontainer/api": "^1.6.1",
47
52
  "@floating-ui/dom": "^1.7.4",
48
- "@yh-ui/hooks": "^1.0.43",
49
- "@yh-ui/locale": "^1.0.43",
50
- "@yh-ui/theme": "^1.0.43",
51
- "@yh-ui/utils": "^1.0.43",
53
+ "@yh-ui/hooks": "^1.0.44",
54
+ "@yh-ui/locale": "^1.0.44",
55
+ "@yh-ui/theme": "^1.0.44",
56
+ "@yh-ui/utils": "^1.0.44",
52
57
  "async-validator": "^4.2.5",
53
58
  "dayjs": "^1.11.19",
54
59
  "dompurify": "^3.3.3"
@@ -82,6 +87,7 @@
82
87
  "devDependencies": {
83
88
  "@types/markdown-it": "^14.1.2",
84
89
  "@vitejs/plugin-vue": "^6.0.0",
90
+ "vite": "^6.0.0",
85
91
  "monaco-editor": "^0.55.1",
86
92
  "xlsx": "^0.18.5",
87
93
  "viewerjs": "^1.11.7",