index.d.mts 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542
  1. import * as vue from 'vue';
  2. import { ComponentPropsOptions, ExtractPropTypes, VNodeChild, VNode, ComponentInternalInstance, Ref, ComputedRef, PropType, ComponentPublicInstance, FunctionalComponent } from 'vue';
  3. type SlotsToProps<U extends RawSlots, T = MakeInternalSlots<U>> = {
  4. $children?: (VNodeChild | (T extends {
  5. default: infer V;
  6. } ? V : {}) | {
  7. [K in keyof T]?: T[K];
  8. });
  9. 'v-slots'?: {
  10. [K in keyof T]?: T[K] | false;
  11. };
  12. } & {
  13. [K in keyof T as `v-slot:${K & string}`]?: T[K] | false;
  14. };
  15. type RawSlots = Record<string, unknown>;
  16. type Slot<T> = [T] extends [never] ? () => VNodeChild : (arg: T) => VNodeChild;
  17. type VueSlot<T> = [T] extends [never] ? () => VNode[] : (arg: T) => VNode[];
  18. type MakeInternalSlots<T extends RawSlots> = {
  19. [K in keyof T]: Slot<T[K]>;
  20. };
  21. type MakeSlots<T extends RawSlots> = {
  22. [K in keyof T]: VueSlot<T[K]>;
  23. };
  24. type GenericProps<Props, Slots extends Record<string, unknown>> = {
  25. $props: Props & SlotsToProps<Slots>;
  26. $slots: MakeSlots<Slots>;
  27. };
  28. interface FilterPropsOptions<PropsOptions extends Readonly<ComponentPropsOptions>, Props = ExtractPropTypes<PropsOptions>> {
  29. filterProps<T extends Partial<Props>, U extends Exclude<keyof Props, Exclude<keyof Props, keyof T>>>(props: T): Partial<Pick<T, U>>;
  30. }
  31. type ClassValue = any;
  32. interface GroupItem {
  33. id: number;
  34. value: Ref<unknown>;
  35. disabled: Ref<boolean | undefined>;
  36. useIndexAsValue?: boolean;
  37. }
  38. interface GroupProvide {
  39. register: (item: GroupItem, cmp: ComponentInternalInstance) => void;
  40. unregister: (id: number) => void;
  41. select: (id: number, value: boolean) => void;
  42. selected: Ref<Readonly<number[]>>;
  43. isSelected: (id: number) => boolean;
  44. prev: () => void;
  45. next: () => void;
  46. selectedClass: Ref<string | undefined>;
  47. items: ComputedRef<{
  48. id: number;
  49. value: unknown;
  50. disabled: boolean | undefined;
  51. }[]>;
  52. disabled: Ref<boolean | undefined>;
  53. getItemIndex: (value: unknown) => number;
  54. }
  55. interface GroupItemProvide {
  56. id: number;
  57. isSelected: Ref<boolean>;
  58. isFirst: Ref<boolean>;
  59. isLast: Ref<boolean>;
  60. toggle: () => void;
  61. select: (value: boolean) => void;
  62. selectedClass: Ref<(string | undefined)[] | false>;
  63. value: Ref<unknown>;
  64. disabled: Ref<boolean | undefined>;
  65. group: GroupProvide;
  66. }
  67. type JSXComponent<Props = any> = {
  68. new (): ComponentPublicInstance<Props>;
  69. } | FunctionalComponent<Props>;
  70. type IconValue = string | (string | [path: string, opacity: number])[] | JSXComponent;
  71. declare const IconValue: PropType<IconValue>;
  72. interface TouchHandlers {
  73. start?: (wrapperEvent: {
  74. originalEvent: TouchEvent;
  75. } & TouchData) => void;
  76. end?: (wrapperEvent: {
  77. originalEvent: TouchEvent;
  78. } & TouchData) => void;
  79. move?: (wrapperEvent: {
  80. originalEvent: TouchEvent;
  81. } & TouchData) => void;
  82. left?: (wrapper: TouchData) => void;
  83. right?: (wrapper: TouchData) => void;
  84. up?: (wrapper: TouchData) => void;
  85. down?: (wrapper: TouchData) => void;
  86. }
  87. interface TouchData {
  88. touchstartX: number;
  89. touchstartY: number;
  90. touchmoveX: number;
  91. touchmoveY: number;
  92. touchendX: number;
  93. touchendY: number;
  94. offsetX: number;
  95. offsetY: number;
  96. }
  97. type VWindowSlots = {
  98. default: {
  99. group: GroupProvide;
  100. };
  101. additional: {
  102. group: GroupProvide;
  103. };
  104. prev: {
  105. props: ControlProps;
  106. };
  107. next: {
  108. props: ControlProps;
  109. };
  110. };
  111. type ControlProps = {
  112. icon: IconValue;
  113. class: string;
  114. onClick: () => void;
  115. 'aria-label': string;
  116. };
  117. declare const VWindow: {
  118. new (...args: any[]): vue.CreateComponentPublicInstance<{
  119. reverse: boolean;
  120. direction: "horizontal" | "vertical";
  121. style: vue.StyleValue;
  122. disabled: boolean;
  123. tag: string;
  124. mandatory: boolean | "force";
  125. selectedClass: string;
  126. nextIcon: IconValue;
  127. prevIcon: IconValue;
  128. continuous: boolean;
  129. } & {
  130. class?: any;
  131. theme?: string | undefined;
  132. touch?: boolean | TouchHandlers | undefined;
  133. showArrows?: string | boolean | undefined;
  134. } & {}, {
  135. group: GroupProvide;
  136. }, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, Omit<{
  137. 'update:modelValue': (value: any) => true;
  138. }, "$children" | "v-slots" | "v-slot:default" | "modelValue" | "v-slot:additional" | "update:modelValue" | "v-slot:next" | "v-slot:prev">, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps & {
  139. reverse: boolean;
  140. direction: "horizontal" | "vertical";
  141. style: vue.StyleValue;
  142. disabled: boolean;
  143. tag: string;
  144. mandatory: boolean | "force";
  145. selectedClass: string;
  146. nextIcon: IconValue;
  147. prevIcon: IconValue;
  148. continuous: boolean;
  149. } & {
  150. class?: any;
  151. theme?: string | undefined;
  152. touch?: boolean | TouchHandlers | undefined;
  153. showArrows?: string | boolean | undefined;
  154. } & {}, {
  155. reverse: boolean;
  156. direction: "horizontal" | "vertical";
  157. style: vue.StyleValue;
  158. disabled: boolean;
  159. tag: string;
  160. mandatory: boolean | "force";
  161. touch: boolean | TouchHandlers;
  162. selectedClass: string;
  163. nextIcon: IconValue;
  164. prevIcon: IconValue;
  165. continuous: boolean;
  166. }, true, {}, vue.SlotsType<Partial<{
  167. default: (arg: {
  168. group: GroupProvide;
  169. }) => vue.VNode[];
  170. additional: (arg: {
  171. group: GroupProvide;
  172. }) => vue.VNode[];
  173. prev: (arg: {
  174. props: ControlProps;
  175. }) => vue.VNode[];
  176. next: (arg: {
  177. props: ControlProps;
  178. }) => vue.VNode[];
  179. }>>, {
  180. P: {};
  181. B: {};
  182. D: {};
  183. C: {};
  184. M: {};
  185. Defaults: {};
  186. }, {
  187. reverse: boolean;
  188. direction: "horizontal" | "vertical";
  189. style: vue.StyleValue;
  190. disabled: boolean;
  191. tag: string;
  192. mandatory: boolean | "force";
  193. selectedClass: string;
  194. nextIcon: IconValue;
  195. prevIcon: IconValue;
  196. continuous: boolean;
  197. } & {
  198. class?: any;
  199. theme?: string | undefined;
  200. touch?: boolean | TouchHandlers | undefined;
  201. showArrows?: string | boolean | undefined;
  202. } & {}, {
  203. group: GroupProvide;
  204. }, {}, {}, {}, {
  205. reverse: boolean;
  206. direction: "horizontal" | "vertical";
  207. style: vue.StyleValue;
  208. disabled: boolean;
  209. tag: string;
  210. mandatory: boolean | "force";
  211. touch: boolean | TouchHandlers;
  212. selectedClass: string;
  213. nextIcon: IconValue;
  214. prevIcon: IconValue;
  215. continuous: boolean;
  216. }>;
  217. __isFragment?: never;
  218. __isTeleport?: never;
  219. __isSuspense?: never;
  220. } & vue.ComponentOptionsBase<{
  221. reverse: boolean;
  222. direction: "horizontal" | "vertical";
  223. style: vue.StyleValue;
  224. disabled: boolean;
  225. tag: string;
  226. mandatory: boolean | "force";
  227. selectedClass: string;
  228. nextIcon: IconValue;
  229. prevIcon: IconValue;
  230. continuous: boolean;
  231. } & {
  232. class?: any;
  233. theme?: string | undefined;
  234. touch?: boolean | TouchHandlers | undefined;
  235. showArrows?: string | boolean | undefined;
  236. } & {}, {
  237. group: GroupProvide;
  238. }, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, Omit<{
  239. 'update:modelValue': (value: any) => true;
  240. }, "$children" | "v-slots" | "v-slot:default" | "modelValue" | "v-slot:additional" | "update:modelValue" | "v-slot:next" | "v-slot:prev">, string, {
  241. reverse: boolean;
  242. direction: "horizontal" | "vertical";
  243. style: vue.StyleValue;
  244. disabled: boolean;
  245. tag: string;
  246. mandatory: boolean | "force";
  247. touch: boolean | TouchHandlers;
  248. selectedClass: string;
  249. nextIcon: IconValue;
  250. prevIcon: IconValue;
  251. continuous: boolean;
  252. }, {}, string, vue.SlotsType<Partial<{
  253. default: (arg: {
  254. group: GroupProvide;
  255. }) => vue.VNode[];
  256. additional: (arg: {
  257. group: GroupProvide;
  258. }) => vue.VNode[];
  259. prev: (arg: {
  260. props: ControlProps;
  261. }) => vue.VNode[];
  262. next: (arg: {
  263. props: ControlProps;
  264. }) => vue.VNode[];
  265. }>>> & vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps & (new <T>(props: {
  266. modelValue?: T;
  267. "onUpdate:modelValue"?: (value: T) => void;
  268. }, slots: VWindowSlots) => GenericProps<typeof props, typeof slots>) & FilterPropsOptions<{
  269. theme: StringConstructor;
  270. tag: {
  271. type: StringConstructor;
  272. default: string;
  273. };
  274. class: PropType<ClassValue>;
  275. style: {
  276. type: PropType<vue.StyleValue>;
  277. default: null;
  278. };
  279. continuous: BooleanConstructor;
  280. nextIcon: {
  281. type: PropType<IconValue>;
  282. default: string;
  283. };
  284. prevIcon: {
  285. type: PropType<IconValue>;
  286. default: string;
  287. };
  288. reverse: BooleanConstructor;
  289. showArrows: {
  290. type: (StringConstructor | BooleanConstructor)[];
  291. validator: (v: any) => boolean;
  292. };
  293. touch: {
  294. type: PropType<boolean | TouchHandlers>;
  295. default: undefined;
  296. };
  297. direction: {
  298. type: PropType<"horizontal" | "vertical">;
  299. default: string;
  300. };
  301. modelValue: null;
  302. disabled: BooleanConstructor;
  303. selectedClass: {
  304. type: StringConstructor;
  305. default: string;
  306. };
  307. mandatory: {
  308. type: PropType<boolean | "force">;
  309. default: "force";
  310. };
  311. }, vue.ExtractPropTypes<{
  312. theme: StringConstructor;
  313. tag: {
  314. type: StringConstructor;
  315. default: string;
  316. };
  317. class: PropType<ClassValue>;
  318. style: {
  319. type: PropType<vue.StyleValue>;
  320. default: null;
  321. };
  322. continuous: BooleanConstructor;
  323. nextIcon: {
  324. type: PropType<IconValue>;
  325. default: string;
  326. };
  327. prevIcon: {
  328. type: PropType<IconValue>;
  329. default: string;
  330. };
  331. reverse: BooleanConstructor;
  332. showArrows: {
  333. type: (StringConstructor | BooleanConstructor)[];
  334. validator: (v: any) => boolean;
  335. };
  336. touch: {
  337. type: PropType<boolean | TouchHandlers>;
  338. default: undefined;
  339. };
  340. direction: {
  341. type: PropType<"horizontal" | "vertical">;
  342. default: string;
  343. };
  344. modelValue: null;
  345. disabled: BooleanConstructor;
  346. selectedClass: {
  347. type: StringConstructor;
  348. default: string;
  349. };
  350. mandatory: {
  351. type: PropType<boolean | "force">;
  352. default: "force";
  353. };
  354. }>>;
  355. type VWindow = InstanceType<typeof VWindow>;
  356. declare const VWindowItem: {
  357. new (...args: any[]): vue.CreateComponentPublicInstance<{
  358. style: vue.StyleValue;
  359. eager: boolean;
  360. disabled: boolean;
  361. } & {
  362. transition?: string | boolean | undefined;
  363. value?: any;
  364. class?: any;
  365. selectedClass?: string | undefined;
  366. reverseTransition?: string | boolean | undefined;
  367. } & {
  368. $children?: vue.VNodeChild | {
  369. default?: (() => vue.VNodeChild) | undefined;
  370. } | (() => vue.VNodeChild);
  371. 'v-slots'?: {
  372. default?: false | (() => vue.VNodeChild) | undefined;
  373. } | undefined;
  374. } & {
  375. "v-slot:default"?: false | (() => vue.VNodeChild) | undefined;
  376. } & {
  377. "onGroup:selected"?: ((val: {
  378. value: boolean;
  379. }) => any) | undefined;
  380. }, {
  381. groupItem: GroupItemProvide;
  382. }, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
  383. 'group:selected': (val: {
  384. value: boolean;
  385. }) => true;
  386. }, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps & {
  387. style: vue.StyleValue;
  388. eager: boolean;
  389. disabled: boolean;
  390. } & {
  391. transition?: string | boolean | undefined;
  392. value?: any;
  393. class?: any;
  394. selectedClass?: string | undefined;
  395. reverseTransition?: string | boolean | undefined;
  396. } & {
  397. $children?: vue.VNodeChild | {
  398. default?: (() => vue.VNodeChild) | undefined;
  399. } | (() => vue.VNodeChild);
  400. 'v-slots'?: {
  401. default?: false | (() => vue.VNodeChild) | undefined;
  402. } | undefined;
  403. } & {
  404. "v-slot:default"?: false | (() => vue.VNodeChild) | undefined;
  405. } & {
  406. "onGroup:selected"?: ((val: {
  407. value: boolean;
  408. }) => any) | undefined;
  409. }, {
  410. transition: string | boolean;
  411. style: vue.StyleValue;
  412. eager: boolean;
  413. disabled: boolean;
  414. reverseTransition: string | boolean;
  415. }, true, {}, vue.SlotsType<Partial<{
  416. default: () => vue.VNode[];
  417. }>>, {
  418. P: {};
  419. B: {};
  420. D: {};
  421. C: {};
  422. M: {};
  423. Defaults: {};
  424. }, {
  425. style: vue.StyleValue;
  426. eager: boolean;
  427. disabled: boolean;
  428. } & {
  429. transition?: string | boolean | undefined;
  430. value?: any;
  431. class?: any;
  432. selectedClass?: string | undefined;
  433. reverseTransition?: string | boolean | undefined;
  434. } & {
  435. $children?: vue.VNodeChild | {
  436. default?: (() => vue.VNodeChild) | undefined;
  437. } | (() => vue.VNodeChild);
  438. 'v-slots'?: {
  439. default?: false | (() => vue.VNodeChild) | undefined;
  440. } | undefined;
  441. } & {
  442. "v-slot:default"?: false | (() => vue.VNodeChild) | undefined;
  443. } & {
  444. "onGroup:selected"?: ((val: {
  445. value: boolean;
  446. }) => any) | undefined;
  447. }, {
  448. groupItem: GroupItemProvide;
  449. }, {}, {}, {}, {
  450. transition: string | boolean;
  451. style: vue.StyleValue;
  452. eager: boolean;
  453. disabled: boolean;
  454. reverseTransition: string | boolean;
  455. }>;
  456. __isFragment?: never;
  457. __isTeleport?: never;
  458. __isSuspense?: never;
  459. } & vue.ComponentOptionsBase<{
  460. style: vue.StyleValue;
  461. eager: boolean;
  462. disabled: boolean;
  463. } & {
  464. transition?: string | boolean | undefined;
  465. value?: any;
  466. class?: any;
  467. selectedClass?: string | undefined;
  468. reverseTransition?: string | boolean | undefined;
  469. } & {
  470. $children?: vue.VNodeChild | {
  471. default?: (() => vue.VNodeChild) | undefined;
  472. } | (() => vue.VNodeChild);
  473. 'v-slots'?: {
  474. default?: false | (() => vue.VNodeChild) | undefined;
  475. } | undefined;
  476. } & {
  477. "v-slot:default"?: false | (() => vue.VNodeChild) | undefined;
  478. } & {
  479. "onGroup:selected"?: ((val: {
  480. value: boolean;
  481. }) => any) | undefined;
  482. }, {
  483. groupItem: GroupItemProvide;
  484. }, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
  485. 'group:selected': (val: {
  486. value: boolean;
  487. }) => true;
  488. }, string, {
  489. transition: string | boolean;
  490. style: vue.StyleValue;
  491. eager: boolean;
  492. disabled: boolean;
  493. reverseTransition: string | boolean;
  494. }, {}, string, vue.SlotsType<Partial<{
  495. default: () => vue.VNode[];
  496. }>>> & vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps & FilterPropsOptions<{
  497. eager: BooleanConstructor;
  498. value: null;
  499. disabled: BooleanConstructor;
  500. selectedClass: StringConstructor;
  501. class: vue.PropType<ClassValue>;
  502. style: {
  503. type: vue.PropType<vue.StyleValue>;
  504. default: null;
  505. };
  506. reverseTransition: {
  507. type: (StringConstructor | BooleanConstructor)[];
  508. default: undefined;
  509. };
  510. transition: {
  511. type: (StringConstructor | BooleanConstructor)[];
  512. default: undefined;
  513. };
  514. }, vue.ExtractPropTypes<{
  515. eager: BooleanConstructor;
  516. value: null;
  517. disabled: BooleanConstructor;
  518. selectedClass: StringConstructor;
  519. class: vue.PropType<ClassValue>;
  520. style: {
  521. type: vue.PropType<vue.StyleValue>;
  522. default: null;
  523. };
  524. reverseTransition: {
  525. type: (StringConstructor | BooleanConstructor)[];
  526. default: undefined;
  527. };
  528. transition: {
  529. type: (StringConstructor | BooleanConstructor)[];
  530. default: undefined;
  531. };
  532. }>>;
  533. type VWindowItem = InstanceType<typeof VWindowItem>;
  534. export { VWindow, VWindowItem };