@nxgt/material-vue 0.41.0 → 0.43.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 +124 -0
- package/README.md +20 -6
- package/dist/{Button-BG3oDkrl.js → Button-C3K6dhqd.js} +4 -4
- package/dist/{HoverCardTrigger-Dh1ar_W4.js → HoverCardTrigger-Bga4YjEr.js} +69 -62
- package/dist/backgrounds/backgrounds.css +8 -0
- package/dist/backgrounds/css/base.css +169 -0
- package/dist/backgrounds/css/gradient.css +53 -0
- package/dist/backgrounds/css/grain.css +19 -0
- package/dist/backgrounds/css/motion.css +30 -0
- package/dist/backgrounds.js +111 -0
- package/dist/{camera-DV9jcl_3.js → camera-BbF9_-ys.js} +4 -4
- package/dist/components/base.css +5 -2
- package/dist/components/components.css +5 -0
- package/dist/components/theme-tokens.css +21 -0
- package/dist/{components-C1JYYoQ4.js → components-yCdbry6Q.js} +13880 -13101
- package/dist/components.js +8 -8
- package/dist/composables.js +3 -3
- package/dist/dnd.js +1 -1
- package/dist/{form-scope-CeD0v_mw.js → form-scope-CkWJrBCu.js} +1 -1
- package/dist/{i18n-provider-D5XyLQ3P.js → i18n-provider-tL27-a8y.js} +1 -1
- package/dist/i18n.js +4 -4
- package/dist/{icon-button-DXrmfs6e.js → icon-button-MyFFJpXA.js} +4 -4
- package/dist/lib/backgrounds/background/background.vue.d.ts +22 -0
- package/dist/lib/backgrounds/background/index.d.ts +2 -0
- package/dist/lib/backgrounds/background/partials/background-layers.vue.d.ts +9 -0
- package/dist/lib/backgrounds/background/partials/scene-svg.d.ts +10 -0
- package/dist/lib/backgrounds/background/types.d.ts +24 -0
- package/dist/lib/backgrounds/index.d.ts +13 -0
- package/dist/lib/components/ui/actions/button/button-tones.d.ts +3 -3
- package/dist/lib/components/ui/actions/responsive-button/responsive-button.vue.d.ts +3 -3
- package/dist/lib/components/ui/collections/data-table/data-table-context.d.ts +4 -0
- package/dist/lib/components/ui/collections/data-table/data-table.vue.d.ts +8 -0
- package/dist/lib/components/ui/collections/data-table/partials/data-table-body.vue.d.ts +8 -0
- package/dist/lib/components/ui/collections/data-table/partials/data-table-empty.vue.d.ts +5 -1
- package/dist/lib/components/ui/collections/data-table/partials/data-table-toolbar.d.ts +16 -3
- package/dist/lib/components/ui/collections/data-table/select-checkbox.d.ts +36 -0
- package/dist/lib/components/ui/collections/data-table/types.d.ts +15 -0
- package/dist/lib/components/ui/collections/data-table/use-data-table.d.ts +2 -0
- package/dist/lib/components/ui/feedback/circular-progress/circular-progress.vue.d.ts +1 -1
- package/dist/lib/components/ui/feedback/empty-state/empty-state.vue.d.ts +21 -8
- package/dist/lib/components/ui/feedback/empty-state/index.d.ts +1 -1
- package/dist/lib/components/ui/feedback/error-state/error-state.vue.d.ts +54 -0
- package/dist/lib/components/ui/feedback/error-state/index.d.ts +3 -0
- package/dist/lib/components/ui/feedback/error-state/partials/error-state-details.vue.d.ts +7 -0
- package/dist/lib/components/ui/feedback/index.d.ts +1 -0
- package/dist/lib/components/ui/feedback/state-frame/state-frame.vue.d.ts +36 -0
- package/dist/lib/components/ui/feedback/state-frame/state-icon.vue.d.ts +7 -0
- package/dist/lib/components/ui/feedback/state-frame/state-illustration.vue.d.ts +8 -0
- package/dist/lib/components/ui/feedback/state-frame/state-tones.d.ts +11 -0
- package/dist/lib/components/ui/fields/contacts/consts.d.ts +1 -1
- package/dist/lib/components/ui/layout/account-menu/account-menu-avatar.vue.d.ts +9 -0
- package/dist/lib/components/ui/layout/account-menu/account-menu.vue.d.ts +38 -0
- package/dist/lib/components/ui/layout/account-menu/index.d.ts +3 -0
- package/dist/lib/components/ui/layout/account-menu/types.d.ts +10 -0
- package/dist/lib/components/ui/layout/app-shell/activity-layout.vue.d.ts +21 -5
- package/dist/lib/components/ui/layout/app-shell/app-brand-logo.vue.d.ts +20 -0
- package/dist/lib/components/ui/layout/app-shell/app-brand.vue.d.ts +30 -0
- package/dist/lib/components/ui/layout/app-shell/app-header.vue.d.ts +13 -5
- package/dist/lib/components/ui/layout/app-shell/app-sidebar.vue.d.ts +12 -2
- package/dist/lib/components/ui/layout/app-shell/index.d.ts +1 -1
- package/dist/lib/components/ui/layout/app-shell/types.d.ts +10 -0
- package/dist/lib/components/ui/layout/app-shell/use-truncated-title.d.ts +10 -0
- package/dist/lib/components/ui/layout/background/background.vue.d.ts +18 -3
- package/dist/lib/components/ui/layout/doc/partials/doc-empty.vue.d.ts +7 -4
- package/dist/lib/components/ui/layout/index.d.ts +1 -0
- package/dist/lib/components/ui/media/stx-player/stx-player-viewport.vue.d.ts +2 -2
- package/dist/lib/components/ui/overlays/command/CommandSeparator.vue.d.ts +3 -1
- package/dist/lib/components/ui/overlays/dialog/in-dialog.d.ts +1 -1
- package/dist/lib/components/ui/overlays/dialog/use-escape-forward.d.ts +13 -0
- package/dist/lib/components/ui/overlays/dialog/use-modal-content.d.ts +2 -0
- package/dist/lib/components/ui/primitives/nonce-provider/nonce-provider.vue.d.ts +4 -1
- package/dist/lib/components/ui/selection/autocomplete/autocomplete-keyboard.d.ts +22 -4
- package/dist/lib/components/ui/selection/autocomplete/partials/autocomplete-box.vue.d.ts +6 -2
- package/dist/lib/components/ui/selection/autocomplete/partials/autocomplete-list.vue.d.ts +7 -0
- package/dist/lib/components/ui/selection/autocomplete/use-autocomplete-active.d.ts +17 -0
- package/dist/lib/components/ui/selection/autocomplete/use-autocomplete-keydown.d.ts +21 -0
- package/dist/lib/components/ui/selection/autocomplete/use-autocomplete-open.d.ts +3 -3
- package/dist/lib/components/ui/selection/autocomplete/use-autocomplete.d.ts +2 -1
- package/dist/lib/components/ui/selection/autocomplete/use-drawer-room.d.ts +11 -0
- package/dist/lib/components/ui/selection/autocomplete/use-query-change.d.ts +8 -0
- package/dist/lib/components/ui/widgets/charts/chart-container.vue.d.ts +2 -2
- package/dist/lib/components/ui/widgets/kanban/partials/kanban-empty.vue.d.ts +1 -0
- package/dist/lib/composables/use-background-activity.d.ts +8 -0
- package/dist/lib/i18n/resources/en/en.d.ts +28 -0
- package/dist/lib/i18n/resources/en/material.json.d.ts +29 -1
- package/dist/lib/i18n/resources/fr/fr.d.ts +28 -0
- package/dist/lib/i18n/resources/fr/material.json.d.ts +29 -1
- package/dist/lib/i18n/resources/resources.d.ts +56 -0
- package/dist/lib/i18n/translator.d.ts +1 -1
- package/dist/lib/lib/index.d.ts +1 -0
- package/dist/lib/nuxt/component-names.d.ts +1 -1
- package/dist/lib/nuxt/module.d.ts +2 -11
- package/dist/lib/nuxt/pdf-fonts.d.ts +1 -1
- package/dist/lib/nuxt/plugin-options.d.ts +58 -0
- package/dist/lib/vite/index.d.ts +4 -8
- package/dist/lib.js +52 -51
- package/dist/main.js +17 -17
- package/dist/map.js +4 -4
- package/dist/material-vue.css +1 -1
- package/dist/{pdf-outline-sidebar-CgmJjhUz.js → pdf-outline-sidebar-Kqsfd_cO.js} +2 -2
- package/dist/{pdf-page-BjQNWV72.js → pdf-page-Dx3jwxu6.js} +1 -1
- package/dist/{pdf-page-list-nG0l4SjH.js → pdf-page-list-BsQmEHaY.js} +2 -2
- package/dist/{pdf-reader-Dekd4Ymw.js → pdf-reader-CJo8SQVl.js} +15 -15
- package/dist/{pdf-sidebar-gDj63dRH.js → pdf-sidebar-CcCUATl-.js} +3 -3
- package/dist/{pdf-thumbnail-sidebar-C5ikii1Z.js → pdf-thumbnail-sidebar-BRxNRGfG.js} +4 -4
- package/dist/{pdf-toolbar-DmmrSlCq.js → pdf-toolbar-B0ckYBJ2.js} +4 -4
- package/dist/pdf.js +2 -2
- package/dist/{print-format.utils-CiUiQE-i.js → print-format.utils-51joHpFb.js} +2 -2
- package/dist/{sortable-provider-lK0srHJF.js → sortable-provider-BEx1B0Ky.js} +2 -2
- package/dist/{stored-language-dM2e5qaS.js → stored-language-DVP9KzRu.js} +58 -2
- package/dist/{stx-player-C2VQCXFc.js → stx-player-KPp9c7vS.js} +5 -5
- package/dist/styles.css +4 -0
- package/dist/{translator-DXL5RDRg.js → translator-Bm7i7dv-.js} +1 -1
- package/dist/use-background-activity-DdTBbNpX.js +17 -0
- package/dist/{use-heading-spy-Btwc0yad.js → use-heading-spy-jn8f2ioE.js} +13 -13
- package/dist/{use-material-translation-Du3Wvsk1.js → use-material-translation-CfFZPSe0.js} +3 -3
- package/dist/vite.js +7 -2
- package/docs/README.md +3 -0
- package/docs/components/README.md +2 -1
- package/docs/components/buttons-and-actions.md +2 -0
- package/docs/components/data-table-filter-and-lists.md +59 -8
- package/docs/components/feedback-and-status.md +79 -8
- package/docs/components/media-and-files.md +2 -0
- package/docs/components/navigation-and-layout.md +68 -5
- package/docs/components/overlays-and-menus.md +20 -3
- package/docs/components/primitives.md +5 -3
- package/docs/components/rich-widgets.md +1 -1
- package/docs/components/selection-and-choice.md +14 -4
- package/docs/getting-started.md +22 -3
- package/docs/guides/app-shell.md +99 -19
- package/docs/guides/backgrounds.md +143 -0
- package/docs/guides/csp.md +48 -6
- package/docs/guides/helpers.md +1 -0
- package/docs/guides/i18n.md +52 -2
- package/docs/guides/migrate-to-vite-plugin.md +259 -0
- package/docs/guides/pdf.md +11 -4
- package/docs/guides/ssr.md +1 -1
- package/docs/guides/theming.md +52 -4
- package/docs/guides/vite-plugin.md +194 -0
- package/docs/previews/backgrounds-matrix.webp +0 -0
- package/docs/previews/feedback-status-emptystate.webp +0 -0
- package/docs/previews/feedback-status-errorstate.webp +0 -0
- package/docs/previews/navigation-layout-accountmenu.webp +0 -0
- package/docs/roadmap.md +69 -32
- package/docs/troubleshooting.md +251 -7
- package/lib/backgrounds/backgrounds.css +8 -0
- package/lib/backgrounds/css/base.css +169 -0
- package/lib/backgrounds/css/gradient.css +53 -0
- package/lib/backgrounds/css/grain.css +19 -0
- package/lib/backgrounds/css/motion.css +30 -0
- package/lib/components/base.css +5 -2
- package/lib/components/components.css +5 -0
- package/lib/components/theme-tokens.css +21 -0
- package/lib/nuxt/component-names.ts +2 -0
- package/lib/nuxt/module.ts +29 -15
- package/lib/nuxt/pdf-fonts.ts +1 -1
- package/lib/nuxt/plugin-options.ts +92 -0
- package/lib/nuxt/runtime/inter.css +6 -0
- package/lib/styles.css +4 -0
- package/lib/vite/index.ts +19 -2
- package/package.json +24 -2
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/* Motion, off by default: a background moves only when the app sets
|
|
2
|
+
* `animated` (`data-animated`) and the user has not asked for less motion.
|
|
3
|
+
* The animation is declared nowhere else, so a rule test can check that every
|
|
4
|
+
* `animation` sits inside this gate. `data-paused` (base.css) stops it while
|
|
5
|
+
* the page is hidden or the background is off screen. */
|
|
6
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
7
|
+
@keyframes nxgt-background-drift {
|
|
8
|
+
from {
|
|
9
|
+
transform: translate3d(0, 0, 0) scale(1);
|
|
10
|
+
}
|
|
11
|
+
to {
|
|
12
|
+
transform: translate3d(6%, -8%, 0) scale(1.1);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
@layer components {
|
|
17
|
+
[data-background][data-animated] > [data-layer] {
|
|
18
|
+
animation: nxgt-background-drift 18s ease-in-out infinite alternate
|
|
19
|
+
var(--nxgt-bg-play, running);
|
|
20
|
+
will-change: transform;
|
|
21
|
+
}
|
|
22
|
+
[data-background][data-animated] > [data-layer="blob-2"] {
|
|
23
|
+
animation-duration: 24s;
|
|
24
|
+
animation-direction: alternate-reverse;
|
|
25
|
+
}
|
|
26
|
+
[data-background][data-animated] > [data-layer="blob-3"] {
|
|
27
|
+
animation-duration: 30s;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
package/lib/components/base.css
CHANGED
|
@@ -56,8 +56,11 @@
|
|
|
56
56
|
font-weight: var(--font-weight-medium);
|
|
57
57
|
}
|
|
58
58
|
/* A sidebar entry is a link styled as a menu entry: the prose link style
|
|
59
|
-
(underline, info tint on hover and focus) must not reach it (#566).
|
|
60
|
-
|
|
59
|
+
(underline, info tint on hover and focus) must not reach it (#566). A component
|
|
60
|
+
link that has its own look opts out with the `nxgt-plain-link` class (#575). */
|
|
61
|
+
a:not(:has(> button)):not([data-slot="sidebar-menu-item"]):not(
|
|
62
|
+
.nxgt-plain-link
|
|
63
|
+
) {
|
|
61
64
|
@apply focus:underline underline-offset-4 hover:underline cursor-pointer;
|
|
62
65
|
@apply text-info [&_svg]:data-[slot=icon]:text-info hover:bg-info/10 active:bg-info/5 focus:bg-info/15;
|
|
63
66
|
}
|
|
@@ -26,3 +26,8 @@
|
|
|
26
26
|
@import "./ui/fields/opening-hours/opening-hours-item.css";
|
|
27
27
|
@import "./ui/fields/attributes/partials/attribute-form.css";
|
|
28
28
|
@import "./ui/fields/attributes/partials/attribute-values-form.css";
|
|
29
|
+
/* Background (from /components): the gradient preset's CSS, plain and shared
|
|
30
|
+
* (lib/backgrounds/css). The other presets are opt-in: backgrounds.css. */
|
|
31
|
+
@import "../backgrounds/css/base.css";
|
|
32
|
+
@import "../backgrounds/css/gradient.css";
|
|
33
|
+
@import "../backgrounds/css/motion.css";
|
|
@@ -12,6 +12,9 @@
|
|
|
12
12
|
--popover-foreground: oklch(0.129 0.042 264.695);
|
|
13
13
|
--primary: oklch(46% 0.1135 276.35);
|
|
14
14
|
--primary-foreground: oklch(0.984 0.003 247.858);
|
|
15
|
+
/* Primary drawn as text or an icon on a normal surface (`text-primary-text`):
|
|
16
|
+
the colour itself in light; the dark theme lifts it. */
|
|
17
|
+
--primary-text: var(--primary);
|
|
15
18
|
--secondary: oklch(50% 0.1135 245.65);
|
|
16
19
|
--secondary-foreground: oklch(0.984 0.003 247.858);
|
|
17
20
|
--muted: oklch(0.968 0.007 247.896);
|
|
@@ -71,6 +74,9 @@
|
|
|
71
74
|
--popover-foreground: oklch(0.984 0.003 247.858);
|
|
72
75
|
--primary: oklch(46% 0.1135 276.35);
|
|
73
76
|
--primary-foreground: oklch(0.984 0.003 247.858);
|
|
77
|
+
/* Mixed 60 % toward white (the tonal Button labels' recipe): readable as text
|
|
78
|
+
on --background and --card. */
|
|
79
|
+
--primary-text: color-mix(in oklab, var(--primary) 40%, white);
|
|
74
80
|
/* Brighter than the light one: it is read as text on the dark surfaces (6.5:1
|
|
75
81
|
on --background, 5.8:1 on --card); a filled secondary surface mixes it toward --background
|
|
76
82
|
(the opaque 70 % mix) to keep 5.2:1 under its near-white text. */
|
|
@@ -119,3 +125,18 @@
|
|
|
119
125
|
--sidebar-border: oklch(1 0 0 / 10%);
|
|
120
126
|
--sidebar-ring: oklch(0.551 0.027 264.364);
|
|
121
127
|
}
|
|
128
|
+
|
|
129
|
+
/* The tertiary colour (the strix violet), for accents and backgrounds beside
|
|
130
|
+
primary and secondary. Light: 7.6:1 under its near-white foreground. */
|
|
131
|
+
:root {
|
|
132
|
+
--tertiary: var(--strix);
|
|
133
|
+
--tertiary-foreground: oklch(0.984 0.003 247.858);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/* Dark: lifted like --secondary, as it is read as text (7.0:1 on --background,
|
|
137
|
+
6.3:1 on --card); its foreground is the dark surface, 7.0:1 on the fill. */
|
|
138
|
+
.dark,
|
|
139
|
+
[data-theme="dark"] {
|
|
140
|
+
--tertiary: oklch(0.7 0.15 310.75);
|
|
141
|
+
--tertiary-foreground: oklch(0.14 0.036 258.53);
|
|
142
|
+
}
|
|
@@ -4,6 +4,7 @@ export const COMPONENT_NAMES = [
|
|
|
4
4
|
'AccordionContent',
|
|
5
5
|
'AccordionItem',
|
|
6
6
|
'AccordionTrigger',
|
|
7
|
+
'AccountMenu',
|
|
7
8
|
'ActionCard',
|
|
8
9
|
'Activity',
|
|
9
10
|
'ActivityContent',
|
|
@@ -237,6 +238,7 @@ export const COMPONENT_NAMES = [
|
|
|
237
238
|
'EmptyState',
|
|
238
239
|
'EnrolmentSecret',
|
|
239
240
|
'EntityHeader',
|
|
241
|
+
'ErrorState',
|
|
240
242
|
'EventCalendar',
|
|
241
243
|
'EventCard',
|
|
242
244
|
'EventChip',
|
package/lib/nuxt/module.ts
CHANGED
|
@@ -2,33 +2,34 @@ import {
|
|
|
2
2
|
addComponent,
|
|
3
3
|
addImports,
|
|
4
4
|
addPlugin,
|
|
5
|
+
addVitePlugin,
|
|
5
6
|
createResolver,
|
|
6
7
|
defineNuxtModule,
|
|
7
8
|
extendViteConfig,
|
|
8
9
|
useLogger,
|
|
9
10
|
} from '@nuxt/kit';
|
|
10
11
|
import { pdfkitStandardFontFiles } from '@nxgt/material-core/pdfkit-fonts';
|
|
12
|
+
import { nxgtMaterial } from '../vite/index';
|
|
11
13
|
import { COMPOSABLE_IMPORTS, I18N_IMPORTS } from './auto-imports';
|
|
12
14
|
import { COMPONENT_NAMES } from './component-names';
|
|
13
15
|
import { addPdfFontsPlugin, addPdfFontsTrace } from './pdf-fonts';
|
|
16
|
+
import {
|
|
17
|
+
addInterFont,
|
|
18
|
+
addZodJitless,
|
|
19
|
+
BUNDLE_DEPRECATION,
|
|
20
|
+
bundlesPdf,
|
|
21
|
+
type NuxtLike,
|
|
22
|
+
type NuxtVitePartOptions,
|
|
23
|
+
toPluginOptions,
|
|
24
|
+
} from './plugin-options';
|
|
14
25
|
|
|
15
|
-
export type ModuleOptions = {
|
|
26
|
+
export type ModuleOptions = NuxtVitePartOptions & {
|
|
16
27
|
/** Prepended to auto-imported component names. Empty by default. */
|
|
17
28
|
prefix?: string;
|
|
18
29
|
/** Auto-import PascalCase components. Default true. */
|
|
19
30
|
components?: boolean;
|
|
20
31
|
/** Auto-import composables and i18n helpers. Default true. */
|
|
21
32
|
imports?: boolean;
|
|
22
|
-
pdf?: {
|
|
23
|
-
/**
|
|
24
|
-
* Bundle pdfkit's standard fonts into the Nitro server, for
|
|
25
|
-
* `@nxgt/material-vue/pdf` in a server whose runtime image has no
|
|
26
|
-
* `node_modules` (`nitro.noExternals`). Default false: Nitro keeps the
|
|
27
|
-
* renderer external, and the module adds pdfkit's font files to what
|
|
28
|
-
* Nitro traces into `.output/server/node_modules`.
|
|
29
|
-
*/
|
|
30
|
-
bundleStandardFonts?: boolean;
|
|
31
|
-
};
|
|
32
33
|
};
|
|
33
34
|
|
|
34
35
|
/**
|
|
@@ -49,14 +50,17 @@ export default defineNuxtModule<ModuleOptions>({
|
|
|
49
50
|
components: true,
|
|
50
51
|
imports: true,
|
|
51
52
|
},
|
|
52
|
-
setup(
|
|
53
|
+
async setup(
|
|
53
54
|
options: ModuleOptions,
|
|
54
|
-
nuxt: {
|
|
55
|
-
options: {
|
|
55
|
+
nuxt: NuxtLike & {
|
|
56
|
+
options: { build: { transpile: string[] } };
|
|
56
57
|
hook: (name: 'nitro:config', fn: (config: object) => void) => void;
|
|
57
58
|
},
|
|
58
59
|
) {
|
|
59
60
|
const resolver = createResolver(import.meta.url);
|
|
61
|
+
if (options.pdf?.bundleStandardFonts !== undefined) {
|
|
62
|
+
useLogger('@nxgt/material-vue').warn(BUNDLE_DEPRECATION);
|
|
63
|
+
}
|
|
60
64
|
|
|
61
65
|
nuxt.options.build.transpile.push('@nxgt/material-vue');
|
|
62
66
|
|
|
@@ -106,9 +110,19 @@ export default defineNuxtModule<ModuleOptions>({
|
|
|
106
110
|
logger.warn(`pdf fonts: ${message}`),
|
|
107
111
|
),
|
|
108
112
|
);
|
|
109
|
-
if (options
|
|
113
|
+
if (bundlesPdf(options)) addPdfFontsPlugin(config);
|
|
110
114
|
});
|
|
111
115
|
|
|
116
|
+
// Fonts and the styles check only; the CSP part is off under Nuxt.
|
|
117
|
+
addVitePlugin(nxgtMaterial(toPluginOptions(options)));
|
|
118
|
+
addZodJitless(nuxt, options.csp);
|
|
119
|
+
await addInterFont(
|
|
120
|
+
nuxt,
|
|
121
|
+
options.fonts,
|
|
122
|
+
resolver.resolve('./runtime/inter.css'),
|
|
123
|
+
(message) => useLogger('@nxgt/material-vue').warn(message),
|
|
124
|
+
);
|
|
125
|
+
|
|
112
126
|
addPlugin(resolver.resolve('./runtime/plugin'));
|
|
113
127
|
},
|
|
114
128
|
});
|
package/lib/nuxt/pdf-fonts.ts
CHANGED
|
@@ -7,7 +7,7 @@ type NitroConfigLike = {
|
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Adds `pdfkitStandardFonts()` to a Nitro config's Rollup plugins, for the
|
|
10
|
-
* `pdf.
|
|
10
|
+
* `pdf.bundle` module option. Only a fully inlined server
|
|
11
11
|
* (no `node_modules` in the runtime image) needs it: Nitro keeps
|
|
12
12
|
* `@react-pdf/renderer` external by default, and `addPdfFontsTrace` copies
|
|
13
13
|
* the fonts pdfkit loads into `.output/server/node_modules`.
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { tryResolveModule } from '@nuxt/kit';
|
|
2
|
+
import { type NxgtMaterialOptions, ZOD_JITLESS_SCRIPT } from '../vite/index';
|
|
3
|
+
|
|
4
|
+
export const INTER_PACKAGE = '@fontsource-variable/inter';
|
|
5
|
+
|
|
6
|
+
export type NuxtCspOptions = {
|
|
7
|
+
/**
|
|
8
|
+
* Add zod's jitless inline script to every page's head, so zod never
|
|
9
|
+
* probes `new Function` under a CSP without `'unsafe-eval'`. Default false:
|
|
10
|
+
* the script is inline, so a strict CSP needs `nuxt-security` to stamp it
|
|
11
|
+
* (`nonce: true`) or hash it.
|
|
12
|
+
*/
|
|
13
|
+
zodJitless?: boolean;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export type NuxtVitePartOptions = {
|
|
17
|
+
/** Only `zodJitless` applies; the policy itself is `nuxt-security`'s. */
|
|
18
|
+
csp?: boolean | NuxtCspOptions;
|
|
19
|
+
/** `katex` defaults to true; `sans: 'inter'` is opt-in (default false). */
|
|
20
|
+
fonts?: boolean | { katex?: boolean; sans?: 'inter' | false };
|
|
21
|
+
/** The styles check. Default false in Nuxt: see the guide. */
|
|
22
|
+
styles?: boolean | { check?: boolean };
|
|
23
|
+
pdf?: {
|
|
24
|
+
/** Bundle pdfkit's standard fonts into the Nitro server. */
|
|
25
|
+
bundle?: boolean;
|
|
26
|
+
/** @deprecated Use `bundle`. */
|
|
27
|
+
bundleStandardFonts?: boolean;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/** The part of the Nuxt instance this file touches. */
|
|
32
|
+
export type NuxtLike = {
|
|
33
|
+
options: {
|
|
34
|
+
rootDir: string;
|
|
35
|
+
css: string[];
|
|
36
|
+
app: { head?: { script?: unknown[] } };
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* What `nxgtMaterial()` is given under Nuxt. The CSP part is always off: Nuxt
|
|
42
|
+
* has no `index.html` for it to hash or stamp, and a header on the Vite dev
|
|
43
|
+
* server never reaches the pages Nitro renders. pdf is off too: Nitro owns it
|
|
44
|
+
* (`addPdfFontsPlugin`), not Vite. Inter is off because the module loads it
|
|
45
|
+
* through `nuxt.options.css`.
|
|
46
|
+
*/
|
|
47
|
+
export function toPluginOptions(o: NuxtVitePartOptions): NxgtMaterialOptions {
|
|
48
|
+
const f = typeof o.fonts === 'object' ? o.fonts : {};
|
|
49
|
+
return {
|
|
50
|
+
csp: false,
|
|
51
|
+
pdf: false,
|
|
52
|
+
fonts: o.fonts === false ? false : { katex: f.katex ?? true, sans: false },
|
|
53
|
+
styles: o.styles ?? false,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** `pdf.bundle`, or its deprecated spelling. */
|
|
58
|
+
export const bundlesPdf = (o: NuxtVitePartOptions): boolean =>
|
|
59
|
+
Boolean(o.pdf?.bundle ?? o.pdf?.bundleStandardFonts);
|
|
60
|
+
|
|
61
|
+
export function addZodJitless(nuxt: NuxtLike, csp: NuxtVitePartOptions['csp']) {
|
|
62
|
+
if (typeof csp !== 'object' || !csp.zodJitless) return;
|
|
63
|
+
const app = nuxt.options.app;
|
|
64
|
+
app.head ??= {};
|
|
65
|
+
app.head.script = [
|
|
66
|
+
...(app.head.script ?? []),
|
|
67
|
+
{ innerHTML: ZOD_JITLESS_SCRIPT, tagPriority: 'critical' },
|
|
68
|
+
];
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export async function addInterFont(
|
|
72
|
+
nuxt: NuxtLike,
|
|
73
|
+
fonts: NuxtVitePartOptions['fonts'],
|
|
74
|
+
runtimeCss: string,
|
|
75
|
+
warn: (message: string) => void,
|
|
76
|
+
resolve = tryResolveModule,
|
|
77
|
+
): Promise<void> {
|
|
78
|
+
if (typeof fonts !== 'object' || fonts.sans !== 'inter') return;
|
|
79
|
+
if (!(await resolve(`${INTER_PACKAGE}/index.css`, nuxt.options.rootDir))) {
|
|
80
|
+
warn(INTER_MISSING);
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
nuxt.options.css.unshift(`${INTER_PACKAGE}/index.css`, runtimeCss);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/** Inter never fails a build: without the package the system font stays. */
|
|
87
|
+
export const INTER_MISSING =
|
|
88
|
+
`[nxgt-material] ${INTER_PACKAGE} is not installed: keeping the system font. ` +
|
|
89
|
+
`Install it to use Inter (bun add ${INTER_PACKAGE}), or drop fonts: { sans: 'inter' }.`;
|
|
90
|
+
|
|
91
|
+
export const BUNDLE_DEPRECATION =
|
|
92
|
+
'[nxgt-material] pdf.bundleStandardFonts is deprecated: use pdf.bundle.';
|
package/lib/styles.css
CHANGED
|
@@ -34,10 +34,14 @@
|
|
|
34
34
|
--color-popover-foreground: var(--popover-foreground);
|
|
35
35
|
--color-primary: var(--primary);
|
|
36
36
|
--color-primary-foreground: var(--primary-foreground);
|
|
37
|
+
--color-primary-text: var(--primary-text);
|
|
37
38
|
--color-primary-container: --alpha(var(--primary-foreground) / 20%);
|
|
38
39
|
--color-secondary: var(--secondary);
|
|
39
40
|
--color-secondary-foreground: var(--secondary-foreground);
|
|
40
41
|
--color-secondary-container: --alpha(var(--secondary-foreground) / 20%);
|
|
42
|
+
--color-tertiary: var(--tertiary);
|
|
43
|
+
--color-tertiary-foreground: var(--tertiary-foreground);
|
|
44
|
+
--color-tertiary-container: --alpha(var(--tertiary) / 20%);
|
|
41
45
|
--color-muted: var(--muted);
|
|
42
46
|
--color-muted-foreground: var(--muted-foreground);
|
|
43
47
|
--color-track: var(--track);
|
package/lib/vite/index.ts
CHANGED
|
@@ -2,10 +2,27 @@
|
|
|
2
2
|
* Build-time helpers for the apps that consume this library: Node code that
|
|
3
3
|
* runs inside a consumer's `vite.config.ts`. The one copy lives in
|
|
4
4
|
* `@nxgt/material-core/vite`, shared with the sister library; this entry keeps
|
|
5
|
-
* the subpath consumers already import.
|
|
6
|
-
* `
|
|
5
|
+
* the subpath consumers already import. `nxgtMaterial()` is the one plugin to
|
|
6
|
+
* add (a strict CSP, fonts, a styles check); `pdfkitStandardFonts` and
|
|
7
|
+
* `cspAssetsInlineLimit` are its parts.
|
|
7
8
|
*/
|
|
9
|
+
import {
|
|
10
|
+
nxgtMaterial as coreNxgtMaterial,
|
|
11
|
+
type NxgtMaterialOptions,
|
|
12
|
+
} from '@nxgt/material-core/vite';
|
|
13
|
+
|
|
8
14
|
export {
|
|
15
|
+
CSP_NONCE_PLACEHOLDER,
|
|
9
16
|
cspAssetsInlineLimit,
|
|
17
|
+
type NxgtMaterialCspOptions,
|
|
18
|
+
type NxgtMaterialOptions,
|
|
10
19
|
pdfkitStandardFonts,
|
|
20
|
+
ZOD_JITLESS_SCRIPT,
|
|
11
21
|
} from '@nxgt/material-core/vite';
|
|
22
|
+
|
|
23
|
+
/** The plugin for this library: see the Vite plugin guide. */
|
|
24
|
+
export function nxgtMaterial(
|
|
25
|
+
options?: NxgtMaterialOptions,
|
|
26
|
+
): ReturnType<typeof coreNxgtMaterial> {
|
|
27
|
+
return coreNxgtMaterial(options, '@nxgt/material-vue');
|
|
28
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nxgt/material-vue",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.43.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"email": "stevegires@gmail.com"
|
|
@@ -20,6 +20,8 @@
|
|
|
20
20
|
"lib/vite/index.ts",
|
|
21
21
|
"lib/styles.css",
|
|
22
22
|
"lib/map/map.css",
|
|
23
|
+
"lib/backgrounds/backgrounds.css",
|
|
24
|
+
"lib/backgrounds/css/*.css",
|
|
23
25
|
"lib/components/**/*.css",
|
|
24
26
|
"docs",
|
|
25
27
|
"README.md",
|
|
@@ -43,6 +45,11 @@
|
|
|
43
45
|
"types": "./dist/lib/pdf/index.d.ts",
|
|
44
46
|
"require": "./dist/pdf.js"
|
|
45
47
|
},
|
|
48
|
+
"./backgrounds": {
|
|
49
|
+
"import": "./dist/backgrounds.js",
|
|
50
|
+
"types": "./dist/lib/backgrounds/index.d.ts",
|
|
51
|
+
"require": "./dist/backgrounds.js"
|
|
52
|
+
},
|
|
46
53
|
"./vite": {
|
|
47
54
|
"import": "./dist/vite.js",
|
|
48
55
|
"types": "./dist/lib/vite/index.d.ts",
|
|
@@ -91,6 +98,14 @@
|
|
|
91
98
|
"style": "./lib/map/map.css",
|
|
92
99
|
"default": "./lib/map/map.css"
|
|
93
100
|
},
|
|
101
|
+
"./backgrounds.css": {
|
|
102
|
+
"style": "./lib/backgrounds/backgrounds.css",
|
|
103
|
+
"default": "./lib/backgrounds/backgrounds.css"
|
|
104
|
+
},
|
|
105
|
+
"./backgrounds/*.css": {
|
|
106
|
+
"style": "./lib/backgrounds/css/*.css",
|
|
107
|
+
"default": "./lib/backgrounds/css/*.css"
|
|
108
|
+
},
|
|
94
109
|
"./nuxt": {
|
|
95
110
|
"types": "./lib/nuxt/module.ts",
|
|
96
111
|
"import": "./lib/nuxt/module.ts",
|
|
@@ -124,7 +139,7 @@
|
|
|
124
139
|
"docs:previews": "vitest run --project previews"
|
|
125
140
|
},
|
|
126
141
|
"dependencies": {
|
|
127
|
-
"@nxgt/material-core": "^0.
|
|
142
|
+
"@nxgt/material-core": "^0.13.0",
|
|
128
143
|
"@floating-ui/dom": "^1.8.0",
|
|
129
144
|
"@fortawesome/fontawesome-common-types": "7.3.1",
|
|
130
145
|
"@lucide/vue": "^1.45.0",
|
|
@@ -183,6 +198,7 @@
|
|
|
183
198
|
},
|
|
184
199
|
"devDependencies": {
|
|
185
200
|
"@chromatic-com/storybook": "^5.3.1",
|
|
201
|
+
"@fontsource-variable/inter": "^5",
|
|
186
202
|
"@nxgt/material-testing": "0.0.0",
|
|
187
203
|
"@nxgt/playwright": "^0.1.0",
|
|
188
204
|
"@react-pdf/renderer": "^4.9.0",
|
|
@@ -190,6 +206,7 @@
|
|
|
190
206
|
"@storybook/addon-docs": "10.6.0",
|
|
191
207
|
"@storybook/addon-vitest": "10.6.0",
|
|
192
208
|
"@storybook/vue3-vite": "10.6.0",
|
|
209
|
+
"@tailwindcss/node": "^4.3.3",
|
|
193
210
|
"@tailwindcss/vite": "^4.3.3",
|
|
194
211
|
"@tanstack/vue-table": "^9.1.2",
|
|
195
212
|
"@types/bun": "^1.4.2",
|
|
@@ -207,6 +224,7 @@
|
|
|
207
224
|
"ajv": "^8.20.0",
|
|
208
225
|
"globals": "^17.7.0",
|
|
209
226
|
"leaflet": "^1.9.4",
|
|
227
|
+
"lightningcss": "^1.33.0",
|
|
210
228
|
"monaco-editor": "^0.56.0",
|
|
211
229
|
"pinia": "^3.0.3",
|
|
212
230
|
"playwright": "^1.63.0",
|
|
@@ -222,6 +240,7 @@
|
|
|
222
240
|
"vue-tsc": "^3.1.0"
|
|
223
241
|
},
|
|
224
242
|
"peerDependencies": {
|
|
243
|
+
"@fontsource-variable/inter": ">=5",
|
|
225
244
|
"@react-pdf/renderer": "^4.9.0",
|
|
226
245
|
"@tanstack/vue-table": "^9.1.2",
|
|
227
246
|
"@vue-leaflet/vue-leaflet": "^0.10.1",
|
|
@@ -235,6 +254,9 @@
|
|
|
235
254
|
"vue-router": "^4.5.0 || ^5.0.0"
|
|
236
255
|
},
|
|
237
256
|
"peerDependenciesMeta": {
|
|
257
|
+
"@fontsource-variable/inter": {
|
|
258
|
+
"optional": true
|
|
259
|
+
},
|
|
238
260
|
"@react-pdf/renderer": {
|
|
239
261
|
"optional": true
|
|
240
262
|
},
|