vuetify-nuxt-module 0.5.13 → 0.5.15

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/module.d.ts CHANGED
@@ -69,6 +69,44 @@ interface FontIconSet {
69
69
  */
70
70
  cdn?: string;
71
71
  }
72
+ interface UnoCCSMdiIconSet {
73
+ collapse?: string;
74
+ complete?: string;
75
+ cancel?: string;
76
+ close?: string;
77
+ delete?: string;
78
+ clear?: string;
79
+ success?: string;
80
+ info?: string;
81
+ warning?: string;
82
+ error?: string;
83
+ prev?: string;
84
+ next?: string;
85
+ checkboxOn?: string;
86
+ checkboxOff?: string;
87
+ checkboxIndeterminate?: string;
88
+ delimiter?: string;
89
+ sortAsc?: string;
90
+ sortDesc?: string;
91
+ expand?: string;
92
+ menu?: string;
93
+ subgroup?: string;
94
+ dropdown?: string;
95
+ radioOn?: string;
96
+ radioOff?: string;
97
+ edit?: string;
98
+ ratingEmpty?: string;
99
+ ratingFull?: string;
100
+ ratingHalf?: string;
101
+ loading?: string;
102
+ first?: string;
103
+ last?: string;
104
+ unfold?: string;
105
+ file?: string;
106
+ plus?: string;
107
+ minus?: string;
108
+ calendar?: string;
109
+ }
72
110
  interface IconsOptions {
73
111
  /**
74
112
  * @default 'mdi'
@@ -80,6 +118,14 @@ interface IconsOptions {
80
118
  * @default 'i-'
81
119
  */
82
120
  unocssIconPrefix?: string;
121
+ /**
122
+ * Override the default mdi icons.
123
+ *
124
+ * Icon names should include the prefix and the collection, for example:
125
+ * - home: i-<collection>:<icon>
126
+ */
127
+ unocssIcons?: UnoCCSMdiIconSet;
128
+ unocssAdditionalIcons?: Record<string, string>;
83
129
  sets?: IconFontName | IconFontName[] | FontIconSet[];
84
130
  svg?: {
85
131
  mdi?: JSSVGIconSet;
@@ -380,4 +426,4 @@ declare module '#app' {
380
426
 
381
427
  declare const _default: _nuxt_schema.NuxtModule<ModuleOptions>;
382
428
 
383
- export { ComponentName, Components, DateAdapter, DateOptions, DirectiveName, Directives, ExternalVuetifyOptions, FontAwesomeSvgIconSet, FontIconSet, IconFontName, IconSetName, IconsOptions, InlineModuleOptions, JSSVGIconSet, LabComponentName, LabComponents, MOptions, ModuleOptions, SSRClientHints, SSRClientHintsConfiguration, VOptions, VuetifyLocale, _default as default };
429
+ export { ComponentName, Components, DateAdapter, DateOptions, DirectiveName, Directives, ExternalVuetifyOptions, FontAwesomeSvgIconSet, FontIconSet, IconFontName, IconSetName, IconsOptions, InlineModuleOptions, JSSVGIconSet, LabComponentName, LabComponents, MOptions, ModuleOptions, SSRClientHints, SSRClientHintsConfiguration, UnoCCSMdiIconSet, VOptions, VuetifyLocale, _default as default };
package/dist/module.json CHANGED
@@ -4,5 +4,5 @@
4
4
  "compatibility": {
5
5
  "nuxt": "^3.0.0"
6
6
  },
7
- "version": "0.5.13"
7
+ "version": "0.5.15"
8
8
  }
package/dist/module.mjs CHANGED
@@ -12,7 +12,7 @@ import vuetify, { transformAssetUrls } from 'vite-plugin-vuetify';
12
12
  import { isAbsolute, join, relative } from 'pathe';
13
13
  import { normalizePath as normalizePath$1 } from 'vite';
14
14
 
15
- const version = "0.5.13";
15
+ const version = "0.5.15";
16
16
 
17
17
  const VIRTUAL_VUETIFY_CONFIGURATION = "virtual:vuetify-configuration";
18
18
  const RESOLVED_VIRTUAL_VUETIFY_CONFIGURATION = `/@nuxt-vuetify-configuration/${VIRTUAL_VUETIFY_CONFIGURATION.slice("virtual:".length)}`;
@@ -198,6 +198,8 @@ const disabledResolvedIcons = Object.freeze({
198
198
  unocss: false,
199
199
  unocssAliases: false,
200
200
  unocssIconPrefix: "i-",
201
+ unocssIcons: {},
202
+ unocssAdditionalIcons: {},
201
203
  imports: [],
202
204
  aliases: [],
203
205
  aliasesImportPresent: false,
@@ -221,6 +223,8 @@ function prepareIcons(unocssPresent, logger, vuetifyOptions) {
221
223
  unocss: unocssPresent && (defaultSet === "unocss-mdi" || sets.some((s) => s.name === "unocss-mdi")),
222
224
  unocssAliases: defaultSet === "unocss-mdi",
223
225
  unocssIconPrefix: icons.unocssIconPrefix ?? "i-",
226
+ unocssIcons: icons.unocssIcons ?? {},
227
+ unocssAdditionalIcons: icons.unocssAdditionalIcons ?? {},
224
228
  defaultSet,
225
229
  sets: [],
226
230
  aliases: [],
@@ -658,6 +662,15 @@ function vuetifyStylesPlugin(options, logger) {
658
662
  };
659
663
  }
660
664
 
665
+ function toKebabCase(str = "") {
666
+ if (toKebabCase.cache.has(str))
667
+ return toKebabCase.cache.get(str);
668
+ const kebab = str.replace(/[^a-z]/gi, "-").replace(/\B([A-Z])/g, "-$1").toLowerCase();
669
+ toKebabCase.cache.set(str, kebab);
670
+ return kebab;
671
+ }
672
+ toKebabCase.cache = /* @__PURE__ */ new Map();
673
+
661
674
  function vuetifyConfigurationPlugin(ctx) {
662
675
  return {
663
676
  name: "vuetify:configuration:nuxt",
@@ -744,8 +757,8 @@ async function buildConfiguration(ctx) {
744
757
  config.imports.push("import * as directives from 'vuetify/directives'");
745
758
  config.directives = "options.directives = directives";
746
759
  } else {
747
- const useDirectives = Array.isArray(directives) ? [...new Set(...directives)] : [directives];
748
- config.imports.push(useDirectives.map((d) => `import { ${d} } from 'vuetify/directives/${d}'`).join("\n"));
760
+ const useDirectives = Array.isArray(directives) ? [...new Set(directives)] : [directives];
761
+ config.imports.push(useDirectives.map((d) => `import {${d}} from 'vuetify/directives/${toKebabCase(d)}'`).join("\n"));
749
762
  config.directives = `options.directives = {${useDirectives.join(",")}}`;
750
763
  }
751
764
  }
@@ -960,46 +973,87 @@ ${unocss}
960
973
  if (ctx.icons.unocss && ctx.icons.unocssAliases) {
961
974
  ctx.icons.imports.unshift("// @unocss-include");
962
975
  const prefix = `${ctx.icons.unocssIconPrefix}mdi:`;
963
- unocss = `const aliases = JSON.parse('${JSON.stringify({
964
- collapse: `${prefix}chevron-up`,
965
- complete: `${prefix}check`,
966
- cancel: `${prefix}close-circle`,
967
- close: `${prefix}close`,
968
- delete: `${prefix}close-circle`,
976
+ const {
977
+ collapse = `${prefix}chevron-up`,
978
+ complete = `${prefix}check`,
979
+ cancel = `${prefix}close-circle`,
980
+ close = `${prefix}close`,
969
981
  // delete (e.g. v-chip close)
970
- clear: `${prefix}close-circle`,
971
- success: `${prefix}check-circle`,
972
- info: `${prefix}information`,
973
- warning: `${prefix}alert-circle`,
974
- error: `${prefix}close-circle`,
975
- prev: `${prefix}chevron-left`,
976
- next: `${prefix}chevron-right`,
977
- checkboxOn: `${prefix}checkbox-marked`,
978
- checkboxOff: `${prefix}checkbox-blank-outline`,
979
- checkboxIndeterminate: `${prefix}minus-box`,
980
- delimiter: `${prefix}circle`,
982
+ clear = `${prefix}close-circle`,
983
+ success = `${prefix}check-circle`,
984
+ info = `${prefix}information`,
985
+ warning = `${prefix}alert-circle`,
986
+ error = `${prefix}close-circle`,
987
+ prev = `${prefix}chevron-left`,
988
+ next = `${prefix}chevron-right`,
989
+ checkboxOn = `${prefix}checkbox-marked`,
990
+ checkboxOff = `${prefix}checkbox-blank-outline`,
991
+ checkboxIndeterminate = `${prefix}minus-box`,
992
+ delimiter = `${prefix}circle`,
981
993
  // for carousel
982
- sortAsc: `${prefix}arrow-up`,
983
- sortDesc: `${prefix}arrow-down`,
984
- expand: `${prefix}chevron-down`,
985
- menu: `${prefix}menu`,
986
- subgroup: `${prefix}menu-down`,
987
- dropdown: `${prefix}menu-down`,
988
- radioOn: `${prefix}radiobox-marked`,
989
- radioOff: `${prefix}radiobox-blank`,
990
- edit: `${prefix}pencil`,
991
- ratingEmpty: `${prefix}star-outline`,
992
- ratingFull: `${prefix}star`,
993
- ratingHalf: `${prefix}star-half-full`,
994
- loading: `${prefix}cached`,
995
- first: `${prefix}page-first`,
996
- last: `${prefix}page-last`,
997
- unfold: `${prefix}unfold-more-horizontal`,
998
- file: `${prefix}paperclip`,
999
- plus: `${prefix}plus`,
1000
- minus: `${prefix}minus`,
1001
- calendar: `${prefix}calendar`
1002
- })}');
994
+ sortAsc = `${prefix}arrow-up`,
995
+ sortDesc = `${prefix}arrow-down`,
996
+ expand = `${prefix}chevron-down`,
997
+ menu = `${prefix}menu`,
998
+ subgroup = `${prefix}menu-down`,
999
+ dropdown = `${prefix}menu-down`,
1000
+ radioOn = `${prefix}radiobox-marked`,
1001
+ radioOff = `${prefix}radiobox-blank`,
1002
+ edit = `${prefix}pencil`,
1003
+ ratingEmpty = `${prefix}star-outline`,
1004
+ ratingFull = `${prefix}star`,
1005
+ ratingHalf = `${prefix}star-half-full`,
1006
+ loading = `${prefix}cached`,
1007
+ first = `${prefix}page-first`,
1008
+ last = `${prefix}page-last`,
1009
+ unfold = `${prefix}unfold-more-horizontal`,
1010
+ file = `${prefix}paperclip`,
1011
+ plus = `${prefix}plus`,
1012
+ minus = `${prefix}minus`,
1013
+ calendar = `${prefix}calendar`
1014
+ } = ctx.icons.unocssIcons;
1015
+ const useIcons = {
1016
+ collapse,
1017
+ complete,
1018
+ cancel,
1019
+ close,
1020
+ delete: ctx.icons.unocssIcons.delete ?? `${prefix}close-circle`,
1021
+ clear,
1022
+ success,
1023
+ info,
1024
+ warning,
1025
+ error,
1026
+ prev,
1027
+ next,
1028
+ checkboxOn,
1029
+ checkboxOff,
1030
+ checkboxIndeterminate,
1031
+ delimiter,
1032
+ sortAsc,
1033
+ sortDesc,
1034
+ expand,
1035
+ menu,
1036
+ subgroup,
1037
+ dropdown,
1038
+ radioOn,
1039
+ radioOff,
1040
+ edit,
1041
+ ratingEmpty,
1042
+ ratingFull,
1043
+ ratingHalf,
1044
+ loading,
1045
+ first,
1046
+ last,
1047
+ unfold,
1048
+ file,
1049
+ plus,
1050
+ minus,
1051
+ calendar
1052
+ };
1053
+ Object.entries(ctx.icons.unocssAdditionalIcons).forEach(([key, value]) => {
1054
+ useIcons[key] = value;
1055
+ });
1056
+ unocss = `const aliases = JSON.parse('${JSON.stringify(useIcons)}');
1003
1057
  `;
1004
1058
  }
1005
1059
  return {
@@ -1091,11 +1145,13 @@ function configureVite(configKey, nuxt, ctx) {
1091
1145
  viteInlineConfig.plugins = viteInlineConfig.plugins || [];
1092
1146
  checkVuetifyPlugins(viteInlineConfig);
1093
1147
  viteInlineConfig.optimizeDeps = defu(viteInlineConfig.optimizeDeps, { exclude: ["vuetify"] });
1094
- viteInlineConfig.ssr || (viteInlineConfig.ssr = {});
1095
- viteInlineConfig.ssr.noExternal = [
1096
- ...Array.isArray(viteInlineConfig.ssr.noExternal) ? viteInlineConfig.ssr.noExternal : [],
1097
- configKey
1098
- ];
1148
+ if (nuxt.options.ssr) {
1149
+ viteInlineConfig.ssr || (viteInlineConfig.ssr = {});
1150
+ viteInlineConfig.ssr.noExternal = [
1151
+ ...Array.isArray(viteInlineConfig.ssr.noExternal) ? viteInlineConfig.ssr.noExternal : viteInlineConfig.ssr.noExternal && typeof viteInlineConfig.ssr.noExternal !== "boolean" ? [viteInlineConfig.ssr.noExternal] : [],
1152
+ configKey
1153
+ ];
1154
+ }
1099
1155
  viteInlineConfig.plugins.push(vuetify({ styles: true, autoImport: true }));
1100
1156
  viteInlineConfig.plugins.push(vuetifyStylesPlugin({ styles: ctx.moduleOptions.styles }, ctx.logger));
1101
1157
  viteInlineConfig.plugins.push(vuetifyConfigurationPlugin(ctx));
@@ -1106,15 +1162,6 @@ function configureVite(configKey, nuxt, ctx) {
1106
1162
  });
1107
1163
  }
1108
1164
 
1109
- function toKebabCase(str = "") {
1110
- if (toKebabCase.cache.has(str))
1111
- return toKebabCase.cache.get(str);
1112
- const kebab = str.replace(/[^a-z]/gi, "-").replace(/\B([A-Z])/g, "-$1").toLowerCase();
1113
- toKebabCase.cache.set(str, kebab);
1114
- return kebab;
1115
- }
1116
- toKebabCase.cache = /* @__PURE__ */ new Map();
1117
-
1118
1165
  function configureNuxt(configKey, nuxt, ctx) {
1119
1166
  var _a, _b, _c;
1120
1167
  const {
@@ -1124,8 +1171,10 @@ function configureNuxt(configKey, nuxt, ctx) {
1124
1171
  includeTransformAssetsUrls = true
1125
1172
  } = ctx.moduleOptions;
1126
1173
  const runtimeDir = ctx.resolver.resolve("./runtime");
1127
- nuxt.options.build.transpile.push(configKey);
1128
- nuxt.options.build.transpile.push(runtimeDir);
1174
+ if (!nuxt.options.ssr) {
1175
+ nuxt.options.build.transpile.push(configKey);
1176
+ nuxt.options.build.transpile.push(runtimeDir);
1177
+ }
1129
1178
  (_a = nuxt.options).css ?? (_a.css = []);
1130
1179
  if (typeof styles === "string" && ["sass", "expose"].includes(styles))
1131
1180
  nuxt.options.css.unshift("vuetify/styles/main.sass");
@@ -1133,11 +1182,10 @@ function configureNuxt(configKey, nuxt, ctx) {
1133
1182
  nuxt.options.css.unshift("vuetify/styles");
1134
1183
  else if (typeof styles === "object" && typeof styles?.configFile === "string")
1135
1184
  nuxt.options.css.unshift(styles.configFile);
1136
- if (includeTransformAssetsUrls) {
1185
+ if (includeTransformAssetsUrls && typeof nuxt.options.vite.vue?.template?.transformAssetUrls === "undefined") {
1137
1186
  (_b = nuxt.options.vite).vue ?? (_b.vue = {});
1138
1187
  (_c = nuxt.options.vite.vue).template ?? (_c.template = {});
1139
- if (typeof nuxt.options.vite.vue.template.transformAssetUrls === "undefined")
1140
- nuxt.options.vite.vue.template.transformAssetUrls = transformAssetUrls;
1188
+ nuxt.options.vite.vue.template.transformAssetUrls = transformAssetUrls;
1141
1189
  }
1142
1190
  extendWebpackConfig(() => {
1143
1191
  throw new Error("Webpack is not supported: vuetify-nuxt-module module can only be used with Vite!");
@@ -1177,16 +1225,10 @@ function configureNuxt(configKey, nuxt, ctx) {
1177
1225
  src: ctx.resolver.resolve(runtimeDir, "plugins/vuetify-i18n")
1178
1226
  });
1179
1227
  }
1180
- if (nuxt.options.dev) {
1228
+ if (nuxt.options.dev || ctx.dateAdapter) {
1181
1229
  addPlugin({
1182
1230
  src: ctx.resolver.resolve(runtimeDir, "plugins/vuetify-date")
1183
1231
  });
1184
- } else {
1185
- if (ctx.dateAdapter) {
1186
- addPlugin({
1187
- src: ctx.resolver.resolve(runtimeDir, "plugins/vuetify-date")
1188
- });
1189
- }
1190
1232
  }
1191
1233
  }
1192
1234
 
package/dist/types.d.ts CHANGED
@@ -12,4 +12,4 @@ declare module 'nuxt/schema' {
12
12
  }
13
13
 
14
14
 
15
- export { ComponentName, Components, DateAdapter, DateOptions, DirectiveName, Directives, ExternalVuetifyOptions, FontAwesomeSvgIconSet, FontIconSet, IconFontName, IconSetName, IconsOptions, InlineModuleOptions, JSSVGIconSet, LabComponentName, LabComponents, MOptions, ModuleOptions, SSRClientHints, SSRClientHintsConfiguration, VOptions, VuetifyLocale, default } from './module'
15
+ export { ComponentName, Components, DateAdapter, DateOptions, DirectiveName, Directives, ExternalVuetifyOptions, FontAwesomeSvgIconSet, FontIconSet, IconFontName, IconSetName, IconsOptions, InlineModuleOptions, JSSVGIconSet, LabComponentName, LabComponents, MOptions, ModuleOptions, SSRClientHints, SSRClientHintsConfiguration, UnoCCSMdiIconSet, VOptions, VuetifyLocale, default } from './module'
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "vuetify-nuxt-module",
3
3
  "type": "module",
4
- "version": "0.5.13",
5
- "packageManager": "pnpm@8.8.0",
4
+ "version": "0.5.15",
5
+ "packageManager": "pnpm@8.9.0",
6
6
  "description": "Zero-Config Nuxt Module for Vuetify",
7
7
  "author": "userquin <userquin@gmail.com>",
8
8
  "license": "MIT",