@venix-sistemas/jade 1.2.0 → 1.3.0
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 +367 -157
- package/dist/module.json +1 -1
- package/dist/module.mjs +66 -4
- package/dist/runtime/components/VenixThemeSwitcher.d.vue.ts +2 -0
- package/dist/runtime/components/VenixThemeSwitcher.vue +413 -70
- package/dist/runtime/components/VenixThemeSwitcher.vue.d.ts +2 -0
- package/dist/runtime/composables/useThemeColors.d.ts +2 -2
- package/dist/runtime/composables/useThemeCookies.d.ts +8 -0
- package/dist/runtime/composables/useThemeCookies.js +20 -1
- package/dist/runtime/composables/useThemeLocale.d.ts +2 -2
- package/dist/runtime/composables/useThemeSeasonal.d.ts +2 -2
- package/dist/runtime/composables/useVenixTheme.d.ts +20 -0
- package/dist/runtime/composables/useVenixTheme.js +86 -9
- package/dist/runtime/plugins/overlay-scrollbars.client.d.ts +2 -0
- package/dist/runtime/plugins/overlay-scrollbars.client.js +89 -0
- package/dist/runtime/scripts/theme-init.d.ts +12 -3
- package/dist/runtime/scripts/theme-init.js +21 -4
- package/dist/shared/constants.d.ts +54 -0
- package/dist/shared/constants.js +20 -0
- package/dist/shared/css/cursor-svg.d.ts +10 -0
- package/dist/shared/css/cursor-svg.js +28 -0
- package/dist/shared/css/cursor.js +78 -33
- package/dist/shared/css/scrollbar.js +61 -7
- package/dist/shared/css/typography.js +13 -0
- package/dist/shared/theme.json +14 -8
- package/dist/shared/types/cursor.d.ts +34 -4
- package/dist/shared/types/index.d.ts +2 -2
- package/dist/shared/types/runtime-config.d.ts +1 -0
- package/dist/shared/types/scrollbar.d.ts +11 -0
- package/dist/shared/types/theme.d.ts +7 -0
- package/dist/shared/types/typography.d.ts +2 -1
- package/dist/shared/utils/load.d.ts +2 -2
- package/dist/shared/utils/load.js +2 -1
- package/dist/shared/utils/theme-config.d.ts +3 -3
- package/dist/shared/utils/theme-config.js +0 -1
- package/dist/shared/utils/theme-resolve.d.ts +11 -2
- package/dist/shared/utils/theme-resolve.js +18 -0
- package/dist/shared/utils/theme-resolver.d.ts +1 -0
- package/dist/shared/utils/theme-resolver.js +1 -0
- package/package.json +10 -1
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { addComponent, addPlugin, addServerPlugin, addTemplate, installModule, addImports, defineNuxtModule, createResolver
|
|
1
|
+
import { addComponent, addPlugin, addServerPlugin, addTemplate, useLogger, installModule, addImports, defineNuxtModule, createResolver } from '@nuxt/kit';
|
|
2
2
|
import { loadTheme } from '../dist/shared/utils/load.js';
|
|
3
|
-
import { DEFAULT_THEME, DEFAULT_LOCALE_COOKIE_NAME, DEFAULT_LOCALE } from '../dist/shared/constants.js';
|
|
3
|
+
import { SWITCHER_ICONS, DEFAULT_THEME, DEFAULT_LOCALE_COOKIE_NAME, DEFAULT_LOCALE } from '../dist/shared/constants.js';
|
|
4
4
|
import { resolveFeatureOption } from '../dist/shared/utils/options.js';
|
|
5
5
|
import { findDeprecatedThemeEntries } from '../dist/shared/utils/merge-themes.js';
|
|
6
6
|
import { buildResolvedTheme, getBaseThemeEntries } from '../dist/shared/utils/theme-config.js';
|
|
7
7
|
import { processTheme } from '../dist/shared/css/index.js';
|
|
8
|
-
import { isColorTheme, getThemeHexColors } from '../dist/shared/utils/theme-resolve.js';
|
|
9
8
|
import { createRequire } from 'node:module';
|
|
9
|
+
import { isColorTheme, getThemeHexColors } from '../dist/shared/utils/theme-resolve.js';
|
|
10
10
|
import { realpathSync } from 'node:fs';
|
|
11
11
|
import { fileURLToPath } from 'node:url';
|
|
12
12
|
import { join } from 'node:path';
|
|
@@ -18,6 +18,14 @@ function customizeTheme(baseTheme, options) {
|
|
|
18
18
|
customized.typography = resolveFeatureOption(options.typography, customized.typography);
|
|
19
19
|
customized.customScrollbar = resolveFeatureOption(options.scrollbar, customized.customScrollbar);
|
|
20
20
|
customized.customCursor = resolveFeatureOption(options.cursor, customized.customCursor);
|
|
21
|
+
const cursorOption = typeof options.cursor === "object" && options.cursor !== null ? options.cursor : void 0;
|
|
22
|
+
if (cursorOption?.cursors) {
|
|
23
|
+
customized.customCursor.defaultCursors = cursorOption.defaultCursors ?? cursorOption.cursors;
|
|
24
|
+
}
|
|
25
|
+
delete customized.customCursor.cursors;
|
|
26
|
+
if (cursorOption?.themeCursors) {
|
|
27
|
+
customized.customCursor.themeCursors = { ...baseTheme.customCursor.themeCursors, ...cursorOption.themeCursors };
|
|
28
|
+
}
|
|
21
29
|
const colorOption = options.color;
|
|
22
30
|
if (colorOption === false) {
|
|
23
31
|
customized.colors.enabled = false;
|
|
@@ -77,6 +85,49 @@ function registerThemeCSS(nuxt, theme) {
|
|
|
77
85
|
}
|
|
78
86
|
}
|
|
79
87
|
|
|
88
|
+
const FONT_MIME_TYPES = {
|
|
89
|
+
woff2: "font/woff2",
|
|
90
|
+
woff: "font/woff",
|
|
91
|
+
truetype: "font/ttf",
|
|
92
|
+
opentype: "font/otf"
|
|
93
|
+
};
|
|
94
|
+
function getFontPreloadLinks(theme) {
|
|
95
|
+
if (theme.typography?.enabled === false) return [];
|
|
96
|
+
const links = [];
|
|
97
|
+
for (const font of theme.typography?.customFonts ?? []) {
|
|
98
|
+
if (!font.preload) continue;
|
|
99
|
+
const [format, href] = Object.entries(font.sources ?? {})[0] ?? [];
|
|
100
|
+
if (!format || !href) continue;
|
|
101
|
+
links.push({ rel: "preload", as: "font", href, type: FONT_MIME_TYPES[format] ?? `font/${format}`, crossorigin: "anonymous" });
|
|
102
|
+
}
|
|
103
|
+
return links;
|
|
104
|
+
}
|
|
105
|
+
function registerFontPreloads(nuxt, theme) {
|
|
106
|
+
const links = getFontPreloadLinks(theme);
|
|
107
|
+
if (!links.length) return;
|
|
108
|
+
nuxt.options.app.head.link = [...nuxt.options.app.head.link ?? [], ...links];
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function resolveOverlayScrollbarsCSS() {
|
|
112
|
+
try {
|
|
113
|
+
return createRequire(import.meta.url).resolve("overlayscrollbars/overlayscrollbars.css");
|
|
114
|
+
} catch {
|
|
115
|
+
return null;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
function registerOverlayScrollbars(nuxt, resolver, theme, resolveCSS = resolveOverlayScrollbarsCSS) {
|
|
119
|
+
const scrollbar = theme.customScrollbar;
|
|
120
|
+
if (scrollbar?.enabled === false || scrollbar?.overlay !== true) return;
|
|
121
|
+
const css = resolveCSS();
|
|
122
|
+
if (!css) {
|
|
123
|
+
useLogger("jade").warn("`scrollbar.overlay` needs the `overlayscrollbars` package, which isn't installed: run `pnpm add overlayscrollbars` (or npm/yarn). Using the CSS-styled native scrollbar meanwhile.");
|
|
124
|
+
scrollbar.overlay = false;
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
nuxt.options.css.push(css);
|
|
128
|
+
addPlugin({ src: resolver.resolve("./runtime/plugins/overlay-scrollbars.client"), mode: "client" });
|
|
129
|
+
}
|
|
130
|
+
|
|
80
131
|
function buildVuetifyThemes(colors) {
|
|
81
132
|
const themes = {};
|
|
82
133
|
for (const [name, themeColors] of Object.entries(colors.themes)) {
|
|
@@ -137,7 +188,11 @@ async function registerThemeIcon(nuxt, resolver, options, colors) {
|
|
|
137
188
|
}
|
|
138
189
|
const explicit = new Set(options.collections);
|
|
139
190
|
const collections = options.collections.map((name) => loadFullCollection(name, projectRequire));
|
|
140
|
-
const labelled = [
|
|
191
|
+
const labelled = [
|
|
192
|
+
...Object.values(colors.groups ?? {}),
|
|
193
|
+
...Object.values(colors.modes ?? {}),
|
|
194
|
+
...Object.values(SWITCHER_ICONS).map((icon) => ({ icon }))
|
|
195
|
+
];
|
|
141
196
|
const refs = extractIconRefs(labelled, options.aliases);
|
|
142
197
|
for (const [name, iconNames] of refs) {
|
|
143
198
|
if (explicit.has(name)) continue;
|
|
@@ -195,6 +250,9 @@ const module$1 = defineNuxtModule({
|
|
|
195
250
|
for (const message of findDeprecatedThemeEntries(getBaseThemeEntries(), colorOptions.themes)) {
|
|
196
251
|
useLogger("jade").warn(message);
|
|
197
252
|
}
|
|
253
|
+
if (typeof options.cursor === "object" && options.cursor?.cursors) {
|
|
254
|
+
useLogger("jade").warn("`cursor.cursors` is deprecated and stops working in 2.0. Use `cursor.defaultCursors` instead.");
|
|
255
|
+
}
|
|
198
256
|
const shouldApplyColors = colorOptions.enabled && colorOptions.apply && theme.colors?.defaults !== false;
|
|
199
257
|
const translationOptions = resolveFeatureOption(options.translation, {
|
|
200
258
|
enabled: true,
|
|
@@ -203,7 +261,9 @@ const module$1 = defineNuxtModule({
|
|
|
203
261
|
cookieSync: DEFAULT_LOCALE_COOKIE_NAME,
|
|
204
262
|
manageHtmlLang: false
|
|
205
263
|
});
|
|
264
|
+
registerOverlayScrollbars(nuxt, resolver, theme);
|
|
206
265
|
registerThemeCSS(nuxt, theme);
|
|
266
|
+
registerFontPreloads(nuxt, theme);
|
|
207
267
|
registerThemePlugins(nuxt, resolver, shouldApplyColors);
|
|
208
268
|
const vuetifyOptions = resolveFeatureOption(options.vuetify, {
|
|
209
269
|
enabled: true
|
|
@@ -231,6 +291,8 @@ const module$1 = defineNuxtModule({
|
|
|
231
291
|
},
|
|
232
292
|
enabled: {
|
|
233
293
|
typography: theme.typography?.enabled !== false,
|
|
294
|
+
// Something for the visitor to turn off (`font.available`)
|
|
295
|
+
customFont: theme.typography?.enabled !== false && !!theme.typography?.customFonts?.length,
|
|
234
296
|
scrollbar: theme.customScrollbar?.enabled !== false,
|
|
235
297
|
cursor: theme.customCursor?.enabled !== false,
|
|
236
298
|
color: colorOptions.enabled,
|
|
@@ -3,6 +3,8 @@ type __VLS_Props = {
|
|
|
3
3
|
label?: string;
|
|
4
4
|
/** Shows the active theme's and mode's names next to the icon on the button. */
|
|
5
5
|
showLabel?: boolean;
|
|
6
|
+
/** Hides "Save changes" in the settings, for a site whose own cookie banner already records consent. */
|
|
7
|
+
hideConsent?: boolean;
|
|
6
8
|
};
|
|
7
9
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
8
10
|
declare const _default: typeof __VLS_export;
|