@alexandregme/zljs 3.13.2 → 3.14.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/CHANGELOG.md CHANGED
@@ -8,6 +8,19 @@ A change that needs action in an app has a **Migration** note. When updating, re
8
8
 
9
9
  ## [Unreleased]
10
10
 
11
+ ## [3.14.0] - 2026-11-12
12
+
13
+ ### Added
14
+
15
+ - `RootLayout` counts the page views with [Vercel Web Analytics](https://vercel.com/docs/analytics): it renders `Analytics` from `@vercel/analytics/next`, which zljs now installs, so an app has nothing to install or import. It adds a script to the document and nothing to the page. It is always on. In development it sends nothing and stays silent in the console
16
+
17
+ #### Migration
18
+
19
+ An app that uses `RootLayout` starts loading the analytics script when it updates:
20
+
21
+ - Enable Web Analytics in the project on Vercel (Analytics tab), then deploy. Until it is enabled the script answers 404 and nothing is counted
22
+ - An app that already renders `<Analytics />` from `@vercel/analytics` itself: remove its own, or the views are counted by two components. Find it with `grep -rn "@vercel/analytics" app src pages`
23
+
11
24
  ## [3.13.1] - 2026-11-12
12
25
 
13
26
  ### Fixed
@@ -530,7 +543,8 @@ Replace the shade with the class of the `color` being tested, for example `/(^|\
530
543
 
531
544
  The message of `Error` is `text-zl-danger`. `none` and `ghost` didn't change.
532
545
 
533
- [Unreleased]: https://github.com/alexandregme/zljs/compare/v3.13.1...HEAD
546
+ [Unreleased]: https://github.com/alexandregme/zljs/compare/v3.14.0...HEAD
547
+ [3.14.0]: https://github.com/alexandregme/zljs/compare/v3.13.1...v3.14.0
534
548
  [3.13.1]: https://github.com/alexandregme/zljs/compare/v3.13.0...v3.13.1
535
549
  [3.13.0]: https://github.com/alexandregme/zljs/compare/v3.11.0...v3.13.0
536
550
  [3.11.0]: https://github.com/alexandregme/zljs/compare/v3.10.0...v3.11.0
package/README.md CHANGED
@@ -43,6 +43,23 @@ import { FormProvider, FormInput } from "@alexandregme/zljs/rhf";
43
43
  <Button onClick={handleClick}>Submit</Button>;
44
44
  ```
45
45
 
46
+ `RootLayout` goes in the root layout of a Next.js app, around its content. It renders the page's `<main>` and counts the page views with [Vercel Web Analytics](https://vercel.com/docs/analytics), so the app installs nothing for it: enable Web Analytics in the project on Vercel and deploy.
47
+
48
+ ```tsx
49
+ // app/layout.tsx
50
+ import { RootLayout } from "@alexandregme/zljs/next";
51
+
52
+ export default function Layout({ children }: { children: React.ReactNode }) {
53
+ return (
54
+ <html lang="en">
55
+ <body>
56
+ <RootLayout>{children}</RootLayout>
57
+ </body>
58
+ </html>
59
+ );
60
+ }
61
+ ```
62
+
46
63
  ## Colors
47
64
 
48
65
  The components work with no setup, using the default colors. To use your own, redefine the values you want after importing the styles:
@@ -9,6 +9,9 @@ import {
9
9
  useRouterStore
10
10
  } from "../chunk-ZB76FFTW.js";
11
11
 
12
+ // core/next/root-layout/root-layout.tsx
13
+ import { Analytics } from "@vercel/analytics/next";
14
+
12
15
  // core/next/root-layout/root-layout.styles.ts
13
16
  import { tv } from "tailwind-variants";
14
17
  var rootLayout = tv({
@@ -16,9 +19,12 @@ var rootLayout = tv({
16
19
  });
17
20
 
18
21
  // core/next/root-layout/root-layout.tsx
19
- import { jsx } from "react/jsx-runtime";
22
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
20
23
  var RootLayout = ({ children }) => {
21
- return /* @__PURE__ */ jsx("main", { className: rootLayout(), children });
24
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
25
+ /* @__PURE__ */ jsx("main", { className: rootLayout(), children }),
26
+ /* @__PURE__ */ jsx(Analytics, { debug: false })
27
+ ] });
22
28
  };
23
29
 
24
30
  // core/next/not-found/not-found.styles.ts
@@ -32,7 +38,7 @@ var notFound = tv2({
32
38
  });
33
39
 
34
40
  // core/next/not-found/not-found.tsx
35
- import { jsx as jsx2, jsxs } from "react/jsx-runtime";
41
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
36
42
  var NotFound = ({
37
43
  title = "Page not found",
38
44
  message = "The page you are looking for does not exist.",
@@ -40,9 +46,9 @@ var NotFound = ({
40
46
  backLabel = "Go back home"
41
47
  }) => {
42
48
  const { base, code, content } = notFound();
43
- return /* @__PURE__ */ jsxs("div", { className: base(), children: [
49
+ return /* @__PURE__ */ jsxs2("div", { className: base(), children: [
44
50
  /* @__PURE__ */ jsx2("span", { className: code(), children: "404" }),
45
- /* @__PURE__ */ jsxs("div", { className: content(), children: [
51
+ /* @__PURE__ */ jsxs2("div", { className: content(), children: [
46
52
  /* @__PURE__ */ jsx2(Heading, { children: title }),
47
53
  /* @__PURE__ */ jsx2(Text, { color: "muted", children: message })
48
54
  ] }),
@@ -69,7 +75,7 @@ var PageWrapper = ({ children }) => {
69
75
  // core/next/app-providers/app-providers.tsx
70
76
  import { useEffect } from "react";
71
77
  import { usePathname } from "next/navigation.js";
72
- import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
78
+ import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
73
79
  var RouteSync = () => {
74
80
  const pathname = usePathname();
75
81
  const setRoute = useRouterStore((s) => s.setRoute);
@@ -84,7 +90,7 @@ var AppProviders = ({
84
90
  children,
85
91
  auth,
86
92
  ...store
87
- }) => /* @__PURE__ */ jsxs2(ReduxProvider, { ...store, children: [
93
+ }) => /* @__PURE__ */ jsxs3(ReduxProvider, { ...store, children: [
88
94
  /* @__PURE__ */ jsx4(RouteSync, {}),
89
95
  /* @__PURE__ */ jsx4(ZustandProviders, { auth, children })
90
96
  ] });
@@ -92,7 +98,7 @@ var AppProviders = ({
92
98
  // core/next/page-config/page-config.tsx
93
99
  import { useEffect as useEffect2 } from "react";
94
100
  import { useDispatch, useStore } from "react-redux";
95
- import { Fragment, jsx as jsx5 } from "react/jsx-runtime";
101
+ import { Fragment as Fragment2, jsx as jsx5 } from "react/jsx-runtime";
96
102
  var PageConfig = ({
97
103
  children,
98
104
  title,
@@ -115,7 +121,7 @@ var PageConfig = ({
115
121
  initPage(dispatch);
116
122
  }
117
123
  }, []);
118
- return /* @__PURE__ */ jsx5(Fragment, { children });
124
+ return /* @__PURE__ */ jsx5(Fragment2, { children });
119
125
  };
120
126
  export {
121
127
  AppProviders,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alexandregme/zljs",
3
- "version": "3.13.2",
3
+ "version": "3.14.0",
4
4
  "description": "Opinionated, accessible React component library for enterprise apps (Next.js, Tailwind CSS v4).",
5
5
  "keywords": [
6
6
  "react",
@@ -76,6 +76,7 @@
76
76
  "@hookform/resolvers": "^5.2.2",
77
77
  "@radix-ui/react-dialog": "^1.1.15",
78
78
  "@radix-ui/react-tabs": "^1.2.1",
79
+ "@vercel/analytics": "^2.0.1",
79
80
  "ag-grid-community": "^36.2.0",
80
81
  "ag-grid-react": "^36.2.0",
81
82
  "axios": "^1.13.5",