@softistx/material 3.248.0 → 3.249.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 +24 -0
- package/README.md +6 -2
- package/dist/adopt-styles-C3MfGnxE.js +20 -0
- package/dist/{async-slice-C5HfFq1M.js → async-slice-DdEr7vFx.js} +1 -1
- package/dist/{audio-player-2kKst8lH.js → audio-player-DMYszRGT.js} +3 -3
- package/dist/{audio-player-viewer-D9DsYBcy.js → audio-player-viewer-z13yCjo4.js} +2 -2
- package/dist/{autocomplete-JuRCjl48.js → autocomplete-Bgf_AJ6U.js} +11 -11
- package/dist/{avatar-CvvdaBu4.js → avatar-WvTropuJ.js} +1 -1
- package/dist/blank-placeholder-DZIFJ0DG.js +17 -0
- package/dist/{breadcrumb-DacRqg91.js → breadcrumb-DYa6pVsq.js} +5 -5
- package/dist/{button-CpUMPIdk.js → button-RsWgka2v.js} +1 -1
- package/dist/{calculator-BYgFgWHL.js → calculator-DPHCuAZy.js} +11 -11
- package/dist/calculator-field.js +6 -6
- package/dist/{calculator-segment-DCHWZy6b.js → calculator-segment-Ckn9Fua9.js} +1 -1
- package/dist/calculator.js +1 -1
- package/dist/canvas-BShNj4yp.js +144 -0
- package/dist/capture-outputs-qcYUPW6K.js +174 -0
- package/dist/capture-toolbar.css +2 -0
- package/dist/capture-toolbar.js +858 -0
- package/dist/capture.js +53 -139
- package/dist/charts.js +3 -3
- package/dist/{chip-CjJPmAYO.js → chip-tyDM0lpO.js} +2 -2
- package/dist/{code-editor-nNcxtslA.js → code-editor-gHHXEwF-.js} +6 -6
- package/dist/code-editor.js +6 -6
- package/dist/{code-file-viewer-CcESl49v.js → code-file-viewer-CYQcskvt.js} +4 -4
- package/dist/{code-language-items-CW8_Si05.js → code-language-items-DDFuDf_E.js} +2 -2
- package/dist/{components-BdMaUeOm.js → components-BbAylWQW.js} +16711 -20831
- package/dist/components.js +83 -79
- package/dist/{confirm-dialog-B2eonW2X.js → confirm-dialog-IHvPA3O2.js} +4 -4
- package/dist/{conversion-variant-DZm_xgUK.js → conversion-variant-MWTjnFnG.js} +5 -5
- package/dist/{currency-field-UIkYAlvP.js → currency-field-Bd9od1Ee.js} +5 -5
- package/dist/{detail-panel-header-CL2_tUG0.js → detail-panel-header-D2a63Sk3.js} +1 -1
- package/dist/{details-content-CPzj3vUr.js → details-content-CnN_ukTA.js} +6 -6
- package/dist/{details-header-band-D-CyB_Xx.js → details-header-band-wcgmC7qC.js} +5 -5
- package/dist/{details-host-BvYgFIWx.js → details-host-DKEaGH4P.js} +1 -1
- package/dist/{details-sheet-D4PTV_jR.js → details-sheet-CtNM4oDU.js} +2 -2
- package/dist/{details-shell-D4XoPRBu.js → details-shell-DZ80h6mN.js} +1 -1
- package/dist/{dialog-CleLsHkZ.js → dialog-DwUxG2-o.js} +1 -1
- package/dist/{dialog-app-bar-CLC990e6.js → dialog-app-bar-BsJ4UwKb.js} +2 -2
- package/dist/dist-Cb17ixQs.js +16 -0
- package/dist/dist-CyqFzDZ6.js +11 -0
- package/dist/dnd.js +1 -1
- package/dist/draw.js +1 -1
- package/dist/{drop-overlay-BTkVfscF.js → drop-overlay-B26hx0-T.js} +2 -2
- package/dist/{dropdown-menu-BoJC2DEH.js → dropdown-menu-D-PRbHaP.js} +1 -1
- package/dist/{editable-section-CTRGfbLJ.js → editable-section-DPmF1flG.js} +3 -3
- package/dist/editor.js +14 -14
- package/dist/embed-chunks/{avatar-GlGqPU7B.js → avatar-CSDtFCum.js} +1 -1
- package/dist/embed-chunks/{dist-BrYZYfsJ.js → dist-C-lAK_LC.js} +2 -2
- package/dist/embed-chunks/{emoji-picker-BSYBi_C8.js → emoji-picker-BWDQFdQu.js} +4 -4
- package/dist/embed-chunks/{mention-list-NW43QcRq.js → mention-list-CdUr0h3X.js} +3 -3
- package/dist/embed-chunks/{nxgt-theme-provider-B1aeqDja.js → nxgt-theme-provider-DdDsiEPj.js} +2 -2
- package/dist/embed-chunks/{switch-control-ChcowM3u.js → switch-control-B95ZWvna.js} +1 -1
- package/dist/embed-chunks/{tabs-root-CY-uLp1C.js → tabs-root-MF9lEHbq.js} +2 -2
- package/dist/embed-chunks/{use-shape-morph-NrJQMv7i.js → use-shape-morph-D1MOoQ4T.js} +110 -2
- package/dist/embed-chunks/{useLatest-B57qw3XH.js → useLatest-RGIW0nya.js} +1 -1
- package/dist/embed.js +626 -613
- package/dist/{emoji-picker-DZbTd3Fr.js → emoji-picker-DabgsEVQ.js} +7 -7
- package/dist/{empty-state-DBSJDLKL.js → empty-state-BylD7RYH.js} +1 -1
- package/dist/{error-state-kauz4If4.js → error-state-BTe_NzTC.js} +2 -2
- package/dist/fab-DUnGwNE7.js +41 -0
- package/dist/fab-dock-By2pLVh7.js +49 -0
- package/dist/{feature-popup-CcXMGFES.js → feature-popup-CW7VS2fx.js} +1 -1
- package/dist/{blank-placeholder-DeDn5Xor.js → field-box-BXN-uyrv.js} +1 -16
- package/dist/{field-group-BpV74Ttu.js → field-group-B2Ozd5Jn.js} +1 -1
- package/dist/{file-dialogs-CbdvmY__.js → file-dialogs-CgEXaCev.js} +7 -7
- package/dist/{file-manager-shell-DLaJ5Z_L.js → file-manager-shell-Tqduf5lh.js} +21 -21
- package/dist/{file-preview-host-RhZvGGqC.js → file-preview-host-CM4pV3ZD.js} +2367 -2384
- package/dist/{file-viewer-body-DM3RkXGn.js → file-viewer-body-DrWFmnp4.js} +3 -3
- package/dist/{file-viewer-dialog-impl-ei5EYj8k.js → file-viewer-dialog-impl-DZpuZZ7x.js} +2 -2
- package/dist/files-drop.js +1 -1
- package/dist/files-picker.js +8 -8
- package/dist/files.js +3 -3
- package/dist/{financial-variant-BNdOqzA5.js → financial-variant-ljdP0JL4.js} +5 -5
- package/dist/{flow-diagram-BBB6r8--.js → flow-diagram-DwUnyl0u.js} +1 -1
- package/dist/{gallery-CIIJHpmj.js → gallery-DfN2KE4Y.js} +11 -11
- package/dist/{gallery-file-viewer-DkshswFr.js → gallery-file-viewer-BfFWfLIF.js} +3 -3
- package/dist/{gl-markers-abqcNuYT.js → gl-markers-CBNFeWIk.js} +3 -3
- package/dist/{hooks-D6lOSXA5.js → hooks-DiAhgchz.js} +3 -3
- package/dist/hooks.js +3 -3
- package/dist/i18n.js +3 -3
- package/dist/{icon-button-GKYj7uC4.js → icon-button-D-gi4Plg.js} +1 -1
- package/dist/image-editor-mmhbsqs-.js +4423 -0
- package/dist/image-editor.css +1 -1
- package/dist/image-editor.js +1124 -848
- package/dist/image-markup-editor-D-QkZWKf.js +24 -0
- package/dist/input-CWf3Apid.js +18 -0
- package/dist/input-box-moFuoMt0.js +15 -0
- package/dist/{input-group-CKO68Pyi.js → input-group-Bb8sAFRF.js} +3 -2
- package/dist/{item-details-l_-rk3Hj.js → item-details-BWdHMfsS.js} +7 -7
- package/dist/keypad.js +2 -2
- package/dist/lib/capture/engine/canvas.d.ts +17 -0
- package/dist/lib/capture/engine/capture.d.ts +19 -0
- package/dist/lib/capture/engine/filters.d.ts +27 -0
- package/dist/lib/capture/engine/rect.d.ts +26 -0
- package/dist/lib/capture/engine/types.d.ts +66 -0
- package/dist/lib/capture/index.d.ts +16 -0
- package/dist/lib/capture/modes/capture-mode.d.ts +24 -0
- package/dist/lib/capture/modes/countdown.d.ts +16 -0
- package/dist/lib/capture/modes/full-page.d.ts +14 -0
- package/dist/lib/capture/modes/pick-element.d.ts +22 -0
- package/dist/lib/capture/modes/scroller.d.ts +13 -0
- package/dist/lib/capture/modes/visible.d.ts +3 -0
- package/dist/lib/capture-toolbar/index.d.ts +25 -0
- package/dist/lib/capture-toolbar/lazy-capture-outputs.d.ts +2 -0
- package/dist/lib/capture-toolbar/outputs-encode.d.ts +25 -0
- package/dist/lib/capture-toolbar/outputs.d.ts +38 -0
- package/dist/lib/capture-toolbar/partials/capture-editor.d.ts +11 -0
- package/dist/lib/capture-toolbar/partials/capture-outputs.d.ts +16 -0
- package/dist/lib/capture-toolbar/region-overlay.d.ts +15 -0
- package/dist/lib/capture-toolbar/screen-capture-toolbar.d.ts +31 -0
- package/dist/lib/capture-toolbar/types.d.ts +117 -0
- package/dist/lib/capture-toolbar/use-screen-capture.d.ts +16 -0
- package/dist/lib/components/ui/media/attachment-list/attachment-list.d.ts +2 -2
- package/dist/lib/components/ui/media/image-editor/image-markup-editor.d.ts +11 -3
- package/dist/lib/components/ui/media/image-editor/types-edits.d.ts +7 -0
- package/dist/lib/components/ui/media/image-editor/types-session.d.ts +1 -1
- package/dist/lib/components/ui/media/image-editor/types.d.ts +8 -0
- package/dist/lib/embed/index.d.ts +2 -0
- package/dist/lib/i18n/resources/resources.d.ts +108 -0
- package/dist/lib/i18n/translator.d.ts +1 -1
- package/dist/lib/image-editor/index.d.ts +1 -1
- package/dist/lib.js +38 -56
- package/dist/{list-sheet-D22J9I-K.js → list-sheet-CejfrKJr.js} +1 -1
- package/dist/{loading-indicator-sDzxZg8f.js → loading-indicator-BBjOF25N.js} +1 -1
- package/dist/main.js +103 -98
- package/dist/{map-draw-DfbfT0eJ.js → map-draw-DyRy9SSV.js} +2 -2
- package/dist/map-draw.js +5 -5
- package/dist/map-static.js +1 -1
- package/dist/{map-view-DAx2zvV-.js → map-view-YfuYD3zS.js} +9 -9
- package/dist/map-zone-events.js +1 -1
- package/dist/map-zone-field.js +7 -7
- package/dist/map.js +10 -10
- package/dist/{marker-button-D7hEvEZD.js → marker-button-CXBaToHp.js} +1 -1
- package/dist/{marker-count-image-CWS3G-k8.js → marker-count-image-DHuzSev9.js} +1 -1
- package/dist/material.css +1 -1
- package/dist/{measure-manual-Bfvu8B_R.js → measure-manual-CcESmV1d.js} +3 -3
- package/dist/{measurement-B-OeWv7j.js → measurement-D2or6yM_.js} +1 -1
- package/dist/{media-player-DGXmWK7W.js → media-player-qW9RXFuO.js} +451 -567
- package/dist/{media-player-viewer-C3vXYcd8.js → media-player-viewer-DozPiF6T.js} +2 -2
- package/dist/{media-surface-BySonDjv.js → media-surface-BJsdNynm.js} +6 -6
- package/dist/{mention-list-BpoZHwO6.js → mention-list-z1wnlJgs.js} +2 -2
- package/dist/{native-select-Dg4bc7aC.js → native-select-BnDOVnER.js} +1 -1
- package/dist/{nxgt-theme-Ob-uFqU_.js → nxgt-theme-EYZ5aFHi.js} +6 -15
- package/dist/nxgt-theme-provider-BPXd3h82.js +40 -0
- package/dist/outputs-DF-aVqUO.js +81 -0
- package/dist/passkey.js +1 -1
- package/dist/{pdf-form-filler-DgH52W2Q.js → pdf-form-filler-Ct4eexhZ.js} +34 -34
- package/dist/pdf-form.js +2 -2
- package/dist/{pdf-reader-Bilz5foK.js → pdf-reader-khpMMEjU.js} +16 -16
- package/dist/{pdf-reader-viewer-DwQP2IpV.js → pdf-reader-viewer-B3_TdFOn.js} +2 -2
- package/dist/pdf-reader.js +2 -2
- package/dist/{percent-field-Ldc7K2wC.js → percent-field-Bu-PmCNR.js} +2 -2
- package/dist/{picker-surface-DZQbBgvA.js → picker-surface-THexE1OU.js} +3 -3
- package/dist/{popover-DwsaHFrK.js → popover-osl5duoA.js} +1 -1
- package/dist/portal-container-provider-fZFUk-ZB.js +11 -0
- package/dist/{pos-types-CKDG7pZA.js → pos-types-BPPae99i.js} +1 -1
- package/dist/{pos-variant-9nhz-ZzW.js → pos-variant-D6bDUqwV.js} +4 -4
- package/dist/print.js +1 -1
- package/dist/{programmer-variant-BzwfeMGC.js → programmer-variant-CDlFE24o.js} +2 -2
- package/dist/{progress-BBfp7sMi.js → progress-DjHnanxA.js} +2 -2
- package/dist/{progress-linear-BOJbHnzd.js → progress-linear-CTJ_U6kY.js} +1 -1
- package/dist/{public-I8nb8pCC.js → public-u9u2Osmx.js} +6 -6
- package/dist/{rendition-stage-A1nHXYrA.js → rendition-stage-BXjQpfKK.js} +2 -2
- package/dist/{rich-code-block-BJERY3N3.js → rich-code-block-DWSzyQRw.js} +5 -5
- package/dist/{scientific-variant-st2NBm1K.js → scientific-variant-DCgApH87.js} +2 -2
- package/dist/{scroll-area-B3XstZU2.js → scroll-area-BxKiT4Dn.js} +155 -164
- package/dist/{search-field-D3AOJr7s.js → search-field-Cgqa2bQf.js} +2 -2
- package/dist/{select-DhfzCkun.js → select-BGhRlBh4.js} +166 -179
- package/dist/{sheet-B8cO1T5K.js → sheet-BvNVroog.js} +1 -1
- package/dist/{signature-dialog-BNLMPgao.js → signature-dialog-x--_QWRB.js} +5 -5
- package/dist/signature.js +1 -1
- package/dist/{site-footer-cta-Cx7zsvkq.js → site-footer-cta-B3Kfqpep.js} +4 -4
- package/dist/{site-footer-link-Di8IMIw0.js → site-footer-link-SFHrO4ld.js} +1 -1
- package/dist/{size-slot-D1cKqb09.js → size-slot-Cb-W2Zm4.js} +1 -1
- package/dist/{sortable-provider-DrLnoygf.js → sortable-provider-KRScvvYx.js} +2 -2
- package/dist/{spinner-BpH9tE8R.js → spinner-DpB6XvJJ.js} +1 -1
- package/dist/switch-c_6OtXzW.js +125 -0
- package/dist/{tabs-root-BUnIfDah.js → tabs-root-C2n3K_Yv.js} +1 -1
- package/dist/{tags-form-BwqR4UVj.js → tags-form-BKB9fP03.js} +5 -5
- package/dist/{text-field-CFCHo07X.js → text-field-Dl7xTxZe.js} +2 -2
- package/dist/{textarea-B_iMDYgM.js → textarea-C3BGZELU.js} +1 -1
- package/dist/{textarea-field-DIOGxyUd.js → textarea-field-mqWhhbis.js} +2 -2
- package/dist/theme-picker.js +5 -4
- package/dist/{theme-toggle-CsBe64lm.js → theme-toggle-K-n5eq0T.js} +3 -3
- package/dist/theme-value-CD2nDrj_.js +12 -0
- package/dist/themes.js +15 -48
- package/dist/{toasts-McZnLRHP.js → toasts-DFLecXh0.js} +5 -5
- package/dist/{toggle-group-DKN1XLBS.js → toggle-group-DMDjNJWx.js} +1 -1
- package/dist/{toolbar-group-BmzGP_JO.js → toolbar-group-bttMdvg4.js} +1 -1
- package/dist/{toolbar-item-slot-BnqQLkVd.js → toolbar-item-slot-CBn3YjeE.js} +1 -1
- package/dist/{toolbar-items-C9uasXZ2.js → toolbar-items-zL5TYLf2.js} +4 -4
- package/dist/{toolbar-keep-focus-Vc5V-dX2.js → toolbar-keep-focus-C6bnzvpE.js} +2 -2
- package/dist/{tracked-layer-CjCXB_O6.js → tracked-layer-CYdLWRK-.js} +4 -4
- package/dist/{translate-material-C-qVvGLn.js → translate-material-DZNgWjYu.js} +1 -1
- package/dist/{translator-BrzI307E.js → translator-CrIFDzAz.js} +110 -2
- package/dist/{tree-DOAs456A.js → tree-CFXDccIe.js} +1 -1
- package/dist/{upload-host-ZpSSql8v.js → upload-host-DDktVohu.js} +9 -8
- package/dist/{use-calculator-keyboard-Ss25SRoM.js → use-calculator-keyboard-BWkYuIw5.js} +1 -1
- package/dist/{use-chat-composer-DopDN-zP.js → use-chat-composer-C1Qlnw2i.js} +20 -20
- package/dist/{use-file-meta-DyJX0JVs.js → use-file-meta-DcfQCh52.js} +1 -1
- package/dist/{use-heading-spy-CA2IAqMe.js → use-heading-spy-B9xEMHbZ.js} +2 -2
- package/dist/use-image-preview-BNq_RQm5.js +20 -0
- package/dist/{use-item-entries-CYbS5otl.js → use-item-entries-BKQHcWFx.js} +1 -1
- package/dist/{use-material-translation-eYySryw3.js → use-material-translation-ZEUtduro.js} +1 -1
- package/dist/{use-media-viewer-DoNdrzhN.js → use-media-viewer-DViJNx75.js} +1 -1
- package/dist/{use-text-preview-BQE4U9cT.js → use-text-preview-Ci97JKKo.js} +2 -2
- package/dist/{use-unsaved-guard-CSfDvdxd.js → use-unsaved-guard-CWlHEvjN.js} +2 -2
- package/dist/{viewer-CXF1dAv0.js → viewer-DDPJOxBt.js} +5 -5
- package/dist/{viewer-stage-class-CpyA8o-M.js → viewer-stage-class-DJ1uod4l.js} +4 -4
- package/dist/{viewer-states-BXyCdNhE.js → viewer-states-DkaPBkK4.js} +3 -3
- package/dist/{virtual-layer-rows-DHy8vAup.js → virtual-layer-rows-DKejQ_Jd.js} +1 -1
- package/dist/visible-B-IFZ4Nv.js +475 -0
- package/docs/components/media-and-files.md +1 -1
- package/docs/guides/capture.md +248 -0
- package/docs/guides/csp.md +1 -1
- package/docs/guides/embed.md +50 -2
- package/docs/roadmap.md +2 -1
- package/docs/troubleshooting.md +56 -0
- package/package.json +18 -1
- package/dist/fab-dock-DqwbI-5n.js +0 -86
- package/dist/input-BaBE_MR_.js +0 -27
- /package/dist/{dist-B1qFabLJ.js → dist-B1qFabLJ2.js} +0 -0
package/docs/guides/capture.md
CHANGED
|
@@ -69,6 +69,254 @@ still page. Chromium is the supported browser for `maskText`.
|
|
|
69
69
|
- `failed`: no frame within 5 seconds (hidden tab, stream ended), no encoding,
|
|
70
70
|
or an invalid `unmaskSelector`. The tracks are always stopped.
|
|
71
71
|
|
|
72
|
+
## Engines: `captureElement` and `captureRegion`
|
|
73
|
+
|
|
74
|
+
`captureScreen` always asks the browser for a screen share. The engine layer
|
|
75
|
+
renders the page itself, with no prompt, or reads a frame of the share and
|
|
76
|
+
crops it. Same entry, still no React.
|
|
77
|
+
|
|
78
|
+
```ts
|
|
79
|
+
import {
|
|
80
|
+
canvasToBlob,
|
|
81
|
+
captureElement,
|
|
82
|
+
captureRegion,
|
|
83
|
+
} from '@softistx/material/capture';
|
|
84
|
+
|
|
85
|
+
// The page (or one element), as a canvas at devicePixelRatio:
|
|
86
|
+
const { canvas } = await captureElement(document.querySelector('#report'));
|
|
87
|
+
const blob = await canvasToBlob(canvas, 'image/webp', 0.9);
|
|
88
|
+
|
|
89
|
+
// A rectangle of the viewport, in the CSS pixels of getBoundingClientRect:
|
|
90
|
+
const region = await captureRegion({ x: 40, y: 80, w: 320, h: 200 }, { mask: true });
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
| Function | Meaning |
|
|
94
|
+
| --- | --- |
|
|
95
|
+
| `captureElement(target?, options?)` | renders `target` (default `document.documentElement`) |
|
|
96
|
+
| `captureRegion(rect, options?)` | renders `options.target` (default the page) and keeps `rect`, in viewport CSS pixels |
|
|
97
|
+
| `getCaptureEngine('dom' \| 'system')` | the built-in engine, to call `isAvailable()` or `capture()` yourself |
|
|
98
|
+
| `canvasToBlob(canvas, type?, quality?)`, `canvasToBitmap(canvas)`, `cropCanvas(canvas, rect, scale)` | output helpers |
|
|
99
|
+
| `rectFromPoints(a, b)`, `intersectRects(a, b)` | rectangle maths for a selection UI |
|
|
100
|
+
|
|
101
|
+
They resolve `{ canvas, scale, engine }` (`scale`: canvas pixels per CSS
|
|
102
|
+
pixel) and reject with a `CaptureEngineError`.
|
|
103
|
+
|
|
104
|
+
| Option | Default | Meaning |
|
|
105
|
+
| --- | --- | --- |
|
|
106
|
+
| `engine` | `'dom'` | `'dom'`, `'system'`, or an object implementing `CaptureEngine` |
|
|
107
|
+
| `mask` | off | `true`, or `{ selector, text, unmaskSelector }`, see below |
|
|
108
|
+
| `scale` | `devicePixelRatio` | pixels per CSS pixel (DOM engine; the system engine keeps the frame's resolution) |
|
|
109
|
+
| `backgroundColor` | none | fill behind transparent areas (DOM engine) |
|
|
110
|
+
|
|
111
|
+
### The DOM engine (default)
|
|
112
|
+
|
|
113
|
+
Needs the optional peer `@zumer/snapdom` (`bun add @zumer/snapdom@^3.7.1`),
|
|
114
|
+
imported with `import()` only when a capture runs: the entry itself does not
|
|
115
|
+
grow, and an app that never captures never loads it. It needs no permission,
|
|
116
|
+
reads open shadow roots, embeds the web fonts in use and draws pseudo-elements.
|
|
117
|
+
Cross-origin images and iframes that cannot be read become a neutral grey box,
|
|
118
|
+
so the canvas is never tainted. The page is rendered as it looks now, then
|
|
119
|
+
cropped; a long page costs more than a region of a short one.
|
|
120
|
+
|
|
121
|
+
### The system engine
|
|
122
|
+
|
|
123
|
+
`engine: 'system'` asks the person to share a window, a tab or a screen
|
|
124
|
+
(`getDisplayMedia`, from a user gesture) and returns that frame. A `target`, a `rect`
|
|
125
|
+
or a `mask` are in the page's CSS pixels, so they need the current tab
|
|
126
|
+
(`displaySurface: 'browser'`); another surface rejects with `invalid-target`
|
|
127
|
+
instead of cropping the wrong pixels. A `target` crops the frame to its
|
|
128
|
+
bounding box, intersected with `rect` when both are given (no overlap rejects
|
|
129
|
+
with `invalid-target`). A `scale` that is not a positive number rejects with
|
|
130
|
+
`invalid-target` too. Excluded elements are hidden while the
|
|
131
|
+
frame is read.
|
|
132
|
+
|
|
133
|
+
### Excluding and masking
|
|
134
|
+
|
|
135
|
+
- An element with **`data-capture-exclude`** (and what it contains) is left out
|
|
136
|
+
of every capture, DOM or system. Put it on your own capture UI.
|
|
137
|
+
- **Masking is opt-in.** With `mask: true`, elements with
|
|
138
|
+
**`data-capture-mask`** are painted as opaque black boxes after rendering, so
|
|
139
|
+
the pixels never leave. `mask.selector` changes the attribute selector;
|
|
140
|
+
`mask.text: true` (or an element) also boxes the text under it like
|
|
141
|
+
`captureScreen`'s `maskText`, leaving `mask.unmaskSelector`
|
|
142
|
+
(`[data-capture-unmask]`) readable.
|
|
143
|
+
|
|
144
|
+
### Engine errors
|
|
145
|
+
|
|
146
|
+
`CaptureEngineError.code`: `unsupported` (no `getDisplayMedia`, a server),
|
|
147
|
+
`denied` (picker refused), `peer-missing` (`@zumer/snapdom` not installed),
|
|
148
|
+
`invalid-target` (detached element, empty region, a crop of a non-tab share),
|
|
149
|
+
`cancelled` (Esc or an `AbortSignal` during a pick or a countdown), `failed`.
|
|
150
|
+
|
|
151
|
+
## Modes: visible, element, full page, timer
|
|
152
|
+
|
|
153
|
+
Plain functions on top of the engines, no React. Every one resolves
|
|
154
|
+
`{ canvas, scale, engine }` like `captureElement`.
|
|
155
|
+
|
|
156
|
+
```ts
|
|
157
|
+
import { captureMode } from '@softistx/material/capture';
|
|
158
|
+
|
|
159
|
+
const { canvas } = await captureMode('full-page', { delay: 5 });
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
| Function | What it does |
|
|
163
|
+
| --- | --- |
|
|
164
|
+
| `captureVisible(options?)` | the viewport as the person sees it |
|
|
165
|
+
| `captureFullPage({ target?, ...options })` | the whole content of the main scroll container, else of the document |
|
|
166
|
+
| `pickElement({ filter?, onHover?, signal?, outline?, describe?, announce? })` | element mode: an outline follows the pointer, a click (or tap) resolves the element and is not passed on to the page. The keyboard works too: Up goes to the parent, Down to the first child, Left and Right between siblings, Tab and Shift+Tab step through the page, Enter or Space picks, Esc cancels. A live region says which element is outlined (`describe` names it, `announce: false` turns it off) |
|
|
167
|
+
| `countdown(3 \| 5 \| 10, { onTick?, signal?, overlay? })` | the timer: a big number on screen, one tick a second |
|
|
168
|
+
| `captureMode(mode, { delay?, signal?, onTick?, overlay?, target? })` | `'visible'`, `'element'` or `'full-page'`, with the timer in front when `delay` is set |
|
|
169
|
+
| `findMainScroller()` | the element `captureFullPage` detects, or `null` for the document |
|
|
170
|
+
|
|
171
|
+
**Full page.** The main scroll container is the largest element (at least a
|
|
172
|
+
third of the viewport) that scrolls vertically, such as a layout's main area;
|
|
173
|
+
without one the document is captured. Pass `target` to force a scroller. While
|
|
174
|
+
it renders, the container is stretched to its content and scrolled to the top,
|
|
175
|
+
then restored, so a sticky header is drawn once; the page may jump for the length of the render. An ancestor that clips the scroller (a fixed-height `overflow: hidden` layout) can still hide content: pass its scroller as `target`. It needs the DOM engine
|
|
176
|
+
(the built-in `engine: 'system'` rejects with `unsupported`).
|
|
177
|
+
|
|
178
|
+
**Timer.** `delay` (`CAPTURE_DELAYS`: 3, 5 or 10 seconds) counts down before the
|
|
179
|
+
capture, and before the pick in element mode, so a menu can be opened
|
|
180
|
+
meanwhile. Esc or the `signal` cancels with a `cancelled` `CaptureEngineError`.
|
|
181
|
+
The outline and the number carry `data-capture-exclude`; pass `overlay: false`
|
|
182
|
+
to draw your own from `onHover` and `onTick`.
|
|
183
|
+
|
|
184
|
+
### `CaptureMode` and `ScreenCaptureMode`
|
|
185
|
+
|
|
186
|
+
Two names, two lists. `CaptureMode` (`'visible' | 'element' | 'full-page'`) is
|
|
187
|
+
what `captureMode()` runs: a plain function that needs no screen of its own.
|
|
188
|
+
`ScreenCaptureMode` (`'visible' | 'region' | 'element' | 'full-page' | 'system'`,
|
|
189
|
+
`SCREEN_CAPTURE_MODES`) is what the toolbar and `useScreenCapture` offer: the
|
|
190
|
+
same three, plus `region`, which needs the overlay to draw the area, and
|
|
191
|
+
`system`, which uses the browser's own capture and its permission prompt.
|
|
192
|
+
Use `CaptureMode` with the functions and `ScreenCaptureMode` with the toolbar.
|
|
193
|
+
|
|
194
|
+
## The toolbar: `@softistx/material/capture-toolbar`
|
|
195
|
+
|
|
196
|
+
The interface of the tool, React, in its own entry (the engines and modes above
|
|
197
|
+
stay lean and React-free). `ScreenCaptureToolbar` is a floating, tinted pill:
|
|
198
|
+
a chip per mode (visible area, region, element, full page, and the system
|
|
199
|
+
window where `getDisplayMedia` exists), the timer as a menu (no timer, 3, 5 or
|
|
200
|
+
10 s) and a round Capture button. While a timer runs, a region is drawn or an
|
|
201
|
+
element is picked, the button becomes Cancel; Esc cancels too. When a run
|
|
202
|
+
ends (done, cancelled, failed), focus goes back to the Capture button. The
|
|
203
|
+
editor is a modal layer: the page behind it is `inert` while it is open.
|
|
204
|
+
|
|
205
|
+
```tsx
|
|
206
|
+
import { ScreenCaptureToolbar } from '@softistx/material/capture-toolbar';
|
|
207
|
+
|
|
208
|
+
<ScreenCaptureToolbar
|
|
209
|
+
onCapture={({ blob, mode }) => upload(blob)}
|
|
210
|
+
onError={(error) => report(error)}
|
|
211
|
+
capture={{ mask: true }} // opt-in masking, as in CaptureOptions
|
|
212
|
+
modes={['visible', 'region', 'element']}
|
|
213
|
+
shortcut="Alt+Shift+S" // optional: there is no default shortcut
|
|
214
|
+
/>
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
`onCapture` receives `{ blob, canvas, scale, engine, mode }` with a PNG `blob`.
|
|
218
|
+
A cancel is not an error: nothing is called. `position="top"` moves the pill to
|
|
219
|
+
the top of the viewport. The toolbar, the region overlay, the countdown and the
|
|
220
|
+
element outline all carry `data-capture-exclude`, so none is in the image.
|
|
221
|
+
|
|
222
|
+
**Region.** Drag to draw an area, or click to snap to the element under the
|
|
223
|
+
pointer (a "Snap" chip marks it). The area has a 3 px outline, eight round
|
|
224
|
+
handles, a "W x H px" pill at its top centre, and Cancel and Capture buttons.
|
|
225
|
+
Drag inside it to move it. With the keyboard: arrows move it by 1 px, Shift by
|
|
226
|
+
10 px, Alt resizes it, Enter captures and Esc cancels. A fine pointer shows a
|
|
227
|
+
loupe with its pixel coordinates, kept clear of the size pill and the Cancel and Capture buttons (it moves to another side of the pointer, and hides while the pointer is over them); touch drag works as the mouse does.
|
|
228
|
+
|
|
229
|
+
**Edit the capture.** With `edit` (on by default on the toolbar), the capture
|
|
230
|
+
opens in the markup editor before `onCapture`: full screen, floating tools
|
|
231
|
+
(pen, highlighter, arrow, rectangle, text, the numbered step marker, redact),
|
|
232
|
+
Crop, a text Cancel and a primary Done. Done calls `onCapture` with the edited
|
|
233
|
+
PNG (`edited: true`; `canvas` stays the raw capture); Cancel returns to the page
|
|
234
|
+
with nothing, no `onCapture`, no `onError`. It works the same for every mode and
|
|
235
|
+
both engines. The editor is a lazy chunk, fetched when a capture opens it, so
|
|
236
|
+
`edit={false}` keeps it out of the page's loads.
|
|
237
|
+
|
|
238
|
+
```tsx
|
|
239
|
+
<ScreenCaptureToolbar onCapture={({ blob }) => upload(blob)} /> // edits first
|
|
240
|
+
<ScreenCaptureToolbar edit={false} onCapture={({ blob }) => upload(blob)} />
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
**Outputs.** Pass `outputs` and, after the capture (and the editor), the pill is
|
|
244
|
+
replaced by a row that offers what to do with the image, until Close or Esc.
|
|
245
|
+
`onCapture` still fires first, with the PNG. Copy and Download are on by
|
|
246
|
+
default, Share (on by default) shows only where `navigator.canShare({ files })` is true, and
|
|
247
|
+
Upload shows only with a `FileSource` that has `upload`. Each action reports
|
|
248
|
+
its result once, in an inline status that a screen reader announces (no
|
|
249
|
+
`Toaster` is needed); a failure also stays on screen until the next try.
|
|
250
|
+
|
|
251
|
+
```tsx
|
|
252
|
+
// Copy (always PNG), Download, and Share where the device supports it
|
|
253
|
+
<ScreenCaptureToolbar outputs={{}} />
|
|
254
|
+
|
|
255
|
+
// Copy and Download only
|
|
256
|
+
<ScreenCaptureToolbar outputs={{ share: false }} />
|
|
257
|
+
|
|
258
|
+
// Download as WebP at 80 % quality, with a file name (`quality` is ignored for PNG, default 0.92)
|
|
259
|
+
<ScreenCaptureToolbar
|
|
260
|
+
outputs={{ copy: false, format: 'webp', quality: 0.8, fileName: 'bug-report' }}
|
|
261
|
+
/>
|
|
262
|
+
|
|
263
|
+
// Upload through your FileSource (`source`, a `FileSource` with `upload`; Share shows by itself where the device can)
|
|
264
|
+
<ScreenCaptureToolbar
|
|
265
|
+
outputs={{
|
|
266
|
+
upload: { source, onUploaded: (item) => attach(item) },
|
|
267
|
+
}}
|
|
268
|
+
/>
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
The helpers are exported for your own buttons: `encodeCapture(blob, { format,
|
|
272
|
+
quality })` (PNG, WebP or JPEG; JPEG is filled white), `copyCapture`,
|
|
273
|
+
`downloadCapture`, `shareCapture`, `uploadCapture` and the checks
|
|
274
|
+
`canCopyCapture` and `canShareCapture`, `captureFileName(name?, format?)` for a
|
|
275
|
+
file name with the right extension, and the `CaptureFormat` type (`'png' | 'webp' | 'jpeg'`). They throw a `CaptureOutputError` with
|
|
276
|
+
`code` `unsupported` (no clipboard, share or encoder in this browser) or `failed`;
|
|
277
|
+
`uploadCapture` rethrows the source's own error, and `shareCapture` resolves
|
|
278
|
+
`false` when the person closes the sheet. `upload` also takes `parentId`,
|
|
279
|
+
`onConflict`, `onProgress` and `signal`. Headless, `useScreenCapture({ review: true })`
|
|
280
|
+
sets `status` to `reviewing` and `cap.review` to `{ result, onClose }` for
|
|
281
|
+
`<CaptureOutputs {...cap.review} outputs={...} />` inside a `Suspense`, or call the
|
|
282
|
+
helpers from your own buttons:
|
|
283
|
+
|
|
284
|
+
```tsx
|
|
285
|
+
const cap = useScreenCapture({ review: true, onCapture: ({ blob }) => setLast(blob) });
|
|
286
|
+
<button type="button" onClick={async () =>
|
|
287
|
+
downloadCapture(await encodeCapture(last, { format: 'jpeg', quality: 0.8 }), 'bug.jpg')}>
|
|
288
|
+
Save as JPEG
|
|
289
|
+
</button>
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
**Headless.** `useScreenCapture(options)` returns `{ mode, setMode, delay,
|
|
293
|
+
setDelay, status, left, error, start, cancel, region, editor, review }`; `status`
|
|
294
|
+
is `editing` while the editor is open and `reviewing` while the output step
|
|
295
|
+
shows (`review: true`). Start a capture from
|
|
296
|
+
your own control and render `<RegionOverlay {...cap.region} />` while `region`
|
|
297
|
+
is set.
|
|
298
|
+
|
|
299
|
+
```tsx
|
|
300
|
+
const cap = useScreenCapture({ onCapture: ({ blob }) => upload(blob) });
|
|
301
|
+
<button type="button" onClick={() => cap.start('visible')}>Capture</button>
|
|
302
|
+
{cap.region && <RegionOverlay {...cap.region} />}
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
`edit` is off by default in the hook (it stays lean). Set `edit: true` and render
|
|
306
|
+
`{cap.editor && <CaptureEditor {...cap.editor} />}` beside the overlay.
|
|
307
|
+
|
|
308
|
+
**Labels.** The strings are `material.capture.*` in English and French.
|
|
309
|
+
|
|
310
|
+
**Embedded in a Shadow DOM.** Wrap the toolbar in a `PortalContainerProvider`
|
|
311
|
+
(re-exported by the entry, with `adoptStyles`, `NxgtThemeProvider` and
|
|
312
|
+
`I18nProvider`) so the timer menu renders in the shadow root, and adopt
|
|
313
|
+
`@softistx/material/capture-toolbar.css`, the shadow-root-ready stylesheet.
|
|
314
|
+
The toolbar is an entry of the regular build, not of the lean embed build, so
|
|
315
|
+
it shares chunks with the rest of the library: opt in only where that is
|
|
316
|
+
acceptable. The region overlay and the toolbar render and capture inside a
|
|
317
|
+
shadow root; a cross-origin image or iframe is drawn as a neutral placeholder
|
|
318
|
+
by the engine.
|
|
319
|
+
|
|
72
320
|
## Testing
|
|
73
321
|
|
|
74
322
|
Stub `navigator.mediaDevices.getDisplayMedia` to return a `<canvas>`'s
|
package/docs/guides/csp.md
CHANGED
|
@@ -278,7 +278,7 @@ mermaid and pdf.js's font fallback are the [known gaps](#known-gaps).
|
|
|
278
278
|
| `ImageCropper` (react-easy-crop) | nothing | its CSS is in the stylesheet; it renders with `disableAutomaticStylesInjection` |
|
|
279
279
|
| `Spinner` (variant `4`), `PdfReader` (search highlights, night mode) | nothing | their rules are in the stylesheet (`spinner.css`, `pdf-viewer.css`) |
|
|
280
280
|
| `Progress`, `CircularProgress` | nothing | the server draws SVG percentages, SMIL and path data, and the rules are in the stylesheet (`progress.css`); no `style` attribute |
|
|
281
|
-
| `ScrollArea`, `Select` (Radix) | the nonce | Radix renders a `<style>` element with `NonceProvider`'s nonce: wrap the app in [`NonceProvider`](#nonceprovider) |
|
|
281
|
+
| `ScrollArea`, `Select` (Radix) | the nonce | Radix renders a `<style>` element with `NonceProvider`'s nonce: wrap the app in [`NonceProvider`](#nonceprovider) (in an embed, the one of `@softistx/material/embed`: see [Strict CSP and the chat scroll area](./embed.md#strict-csp-and-the-chat-scroll-area)) |
|
|
282
282
|
| `Markdown` (math) | the nonce | one `<style>` of `mk-` rules replacing KaTeX's `style` attributes, with `NonceProvider`'s nonce |
|
|
283
283
|
| `RichTextEditor` (tiptap) | the nonce | tiptap, on mount, with `NonceProvider`'s nonce as `injectNonce` |
|
|
284
284
|
| `Dialog`, `AlertDialog`, `Sheet`, `ConfirmationDialog`, … (Radix scroll lock) | the nonce | react-style-singleton, when a modal opens: see below |
|
package/docs/guides/embed.md
CHANGED
|
@@ -78,6 +78,7 @@ createRoot(shadow).render(
|
|
|
78
78
|
| `Spinner` | a busy indicator |
|
|
79
79
|
| `ChatThread`, `ChatMessageList`, `ChatMessage`, `ChatMessageSeparator`, `ChatComposer` | a chat: the frame, the scrolling list, a message, a day or "unread" separator and the composer with attachments ([A chat in an embed](#a-chat-in-an-embed)) |
|
|
80
80
|
| `AttachmentList`, `AttachmentItem` | the files of a message: type icon, name, size, canvas thumbnail, progress, refusal text, Remove ([Files in an embed](#files-in-an-embed)) |
|
|
81
|
+
| `NonceProvider` | the host page's CSP nonce, for the `<style>` of `ChatMessageList`'s scroll area ([Strict CSP](#strict-csp-and-the-chat-scroll-area)) |
|
|
81
82
|
| `I18nProvider` | the language of the labels (`initialLanguage`), for `AttachmentList` ([Files in an embed](#files-in-an-embed)) |
|
|
82
83
|
| `NxgtThemeProvider` | the theme and dark mode; it renders no element |
|
|
83
84
|
| `PortalContainerProvider` | the shadow root the dialog portals into ([Shadow DOM](shadow-dom.md)) |
|
|
@@ -165,7 +166,7 @@ The mail icon is an inline SVG, so no sprite sheet is needed on the host page.
|
|
|
165
166
|
goes through the same rules as a drop). Its icons are drawn inline (no sprite
|
|
166
167
|
provider needed) and its classes (the zone's dashed border, its layout) are in
|
|
167
168
|
`@softistx/material/embed.css`, which is what styles it inside the shadow root.
|
|
168
|
-
`AttachmentList` shows what it handed you; it draws inline icons,
|
|
169
|
+
`AttachmentList` shows what it handed you (no size when a file's `size` is unknown, an upload already done); it draws inline icons,
|
|
169
170
|
and an image's thumbnail on a `<canvas>` (no `blob:` or `data:` `<img>`), so a
|
|
170
171
|
host page with a strict `img-src` does not block it. Labels are English and
|
|
171
172
|
French (`material.attachments.*`, and the refusal sentences of `useRefusalMessage`):
|
|
@@ -347,8 +348,37 @@ createRoot(shadow).render(
|
|
|
347
348
|
```
|
|
348
349
|
|
|
349
350
|
- `ImageMarkupEditor` is `ImageEditor` set up for annotation: only the Markup
|
|
350
|
-
panel, with the pen, highlighter, arrow, rectangle, text and redact tools
|
|
351
|
+
panel, with the pen, highlighter, arrow, rectangle, text, step marker and redact tools
|
|
351
352
|
(`EMBED_MARKUP_TOOLS`), no Download item, and `decode="bitmap"`.
|
|
353
|
+
- Numbered step markers: the `step` tool (in `EMBED_MARKUP_TOOLS`, `markupTools`
|
|
354
|
+
keeps it or leaves it out) drops a round pin numbered 1, 2, 3 in the current
|
|
355
|
+
colour with a click, and a drag on a pin moves it. Deleting a pin (Delete on
|
|
356
|
+
the stage, or the Delete button) renumbers the ones after it, and Undo
|
|
357
|
+
brings it back. The number is white or dark depending on the colour's
|
|
358
|
+
luminance, and pins are part of the exported image. With the Step tool open,
|
|
359
|
+
Enter on the focused image drops the next pin at the centre of the view; the
|
|
360
|
+
arrow keys then nudge it. The mark is `{ kind: 'step', x, y, n, color, size }`
|
|
361
|
+
(centre as fractions of the image, `size` a fraction of the shorter side).
|
|
362
|
+
- `crop` (on `ImageMarkupEditor`) adds the Crop panel beside Markup, for
|
|
363
|
+
annotating a capture: `<ImageMarkupEditor crop … />`.
|
|
364
|
+
- `toolbar="floating"` (on `ImageEditor` or `ImageMarkupEditor`) is the annotate
|
|
365
|
+
mode: no side panel or rail, but a pill of tools floating over the image
|
|
366
|
+
(Crop, the drawing tools, five colours and a picker, Undo and Redo; the active
|
|
367
|
+
tool widens to show its name), a text Cancel at the top left and a primary
|
|
368
|
+
Done at the top right (`saveLabel` renames it; default "Done"). Crop opens its
|
|
369
|
+
controls in a card over the pill. Only Markup and Crop are offered in this
|
|
370
|
+
mode. The default, `toolbar="panel"`, is unchanged.
|
|
371
|
+
|
|
372
|
+
```tsx
|
|
373
|
+
<ImageMarkupEditor
|
|
374
|
+
src={screenshot}
|
|
375
|
+
crop
|
|
376
|
+
toolbar="floating"
|
|
377
|
+
onSave={({ file }) => upload(file)}
|
|
378
|
+
onCancel={close}
|
|
379
|
+
/>
|
|
380
|
+
```
|
|
381
|
+
|
|
352
382
|
- `ImageEditor` (the full editor, every panel) is exported too, with two new
|
|
353
383
|
optional props: `markupTools` lists the drawing tools offered (the first is
|
|
354
384
|
selected at the start) and `decode` is `'image'` (the default) or `'bitmap'`.
|
|
@@ -368,3 +398,21 @@ createRoot(shadow).render(
|
|
|
368
398
|
- Wrap the editor in `PortalContainerProvider`: the export menu and the
|
|
369
399
|
shortcuts dialog then render in the shadow root, where the adopted styles
|
|
370
400
|
reach them. Pointer, keyboard and focus work in an open shadow root.
|
|
401
|
+
|
|
402
|
+
## Strict CSP and the chat scroll area
|
|
403
|
+
|
|
404
|
+
`ChatMessageList` (and so `ChatThread`) renders a scroll area whose viewport
|
|
405
|
+
injects a `<style>` into the shadow root. Under `style-src 'nonce-X'` it needs the
|
|
406
|
+
nonce. Wrap the widget in the `NonceProvider` exported from
|
|
407
|
+
`@softistx/material/embed` (not the one of another entry: the embed entry is built
|
|
408
|
+
apart, so another provider is a different context):
|
|
409
|
+
|
|
410
|
+
```tsx
|
|
411
|
+
import { NonceProvider, ChatThread } from '@softistx/material/embed';
|
|
412
|
+
|
|
413
|
+
<NonceProvider nonce={hostNonce}>
|
|
414
|
+
<ChatThread /* ... */ />
|
|
415
|
+
</NonceProvider>;
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
Mounting the provider also sets the shared `Symbol.for('nxgt.cspNonce')` key on the host page's `globalThis` (the nonce for code that runs outside React).
|
package/docs/roadmap.md
CHANGED
|
@@ -8,7 +8,6 @@ version they shipped in, and planned entries may name the major they target.
|
|
|
8
8
|
|
|
9
9
|
- **Attractive auth pages (AuthVisual + domain scene sets)** — `AuthVisual`, the rich `visual` of `AuthCard layout="split"`: a flat primary tint with a domain `Illustration`, a headline and value line, two or three benefits and a stat or quote, hidden on a phone, with a `Guides/Recipes/Auth` sign-in and sign-up split recipe ([#5164](https://github.com/softistx/nxgt-material/issues/5164), [#5144](https://github.com/softistx/nxgt-material/issues/5144)). React only for now.
|
|
10
10
|
- **One radius token per button kind ([#5022](https://github.com/softistx/nxgt-material/issues/5022))** — `--nxgt-button-radius`, `--nxgt-icon-button-radius`, `--nxgt-fab-radius`, `--nxgt-split-button-radius`, `--nxgt-toggle-radius` and `--nxgt-toggle-group-radius`, unset by default (today's shape and press morph stay), replace a kind's rest radius at every size when an app sets one; the library's own `rounded-*` on button roots are gone, and a guard spec keeps them out ([guide](guides/theming.md#button-radius)). Shipped with the next release.
|
|
11
|
-
- **Capture the screen ([#4883](https://github.com/softistx/nxgt-material/issues/4883))** — `@softistx/material/capture`: `canCaptureScreen()` and `captureScreen({ maskText })`, one frame from the browser's screen capture as a `Blob`, with opaque boxes burned over text and field values when asked; a lean entry with no React ([guide](guides/capture.md)).
|
|
12
11
|
- **Split dialog ([#4884](https://github.com/softistx/nxgt-material/issues/4884))** — `DialogContent layout="split"` puts a body and a `DialogAside` side by side while the dialog is 640px wide or more (its own width, not the viewport's), each scrolling alone, with the header and footer across both; one column when narrower. Defaults to `size="lg"` and a full-screen phone presentation. React only for now. Shipped with the next release.
|
|
13
12
|
- **TimerChip ([#4750](https://github.com/softistx/nxgt-material/issues/4750))** — `TimerChip` in `@softistx/material/components`: a running timer as one chip, a live dot (pulse, off under reduced motion), an optional truncating label, the time elapsed since `startedAt` (`h:mm:ss`; a `role="timer"`, `aria-live="off"`) and an optional Stop button (tonal icon button, tooltip, 44 px target), with a `compact` form for a phone app bar and `material.timer-chip.*` names in English and French. React only for now (Vue twin [#4753](https://github.com/softistx/nxgt-material/issues/4753)). Shipped with the next release.
|
|
14
13
|
- **Highlight a quoted excerpt in Markdown** — `Markdown` takes `highlight` (a string or `{ text, name?, scroll? }`) and `onHighlight`: the excerpt is found in the rendered text with case, accents, whitespace and Markdown marks folded, across inline elements and without KaTeX's MathML copy, painted with the CSS Custom Highlight API in a themed `::highlight(nxgt-excerpt)`, scrolled into view (no smooth scroll under reduced motion), and reported as found or not so the app can say the passage changed; `useTextHighlight` in `/hooks` does the same for any element ([#4611](https://github.com/softistx/nxgt-material/issues/4611), [docs](components/data-display.md#highlight-a-quoted-excerpt); Vue twin [#4612](https://github.com/softistx/nxgt-material/issues/4612)). React only for now. Shipped with the next release.
|
|
@@ -294,6 +293,7 @@ version they shipped in, and planned entries may name the major they target.
|
|
|
294
293
|
|
|
295
294
|
## Later
|
|
296
295
|
|
|
296
|
+
- **Screen video recording** — record the screen as a video or GIF (`MediaRecorder`) beside the screen-capture tool ([#5280](https://github.com/softistx/nxgt-material/issues/5280)).
|
|
297
297
|
- **PDF form designer and flattening** — the PDF form filler's second version ([#4895](https://github.com/softistx/nxgt-material/issues/4895)): place fields on a PDF that has none (a field designer, with `pdf-lib` loaded on demand), flatten a filled form into plain page content, and later detect fields automatically. React only for now.
|
|
298
298
|
|
|
299
299
|
- **PDF field designer and flattening** — for `PdfFormFiller`: place fields on a PDF that has none, and flatten a filled form into a plain, non-editable PDF ([#4895](https://github.com/softistx/nxgt-material/issues/4895)).
|
|
@@ -434,6 +434,7 @@ version they shipped in, and planned entries may name the major they target.
|
|
|
434
434
|
|
|
435
435
|
## Shipped
|
|
436
436
|
|
|
437
|
+
- **Screen capture tool ([#5280](https://github.com/softistx/nxgt-material/issues/5280))** — `@softistx/material/capture` grows into a full screen-capture tool: a DOM engine with no permission prompt or the browser's window/tab/screen capture, visible-area, region, element, full scrolling page and timed modes, a floating `ScreenCaptureToolbar` and `useScreenCapture` hook that stay out of the image, opt-in masking, a markup editor with crop and numbered step markers, and Blob, Copy, Download, WebP/JPEG, `FileSource` upload and Web Share outputs, usable inside a shadow root; `captureScreen({ maskText })` ([#4883](https://github.com/softistx/nxgt-material/issues/4883): one frame from the browser's screen capture as a `Blob`, with opaque boxes burned over text and field values) is unchanged, and the lean entry has no React ([guide](guides/capture.md)). Shipped with the next release.
|
|
437
438
|
- **Button loading on form submit ([#5180](https://github.com/softistx/nxgt-material/issues/5180))** — a `type="submit"` `Button` inside a React Router `<Form>` is busy by itself while its submission runs, with the spinner centred over a label that stays in place; `loading={false}` opts out, and `RouterNavigationState` covers pages outside `ActivityLayout`.
|
|
438
439
|
- **Page skeletons ([#5181](https://github.com/softistx/nxgt-material/issues/5181))** — `PageSkeleton` for list, detail, dashboard, form and table pages, to show from a route's fallback while its data loads.
|
|
439
440
|
- **WorkspacePicker `pendingId` ([#5200](https://github.com/softistx/nxgt-material/issues/5200))** — `WorkspacePicker` marks the workspace being opened as busy and locks the others while a choice is submitted through a fetcher or any async call.
|
package/docs/troubleshooting.md
CHANGED
|
@@ -313,6 +313,11 @@ npm view @softistx/material --registry https://registry.npmjs.org/
|
|
|
313
313
|
- [Markers lose their icon or `renderMarker`, or cannot be tabbed to, on a large map](#markers-lose-their-icon-or-rendermarker-or-cannot-be-tabbed-to-on-a-large-map)
|
|
314
314
|
- [`MapView: "View data" rows failed to load`](#mapview-view-data-rows-failed-to-load)
|
|
315
315
|
|
|
316
|
+
**Screen capture**
|
|
317
|
+
|
|
318
|
+
- [The capture toolbar is unstyled](#the-capture-toolbar-is-unstyled)
|
|
319
|
+
- [Capture output rows: copy, share, encode and upload errors](#capture-output-rows-copy-share-encode-and-upload-errors)
|
|
320
|
+
|
|
316
321
|
**i18n**
|
|
317
322
|
|
|
318
323
|
- [`useI18nContext must be used within an I18nProvider`](#usei18ncontext-must-be-used-within-an-i18nprovider)
|
|
@@ -4898,6 +4903,57 @@ Keep the `markers` array stable (`useMemo`) in GL mode: a new array on each rend
|
|
|
4898
4903
|
the status line says so. Under a CSP, add the origin to `connect-src`.
|
|
4899
4904
|
- The route is outside the view: call `ref.fit()` or set `fitOnLoad`.
|
|
4900
4905
|
|
|
4906
|
+
### The capture toolbar is unstyled
|
|
4907
|
+
|
|
4908
|
+
**When:** `ScreenCaptureToolbar` renders with no pill, no tint and misplaced
|
|
4909
|
+
buttons, in a Shadow DOM or in an app that does not load the library's
|
|
4910
|
+
`styles.css`.
|
|
4911
|
+
**Why:** the toolbar's stylesheet ships as `@softistx/material/capture-toolbar.css`
|
|
4912
|
+
and is not part of `styles.css`.
|
|
4913
|
+
A normal app that loads `styles.css` still needs this one import.
|
|
4914
|
+
**Fix:** import it (or adopt it in the shadow root) and wrap the toolbar in a
|
|
4915
|
+
`PortalContainerProvider` so the timer menu renders in the same root:
|
|
4916
|
+
|
|
4917
|
+
```tsx
|
|
4918
|
+
import '@softistx/material/capture-toolbar.css';
|
|
4919
|
+
```
|
|
4920
|
+
|
|
4921
|
+
### Capture output rows: copy, share, encode and upload errors
|
|
4922
|
+
|
|
4923
|
+
**When:** the output row of `ScreenCaptureToolbar` (`outputs` prop) or a helper
|
|
4924
|
+
(`copyCapture`, `shareCapture`, `encodeCapture`, `uploadCapture`) fails. The row
|
|
4925
|
+
shows the message once, in an alert under the row; a helper rejects with a
|
|
4926
|
+
`CaptureOutputError` whose `code` is `unsupported` or `failed`.
|
|
4927
|
+
**Why and fix:**
|
|
4928
|
+
|
|
4929
|
+
- "This browser cannot copy an image": no `ClipboardItem` or no
|
|
4930
|
+
`navigator.clipboard.write` (an insecure `http:` page, an old browser).
|
|
4931
|
+
Serve the page over HTTPS, test with `canCopyCapture()` and hide Copy, or
|
|
4932
|
+
keep Download.
|
|
4933
|
+
- "The copy failed": the browser refused the write: the page lost focus, the
|
|
4934
|
+
click was not a user gesture, or the clipboard permission is denied. Copy
|
|
4935
|
+
runs from the button click only; do not call `copyCapture` after a long
|
|
4936
|
+
`await`. Only PNG is copied, whatever `format` is set.
|
|
4937
|
+
- "This browser cannot share an image": `navigator.share` or
|
|
4938
|
+
`navigator.canShare({ files })` is missing (most desktop browsers, any
|
|
4939
|
+
non-HTTPS page). Test `canShareCapture(blob)`; the row already hides Share
|
|
4940
|
+
there.
|
|
4941
|
+
- "The share failed": the share sheet raised an error other than the user
|
|
4942
|
+
cancelling (a cancel is not an error and resolves `false`). Share needs a
|
|
4943
|
+
user gesture too, which is why the row encodes the image ahead of the click.
|
|
4944
|
+
- "This browser cannot encode webp" (or `jpeg`): the canvas returned another
|
|
4945
|
+
type than the one asked, as Safari does for WebP. Use `format="png"` or
|
|
4946
|
+
`jpeg`. "This browser cannot re-encode an image": no `createImageBitmap` or
|
|
4947
|
+
canvas, as in a non-browser runtime.
|
|
4948
|
+
- "This file source does not accept uploads": the `FileSource` passed to
|
|
4949
|
+
`outputs.upload.source` has no `upload` method (a read-only source). Pass a
|
|
4950
|
+
source that implements `upload`, or drop the Upload action.
|
|
4951
|
+
- An upload that fails shows **the source's own error message**: look at the
|
|
4952
|
+
server answer (size limit, auth, CORS on a direct-to-storage URL). Closing
|
|
4953
|
+
the row aborts the upload through its `signal`.
|
|
4954
|
+
- No toast appears: the app has no Toaster mounted. The inline status line
|
|
4955
|
+
still shows the message.
|
|
4956
|
+
|
|
4901
4957
|
### `captureMap()` rejects
|
|
4902
4958
|
|
|
4903
4959
|
**When:** `ref.current.captureMap()` rejects. The message says why.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@softistx/material",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.249.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"email": "stevegires@gmail.com"
|
|
@@ -207,6 +207,11 @@
|
|
|
207
207
|
"types": "./dist/lib/capture/index.d.ts",
|
|
208
208
|
"require": "./dist/capture.js"
|
|
209
209
|
},
|
|
210
|
+
"./capture-toolbar": {
|
|
211
|
+
"import": "./dist/capture-toolbar.js",
|
|
212
|
+
"types": "./dist/lib/capture-toolbar/index.d.ts",
|
|
213
|
+
"require": "./dist/capture-toolbar.js"
|
|
214
|
+
},
|
|
210
215
|
"./image-editor": {
|
|
211
216
|
"import": "./dist/image-editor.js",
|
|
212
217
|
"types": "./dist/lib/image-editor/index.d.ts",
|
|
@@ -329,6 +334,10 @@
|
|
|
329
334
|
"style": "./dist/embed.css",
|
|
330
335
|
"default": "./dist/embed.css"
|
|
331
336
|
},
|
|
337
|
+
"./capture-toolbar.css": {
|
|
338
|
+
"style": "./dist/capture-toolbar.css",
|
|
339
|
+
"default": "./dist/capture-toolbar.css"
|
|
340
|
+
},
|
|
332
341
|
"./image-editor.css": {
|
|
333
342
|
"style": "./dist/image-editor.css",
|
|
334
343
|
"default": "./dist/image-editor.css"
|
|
@@ -636,6 +645,7 @@
|
|
|
636
645
|
"@types/react-dom": "^19.3.0",
|
|
637
646
|
"@vitejs/plugin-react": "6.0.4",
|
|
638
647
|
"@vitest/browser-playwright": "4.1.10",
|
|
648
|
+
"@zumer/snapdom": "3.7.1",
|
|
639
649
|
"ajv": "^8.20.0",
|
|
640
650
|
"axe-core": "4.12.1",
|
|
641
651
|
"bwip-js": "^4.11.4",
|
|
@@ -694,6 +704,13 @@
|
|
|
694
704
|
"/passkey"
|
|
695
705
|
]
|
|
696
706
|
},
|
|
707
|
+
"@zumer/snapdom": {
|
|
708
|
+
"range": "^3.7.1",
|
|
709
|
+
"subpaths": [
|
|
710
|
+
"/capture",
|
|
711
|
+
"/capture-toolbar"
|
|
712
|
+
]
|
|
713
|
+
},
|
|
697
714
|
"hls.js": {
|
|
698
715
|
"range": "^1.6.0",
|
|
699
716
|
"subpaths": [
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { t as e } from "./utils-BLfntITJ.js";
|
|
2
|
-
import { n as t, t as n } from "./dist-DVRQkaTK.js";
|
|
3
|
-
import { t as r } from "./fab-icon-BRG_oyGh.js";
|
|
4
|
-
import { useEffect as i, useRef as a, useState as o } from "react";
|
|
5
|
-
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
6
|
-
//#region lib/components/ui/actions/fab/fab.tsx
|
|
7
|
-
var l = ["tonal", "filled"], u = [
|
|
8
|
-
"primary",
|
|
9
|
-
"secondary",
|
|
10
|
-
"neutral"
|
|
11
|
-
];
|
|
12
|
-
function d({ icon: i, label: a, extended: l, collapsed: u, size: d = "md", variant: f = "tonal", tone: p = "primary", attention: m, asChild: h = !1, children: g, className: _, type: v = "button", ...y }) {
|
|
13
|
-
let b = h ? n : "button", x = !l || u, [S, C] = o(m), [w, T] = o();
|
|
14
|
-
return m !== S && (C(m), m !== void 0 && T(w === "a" ? "b" : "a")), /* @__PURE__ */ c(b, {
|
|
15
|
-
type: h ? void 0 : v,
|
|
16
|
-
"data-slot": "fab",
|
|
17
|
-
"data-size": d,
|
|
18
|
-
"data-variant": f,
|
|
19
|
-
"data-tone": p,
|
|
20
|
-
"data-extended": l ? "" : void 0,
|
|
21
|
-
"data-collapsed": l && u ? "" : void 0,
|
|
22
|
-
"data-attention": w,
|
|
23
|
-
"aria-label": x ? a : void 0,
|
|
24
|
-
className: e("nxgt-fab", _),
|
|
25
|
-
...y,
|
|
26
|
-
children: [
|
|
27
|
-
h ? /* @__PURE__ */ s(t, { children: g }) : null,
|
|
28
|
-
/* @__PURE__ */ s(r, { icon: i }),
|
|
29
|
-
l ? /* @__PURE__ */ s("span", {
|
|
30
|
-
"data-slot": "fab-label-track",
|
|
31
|
-
children: /* @__PURE__ */ s("span", {
|
|
32
|
-
"data-slot": "fab-label",
|
|
33
|
-
"aria-hidden": u || void 0,
|
|
34
|
-
children: a
|
|
35
|
-
})
|
|
36
|
-
}) : null
|
|
37
|
-
]
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
//#endregion
|
|
41
|
-
//#region lib/components/ui/actions/fab/fab-dock-inset.ts
|
|
42
|
-
var f = "--fab-dock-inset", p = 12, m = /* @__PURE__ */ new WeakMap();
|
|
43
|
-
function h(e) {
|
|
44
|
-
let t = m.get(e);
|
|
45
|
-
if (!t?.size) return e.style.removeProperty(f);
|
|
46
|
-
e.style.setProperty(f, `${Math.max(...t.values())}px`);
|
|
47
|
-
}
|
|
48
|
-
function g(e, t, n, r, i) {
|
|
49
|
-
let a = Symbol("fab-dock"), o = m.get(t) ?? /* @__PURE__ */ new Map();
|
|
50
|
-
m.set(t, o);
|
|
51
|
-
let s = () => {
|
|
52
|
-
let r = e.offsetHeight;
|
|
53
|
-
if (!r) o.delete(a);
|
|
54
|
-
else {
|
|
55
|
-
let e = Number.parseFloat(n()) || 0;
|
|
56
|
-
o.set(a, Math.ceil(e + r + p));
|
|
57
|
-
}
|
|
58
|
-
h(t);
|
|
59
|
-
};
|
|
60
|
-
s();
|
|
61
|
-
let c = i ? new i(s) : void 0;
|
|
62
|
-
return c?.observe(e), r?.addEventListener("resize", s), () => {
|
|
63
|
-
c?.disconnect(), r?.removeEventListener("resize", s), o.delete(a), h(t);
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
//#endregion
|
|
67
|
-
//#region lib/components/ui/actions/fab/fab-dock.tsx
|
|
68
|
-
function _({ contained: t, scrolling: n, side: r = "end", className: o, ref: c, ...l }) {
|
|
69
|
-
let u = a(null);
|
|
70
|
-
return i(() => {
|
|
71
|
-
let e = u.current;
|
|
72
|
-
if (!(t || n || !e)) return g(e, document.documentElement, () => getComputedStyle(e).insetBlockEnd, window, typeof ResizeObserver > "u" ? void 0 : ResizeObserver);
|
|
73
|
-
}, [t, n]), /* @__PURE__ */ s("div", {
|
|
74
|
-
ref: (e) => {
|
|
75
|
-
u.current = e, typeof c == "function" ? c(e) : c && (c.current = e);
|
|
76
|
-
},
|
|
77
|
-
"data-slot": "fab-dock",
|
|
78
|
-
"data-contained": t || n ? "" : void 0,
|
|
79
|
-
"data-scrolling": n ? "" : void 0,
|
|
80
|
-
"data-side": r,
|
|
81
|
-
className: e("nxgt-fab-dock", o),
|
|
82
|
-
...l
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
//#endregion
|
|
86
|
-
export { d as i, u as n, l as r, _ as t };
|
package/dist/input-BaBE_MR_.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { t as e } from "./utils-BLfntITJ.js";
|
|
2
|
-
import { n as t, t as n } from "./blank-placeholder-DeDn5Xor.js";
|
|
3
|
-
import { jsx as r } from "react/jsx-runtime";
|
|
4
|
-
//#region lib/components/ui/primitives/input/input-box.ts
|
|
5
|
-
var i = "selection:bg-primary selection:text-primary-foreground", a = [
|
|
6
|
-
"inline-flex gap-2 items-center h-11 max-h-full w-full min-w-0",
|
|
7
|
-
"px-2 py-1 text-base md:text-sm outline-none",
|
|
8
|
-
"placeholder:text-muted-foreground",
|
|
9
|
-
"file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-muted-foreground",
|
|
10
|
-
"disabled:pointer-events-none"
|
|
11
|
-
], o = [
|
|
12
|
-
...a,
|
|
13
|
-
i,
|
|
14
|
-
t
|
|
15
|
-
], s = [...a, t], c = o;
|
|
16
|
-
function l({ className: t, type: i = "text", ...a }) {
|
|
17
|
-
return /* @__PURE__ */ r("input", {
|
|
18
|
-
type: i,
|
|
19
|
-
"data-slot": "input",
|
|
20
|
-
className: e(c, t),
|
|
21
|
-
"data-pw": a.name ?? "input",
|
|
22
|
-
...a,
|
|
23
|
-
placeholder: n(a.placeholder, i)
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
//#endregion
|
|
27
|
-
export { s as i, c as n, o as r, l as t };
|
|
File without changes
|