@nxgt/material 3.60.0 → 3.62.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 +30 -0
- package/README.md +3 -2
- package/dist/code-editor.js +49 -32
- package/dist/{components-BSM-h5IQ.js → components-TDDUQ1Y0.js} +9203 -9191
- package/dist/components.js +22 -22
- package/dist/hooks-CGnqFngB.js +187 -0
- package/dist/hooks.js +8 -102
- package/dist/illustrations-game.js +2 -0
- package/dist/lib/components/ui/display/list-tile/list-tile.d.ts +6 -0
- package/dist/lib/components/ui/display/list-tile/partials/list-tile-classes.d.ts +3 -1
- package/dist/lib/components/ui/display/list-tile/partials/list-tile-line.d.ts +1 -1
- package/dist/lib/components/ui/display/list-tile/partials/list-tile-toggle.d.ts +1 -1
- package/dist/lib/components/ui/layout/app-shell/activity-layout.types.d.ts +6 -3
- package/dist/lib/components/ui/layout/app-shell/index.d.ts +1 -1
- package/dist/lib/components/ui/layout/app-shell/route-transition.d.ts +20 -2
- package/dist/lib/components/ui/layout/app-shell/shapes-clear-content.d.ts +2 -1
- package/dist/lib/components/ui/widgets/code-editor/configure-monaco.d.ts +2 -0
- package/dist/lib/hooks/drafts-store.d.ts +4 -0
- package/dist/lib/hooks/index.d.ts +1 -0
- package/dist/lib/hooks/use-drafts.d.ts +75 -0
- package/dist/lib/illustrations-game/index.d.ts +17 -0
- package/dist/main.js +39 -39
- package/dist/material.css +1 -1
- package/docs/components/data-display.md +1 -0
- package/docs/components/navigation-and-layout.md +1 -1
- package/docs/guides/app-shell.md +17 -0
- package/docs/guides/code-editor.md +8 -0
- package/docs/guides/csp.md +4 -0
- package/docs/guides/helpers.md +57 -0
- package/docs/guides/icon-motifs.md +3 -1
- package/docs/guides/illustrations.md +33 -1
- package/docs/guides/migrating-to-3.md +4 -2
- package/docs/previews/feedback-status-illustration-game.webp +0 -0
- package/docs/roadmap.md +1 -1
- package/docs/troubleshooting.md +9 -6
- package/package.json +7 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
# @nxgt/material
|
|
2
2
|
|
|
3
|
+
## 3.62.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#2011](https://github.com/softistx/nxgt-material/pull/2011) [`688d543`](https://github.com/softistx/nxgt-material/commit/688d543e3306e3709d66cd75f4ad64cea43d48d0) Thanks [@SteveGT96](https://github.com/SteveGT96)! - Add `inset` to `ListTile`. With `variant="divided"`, `inset` gives 16px of inline padding (M3's list-item inset) in place of 4px, for a divided list inside a `Card`; the hairlines still run edge to edge. Default `false`: nothing changes for existing tiles.
|
|
8
|
+
|
|
9
|
+
## 3.61.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [#1999](https://github.com/softistx/nxgt-material/pull/1999) [`cf43f97`](https://github.com/softistx/nxgt-material/commit/cf43f97b8e66f162486066a94d566a3faac25eaf) Thanks [@SteveGT96](https://github.com/SteveGT96)! - New subpath `@nxgt/material/illustrations/game`: a set of eleven game scenes (`night-sky`, `village`, `seer`, `healer`, `archer`, `cupid`, `wolf`, `victory`, `empty-table`, `waiting-players`, `connection-lost`) for a game, quiz, community or event app, registered like the health and education sets (`<IllustrationDefaults sets={[GAME_SCENES]}>`). Decorative by default, an accessible `title` on request, theme tones in light and dark. Importing it adds the ids to `SceneId`. Fixes [#1914](https://github.com/softistx/nxgt-material/issues/1914).
|
|
14
|
+
|
|
15
|
+
- [#1998](https://github.com/softistx/nxgt-material/pull/1998) [`02ff46a`](https://github.com/softistx/nxgt-material/commit/02ff46ad89404eba69d34ab3c6ec5e5b6cd92688) Thanks [@SteveGT96](https://github.com/SteveGT96)! - `ActivityLayout`'s default `routeTransition` (`true`) now fades the content region only when the pathname changes. A search or hash change (`?tab=`, a list search), a fetcher submit and a revalidation no longer animate the whole region, and typing in a search inside a dialog no longer drops characters. An explicit `routeTransition` object keeps working exactly as before, without the gate, so `{ default: 'nxgt-route' }` still animates every transition. If your app gated `update` on the pathname with a ref of the last pathname, remove that workaround.
|
|
16
|
+
|
|
17
|
+
New export `ROUTE_TRANSITION_CLASS` (`'nxgt-route'`), so a nested `<ViewTransition>` fades with the same timing as the shell.
|
|
18
|
+
|
|
19
|
+
- [#2007](https://github.com/softistx/nxgt-material/pull/2007) [`815f539`](https://github.com/softistx/nxgt-material/commit/815f5399630ca494edc7879f365a80e77b61bd6e) Thanks [@SteveGT96](https://github.com/SteveGT96)! - Add `useDrafts(storageKey, options?)` to `@nxgt/material/hooks`: unsent values kept by key in the tab's `sessionStorage` so a reload or a jump to another step of a form loses no typed text. It returns `{ get, set, drop, clear, keys, loaded }`, reads after the first render (no hydration mismatch), swallows storage errors, and takes `serialize`, `parse` and `storage` options. Call `drop(key)` once the value is saved. `clearDrafts(storageKey, storage?)` empties a store key without a hook (sign-out). No Vue twin yet.
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- [#1995](https://github.com/softistx/nxgt-material/pull/1995) [`224da3b`](https://github.com/softistx/nxgt-material/commit/224da3b885e346aa627a471b124d88750042abda) Thanks [@SteveGT96](https://github.com/SteveGT96)! - Fix backdrop shapes cut by the edge of a surface. With `ActivityLayout`'s shapes backdrop, a glyph that straddled the edge of a header band (`ActivityContentHeader`, `EntityHeader`, the breadcrumb) or of a plain `bg-card` block was drawn half hidden. The keep-clear rule now counts those blocks whole, so a glyph meeting a surface edge is dropped whole, like one that meets a card. An element with the bare `bg-card` class now counts as a surface, so a page-wide `bg-card` wrapper keeps every glyph clear.
|
|
24
|
+
|
|
25
|
+
- [#2006](https://github.com/softistx/nxgt-material/pull/2006) [`c723507`](https://github.com/softistx/nxgt-material/commit/c723507e4ca28f73d76869862bd371a46e2c7930) Thanks [@SteveGT96](https://github.com/SteveGT96)! - `configureMonaco` (`@nxgt/material/code-editor`) gives the `<style>` elements Monaco injects the page's CSP nonce (`getCspNonce()`), so a `style-src-elem 'nonce-…'` policy no longer refuses the editor's styles and an app needs no `document.createElement` patch. The code editor and CSP guides say how the nonce and the bundled workers fit together. Fixes [#2002](https://github.com/softistx/nxgt-material/issues/2002).
|
|
26
|
+
|
|
27
|
+
- [#1996](https://github.com/softistx/nxgt-material/pull/1996) [`5dbe8cc`](https://github.com/softistx/nxgt-material/commit/5dbe8ccd3f765879698bb4880fa0603cb1d9b177) Thanks [@SteveGT96](https://github.com/SteveGT96)! - `ActivityLayout` and `AppHeader` no longer show the phone's menu button when the menu sheet would hold nothing to open: `items` is empty and there is no `context` line. The brand alone does not count. A menu with any entry (footer ones included) or a `context` keeps its button, and `showMenuIcon={false}` still hides it. Fixes [#1418](https://github.com/softistx/nxgt-material/issues/1418).
|
|
28
|
+
|
|
29
|
+
- [#2013](https://github.com/softistx/nxgt-material/pull/2013) [`c4b4a4d`](https://github.com/softistx/nxgt-material/commit/c4b4a4d20e05b1f3e3e2c6052b98513b4fcb9633) Thanks [@SteveGT96](https://github.com/SteveGT96)! - `QuestionCard`: in the answer key, the correct option of an unanswered single-choice question is drawn with the dashed `missed` style, as multi-choice does, instead of the solid `correct` one. A chosen correct option stays `correct`. Fixes [#2010](https://github.com/softistx/nxgt-material/issues/2010).
|
|
30
|
+
- Updated dependencies [[`cf43f97`](https://github.com/softistx/nxgt-material/commit/cf43f97b8e66f162486066a94d566a3faac25eaf)]:
|
|
31
|
+
- @nxgt/material-core@0.44.0
|
|
32
|
+
|
|
3
33
|
## 3.60.0
|
|
4
34
|
|
|
5
35
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -208,6 +208,7 @@ reads `duotone.svg`, the file that exists (it used to ask for the missing
|
|
|
208
208
|
| `@nxgt/material/illustrations` | State illustrations: `Illustration` (`scene`: `empty`, `no-results`, `not-found`, `error`, `offline`, `success`, `welcome`, `forbidden`, `maintenance`, `invitation`, `sign-in`, `empty-inbox`, or an id of the `scenes` table it is given; `size`, `title`, `animated`, `hero`, `satellites`, `iconStyle`, `tone`, `duotone`) draws a hero icon on a Material 3 Expressive plate with satellites, from the Font Awesome sprites your app serves (no icon artwork ships); `IllustrationDefaults` (`icons`: `'suggested'` or a table, `iconStyle`, `sets`) opts a subtree's `EmptyState` and `ErrorState` into them; `ILLUSTRATION_SCENES`, `SUGGESTED_ICONS` and the types re-exported from `@nxgt/material-core/illustrations` (`SceneRow`, `SceneTable`), plus `IconStyleInput` and `IconStyleRef` (the `iconStyle` types: `{ family?, type? }` or one of the 37 sprite file names), `SceneId`, `RegisteredScene` and `IllustrationSceneRegistry`, the scene id type that an imported set's ids widen. `unauthorized` and `maintenance` states draw the `forbidden` and `maintenance` scenes. `EmptyState`, `ErrorState` and the `DataTable` empty row (`emptyIllustration`) also take `illustration` as a scene id or `true`. Colours are theme tones in `styles.css`; its own entry ([illustrations guide](https://cdn.jsdelivr.net/npm/@nxgt/material@3/docs/guides/illustrations.md)) |
|
|
209
209
|
| `@nxgt/material/illustrations/health` | The health scenes: `HEALTH_SCENES` (`patient-record`, `consultation`, `appointment`, `lab-sample`, `prescription`, `vaccination`, `hospitalisation`, `emergency`, `no-patients`, `lab-results`), `HEALTH_SCENE_IDS`, `HEALTH_SUGGESTED_ICONS`, `HealthScene`; register it with `<IllustrationDefaults sets={[HEALTH_SCENES]}>` so `<Illustration scene="patient-record" />` and `<EmptyState illustration="no-patients" />` work (or pass `scenes={HEALTH_SCENES}` to one `Illustration`); importing it adds the ids to `SceneId`. An app that does not import it does not carry it |
|
|
210
210
|
| `@nxgt/material/illustrations/education` | The education scenes: `EDUCATION_SCENES` (`classroom`, `homework`, `exam-grades`, `timetable`, `attendance`, `enrolment`, `library`, `graduation`, `no-students`, `report-card`), `EDUCATION_SCENE_IDS`, `EDUCATION_SUGGESTED_ICONS`, `EducationScene`; register it with `<IllustrationDefaults sets={[EDUCATION_SCENES]}>` so `<Illustration scene="classroom" />` and `<EmptyState illustration="no-students" />` work (or pass `scenes={EDUCATION_SCENES}` to one `Illustration`); importing it adds the ids to `SceneId`. An app that does not import it does not carry it |
|
|
211
|
+
| `@nxgt/material/illustrations/game` | The game scenes, for a game, quiz, community or event app: `GAME_SCENES` (`night-sky`, `village`, `seer`, `healer`, `archer`, `cupid`, `wolf`, `victory`, `empty-table`, `waiting-players`, `connection-lost`), `GAME_SCENE_IDS`, `GAME_SUGGESTED_ICONS`, `GameScene`; register it with `<IllustrationDefaults sets={[GAME_SCENES]}>` so `<Illustration scene="village" />` and `<EmptyState illustration="empty-table" />` work (or pass `scenes={GAME_SCENES}` to one `Illustration`); importing it adds the ids to `SceneId`. Pass `title` for an accessible name, otherwise the picture is decorative (`aria-hidden`). An app that does not import it does not carry it |
|
|
211
212
|
| `@nxgt/material/backgrounds` | Background presets: `Background` (a superset of the `/components` one: `preset`, `animated`, `grain`, `seed`, `fill`, `motif`, and for `preset="icons"` `icons`, `iconStyle` and `iconMotif`), `AVAILABLE_BACKGROUND_PRESETS` and `AvailableBackgroundPreset` (the 50 ids `Background` draws), `MoonOptions` (the `moon` prop), `IconMotifOptions` (`iconMotif`, with `quiet`: a band the icons fade out of for text), `IconLayout`, `IconQuiet`, `SkyPreset` and `CelestialPreset` (the `sky` ids), `IconsInput` (`icons`), `IconStyleInput` and `IconStyleRef` (`iconStyle`: `{ family?, type? }` or one of the 37 sprite file names, completed by the editor, any other string is a type error), `sky` (`'moon'` or a celestial preset over any preset, also read from the theme's `background.sky`; the four celestial presets and `sky` share the opt-in `@nxgt/material/backgrounds/celestial.css`, also in `backgrounds.css`), `MOTIF_SHAPES_ALL` (the 25 motif shapes), the `MotifLayout` type, 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)) |
|
|
212
213
|
| `@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)) |
|
|
213
214
|
| `@nxgt/material/editor/viewer` | `RichTextViewer`: shows a saved document (HTML, JSON or Markdown) read-only, **server-safe**, with no editor instance and no `'use client'` ([RichTextViewer](https://cdn.jsdelivr.net/npm/@nxgt/material@3/docs/components/rich-widgets.md#richtextviewer)) |
|
|
@@ -219,7 +220,7 @@ reads `duotone.svg`, the file that exists (it used to ask for the missing
|
|
|
219
220
|
| `@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)) |
|
|
220
221
|
| `@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, generates your app themes' stylesheets with `nxgtMaterial({ themes })` and the `nxgt-theme` bin: [Themes guide](https://cdn.jsdelivr.net/npm/@nxgt/material@3/docs/guides/themes.md), a reduced backdrop icon sprite from your Font Awesome install with `nxgtMaterial({ backdropSprite })` and the `nxgt-backdrop-sprite` bin, 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)) |
|
|
221
222
|
| `@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)) |
|
|
222
|
-
| `@nxgt/material/hooks` | `useTheme`, `useIsClient`, `useIsMobile`, `useLocalizedDate`, `useCspNonce`, `useFocusOnMount`, `useCountdown`, `useSubmitOnce`, … ([helpers](https://cdn.jsdelivr.net/npm/@nxgt/material@3/docs/guides/helpers.md#nxgtmaterialhooks)) |
|
|
223
|
+
| `@nxgt/material/hooks` | `useTheme`, `useIsClient`, `useIsMobile`, `useLocalizedDate`, `useCspNonce`, `useFocusOnMount`, `useCountdown`, `useSubmitOnce`, `useDrafts`, … ([helpers](https://cdn.jsdelivr.net/npm/@nxgt/material@3/docs/guides/helpers.md#nxgtmaterialhooks)) |
|
|
223
224
|
| `@nxgt/material/dnd` | `@dnd-kit` primitives ([helpers](https://cdn.jsdelivr.net/npm/@nxgt/material@3/docs/guides/helpers.md#nxgtmaterialdnd)) |
|
|
224
225
|
| `@nxgt/material/i18n` | `I18nProvider`, `mergeResources`, `createTranslator`, `translateMaterial`, `formatMessage` ([i18n guide](https://cdn.jsdelivr.net/npm/@nxgt/material@3/docs/guides/i18n.md)) |
|
|
225
226
|
| `@nxgt/material/lib` | `cn`, `clientOnly`, date, number and storage utilities, `useSliceReducer`, `getCspNonce` / `setCspNonce`, the server-side CSP helpers (`createCspNonce`, `cspPolicy`, `cspHash`, `applyCspNonce`, `CSP_NONCE_PLACEHOLDER`, `ZOD_JITLESS_SCRIPT`, `zodJitlessTag`: [CSP, SSR](https://cdn.jsdelivr.net/npm/@nxgt/material@3/docs/guides/csp.md#ssr)) ([helpers](https://cdn.jsdelivr.net/npm/@nxgt/material@3/docs/guides/helpers.md#nxgtmateriallib)) |
|
|
@@ -463,7 +464,7 @@ Each area a consumer starts from has its own page under `docs/guides/`.
|
|
|
463
464
|
| [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 |
|
|
464
465
|
| [Barcodes](https://cdn.jsdelivr.net/npm/@nxgt/material@3/docs/guides/barcode.md) | Code 128 and Data Matrix with `@nxgt/material/barcode`: props, paper appearance, accessibility, `barcodeGeometry`, `LabelSheet` label sizes, offsets and `skip`, errors and printing |
|
|
465
466
|
| [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 |
|
|
466
|
-
| [Illustrations](https://cdn.jsdelivr.net/npm/@nxgt/material@3/docs/guides/illustrations.md) | `@nxgt/material/illustrations`: the twelve scenes and the health and
|
|
467
|
+
| [Illustrations](https://cdn.jsdelivr.net/npm/@nxgt/material@3/docs/guides/illustrations.md) | `@nxgt/material/illustrations`: the twelve scenes and the health, education and game sets, icons from your sprites, `EmptyState` / `ErrorState` / `DataTable` with `illustration`, `IllustrationDefaults` for an app, sizes, motion and CSP |
|
|
467
468
|
| [Icon motifs](https://cdn.jsdelivr.net/npm/@nxgt/material@3/docs/guides/icon-motifs.md) | icon backgrounds, celestial skies, illustrations and themes together: serving your own Font Awesome sprites (the package ships none), `IconSpritesProvider`, `icons` / `iconStyle` / `iconMotif`, `sky`, the health and education sets, a theme naming its motif, Free fallbacks for Pro-only names |
|
|
468
469
|
| [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 |
|
|
469
470
|
| [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 |
|
package/dist/code-editor.js
CHANGED
|
@@ -11,9 +11,10 @@ import { t as h } from "./react-node-text-Crkpfpco.js";
|
|
|
11
11
|
import { a as g, c as _, d as v, f as y, i as b, l as x, m as S, o as C, p as w, r as T, s as E, t as D, u as O } from "./code-editor-Ckc9TTCM.js";
|
|
12
12
|
import { useEffect as k, useRef as A, useState as j } from "react";
|
|
13
13
|
import { Fragment as M, jsx as N, jsxs as P } from "react/jsx-runtime";
|
|
14
|
-
import {
|
|
14
|
+
import { getCspNonce as F } from "@nxgt/material-core/csp-nonce";
|
|
15
|
+
import { ChevronDown as I, ChevronUp as L, Columns2 as R } from "lucide-react";
|
|
15
16
|
//#region lib/components/ui/widgets/code-editor/code-editor-form-field.tsx
|
|
16
|
-
function
|
|
17
|
+
function z({ control: e, name: t, ...n }) {
|
|
17
18
|
return /* @__PURE__ */ N(u, {
|
|
18
19
|
control: e,
|
|
19
20
|
name: t,
|
|
@@ -34,12 +35,28 @@ function R({ control: e, name: t, ...n }) {
|
|
|
34
35
|
}
|
|
35
36
|
//#endregion
|
|
36
37
|
//#region lib/components/ui/widgets/code-editor/configure-monaco.ts
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
var B = Symbol.for("nxgt.material.monaco-nonce");
|
|
39
|
+
function V() {
|
|
40
|
+
if (typeof document > "u") return;
|
|
41
|
+
let e = document;
|
|
42
|
+
if (e[B]) return;
|
|
43
|
+
e[B] = !0;
|
|
44
|
+
let t = e.createElement.bind(e);
|
|
45
|
+
e.createElement = ((e, n) => {
|
|
46
|
+
let r = t(e, n);
|
|
47
|
+
if (e.toLowerCase() === "style") {
|
|
48
|
+
let e = F();
|
|
49
|
+
e && r.setAttribute("nonce", e);
|
|
50
|
+
}
|
|
51
|
+
return r;
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
function H(e) {
|
|
55
|
+
V(), S.config(e);
|
|
39
56
|
}
|
|
40
57
|
//#endregion
|
|
41
58
|
//#region lib/components/ui/widgets/code-editor/diff/code-diff-parts.tsx
|
|
42
|
-
function
|
|
59
|
+
function U({ added: e, removed: t }) {
|
|
43
60
|
let { t: n } = o();
|
|
44
61
|
return /* @__PURE__ */ P("span", {
|
|
45
62
|
className: "nxgt-code-diff-totals",
|
|
@@ -62,7 +79,7 @@ function B({ added: e, removed: t }) {
|
|
|
62
79
|
]
|
|
63
80
|
});
|
|
64
81
|
}
|
|
65
|
-
function
|
|
82
|
+
function W({ index: e, count: t, language: n, children: r }) {
|
|
66
83
|
let { t: i } = o(), a = t === 0 ? i("material.code.no-changes", "No changes") : e < 0 ? i("material.code.change-count", "{count, plural, one {# change} other {# changes}}", { count: t }) : i("material.code.change-of", "Change {index} of {count}", {
|
|
67
84
|
index: e + 1,
|
|
68
85
|
count: t
|
|
@@ -87,7 +104,7 @@ function V({ index: e, count: t, language: n, children: r }) {
|
|
|
87
104
|
}
|
|
88
105
|
//#endregion
|
|
89
106
|
//#region lib/components/ui/widgets/code-editor/diff/code-diff-toolbar.tsx
|
|
90
|
-
function
|
|
107
|
+
function G({ sideBySide: e, onSideBySideChange: t, changeCount: s, onStep: u, getCode: d }) {
|
|
91
108
|
let { t: f } = o(), { status: p, copy: m } = l();
|
|
92
109
|
return /* @__PURE__ */ P(M, { children: [/* @__PURE__ */ P(n, {
|
|
93
110
|
label: f("material.code.diff-tools", "Diff tools"),
|
|
@@ -100,7 +117,7 @@ function H({ sideBySide: e, onSideBySideChange: t, changeCount: s, onStep: u, ge
|
|
|
100
117
|
className: "nxgt-code-toolbar",
|
|
101
118
|
children: [
|
|
102
119
|
t && /* @__PURE__ */ N(r, {
|
|
103
|
-
icon: /* @__PURE__ */ N(
|
|
120
|
+
icon: /* @__PURE__ */ N(R, {}),
|
|
104
121
|
label: f("material.code.side-by-side", "Side by side"),
|
|
105
122
|
priority: 1,
|
|
106
123
|
pressed: !!e,
|
|
@@ -110,12 +127,12 @@ function H({ sideBySide: e, onSideBySideChange: t, changeCount: s, onStep: u, ge
|
|
|
110
127
|
label: f("material.code.changes", "Changes"),
|
|
111
128
|
priority: 3,
|
|
112
129
|
children: [/* @__PURE__ */ N(i, {
|
|
113
|
-
icon: /* @__PURE__ */ N(
|
|
130
|
+
icon: /* @__PURE__ */ N(L, {}),
|
|
114
131
|
label: f("material.code.previous-change", "Previous change"),
|
|
115
132
|
disabled: !s,
|
|
116
133
|
onClick: () => u(-1)
|
|
117
134
|
}), /* @__PURE__ */ N(i, {
|
|
118
|
-
icon: /* @__PURE__ */ N(
|
|
135
|
+
icon: /* @__PURE__ */ N(I, {}),
|
|
119
136
|
label: f("material.code.next-change", "Next change"),
|
|
120
137
|
disabled: !s,
|
|
121
138
|
onClick: () => u(1)
|
|
@@ -133,24 +150,24 @@ function H({ sideBySide: e, onSideBySideChange: t, changeCount: s, onStep: u, ge
|
|
|
133
150
|
}
|
|
134
151
|
//#endregion
|
|
135
152
|
//#region lib/components/ui/widgets/code-editor/diff/diff-changes.ts
|
|
136
|
-
var
|
|
137
|
-
function
|
|
153
|
+
var K = (e, t) => t > 0 ? t - e + 1 : 0;
|
|
154
|
+
function q(e) {
|
|
138
155
|
let t = 0, n = 0;
|
|
139
|
-
for (let r of e) t +=
|
|
156
|
+
for (let r of e) t += K(r.modifiedStartLineNumber, r.modifiedEndLineNumber), n += K(r.originalStartLineNumber, r.originalEndLineNumber);
|
|
140
157
|
return {
|
|
141
158
|
added: t,
|
|
142
159
|
removed: n
|
|
143
160
|
};
|
|
144
161
|
}
|
|
145
|
-
function
|
|
162
|
+
function J(e) {
|
|
146
163
|
return Math.max(1, e.modifiedEndLineNumber > 0 ? e.modifiedStartLineNumber : e.modifiedStartLineNumber + 1);
|
|
147
164
|
}
|
|
148
|
-
function
|
|
165
|
+
function Y(e, t, n) {
|
|
149
166
|
return n === 0 ? -1 : e < 0 ? t === 1 ? 0 : n - 1 : (e + t + n) % n;
|
|
150
167
|
}
|
|
151
168
|
//#endregion
|
|
152
169
|
//#region lib/components/ui/widgets/code-editor/diff/use-diff-changes.ts
|
|
153
|
-
function
|
|
170
|
+
function X(e) {
|
|
154
171
|
let [t, n] = j([]), [r, i] = j(-1);
|
|
155
172
|
return k(() => {
|
|
156
173
|
if (!e) return;
|
|
@@ -164,9 +181,9 @@ function q(e) {
|
|
|
164
181
|
changes: t,
|
|
165
182
|
index: r,
|
|
166
183
|
go: (n) => {
|
|
167
|
-
let a =
|
|
184
|
+
let a = Y(r, n, t.length);
|
|
168
185
|
if (!e || a < 0) return;
|
|
169
|
-
let o =
|
|
186
|
+
let o = J(t[a]), s = e.getModifiedEditor();
|
|
170
187
|
s.setPosition({
|
|
171
188
|
lineNumber: o,
|
|
172
189
|
column: 1
|
|
@@ -176,7 +193,7 @@ function q(e) {
|
|
|
176
193
|
}
|
|
177
194
|
//#endregion
|
|
178
195
|
//#region lib/components/ui/widgets/code-editor/diff/use-narrower.ts
|
|
179
|
-
function
|
|
196
|
+
function Z(e, t) {
|
|
180
197
|
let [n, r] = j(!1);
|
|
181
198
|
return k(() => {
|
|
182
199
|
let n = e.current;
|
|
@@ -187,13 +204,13 @@ function J(e, t) {
|
|
|
187
204
|
}
|
|
188
205
|
//#endregion
|
|
189
206
|
//#region lib/components/ui/widgets/code-editor/diff/code-diff.tsx
|
|
190
|
-
var
|
|
191
|
-
function
|
|
192
|
-
let { original: r, modified: i, language: a = "typescript", height: o = 280 } = n, s = n.showChrome ?? !0, c = v(), l = b(n.theme, n.scheme), u = m(), d =
|
|
207
|
+
var Q = 480;
|
|
208
|
+
function $(n) {
|
|
209
|
+
let { original: r, modified: i, language: a = "typescript", height: o = 280 } = n, s = n.showChrome ?? !0, c = v(), l = b(n.theme, n.scheme), u = m(), d = Z(l.surfaceRef, Q), p = u || d, [g, S] = t({
|
|
193
210
|
prop: n.sideBySide,
|
|
194
211
|
defaultProp: n.defaultSideBySide ?? !0,
|
|
195
212
|
onChange: n.onSideBySideChange
|
|
196
|
-
}), [C, T] = j(), { changes: E, index: D, go: k } =
|
|
213
|
+
}), [C, T] = j(), { changes: E, index: D, go: k } = X(C), A = ne(), M = ee(h(n.label) || h(n.filename)), F = (e, t) => {
|
|
197
214
|
A.keep(e), x(t), T(e);
|
|
198
215
|
};
|
|
199
216
|
return /* @__PURE__ */ P("div", {
|
|
@@ -209,8 +226,8 @@ function X(n) {
|
|
|
209
226
|
className: "nxgt-code-filename",
|
|
210
227
|
children: n.filename
|
|
211
228
|
}),
|
|
212
|
-
C && /* @__PURE__ */ N(
|
|
213
|
-
/* @__PURE__ */ N(
|
|
229
|
+
C && /* @__PURE__ */ N(U, { ...q(E) }),
|
|
230
|
+
/* @__PURE__ */ N(G, {
|
|
214
231
|
sideBySide: g,
|
|
215
232
|
onSideBySideChange: p ? void 0 : S,
|
|
216
233
|
changeCount: E.length,
|
|
@@ -230,7 +247,7 @@ function X(n) {
|
|
|
230
247
|
keepCurrentModifiedModel: !0,
|
|
231
248
|
onMount: F,
|
|
232
249
|
options: {
|
|
233
|
-
...
|
|
250
|
+
...te(l.overflow, g && !p),
|
|
234
251
|
...M
|
|
235
252
|
},
|
|
236
253
|
loading: /* @__PURE__ */ N(f, {
|
|
@@ -238,7 +255,7 @@ function X(n) {
|
|
|
238
255
|
className: "w-full"
|
|
239
256
|
})
|
|
240
257
|
}),
|
|
241
|
-
s && /* @__PURE__ */ N(
|
|
258
|
+
s && /* @__PURE__ */ N(W, {
|
|
242
259
|
index: D,
|
|
243
260
|
count: E.length,
|
|
244
261
|
language: a
|
|
@@ -246,25 +263,25 @@ function X(n) {
|
|
|
246
263
|
]
|
|
247
264
|
});
|
|
248
265
|
}
|
|
249
|
-
function
|
|
266
|
+
function ee(e) {
|
|
250
267
|
let { t } = o();
|
|
251
268
|
return {
|
|
252
269
|
originalAriaLabel: e ? t("material.code.original-of", "{name}, original", { name: e }) : t("material.code.original", "Original"),
|
|
253
270
|
ariaLabel: e ? t("material.code.modified-of", "{name}, modified", { name: e }) : t("material.code.modified", "Modified")
|
|
254
271
|
};
|
|
255
272
|
}
|
|
256
|
-
function
|
|
273
|
+
function te(e, t) {
|
|
257
274
|
return {
|
|
258
275
|
...E,
|
|
259
276
|
overflowWidgetsDomNode: e,
|
|
260
277
|
readOnly: !0,
|
|
261
278
|
renderSideBySide: t,
|
|
262
|
-
renderSideBySideInlineBreakpoint:
|
|
279
|
+
renderSideBySideInlineBreakpoint: Q,
|
|
263
280
|
renderGutterMenu: !1,
|
|
264
281
|
renderOverviewRuler: !1
|
|
265
282
|
};
|
|
266
283
|
}
|
|
267
|
-
function
|
|
284
|
+
function ne() {
|
|
268
285
|
let e = A([]);
|
|
269
286
|
return k(() => () => {
|
|
270
287
|
let t = e.current;
|
|
@@ -277,4 +294,4 @@ function $() {
|
|
|
277
294
|
} };
|
|
278
295
|
}
|
|
279
296
|
//#endregion
|
|
280
|
-
export { g as CODE_THEMES,
|
|
297
|
+
export { g as CODE_THEMES, $ as CodeDiff, D as CodeEditor, z as CodeEditorFormField, H as configureMonaco, C as defineCodeTheme };
|