@venix-sistemas/jade 1.4.1 → 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.
Files changed (41) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +994 -969
  3. package/dist/module.d.mts +1 -0
  4. package/dist/module.json +1 -1
  5. package/dist/module.mjs +29 -8
  6. package/dist/runtime/components/VenixIcon.vue +20 -20
  7. package/dist/runtime/components/VenixThemeSwitcher.vue +336 -336
  8. package/dist/runtime/composables/useVenixTheme.d.ts +4 -4
  9. package/dist/runtime/composables/useVenixTheme.js +22 -0
  10. package/dist/runtime/nitro/theme-init.js +1 -1
  11. package/dist/runtime/scripts/theme-init.d.ts +4 -2
  12. package/dist/runtime/scripts/theme-init.js +14 -4
  13. package/dist/runtime/server/tsconfig.json +3 -3
  14. package/dist/shared/css/colors.d.ts +1 -1
  15. package/dist/shared/css/colors.js +11 -3
  16. package/dist/shared/css/index.js +1 -1
  17. package/dist/shared/css/tokens.d.ts +7 -0
  18. package/dist/shared/css/tokens.js +32 -5
  19. package/dist/shared/theme.json +314 -320
  20. package/dist/shared/token-names.d.ts +14 -5
  21. package/dist/shared/token-names.js +1 -1
  22. package/dist/shared/types/color-options.d.ts +24 -1
  23. package/dist/shared/types/colors.d.ts +2 -0
  24. package/dist/shared/types/index.d.ts +3 -1
  25. package/dist/shared/types/runtime-config.d.ts +2 -0
  26. package/dist/shared/types/theme-names.d.ts +23 -0
  27. package/dist/shared/types/theme-names.js +0 -0
  28. package/dist/shared/utils/base-url.d.ts +15 -0
  29. package/dist/shared/utils/base-url.js +32 -0
  30. package/dist/shared/utils/derive-seeds.d.ts +24 -0
  31. package/dist/shared/utils/derive-seeds.js +30 -0
  32. package/dist/shared/utils/oklab.d.ts +8 -0
  33. package/dist/shared/utils/oklab.js +15 -2
  34. package/dist/shared/utils/scale.d.ts +7 -2
  35. package/dist/shared/utils/scale.js +4 -3
  36. package/dist/shared/utils/theme-color.d.ts +9 -0
  37. package/dist/shared/utils/theme-color.js +10 -0
  38. package/dist/shared/utils/theme-types.d.ts +8 -0
  39. package/dist/shared/utils/theme-types.js +16 -0
  40. package/dist/types.d.mts +2 -0
  41. package/package.json +15 -13
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
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": ">=4.0.0"
6
6
  },
7
- "version": "1.4.1",
7
+ "version": "1.4.2-alpha.0",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "1.0.3",
10
10
  "unbuild": "unknown"
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
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, TOKEN_ROLES } from '../dist/shared/token-names.js';
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 TOKEN_ROLES) {
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) {
@@ -284,8 +296,14 @@ const module$1 = defineNuxtModule({
284
296
  requireConsent: true,
285
297
  seasonal: true,
286
298
  allowVenixOverride: false,
287
- contrast: "AA"
299
+ contrast: "AA",
300
+ themeColorMeta: false,
301
+ highContrast: false
288
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
+ }
289
307
  for (const message of findDeprecatedThemeEntries(getBaseThemeEntries(), colorOptions.themes)) {
290
308
  useLogger("jade").warn(message);
291
309
  }
@@ -327,8 +345,10 @@ const module$1 = defineNuxtModule({
327
345
  manageHtmlLang: false
328
346
  });
329
347
  registerOverlayScrollbars(nuxt, resolver, theme);
330
- registerThemeCSS(nuxt, theme);
331
- registerFontPreloads(nuxt, theme);
348
+ const assetTheme = withAppBaseURL(theme, nuxt.options.app.baseURL);
349
+ registerThemeCSS(nuxt, assetTheme);
350
+ registerThemeTypes(theme);
351
+ registerFontPreloads(nuxt, assetTheme);
332
352
  registerThemePlugins(nuxt, resolver, shouldApplyColors);
333
353
  const vuetifyOptions = resolveFeatureOption(options.vuetify, {
334
354
  enabled: true
@@ -352,6 +372,7 @@ const module$1 = defineNuxtModule({
352
372
  iconFormat: iconOptions.enabled ? colorOptions.iconFormat : "emote",
353
373
  requireConsent: colorOptions.requireConsent,
354
374
  seasonal: colorOptions.seasonal,
375
+ ...themeColorMeta && { themeColorMeta },
355
376
  tokens,
356
377
  icon: {
357
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>