@publish.os/nextjs 0.0.1-alpha.6 → 0.0.1-alpha.8
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/README.md +3 -5
- package/compiler-assets/nextjs/defaults/app/globals.css +6 -0
- package/compiler-assets/nextjs/defaults/group/layout.tsx +23 -0
- package/compiler-assets/nextjs/defaults/group/leaf.tsx +48 -0
- package/compiler-assets/nextjs/defaults/group/page.tsx +50 -0
- package/compiler-assets/nextjs/defaults/project/next.config.mjs +45 -0
- package/compiler-assets/nextjs/defaults/project/postcss.config.mjs +5 -0
- package/compiler-assets/nextjs/defaults/project/tsconfig.json.template +41 -0
- package/compiler-assets/nextjs/defaults/root/css/animation.css +90 -0
- package/compiler-assets/nextjs/defaults/root/css/components/dialog.css +21 -0
- package/compiler-assets/nextjs/defaults/root/css/components/drawer.css +21 -0
- package/compiler-assets/nextjs/defaults/root/css/components/menu.css +23 -0
- package/compiler-assets/nextjs/defaults/root/css/components/navigation-menu.css +25 -0
- package/compiler-assets/nextjs/defaults/root/css/components/popover.css +17 -0
- package/compiler-assets/nextjs/defaults/root/css/components/select.css +23 -0
- package/compiler-assets/nextjs/defaults/root/css/components/toast.css +19 -0
- package/compiler-assets/nextjs/defaults/root/css/components/tooltip.css +15 -0
- package/compiler-assets/nextjs/defaults/root/css/layout.css +22 -0
- package/compiler-assets/nextjs/defaults/root/css/media.css +81 -0
- package/compiler-assets/nextjs/defaults/root/css/radius.css +49 -0
- package/compiler-assets/nextjs/defaults/root/css/scrollbar.css +43 -0
- package/compiler-assets/nextjs/defaults/root/css/shadow.css +145 -0
- package/compiler-assets/nextjs/defaults/root/css/typography.css +607 -0
- package/compiler-assets/nextjs/defaults/root/css/zindex.css +39 -0
- package/compiler-assets/nextjs/defaults/root/globals.css +191 -0
- package/compiler-assets/nextjs/defaults/root/layout.tsx +19 -0
- package/compiler-assets/nextjs/defaults/root/page.tsx +61 -0
- package/compiler-assets/nextjs/defaults/root/theme.css +50 -0
- package/compiler-assets/nextjs/defaults/source/_internal/logger.ts +21 -0
- package/compiler-assets/nextjs/shims/generated-group-layout.tsx +19 -0
- package/compiler-assets/nextjs/shims/generated-group-page.tsx +18 -0
- package/compiler-assets/nextjs/shims/generated-leaf-page.tsx +21 -0
- package/compiler-assets/nextjs/shims/global-layout.tsx +134 -0
- package/compiler-assets/nextjs/shims/markdown-route.ts +29 -0
- package/compiler-assets/nextjs/shims/og-image-route.ts +18 -0
- package/compiler-assets/nextjs/shims/powered-by-footer.tsx +40 -0
- package/compiler-assets/nextjs/shims/providers.tsx +13 -0
- package/compiler-assets/nextjs/shims/proxy.ts +317 -0
- package/compiler-assets/nextjs/shims/publish-os-theme-provider.tsx +77 -0
- package/compiler-assets/nextjs/shims/root-page.tsx +13 -0
- package/compiler-assets/nextjs/shims/theme-defaults.css +177 -0
- package/dist/button-CFdx-ohV.d.ts +20 -0
- package/dist/cache/tags.js +6 -14
- package/dist/compiler.d.ts +100 -0
- package/dist/compiler.js +13379 -0
- package/dist/config/createNextConfig.d.ts +2 -1
- package/dist/config/createNextConfig.js +16 -12
- package/dist/icons.d.ts +1 -0
- package/dist/icons.js +2 -0
- package/dist/index.d.ts +303 -15
- package/dist/index.js +30 -1198
- package/dist/kernel/components/blocks/AgentActions.d.ts +9 -3
- package/dist/kernel/components/blocks/AgentActions.js +114 -200
- package/dist/kernel/components/blocks/animated-icon-swap.js +4 -25
- package/dist/kernel/components/blocks/color-palette.js +88 -169
- package/dist/kernel/components/blocks/design-system-preview.d.ts +38 -6
- package/dist/kernel/components/blocks/design-system-preview.js +44 -52
- package/dist/kernel/components/blocks/link-playground.js +23 -71
- package/dist/kernel/components/blocks/logo-block.js +18 -47
- package/dist/kernel/components/blocks/nav-breadcrumb.d.ts +1 -1
- package/dist/kernel/components/blocks/nav-breadcrumb.js +28 -42
- package/dist/kernel/components/blocks/navbar.d.ts +1 -1
- package/dist/kernel/components/blocks/navbar.js +14 -41
- package/dist/kernel/components/blocks/navigation-progress-playground.js +56 -149
- package/dist/kernel/components/blocks/navigation-progress.js +53 -157
- package/dist/kernel/components/blocks/next-prev.d.ts +1 -1
- package/dist/kernel/components/blocks/next-prev.js +16 -42
- package/dist/kernel/components/blocks/page-list.d.ts +1 -1
- package/dist/kernel/components/blocks/page-list.js +11 -16
- package/dist/kernel/components/blocks/search.d.ts +13 -2
- package/dist/kernel/components/blocks/search.js +116 -247
- package/dist/kernel/components/blocks/sidebar-node.d.ts +2 -2
- package/dist/kernel/components/blocks/sidebar-node.js +56 -95
- package/dist/kernel/components/blocks/sidebar.d.ts +5 -23
- package/dist/kernel/components/blocks/sidebar.js +35 -103
- package/dist/kernel/components/blocks/theme-toggle.d.ts +7 -3
- package/dist/kernel/components/blocks/theme-toggle.js +2 -2
- package/dist/kernel/components/blocks/toc.js +42 -178
- package/dist/kernel/components/mdx/components/blockquote.js +3 -24
- package/dist/kernel/components/mdx/components/callout.d.ts +1 -1
- package/dist/kernel/components/mdx/components/callout.js +15 -47
- package/dist/kernel/components/mdx/components/code-block.js +2 -2
- package/dist/kernel/components/mdx/components/figure-caption.js +6 -24
- package/dist/kernel/components/mdx/components/figure.js +9 -36
- package/dist/kernel/components/mdx/components/footnotes.js +3 -24
- package/dist/kernel/components/mdx/components/heading-copy-link.js +13 -37
- package/dist/kernel/components/mdx/components/heading.d.ts +8 -3
- package/dist/kernel/components/mdx/components/heading.js +32 -116
- package/dist/kernel/components/mdx/components/hr.d.ts +5 -3
- package/dist/kernel/components/mdx/components/hr.js +2 -2
- package/dist/kernel/components/mdx/components/image-zoom.js +2 -3
- package/dist/kernel/components/mdx/components/image.js +22 -62
- package/dist/kernel/components/mdx/components/inline-code.js +3 -24
- package/dist/kernel/components/mdx/components/kbd.d.ts +9 -4
- package/dist/kernel/components/mdx/components/kbd.js +2 -2
- package/dist/kernel/components/mdx/components/link.d.ts +1 -2
- package/dist/kernel/components/mdx/components/link.js +2 -2
- package/dist/kernel/components/mdx/components/paragraph.js +13 -41
- package/dist/kernel/components/mdx/components/pre.js +3 -24
- package/dist/kernel/components/mdx/components/strikethrough.js +6 -24
- package/dist/kernel/components/mdx/components/table.js +2 -2
- package/dist/kernel/components/mdx/components/task-list.js +6 -28
- package/dist/kernel/components/mdx/components/video-player.js +53 -88
- package/dist/kernel/components/mdx/components/video.js +27 -75
- package/dist/kernel/components/mdx/error-boundary.d.ts +1 -1
- package/dist/kernel/components/mdx/error-boundary.js +12 -15
- package/dist/kernel/components/mdx/error-fallback.js +4 -4
- package/dist/kernel/components/mdx/mdx.d.ts +68 -11
- package/dist/kernel/components/mdx/mdx.js +29 -29
- package/dist/kernel/components/mdx/rehype-heading-ids.js +11 -67
- package/dist/kernel/components/mdx/types.d.ts +1 -1
- package/dist/kernel/components/ui/accordion.js +3 -26
- package/dist/kernel/components/ui/breadcrumb-trail.d.ts +23 -7
- package/dist/kernel/components/ui/breadcrumb-trail.js +32 -80
- package/dist/kernel/components/ui/breadcrumb.d.ts +1 -1
- package/dist/kernel/components/ui/breadcrumb.js +20 -54
- package/dist/kernel/components/ui/button-group.d.ts +4 -3
- package/dist/kernel/components/ui/button-group.js +7 -30
- package/dist/kernel/components/ui/button.js +13 -36
- package/dist/kernel/components/ui/card.d.ts +1 -1
- package/dist/kernel/components/ui/card.js +2 -23
- package/dist/kernel/components/ui/dialog.d.ts +9 -9
- package/dist/kernel/components/ui/dialog.js +15 -33
- package/dist/kernel/components/ui/drawer.d.ts +10 -10
- package/dist/kernel/components/ui/drawer.js +15 -33
- package/dist/kernel/components/ui/input.js +6 -30
- package/dist/kernel/components/ui/kbd.js +10 -31
- package/dist/kernel/components/ui/link.d.ts +1 -1
- package/dist/kernel/components/ui/link.js +53 -104
- package/dist/kernel/components/ui/menu.d.ts +21 -21
- package/dist/kernel/components/ui/menu.js +10 -32
- package/dist/kernel/components/ui/meta-key.d.ts +9 -4
- package/dist/kernel/components/ui/meta-key.js +2 -2
- package/dist/kernel/components/ui/navigation-menu.d.ts +14 -14
- package/dist/kernel/components/ui/navigation-menu.js +9 -30
- package/dist/kernel/components/ui/popover.d.ts +10 -10
- package/dist/kernel/components/ui/popover.js +19 -34
- package/dist/kernel/components/ui/progress.js +2 -25
- package/dist/kernel/components/ui/scroll-area.js +39 -118
- package/dist/kernel/components/ui/select.d.ts +15 -15
- package/dist/kernel/components/ui/select.js +19 -35
- package/dist/kernel/components/ui/separator.js +2 -25
- package/dist/kernel/components/ui/table.js +2 -23
- package/dist/kernel/components/ui/tabs.js +39 -99
- package/dist/kernel/components/ui/tag.d.ts +2 -2
- package/dist/kernel/components/ui/tag.js +4 -25
- package/dist/kernel/components/ui/text.d.ts +2 -2
- package/dist/kernel/components/ui/text.js +3 -25
- package/dist/kernel/components/ui/theme-toggle.d.ts +18 -4
- package/dist/kernel/components/ui/theme-toggle.js +18 -44
- package/dist/kernel/components/ui/toast.d.ts +10 -10
- package/dist/kernel/components/ui/toast.js +13 -35
- package/dist/kernel/components/ui/tooltip.d.ts +8 -8
- package/dist/kernel/components/ui/tooltip.js +8 -29
- package/dist/kernel/defaults.registry.d.ts +1 -1
- package/dist/kernel/defaults.registry.js +2 -2
- package/dist/kernel/framework-icons.d.ts +1 -0
- package/dist/kernel/framework-icons.js +39 -0
- package/dist/kernel/routes/agent/markdown.js +36 -65
- package/dist/kernel/routes/layouts/group.d.ts +1 -1
- package/dist/kernel/routes/layouts/group.js +20 -109
- package/dist/kernel/routes/metadata/feed.d.ts +1 -2
- package/dist/kernel/routes/metadata/feed.js +46 -127
- package/dist/kernel/routes/metadata/llms.d.ts +1 -2
- package/dist/kernel/routes/metadata/llms.js +40 -120
- package/dist/kernel/routes/metadata/og-image.d.ts +10 -0
- package/dist/kernel/routes/metadata/og-image.js +264 -198
- package/dist/kernel/routes/metadata/robots.d.ts +1 -2
- package/dist/kernel/routes/metadata/robots.js +21 -90
- package/dist/kernel/routes/metadata/sitemap.d.ts +1 -2
- package/dist/kernel/routes/metadata/sitemap.js +36 -102
- package/dist/kernel/routes/pages/group.d.ts +1 -1
- package/dist/kernel/routes/pages/group.js +42 -137
- package/dist/kernel/routes/pages/leaf.d.ts +1 -1
- package/dist/kernel/routes/pages/leaf.js +74 -213
- package/dist/kernel/routes/pages/root.d.ts +1 -1
- package/dist/kernel/routes/pages/root.js +37 -108
- package/dist/keyboard-shortcuts.js +69 -141
- package/dist/link-CYaCRDb6.d.ts +35 -0
- package/dist/resolvers/manifest-resolver.d.ts +3 -3
- package/dist/resolvers/manifest-resolver.js +15 -21
- package/dist/route-metadata-og-image-BeKKFHg7.d.ts +58 -0
- package/dist/search.d.ts +81 -4
- package/dist/search.js +124 -195
- package/dist/sidebar-types-Bgchdfd6.d.ts +25 -0
- package/dist/theme-scope.d.ts +15 -0
- package/dist/theme-scope.js +23 -0
- package/dist/types-B_b3C0U6.d.ts +63 -0
- package/dist/types-CIwwieNw.d.ts +127 -0
- package/dist/types-DHBm7-j6.d.ts +57 -0
- package/dist/types-sM2g9nW0.d.ts +12 -0
- package/dist/types.d.ts +0 -1
- package/dist/types.js +1 -1
- package/dist/utils/cn.d.ts +5 -9
- package/dist/utils/cn.js +13 -7
- package/dist/utils/heading-ids.js +20 -47
- package/dist/utils/pretty-date.js +7 -13
- package/init/seed/minimal/publish.os/assets/logo/publish-dev-logo.dark.png +0 -0
- package/init/seed/minimal/publish.os/assets/logo/publish-dev-logo.png +0 -0
- package/init/seed/minimal/publish.os/docs/content/get-started.mdx +54 -0
- package/init/seed/minimal/publish.os/docs/content/groups.mdx +31 -0
- package/init/seed/minimal/publish.os/docs/content/theme.mdx +64 -0
- package/init/seed/minimal/publish.os/publish.os.config.json +21 -0
- package/init/seed/minimal/publish.os/theme.css +47 -0
- package/init/seed/minimal/seed.json +13 -0
- package/package.json +469 -35
- package/release/{package.json → app/lucide/package.json} +11 -5
- package/release/app/lucide/pnpm-lock.yaml.template +2905 -0
- package/release/app/lucide/pnpm-workspace.yaml +11 -0
- package/release/app/phosphor/package.json +30 -0
- package/release/app/phosphor/pnpm-lock.yaml.template +2908 -0
- package/release/app/phosphor/pnpm-workspace.yaml +11 -0
- package/release/app/tabler/package.json +30 -0
- package/release/app/tabler/pnpm-lock.yaml.template +2911 -0
- package/release/app/tabler/pnpm-workspace.yaml +11 -0
- package/release/compiler/package.json +20 -0
- package/release/compiler/pnpm-lock.yaml.template +2432 -0
- package/release/compiler/pnpm-workspace.yaml +11 -0
- package/release/release.json +29 -5
- package/release/runtime-pnpm-lock.yaml +0 -1316
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { LogoBlockLogo, LogoBlockAsset } from './logo-block.js';
|
|
3
|
-
import { SiteData, TreeNode } from '
|
|
3
|
+
import { S as SiteData, T as TreeNode } from '../../../types-B_b3C0U6.js';
|
|
4
4
|
|
|
5
5
|
type NavbarProps = {
|
|
6
6
|
logo?: NavbarLogo;
|
|
@@ -1,58 +1,32 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
// src/
|
|
3
|
+
// src/components/block/navigation/navbar.tsx
|
|
4
4
|
import {
|
|
5
5
|
LogoBlock
|
|
6
|
-
} from "
|
|
7
|
-
import { NavBreadcrumb } from "
|
|
8
|
-
import { Search } from "
|
|
9
|
-
import { ThemeToggle } from "
|
|
10
|
-
import { Link } from "
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
import { clsx } from "clsx";
|
|
14
|
-
import { extendTailwindMerge } from "tailwind-merge";
|
|
15
|
-
var twMerge = extendTailwindMerge({
|
|
16
|
-
extend: {
|
|
17
|
-
classGroups: {
|
|
18
|
-
z: [
|
|
19
|
-
"z-content",
|
|
20
|
-
"z-nav",
|
|
21
|
-
"z-overlay",
|
|
22
|
-
"z-modal",
|
|
23
|
-
"z-search",
|
|
24
|
-
"z-toast",
|
|
25
|
-
"z-progress"
|
|
26
|
-
]
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
function cn(...inputs) {
|
|
31
|
-
return twMerge(clsx(inputs));
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// src/kernel/components/blocks/navbar.tsx
|
|
35
|
-
import { ArrowRight } from "lucide-react";
|
|
6
|
+
} from "@publish.os/nextjs/kernel/components/blocks/logo-block";
|
|
7
|
+
import { NavBreadcrumb } from "@publish.os/nextjs/kernel/components/blocks/nav-breadcrumb";
|
|
8
|
+
import { Search } from "@publish.os/nextjs/kernel/components/blocks/search";
|
|
9
|
+
import { ThemeToggle } from "@publish.os/nextjs/kernel/components/blocks/theme-toggle";
|
|
10
|
+
import { Link } from "@publish.os/nextjs/kernel/components/ui/link";
|
|
11
|
+
import { FrameworkArrowRightIcon as ArrowRight } from "@publish.os/nextjs/kernel/framework-icons";
|
|
12
|
+
import { cn } from "@publish.os/nextjs/utils/cn";
|
|
36
13
|
import NextLink from "next/link";
|
|
37
14
|
import { usePathname } from "next/navigation";
|
|
38
15
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
39
16
|
function hasPath(node) {
|
|
40
|
-
return "path" in node && typeof node.path
|
|
17
|
+
return "path" in node && typeof node.path == "string";
|
|
41
18
|
}
|
|
42
19
|
function isTopLevelGroup(node) {
|
|
43
|
-
return node.type === "section" && typeof node.group
|
|
20
|
+
return node.type === "section" && typeof node.group == "string" && !node.group.includes("/");
|
|
44
21
|
}
|
|
45
22
|
function Navbar({
|
|
46
23
|
logo,
|
|
47
24
|
site,
|
|
48
25
|
siteTitle,
|
|
49
|
-
showThemeToggle =
|
|
26
|
+
showThemeToggle = !0,
|
|
50
27
|
tree
|
|
51
28
|
}) {
|
|
52
|
-
|
|
53
|
-
const headerSite = site ?? { name: siteTitle ?? "Site" };
|
|
54
|
-
const groups = tree.filter(hasPath).filter(isTopLevelGroup);
|
|
55
|
-
const activeGroupPath = groups.map((group) => group.path).filter((path) => pathname === path || pathname.startsWith(`${path}/`)).sort((a, b) => b.length - a.length)[0];
|
|
29
|
+
let pathname = usePathname() || "/", headerSite = site ?? { name: siteTitle ?? "Site" }, groups = tree.filter(hasPath).filter(isTopLevelGroup), activeGroupPath = groups.map((group) => group.path).filter((path) => pathname === path || pathname.startsWith(`${path}/`)).sort((a, b) => b.length - a.length)[0];
|
|
56
30
|
return /* @__PURE__ */ jsx("header", { className: "sticky top-0 z-nav border-b border-stroke-3 bg-surface-2 [anchor-name:--global-navbar]", children: /* @__PURE__ */ jsxs("div", { className: "mx-auto flex min-h-[var(--layout-global-nav-height)] w-full max-w-(--layout-site-max-width) flex-col gap-3 border-x border-stroke-3 px-5 py-3 md:flex-row md:items-center md:gap-4 md:py-2 lg:px-6", children: [
|
|
57
31
|
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 items-center gap-3", children: [
|
|
58
32
|
/* @__PURE__ */ jsx(
|
|
@@ -69,7 +43,7 @@ function Navbar({
|
|
|
69
43
|
NavBreadcrumb,
|
|
70
44
|
{
|
|
71
45
|
currentPath: pathname,
|
|
72
|
-
showRoot:
|
|
46
|
+
showRoot: !1,
|
|
73
47
|
site: headerSite,
|
|
74
48
|
tree
|
|
75
49
|
}
|
|
@@ -82,8 +56,7 @@ function Navbar({
|
|
|
82
56
|
"aria-label": "Groups",
|
|
83
57
|
className: "flex min-w-0 flex-wrap items-center gap-2 text-sm",
|
|
84
58
|
children: groups.map((group) => {
|
|
85
|
-
|
|
86
|
-
const active = path === activeGroupPath;
|
|
59
|
+
let path = group.path, active = path === activeGroupPath;
|
|
87
60
|
return /* @__PURE__ */ jsx(
|
|
88
61
|
Link,
|
|
89
62
|
{
|
|
@@ -1,37 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
// src/
|
|
4
|
-
import { Button } from "
|
|
3
|
+
// src/modules/design-system/navigation-progress-playground.tsx
|
|
4
|
+
import { Button } from "@publish.os/nextjs/kernel/components/ui/button";
|
|
5
5
|
import {
|
|
6
6
|
Progress,
|
|
7
7
|
ProgressIndicator,
|
|
8
8
|
ProgressTrack
|
|
9
|
-
} from "
|
|
10
|
-
import { Tabs, TabsList, TabsPanel, TabsTab } from "
|
|
11
|
-
|
|
12
|
-
// src/utils/cn.ts
|
|
13
|
-
import { clsx } from "clsx";
|
|
14
|
-
import { extendTailwindMerge } from "tailwind-merge";
|
|
15
|
-
var twMerge = extendTailwindMerge({
|
|
16
|
-
extend: {
|
|
17
|
-
classGroups: {
|
|
18
|
-
z: [
|
|
19
|
-
"z-content",
|
|
20
|
-
"z-nav",
|
|
21
|
-
"z-overlay",
|
|
22
|
-
"z-modal",
|
|
23
|
-
"z-search",
|
|
24
|
-
"z-toast",
|
|
25
|
-
"z-progress"
|
|
26
|
-
]
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
function cn(...inputs) {
|
|
31
|
-
return twMerge(clsx(inputs));
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// src/kernel/components/blocks/navigation-progress-playground.tsx
|
|
9
|
+
} from "@publish.os/nextjs/kernel/components/ui/progress";
|
|
10
|
+
import { Tabs, TabsList, TabsPanel, TabsTab } from "@publish.os/nextjs/kernel/components/ui/tabs";
|
|
11
|
+
import { cn } from "@publish.os/nextjs/utils/cn";
|
|
35
12
|
import {
|
|
36
13
|
useCallback,
|
|
37
14
|
useEffect,
|
|
@@ -59,8 +36,8 @@ var presets = {
|
|
|
59
36
|
transitionDuration: 320,
|
|
60
37
|
curvePower: 3,
|
|
61
38
|
height: 2,
|
|
62
|
-
fill: "var(--progress-
|
|
63
|
-
track: "var(--progress-
|
|
39
|
+
fill: "var(--progress-indicator-surface)",
|
|
40
|
+
track: "var(--progress-track-surface)",
|
|
64
41
|
progressEase: "cubic-bezier(0.21, 0.65, 0.35, 1)",
|
|
65
42
|
exitEase: "cubic-bezier(0.55, 0.06, 0.68, 0.19)",
|
|
66
43
|
transformOrigin: "left",
|
|
@@ -109,16 +86,15 @@ var presets = {
|
|
|
109
86
|
transitionDuration: 180,
|
|
110
87
|
curvePower: 2.6,
|
|
111
88
|
height: 2,
|
|
112
|
-
fill: "var(--progress-
|
|
113
|
-
track: "var(--progress-
|
|
89
|
+
fill: "var(--progress-indicator-surface)",
|
|
90
|
+
track: "var(--progress-track-surface)",
|
|
114
91
|
progressEase: "cubic-bezier(0.12, 0.72, 0, 1)",
|
|
115
92
|
exitEase: "cubic-bezier(0.2, 0, 0, 1)",
|
|
116
93
|
transformOrigin: "left",
|
|
117
94
|
exitTransformOrigin: "right"
|
|
118
95
|
}
|
|
119
96
|
}
|
|
120
|
-
};
|
|
121
|
-
var presetOrder = ["current", "aave", "tuned"];
|
|
97
|
+
}, presetOrder = ["current", "aave", "tuned"];
|
|
122
98
|
function clamp({
|
|
123
99
|
max,
|
|
124
100
|
min,
|
|
@@ -145,7 +121,7 @@ const sampleDuration =
|
|
|
145
121
|
:root {
|
|
146
122
|
--animation-ease-progress: ${settings.progressEase};
|
|
147
123
|
--animation-ease-progress-exit: ${settings.exitEase};
|
|
148
|
-
--progress-
|
|
124
|
+
--progress-height: ${settings.height}px;
|
|
149
125
|
}
|
|
150
126
|
|
|
151
127
|
/* NavigationProgress indicator */
|
|
@@ -157,12 +133,11 @@ style={{
|
|
|
157
133
|
}}
|
|
158
134
|
|
|
159
135
|
/* Theme tokens */
|
|
160
|
-
--progress-
|
|
161
|
-
--progress-
|
|
136
|
+
--progress-indicator-surface: ${settings.fill};
|
|
137
|
+
--progress-track-surface: ${settings.track};`;
|
|
162
138
|
}
|
|
163
139
|
function randomDuration({ max, min }) {
|
|
164
|
-
|
|
165
|
-
const upper = Math.max(min, max);
|
|
140
|
+
let lower = Math.min(min, max), upper = Math.max(min, max);
|
|
166
141
|
return Math.round(lower + Math.random() * (upper - lower));
|
|
167
142
|
}
|
|
168
143
|
function NumberControl({
|
|
@@ -174,8 +149,7 @@ function NumberControl({
|
|
|
174
149
|
unit,
|
|
175
150
|
value
|
|
176
151
|
}) {
|
|
177
|
-
|
|
178
|
-
const handleChange = (event) => {
|
|
152
|
+
let id = useId(), handleChange = (event) => {
|
|
179
153
|
onChange(Number(event.target.value));
|
|
180
154
|
};
|
|
181
155
|
return /* @__PURE__ */ jsxs("div", { className: "grid gap-2", children: [
|
|
@@ -197,7 +171,7 @@ function NumberControl({
|
|
|
197
171
|
/* @__PURE__ */ jsx(
|
|
198
172
|
"input",
|
|
199
173
|
{
|
|
200
|
-
className: "h-1 w-full accent-foreground-1",
|
|
174
|
+
className: "h-1 w-full accent-1-foreground-1",
|
|
201
175
|
id,
|
|
202
176
|
max,
|
|
203
177
|
min,
|
|
@@ -227,7 +201,7 @@ function TextControl({
|
|
|
227
201
|
onChange,
|
|
228
202
|
value
|
|
229
203
|
}) {
|
|
230
|
-
|
|
204
|
+
let id = useId();
|
|
231
205
|
return /* @__PURE__ */ jsxs(
|
|
232
206
|
"label",
|
|
233
207
|
{
|
|
@@ -241,7 +215,7 @@ function TextControl({
|
|
|
241
215
|
className: "h-8 rounded-button border border-stroke-2 bg-surface-1 px-2 font-mono text-xs text-foreground-1 outline-none focus:border-accent-1",
|
|
242
216
|
id,
|
|
243
217
|
onChange: (event) => onChange(event.target.value),
|
|
244
|
-
spellCheck:
|
|
218
|
+
spellCheck: !1,
|
|
245
219
|
value
|
|
246
220
|
}
|
|
247
221
|
)
|
|
@@ -285,9 +259,7 @@ function ProgressPreview({
|
|
|
285
259
|
progress,
|
|
286
260
|
settings
|
|
287
261
|
}) {
|
|
288
|
-
|
|
289
|
-
const boundedProgress = clamp({ max: 100, min: 0, value: progress });
|
|
290
|
-
const indicatorStyle = {
|
|
262
|
+
let isVisible = progress > 0, boundedProgress = clamp({ max: 100, min: 0, value: progress }), indicatorStyle = {
|
|
291
263
|
background: settings.fill,
|
|
292
264
|
transform: isExiting ? "scaleX(0)" : `scaleX(${boundedProgress / 100})`,
|
|
293
265
|
transformOrigin: isExiting ? settings.exitTransformOrigin : settings.transformOrigin,
|
|
@@ -321,125 +293,60 @@ function ProgressPreview({
|
|
|
321
293
|
);
|
|
322
294
|
}
|
|
323
295
|
function NavigationProgressPlayground() {
|
|
324
|
-
|
|
296
|
+
let [settings, setSettings] = useState(
|
|
325
297
|
presets.tuned.settings
|
|
326
|
-
)
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
const clearTimers = useCallback(() => {
|
|
340
|
-
if (animationFrame.current) cancelAnimationFrame(animationFrame.current);
|
|
341
|
-
if (completionTimer.current) clearTimeout(completionTimer.current);
|
|
342
|
-
if (settleTimer.current) clearTimeout(settleTimer.current);
|
|
343
|
-
if (exitTimer.current) clearTimeout(exitTimer.current);
|
|
344
|
-
animationFrame.current = null;
|
|
345
|
-
completionTimer.current = null;
|
|
346
|
-
settleTimer.current = null;
|
|
347
|
-
exitTimer.current = null;
|
|
348
|
-
}, []);
|
|
349
|
-
const resetSample = useCallback(() => {
|
|
350
|
-
clearTimers();
|
|
351
|
-
activeNavigation.current = false;
|
|
352
|
-
setProgress(0);
|
|
353
|
-
setIsExiting(false);
|
|
354
|
-
setIsRunning(false);
|
|
355
|
-
setSampleDuration(null);
|
|
356
|
-
}, [clearTimers]);
|
|
357
|
-
const completeSample = useCallback(() => {
|
|
358
|
-
if (!activeNavigation.current) return;
|
|
359
|
-
if (animationFrame.current) {
|
|
360
|
-
cancelAnimationFrame(animationFrame.current);
|
|
361
|
-
animationFrame.current = null;
|
|
362
|
-
}
|
|
363
|
-
if (completionTimer.current) {
|
|
364
|
-
clearTimeout(completionTimer.current);
|
|
365
|
-
completionTimer.current = null;
|
|
366
|
-
}
|
|
367
|
-
setProgress(100);
|
|
368
|
-
settleTimer.current = setTimeout(() => {
|
|
369
|
-
if (!activeNavigation.current) return;
|
|
370
|
-
setIsExiting(true);
|
|
371
|
-
exitTimer.current = setTimeout(() => {
|
|
372
|
-
setProgress(0);
|
|
373
|
-
setIsExiting(false);
|
|
374
|
-
setIsRunning(false);
|
|
375
|
-
activeNavigation.current = false;
|
|
376
|
-
exitTimer.current = null;
|
|
377
|
-
}, settings.exitDuration);
|
|
378
|
-
}, settings.settleDelay);
|
|
379
|
-
}, [settings.exitDuration, settings.settleDelay]);
|
|
380
|
-
const startSample = useCallback(() => {
|
|
381
|
-
resetSample();
|
|
382
|
-
activeNavigation.current = true;
|
|
383
|
-
setIsRunning(true);
|
|
384
|
-
setIsExiting(false);
|
|
385
|
-
setProgress(settings.initialProgress);
|
|
386
|
-
const startTime = performance.now();
|
|
387
|
-
const routeDuration = randomDuration({
|
|
298
|
+
), [activePreset, setActivePreset] = useState("tuned"), [progress, setProgress] = useState(0), [isExiting, setIsExiting] = useState(!1), [isRunning, setIsRunning] = useState(!1), [copyState, setCopyState] = useState("idle"), [sampleDuration, setSampleDuration] = useState(null), animationFrame = useRef(null), completionTimer = useRef(null), settleTimer = useRef(null), exitTimer = useRef(null), activeNavigation = useRef(!1), output = useMemo(() => buildOutput(settings), [settings]), clearTimers = useCallback(() => {
|
|
299
|
+
animationFrame.current && cancelAnimationFrame(animationFrame.current), completionTimer.current && clearTimeout(completionTimer.current), settleTimer.current && clearTimeout(settleTimer.current), exitTimer.current && clearTimeout(exitTimer.current), animationFrame.current = null, completionTimer.current = null, settleTimer.current = null, exitTimer.current = null;
|
|
300
|
+
}, []), resetSample = useCallback(() => {
|
|
301
|
+
clearTimers(), activeNavigation.current = !1, setProgress(0), setIsExiting(!1), setIsRunning(!1), setSampleDuration(null);
|
|
302
|
+
}, [clearTimers]), completeSample = useCallback(() => {
|
|
303
|
+
activeNavigation.current && (animationFrame.current && (cancelAnimationFrame(animationFrame.current), animationFrame.current = null), completionTimer.current && (clearTimeout(completionTimer.current), completionTimer.current = null), setProgress(100), settleTimer.current = setTimeout(() => {
|
|
304
|
+
activeNavigation.current && (setIsExiting(!0), exitTimer.current = setTimeout(() => {
|
|
305
|
+
setProgress(0), setIsExiting(!1), setIsRunning(!1), activeNavigation.current = !1, exitTimer.current = null;
|
|
306
|
+
}, settings.exitDuration));
|
|
307
|
+
}, settings.settleDelay));
|
|
308
|
+
}, [settings.exitDuration, settings.settleDelay]), startSample = useCallback(() => {
|
|
309
|
+
resetSample(), activeNavigation.current = !0, setIsRunning(!0), setIsExiting(!1), setProgress(settings.initialProgress);
|
|
310
|
+
let startTime = performance.now(), routeDuration = randomDuration({
|
|
388
311
|
max: settings.sampleMaxDuration,
|
|
389
312
|
min: settings.sampleMinDuration
|
|
390
313
|
});
|
|
391
314
|
setSampleDuration(routeDuration);
|
|
392
|
-
|
|
315
|
+
let animate = () => {
|
|
393
316
|
if (!activeNavigation.current) return;
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
if (elapsed < settings.minDuration) {
|
|
317
|
+
let elapsed = performance.now() - startTime, progressValue;
|
|
318
|
+
if (elapsed < settings.minDuration)
|
|
397
319
|
progressValue = settings.initialProgress + elapsed / settings.minDuration * (settings.fastPhaseEnd - settings.initialProgress);
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
const normalizedTime = clamp({
|
|
320
|
+
else {
|
|
321
|
+
let remainingProgress = settings.targetProgress - settings.fastPhaseEnd, easedTime = 1 - (1 - clamp({
|
|
401
322
|
max: 1,
|
|
402
323
|
min: 0,
|
|
403
324
|
value: (elapsed - settings.minDuration) / (settings.maxDuration - settings.minDuration)
|
|
404
|
-
});
|
|
405
|
-
const easedTime = 1 - (1 - normalizedTime) ** settings.curvePower;
|
|
325
|
+
})) ** settings.curvePower;
|
|
406
326
|
progressValue = settings.fastPhaseEnd + easedTime * remainingProgress;
|
|
407
327
|
}
|
|
408
328
|
setProgress(
|
|
409
329
|
clamp({ max: settings.targetProgress, min: 0, value: progressValue })
|
|
410
|
-
);
|
|
411
|
-
animationFrame.current = requestAnimationFrame(animate);
|
|
330
|
+
), animationFrame.current = requestAnimationFrame(animate);
|
|
412
331
|
};
|
|
413
|
-
animationFrame.current = requestAnimationFrame(animate);
|
|
414
|
-
completionTimer.current = setTimeout(completeSample, routeDuration);
|
|
332
|
+
animationFrame.current = requestAnimationFrame(animate), completionTimer.current = setTimeout(completeSample, routeDuration);
|
|
415
333
|
}, [completeSample, resetSample, settings]);
|
|
416
334
|
useEffect(() => resetSample, [resetSample]);
|
|
417
|
-
|
|
418
|
-
setActivePreset("custom");
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
setActivePreset("custom");
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
setSettings((current) => ({ ...current, [key]: value }));
|
|
428
|
-
};
|
|
429
|
-
const applyPreset = (preset) => {
|
|
430
|
-
resetSample();
|
|
431
|
-
setActivePreset(preset);
|
|
432
|
-
setSettings(presets[preset].settings);
|
|
433
|
-
};
|
|
434
|
-
const copyOutput = async () => {
|
|
435
|
-
await navigator.clipboard.writeText(output);
|
|
436
|
-
setCopyState("copied");
|
|
437
|
-
window.setTimeout(() => setCopyState("idle"), 1200);
|
|
335
|
+
let updateNumber = (key, value) => {
|
|
336
|
+
setActivePreset("custom"), setSettings((current) => ({ ...current, [key]: value }));
|
|
337
|
+
}, updateText = (key, value) => {
|
|
338
|
+
setActivePreset("custom"), setSettings((current) => ({ ...current, [key]: value }));
|
|
339
|
+
}, updateOrigin = (key, value) => {
|
|
340
|
+
setActivePreset("custom"), setSettings((current) => ({ ...current, [key]: value }));
|
|
341
|
+
}, applyPreset = (preset) => {
|
|
342
|
+
resetSample(), setActivePreset(preset), setSettings(presets[preset].settings);
|
|
343
|
+
}, copyOutput = async () => {
|
|
344
|
+
await navigator.clipboard.writeText(output), setCopyState("copied"), window.setTimeout(() => setCopyState("idle"), 1200);
|
|
438
345
|
};
|
|
439
|
-
return /* @__PURE__ */ jsx("div", { className: "min-h-screen bg-
|
|
346
|
+
return /* @__PURE__ */ jsx("div", { className: "min-h-screen bg-surface-page text-foreground-1", children: /* @__PURE__ */ jsxs("div", { className: "grid min-h-screen lg:grid-cols-[1fr_23rem]", children: [
|
|
440
347
|
/* @__PURE__ */ jsxs("main", { className: "relative min-h-screen overflow-hidden", children: [
|
|
441
|
-
/* @__PURE__ */ jsx("div", { className: "absolute left-5 top-5 text-sm font-medium text-
|
|
442
|
-
/* @__PURE__ */ jsx("div", { className: "flex min-h-screen items-center justify-center px-8 py-20", children: /* @__PURE__ */ jsxs("section", { className: "relative flex h-[15rem] w-full max-w-4xl flex-col items-center justify-center overflow-hidden bg-
|
|
348
|
+
/* @__PURE__ */ jsx("div", { className: "absolute left-5 top-5 text-sm font-medium text-foreground-4", children: "Inline" }),
|
|
349
|
+
/* @__PURE__ */ jsx("div", { className: "flex min-h-screen items-center justify-center px-8 py-20", children: /* @__PURE__ */ jsxs("section", { className: "border-shadow-3 relative flex h-[15rem] w-full max-w-4xl flex-col items-center justify-center overflow-hidden bg-surface-1", children: [
|
|
443
350
|
/* @__PURE__ */ jsx(
|
|
444
351
|
ProgressPreview,
|
|
445
352
|
{
|
|
@@ -449,7 +356,7 @@ function NavigationProgressPlayground() {
|
|
|
449
356
|
}
|
|
450
357
|
),
|
|
451
358
|
/* @__PURE__ */ jsxs("div", { className: "grid justify-items-center gap-6", children: [
|
|
452
|
-
/* @__PURE__ */ jsx("div", { className: "text-center text-base font-semibold text-
|
|
359
|
+
/* @__PURE__ */ jsx("div", { className: "text-center text-base font-semibold text-foreground-1", children: "put progress bars here" }),
|
|
453
360
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
454
361
|
/* @__PURE__ */ jsx(Button, { onClick: startSample, size: "sm", children: "Trigger navigation" }),
|
|
455
362
|
/* @__PURE__ */ jsx(Button, { onClick: resetSample, size: "sm", variant: "outline", children: "Reset" })
|
|
@@ -706,7 +613,7 @@ function NavigationProgressPlayground() {
|
|
|
706
613
|
"textarea",
|
|
707
614
|
{
|
|
708
615
|
className: "min-h-[26rem] resize-none rounded-panel border border-stroke-2 bg-surface-2 p-3 font-mono text-xs leading-5 text-foreground-1 outline-none focus:border-accent-1",
|
|
709
|
-
readOnly:
|
|
616
|
+
readOnly: !0,
|
|
710
617
|
value: output
|
|
711
618
|
}
|
|
712
619
|
),
|