@open-artifact/ui 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/NOTICE +5 -0
- package/README.md +5 -2
- package/package.json +48 -4
- package/src/button.d.ts +30 -0
- package/src/button.js +28 -0
- package/src/cn.d.ts +3 -0
- package/src/cn.js +5 -0
- package/src/color-picker.d.ts +98 -0
- package/src/color-picker.js +370 -0
- package/src/color.d.ts +144 -0
- package/src/color.js +528 -0
- package/src/data/google-fonts.json +1775 -0
- package/src/effect-editors.d.ts +48 -0
- package/src/effect-editors.js +230 -0
- package/src/effects.d.ts +118 -0
- package/src/effects.js +425 -0
- package/src/fields.d.ts +105 -0
- package/src/fields.js +77 -0
- package/src/focusables.d.ts +26 -0
- package/src/focusables.js +42 -0
- package/src/font-picker.d.ts +62 -0
- package/src/font-picker.js +238 -0
- package/src/fonts.d.ts +121 -0
- package/src/fonts.js +273 -0
- package/src/history-diff.d.ts +64 -0
- package/src/history-diff.js +151 -0
- package/src/history.d.ts +95 -0
- package/src/history.js +160 -0
- package/src/index.d.ts +25 -0
- package/src/index.js +25 -0
- package/src/keys.d.ts +60 -0
- package/src/keys.js +78 -0
- package/src/layout.d.ts +55 -0
- package/src/layout.js +64 -0
- package/src/menu.d.ts +50 -0
- package/src/menu.js +36 -0
- package/src/numbers.d.ts +24 -0
- package/src/numbers.js +114 -0
- package/src/overlays.d.ts +38 -0
- package/src/overlays.js +26 -0
- package/src/scroll.d.ts +24 -0
- package/src/scroll.js +111 -0
- package/src/scrub-number-field.d.ts +56 -0
- package/src/scrub-number-field.js +190 -0
- package/src/styles.css +122 -0
- package/src/tooltip.d.ts +18 -0
- package/src/tooltip.js +10 -0
package/src/styles.css
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Open Artifact UI theme.
|
|
3
|
+
*
|
|
4
|
+
* Tailwind CSS v4 with a small set of semantic color tokens. Components use
|
|
5
|
+
* the semantic names (`bg-surface`, `text-fg-muted`, `border-line`…) only,
|
|
6
|
+
* so light and dark themes are just two sets of variable values.
|
|
7
|
+
*
|
|
8
|
+
* Apps import this file once: `@import "@open-artifact/ui/styles.css";`.
|
|
9
|
+
*/
|
|
10
|
+
@import "tailwindcss";
|
|
11
|
+
|
|
12
|
+
/* Scan the UI kit's own components for class names. */
|
|
13
|
+
@source "./";
|
|
14
|
+
|
|
15
|
+
@custom-variant dark (&:where([data-theme="dark"], [data-theme="dark"] *));
|
|
16
|
+
|
|
17
|
+
@theme {
|
|
18
|
+
--font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
|
|
19
|
+
--font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
|
|
20
|
+
|
|
21
|
+
--color-canvas: var(--open-artifact-canvas);
|
|
22
|
+
--color-surface: var(--open-artifact-surface);
|
|
23
|
+
--color-surface-2: var(--open-artifact-surface-2);
|
|
24
|
+
--color-hover: var(--open-artifact-hover);
|
|
25
|
+
--color-line: var(--open-artifact-line);
|
|
26
|
+
--color-line-strong: var(--open-artifact-line-strong);
|
|
27
|
+
--color-fg: var(--open-artifact-fg);
|
|
28
|
+
--color-fg-muted: var(--open-artifact-fg-muted);
|
|
29
|
+
--color-fg-subtle: var(--open-artifact-fg-subtle);
|
|
30
|
+
--color-accent: var(--open-artifact-accent);
|
|
31
|
+
--color-accent-fg: var(--open-artifact-accent-fg);
|
|
32
|
+
--color-accent-soft: var(--open-artifact-accent-soft);
|
|
33
|
+
--color-danger: var(--open-artifact-danger);
|
|
34
|
+
--color-warning: var(--open-artifact-warning);
|
|
35
|
+
--color-success: var(--open-artifact-success);
|
|
36
|
+
--color-select: var(--open-artifact-select);
|
|
37
|
+
|
|
38
|
+
--radius-control: 6px;
|
|
39
|
+
--shadow-popup: 0 8px 24px -6px rgb(0 0 0 / 0.18), 0 0 0 1px var(--open-artifact-line);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/* Light theme (default). */
|
|
43
|
+
:root {
|
|
44
|
+
color-scheme: light;
|
|
45
|
+
--open-artifact-canvas: #f2f2f0;
|
|
46
|
+
--open-artifact-surface: #ffffff;
|
|
47
|
+
--open-artifact-surface-2: #f7f7f5;
|
|
48
|
+
--open-artifact-hover: rgb(0 0 0 / 0.05);
|
|
49
|
+
--open-artifact-line: rgb(0 0 0 / 0.1);
|
|
50
|
+
--open-artifact-line-strong: rgb(0 0 0 / 0.2);
|
|
51
|
+
--open-artifact-fg: #1c1c1a;
|
|
52
|
+
--open-artifact-fg-muted: #5c5c57;
|
|
53
|
+
--open-artifact-fg-subtle: #8a8a84;
|
|
54
|
+
--open-artifact-accent: #2563eb;
|
|
55
|
+
--open-artifact-accent-fg: #ffffff;
|
|
56
|
+
--open-artifact-accent-soft: rgb(37 99 235 / 0.12);
|
|
57
|
+
--open-artifact-danger: #c2410c;
|
|
58
|
+
--open-artifact-warning: #b45309;
|
|
59
|
+
--open-artifact-success: #15803d;
|
|
60
|
+
--open-artifact-select: #2563eb;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/* Dark theme: follows the system unless a page pins `data-theme`. */
|
|
64
|
+
@media (prefers-color-scheme: dark) {
|
|
65
|
+
:root:not([data-theme="light"]) {
|
|
66
|
+
color-scheme: dark;
|
|
67
|
+
--open-artifact-canvas: #1a1a19;
|
|
68
|
+
--open-artifact-surface: #242423;
|
|
69
|
+
--open-artifact-surface-2: #2c2c2a;
|
|
70
|
+
--open-artifact-hover: rgb(255 255 255 / 0.07);
|
|
71
|
+
--open-artifact-line: rgb(255 255 255 / 0.1);
|
|
72
|
+
--open-artifact-line-strong: rgb(255 255 255 / 0.2);
|
|
73
|
+
--open-artifact-fg: #ededeb;
|
|
74
|
+
--open-artifact-fg-muted: #a8a8a3;
|
|
75
|
+
--open-artifact-fg-subtle: #7c7c77;
|
|
76
|
+
--open-artifact-accent: #60a5fa;
|
|
77
|
+
--open-artifact-accent-fg: #0b1220;
|
|
78
|
+
--open-artifact-accent-soft: rgb(96 165 250 / 0.16);
|
|
79
|
+
--open-artifact-danger: #fb923c;
|
|
80
|
+
--open-artifact-warning: #fbbf24;
|
|
81
|
+
--open-artifact-success: #4ade80;
|
|
82
|
+
--open-artifact-select: #60a5fa;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
:root[data-theme="dark"] {
|
|
86
|
+
color-scheme: dark;
|
|
87
|
+
--open-artifact-canvas: #1a1a19;
|
|
88
|
+
--open-artifact-surface: #242423;
|
|
89
|
+
--open-artifact-surface-2: #2c2c2a;
|
|
90
|
+
--open-artifact-hover: rgb(255 255 255 / 0.07);
|
|
91
|
+
--open-artifact-line: rgb(255 255 255 / 0.1);
|
|
92
|
+
--open-artifact-line-strong: rgb(255 255 255 / 0.2);
|
|
93
|
+
--open-artifact-fg: #ededeb;
|
|
94
|
+
--open-artifact-fg-muted: #a8a8a3;
|
|
95
|
+
--open-artifact-fg-subtle: #7c7c77;
|
|
96
|
+
--open-artifact-accent: #60a5fa;
|
|
97
|
+
--open-artifact-accent-fg: #0b1220;
|
|
98
|
+
--open-artifact-accent-soft: rgb(96 165 250 / 0.16);
|
|
99
|
+
--open-artifact-danger: #fb923c;
|
|
100
|
+
--open-artifact-warning: #fbbf24;
|
|
101
|
+
--open-artifact-success: #4ade80;
|
|
102
|
+
--open-artifact-select: #60a5fa;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
@layer base {
|
|
106
|
+
html,
|
|
107
|
+
body,
|
|
108
|
+
#root {
|
|
109
|
+
height: 100%;
|
|
110
|
+
}
|
|
111
|
+
body {
|
|
112
|
+
margin: 0;
|
|
113
|
+
background: var(--open-artifact-canvas);
|
|
114
|
+
color: var(--open-artifact-fg);
|
|
115
|
+
font-family: var(--font-sans);
|
|
116
|
+
font-size: 13px;
|
|
117
|
+
-webkit-font-smoothing: antialiased;
|
|
118
|
+
}
|
|
119
|
+
button {
|
|
120
|
+
cursor: default;
|
|
121
|
+
}
|
|
122
|
+
}
|
package/src/tooltip.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
2
|
+
/** Props of {@link Tooltip}. */
|
|
3
|
+
export interface TooltipProps {
|
|
4
|
+
/** Tooltip text. */
|
|
5
|
+
label: ReactNode;
|
|
6
|
+
/** Optional keyboard shortcut, shown dimmed after the label. */
|
|
7
|
+
shortcut?: string;
|
|
8
|
+
/** Where the tooltip opens relative to its trigger. */
|
|
9
|
+
side?: 'top' | 'bottom' | 'left' | 'right';
|
|
10
|
+
/** The trigger element; it must accept a ref and DOM props. */
|
|
11
|
+
children: ReactElement<Record<string, unknown>>;
|
|
12
|
+
}
|
|
13
|
+
/** Wraps any element with a hover tooltip. Put one {@link TooltipProvider} near the app root. */
|
|
14
|
+
export declare function Tooltip({ label, shortcut, side, children }: TooltipProps): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
/** Shares hover delays between neighbouring tooltips. */
|
|
16
|
+
export declare function TooltipProvider({ children }: {
|
|
17
|
+
children: ReactNode;
|
|
18
|
+
}): import("react/jsx-runtime").JSX.Element;
|
package/src/tooltip.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Tooltip as BaseTooltip } from '@base-ui/react/tooltip';
|
|
3
|
+
/** Wraps any element with a hover tooltip. Put one {@link TooltipProvider} near the app root. */
|
|
4
|
+
export function Tooltip({ label, shortcut, side = 'bottom', children }) {
|
|
5
|
+
return (_jsxs(BaseTooltip.Root, { children: [_jsx(BaseTooltip.Trigger, { render: children }), _jsx(BaseTooltip.Portal, { children: _jsx(BaseTooltip.Positioner, { side: side, sideOffset: 6, className: "z-[1000]", children: _jsxs(BaseTooltip.Popup, { className: "rounded-md bg-fg px-2 py-1 text-xs text-surface shadow-popup data-[starting-style]:opacity-0 data-[ending-style]:opacity-0 transition-opacity", children: [label, shortcut ? _jsx("span", { className: "ml-2 opacity-60", children: shortcut }) : null] }) }) })] }));
|
|
6
|
+
}
|
|
7
|
+
/** Shares hover delays between neighbouring tooltips. */
|
|
8
|
+
export function TooltipProvider({ children }) {
|
|
9
|
+
return (_jsx(BaseTooltip.Provider, { delay: 500, closeDelay: 0, children: children }));
|
|
10
|
+
}
|