fromsrc 0.0.2 → 0.0.22
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/access.d.ts +7 -7
- package/dist/access.js +12 -5
- package/dist/adapter.js +8 -16
- package/dist/adapterbrowser.js +6 -10
- package/dist/adapternext.js +7 -18
- package/dist/adapterreactrouter.js +5 -9
- package/dist/adapterremix.js +8 -17
- package/dist/adaptertanstack.js +6 -10
- package/dist/algolia.js +43 -21
- package/dist/analytics.d.ts +1 -1
- package/dist/analytics.js +16 -10
- package/dist/ansi.js +76 -37
- package/dist/api.d.ts +10 -10
- package/dist/api.js +14 -11
- package/dist/audit.d.ts +6 -6
- package/dist/audit.js +29 -10
- package/dist/autotype.js +20 -10
- package/dist/batch.d.ts +6 -6
- package/dist/batch.js +16 -9
- package/dist/changelog.js +28 -14
- package/dist/changelogutil.d.ts +4 -4
- package/dist/changelogutil.js +33 -13
- package/dist/cli.d.ts +6 -6
- package/dist/cli.js +7 -3
- package/dist/client.d.ts +1 -1
- package/dist/codesample.d.ts +4 -4
- package/dist/codesample.js +63 -24
- package/dist/collapse.js +31 -13
- package/dist/collections.js +36 -16
- package/dist/components/accordion.d.ts +1 -1
- package/dist/components/accordion.js +5 -1
- package/dist/components/alert.d.ts +1 -1
- package/dist/components/alert.js +24 -13
- package/dist/components/announce.js +40 -17
- package/dist/components/autofill.js +18 -8
- package/dist/components/avatar.js +4 -4
- package/dist/components/avatarstack.js +2 -2
- package/dist/components/backtotop.d.ts +1 -1
- package/dist/components/backtotop.js +18 -5
- package/dist/components/badge.js +9 -4
- package/dist/components/banner.js +22 -5
- package/dist/components/breadcrumb.js +11 -4
- package/dist/components/breadcrumbnav.js +37 -21
- package/dist/components/button.js +23 -8
- package/dist/components/callout.d.ts +1 -1
- package/dist/components/callout.js +35 -31
- package/dist/components/changelog.js +21 -8
- package/dist/components/checkbox.js +32 -19
- package/dist/components/code.d.ts +1 -1
- package/dist/components/code.js +6 -3
- package/dist/components/codeblock.js +157 -39
- package/dist/components/codecopy.d.ts +1 -1
- package/dist/components/codecopy.js +36 -13
- package/dist/components/codegroup.js +87 -25
- package/dist/components/collapsible.d.ts +1 -1
- package/dist/components/collapsible.js +5 -1
- package/dist/components/command.d.ts +1 -1
- package/dist/components/command.js +42 -15
- package/dist/components/compare.js +20 -8
- package/dist/components/content.js +121 -79
- package/dist/components/copybutton.d.ts +1 -1
- package/dist/components/copybutton.js +14 -7
- package/dist/components/countdown.js +9 -3
- package/dist/components/create.js +34 -24
- package/dist/components/definition.js +11 -4
- package/dist/components/diffview.js +63 -29
- package/dist/components/divider.js +5 -1
- package/dist/components/docheader.js +8 -1
- package/dist/components/doclinkcard.js +27 -3
- package/dist/components/dropdown.d.ts +1 -1
- package/dist/components/dropdown.js +32 -11
- package/dist/components/dynamiccode.js +5 -3
- package/dist/components/editlink.js +35 -23
- package/dist/components/embed.js +15 -7
- package/dist/components/endpoint.d.ts +3 -3
- package/dist/components/endpoint.js +24 -9
- package/dist/components/errormessage.d.ts +1 -1
- package/dist/components/errormessage.js +4 -1
- package/dist/components/expandcode.d.ts +1 -1
- package/dist/components/expandcode.js +6 -2
- package/dist/components/feature.js +8 -1
- package/dist/components/featuregrid.d.ts +4 -4
- package/dist/components/featuregrid.js +7 -1
- package/dist/components/feedback.js +11 -7
- package/dist/components/feedbackwidget.js +18 -12
- package/dist/components/files.d.ts +1 -1
- package/dist/components/files.js +52 -18
- package/dist/components/folder.d.ts +1 -1
- package/dist/components/folder.js +21 -4
- package/dist/components/footer.js +5 -1
- package/dist/components/formlabel.d.ts +1 -1
- package/dist/components/formlabel.js +31 -18
- package/dist/components/github.js +43 -14
- package/dist/components/graph.js +38 -14
- package/dist/components/heading.js +36 -29
- package/dist/components/headingcopy.js +13 -5
- package/dist/components/hero.js +20 -14
- package/dist/components/highlight.d.ts +2 -2
- package/dist/components/highlight.js +14 -8
- package/dist/components/hover.d.ts +2 -2
- package/dist/components/hover.js +11 -4
- package/dist/components/icons.js +4 -1
- package/dist/components/inlinetoc.js +3 -1
- package/dist/components/input.js +13 -3
- package/dist/components/install.js +34 -24
- package/dist/components/kbd.js +19 -11
- package/dist/components/langicon.d.ts +1 -1
- package/dist/components/langicon.js +32 -24
- package/dist/components/language.d.ts +1 -1
- package/dist/components/language.js +12 -4
- package/dist/components/lastupdated.d.ts +2 -2
- package/dist/components/lastupdated.js +36 -12
- package/dist/components/link.d.ts +1 -1
- package/dist/components/linkcard.js +3 -1
- package/dist/components/list.d.ts +1 -1
- package/dist/components/list.js +4 -1
- package/dist/components/math.js +33 -8
- package/dist/components/mermaid.js +3 -3
- package/dist/components/mobilenav.d.ts +2 -1
- package/dist/components/mobilenav.js +116 -47
- package/dist/components/modal.d.ts +1 -1
- package/dist/components/modal.js +9 -2
- package/dist/components/navlink.js +17 -3
- package/dist/components/openapi.d.ts +1 -1
- package/dist/components/openapi.js +102 -32
- package/dist/components/openapischema.d.ts +1 -1
- package/dist/components/openapischema.js +29 -9
- package/dist/components/openapitags.js +6 -2
- package/dist/components/pagetransition.js +5 -3
- package/dist/components/pagination.js +5 -4
- package/dist/components/panel.js +92 -16
- package/dist/components/playground.d.ts +1 -1
- package/dist/components/playground.js +153 -50
- package/dist/components/popover.js +9 -7
- package/dist/components/prelink.js +40 -9
- package/dist/components/prevnext.d.ts +1 -1
- package/dist/components/prevnext.js +36 -16
- package/dist/components/progress.js +2 -2
- package/dist/components/property.js +4 -2
- package/dist/components/quote.d.ts +2 -2
- package/dist/components/quote.js +32 -4
- package/dist/components/radio.js +36 -18
- package/dist/components/rating.js +14 -3
- package/dist/components/recent.d.ts +1 -1
- package/dist/components/recent.js +26 -10
- package/dist/components/responsive.js +21 -13
- package/dist/components/results.js +8 -4
- package/dist/components/screenshot.js +61 -21
- package/dist/components/scrollprogress.js +9 -5
- package/dist/components/scrollspy.d.ts +2 -2
- package/dist/components/scrollspy.js +9 -3
- package/dist/components/search.js +47 -18
- package/dist/components/searchbutton.js +3 -1
- package/dist/components/searchdialog.js +36 -23
- package/dist/components/searcher.d.ts +1 -1
- package/dist/components/searcher.js +51 -26
- package/dist/components/select.js +27 -13
- package/dist/components/shortcuts.d.ts +1 -1
- package/dist/components/shortcuts.js +57 -38
- package/dist/components/sidebar.d.ts +2 -1
- package/dist/components/sidebar.js +209 -64
- package/dist/components/sidebarfilter.d.ts +1 -1
- package/dist/components/sidebarfilter.js +33 -9
- package/dist/components/sidebarscript.d.ts +5 -0
- package/dist/components/sidebarscript.js +5 -0
- package/dist/components/skeleton.js +15 -3
- package/dist/components/spinner.js +13 -3
- package/dist/components/status.js +20 -8
- package/dist/components/steps.js +3 -1
- package/dist/components/switch.js +4 -4
- package/dist/components/table.js +37 -12
- package/dist/components/tabnav.d.ts +1 -1
- package/dist/components/tabnav.js +48 -36
- package/dist/components/tabs.d.ts +1 -1
- package/dist/components/tabs.js +56 -40
- package/dist/components/tag.js +8 -3
- package/dist/components/terminal.js +14 -4
- package/dist/components/textarea.js +96 -82
- package/dist/components/theme.d.ts +1 -1
- package/dist/components/theme.js +26 -4
- package/dist/components/themeprovider.d.ts +4 -4
- package/dist/components/themeprovider.js +16 -5
- package/dist/components/toast.d.ts +1 -1
- package/dist/components/toast.js +23 -14
- package/dist/components/toc/default.d.ts +1 -1
- package/dist/components/toc/default.js +28 -13
- package/dist/components/toc/hook.js +28 -14
- package/dist/components/toc/index.js +8 -4
- package/dist/components/toc/inline.js +12 -2
- package/dist/components/toc/minimal.js +11 -5
- package/dist/components/toc/zigzag.d.ts +1 -1
- package/dist/components/toc/zigzag.js +37 -17
- package/dist/components/tocprogress.d.ts +1 -1
- package/dist/components/tocprogress.js +66 -34
- package/dist/components/tooltip.d.ts +1 -1
- package/dist/components/tooltip.js +20 -8
- package/dist/components/trigger.js +13 -5
- package/dist/components/twoslash.js +49 -26
- package/dist/components/typetable.js +23 -4
- package/dist/components/typewriter.js +6 -2
- package/dist/components/version.js +40 -14
- package/dist/components/video.js +25 -15
- package/dist/components/zoom.js +6 -2
- package/dist/config.d.ts +2 -2
- package/dist/config.js +56 -30
- package/dist/content.d.ts +5 -5
- package/dist/content.js +121 -57
- package/dist/contentcache.d.ts +10 -10
- package/dist/contentcache.js +9 -5
- package/dist/contentdiff.d.ts +4 -4
- package/dist/contentdiff.js +16 -8
- package/dist/contributors.d.ts +4 -4
- package/dist/contributors.js +49 -19
- package/dist/diff.d.ts +6 -6
- package/dist/diff.js +37 -16
- package/dist/draft.d.ts +11 -11
- package/dist/draft.js +9 -5
- package/dist/env.js +21 -7
- package/dist/export.js +4 -4
- package/dist/frontmatter.js +11 -9
- package/dist/github.js +60 -30
- package/dist/gitsource.d.ts +1 -1
- package/dist/gitsource.js +16 -9
- package/dist/hash.d.ts +6 -6
- package/dist/hash.js +19 -7
- package/dist/highlight.d.ts +4 -4
- package/dist/highlight.js +34 -14
- package/dist/hooks/anchor.js +26 -14
- package/dist/hooks/arrownav.js +25 -7
- package/dist/hooks/async.js +3 -3
- package/dist/hooks/battery.js +11 -3
- package/dist/hooks/breakpoint.js +10 -2
- package/dist/hooks/clickoutside.js +10 -3
- package/dist/hooks/clipboard-paste.js +7 -3
- package/dist/hooks/clipboard.d.ts +2 -2
- package/dist/hooks/clipboard.js +21 -15
- package/dist/hooks/copy.js +11 -6
- package/dist/hooks/countdown.js +1 -1
- package/dist/hooks/counter.js +1 -1
- package/dist/hooks/escapekey.js +6 -1
- package/dist/hooks/eventlistener.js +3 -1
- package/dist/hooks/eventsource.js +4 -2
- package/dist/hooks/eyedropper.js +7 -3
- package/dist/hooks/favicon.js +1 -1
- package/dist/hooks/fetch.js +12 -4
- package/dist/hooks/focustrap.js +20 -8
- package/dist/hooks/focuswithin.js +6 -2
- package/dist/hooks/form.d.ts +2 -2
- package/dist/hooks/form.js +15 -2
- package/dist/hooks/fullscreen.js +1 -1
- package/dist/hooks/geolocation.js +8 -8
- package/dist/hooks/hotkeys.js +19 -7
- package/dist/hooks/hover.d.ts +4 -1
- package/dist/hooks/hover.js +3 -1
- package/dist/hooks/idle.js +13 -3
- package/dist/hooks/infinitescroll.js +4 -2
- package/dist/hooks/interval.js +3 -1
- package/dist/hooks/inview.js +7 -3
- package/dist/hooks/keyboard.js +36 -12
- package/dist/hooks/keypress.js +6 -2
- package/dist/hooks/list.js +11 -1
- package/dist/hooks/longpress.js +3 -3
- package/dist/hooks/map.js +1 -1
- package/dist/hooks/measure.js +16 -7
- package/dist/hooks/mediarecorder.js +7 -3
- package/dist/hooks/networkstate.js +4 -2
- package/dist/hooks/os.js +12 -4
- package/dist/hooks/pagination.js +6 -4
- package/dist/hooks/permission.js +6 -2
- package/dist/hooks/queue.js +4 -2
- package/dist/hooks/readprogress.js +6 -2
- package/dist/hooks/resizeobserver.js +6 -4
- package/dist/hooks/script.js +1 -1
- package/dist/hooks/scrolllock.js +6 -2
- package/dist/hooks/scrollspy.js +4 -2
- package/dist/hooks/selection.js +6 -3
- package/dist/hooks/share.js +18 -9
- package/dist/hooks/speechrecognition.js +7 -3
- package/dist/hooks/stepper.js +4 -4
- package/dist/hooks/storage.js +9 -3
- package/dist/hooks/stylesheet.js +4 -2
- package/dist/hooks/textselection.js +6 -3
- package/dist/hooks/throttle.js +6 -2
- package/dist/hooks/undoredo.js +19 -11
- package/dist/hooks/vibrate.js +3 -1
- package/dist/hooks/viewtransition.js +8 -4
- package/dist/hooks/wakelock.js +12 -7
- package/dist/hooks/websocket.js +4 -2
- package/dist/hooks/windowsize.js +2 -2
- package/dist/i18n.d.ts +2 -2
- package/dist/i18n.js +27 -14
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/lastmodified.js +11 -5
- package/dist/linkcheck.d.ts +6 -6
- package/dist/linkcheck.js +55 -14
- package/dist/llms.js +20 -4
- package/dist/manifest.js +7 -7
- package/dist/mcp.js +28 -22
- package/dist/mdtoc.d.ts +4 -4
- package/dist/mdtoc.js +11 -5
- package/dist/mdxscope.d.ts +2 -2
- package/dist/mdxscope.js +3 -1
- package/dist/meta.js +19 -7
- package/dist/migrate.js +35 -25
- package/dist/navgen.d.ts +8 -8
- package/dist/navgen.js +73 -30
- package/dist/navtree.d.ts +1 -1
- package/dist/navtree.js +39 -19
- package/dist/oembed.d.ts +4 -4
- package/dist/oembed.js +24 -18
- package/dist/ogimage.d.ts +11 -11
- package/dist/ogimage.js +24 -24
- package/dist/openapi.js +60 -33
- package/dist/openapiguard.js +21 -11
- package/dist/openapiutil.js +66 -20
- package/dist/orama.js +52 -34
- package/dist/pipeline.d.ts +4 -4
- package/dist/pipeline.js +4 -4
- package/dist/preload.d.ts +2 -2
- package/dist/preload.js +4 -4
- package/dist/ranking.d.ts +6 -6
- package/dist/ranking.js +39 -13
- package/dist/readtime.js +3 -1
- package/dist/redirects.d.ts +2 -2
- package/dist/redirects.js +20 -12
- package/dist/rehype.js +16 -9
- package/dist/rehypeautolink.d.ts +2 -2
- package/dist/rehypeautolink.js +25 -23
- package/dist/rehypecode.js +38 -28
- package/dist/rehypecopy.js +17 -13
- package/dist/rehypeinline.js +33 -27
- package/dist/rehypelinks.js +28 -20
- package/dist/rehyperaw.js +9 -3
- package/dist/rehypeslug.d.ts +1 -1
- package/dist/rehypeslug.js +23 -19
- package/dist/rehypetablewrap.d.ts +2 -2
- package/dist/rehypetablewrap.js +9 -5
- package/dist/rehypetoc.d.ts +1 -1
- package/dist/rehypetoc.js +15 -7
- package/dist/remark.js +28 -13
- package/dist/remarkadmonition.js +40 -14
- package/dist/remarkannotation.d.ts +2 -2
- package/dist/remarkannotation.js +26 -10
- package/dist/remarkbadge.js +43 -31
- package/dist/remarkblockmath.js +29 -15
- package/dist/remarkcallout.js +32 -14
- package/dist/remarkcaption.js +28 -16
- package/dist/remarkcodetitle.js +29 -13
- package/dist/remarkcolumns.js +22 -10
- package/dist/remarkdetails.js +34 -14
- package/dist/remarkdirective.js +47 -20
- package/dist/remarkembed.js +38 -22
- package/dist/remarkfiletree.js +29 -19
- package/dist/remarkfootnote.js +46 -18
- package/dist/remarkgfm.js +13 -8
- package/dist/remarkheadingid.js +16 -6
- package/dist/remarkimage.js +54 -34
- package/dist/remarkinclude.js +20 -8
- package/dist/remarkinstall.js +20 -12
- package/dist/remarklinkcard.js +33 -14
- package/dist/remarkmath.js +34 -15
- package/dist/remarkmermaid.js +10 -6
- package/dist/remarkmeta.d.ts +2 -2
- package/dist/remarkmeta.js +15 -5
- package/dist/remarkreadingtime.d.ts +2 -2
- package/dist/remarkreadingtime.js +3 -1
- package/dist/remarksteps.js +26 -14
- package/dist/remarkstructure.js +16 -10
- package/dist/remarktabs.js +31 -14
- package/dist/remarktoc.js +40 -24
- package/dist/remarkts2js.js +51 -40
- package/dist/remarktwoslash.d.ts +4 -4
- package/dist/remarktwoslash.js +24 -14
- package/dist/remarkvideo.d.ts +4 -4
- package/dist/remarkvideo.js +42 -16
- package/dist/schema.d.ts +14 -14
- package/dist/schema.js +2 -2
- package/dist/search.js +106 -48
- package/dist/searchindex.js +86 -34
- package/dist/searchpolicy.js +1 -1
- package/dist/searchscore.js +5 -5
- package/dist/searchtypo.js +30 -10
- package/dist/seo.d.ts +2 -2
- package/dist/seo.js +14 -14
- package/dist/shortcodes.d.ts +4 -4
- package/dist/shortcodes.js +25 -20
- package/dist/sitemap.js +18 -8
- package/dist/snippets.js +26 -18
- package/dist/source.js +75 -41
- package/dist/stats.d.ts +4 -4
- package/dist/stats.js +18 -12
- package/dist/testing.d.ts +7 -7
- package/dist/testing.js +74 -29
- package/dist/themeutil.d.ts +6 -6
- package/dist/themeutil.js +145 -27
- package/dist/typegen.js +31 -12
- package/dist/validate.js +19 -7
- package/dist/validator.d.ts +11 -11
- package/dist/validator.js +68 -19
- package/dist/versioning.d.ts +7 -7
- package/dist/versioning.js +27 -11
- package/dist/watcher.js +39 -15
- package/dist/webhook.d.ts +6 -6
- package/dist/webhook.js +34 -12
- package/dist/workspace.js +26 -12
- package/package.json +137 -137
- package/styles/reset.css +1 -1
package/dist/components/table.js
CHANGED
|
@@ -13,26 +13,44 @@ function Table({
|
|
|
13
13
|
caption,
|
|
14
14
|
className = ""
|
|
15
15
|
}) {
|
|
16
|
-
const [sortKey, setSortKey] = useState(
|
|
17
|
-
|
|
16
|
+
const [sortKey, setSortKey] = useState(
|
|
17
|
+
defaultSort ?? null
|
|
18
|
+
);
|
|
19
|
+
const [sortDir, setSortDir] = useState(
|
|
20
|
+
defaultSort ? defaultDirection : null
|
|
21
|
+
);
|
|
18
22
|
const id = useId();
|
|
19
23
|
const sorted = useMemo(() => {
|
|
20
|
-
if (!sortKey || !sortDir)
|
|
24
|
+
if (!sortKey || !sortDir) {
|
|
25
|
+
return data;
|
|
26
|
+
}
|
|
21
27
|
return [...data].sort((a, b) => {
|
|
22
28
|
const va = a[sortKey];
|
|
23
29
|
const vb = b[sortKey];
|
|
24
|
-
if (va === vb)
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
30
|
+
if (va === vb) {
|
|
31
|
+
return 0;
|
|
32
|
+
}
|
|
33
|
+
if (va == null) {
|
|
34
|
+
return 1;
|
|
35
|
+
}
|
|
36
|
+
if (vb == null) {
|
|
37
|
+
return -1;
|
|
38
|
+
}
|
|
39
|
+
const na = typeof va === "number" ? va : String(va);
|
|
40
|
+
const nb = typeof vb === "number" ? vb : String(vb);
|
|
41
|
+
const cmp = na < nb ? -1 : na > nb ? 1 : 0;
|
|
28
42
|
return sortDir === "asc" ? cmp : -cmp;
|
|
29
43
|
});
|
|
30
44
|
}, [data, sortKey, sortDir]);
|
|
31
45
|
const handleSort = useCallback(
|
|
32
46
|
(key) => {
|
|
33
47
|
if (sortKey === key) {
|
|
34
|
-
setSortDir(
|
|
35
|
-
|
|
48
|
+
setSortDir(
|
|
49
|
+
sortDir === "asc" ? "desc" : sortDir === "desc" ? null : "asc"
|
|
50
|
+
);
|
|
51
|
+
if (sortDir === "desc") {
|
|
52
|
+
setSortKey(null);
|
|
53
|
+
}
|
|
36
54
|
} else {
|
|
37
55
|
setSortKey(key);
|
|
38
56
|
setSortDir("asc");
|
|
@@ -44,8 +62,12 @@ function Table({
|
|
|
44
62
|
const getSortLabel = useCallback(
|
|
45
63
|
(col) => {
|
|
46
64
|
if (sortKey === col.key) {
|
|
47
|
-
if (sortDir === "asc")
|
|
48
|
-
|
|
65
|
+
if (sortDir === "asc") {
|
|
66
|
+
return `${col.header}, sorted ascending`;
|
|
67
|
+
}
|
|
68
|
+
if (sortDir === "desc") {
|
|
69
|
+
return `${col.header}, sorted descending`;
|
|
70
|
+
}
|
|
49
71
|
}
|
|
50
72
|
return `${col.header}, sortable`;
|
|
51
73
|
},
|
|
@@ -119,7 +141,10 @@ function Table({
|
|
|
119
141
|
}
|
|
120
142
|
);
|
|
121
143
|
}
|
|
122
|
-
const SortIcon = memo(function SortIcon2({
|
|
144
|
+
const SortIcon = memo(function SortIcon2({
|
|
145
|
+
active,
|
|
146
|
+
direction
|
|
147
|
+
}) {
|
|
123
148
|
return /* @__PURE__ */ jsx(
|
|
124
149
|
"svg",
|
|
125
150
|
{
|
|
@@ -25,6 +25,6 @@ interface TabNavDropdownProps {
|
|
|
25
25
|
tabs: NavTab[];
|
|
26
26
|
label?: string;
|
|
27
27
|
}
|
|
28
|
-
declare function TabNavDropdown({ tabs, label }: TabNavDropdownProps): ReactNode;
|
|
28
|
+
declare function TabNavDropdown({ tabs, label, }: TabNavDropdownProps): ReactNode;
|
|
29
29
|
|
|
30
30
|
export { type NavTab, TabNav, TabNavDropdown, type TabNavDropdownProps, type TabNavProps };
|
|
@@ -26,37 +26,50 @@ function TabNav({ tabs, label = "Navigation" }) {
|
|
|
26
26
|
direction: "both",
|
|
27
27
|
wrap: true
|
|
28
28
|
});
|
|
29
|
-
if (next === index)
|
|
29
|
+
if (next === index) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
30
32
|
e.preventDefault();
|
|
31
33
|
refs.current[next]?.focus();
|
|
32
34
|
},
|
|
33
35
|
[tabs.length]
|
|
34
36
|
);
|
|
35
|
-
return /* @__PURE__ */ jsx(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
37
|
+
return /* @__PURE__ */ jsx(
|
|
38
|
+
"nav",
|
|
39
|
+
{
|
|
40
|
+
"aria-label": label,
|
|
41
|
+
role: "tablist",
|
|
42
|
+
className: "flex gap-1 p-1 bg-surface rounded-lg",
|
|
43
|
+
children: tabs.map((tab, i) => {
|
|
44
|
+
const active = isActive(tab);
|
|
45
|
+
return /* @__PURE__ */ jsxs(
|
|
46
|
+
Link,
|
|
47
|
+
{
|
|
48
|
+
ref: (el) => {
|
|
49
|
+
refs.current[i] = el;
|
|
50
|
+
},
|
|
51
|
+
href: tab.href,
|
|
52
|
+
role: "tab",
|
|
53
|
+
tabIndex: active ? 0 : -1,
|
|
54
|
+
"aria-selected": active,
|
|
55
|
+
"aria-current": active ? "page" : void 0,
|
|
56
|
+
onKeyDown: (e) => handleKeyDown(e, i),
|
|
57
|
+
className: `flex items-center gap-2 px-3 py-1.5 rounded-md text-sm font-medium transition-colors ${active ? "bg-bg text-fg shadow-sm" : "text-muted hover:text-fg hover:bg-bg/50"}`,
|
|
58
|
+
children: [
|
|
59
|
+
tab.icon && /* @__PURE__ */ jsx("span", { className: "w-4 h-4", "aria-hidden": "true", children: tab.icon }),
|
|
60
|
+
tab.label
|
|
61
|
+
]
|
|
62
|
+
},
|
|
63
|
+
tab.id
|
|
64
|
+
);
|
|
65
|
+
})
|
|
66
|
+
}
|
|
67
|
+
);
|
|
58
68
|
}
|
|
59
|
-
function TabNavDropdown({
|
|
69
|
+
function TabNavDropdown({
|
|
70
|
+
tabs,
|
|
71
|
+
label = "Navigation"
|
|
72
|
+
}) {
|
|
60
73
|
const pathname = usePathname();
|
|
61
74
|
const [open, setOpen] = useState(false);
|
|
62
75
|
const [focused, setFocused] = useState(0);
|
|
@@ -90,7 +103,7 @@ function TabNavDropdown({ tabs, label = "Navigation" }) {
|
|
|
90
103
|
(e) => {
|
|
91
104
|
if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
92
105
|
e.preventDefault();
|
|
93
|
-
openMenu(currentIndex
|
|
106
|
+
openMenu(Math.max(currentIndex, 0));
|
|
94
107
|
}
|
|
95
108
|
},
|
|
96
109
|
[currentIndex, openMenu]
|
|
@@ -111,7 +124,9 @@ function TabNavDropdown({ tabs, label = "Navigation" }) {
|
|
|
111
124
|
current: index,
|
|
112
125
|
wrap: true
|
|
113
126
|
});
|
|
114
|
-
if (next === index)
|
|
127
|
+
if (next === index) {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
115
130
|
e.preventDefault();
|
|
116
131
|
setFocused(next);
|
|
117
132
|
optionRefs.current[next]?.focus();
|
|
@@ -122,17 +137,14 @@ function TabNavDropdown({ tabs, label = "Navigation" }) {
|
|
|
122
137
|
if (open) {
|
|
123
138
|
closeMenu();
|
|
124
139
|
} else {
|
|
125
|
-
openMenu(currentIndex
|
|
140
|
+
openMenu(Math.max(currentIndex, 0));
|
|
126
141
|
}
|
|
127
142
|
}, [open, closeMenu, openMenu, currentIndex]);
|
|
128
|
-
const handleBlur = useCallback(
|
|
129
|
-
(e)
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
},
|
|
134
|
-
[]
|
|
135
|
-
);
|
|
143
|
+
const handleBlur = useCallback((e) => {
|
|
144
|
+
if (!containerRef.current?.contains(e.relatedTarget)) {
|
|
145
|
+
setOpen(false);
|
|
146
|
+
}
|
|
147
|
+
}, []);
|
|
136
148
|
return /* @__PURE__ */ jsxs("nav", { "aria-label": label, className: "relative", ref: containerRef, children: [
|
|
137
149
|
/* @__PURE__ */ jsxs(
|
|
138
150
|
"button",
|
|
@@ -5,7 +5,7 @@ interface TabsProps {
|
|
|
5
5
|
defaultValue?: string;
|
|
6
6
|
children: ReactNode;
|
|
7
7
|
}
|
|
8
|
-
declare function Tabs({ items, defaultValue, children }: TabsProps): JSX.Element;
|
|
8
|
+
declare function Tabs({ items, defaultValue, children, }: TabsProps): JSX.Element;
|
|
9
9
|
interface TabProps {
|
|
10
10
|
value: string;
|
|
11
11
|
children: ReactNode;
|
package/dist/components/tabs.js
CHANGED
|
@@ -4,7 +4,11 @@ import { createContext, useState, useId, useRef, useCallback, useContext } from
|
|
|
4
4
|
import { getNextIndex } from '../hooks/arrownav';
|
|
5
5
|
|
|
6
6
|
const TabsContext = createContext(null);
|
|
7
|
-
function Tabs({
|
|
7
|
+
function Tabs({
|
|
8
|
+
items,
|
|
9
|
+
defaultValue,
|
|
10
|
+
children
|
|
11
|
+
}) {
|
|
8
12
|
const [active, setActive] = useState(defaultValue ?? items[0] ?? "");
|
|
9
13
|
const id = useId();
|
|
10
14
|
const tabsRef = useRef(null);
|
|
@@ -37,7 +41,9 @@ function Tabs({ items, defaultValue, children }) {
|
|
|
37
41
|
direction: "horizontal",
|
|
38
42
|
wrap: true
|
|
39
43
|
});
|
|
40
|
-
if (nextIndex === currentIndex)
|
|
44
|
+
if (nextIndex === currentIndex) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
41
47
|
e.preventDefault();
|
|
42
48
|
const nextItem = items[nextIndex];
|
|
43
49
|
if (nextItem !== void 0) {
|
|
@@ -48,48 +54,58 @@ function Tabs({ items, defaultValue, children }) {
|
|
|
48
54
|
},
|
|
49
55
|
[active, items]
|
|
50
56
|
);
|
|
51
|
-
return /* @__PURE__ */ jsx(
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
{
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
className: "flex border-b border-line",
|
|
59
|
-
children: items.map((item) => /* @__PURE__ */ jsx(
|
|
60
|
-
"button",
|
|
57
|
+
return /* @__PURE__ */ jsx(
|
|
58
|
+
TabsContext.Provider,
|
|
59
|
+
{
|
|
60
|
+
value: { active, getPanelId, getTabId, id, setActive },
|
|
61
|
+
children: /* @__PURE__ */ jsxs("div", { className: "my-6", children: [
|
|
62
|
+
/* @__PURE__ */ jsx(
|
|
63
|
+
"div",
|
|
61
64
|
{
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
65
|
+
ref: tabsRef,
|
|
66
|
+
role: "tablist",
|
|
67
|
+
onKeyDown: handleKeyDown,
|
|
68
|
+
className: "flex border-b border-line",
|
|
69
|
+
children: items.map((item) => /* @__PURE__ */ jsx(
|
|
70
|
+
"button",
|
|
71
|
+
{
|
|
72
|
+
id: getTabId(item),
|
|
73
|
+
type: "button",
|
|
74
|
+
role: "tab",
|
|
75
|
+
"aria-selected": active === item,
|
|
76
|
+
"aria-controls": getPanelId(item),
|
|
77
|
+
tabIndex: active === item ? 0 : -1,
|
|
78
|
+
onClick: () => setActive(item),
|
|
79
|
+
className: `px-4 py-2 text-sm font-medium transition-colors border-b -mb-px ${active === item ? "text-fg border-fg" : "text-muted hover:text-fg border-transparent"}`,
|
|
80
|
+
children: item
|
|
81
|
+
},
|
|
82
|
+
item
|
|
83
|
+
))
|
|
84
|
+
}
|
|
85
|
+
),
|
|
86
|
+
/* @__PURE__ */ jsx(
|
|
87
|
+
"div",
|
|
88
|
+
{
|
|
89
|
+
id: getPanelId(active),
|
|
90
|
+
role: "tabpanel",
|
|
91
|
+
"aria-labelledby": getTabId(active),
|
|
92
|
+
tabIndex: 0,
|
|
93
|
+
className: "pt-4",
|
|
94
|
+
children
|
|
95
|
+
}
|
|
96
|
+
)
|
|
97
|
+
] })
|
|
98
|
+
}
|
|
99
|
+
);
|
|
88
100
|
}
|
|
89
101
|
function Tab({ value, children }) {
|
|
90
102
|
const context = useContext(TabsContext);
|
|
91
|
-
if (!context)
|
|
92
|
-
|
|
103
|
+
if (!context) {
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
if (context.active !== value) {
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
93
109
|
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
94
110
|
}
|
|
95
111
|
|
package/dist/components/tag.js
CHANGED
|
@@ -3,13 +3,18 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
3
3
|
import { memo } from 'react';
|
|
4
4
|
|
|
5
5
|
const styles = {
|
|
6
|
+
danger: "bg-red-500/10 border-red-500/20 text-red-400",
|
|
6
7
|
default: "bg-surface border-line text-muted",
|
|
7
8
|
primary: "bg-accent/10 border-accent/20 text-accent",
|
|
8
9
|
success: "bg-emerald-500/10 border-emerald-500/20 text-emerald-400",
|
|
9
|
-
warning: "bg-amber-500/10 border-amber-500/20 text-amber-400"
|
|
10
|
-
danger: "bg-red-500/10 border-red-500/20 text-red-400"
|
|
10
|
+
warning: "bg-amber-500/10 border-amber-500/20 text-amber-400"
|
|
11
11
|
};
|
|
12
|
-
function TagBase({
|
|
12
|
+
function TagBase({
|
|
13
|
+
variant = "default",
|
|
14
|
+
className,
|
|
15
|
+
children,
|
|
16
|
+
...props
|
|
17
|
+
}) {
|
|
13
18
|
return /* @__PURE__ */ jsx(
|
|
14
19
|
"span",
|
|
15
20
|
{
|
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { memo, useState, useRef, useCallback, useEffect } from 'react';
|
|
4
4
|
|
|
5
|
-
const Terminal = memo(function Terminal2({
|
|
5
|
+
const Terminal = memo(function Terminal2({
|
|
6
|
+
title = "Terminal",
|
|
7
|
+
children
|
|
8
|
+
}) {
|
|
6
9
|
return /* @__PURE__ */ jsxs("div", { className: "my-6 rounded-xl border border-line overflow-hidden", children: [
|
|
7
10
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 px-4 py-2.5 bg-[#0a0a0a] border-b border-line", children: [
|
|
8
11
|
/* @__PURE__ */ jsxs("div", { className: "flex gap-1.5", "aria-hidden": "true", children: [
|
|
@@ -15,13 +18,18 @@ const Terminal = memo(function Terminal2({ title = "Terminal", children }) {
|
|
|
15
18
|
/* @__PURE__ */ jsx("div", { className: "p-4 bg-[#0a0a0a] font-mono text-sm", children })
|
|
16
19
|
] });
|
|
17
20
|
});
|
|
18
|
-
const Line = memo(function Line2({
|
|
21
|
+
const Line = memo(function Line2({
|
|
22
|
+
prompt = "$",
|
|
23
|
+
children
|
|
24
|
+
}) {
|
|
19
25
|
return /* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
|
|
20
26
|
/* @__PURE__ */ jsx("span", { className: "text-emerald-400 select-none shrink-0", children: prompt }),
|
|
21
27
|
/* @__PURE__ */ jsx("span", { className: "text-zinc-300", children })
|
|
22
28
|
] });
|
|
23
29
|
});
|
|
24
|
-
const Output = memo(function Output2({
|
|
30
|
+
const Output = memo(function Output2({
|
|
31
|
+
children
|
|
32
|
+
}) {
|
|
25
33
|
return /* @__PURE__ */ jsx("div", { className: "text-zinc-500 pl-5", children });
|
|
26
34
|
});
|
|
27
35
|
const caretStyle = {
|
|
@@ -48,7 +56,9 @@ function Typed({ text, speed = 50 }) {
|
|
|
48
56
|
reset();
|
|
49
57
|
}, [text, reset]);
|
|
50
58
|
useEffect(() => {
|
|
51
|
-
if (done)
|
|
59
|
+
if (done) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
52
62
|
const interval = setInterval(tick, speed);
|
|
53
63
|
return () => clearInterval(interval);
|
|
54
64
|
}, [text, speed, done, tick]);
|
|
@@ -9,92 +9,106 @@ const variants = {
|
|
|
9
9
|
error: "border-red-500/50 bg-red-500/5 text-fg placeholder:text-muted focus:border-red-500"
|
|
10
10
|
};
|
|
11
11
|
const sizes = {
|
|
12
|
-
|
|
12
|
+
lg: "px-4 py-3 text-base min-h-[100px]",
|
|
13
13
|
md: "px-3 py-2 text-sm min-h-[80px]",
|
|
14
|
-
|
|
14
|
+
sm: "px-2.5 py-1.5 text-xs min-h-[60px]"
|
|
15
15
|
};
|
|
16
|
-
const Textarea = memo(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}, [autoresize]);
|
|
51
|
-
useEffect(() => {
|
|
52
|
-
resize();
|
|
53
|
-
}, [resize, value]);
|
|
54
|
-
const handleChange = (e) => {
|
|
55
|
-
setCharCount(e.target.value.length);
|
|
56
|
-
if (autoresize) resize();
|
|
57
|
-
onChange?.(e);
|
|
58
|
-
};
|
|
59
|
-
const setRefs = useCallback(
|
|
60
|
-
(node) => {
|
|
61
|
-
internalRef.current = node;
|
|
62
|
-
if (typeof ref === "function") {
|
|
63
|
-
ref(node);
|
|
64
|
-
} else if (ref) {
|
|
65
|
-
ref.current = node;
|
|
16
|
+
const Textarea = memo(
|
|
17
|
+
forwardRef(function Textarea2({
|
|
18
|
+
variant = "default",
|
|
19
|
+
size = "md",
|
|
20
|
+
label,
|
|
21
|
+
error,
|
|
22
|
+
hint,
|
|
23
|
+
autoresize = false,
|
|
24
|
+
showCount = false,
|
|
25
|
+
tooltip,
|
|
26
|
+
maxLength,
|
|
27
|
+
className = "",
|
|
28
|
+
id,
|
|
29
|
+
value,
|
|
30
|
+
defaultValue,
|
|
31
|
+
onChange,
|
|
32
|
+
...props
|
|
33
|
+
}, ref) {
|
|
34
|
+
const generatedId = useId();
|
|
35
|
+
const textareaId = id || generatedId;
|
|
36
|
+
const errorId = error ? `${textareaId}-error` : void 0;
|
|
37
|
+
const hintId = hint && !error ? `${textareaId}-hint` : void 0;
|
|
38
|
+
const countId = showCount ? `${textareaId}-count` : void 0;
|
|
39
|
+
const describedBy = [errorId, hintId, countId].filter(Boolean).join(" ") || void 0;
|
|
40
|
+
const actualVariant = error ? "error" : variant;
|
|
41
|
+
const internalRef = useRef(null);
|
|
42
|
+
const [charCount, setCharCount] = useState(() => {
|
|
43
|
+
const initial = value ?? defaultValue ?? "";
|
|
44
|
+
return typeof initial === "string" ? initial.length : 0;
|
|
45
|
+
});
|
|
46
|
+
const resize = useCallback(() => {
|
|
47
|
+
const textarea = internalRef.current;
|
|
48
|
+
if (!textarea || !autoresize) {
|
|
49
|
+
return;
|
|
66
50
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
"aria-invalid": actualVariant === "error" ? true : void 0,
|
|
78
|
-
"aria-describedby": describedBy,
|
|
79
|
-
maxLength,
|
|
80
|
-
value,
|
|
81
|
-
defaultValue,
|
|
82
|
-
onChange: handleChange,
|
|
83
|
-
className: `rounded-md border outline-none transition-colors resize-vertical ${variants[actualVariant]} ${sizes[size]} ${autoresize ? "resize-none overflow-hidden" : ""} ${className}`.trim(),
|
|
84
|
-
...props
|
|
51
|
+
textarea.style.height = "auto";
|
|
52
|
+
textarea.style.height = `${textarea.scrollHeight}px`;
|
|
53
|
+
}, [autoresize]);
|
|
54
|
+
useEffect(() => {
|
|
55
|
+
resize();
|
|
56
|
+
}, [resize, value]);
|
|
57
|
+
const handleChange = (e) => {
|
|
58
|
+
setCharCount(e.target.value.length);
|
|
59
|
+
if (autoresize) {
|
|
60
|
+
resize();
|
|
85
61
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
62
|
+
onChange?.(e);
|
|
63
|
+
};
|
|
64
|
+
const setRefs = useCallback(
|
|
65
|
+
(node) => {
|
|
66
|
+
internalRef.current = node;
|
|
67
|
+
if (typeof ref === "function") {
|
|
68
|
+
ref(node);
|
|
69
|
+
} else if (ref) {
|
|
70
|
+
ref.current = node;
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
[ref]
|
|
74
|
+
);
|
|
75
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5", children: [
|
|
76
|
+
label && /* @__PURE__ */ jsx(FormLabel, { label, tooltip, htmlFor: textareaId }),
|
|
77
|
+
/* @__PURE__ */ jsx(
|
|
78
|
+
"textarea",
|
|
79
|
+
{
|
|
80
|
+
ref: setRefs,
|
|
81
|
+
id: textareaId,
|
|
82
|
+
"aria-invalid": actualVariant === "error" ? true : void 0,
|
|
83
|
+
"aria-describedby": describedBy,
|
|
84
|
+
maxLength,
|
|
85
|
+
value,
|
|
86
|
+
defaultValue,
|
|
87
|
+
onChange: handleChange,
|
|
88
|
+
className: `rounded-md border outline-none transition-colors resize-vertical ${variants[actualVariant]} ${sizes[size]} ${autoresize ? "resize-none overflow-hidden" : ""} ${className}`.trim(),
|
|
89
|
+
...props
|
|
90
|
+
}
|
|
91
|
+
),
|
|
92
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-between gap-2", children: [
|
|
93
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1", children: [
|
|
94
|
+
error && /* @__PURE__ */ jsx(ErrorMessage, { id: errorId, children: error }),
|
|
95
|
+
hint && !error && /* @__PURE__ */ jsx("span", { id: hintId, className: "text-xs text-muted", children: hint })
|
|
96
|
+
] }),
|
|
97
|
+
showCount && /* @__PURE__ */ jsxs(
|
|
98
|
+
"span",
|
|
99
|
+
{
|
|
100
|
+
id: countId,
|
|
101
|
+
className: "text-xs text-muted",
|
|
102
|
+
"aria-live": "polite",
|
|
103
|
+
children: [
|
|
104
|
+
charCount,
|
|
105
|
+
maxLength ? `/${maxLength}` : ""
|
|
106
|
+
]
|
|
107
|
+
}
|
|
108
|
+
)
|
|
95
109
|
] })
|
|
96
|
-
] })
|
|
97
|
-
|
|
98
|
-
|
|
110
|
+
] });
|
|
111
|
+
})
|
|
112
|
+
);
|
|
99
113
|
|
|
100
114
|
export { Textarea };
|
|
@@ -5,7 +5,7 @@ type Theme = "light" | "dark" | "system";
|
|
|
5
5
|
interface ThemeToggleProps {
|
|
6
6
|
defaultTheme?: Theme;
|
|
7
7
|
}
|
|
8
|
-
declare function ThemeToggleBase({ defaultTheme }: ThemeToggleProps): JSX.Element;
|
|
8
|
+
declare function ThemeToggleBase({ defaultTheme, }: ThemeToggleProps): JSX.Element;
|
|
9
9
|
declare const ThemeToggle: react.MemoExoticComponent<typeof ThemeToggleBase>;
|
|
10
10
|
|
|
11
11
|
export { type Theme, ThemeToggle, type ThemeToggleProps };
|