vueless 0.0.483 → 0.0.484

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.
@@ -24,7 +24,7 @@ export interface LocaleInstance {
24
24
  fallback: Ref<string>;
25
25
  t: (key: string, ...params: unknown[]) => string;
26
26
  n: (value: number) => string;
27
- tm: (key: string, ...params: unknown[]) => string;
27
+ tm: <TMassages>(key: string) => Partial<TMassages>;
28
28
  }
29
29
 
30
30
  const FALLBACK_LOCALE_CODE = "en";
@@ -86,7 +86,7 @@ function createTranslateMessageFunction(
86
86
  fallback: Ref<string>,
87
87
  messages: Ref<LocaleMessages>,
88
88
  ) {
89
- return (key: string) => {
89
+ return <TMassages>(key: string): Partial<TMassages> => {
90
90
  const currentLocale = current.value && messages.value[current.value];
91
91
  const fallbackLocale = fallback.value && messages.value[fallback.value];
92
92
 
@@ -100,7 +100,7 @@ function createTranslateMessageFunction(
100
100
  str = getObjectValueByPath(fallbackLocale, key, null);
101
101
  }
102
102
 
103
- return String(str);
103
+ return str as TMassages;
104
104
  };
105
105
  }
106
106
 
@@ -32,6 +32,7 @@ import type {
32
32
  CVA,
33
33
  KeyAttrs,
34
34
  KeysToExtend,
35
+ ExtendedKeyClasses,
35
36
  } from "../types.ts";
36
37
 
37
38
  interface MergedConfigOptions {
@@ -113,7 +114,7 @@ export default function useUI<T>(
113
114
  * – value: reactive string of extendingKey classes.
114
115
  */
115
116
  function getExtendingKeysClasses(extendingKeys: string[], mutatedProps = {}) {
116
- const extendingClasses: UnknownObject = {};
117
+ const extendingClasses: ExtendedKeyClasses = {};
117
118
 
118
119
  for (const key of extendingKeys) {
119
120
  extendingClasses[key] = getClasses(key, mutatedProps);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vueless",
3
- "version": "0.0.483",
3
+ "version": "0.0.484",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless UI Component Library, powered by Tailwind CSS.",
6
6
  "keywords": [
package/types.ts CHANGED
@@ -4,13 +4,18 @@ import { hasSlotContent } from "./composables/useUI.ts";
4
4
  import UTextDefaultConfig from "./ui.text-block/config.ts";
5
5
  import UButtonDefaultConfig from "./ui.button/config.ts";
6
6
  import UBadgeDefaultConfig from "./ui.text-badge/config.ts";
7
+ import UCalendarDefaultConfig from "./ui.form-calendar/config.ts";
7
8
 
8
- import type { ComputedRef, MaybeRef } from "vue";
9
+ import type { ComputedRef, MaybeRef, Ref } from "vue";
9
10
  import type { Props } from "tippy.js";
10
11
  import type { LocaleOptions } from "./adatper.locale/vueless.ts";
11
12
 
12
13
  export type TemplateRefElement = MaybeRef<HTMLElement | HTMLElement[] | null>;
13
14
 
15
+ export interface ExtendedKeyClasses {
16
+ [key: string]: Ref<string>;
17
+ }
18
+
14
19
  export interface ThemeConfig {
15
20
  /**
16
21
  * Components brand (primary) color.
@@ -109,6 +114,7 @@ export interface Components {
109
114
  UText?: Partial<typeof UTextDefaultConfig>;
110
115
  UButton?: Partial<typeof UButtonDefaultConfig>;
111
116
  UBadge?: Partial<typeof UBadgeDefaultConfig>;
117
+ UCalendar?: Partial<typeof UCalendarDefaultConfig>;
112
118
  }
113
119
 
114
120
  export interface Directives {
@@ -162,9 +168,10 @@ export interface VueAttrs {
162
168
  value?: string;
163
169
  }
164
170
 
165
- export interface UseAttrs {
171
+ export interface UseAttrs<TConfig> {
166
172
  hasSlotContent: typeof hasSlotContent;
167
- [key: string]: object | undefined;
173
+ config: Ref<TConfig | undefined>;
174
+ [key: string]: Ref<TConfig | undefined> | typeof hasSlotContent;
168
175
  }
169
176
 
170
177
  export interface KeyAttrs extends VueAttrs {