@soave/nuxt-ui 0.1.0 → 0.2.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/dist/module.d.mts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
2
|
|
|
3
|
+
type StyleAdapterName = "tailwind" | "css-variables" | "headless";
|
|
3
4
|
interface SoaveNuxtModuleOptions {
|
|
4
5
|
prefix?: string;
|
|
5
6
|
global?: boolean;
|
|
7
|
+
adapter?: StyleAdapterName;
|
|
6
8
|
i18n?: {
|
|
7
9
|
enabled?: boolean;
|
|
8
10
|
default_locale?: string;
|
|
@@ -13,6 +15,7 @@ declare const _default: _nuxt_schema.NuxtModule<SoaveNuxtModuleOptions, SoaveNux
|
|
|
13
15
|
declare module "@nuxt/schema" {
|
|
14
16
|
interface PublicRuntimeConfig {
|
|
15
17
|
soaveUI: {
|
|
18
|
+
adapter: StyleAdapterName;
|
|
16
19
|
i18n: {
|
|
17
20
|
enabled: boolean;
|
|
18
21
|
default_locale: string;
|
|
@@ -22,4 +25,4 @@ declare module "@nuxt/schema" {
|
|
|
22
25
|
}
|
|
23
26
|
|
|
24
27
|
export { _default as default };
|
|
25
|
-
export type { SoaveNuxtModuleOptions };
|
|
28
|
+
export type { SoaveNuxtModuleOptions, StyleAdapterName };
|
package/dist/module.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
2
|
|
|
3
|
+
type StyleAdapterName = "tailwind" | "css-variables" | "headless";
|
|
3
4
|
interface SoaveNuxtModuleOptions {
|
|
4
5
|
prefix?: string;
|
|
5
6
|
global?: boolean;
|
|
7
|
+
adapter?: StyleAdapterName;
|
|
6
8
|
i18n?: {
|
|
7
9
|
enabled?: boolean;
|
|
8
10
|
default_locale?: string;
|
|
@@ -13,6 +15,7 @@ declare const _default: _nuxt_schema.NuxtModule<SoaveNuxtModuleOptions, SoaveNux
|
|
|
13
15
|
declare module "@nuxt/schema" {
|
|
14
16
|
interface PublicRuntimeConfig {
|
|
15
17
|
soaveUI: {
|
|
18
|
+
adapter: StyleAdapterName;
|
|
16
19
|
i18n: {
|
|
17
20
|
enabled: boolean;
|
|
18
21
|
default_locale: string;
|
|
@@ -22,4 +25,4 @@ declare module "@nuxt/schema" {
|
|
|
22
25
|
}
|
|
23
26
|
|
|
24
27
|
export { _default as default };
|
|
25
|
-
export type { SoaveNuxtModuleOptions };
|
|
28
|
+
export type { SoaveNuxtModuleOptions, StyleAdapterName };
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -11,6 +11,7 @@ const module = defineNuxtModule({
|
|
|
11
11
|
defaults: {
|
|
12
12
|
prefix: "",
|
|
13
13
|
global: true,
|
|
14
|
+
adapter: "tailwind",
|
|
14
15
|
i18n: {
|
|
15
16
|
enabled: false,
|
|
16
17
|
default_locale: "en"
|
|
@@ -30,6 +31,11 @@ const module = defineNuxtModule({
|
|
|
30
31
|
prefix: options.prefix,
|
|
31
32
|
global: options.global
|
|
32
33
|
});
|
|
34
|
+
if (options.adapter === "css-variables") {
|
|
35
|
+
nuxt.options.css.push(
|
|
36
|
+
resolver.resolve("../../core/styles/css-variables.css")
|
|
37
|
+
);
|
|
38
|
+
}
|
|
33
39
|
addPlugin({
|
|
34
40
|
src: resolver.resolve("./runtime/plugins/ui-provider.client"),
|
|
35
41
|
mode: "client"
|
|
@@ -39,6 +45,7 @@ const module = defineNuxtModule({
|
|
|
39
45
|
mode: "server"
|
|
40
46
|
});
|
|
41
47
|
nuxt.options.runtimeConfig.public.soaveUI = {
|
|
48
|
+
adapter: options.adapter,
|
|
42
49
|
i18n: options.i18n
|
|
43
50
|
};
|
|
44
51
|
nuxt.hook("prepare:types", ({ references }) => {
|
|
@@ -1,10 +1,23 @@
|
|
|
1
|
-
import { defineNuxtPlugin } from "#app";
|
|
2
|
-
import {
|
|
1
|
+
import { defineNuxtPlugin, useRuntimeConfig } from "#app";
|
|
2
|
+
import {
|
|
3
|
+
useUIProvider,
|
|
4
|
+
tailwindAdapter,
|
|
5
|
+
cssVariablesAdapter,
|
|
6
|
+
headlessAdapter
|
|
7
|
+
} from "@soave/ui";
|
|
3
8
|
export default defineNuxtPlugin(() => {
|
|
4
|
-
const
|
|
9
|
+
const runtime_config = useRuntimeConfig();
|
|
10
|
+
const soave_config = runtime_config.public.soaveUI;
|
|
11
|
+
const adapter_map = {
|
|
12
|
+
tailwind: tailwindAdapter,
|
|
13
|
+
"css-variables": cssVariablesAdapter,
|
|
14
|
+
headless: headlessAdapter
|
|
15
|
+
};
|
|
16
|
+
const selected_adapter = adapter_map[soave_config?.adapter ?? "tailwind"] ?? tailwindAdapter;
|
|
17
|
+
const context = useUIProvider({}, selected_adapter);
|
|
5
18
|
return {
|
|
6
19
|
provide: {
|
|
7
|
-
soaveUI:
|
|
20
|
+
soaveUI: context
|
|
8
21
|
}
|
|
9
22
|
};
|
|
10
23
|
});
|
|
@@ -1,10 +1,23 @@
|
|
|
1
|
-
import { defineNuxtPlugin } from "#app";
|
|
2
|
-
import {
|
|
1
|
+
import { defineNuxtPlugin, useRuntimeConfig } from "#app";
|
|
2
|
+
import {
|
|
3
|
+
useUIProvider,
|
|
4
|
+
tailwindAdapter,
|
|
5
|
+
cssVariablesAdapter,
|
|
6
|
+
headlessAdapter
|
|
7
|
+
} from "@soave/ui";
|
|
3
8
|
export default defineNuxtPlugin(() => {
|
|
4
|
-
const
|
|
9
|
+
const runtime_config = useRuntimeConfig();
|
|
10
|
+
const soave_config = runtime_config.public.soaveUI;
|
|
11
|
+
const adapter_map = {
|
|
12
|
+
tailwind: tailwindAdapter,
|
|
13
|
+
"css-variables": cssVariablesAdapter,
|
|
14
|
+
headless: headlessAdapter
|
|
15
|
+
};
|
|
16
|
+
const selected_adapter = adapter_map[soave_config?.adapter ?? "tailwind"] ?? tailwindAdapter;
|
|
17
|
+
const context = useUIProvider({}, selected_adapter);
|
|
5
18
|
return {
|
|
6
19
|
provide: {
|
|
7
|
-
soaveUI:
|
|
20
|
+
soaveUI: context
|
|
8
21
|
}
|
|
9
22
|
};
|
|
10
23
|
});
|
package/package.json
CHANGED