macbetter 0.0.0-stage → 0.1.0-beta.2
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 +201 -0
- package/README.md +92 -2
- package/dist/components/accessory-tile.d.ts +50 -0
- package/dist/components/accessory-tile.js +46 -0
- package/dist/components/activity-indicator.d.ts +15 -0
- package/dist/components/activity-indicator.js +15 -0
- package/dist/components/alert.d.ts +29 -0
- package/dist/components/alert.js +30 -0
- package/dist/components/artifact-card.d.ts +41 -0
- package/dist/components/artifact-card.js +57 -0
- package/dist/components/artwork.d.ts +44 -0
- package/dist/components/artwork.js +935 -0
- package/dist/components/attachment.d.ts +48 -0
- package/dist/components/attachment.js +65 -0
- package/dist/components/automation-row.d.ts +24 -0
- package/dist/components/automation-row.js +12 -0
- package/dist/components/avatar.d.ts +33 -0
- package/dist/components/avatar.js +45 -0
- package/dist/components/badge.d.ts +24 -0
- package/dist/components/badge.js +19 -0
- package/dist/components/button.d.ts +20 -0
- package/dist/components/button.js +10 -0
- package/dist/components/calendar.d.ts +30 -0
- package/dist/components/calendar.js +47 -0
- package/dist/components/camera-view.d.ts +40 -0
- package/dist/components/camera-view.js +44 -0
- package/dist/components/card.d.ts +14 -0
- package/dist/components/card.js +21 -0
- package/dist/components/carousel.d.ts +18 -0
- package/dist/components/carousel.js +33 -0
- package/dist/components/chat.d.ts +29 -0
- package/dist/components/chat.js +29 -0
- package/dist/components/checkbox.d.ts +13 -0
- package/dist/components/checkbox.js +16 -0
- package/dist/components/code-block.d.ts +39 -0
- package/dist/components/code-block.js +65 -0
- package/dist/components/code-field.d.ts +16 -0
- package/dist/components/code-field.js +29 -0
- package/dist/components/color-well.d.ts +23 -0
- package/dist/components/color-well.js +27 -0
- package/dist/components/combo-box.d.ts +42 -0
- package/dist/components/combo-box.js +102 -0
- package/dist/components/command-palette.d.ts +33 -0
- package/dist/components/command-palette.js +55 -0
- package/dist/components/confirmation.d.ts +24 -0
- package/dist/components/confirmation.js +50 -0
- package/dist/components/content-unavailable.d.ts +19 -0
- package/dist/components/content-unavailable.js +21 -0
- package/dist/components/context-menu.d.ts +9 -0
- package/dist/components/context-menu.js +15 -0
- package/dist/components/date-picker.d.ts +53 -0
- package/dist/components/date-picker.js +86 -0
- package/dist/components/description-list.d.ts +18 -0
- package/dist/components/description-list.js +17 -0
- package/dist/components/device-frame.d.ts +18 -0
- package/dist/components/device-frame.js +16 -0
- package/dist/components/dialog.d.ts +27 -0
- package/dist/components/dialog.js +35 -0
- package/dist/components/disclosure.d.ts +32 -0
- package/dist/components/disclosure.js +35 -0
- package/dist/components/dock.d.ts +28 -0
- package/dist/components/dock.js +80 -0
- package/dist/components/door-control.d.ts +20 -0
- package/dist/components/door-control.js +43 -0
- package/dist/components/energy-readout.d.ts +32 -0
- package/dist/components/energy-readout.js +27 -0
- package/dist/components/field.d.ts +28 -0
- package/dist/components/field.js +32 -0
- package/dist/components/gauge.d.ts +25 -0
- package/dist/components/gauge.js +42 -0
- package/dist/components/generated-image.d.ts +39 -0
- package/dist/components/generated-image.js +47 -0
- package/dist/components/glass.d.ts +34 -0
- package/dist/components/glass.js +31 -0
- package/dist/components/home-backdrop.d.ts +23 -0
- package/dist/components/home-backdrop.js +12 -0
- package/dist/components/home-section.d.ts +19 -0
- package/dist/components/home-section.js +21 -0
- package/dist/components/home-status.d.ts +24 -0
- package/dist/components/home-status.js +14 -0
- package/dist/components/hover-card.d.ts +14 -0
- package/dist/components/hover-card.js +16 -0
- package/dist/components/inspector.d.ts +29 -0
- package/dist/components/inspector.js +40 -0
- package/dist/components/level-control.d.ts +19 -0
- package/dist/components/level-control.js +13 -0
- package/dist/components/light-color-picker.d.ts +33 -0
- package/dist/components/light-color-picker.js +56 -0
- package/dist/components/list.d.ts +42 -0
- package/dist/components/list.js +42 -0
- package/dist/components/listbox.d.ts +16 -0
- package/dist/components/listbox.js +28 -0
- package/dist/components/lock-control.d.ts +20 -0
- package/dist/components/lock-control.js +35 -0
- package/dist/components/menu-bar.d.ts +14 -0
- package/dist/components/menu-bar.js +16 -0
- package/dist/components/menu.d.ts +40 -0
- package/dist/components/menu.js +54 -0
- package/dist/components/message.d.ts +65 -0
- package/dist/components/message.js +69 -0
- package/dist/components/model-picker.d.ts +61 -0
- package/dist/components/model-picker.js +59 -0
- package/dist/components/navigation-bar.d.ts +24 -0
- package/dist/components/navigation-bar.js +54 -0
- package/dist/components/outline.d.ts +21 -0
- package/dist/components/outline.js +40 -0
- package/dist/components/page-control.d.ts +10 -0
- package/dist/components/page-control.js +8 -0
- package/dist/components/plan.d.ts +25 -0
- package/dist/components/plan.js +43 -0
- package/dist/components/popover.d.ts +16 -0
- package/dist/components/popover.js +24 -0
- package/dist/components/progress.d.ts +27 -0
- package/dist/components/progress.js +27 -0
- package/dist/components/prompt-input.d.ts +93 -0
- package/dist/components/prompt-input.js +172 -0
- package/dist/components/radio.d.ts +16 -0
- package/dist/components/radio.js +13 -0
- package/dist/components/rating.d.ts +10 -0
- package/dist/components/rating.js +12 -0
- package/dist/components/reasoning.d.ts +28 -0
- package/dist/components/reasoning.js +52 -0
- package/dist/components/response.d.ts +14 -0
- package/dist/components/response.js +14 -0
- package/dist/components/scene-tile.d.ts +22 -0
- package/dist/components/scene-tile.js +13 -0
- package/dist/components/scroll-view.d.ts +21 -0
- package/dist/components/scroll-view.js +13 -0
- package/dist/components/search-field.d.ts +16 -0
- package/dist/components/search-field.js +12 -0
- package/dist/components/secure-field.d.ts +23 -0
- package/dist/components/secure-field.js +21 -0
- package/dist/components/segmented-control.d.ts +12 -0
- package/dist/components/segmented-control.js +10 -0
- package/dist/components/select.d.ts +45 -0
- package/dist/components/select.js +79 -0
- package/dist/components/sensor-readout.d.ts +29 -0
- package/dist/components/sensor-readout.js +12 -0
- package/dist/components/separator.d.ts +14 -0
- package/dist/components/separator.js +11 -0
- package/dist/components/setup-code.d.ts +29 -0
- package/dist/components/setup-code.js +47 -0
- package/dist/components/sheet.d.ts +31 -0
- package/dist/components/sheet.js +51 -0
- package/dist/components/shimmer.d.ts +18 -0
- package/dist/components/shimmer.js +17 -0
- package/dist/components/sidebar.d.ts +30 -0
- package/dist/components/sidebar.js +26 -0
- package/dist/components/slider.d.ts +27 -0
- package/dist/components/slider.js +43 -0
- package/dist/components/sources.d.ts +51 -0
- package/dist/components/sources.js +46 -0
- package/dist/components/split-view.d.ts +11 -0
- package/dist/components/split-view.js +13 -0
- package/dist/components/squircle.d.ts +41 -0
- package/dist/components/squircle.js +63 -0
- package/dist/components/stepper.d.ts +30 -0
- package/dist/components/stepper.js +28 -0
- package/dist/components/suggestion.d.ts +23 -0
- package/dist/components/suggestion.js +29 -0
- package/dist/components/switch.d.ts +10 -0
- package/dist/components/switch.js +10 -0
- package/dist/components/tab-bar.d.ts +20 -0
- package/dist/components/tab-bar.js +17 -0
- package/dist/components/table.d.ts +49 -0
- package/dist/components/table.js +179 -0
- package/dist/components/tabs.d.ts +16 -0
- package/dist/components/tabs.js +19 -0
- package/dist/components/text-area.d.ts +14 -0
- package/dist/components/text-area.js +9 -0
- package/dist/components/text-field.d.ts +26 -0
- package/dist/components/text-field.js +23 -0
- package/dist/components/thermostat-control.d.ts +30 -0
- package/dist/components/thermostat-control.js +139 -0
- package/dist/components/toast.d.ts +30 -0
- package/dist/components/toast.js +114 -0
- package/dist/components/toggle.d.ts +21 -0
- package/dist/components/toggle.js +19 -0
- package/dist/components/token-field.d.ts +31 -0
- package/dist/components/token-field.js +78 -0
- package/dist/components/tool-call.d.ts +48 -0
- package/dist/components/tool-call.js +77 -0
- package/dist/components/toolbar.d.ts +27 -0
- package/dist/components/toolbar.js +39 -0
- package/dist/components/tooltip.d.ts +11 -0
- package/dist/components/tooltip.js +18 -0
- package/dist/components/window.d.ts +56 -0
- package/dist/components/window.js +61 -0
- package/dist/index.d.ts +97 -0
- package/dist/index.js +98 -0
- package/dist/lib/agent-glyphs.d.ts +10 -0
- package/dist/lib/agent-glyphs.js +19 -0
- package/dist/lib/cx.d.ts +9 -0
- package/dist/lib/cx.js +14 -0
- package/dist/lib/derive.d.ts +53 -0
- package/dist/lib/derive.js +255 -0
- package/dist/lib/field-glyphs.d.ts +13 -0
- package/dist/lib/field-glyphs.js +28 -0
- package/dist/lib/menu-glyphs.d.ts +6 -0
- package/dist/lib/menu-glyphs.js +15 -0
- package/dist/lib/platform.d.ts +18 -0
- package/dist/lib/platform.js +17 -0
- package/dist/lib/squircle.d.ts +23 -0
- package/dist/lib/squircle.js +69 -0
- package/dist/lib/theme.d.ts +42 -0
- package/dist/lib/theme.js +62 -0
- package/dist/styles/base.css +115 -0
- package/dist/styles/components/accessory-tile.css +461 -0
- package/dist/styles/components/activity-indicator.css +63 -0
- package/dist/styles/components/alert.css +433 -0
- package/dist/styles/components/artifact-card.css +238 -0
- package/dist/styles/components/artwork.css +380 -0
- package/dist/styles/components/attachment.css +540 -0
- package/dist/styles/components/automation-row.css +52 -0
- package/dist/styles/components/avatar.css +230 -0
- package/dist/styles/components/badge.css +204 -0
- package/dist/styles/components/button.css +298 -0
- package/dist/styles/components/calendar.css +287 -0
- package/dist/styles/components/camera-view.css +239 -0
- package/dist/styles/components/card.css +100 -0
- package/dist/styles/components/carousel.css +210 -0
- package/dist/styles/components/chat.css +209 -0
- package/dist/styles/components/checkbox.css +212 -0
- package/dist/styles/components/code-block.css +162 -0
- package/dist/styles/components/code-field.css +163 -0
- package/dist/styles/components/color-well.css +452 -0
- package/dist/styles/components/combo-box.css +222 -0
- package/dist/styles/components/command-palette.css +379 -0
- package/dist/styles/components/confirmation.css +189 -0
- package/dist/styles/components/content-unavailable.css +105 -0
- package/dist/styles/components/context-menu.css +43 -0
- package/dist/styles/components/date-picker.css +356 -0
- package/dist/styles/components/description-list.css +92 -0
- package/dist/styles/components/device-frame.css +202 -0
- package/dist/styles/components/dialog.css +366 -0
- package/dist/styles/components/disclosure.css +197 -0
- package/dist/styles/components/dock.css +404 -0
- package/dist/styles/components/door-control.css +187 -0
- package/dist/styles/components/energy-readout.css +161 -0
- package/dist/styles/components/field.css +175 -0
- package/dist/styles/components/gauge.css +239 -0
- package/dist/styles/components/generated-image.css +248 -0
- package/dist/styles/components/glass.css +113 -0
- package/dist/styles/components/home-backdrop.css +81 -0
- package/dist/styles/components/home-section.css +100 -0
- package/dist/styles/components/home-status.css +215 -0
- package/dist/styles/components/hover-card.css +145 -0
- package/dist/styles/components/index.css +94 -0
- package/dist/styles/components/inspector.css +236 -0
- package/dist/styles/components/level-control.css +247 -0
- package/dist/styles/components/light-color-picker.css +94 -0
- package/dist/styles/components/list.css +411 -0
- package/dist/styles/components/listbox.css +168 -0
- package/dist/styles/components/lock-control.css +164 -0
- package/dist/styles/components/menu-bar.css +94 -0
- package/dist/styles/components/menu.css +454 -0
- package/dist/styles/components/message.css +236 -0
- package/dist/styles/components/model-picker.css +64 -0
- package/dist/styles/components/navigation-bar.css +249 -0
- package/dist/styles/components/outline.css +248 -0
- package/dist/styles/components/page-control.css +127 -0
- package/dist/styles/components/plan.css +212 -0
- package/dist/styles/components/popover.css +186 -0
- package/dist/styles/components/progress.css +228 -0
- package/dist/styles/components/prompt-input.css +503 -0
- package/dist/styles/components/radio.css +281 -0
- package/dist/styles/components/rating.css +122 -0
- package/dist/styles/components/reasoning.css +214 -0
- package/dist/styles/components/response.css +303 -0
- package/dist/styles/components/scene-tile.css +295 -0
- package/dist/styles/components/scroll-view.css +195 -0
- package/dist/styles/components/search-field.css +128 -0
- package/dist/styles/components/secure-field.css +189 -0
- package/dist/styles/components/segmented-control.css +183 -0
- package/dist/styles/components/select.css +290 -0
- package/dist/styles/components/sensor-readout.css +231 -0
- package/dist/styles/components/separator.css +62 -0
- package/dist/styles/components/setup-code.css +138 -0
- package/dist/styles/components/sheet.css +345 -0
- package/dist/styles/components/shimmer.css +60 -0
- package/dist/styles/components/sidebar.css +261 -0
- package/dist/styles/components/slider.css +208 -0
- package/dist/styles/components/sources.css +349 -0
- package/dist/styles/components/split-view.css +75 -0
- package/dist/styles/components/squircle.css +44 -0
- package/dist/styles/components/stepper.css +278 -0
- package/dist/styles/components/suggestion.css +203 -0
- package/dist/styles/components/switch.css +115 -0
- package/dist/styles/components/tab-bar.css +223 -0
- package/dist/styles/components/table.css +313 -0
- package/dist/styles/components/tabs.css +262 -0
- package/dist/styles/components/text-area.css +94 -0
- package/dist/styles/components/text-field.css +294 -0
- package/dist/styles/components/thermostat-control.css +214 -0
- package/dist/styles/components/toast.css +418 -0
- package/dist/styles/components/toggle.css +312 -0
- package/dist/styles/components/token-field.css +193 -0
- package/dist/styles/components/tool-call.css +391 -0
- package/dist/styles/components/toolbar.css +370 -0
- package/dist/styles/components/tooltip.css +69 -0
- package/dist/styles/components/window.css +428 -0
- package/dist/styles/index.css +17 -0
- package/dist/styles/materials.css +263 -0
- package/dist/styles/platforms.css +214 -0
- package/dist/styles/themes/ember.css +24 -0
- package/dist/styles/themes/graphite.css +16 -0
- package/dist/styles/themes/nebula.css +16 -0
- package/dist/styles/themes/system.css +28 -0
- package/dist/styles/tokens.css +299 -0
- package/package.json +82 -3
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Toggle, ToggleGroup } from "@ui-sdk/react/toggle";
|
|
3
|
+
import { ToolbarButton as ToolbarButtonPrimitive, ToolbarGroup as ToolbarGroupPrimitive, ToolbarInput as ToolbarInputPrimitive, ToolbarLink as ToolbarLinkPrimitive, Toolbar as ToolbarPrimitive, ToolbarSeparator as ToolbarSeparatorPrimitive, } from "@ui-sdk/react/toolbar";
|
|
4
|
+
import { cx, join } from "../lib/cx.js";
|
|
5
|
+
function Toolbar({ variant = "unified", className, ...props }) {
|
|
6
|
+
return _jsx(ToolbarPrimitive, { "data-variant": variant, className: cx("mb-toolbar", className), ...props });
|
|
7
|
+
}
|
|
8
|
+
function ToolbarButton({ className, ...props }) {
|
|
9
|
+
return _jsx(ToolbarButtonPrimitive, { className: cx("mb-toolbar-button", className), ...props });
|
|
10
|
+
}
|
|
11
|
+
/** A toolbar button that stays pressed, like Show Sidebar or a view mode. */
|
|
12
|
+
function ToolbarToggle({ className, ...props }) {
|
|
13
|
+
return _jsx(Toggle, { className: cx("mb-toolbar-button", className), ...props });
|
|
14
|
+
}
|
|
15
|
+
function ToolbarLink({ className, ...props }) {
|
|
16
|
+
return _jsx(ToolbarLinkPrimitive, { className: cx("mb-toolbar-button", className), ...props });
|
|
17
|
+
}
|
|
18
|
+
function ToolbarGroup({ className, ...props }) {
|
|
19
|
+
return _jsx(ToolbarGroupPrimitive, { className: cx("mb-toolbar-group", className), ...props });
|
|
20
|
+
}
|
|
21
|
+
/** One choice from a cluster of toggles, like the Finder's icon, list and column views. */
|
|
22
|
+
function ToolbarToggleGroup({ className, ...props }) {
|
|
23
|
+
return _jsx(ToggleGroup, { className: cx("mb-toolbar-group", className), ...props });
|
|
24
|
+
}
|
|
25
|
+
function ToolbarSeparator({ className, ...props }) {
|
|
26
|
+
return _jsx(ToolbarSeparatorPrimitive, { className: cx("mb-toolbar-separator", className), ...props });
|
|
27
|
+
}
|
|
28
|
+
/** Flexible space: pushes what follows to the trailing edge. */
|
|
29
|
+
function ToolbarSpacer({ className, ...props }) {
|
|
30
|
+
return _jsx("div", { "aria-hidden": "true", className: join("mb-toolbar-spacer", className), ...props });
|
|
31
|
+
}
|
|
32
|
+
function ToolbarTitle({ subtitle, className, children, ...props }) {
|
|
33
|
+
return (_jsxs("div", { className: join("mb-toolbar-title", className), ...props, children: [_jsx("span", { className: "mb-toolbar-title-text", children: children }), subtitle ? _jsx("span", { className: "mb-toolbar-subtitle", children: subtitle }) : null] }));
|
|
34
|
+
}
|
|
35
|
+
/** A search field that joins the toolbar's arrow-key navigation. Name it with `aria-label`. */
|
|
36
|
+
function ToolbarSearchField({ className, placeholder = "Search", ...props }) {
|
|
37
|
+
return (_jsxs("span", { className: "mb-toolbar-search", children: [_jsxs("svg", { viewBox: "0 0 16 16", "aria-hidden": "true", className: "mb-toolbar-search-icon", children: [_jsx("circle", { cx: "7", cy: "7", r: "4.75" }), _jsx("path", { d: "m10.5 10.5 3.25 3.25" })] }), _jsx(ToolbarInputPrimitive, { type: "search", placeholder: placeholder, className: cx("mb-toolbar-search-input", className), ...props })] }));
|
|
38
|
+
}
|
|
39
|
+
export { Toolbar, ToolbarButton, ToolbarGroup, ToolbarLink, ToolbarSearchField, ToolbarSeparator, ToolbarSpacer, ToolbarTitle, ToolbarToggle, ToolbarToggleGroup, };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Tooltip as TooltipPrimitive, TooltipContent as TooltipContentPrimitive, TooltipShortcut as TooltipShortcutPrimitive, TooltipTrigger as TooltipTriggerPrimitive } from "@ui-sdk/react/tooltip";
|
|
2
|
+
import type * as React from "react";
|
|
3
|
+
type TooltipProps = React.ComponentProps<typeof TooltipPrimitive>;
|
|
4
|
+
/** A macOS help tag. It appears after a short rest; set `delay` to change how long. */
|
|
5
|
+
declare function Tooltip({ delay, ...props }: TooltipProps): React.JSX.Element;
|
|
6
|
+
declare function TooltipTrigger(props: React.ComponentProps<typeof TooltipTriggerPrimitive>): React.JSX.Element;
|
|
7
|
+
declare function TooltipContent({ side, sideOffset, collisionPadding, className, ...props }: React.ComponentProps<typeof TooltipContentPrimitive>): React.JSX.Element;
|
|
8
|
+
declare function TooltipShortcut({ className, ...props }: React.ComponentProps<typeof TooltipShortcutPrimitive>): React.JSX.Element;
|
|
9
|
+
export { createTooltipController } from "@ui-sdk/react/tooltip";
|
|
10
|
+
export { Tooltip, TooltipContent, TooltipShortcut, TooltipTrigger };
|
|
11
|
+
export type { TooltipProps };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Tooltip as TooltipPrimitive, TooltipContent as TooltipContentPrimitive, TooltipShortcut as TooltipShortcutPrimitive, TooltipTrigger as TooltipTriggerPrimitive, } from "@ui-sdk/react/tooltip";
|
|
3
|
+
import { cx } from "../lib/cx.js";
|
|
4
|
+
/** A macOS help tag. It appears after a short rest; set `delay` to change how long. */
|
|
5
|
+
function Tooltip({ delay = 400, ...props }) {
|
|
6
|
+
return _jsx(TooltipPrimitive, { delay: delay, ...props });
|
|
7
|
+
}
|
|
8
|
+
function TooltipTrigger(props) {
|
|
9
|
+
return _jsx(TooltipTriggerPrimitive, { ...props });
|
|
10
|
+
}
|
|
11
|
+
function TooltipContent({ side = "bottom", sideOffset = 6, collisionPadding = 8, className, ...props }) {
|
|
12
|
+
return (_jsx(TooltipContentPrimitive, { side: side, sideOffset: sideOffset, collisionPadding: collisionPadding, className: cx("mb-tooltip", className), ...props }));
|
|
13
|
+
}
|
|
14
|
+
function TooltipShortcut({ className, ...props }) {
|
|
15
|
+
return _jsx(TooltipShortcutPrimitive, { className: cx("mb-tooltip-shortcut", className), ...props });
|
|
16
|
+
}
|
|
17
|
+
export { createTooltipController } from "@ui-sdk/react/tooltip";
|
|
18
|
+
export { Tooltip, TooltipContent, TooltipShortcut, TooltipTrigger };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type * as React from "react";
|
|
2
|
+
type WindowProps = React.ComponentProps<"div"> & {
|
|
3
|
+
/** Draws the window as it looks behind the key window: gray traffic lights, quieter chrome. */
|
|
4
|
+
inactive?: boolean;
|
|
5
|
+
};
|
|
6
|
+
declare function Window({ inactive, className, ...props }: WindowProps): React.JSX.Element;
|
|
7
|
+
type WindowTitlebarProps = React.ComponentProps<"div"> & {
|
|
8
|
+
/** `unified` is the 52px title bar that holds a toolbar; `compact` is the 28px title-only bar. */
|
|
9
|
+
variant?: "unified" | "compact";
|
|
10
|
+
/** Draws the hairline between the title bar and the content. */
|
|
11
|
+
bordered?: boolean;
|
|
12
|
+
};
|
|
13
|
+
declare function WindowTitlebar({ variant, bordered, className, ...props }: WindowTitlebarProps): React.JSX.Element;
|
|
14
|
+
type WindowTitleProps = React.ComponentProps<"div"> & {
|
|
15
|
+
/**
|
|
16
|
+
* `leading` beside a unified toolbar. `center` keeps the title in the middle of the bar whatever sits on
|
|
17
|
+
* either side, and truncates it before it reaches them; no spacer needed.
|
|
18
|
+
*/
|
|
19
|
+
align?: "center" | "leading";
|
|
20
|
+
subtitle?: React.ReactNode;
|
|
21
|
+
};
|
|
22
|
+
declare function WindowTitle({ align, subtitle, className, children, ...props }: WindowTitleProps): React.JSX.Element;
|
|
23
|
+
type WindowTrafficLightsProps = Omit<React.ComponentProps<"div">, "children"> & {
|
|
24
|
+
onClose?: React.MouseEventHandler<HTMLElement>;
|
|
25
|
+
onMinimize?: React.MouseEventHandler<HTMLElement>;
|
|
26
|
+
onZoom?: React.MouseEventHandler<HTMLElement>;
|
|
27
|
+
};
|
|
28
|
+
declare function WindowTrafficLights({ onClose, onMinimize, onZoom, className, ...props }: WindowTrafficLightsProps): React.JSX.Element;
|
|
29
|
+
/** What comes before a centered title: traffic lights, an app name, a menu. */
|
|
30
|
+
declare function WindowTitlebarLeading({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
31
|
+
/** A control held in the middle of the bar, like Calendar's Day, Week, Month and Year. Centers like a centered title. */
|
|
32
|
+
declare function WindowTitlebarCenter({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
33
|
+
/** What comes after a centered title, held against the trailing edge: a toolbar, an account menu. */
|
|
34
|
+
declare function WindowTitlebarTrailing({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
35
|
+
type WindowSidebarProps = React.ComponentProps<"div"> & {
|
|
36
|
+
/**
|
|
37
|
+
* `edge` runs the sidebar the full height of the window, edge to edge, as current macOS does.
|
|
38
|
+
* `floating` insets it as a pane of glass with its own shadow, as macOS 26 did.
|
|
39
|
+
*/
|
|
40
|
+
variant?: "edge" | "floating";
|
|
41
|
+
};
|
|
42
|
+
declare function WindowSidebar({ variant, className, ...props }: WindowSidebarProps): React.JSX.Element;
|
|
43
|
+
/**
|
|
44
|
+
* The top of a sidebar, level with the title bar: traffic lights, an app name, a workspace menu,
|
|
45
|
+
* or nothing. It keeps its height when empty, so the list below starts where it would beside the lights.
|
|
46
|
+
*/
|
|
47
|
+
declare function WindowSidebarHeader({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
48
|
+
type WindowAppNameProps = React.ComponentProps<"span"> & {
|
|
49
|
+
/** A 20-point app icon or workspace avatar. Decorative: the name is what's read. */
|
|
50
|
+
icon?: React.ReactNode;
|
|
51
|
+
};
|
|
52
|
+
/** The app or workspace name where the traffic lights would sit. Put it inside a MenuTrigger to make it a switcher. */
|
|
53
|
+
declare function WindowAppName({ icon, className, children, ...props }: WindowAppNameProps): React.JSX.Element;
|
|
54
|
+
declare function WindowBody({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
55
|
+
export { Window, WindowAppName, WindowBody, WindowSidebar, WindowSidebarHeader, WindowTitle, WindowTitlebar, WindowTitlebarCenter, WindowTitlebarLeading, WindowTitlebarTrailing, WindowTrafficLights, };
|
|
56
|
+
export type { WindowAppNameProps, WindowProps, WindowSidebarProps, WindowTitlebarProps, WindowTitleProps, WindowTrafficLightsProps, };
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Button as ButtonPrimitive } from "@ui-sdk/react/button";
|
|
3
|
+
import { join } from "../lib/cx.js";
|
|
4
|
+
function Window({ inactive, className, ...props }) {
|
|
5
|
+
return (_jsx("div", { role: "group", "data-inactive": inactive ? "" : undefined, className: join("mb-window", className), ...props }));
|
|
6
|
+
}
|
|
7
|
+
function WindowTitlebar({ variant = "unified", bordered = true, className, ...props }) {
|
|
8
|
+
return (_jsx("div", { "data-variant": variant, "data-bordered": bordered ? "" : undefined, className: join("mb-window-titlebar", className), ...props }));
|
|
9
|
+
}
|
|
10
|
+
function WindowTitle({ align = "leading", subtitle, className, children, ...props }) {
|
|
11
|
+
return (_jsxs("div", { "data-align": align, className: join("mb-window-title", className), ...props, children: [_jsx("span", { className: "mb-window-title-text", children: children }), subtitle ? _jsx("span", { className: "mb-window-subtitle", children: subtitle }) : null] }));
|
|
12
|
+
}
|
|
13
|
+
const glyphs = {
|
|
14
|
+
close: _jsx("path", { d: "M3.5 3.5l5 5m0-5l-5 5", strokeWidth: "1.3", strokeLinecap: "round" }),
|
|
15
|
+
minimize: _jsx("path", { d: "M2.8 6h6.4", strokeWidth: "1.4", strokeLinecap: "round" }),
|
|
16
|
+
zoom: _jsx("path", { d: "M3.3 3.3h4L3.3 7.3zM8.7 8.7h-4l4-4z", fill: "currentColor", stroke: "none" }),
|
|
17
|
+
};
|
|
18
|
+
const lightLabels = { close: "Close", minimize: "Minimize", zoom: "Zoom" };
|
|
19
|
+
function WindowTrafficLights({ onClose, onMinimize, onZoom, className, ...props }) {
|
|
20
|
+
const handlers = {
|
|
21
|
+
close: onClose,
|
|
22
|
+
minimize: onMinimize,
|
|
23
|
+
zoom: onZoom,
|
|
24
|
+
};
|
|
25
|
+
const interactive = Boolean(onClose || onMinimize || onZoom);
|
|
26
|
+
return (_jsx("div", { role: interactive ? "group" : undefined, "aria-label": interactive ? "Window controls" : undefined, "aria-hidden": interactive ? undefined : true, className: join("mb-window-traffic-lights", className), ...props, children: Object.keys(glyphs).map((light) => {
|
|
27
|
+
const glyph = (_jsx("svg", { viewBox: "0 0 12 12", "aria-hidden": "true", className: "mb-window-traffic-light-glyph", children: glyphs[light] }));
|
|
28
|
+
const onClick = handlers[light];
|
|
29
|
+
return onClick ? (_jsx(ButtonPrimitive, { "data-light": light, "aria-label": lightLabels[light], onClick: onClick, className: "mb-window-traffic-light", children: glyph }, light)) : (_jsx("span", { "data-light": light, className: "mb-window-traffic-light", children: glyph }, light));
|
|
30
|
+
}) }));
|
|
31
|
+
}
|
|
32
|
+
/** What comes before a centered title: traffic lights, an app name, a menu. */
|
|
33
|
+
function WindowTitlebarLeading({ className, ...props }) {
|
|
34
|
+
return _jsx("div", { className: join("mb-window-titlebar-leading", className), ...props });
|
|
35
|
+
}
|
|
36
|
+
/** A control held in the middle of the bar, like Calendar's Day, Week, Month and Year. Centers like a centered title. */
|
|
37
|
+
function WindowTitlebarCenter({ className, ...props }) {
|
|
38
|
+
return _jsx("div", { className: join("mb-window-titlebar-center", className), ...props });
|
|
39
|
+
}
|
|
40
|
+
/** What comes after a centered title, held against the trailing edge: a toolbar, an account menu. */
|
|
41
|
+
function WindowTitlebarTrailing({ className, ...props }) {
|
|
42
|
+
return _jsx("div", { className: join("mb-window-titlebar-trailing", className), ...props });
|
|
43
|
+
}
|
|
44
|
+
function WindowSidebar({ variant = "edge", className, ...props }) {
|
|
45
|
+
return _jsx("div", { "data-variant": variant, className: join("mb-window-sidebar", className), ...props });
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* The top of a sidebar, level with the title bar: traffic lights, an app name, a workspace menu,
|
|
49
|
+
* or nothing. It keeps its height when empty, so the list below starts where it would beside the lights.
|
|
50
|
+
*/
|
|
51
|
+
function WindowSidebarHeader({ className, ...props }) {
|
|
52
|
+
return _jsx("div", { className: join("mb-window-sidebar-header", className), ...props });
|
|
53
|
+
}
|
|
54
|
+
/** The app or workspace name where the traffic lights would sit. Put it inside a MenuTrigger to make it a switcher. */
|
|
55
|
+
function WindowAppName({ icon, className, children, ...props }) {
|
|
56
|
+
return (_jsxs("span", { className: join("mb-window-app-name", className), ...props, children: [icon ? (_jsx("span", { "aria-hidden": "true", className: "mb-window-app-name-icon", children: icon })) : null, _jsx("span", { className: "mb-window-app-name-text", children: children })] }));
|
|
57
|
+
}
|
|
58
|
+
function WindowBody({ className, ...props }) {
|
|
59
|
+
return _jsx("div", { className: join("mb-window-body", className), ...props });
|
|
60
|
+
}
|
|
61
|
+
export { Window, WindowAppName, WindowBody, WindowSidebar, WindowSidebarHeader, WindowTitle, WindowTitlebar, WindowTitlebarCenter, WindowTitlebarLeading, WindowTitlebarTrailing, WindowTrafficLights, };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
export * from "./components/accessory-tile.js";
|
|
2
|
+
export * from "./components/activity-indicator.js";
|
|
3
|
+
export * from "./components/alert.js";
|
|
4
|
+
export * from "./components/artifact-card.js";
|
|
5
|
+
export * from "./components/artwork.js";
|
|
6
|
+
export * from "./components/attachment.js";
|
|
7
|
+
export * from "./components/automation-row.js";
|
|
8
|
+
export * from "./components/avatar.js";
|
|
9
|
+
export * from "./components/badge.js";
|
|
10
|
+
export * from "./components/button.js";
|
|
11
|
+
export * from "./components/calendar.js";
|
|
12
|
+
export * from "./components/camera-view.js";
|
|
13
|
+
export * from "./components/card.js";
|
|
14
|
+
export * from "./components/carousel.js";
|
|
15
|
+
export * from "./components/chat.js";
|
|
16
|
+
export * from "./components/checkbox.js";
|
|
17
|
+
export * from "./components/code-block.js";
|
|
18
|
+
export * from "./components/code-field.js";
|
|
19
|
+
export * from "./components/color-well.js";
|
|
20
|
+
export * from "./components/combo-box.js";
|
|
21
|
+
export * from "./components/command-palette.js";
|
|
22
|
+
export * from "./components/confirmation.js";
|
|
23
|
+
export * from "./components/content-unavailable.js";
|
|
24
|
+
export * from "./components/context-menu.js";
|
|
25
|
+
export * from "./components/date-picker.js";
|
|
26
|
+
export * from "./components/description-list.js";
|
|
27
|
+
export * from "./components/device-frame.js";
|
|
28
|
+
export * from "./components/dialog.js";
|
|
29
|
+
export * from "./components/disclosure.js";
|
|
30
|
+
export * from "./components/dock.js";
|
|
31
|
+
export * from "./components/door-control.js";
|
|
32
|
+
export * from "./components/energy-readout.js";
|
|
33
|
+
export * from "./components/field.js";
|
|
34
|
+
export * from "./components/gauge.js";
|
|
35
|
+
export * from "./components/generated-image.js";
|
|
36
|
+
export * from "./components/glass.js";
|
|
37
|
+
export * from "./components/home-backdrop.js";
|
|
38
|
+
export * from "./components/home-section.js";
|
|
39
|
+
export * from "./components/home-status.js";
|
|
40
|
+
export * from "./components/hover-card.js";
|
|
41
|
+
export * from "./components/inspector.js";
|
|
42
|
+
export * from "./components/level-control.js";
|
|
43
|
+
export * from "./components/light-color-picker.js";
|
|
44
|
+
export * from "./components/list.js";
|
|
45
|
+
export * from "./components/listbox.js";
|
|
46
|
+
export * from "./components/lock-control.js";
|
|
47
|
+
export * from "./components/menu.js";
|
|
48
|
+
export * from "./components/menu-bar.js";
|
|
49
|
+
export * from "./components/message.js";
|
|
50
|
+
export * from "./components/model-picker.js";
|
|
51
|
+
export * from "./components/navigation-bar.js";
|
|
52
|
+
export * from "./components/outline.js";
|
|
53
|
+
export * from "./components/page-control.js";
|
|
54
|
+
export * from "./components/plan.js";
|
|
55
|
+
export * from "./components/popover.js";
|
|
56
|
+
export * from "./components/progress.js";
|
|
57
|
+
export * from "./components/prompt-input.js";
|
|
58
|
+
export * from "./components/radio.js";
|
|
59
|
+
export * from "./components/rating.js";
|
|
60
|
+
export * from "./components/reasoning.js";
|
|
61
|
+
export * from "./components/response.js";
|
|
62
|
+
export * from "./components/scene-tile.js";
|
|
63
|
+
export * from "./components/scroll-view.js";
|
|
64
|
+
export * from "./components/search-field.js";
|
|
65
|
+
export * from "./components/secure-field.js";
|
|
66
|
+
export * from "./components/segmented-control.js";
|
|
67
|
+
export * from "./components/select.js";
|
|
68
|
+
export * from "./components/sensor-readout.js";
|
|
69
|
+
export * from "./components/separator.js";
|
|
70
|
+
export * from "./components/setup-code.js";
|
|
71
|
+
export * from "./components/sheet.js";
|
|
72
|
+
export * from "./components/shimmer.js";
|
|
73
|
+
export * from "./components/sidebar.js";
|
|
74
|
+
export * from "./components/slider.js";
|
|
75
|
+
export * from "./components/sources.js";
|
|
76
|
+
export * from "./components/split-view.js";
|
|
77
|
+
export * from "./components/squircle.js";
|
|
78
|
+
export * from "./components/stepper.js";
|
|
79
|
+
export * from "./components/suggestion.js";
|
|
80
|
+
export * from "./components/switch.js";
|
|
81
|
+
export * from "./components/tab-bar.js";
|
|
82
|
+
export * from "./components/table.js";
|
|
83
|
+
export * from "./components/tabs.js";
|
|
84
|
+
export * from "./components/text-area.js";
|
|
85
|
+
export * from "./components/text-field.js";
|
|
86
|
+
export * from "./components/thermostat-control.js";
|
|
87
|
+
export * from "./components/toast.js";
|
|
88
|
+
export * from "./components/toggle.js";
|
|
89
|
+
export * from "./components/token-field.js";
|
|
90
|
+
export * from "./components/tool-call.js";
|
|
91
|
+
export * from "./components/toolbar.js";
|
|
92
|
+
export * from "./components/tooltip.js";
|
|
93
|
+
export * from "./components/window.js";
|
|
94
|
+
export * from "./lib/cx.js";
|
|
95
|
+
export * from "./lib/derive.js";
|
|
96
|
+
export * from "./lib/platform.js";
|
|
97
|
+
export * from "./lib/theme.js";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
// Generated by scripts/gen-index.mjs. Do not edit.
|
|
2
|
+
export * from "./components/accessory-tile.js";
|
|
3
|
+
export * from "./components/activity-indicator.js";
|
|
4
|
+
export * from "./components/alert.js";
|
|
5
|
+
export * from "./components/artifact-card.js";
|
|
6
|
+
export * from "./components/artwork.js";
|
|
7
|
+
export * from "./components/attachment.js";
|
|
8
|
+
export * from "./components/automation-row.js";
|
|
9
|
+
export * from "./components/avatar.js";
|
|
10
|
+
export * from "./components/badge.js";
|
|
11
|
+
export * from "./components/button.js";
|
|
12
|
+
export * from "./components/calendar.js";
|
|
13
|
+
export * from "./components/camera-view.js";
|
|
14
|
+
export * from "./components/card.js";
|
|
15
|
+
export * from "./components/carousel.js";
|
|
16
|
+
export * from "./components/chat.js";
|
|
17
|
+
export * from "./components/checkbox.js";
|
|
18
|
+
export * from "./components/code-block.js";
|
|
19
|
+
export * from "./components/code-field.js";
|
|
20
|
+
export * from "./components/color-well.js";
|
|
21
|
+
export * from "./components/combo-box.js";
|
|
22
|
+
export * from "./components/command-palette.js";
|
|
23
|
+
export * from "./components/confirmation.js";
|
|
24
|
+
export * from "./components/content-unavailable.js";
|
|
25
|
+
export * from "./components/context-menu.js";
|
|
26
|
+
export * from "./components/date-picker.js";
|
|
27
|
+
export * from "./components/description-list.js";
|
|
28
|
+
export * from "./components/device-frame.js";
|
|
29
|
+
export * from "./components/dialog.js";
|
|
30
|
+
export * from "./components/disclosure.js";
|
|
31
|
+
export * from "./components/dock.js";
|
|
32
|
+
export * from "./components/door-control.js";
|
|
33
|
+
export * from "./components/energy-readout.js";
|
|
34
|
+
export * from "./components/field.js";
|
|
35
|
+
export * from "./components/gauge.js";
|
|
36
|
+
export * from "./components/generated-image.js";
|
|
37
|
+
export * from "./components/glass.js";
|
|
38
|
+
export * from "./components/home-backdrop.js";
|
|
39
|
+
export * from "./components/home-section.js";
|
|
40
|
+
export * from "./components/home-status.js";
|
|
41
|
+
export * from "./components/hover-card.js";
|
|
42
|
+
export * from "./components/inspector.js";
|
|
43
|
+
export * from "./components/level-control.js";
|
|
44
|
+
export * from "./components/light-color-picker.js";
|
|
45
|
+
export * from "./components/list.js";
|
|
46
|
+
export * from "./components/listbox.js";
|
|
47
|
+
export * from "./components/lock-control.js";
|
|
48
|
+
export * from "./components/menu.js";
|
|
49
|
+
export * from "./components/menu-bar.js";
|
|
50
|
+
export * from "./components/message.js";
|
|
51
|
+
export * from "./components/model-picker.js";
|
|
52
|
+
export * from "./components/navigation-bar.js";
|
|
53
|
+
export * from "./components/outline.js";
|
|
54
|
+
export * from "./components/page-control.js";
|
|
55
|
+
export * from "./components/plan.js";
|
|
56
|
+
export * from "./components/popover.js";
|
|
57
|
+
export * from "./components/progress.js";
|
|
58
|
+
export * from "./components/prompt-input.js";
|
|
59
|
+
export * from "./components/radio.js";
|
|
60
|
+
export * from "./components/rating.js";
|
|
61
|
+
export * from "./components/reasoning.js";
|
|
62
|
+
export * from "./components/response.js";
|
|
63
|
+
export * from "./components/scene-tile.js";
|
|
64
|
+
export * from "./components/scroll-view.js";
|
|
65
|
+
export * from "./components/search-field.js";
|
|
66
|
+
export * from "./components/secure-field.js";
|
|
67
|
+
export * from "./components/segmented-control.js";
|
|
68
|
+
export * from "./components/select.js";
|
|
69
|
+
export * from "./components/sensor-readout.js";
|
|
70
|
+
export * from "./components/separator.js";
|
|
71
|
+
export * from "./components/setup-code.js";
|
|
72
|
+
export * from "./components/sheet.js";
|
|
73
|
+
export * from "./components/shimmer.js";
|
|
74
|
+
export * from "./components/sidebar.js";
|
|
75
|
+
export * from "./components/slider.js";
|
|
76
|
+
export * from "./components/sources.js";
|
|
77
|
+
export * from "./components/split-view.js";
|
|
78
|
+
export * from "./components/squircle.js";
|
|
79
|
+
export * from "./components/stepper.js";
|
|
80
|
+
export * from "./components/suggestion.js";
|
|
81
|
+
export * from "./components/switch.js";
|
|
82
|
+
export * from "./components/tab-bar.js";
|
|
83
|
+
export * from "./components/table.js";
|
|
84
|
+
export * from "./components/tabs.js";
|
|
85
|
+
export * from "./components/text-area.js";
|
|
86
|
+
export * from "./components/text-field.js";
|
|
87
|
+
export * from "./components/thermostat-control.js";
|
|
88
|
+
export * from "./components/toast.js";
|
|
89
|
+
export * from "./components/toggle.js";
|
|
90
|
+
export * from "./components/token-field.js";
|
|
91
|
+
export * from "./components/tool-call.js";
|
|
92
|
+
export * from "./components/toolbar.js";
|
|
93
|
+
export * from "./components/tooltip.js";
|
|
94
|
+
export * from "./components/window.js";
|
|
95
|
+
export * from "./lib/cx.js";
|
|
96
|
+
export * from "./lib/derive.js";
|
|
97
|
+
export * from "./lib/platform.js";
|
|
98
|
+
export * from "./lib/theme.js";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type * as React from "react";
|
|
2
|
+
type GlyphProps = React.ComponentProps<"svg">;
|
|
3
|
+
/** A small chevron that points to the inline end; the stylesheet turns it down when open. */
|
|
4
|
+
declare function DisclosureChevron(props: GlyphProps): React.JSX.Element;
|
|
5
|
+
declare function CheckGlyph(props: GlyphProps): React.JSX.Element;
|
|
6
|
+
declare function CrossGlyph(props: GlyphProps): React.JSX.Element;
|
|
7
|
+
declare function DashGlyph(props: GlyphProps): React.JSX.Element;
|
|
8
|
+
/** An exclamation mark; the stylesheet draws the filled circle behind it. */
|
|
9
|
+
declare function AlertGlyph(props: GlyphProps): React.JSX.Element;
|
|
10
|
+
export { AlertGlyph, CheckGlyph, CrossGlyph, DashGlyph, DisclosureChevron };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/** A small chevron that points to the inline end; the stylesheet turns it down when open. */
|
|
3
|
+
function DisclosureChevron(props) {
|
|
4
|
+
return (_jsx("svg", { viewBox: "0 0 8 14", "aria-hidden": "true", focusable: "false", ...props, children: _jsx("path", { d: "M1.75 1.75 6.25 7l-4.5 5.25" }) }));
|
|
5
|
+
}
|
|
6
|
+
function CheckGlyph(props) {
|
|
7
|
+
return (_jsx("svg", { viewBox: "0 0 16 16", "aria-hidden": "true", focusable: "false", ...props, children: _jsx("path", { d: "m4 8.4 2.7 2.7L12 5.4" }) }));
|
|
8
|
+
}
|
|
9
|
+
function CrossGlyph(props) {
|
|
10
|
+
return (_jsx("svg", { viewBox: "0 0 16 16", "aria-hidden": "true", focusable: "false", ...props, children: _jsx("path", { d: "m5 5 6 6m0-6-6 6" }) }));
|
|
11
|
+
}
|
|
12
|
+
function DashGlyph(props) {
|
|
13
|
+
return (_jsx("svg", { viewBox: "0 0 16 16", "aria-hidden": "true", focusable: "false", ...props, children: _jsx("path", { d: "M5 8h6" }) }));
|
|
14
|
+
}
|
|
15
|
+
/** An exclamation mark; the stylesheet draws the filled circle behind it. */
|
|
16
|
+
function AlertGlyph(props) {
|
|
17
|
+
return (_jsxs("svg", { viewBox: "0 0 16 16", "aria-hidden": "true", focusable: "false", ...props, children: [_jsx("circle", { cx: "8", cy: "8", r: "7", "data-fill": "" }), _jsx("path", { d: "M8 4.6v4.1" }), _jsx("circle", { cx: "8", cy: "11.3", r: "0.55", "data-dot": "" })] }));
|
|
18
|
+
}
|
|
19
|
+
export { AlertGlyph, CheckGlyph, CrossGlyph, DashGlyph, DisclosureChevron };
|
package/dist/lib/cx.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
type ClassValue<S> = string | undefined | ((state: S) => string | undefined);
|
|
2
|
+
/**
|
|
3
|
+
* Joins macbetter's class with the caller's, which ui-sdk lets be a function
|
|
4
|
+
* of the part's state.
|
|
5
|
+
*/
|
|
6
|
+
declare function cx<S>(base: string, className?: ClassValue<S>): string | ((state: S) => string);
|
|
7
|
+
declare function join(...parts: Array<string | undefined | false | null>): string;
|
|
8
|
+
export { cx, join };
|
|
9
|
+
export type { ClassValue };
|
package/dist/lib/cx.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Joins macbetter's class with the caller's, which ui-sdk lets be a function
|
|
3
|
+
* of the part's state.
|
|
4
|
+
*/
|
|
5
|
+
function cx(base, className) {
|
|
6
|
+
if (typeof className === "function") {
|
|
7
|
+
return (state) => join(base, className(state));
|
|
8
|
+
}
|
|
9
|
+
return join(base, className);
|
|
10
|
+
}
|
|
11
|
+
function join(...parts) {
|
|
12
|
+
return parts.filter(Boolean).join(" ");
|
|
13
|
+
}
|
|
14
|
+
export { cx, join };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
type Rgb = [number, number, number];
|
|
2
|
+
type Oklch = {
|
|
3
|
+
l: number;
|
|
4
|
+
c: number;
|
|
5
|
+
h: number;
|
|
6
|
+
};
|
|
7
|
+
type Pair = {
|
|
8
|
+
light: string;
|
|
9
|
+
dark: string;
|
|
10
|
+
};
|
|
11
|
+
type Scheme = "light" | "dark";
|
|
12
|
+
declare const colorKeys: readonly ["accent", "onAccent", "accentText", "accentSecondary", "ink", "bg", "bgSecondary", "bgTertiary", "bgElevated", "bgSidebar", "tint", "green", "red"];
|
|
13
|
+
type ColorKey = (typeof colorKeys)[number];
|
|
14
|
+
type ThemeColors = Record<ColorKey, Pair>;
|
|
15
|
+
/** `#abc`, `abc`, `#aabbcc` → `#aabbcc`; anything else → null. Alpha is dropped from 8-digit hex. */
|
|
16
|
+
declare function normalizeHex(input: string): string | null;
|
|
17
|
+
declare function hexToRgb(hex: string): Rgb;
|
|
18
|
+
declare function rgbToHex(rgb: Rgb): string;
|
|
19
|
+
declare function hexToOklch(hex: string): Oklch;
|
|
20
|
+
/** OKLCH → hex, reducing chroma (keeping lightness and hue) until the color fits in sRGB. */
|
|
21
|
+
declare function oklchToHex(color: Oklch): string;
|
|
22
|
+
/** `fg` at `alpha` over an opaque `bg`, composited in sRGB as the browser paints it. */
|
|
23
|
+
declare function composite(fg: string, bg: string, alpha: number): string;
|
|
24
|
+
declare function relativeLuminance(hex: string): number;
|
|
25
|
+
/**
|
|
26
|
+
* Moves `fg`'s OKLCH lightness away from `bg` until the pair reaches `target`,
|
|
27
|
+
* keeping hue and as much chroma as fits. Returns `fg` unchanged if it already passes.
|
|
28
|
+
*/
|
|
29
|
+
declare function ensureContrast(fg: string, bg: string, target?: number): string;
|
|
30
|
+
/** Of `candidates`, the one with the most contrast against `bg`. */
|
|
31
|
+
declare function bestContrast(bg: string, candidates: string[]): string;
|
|
32
|
+
/**
|
|
33
|
+
* A complete set of color seeds from one accent: the accent kept as given in
|
|
34
|
+
* light and lifted for dark, text on it chosen by contrast, the accent as text
|
|
35
|
+
* pushed to 4.5:1, and neutrals tinted toward the accent's hue.
|
|
36
|
+
*/
|
|
37
|
+
declare function deriveFromAccent(input: string): ThemeColors;
|
|
38
|
+
type ContrastCheck = {
|
|
39
|
+
id: "on-accent" | "accent-text" | "ink" | "label-secondary" | "control-border";
|
|
40
|
+
label: string;
|
|
41
|
+
/** The seed to adjust when the pair falls short. */
|
|
42
|
+
fix: ColorKey | null;
|
|
43
|
+
ratio: number;
|
|
44
|
+
target: number;
|
|
45
|
+
pass: boolean;
|
|
46
|
+
fg: string;
|
|
47
|
+
bg: string;
|
|
48
|
+
};
|
|
49
|
+
declare function contrastChecks(colors: ThemeColors, scheme: Scheme): ContrastCheck[];
|
|
50
|
+
/** Adjusts the seed behind a failing check so it passes, leaving everything else alone. */
|
|
51
|
+
declare function fixCheck(colors: ThemeColors, scheme: Scheme, id: ContrastCheck["id"]): ThemeColors;
|
|
52
|
+
export { bestContrast, colorKeys, composite, contrastChecks, deriveFromAccent, ensureContrast, fixCheck, hexToOklch, hexToRgb, normalizeHex, oklchToHex, relativeLuminance, rgbToHex, };
|
|
53
|
+
export type { ColorKey, ContrastCheck, Oklch, Pair, Scheme, ThemeColors };
|