highsoft-ui 1.0.25 → 1.0.28
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/Header/index.js +76 -77
- package/dist/utils.d.ts +1 -2
- package/dist/utils.js +94 -91
- package/package.json +1 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { jsx as e, jsxs as s, Fragment as
|
|
2
|
-
import { useState as
|
|
1
|
+
import { jsx as e, jsxs as s, Fragment as U } from "react/jsx-runtime";
|
|
2
|
+
import { useState as N, useEffect as V } from "react";
|
|
3
3
|
import { J as q } from "../../index-CMegByeX.js";
|
|
4
4
|
import { _ as d } from "../../extends-hS2Bh-Yp.js";
|
|
5
5
|
import { N as J, X as A } from "../../index-ChurKizy.js";
|
|
6
|
-
import { c as
|
|
6
|
+
import { c as _ } from "../../clsx-OuTLNxxd.js";
|
|
7
7
|
import { Button as h } from "../Button/index.js";
|
|
8
|
-
import { Container as
|
|
9
|
-
import { ThemedLogo as
|
|
8
|
+
import { Container as j } from "../Container/index.js";
|
|
9
|
+
import { ThemedLogo as z } from "../Logo/index.js";
|
|
10
10
|
import { PrefPanel as S } from "../PrefPanel/index.js";
|
|
11
|
-
import { useMediaQuery as
|
|
11
|
+
import { useMediaQuery as M, usePathname as G } from "../../utils.js";
|
|
12
12
|
var F = function(t) {
|
|
13
13
|
return /* @__PURE__ */ e("svg", d({
|
|
14
14
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -121,7 +121,7 @@ var F = function(t) {
|
|
|
121
121
|
d: "M12 16v5m6 0-3.9514-3.2928c-.7288-.6074-1.0932-.911-1.4999-1.0271a2 2 0 0 0-1.0974 0c-.4067.1161-.7711.4197-1.4999 1.0271L6 21m2-10v1m4-3v3m4-5v5m6-9H2m1 0h18v8.2c0 1.6802 0 2.5202-.327 3.162a3 3 0 0 1-1.311 1.311C18.7202 16 17.8802 16 16.2 16H7.8c-1.6802 0-2.5202 0-3.162-.327a3 3 0 0 1-1.311-1.311C3 13.7202 3 12.8802 3 11.2z"
|
|
122
122
|
})
|
|
123
123
|
}));
|
|
124
|
-
},
|
|
124
|
+
}, L = function(t) {
|
|
125
125
|
return /* @__PURE__ */ e("svg", d({
|
|
126
126
|
xmlns: "http://www.w3.org/2000/svg",
|
|
127
127
|
width: 24,
|
|
@@ -137,7 +137,7 @@ var F = function(t) {
|
|
|
137
137
|
d: "m21 21-4.35-4.35M19 11c0 4.4183-3.5817 8-8 8s-8-3.5817-8-8 3.5817-8 8-8 8 3.5817 8 8"
|
|
138
138
|
})
|
|
139
139
|
}));
|
|
140
|
-
},
|
|
140
|
+
}, T = function(t) {
|
|
141
141
|
return /* @__PURE__ */ e("svg", d({
|
|
142
142
|
xmlns: "http://www.w3.org/2000/svg",
|
|
143
143
|
width: 24,
|
|
@@ -153,7 +153,7 @@ var F = function(t) {
|
|
|
153
153
|
d: "M4.5 22v-5m0-10V2M2 4.5h5m-5 15h5M13 3l-1.7342 4.5089c-.282.7332-.423 1.0998-.6423 1.4082a3 3 0 0 1-.7064.7064c-.3084.2193-.675.3603-1.4082.6423L4 12l4.5089 1.7342c.7332.282 1.0998.423 1.4082.6423.2733.1943.5121.4331.7064.7064.2193.3084.3603.675.6423 1.4082L13 21l1.7342-4.5089c.282-.7332.423-1.0998.6423-1.4082a3 3 0 0 1 .7064-.7064c.3084-.2193.675-.3603 1.4082-.6423L22 12l-4.5089-1.7342c-.7332-.282-1.0998-.423-1.4082-.6423a3 3 0 0 1-.7064-.7064c-.2193-.3084-.3603-.675-.6423-1.4082z"
|
|
154
154
|
})
|
|
155
155
|
}));
|
|
156
|
-
},
|
|
156
|
+
}, B = function(t) {
|
|
157
157
|
return /* @__PURE__ */ e("svg", d({
|
|
158
158
|
xmlns: "http://www.w3.org/2000/svg",
|
|
159
159
|
width: 24,
|
|
@@ -169,7 +169,7 @@ var F = function(t) {
|
|
|
169
169
|
d: "m7 15 3-3-3-3m6 6h4m-9.2 6h8.4c1.6802 0 2.5202 0 3.162-.327a3 3 0 0 0 1.311-1.311C21 18.7202 21 17.8802 21 16.2V7.8c0-1.6802 0-2.5202-.327-3.162a3 3 0 0 0-1.311-1.311C18.7202 3 17.8802 3 16.2 3H7.8c-1.6802 0-2.5202 0-3.162.327a3 3 0 0 0-1.311 1.311C3 5.2798 3 6.1198 3 7.8v8.4c0 1.6802 0 2.5202.327 3.162a3 3 0 0 0 1.311 1.311C5.2798 21 6.1198 21 7.8 21"
|
|
170
170
|
})
|
|
171
171
|
}));
|
|
172
|
-
},
|
|
172
|
+
}, W = function(t) {
|
|
173
173
|
return /* @__PURE__ */ e("svg", d({
|
|
174
174
|
xmlns: "http://www.w3.org/2000/svg",
|
|
175
175
|
width: 24,
|
|
@@ -207,7 +207,7 @@ const I = "_header_1vxsz_270", K = "_outer_1vxsz_281", Y = "_main_1vxsz_290", Z
|
|
|
207
207
|
slideUp: d1,
|
|
208
208
|
sub: u1,
|
|
209
209
|
gpt: m1
|
|
210
|
-
},
|
|
210
|
+
}, H = [
|
|
211
211
|
{
|
|
212
212
|
title: "Products",
|
|
213
213
|
url: "https://highcharts.com/products/",
|
|
@@ -245,31 +245,30 @@ function l(n, t) {
|
|
|
245
245
|
function w1({
|
|
246
246
|
items: n,
|
|
247
247
|
link: t = "a",
|
|
248
|
-
host:
|
|
248
|
+
host: g = "https://www.highcharts.com"
|
|
249
249
|
}) {
|
|
250
|
-
const
|
|
251
|
-
return /* @__PURE__ */ e("div", { className:
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
g = (f.startsWith("/") || k.origin === _) && k.pathname === i.pathname;
|
|
250
|
+
const o = G();
|
|
251
|
+
return console.log("header", o), /* @__PURE__ */ e("div", { className: _(r.sub, r.outer), children: /* @__PURE__ */ e(j, { className: r.subContainer, as: "ul", children: n.map(({ title: a, url: v, icon: k, tag: x, tagVariant: m = "success" }, C) => {
|
|
252
|
+
let w = !1;
|
|
253
|
+
if (typeof window < "u") {
|
|
254
|
+
const p = window.location.origin, f = new URL(v, p);
|
|
255
|
+
console.log(f, o, p), w = (v.startsWith("/") || f.origin === p) && f.pathname === o;
|
|
257
256
|
}
|
|
258
257
|
return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ s(
|
|
259
258
|
t,
|
|
260
259
|
{
|
|
261
|
-
href:
|
|
262
|
-
className:
|
|
263
|
-
[r.selected]:
|
|
260
|
+
href: l(v, g),
|
|
261
|
+
className: _({
|
|
262
|
+
[r.selected]: w
|
|
264
263
|
}),
|
|
265
264
|
children: [
|
|
266
|
-
|
|
265
|
+
k,
|
|
267
266
|
/* @__PURE__ */ s("span", { children: [
|
|
268
267
|
a,
|
|
269
268
|
x && /* @__PURE__ */ e(
|
|
270
269
|
"span",
|
|
271
270
|
{
|
|
272
|
-
className:
|
|
271
|
+
className: _(
|
|
273
272
|
r.subTag,
|
|
274
273
|
r[`subTag-${m}`]
|
|
275
274
|
),
|
|
@@ -279,40 +278,40 @@ function w1({
|
|
|
279
278
|
] })
|
|
280
279
|
]
|
|
281
280
|
}
|
|
282
|
-
) },
|
|
281
|
+
) }, C);
|
|
283
282
|
}) }) });
|
|
284
283
|
}
|
|
285
284
|
function z1({
|
|
286
285
|
subItems: n,
|
|
287
286
|
children: t,
|
|
288
|
-
notifications:
|
|
287
|
+
notifications: g = [],
|
|
289
288
|
// TODO: Fetch these from the internets
|
|
290
|
-
link:
|
|
289
|
+
link: o = "a",
|
|
291
290
|
host: a = "https://www.highcharts.com"
|
|
292
291
|
}) {
|
|
293
|
-
const
|
|
292
|
+
const v = M("(max-width: 374px)"), k = M("(max-width: 849px)"), x = M("(min-width: 850px) and (max-width: 999px)"), [m, C] = N(!1), [w, p] = N([]);
|
|
294
293
|
V(() => {
|
|
295
|
-
if (
|
|
294
|
+
if (g.length) {
|
|
296
295
|
const c = localStorage.getItem("notifications");
|
|
297
296
|
if (c) {
|
|
298
297
|
const u = JSON.parse(c);
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
(
|
|
298
|
+
p(
|
|
299
|
+
g.filter(
|
|
300
|
+
(i) => !i.id || !u.closed.includes(i.id)
|
|
302
301
|
)
|
|
303
302
|
);
|
|
304
303
|
} else
|
|
305
|
-
g
|
|
304
|
+
p(g);
|
|
306
305
|
}
|
|
307
|
-
}, [
|
|
308
|
-
const
|
|
309
|
-
|
|
310
|
-
},
|
|
311
|
-
|
|
306
|
+
}, [g]);
|
|
307
|
+
const f = () => {
|
|
308
|
+
C(!m);
|
|
309
|
+
}, y = (c) => {
|
|
310
|
+
p(w.filter((i) => !i.id || i.id !== c));
|
|
312
311
|
const u = localStorage.getItem("notifications");
|
|
313
312
|
if (u) {
|
|
314
|
-
const
|
|
315
|
-
|
|
313
|
+
const i = JSON.parse(u);
|
|
314
|
+
i.closed.includes(c) || (i.closed.push(c), localStorage.setItem("notifications", JSON.stringify(i)));
|
|
316
315
|
} else
|
|
317
316
|
localStorage.setItem(
|
|
318
317
|
"notifications",
|
|
@@ -323,76 +322,76 @@ function z1({
|
|
|
323
322
|
};
|
|
324
323
|
return /* @__PURE__ */ e(q, { children: /* @__PURE__ */ s("header", { className: r.header, children: [
|
|
325
324
|
w == null ? void 0 : w.map(
|
|
326
|
-
({ id: c, title: u, description:
|
|
325
|
+
({ id: c, title: u, description: i, variant: b, closable: O }, P) => /* @__PURE__ */ e(
|
|
327
326
|
J,
|
|
328
327
|
{
|
|
329
|
-
description:
|
|
330
|
-
variant:
|
|
328
|
+
description: i,
|
|
329
|
+
variant: b,
|
|
331
330
|
closable: O,
|
|
332
|
-
onClose: () =>
|
|
331
|
+
onClose: () => y(c),
|
|
333
332
|
children: u
|
|
334
333
|
},
|
|
335
|
-
|
|
334
|
+
P
|
|
336
335
|
)
|
|
337
336
|
),
|
|
338
|
-
/* @__PURE__ */ e("div", { className:
|
|
337
|
+
/* @__PURE__ */ e("div", { className: _(r.main, r.outer), children: /* @__PURE__ */ s(j, { as: "nav", className: r.container, children: [
|
|
339
338
|
/* @__PURE__ */ e(
|
|
340
|
-
|
|
339
|
+
o,
|
|
341
340
|
{
|
|
342
341
|
className: r.logo,
|
|
343
342
|
href: l("https://www.highcharts.com/", a),
|
|
344
|
-
children: /* @__PURE__ */ e(
|
|
343
|
+
children: /* @__PURE__ */ e(z, { showText: !x && !v })
|
|
345
344
|
}
|
|
346
345
|
),
|
|
347
|
-
/* @__PURE__ */ e("ul", { className: r.links, children:
|
|
346
|
+
/* @__PURE__ */ e("ul", { className: r.links, children: H.map(({ title: c, url: u }, i) => /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
|
|
348
347
|
h,
|
|
349
348
|
{
|
|
350
349
|
variant: "plain",
|
|
351
350
|
size: 300,
|
|
352
|
-
as:
|
|
351
|
+
as: o,
|
|
353
352
|
href: l(u, a),
|
|
354
353
|
children: c
|
|
355
354
|
}
|
|
356
|
-
) },
|
|
355
|
+
) }, i)) }),
|
|
357
356
|
/* @__PURE__ */ s("div", { className: r.buttons, children: [
|
|
358
357
|
/* @__PURE__ */ s(
|
|
359
358
|
h,
|
|
360
359
|
{
|
|
361
360
|
variant: "transparent",
|
|
362
|
-
as:
|
|
361
|
+
as: o,
|
|
363
362
|
href: l(
|
|
364
363
|
"https://www.highcharts.com/chat/gpt/",
|
|
365
364
|
a
|
|
366
365
|
),
|
|
367
366
|
children: [
|
|
368
367
|
/* @__PURE__ */ e("span", { className: r.gpt, children: "Highcharts GPT" }),
|
|
369
|
-
/* @__PURE__ */ e(
|
|
368
|
+
/* @__PURE__ */ e(T, {})
|
|
370
369
|
]
|
|
371
370
|
}
|
|
372
371
|
),
|
|
373
|
-
/* @__PURE__ */ e(h, { variant: "transparent", "aria-label": "Search", children: /* @__PURE__ */ e(
|
|
372
|
+
/* @__PURE__ */ e(h, { variant: "transparent", "aria-label": "Search", children: /* @__PURE__ */ e(L, {}) }),
|
|
374
373
|
/* @__PURE__ */ e(S, {}),
|
|
375
374
|
/* @__PURE__ */ e(
|
|
376
375
|
h,
|
|
377
376
|
{
|
|
378
377
|
variant: "brand",
|
|
379
|
-
as:
|
|
378
|
+
as: o,
|
|
380
379
|
href: l("https://shop.highcharts.com/account", a),
|
|
381
380
|
"aria-label": "Login",
|
|
382
|
-
children: /* @__PURE__ */ e(
|
|
381
|
+
children: /* @__PURE__ */ e(W, {})
|
|
383
382
|
}
|
|
384
383
|
),
|
|
385
384
|
/* @__PURE__ */ s(
|
|
386
385
|
h,
|
|
387
386
|
{
|
|
388
387
|
variant: "success",
|
|
389
|
-
as:
|
|
388
|
+
as: o,
|
|
390
389
|
href: l(
|
|
391
390
|
"https://www.highcharts.com/download/",
|
|
392
391
|
a
|
|
393
392
|
),
|
|
394
393
|
children: [
|
|
395
|
-
/* @__PURE__ */ e(
|
|
394
|
+
/* @__PURE__ */ e(B, {}),
|
|
396
395
|
"Get started"
|
|
397
396
|
]
|
|
398
397
|
}
|
|
@@ -402,7 +401,7 @@ function z1({
|
|
|
402
401
|
{
|
|
403
402
|
variant: m ? "white" : "transparent",
|
|
404
403
|
className: r.menu,
|
|
405
|
-
onClick:
|
|
404
|
+
onClick: f,
|
|
406
405
|
children: [
|
|
407
406
|
m ? "Close" : "Menu",
|
|
408
407
|
m ? /* @__PURE__ */ e(A, {}) : /* @__PURE__ */ e($, {})
|
|
@@ -411,30 +410,30 @@ function z1({
|
|
|
411
410
|
)
|
|
412
411
|
] })
|
|
413
412
|
] }) }),
|
|
414
|
-
!!(n != null && n.length) && /* @__PURE__ */ e(w1, { items: n, link:
|
|
413
|
+
!!(n != null && n.length) && /* @__PURE__ */ e(w1, { items: n, link: o, host: a }),
|
|
415
414
|
t,
|
|
416
|
-
|
|
415
|
+
k && /* @__PURE__ */ s(U, { children: [
|
|
417
416
|
/* @__PURE__ */ e(
|
|
418
417
|
"div",
|
|
419
418
|
{
|
|
420
|
-
className:
|
|
421
|
-
onClick:
|
|
419
|
+
className: _(r.mobileOverlay, { [r.open]: m }),
|
|
420
|
+
onClick: f
|
|
422
421
|
}
|
|
423
422
|
),
|
|
424
423
|
/* @__PURE__ */ s(
|
|
425
424
|
"nav",
|
|
426
425
|
{
|
|
427
|
-
className:
|
|
426
|
+
className: _(r.mobile, {
|
|
428
427
|
[r.open]: m
|
|
429
428
|
}),
|
|
430
429
|
children: [
|
|
431
430
|
/* @__PURE__ */ s("div", { className: r.container, children: [
|
|
432
431
|
/* @__PURE__ */ e(
|
|
433
|
-
|
|
432
|
+
o,
|
|
434
433
|
{
|
|
435
434
|
className: r.logo,
|
|
436
435
|
href: l("https://www.highcharts.com/", a),
|
|
437
|
-
children: /* @__PURE__ */ e(
|
|
436
|
+
children: /* @__PURE__ */ e(z, { showText: !v })
|
|
438
437
|
}
|
|
439
438
|
),
|
|
440
439
|
/* @__PURE__ */ s("div", { className: r.buttons, children: [
|
|
@@ -442,18 +441,18 @@ function z1({
|
|
|
442
441
|
h,
|
|
443
442
|
{
|
|
444
443
|
variant: "transparent",
|
|
445
|
-
as:
|
|
444
|
+
as: o,
|
|
446
445
|
href: l(
|
|
447
446
|
"https://www.highcharts.com/chat/gpt/",
|
|
448
447
|
a
|
|
449
448
|
),
|
|
450
449
|
children: [
|
|
451
450
|
/* @__PURE__ */ e("span", { className: r.gpt, children: "Highcharts GPT" }),
|
|
452
|
-
/* @__PURE__ */ e(
|
|
451
|
+
/* @__PURE__ */ e(T, {})
|
|
453
452
|
]
|
|
454
453
|
}
|
|
455
454
|
),
|
|
456
|
-
/* @__PURE__ */ e(h, { variant: "transparent", "aria-label": "Search", children: /* @__PURE__ */ e(
|
|
455
|
+
/* @__PURE__ */ e(h, { variant: "transparent", "aria-label": "Search", children: /* @__PURE__ */ e(L, {}) }),
|
|
457
456
|
/* @__PURE__ */ e(S, {})
|
|
458
457
|
] })
|
|
459
458
|
] }),
|
|
@@ -463,13 +462,13 @@ function z1({
|
|
|
463
462
|
{
|
|
464
463
|
variant: "brand",
|
|
465
464
|
fullWidth: !0,
|
|
466
|
-
as:
|
|
465
|
+
as: o,
|
|
467
466
|
href: l(
|
|
468
467
|
"https://shop.highcharts.com/account",
|
|
469
468
|
a
|
|
470
469
|
),
|
|
471
470
|
children: [
|
|
472
|
-
/* @__PURE__ */ e(
|
|
471
|
+
/* @__PURE__ */ e(W, {}),
|
|
473
472
|
"Login"
|
|
474
473
|
]
|
|
475
474
|
}
|
|
@@ -479,32 +478,32 @@ function z1({
|
|
|
479
478
|
{
|
|
480
479
|
variant: "success",
|
|
481
480
|
fullWidth: !0,
|
|
482
|
-
as:
|
|
481
|
+
as: o,
|
|
483
482
|
href: l(
|
|
484
483
|
"https://www.highcharts.com/download/",
|
|
485
484
|
a
|
|
486
485
|
),
|
|
487
486
|
children: [
|
|
488
|
-
/* @__PURE__ */ e(
|
|
487
|
+
/* @__PURE__ */ e(B, {}),
|
|
489
488
|
"Get started"
|
|
490
489
|
]
|
|
491
490
|
}
|
|
492
491
|
)
|
|
493
492
|
] }),
|
|
494
|
-
/* @__PURE__ */ e("ul", { className: r.links, children:
|
|
493
|
+
/* @__PURE__ */ e("ul", { className: r.links, children: H.map(({ title: c, url: u, icon: i }, b) => /* @__PURE__ */ e("li", { children: /* @__PURE__ */ s(
|
|
495
494
|
h,
|
|
496
495
|
{
|
|
497
496
|
variant: "plain",
|
|
498
497
|
size: 500,
|
|
499
498
|
fullWidth: !0,
|
|
500
|
-
as:
|
|
499
|
+
as: o,
|
|
501
500
|
href: l(u, a),
|
|
502
501
|
children: [
|
|
503
|
-
|
|
502
|
+
i,
|
|
504
503
|
c
|
|
505
504
|
]
|
|
506
505
|
}
|
|
507
|
-
) },
|
|
506
|
+
) }, b)) })
|
|
508
507
|
]
|
|
509
508
|
}
|
|
510
509
|
)
|
package/dist/utils.d.ts
CHANGED
package/dist/utils.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { _ as $ } from "./extends-hS2Bh-Yp.js";
|
|
2
|
-
import { useState as
|
|
2
|
+
import { useState as E, useEffect as k } from "react";
|
|
3
3
|
var p;
|
|
4
|
-
(function(
|
|
5
|
-
|
|
4
|
+
(function(e) {
|
|
5
|
+
e.Pop = "POP", e.Push = "PUSH", e.Replace = "REPLACE";
|
|
6
6
|
})(p || (p = {}));
|
|
7
|
-
var A = process.env.NODE_ENV !== "production" ? function(
|
|
8
|
-
return Object.freeze(
|
|
9
|
-
} : function(
|
|
10
|
-
return
|
|
7
|
+
var A = process.env.NODE_ENV !== "production" ? function(e) {
|
|
8
|
+
return Object.freeze(e);
|
|
9
|
+
} : function(e) {
|
|
10
|
+
return e;
|
|
11
11
|
};
|
|
12
|
-
function U(
|
|
12
|
+
function U(e, o) {
|
|
13
13
|
{
|
|
14
14
|
typeof console < "u" && console.warn(o);
|
|
15
15
|
try {
|
|
@@ -19,13 +19,13 @@ function U(n, o) {
|
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
var H = "beforeunload", j = "popstate";
|
|
22
|
-
function z(
|
|
23
|
-
|
|
24
|
-
var o =
|
|
22
|
+
function z(e) {
|
|
23
|
+
e === void 0 && (e = {});
|
|
24
|
+
var o = e, a = o.window, t = a === void 0 ? document.defaultView : a, i = t.history;
|
|
25
25
|
function f() {
|
|
26
|
-
var
|
|
26
|
+
var n = t.location, r = n.pathname, c = n.search, l = n.hash, u = i.state || {};
|
|
27
27
|
return [u.idx, A({
|
|
28
|
-
pathname:
|
|
28
|
+
pathname: r,
|
|
29
29
|
search: c,
|
|
30
30
|
hash: l,
|
|
31
31
|
state: u.usr || null,
|
|
@@ -37,12 +37,12 @@ function z(n) {
|
|
|
37
37
|
if (s)
|
|
38
38
|
d.call(s), s = null;
|
|
39
39
|
else {
|
|
40
|
-
var
|
|
40
|
+
var n = p.Pop, r = f(), c = r[0], l = r[1];
|
|
41
41
|
if (d.length)
|
|
42
42
|
if (c != null) {
|
|
43
43
|
var u = h - c;
|
|
44
44
|
u && (s = {
|
|
45
|
-
action:
|
|
45
|
+
action: n,
|
|
46
46
|
location: l,
|
|
47
47
|
retry: function() {
|
|
48
48
|
y(u * -1);
|
|
@@ -57,83 +57,83 @@ function z(n) {
|
|
|
57
57
|
"You are trying to block a POP navigation to a location that was not created by the history library. The block will fail silently in production, but in general you should do all navigation with the history library (instead of using window.history.pushState directly) to avoid this situation."
|
|
58
58
|
);
|
|
59
59
|
else
|
|
60
|
-
b(
|
|
60
|
+
b(n);
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
|
-
|
|
64
|
-
var
|
|
63
|
+
t.addEventListener(j, D);
|
|
64
|
+
var w = p.Pop, x = f(), h = x[0], m = x[1], L = B(), d = B();
|
|
65
65
|
h == null && (h = 0, i.replaceState($({}, i.state, {
|
|
66
66
|
idx: h
|
|
67
67
|
}), ""));
|
|
68
|
-
function O(
|
|
69
|
-
return typeof
|
|
68
|
+
function O(n) {
|
|
69
|
+
return typeof n == "string" ? n : K(n);
|
|
70
70
|
}
|
|
71
|
-
function S(
|
|
72
|
-
return
|
|
73
|
-
pathname:
|
|
71
|
+
function S(n, r) {
|
|
72
|
+
return r === void 0 && (r = null), A($({
|
|
73
|
+
pathname: m.pathname,
|
|
74
74
|
hash: "",
|
|
75
75
|
search: ""
|
|
76
|
-
}, typeof
|
|
77
|
-
state:
|
|
76
|
+
}, typeof n == "string" ? Q(n) : n, {
|
|
77
|
+
state: r,
|
|
78
78
|
key: C()
|
|
79
79
|
}));
|
|
80
80
|
}
|
|
81
|
-
function _(
|
|
81
|
+
function _(n, r) {
|
|
82
82
|
return [{
|
|
83
|
-
usr:
|
|
84
|
-
key:
|
|
85
|
-
idx:
|
|
86
|
-
}, O(
|
|
83
|
+
usr: n.state,
|
|
84
|
+
key: n.key,
|
|
85
|
+
idx: r
|
|
86
|
+
}, O(n)];
|
|
87
87
|
}
|
|
88
|
-
function M(
|
|
88
|
+
function M(n, r, c) {
|
|
89
89
|
return !d.length || (d.call({
|
|
90
|
-
action:
|
|
91
|
-
location:
|
|
90
|
+
action: n,
|
|
91
|
+
location: r,
|
|
92
92
|
retry: c
|
|
93
93
|
}), !1);
|
|
94
94
|
}
|
|
95
|
-
function b(
|
|
96
|
-
|
|
97
|
-
var
|
|
98
|
-
h =
|
|
99
|
-
action:
|
|
100
|
-
location:
|
|
95
|
+
function b(n) {
|
|
96
|
+
w = n;
|
|
97
|
+
var r = f();
|
|
98
|
+
h = r[0], m = r[1], L.call({
|
|
99
|
+
action: w,
|
|
100
|
+
location: m
|
|
101
101
|
});
|
|
102
102
|
}
|
|
103
|
-
function T(
|
|
104
|
-
var c = p.Push, l = S(
|
|
103
|
+
function T(n, r) {
|
|
104
|
+
var c = p.Push, l = S(n, r);
|
|
105
105
|
function u() {
|
|
106
|
-
T(
|
|
106
|
+
T(n, r);
|
|
107
107
|
}
|
|
108
108
|
if (M(c, l, u)) {
|
|
109
|
-
var v = _(l, h + 1),
|
|
109
|
+
var v = _(l, h + 1), P = v[0], g = v[1];
|
|
110
110
|
try {
|
|
111
|
-
i.pushState(
|
|
111
|
+
i.pushState(P, "", g);
|
|
112
112
|
} catch {
|
|
113
|
-
|
|
113
|
+
t.location.assign(g);
|
|
114
114
|
}
|
|
115
115
|
b(c);
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
|
-
function N(
|
|
119
|
-
var c = p.Replace, l = S(
|
|
118
|
+
function N(n, r) {
|
|
119
|
+
var c = p.Replace, l = S(n, r);
|
|
120
120
|
function u() {
|
|
121
|
-
N(
|
|
121
|
+
N(n, r);
|
|
122
122
|
}
|
|
123
123
|
if (M(c, l, u)) {
|
|
124
|
-
var v = _(l, h),
|
|
125
|
-
i.replaceState(
|
|
124
|
+
var v = _(l, h), P = v[0], g = v[1];
|
|
125
|
+
i.replaceState(P, "", g), b(c);
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
|
-
function y(
|
|
129
|
-
i.go(
|
|
128
|
+
function y(n) {
|
|
129
|
+
i.go(n);
|
|
130
130
|
}
|
|
131
131
|
var R = {
|
|
132
132
|
get action() {
|
|
133
|
-
return
|
|
133
|
+
return w;
|
|
134
134
|
},
|
|
135
135
|
get location() {
|
|
136
|
-
return
|
|
136
|
+
return m;
|
|
137
137
|
},
|
|
138
138
|
createHref: O,
|
|
139
139
|
push: T,
|
|
@@ -145,37 +145,37 @@ function z(n) {
|
|
|
145
145
|
forward: function() {
|
|
146
146
|
y(1);
|
|
147
147
|
},
|
|
148
|
-
listen: function(
|
|
149
|
-
return
|
|
148
|
+
listen: function(r) {
|
|
149
|
+
return L.push(r);
|
|
150
150
|
},
|
|
151
|
-
block: function(
|
|
152
|
-
var c = d.push(
|
|
153
|
-
return d.length === 1 &&
|
|
154
|
-
c(), d.length ||
|
|
151
|
+
block: function(r) {
|
|
152
|
+
var c = d.push(r);
|
|
153
|
+
return d.length === 1 && t.addEventListener(H, V), function() {
|
|
154
|
+
c(), d.length || t.removeEventListener(H, V);
|
|
155
155
|
};
|
|
156
156
|
}
|
|
157
157
|
};
|
|
158
158
|
return R;
|
|
159
159
|
}
|
|
160
|
-
function V(
|
|
161
|
-
|
|
160
|
+
function V(e) {
|
|
161
|
+
e.preventDefault(), e.returnValue = "";
|
|
162
162
|
}
|
|
163
163
|
function B() {
|
|
164
|
-
var
|
|
164
|
+
var e = [];
|
|
165
165
|
return {
|
|
166
166
|
get length() {
|
|
167
|
-
return
|
|
167
|
+
return e.length;
|
|
168
168
|
},
|
|
169
169
|
push: function(a) {
|
|
170
|
-
return
|
|
171
|
-
|
|
172
|
-
return
|
|
170
|
+
return e.push(a), function() {
|
|
171
|
+
e = e.filter(function(t) {
|
|
172
|
+
return t !== a;
|
|
173
173
|
});
|
|
174
174
|
};
|
|
175
175
|
},
|
|
176
176
|
call: function(a) {
|
|
177
|
-
|
|
178
|
-
return
|
|
177
|
+
e.forEach(function(t) {
|
|
178
|
+
return t && t(a);
|
|
179
179
|
});
|
|
180
180
|
}
|
|
181
181
|
};
|
|
@@ -183,45 +183,48 @@ function B() {
|
|
|
183
183
|
function C() {
|
|
184
184
|
return Math.random().toString(36).substr(2, 8);
|
|
185
185
|
}
|
|
186
|
-
function K(
|
|
187
|
-
var o =
|
|
186
|
+
function K(e) {
|
|
187
|
+
var o = e.pathname, a = o === void 0 ? "/" : o, t = e.search, i = t === void 0 ? "" : t, f = e.hash, s = f === void 0 ? "" : f;
|
|
188
188
|
return i && i !== "?" && (a += i.charAt(0) === "?" ? i : "?" + i), s && s !== "#" && (a += s.charAt(0) === "#" ? s : "#" + s), a;
|
|
189
189
|
}
|
|
190
|
-
function Q(
|
|
190
|
+
function Q(e) {
|
|
191
191
|
var o = {};
|
|
192
|
-
if (
|
|
193
|
-
var a =
|
|
194
|
-
a >= 0 && (o.hash =
|
|
195
|
-
var
|
|
196
|
-
|
|
192
|
+
if (e) {
|
|
193
|
+
var a = e.indexOf("#");
|
|
194
|
+
a >= 0 && (o.hash = e.substr(a), e = e.substr(0, a));
|
|
195
|
+
var t = e.indexOf("?");
|
|
196
|
+
t >= 0 && (o.search = e.substr(t), e = e.substr(0, t)), e && (o.pathname = e);
|
|
197
197
|
}
|
|
198
198
|
return o;
|
|
199
199
|
}
|
|
200
|
-
function J(
|
|
201
|
-
const [o, a] =
|
|
200
|
+
function J(e) {
|
|
201
|
+
const [o, a] = E(!1);
|
|
202
202
|
return k(() => {
|
|
203
|
-
const
|
|
204
|
-
a(
|
|
203
|
+
const t = window.matchMedia(e);
|
|
204
|
+
a(t.matches);
|
|
205
205
|
const i = (f) => {
|
|
206
206
|
a(f.matches);
|
|
207
207
|
};
|
|
208
|
-
return
|
|
209
|
-
}, [
|
|
208
|
+
return t.addEventListener("change", i), () => t.removeEventListener("change", i);
|
|
209
|
+
}, [e]), o;
|
|
210
210
|
}
|
|
211
211
|
function W() {
|
|
212
|
-
const [
|
|
212
|
+
const [e, o] = E(!1);
|
|
213
213
|
return k(() => {
|
|
214
214
|
o(!0);
|
|
215
|
-
}, []),
|
|
215
|
+
}, []), e;
|
|
216
216
|
}
|
|
217
217
|
function X() {
|
|
218
|
-
const [
|
|
219
|
-
return k(() =>
|
|
220
|
-
|
|
221
|
-
|
|
218
|
+
const [e, o] = E("");
|
|
219
|
+
return k(() => {
|
|
220
|
+
const a = z();
|
|
221
|
+
return o(a.location.pathname), a.listen(({ location: t }) => {
|
|
222
|
+
console.log("listener", t.pathname), o(t.pathname);
|
|
223
|
+
});
|
|
224
|
+
}, []), e;
|
|
222
225
|
}
|
|
223
226
|
export {
|
|
224
|
-
X as useLocation,
|
|
225
227
|
J as useMediaQuery,
|
|
226
|
-
W as useMounted
|
|
228
|
+
W as useMounted,
|
|
229
|
+
X as usePathname
|
|
227
230
|
};
|