@moubing/bing-ui 0.6.0 → 0.7.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.
@@ -1,10 +1,10 @@
1
- import { BingCursorProps, BingCursorSlotProps } from './BingCursor.types';
1
+ import { BingCursorProps, BingCursorType } from './BingCursor.types';
2
2
  interface CursorOwner {
3
3
  root: HTMLElement;
4
4
  options: () => BingCursorProps;
5
- show: (state: Omit<BingCursorSlotProps, 'size'>, x: number, y: number) => boolean;
6
- move: (x: number, y: number) => void;
5
+ show: (type: BingCursorType) => void;
7
6
  hide: () => void;
7
+ nativeCursor: (type: BingCursorType) => string | undefined;
8
8
  }
9
9
  export declare function registerCursor(owner: CursorOwner): {
10
10
  refresh: () => void;
@@ -0,0 +1,3 @@
1
+ import { BingCursorType } from './BingCursor.types';
2
+ /** 只在外观变化时生成图片;鼠标位置完全交给浏览器的 cursor 管线。 */
3
+ export declare function createNativeCursor(type: BingCursorType, size: number, color: string, outline: string, hotspot?: readonly [number, number]): string;
@@ -1,11 +1,10 @@
1
1
  import { BingCursorType } from './BingCursor.types';
2
2
  export interface CursorPath {
3
3
  d: string;
4
- /** 1 为主色,0 为描边色;形变时同步插值这两个颜色。 */
4
+ /** 1 为主色,0 为描边色。 */
5
5
  ink: number;
6
6
  outline: number;
7
7
  strokeWidth: number;
8
- opacity: number;
9
8
  }
10
- /** 预览与鼠标共用相同的四层路径:主体轮廓和三个细节,始终保持节点身份。 */
9
+ /** 预览与原生光标图片共用的静态路径。 */
11
10
  export declare const cursorShapes: Record<BingCursorType, readonly CursorPath[]>;
@@ -1,5 +1,5 @@
1
1
  /** 将原 cursor 声明映射到私有变量,让浏览器继续处理选择器、优先级和继承。 */
2
2
  export declare function createCursorStyleSource(doc: Document): {
3
- read(target: Element): string;
3
+ read(target: Element, scanRules?: boolean): string;
4
4
  destroy(): void;
5
5
  };
@@ -1,11 +1,8 @@
1
1
  import { VNode } from 'vue';
2
2
  export type BingCursorType = 'default' | 'pointer' | 'not-allowed' | 'text' | 'grab' | 'grabbing' | 'move' | 'crosshair' | 'col-resize' | 'row-resize' | 'ew-resize' | 'ns-resize' | 'nwse-resize' | 'nesw-resize' | 'zoom-in' | 'zoom-out';
3
- export type BingCursorMode = 'replace' | 'follow';
4
3
  export interface BingCursorProps {
5
4
  /** 自动识别元素的 CSS cursor 和交互语义,也可固定一种光标。 */
6
5
  type?: BingCursorType | 'auto';
7
- /** replace 使用自定义光标;follow 保留原生光标并显示跟随圆环。 */
8
- mode?: BingCursorMode;
9
6
  /** 默认只作用于默认插槽的内容;开启后作用于当前文档。 */
10
7
  global?: boolean;
11
8
  disabled?: boolean;
@@ -13,25 +10,11 @@ export interface BingCursorProps {
13
10
  size?: number;
14
11
  color?: string;
15
12
  outlineColor?: string;
16
- /** 自定义插槽的点击热点,相对于插槽左上角,单位 px */
13
+ /** 点击热点,相对于光标左上角,单位 px;原生渲染会取整并限制在画布内。 */
17
14
  hotspot?: readonly [number, number];
18
- /** 仅跟随模式使用,单位秒;替换模式始终精确定位。 */
19
- followDuration?: number;
20
- /** 内置 SVG 轮廓形变与自定义提示的过渡时长,单位秒,默认 0.24;设为 0 关闭。 */
21
- transitionDuration?: number;
22
- zIndex?: number;
23
- }
24
- export interface BingCursorSlotProps {
25
- type: BingCursorType;
26
- pressed: boolean;
27
- size: number;
28
- /** 来自当前元素或祖先的 data-bing-cursor-label。 */
29
- label: string;
30
- target: Element | null;
31
15
  }
32
16
  export interface BingCursorSlots {
33
17
  default?: () => VNode[];
34
- cursor?: (props: BingCursorSlotProps) => VNode[];
35
18
  }
36
19
  export interface BingCursorEmits {
37
20
  change: [type: BingCursorType];
@@ -8,13 +8,9 @@ declare const __VLS_base: import('vue').DefineComponent<BingCursorProps, {}, {},
8
8
  "onVisibility-change"?: ((visible: boolean) => any) | undefined;
9
9
  }>, {
10
10
  disabled: boolean;
11
- transitionDuration: number;
12
- zIndex: number;
13
11
  type: BingCursorType | "auto";
14
- mode: import('./BingCursor.types').BingCursorMode;
15
12
  size: number;
16
13
  global: boolean;
17
- followDuration: number;
18
14
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
19
15
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
20
16
  declare const _default: typeof __VLS_export;
@@ -1,2 +1,2 @@
1
1
  export { default as BingCursor } from './BingCursor.vue';
2
- export type { BingCursorEmits, BingCursorMode, BingCursorProps, BingCursorSlotProps, BingCursorSlots, BingCursorType, } from './BingCursor.types';
2
+ export type { BingCursorEmits, BingCursorProps, BingCursorSlots, BingCursorType, } from './BingCursor.types';
@@ -0,0 +1,11 @@
1
+ import { InjectionKey, Ref } from 'vue';
2
+ type CommitMeasurement = () => void;
3
+ type ReadMeasurement = () => CommitMeasurement | undefined;
4
+ export interface BingTableMeasurements {
5
+ register: (element: HTMLElement, read: ReadMeasurement) => () => void;
6
+ invalidate: (element?: HTMLElement | null) => void;
7
+ }
8
+ export declare const bingTableMeasurementsKey: InjectionKey<BingTableMeasurements>;
9
+ /** 同一张表共用监听器;一帧内先读完变化的单元格,再提交结果。 */
10
+ export declare function createTableMeasurements(root: Ref<HTMLElement | null>, readLayout?: (elements: HTMLElement[]) => CommitMeasurement | undefined): BingTableMeasurements;
11
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moubing/bing-ui",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public",
@@ -1,9 +0,0 @@
1
- import { BingCursorType } from './BingCursor.types';
2
- /** 把点击热点统一对齐到画布中心,轮廓形变不带动鼠标位置。 */
3
- export declare function alignCursorPaths(type: BingCursorType, hotspot: readonly [number, number], size: number): {
4
- d: string;
5
- ink: number;
6
- outline: number;
7
- strokeWidth: number;
8
- opacity: number;
9
- }[];
@@ -1,11 +0,0 @@
1
- import { BingCursorType } from './BingCursor.types';
2
- type __VLS_Props = {
3
- type: BingCursorType;
4
- size: number;
5
- hotspot: readonly [number, number];
6
- duration: number;
7
- active: boolean;
8
- };
9
- declare const __VLS_export: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
10
- declare const _default: typeof __VLS_export;
11
- export default _default;
@@ -1,28 +0,0 @@
1
- import { BingCursorMode, BingCursorSlotProps } from './BingCursor.types';
2
- type __VLS_Props = {
3
- state: BingCursorSlotProps;
4
- hotspot: readonly [number, number];
5
- duration: number;
6
- active: boolean;
7
- mode: BingCursorMode;
8
- custom: boolean;
9
- };
10
- declare var __VLS_1: {
11
- type: import('./BingCursor.types').BingCursorType;
12
- pressed: boolean;
13
- size: number;
14
- label: string;
15
- target: Element | null;
16
- };
17
- type __VLS_Slots = {} & {
18
- default?: (props: typeof __VLS_1) => any;
19
- };
20
- declare const __VLS_base: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
21
- declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
22
- declare const _default: typeof __VLS_export;
23
- export default _default;
24
- type __VLS_WithSlots<T, S> = T & {
25
- new (): {
26
- $slots: S;
27
- };
28
- };