ywana-core8 0.1.48 → 0.1.50
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.cjs +71 -30
- package/dist/index.cjs.map +1 -1
- package/dist/index.modern.js +73 -32
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +71 -30
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/site/index.js +1 -1
- package/src/site/site.js +20 -20
- package/src/site/site2.js +0 -338
package/dist/index.modern.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import 'material-design-icons-iconfont/dist/material-design-icons.css';
|
2
|
-
import React, { useContext, useState, useEffect, useCallback, Fragment,
|
2
|
+
import React, { useContext, useState, useEffect, useCallback, Fragment, useMemo, useRef } from 'react';
|
3
3
|
import ResumableJS from 'resumablejs';
|
4
|
-
import {
|
4
|
+
import { Store, ReactNotifications } from 'react-notifications-component';
|
5
5
|
import 'react-notifications-component/dist/theme.css';
|
6
6
|
import RSwitch from 'react-switch';
|
7
7
|
import moment$1 from 'moment';
|
@@ -2042,31 +2042,59 @@ var SiteProvider = function SiteProvider(_ref) {
|
|
2042
2042
|
consoleLines = _useState7[0],
|
2043
2043
|
setConsoleLines = _useState7[1];
|
2044
2044
|
var _useState8 = useState(),
|
2045
|
-
|
2046
|
-
|
2045
|
+
dialog = _useState8[0],
|
2046
|
+
setDialog = _useState8[1];
|
2047
2047
|
var _useState9 = useState(),
|
2048
|
-
|
2049
|
-
|
2048
|
+
promptDialog = _useState9[0],
|
2049
|
+
setPromptDialog = _useState9[1];
|
2050
2050
|
var _useState10 = useState(),
|
2051
|
-
|
2052
|
-
|
2051
|
+
preview = _useState10[0],
|
2052
|
+
setPreview = _useState10[1];
|
2053
2053
|
var _useState11 = useState(),
|
2054
|
-
|
2055
|
-
|
2056
|
-
var _useState12 = useState(),
|
2057
|
-
|
2058
|
-
|
2054
|
+
breadcrumb = _useState11[0],
|
2055
|
+
setBreadcrumb = _useState11[1];
|
2056
|
+
var _useState12 = useState([]),
|
2057
|
+
history = _useState12[0],
|
2058
|
+
setHistory = _useState12[1];
|
2059
|
+
|
2060
|
+
// 📌 Extraer la página actual desde la URL (por defecto "home")
|
2061
|
+
var getCurrentPageFromURL = function getCurrentPageFromURL() {
|
2062
|
+
var path = window.location.pathname.replace("/", "");
|
2063
|
+
return path || "home";
|
2064
|
+
};
|
2065
|
+
var _useState13 = useState(getCurrentPageFromURL()),
|
2066
|
+
page = _useState13[0],
|
2067
|
+
setPage = _useState13[1];
|
2068
|
+
useEffect(function () {
|
2069
|
+
// 📌 Detectar cambios en la URL cuando el usuario presiona "Atrás" o "Adelante"
|
2070
|
+
var handlePopState = function handlePopState(event) {
|
2071
|
+
var _event$state;
|
2072
|
+
var previousPage = ((_event$state = event.state) == null ? void 0 : _event$state.page) || "home";
|
2073
|
+
setPage(previousPage);
|
2074
|
+
};
|
2075
|
+
window.addEventListener("popstate", handlePopState);
|
2076
|
+
return function () {
|
2077
|
+
return window.removeEventListener("popstate", handlePopState);
|
2078
|
+
};
|
2079
|
+
}, []);
|
2059
2080
|
var value = {
|
2060
2081
|
lang: lang,
|
2061
2082
|
setLang: setLang,
|
2062
2083
|
dictionary: dictionary,
|
2063
2084
|
setDictionary: setDictionary,
|
2064
|
-
translate: function
|
2065
|
-
|
2066
|
-
|
2067
|
-
|
2068
|
-
|
2085
|
+
translate: useCallback(function (key) {
|
2086
|
+
var _dictionary$key;
|
2087
|
+
return (dictionary == null ? void 0 : (_dictionary$key = dictionary[key]) == null ? void 0 : _dictionary$key[lang]) || key;
|
2088
|
+
}, [lang, dictionary]),
|
2089
|
+
/*
|
2090
|
+
translate: (key) => {
|
2091
|
+
if (!key) return key
|
2092
|
+
if (dictionary === undefined) return key
|
2093
|
+
const term = dictionary[key]
|
2094
|
+
return term ? term[lang] : key
|
2069
2095
|
},
|
2096
|
+
*/
|
2097
|
+
|
2070
2098
|
sideNav: sideNav,
|
2071
2099
|
setSideNav: setSideNav,
|
2072
2100
|
showNav: showNav,
|
@@ -2094,7 +2122,25 @@ var SiteProvider = function SiteProvider(_ref) {
|
|
2094
2122
|
setBreadcrumb: setBreadcrumb,
|
2095
2123
|
page: page,
|
2096
2124
|
"goto": function goto(id) {
|
2125
|
+
if (page) {
|
2126
|
+
setHistory(function (prev) {
|
2127
|
+
return [].concat(prev, [page]);
|
2128
|
+
}); // 🔹 Guarda la página actual en el historial antes de cambiar
|
2129
|
+
}
|
2097
2130
|
setPage(id);
|
2131
|
+
window.history.pushState({
|
2132
|
+
page: id
|
2133
|
+
}, "", "/" + id); // 🔹 Actualiza la URL
|
2134
|
+
},
|
2135
|
+
goBack: function goBack() {
|
2136
|
+
if (history.length > 0) {
|
2137
|
+
var lastPage = history[history.length - 1];
|
2138
|
+
setHistory(function (prev) {
|
2139
|
+
return prev.slice(0, -1);
|
2140
|
+
}); // 🔹 Elimina la última entrada del historial
|
2141
|
+
setPage(lastPage); // 🔹 Vuelve a la página anterior
|
2142
|
+
window.history.back(); // 🔹 Regresa en la navegación del navegador
|
2143
|
+
}
|
2098
2144
|
},
|
2099
2145
|
dialog: dialog,
|
2100
2146
|
openDialog: function openDialog(dialog) {
|
@@ -2252,20 +2298,15 @@ var SiteMenu = function SiteMenu(_ref6) {
|
|
2252
2298
|
context.setShowNav(false);
|
2253
2299
|
context["goto"](id);
|
2254
2300
|
};
|
2255
|
-
var sections =
|
2256
|
-
|
2257
|
-
|
2258
|
-
|
2259
|
-
|
2260
|
-
|
2261
|
-
|
2262
|
-
|
2263
|
-
|
2264
|
-
icon: icon,
|
2265
|
-
title: title
|
2266
|
-
});
|
2267
|
-
return sections;
|
2268
|
-
}, {}) : {};
|
2301
|
+
var sections = useMemo(function () {
|
2302
|
+
return children.reduce(function (acc, child) {
|
2303
|
+
var section = child.props.section || "";
|
2304
|
+
if (!acc[section]) acc[section] = [];
|
2305
|
+
var title = child.props.title;
|
2306
|
+
if (title) acc[section].push(child.props);
|
2307
|
+
return acc;
|
2308
|
+
}, {});
|
2309
|
+
}, [children]);
|
2269
2310
|
var style = sideNav === 'max' ? 'max' : 'min';
|
2270
2311
|
var toggleIcon = sideNav === 'max' ? 'chevron_left' : 'chevron_right';
|
2271
2312
|
var menutTitle = sideNav === 'max' ? title : '';
|