@nxgt/material 3.3.0 → 3.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/README.md +3 -3
  3. package/dist/backgrounds/backgrounds.css +30 -1
  4. package/dist/backgrounds/css-react/blobs.css +65 -0
  5. package/dist/backgrounds/css-react/bubbles.css +41 -0
  6. package/dist/backgrounds/css-react/checker.css +47 -0
  7. package/dist/backgrounds/css-react/chevrons.css +46 -0
  8. package/dist/backgrounds/css-react/circuit.css +111 -0
  9. package/dist/backgrounds/css-react/concrete.css +41 -0
  10. package/dist/backgrounds/css-react/diagonal-checker.css +48 -0
  11. package/dist/backgrounds/css-react/glass.css +99 -0
  12. package/dist/backgrounds/css-react/graph-paper.css +74 -0
  13. package/dist/backgrounds/css-react/halo.css +66 -0
  14. package/dist/backgrounds/css-react/hexagons.css +79 -0
  15. package/dist/backgrounds/css-react/illustrated.css +164 -0
  16. package/dist/backgrounds/css-react/leaves.css +41 -0
  17. package/dist/backgrounds/css-react/linen.css +44 -0
  18. package/dist/backgrounds/css-react/marble.css +55 -0
  19. package/dist/backgrounds/css-react/music.css +2 -0
  20. package/dist/backgrounds/css-react/night-sky.css +41 -0
  21. package/dist/backgrounds/css-react/paper.css +49 -0
  22. package/dist/backgrounds/css-react/plasma.css +53 -0
  23. package/dist/backgrounds/css-react/rays.css +67 -0
  24. package/dist/backgrounds/css-react/ripples.css +68 -0
  25. package/dist/backgrounds/css-react/school.css +2 -0
  26. package/dist/backgrounds/css-react/science.css +2 -0
  27. package/dist/backgrounds/css-react/sport.css +2 -0
  28. package/dist/backgrounds/css-react/travel.css +2 -0
  29. package/dist/backgrounds.js +57 -33
  30. package/dist/lib/backgrounds/background/available.d.ts +3 -3
  31. package/dist/lib/backgrounds/background/background.d.ts +2 -2
  32. package/dist/lib/backgrounds/index.d.ts +1 -1
  33. package/dist/material.css +1 -1
  34. package/docs/components/navigation-and-layout.md +1 -1
  35. package/docs/getting-started.md +1 -1
  36. package/docs/guides/backgrounds.md +94 -16
  37. package/docs/previews/backgrounds-geometry-more.webp +0 -0
  38. package/docs/previews/backgrounds-illustrated-scenes.webp +0 -0
  39. package/docs/previews/backgrounds-light-more.webp +0 -0
  40. package/docs/previews/backgrounds-material-more.webp +0 -0
  41. package/docs/previews/backgrounds-matrix.webp +0 -0
  42. package/docs/previews/backgrounds-motif-shapes.webp +0 -0
  43. package/docs/roadmap.md +16 -4
  44. package/docs/troubleshooting.md +2 -2
  45. package/lib/backgrounds/backgrounds.css +30 -1
  46. package/lib/backgrounds/css-react/blobs.css +65 -0
  47. package/lib/backgrounds/css-react/bubbles.css +41 -0
  48. package/lib/backgrounds/css-react/checker.css +47 -0
  49. package/lib/backgrounds/css-react/chevrons.css +46 -0
  50. package/lib/backgrounds/css-react/circuit.css +111 -0
  51. package/lib/backgrounds/css-react/concrete.css +41 -0
  52. package/lib/backgrounds/css-react/diagonal-checker.css +48 -0
  53. package/lib/backgrounds/css-react/glass.css +99 -0
  54. package/lib/backgrounds/css-react/graph-paper.css +74 -0
  55. package/lib/backgrounds/css-react/halo.css +66 -0
  56. package/lib/backgrounds/css-react/hexagons.css +79 -0
  57. package/lib/backgrounds/css-react/illustrated.css +164 -0
  58. package/lib/backgrounds/css-react/leaves.css +41 -0
  59. package/lib/backgrounds/css-react/linen.css +44 -0
  60. package/lib/backgrounds/css-react/marble.css +55 -0
  61. package/lib/backgrounds/css-react/music.css +2 -0
  62. package/lib/backgrounds/css-react/night-sky.css +41 -0
  63. package/lib/backgrounds/css-react/paper.css +49 -0
  64. package/lib/backgrounds/css-react/plasma.css +53 -0
  65. package/lib/backgrounds/css-react/rays.css +67 -0
  66. package/lib/backgrounds/css-react/ripples.css +68 -0
  67. package/lib/backgrounds/css-react/school.css +2 -0
  68. package/lib/backgrounds/css-react/science.css +2 -0
  69. package/lib/backgrounds/css-react/sport.css +2 -0
  70. package/lib/backgrounds/css-react/travel.css +2 -0
  71. package/package.json +103 -2
@@ -0,0 +1,67 @@
1
+ /* The `rays` preset: a sunburst. A conic gradient of alternating rays from
2
+ * the top centre of the frame (`rays`, a layer twice the frame's size and
3
+ * centred on that point, faded with distance) over a tint (`wash`). CSS only.
4
+ * Blended with the page: it adds light in dark. Motion (opt-in, `animated`):
5
+ * the burst turns slowly. React only: nothing in the shared `css/` folder. */
6
+ @layer components {
7
+ [data-background="rays"] {
8
+ overflow: clip;
9
+ isolation: isolate;
10
+ }
11
+ [data-background="rays"] > [data-layer="wash"] {
12
+ position: absolute;
13
+ inset: 0;
14
+ background-image: radial-gradient(
15
+ ellipse 70% 60% at 50% 0%,
16
+ color-mix(in oklab, var(--nxgt-bg-c2) var(--nxgt-bg-a2), transparent),
17
+ transparent 75%
18
+ );
19
+ }
20
+ [data-background="rays"] > [data-layer="rays"] {
21
+ position: absolute;
22
+ top: -100%;
23
+ right: -50%;
24
+ bottom: 0;
25
+ left: -50%;
26
+ opacity: var(--nxgt-bg-op);
27
+ mix-blend-mode: var(--nxgt-bg-glow-blend);
28
+ background-image: repeating-conic-gradient(
29
+ from 0deg at 50% 50%,
30
+ color-mix(in oklab, var(--nxgt-bg-c1) 34%, transparent) 0deg 6deg,
31
+ transparent 6deg 9deg,
32
+ color-mix(in oklab, var(--nxgt-bg-c2) 24%, transparent) 9deg 12deg,
33
+ transparent 12deg 18deg,
34
+ color-mix(in oklab, var(--nxgt-bg-c3) 28%, transparent) 18deg 21deg,
35
+ transparent 21deg 30deg
36
+ );
37
+ -webkit-mask-image: radial-gradient(
38
+ closest-side,
39
+ rgb(0 0 0 / 0.5) 0,
40
+ black 14%,
41
+ rgb(0 0 0 / 0.35) 55%,
42
+ transparent
43
+ );
44
+ mask-image: radial-gradient(
45
+ closest-side,
46
+ rgb(0 0 0 / 0.5) 0,
47
+ black 14%,
48
+ rgb(0 0 0 / 0.35) 55%,
49
+ transparent
50
+ );
51
+ }
52
+ }
53
+
54
+ @media (prefers-reduced-motion: no-preference) {
55
+ @keyframes nxgt-bg-rays-turn {
56
+ to {
57
+ transform: rotate(30deg);
58
+ }
59
+ }
60
+
61
+ @layer components {
62
+ [data-background="rays"][data-animated] > [data-layer="rays"] {
63
+ animation: nxgt-bg-rays-turn 90s linear infinite
64
+ var(--nxgt-bg-play, running);
65
+ }
66
+ }
67
+ }
@@ -0,0 +1,68 @@
1
+ /* The `ripples` preset: rings spreading from three seeded centres, one tone
2
+ * colour each (`rp-c1..3`), fading outward, over a tint (`wash`). Blended
3
+ * with the page: it adds light in dark. Motion (opt-in, `animated`): each set
4
+ * of rings breathes at its own pace (`rp-d1..3`). React only: nothing in the
5
+ * shared `css/` folder. */
6
+ @import "../css/scene.css";
7
+
8
+ @layer components {
9
+ [data-background="ripples"] {
10
+ isolation: isolate;
11
+ }
12
+ [data-background="ripples"] > [data-layer="wash"] {
13
+ position: absolute;
14
+ inset: 0;
15
+ background-image: radial-gradient(
16
+ ellipse 90% 80% at 50% 50%,
17
+ color-mix(in oklab, var(--nxgt-bg-c1) var(--nxgt-bg-a1), transparent),
18
+ transparent 80%
19
+ );
20
+ }
21
+ [data-background="ripples"] > [data-scene] > svg {
22
+ mix-blend-mode: var(--nxgt-bg-glow-blend);
23
+ }
24
+ [data-background="ripples"] > [data-scene] circle {
25
+ fill: none;
26
+ stroke-width: 2;
27
+ opacity: var(--nxgt-bg-op);
28
+ }
29
+ [data-background="ripples"] > [data-scene] .rp-c1 {
30
+ stroke: var(--nxgt-bg-c1);
31
+ }
32
+ [data-background="ripples"] > [data-scene] .rp-c2 {
33
+ stroke: var(--nxgt-bg-c2);
34
+ }
35
+ [data-background="ripples"] > [data-scene] .rp-c3 {
36
+ stroke: var(--nxgt-bg-c3);
37
+ }
38
+ }
39
+
40
+ @media (prefers-reduced-motion: no-preference) {
41
+ @keyframes nxgt-bg-ripples-breathe {
42
+ from {
43
+ transform: scale(0.94);
44
+ }
45
+ to {
46
+ transform: scale(1.06);
47
+ }
48
+ }
49
+
50
+ @layer components {
51
+ [data-background="ripples"][data-animated] > [data-scene] [class^="rp-c"] {
52
+ animation: nxgt-bg-ripples-breathe 14s ease-in-out infinite alternate
53
+ var(--nxgt-bg-play, running);
54
+ transform-box: fill-box;
55
+ transform-origin: 50% 50%;
56
+ }
57
+ [data-background="ripples"][data-animated] > [data-scene] .rp-d1 {
58
+ animation-direction: alternate;
59
+ }
60
+ [data-background="ripples"][data-animated] > [data-scene] .rp-d2 {
61
+ animation-duration: 19s;
62
+ animation-direction: alternate-reverse;
63
+ }
64
+ [data-background="ripples"][data-animated] > [data-scene] .rp-d3 {
65
+ animation-duration: 24s;
66
+ }
67
+ }
68
+ }
@@ -0,0 +1,2 @@
1
+ /* The `school` preset: line drawings of one theme (see illustrated.css). Still. */
2
+ @import "./illustrated.css";
@@ -0,0 +1,2 @@
1
+ /* The `science` preset: line drawings of one theme (see illustrated.css). Still. */
2
+ @import "./illustrated.css";
@@ -0,0 +1,2 @@
1
+ /* The `sport` preset: line drawings of one theme (see illustrated.css). Still. */
2
+ @import "./illustrated.css";
@@ -0,0 +1,2 @@
1
+ /* The `travel` preset: line drawings of one theme (see illustrated.css). Still. */
2
+ @import "./illustrated.css";
@@ -3,52 +3,76 @@ import { t } from "./compose-refs-DZ0iIVF-.js";
3
3
  import { t as n } from "./use-background-activity-B8jLHNop.js";
4
4
  import { createElement as r, memo as i, useId as a, useMemo as o, useRef as s } from "react";
5
5
  import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
6
- import { BACKGROUND_INTENSITIES as d, BACKGROUND_PRESETS as f, BACKGROUND_TONES as p, MOTIF_SHAPES as m, SCENE_LAYER as h, SHIPPED_BACKGROUND_PRESETS as g, buildBackgroundScene as _, presetLayers as v, resolveBackgroundPreset as y, svgIdPrefix as b } from "@nxgt/material-core/backgrounds";
6
+ import { BACKGROUND_INTENSITIES as d, BACKGROUND_PRESETS as f, BACKGROUND_TONES as p, MOTIF_SHAPES as m, MOTIF_SHAPES_ALL as h, SCENE_LAYER as g, SHIPPED_BACKGROUND_PRESETS as _, buildBackgroundScene as v, presetLayers as y, resolveBackgroundPreset as b, svgIdPrefix as x } from "@nxgt/material-core/backgrounds";
7
7
  //#region lib/backgrounds/background/available.ts
8
- var x = [
8
+ var S = [
9
9
  "gradient",
10
10
  "grain",
11
11
  "mesh",
12
12
  "aurora",
13
13
  "spotlight",
14
- "bokeh"
15
- ], S = [
14
+ "bokeh",
15
+ "rays",
16
+ "halo",
17
+ "plasma",
18
+ "glass",
19
+ "ripples",
20
+ "blobs",
21
+ "paper",
22
+ "linen",
23
+ "concrete",
24
+ "marble"
25
+ ], C = [
16
26
  "isometric",
17
27
  "blueprint",
18
28
  "dots",
19
29
  "stripes",
20
30
  "low-poly",
21
31
  "topography",
22
- "waves"
23
- ], C = [
32
+ "waves",
33
+ "hexagons",
34
+ "circuit",
35
+ "graph-paper",
36
+ "checker",
37
+ "diagonal-checker",
38
+ "chevrons"
39
+ ], w = [
24
40
  "shapes",
25
41
  "confetti-grid",
26
42
  "constellation",
27
43
  "halftone",
28
44
  "truchet",
29
45
  "floating",
30
- "scatter-icons"
31
- ], w = [
32
- ...x,
46
+ "scatter-icons",
47
+ "school",
48
+ "night-sky",
49
+ "bubbles",
50
+ "leaves",
51
+ "science",
52
+ "music",
53
+ "travel",
54
+ "sport"
55
+ ], T = [
33
56
  ...S,
34
- ...C
35
- ], T = /^(aria|data)-/, E = (e) => e === "class" ? "className" : T.test(e) ? e : e.replace(/-([a-z])/g, (e, t) => t.toUpperCase()), D = i(function e({ node: t }) {
36
- let n = Object.fromEntries(Object.entries(t.attrs).map(([e, t]) => [E(e), t]));
57
+ ...C,
58
+ ...w
59
+ ], E = /^(aria|data)-/, D = (e) => e === "class" ? "className" : E.test(e) ? e : e.replace(/-([a-z])/g, (e, t) => t.toUpperCase()), O = i(function e({ node: t }) {
60
+ let n = Object.fromEntries(Object.entries(t.attrs).map(([e, t]) => [D(e), t]));
37
61
  return r(t.tag, n, ...(t.children ?? []).map((t, n) => /* @__PURE__ */ l(e, { node: t }, n)));
38
- }), O = i(function({ preset: e, scene: t, grain: n }) {
39
- return /* @__PURE__ */ u(c, { children: [v(e).map((e) => e === h ? t && /* @__PURE__ */ l("div", {
62
+ }), k = i(function({ preset: e, scene: t, grain: n }) {
63
+ return /* @__PURE__ */ u(c, { children: [y(e).map((e) => e === g ? t && /* @__PURE__ */ l("div", {
40
64
  "data-scene": "",
41
65
  "aria-hidden": "true",
42
- children: /* @__PURE__ */ l(D, { node: t })
66
+ children: /* @__PURE__ */ l(O, { node: t })
43
67
  }, e) : /* @__PURE__ */ l("div", {
44
68
  "data-layer": e,
45
69
  "aria-hidden": "true"
46
70
  }, e)), n && /* @__PURE__ */ l("div", {
47
71
  "data-overlay": "grain",
48
72
  "aria-hidden": "true",
49
- children: /* @__PURE__ */ l(D, { node: n })
73
+ children: /* @__PURE__ */ l(O, { node: n })
50
74
  })] });
51
- }), k = (e) => console.warn(e), A = Object.keys({
75
+ }), A = (e) => console.warn(e), j = Object.keys({
52
76
  shapes: 1,
53
77
  density: 1,
54
78
  size: 1,
@@ -56,37 +80,37 @@ var x = [
56
80
  shapeFill: 1,
57
81
  opacitySpread: 1
58
82
  }).filter((e) => e !== "shapes");
59
- function j(e) {
60
- return A.map((t) => e?.[t]);
83
+ function M(e) {
84
+ return j.map((t) => e?.[t]);
61
85
  }
62
- function M(e, t, n, r, i) {
86
+ function N(e, t, n, r, i) {
63
87
  if (e === "grain") return null;
64
88
  let a = JSON.parse(i);
65
- return _(e, {
89
+ return v(e, {
66
90
  idPrefix: t,
67
91
  seed: n,
68
92
  motif: {
69
- ...Object.fromEntries(A.map((e, t) => [e, a[t] ?? void 0])),
93
+ ...Object.fromEntries(j.map((e, t) => [e, a[t] ?? void 0])),
70
94
  shapes: r === void 0 ? void 0 : r.split(",").filter(Boolean)
71
95
  }
72
96
  });
73
97
  }
74
- function N(e, t) {
75
- return _("grain", {
98
+ function P(e, t) {
99
+ return v("grain", {
76
100
  idPrefix: `${e}-grain`,
77
101
  seed: t
78
102
  });
79
103
  }
80
- function P({ children: r, ref: i, preset: c = "gradient", tone: d = "primary", intensity: f = "default", animated: p = !1, grain: m = !1, seed: h = 0, motif: g, fill: _ = "viewport", ...v }) {
81
- let x = s(null), S = o(() => t(x, i), [i]), C = n(x, p), T = b(a()), E = y(c, w, e() ? void 0 : k), D = m || E === "grain", A = g?.shapes ? [...new Set(g.shapes)].sort().join(",") : void 0, P = JSON.stringify(j(g)), F = o(() => M(E, T, h, A, P), [
104
+ function F({ children: r, ref: i, preset: c = "gradient", tone: d = "primary", intensity: f = "default", animated: p = !1, grain: m = !1, seed: h = 0, motif: g, fill: _ = "viewport", ...v }) {
105
+ let y = s(null), S = o(() => t(y, i), [i]), C = n(y, p), w = x(a()), E = b(c, T, e() ? void 0 : A), D = m || E === "grain", O = g?.shapes ? [...new Set(g.shapes)].sort().join(",") : void 0, j = JSON.stringify(M(g)), F = o(() => N(E, w, h, O, j), [
82
106
  E,
83
- T,
107
+ w,
84
108
  h,
85
- A,
86
- P
87
- ]), I = o(() => D ? N(T, h) : null, [
109
+ O,
110
+ j
111
+ ]), I = o(() => D ? P(w, h) : null, [
88
112
  D,
89
- T,
113
+ w,
90
114
  h
91
115
  ]);
92
116
  return /* @__PURE__ */ u("div", {
@@ -101,7 +125,7 @@ function P({ children: r, ref: i, preset: c = "gradient", tone: d = "primary", i
101
125
  "data-animated": p ? "" : void 0,
102
126
  "data-grain": D ? "" : void 0,
103
127
  "data-paused": p && C ? "" : void 0,
104
- children: [/* @__PURE__ */ l(O, {
128
+ children: [/* @__PURE__ */ l(k, {
105
129
  preset: E,
106
130
  scene: F,
107
131
  grain: I
@@ -112,4 +136,4 @@ function P({ children: r, ref: i, preset: c = "gradient", tone: d = "primary", i
112
136
  });
113
137
  }
114
138
  //#endregion
115
- export { w as AVAILABLE_BACKGROUND_PRESETS, d as BACKGROUND_INTENSITIES, f as BACKGROUND_PRESETS, p as BACKGROUND_TONES, P as Background, m as MOTIF_SHAPES, g as SHIPPED_BACKGROUND_PRESETS };
139
+ export { T as AVAILABLE_BACKGROUND_PRESETS, d as BACKGROUND_INTENSITIES, f as BACKGROUND_PRESETS, p as BACKGROUND_TONES, F as Background, m as MOTIF_SHAPES, h as MOTIF_SHAPES_ALL, _ as SHIPPED_BACKGROUND_PRESETS };
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * The presets this library draws: the ids `BackgroundProps.preset` accepts.
3
- * Core's `BACKGROUND_PRESETS` is the table of all twenty presets, and its
3
+ * Core's `BACKGROUND_PRESETS` is the table of all 44 presets, and its
4
4
  * `SHIPPED_BACKGROUND_PRESETS` the common floor (`gradient`, `grain`) every
5
- * library draws; this list is `@nxgt/material`'s own and holds all twenty.
5
+ * library draws; this list is `@nxgt/material`'s own and holds all 44.
6
6
  * Any other id draws the gradient, with a warning outside production.
7
7
  */
8
- export declare const AVAILABLE_BACKGROUND_PRESETS: readonly ["gradient", "grain", "mesh", "aurora", "spotlight", "bokeh", "isometric", "blueprint", "dots", "stripes", "low-poly", "topography", "waves", "shapes", "confetti-grid", "constellation", "halftone", "truchet", "floating", "scatter-icons"];
8
+ export declare const AVAILABLE_BACKGROUND_PRESETS: readonly ["gradient", "grain", "mesh", "aurora", "spotlight", "bokeh", "rays", "halo", "plasma", "glass", "ripples", "blobs", "paper", "linen", "concrete", "marble", "isometric", "blueprint", "dots", "stripes", "low-poly", "topography", "waves", "hexagons", "circuit", "graph-paper", "checker", "diagonal-checker", "chevrons", "shapes", "confetti-grid", "constellation", "halftone", "truchet", "floating", "scatter-icons", "school", "night-sky", "bubbles", "leaves", "science", "music", "travel", "sport"];
9
9
  export type AvailableBackgroundPreset = (typeof AVAILABLE_BACKGROUND_PRESETS)[number];
@@ -1,10 +1,10 @@
1
1
  import { BackgroundProps } from './types.js';
2
2
  export type { BackgroundProps } from './types.js';
3
3
  /**
4
- * A backdrop that centres its children, with a choice of twenty presets: the
4
+ * A backdrop that centres its children, with a choice of 44 presets: the
5
5
  * superset of the `Background` of `/components` (which has `tone`, `intensity`,
6
6
  * `preset` and `animated`). The extra props here are `grain`, `seed`, `fill` and
7
- * `motif` (`shapes`, `density`, `size`, `rotate` (default `false`),
7
+ * `motif` (`shapes` (any of `MOTIF_SHAPES_ALL`), `density`, `size`, `rotate` (default `false`),
8
8
  * `shapeFill`, `opacitySpread`). Its look is plain CSS keyed on
9
9
  * `data-background` and `data-*` (`@nxgt/material/backgrounds.css` for the
10
10
  * grain), its SVG comes from core as data, and it emits no `style` attribute.
@@ -9,6 +9,6 @@
9
9
  * name (same props, plus every preset's), with the types and the engine's
10
10
  * tables re-exported from `@nxgt/material-core/backgrounds` by name.
11
11
  */
12
- export { BACKGROUND_INTENSITIES, BACKGROUND_PRESETS, BACKGROUND_TONES, type BackgroundIntensity, type BackgroundPreset, type BackgroundTone, MOTIF_SHAPES, type MotifDensity, type MotifOptions, type MotifShape, type MotifSize, type OpacitySpread, type PresetInfo, SHIPPED_BACKGROUND_PRESETS, type ShapeFill, type ShippedBackgroundPreset, } from '@nxgt/material-core/backgrounds';
12
+ export { BACKGROUND_INTENSITIES, BACKGROUND_PRESETS, BACKGROUND_TONES, type BackgroundIntensity, type BackgroundPreset, type BackgroundTone, MOTIF_SHAPES, MOTIF_SHAPES_ALL, type MotifDensity, type MotifOptions, type MotifShape, type MotifSize, type OpacitySpread, type PresetInfo, SHIPPED_BACKGROUND_PRESETS, type ShapeFill, type ShippedBackgroundPreset, } from '@nxgt/material-core/backgrounds';
13
13
  export { Background, type BackgroundProps } from './background/index.js';
14
14
  export { AVAILABLE_BACKGROUND_PRESETS, type AvailableBackgroundPreset, } from './background/available.js';