@nubisco/ui 1.40.0 → 1.41.1
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/dist/plugins/fonts.d.ts +52 -1
- package/dist/plugins/fonts.d.ts.map +1 -1
- package/dist/plugins/fonts.js +53 -8
- package/package.json +7 -2
- package/src/plugins/fonts.ts +68 -16
package/dist/plugins/fonts.d.ts
CHANGED
|
@@ -1,2 +1,53 @@
|
|
|
1
|
-
|
|
1
|
+
import Unfonts from 'unplugin-fonts/vite';
|
|
2
|
+
/**
|
|
3
|
+
* Options accepted by {@link fonts}. This is the exact option object that
|
|
4
|
+
* `unplugin-fonts` exposes, so any provider it supports (`fontsource`,
|
|
5
|
+
* `custom`, `google`, `typekit`) can be configured here.
|
|
6
|
+
*/
|
|
7
|
+
export type TFontsOptions = NonNullable<Parameters<typeof Unfonts>[0]>;
|
|
8
|
+
/**
|
|
9
|
+
* Default font configuration for NubiscoUI.
|
|
10
|
+
*
|
|
11
|
+
* Self-hosted via the `fontsource` provider (RGPD-friendly, no third-party
|
|
12
|
+
* CDN). These are the two families declared as the library defaults in
|
|
13
|
+
* `src/styles/variables/_type.scss` (`--nb-font-family-sans` / `-mono`):
|
|
14
|
+
*
|
|
15
|
+
* - Plus Jakarta Sans: weights 400, 500, 600, 700 (sans default)
|
|
16
|
+
* - Fira Code: weights 400, 600 (mono default)
|
|
17
|
+
*
|
|
18
|
+
* Only `normal` styles are loaded. Every subset shipped by Fontsource is
|
|
19
|
+
* imported, but each `@font-face` carries a `unicode-range`, so the browser
|
|
20
|
+
* only downloads the subsets a page actually needs. `font-display: swap` is
|
|
21
|
+
* baked into the Fontsource stylesheets.
|
|
22
|
+
*
|
|
23
|
+
* Consumers must install the source packages themselves:
|
|
24
|
+
* `pnpm add -D @fontsource/plus-jakarta-sans @fontsource/fira-code`.
|
|
25
|
+
*/
|
|
26
|
+
export declare const DEFAULT_FONTS: TFontsOptions;
|
|
27
|
+
/**
|
|
28
|
+
* Vite plugin that loads NubiscoUI's typefaces.
|
|
29
|
+
*
|
|
30
|
+
* Called with no arguments it self-hosts the library defaults (Plus Jakarta
|
|
31
|
+
* Sans + Fira Code) via Fontsource, keeping every existing consumer's output
|
|
32
|
+
* unchanged. Pass an options object to fully replace that configuration: load
|
|
33
|
+
* different families/weights, point the `custom` provider at your own woff2
|
|
34
|
+
* files, or use any other provider `unplugin-fonts` supports.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* // vite.config.ts (keep the NubiscoUI defaults)
|
|
38
|
+
* import { fonts } from '@nubisco/ui/plugins/fonts'
|
|
39
|
+
* export default defineConfig({ plugins: [fonts()] })
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* // bring your own families/weights
|
|
43
|
+
* fonts({
|
|
44
|
+
* fontsource: {
|
|
45
|
+
* families: [
|
|
46
|
+
* { name: 'Inter', weights: [400, 600], styles: ['normal'] },
|
|
47
|
+
* { name: 'JetBrains Mono', weights: [400], styles: ['normal'] },
|
|
48
|
+
* ],
|
|
49
|
+
* },
|
|
50
|
+
* })
|
|
51
|
+
*/
|
|
52
|
+
export declare const fonts: (options?: TFontsOptions) => import("vite").Plugin<any> | import("vite").Plugin<any>[];
|
|
2
53
|
//# sourceMappingURL=fonts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fonts.d.ts","sourceRoot":"","sources":["../../src/plugins/fonts.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fonts.d.ts","sourceRoot":"","sources":["../../src/plugins/fonts.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,qBAAqB,CAAA;AAEzC;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,WAAW,CAAC,UAAU,CAAC,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AAEtE;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,aAAa,EAAE,aAe3B,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,KAAK,GAAI,UAAS,aAA6B,8DAC1C,CAAA"}
|
package/dist/plugins/fonts.js
CHANGED
|
@@ -1,16 +1,61 @@
|
|
|
1
1
|
import Unfonts from 'unplugin-fonts/vite';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Default font configuration for NubiscoUI.
|
|
4
|
+
*
|
|
5
|
+
* Self-hosted via the `fontsource` provider (RGPD-friendly, no third-party
|
|
6
|
+
* CDN). These are the two families declared as the library defaults in
|
|
7
|
+
* `src/styles/variables/_type.scss` (`--nb-font-family-sans` / `-mono`):
|
|
8
|
+
*
|
|
9
|
+
* - Plus Jakarta Sans: weights 400, 500, 600, 700 (sans default)
|
|
10
|
+
* - Fira Code: weights 400, 600 (mono default)
|
|
11
|
+
*
|
|
12
|
+
* Only `normal` styles are loaded. Every subset shipped by Fontsource is
|
|
13
|
+
* imported, but each `@font-face` carries a `unicode-range`, so the browser
|
|
14
|
+
* only downloads the subsets a page actually needs. `font-display: swap` is
|
|
15
|
+
* baked into the Fontsource stylesheets.
|
|
16
|
+
*
|
|
17
|
+
* Consumers must install the source packages themselves:
|
|
18
|
+
* `pnpm add -D @fontsource/plus-jakarta-sans @fontsource/fira-code`.
|
|
19
|
+
*/
|
|
20
|
+
export const DEFAULT_FONTS = {
|
|
21
|
+
fontsource: {
|
|
5
22
|
families: [
|
|
6
23
|
{
|
|
7
|
-
name: 'Plus
|
|
8
|
-
|
|
24
|
+
name: 'Plus Jakarta Sans',
|
|
25
|
+
weights: [400, 500, 600, 700],
|
|
26
|
+
styles: ['normal'],
|
|
9
27
|
},
|
|
10
28
|
{
|
|
11
|
-
name: 'Fira
|
|
12
|
-
|
|
29
|
+
name: 'Fira Code',
|
|
30
|
+
weights: [400, 600],
|
|
31
|
+
styles: ['normal'],
|
|
13
32
|
},
|
|
14
33
|
],
|
|
15
34
|
},
|
|
16
|
-
}
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Vite plugin that loads NubiscoUI's typefaces.
|
|
38
|
+
*
|
|
39
|
+
* Called with no arguments it self-hosts the library defaults (Plus Jakarta
|
|
40
|
+
* Sans + Fira Code) via Fontsource, keeping every existing consumer's output
|
|
41
|
+
* unchanged. Pass an options object to fully replace that configuration: load
|
|
42
|
+
* different families/weights, point the `custom` provider at your own woff2
|
|
43
|
+
* files, or use any other provider `unplugin-fonts` supports.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* // vite.config.ts (keep the NubiscoUI defaults)
|
|
47
|
+
* import { fonts } from '@nubisco/ui/plugins/fonts'
|
|
48
|
+
* export default defineConfig({ plugins: [fonts()] })
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* // bring your own families/weights
|
|
52
|
+
* fonts({
|
|
53
|
+
* fontsource: {
|
|
54
|
+
* families: [
|
|
55
|
+
* { name: 'Inter', weights: [400, 600], styles: ['normal'] },
|
|
56
|
+
* { name: 'JetBrains Mono', weights: [400], styles: ['normal'] },
|
|
57
|
+
* ],
|
|
58
|
+
* },
|
|
59
|
+
* })
|
|
60
|
+
*/
|
|
61
|
+
export const fonts = (options = DEFAULT_FONTS) => Unfonts(options);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nubisco/ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.41.1",
|
|
4
4
|
"description": "Vue 3 UI component library",
|
|
5
5
|
"packageManager": "pnpm@11.0.8",
|
|
6
6
|
"repository": {
|
|
@@ -110,16 +110,22 @@
|
|
|
110
110
|
},
|
|
111
111
|
"peerDependencies": {
|
|
112
112
|
"pixi.js": "^8.0.0",
|
|
113
|
+
"unplugin-fonts": ">=1.4.0",
|
|
113
114
|
"vue": "^3.5.30",
|
|
114
115
|
"vue-i18n": "^11.3.0"
|
|
115
116
|
},
|
|
116
117
|
"peerDependenciesMeta": {
|
|
117
118
|
"pixi.js": {
|
|
118
119
|
"optional": true
|
|
120
|
+
},
|
|
121
|
+
"unplugin-fonts": {
|
|
122
|
+
"optional": true
|
|
119
123
|
}
|
|
120
124
|
},
|
|
121
125
|
"devDependencies": {
|
|
122
126
|
"@eslint/js": "^10.0.1",
|
|
127
|
+
"@fontsource/fira-code": "^5.2.7",
|
|
128
|
+
"@fontsource/plus-jakarta-sans": "^5.2.8",
|
|
123
129
|
"@phosphor-icons/core": "^2.1.1",
|
|
124
130
|
"@semantic-release/changelog": "^6.0.3",
|
|
125
131
|
"@semantic-release/git": "^10.0.1",
|
|
@@ -143,7 +149,6 @@
|
|
|
143
149
|
"tinycolor2": "^1.6.0",
|
|
144
150
|
"typescript": "^5.9.3",
|
|
145
151
|
"typescript-eslint": "^8.57.2",
|
|
146
|
-
"unplugin-fonts": "^1.4.0",
|
|
147
152
|
"vite": "^8.0.2",
|
|
148
153
|
"vite-svg-loader": "^5.1.1",
|
|
149
154
|
"vitepress": "^1.6.4",
|
package/src/plugins/fonts.ts
CHANGED
|
@@ -1,19 +1,71 @@
|
|
|
1
1
|
import Unfonts from 'unplugin-fonts/vite'
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Options accepted by {@link fonts}. This is the exact option object that
|
|
5
|
+
* `unplugin-fonts` exposes, so any provider it supports (`fontsource`,
|
|
6
|
+
* `custom`, `google`, `typekit`) can be configured here.
|
|
7
|
+
*/
|
|
8
|
+
export type TFontsOptions = NonNullable<Parameters<typeof Unfonts>[0]>
|
|
7
9
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Default font configuration for NubiscoUI.
|
|
12
|
+
*
|
|
13
|
+
* Self-hosted via the `fontsource` provider (RGPD-friendly, no third-party
|
|
14
|
+
* CDN). These are the two families declared as the library defaults in
|
|
15
|
+
* `src/styles/variables/_type.scss` (`--nb-font-family-sans` / `-mono`):
|
|
16
|
+
*
|
|
17
|
+
* - Plus Jakarta Sans: weights 400, 500, 600, 700 (sans default)
|
|
18
|
+
* - Fira Code: weights 400, 600 (mono default)
|
|
19
|
+
*
|
|
20
|
+
* Only `normal` styles are loaded. Every subset shipped by Fontsource is
|
|
21
|
+
* imported, but each `@font-face` carries a `unicode-range`, so the browser
|
|
22
|
+
* only downloads the subsets a page actually needs. `font-display: swap` is
|
|
23
|
+
* baked into the Fontsource stylesheets.
|
|
24
|
+
*
|
|
25
|
+
* Consumers must install the source packages themselves:
|
|
26
|
+
* `pnpm add -D @fontsource/plus-jakarta-sans @fontsource/fira-code`.
|
|
27
|
+
*/
|
|
28
|
+
export const DEFAULT_FONTS: TFontsOptions = {
|
|
29
|
+
fontsource: {
|
|
30
|
+
families: [
|
|
31
|
+
{
|
|
32
|
+
name: 'Plus Jakarta Sans',
|
|
33
|
+
weights: [400, 500, 600, 700],
|
|
34
|
+
styles: ['normal'],
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
name: 'Fira Code',
|
|
38
|
+
weights: [400, 600],
|
|
39
|
+
styles: ['normal'],
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
},
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Vite plugin that loads NubiscoUI's typefaces.
|
|
47
|
+
*
|
|
48
|
+
* Called with no arguments it self-hosts the library defaults (Plus Jakarta
|
|
49
|
+
* Sans + Fira Code) via Fontsource, keeping every existing consumer's output
|
|
50
|
+
* unchanged. Pass an options object to fully replace that configuration: load
|
|
51
|
+
* different families/weights, point the `custom` provider at your own woff2
|
|
52
|
+
* files, or use any other provider `unplugin-fonts` supports.
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* // vite.config.ts (keep the NubiscoUI defaults)
|
|
56
|
+
* import { fonts } from '@nubisco/ui/plugins/fonts'
|
|
57
|
+
* export default defineConfig({ plugins: [fonts()] })
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* // bring your own families/weights
|
|
61
|
+
* fonts({
|
|
62
|
+
* fontsource: {
|
|
63
|
+
* families: [
|
|
64
|
+
* { name: 'Inter', weights: [400, 600], styles: ['normal'] },
|
|
65
|
+
* { name: 'JetBrains Mono', weights: [400], styles: ['normal'] },
|
|
66
|
+
* ],
|
|
67
|
+
* },
|
|
68
|
+
* })
|
|
69
|
+
*/
|
|
70
|
+
export const fonts = (options: TFontsOptions = DEFAULT_FONTS) =>
|
|
71
|
+
Unfonts(options)
|