@venix-sistemas/jade 1.0.0 → 1.0.1

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.
@@ -0,0 +1,84 @@
1
+ <!--
2
+ Get your module up and running quickly.
3
+
4
+ Find and replace all on all files (CMD+SHIFT+F):
5
+ - Name: My Module
6
+ - Package name: my-module
7
+ - Description: My new Nuxt module
8
+ -->
9
+
10
+ # My Module
11
+
12
+ [![npm version][npm-version-src]][npm-version-href]
13
+ [![npm downloads][npm-downloads-src]][npm-downloads-href]
14
+ [![License][license-src]][license-href]
15
+ [![Nuxt][nuxt-src]][nuxt-href]
16
+
17
+ My new Nuxt module for doing amazing things.
18
+
19
+ - [✨ &nbsp;Release Notes](/CHANGELOG.md)
20
+ <!-- - [🏀 Online playground](https://stackblitz.com/github/your-org/my-module?file=playground%2Fapp.vue) -->
21
+ <!-- - [📖 &nbsp;Documentation](https://example.com) -->
22
+
23
+ ## Features
24
+
25
+ <!-- Highlight some of the features your module provide here -->
26
+ - ⛰ &nbsp;Foo
27
+ - 🚠 &nbsp;Bar
28
+ - 🌲 &nbsp;Baz
29
+
30
+ ## Quick Setup
31
+
32
+ Install the module to your Nuxt application with one command:
33
+
34
+ ```bash
35
+ npx nuxt module add my-module
36
+ ```
37
+
38
+ That's it! You can now use My Module in your Nuxt app ✨
39
+
40
+
41
+ ## Contribution
42
+
43
+ <details>
44
+ <summary>Local development</summary>
45
+
46
+ ```bash
47
+ # Install dependencies
48
+ npm install
49
+
50
+ # Generate type stubs
51
+ npm run dev:prepare
52
+
53
+ # Develop with the playground
54
+ npm run dev
55
+
56
+ # Build the playground
57
+ npm run dev:build
58
+
59
+ # Run ESLint
60
+ npm run lint
61
+
62
+ # Run Vitest
63
+ npm run test
64
+ npm run test:watch
65
+
66
+ # Release new version
67
+ npm run release
68
+ ```
69
+
70
+ </details>
71
+
72
+
73
+ <!-- Badges -->
74
+ [npm-version-src]: https://img.shields.io/npm/v/my-module/latest.svg?style=flat&colorA=020420&colorB=00DC82
75
+ [npm-version-href]: https://npmjs.com/package/my-module
76
+
77
+ [npm-downloads-src]: https://img.shields.io/npm/dm/my-module.svg?style=flat&colorA=020420&colorB=00DC82
78
+ [npm-downloads-href]: https://npm.chart.dev/my-module
79
+
80
+ [license-src]: https://img.shields.io/npm/l/my-module.svg?style=flat&colorA=020420&colorB=00DC82
81
+ [license-href]: https://npmjs.com/package/my-module
82
+
83
+ [nuxt-src]: https://img.shields.io/badge/Nuxt-020420?logo=nuxt
84
+ [nuxt-href]: https://nuxt.com
package/README.md CHANGED
@@ -228,6 +228,8 @@ Unlike the UnoCSS integration (which points at CSS variables), Vuetify computes
228
228
 
229
229
  `vuetify: true` also adds a small runtime plugin that keeps Vuetify's active theme in sync at every point: it resolves the same `theme-preference`/`theme-resolved` cookies used elsewhere in the module so Vuetify's `defaultTheme` matches what's rendered from the first paint (server and client), and it applies every later runtime switch (`theme.toggle()`, the switcher, a system/seasonal auto-change) via `theme.change()` (the current, non-deprecated API), inside the same View Transition the rest of the module uses rather than racing it as a separate update.
230
230
 
231
+ In SPA mode (`ssr: false`), the same plugin also closes a first-paint gap: with unhead present, Vuetify hands its theme stylesheet (`<style id="vuetify-theme-stylesheet">`, with the `--v-theme-*` variables) to `head.push()`, and unhead only writes it to the DOM after the first render — so the page would show for a moment without Vuetify's theme colors. The plugin writes a copy of that stylesheet (`<style id="venix-vuetify-theme-early">`) into `<head>` before the app mounts, and removes it as soon as unhead's own stylesheet reaches the DOM. With SSR the stylesheet already comes in the HTML, so the plugin does nothing there.
232
+
231
233
  **This must come before the Vuetify module in your `modules` array** — the registration happens through Vuetify's own [`vuetify:registerModule`](https://nuxt.vuetifyjs.com/guide/advanced/layers-and-hooks.html) build hook, which only picks up registrations made before Vuetify resolves its configuration. If you already define `vuetify.vuetifyOptions.theme.themes` yourself, your values take precedence over the generated ones (merged per color, not replaced wholesale).
232
234
 
233
235
  `vuetify` defaults to `false` — unlike the other integrations, it ships a runtime plugin, so it's opt-in rather than automatic. There's no hard dependency on Vuetify: if `vuetify-nuxt-module` isn't installed, enabling this option is a no-op. Tested against Vuetify `^4.2.1` with `vuetify-nuxt-module@1.0.0-rc.6` — as that module is still pre-1.0, its hooks may still change between releases.
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@venix-sistemas/jade",
3
3
  "configKey": "venixTheme",
4
- "version": "1.0.0",
4
+ "version": "1.0.1",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.3",
7
7
  "unbuild": "unknown"
@@ -1,6 +1,8 @@
1
1
  import { defineNuxtPlugin, useRuntimeConfig, useCookie } from "#app";
2
2
  import { THEME_PREFERENCE_COOKIE, THEME_RESOLVED_COOKIE, THEME_APPLIED_EVENT, DEFAULT_THEME } from "../../shared/constants";
3
3
  import { buildResolvedTheme } from "../../shared/utils/theme-config";
4
+ const VUETIFY_THEME_STYLESHEET_ID = "vuetify-theme-stylesheet";
5
+ const EARLY_THEME_STYLESHEET_ID = "venix-vuetify-theme-early";
4
6
  function applyVuetifyTheme(vuetify, name) {
5
7
  if (typeof vuetify.theme.change === "function") {
6
8
  vuetify.theme.change(name);
@@ -8,6 +10,21 @@ function applyVuetifyTheme(vuetify, name) {
8
10
  vuetify.theme.global.name.value = name;
9
11
  }
10
12
  }
13
+ function writeEarlyThemeStylesheet(nuxtApp, vuetify) {
14
+ const css = vuetify.theme.styles.value;
15
+ if (!css || document.getElementById(VUETIFY_THEME_STYLESHEET_ID)) return;
16
+ const headHooks = nuxtApp.vueApp._context.provides.usehead?.hooks;
17
+ if (!headHooks) return;
18
+ const style = document.createElement("style");
19
+ style.id = EARLY_THEME_STYLESHEET_ID;
20
+ style.textContent = css;
21
+ document.head.appendChild(style);
22
+ const unhook = headHooks.hook("dom:rendered", () => {
23
+ if (!document.getElementById(VUETIFY_THEME_STYLESHEET_ID)) return;
24
+ style.remove();
25
+ unhook();
26
+ });
27
+ }
11
28
  export default defineNuxtPlugin({
12
29
  name: "venix-theme-vuetify-sync",
13
30
  enforce: "pre",
@@ -18,8 +35,8 @@ export default defineNuxtPlugin({
18
35
  const preferenceCookie = useCookie(THEME_PREFERENCE_COOKIE);
19
36
  const theme = buildResolvedTheme(themeConfig);
20
37
  const defaultTheme = theme.colors.defaultColor || DEFAULT_THEME;
21
- const hookBeforeCreate = nuxtApp.hook;
22
- hookBeforeCreate("vuetify:before-create", ({ vuetifyOptions }) => {
38
+ const hookVuetify = nuxtApp.hook;
39
+ hookVuetify("vuetify:before-create", ({ vuetifyOptions }) => {
23
40
  const themes = vuetifyOptions?.theme?.themes;
24
41
  if (!vuetifyOptions?.theme || !themes) return;
25
42
  let resolved = defaultTheme;
@@ -31,8 +48,8 @@ export default defineNuxtPlugin({
31
48
  vuetifyOptions.theme.defaultTheme = resolved;
32
49
  });
33
50
  if (import.meta.client) {
34
- const hookReady = nuxtApp.hook;
35
- hookReady("vuetify:ready", (vuetify) => {
51
+ hookVuetify("vuetify:ready", (vuetify) => {
52
+ if (!nuxtApp.payload.serverRendered) writeEarlyThemeStylesheet(nuxtApp, vuetify);
36
53
  window.addEventListener(THEME_APPLIED_EVENT, ((event) => {
37
54
  applyVuetifyTheme(vuetify, event.detail);
38
55
  }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@venix-sistemas/jade",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Complete color system for Nuxt: seasonal colors, automatic theme, SSR, Cookie Policy, cursor, scrollbar, etc...",
5
5
  "keywords": [
6
6
  "nuxt",
@@ -62,18 +62,6 @@
62
62
  "workspaces": [
63
63
  "playground"
64
64
  ],
65
- "scripts": {
66
- "prepack": "nuxt-module-build build",
67
- "dev": "npm run dev:prepare && nuxt dev playground",
68
- "dev:build": "nuxt build playground",
69
- "dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxt prepare playground",
70
- "release": "npm run lint && npm run test && npm run prepack && changelogen --release && npm publish && git push --follow-tags",
71
- "release:alpha": "npm run lint && npm run test && npm run prepack && changelogen --release --prerelease alpha && npm publish --tag alpha && git push --follow-tags",
72
- "lint": "eslint .",
73
- "test": "vitest run",
74
- "test:watch": "vitest watch",
75
- "test:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit"
76
- },
77
65
  "dependencies": {
78
66
  "@iconify-json/line-md": "^1.2.16",
79
67
  "@iconify-json/mdi": "^1.2.3",
@@ -96,5 +84,15 @@
96
84
  "vitest": "5.0.3",
97
85
  "vue-tsc": "^3.3.12"
98
86
  },
99
- "packageManager": "pnpm@12.3.4"
87
+ "scripts": {
88
+ "dev": "pnpm run dev:prepare && nuxt dev playground",
89
+ "dev:build": "nuxt build playground",
90
+ "dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxt prepare playground",
91
+ "release": "pnpm run lint && pnpm run test && pnpm run prepack && changelogen --release && pnpm publish && git push --follow-tags",
92
+ "release:alpha": "pnpm run lint && pnpm run test && pnpm run prepack && changelogen --release --prerelease alpha && pnpm publish --tag alpha && git push --follow-tags",
93
+ "lint": "eslint .",
94
+ "test": "vitest run",
95
+ "test:watch": "vitest watch",
96
+ "test:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit"
97
+ }
100
98
  }