@publish.os/nextjs 0.0.1-alpha.6 → 0.0.1-alpha.7
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 +2 -2
- 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,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
// src/
|
|
4
|
-
import { Button } from "
|
|
3
|
+
// src/modules/design-system/color-palette.tsx
|
|
4
|
+
import { Button } from "@publish.os/nextjs/kernel/components/ui/button";
|
|
5
5
|
import {
|
|
6
6
|
Menu,
|
|
7
7
|
MenuItem,
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
MenuPortal,
|
|
10
10
|
MenuPositioner,
|
|
11
11
|
MenuTrigger
|
|
12
|
-
} from "
|
|
12
|
+
} from "@publish.os/nextjs/kernel/components/ui/menu";
|
|
13
13
|
import {
|
|
14
14
|
Select,
|
|
15
15
|
SelectIcon,
|
|
@@ -22,202 +22,149 @@ import {
|
|
|
22
22
|
SelectPositioner,
|
|
23
23
|
SelectTrigger,
|
|
24
24
|
SelectValue
|
|
25
|
-
} from "
|
|
25
|
+
} from "@publish.os/nextjs/kernel/components/ui/select";
|
|
26
26
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
27
27
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
28
28
|
var DEFAULT_TOKEN_NAMES = [
|
|
29
|
-
"
|
|
30
|
-
"foreground-2",
|
|
31
|
-
"foreground-3",
|
|
32
|
-
"foreground-4",
|
|
33
|
-
"surface-background",
|
|
29
|
+
"surface-page",
|
|
34
30
|
"surface-1",
|
|
35
31
|
"surface-2",
|
|
36
32
|
"surface-3",
|
|
37
33
|
"surface-4",
|
|
38
34
|
"surface-hover",
|
|
39
35
|
"surface-active",
|
|
40
|
-
"
|
|
36
|
+
"foreground-1",
|
|
37
|
+
"foreground-2",
|
|
38
|
+
"foreground-3",
|
|
39
|
+
"foreground-4",
|
|
40
|
+
"stroke-1",
|
|
41
|
+
"stroke-2",
|
|
42
|
+
"stroke-3",
|
|
43
|
+
"stroke-4",
|
|
44
|
+
"backdrop",
|
|
45
|
+
"media-backdrop",
|
|
41
46
|
"menu-surface-1",
|
|
42
|
-
"menu-surface-2",
|
|
43
47
|
"menu-surface-3",
|
|
44
48
|
"menu-surface-4",
|
|
45
49
|
"menu-foreground-1",
|
|
46
|
-
"menu-foreground-2",
|
|
47
|
-
"menu-foreground-3",
|
|
48
50
|
"menu-foreground-4",
|
|
49
51
|
"menu-highlight-surface",
|
|
50
52
|
"menu-highlight-foreground",
|
|
51
|
-
"menu-option-highlight-surface",
|
|
52
|
-
"menu-option-highlight-foreground",
|
|
53
|
-
"menu-stroke-1",
|
|
54
|
-
"menu-stroke-2",
|
|
55
53
|
"menu-stroke-3",
|
|
56
|
-
"menu-stroke-4",
|
|
57
54
|
"tooltip-surface-1",
|
|
58
|
-
"tooltip-surface-2",
|
|
59
|
-
"tooltip-surface-3",
|
|
60
|
-
"tooltip-surface-4",
|
|
61
55
|
"tooltip-foreground-1",
|
|
62
|
-
"tooltip-foreground-2",
|
|
63
|
-
"tooltip-foreground-3",
|
|
64
56
|
"tooltip-foreground-4",
|
|
65
|
-
"tooltip-stroke-1",
|
|
66
|
-
"tooltip-stroke-2",
|
|
67
|
-
"tooltip-stroke-3",
|
|
68
57
|
"tooltip-stroke-4",
|
|
69
58
|
"accent-1",
|
|
70
|
-
"accent-
|
|
71
|
-
"accent-
|
|
72
|
-
"accent-
|
|
73
|
-
"accent-
|
|
74
|
-
"accent-soft-hover",
|
|
75
|
-
"accent-soft-active",
|
|
76
|
-
"accent-border",
|
|
77
|
-
"accent-focus",
|
|
78
|
-
"accent-code-background",
|
|
79
|
-
"accent-code-foreground",
|
|
59
|
+
"accent-1-foreground",
|
|
60
|
+
"accent-1-stroke",
|
|
61
|
+
"accent-1-hover",
|
|
62
|
+
"accent-1-active",
|
|
80
63
|
"accent-2",
|
|
64
|
+
"accent-2-foreground",
|
|
65
|
+
"accent-2-stroke",
|
|
66
|
+
"accent-2-hover",
|
|
67
|
+
"accent-2-active",
|
|
81
68
|
"accent-3",
|
|
82
69
|
"accent-4",
|
|
83
|
-
"
|
|
84
|
-
"
|
|
85
|
-
"
|
|
86
|
-
"
|
|
87
|
-
"stroke
|
|
88
|
-
"focus-ring",
|
|
89
|
-
"typography-links",
|
|
90
|
-
"typography-variable",
|
|
91
|
-
"typography-pre-bg",
|
|
92
|
-
"typography-pre-border",
|
|
70
|
+
"focus-stroke",
|
|
71
|
+
"typography-link-foreground",
|
|
72
|
+
"typography-variable-foreground",
|
|
73
|
+
"typography-pre-surface",
|
|
74
|
+
"typography-pre-stroke",
|
|
93
75
|
"color-foreground-1",
|
|
94
76
|
"color-surface-1",
|
|
95
77
|
"color-accent-1",
|
|
96
78
|
"color-stroke-1"
|
|
97
79
|
];
|
|
98
80
|
function collectTokenNamesFromCssText(css) {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
const name = m[1];
|
|
104
|
-
if (name && !seen.has(name)) {
|
|
105
|
-
seen.add(name);
|
|
106
|
-
names.push(name);
|
|
107
|
-
}
|
|
81
|
+
let stripped = css.replace(/\/\*[\s\S]*?\*\//g, ""), seen = /* @__PURE__ */ new Set(), names = [];
|
|
82
|
+
for (let m of stripped.matchAll(/--([a-zA-Z0-9_-]+)\s*:/g)) {
|
|
83
|
+
let name = m[1];
|
|
84
|
+
name && !seen.has(name) && (seen.add(name), names.push(name));
|
|
108
85
|
}
|
|
109
86
|
return names;
|
|
110
87
|
}
|
|
111
88
|
function appendTokenName(names, name) {
|
|
112
|
-
|
|
113
|
-
names.add(name);
|
|
89
|
+
!name || name.startsWith("_") || names.add(name);
|
|
114
90
|
}
|
|
115
91
|
function collectTokenNamesFromStyle(style, names) {
|
|
116
92
|
for (let index = 0; index < style.length; index += 1) {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
appendTokenName(names, property.slice(2));
|
|
120
|
-
}
|
|
93
|
+
let property = style.item(index);
|
|
94
|
+
property.startsWith("--") && appendTokenName(names, property.slice(2));
|
|
121
95
|
}
|
|
122
96
|
}
|
|
123
97
|
function collectTokenNamesFromRule(rule, names) {
|
|
124
|
-
if ("style" in rule) {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
if ("cssRules" in rule) {
|
|
128
|
-
const rules = rule.cssRules;
|
|
129
|
-
for (const childRule of Array.from(rules)) {
|
|
98
|
+
if ("style" in rule && collectTokenNamesFromStyle(rule.style, names), "cssRules" in rule) {
|
|
99
|
+
let rules = rule.cssRules;
|
|
100
|
+
for (let childRule of Array.from(rules))
|
|
130
101
|
collectTokenNamesFromRule(childRule, names);
|
|
131
|
-
}
|
|
132
102
|
}
|
|
133
103
|
}
|
|
134
104
|
function readDeclaredTokenNames() {
|
|
135
|
-
|
|
136
|
-
for (
|
|
105
|
+
let names = new Set(DEFAULT_TOKEN_NAMES);
|
|
106
|
+
for (let sheet of Array.from(document.styleSheets))
|
|
137
107
|
try {
|
|
138
|
-
for (
|
|
108
|
+
for (let rule of Array.from(sheet.cssRules))
|
|
139
109
|
collectTokenNamesFromRule(rule, names);
|
|
140
|
-
}
|
|
141
110
|
} catch {
|
|
142
111
|
}
|
|
143
|
-
|
|
144
|
-
collectTokenNamesFromStyle(getComputedStyle(document.documentElement), names);
|
|
145
|
-
return Array.from(names);
|
|
112
|
+
return collectTokenNamesFromStyle(getComputedStyle(document.documentElement), names), Array.from(names);
|
|
146
113
|
}
|
|
147
114
|
function deriveTokenGroup(name) {
|
|
148
115
|
if (name.startsWith("color-")) return "color";
|
|
149
|
-
if (name.startsWith("
|
|
116
|
+
if (name.startsWith("neutral-")) return "palette";
|
|
150
117
|
if (name.startsWith("typography-")) return "typography";
|
|
151
|
-
|
|
118
|
+
let p = name.split("-");
|
|
152
119
|
if (p.length === 1) return "base";
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
return p[0] ?? "base";
|
|
120
|
+
let last = p[p.length - 1];
|
|
121
|
+
return last && /^\d+$/.test(last) ? p.slice(0, -1).join("-") : p[0] ?? "base";
|
|
156
122
|
}
|
|
157
123
|
var COLOR_TOKEN_PREFIXES = [
|
|
158
124
|
"accent-",
|
|
159
125
|
"color-",
|
|
160
126
|
"danger-",
|
|
161
|
-
"focus-
|
|
127
|
+
"focus-stroke",
|
|
162
128
|
"foreground-",
|
|
163
129
|
"info-",
|
|
164
130
|
"kitchen-sink-",
|
|
165
131
|
"menu-",
|
|
166
|
-
"
|
|
132
|
+
"navigation-menu-",
|
|
133
|
+
"neutral-",
|
|
134
|
+
"popover-",
|
|
135
|
+
"select-",
|
|
167
136
|
"success-",
|
|
168
137
|
"stroke-",
|
|
169
138
|
"surface-",
|
|
170
139
|
"tooltip-",
|
|
140
|
+
"toast-",
|
|
171
141
|
"typography-",
|
|
172
142
|
"warning-"
|
|
173
143
|
];
|
|
174
144
|
function isColorTokenName(name) {
|
|
175
|
-
|
|
176
|
-
return COLOR_TOKEN_PREFIXES.some((prefix) => name.startsWith(prefix));
|
|
145
|
+
return name.startsWith("tw-") ? !1 : COLOR_TOKEN_PREFIXES.some((prefix) => name.startsWith(prefix));
|
|
177
146
|
}
|
|
178
147
|
function parseRgbString(s) {
|
|
179
|
-
|
|
148
|
+
let m = s.match(/rgba?\(\s*([\d.]+)[,\s]\s*([\d.]+)[,\s]\s*([\d.]+)/);
|
|
180
149
|
if (!m) return null;
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
return [Math.round(+r), Math.round(+g), Math.round(+b)];
|
|
150
|
+
let [, r, g, b] = m;
|
|
151
|
+
return !r || !g || !b ? null : [Math.round(+r), Math.round(+g), Math.round(+b)];
|
|
184
152
|
}
|
|
185
153
|
function toHex(r, g, b) {
|
|
186
154
|
return "#" + [r, g, b].map((x) => x.toString(16).padStart(2, "0")).join("").toUpperCase();
|
|
187
155
|
}
|
|
188
156
|
function toHsl(r, g, b) {
|
|
189
|
-
r /= 255;
|
|
190
|
-
g
|
|
191
|
-
b /= 255;
|
|
192
|
-
const mx = Math.max(r, g, b), mn = Math.min(r, g, b);
|
|
193
|
-
let h = 0, s = 0;
|
|
194
|
-
const l = (mx + mn) / 2;
|
|
157
|
+
r /= 255, g /= 255, b /= 255;
|
|
158
|
+
let mx = Math.max(r, g, b), mn = Math.min(r, g, b), h = 0, s = 0, l = (mx + mn) / 2;
|
|
195
159
|
if (mx !== mn) {
|
|
196
|
-
|
|
197
|
-
s = l > 0.5 ? d / (2 - mx - mn) : d / (mx + mn);
|
|
198
|
-
if (mx === r) h = ((g - b) / d + (g < b ? 6 : 0)) / 6;
|
|
199
|
-
else if (mx === g) h = ((b - r) / d + 2) / 6;
|
|
200
|
-
else h = ((r - g) / d + 4) / 6;
|
|
160
|
+
let d = mx - mn;
|
|
161
|
+
s = l > 0.5 ? d / (2 - mx - mn) : d / (mx + mn), mx === r ? h = ((g - b) / d + (g < b ? 6 : 0)) / 6 : mx === g ? h = ((b - r) / d + 2) / 6 : h = ((r - g) / d + 4) / 6;
|
|
201
162
|
}
|
|
202
163
|
return `hsl(${Math.round(h * 360)}, ${Math.round(s * 100)}%, ${Math.round(l * 100)}%)`;
|
|
203
164
|
}
|
|
204
165
|
function toOklch(r, g, b) {
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
return c <= 0.04045 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;
|
|
208
|
-
};
|
|
209
|
-
const [lr, lg, lb] = [tl(r), tl(g), tl(b)];
|
|
210
|
-
const l = 0.4122214708 * lr + 0.5363325363 * lg + 0.0514459929 * lb;
|
|
211
|
-
const m = 0.2119034982 * lr + 0.6806995451 * lg + 0.1073969566 * lb;
|
|
212
|
-
const s = 0.0883024619 * lr + 0.2817188376 * lg + 0.6299787005 * lb;
|
|
213
|
-
const [l_, m_, s_] = [Math.cbrt(l), Math.cbrt(m), Math.cbrt(s)];
|
|
214
|
-
const L = 0.2104542553 * l_ + 0.793617785 * m_ - 4072047e-9 * s_;
|
|
215
|
-
const a = 1.9779984951 * l_ - 2.428592205 * m_ + 0.4505937099 * s_;
|
|
216
|
-
const bv = 0.0259040371 * l_ + 0.7827717662 * m_ - 0.808675766 * s_;
|
|
217
|
-
const C = Math.sqrt(a * a + bv * bv);
|
|
218
|
-
let H = Math.atan2(bv, a) * (180 / Math.PI);
|
|
219
|
-
if (H < 0) H += 360;
|
|
220
|
-
return `oklch(${L.toFixed(3)} ${C.toFixed(3)} ${H.toFixed(1)})`;
|
|
166
|
+
let tl = (c) => (c /= 255, c <= 0.04045 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4), [lr, lg, lb] = [tl(r), tl(g), tl(b)], l = 0.4122214708 * lr + 0.5363325363 * lg + 0.0514459929 * lb, m = 0.2119034982 * lr + 0.6806995451 * lg + 0.1073969566 * lb, s = 0.0883024619 * lr + 0.2817188376 * lg + 0.6299787005 * lb, [l_, m_, s_] = [Math.cbrt(l), Math.cbrt(m), Math.cbrt(s)], L = 0.2104542553 * l_ + 0.793617785 * m_ - 4072047e-9 * s_, a = 1.9779984951 * l_ - 2.428592205 * m_ + 0.4505937099 * s_, bv = 0.0259040371 * l_ + 0.7827717662 * m_ - 0.808675766 * s_, C = Math.sqrt(a * a + bv * bv), H = Math.atan2(bv, a) * (180 / Math.PI);
|
|
167
|
+
return H < 0 && (H += 360), `oklch(${L.toFixed(3)} ${C.toFixed(3)} ${H.toFixed(1)})`;
|
|
221
168
|
}
|
|
222
169
|
function formatColor(r, g, b, fmt) {
|
|
223
170
|
switch (fmt) {
|
|
@@ -235,12 +182,10 @@ function isLight(r, g, b) {
|
|
|
235
182
|
return (0.299 * r + 0.587 * g + 0.114 * b) / 255 > 0.52;
|
|
236
183
|
}
|
|
237
184
|
function readToken(name, container) {
|
|
238
|
-
|
|
239
|
-
probe.style.cssText = `position:absolute;width:1px;height:1px;pointer-events:none;background:var(--${name})
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
container.removeChild(probe);
|
|
243
|
-
return parseRgbString(computed);
|
|
185
|
+
let probe = document.createElement("div");
|
|
186
|
+
probe.style.cssText = `position:absolute;width:1px;height:1px;pointer-events:none;background:var(--${name})`, container.appendChild(probe);
|
|
187
|
+
let computed = getComputedStyle(probe).backgroundColor;
|
|
188
|
+
return container.removeChild(probe), parseRgbString(computed);
|
|
244
189
|
}
|
|
245
190
|
var FORMAT_OPTIONS = [
|
|
246
191
|
{ label: "HEX", value: "hex" },
|
|
@@ -255,9 +200,7 @@ function Swatch({
|
|
|
255
200
|
onFormatChange,
|
|
256
201
|
onCopy
|
|
257
202
|
}) {
|
|
258
|
-
|
|
259
|
-
const light = rgb ? isLight(...rgb) : true;
|
|
260
|
-
const bg = rgb ? toHex(...rgb) : void 0;
|
|
203
|
+
let displayVal = rgb ? formatColor(...rgb, format) : null, light = rgb ? isLight(...rgb) : !0, bg = rgb ? toHex(...rgb) : void 0;
|
|
261
204
|
return /* @__PURE__ */ jsxs("div", { className: "flex w-32 shrink-0 flex-col", children: [
|
|
262
205
|
/* @__PURE__ */ jsx(
|
|
263
206
|
Button,
|
|
@@ -285,7 +228,7 @@ function Swatch({
|
|
|
285
228
|
{
|
|
286
229
|
className: "pointer-events-none absolute inset-0 rounded-card",
|
|
287
230
|
style: {
|
|
288
|
-
backgroundImage: "repeating-conic-gradient(
|
|
231
|
+
backgroundImage: "repeating-conic-gradient(var(--stroke-2) 0% 25%, transparent 0% 50%)",
|
|
289
232
|
backgroundSize: "12px 12px",
|
|
290
233
|
opacity: 0.2
|
|
291
234
|
}
|
|
@@ -328,62 +271,38 @@ function Swatch({
|
|
|
328
271
|
] });
|
|
329
272
|
}
|
|
330
273
|
function ColorPalette() {
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
const [tokenNames, setTokenNames] = useState(DEFAULT_TOKEN_NAMES);
|
|
334
|
-
const [resolved, setResolved] = useState({});
|
|
335
|
-
const probeRef = useRef(null);
|
|
336
|
-
const noticeTimer = useRef(null);
|
|
337
|
-
const readAll = useCallback(() => {
|
|
338
|
-
const container = probeRef.current;
|
|
274
|
+
let [format, setFormat] = useState("hex"), [notice, setNotice] = useState(""), [tokenNames, setTokenNames] = useState(DEFAULT_TOKEN_NAMES), [resolved, setResolved] = useState({}), probeRef = useRef(null), noticeTimer = useRef(null), readAll = useCallback(() => {
|
|
275
|
+
let container = probeRef.current;
|
|
339
276
|
if (!container) return;
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
const rgb = readToken(name, container);
|
|
344
|
-
next[name] = rgb;
|
|
345
|
-
return rgb !== null;
|
|
277
|
+
let names = readDeclaredTokenNames().filter(isColorTokenName), next = {}, colorTokenNames = names.filter((name) => {
|
|
278
|
+
let rgb = readToken(name, container);
|
|
279
|
+
return next[name] = rgb, rgb !== null;
|
|
346
280
|
});
|
|
347
|
-
setTokenNames(colorTokenNames);
|
|
348
|
-
setResolved(next);
|
|
281
|
+
setTokenNames(colorTokenNames), setResolved(next);
|
|
349
282
|
}, []);
|
|
350
283
|
useEffect(() => {
|
|
351
284
|
readAll();
|
|
352
|
-
|
|
353
|
-
obs.observe(document.documentElement, {
|
|
354
|
-
attributes:
|
|
285
|
+
let obs = new MutationObserver(readAll);
|
|
286
|
+
return obs.observe(document.documentElement, {
|
|
287
|
+
attributes: !0,
|
|
355
288
|
attributeFilter: ["class", "data-theme"]
|
|
356
|
-
});
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
useEffect(() => {
|
|
360
|
-
return () => {
|
|
361
|
-
if (noticeTimer.current) clearTimeout(noticeTimer.current);
|
|
362
|
-
};
|
|
289
|
+
}), () => obs.disconnect();
|
|
290
|
+
}, [readAll]), useEffect(() => () => {
|
|
291
|
+
noticeTimer.current && clearTimeout(noticeTimer.current);
|
|
363
292
|
}, []);
|
|
364
|
-
|
|
293
|
+
let handleCopy = useCallback((txt) => {
|
|
365
294
|
navigator.clipboard.writeText(txt).catch(() => {
|
|
366
|
-
});
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
const groupOrder = [];
|
|
373
|
-
tokenNames.forEach((name) => {
|
|
374
|
-
const g = deriveTokenGroup(name);
|
|
375
|
-
if (!groups[g]) {
|
|
376
|
-
groups[g] = [];
|
|
377
|
-
groupOrder.push(g);
|
|
378
|
-
}
|
|
379
|
-
groups[g].push(name);
|
|
380
|
-
});
|
|
381
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
295
|
+
}), setNotice(`Copied ${txt}`), noticeTimer.current && clearTimeout(noticeTimer.current), noticeTimer.current = setTimeout(() => setNotice(""), 1800);
|
|
296
|
+
}, []), groups = {}, groupOrder = [];
|
|
297
|
+
return tokenNames.forEach((name) => {
|
|
298
|
+
let g = deriveTokenGroup(name);
|
|
299
|
+
groups[g] || (groups[g] = [], groupOrder.push(g)), groups[g].push(name);
|
|
300
|
+
}), /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
382
301
|
/* @__PURE__ */ jsx(
|
|
383
302
|
"div",
|
|
384
303
|
{
|
|
385
304
|
ref: probeRef,
|
|
386
|
-
"aria-hidden":
|
|
305
|
+
"aria-hidden": !0,
|
|
387
306
|
style: {
|
|
388
307
|
position: "absolute",
|
|
389
308
|
width: 0,
|
|
@@ -1,10 +1,42 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import 'class-variance-authority
|
|
5
|
-
import '
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
3
|
+
import { Tabs as Tabs$1 } from '@base-ui/react/tabs';
|
|
4
|
+
import { VariantProps } from 'class-variance-authority';
|
|
5
|
+
import { ComponentPropsWithoutRef, ReactNode } from 'react';
|
|
6
|
+
|
|
7
|
+
declare const tabsListVariants: (props?: ({
|
|
8
|
+
variant?: "base" | "button" | "underline" | null | undefined;
|
|
9
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
10
|
+
type TabsVariantProps = VariantProps<typeof tabsListVariants>;
|
|
11
|
+
type TabsIndicatorAnimation = "grow" | "slide";
|
|
12
|
+
type TabsIndicatorColor = "accent" | "current" | "foreground" | (string & {});
|
|
13
|
+
type TabsProps = ComponentPropsWithoutRef<typeof Tabs$1.Root> & TabsVariantProps & {
|
|
14
|
+
/**
|
|
15
|
+
* Sets the underline indicator animation.
|
|
16
|
+
*
|
|
17
|
+
* `slide` tracks the active tab with a clipped underline.
|
|
18
|
+
* `grow` redraws the underline from the active tab center.
|
|
19
|
+
*
|
|
20
|
+
* @default "slide"
|
|
21
|
+
*/
|
|
22
|
+
indicatorAnimation?: TabsIndicatorAnimation;
|
|
23
|
+
/**
|
|
24
|
+
* Sets the underline indicator color for this tabs tree.
|
|
25
|
+
*
|
|
26
|
+
* Pass a CSS color, a CSS variable name like `--accent-1`, or one of the
|
|
27
|
+
* named design tokens.
|
|
28
|
+
*
|
|
29
|
+
* @default "accent"
|
|
30
|
+
*/
|
|
31
|
+
indicatorColor?: TabsIndicatorColor;
|
|
32
|
+
};
|
|
33
|
+
type TabsListProps = ComponentPropsWithoutRef<typeof Tabs$1.List> & TabsVariantProps;
|
|
34
|
+
type TabsTabProps = ComponentPropsWithoutRef<typeof Tabs$1.Tab> & TabsVariantProps;
|
|
35
|
+
type TabsPanelProps = ComponentPropsWithoutRef<typeof Tabs$1.Panel>;
|
|
36
|
+
declare function Tabs({ children, className, indicatorAnimation, indicatorColor, style, variant, ...props }: TabsProps): react_jsx_runtime.JSX.Element;
|
|
37
|
+
declare function TabsList({ className, variant, ...props }: TabsListProps): react_jsx_runtime.JSX.Element;
|
|
38
|
+
declare function TabsTab({ className, variant, ...props }: TabsTabProps): react_jsx_runtime.JSX.Element;
|
|
39
|
+
declare function TabsPanel({ className, ...props }: TabsPanelProps): react_jsx_runtime.JSX.Element;
|
|
8
40
|
|
|
9
41
|
type PreviewTab = "tokens" | "typography" | "ui" | "mdx" | "blocks";
|
|
10
42
|
type DesignSystemPreviewFixture = {
|