@venix-sistemas/jade 1.4.0 → 1.4.2-alpha.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/LICENSE +21 -21
- package/README.md +994 -969
- package/dist/module.d.mts +1 -0
- package/dist/module.json +4 -1
- package/dist/module.mjs +39 -10
- package/dist/runtime/components/VenixIcon.vue +20 -20
- package/dist/runtime/components/VenixThemeSwitcher.vue +336 -336
- package/dist/runtime/composables/useVenixTheme.d.ts +4 -4
- package/dist/runtime/composables/useVenixTheme.js +25 -0
- package/dist/runtime/nitro/theme-init.js +1 -1
- package/dist/runtime/scripts/theme-init.d.ts +11 -1
- package/dist/runtime/scripts/theme-init.js +25 -2
- package/dist/runtime/server/tsconfig.json +3 -3
- package/dist/shared/css/colors.d.ts +1 -1
- package/dist/shared/css/colors.js +11 -3
- package/dist/shared/css/index.js +1 -1
- package/dist/shared/css/tokens.d.ts +7 -0
- package/dist/shared/css/tokens.js +32 -5
- package/dist/shared/theme.json +314 -320
- package/dist/shared/token-names.d.ts +14 -5
- package/dist/shared/token-names.js +1 -1
- package/dist/shared/types/color-options.d.ts +24 -1
- package/dist/shared/types/colors.d.ts +2 -0
- package/dist/shared/types/index.d.ts +3 -1
- package/dist/shared/types/runtime-config.d.ts +2 -0
- package/dist/shared/types/theme-names.d.ts +23 -0
- package/dist/shared/types/theme-names.js +0 -0
- package/dist/shared/utils/base-url.d.ts +15 -0
- package/dist/shared/utils/base-url.js +32 -0
- package/dist/shared/utils/derive-seeds.d.ts +24 -0
- package/dist/shared/utils/derive-seeds.js +30 -0
- package/dist/shared/utils/load.d.ts +1 -1
- package/dist/shared/utils/load.js +1 -1
- package/dist/shared/utils/merge-themes.d.ts +10 -0
- package/dist/shared/utils/merge-themes.js +55 -0
- package/dist/shared/utils/oklab.d.ts +8 -0
- package/dist/shared/utils/oklab.js +15 -2
- package/dist/shared/utils/scale.d.ts +7 -2
- package/dist/shared/utils/scale.js +4 -3
- package/dist/shared/utils/theme-color.d.ts +9 -0
- package/dist/shared/utils/theme-color.js +10 -0
- package/dist/shared/utils/theme-types.d.ts +8 -0
- package/dist/shared/utils/theme-types.js +16 -0
- package/dist/types.d.mts +2 -0
- package/package.json +25 -24
package/dist/module.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
2
|
import { TranslationConfig, ColorOptions, ScrollbarConfig, CursorConfig, TypographyConfig, VuetifyOptions, IconOptions, ExperimentalConfig } from '../dist/shared/types/index.js';
|
|
3
|
+
export { ThemeName, ThemeOrVariantName, TokenName } from '../dist/shared/types/index.js';
|
|
3
4
|
|
|
4
5
|
interface ModuleOptions {
|
|
5
6
|
translation?: boolean | Partial<TranslationConfig>;
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
import { addComponent, addPlugin, addServerPlugin, addTemplate, useLogger, installModule, addImports, defineNuxtModule, createResolver } from '@nuxt/kit';
|
|
1
|
+
import { addComponent, addPlugin, addServerPlugin, addTemplate, addTypeTemplate, useLogger, installModule, addImports, defineNuxtModule, createResolver } from '@nuxt/kit';
|
|
2
2
|
import { loadTheme } from '../dist/shared/utils/load.js';
|
|
3
|
-
import { SWITCHER_ICONS, DEFAULT_THEME, DEFAULT_LOCALE_COOKIE_NAME, DEFAULT_LOCALE } from '../dist/shared/constants.js';
|
|
3
|
+
import { SWITCHER_ICONS, DEFAULT_THEME, COLOR_PROPERTIES, DEFAULT_LOCALE_COOKIE_NAME, DEFAULT_LOCALE } from '../dist/shared/constants.js';
|
|
4
|
+
import { resolveThemeColorName } from '../dist/shared/utils/theme-color.js';
|
|
5
|
+
import { withAppBaseURL } from '../dist/shared/utils/base-url.js';
|
|
4
6
|
import { resolveFeatureOption } from '../dist/shared/utils/options.js';
|
|
5
|
-
import { findDeprecatedThemeEntries, overridesBrandColors } from '../dist/shared/utils/merge-themes.js';
|
|
7
|
+
import { findDeprecatedThemeEntries, findThemeConfigIssues, overridesBrandColors } from '../dist/shared/utils/merge-themes.js';
|
|
6
8
|
import { buildResolvedTheme, getBaseThemeEntries, findInvalidDefaultColor } from '../dist/shared/utils/theme-config.js';
|
|
7
9
|
import { generateTokens, findTokenOverrideIssues, findTokenContrastIssues, collectTokens } from '../dist/shared/css/tokens.js';
|
|
8
|
-
import { tokensEnabled
|
|
10
|
+
import { tokensEnabled } from '../dist/shared/token-names.js';
|
|
9
11
|
import { isColorTheme, getThemeHexColors } from '../dist/shared/utils/theme-resolve.js';
|
|
10
12
|
import { processTheme } from '../dist/shared/css/index.js';
|
|
13
|
+
import { renderThemeTypes } from '../dist/shared/utils/theme-types.js';
|
|
11
14
|
import { createRequire } from 'node:module';
|
|
12
15
|
import { realpathSync } from 'node:fs';
|
|
13
16
|
import { fileURLToPath } from 'node:url';
|
|
@@ -42,6 +45,7 @@ function customizeTheme(baseTheme, options) {
|
|
|
42
45
|
});
|
|
43
46
|
customized.colors = { ...resolved.colors, enabled: customized.colors.enabled };
|
|
44
47
|
if (colorOption.contrast !== void 0) customized.colors.contrast = colorOption.contrast;
|
|
48
|
+
if (colorOption.highContrast !== void 0) customized.colors.highContrast = colorOption.highContrast;
|
|
45
49
|
}
|
|
46
50
|
const experimental = resolveFeatureOption(options.experimental, { enabled: false }).enabled;
|
|
47
51
|
if (experimental && customized.colors.enabled !== false) {
|
|
@@ -103,6 +107,13 @@ function registerThemeCSS(nuxt, theme) {
|
|
|
103
107
|
}
|
|
104
108
|
}
|
|
105
109
|
|
|
110
|
+
function registerThemeTypes(theme) {
|
|
111
|
+
addTypeTemplate({
|
|
112
|
+
filename: "types/venix-theme.d.ts",
|
|
113
|
+
getContents: () => renderThemeTypes(theme.colors)
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
|
|
106
117
|
const FONT_MIME_TYPES = {
|
|
107
118
|
woff2: "font/woff2",
|
|
108
119
|
woff: "font/woff",
|
|
@@ -146,12 +157,13 @@ function registerOverlayScrollbars(nuxt, resolver, theme, resolveCSS = resolveOv
|
|
|
146
157
|
addPlugin({ src: resolver.resolve("./runtime/plugins/overlay-scrollbars.client"), mode: "client" });
|
|
147
158
|
}
|
|
148
159
|
|
|
160
|
+
const VUETIFY_TOKEN_ROLES = ["primary", "secondary"];
|
|
149
161
|
function tokenColorsForVuetify(themeColors, level, hasBackground2) {
|
|
150
162
|
const tokens = Object.fromEntries(generateTokens(themeColors, level));
|
|
151
163
|
const colors = {};
|
|
152
|
-
for (const role of
|
|
164
|
+
for (const role of VUETIFY_TOKEN_ROLES) {
|
|
153
165
|
const on = tokens[`on-${role}`];
|
|
154
|
-
if (on) colors[`on-${role}`] = on;
|
|
166
|
+
if (on && themeColors[role]) colors[`on-${role}`] = on;
|
|
155
167
|
}
|
|
156
168
|
if (tokens["bg-subtle"] && !hasBackground2) colors.surface = tokens["bg-subtle"];
|
|
157
169
|
if (tokens.text) {
|
|
@@ -250,7 +262,10 @@ async function registerThemeIcon(nuxt, resolver, options, colors) {
|
|
|
250
262
|
const module$1 = defineNuxtModule({
|
|
251
263
|
meta: {
|
|
252
264
|
name: "@venix-sistemas/jade",
|
|
253
|
-
configKey: "venixTheme"
|
|
265
|
+
configKey: "venixTheme",
|
|
266
|
+
// The module is built and tested on Nuxt 4 (`@nuxt/kit` ^4). Older
|
|
267
|
+
// versions get a clear message, not the first error that comes up.
|
|
268
|
+
compatibility: { nuxt: ">=4.0.0" }
|
|
254
269
|
},
|
|
255
270
|
defaults: {
|
|
256
271
|
translation: true,
|
|
@@ -281,11 +296,22 @@ const module$1 = defineNuxtModule({
|
|
|
281
296
|
requireConsent: true,
|
|
282
297
|
seasonal: true,
|
|
283
298
|
allowVenixOverride: false,
|
|
284
|
-
contrast: "AA"
|
|
299
|
+
contrast: "AA",
|
|
300
|
+
themeColorMeta: false,
|
|
301
|
+
highContrast: false
|
|
285
302
|
});
|
|
303
|
+
const themeColorMeta = resolveThemeColorName(colorOptions.themeColorMeta);
|
|
304
|
+
if (colorOptions.themeColorMeta && !themeColorMeta) {
|
|
305
|
+
useLogger("jade").warn(`\`color.themeColorMeta\` is \`${String(colorOptions.themeColorMeta)}\`, which is not a theme color (${COLOR_PROPERTIES.join(", ")}): \`theme-color\` is left alone.`);
|
|
306
|
+
}
|
|
286
307
|
for (const message of findDeprecatedThemeEntries(getBaseThemeEntries(), colorOptions.themes)) {
|
|
287
308
|
useLogger("jade").warn(message);
|
|
288
309
|
}
|
|
310
|
+
if (colorOptions.enabled) {
|
|
311
|
+
for (const message of findThemeConfigIssues(getBaseThemeEntries(), colorOptions.themes)) {
|
|
312
|
+
useLogger("jade").warn(message);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
289
315
|
if (colorOptions.enabled && !colorOptions.allowVenixOverride && overridesBrandColors(getBaseThemeEntries(), colorOptions.themes)) {
|
|
290
316
|
useLogger("jade").warn("`color.themes` changes the colors of `venix`, the Venix Sistemas brand theme. For another identity, add a theme of your own (e.g. `color.themes.myBrand`) and set `color.defaultColor` to its name; Venix stays in the switcher next to it. Set `color.allowVenixOverride: true` if changing Venix is intended.");
|
|
291
317
|
}
|
|
@@ -319,8 +345,10 @@ const module$1 = defineNuxtModule({
|
|
|
319
345
|
manageHtmlLang: false
|
|
320
346
|
});
|
|
321
347
|
registerOverlayScrollbars(nuxt, resolver, theme);
|
|
322
|
-
|
|
323
|
-
|
|
348
|
+
const assetTheme = withAppBaseURL(theme, nuxt.options.app.baseURL);
|
|
349
|
+
registerThemeCSS(nuxt, assetTheme);
|
|
350
|
+
registerThemeTypes(theme);
|
|
351
|
+
registerFontPreloads(nuxt, assetTheme);
|
|
324
352
|
registerThemePlugins(nuxt, resolver, shouldApplyColors);
|
|
325
353
|
const vuetifyOptions = resolveFeatureOption(options.vuetify, {
|
|
326
354
|
enabled: true
|
|
@@ -344,6 +372,7 @@ const module$1 = defineNuxtModule({
|
|
|
344
372
|
iconFormat: iconOptions.enabled ? colorOptions.iconFormat : "emote",
|
|
345
373
|
requireConsent: colorOptions.requireConsent,
|
|
346
374
|
seasonal: colorOptions.seasonal,
|
|
375
|
+
...themeColorMeta && { themeColorMeta },
|
|
347
376
|
tokens,
|
|
348
377
|
icon: {
|
|
349
378
|
aliases: iconOptions.aliases
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<span
|
|
3
|
-
v-if="resolved.kind === 'emoji'"
|
|
4
|
-
class="venix-icon venix-icon--emoji"
|
|
5
|
-
v-bind="$attrs"
|
|
6
|
-
>{{ resolved.value }}</span>
|
|
7
|
-
<!-- eslint-disable vue/no-v-html -- SVG comes from the theme config/consumer dev's props, not end-user input -->
|
|
8
|
-
<span
|
|
9
|
-
v-else-if="resolved.kind === 'svg'"
|
|
10
|
-
class="venix-icon venix-icon--svg"
|
|
11
|
-
v-bind="$attrs"
|
|
12
|
-
v-html="resolved.value"
|
|
13
|
-
/>
|
|
14
|
-
<!-- eslint-enable vue/no-v-html -->
|
|
15
|
-
<Icon
|
|
16
|
-
v-else
|
|
17
|
-
class="venix-icon venix-icon--iconify"
|
|
18
|
-
:name="resolved.value"
|
|
19
|
-
:mode="mode"
|
|
20
|
-
v-bind="$attrs"
|
|
21
|
-
/>
|
|
2
|
+
<span
|
|
3
|
+
v-if="resolved.kind === 'emoji'"
|
|
4
|
+
class="venix-icon venix-icon--emoji"
|
|
5
|
+
v-bind="$attrs"
|
|
6
|
+
>{{ resolved.value }}</span>
|
|
7
|
+
<!-- eslint-disable vue/no-v-html -- SVG comes from the theme config/consumer dev's props, not end-user input -->
|
|
8
|
+
<span
|
|
9
|
+
v-else-if="resolved.kind === 'svg'"
|
|
10
|
+
class="venix-icon venix-icon--svg"
|
|
11
|
+
v-bind="$attrs"
|
|
12
|
+
v-html="resolved.value"
|
|
13
|
+
/>
|
|
14
|
+
<!-- eslint-enable vue/no-v-html -->
|
|
15
|
+
<Icon
|
|
16
|
+
v-else
|
|
17
|
+
class="venix-icon venix-icon--iconify"
|
|
18
|
+
:name="resolved.value"
|
|
19
|
+
:mode="mode"
|
|
20
|
+
v-bind="$attrs"
|
|
21
|
+
/>
|
|
22
22
|
</template>
|
|
23
23
|
|
|
24
24
|
<script setup>
|