@xyd-js/ui 0.1.0-xyd.5 → 0.1.0-xyd.57

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 xyd
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/dist/index.css CHANGED
@@ -1,51 +1,18 @@
1
- .h1vu90xp{position:sticky;top:0;z-index:20;width:100%;background:transparent;display:flex;}
2
- .s1i2i14o{pointer-events:none;position:absolute;z-index:-1;height:100%;width:100%;background-color:white;}
3
- .n1oemxra{display:flex;width:100%;height:var(--xyd-navbar-height);align-items:center;justify-content:flex-end;gap:8px;padding-left:calc(max(env(safe-area-inset-left), 16px));padding-right:calc(max(env(safe-area-inset-right), 16px));}
4
- .ny6xn1c{display:grid;grid-template-columns:1fr 1fr 1fr;align-items:center;}
5
- .hj2rxb1{display:flex;align-items:center;justify-content:center;gap:8px;}
6
- .hcz0c13{font-size:14px;position:relative;white-space:nowrap;color:#4b5563;padding:6px 16px;display:flex;align-items:center;justify-content:center;}
7
- .hcz0c13:hover{color:#1f2937;}
8
- .hcz0c13[data-state="active"]{font-weight:bold;background:#f9f9f9;border-radius:8px;}
9
- .t1lsj05a{position:absolute;inset:0;text-align:center;align-items:center;display:flex;justify-content:center;}
10
- .t138ur9z{visibility:hidden;font-weight:500;}
11
- .hso30gp{display:flex;align-items:center;margin-right:auto;}
1
+ @layer defaults{.n1vu90xp{position:sticky;top:0;z-index:20;width:100%;background:transparent;display:flex;}.n1vu90xp [part="shadow"]{pointer-events:none;position:absolute;z-index:-1;height:100%;width:100%;background-color:var(--xyd-nav-shadow-bgcolor);}.n1vu90xp [part="nav"]{display:flex;width:100%;height:var(--xyd-nav-height);align-items:center;justify-content:flex-end;gap:8px;padding-left:calc(max(env(safe-area-inset-left), var(--xyd-padding-default)));padding-right:calc(max(env(safe-area-inset-right), var(--xyd-padding-default)));}.n1vu90xp[data-kind="middle"] [part="nav"]{display:grid;grid-template-columns:1fr 1fr 1fr;align-items:center;}.n1vu90xp [part="logo"]{display:flex;align-items:center;margin-right:auto;width:100%;}.n1vu90xp [part="list"]{display:flex;align-items:center;justify-content:center;gap:8px;}.n1vu90xp [part="right"]{display:flex;align-items:center;justify-content:flex-end;}}
2
+ @layer defaults{.i1i2i14o{position:relative;white-space:nowrap;color:var(--xyd-nav-item-color);padding:calc(var(--xyd-padding-default) / 2) var(--xyd-padding-default);display:flex;align-items:center;justify-content:center;}.i1i2i14o:hover{color:var(--xyd-nav-item-color--active);}.i1i2i14o[data-state="active"]{font-weight:bold;background:var(--xyd-nav-item-bgcolor--active);border-radius:8px;}.i1i2i14o [part="title1"]{position:absolute;inset:0;text-align:center;align-items:center;display:flex;justify-content:center;}.i1i2i14o [part="title2"]{visibility:hidden;font-weight:var(--xyd-font-weight-semibold);}}
12
3
 
13
- .hptag3l{background:#f9f9f9;height:100%;border-radius:0.5rem;display:flex;flex-direction:column;}
14
- .uead4fo{overflow-y:auto;overflow-x:hidden;height:100%;padding:1rem;}
15
- .h1hrlfak{padding:1rem;box-shadow:0 -2px 10px rgba(237, 237, 237, .1);border-top:1px solid #ededed;}
16
- .i1btwdcv{display:flex;width:100%;padding:2px;color:#6e6e80;}
17
- .i1801o7t{display:flex;align-items:center;width:100%;gap:7px;font-size:14px;padding:4px 8px;}
18
- .i1801o7t:hover{background:#ececf1;color:#111827;border-radius:4px;}
19
- .i1801o7t:hover svg{fill:#111827;}
20
- .i1801o7t svg{fill:#6e6e80;font-size:18px;width:18px;height:18px;}
21
- .hs1gieu{color:#6e6e80;font-size:14px;}
22
- .l1s9ffav{display:flex;width:100%;padding:2px;font-weight:500;}
23
- .l1041tva{background:#fff;color:#7051d4;border-radius:4px;}
24
- .l1hsy03l{background:unset;color:#111827;font-weight:500;}
25
- .lz6cy9y{display:flex;width:100%;padding:4px 8px;}
26
- .lz6cy9y:hover{background:#ececf1;color:#111827;border-radius:4px;}
27
- .hnhdi2c{margin-left:8px;}
28
- .hj0z21i{padding-left:10px;margin-bottom:6px;margin-top:16px;font-size:12px;line-height:16px;font-weight:600;letter-spacing:1px;color:#111827;}
4
+ @layer defaults{.p1jzdbj3{position:absolute;top:0;left:0;right:0;z-index:50;background-color:var(--xyd-progressbar-bgcolor);height:0;opacity:0;transition:opacity .1s linear;transition-delay:0s;will-change:opacity;}.p1jzdbj3[data-active="true"]{height:.25rem;opacity:1;transition-delay:.3s;}.p1jzdbj3 [part="item"]{height:100%;transition:all .5s ease-in-out;transition-delay:.1s;background-color:var(--xyd-progressbar-bgcolor--active);}.p1jzdbj3[data-loading="true"] [part="item"]{width:100%;}}
29
5
 
30
- .c12fwmxc{transform:translateZ(0);overflow:hidden;transition:all 300ms ease-in-out;}
31
- .bfe0v98{opacity:0;transition:opacity 500ms ease-in-out;}
32
- .oza7km2{opacity:1;}
6
+ @layer defaults{.sptag3l{background:var(--xyd-sidebar-bgcolor);height:100%;border-radius:4px;display:flex;flex-direction:column;}.sptag3l [part="list"]{overflow-y:auto;overflow-x:hidden;height:100%;padding:var(--xyd-sidebar-padding);}.sptag3l [part="footer"]{padding:1rem;box-shadow:0 -2px 10px var(--xyd-sidebar-divider-shadow-color);border-top:1px solid var(--xyd-sidebar-divider-color);}}
7
+ @layer defaults{.iead4fo{color:var(--xyd-sidebar-item-color);}.iead4fo button{width:100%;}.iead4fo [part="link"]{display:flex;width:100%;font-weight:var(--xyd-font-weight-medium);}.iead4fo [part="first-item"]{display:flex;align-items:center;gap:8px;width:100%;padding:6px 12px 6px var(--xyd-sidebar-item-padding-left);margin-bottom:4px;position:relative;}.iead4fo [part="first-item"][data-anchor="true"]{padding:6px 12px 12px var(--xyd-sidebar-item-padding-left);}.iead4fo [part="first-item"]:not([data-anchor="true"]):hover{background:var(--xyd-sidebar-item-bgcolor--active-hover);color:var( --xyd-sidebar-item-color--active);border-radius:4px;}.iead4fo [part="first-item"] [part="item-title-container"]{width:100%;display:flex;align-items:center;justify-content:space-between;}.iead4fo [part="first-item"] [part="item-title"]{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.iead4fo [part="first-item" ][data-active="true"]{background:var(--xyd-sidebar-item-bgcolor--active);border-radius:4px;position:relative;font-weight:var(--xyd-font-weight-semibold);color:var(--xyd-sidebar-item-color--active);}.iead4fo [part="first-item" ][data-active="true"]::before{content:"";position:absolute;background:var(--xyd-sidebar-item-bgcolor--active-mark);border-radius:0 2px 2px 0;bottom:9px;top:9px;width:2px;left:5px;border-radius:10px;}.iead4fo [part="first-item"][data-parent-active="true"]{font-weight:var(--xyd-font-weight-semibold);background:transparent;}.iead4fo[data-theme="secondary"] [part="first-item"][data-active="true"]{background:unset;font-weight:var(--xyd-font-weight-medium);}.iead4fo [part="item-button"]:has(+ [part="subtree"] xyd-collapse){position:relative;}.iead4fo [part="item-button"]:has(+ [part="subtree"] xyd-collapse)::after{content:"";position:absolute;right:8px;top:0;bottom:0;width:16px;display:flex;align-items:center;justify-content:center;background-color:var(--xyd-sidebar-item-color);-webkit-mask-image:url(/Users/zdunecki/Code/livesession/xyd/packages/xyd-ui/src/components/Sidebar/chevronIcon.svg);-webkit-mask-image:url(/Users/zdunecki/Code/livesession/xyd/packages/xyd-ui/src/components/Sidebar/chevronIcon.svg);mask-image:url(/Users/zdunecki/Code/livesession/xyd/packages/xyd-ui/src/components/Sidebar/chevronIcon.svg);-webkit-mask-size:contain;-webkit-mask-size:contain;mask-size:contain;-webkit-mask-repeat:no-repeat;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-position:center;-webkit-mask-position:center;mask-position:center;transition:transform 0.2s ease,background-color 0.2s ease;transform:rotate(-90deg);}.iead4fo [part="item-button"]:has(+ [part="subtree"] xyd-collapse):hover::after{background-color:var(--xyd-sidebar-item-color--active);}.iead4fo [part="item-button"]:has(+ [part="subtree"] xyd-collapse[data-open="true"]){font-weight:bold;}.iead4fo [part="item-button"]:has(+ [part="subtree"] xyd-collapse[data-open="true"])::after{transform:rotate(0deg);}}
8
+ @layer defaults{.t1hrlfak{margin-left:12px;}}
9
+ @layer defaults{.i1btwdcv{font-size:var(--xyd-font-size-xsmall);font-weight:var(--xyd-font-weight-extrabold);text-transform:uppercase;letter-spacing:0.25px;color:var( --xyd-sidebar-item-header-color);padding-left:var(--xyd-sidebar-item-padding-left);margin-bottom:8px;margin-top:24px;display:flex;align-items:center;gap:8px;}}
10
+ @layer defaults{.f1801o7t{display:flex;width:100%;padding:2px;color:var(--xyd-sidebar-item-color);}.f1801o7t [part="item"]{display:flex;align-items:center;width:100%;gap:7px;padding:4px 8px;}.f1801o7t [part="item"]:hover{background:var(--xyd-sidebar-item-bgcolor--active-hover);color:var(--xyd-sidebar-item-color--active);border-radius:4px;}.f1801o7t [part="item"]:hover svg{fill:var(--xyd-sidebar-item-color--active);}.f1801o7t [part="item"] svg{fill:var(--xyd-sidebar-item-color);font-size:var(--xyd-font-size-large);width:18px;height:18px;}}
33
11
 
34
- .h4ah3ok{align-items:center;background-color:#f6f6f7;border-radius:0.50rem;display:flex;flex-direction:row;width:100%;height:44px;margin-top:3px;padding:0 0.25rem;}
35
- .p1ncaln9{color:#44474a;font-size:12px;font-weight:600;padding-left:0.50rem;padding-right:1.50rem;position:relative;text-transform:uppercase;}
36
- .p1ncaln9:after{background:#d2d5d8;border-radius:1px;content:" ";height:0.75rem;position:absolute;right:0.50rem;top:50%;transform:translateY(-50%);width:2px;}
37
- .u3wpqhn{display:flex;flex-direction:row;height:100%;}
38
- .lc3ej8u{display:flex;height:100%;align-items:center;position:relative;}
39
- .lc3ej8u[data-state="active"]{font-weight:500;}
40
- .lc3ej8u[data-state="active"] a{color:#202223;}
41
- .lc3ej8u[data-state="active"] a:after{background-color:#7051d4;border-radius:1px;bottom:0;content:" ";height:2px;left:0;position:absolute;width:100%;}
42
- .l1taqsnk{color:#4b5563;line-height:2.75rem;display:block;height:100%;padding:0 0.50rem;}
43
- .l1taqsnk:hover{color:#202223;}
12
+ @layer defaults{.c12fwmxc{display:block;transform:translateZ(0);overflow:hidden;transition:width 300ms cubic-bezier(0.4, 0, 0.2, 1),height 300ms cubic-bezier(0.4, 0, 0.2, 1);will-change:width,height;}@media (prefers-reduced-motion: reduce){.c12fwmxc{transition:none;}}.c12fwmxc [part="child"]{opacity:0;transition:opacity 300ms cubic-bezier(0.4, 0, 0.2, 1);will-change:opacity;}@media (prefers-reduced-motion: reduce){.c12fwmxc [part="child"]{transition:none;}}.c12fwmxc[data-open="true"] [part="child"]{opacity:1;}}
44
13
 
45
- .h19g75q2{position:relative;padding-left:16px;}
46
- .ueg7kxf{margin:0;padding:0;list-style:none;}
47
- .lagigsw{position:relative;line-height:1.5;margin:0 0 10px;padding:0;}
48
- .lylqcp3{display:inline-block;font-size:14px;color:#6e6e80;line-height:1.4;text-wrap:pretty;transition:color .15s ease;}
49
- .l16swvpi{font-weight:500;color:#353740;}
50
- .ht0m6aa{position:absolute;top:0;bottom:0;left:0;width:2px;background-color:#ececf1;}
51
- .sfp1vxs{position:absolute;top:0;left:0;width:2px;height:var(--active-track-height);transform:translateY(var(--active-track-top));background-color:#353740;transition:height .4s cubic-bezier(.19, 1, .22, 1),transform .4s cubic-bezier(.19, 1, .22, 1);}
14
+ @layer defaults{.s4ah3ok{align-items:center;background-color:var(--xyd-subnav-bgcolor);border-radius:0.50rem;display:flex;flex-direction:row;width:100%;height:var(--xyd-subnav-height);margin-top:3px;padding:0 var(--xyd-padding-default);}.s4ah3ok [part="prefix"]{color:var(--xyd-subnav-prefix-color);font-weight:var(--xyd-font-weight-semibold);padding:0 var(--xyd-padding-default);position:relative;}.s4ah3ok [part="prefix"]:after{background:var(--xyd-subnav-prefix-marker-color);border-radius:1px;content:" ";height:12px;position:absolute;right:4px;top:50%;transform:translateY(-50%);width:2px;}.s4ah3ok [part="list"]{display:flex;flex-direction:row;height:100%;}}
15
+ @layer defaults{.s1ncaln9{display:flex;height:100%;align-items:center;position:relative;}[data-state="active"]>.s1ncaln9{font-weight:var(--xyd-font-weight-semibold);}[data-state="active"]>.s1ncaln9 a{color:var(--xyd-subnav-item-color--active);}[data-state="active"]>.s1ncaln9 a:after{background-color:var(--xyd-subnav-item-color--active-mark);border-radius:1px;bottom:0;content:" ";height:2px;left:0;position:absolute;width:100%;}.s1ncaln9 [part="link"]{color:var(--xyd-subnav-item-color);display:flex;height:100%;padding:0 0.50rem;align-items:center;}.s1ncaln9 [part="link"]:hover{color:var(--xyd-subnav-item-color--active);}}
16
+
17
+ @layer defaults{.t19g75q2{position:relative;padding-left:16px;display:block;}.t19g75q2 [part="scroller"]{position:absolute;top:0;bottom:0;left:0;width:2px;background-color:var(--xyd-toc-bgcolor);}.t19g75q2 [part="scroll"]{position:absolute;top:0;left:0;width:2px;height:var(--xyd-toc-active-track-height);transform:translateY(var(--xyd-toc-active-track-top));background-color:var(--xyd-toc-scroll-bgcolor);transition:height .4s cubic-bezier(.19, 1, .22, 1),transform .4s cubic-bezier(.19, 1, .22, 1);}.t19g75q2 [part="list"]{margin:0;padding:0;list-style:none;}}
18
+ @layer defaults{.teg7kxf{position:relative;margin:0 0 12px;padding:0;}.teg7kxf [part="link"]{display:inline-block;color:var(--xyd-toc-item-color);text-wrap:pretty;transition:color .15s ease;padding-left:0;}.teg7kxf [part="link"]:hover{color:var(--xyd-toc-item-color--active);}.teg7kxf[data-active="true"] [part="link"]{color:var(--xyd-toc-item-color--active);font-weight:var(--xyd-font-weight-semibold);}.teg7kxf[data-depth="1"] [part="link"]{padding-left:16px;}.teg7kxf[data-depth="2"] [part="link"]{padding-left:32px;}.teg7kxf[data-depth="3"] [part="link"]{padding-left:48px;}.teg7kxf[data-depth="4"] [part="link"]{padding-left:64px;}.teg7kxf[data-depth="5"] [part="link"]{padding-left:80px;}}
package/dist/index.d.ts CHANGED
@@ -3,34 +3,46 @@ import React from 'react';
3
3
  interface NavProps {
4
4
  children: React.ReactNode;
5
5
  value: string;
6
- onChange: (value: string) => void;
6
+ onChange?: (value: string) => void;
7
7
  logo?: React.ReactNode;
8
8
  kind?: "middle";
9
+ className?: string;
10
+ rightSurface?: React.ReactNode;
9
11
  }
10
- declare function Nav({ children, value, onChange, logo, kind }: NavProps): React.JSX.Element;
12
+ declare function Nav({ children, value, onChange, logo, kind, className, rightSurface }: NavProps): React.JSX.Element;
11
13
  declare namespace Nav {
12
- var Item: ({ children, value, href }: {
13
- children: any;
14
- value: any;
15
- href: any;
16
- }) => React.JSX.Element;
14
+ var Tab: ({ children, value, onChange }: TabProps) => React.JSX.Element;
15
+ var Item: ({ children, value, href, as }: NavItemProps) => React.JSX.Element;
16
+ }
17
+ interface TabProps {
18
+ children: React.ReactNode;
19
+ value: string;
20
+ onChange?: (value: string) => void;
17
21
  }
18
22
  interface NavItemProps {
19
23
  children: React.ReactNode;
20
24
  href: string;
21
25
  value: string;
26
+ as?: React.ElementType;
27
+ }
28
+
29
+ interface ProgressBarProps {
30
+ className?: string;
31
+ isActive?: boolean;
22
32
  }
33
+ declare function ProgressBar({ className, isActive }: ProgressBarProps): React.JSX.Element;
23
34
 
24
35
  interface UISidebarProps {
25
36
  children: React.ReactNode;
26
37
  footerItems?: React.ReactNode;
38
+ className?: string;
27
39
  }
28
- declare function UISidebar({ children, footerItems }: UISidebarProps): React.JSX.Element;
40
+ declare function UISidebar({ children, footerItems, className }: UISidebarProps): React.JSX.Element;
29
41
  declare namespace UISidebar {
30
- var Item: ({ children, button, href, active, activeTheme, onClick }: UISidebarItemProps) => React.JSX.Element;
31
- var ItemHeader: ({ children }: UISidebarItemHeaderProps) => React.JSX.Element;
42
+ var Item: ({ children, button, href, active, activeTheme, isParentActive, anchor, icon, onClick, }: UISidebarItemProps) => React.JSX.Element;
43
+ var ItemHeader: ({ children, icon }: UISidebarItemHeaderProps) => React.JSX.Element;
32
44
  var SubTree: ({ children, isOpen }: UISidebarSubTreeProps) => React.JSX.Element;
33
- var FooterItem: ({ children, href, icon }: SidebarFooterItemProps) => React.JSX.Element;
45
+ var FooterItem: ({ children, href, icon, as }: SidebarFooterItemProps) => React.JSX.Element;
34
46
  }
35
47
  interface UISidebarItemProps {
36
48
  children: React.ReactNode;
@@ -38,10 +50,14 @@ interface UISidebarItemProps {
38
50
  href?: string;
39
51
  active?: boolean;
40
52
  activeTheme?: "secondary";
53
+ isParentActive?: boolean;
54
+ anchor?: boolean;
55
+ icon?: React.ReactNode;
41
56
  onClick?: (v: any) => void;
42
57
  }
43
58
  interface UISidebarItemHeaderProps {
44
59
  children: React.ReactNode;
60
+ icon?: React.ReactNode;
45
61
  }
46
62
  interface UISidebarSubTreeProps {
47
63
  children: React.ReactNode;
@@ -51,40 +67,48 @@ interface SidebarFooterItemProps {
51
67
  children: React.ReactNode;
52
68
  href?: string;
53
69
  icon?: React.ReactNode;
70
+ as?: React.ElementType;
54
71
  }
55
72
 
56
73
  interface SubNavProps {
57
74
  children: React.ReactNode;
58
75
  title: string;
59
76
  value: string;
60
- onChange: (value: string) => void;
77
+ onChange?: (value: string) => void;
78
+ className?: string;
61
79
  }
62
- declare function SubNav({ children, title, value, onChange }: SubNavProps): React.JSX.Element;
80
+ declare function SubNav({ children, title, value, onChange, className }: SubNavProps): React.JSX.Element;
63
81
  declare namespace SubNav {
64
- var Item: ({ children, value, href }: SubNavItemProps) => React.JSX.Element;
82
+ var Item: ({ children, value, href, as }: SubNavItemProps) => React.JSX.Element;
65
83
  }
66
84
  interface SubNavItemProps {
67
85
  children: React.ReactNode;
68
86
  value: string;
69
87
  href?: string;
88
+ as?: React.ElementType;
70
89
  }
71
90
 
72
91
  interface TocProps {
73
92
  children: React.ReactNode;
74
93
  defaultValue?: string;
94
+ className?: string;
95
+ maxDepth?: number;
75
96
  }
76
- declare function Toc({ children, defaultValue }: TocProps): React.JSX.Element;
97
+ declare function Toc({ children, defaultValue, className, maxDepth }: TocProps): React.JSX.Element;
77
98
  declare namespace Toc {
78
- var Item: ({ children, value, }: TocItemProps) => React.JSX.Element;
99
+ var Item: ({ children, id, className, depth }: TocItemProps) => React.JSX.Element;
79
100
  }
80
101
  interface TocItemProps {
81
102
  children: React.ReactNode;
82
- value: string;
103
+ id: string;
104
+ className?: string;
105
+ depth?: number;
83
106
  }
84
107
 
85
108
  interface ITOC {
86
109
  depth: number;
87
110
  value: string;
111
+ id: string;
88
112
  children: ITOC[];
89
113
  }
90
114
  interface IBreadcrumb {
@@ -102,4 +126,5 @@ interface INavLinks {
102
126
  };
103
127
  }
104
128
 
105
- export { type IBreadcrumb, type INavLinks, type ITOC, Nav, type NavItemProps, type NavProps, type SidebarFooterItemProps, SubNav, type SubNavProps, Toc, UISidebar, type UISidebarItemHeaderProps, type UISidebarItemProps, type UISidebarProps };
129
+ export { Nav, ProgressBar, SubNav, Toc, UISidebar };
130
+ export type { IBreadcrumb, INavLinks, ITOC, NavItemProps, NavProps, SidebarFooterItemProps, SubNavProps, TocItemProps, TocProps, UISidebarItemHeaderProps, UISidebarItemProps, UISidebarProps };
package/dist/index.js CHANGED
@@ -1,222 +1,2 @@
1
- import e, {useRef as t, useEffect as n, useState as r, useContext as a} from "react";
2
- import *as c from "@radix-ui/react-tabs";
3
-
4
- var l = "h1vu90xp", o = "s1i2i14o", i = "n1oemxra", s = "ny6xn1c", u = "hj2rxb1", m = "hcz0c13", f = "t1lsj05a",
5
- h = "t138ur9z", d = "hso30gp";
6
-
7
- function v(t) {
8
- var n = t.children, r = t.value, a = t.onChange, m = t.logo, f = t.kind;
9
- return e.createElement(c.Root, {
10
- asChild: !0,
11
- value: r,
12
- onValueChange: a
13
- }, e.createElement("div", {className: "".concat(l)}, e.createElement("div", {className: o}), e.createElement("nav", {className: "\n ".concat(i, "\n ").concat("middle" === f && s, "\n ")}, e.createElement("div", {className: "\n ".concat(d, "\n xyd_ui-comp-nav-logo\n ")}, m), e.createElement(c.List, {asChild: !0}, e.createElement("div", {className: u}, n)), "middle" === f && e.createElement("div", null))))
14
- }
15
-
16
- function p(e, t) {
17
- (null == t || t > e.length) && (t = e.length);
18
- for (var n = 0, r = Array(t); n < t; n++) r[n] = e[n];
19
- return r
20
- }
21
-
22
- function y(e) {
23
- if (Array.isArray(e)) return e
24
- }
25
-
26
- function E() {
27
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")
28
- }
29
-
30
- function g(e, t) {
31
- return y(e) || function (e, t) {
32
- var n = null == e ? null : "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"];
33
- if (null != n) {
34
- var r, a, c, l, o = [], i = !0, s = !1;
35
- try {
36
- if (c = (n = n.call(e)).next, 0 === t) ; else for (; !(i = (r = c.call(n)).done) && (o.push(r.value), o.length !== t); i = !0) ;
37
- } catch (e) {
38
- s = !0, a = e
39
- } finally {
40
- try {
41
- if (!i && null != n.return && (l = n.return(), Object(l) !== l)) return
42
- } finally {
43
- if (s) throw a
44
- }
45
- }
46
- return o
47
- }
48
- }(e, t) || b(e, t) || E()
49
- }
50
-
51
- function N(e) {
52
- return y(e) || function (e) {
53
- if ("undefined" != typeof Symbol && null != e[Symbol.iterator] || null != e["@@iterator"]) return Array.from(e)
54
- }(e) || b(e) || E()
55
- }
56
-
57
- function b(e, t) {
58
- if (e) {
59
- if ("string" == typeof e) return p(e, t);
60
- var n = {}.toString.call(e).slice(8, -1);
61
- return "Object" === n && e.constructor && (n = e.constructor.name), "Map" === n || "Set" === n ? Array.from(e) : "Arguments" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? p(e, t) : void 0
62
- }
63
- }
64
-
65
- v.Item = function (t) {
66
- var n = t.children, r = t.value, a = t.href;
67
- return e.createElement(c.Trigger, {asChild: !0, value: r}, e.createElement("a", {
68
- href: a,
69
- className: "".concat(m)
70
- }, e.createElement("span", {className: f}, n), e.createElement("span", {className: h}, n)))
71
- }, "function" == typeof SuppressedError && SuppressedError;
72
- var x = "hptag3l", w = "uead4fo", C = "h1hrlfak", O = "i1btwdcv", S = "i1801o7t", I = "hs1gieu", j = "l1s9ffav",
73
- k = "l1041tva", T = "l1hsy03l", A = "lz6cy9y", H = "hnhdi2c", q = "hj0z21i", z = "c12fwmxc", P = "bfe0v98",
74
- V = "oza7km2";
75
-
76
- function W(r) {
77
- var a = r.children, c = r.isOpen, l = r.horizontal, o = void 0 !== l && l, i = t(null), s = t(null), u = t(null),
78
- m = t(c), f = t(!0);
79
- return n((function () {
80
- var e = i.current, t = s.current;
81
- if (u.current && clearTimeout(u.current), !f.current && e && t) if (c) o ? (t.style.width = "".concat(t.scrollWidth, "px"), e.style.width = "".concat(t.scrollWidth, "px")) : (t.style.height = "".concat(t.scrollHeight, "px"), e.style.height = "".concat(t.scrollHeight, "px")), u.current = window.setTimeout((function () {
82
- e.style.removeProperty(o ? "width" : "height")
83
- }), 300); else if (o) {
84
- var n = e.scrollWidth;
85
- e.style.width = "".concat(n, "px"), e.offsetWidth, e.style.width = "0px"
86
- } else {
87
- var r = e.scrollHeight;
88
- e.style.height = "".concat(r, "px"), e.offsetHeight, e.style.height = "0px"
89
- }
90
- }), [o, c]), n((function () {
91
- f.current = !1
92
- }), []), e.createElement("div", {
93
- ref: i,
94
- className: "".concat(z),
95
- style: m.current || o ? void 0 : {height: 0}
96
- }, e.createElement("div", {ref: s, className: "".concat(P, " ").concat(c ? V : "")}, a))
97
- }
98
-
99
- function L(t) {
100
- var n = t.children, r = t.footerItems;
101
- return e.createElement("div", {className: "\n ".concat(x, "\n xyd_ui-comp-sidebar\n ")}, e.createElement("ul", {className: w}, n), r && e.createElement(M, null, r))
102
- }
103
-
104
- function R(t) {
105
- var n = t.children, r = function (e, t) {
106
- var n = {};
107
- for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && t.indexOf(r) < 0 && (n[r] = e[r]);
108
- if (null != e && "function" == typeof Object.getOwnPropertySymbols) {
109
- var a = 0;
110
- for (r = Object.getOwnPropertySymbols(e); a < r.length; a++) t.indexOf(r[a]) < 0 && Object.prototype.propertyIsEnumerable.call(e, r[a]) && (n[r[a]] = e[r[a]])
111
- }
112
- return n
113
- }(t, ["children"]);
114
- return e.createElement("a", Object.assign({}, r), n)
115
- }
116
-
117
- function M(t) {
118
- var n = t.children;
119
- return e.createElement("div", {className: C}, e.createElement("ul", null, n))
120
- }
121
-
122
- L.Item = function (t) {
123
- var n = t.children, r = t.button, a = t.href, c = t.active, l = t.activeTheme, o = t.onClick,
124
- i = N(e.Children.toArray(n)), s = i[0], u = i.slice(1), m = r ? "button" : R;
125
- return e.createElement("li", {className: I}, e.createElement(m, {
126
- href: r ? void 0 : a,
127
- onClick: r ? o : void 0,
128
- className: "\n ".concat(j, "\n ")
129
- }, e.createElement("div", {className: "\n ".concat(A, "\n ").concat(c && k, "\n ").concat(c && "secondary" === l && T, "\n ")}, s)), u)
130
- }, L.ItemHeader = function (t) {
131
- var n = t.children;
132
- return e.createElement("li", {className: q}, n)
133
- }, L.SubTree = function (t) {
134
- var n = t.children, r = t.isOpen;
135
- return e.createElement("ul", {className: H}, e.createElement(W, {isOpen: r || !1}, n))
136
- }, L.FooterItem = function (t) {
137
- var n = t.children, r = t.href, a = t.icon;
138
- return e.createElement("li", {className: O}, e.createElement("a", {className: S, href: r}, a, n))
139
- };
140
- var _ = "h4ah3ok", B = "p1ncaln9", D = "u3wpqhn", F = "lc3ej8u", U = "l1taqsnk";
141
-
142
- function $(t) {
143
- var n = t.children, r = t.title, a = t.value, l = t.onChange;
144
- return e.createElement(c.Root, {
145
- asChild: !0,
146
- value: a,
147
- onValueChange: l
148
- }, e.createElement("nav", {className: _}, e.createElement("div", {className: B}, r), e.createElement(c.List, {asChild: !0}, e.createElement("ul", {className: D}, n))))
149
- }
150
-
151
- $.Item = function (t) {
152
- var n = t.children, r = t.value, a = t.href;
153
- return e.createElement(c.Trigger, {
154
- asChild: !0,
155
- value: r
156
- }, e.createElement("li", {className: F}, e.createElement("a", {href: a, className: "".concat(U)}, n)))
157
- };
158
- var G = "h19g75q2", J = "ueg7kxf", K = "lagigsw", Q = "lylqcp3", X = "l16swvpi", Y = "ht0m6aa", Z = "sfp1vxs",
159
- ee = e.createContext({
160
- value: "", onChange: function (e) {
161
- }
162
- });
163
-
164
- function te(t) {
165
- var a = t.children, c = t.defaultValue, l = g(r(0), 2), o = l[0], i = l[1], s = g(r(0), 2), u = s[0], m = s[1],
166
- f = g(r(c || ""), 2), h = f[0], d = f[1];
167
- return n((function () {
168
- var e = new IntersectionObserver((function (e) {
169
- var t = !1;
170
- e.forEach((function (e) {
171
- if (!t && e.isIntersecting && e.target instanceof HTMLHeadingElement) {
172
- var n = e.target.getBoundingClientRect();
173
- n.top >= 0 && n.bottom <= window.innerHeight && (t = !0, d(e.target.innerText))
174
- }
175
- }))
176
- }), {threshold: .3});
177
- return document.querySelectorAll("h2").forEach((function (t) {
178
- t && e.observe(t)
179
- })), function () {
180
- e.disconnect()
181
- }
182
- }), []), n((function () {
183
- !function () {
184
- var e = document.querySelector(".".concat(X));
185
- if (e) {
186
- var t = e.offsetHeight;
187
- if (i(t), null == e ? void 0 : e.parentElement) {
188
- var n = e.parentElement.offsetTop;
189
- m(n)
190
- }
191
- }
192
- }()
193
- }), [h]), e.createElement(ee.Provider, {
194
- value: {
195
- value: h, onChange: function (e) {
196
- d(e)
197
- }
198
- }
199
- }, e.createElement("div", {className: G}, e.createElement("div", {className: Y}, e.createElement("div", {
200
- style: {
201
- "--active-track-height": "".concat(o, "px"),
202
- "--active-track-top": "".concat(u, "px")
203
- }, className: Z
204
- })), e.createElement("ul", {className: J}, a)))
205
- }
206
-
207
- te.Item = function (t) {
208
- var n = t.children, r = t.value, c = void 0 === r ? "#" : r, l = a(ee), o = l.value, i = l.onChange, s = "#" + c,
209
- u = o === c;
210
- return e.createElement("li", {className: K}, e.createElement("a", {
211
- className: "".concat(Q, " ").concat(u && X),
212
- href: s,
213
- onClick: function (e) {
214
- e.preventDefault(), i(c);
215
- var t = !1;
216
- document.querySelectorAll("h2").forEach((function (e) {
217
- t || e.innerText === c && (t = !0, e.scrollIntoView())
218
- }))
219
- }
220
- }, n))
221
- };
222
- export {v as Nav, $ as SubNav, te as Toc, L as UISidebar};
1
+ import e,{useRef as t,useEffect as r,useState as n,useCallback as a,createContext as c,useContext as i}from"react";import{Tabs as l}from"radix-ui";import{Link as o}from"react-router";function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function s(e){if(Array.isArray(e))return e}function f(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function d(e,t){return s(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,a,c,i,l=[],o=!0,u=!1;try{if(c=(r=r.call(e)).next,0===t);else for(;!(o=(n=c.call(r)).done)&&(l.push(n.value),l.length!==t);o=!0);}catch(e){u=!0,a=e}finally{try{if(!o&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(e,t)||h(e,t)||f()}function m(e){return s(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||h(e)||f()}function h(e,t){if(e){if("string"==typeof e)return u(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?u(e,t):void 0}}function v(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]])}return r}"function"==typeof SuppressedError&&SuppressedError;function p(t){var r=t.children,n=t.value,a=t.onChange,c=t.logo,i=t.kind,o=t.className,u=t.rightSurface;return e.createElement(l.Root,{asChild:!0,value:n,onValueChange:a},e.createElement("xyd-nav",{className:"".concat("n1vu90xp"," ").concat(o||""),"data-kind":i},e.createElement("div",{part:"shadow"}),e.createElement("nav",{part:"nav"},e.createElement("div",{part:"logo"},c),e.createElement(l.List,{asChild:!0},e.createElement("div",{part:"list"},r)),("middle"===i||u)&&e.createElement("div",{part:"right"},u))))}function y(t){var r=t.children,n=v(t,["children"]);return e.createElement("a",Object.assign({},n),r)}p.Tab=function(t){var r=t.children,n=t.value,a=t.onChange;return e.createElement(l.Root,{asChild:!0,value:n,onValueChange:a},e.createElement(l.List,null,r))},p.Item=function(t){var r=t.children,n=t.value,a=t.href,c=t.as||y;return e.createElement(l.Trigger,{asChild:!0,value:n},e.createElement("xyd-nav-item",{className:"i1i2i14o"},e.createElement(c,{href:a},e.createElement("span",{part:"title1"},r),e.createElement("span",{part:"title2"},r))))};function g(t){var r=t.className,n=t.isActive,a=void 0!==n&&n;return e.createElement("xyd-progressbar",{"data-active":String(a),role:"progressbar","aria-hidden":"true","aria-label":"loading bar",className:"".concat("p1jzdbj3"," ").concat(r||"")},e.createElement("div",{part:"item"}))}function E(n){var a=n.children,c=n.isOpen,i=n.horizontal,l=void 0!==i&&i,o=n.className,u=t(null),s=t(null),f=t(null),d=t(c),m=t(!0),h=t(null),v=function(){var e=u.current,t=s.current;if(e&&t){var r=t.querySelectorAll('[class*="collapse"]'),n=[];if(r.forEach(function(e){e instanceof HTMLElement&&(n.push({element:e,height:e.style.height,overflow:e.style.overflow}),e.style.height="auto",e.style.overflow="visible")}),l){var a=t.scrollWidth;e.style.width="".concat(a,"px"),t.style.width="".concat(a,"px")}else{var c=t.scrollHeight;e.style.height="".concat(c,"px"),t.style.height="".concat(c,"px")}n.forEach(function(e){var t=e.element,r=e.height,n=e.overflow;t.style.height=r,t.style.overflow=n})}};return r(function(){var e=u.current,t=s.current;if(f.current&&clearTimeout(f.current),!m.current&&e&&t){if(h.current&&h.current.disconnect(),c)v(),h.current=new MutationObserver(function(e){e.some(function(e){var t;return"childList"===e.type||"attributes"===e.type||"characterData"===e.type&&(null===(t=e.target.parentElement)||void 0===t?void 0:t.closest('[class*="collapse"]'))})&&v()}),h.current.observe(t,{childList:!0,subtree:!0,characterData:!0,attributes:!0}),f.current=window.setTimeout(function(){e.style.removeProperty(l?"width":"height"),t.style.removeProperty(l?"width":"height"),h.current&&h.current.disconnect()},300);else if(l){var r=e.scrollWidth;e.style.width="".concat(r,"px"),e.offsetWidth,e.style.width="0px"}else{var n=e.scrollHeight;e.style.height="".concat(n,"px"),e.offsetHeight,e.style.height="0px"}return function(){h.current&&h.current.disconnect(),f.current&&clearTimeout(f.current)}}},[l,c]),r(function(){m.current=!1},[]),e.createElement("xyd-collapse",{"data-open":String(c),className:"".concat("c12fwmxc"," ").concat(o||""),ref:u,style:d.current||l?void 0:{height:0}},e.createElement("div",{part:"child",ref:s},a))}function b(n){var a=n.children,c=n.footerItems,i=n.className,l=t(null);return r(function(){if(l.current){var e=l.current.querySelector('[data-active="true"]');if(e){var t=l.current.clientHeight,r=e.getBoundingClientRect().top,n=e.clientHeight,a=l.current.scrollTop+r-t/2+n/2;l.current.scrollTo({top:a,behavior:"auto"})}}},[]),e.createElement("xyd-sidebar",{className:"".concat("sptag3l"," ").concat(i||"")},e.createElement("ul",{part:"list",ref:l},a),c&&e.createElement("div",{part:"footer"},e.createElement("ul",null,c)))}function w(t){var r=t.children,n=v(t,["children"]);return e.createElement("a",Object.assign({},n),r)}b.Item=function(t){var r=t.children,n=t.button,a=t.href,c=t.active,i=t.activeTheme,l=t.isParentActive,u=t.anchor,s=t.icon,f=t.onClick,d=m(e.Children.toArray(r)),h=d[0],v=d.slice(1),p=n?"button":o,y=(null==a?void 0:a.endsWith("/"))?a.slice(0,-1):a;return e.createElement("li",{part:"item",className:"iead4fo","data-theme":i,"data-anchor":u?String(u):void 0},e.createElement(p,{part:"item-".concat(n?"button":"link"),href:n?void 0:y,to:y,onClick:f},e.createElement("div",{part:"first-item","data-parent-active":l,"data-active":c,"data-anchor":u?String(u):void 0},e.createElement(e.Fragment,null,s,h))),v)},b.ItemHeader=function(t){var r=t.children,n=t.icon;return e.createElement("li",{part:"item-header",className:"i1btwdcv"},n,r)},b.SubTree=function(t){var r=t.children,n=t.isOpen;return e.createElement("ul",{part:"subtree",className:"t1hrlfak"},e.createElement(E,{isOpen:n||!1},r))},b.FooterItem=function(t){var r=t.children,n=t.href,a=t.icon,c=t.as||w;return e.createElement("li",{part:"footer-item",className:"f1801o7t"},e.createElement(c,{part:"footer-link",href:n},a,r))};function x(t){var r=t.children,n=t.title,a=t.value,c=t.onChange,i=t.className;return e.createElement(l.Root,{asChild:!0,value:a,onValueChange:c},e.createElement("xyd-subnav",{className:"".concat("s4ah3ok"," ").concat(i||"")},e.createElement("div",{part:"prefix"},n),e.createElement(l.List,{asChild:!0},e.createElement("ul",{part:"list"},r))))}function S(t){var r=t.children,n=v(t,["children"]);return e.createElement("a",Object.assign({},n),r)}x.Item=function(t){var r=t.children,n=t.value,a=t.href,c=t.as||S;return e.createElement(l.Trigger,{asChild:!0,value:n},e.createElement("xyd-subnav-item",null,e.createElement("li",{className:"s1ncaln9"},e.createElement(c,{part:"link",href:a},r))))};var C=c({value:"",onChange:function(){},registerActiveItem:function(){},unregisterActiveItem:function(){}});function A(c){var i=c.children,l=c.defaultValue,o=c.className,u=c.maxDepth,s=void 0===u?2:u,f=d(n(0),2),m=f[0],v=f[1],p=d(n(0),2),y=p[0],g=p[1],E=d(n(l||""),2),b=E[0],w=E[1],x=t(new Map),S=t([]),A=t(!1),I=a(function(e,t){x.current.set(t,e)},[]),N=a(function(e){x.current.delete(e)},[]),O=a(function(e){w(e),A.current=!0},[]);function k(){var e=Array.from({length:s},function(e,t){return"h".concat(t+2)}).join(",");S.current=Array.from(document.querySelectorAll(e)).map(function(e){return e.id})}return r(function(){return k(),!l&&S.current.length&&w(S.current[0]),window.addEventListener("resize",k),function(){return window.removeEventListener("resize",k)}},[l]),r(function(){var e=window;function t(){if(A.current)A.current=!1;else{var t,r=e instanceof Window?window.pageYOffset:e.scrollTop,n=e instanceof Window?window.innerHeight:e.clientHeight,a=.2*n,c=S.current[0]||"",i=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=h(e))||t){r&&(e=r);var n=0,a=function(){};return{s:a,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var c,i=!0,l=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return i=e.done,e},e:function(e){l=!0,c=e},f:function(){try{i||null==r.return||r.return()}finally{if(l)throw c}}}}(S.current);try{for(i.s();!(t=i.n()).done;){var l=t.value,o=document.getElementById(l);if(o){if(!(o.getBoundingClientRect().top<=a))break;c=l}}}catch(e){i.e(e)}finally{i.f()}var u=e instanceof Window?document.documentElement.scrollHeight:e.scrollHeight;u>n&&r+n>=u-1&&(c=S.current[S.current.length-1]||c),c!==b&&w(c)}}return e.addEventListener("scroll",t),t(),function(){return e.removeEventListener("scroll",t)}},[b]),r(function(){var e;(null==(e=x.current.get(b))?void 0:e.current)&&(v(e.current.offsetHeight),g(e.current.offsetTop))},[b]),e.createElement(C.Provider,{value:{value:b,onChange:O,registerActiveItem:I,unregisterActiveItem:N}},e.createElement("xyd-toc",{className:"".concat("t19g75q2"," ").concat(o||"")},e.createElement("div",{part:"scroller"},e.createElement("div",{part:"scroll",style:{"--xyd-toc-active-track-height":"".concat(m,"px"),"--xyd-toc-active-track-top":"".concat(y,"px")}})),e.createElement("ul",{part:"list"},i)))}A.Item=function(n){var a=n.children,c=n.id,l=n.className,u=n.depth,s=i(C),f=s.value,d=s.onChange,m=s.registerActiveItem,h=s.unregisterActiveItem,v=t(null),p=f===c;return r(function(){return p&&v.current&&m(v,c),function(){return h(c)}},[p,c,m,h]),e.createElement("xyd-toc-item",null,e.createElement("li",{ref:v,className:"".concat("teg7kxf"," ").concat(l||""),"data-active":String(p),"data-depth":u},e.createElement(o,{part:"link",to:"",onClick:function(e){var t;e.preventDefault(),d(c);var r=new URL(window.location.href);r.hash=c,history.replaceState(null,"",r.toString()),null===(t=document.getElementById(c))||void 0===t||t.scrollIntoView()}},a)))};export{p as Nav,g as ProgressBar,x as SubNav,A as Toc,b as UISidebar};
2
+ //# sourceMappingURL=index.js.map