react-better-html 1.1.160 → 1.1.162
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/index.d.mts +11 -6
- package/dist/index.d.ts +11 -6
- package/dist/index.js +37 -22
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +37 -22
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -9,7 +9,6 @@ var isMobileDevice = /Mobi|Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Op
|
|
|
9
9
|
|
|
10
10
|
// src/utils/hooks.ts
|
|
11
11
|
import { useCallback as useCallback4, useEffect as useEffect5, useMemo as useMemo3, useRef as useRef2, useState as useState3 } from "react";
|
|
12
|
-
import { createSearchParams, useInRouterContext, useNavigate, useSearchParams } from "react-router-dom";
|
|
13
12
|
|
|
14
13
|
// src/constants/css.ts
|
|
15
14
|
var cssProps = {
|
|
@@ -1547,14 +1546,12 @@ var alertsPlugin = (options) => ({
|
|
|
1547
1546
|
});
|
|
1548
1547
|
|
|
1549
1548
|
// src/plugins/reactRouterDom.ts
|
|
1550
|
-
import
|
|
1551
|
-
var defaultReactRouterDomPluginOptions = {
|
|
1549
|
+
import * as reactRouterDomLib from "react-router-dom";
|
|
1550
|
+
var defaultReactRouterDomPluginOptions = {
|
|
1551
|
+
reactRouterDomLib
|
|
1552
|
+
};
|
|
1552
1553
|
var reactRouterDomPlugin = (options) => ({
|
|
1553
1554
|
name: "react-router-dom",
|
|
1554
|
-
components: {
|
|
1555
|
-
Link: RouterLink,
|
|
1556
|
-
NavLink: RouterNavLink
|
|
1557
|
-
},
|
|
1558
1555
|
initialize: () => {
|
|
1559
1556
|
console.log("react-router-dom plugin initialized");
|
|
1560
1557
|
},
|
|
@@ -2208,7 +2205,7 @@ function Alert2({ alert }) {
|
|
|
2208
2205
|
const theme2 = useTheme();
|
|
2209
2206
|
const alertControls2 = useAlertControls();
|
|
2210
2207
|
const alertsPlugin2 = usePlugin("alerts");
|
|
2211
|
-
const pluginConfig = alertsPlugin2?.getConfig
|
|
2208
|
+
const pluginConfig = alertsPlugin2?.getConfig() ?? {};
|
|
2212
2209
|
const defaultAlertDurationNumber = getAlertDurationFromAuto(
|
|
2213
2210
|
alert.duration ?? pluginConfig.defaultDuration ?? defaultAlertsPluginOptions.defaultDuration,
|
|
2214
2211
|
alert
|
|
@@ -2370,7 +2367,7 @@ function AlertsHolder() {
|
|
|
2370
2367
|
const theme2 = useTheme();
|
|
2371
2368
|
const alertsPlugin2 = usePlugin("alerts");
|
|
2372
2369
|
const { alerts } = useBetterHtmlContextInternal();
|
|
2373
|
-
const pluginConfig = alertsPlugin2?.getConfig
|
|
2370
|
+
const pluginConfig = alertsPlugin2?.getConfig() ?? {};
|
|
2374
2371
|
const top = pluginConfig.position === "top" ? theme2.styles.gap : void 0;
|
|
2375
2372
|
const bottom = pluginConfig.position === "bottom" ? theme2.styles.gap : void 0;
|
|
2376
2373
|
const left = pluginConfig.align === "left" ? theme2.styles.space : pluginConfig.align === "center" ? "50%" : void 0;
|
|
@@ -3063,14 +3060,15 @@ function useUrlQuery() {
|
|
|
3063
3060
|
"`useUrlQuery` hook requires the `react-router-dom` plugin to be added to the `plugins` prop in `<BetterHtmlProvider>`."
|
|
3064
3061
|
);
|
|
3065
3062
|
}
|
|
3066
|
-
const
|
|
3063
|
+
const reactRouterDomPluginConfig = reactRouterDomPlugin2.getConfig();
|
|
3064
|
+
const isInRouterContext = reactRouterDomPluginConfig.reactRouterDomLib.useInRouterContext();
|
|
3067
3065
|
if (!isInRouterContext) {
|
|
3068
3066
|
throw new Error(
|
|
3069
3067
|
"`useUrlQuery` hook must be used inside a React Router context. Make sure your component is wrapped in a `<BrowserRouter>`, or another Router component."
|
|
3070
3068
|
);
|
|
3071
3069
|
}
|
|
3072
|
-
const navigate = useNavigate();
|
|
3073
|
-
const [searchParams] = useSearchParams();
|
|
3070
|
+
const navigate = reactRouterDomPluginConfig.reactRouterDomLib.useNavigate();
|
|
3071
|
+
const [searchParams] = reactRouterDomPluginConfig.reactRouterDomLib.useSearchParams();
|
|
3074
3072
|
const setQuery = useCallback4(
|
|
3075
3073
|
(query, keepHistory = true) => {
|
|
3076
3074
|
const currentSearchParams = {};
|
|
@@ -3079,7 +3077,7 @@ function useUrlQuery() {
|
|
|
3079
3077
|
});
|
|
3080
3078
|
navigate(
|
|
3081
3079
|
{
|
|
3082
|
-
search: createSearchParams({
|
|
3080
|
+
search: reactRouterDomPluginConfig.reactRouterDomLib.createSearchParams({
|
|
3083
3081
|
...currentSearchParams,
|
|
3084
3082
|
...Object.fromEntries(Object.entries(query).map(([key, value]) => [key, value.toString()]))
|
|
3085
3083
|
}).toString()
|
|
@@ -3566,7 +3564,9 @@ var PageHolderComponent = forwardRef7(function PageHolder({ noMaxContentWidth, c
|
|
|
3566
3564
|
});
|
|
3567
3565
|
PageHolderComponent.center = forwardRef7(function Center({
|
|
3568
3566
|
pageBackgroundColor,
|
|
3567
|
+
pageBackgroundImage,
|
|
3569
3568
|
contentMaxWidth,
|
|
3569
|
+
behindComponent,
|
|
3570
3570
|
sideComponent,
|
|
3571
3571
|
sideComponentPosition = "right",
|
|
3572
3572
|
noMaxContentWidth,
|
|
@@ -3581,17 +3581,32 @@ PageHolderComponent.center = forwardRef7(function Center({
|
|
|
3581
3581
|
return /* @__PURE__ */ jsxs7(
|
|
3582
3582
|
Div_default.row,
|
|
3583
3583
|
{
|
|
3584
|
+
position: "relative",
|
|
3584
3585
|
width: "100%",
|
|
3585
3586
|
minHeight: "100svh",
|
|
3586
3587
|
alignItems: "center",
|
|
3587
3588
|
justifyContent: "center",
|
|
3588
3589
|
backgroundColor: pageBackgroundColor,
|
|
3590
|
+
backgroundImage: pageBackgroundImage,
|
|
3589
3591
|
children: [
|
|
3592
|
+
behindComponent && /* @__PURE__ */ jsx12(
|
|
3593
|
+
Div_default,
|
|
3594
|
+
{
|
|
3595
|
+
position: "fixed",
|
|
3596
|
+
width: `${withSideComponent ? 50 : 100}%`,
|
|
3597
|
+
height: "100svh",
|
|
3598
|
+
top: 0,
|
|
3599
|
+
left: sideComponentPosition === "right" ? 0 : "auto",
|
|
3600
|
+
right: sideComponentPosition === "left" ? 0 : "auto",
|
|
3601
|
+
zIndex: 1,
|
|
3602
|
+
children: behindComponent
|
|
3603
|
+
}
|
|
3604
|
+
),
|
|
3590
3605
|
sideComponentPosition === "left" && withSideComponent && /* @__PURE__ */ jsx12(Div_default, { width: "50%" }),
|
|
3591
|
-
/* @__PURE__ */ jsx12(Div_default.column, { width: `${withSideComponent ? 50 : 100}%`, alignItems: "center", children: /* @__PURE__ */ jsx12(
|
|
3606
|
+
/* @__PURE__ */ jsx12(Div_default.column, { position: "relative", width: `${withSideComponent ? 50 : 100}%`, alignItems: "center", zIndex: 2, children: /* @__PURE__ */ jsx12(
|
|
3592
3607
|
Div_default.box,
|
|
3593
3608
|
{
|
|
3594
|
-
width: `calc(100% - ${theme2.styles.space
|
|
3609
|
+
width: `calc(100% - ${theme2.styles.space * 2}px)`,
|
|
3595
3610
|
maxWidth: !noMaxContentWidth ? contentMaxWidth ?? app.contentMaxWidth / 2 : void 0,
|
|
3596
3611
|
marginInline: theme2.styles.space,
|
|
3597
3612
|
marginBlock: theme2.styles.space,
|
|
@@ -5476,8 +5491,8 @@ var encryptString = (text) => {
|
|
|
5476
5491
|
"`encryptString` hook requires the `localStorage` plugin to be added to the `plugins` prop in `<BetterHtmlProvider>`."
|
|
5477
5492
|
);
|
|
5478
5493
|
}
|
|
5479
|
-
const pluginConfig = localStoragePlugin2.getConfig
|
|
5480
|
-
if (!pluginConfig
|
|
5494
|
+
const pluginConfig = localStoragePlugin2.getConfig();
|
|
5495
|
+
if (!pluginConfig.encryption?.enabled) return text;
|
|
5481
5496
|
const encrypted = CryptoJS.AES.encrypt(text, CryptoJS.enc.Hex.parse(pluginConfig.encryption.secretKey), {
|
|
5482
5497
|
iv: CryptoJS.enc.Hex.parse(pluginConfig.encryption.iv),
|
|
5483
5498
|
mode: CryptoJS.mode.CBC,
|
|
@@ -5493,8 +5508,8 @@ var decryptString = (text) => {
|
|
|
5493
5508
|
"`decryptString` hook requires the `localStorage` plugin to be added to the `plugins` prop in `<BetterHtmlProvider>`."
|
|
5494
5509
|
);
|
|
5495
5510
|
}
|
|
5496
|
-
const pluginConfig = localStoragePlugin2.getConfig
|
|
5497
|
-
if (!pluginConfig
|
|
5511
|
+
const pluginConfig = localStoragePlugin2.getConfig();
|
|
5512
|
+
if (!pluginConfig.encryption?.enabled) return text;
|
|
5498
5513
|
const decrypted = CryptoJS.AES.decrypt(text, CryptoJS.enc.Hex.parse(pluginConfig.encryption.secretKey), {
|
|
5499
5514
|
iv: CryptoJS.enc.Hex.parse(pluginConfig.encryption.iv),
|
|
5500
5515
|
mode: CryptoJS.mode.CBC,
|
|
@@ -9094,7 +9109,7 @@ function generateLocalStorage() {
|
|
|
9094
9109
|
"`generateLocalStorage` hook requires the `localStorage` plugin to be added to the `plugins` prop in `<BetterHtmlProvider>`."
|
|
9095
9110
|
);
|
|
9096
9111
|
}
|
|
9097
|
-
const pluginConfig = localStoragePlugin2.getConfig
|
|
9112
|
+
const pluginConfig = localStoragePlugin2.getConfig();
|
|
9098
9113
|
const encryptionEnabled = pluginConfig.encryption?.enabled ?? false;
|
|
9099
9114
|
const readyName = encryptionEnabled ? encryptString(name.toString()) : name;
|
|
9100
9115
|
const readyValue = encryptionEnabled ? encryptString(JSON.stringify(value)) : JSON.stringify(value);
|
|
@@ -9112,7 +9127,7 @@ function generateLocalStorage() {
|
|
|
9112
9127
|
"`generateLocalStorage` hook requires the `localStorage` plugin to be added to the `plugins` prop in `<BetterHtmlProvider>`."
|
|
9113
9128
|
);
|
|
9114
9129
|
}
|
|
9115
|
-
const pluginConfig = localStoragePlugin2.getConfig
|
|
9130
|
+
const pluginConfig = localStoragePlugin2.getConfig();
|
|
9116
9131
|
const encryptionEnabled = pluginConfig.encryption?.enabled ?? false;
|
|
9117
9132
|
const readyName = encryptionEnabled ? encryptString(name.toString()) : name;
|
|
9118
9133
|
const item = localStorage.getItem(readyName.toString());
|
|
@@ -9134,7 +9149,7 @@ function generateLocalStorage() {
|
|
|
9134
9149
|
"`generateLocalStorage` hook requires the `localStorage` plugin to be added to the `plugins` prop in `<BetterHtmlProvider>`."
|
|
9135
9150
|
);
|
|
9136
9151
|
}
|
|
9137
|
-
const pluginConfig = localStoragePlugin2.getConfig
|
|
9152
|
+
const pluginConfig = localStoragePlugin2.getConfig();
|
|
9138
9153
|
const encryptionEnabled = pluginConfig.encryption?.enabled ?? false;
|
|
9139
9154
|
const readyName = encryptionEnabled ? encryptString(name.toString()) : name;
|
|
9140
9155
|
localStorage.removeItem(readyName.toString());
|