@windrun-huaiin/base-ui 6.0.3 → 7.1.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/dist/components/index.d.cts +1 -28
- package/dist/components/index.d.ts +1 -28
- package/dist/components/index.js +28 -199
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +27 -198
- package/dist/components/index.mjs.map +1 -1
- package/dist/components/server.d.cts +15 -1
- package/dist/components/server.d.ts +15 -1
- package/dist/components/server.js +87 -1
- package/dist/components/server.js.map +1 -1
- package/dist/components/server.mjs +87 -1
- package/dist/components/server.mjs.map +1 -1
- package/dist/ui/index.d.cts +0 -9
- package/dist/ui/index.d.ts +0 -9
- package/dist/ui/index.js +1 -0
- package/dist/ui/index.js.map +1 -1
- package/dist/ui/index.mjs +1 -0
- package/dist/ui/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/index.ts +0 -4
- package/src/components/script/google-analytics-client.tsx +53 -0
- package/src/components/script/google-analytics-script.tsx +12 -47
- package/src/components/script/microsoft-clarity-client.tsx +21 -0
- package/src/components/script/microsoft-clarity-script.tsx +11 -17
- package/src/components/server.ts +4 -0
- package/src/ui/button.tsx +2 -0
- package/src/ui/language-button.tsx +1 -1
- package/src/components/language-detector.tsx +0 -175
@@ -172,4 +172,18 @@ declare const NotFoundIcon: () => react_jsx_runtime.JSX.Element;
|
|
172
172
|
*/
|
173
173
|
declare function createSiteIcon(iconConfig: string | React.ComponentType<LucideProps>): ({ size, className, ...props }: Omit<LucideProps, "children">) => react_jsx_runtime.JSX.Element;
|
174
174
|
|
175
|
-
|
175
|
+
declare function useGoogleAnalytics(): {
|
176
|
+
trackEvent: (event: string, data?: Record<string, unknown>) => void;
|
177
|
+
};
|
178
|
+
declare global {
|
179
|
+
interface Window {
|
180
|
+
dataLayer: any[];
|
181
|
+
gtag: (...args: any[]) => void;
|
182
|
+
}
|
183
|
+
}
|
184
|
+
|
185
|
+
declare function GoogleAnalyticsScript(): react_jsx_runtime.JSX.Element | null;
|
186
|
+
|
187
|
+
declare function MicrosoftClarityScript(): react_jsx_runtime.JSX.Element | null;
|
188
|
+
|
189
|
+
export { DefaultSiteIcon, GoogleAnalyticsScript, MicrosoftClarityScript, NotFoundIcon, createSiteIcon, getGlobalIcon, getIconElement, globalLucideIcons, useGoogleAnalytics };
|
@@ -172,4 +172,18 @@ declare const NotFoundIcon: () => react_jsx_runtime.JSX.Element;
|
|
172
172
|
*/
|
173
173
|
declare function createSiteIcon(iconConfig: string | React.ComponentType<LucideProps>): ({ size, className, ...props }: Omit<LucideProps, "children">) => react_jsx_runtime.JSX.Element;
|
174
174
|
|
175
|
-
|
175
|
+
declare function useGoogleAnalytics(): {
|
176
|
+
trackEvent: (event: string, data?: Record<string, unknown>) => void;
|
177
|
+
};
|
178
|
+
declare global {
|
179
|
+
interface Window {
|
180
|
+
dataLayer: any[];
|
181
|
+
gtag: (...args: any[]) => void;
|
182
|
+
}
|
183
|
+
}
|
184
|
+
|
185
|
+
declare function GoogleAnalyticsScript(): react_jsx_runtime.JSX.Element | null;
|
186
|
+
|
187
|
+
declare function MicrosoftClarityScript(): react_jsx_runtime.JSX.Element | null;
|
188
|
+
|
189
|
+
export { DefaultSiteIcon, GoogleAnalyticsScript, MicrosoftClarityScript, NotFoundIcon, createSiteIcon, getGlobalIcon, getIconElement, globalLucideIcons, useGoogleAnalytics };
|
@@ -1,3 +1,4 @@
|
|
1
|
+
/* eslint-disable */
|
1
2
|
"use strict";
|
2
3
|
var __create = Object.create;
|
3
4
|
var __defProp = Object.defineProperty;
|
@@ -60,11 +61,14 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
60
61
|
var server_exports = {};
|
61
62
|
__export(server_exports, {
|
62
63
|
DefaultSiteIcon: () => DefaultSiteIcon,
|
64
|
+
GoogleAnalyticsScript: () => GoogleAnalyticsScript,
|
65
|
+
MicrosoftClarityScript: () => MicrosoftClarityScript,
|
63
66
|
NotFoundIcon: () => NotFoundIcon,
|
64
67
|
createSiteIcon: () => createSiteIcon,
|
65
68
|
getGlobalIcon: () => getGlobalIcon,
|
66
69
|
getIconElement: () => getIconElement,
|
67
|
-
globalLucideIcons: () => globalLucideIcons
|
70
|
+
globalLucideIcons: () => globalLucideIcons,
|
71
|
+
useGoogleAnalytics: () => useGoogleAnalytics
|
68
72
|
});
|
69
73
|
module.exports = __toCommonJS(server_exports);
|
70
74
|
|
@@ -1466,4 +1470,86 @@ function createSiteIcon(iconConfig) {
|
|
1466
1470
|
}
|
1467
1471
|
};
|
1468
1472
|
}
|
1473
|
+
|
1474
|
+
// src/components/script/google-analytics-client.tsx
|
1475
|
+
var import_script = __toESM(require("next/script"), 1);
|
1476
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
1477
|
+
function GoogleAnalyticsClient({ analyticsId }) {
|
1478
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
1479
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
1480
|
+
import_script.default,
|
1481
|
+
{
|
1482
|
+
strategy: "afterInteractive",
|
1483
|
+
src: `https://www.googletagmanager.com/gtag/js?id=${analyticsId}`
|
1484
|
+
}
|
1485
|
+
),
|
1486
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
1487
|
+
import_script.default,
|
1488
|
+
{
|
1489
|
+
id: "google-analytics",
|
1490
|
+
strategy: "afterInteractive",
|
1491
|
+
dangerouslySetInnerHTML: {
|
1492
|
+
__html: `
|
1493
|
+
window.dataLayer = window.dataLayer || [];
|
1494
|
+
function gtag(){dataLayer.push(arguments);}
|
1495
|
+
gtag('js', new Date());
|
1496
|
+
gtag('config', '${analyticsId}');
|
1497
|
+
`
|
1498
|
+
}
|
1499
|
+
}
|
1500
|
+
)
|
1501
|
+
] });
|
1502
|
+
}
|
1503
|
+
function useGoogleAnalytics() {
|
1504
|
+
const trackEvent = (event, data) => {
|
1505
|
+
if (typeof window === "undefined" || !window.gtag) {
|
1506
|
+
return;
|
1507
|
+
}
|
1508
|
+
window.gtag("event", event, data);
|
1509
|
+
};
|
1510
|
+
return {
|
1511
|
+
trackEvent
|
1512
|
+
};
|
1513
|
+
}
|
1514
|
+
|
1515
|
+
// src/components/script/google-analytics-script.tsx
|
1516
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
1517
|
+
function GoogleAnalyticsScript() {
|
1518
|
+
if (process.env.NODE_ENV !== "production") {
|
1519
|
+
return null;
|
1520
|
+
}
|
1521
|
+
const googleAnalyticsId = process.env.NEXT_PUBLIC_GOOGLE_ANALYTICS_ID;
|
1522
|
+
if (!googleAnalyticsId) {
|
1523
|
+
console.warn("NEXT_PUBLIC_GOOGLE_ANALYTICS_ID is not configured");
|
1524
|
+
return null;
|
1525
|
+
}
|
1526
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(GoogleAnalyticsClient, { analyticsId: googleAnalyticsId });
|
1527
|
+
}
|
1528
|
+
|
1529
|
+
// src/components/script/microsoft-clarity-client.tsx
|
1530
|
+
var import_script2 = __toESM(require("next/script"), 1);
|
1531
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
1532
|
+
function MicrosoftClarityClient({ clarityId }) {
|
1533
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_script2.default, { id: "microsoft-clarity", strategy: "afterInteractive", children: `
|
1534
|
+
(function(c,l,a,r,i,t,y){
|
1535
|
+
c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)};
|
1536
|
+
t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i;
|
1537
|
+
y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y);
|
1538
|
+
})(window, document, "clarity", "script", "${clarityId}");
|
1539
|
+
` });
|
1540
|
+
}
|
1541
|
+
|
1542
|
+
// src/components/script/microsoft-clarity-script.tsx
|
1543
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
1544
|
+
function MicrosoftClarityScript() {
|
1545
|
+
if (process.env.NODE_ENV !== "production") {
|
1546
|
+
return null;
|
1547
|
+
}
|
1548
|
+
const microsoftClarityId = process.env.NEXT_PUBLIC_MICROSOFT_CLARITY_ID;
|
1549
|
+
if (!microsoftClarityId) {
|
1550
|
+
console.warn("NEXT_PUBLIC_MICROSOFT_CLARITY_ID is not configured");
|
1551
|
+
return null;
|
1552
|
+
}
|
1553
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(MicrosoftClarityClient, { clarityId: microsoftClarityId });
|
1554
|
+
}
|
1469
1555
|
//# sourceMappingURL=server.js.map
|