@brickflow/ui 0.0.50 → 0.0.52
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 +2 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +17 -2
- package/dist/runtime/components/Button/index.vue +5 -2
- package/dist/runtime/composables/useBrickflow.d.ts +8 -0
- package/dist/runtime/composables/useBrickflow.js +8 -0
- package/dist/runtime/composables/useTranslate.d.ts +1 -5
- package/dist/runtime/composables/useTranslate.js +9 -14
- package/dist/types.d.mts +3 -1
- package/package.json +1 -1
package/dist/module.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
|
-
export { BrickflowConfig
|
|
2
|
+
export { BrickflowConfig } from '../dist/runtime/composables/useBrickflow.js';
|
|
3
|
+
export { BrickflowI18n, BrickflowRouteLocationParam } from '../dist/runtime/composables/useTranslate.js';
|
|
3
4
|
|
|
4
5
|
interface ModuleOptions {
|
|
5
6
|
componentPrefix?: string;
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineNuxtModule, createResolver, resolvePath, addTypeTemplate, addTemplate, updateTemplates,
|
|
1
|
+
import { defineNuxtModule, createResolver, resolvePath, addTypeTemplate, addTemplate, updateTemplates, addImports, addComponentsDir } from '@nuxt/kit';
|
|
2
2
|
import tailwindcss from '@tailwindcss/vite';
|
|
3
3
|
import { createJiti } from 'jiti';
|
|
4
4
|
import { mkdir, access, readFile, writeFile, readdir } from 'node:fs/promises';
|
|
@@ -960,7 +960,22 @@ const module$1 = defineNuxtModule({
|
|
|
960
960
|
}
|
|
961
961
|
viteConfig.plugins.push(tailwindcss());
|
|
962
962
|
});
|
|
963
|
-
|
|
963
|
+
addImports([
|
|
964
|
+
...["provideBrickflow", "useBrickflow", "BrickflowConfig"].map((name) => ({
|
|
965
|
+
from: resolver.resolve("./runtime/composables/useBrickflow"),
|
|
966
|
+
name,
|
|
967
|
+
type: name === "useBrickflow"
|
|
968
|
+
})),
|
|
969
|
+
{
|
|
970
|
+
from: resolver.resolve("./runtime/composables/useScreen"),
|
|
971
|
+
name: "useScreen"
|
|
972
|
+
},
|
|
973
|
+
...["useTheme", "Theme", "ThemeController"].map((name) => ({
|
|
974
|
+
from: resolver.resolve("./runtime/composables/useTheme"),
|
|
975
|
+
name,
|
|
976
|
+
type: name !== "useTheme"
|
|
977
|
+
}))
|
|
978
|
+
]);
|
|
964
979
|
addComponentsDir({
|
|
965
980
|
ignore: ["**/*.demo.vue"],
|
|
966
981
|
path: resolver.resolve("./runtime/components"),
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
rounded?: boolean
|
|
32
32
|
size?: ButtonSize
|
|
33
33
|
square?: boolean
|
|
34
|
+
target?: '_blank' | '_parent' | '_self' | '_top' | null | (Record<string, never> & string)
|
|
34
35
|
to?: RouteLocationRaw
|
|
35
36
|
trailingIcon?: string
|
|
36
37
|
type?: 'button' | 'reset' | 'submit'
|
|
@@ -41,6 +42,7 @@
|
|
|
41
42
|
icon: undefined,
|
|
42
43
|
rounded: false,
|
|
43
44
|
size: UI_CONFIG.sizeDefault,
|
|
45
|
+
target: undefined,
|
|
44
46
|
to: undefined,
|
|
45
47
|
trailingIcon: undefined,
|
|
46
48
|
type: 'button',
|
|
@@ -55,9 +57,9 @@
|
|
|
55
57
|
type ButtonSize = Extract<keyof typeof sizeClasses, string>
|
|
56
58
|
type ButtonVariant = Extract<keyof (typeof colorClasses)[ButtonColor], string>
|
|
57
59
|
|
|
58
|
-
const component = computed(() => (props.to === undefined ? 'button' : BaseLink))
|
|
59
|
-
const disabled = computed(() => props.disabled || props.loading)
|
|
60
60
|
const isButton = computed(() => props.to === undefined)
|
|
61
|
+
const component = computed(() => (isButton.value ? 'button' : BaseLink))
|
|
62
|
+
const disabled = computed(() => props.disabled || props.loading)
|
|
61
63
|
const classes = computed(() => [
|
|
62
64
|
UI_STYLE.base,
|
|
63
65
|
twMerge(sizeClasses[props.size], props.square && UI_STYLE.state.square),
|
|
@@ -82,6 +84,7 @@
|
|
|
82
84
|
:is="component"
|
|
83
85
|
v-bind="animationTapClass ? { onPointerupPassive: handleTap } : {}"
|
|
84
86
|
:to="props.to"
|
|
87
|
+
:target="isButton ? undefined : props.target"
|
|
85
88
|
:type="isButton ? props.type : undefined"
|
|
86
89
|
:disabled="isButton ? disabled : undefined"
|
|
87
90
|
:aria-busy="props.loading || undefined"
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type App } from 'vue';
|
|
2
|
+
import type { BrickflowI18n } from './useTranslate.js';
|
|
3
|
+
export interface BrickflowConfig {
|
|
4
|
+
i18n?: BrickflowI18n;
|
|
5
|
+
}
|
|
6
|
+
export declare function provideBrickflow<T extends BrickflowConfig>(app: App, config: T): void;
|
|
7
|
+
export declare function useBrickflow(): BrickflowConfig;
|
|
8
|
+
//# sourceMappingURL=useBrickflow.d.ts.map
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import type { RouteRecordNameGeneric } from 'vue-router';
|
|
2
|
-
import { type
|
|
3
|
-
export interface BrickflowConfig {
|
|
4
|
-
i18n?: BrickflowI18n;
|
|
5
|
-
}
|
|
2
|
+
import { type Ref } from 'vue';
|
|
6
3
|
export interface BrickflowI18n {
|
|
7
4
|
getRealName: (route: {
|
|
8
5
|
name: RouteRecordNameGeneric;
|
|
@@ -15,6 +12,5 @@ export interface BrickflowRouteLocationParam {
|
|
|
15
12
|
path: string;
|
|
16
13
|
query: Record<string, unknown>;
|
|
17
14
|
}
|
|
18
|
-
export declare function provideBrickflowConfig<T extends BrickflowConfig>(app: App, config: T): void;
|
|
19
15
|
export declare function useTranslate(): BrickflowI18n;
|
|
20
16
|
//# sourceMappingURL=useTranslate.d.ts.map
|
|
@@ -1,17 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
localePath: getRealPath
|
|
10
|
-
};
|
|
1
|
+
import { shallowRef } from "vue";
|
|
2
|
+
import { useBrickflow } from "./useBrickflow.js";
|
|
3
|
+
const getFallbackRealPath = (route) => typeof route === "string" ? route : route.path;
|
|
4
|
+
const translateFallback = {
|
|
5
|
+
getRealName: (route) => String(route.name),
|
|
6
|
+
getRealPath: getFallbackRealPath,
|
|
7
|
+
locale: shallowRef("en"),
|
|
8
|
+
localePath: getFallbackRealPath
|
|
11
9
|
};
|
|
12
|
-
export function provideBrickflowConfig(app, config) {
|
|
13
|
-
app.provide(brickflowConfigKey, config);
|
|
14
|
-
}
|
|
15
10
|
export function useTranslate() {
|
|
16
|
-
return
|
|
11
|
+
return useBrickflow().i18n ?? translateFallback;
|
|
17
12
|
}
|
package/dist/types.d.mts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
export { type BrickflowConfig
|
|
1
|
+
export { type BrickflowConfig } from '../dist/runtime/composables/useBrickflow.js'
|
|
2
|
+
|
|
3
|
+
export { type BrickflowI18n, type BrickflowRouteLocationParam } from '../dist/runtime/composables/useTranslate.js'
|
|
2
4
|
|
|
3
5
|
export { default } from './module.mjs'
|
|
4
6
|
|