@sit-onyx/nuxt 1.0.0-beta.31 → 1.0.0-beta.310
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/README.md +1 -5
- package/dist/module.d.mts +3 -22
- package/dist/module.json +2 -2
- package/dist/module.mjs +19 -16
- package/dist/runtime/plugins/onyx.js +24 -19
- package/dist/types.d.mts +3 -1
- package/package.json +18 -16
- package/dist/module.cjs +0 -5
- package/dist/module.d.ts +0 -37
- package/dist/types.d.ts +0 -1
package/README.md
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
<div align="center" style="text-align: center">
|
|
2
|
-
<
|
|
3
|
-
<source media="(prefers-color-scheme: dark)" type="image/svg+xml" srcset="https://raw.githubusercontent.com/SchwarzIT/onyx/main/.github/onyx-logo-light.svg">
|
|
4
|
-
<source media="(prefers-color-scheme: light)" type="image/svg+xml" srcset="https://raw.githubusercontent.com/SchwarzIT/onyx/main/.github/onyx-logo-dark.svg">
|
|
5
|
-
<img alt="onyx logo" src="https://raw.githubusercontent.com/SchwarzIT/onyx/main/.github/onyx-logo-dark.svg" width="160px">
|
|
6
|
-
</picture>
|
|
2
|
+
<img alt="onyx logo" src="https://raw.githubusercontent.com/SchwarzIT/onyx/main/.github/onyx-logo.svg" height="96px">
|
|
7
3
|
</div>
|
|
8
4
|
|
|
9
5
|
<br>
|
package/dist/module.d.mts
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
|
-
import { OnyxTheme } from 'sit-onyx';
|
|
3
2
|
|
|
4
3
|
interface ModuleOptions {
|
|
5
|
-
/**
|
|
6
|
-
* The onyx theme to use. See: [https://onyx.schwarz/development/theming.html](https://onyx.schwarz/development/theming.html)
|
|
7
|
-
* @default "onyx"
|
|
8
|
-
*/
|
|
9
|
-
theme: OnyxTheme;
|
|
10
4
|
/**
|
|
11
5
|
* By default, the global onyx styles (`global.css` file) will be included
|
|
12
6
|
* which applies some global styles like background color and font styles.
|
|
@@ -17,21 +11,8 @@ interface ModuleOptions {
|
|
|
17
11
|
* @see https://onyx.schwarz/development/#installation
|
|
18
12
|
*/
|
|
19
13
|
disableGlobalStyles?: boolean;
|
|
20
|
-
/**
|
|
21
|
-
* Settings related to the integration with @nuxtjs/i18n
|
|
22
|
-
*/
|
|
23
|
-
i18n?: {
|
|
24
|
-
/**
|
|
25
|
-
* Mapping for registering the translations from onyx with @nuxtjs/i18n.
|
|
26
|
-
* @example
|
|
27
|
-
* ```ts
|
|
28
|
-
* registerLocales: { "en_US": "en-US" }
|
|
29
|
-
* ```
|
|
30
|
-
* This would register the onyx translations for the language "en-US" to the code "en_US" of your projects locales.
|
|
31
|
-
*/
|
|
32
|
-
registerLocales?: Record<string, "en-US" | "de-DE" | "ko-KR">;
|
|
33
|
-
};
|
|
34
14
|
}
|
|
35
|
-
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions>;
|
|
15
|
+
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
|
|
36
16
|
|
|
37
|
-
export {
|
|
17
|
+
export { _default as default };
|
|
18
|
+
export type { ModuleOptions };
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { defineNuxtModule, useLogger, createResolver, addComponent, addPlugin } from '@nuxt/kit';
|
|
2
|
+
import { stat } from 'node:fs/promises';
|
|
2
3
|
import * as onyx from 'sit-onyx';
|
|
3
4
|
|
|
4
5
|
const module = defineNuxtModule({
|
|
@@ -6,20 +7,14 @@ const module = defineNuxtModule({
|
|
|
6
7
|
name: "@sit-onyx/nuxt",
|
|
7
8
|
configKey: "onyx"
|
|
8
9
|
},
|
|
9
|
-
defaults: {
|
|
10
|
-
theme: "onyx"
|
|
11
|
-
},
|
|
10
|
+
defaults: {},
|
|
12
11
|
setup(options, nuxt) {
|
|
13
12
|
const logger = useLogger("@sit-onyx/nuxt");
|
|
14
13
|
const { resolve } = createResolver(import.meta.url);
|
|
15
|
-
nuxt.options.postcss.plugins.cssnano = { preset: ["default", { calc: false }] };
|
|
16
|
-
nuxt.options.css.push("sit-onyx/style.css");
|
|
17
|
-
if (options.theme !== "onyx") {
|
|
18
|
-
nuxt.options.css.push(`sit-onyx/themes/${options.theme}.css`);
|
|
19
|
-
}
|
|
20
14
|
if (!options.disableGlobalStyles) {
|
|
21
|
-
nuxt.options.css.
|
|
15
|
+
nuxt.options.css.unshift("sit-onyx/global.css");
|
|
22
16
|
}
|
|
17
|
+
nuxt.options.css.unshift("sit-onyx/style.css");
|
|
23
18
|
Object.keys(onyx).filter((namedExport) => namedExport.startsWith("Onyx")).forEach((component) => {
|
|
24
19
|
addComponent({
|
|
25
20
|
filePath: "sit-onyx",
|
|
@@ -39,29 +34,37 @@ const module = defineNuxtModule({
|
|
|
39
34
|
);
|
|
40
35
|
}
|
|
41
36
|
if (i18nModuleIndex >= 0) {
|
|
42
|
-
const registerOnyxLocales = (register) => {
|
|
37
|
+
const registerOnyxLocales = async (register) => {
|
|
38
|
+
const onyxLocalesToRegister = {};
|
|
39
|
+
await Promise.allSettled(
|
|
40
|
+
nuxt.options.i18n?.locales?.map(async (projectLocale) => {
|
|
41
|
+
const locale = typeof projectLocale === "string" ? { code: projectLocale, language: projectLocale } : projectLocale;
|
|
42
|
+
const language = locale.language ?? locale.code;
|
|
43
|
+
await stat(resolve(`./runtime/locales/${language}.js`));
|
|
44
|
+
onyxLocalesToRegister[locale.code] = language;
|
|
45
|
+
}) ?? []
|
|
46
|
+
);
|
|
43
47
|
register({
|
|
44
48
|
langDir: resolve("./runtime/locales"),
|
|
45
49
|
// we need to use .js files instead of .ts because the .ts files would be compiled to .js in the build step, so
|
|
46
50
|
// when projects use this nuxt module, .ts files will throw a "can not find file" error
|
|
47
|
-
locales: Object.entries(
|
|
51
|
+
locales: Object.entries(onyxLocalesToRegister).map(([code, language]) => ({
|
|
48
52
|
code,
|
|
53
|
+
language,
|
|
49
54
|
file: `${language}.js`
|
|
50
55
|
}))
|
|
51
56
|
});
|
|
52
57
|
};
|
|
53
58
|
nuxt.hook("i18n:registerModule", registerOnyxLocales);
|
|
54
|
-
addPlugin({ src: resolve("./runtime/plugins/onyx") });
|
|
55
59
|
}
|
|
60
|
+
addPlugin({ src: resolve("./runtime/plugins/onyx") });
|
|
56
61
|
}
|
|
57
62
|
});
|
|
58
63
|
function getModuleIndex(modules, ...moduleNames) {
|
|
59
64
|
for (let i = 0; i < modules.length; i++) {
|
|
60
65
|
const module = modules[i];
|
|
61
|
-
if (typeof module === "string" && moduleNames.includes(module))
|
|
62
|
-
|
|
63
|
-
if (Array.isArray(module) && moduleNames.includes(module[0]))
|
|
64
|
-
return i;
|
|
66
|
+
if (typeof module === "string" && moduleNames.includes(module)) return i;
|
|
67
|
+
if (Array.isArray(module) && moduleNames.includes(module[0])) return i;
|
|
65
68
|
}
|
|
66
69
|
return -1;
|
|
67
70
|
}
|
|
@@ -1,25 +1,30 @@
|
|
|
1
|
-
import { computed
|
|
2
|
-
import { defineNuxtPlugin, useNuxtApp } from "nuxt/app";
|
|
3
|
-
import {
|
|
1
|
+
import { computed } from "#imports";
|
|
2
|
+
import { defineNuxtPlugin, useNuxtApp, useRouter } from "nuxt/app";
|
|
3
|
+
import { createOnyx } from "sit-onyx";
|
|
4
4
|
export default defineNuxtPlugin({
|
|
5
5
|
name: "onyx:plugin",
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
dependsOn: [],
|
|
7
|
+
// "parallel: false" is the current default but to be resistant for future changes, we explicitly set it to false here
|
|
8
|
+
// see: https://github.com/SchwarzIT/onyx/pull/3832#discussion_r2244487744
|
|
9
|
+
parallel: false,
|
|
8
10
|
setup: (app) => {
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
t
|
|
18
|
-
});
|
|
19
|
-
app.hook("app:beforeMount", () => {
|
|
20
|
-
watchEffect(() => {
|
|
21
|
-
syncGlobalOptionalText(translate(`onyx.optional`));
|
|
11
|
+
const i18n = useNuxtApp().$i18n;
|
|
12
|
+
const router = useRouter();
|
|
13
|
+
const getI18nOptions = () => {
|
|
14
|
+
if (!i18n) return;
|
|
15
|
+
const t = computed(() => {
|
|
16
|
+
return (key, placeholders) => {
|
|
17
|
+
return i18n.t(`onyx.${key}`, placeholders?.n ?? 1, { named: placeholders });
|
|
18
|
+
};
|
|
22
19
|
});
|
|
23
|
-
|
|
20
|
+
const locale = computed(() => i18n.localeProperties.value.language ?? "en-US");
|
|
21
|
+
return { t, locale };
|
|
22
|
+
};
|
|
23
|
+
app.vueApp.use(
|
|
24
|
+
createOnyx({
|
|
25
|
+
router,
|
|
26
|
+
i18n: getI18nOptions()
|
|
27
|
+
})
|
|
28
|
+
);
|
|
24
29
|
}
|
|
25
30
|
});
|
package/dist/types.d.mts
CHANGED
package/package.json
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sit-onyx/nuxt",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.310",
|
|
4
4
|
"description": "A Nuxt module to easily integrate onyx into Nuxt projects",
|
|
5
|
+
"type": "module",
|
|
5
6
|
"author": "Schwarz IT KG",
|
|
6
7
|
"license": "Apache-2.0",
|
|
8
|
+
"engines": {
|
|
9
|
+
"node": ">=20"
|
|
10
|
+
},
|
|
7
11
|
"homepage": "https://onyx.schwarz",
|
|
8
12
|
"repository": {
|
|
9
13
|
"type": "git",
|
|
@@ -13,32 +17,30 @@
|
|
|
13
17
|
"bugs": {
|
|
14
18
|
"url": "https://github.com/SchwarzIT/onyx/issues"
|
|
15
19
|
},
|
|
16
|
-
"type": "module",
|
|
17
20
|
"exports": {
|
|
18
21
|
".": {
|
|
19
|
-
"types": "./dist/types.d.
|
|
22
|
+
"types": "./dist/types.d.mts",
|
|
20
23
|
"import": "./dist/module.mjs",
|
|
21
|
-
"require": "./dist/module.
|
|
24
|
+
"require": "./dist/module.mjs"
|
|
22
25
|
}
|
|
23
26
|
},
|
|
24
|
-
"types": "./dist/types.d.ts",
|
|
25
27
|
"files": [
|
|
26
28
|
"dist"
|
|
27
29
|
],
|
|
28
|
-
"dependencies": {
|
|
29
|
-
"@nuxt/kit": "^3.12.4"
|
|
30
|
-
},
|
|
31
30
|
"devDependencies": {
|
|
32
|
-
"@nuxt/devtools": "^
|
|
33
|
-
"@nuxt/
|
|
34
|
-
"@nuxt/
|
|
35
|
-
"@nuxt/
|
|
36
|
-
"@
|
|
37
|
-
"
|
|
38
|
-
"
|
|
31
|
+
"@nuxt/devtools": "^2.6.3",
|
|
32
|
+
"@nuxt/kit": "^4.0.3",
|
|
33
|
+
"@nuxt/module-builder": "^1.0.2",
|
|
34
|
+
"@nuxt/schema": "^4.0.3",
|
|
35
|
+
"@nuxt/test-utils": "^3.19.2",
|
|
36
|
+
"@nuxtjs/i18n": "^10.0.6",
|
|
37
|
+
"nuxt": "^4.0.3",
|
|
38
|
+
"typescript": "5.9.2",
|
|
39
|
+
"vue-i18n": "^11.1.11",
|
|
40
|
+
"sit-onyx": "^1.0.0-beta.324"
|
|
39
41
|
},
|
|
40
42
|
"peerDependencies": {
|
|
41
|
-
"sit-onyx": "^1.0.0-beta.
|
|
43
|
+
"sit-onyx": "^1.0.0-beta.324"
|
|
42
44
|
},
|
|
43
45
|
"scripts": {
|
|
44
46
|
"dev": "nuxi dev playground",
|
package/dist/module.cjs
DELETED
package/dist/module.d.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
|
-
import { OnyxTheme } from 'sit-onyx';
|
|
3
|
-
|
|
4
|
-
interface ModuleOptions {
|
|
5
|
-
/**
|
|
6
|
-
* The onyx theme to use. See: [https://onyx.schwarz/development/theming.html](https://onyx.schwarz/development/theming.html)
|
|
7
|
-
* @default "onyx"
|
|
8
|
-
*/
|
|
9
|
-
theme: OnyxTheme;
|
|
10
|
-
/**
|
|
11
|
-
* By default, the global onyx styles (`global.css` file) will be included
|
|
12
|
-
* which applies some global styles like background color and font styles.
|
|
13
|
-
* This is recommended when building a whole application with onyx.
|
|
14
|
-
*
|
|
15
|
-
* You can set this option to `true` to disable this.
|
|
16
|
-
*
|
|
17
|
-
* @see https://onyx.schwarz/development/#installation
|
|
18
|
-
*/
|
|
19
|
-
disableGlobalStyles?: boolean;
|
|
20
|
-
/**
|
|
21
|
-
* Settings related to the integration with @nuxtjs/i18n
|
|
22
|
-
*/
|
|
23
|
-
i18n?: {
|
|
24
|
-
/**
|
|
25
|
-
* Mapping for registering the translations from onyx with @nuxtjs/i18n.
|
|
26
|
-
* @example
|
|
27
|
-
* ```ts
|
|
28
|
-
* registerLocales: { "en_US": "en-US" }
|
|
29
|
-
* ```
|
|
30
|
-
* This would register the onyx translations for the language "en-US" to the code "en_US" of your projects locales.
|
|
31
|
-
*/
|
|
32
|
-
registerLocales?: Record<string, "en-US" | "de-DE" | "ko-KR">;
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions>;
|
|
36
|
-
|
|
37
|
-
export { type ModuleOptions, _default as default };
|
package/dist/types.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { type ModuleOptions, default } from './module'
|