@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,192 @@
|
|
|
1
|
+
import type { JSX } from "solid-js";
|
|
2
|
+
import type { DomProps } from "..";
|
|
3
|
+
import type { InteractableComponent, InteractableProps } from "../state";
|
|
4
|
+
import { InteractableController } from "../state/controller";
|
|
5
|
+
import "../container/elevation-shadow.css";
|
|
6
|
+
import "./surface.css";
|
|
7
|
+
/**
|
|
8
|
+
* Material surface color roles.
|
|
9
|
+
*
|
|
10
|
+
* | Value | Container role | Content role |
|
|
11
|
+
* | ----------------------------- | --------------------------- | -------------------- |
|
|
12
|
+
* | `"surface"` | `surface` | `onSurface` |
|
|
13
|
+
* | `"surface-dim"` | `surfaceDim` | `onSurface` |
|
|
14
|
+
* | `"surface-bright"` | `surfaceBright` | `onSurface` |
|
|
15
|
+
* | `"surface-container-lowest"` | `surfaceContainerLowest` | `onSurface` |
|
|
16
|
+
* | `"surface-container-low"` | `surfaceContainerLow` | `onSurface` |
|
|
17
|
+
* | `"surface-container"` | `surfaceContainer` | `onSurface` |
|
|
18
|
+
* | `"surface-container-high"` | `surfaceContainerHigh` | `onSurface` |
|
|
19
|
+
* | `"surface-container-highest"` | `surfaceContainerHighest` | `onSurface` |
|
|
20
|
+
* | `"inverse"` | `inverseSurface` | `inverseOnSurface` |
|
|
21
|
+
* | `"primary"` | `primary` | `onPrimary` |
|
|
22
|
+
* | `"secondary"` | `secondary` | `onSecondary` |
|
|
23
|
+
* | `"tertiary"` | `tertiary` | `onTertiary` |
|
|
24
|
+
* | `"error"` | `error` | `onError` |
|
|
25
|
+
*/
|
|
26
|
+
export type SurfaceColor = "surface" | "surface-dim" | "surface-bright" | "surface-container-lowest" | "surface-container-low" | "surface-container" | "surface-container-high" | "surface-container-highest" | "inverse" | "primary" | "secondary" | "tertiary" | "error";
|
|
27
|
+
/**
|
|
28
|
+
* Properties accepted by {@link Surface}.
|
|
29
|
+
*/
|
|
30
|
+
export type SurfaceBaseProps = DomProps<HTMLDivElement, Omit<JSX.HTMLAttributes<HTMLDivElement>, "role" | "tabindex" | "aria-disabled" | "aria-selected">> & {
|
|
31
|
+
/**
|
|
32
|
+
* Surface color role.
|
|
33
|
+
*
|
|
34
|
+
* The color applies to the container; content uses the matching content role. See
|
|
35
|
+
* {@link SurfaceColor}.
|
|
36
|
+
*
|
|
37
|
+
* @defaultValue `"surface-container"`
|
|
38
|
+
*/
|
|
39
|
+
color?: SurfaceColor | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* Material elevation level.
|
|
42
|
+
*
|
|
43
|
+
* The level selects the `cw-Elevation` shadow of the surface.
|
|
44
|
+
*
|
|
45
|
+
* @defaultValue `0`
|
|
46
|
+
*/
|
|
47
|
+
elevation?: 0 | 1 | 2 | 3 | 4 | 5 | undefined;
|
|
48
|
+
/**
|
|
49
|
+
* Named corner shape or a CSS `border-radius` value.
|
|
50
|
+
*
|
|
51
|
+
* Named shapes map to the `cw-CornerRadius` roles. When omitted, the `cw-Surface-shape` role
|
|
52
|
+
* applies, which an expressive theme enlarges; an explicit shape is never overridden by a
|
|
53
|
+
* theme.
|
|
54
|
+
*/
|
|
55
|
+
shape?: "none" | "extra-small" | "small" | "medium" | "large" | "extra-large" | "full" | string | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* Surface is a button.
|
|
58
|
+
*
|
|
59
|
+
* When `true`, the surface has the `button` role, is keyboard focusable, activates with Enter
|
|
60
|
+
* and Space, and renders hover, focus, and press state layers.
|
|
61
|
+
*
|
|
62
|
+
* @defaultValue `false`
|
|
63
|
+
*/
|
|
64
|
+
clickable?: boolean | undefined;
|
|
65
|
+
/**
|
|
66
|
+
* Surface is an independent toggle.
|
|
67
|
+
*
|
|
68
|
+
* When `true`, the surface has the `button` role and an `aria-pressed` state which activation
|
|
69
|
+
* toggles. Activating a nested interactive element, or a nested surface, does not toggle it.
|
|
70
|
+
*
|
|
71
|
+
* @defaultValue `false`
|
|
72
|
+
*/
|
|
73
|
+
selectable?: boolean | undefined;
|
|
74
|
+
/**
|
|
75
|
+
* Controlled selection state.
|
|
76
|
+
*
|
|
77
|
+
* Supplying this property, even as `undefined`, makes selection controlled: activation
|
|
78
|
+
* requests a change through {@link SurfaceBaseProps.onSelectedChange | `onSelectedChange`}
|
|
79
|
+
* and the parent must update this property.
|
|
80
|
+
*/
|
|
81
|
+
selected?: boolean | undefined;
|
|
82
|
+
/**
|
|
83
|
+
* Initial selection state of an uncontrolled selectable surface.
|
|
84
|
+
*
|
|
85
|
+
* @remarks
|
|
86
|
+
* This is **not** reactive.
|
|
87
|
+
*
|
|
88
|
+
* @defaultValue `false`
|
|
89
|
+
*/
|
|
90
|
+
defaultSelected?: boolean | undefined;
|
|
91
|
+
/**
|
|
92
|
+
* Surface is disabled.
|
|
93
|
+
*
|
|
94
|
+
* A disabled interactive surface is removed from sequential focus, does not activate, and
|
|
95
|
+
* ignores programmatic clicks. A disabled surface is rendered at the `disabledOpacity` role.
|
|
96
|
+
*
|
|
97
|
+
* @defaultValue `false`
|
|
98
|
+
*/
|
|
99
|
+
disabled?: boolean | undefined;
|
|
100
|
+
/**
|
|
101
|
+
* Sequential focus index.
|
|
102
|
+
*
|
|
103
|
+
* An interactive surface defaults to `0`; a disabled interactive surface always uses `-1`.
|
|
104
|
+
*/
|
|
105
|
+
tabIndex?: number | undefined;
|
|
106
|
+
/**
|
|
107
|
+
* Handle activation of a selectable surface.
|
|
108
|
+
*
|
|
109
|
+
* Invoked for controlled and uncontrolled surfaces, *before* an uncontrolled surface updates
|
|
110
|
+
* its own state.
|
|
111
|
+
*
|
|
112
|
+
* @remarks
|
|
113
|
+
* This is **not** reactive.
|
|
114
|
+
*
|
|
115
|
+
* @param selected - requested selection state
|
|
116
|
+
* @param event - activating click event
|
|
117
|
+
*/
|
|
118
|
+
onSelectedChange?: ((selected: boolean, event: Event) => void) | undefined;
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* Surface properties, including the standard Cobweb interaction callbacks.
|
|
122
|
+
*/
|
|
123
|
+
export type SurfaceProps = InteractableProps<SurfaceBaseProps>;
|
|
124
|
+
/**
|
|
125
|
+
* Client controller of a {@link Surface}.
|
|
126
|
+
*
|
|
127
|
+
* The controller owns the surface's classes, button semantics and keyboard activation. While a
|
|
128
|
+
* surface is neither clickable nor selectable, it installs no activation listeners and enables no
|
|
129
|
+
* interaction states.
|
|
130
|
+
*/
|
|
131
|
+
export declare class SurfaceController extends InteractableController<SurfaceBaseProps> {
|
|
132
|
+
#private;
|
|
133
|
+
/**
|
|
134
|
+
* Construct a new `SurfaceController`.
|
|
135
|
+
*
|
|
136
|
+
* @param props - component properties
|
|
137
|
+
*/
|
|
138
|
+
constructor(props: SurfaceBaseProps);
|
|
139
|
+
/**
|
|
140
|
+
* Apply local properties to component state and styling.
|
|
141
|
+
*
|
|
142
|
+
* @see {@link ../dom/client#DomController.applyComponentProps}
|
|
143
|
+
*/
|
|
144
|
+
protected applyComponentProps(): void;
|
|
145
|
+
/**
|
|
146
|
+
* Toggle a selectable surface when it, rather than a nested control, is activated.
|
|
147
|
+
*
|
|
148
|
+
* @param event - interaction event received by the controller
|
|
149
|
+
*/
|
|
150
|
+
protected onEvent(event: Event): void;
|
|
151
|
+
/**
|
|
152
|
+
* Render the component's element tree.
|
|
153
|
+
*
|
|
154
|
+
* @param children - nested component children, possibly an accessor
|
|
155
|
+
* @returns rendered component elements
|
|
156
|
+
* @see {@link ../dom/client#DomController.render}
|
|
157
|
+
*/
|
|
158
|
+
protected render(children: JSX.Element): JSX.Element;
|
|
159
|
+
/**
|
|
160
|
+
* Release activation listeners when the controller is disposed.
|
|
161
|
+
*
|
|
162
|
+
* @see {@link ../dom/client#DomController.onControllerCleanup}
|
|
163
|
+
*/
|
|
164
|
+
protected onControllerCleanup(): void;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Material surface container.
|
|
168
|
+
*
|
|
169
|
+
* A surface is a container on a Material color role, with an optional corner shape and elevation.
|
|
170
|
+
* It can also act as a button, or as an independent toggle, while keeping native keyboard and ARIA
|
|
171
|
+
* semantics available to assistive technology.
|
|
172
|
+
*
|
|
173
|
+
* # States
|
|
174
|
+
*
|
|
175
|
+
* A {@link SurfaceBaseProps.clickable | clickable} or {@link SurfaceBaseProps.selectable |
|
|
176
|
+
* selectable} surface has the `button` role and enters the {@link FocusState | focus}, {@link
|
|
177
|
+
* HoverState | hover}, and {@link PressState | press} interaction states, unless it is {@link
|
|
178
|
+
* SurfaceBaseProps.disabled | disabled}. A selectable surface exposes its selection through
|
|
179
|
+
* `aria-pressed`; a selected surface uses the selected container and content colors.
|
|
180
|
+
*
|
|
181
|
+
* # Design
|
|
182
|
+
*
|
|
183
|
+
* Surface design is controlled through the [`cw-Surface`](./surface.yaml) component design
|
|
184
|
+
* attribute. The `cw-Surface-clickable`, `cw-Surface-selectable`, `cw-Surface-selected`, and
|
|
185
|
+
* `cw-Surface-disabled` classes reflect the corresponding properties, and `cw-Surface-<state>`
|
|
186
|
+
* classes reflect the entered interaction state. State layers use the `cw-State` layer opacities
|
|
187
|
+
* on the content color, and the focus indicator uses the `cw-State` focus indicator roles.
|
|
188
|
+
*
|
|
189
|
+
* @param props - component properties
|
|
190
|
+
* @returns rendered component elements
|
|
191
|
+
*/
|
|
192
|
+
export declare const Surface: InteractableComponent<SurfaceBaseProps>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typography and typescale definitions.
|
|
3
|
+
*
|
|
4
|
+
* This module defines the {@link Text} component, which renders text according to the baseline
|
|
5
|
+
* and emphasized styles of the [`cw-Typescale`](./typescale.yaml) design attribute, and the {@link
|
|
6
|
+
* Typography} component, which selects the [`cw-LineHeight`](./line-height.yaml) category of a
|
|
7
|
+
* subtree by language.
|
|
8
|
+
*
|
|
9
|
+
* Fonts are named by the [`cw-Typeface`](./typeface.yaml) design attribute; Cobweb does not
|
|
10
|
+
* bundle them, so applications load the named fonts, for example with `@font-face` rules. The
|
|
11
|
+
* root stylesheet defines the `cw-LineHeight` properties referenced by every typescale role.
|
|
12
|
+
*
|
|
13
|
+
* @packageDocumentation
|
|
14
|
+
*/
|
|
15
|
+
export type { TextEmphasis, TextProps, TextRole, TextSize, Typescale } from "./text";
|
|
16
|
+
export { Text } from "./text";
|
|
17
|
+
export type { TypographyHeight, TypographyProps } from "./typography";
|
|
18
|
+
export { Typography } from "./typography";
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import type { JSX, VoidProps } from "solid-js";
|
|
2
|
+
import type { DomComponent, DomProps } from "..";
|
|
3
|
+
import "./text.css";
|
|
4
|
+
/**
|
|
5
|
+
* {@link Text} display role enumeration.
|
|
6
|
+
*
|
|
7
|
+
* This equals the top-level group roles of the [`cw-Typescale`](./typescale.yaml) design
|
|
8
|
+
* attribute.
|
|
9
|
+
*
|
|
10
|
+
* @see {@link Typescale}
|
|
11
|
+
*/
|
|
12
|
+
export type TextRole = "body" | "display" | "headline" | "label" | "title";
|
|
13
|
+
/**
|
|
14
|
+
* {@link Text} size enumeration.
|
|
15
|
+
*
|
|
16
|
+
* This equals the {@link TextRole | role} size group roles of the
|
|
17
|
+
* [`cw-Typescale`](./typescale.yaml) design attribute.
|
|
18
|
+
*
|
|
19
|
+
* @see {@link Typescale}
|
|
20
|
+
*/
|
|
21
|
+
export type TextSize = "large" | "medium" | "small";
|
|
22
|
+
/**
|
|
23
|
+
* {@link Text} emphasis enumeration.
|
|
24
|
+
*
|
|
25
|
+
* Emphasized styles use the same role and size as their baseline counterparts, with a heavier
|
|
26
|
+
* weight and the tracking specified by Material 3 Expressive.
|
|
27
|
+
*
|
|
28
|
+
* @see {@link Typescale}
|
|
29
|
+
*/
|
|
30
|
+
export type TextEmphasis = "emphasized";
|
|
31
|
+
/**
|
|
32
|
+
* Typescale a {@link Text | text} is rendered with.
|
|
33
|
+
*
|
|
34
|
+
* Typescale may be a {@link TextRole | role}, {@link TextSize | size}, and optional {@link
|
|
35
|
+
* TextEmphasis | emphasis}, delimited by hyphens, or just a role. When set to just a role, the
|
|
36
|
+
* default `"large"` size and baseline style are applied.
|
|
37
|
+
*
|
|
38
|
+
* @see {@link TextProps.scale}
|
|
39
|
+
*/
|
|
40
|
+
export type Typescale = `${TextRole}-${TextSize}-${TextEmphasis}` | `${TextRole}-${TextSize}` | TextRole;
|
|
41
|
+
/**
|
|
42
|
+
* {@link Text} component properties.
|
|
43
|
+
*/
|
|
44
|
+
export type TextProps = VoidProps<DomProps<HTMLSpanElement, JSX.HTMLElementTags["span"]>> & {
|
|
45
|
+
/**
|
|
46
|
+
* Typescale text is rendered with.
|
|
47
|
+
*
|
|
48
|
+
* @defaultValue `"body-large"`
|
|
49
|
+
*/
|
|
50
|
+
scale?: Typescale;
|
|
51
|
+
/**
|
|
52
|
+
* Text content.
|
|
53
|
+
*/
|
|
54
|
+
value?: string;
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Text rendered with {@link Typescale | typescale}.
|
|
58
|
+
*
|
|
59
|
+
* This renders {@link TextProps.value | `props.value`} with typescale CSS properties based on
|
|
60
|
+
* {@link TextProps.scale | `props.scale`}.
|
|
61
|
+
*
|
|
62
|
+
* ```tsx
|
|
63
|
+
* import type { JSX, VoidProps } from "solid-js";
|
|
64
|
+
*
|
|
65
|
+
* import { Text } from "@pg-labs-incubator/cobweb/text";
|
|
66
|
+
*
|
|
67
|
+
* export default function(_props: VoidProps): JSX.Element {
|
|
68
|
+
* return <>
|
|
69
|
+
* <Text value="Body (large): --cw-Typescale-body-large" />
|
|
70
|
+
* <Text
|
|
71
|
+
* scale="body-small"
|
|
72
|
+
* value="Body (small): --cw-Typescale-body-small" />
|
|
73
|
+
* <Text
|
|
74
|
+
* scale="label"
|
|
75
|
+
* value="Label (large): --cw-Typescale-label-large" />
|
|
76
|
+
* </>;
|
|
77
|
+
* }
|
|
78
|
+
* ```
|
|
79
|
+
*
|
|
80
|
+
* # Design
|
|
81
|
+
*
|
|
82
|
+
* The [`cw-Typescale`](./typescale.yaml) design attribute controls the typescale CSS properties
|
|
83
|
+
* of the rendered text. Typescale size and roles can be controlled using `props.scale`. Fonts are
|
|
84
|
+
* selected by the [`cw-Typeface`](./typeface.yaml) design attribute and are not bundled; see its
|
|
85
|
+
* description for loading them. Line heights follow the language within a {@link
|
|
86
|
+
* ./typography#Typography | typography} scope.
|
|
87
|
+
*
|
|
88
|
+
* Note that the rendered text is *not* selectable or interactable. If selection or interaction
|
|
89
|
+
* is required, `user-select`, `pointer-events`, and `touch-action` should be used.
|
|
90
|
+
*
|
|
91
|
+
* @param props - text properties
|
|
92
|
+
* @returns rendered element
|
|
93
|
+
*/
|
|
94
|
+
export declare const Text: DomComponent<TextProps>;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type { JSX } from "solid-js";
|
|
2
|
+
import type { DomComponent, DomProps } from "..";
|
|
3
|
+
import "./typography.css";
|
|
4
|
+
/**
|
|
5
|
+
* Line height category of a {@link Typography} scope.
|
|
6
|
+
*
|
|
7
|
+
* Categories select line heights of the [`cw-LineHeight`](./line-height.yaml) design attribute:
|
|
8
|
+
*
|
|
9
|
+
* | Category | Line heights |
|
|
10
|
+
* | -------------- | -------------------------------------------------------------------- |
|
|
11
|
+
* | `"auto"` | Category of the language, see {@link Typography}. |
|
|
12
|
+
* | `"small"` | Default role values, Material's type scale line heights. |
|
|
13
|
+
* | `"medium"` | `medium` theme, for dense and tall scripts. |
|
|
14
|
+
* | `"large"` | `large` theme, for Burmese and Telugu. |
|
|
15
|
+
* | `"extraLarge"` | `extraLarge` theme, for script styles such as Nastaliq. |
|
|
16
|
+
*/
|
|
17
|
+
export type TypographyHeight = "auto" | "small" | "medium" | "large" | "extraLarge";
|
|
18
|
+
/**
|
|
19
|
+
* {@link Typography} component properties.
|
|
20
|
+
*/
|
|
21
|
+
export type TypographyProps = DomProps<HTMLDivElement, JSX.HTMLElementTags["div"]> & {
|
|
22
|
+
/**
|
|
23
|
+
* Line height category applied within the scope.
|
|
24
|
+
*
|
|
25
|
+
* An explicit category applies to the whole scope, including nested elements declaring another
|
|
26
|
+
* language, until a nested scope selects its own height. `"auto"` selects the category by
|
|
27
|
+
* language, also within a scope of an explicit category.
|
|
28
|
+
*
|
|
29
|
+
* @defaultValue `"auto"`
|
|
30
|
+
*/
|
|
31
|
+
height?: TypographyHeight;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Typography scope selecting line heights by language.
|
|
35
|
+
*
|
|
36
|
+
* Text rendered with [`cw-Typescale`](./typescale.yaml) roles uses the line heights of the
|
|
37
|
+
* [`cw-LineHeight`](./line-height.yaml) design attribute. Outside of a scope, these are the small
|
|
38
|
+
* category: Material's type scale line heights, which suit English-like scripts. Within a scope,
|
|
39
|
+
* the scope element and every nested element with a `lang` attribute select the first of:
|
|
40
|
+
*
|
|
41
|
+
* 1. the {@link TypographyProps.height | height} of the nearest scope, unless `"auto"`;
|
|
42
|
+
*
|
|
43
|
+
* 2. the category of the script subtag of the nearest language tag: medium for dense and tall
|
|
44
|
+
* scripts (Arabic, Bengali, Devanagari, Ethiopic, Gujarati, Gurmukhi, Han, Hangul, Japanese
|
|
45
|
+
* kana, Kannada, Khmer, Lao, Malayalam, Odia, Sinhala, Tamil, Thai, and Tibetan), large for
|
|
46
|
+
* Burmese and Telugu, and small for Cyrillic, Greek, Hebrew, and Latin, except Vietnamese;
|
|
47
|
+
*
|
|
48
|
+
* 3. the category of the language: medium for languages written in a dense or tall script by
|
|
49
|
+
* default and for Vietnamese, large for Burmese and Telugu, and small for every other
|
|
50
|
+
* language, including undetermined ones.
|
|
51
|
+
*
|
|
52
|
+
* Nastaliq requires an explicit `"extraLarge"` height, since an Arabic script or language tag does
|
|
53
|
+
* not identify the font style. Baseline and emphasized styles share their line heights, while
|
|
54
|
+
* `cw-Typescale` line height overrides and authored `line-height` declarations retain their normal
|
|
55
|
+
* priority. Categories are resolved by CSS alone, so the server renders the same markup regardless
|
|
56
|
+
* of the language of the document.
|
|
57
|
+
*
|
|
58
|
+
* ```tsx
|
|
59
|
+
* import { Text, Typography } from "@pg-labs-incubator/cobweb/text";
|
|
60
|
+
*
|
|
61
|
+
* <Typography attr:lang="ar">
|
|
62
|
+
* <Text value="مرحبا" />
|
|
63
|
+
* <Typography height="extraLarge" attr:lang="ur">
|
|
64
|
+
* <Text value="خوش آمدید" />
|
|
65
|
+
* </Typography>
|
|
66
|
+
* </Typography>
|
|
67
|
+
* ```
|
|
68
|
+
*
|
|
69
|
+
* # Design
|
|
70
|
+
*
|
|
71
|
+
* The categories are the default values and the `medium`, `large`, and `extraLarge` themes of the
|
|
72
|
+
* [`cw-LineHeight`](./line-height.yaml) design attribute. Categories are a Cobweb web adaptation;
|
|
73
|
+
* Material's type scale defines the small category only.
|
|
74
|
+
*
|
|
75
|
+
* # Styles
|
|
76
|
+
*
|
|
77
|
+
* The scope element has the `cw-Typography` class.
|
|
78
|
+
*
|
|
79
|
+
* @param props - typography scope properties
|
|
80
|
+
* @returns rendered scope element
|
|
81
|
+
*/
|
|
82
|
+
export declare const Typography: DomComponent<TypographyProps>;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Top {@link BoxSide | side} of box, equivalent to `block-start`.
|
|
3
|
+
*
|
|
4
|
+
* @see {@link BoxSide}
|
|
5
|
+
*/
|
|
6
|
+
export declare const BoxTop = 0;
|
|
7
|
+
/**
|
|
8
|
+
* Right {@link BoxSide | side} of box, equivalent to `inline-end`.
|
|
9
|
+
*
|
|
10
|
+
* @see {@link BoxSide}
|
|
11
|
+
*/
|
|
12
|
+
export declare const BoxRight = 1;
|
|
13
|
+
/**
|
|
14
|
+
* Bottom {@link BoxSide | side} of box, equivalent to `block-end`.
|
|
15
|
+
*
|
|
16
|
+
* @see {@link BoxSide}
|
|
17
|
+
*/
|
|
18
|
+
export declare const BoxBottom = 2;
|
|
19
|
+
/**
|
|
20
|
+
* Left {@link BoxSide | side} of box, equivalent to `inline-start`.
|
|
21
|
+
*
|
|
22
|
+
* @see {@link BoxSide}
|
|
23
|
+
*/
|
|
24
|
+
export declare const BoxLeft = 3;
|
|
25
|
+
/**
|
|
26
|
+
* Union of box sides.
|
|
27
|
+
*
|
|
28
|
+
* Each side discriminant evaluates to an integer equal to the common CSS value order for the
|
|
29
|
+
* respective side. For example, the
|
|
30
|
+
* [`border-color`](https://developer.mozilla.org/en-US/docs/Web/CSS/border-color) property can
|
|
31
|
+
* be assigned to a list of values which style the top, right, bottom, and left border color.
|
|
32
|
+
*
|
|
33
|
+
* @see {@link LogicalBoxSides}
|
|
34
|
+
*/
|
|
35
|
+
export type BoxSide = typeof BoxBottom | typeof BoxLeft | typeof BoxRight | typeof BoxTop;
|
|
36
|
+
/**
|
|
37
|
+
* Table mapping logical box {@link BoxSide | side} to physical side.
|
|
38
|
+
*
|
|
39
|
+
* The {@link BoxTop}, {@link BoxRight}, {@link BoxBottom}, and {@link BoxLeft} constants can be
|
|
40
|
+
* used to retrieve the physical side block-start, inline-end, block-end, and inline-start logical
|
|
41
|
+
* sides map to, respectively.
|
|
42
|
+
*
|
|
43
|
+
* @see {@link BoxSide}
|
|
44
|
+
* @see {@link logicalBoxSidesOf}
|
|
45
|
+
*/
|
|
46
|
+
export type LogicalBoxSides = [
|
|
47
|
+
top: BoxSide,
|
|
48
|
+
right: BoxSide,
|
|
49
|
+
bottom: BoxSide,
|
|
50
|
+
left: BoxSide
|
|
51
|
+
];
|
|
52
|
+
/**
|
|
53
|
+
* Determine whether a box side lies on the `x` or `y` axis.
|
|
54
|
+
*
|
|
55
|
+
* @param side - side to test
|
|
56
|
+
* @returns `0` or `1` if `side` lies on `x` or `y` axis, respectively
|
|
57
|
+
*/
|
|
58
|
+
export declare function axisOfBoxSide(side: BoxSide): 0 | 1;
|
|
59
|
+
/**
|
|
60
|
+
* Determine the logical box side {@link LogicalBoxSides | mapping} based on the current style of
|
|
61
|
+
* an element.
|
|
62
|
+
*
|
|
63
|
+
* This determines the logical to physical side mapping for `elem`, or pseudo-element `pseudoElem`
|
|
64
|
+
* of `elem`, based on the `direction` and `writing-mode` CSS properties currently styled for the
|
|
65
|
+
* element or pseudo-element. Unknown writing modes are mapped as `horizontal-tb`.
|
|
66
|
+
*
|
|
67
|
+
* In a {@link solid-js/web#isServer | server} environment, or when the document of `elem` has no
|
|
68
|
+
* browsing context, this returns the mapping of the `horizontal-tb` writing mode and the `ltr`
|
|
69
|
+
* direction.
|
|
70
|
+
*
|
|
71
|
+
* @param elem - element to determine logical side mapping of
|
|
72
|
+
* @param pseudoElem - pseudo-element selector, within `elem`, to resolve logical sides of, or
|
|
73
|
+
* `undefined` to resolve logical sides of `elem`
|
|
74
|
+
* @returns logical to physical side mapping
|
|
75
|
+
*/
|
|
76
|
+
export declare function logicalBoxSidesOf(elem: Element, pseudoElem?: string): LogicalBoxSides;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fail if {@link solid-js#DEV | debugging} is enabled *and* condition evaluates to `false`.
|
|
3
|
+
*
|
|
4
|
+
* If `cond` is a `boolean`, it is validated as-is; otherwise, `cond` must be a function which
|
|
5
|
+
* evaluates to a `boolean`, which is then validated.
|
|
6
|
+
*
|
|
7
|
+
* @param cond - condition to validate or function whose condition should be evaluated
|
|
8
|
+
* @param msg - message to fail with
|
|
9
|
+
* @throws {@link Error} debugging is enabled and `cond` is `false`
|
|
10
|
+
*/
|
|
11
|
+
export declare function assertDebug(cond: boolean | (() => boolean), msg?: string): asserts cond;
|
|
12
|
+
/**
|
|
13
|
+
* Print message if {@link solid-js#DEV | debugging} is enabled.
|
|
14
|
+
*
|
|
15
|
+
* This invokes `console.log()` with `msg` and `args` if, and only if, debugging is enabled.
|
|
16
|
+
*
|
|
17
|
+
* @param msg - message to print
|
|
18
|
+
* @param args - additional message arguments to print
|
|
19
|
+
*/
|
|
20
|
+
export declare function printDebug(msg?: unknown, ...args: unknown[]): void;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolve the value an element attribute is assigned to.
|
|
3
|
+
*
|
|
4
|
+
* Attribute values are resolved as follows:
|
|
5
|
+
*
|
|
6
|
+
* | `value` | ARIA and keyword attributes | Other attributes |
|
|
7
|
+
* | --------------------- | --------------------------- | ---------------- |
|
|
8
|
+
* | `undefined` or `null` | `null` | `null` |
|
|
9
|
+
* | `true` | `true` state keyword | `""` |
|
|
10
|
+
* | `false` | `false` state keyword | `null` |
|
|
11
|
+
* | `number` or `string` | text of `value` | text of `value` |
|
|
12
|
+
*
|
|
13
|
+
* ARIA states and properties, such as `aria-expanded` or `aria-pressed`, distinguish a `"false"`
|
|
14
|
+
* value from a missing attribute, unlike boolean attributes, such as `disabled` or `hidden`; their
|
|
15
|
+
* state keywords are `"true"` and `"false"`. The state keywords of other enumerated attributes
|
|
16
|
+
* are listed in {@link KEYWORD_ATTRIBUTES}.
|
|
17
|
+
*
|
|
18
|
+
* @param name - name of attribute
|
|
19
|
+
* @param value - value to resolve
|
|
20
|
+
* @returns value the attribute is assigned to, or `null` if the attribute is removed
|
|
21
|
+
*/
|
|
22
|
+
export declare function attributeValueOf(name: string, value: boolean | number | string | null | undefined): string | null;
|
|
23
|
+
/**
|
|
24
|
+
* Set attribute for element or remove attribute from element.
|
|
25
|
+
*
|
|
26
|
+
* The attribute is assigned to the value {@link attributeValueOf | resolved} for `value`, or is
|
|
27
|
+
* removed if `value` resolves to `null`. Values of any type other than `boolean`, `number`,
|
|
28
|
+
* `string`, `null`, or `undefined` leave the attribute unchanged.
|
|
29
|
+
*
|
|
30
|
+
* @param elem - element to set attribute on
|
|
31
|
+
* @param name - name of attribute
|
|
32
|
+
* @param value - value to set to
|
|
33
|
+
* @see {@link attributeValueOf}
|
|
34
|
+
*/
|
|
35
|
+
export declare function setAttribute(elem: Element, name: string, value: unknown): void;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* User-agent supports passive event listeners.
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* In a {@link solid-js/web#isServer | server} environment, this always evaluates to `false`.
|
|
6
|
+
*/
|
|
7
|
+
export declare const HAS_PASSIVE_EVENT_LISTENERS: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Transform event listener options to options supported by user-agent.
|
|
10
|
+
*
|
|
11
|
+
* @param opts - options to transform
|
|
12
|
+
* @param _target - ignored; accepted so that callers may pass the target the listener is
|
|
13
|
+
* registered with
|
|
14
|
+
* @returns `opts` if, and only if, user-agent {@link HAS_PASSIVE_EVENT_LISTENERS | supports}
|
|
15
|
+
* passive events; otherwise, `opts.capture` or `false` if `opts.capture` was not specified,
|
|
16
|
+
* respectively
|
|
17
|
+
*/
|
|
18
|
+
export declare function eventListenerOptionsOf(opts: AddEventListenerOptions, _target?: EventTarget): AddEventListenerOptions | boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Defer a component request until bubbling consumers had an opportunity to cancel an event.
|
|
21
|
+
*
|
|
22
|
+
* Components listen to events on their elements directly, while SolidJS invokes delegated event
|
|
23
|
+
* handlers, such as `onClick` and `event:click` handlers, from a listener of the document, which
|
|
24
|
+
* is invoked *after* component listeners. This defers the request of a component, received
|
|
25
|
+
* through `event`, until delegated handlers, and listeners of the window, had an opportunity to
|
|
26
|
+
* veto the request by cancelling `event` with `preventDefault()`. If `event` was cancelled by
|
|
27
|
+
* then, the request is discarded. Otherwise, the request is accepted: the default action of
|
|
28
|
+
* `event` is cancelled, if `preventDefault` is `true`, and `action` is invoked in a microtask.
|
|
29
|
+
*
|
|
30
|
+
* If `event` bubbles to a document, requests settle at the first of:
|
|
31
|
+
*
|
|
32
|
+
* 1. `event` reaching the window, once listeners of the window, registered before `event` was
|
|
33
|
+
* dispatched, were invoked.
|
|
34
|
+
*
|
|
35
|
+
* 2. the end of propagation at the document, if propagation was stopped by then, for example, by
|
|
36
|
+
* a delegated handler, once listeners of the document were invoked.
|
|
37
|
+
*
|
|
38
|
+
* 3. a microtask, queued when `stopPropagation()` or `stopImmediatePropagation()` is invoked on
|
|
39
|
+
* `event`; this observes propagation stopped before `event` reaches the document.
|
|
40
|
+
*
|
|
41
|
+
* 4. a task, or a microtask if `event` is not trusted, queued when the request is deferred, if
|
|
42
|
+
* none of the above is observed, for example, as propagation was stopped through the
|
|
43
|
+
* `cancelBubble` setter, or a listener of the window deferred the request.
|
|
44
|
+
*
|
|
45
|
+
* If `event` does not bubble, does not propagate to a document, or was stopped from propagating
|
|
46
|
+
* further, no delegated handler can observe it, and requests settle in a microtask.
|
|
47
|
+
*
|
|
48
|
+
* The default action of `event` can be cancelled only while `event` is dispatched. Microtasks
|
|
49
|
+
* run once the JavaScript execution context stack is empty. When the user agent dispatches an
|
|
50
|
+
* event, for example, in response to user input, the stack is empty after each listener returns,
|
|
51
|
+
* so a microtask queued by a listener runs *before* the next listener is invoked, while the event
|
|
52
|
+
* is still dispatched. When script dispatches an event, for example, through `dispatchEvent()`,
|
|
53
|
+
* `click()`, or `focus()`, the stack is empty only after that script returns, which is *after*
|
|
54
|
+
* the event was dispatched; requests which settle in a microtask still invoke their actions, but
|
|
55
|
+
* can no longer cancel the default action.
|
|
56
|
+
*
|
|
57
|
+
* @param event - event the request is received through
|
|
58
|
+
* @param _root - ignored, as the propagation path is resolved from `event`; accepted so that
|
|
59
|
+
* callers may pass the element whose listener received `event`
|
|
60
|
+
* @param action - function to invoke when the request is accepted
|
|
61
|
+
* @param preventDefault - `true` if, and only if, the default action of `event` is cancelled when
|
|
62
|
+
* the request is accepted; defaults to `true`
|
|
63
|
+
* @remarks
|
|
64
|
+
* Deferred requests are subject to the following:
|
|
65
|
+
*
|
|
66
|
+
* - Any invocation of `preventDefault()` before requests settle vetoes them, including those not
|
|
67
|
+
* intended to veto a component request, such as that of a router handling a click on a link.
|
|
68
|
+
*
|
|
69
|
+
* - Requests deferred for the same event settle together, in the order they were deferred. The
|
|
70
|
+
* first accepted request which cancels the default action consumes the event, and requests
|
|
71
|
+
* deferred after it are discarded; for example, of nested components handling the same event,
|
|
72
|
+
* the innermost component consumes the event.
|
|
73
|
+
*
|
|
74
|
+
* - An action which tests `event.defaultPrevented` must not cancel the default action
|
|
75
|
+
* (`preventDefault` is `false`); otherwise, the action observes its own cancellation.
|
|
76
|
+
*
|
|
77
|
+
* - Listeners invoked after requests settled, such as listeners of the same target as the
|
|
78
|
+
* listener which stopped propagation, cannot veto requests.
|
|
79
|
+
*/
|
|
80
|
+
export declare function deferAfterDelegatedCancellation(event: Event, _root: Element | null, action: () => void, preventDefault?: boolean): void;
|
|
81
|
+
/**
|
|
82
|
+
* Test whether a pointer leaving an element moves into the element, or one of its descendants.
|
|
83
|
+
*
|
|
84
|
+
* Chromium dispatches `pointerleave` to a pseudo-element the pointer leaves for its originating
|
|
85
|
+
* element, or a descendant of it, while a capturing `pointerleave` listener is installed on an
|
|
86
|
+
* ancestor. The event is retargeted to the originating element, although the pointer is still
|
|
87
|
+
* within it: such a leave toward its own subtree is not a leave of the element.
|
|
88
|
+
*
|
|
89
|
+
* @param event - `pointerleave` event received
|
|
90
|
+
* @param elem - element `event` is targeted at
|
|
91
|
+
* @returns `true` if, and only if, the related target of `event` is `elem`, or a descendant of it
|
|
92
|
+
*/
|
|
93
|
+
export declare function isLeaveWithin(event: PointerEvent, elem: Element): boolean;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility definitions.
|
|
3
|
+
*
|
|
4
|
+
* @packageDocumentation
|
|
5
|
+
*/
|
|
6
|
+
export type { BoxSide, LogicalBoxSides } from "./box-side";
|
|
7
|
+
export { BoxBottom, BoxLeft, BoxRight, BoxTop, axisOfBoxSide, logicalBoxSidesOf } from "./box-side";
|
|
8
|
+
export { assertDebug, printDebug } from "./debug";
|
|
9
|
+
export { attributeValueOf, setAttribute } from "./dom";
|
|
10
|
+
export { HAS_PASSIVE_EVENT_LISTENERS, deferAfterDelegatedCancellation, eventListenerOptionsOf } from "./event";
|
|
11
|
+
export { checkArgument, checkArray, checkBoolean, checkBrowser, checkNumber, checkObject, checkServer, checkState, checkString, checkValueDefined } from "./preconditions";
|
|
12
|
+
export { consumeProps, isPropReactive } from "./reactive";
|