@opendesign-plus-test/composables 0.0.1-rc.4 → 0.0.1-rc.5

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.
@@ -0,0 +1,12 @@
1
+ import { InjectionKey, MaybeRef, WatchSource } from 'vue';
2
+ type BubbleData = Record<string | symbol, any>;
3
+ type DataSource<T = any> = MaybeRef<BubbleData> | ((val?: T | Event, old?: T) => Promise<BubbleData> | BubbleData);
4
+ type ConfigOptions = {
5
+ key?: InjectionKey<any> | string;
6
+ bubble?: boolean;
7
+ catchBubble?: boolean;
8
+ };
9
+ export declare function useWatchAnalytics<T = any>(watchSource: WatchSource<T>, dataSource: DataSource<T>, options?: ConfigOptions): void;
10
+ export declare function useElementEventAnalytics<T = any>(el: MaybeRef<HTMLElement>, event: string, dataSource: DataSource<T>, options?: ConfigOptions): void;
11
+ export declare function useAnalytics<DS = any>(dataSource: DataSource<DS>, options: ConfigOptions): void;
12
+ export {};
@@ -0,0 +1,9 @@
1
+ import { MaybeRefOrGetter } from 'vue';
2
+ export declare const useCheckbox: <T>(datasource: MaybeRefOrGetter<T[]>, cbValueExtractor: (item: T) => string | number) => {
3
+ checkboxes: import('vue').Ref<(string | number)[], (string | number)[]>;
4
+ indeterminate: import('vue').Ref<boolean, boolean>;
5
+ parentCheckbox: import('vue').Ref<(string | number)[], (string | number)[]>;
6
+ isCheckedAll: import('vue').ComputedRef<boolean>;
7
+ clearCheckboxes: () => void;
8
+ checkAll: () => void;
9
+ };
@@ -2,7 +2,7 @@ import { MarkdownItAsyncOptions } from 'markdown-it-async';
2
2
  import { BundledLanguage, BundledTheme } from 'shiki';
3
3
  export type * from 'markdown-it-async';
4
4
  export type * from 'shiki';
5
- export interface UseMdOptions extends MarkdownItAsyncOptions {
5
+ export interface UseMdOptionsT extends MarkdownItAsyncOptions {
6
6
  anchor?: boolean;
7
7
  anchorType?: 'vitepress' | 'github';
8
8
  copy?: boolean;
@@ -17,7 +17,7 @@ export interface UseMdOptions extends MarkdownItAsyncOptions {
17
17
  * @param options - 配置选项
18
18
  * @returns 返回一个对象可解构出 shiki 实例和 markdown-it 实例
19
19
  */
20
- export declare function useMdRender(options?: UseMdOptions): Promise<{
20
+ export declare function useMdRender(options?: UseMdOptionsT): Promise<{
21
21
  shiki: import('shiki').HighlighterGeneric<BundledLanguage, BundledTheme>;
22
22
  markdwon: import('markdown-it-async').MarkdownItAsync;
23
23
  }>;
@@ -0,0 +1,4 @@
1
+ import { OScroller } from '@opensig/opendesign';
2
+ import { Ref } from 'vue';
3
+ declare const useScrollBottom: (scrollerRef: Ref<InstanceType<typeof OScroller>>, callback: () => void) => void;
4
+ export default useScrollBottom;
@@ -1,19 +1,37 @@
1
+ import { ComputedRef, Plugin } from 'vue';
1
2
  /**
2
- * 初始化主题,建议在 vue 应用初始化前调用
3
- * @param storageKey - 用于存储主题偏好设置的键名
4
- * @param cookieDomain - Cookie 的作用域域名
3
+ * 创建主题配置项
4
+ * @param options - 配置项
5
+ * @param options.cookieKey - cookie 键名
6
+ * @param options.cookieDomain - cookie 域
7
+ * @param options.lightValue - 浅色主题值
8
+ * @param options.darkValue - 深色主题值
9
+ * @param options.attribute - 属性名
10
+ * @param options.attributeLightValue - 浅色主题属性值
11
+ * @param options.attributeDarkValue - 深色主题属性值
12
+ * @param options.classLightValue - 浅色主题类名
13
+ * @param options.classDarkValue - 深色主题类名
14
+ * @returns theme 插件实例
5
15
  */
6
- export declare function initTheme(storageKey: string, cookieDomain: string): void;
16
+ export declare function createTheme<ThemeValue = 'dark | light'>(options?: {
17
+ cookieKey: string;
18
+ cookieDomain: string;
19
+ lightValue?: string;
20
+ darkValue?: string;
21
+ attribute?: string;
22
+ attributeLightValue?: string;
23
+ attributeDarkValue?: string;
24
+ classLightValue?: string;
25
+ classDarkValue?: string;
26
+ }): Plugin;
7
27
  /**
8
28
  * 主题切换组合式函数
9
- * @param storageKey - 用于存储主题偏好设置的键名,若调用过 initTheme 可不传
10
- * @param cookieDomain - Cookie 的作用域域名,若调用过 initTheme 可不传
11
29
  * @returns 包含当前主题状态和操作方法的对象
12
30
  */
13
- export declare function useTheme(storageKey?: string, cookieDomain?: string): {
14
- theme: import('vue').ComputedRef<"light" | "dark">;
15
- isLight: import('vue').ComputedRef<boolean>;
16
- isDark: import('vue').ComputedRef<boolean>;
17
- setTheme: (newTheme: "light" | "dark") => void;
18
- toggleTheme: () => void;
31
+ export declare function useTheme<ThemeValue = 'dark | light'>(): {
32
+ theme: ComputedRef<ThemeValue> | undefined;
33
+ isLight: ComputedRef<boolean> | undefined;
34
+ isDark: ComputedRef<boolean> | undefined;
35
+ setTheme: ((val: ThemeValue) => void) | undefined;
36
+ toggleTheme: (() => void) | undefined;
19
37
  };
package/dist/index.d.ts CHANGED
@@ -3,3 +3,4 @@ export * from './core/useScreen';
3
3
  export * from './core/useLocale';
4
4
  export * from './core/useTheme';
5
5
  export * from './core/useClipboard';
6
+ export * from './analytics/useAnalytics';