@pg-labs-incubator/cobweb 0.0.0-stage → 0.0.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 +163 -0
- package/README.md +82 -2
- package/package.json +112 -3
- package/src/action/action.yaml +291 -0
- package/src/action/button-group.yaml +56 -0
- package/src/action/button.yaml +239 -0
- package/src/action/split-button.yaml +87 -0
- package/src/color/color.yaml +181 -0
- package/src/color/palette.yaml +147 -0
- package/src/container/card.yaml +170 -0
- package/src/container/corner-radius.yaml +50 -0
- package/src/container/elevation.yaml +19 -0
- package/src/design.yaml +41 -0
- package/src/feedback/feedback.yaml +225 -0
- package/src/icon/icon-font.yaml +28 -0
- package/src/icon/icon.yaml +31 -0
- package/src/input/date-picker.yaml +144 -0
- package/src/input/date-range-input.yaml +162 -0
- package/src/input/range-slider.yaml +161 -0
- package/src/input/select.yaml +230 -0
- package/src/input/slider.yaml +172 -0
- package/src/input/text-field.yaml +240 -0
- package/src/input/time-picker.yaml +220 -0
- package/src/motion/motion.yaml +371 -0
- package/src/navigation/app-bar.yaml +147 -0
- package/src/navigation/navigation.yaml +339 -0
- package/src/navigation/scroll.yaml +23 -0
- package/src/navigation/search.yaml +112 -0
- package/src/navigation/tabs.yaml +144 -0
- package/src/navigation/toolbar.yaml +130 -0
- package/src/selection/checkbox.yaml +162 -0
- package/src/selection/chip.yaml +219 -0
- package/src/selection/radio.yaml +125 -0
- package/src/selection/segmented-group.yaml +11 -0
- package/src/selection/segmented.yaml +69 -0
- package/src/selection/switch.yaml +209 -0
- package/src/spacing/measurement.yaml +80 -0
- package/src/state/state.yaml +38 -0
- package/src/surface/surface.yaml +483 -0
- package/src/text/line-height.yaml +144 -0
- package/src/text/typeface.yaml +31 -0
- package/src/text/typescale.yaml +726 -0
- package/target/esbuild/action/action.css +1 -0
- package/target/esbuild/action/base.jsx +1 -0
- package/target/esbuild/action/button.jsx +17 -0
- package/target/esbuild/action/fab-menu-context.jsx +1 -0
- package/target/esbuild/action/fab-menu.jsx +15 -0
- package/target/esbuild/action/fab.jsx +7 -0
- package/target/esbuild/action/group.jsx +22 -0
- package/target/esbuild/action/icon-button.jsx +5 -0
- package/target/esbuild/action/index.jsx +1 -0
- package/target/esbuild/action/split-button.jsx +12 -0
- package/target/esbuild/color/contrast.jsx +1 -0
- package/target/esbuild/color/dynamic.jsx +1 -0
- package/target/esbuild/color/hct.jsx +1 -0
- package/target/esbuild/color/index.css +1 -0
- package/target/esbuild/color/index.jsx +1 -0
- package/target/esbuild/color/palette.jsx +1 -0
- package/target/esbuild/color/scheme.jsx +1 -0
- package/target/esbuild/color/temperature.jsx +1 -0
- package/target/esbuild/container/card.css +1 -0
- package/target/esbuild/container/card.jsx +1 -0
- package/target/esbuild/container/elevation-shadow.css +1 -0
- package/target/esbuild/container/elevation-shadow.jsx +1 -0
- package/target/esbuild/container/index.jsx +1 -0
- package/target/esbuild/dom/client.jsx +1 -0
- package/target/esbuild/dom/index.jsx +1 -0
- package/target/esbuild/dom/server.jsx +1 -0
- package/target/esbuild/dom/types.jsx +1 -0
- package/target/esbuild/feedback/badge.jsx +15 -0
- package/target/esbuild/feedback/feedback.css +1 -0
- package/target/esbuild/feedback/focus.jsx +1 -0
- package/target/esbuild/feedback/index.jsx +1 -0
- package/target/esbuild/feedback/loading.jsx +7 -0
- package/target/esbuild/feedback/observe.jsx +1 -0
- package/target/esbuild/feedback/progress.jsx +35 -0
- package/target/esbuild/feedback/snackbar.jsx +23 -0
- package/target/esbuild/feedback/tooltip.jsx +24 -0
- package/target/esbuild/icon/icon.css +1 -0
- package/target/esbuild/icon/icon.jsx +1 -0
- package/target/esbuild/icon/index.jsx +1 -0
- package/target/esbuild/index.css +1 -0
- package/target/esbuild/index.jsx +1 -0
- package/target/esbuild/input/autocomplete.jsx +5 -0
- package/target/esbuild/input/base.jsx +4 -0
- package/target/esbuild/input/date-picker.css +1 -0
- package/target/esbuild/input/date-picker.jsx +104 -0
- package/target/esbuild/input/date-range-input.css +1 -0
- package/target/esbuild/input/date-time.jsx +21 -0
- package/target/esbuild/input/index.css +1 -0
- package/target/esbuild/input/index.jsx +1 -0
- package/target/esbuild/input/paired-input.jsx +1 -0
- package/target/esbuild/input/picker-dialog.css +1 -0
- package/target/esbuild/input/picker-dialog.jsx +14 -0
- package/target/esbuild/input/select.css +1 -0
- package/target/esbuild/input/select.jsx +63 -0
- package/target/esbuild/input/slider.css +1 -0
- package/target/esbuild/input/slider.jsx +51 -0
- package/target/esbuild/input/text-field.css +1 -0
- package/target/esbuild/input/text-field.jsx +67 -0
- package/target/esbuild/input/time-picker.css +1 -0
- package/target/esbuild/input/time-picker.jsx +29 -0
- package/target/esbuild/motion/frame.jsx +1 -0
- package/target/esbuild/motion/index.css +1 -0
- package/target/esbuild/motion/index.jsx +1 -0
- package/target/esbuild/motion/material.jsx +1 -0
- package/target/esbuild/motion/motion.jsx +1 -0
- package/target/esbuild/motion/spring.jsx +1 -0
- package/target/esbuild/motion/transition.css +1 -0
- package/target/esbuild/motion/transition.jsx +1 -0
- package/target/esbuild/motion/velocity.jsx +1 -0
- package/target/esbuild/navigation/app-bar.jsx +51 -0
- package/target/esbuild/navigation/base.jsx +1 -0
- package/target/esbuild/navigation/drawer.jsx +25 -0
- package/target/esbuild/navigation/index.jsx +1 -0
- package/target/esbuild/navigation/navigation.css +1 -0
- package/target/esbuild/navigation/navigation.jsx +29 -0
- package/target/esbuild/navigation/scroll.jsx +1 -0
- package/target/esbuild/navigation/search.jsx +29 -0
- package/target/esbuild/navigation/tabs.jsx +7 -0
- package/target/esbuild/navigation/toolbar.jsx +23 -0
- package/target/esbuild/selection/base.jsx +1 -0
- package/target/esbuild/selection/checkbox.jsx +14 -0
- package/target/esbuild/selection/chip.jsx +23 -0
- package/target/esbuild/selection/index.jsx +1 -0
- package/target/esbuild/selection/radio.jsx +9 -0
- package/target/esbuild/selection/segmented.jsx +15 -0
- package/target/esbuild/selection/selection.css +1 -0
- package/target/esbuild/selection/switch.jsx +14 -0
- package/target/esbuild/shape/corner-rounding.jsx +1 -0
- package/target/esbuild/shape/cubic.jsx +1 -0
- package/target/esbuild/shape/index.jsx +1 -0
- package/target/esbuild/shape/material-shapes.jsx +1 -0
- package/target/esbuild/shape/morph.jsx +1 -0
- package/target/esbuild/shape/path.jsx +1 -0
- package/target/esbuild/shape/point.jsx +1 -0
- package/target/esbuild/shape/rounded-polygon.jsx +1 -0
- package/target/esbuild/shape/shapes.jsx +1 -0
- package/target/esbuild/spacing/index.jsx +1 -0
- package/target/esbuild/state/component.css +1 -0
- package/target/esbuild/state/component.jsx +1 -0
- package/target/esbuild/state/controller.jsx +1 -0
- package/target/esbuild/state/index.jsx +1 -0
- package/target/esbuild/state/ripple.jsx +1 -0
- package/target/esbuild/state/state.jsx +1 -0
- package/target/esbuild/state/style.jsx +1 -0
- package/target/esbuild/surface/carousel-layout.jsx +1 -0
- package/target/esbuild/surface/carousel.css +1 -0
- package/target/esbuild/surface/carousel.jsx +10 -0
- package/target/esbuild/surface/dialog.jsx +35 -0
- package/target/esbuild/surface/divider.jsx +1 -0
- package/target/esbuild/surface/drag.jsx +1 -0
- package/target/esbuild/surface/gestures.css +1 -0
- package/target/esbuild/surface/gestures.jsx +7 -0
- package/target/esbuild/surface/index.css +1 -0
- package/target/esbuild/surface/index.jsx +1 -0
- package/target/esbuild/surface/interactive.jsx +1 -0
- package/target/esbuild/surface/list-patterns.jsx +26 -0
- package/target/esbuild/surface/list.css +1 -0
- package/target/esbuild/surface/list.jsx +9 -0
- package/target/esbuild/surface/menu.css +1 -0
- package/target/esbuild/surface/menu.jsx +12 -0
- package/target/esbuild/surface/scaffold.jsx +47 -0
- package/target/esbuild/surface/sheet.jsx +21 -0
- package/target/esbuild/surface/side-sheet.jsx +17 -0
- package/target/esbuild/surface/slots.jsx +1 -0
- package/target/esbuild/surface/surface.css +1 -0
- package/target/esbuild/surface/surface.jsx +1 -0
- package/target/esbuild/text/index.css +1 -0
- package/target/esbuild/text/index.jsx +1 -0
- package/target/esbuild/text/text.css +1 -0
- package/target/esbuild/text/text.jsx +3 -0
- package/target/esbuild/text/typography.css +1 -0
- package/target/esbuild/text/typography.jsx +1 -0
- package/target/esbuild/util/box-side.jsx +1 -0
- package/target/esbuild/util/debug.jsx +1 -0
- package/target/esbuild/util/dom.jsx +1 -0
- package/target/esbuild/util/event.jsx +1 -0
- package/target/esbuild/util/index.jsx +1 -0
- package/target/esbuild/util/preconditions.jsx +1 -0
- package/target/esbuild/util/reactive.jsx +1 -0
- package/target/tsc/action/action.css.d.ts +3 -0
- package/target/tsc/action/base.d.ts +211 -0
- package/target/tsc/action/button.d.ts +126 -0
- package/target/tsc/action/fab-menu-context.d.ts +16 -0
- package/target/tsc/action/fab-menu.d.ts +112 -0
- package/target/tsc/action/fab.d.ts +98 -0
- package/target/tsc/action/group.d.ts +166 -0
- package/target/tsc/action/icon-button.d.ts +79 -0
- package/target/tsc/action/index.d.ts +24 -0
- package/target/tsc/action/split-button.d.ts +78 -0
- package/target/tsc/color/contrast.d.ts +48 -0
- package/target/tsc/color/dynamic.d.ts +203 -0
- package/target/tsc/color/hct.d.ts +114 -0
- package/target/tsc/color/index.css.d.ts +3 -0
- package/target/tsc/color/index.d.ts +23 -0
- package/target/tsc/color/palette.d.ts +30 -0
- package/target/tsc/color/scheme.d.ts +446 -0
- package/target/tsc/color/temperature.d.ts +24 -0
- package/target/tsc/container/card.css.d.ts +3 -0
- package/target/tsc/container/card.d.ts +110 -0
- package/target/tsc/container/elevation-shadow.css.d.ts +3 -0
- package/target/tsc/container/elevation-shadow.d.ts +23 -0
- package/target/tsc/container/index.d.ts +44 -0
- package/target/tsc/dom/client.d.ts +387 -0
- package/target/tsc/dom/index.d.ts +93 -0
- package/target/tsc/dom/server.d.ts +65 -0
- package/target/tsc/dom/types.d.ts +134 -0
- package/target/tsc/feedback/badge.d.ts +116 -0
- package/target/tsc/feedback/feedback.css.d.ts +3 -0
- package/target/tsc/feedback/focus.d.ts +20 -0
- package/target/tsc/feedback/index.d.ts +17 -0
- package/target/tsc/feedback/loading.d.ts +194 -0
- package/target/tsc/feedback/observe.d.ts +75 -0
- package/target/tsc/feedback/progress.d.ts +281 -0
- package/target/tsc/feedback/snackbar.d.ts +398 -0
- package/target/tsc/feedback/tooltip.d.ts +326 -0
- package/target/tsc/icon/icon.css.d.ts +3 -0
- package/target/tsc/icon/icon.d.ts +69 -0
- package/target/tsc/icon/index.d.ts +13 -0
- package/target/tsc/index.css.d.ts +3 -0
- package/target/tsc/index.d.ts +7 -0
- package/target/tsc/input/autocomplete.d.ts +119 -0
- package/target/tsc/input/base.d.ts +282 -0
- package/target/tsc/input/date-picker.css.d.ts +3 -0
- package/target/tsc/input/date-picker.d.ts +351 -0
- package/target/tsc/input/date-range-input.css.d.ts +3 -0
- package/target/tsc/input/date-time.d.ts +171 -0
- package/target/tsc/input/index.css.d.ts +3 -0
- package/target/tsc/input/index.d.ts +27 -0
- package/target/tsc/input/paired-input.d.ts +435 -0
- package/target/tsc/input/picker-dialog.css.d.ts +3 -0
- package/target/tsc/input/picker-dialog.d.ts +84 -0
- package/target/tsc/input/select.css.d.ts +3 -0
- package/target/tsc/input/select.d.ts +267 -0
- package/target/tsc/input/slider.css.d.ts +3 -0
- package/target/tsc/input/slider.d.ts +372 -0
- package/target/tsc/input/text-field.css.d.ts +3 -0
- package/target/tsc/input/text-field.d.ts +415 -0
- package/target/tsc/input/time-picker.css.d.ts +3 -0
- package/target/tsc/input/time-picker.d.ts +212 -0
- package/target/tsc/motion/frame.d.ts +36 -0
- package/target/tsc/motion/index.css.d.ts +3 -0
- package/target/tsc/motion/index.d.ts +34 -0
- package/target/tsc/motion/material.d.ts +110 -0
- package/target/tsc/motion/motion.d.ts +235 -0
- package/target/tsc/motion/spring.d.ts +223 -0
- package/target/tsc/motion/transition.css.d.ts +3 -0
- package/target/tsc/motion/transition.d.ts +597 -0
- package/target/tsc/motion/velocity.d.ts +54 -0
- package/target/tsc/navigation/app-bar.d.ts +473 -0
- package/target/tsc/navigation/base.d.ts +331 -0
- package/target/tsc/navigation/drawer.d.ts +301 -0
- package/target/tsc/navigation/index.d.ts +25 -0
- package/target/tsc/navigation/navigation.css.d.ts +3 -0
- package/target/tsc/navigation/navigation.d.ts +537 -0
- package/target/tsc/navigation/scroll.d.ts +218 -0
- package/target/tsc/navigation/search.d.ts +332 -0
- package/target/tsc/navigation/tabs.d.ts +497 -0
- package/target/tsc/navigation/toolbar.d.ts +248 -0
- package/target/tsc/selection/base.d.ts +100 -0
- package/target/tsc/selection/checkbox.d.ts +194 -0
- package/target/tsc/selection/chip.d.ts +358 -0
- package/target/tsc/selection/index.d.ts +21 -0
- package/target/tsc/selection/radio.d.ts +198 -0
- package/target/tsc/selection/segmented.d.ts +333 -0
- package/target/tsc/selection/selection.css.d.ts +3 -0
- package/target/tsc/selection/switch.d.ts +165 -0
- package/target/tsc/shape/corner-rounding.d.ts +36 -0
- package/target/tsc/shape/cubic.d.ts +215 -0
- package/target/tsc/shape/index.d.ts +35 -0
- package/target/tsc/shape/material-shapes.d.ts +176 -0
- package/target/tsc/shape/morph.d.ts +91 -0
- package/target/tsc/shape/path.d.ts +177 -0
- package/target/tsc/shape/point.d.ts +165 -0
- package/target/tsc/shape/rounded-polygon.d.ts +289 -0
- package/target/tsc/shape/shapes.d.ts +76 -0
- package/target/tsc/spacing/index.d.ts +19 -0
- package/target/tsc/state/component.css.d.ts +3 -0
- package/target/tsc/state/component.d.ts +276 -0
- package/target/tsc/state/controller.d.ts +257 -0
- package/target/tsc/state/index.d.ts +19 -0
- package/target/tsc/state/ripple.d.ts +50 -0
- package/target/tsc/state/state.d.ts +129 -0
- package/target/tsc/state/style.d.ts +22 -0
- package/target/tsc/surface/carousel-layout.d.ts +212 -0
- package/target/tsc/surface/carousel.css.d.ts +3 -0
- package/target/tsc/surface/carousel.d.ts +231 -0
- package/target/tsc/surface/dialog.d.ts +582 -0
- package/target/tsc/surface/divider.d.ts +92 -0
- package/target/tsc/surface/drag.d.ts +92 -0
- package/target/tsc/surface/gestures.css.d.ts +3 -0
- package/target/tsc/surface/gestures.d.ts +292 -0
- package/target/tsc/surface/index.css.d.ts +3 -0
- package/target/tsc/surface/index.d.ts +29 -0
- package/target/tsc/surface/interactive.d.ts +22 -0
- package/target/tsc/surface/list-patterns.d.ts +384 -0
- package/target/tsc/surface/list.css.d.ts +3 -0
- package/target/tsc/surface/list.d.ts +340 -0
- package/target/tsc/surface/menu.css.d.ts +3 -0
- package/target/tsc/surface/menu.d.ts +590 -0
- package/target/tsc/surface/scaffold.d.ts +337 -0
- package/target/tsc/surface/sheet.d.ts +384 -0
- package/target/tsc/surface/side-sheet.d.ts +183 -0
- package/target/tsc/surface/slots.d.ts +21 -0
- package/target/tsc/surface/surface.css.d.ts +3 -0
- package/target/tsc/surface/surface.d.ts +192 -0
- package/target/tsc/text/index.css.d.ts +3 -0
- package/target/tsc/text/index.d.ts +18 -0
- package/target/tsc/text/text.css.d.ts +3 -0
- package/target/tsc/text/text.d.ts +94 -0
- package/target/tsc/text/typography.css.d.ts +3 -0
- package/target/tsc/text/typography.d.ts +82 -0
- package/target/tsc/util/box-side.d.ts +76 -0
- package/target/tsc/util/debug.d.ts +20 -0
- package/target/tsc/util/dom.d.ts +35 -0
- package/target/tsc/util/event.d.ts +93 -0
- package/target/tsc/util/index.d.ts +12 -0
- package/target/tsc/util/preconditions.d.ts +79 -0
- package/target/tsc/util/reactive.d.ts +36 -0
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import type { JSX } from "solid-js";
|
|
2
|
+
import type { DomComponent, DomProps } from "..";
|
|
3
|
+
import type { SegmentedButtonItem, SegmentedGroupChangeHandler, SegmentedGroupValue } from "../selection/segmented";
|
|
4
|
+
import type { ActionButtonSize } from "./base";
|
|
5
|
+
import "./action.css";
|
|
6
|
+
/**
|
|
7
|
+
* Button-group variants.
|
|
8
|
+
*/
|
|
9
|
+
export type ButtonGroupVariant = "connected" | "standard";
|
|
10
|
+
/**
|
|
11
|
+
* Button-group orientation.
|
|
12
|
+
*/
|
|
13
|
+
export type ButtonGroupOrientation = "horizontal" | "vertical";
|
|
14
|
+
/**
|
|
15
|
+
* Selectable button-group item.
|
|
16
|
+
*/
|
|
17
|
+
export type ButtonGroupItem = SegmentedButtonItem;
|
|
18
|
+
/**
|
|
19
|
+
* Selected button-group value or values.
|
|
20
|
+
*/
|
|
21
|
+
export type ButtonGroupValue = SegmentedGroupValue;
|
|
22
|
+
/**
|
|
23
|
+
* Button-group selection callback.
|
|
24
|
+
*/
|
|
25
|
+
export type ButtonGroupChangeHandler = SegmentedGroupChangeHandler;
|
|
26
|
+
/**
|
|
27
|
+
* Action of a button group, rendered as a button, or as an item of the overflow menu while it does
|
|
28
|
+
* not fit into the group.
|
|
29
|
+
*
|
|
30
|
+
* An action supplied `checked` is a toggle, rendered as a {@link ./button#ToggleButton} and a
|
|
31
|
+
* checkbox menu item (`ButtonGroupScope.toggleableItem`); any other action is a
|
|
32
|
+
* {@link ./button#Button} and a menu item (`ButtonGroupScope.clickableItem`). An action has no
|
|
33
|
+
* link destination, since a menu item is not a link: a group of links nests buttons with an
|
|
34
|
+
* `href` as its children instead.
|
|
35
|
+
*/
|
|
36
|
+
export interface ButtonGroupAction {
|
|
37
|
+
/**
|
|
38
|
+
* Label of the button and of the menu item.
|
|
39
|
+
*/
|
|
40
|
+
readonly label: string;
|
|
41
|
+
/**
|
|
42
|
+
* Icon font ligature name of a leading icon, if any.
|
|
43
|
+
*/
|
|
44
|
+
readonly icon?: string | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* Action cannot be activated.
|
|
47
|
+
*
|
|
48
|
+
* @defaultValue `false`
|
|
49
|
+
*/
|
|
50
|
+
readonly disabled?: boolean | undefined;
|
|
51
|
+
/**
|
|
52
|
+
* Selected state of a toggle action.
|
|
53
|
+
*/
|
|
54
|
+
readonly checked?: boolean | undefined;
|
|
55
|
+
/**
|
|
56
|
+
* Activate the action, from its button or from its menu item.
|
|
57
|
+
*/
|
|
58
|
+
readonly onClick?: (() => void) | undefined;
|
|
59
|
+
/**
|
|
60
|
+
* Request the next selected state of a toggle action, from its button or from its menu item.
|
|
61
|
+
*
|
|
62
|
+
* @param checked - requested selected state
|
|
63
|
+
*/
|
|
64
|
+
readonly onCheckedChange?: ((checked: boolean) => void) | undefined;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Button-group properties.
|
|
68
|
+
*/
|
|
69
|
+
export type ButtonGroupProps = DomProps<HTMLDivElement, JSX.HTMLAttributes<HTMLDivElement>> & {
|
|
70
|
+
/**
|
|
71
|
+
* Size of every action, which overrides their own sizes.
|
|
72
|
+
*
|
|
73
|
+
* @defaultValue `"sm"`
|
|
74
|
+
*/
|
|
75
|
+
size?: ActionButtonSize | undefined;
|
|
76
|
+
/**
|
|
77
|
+
* Shape of every action, which overrides their own shapes. In a connected group, this is the
|
|
78
|
+
* shape of the outer corners.
|
|
79
|
+
*
|
|
80
|
+
* @defaultValue `"round"`
|
|
81
|
+
*/
|
|
82
|
+
shape?: "round" | "square" | undefined;
|
|
83
|
+
/**
|
|
84
|
+
* Group visual treatment. Pressing an action of a standard, horizontal group widens it at the
|
|
85
|
+
* expense of its neighbors.
|
|
86
|
+
*
|
|
87
|
+
* @defaultValue `"standard"`
|
|
88
|
+
*/
|
|
89
|
+
variant?: ButtonGroupVariant | undefined;
|
|
90
|
+
/**
|
|
91
|
+
* Group orientation.
|
|
92
|
+
*
|
|
93
|
+
* @defaultValue `"horizontal"`
|
|
94
|
+
*/
|
|
95
|
+
orientation?: ButtonGroupOrientation | undefined;
|
|
96
|
+
/**
|
|
97
|
+
* Actions of the group, in place of children.
|
|
98
|
+
*
|
|
99
|
+
* A horizontal group of actions fills the inline size of its container. Actions which do not
|
|
100
|
+
* fit into it, from the first which does not, move into a menu opened by an overflow indicator
|
|
101
|
+
* at the end of the group (`ButtonGroup`, `overflowIndicator`). A vertical group shows every
|
|
102
|
+
* action, and has no overflow indicator. The presence of this property is read once at
|
|
103
|
+
* construction.
|
|
104
|
+
*/
|
|
105
|
+
actions?: readonly ButtonGroupAction[] | undefined;
|
|
106
|
+
/**
|
|
107
|
+
* Accessible name and plain tooltip of the overflow indicator, and accessible name of its menu.
|
|
108
|
+
*
|
|
109
|
+
* @defaultValue `"More options"`
|
|
110
|
+
*/
|
|
111
|
+
overflowLabel?: string | undefined;
|
|
112
|
+
/**
|
|
113
|
+
* Enable coordinated selection for segmented-button children or data items.
|
|
114
|
+
*
|
|
115
|
+
* Omit this property for ordinary action grouping. Changing its presence replaces the group
|
|
116
|
+
* implementation and initializes the newly selected mode from its current properties.
|
|
117
|
+
*/
|
|
118
|
+
selection?: "single" | "multiple" | undefined;
|
|
119
|
+
/**
|
|
120
|
+
* Controlled selected value or values.
|
|
121
|
+
*/
|
|
122
|
+
value?: SegmentedGroupValue | undefined;
|
|
123
|
+
/**
|
|
124
|
+
* Initial selected value or values.
|
|
125
|
+
*/
|
|
126
|
+
defaultValue?: SegmentedGroupValue | undefined;
|
|
127
|
+
/**
|
|
128
|
+
* Prevent deselecting the final selected item.
|
|
129
|
+
*
|
|
130
|
+
* @defaultValue `false`
|
|
131
|
+
*/
|
|
132
|
+
required?: boolean | undefined;
|
|
133
|
+
/**
|
|
134
|
+
* Selection callback.
|
|
135
|
+
*/
|
|
136
|
+
onValueChange?: SegmentedGroupChangeHandler | undefined;
|
|
137
|
+
/**
|
|
138
|
+
* Selectable items, with deterministic server focus order.
|
|
139
|
+
*/
|
|
140
|
+
items?: readonly SegmentedButtonItem[] | undefined;
|
|
141
|
+
};
|
|
142
|
+
/**
|
|
143
|
+
* Material 3 button group.
|
|
144
|
+
*
|
|
145
|
+
* A button group arranges actions, giving them one size and shape. A standard group spaces its
|
|
146
|
+
* actions; pressing an action of a horizontal standard group widens it and narrows its neighbors.
|
|
147
|
+
* A connected group joins its actions with small inner corners which morph while pressed; a
|
|
148
|
+
* selected action becomes fully round.
|
|
149
|
+
*
|
|
150
|
+
* Ordinary groups preserve their authored children. A group of
|
|
151
|
+
* {@link ButtonGroupProps.actions | actions} renders them as buttons, and moves those which do not
|
|
152
|
+
* fit into a menu opened by an overflow indicator with a plain tooltip of its name, as Compose's
|
|
153
|
+
* `ButtonGroup` does. With `selection`, the group renders segmented buttons from children or
|
|
154
|
+
* `items`, with the item data, form values, roving focus, and selection callbacks of
|
|
155
|
+
* {@link SegmentedButtonGroup}, sized as actions of the group size and colored as filled toggle
|
|
156
|
+
* buttons.
|
|
157
|
+
*
|
|
158
|
+
* # Design
|
|
159
|
+
*
|
|
160
|
+
* The [cw-ButtonGroup](./button-group.yaml) attribute defines the spacing and connected inner
|
|
161
|
+
* corners; the actions are sized by their `cw-Button` size theme.
|
|
162
|
+
*
|
|
163
|
+
* @param props - group properties
|
|
164
|
+
* @returns rendered group
|
|
165
|
+
*/
|
|
166
|
+
export declare const ButtonGroup: DomComponent<ButtonGroupProps>;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { JSX } from "solid-js";
|
|
2
|
+
import type { InteractableComponent, InteractableProps } from "../state";
|
|
3
|
+
import type { ActionButtonSize, BaseActionButtonProps } from "./base";
|
|
4
|
+
/**
|
|
5
|
+
* Icon-button visual variants.
|
|
6
|
+
*/
|
|
7
|
+
export type IconButtonVariant = "filled" | "filled-tonal" | "outlined" | "standard";
|
|
8
|
+
/**
|
|
9
|
+
* Icon-button sizes, each with an optional narrow or wide container width.
|
|
10
|
+
*/
|
|
11
|
+
export type IconButtonSize = `${ActionButtonSize}${"" | "-narrow" | "-wide"}`;
|
|
12
|
+
/**
|
|
13
|
+
* Icon button properties.
|
|
14
|
+
*
|
|
15
|
+
* An icon button supplied `toggle` is a toggle, as an {@link IconToggleButton} is.
|
|
16
|
+
*/
|
|
17
|
+
export type IconButtonProps = BaseActionButtonProps & {
|
|
18
|
+
/**
|
|
19
|
+
* Icon-button visual variant.
|
|
20
|
+
*
|
|
21
|
+
* @defaultValue `"standard"`
|
|
22
|
+
*/
|
|
23
|
+
variant?: IconButtonVariant | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* Icon-button size and width. Inside a button group or split button, the container's size
|
|
26
|
+
* applies instead, keeping the width.
|
|
27
|
+
*
|
|
28
|
+
* @defaultValue `"md"`
|
|
29
|
+
*/
|
|
30
|
+
size?: IconButtonSize | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Round or square resting shape. Inside a button group, the group's shape applies instead.
|
|
33
|
+
*
|
|
34
|
+
* @defaultValue `"round"`
|
|
35
|
+
*/
|
|
36
|
+
shape?: "round" | "square" | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* Icon font ligature name. When omitted, nested content is used as the icon.
|
|
39
|
+
*/
|
|
40
|
+
name?: string | undefined;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Toggle icon-button properties.
|
|
44
|
+
*/
|
|
45
|
+
export type IconToggleButtonProps = IconButtonProps;
|
|
46
|
+
/**
|
|
47
|
+
* Material 3 icon button.
|
|
48
|
+
*
|
|
49
|
+
* Icon buttons are native buttons displaying a single icon, named by `name` or supplied as nested
|
|
50
|
+
* content. Name an icon button with `attr:aria-label`. They come in five sizes, each with narrow,
|
|
51
|
+
* default, and wide widths, keep a 48px minimum target, and morph their corners while pressed.
|
|
52
|
+
*
|
|
53
|
+
* # Design
|
|
54
|
+
*
|
|
55
|
+
* The [cw-Button](./button.yaml) attribute sizes the button and the [cw-Action](./action.yaml)
|
|
56
|
+
* attribute colors it; each variant is a `cw-Action` theme.
|
|
57
|
+
*
|
|
58
|
+
* # Styles
|
|
59
|
+
*
|
|
60
|
+
* The button applies `cw-IconButton-disabled` while disabled and the
|
|
61
|
+
* `cw-IconButton-{hover,focus,press}` interaction classes.
|
|
62
|
+
*
|
|
63
|
+
* @param props - component properties
|
|
64
|
+
* @returns rendered component elements
|
|
65
|
+
*/
|
|
66
|
+
export declare const IconButton: InteractableComponent<IconButtonProps>;
|
|
67
|
+
/**
|
|
68
|
+
* Material 3 icon toggle button.
|
|
69
|
+
*
|
|
70
|
+
* Icon toggle buttons are icon buttons with a selected state, exposed through `aria-pressed`, with
|
|
71
|
+
* the same controlled and uncontrolled contract as {@link ./button#ToggleButton}. A round toggle
|
|
72
|
+
* becomes square when selected and a square toggle round; colors follow the unselected and selected
|
|
73
|
+
* roles of its variant. The toggle applies `cw-IconButton-toggle`, and `cw-IconButton-checked`
|
|
74
|
+
* while selected.
|
|
75
|
+
*
|
|
76
|
+
* @param props - component properties
|
|
77
|
+
* @returns rendered component elements
|
|
78
|
+
*/
|
|
79
|
+
export declare function IconToggleButton(props: InteractableProps<IconToggleButtonProps>): JSX.Element;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Material 3 action controls.
|
|
3
|
+
*
|
|
4
|
+
* Action controls are rendered as native buttons where activation semantics matter, and common
|
|
5
|
+
* buttons with an `href` as native links, since an action which navigates must be a link. They use
|
|
6
|
+
* the shared interactable controller for focus, hover, press, ripple, disabled, and toggle state
|
|
7
|
+
* handling, while keeping form and keyboard behavior provided by the browser.
|
|
8
|
+
*
|
|
9
|
+
* @packageDocumentation
|
|
10
|
+
*/
|
|
11
|
+
export type { ActionButtonController, ActionButtonElementProps, ActionButtonSize, ActionButtonVariant, ActionChangeHandler, ActionLinkProps, ActionToggleProps, BaseActionButtonProps } from "./base";
|
|
12
|
+
export type { ButtonProps, ToggleButtonProps, ToggleButtonVariant } from "./button";
|
|
13
|
+
export type { IconButtonProps, IconButtonSize, IconButtonVariant, IconToggleButtonProps } from "./icon-button";
|
|
14
|
+
export type { FABProps, FABSize, FABVariant } from "./fab";
|
|
15
|
+
export type { ButtonGroupAction, ButtonGroupChangeHandler, ButtonGroupItem, ButtonGroupOrientation, ButtonGroupProps, ButtonGroupValue, ButtonGroupVariant } from "./group";
|
|
16
|
+
export type { SplitButtonProps } from "./split-button";
|
|
17
|
+
export type { FABMenuItemProps, FABMenuProps, FABMenuTriggerFactory, FABMenuTriggerProps } from "./fab-menu";
|
|
18
|
+
export type { FABMenuTriggerContextValue } from "./fab-menu-context";
|
|
19
|
+
export { Button, ToggleButton } from "./button";
|
|
20
|
+
export { IconButton, IconToggleButton } from "./icon-button";
|
|
21
|
+
export { FAB } from "./fab";
|
|
22
|
+
export { ButtonGroup } from "./group";
|
|
23
|
+
export { SplitButton } from "./split-button";
|
|
24
|
+
export { FABMenu, FABMenuItem, FABMenuTrigger } from "./fab-menu";
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import type { JSX } from "solid-js";
|
|
2
|
+
import type { DomComponent, DomProps } from "..";
|
|
3
|
+
import type { ActionButtonSize } from "./base";
|
|
4
|
+
import type { ToggleButtonVariant } from "./button";
|
|
5
|
+
import "./action.css";
|
|
6
|
+
/**
|
|
7
|
+
* Split-button properties.
|
|
8
|
+
*/
|
|
9
|
+
export type SplitButtonProps = DomProps<HTMLDivElement, JSX.HTMLAttributes<HTMLDivElement>> & {
|
|
10
|
+
/**
|
|
11
|
+
* Size of both actions, which overrides their own sizes.
|
|
12
|
+
*
|
|
13
|
+
* @defaultValue `"sm"`
|
|
14
|
+
*/
|
|
15
|
+
size?: ActionButtonSize | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Leading action, normally a {@link ./button#Button}. When omitted, the first child is used.
|
|
18
|
+
*/
|
|
19
|
+
primary?: JSX.Element;
|
|
20
|
+
/**
|
|
21
|
+
* Trailing action, normally an {@link ./icon-button#IconButton} opening a menu. When omitted,
|
|
22
|
+
* the second child is used.
|
|
23
|
+
*/
|
|
24
|
+
secondary?: JSX.Element;
|
|
25
|
+
/**
|
|
26
|
+
* Items of the menu opened by the trailing action, in place of
|
|
27
|
+
* {@link SplitButtonProps.secondary}.
|
|
28
|
+
*
|
|
29
|
+
* The split button then renders the trailing action: a button with an arrow icon opening a
|
|
30
|
+
* {@link ../surface/menu#Menu} of these items, exposed as its trigger with
|
|
31
|
+
* `aria-haspopup="menu"`, `aria-controls`, and an `aria-expanded` state kept in sync with the
|
|
32
|
+
* menu, from server rendering on. The presence of this property is read once at construction.
|
|
33
|
+
*/
|
|
34
|
+
menu?: JSX.Element;
|
|
35
|
+
/**
|
|
36
|
+
* Accessible name of the trailing action rendered for {@link SplitButtonProps.menu}, and of
|
|
37
|
+
* its menu.
|
|
38
|
+
*
|
|
39
|
+
* @defaultValue `"More options"`
|
|
40
|
+
*/
|
|
41
|
+
menuLabel?: string | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* Variant of the trailing action rendered for {@link SplitButtonProps.menu}, which should be
|
|
44
|
+
* the variant of the leading action.
|
|
45
|
+
*
|
|
46
|
+
* @defaultValue `"filled"`
|
|
47
|
+
*/
|
|
48
|
+
variant?: ToggleButtonVariant | undefined;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Material 3 split button.
|
|
52
|
+
*
|
|
53
|
+
* A split button pairs a leading action with a trailing action, normally opening a menu of related
|
|
54
|
+
* actions: supply the menu items as {@link SplitButtonProps.menu} for the split button to render
|
|
55
|
+
* the trailing action and its menu, or compose the trailing action yourself, for example as the
|
|
56
|
+
* trigger of a {@link ../surface/menu#Menu}. Both actions take the split button's size. Their outer
|
|
57
|
+
* corners are fully round; their inner corners morph while hovered or pressed, and the trailing
|
|
58
|
+
* action becomes fully round, with its icon turned over, while selected or while its menu is open
|
|
59
|
+
* (`aria-expanded="true"`). The content of the trailing action is centered optically between its
|
|
60
|
+
* corners (`horizontalCenterOptically`).
|
|
61
|
+
*
|
|
62
|
+
* # Design
|
|
63
|
+
*
|
|
64
|
+
* The [cw-SplitButton](./split-button.yaml) attribute defines the spacing, paddings, trailing icon
|
|
65
|
+
* size, and inner corners; the actions are sized by their `cw-Button` size theme.
|
|
66
|
+
*
|
|
67
|
+
* # Elements
|
|
68
|
+
*
|
|
69
|
+
* | Class | Element |
|
|
70
|
+
* | -------------------------- | --------------------------- |
|
|
71
|
+
* | `cw-SplitButton` | root, with the `group` role |
|
|
72
|
+
* | `cw-SplitButton-primary` | leading action slot |
|
|
73
|
+
* | `cw-SplitButton-secondary` | trailing action slot |
|
|
74
|
+
*
|
|
75
|
+
* @param props - component properties
|
|
76
|
+
* @returns rendered component elements
|
|
77
|
+
*/
|
|
78
|
+
export declare const SplitButton: DomComponent<SplitButtonProps>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Determine contrast ratio of two tones.
|
|
3
|
+
*
|
|
4
|
+
* Tones are clamped to `[0, 100]`.
|
|
5
|
+
*
|
|
6
|
+
* @param tone1 - tone
|
|
7
|
+
* @param tone2 - other tone
|
|
8
|
+
* @returns contrast ratio, in `[1, 21]`
|
|
9
|
+
*/
|
|
10
|
+
export declare function ratioOfTones(tone1: number, tone2: number): number;
|
|
11
|
+
/**
|
|
12
|
+
* Determine the tone lighter than a tone by a contrast ratio.
|
|
13
|
+
*
|
|
14
|
+
* @param tone - tone, in `[0, 100]`
|
|
15
|
+
* @param ratio - contrast ratio
|
|
16
|
+
* @returns lighter tone, in `[0, 100]`, or `-1` if no such tone exists
|
|
17
|
+
*/
|
|
18
|
+
export declare function lighterToneOf(tone: number, ratio: number): number;
|
|
19
|
+
/**
|
|
20
|
+
* Determine the tone darker than a tone by a contrast ratio.
|
|
21
|
+
*
|
|
22
|
+
* @param tone - tone, in `[0, 100]`
|
|
23
|
+
* @param ratio - contrast ratio
|
|
24
|
+
* @returns darker tone, in `[0, 100]`, or `-1` if no such tone exists
|
|
25
|
+
*/
|
|
26
|
+
export declare function darkerToneOf(tone: number, ratio: number): number;
|
|
27
|
+
/**
|
|
28
|
+
* Test whether content on a background of a tone is preferably lighter than the background.
|
|
29
|
+
*
|
|
30
|
+
* @param tone - tone of background
|
|
31
|
+
* @returns `true` if, and only if, `tone` rounds to less than `60`
|
|
32
|
+
*/
|
|
33
|
+
export declare function prefersLighterTone(tone: number): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Determine the tone of content on a background, reaching a contrast ratio.
|
|
36
|
+
*
|
|
37
|
+
* This determines the lighter and darker tones reaching `ratio` against `bg`, white and black
|
|
38
|
+
* if no such tone exists, respectively, and selects one of them. Lighter content is preferred on
|
|
39
|
+
* a {@link prefersLighterTone | dark} background, and darker content otherwise. The preferred tone
|
|
40
|
+
* is selected if it reaches `ratio` or if it contrasts at least as much as the other tone. For a
|
|
41
|
+
* dark background, the lighter tone is additionally selected if neither tone reaches `ratio`
|
|
42
|
+
* and their contrast ratios differ by less than `0.1`.
|
|
43
|
+
*
|
|
44
|
+
* @param bg - tone of background
|
|
45
|
+
* @param ratio - contrast ratio to reach
|
|
46
|
+
* @returns tone of content, in `[0, 100]`
|
|
47
|
+
*/
|
|
48
|
+
export declare function foregroundToneOf(bg: number, ratio: number): number;
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import type { Hct } from "./hct";
|
|
2
|
+
import type { ColorSchemeRole, ColorSchemeSpecVersion, ColorSchemeVariant } from "./scheme";
|
|
3
|
+
/**
|
|
4
|
+
* Dynamic color scheme.
|
|
5
|
+
*
|
|
6
|
+
* A scheme assigns a color to each {@link ColorSchemeRole | role}. A role takes the color of its
|
|
7
|
+
* palette at a tone which is resolved from the definition of the role. Definitions and resolved
|
|
8
|
+
* tones are computed once, when first needed.
|
|
9
|
+
*
|
|
10
|
+
* @see {@link newDynamicScheme}
|
|
11
|
+
* @see {@link argbOfRole}
|
|
12
|
+
*/
|
|
13
|
+
export interface DynamicScheme {
|
|
14
|
+
/**
|
|
15
|
+
* Specification revision the scheme follows.
|
|
16
|
+
*/
|
|
17
|
+
readonly specVersion: ColorSchemeSpecVersion;
|
|
18
|
+
/**
|
|
19
|
+
* Dynamic color style.
|
|
20
|
+
*/
|
|
21
|
+
readonly variant: ColorSchemeVariant;
|
|
22
|
+
/**
|
|
23
|
+
* Scheme is a dark scheme.
|
|
24
|
+
*/
|
|
25
|
+
readonly isDark: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Contrast level, in `[-1, 1]`.
|
|
28
|
+
*/
|
|
29
|
+
readonly contrastLevel: number;
|
|
30
|
+
/**
|
|
31
|
+
* Source color.
|
|
32
|
+
*/
|
|
33
|
+
readonly source: Hct;
|
|
34
|
+
/**
|
|
35
|
+
* Palettes of roles.
|
|
36
|
+
*/
|
|
37
|
+
readonly palettes: Palettes;
|
|
38
|
+
/**
|
|
39
|
+
* Definitions of roles, keyed by role.
|
|
40
|
+
*/
|
|
41
|
+
readonly definitions: Map<ColorSchemeRole, Definition>;
|
|
42
|
+
/**
|
|
43
|
+
* Resolved tones of roles, keyed by role.
|
|
44
|
+
*/
|
|
45
|
+
readonly tones: Map<ColorSchemeRole, number>;
|
|
46
|
+
/**
|
|
47
|
+
* Light scheme of standard contrast level with the palettes of this scheme, if created.
|
|
48
|
+
*
|
|
49
|
+
* @see {@link fixedSchemeOf}
|
|
50
|
+
*/
|
|
51
|
+
fixed: DynamicScheme | undefined;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Tonal palette of a hue and chroma.
|
|
55
|
+
*
|
|
56
|
+
* @see {@link ./palette#argbOfPalette}
|
|
57
|
+
*/
|
|
58
|
+
interface Palette {
|
|
59
|
+
/**
|
|
60
|
+
* Hue of palette, in degrees.
|
|
61
|
+
*/
|
|
62
|
+
readonly hue: number;
|
|
63
|
+
/**
|
|
64
|
+
* Chroma of palette.
|
|
65
|
+
*/
|
|
66
|
+
readonly chroma: number;
|
|
67
|
+
/**
|
|
68
|
+
* {@link searchTone | Searched} tone of palette, starting at tone `100`, if searched.
|
|
69
|
+
*/
|
|
70
|
+
lightTone: number | undefined;
|
|
71
|
+
/**
|
|
72
|
+
* {@link searchTone | Searched} tone of palette, starting at tone `0`, if searched.
|
|
73
|
+
*/
|
|
74
|
+
darkTone: number | undefined;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Palettes of a scheme.
|
|
78
|
+
*/
|
|
79
|
+
interface Palettes {
|
|
80
|
+
/**
|
|
81
|
+
* Primary accent palette.
|
|
82
|
+
*/
|
|
83
|
+
readonly primary: Palette;
|
|
84
|
+
/**
|
|
85
|
+
* Secondary accent palette.
|
|
86
|
+
*/
|
|
87
|
+
readonly secondary: Palette;
|
|
88
|
+
/**
|
|
89
|
+
* Tertiary accent palette.
|
|
90
|
+
*/
|
|
91
|
+
readonly tertiary: Palette;
|
|
92
|
+
/**
|
|
93
|
+
* Error palette.
|
|
94
|
+
*/
|
|
95
|
+
readonly error: Palette;
|
|
96
|
+
/**
|
|
97
|
+
* Neutral palette, of surfaces and their content.
|
|
98
|
+
*/
|
|
99
|
+
readonly neutral: Palette;
|
|
100
|
+
/**
|
|
101
|
+
* Neutral variant palette, of lower emphasis content and outlines, if used by the scheme.
|
|
102
|
+
*
|
|
103
|
+
* Only the `"2021"` specification revision uses this palette.
|
|
104
|
+
*/
|
|
105
|
+
readonly neutralVariant?: Palette | undefined;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Contrast ratios of a role against its background, at each contrast level.
|
|
109
|
+
*
|
|
110
|
+
* The ratios at contrast levels `-1`, `0`, `0.5`, and `1` are given; between, the ratio is
|
|
111
|
+
* interpolated linearly.
|
|
112
|
+
*
|
|
113
|
+
* @see {@link valueOfCurve}
|
|
114
|
+
*/
|
|
115
|
+
type Curve = readonly [low: number, normal: number, medium: number, high: number];
|
|
116
|
+
/**
|
|
117
|
+
* Pair of accent roles whose tones keep a distance from each other.
|
|
118
|
+
*
|
|
119
|
+
* Only the `"2021"` specification revision uses pairs.
|
|
120
|
+
*
|
|
121
|
+
* @see {@link resolvePairTone}
|
|
122
|
+
*/
|
|
123
|
+
interface Pair {
|
|
124
|
+
/**
|
|
125
|
+
* Role of pair whose tone is nearer to the tone of the background.
|
|
126
|
+
*/
|
|
127
|
+
readonly nearer: ColorSchemeRole;
|
|
128
|
+
/**
|
|
129
|
+
* Role of pair whose tone is farther from the tone of the background.
|
|
130
|
+
*/
|
|
131
|
+
readonly farther: ColorSchemeRole;
|
|
132
|
+
/**
|
|
133
|
+
* Tones of both roles leave tones in `[50, 60)` together.
|
|
134
|
+
*/
|
|
135
|
+
readonly together: boolean;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Definition of a role.
|
|
139
|
+
*
|
|
140
|
+
* The tone of a role is adjusted to reach the contrast ratio of its curve against its background
|
|
141
|
+
* role, if it has both. The tones of the roles of a {@link Pair | pair} are adjusted together.
|
|
142
|
+
*
|
|
143
|
+
* @see {@link resolveTone}
|
|
144
|
+
*/
|
|
145
|
+
interface Definition {
|
|
146
|
+
/**
|
|
147
|
+
* Palette of role.
|
|
148
|
+
*/
|
|
149
|
+
readonly palette: Palette;
|
|
150
|
+
/**
|
|
151
|
+
* Factor of the chroma of the palette in the color of role.
|
|
152
|
+
*
|
|
153
|
+
* @defaultValue `1`
|
|
154
|
+
*/
|
|
155
|
+
readonly chromaFactor?: number | undefined;
|
|
156
|
+
/**
|
|
157
|
+
* Tone of role, before adjustment.
|
|
158
|
+
*/
|
|
159
|
+
readonly tone: number;
|
|
160
|
+
/**
|
|
161
|
+
* Role whose color is the background of the color of role, if any.
|
|
162
|
+
*/
|
|
163
|
+
readonly background?: ColorSchemeRole | undefined;
|
|
164
|
+
/**
|
|
165
|
+
* Role whose color is another background of the color of role, if any.
|
|
166
|
+
*/
|
|
167
|
+
readonly secondBackground?: ColorSchemeRole | undefined;
|
|
168
|
+
/**
|
|
169
|
+
* Contrast ratios against background, if any.
|
|
170
|
+
*/
|
|
171
|
+
readonly curve?: Curve | undefined;
|
|
172
|
+
/**
|
|
173
|
+
* Pair of role, if any.
|
|
174
|
+
*/
|
|
175
|
+
readonly pair?: Pair | undefined;
|
|
176
|
+
/**
|
|
177
|
+
* Role is a background, whose adjusted tone avoids tones in `(49, 65)`.
|
|
178
|
+
*/
|
|
179
|
+
readonly isBackground?: boolean | undefined;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Construct a new dynamic color scheme.
|
|
183
|
+
*
|
|
184
|
+
* The `"2025"` specification revision is available for the `tonalSpot`, `neutral`, `vibrant`,
|
|
185
|
+
* and `expressive` variants; other variants use the `"2021"` revision instead.
|
|
186
|
+
*
|
|
187
|
+
* @param sourceColorArgb - ARGB source color, whose alpha is ignored
|
|
188
|
+
* @param variant - dynamic color style
|
|
189
|
+
* @param isDark - `true` if, and only if, the scheme is a dark scheme
|
|
190
|
+
* @param contrastLevel - contrast level, in `[-1, 1]`
|
|
191
|
+
* @param specVersion - requested specification revision
|
|
192
|
+
* @returns new scheme
|
|
193
|
+
*/
|
|
194
|
+
export declare function newDynamicScheme(sourceColorArgb: number, variant: ColorSchemeVariant, isDark: boolean, contrastLevel: number, specVersion: ColorSchemeSpecVersion): DynamicScheme;
|
|
195
|
+
/**
|
|
196
|
+
* Determine the color of a role of a scheme.
|
|
197
|
+
*
|
|
198
|
+
* @param scheme - scheme of role
|
|
199
|
+
* @param role - role to determine color of
|
|
200
|
+
* @returns opaque, unsigned ARGB color of `role`
|
|
201
|
+
*/
|
|
202
|
+
export declare function argbOfRole(scheme: DynamicScheme, role: ColorSchemeRole): number;
|
|
203
|
+
export {};
|