@galaxy-io/dls 2.3.0 → 2.3.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.
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
// DLS: no inline `style={{ … }}` except to set CSS custom properties (Constitution IV.1).
|
|
2
|
-
// `style={{ "--gx-x": value, ["--gx-y"]: value, ...style }}` is
|
|
3
|
-
//
|
|
2
|
+
// `style={{ "--gx-x": value, ["--gx-y"]: value, [GRID_BACKGROUND_COLOR_VAR]: value, ...style }}` is
|
|
3
|
+
// fine (a computed key named `*_VAR` is an exported custom-property constant); `style={{ color: … }}`,
|
|
4
|
+
// `style={{ color }}` (shorthand) and `style={{ [key]: … }}` (any other computed key) are not.
|
|
4
5
|
language js
|
|
5
6
|
|
|
6
7
|
JsxAttribute(name=$name, initializer=$value) where {
|
|
7
8
|
$name <: "style",
|
|
8
9
|
$value <: contains or {
|
|
9
|
-
JsPropertyObjectMember(name=$key) as $member where {
|
|
10
|
+
JsPropertyObjectMember(name=$key) as $member where {
|
|
11
|
+
$key <: not r"(?s)(?:(?:\[\s*)?[\"'`]--.*|\[\s*[A-Z][A-Z0-9_]*_VAR\s*\])"
|
|
12
|
+
},
|
|
10
13
|
JsShorthandPropertyObjectMember() as $member
|
|
11
14
|
},
|
|
12
15
|
register_diagnostic(span=$member, message="DLS: inline style may only set CSS custom properties (`--gx-*`). Style with Linaria.", severity="error")
|
|
@@ -6,7 +6,9 @@ language js
|
|
|
6
6
|
JsxAttribute(name=$name, initializer=$value) where {
|
|
7
7
|
$name <: "style",
|
|
8
8
|
$value <: contains or {
|
|
9
|
-
JsPropertyObjectMember(name=$key) as $member where {
|
|
9
|
+
JsPropertyObjectMember(name=$key) as $member where {
|
|
10
|
+
$key <: not r"(?s)(?:(?:\[\s*)?[\"'`]--.*|\[\s*[A-Z][A-Z0-9_]*_VAR\s*\])"
|
|
11
|
+
},
|
|
10
12
|
JsShorthandPropertyObjectMember() as $member
|
|
11
13
|
},
|
|
12
14
|
register_diagnostic(span=$member, message="DLS: inline style may only set CSS custom properties (`--gx-*`). Style with Linaria.", severity="warn")
|
|
@@ -21,6 +21,15 @@ export declare enum GridBackgroundSize {
|
|
|
21
21
|
/** 48px pitch. */
|
|
22
22
|
X_LARGE = "X_LARGE"
|
|
23
23
|
}
|
|
24
|
+
/** Custom property for the mark color: a `t.color.*` token. Unset, each pattern uses its own `opacity.fg*` token. */
|
|
25
|
+
export declare const GRID_BACKGROUND_COLOR_VAR = "--gx-grid-background-color";
|
|
26
|
+
/** Custom property for the pattern's opacity, 0 to 1. Unset, `1`. */
|
|
27
|
+
export declare const GRID_BACKGROUND_OPACITY_VAR = "--gx-grid-background-opacity";
|
|
28
|
+
/** `style` for GridBackground: CSS custom properties only, typed for the two it reads. */
|
|
29
|
+
export type GridBackgroundStyle = CSSProperties & {
|
|
30
|
+
[GRID_BACKGROUND_COLOR_VAR]?: string;
|
|
31
|
+
[GRID_BACKGROUND_OPACITY_VAR]?: number;
|
|
32
|
+
};
|
|
24
33
|
export interface GridBackgroundProps extends AriaAttributes {
|
|
25
34
|
/**
|
|
26
35
|
* The mark repeated across the grid: dots, small crosses at the intersections, or ruled cells.
|
|
@@ -40,8 +49,8 @@ export interface GridBackgroundProps extends AriaAttributes {
|
|
|
40
49
|
[dataAttribute: `data-${string}`]: string | number | boolean | undefined;
|
|
41
50
|
/** Extra class on the root `<div>`. */
|
|
42
51
|
className?: string;
|
|
43
|
-
/** Inline style on the root `<div>`; only for setting CSS custom properties. */
|
|
44
|
-
style?:
|
|
52
|
+
/** Inline style on the root `<div>`; only for setting CSS custom properties (`GRID_BACKGROUND_COLOR_VAR`, `GRID_BACKGROUND_OPACITY_VAR`). */
|
|
53
|
+
style?: GridBackgroundStyle;
|
|
45
54
|
}
|
|
46
55
|
/** A dot, cross or cell grid painted behind centered content. */
|
|
47
56
|
declare const GridBackground: import("react").ForwardRefExoticComponent<GridBackgroundProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -12,6 +12,10 @@ import { match } from "ts-pattern";
|
|
|
12
12
|
* token, so the pattern follows the theme through CSS alone, with the same
|
|
13
13
|
* markup on the server and the client. Decoration only: not interactive, no semantics.
|
|
14
14
|
*
|
|
15
|
+
* Two custom properties tune the marks through `style`: `GRID_BACKGROUND_COLOR_VAR` takes a
|
|
16
|
+
* `t.color.*` token for the mark color, `GRID_BACKGROUND_OPACITY_VAR` a 0 to 1 opacity for the
|
|
17
|
+
* whole pattern. Unset, the pattern keeps its quiet default.
|
|
18
|
+
*
|
|
15
19
|
* Replaces 1.x `DotGridBackground`, `CrossGridBackground` and `CellGridBackground` (`pattern`;
|
|
16
20
|
* `spacing` / `cellSize` → `size`; the color, opacity, stroke, radius and fill props are gone).
|
|
17
21
|
*/
|
|
@@ -39,6 +43,10 @@ var GridBackgroundSize = /* @__PURE__ */ function(GridBackgroundSize) {
|
|
|
39
43
|
GridBackgroundSize["X_LARGE"] = "X_LARGE";
|
|
40
44
|
return GridBackgroundSize;
|
|
41
45
|
}({});
|
|
46
|
+
/** Custom property for the mark color: a `t.color.*` token. Unset, each pattern uses its own `opacity.fg*` token. */
|
|
47
|
+
var GRID_BACKGROUND_COLOR_VAR = "--gx-grid-background-color";
|
|
48
|
+
/** Custom property for the pattern's opacity, 0 to 1. Unset, `1`. */
|
|
49
|
+
var GRID_BACKGROUND_OPACITY_VAR = "--gx-grid-background-opacity";
|
|
42
50
|
/** Fills the parent and centers the children; a stacking context so the layer sits under them. */
|
|
43
51
|
var Root = /*#__PURE__*/ styled("div")({
|
|
44
52
|
name: "Root",
|
|
@@ -51,7 +59,7 @@ var Layer = /*#__PURE__*/ styled("svg")({
|
|
|
51
59
|
class: "gx-GridBackground-Layer-lvvo1cl",
|
|
52
60
|
propsAsIs: false
|
|
53
61
|
});
|
|
54
|
-
/** The mark color per pattern, on the layer only (never inherited by the children). */
|
|
62
|
+
/** The default mark color per pattern, on the layer only (never inherited by the children); `GRID_BACKGROUND_COLOR_VAR` overrides it. */
|
|
55
63
|
var GRID_BACKGROUND_PATTERN_TO_CSS_MAP = {
|
|
56
64
|
["DOT"]: "gx-GridBackground-DOT-d1ezsakb",
|
|
57
65
|
["CROSS"]: "gx-GridBackground-CROSS-cl21ufg",
|
|
@@ -143,4 +151,4 @@ var GridBackground = forwardRef(function GridBackground({ pattern = "DOT", size
|
|
|
143
151
|
});
|
|
144
152
|
GridBackground.displayName = "GridBackground";
|
|
145
153
|
//#endregion
|
|
146
|
-
export { GridBackgroundPattern, GridBackgroundSize, GridBackground as default };
|
|
154
|
+
export { GRID_BACKGROUND_COLOR_VAR, GRID_BACKGROUND_OPACITY_VAR, GridBackgroundPattern, GridBackgroundSize, GridBackground as default };
|