@nxgt/material 3.6.0 → 3.7.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.
- package/CHANGELOG.md +20 -0
- package/README.md +46 -1
- package/dist/components/components.css +2 -0
- package/dist/components/theme-tokens.css +9 -4
- package/dist/components/ui/widgets/drawing/drawing-animate.css +123 -0
- package/dist/components/ui/widgets/drawing/drawing.css +459 -0
- package/dist/{components-BCYZgeoV.js → components-BX4icy-g.js} +733 -733
- package/dist/components.js +16 -16
- package/dist/{dialog-JQT6iETD.js → dialog-DdJ1C4BR.js} +168 -168
- package/dist/dnd.js +1 -1
- package/dist/draw-animate.js +106 -0
- package/dist/draw-png.js +2 -0
- package/dist/draw-sketch.js +38 -0
- package/dist/draw.js +65 -0
- package/dist/drawing-B8VuG7nx.js +390 -0
- package/dist/drawing-context-CeKeZE6b.js +10 -0
- package/dist/editor.js +110 -110
- package/dist/{icon-badge-C30yKsAM.js → icon-badge-Bb5-73XP.js} +18 -18
- package/dist/{icon-button-BXlI3DJ_.js → icon-button-5A6Mrj6w.js} +60 -90
- package/dist/lib/components/ui/display/shape/use-shape-morph.d.ts +1 -0
- package/dist/lib/components/ui/widgets/drawing/drawing-a11y.d.ts +20 -0
- package/dist/lib/components/ui/widgets/drawing/drawing-context.d.ts +23 -0
- package/dist/lib/components/ui/widgets/drawing/drawing-types.d.ts +63 -0
- package/dist/lib/components/ui/widgets/drawing/drawing.d.ts +17 -0
- package/dist/lib/components/ui/widgets/drawing/index.d.ts +5 -0
- package/dist/lib/components/ui/widgets/drawing/partials/drawing-root.d.ts +17 -0
- package/dist/lib/components/ui/widgets/drawing/partials/interactive-node.d.ts +22 -0
- package/dist/lib/components/ui/widgets/drawing/partials/primitives/content.d.ts +20 -0
- package/dist/lib/components/ui/widgets/drawing/partials/primitives/path.d.ts +29 -0
- package/dist/lib/components/ui/widgets/drawing/partials/primitives/primitive.d.ts +19 -0
- package/dist/lib/components/ui/widgets/drawing/partials/primitives/shapes.d.ts +18 -0
- package/dist/lib/components/ui/widgets/drawing/partials/react-attrs.d.ts +5 -0
- package/dist/lib/components/ui/widgets/drawing/partials/ring.d.ts +9 -0
- package/dist/lib/components/ui/widgets/drawing/partials/svg-tree.d.ts +29 -0
- package/dist/lib/components/ui/widgets/drawing/use-exact-text.d.ts +16 -0
- package/dist/lib/draw/index.d.ts +32 -0
- package/dist/lib/draw-animate/index.d.ts +19 -0
- package/dist/lib/draw-animate/morph-drawing.d.ts +32 -0
- package/dist/lib/draw-animate/reduced-motion.d.ts +2 -0
- package/dist/lib/draw-animate/use-drawing-controls.d.ts +27 -0
- package/dist/lib/draw-animate/use-scene-morph.d.ts +15 -0
- package/dist/lib/draw-png/index.d.ts +11 -0
- package/dist/lib/draw-sketch/index.d.ts +17 -0
- package/dist/lib/draw-sketch/sketch.d.ts +19 -0
- package/dist/lib/print/components/print-drawing.d.ts +16 -0
- package/dist/lib/print/index.d.ts +2 -1
- package/dist/main.js +21 -21
- package/dist/map.js +63 -63
- package/dist/material.css +1 -1
- package/dist/pdf-reader.js +1 -1
- package/dist/print.js +123 -115
- package/dist/{public-Cde8_SN8.js → public-CBlV2XuA.js} +742 -742
- package/dist/{sortable-provider-DYlpq8lP.js → sortable-provider-BvD98s8Y.js} +19 -19
- package/dist/{use-chat-composer-BwpSgP_D.js → use-chat-composer-BhdPNmYm.js} +912 -911
- package/dist/use-shape-morph-BKA_R5P5.js +35 -0
- package/docs/README.md +1 -0
- package/docs/components/rich-widgets.md +196 -0
- package/docs/guides/drawing.md +499 -0
- package/docs/guides/printing.md +47 -0
- package/docs/guides/theming.md +2 -2
- package/docs/previews/rich-widgets-drawing.webp +0 -0
- package/docs/roadmap.md +17 -0
- package/docs/troubleshooting.md +136 -1
- package/lib/components/components.css +2 -0
- package/lib/components/theme-tokens.css +9 -4
- package/lib/components/ui/widgets/drawing/drawing-animate.css +123 -0
- package/lib/components/ui/widgets/drawing/drawing.css +459 -0
- package/package.json +22 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @nxgt/material
|
|
2
2
|
|
|
3
|
+
## 3.7.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#1362](https://github.com/softistx/nxgt-material/pull/1362) [`bd12b85`](https://github.com/softistx/nxgt-material/commit/bd12b85722ff941b4d0411c646ea547e69056c8e) Thanks [@SteveGT96](https://github.com/SteveGT96)! - Vector drawing in React, on the framework-free scenes of `@nxgt/material-core/draw`: accessible, themeable SVG that is strict-CSP safe (no inline `style`, no `<style>`) and hydration safe (no `<title>`, deterministic ids).
|
|
8
|
+
|
|
9
|
+
- `@nxgt/material/draw`: `Drawing` renders a `scene` of plain data or JSX primitives (`Rect`, `Ellipse`, `Circle`, `Line`, `Polygon`, `Path`, `Text`, `Group`, `Image`). Its type requires a `title` or `decorative`. Colours are theme roles, `tone()` or free colours, mapped to classes in `styles.css`, so a drawing follows light and dark. Interactive nodes are focusable buttons with a focus ring and Enter/Space, their events given by scene id (`handlers`, `onNodeClick`) or as primitive props. Wrapped text is laid out with Inter's metrics and refined by the browser once mounted (`exactText`). The builders, paints, `toSVG`, `shape`, `morph` and the layout helpers are re-exported by name from core.
|
|
10
|
+
- `@nxgt/material/draw/sketch`: `<Sketch seed fill>` and `sketch()`, the seeded hand-drawn style.
|
|
11
|
+
- `@nxgt/material/draw/animate`: `drawOn` and `appear` (animated by `styles.css`, stopped under reduced motion), `useDrawingControls(ref)` to replay, pause or finish them, `MorphDrawing` and `useSceneMorph` to spring between two scenes, `morphScenes`.
|
|
12
|
+
- `@nxgt/material/draw/png`: `drawingToPng` and `downloadDrawingPng`.
|
|
13
|
+
- `@nxgt/material/print`: the `drawing(scene, { width, align })` node and the `PrintDrawing` block, a vector drawing in a PDF document.
|
|
14
|
+
|
|
15
|
+
Nothing to change in an existing app: each is its own entry, not in `/components` or the main entry. Keep `@nxgt/material/styles.css` imported, and render `Drawing`, `Sketch` and the animation hooks from a `'use client'` file (the built entries carry no directive). `text` and `image` from `/draw` clash with `/print`'s: import one under another name (`import { text as drawText }`). See the Drawing guide (`docs/guides/drawing.md`).
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [#1364](https://github.com/softistx/nxgt-material/pull/1364) [`174b543`](https://github.com/softistx/nxgt-material/commit/174b54343e62d9faa6451a24bace205b9975a503) Thanks [@SteveGT96](https://github.com/SteveGT96)! - Fix two contrast regressions of the violet-tinted neutrals. The dark `--error-text` is lightened (76 % `--error` mixed with white, was 80 %): 4.78:1 instead of 4.45:1 on a focused error menu item, and still above 5:1 on `--background` and `--card`. The light `--ring` (and `--sidebar-ring`) is darkened to `oklch(0.62 0.04 291)`, so the focus indicator reaches 3.4:1 on `--background`, 3.7:1 on `--card` and 3.2:1 on `--muted` (was 2.4, 2.7 and 2.3:1; WCAG 1.4.11). Fixes [#1363](https://github.com/softistx/nxgt-material/issues/1363).
|
|
20
|
+
- Updated dependencies [[`bd12b85`](https://github.com/softistx/nxgt-material/commit/bd12b85722ff941b4d0411c646ea547e69056c8e)]:
|
|
21
|
+
- @nxgt/material-core@0.27.0
|
|
22
|
+
|
|
3
23
|
## 3.6.0
|
|
4
24
|
|
|
5
25
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -157,9 +157,11 @@ into a tarball. A missing sheet renders nothing, with no error and no fallback.
|
|
|
157
157
|
| --- | --- |
|
|
158
158
|
| `@nxgt/material` | Everything below in one barrel, plus the compiled `style` condition (`dist/material.css`, for apps without Tailwind) |
|
|
159
159
|
| `@nxgt/material/components` | UI components, `*FormField` wrappers and `useCodeResolver` ([Components](#components)) |
|
|
160
|
-
| `@nxgt/material/print` | PDF documents over `@react-pdf/renderer`: the `PrintDocument` page shell, the print blocks, and `PrintDataTable`, `PrintKeyValue` and `PrintMetric` from column definitions and plain rows; documents as plain data (`pdfDocument` and its builders); `downloadPdf`, `openPdf`, `usePdfFile` and `pdfResponse` to get the file in one call — **its own entry, and not in the barrel above** ([printing guide](https://cdn.jsdelivr.net/npm/@nxgt/material@3/docs/guides/printing.md)) |
|
|
160
|
+
| `@nxgt/material/print` | PDF documents over `@react-pdf/renderer`: the `PrintDocument` page shell, the print blocks, `PrintDrawing` and the `drawing(scene)` node (a vector drawing from `@nxgt/material-core/draw` printed as vectors), and `PrintDataTable`, `PrintKeyValue` and `PrintMetric` from column definitions and plain rows; documents as plain data (`pdfDocument` and its builders); `downloadPdf`, `openPdf`, `usePdfFile` and `pdfResponse` to get the file in one call — **its own entry, and not in the barrel above** ([printing guide](https://cdn.jsdelivr.net/npm/@nxgt/material@3/docs/guides/printing.md)) |
|
|
161
161
|
| `@nxgt/material/pdf-reader` | `PdfReader`, the redesigned PDF reader (header, floating page pill, rail and panel; `embedded`, `dialog`, `page` and `fullscreen` modes; single page and two-page layouts; `look="expressive"` by default, `"classic"` to opt out, type `PdfReaderLook`) and `configurePdfReader` for pdf.js's worker and assets. **Its own entry, browser-only** (pdf.js loads on first render); also exported as `PdfReader` from `/components` since 3.0 ([guide](https://cdn.jsdelivr.net/npm/@nxgt/material@3/docs/guides/pdf-reader.md)) |
|
|
162
162
|
| `@nxgt/material/charts` | Native SVG charts (d3-scale and d3-shape for the maths only) with keyboard point navigation, a screen-reader summary, a "View data" table and `patterns`: `LineChart` and `AreaChart` (`LineChartProps`, `AreaChartProps`, `ChartCurve`), `BarChart` (`BarChartProps`, `BarLayout`, `BarOrientation`), `PieChart` (`PieChartProps`), `DonutChart` (`DonutChartProps`), `Gauge` (`GaugeProps`, `GaugeSize`), `RadialBarChart` (`RadialBarChartProps`), `FunnelChart` (`FunnelChartProps`), `HeatmapChart` (`HeatmapChartProps`, `HeatColumn`), `RadarChart` (`RadarChartProps`), `ScatterChart` (`ScatterChartProps`, `ScatterSeries`, `ScatterPoint`), `ComboChart` (`ComboChartProps`, `ComboSeries`: bars, areas and lines, each on a left or a right axis), `zoom` (a mini overview with a window and two slider handles that picks the rows shown; `range`, `defaultRange`, `onRangeChange`) and `scroll` (a dense plot scrolls sideways on a phone, the value axis pinned) on the line, area, bar and combo charts (`ChartRangeProps`, `ChartZoomOptions`, `ChartScrollOptions`, `ChartRange`), `onPointClick` on every chart but `Gauge`, `palette` (`'soft'`: the soft palette, or `data-chart-palette="soft"` on an ancestor; `ChartPalette`) on every chart, and the shared types (`ChartSlice`, `ChartRow`, `ChartValue`, `ChartColor`, `ChartShape`, `ChartSeries`, `ChartAxis`, `ChartXAxis`, `ChartPoint`, `ChartBaseProps`). `categoryLabel` names the "View data" table's category column: on Line, Area, Bar and Combo it defaults to the x axis label, on Radar and Heatmap it is always "Category" unless set. **Its own entry, client-only** (import it from a `'use client'` file), not in the barrel above; replaces the Nivo charts (removed in 3.0) of `/components` ([guide](https://cdn.jsdelivr.net/npm/@nxgt/material@3/docs/guides/charts.md)) |
|
|
163
|
+
| `@nxgt/material/draw` | Vector drawing: a scene of plain data or JSX primitives drawn as accessible, themeable SVG that is safe under a strict CSP and identical on the server and in the browser. `Drawing` (`DrawingProps`, `NodeHandlers`; `scene` or `w`/`h` with children; a `title` or `decorative`, enforced by the type), the primitives `Rect`, `Ellipse`, `Circle`, `Line`, `Polygon`, `Path` (takes `node`), `Text`, `Group` and `Image`, and the builders of `@nxgt/material-core/draw` re-exported by name (`scene`, `rect`, `ellipse`, `circle`, `line`, `polygon`, `path`, `text`, `group`, `image`, `linear`, `radial`, `pattern`, `hatch`, `tone`, `toSVG`, `compileScene`, `ROLES`, `DRAW_PALETTE`, and the types `Scene`, `DrawNode`, `Paint`, `Role`, `ToneRef`), plus Material 3 Expressive's shapes (`shape`, `morph`, `SHAPE_NAMES`, `toCubics`) and the layout helpers (`bbox`, `stack`, `grid`, `align`, `distribute`) re-exported by name. Colours are theme roles (`primary-container`, `on-surface`...) mapped to classes in `styles.css`, so import it. Interactive nodes are focusable `button`s with a focus ring; wrapped text is re-measured by the browser once mounted. **Its own entry, client-only** (render `Drawing` from a `'use client'` file; the builders and `toSVG` run anywhere), not in the barrel above ([drawing guide](https://cdn.jsdelivr.net/npm/@nxgt/material@3/docs/guides/drawing.md)) |
|
|
164
|
+
| `@nxgt/material/draw/sketch` | The sketchy, hand-drawn style for a drawing: `Sketch` (`seed`, `roughness`, `bowing`, `fill`: `hachure`, `cross-hatch`, `solid` or `none`, `hachureAngle`, `hachureGap`, `strokeWidth`) wraps a `Drawing`, or primitives inside one, and draws shapes as double wobbling strokes with hatched fills; `sketch(sceneOrNode, options)` does it to plain data for `toSVG`. Seeded, so the server and the client draw the same lines; ids, labels, focus rings and events keep working. **Its own entry, client-only** (render `Sketch` from a `'use client'` file), not in the barrel above ([drawing guide](https://cdn.jsdelivr.net/npm/@nxgt/material@3/docs/guides/drawing.md#sketch)) |
|
|
163
165
|
| `@nxgt/material/map` | Leaflet maps, markers, a location field — **its own entry, not in the barrel, and browser-only** ([maps guide](https://cdn.jsdelivr.net/npm/@nxgt/material@3/docs/guides/maps.md)) |
|
|
164
166
|
| `@nxgt/material/backgrounds` | Background presets: `Background` (a superset of the `/components` one: `preset`, `animated`, `grain`, `seed`, `fill` and `motif`), `AVAILABLE_BACKGROUND_PRESETS` and `AvailableBackgroundPreset` (the 44 ids `Background` draws), `MOTIF_SHAPES_ALL` (the 22 motif shapes), the types and tables (`BACKGROUND_PRESETS`, `BACKGROUND_TONES`, ...) re-exported from `@nxgt/material-core/backgrounds`; its own entry, with an opt-in stylesheet ([backgrounds guide](https://cdn.jsdelivr.net/npm/@nxgt/material@3/docs/guides/backgrounds.md)) |
|
|
165
167
|
| `@nxgt/material/editor` | The rich text editor: `DocumentEditor` and `DocumentEditorFormField` (with an `outline`, a block handle, focus mode, find and replace, `onUpload`, `onAssist` and `comments`), `CompactEditor` and `CompactEditorFormField`, `RichChatComposer`, `EditorRoot` and the parts (`EditorToolbar`, `EditorContent`, `EditorFooter`, `EditorAssistantPanel`, ...), `useEditor`, the kits (`documentKit`, `compactKit`, `chatKit`, `formNodesKit`), `withFeatures` / `withoutFeatures` and `defineFeature`, and the converters `toHtml`, `toJson`, `toMarkdown`, `fromMarkdown` and `looksLikeMarkdown` — **its own entry, and not in the barrel above**. **Client-only**: import it from a `'use client'` file; `/editor/viewer` is the server-safe one. The `.nxgt-prose` page styles ship in `styles.css` with the component CSS ([DocumentEditor](https://cdn.jsdelivr.net/npm/@nxgt/material@3/docs/components/rich-widgets.md#documenteditor)) |
|
|
@@ -168,6 +170,8 @@ into a tarball. A missing sheet renders nothing, with no error and no fallback.
|
|
|
168
170
|
| `@nxgt/material/editor/collab` | `collaboration({ doc, provider, user, seed, ready, field })`: real-time editing of a Yjs document **your app supplies** (the library ships no server and no provider), for `DocumentEditor`'s `collaboration` prop; carets, undo and the `EditorPresence` avatars and connection chip (`useEditorPresence` for your own UI; both from `/editor`). Its own entry with optional peers `yjs` and `y-protocols` ([Collaboration](https://cdn.jsdelivr.net/npm/@nxgt/material@3/docs/components/rich-widgets.md#collaboration)) |
|
|
169
171
|
| `@nxgt/material/editor/pm` | The editor's own tiptap and ProseMirror (`Extension`, `Node`, `Mark`, `mergeAttributes`, the input and paste rules, `Plugin`, `PluginKey`, `TextSelection`, `NodeSelection`, `ProseMirrorNode`, `Fragment`, `Slice`, `Decoration`, `DecorationSet`, …) for a custom feature's extensions, so its `instanceof` checks and the nodes it builds agree with the editor. Shares the editor's code (next to `/editor`, a list of exports, not a second copy), **server-safe** ([A custom feature](https://cdn.jsdelivr.net/npm/@nxgt/material@3/docs/components/rich-widgets.md#a-custom-feature)) |
|
|
170
172
|
| `@nxgt/material/media-hls` | `hlsStreaming()` (options `HlsStreamingOptions`, module type `HlsModule`), the HLS adapter for `MediaPlayer`'s `streaming` prop: `hls.js` (an optional peer) loaded lazily wherever the browser has MSE, native HLS otherwise (or with `preferNative`), its levels as the quality menu; its own entry ([streaming guide](https://cdn.jsdelivr.net/npm/@nxgt/material@3/docs/guides/media-streaming.md)) |
|
|
173
|
+
| `@nxgt/material/draw/animate` | Animation for `/draw`: `drawOn(scene)` traces strokes and `appear(scene)` fades nodes in, one after the next (`staggerSteps`; they add class names that `styles.css` animates, so a server renders them and there is no inline style); `useDrawingControls(ref)` replays, pauses, plays and finishes them (Web Animations); `morphScenes(a, b, t)`, `useSceneMorph(from, to, active)` and `MorphDrawing` (`from`, `to`, `active`) spring one scene into another. All stop under reduced motion and show the last frame; its own entry, client-only for the hooks ([drawing guide](https://cdn.jsdelivr.net/npm/@nxgt/material@3/docs/guides/drawing.md#animate), [reference](https://cdn.jsdelivr.net/npm/@nxgt/material-core@0/docs/draw.md#animation-nxgtmaterial-coredrawanimate)) |
|
|
174
|
+
| `@nxgt/material/draw/png` | `drawingToPng(sceneOrSvg, { scale?, background?, colorsFrom? })` and `downloadDrawingPng(source, fileName)` — a drawing (a scene, or a live `<svg>` such as `svgRef.current` of a `<Drawing ref={svgRef}>`) as a PNG `Blob` in the browser, with the page's theme colours resolved, `data:` images inlined and CORS errors named; its own entry, DOM only when called ([drawing guide](https://cdn.jsdelivr.net/npm/@nxgt/material@3/docs/guides/drawing.md#png), [reference](https://cdn.jsdelivr.net/npm/@nxgt/material-core@0/docs/draw.md#png-nxgtmaterial-coredrawpng)) |
|
|
171
175
|
| `@nxgt/material/vite` | build-time helpers for consumers: `nxgtMaterial()` (a strict CSP by hash or nonce, self-hosted fonts, a styles check, serves the pdf.js worker on the Vite 5–7 dev server, PDFs on a bundled server with `nxgtMaterial({ pdf: { bundle: true } })`: [Vite plugin guide](https://cdn.jsdelivr.net/npm/@nxgt/material@3/docs/guides/vite-plugin.md)), `pdfkitStandardFonts()` ([printing guide](https://cdn.jsdelivr.net/npm/@nxgt/material@3/docs/guides/printing.md)), `cspAssetsInlineLimit`, a `build.assetsInlineLimit` that never inlines a font ([CSP guide](https://cdn.jsdelivr.net/npm/@nxgt/material@3/docs/guides/csp.md#katex-fonts)) |
|
|
172
176
|
| `@nxgt/material/next` | `withNxgtPrint(nextConfig)`: the `next.config.ts` a Next.js route handler that imports `/print` needs, `output: 'standalone'` included. Node only, no dependency on `next` ([printing guide](https://cdn.jsdelivr.net/npm/@nxgt/material@3/docs/guides/printing.md#nextjs-serverexternalpackages-and-output-standalone)) |
|
|
173
177
|
| `@nxgt/material/hooks` | `useTheme`, `useIsClient`, `useIsMobile`, `useLocalizedDate`, `useCspNonce`, `useFocusOnMount`, `useSubmitOnce`, … ([helpers](https://cdn.jsdelivr.net/npm/@nxgt/material@3/docs/guides/helpers.md#nxgtmaterialhooks)) |
|
|
@@ -301,6 +305,45 @@ It adds `'@nxgt/material'` to `serverExternalPackages` and, when
|
|
|
301
305
|
`outputFileTracingIncludes`, merged with what your config already has. More:
|
|
302
306
|
[Next.js](https://cdn.jsdelivr.net/npm/@nxgt/material@3/docs/guides/printing.md#nextjs-serverexternalpackages-and-output-standalone).
|
|
303
307
|
|
|
308
|
+
### Drawings
|
|
309
|
+
|
|
310
|
+
`@nxgt/material/draw` draws a scene (plain data) or JSX primitives as accessible
|
|
311
|
+
SVG in the theme's colours, with no inline `style`, so it is safe under a strict
|
|
312
|
+
CSP and the same on the server and in the browser. Render `Drawing` from a
|
|
313
|
+
`'use client'` file; colour roles come from `styles.css`.
|
|
314
|
+
|
|
315
|
+
```tsx
|
|
316
|
+
'use client';
|
|
317
|
+
|
|
318
|
+
import { Drawing, path, rect, scene, text, tone } from '@nxgt/material/draw';
|
|
319
|
+
|
|
320
|
+
const flow = scene({ w: 240, h: 120 }, [
|
|
321
|
+
rect({ x: 8, y: 8, w: 224, h: 104, r: 16, fill: 'primary-container', stroke: 'outline' }),
|
|
322
|
+
path((p) => p.moveTo(24, 90).curveTo(60, 20, 120, 20, 200, 60), {
|
|
323
|
+
stroke: tone('success'),
|
|
324
|
+
strokeWidth: 3,
|
|
325
|
+
arrow: { end: 'triangle' },
|
|
326
|
+
}),
|
|
327
|
+
text('Shipped', { x: 120, y: 64, anchor: 'middle', size: 18, weight: 600, fill: 'on-primary-container' }),
|
|
328
|
+
]);
|
|
329
|
+
|
|
330
|
+
export const Flow = () => <Drawing scene={flow} title="Release flow" />;
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
Three more entries, each loaded only by the apps that use it:
|
|
334
|
+
|
|
335
|
+
```tsx
|
|
336
|
+
import { Sketch } from '@nxgt/material/draw/sketch'; // hand-drawn: <Sketch seed={7}><Drawing … /></Sketch>
|
|
337
|
+
import { drawOn, useDrawingControls } from '@nxgt/material/draw/animate'; // <Drawing scene={drawOn(flow)} … />
|
|
338
|
+
import { downloadDrawingPng } from '@nxgt/material/draw/png'; // await downloadDrawingPng(flow, 'release-flow')
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
`toSVG(flow, { standalone: true, theme: 'light' })` (from `@nxgt/material/draw`)
|
|
342
|
+
gives an SVG string with literal colours, for a file or an e-mail, and `drawing(flow)`
|
|
343
|
+
from `@nxgt/material/print` puts it in a PDF as vectors. The
|
|
344
|
+
[drawing guide](https://cdn.jsdelivr.net/npm/@nxgt/material@3/docs/guides/drawing.md)
|
|
345
|
+
covers colours, accessibility, events, sketch, animation, PNG, PDF and e-mail.
|
|
346
|
+
|
|
304
347
|
## Guides
|
|
305
348
|
|
|
306
349
|
Each area a consumer starts from has its own page under `docs/guides/`.
|
|
@@ -314,6 +357,7 @@ Each area a consumer starts from has its own page under `docs/guides/`.
|
|
|
314
357
|
| [Printing](https://cdn.jsdelivr.net/npm/@nxgt/material@3/docs/guides/printing.md) | producing PDFs with `@nxgt/material/print` and getting the file in one call (download, new tab, preview, server `Response`) — its own entry since 2.0.0, with optional peers, a bundling trap on SSR servers, and the `next.config.ts` a Next.js route handler (and `output: 'standalone'`) needs |
|
|
315
358
|
| [Maps](https://cdn.jsdelivr.net/npm/@nxgt/material@3/docs/guides/maps.md) | using `@nxgt/material/map` — browser-only, optional leaflet peers, `map.css` |
|
|
316
359
|
| [Charts](https://cdn.jsdelivr.net/npm/@nxgt/material@3/docs/guides/charts.md) | drawing charts with `@nxgt/material/charts` (client-only): the twelve charts, shared props, legend, View data, `onPointClick`, zoom and phone scroll, right-to-left pages, keyboard and accessibility, theming the `--chart-*` tokens, and migrating from the Nivo charts, removed in 3.0 |
|
|
360
|
+
| [Drawing](https://cdn.jsdelivr.net/npm/@nxgt/material@3/docs/guides/drawing.md) | drawing diagrams, badges and illustrations from code with `@nxgt/material/draw`: a scene or JSX, theme roles and tones, strict CSP, accessibility, events, sketch, animation, PNG, PDF and e-mail |
|
|
317
361
|
| [Backgrounds](https://cdn.jsdelivr.net/npm/@nxgt/material@3/docs/guides/backgrounds.md) | tones, intensity, the opt-in `backgrounds.css` and per-preset files, custom tone tokens, motion and CSP |
|
|
318
362
|
| [Media players](https://cdn.jsdelivr.net/npm/@nxgt/material@3/docs/guides/media.md) | `MediaPlayer`, `AudioPlayer`, playlists, chapters and transcript, sound that keeps playing across pages (`MediaPlayerHost`), the lightbox, HLS, CSP and keyboard |
|
|
319
363
|
| [Streaming (HLS)](https://cdn.jsdelivr.net/npm/@nxgt/material@3/docs/guides/media-streaming.md) | `hlsStreaming()` from `@nxgt/material/media-hls`, the optional `hls.js` peer, native HLS, the quality menu, the CSP worker line |
|
|
@@ -626,6 +670,7 @@ Not components: what the stylesheet gives any element.
|
|
|
626
670
|
| <img src="https://cdn.jsdelivr.net/npm/@nxgt/material@3/docs/previews/rich-widgets-codeeditor.webp" width="120" alt="CodeEditor"> | [`CodeEditor`](https://cdn.jsdelivr.net/npm/@nxgt/material@3/docs/components/rich-widgets.md#codeeditor) · `CodeEditorFormField` | Monaco code field in theme presets (App, Moonlight, Soft, or your own `defineCodeTheme`), with a floating tool pill, a status bar, `markers` for your own problems, a `readOnly` reader look, view props, a `ref` handle, file tabs (`files`) and full screen. From `@nxgt/material/code-editor`. | `CodeEditor`, `CodeEditorFormField` |
|
|
627
671
|
| <img src="https://cdn.jsdelivr.net/npm/@nxgt/material@3/docs/previews/rich-widgets-codeeditor-diff.webp" width="120" alt="CodeDiff"> | [`CodeDiff`](https://cdn.jsdelivr.net/npm/@nxgt/material@3/docs/components/rich-widgets.md#codediff) | A Monaco diff in the code editor's frame and themes: side by side or inline (always inline on a phone), previous/next change, `+N −M` counts and copy. From `@nxgt/material/code-editor`. | `CodeDiff` |
|
|
628
672
|
| <img src="https://cdn.jsdelivr.net/npm/@nxgt/material@3/docs/previews/rich-widgets-quiz.webp" width="120" alt="Quiz"> | [`Quiz`](https://cdn.jsdelivr.net/npm/@nxgt/material@3/docs/components/rich-widgets.md#quiz), `QuestionCard` | Exam or practice quizzes: step progress, instant feedback with explanations and hints, a time limit, keyboard shortcuts, and a results screen with a score ring, a breakdown and a retry of the misses. Container queries. | `Quiz`, `QuestionCard` (modes and results: React only for now) |
|
|
673
|
+
| <img src="https://cdn.jsdelivr.net/npm/@nxgt/material@3/docs/previews/rich-widgets-drawing.webp" width="120" alt="Drawing"> | [`Drawing`, `Rect`, `Ellipse`, `Circle`, `Line`, `Polygon`, `Path`, `Text`, `Group`, `Image`](https://cdn.jsdelivr.net/npm/@nxgt/material@3/docs/components/rich-widgets.md#drawing) from `@nxgt/material/draw` | Vector drawings from a scene of plain data or from JSX: theme-role colours that follow light and dark, no inline style (strict CSP), a `title` or `decorative` enforced by the type, focusable nodes with `onClick` and a focus ring, text that wraps with Inter's metrics and is refined by the browser. Client-only entry. | React only for now |
|
|
629
674
|
|
|
630
675
|
`RadioGroupField`, `SliderField` and `SwitchField` are aliases of the
|
|
631
676
|
labelled `RadioGroup`, `Slider` and `Switch`, under the names
|
|
@@ -196,3 +196,5 @@
|
|
|
196
196
|
@import "../backgrounds/css/base.css";
|
|
197
197
|
@import "../backgrounds/css/gradient.css";
|
|
198
198
|
@import "../backgrounds/css/motion.css";
|
|
199
|
+
@import "./ui/widgets/drawing/drawing.css"; /* @nxgt/material/draw: role colours, focus ring */
|
|
200
|
+
@import "./ui/widgets/drawing/drawing-animate.css";
|
|
@@ -53,7 +53,9 @@
|
|
|
53
53
|
--destructive: var(--error);
|
|
54
54
|
--border: oklch(0.912 0.016 293.7);
|
|
55
55
|
--input: oklch(0.912 0.016 293.7);
|
|
56
|
-
|
|
56
|
+
/* The focus indicator (WCAG 1.4.11, 3:1): 3.40:1 on --background, 3.69:1 on
|
|
57
|
+
--card, 3.23:1 on --muted. */
|
|
58
|
+
--ring: oklch(0.62 0.04 291);
|
|
57
59
|
--chart-1: oklch(0.646 0.222 41.116);
|
|
58
60
|
--chart-2: oklch(0.6 0.118 184.704);
|
|
59
61
|
--chart-3: oklch(0.398 0.07 227.392);
|
|
@@ -86,7 +88,7 @@
|
|
|
86
88
|
--sidebar-accent: oklch(0.955 0.012 292);
|
|
87
89
|
--sidebar-accent-foreground: oklch(0.227 0.017 290);
|
|
88
90
|
--sidebar-border: oklch(0.912 0.016 293.7);
|
|
89
|
-
--sidebar-ring: oklch(0.
|
|
91
|
+
--sidebar-ring: oklch(0.62 0.04 291);
|
|
90
92
|
}
|
|
91
93
|
|
|
92
94
|
.dark,
|
|
@@ -120,8 +122,10 @@
|
|
|
120
122
|
--error: oklch(0.577 0.245 27.325);
|
|
121
123
|
--error-foreground: oklch(0.995 0.002 291.3);
|
|
122
124
|
/* --error stays the fill under near-white text; as text it would give only
|
|
123
|
-
3.9:1 on --background and 3.5:1 on --card. Lightened
|
|
124
|
-
|
|
125
|
+
3.9:1 on --background and 3.5:1 on --card. Lightened (76 % --error), 5.85
|
|
126
|
+
and 5.35:1, and 4.78:1 on a focused error menu item (bg-error/20 over the
|
|
127
|
+
popover; 4.45:1 at the former 80 %, which missed 4.5:1 once rendered). */
|
|
128
|
+
--error-text: color-mix(in oklab, var(--error) 76%, white);
|
|
125
129
|
/* The light brights: on the dark surfaces they read as text and as the
|
|
126
130
|
badge's 60% tint, which keeps its contrast under near-white text (success
|
|
127
131
|
7.1:1, info 5.6:1, error 9.1:1). */
|
|
@@ -137,6 +141,7 @@
|
|
|
137
141
|
--destructive: oklch(0.704 0.191 22.216);
|
|
138
142
|
--border: oklch(0.301 0.025 291.4);
|
|
139
143
|
--input: oklch(0.34 0.027 291.4);
|
|
144
|
+
/* 3.78:1 on --background, 3.45:1 on --card, 3.09:1 on --muted. */
|
|
140
145
|
--ring: oklch(0.551 0.03 290);
|
|
141
146
|
--chart-1: oklch(0.488 0.243 264.376);
|
|
142
147
|
--chart-2: oklch(0.696 0.17 162.48);
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/* Entry animations (`drawOn` and `appear` of @nxgt/material/draw/animate).
|
|
2
|
+
* A node carries `nxgt-draw-on` or `nxgt-draw-appear`, a delay step
|
|
3
|
+
* `nxgt-draw-d-<0..19>` and a duration `nxgt-draw-t-<s|m|l>`: never an inline
|
|
4
|
+
* style. The delay is the step times `--nxgt-draw-stagger` (60ms), set on the
|
|
5
|
+
* drawing or an ancestor to speed it up or slow it down. The animations fill
|
|
6
|
+
* both ways, so a replay (`useDrawingControls`) can find them and the last
|
|
7
|
+
* frame is the drawing itself: a stroke is traced with a dash as long as its
|
|
8
|
+
* path (`pathLength` 1), a fill fades in, a node fades and grows in. */
|
|
9
|
+
.nxgt-draw-t-s {
|
|
10
|
+
--nxgt-draw-dur: 300ms;
|
|
11
|
+
}
|
|
12
|
+
.nxgt-draw-t-m {
|
|
13
|
+
--nxgt-draw-dur: 600ms;
|
|
14
|
+
}
|
|
15
|
+
.nxgt-draw-t-l {
|
|
16
|
+
--nxgt-draw-dur: 1000ms;
|
|
17
|
+
}
|
|
18
|
+
.nxgt-draw-d-0 {
|
|
19
|
+
--nxgt-draw-i: 0;
|
|
20
|
+
}
|
|
21
|
+
.nxgt-draw-d-1 {
|
|
22
|
+
--nxgt-draw-i: 1;
|
|
23
|
+
}
|
|
24
|
+
.nxgt-draw-d-2 {
|
|
25
|
+
--nxgt-draw-i: 2;
|
|
26
|
+
}
|
|
27
|
+
.nxgt-draw-d-3 {
|
|
28
|
+
--nxgt-draw-i: 3;
|
|
29
|
+
}
|
|
30
|
+
.nxgt-draw-d-4 {
|
|
31
|
+
--nxgt-draw-i: 4;
|
|
32
|
+
}
|
|
33
|
+
.nxgt-draw-d-5 {
|
|
34
|
+
--nxgt-draw-i: 5;
|
|
35
|
+
}
|
|
36
|
+
.nxgt-draw-d-6 {
|
|
37
|
+
--nxgt-draw-i: 6;
|
|
38
|
+
}
|
|
39
|
+
.nxgt-draw-d-7 {
|
|
40
|
+
--nxgt-draw-i: 7;
|
|
41
|
+
}
|
|
42
|
+
.nxgt-draw-d-8 {
|
|
43
|
+
--nxgt-draw-i: 8;
|
|
44
|
+
}
|
|
45
|
+
.nxgt-draw-d-9 {
|
|
46
|
+
--nxgt-draw-i: 9;
|
|
47
|
+
}
|
|
48
|
+
.nxgt-draw-d-10 {
|
|
49
|
+
--nxgt-draw-i: 10;
|
|
50
|
+
}
|
|
51
|
+
.nxgt-draw-d-11 {
|
|
52
|
+
--nxgt-draw-i: 11;
|
|
53
|
+
}
|
|
54
|
+
.nxgt-draw-d-12 {
|
|
55
|
+
--nxgt-draw-i: 12;
|
|
56
|
+
}
|
|
57
|
+
.nxgt-draw-d-13 {
|
|
58
|
+
--nxgt-draw-i: 13;
|
|
59
|
+
}
|
|
60
|
+
.nxgt-draw-d-14 {
|
|
61
|
+
--nxgt-draw-i: 14;
|
|
62
|
+
}
|
|
63
|
+
.nxgt-draw-d-15 {
|
|
64
|
+
--nxgt-draw-i: 15;
|
|
65
|
+
}
|
|
66
|
+
.nxgt-draw-d-16 {
|
|
67
|
+
--nxgt-draw-i: 16;
|
|
68
|
+
}
|
|
69
|
+
.nxgt-draw-d-17 {
|
|
70
|
+
--nxgt-draw-i: 17;
|
|
71
|
+
}
|
|
72
|
+
.nxgt-draw-d-18 {
|
|
73
|
+
--nxgt-draw-i: 18;
|
|
74
|
+
}
|
|
75
|
+
.nxgt-draw-d-19 {
|
|
76
|
+
--nxgt-draw-i: 19;
|
|
77
|
+
}
|
|
78
|
+
.nxgt-draw-on,
|
|
79
|
+
.nxgt-draw-appear {
|
|
80
|
+
animation-duration: var(--nxgt-draw-dur, 600ms);
|
|
81
|
+
animation-delay: calc(var(--nxgt-draw-i, 0) * var(--nxgt-draw-stagger, 60ms));
|
|
82
|
+
animation-timing-function: cubic-bezier(0.2, 0, 0, 1);
|
|
83
|
+
animation-fill-mode: both;
|
|
84
|
+
}
|
|
85
|
+
.nxgt-draw-on {
|
|
86
|
+
animation-name: nxgt-draw-trace, nxgt-draw-fill;
|
|
87
|
+
}
|
|
88
|
+
.nxgt-draw-appear {
|
|
89
|
+
animation-name: nxgt-draw-fade, nxgt-draw-grow;
|
|
90
|
+
transform-box: fill-box;
|
|
91
|
+
transform-origin: center;
|
|
92
|
+
}
|
|
93
|
+
@keyframes nxgt-draw-trace {
|
|
94
|
+
from {
|
|
95
|
+
stroke-dasharray: 1;
|
|
96
|
+
stroke-dashoffset: 1;
|
|
97
|
+
}
|
|
98
|
+
to {
|
|
99
|
+
stroke-dasharray: 1;
|
|
100
|
+
stroke-dashoffset: 0;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
@keyframes nxgt-draw-fill {
|
|
104
|
+
from {
|
|
105
|
+
fill-opacity: 0;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
@keyframes nxgt-draw-fade {
|
|
109
|
+
from {
|
|
110
|
+
opacity: 0;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
@keyframes nxgt-draw-grow {
|
|
114
|
+
from {
|
|
115
|
+
scale: 0.92;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
@media (prefers-reduced-motion: reduce) {
|
|
119
|
+
.nxgt-draw-on,
|
|
120
|
+
.nxgt-draw-appear {
|
|
121
|
+
animation: none;
|
|
122
|
+
}
|
|
123
|
+
}
|