@duxweb/dvha-core 0.1.17 → 0.1.19

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.
Files changed (40) hide show
  1. package/dist/cjs/components/auth/can.cjs +1 -1
  2. package/dist/cjs/components/common/icon.cjs +1 -0
  3. package/dist/cjs/directive/permission.cjs +1 -1
  4. package/dist/cjs/hooks/data.cjs +1 -1
  5. package/dist/cjs/hooks/export.cjs +1 -1
  6. package/dist/cjs/hooks/overlay.cjs +1 -1
  7. package/dist/cjs/hooks/theme.cjs +4 -4
  8. package/dist/cjs/index.cjs +1 -1
  9. package/dist/cjs/provider/app.cjs +1 -1
  10. package/dist/cjs/utils/theme.cjs +1 -1
  11. package/dist/esm/components/auth/can.js +3 -3
  12. package/dist/esm/components/common/icon.js +25 -0
  13. package/dist/esm/directive/permission.js +3 -3
  14. package/dist/esm/hooks/data.js +262 -234
  15. package/dist/esm/hooks/export.js +20 -18
  16. package/dist/esm/hooks/overlay.js +1 -1
  17. package/dist/esm/hooks/theme.js +162 -118
  18. package/dist/esm/index.js +65 -63
  19. package/dist/esm/provider/app.js +15 -15
  20. package/dist/esm/utils/theme.js +17 -17
  21. package/dist/types/components/common/icon.d.ts +13 -0
  22. package/dist/types/components/common/index.d.ts +1 -0
  23. package/dist/types/hooks/data.d.ts +390 -30
  24. package/dist/types/hooks/export.d.ts +16 -3
  25. package/dist/types/hooks/exportCsv.d.ts +13 -1
  26. package/dist/types/hooks/index.d.ts +9 -9
  27. package/dist/types/hooks/json/index.d.ts +10 -0
  28. package/dist/types/hooks/json/types.d.ts +28 -0
  29. package/dist/types/hooks/json/utils/contextManager.d.ts +34 -0
  30. package/dist/types/hooks/json/utils/expressionParser.d.ts +10 -0
  31. package/dist/types/hooks/json/vFor.d.ts +2 -0
  32. package/dist/types/hooks/json/vIf.d.ts +2 -0
  33. package/dist/types/hooks/json/vModel.d.ts +2 -0
  34. package/dist/types/hooks/json/vOn.d.ts +2 -0
  35. package/dist/types/hooks/json/vShow.d.ts +2 -0
  36. package/dist/types/hooks/json/vText.d.ts +2 -0
  37. package/dist/types/hooks/json.d.ts +15 -0
  38. package/dist/types/hooks/theme.d.ts +6 -3
  39. package/dist/types/utils/theme.d.ts +3 -3
  40. package/package.json +3 -3
@@ -11,7 +11,19 @@ export interface IUseExportCsvProps extends IUseExportProps {
11
11
  };
12
12
  }
13
13
  export declare function useExportCsv(props: IUseExportCsvProps): {
14
- data: import("vue").Ref<undefined, undefined> | import("vue").Ref<import("@tanstack/query-core").InfiniteData<import("..").IDataProviderResponse | undefined, unknown>, import("@tanstack/query-core").InfiniteData<import("..").IDataProviderResponse | undefined, unknown>>;
14
+ data: import("vue").Ref<{
15
+ [x: string]: any;
16
+ message?: string | undefined;
17
+ data?: any;
18
+ meta?: Record<string, any> | undefined;
19
+ raw?: any;
20
+ } | undefined, import("..").IDataProviderResponse | {
21
+ [x: string]: any;
22
+ message?: string | undefined;
23
+ data?: any;
24
+ meta?: Record<string, any> | undefined;
25
+ raw?: any;
26
+ } | undefined>;
15
27
  isLoading: import("vue").ComputedRef<boolean>;
16
28
  trigger: () => Promise<void>;
17
29
  };
@@ -1,18 +1,18 @@
1
1
  export * from './auth';
2
2
  export * from './config';
3
3
  export * from './data';
4
+ export * from './export';
5
+ export * from './exportCsv';
6
+ export * from './form';
7
+ export * from './i18n';
8
+ export * from './import';
9
+ export * from './importCsv';
4
10
  export * from './manage';
5
11
  export * from './menu';
6
- export * from './theme';
7
12
  export * from './overlay';
8
- export * from './i18n';
9
13
  export * from './select';
10
- export * from './form';
11
- export * from './export';
12
- export * from './import';
13
- export * from './exportCsv';
14
- export * from './importCsv';
14
+ export * from './theme';
15
+ export * from './theme';
16
+ export * from './themeColor';
15
17
  export * from './upload';
16
18
  export * from './upload/index';
17
- export * from './themeColor';
18
- export * from './theme';
@@ -0,0 +1,10 @@
1
+ import type { IJsonAdaptor } from './types';
2
+ import { vForAdaptor } from './vFor';
3
+ import { vIfAdaptor } from './vIf';
4
+ import { vModelAdaptor } from './vModel';
5
+ import { vOnAdaptor } from './vOn';
6
+ import { vShowAdaptor } from './vShow';
7
+ import { vTextAdaptor } from './vText';
8
+ export declare const defaultAdaptors: IJsonAdaptor[];
9
+ export * from './types';
10
+ export { vForAdaptor, vIfAdaptor, vModelAdaptor, vOnAdaptor, vShowAdaptor, vTextAdaptor, };
@@ -0,0 +1,28 @@
1
+ import type { Component } from 'vue';
2
+ export interface JsonSchemaNode {
3
+ tag: string | Component;
4
+ attrs?: Record<string, any>;
5
+ children?: JsonSchemaNode | JsonSchemaNode[] | string;
6
+ slots?: Record<string, SlotContent>;
7
+ }
8
+ export type SlotContent = string | JsonSchemaNode | JsonSchemaNode[] | ((slotProps?: any) => SlotContent);
9
+ export interface IJsonAdaptorResult {
10
+ props: Record<string, any>;
11
+ skip?: boolean;
12
+ nodes?: JsonSchemaNode[];
13
+ }
14
+ export interface IJsonAdaptor {
15
+ name: string;
16
+ priority: number;
17
+ process: (node: JsonSchemaNode, props: Record<string, any>) => IJsonAdaptorResult | null;
18
+ }
19
+ export interface JsonAdaptorOptions {
20
+ adaptors?: IJsonAdaptor[];
21
+ }
22
+ export type EventModifier = 'prevent' | 'stop' | 'once' | 'capture' | 'self' | 'passive';
23
+ export interface VForConfig {
24
+ list: any[];
25
+ item?: string;
26
+ index?: string;
27
+ }
28
+ export type VModelBinding = [object, string] | [() => any, (val: any) => void];
@@ -0,0 +1,34 @@
1
+ /**
2
+ * 合并父子上下文
3
+ */
4
+ export declare function mergeContext(parentContext: Record<string, any>, childContext: Record<string, any>): Record<string, any>;
5
+ /**
6
+ * 从属性中提取上下文
7
+ */
8
+ export declare function extractContext(props: Record<string, any>): Record<string, any>;
9
+ /**
10
+ * 注入上下文到属性
11
+ */
12
+ export declare function injectContext(props: Record<string, any>, context: Record<string, any>): Record<string, any>;
13
+ /**
14
+ * 清理属性中的内部字段
15
+ */
16
+ export declare function cleanProps(props: Record<string, any>): Record<string, any>;
17
+ /**
18
+ * 创建适配器处理结果
19
+ */
20
+ export declare function createAdaptorResult(props: Record<string, any>, options?: {
21
+ skip?: boolean;
22
+ nodes?: any[];
23
+ cleanKeys?: string[];
24
+ }): {
25
+ props: {
26
+ [x: string]: any;
27
+ };
28
+ skip: boolean | undefined;
29
+ nodes: any[] | undefined;
30
+ };
31
+ /**
32
+ * 通用条件求值函数
33
+ */
34
+ export declare function evaluateCondition(value: any, context: Record<string, any>, evaluateExpression: (expr: string, ctx: Record<string, any>) => any): boolean;
@@ -0,0 +1,10 @@
1
+ import jsep from 'jsep';
2
+ export declare function parseExpression(expression: string): jsep.Expression | null;
3
+ export declare function evaluateExpression(expression: string, context: Record<string, any>): any;
4
+ export interface VForParseResult {
5
+ items: any[];
6
+ itemName: string;
7
+ indexName: string;
8
+ }
9
+ export declare function parseVForExpression(expression: string, context: Record<string, any>): VForParseResult;
10
+ export declare function extractVariables(ast: jsep.Expression): string[];
@@ -0,0 +1,2 @@
1
+ import type { IJsonAdaptor } from './types';
2
+ export declare const vForAdaptor: IJsonAdaptor;
@@ -0,0 +1,2 @@
1
+ import type { IJsonAdaptor } from './types';
2
+ export declare const vIfAdaptor: IJsonAdaptor;
@@ -0,0 +1,2 @@
1
+ import type { IJsonAdaptor } from './types';
2
+ export declare const vModelAdaptor: IJsonAdaptor;
@@ -0,0 +1,2 @@
1
+ import type { IJsonAdaptor } from './types';
2
+ export declare const vOnAdaptor: IJsonAdaptor;
@@ -0,0 +1,2 @@
1
+ import type { IJsonAdaptor } from './types';
2
+ export declare const vShowAdaptor: IJsonAdaptor;
@@ -0,0 +1,2 @@
1
+ import type { IJsonAdaptor } from './types';
2
+ export declare const vTextAdaptor: IJsonAdaptor;
@@ -0,0 +1,15 @@
1
+ import type { Ref } from 'vue';
2
+ import type { JsonAdaptorOptions, JsonSchemaNode } from './json/index';
3
+ type JsonSchemaData = JsonSchemaNode[] | Ref<JsonSchemaNode[]>;
4
+ export interface UseJsonSchemaProps extends JsonAdaptorOptions {
5
+ data: JsonSchemaData;
6
+ components?: Record<string, any>;
7
+ context?: Record<string, any> | Ref<Record<string, any>>;
8
+ }
9
+ /**
10
+ * JSON Schema 渲染器
11
+ */
12
+ export declare function useJsonSchema(props: UseJsonSchemaProps): {
13
+ render: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
14
+ };
15
+ export {};
@@ -57,6 +57,7 @@ export interface ThemeConfig {
57
57
  export declare function useTheme(): {
58
58
  toggle: (n?: number) => "light" | "dark" | "auto";
59
59
  mode: import("vue").ShallowRef<"light" | "dark" | "auto">;
60
+ setMode: (mode: "dark" | "light" | "auto") => void;
60
61
  isDark: import("vue").ComputedRef<boolean>;
61
62
  resources: import("vue").ComputedRef<ITheme>;
62
63
  config: {
@@ -244,6 +245,8 @@ export declare function useTheme(): {
244
245
  readonly gray: ThemeColorName;
245
246
  }>>;
246
247
  colors: import("vue").ComputedRef<string[]>;
248
+ neutralColors: import("vue").ComputedRef<string[]>;
249
+ primaryColors: import("vue").ComputedRef<string[]>;
247
250
  colorShades: ThemeColorShade[];
248
251
  colorTypes: ThemeColorType[];
249
252
  colorScenes: ThemeSceneType[];
@@ -251,7 +254,7 @@ export declare function useTheme(): {
251
254
  cssReset: () => void;
252
255
  setColor: (type: ThemeColorType, colorName: ThemeColorName) => void;
253
256
  setColors: (mappings: Partial<Record<ThemeColorType, ThemeColorName>>) => void;
254
- getSceneColor: (type: ThemeColorType, scene?: ThemeSceneType) => string;
255
- getShadeColor: (type: ThemeColorType, shade: ThemeColorShade) => string;
256
- getSemanticColor: (category: keyof ThemeColorSemanticConfig, key: string) => string;
257
+ getSceneColor: (type: ThemeColorType, scene?: ThemeSceneType, asVariable?: boolean) => string;
258
+ getShadeColor: (type: ThemeColorType, shade: ThemeColorShade, asVariable?: boolean) => string;
259
+ getSemanticColor: (category: keyof ThemeColorSemanticConfig, key: string, asVariable?: boolean) => string;
257
260
  };
@@ -1,7 +1,7 @@
1
1
  export declare function themePreset(themeColor: Record<string, any>): {
2
2
  colors: Record<string, Record<string, any>>;
3
3
  classes: {
4
- text: {
4
+ 'text-default': {
5
5
  color: string;
6
6
  };
7
7
  'text-dimmed': {
@@ -19,7 +19,7 @@ export declare function themePreset(themeColor: Record<string, any>): {
19
19
  'text-inverted': {
20
20
  color: string;
21
21
  };
22
- bg: {
22
+ 'bg-default': {
23
23
  'background-color': string;
24
24
  };
25
25
  'bg-muted': {
@@ -34,7 +34,7 @@ export declare function themePreset(themeColor: Record<string, any>): {
34
34
  'bg-inverted': {
35
35
  'background-color': string;
36
36
  };
37
- border: {
37
+ 'border-default': {
38
38
  'border-color': string;
39
39
  };
40
40
  'border-muted': {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@duxweb/dvha-core",
3
3
  "type": "module",
4
- "version": "0.1.17",
4
+ "version": "0.1.19",
5
5
  "author": "DuxWeb",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -39,8 +39,8 @@
39
39
  "dependencies": {
40
40
  "@overlastic/vue": "^0.8.1",
41
41
  "@tanstack/vue-query": "^5.76.2",
42
- "@vueuse/core": "^13.0.0",
43
- "@vueuse/integrations": "^13.0.0",
42
+ "@vueuse/core": "^13.3.0",
43
+ "@vueuse/integrations": "^13.3.0",
44
44
  "axios": "^1.9.0",
45
45
  "clsx": "^2.1.1",
46
46
  "colorizr": "^3.0.8",