@tb-dev/vue 0.3.32 → 0.3.34

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,42 @@
1
1
  import { InputProps } from './types';
2
- declare const _default: import('vue').DefineComponent<InputProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
2
+ import { Option } from '@tb-dev/utils';
3
+ declare function focus(): void;
4
+ declare function blur(): void;
5
+ declare function select(): void;
6
+ declare const _default: import('vue').DefineComponent<InputProps, {
7
+ inputEl: import('vue').ComputedRef<Option<HTMLInputElement>>;
8
+ focus: typeof focus;
9
+ blur: typeof blur;
10
+ select: typeof select;
11
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
3
12
  "update:modelValue": (value: string | null) => any;
4
13
  }, string, import('vue').PublicProps, Readonly<InputProps> & Readonly<{
5
14
  "onUpdate:modelValue"?: ((value: string | null) => any) | undefined;
6
15
  }>, {
7
16
  type: import('vue').InputTypeHTMLAttribute;
8
17
  spellcheck: boolean | "true" | "false";
9
- }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
18
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
19
+ baseInput: import('vue').CreateComponentPublicInstanceWithMixins<Readonly<{
20
+ defaultValue?: string | number;
21
+ modelValue?: string | number;
22
+ class?: import('vue').HTMLAttributes["class"];
23
+ }> & Readonly<{
24
+ "onUpdate:modelValue"?: ((payload: string | number) => any) | undefined;
25
+ }>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
26
+ "update:modelValue": (payload: string | number) => any;
27
+ }, import('vue').PublicProps, {}, false, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, HTMLInputElement, import('vue').ComponentProvideOptions, {
28
+ P: {};
29
+ B: {};
30
+ D: {};
31
+ C: {};
32
+ M: {};
33
+ Defaults: {};
34
+ }, Readonly<{
35
+ defaultValue?: string | number;
36
+ modelValue?: string | number;
37
+ class?: import('vue').HTMLAttributes["class"];
38
+ }> & Readonly<{
39
+ "onUpdate:modelValue"?: ((payload: string | number) => any) | undefined;
40
+ }>, {}, {}, {}, {}, {}> | null;
41
+ }, any>;
10
42
  export default _default;
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { cva } from 'class-variance-authority';
2
- import { inject as inject$1, toValue, defineComponent, computed, createBlock, openBlock, unref, mergeProps, withCtx, renderSlot, normalizeClass, createElementBlock, Fragment, createVNode, toDisplayString, resolveDynamicComponent, createCommentVNode, normalizeStyle, mergeModels, useModel, createElementVNode, createTextVNode, withDirectives, isRef, vModelText, normalizeProps, guardReactiveProps, useTemplateRef, ref, renderList, createSlots, toRef, effectScope } from 'vue';
2
+ import { inject as inject$1, toValue, defineComponent, computed, createBlock, openBlock, unref, mergeProps, withCtx, renderSlot, normalizeClass, createElementBlock, Fragment, createVNode, toDisplayString, resolveDynamicComponent, createCommentVNode, normalizeStyle, mergeModels, useModel, createElementVNode, createTextVNode, withDirectives, isRef, vModelText, useTemplateRef, normalizeProps, guardReactiveProps, ref, renderList, createSlots, toRef, effectScope } from 'vue';
3
3
  import { twMerge } from 'tailwind-merge';
4
4
  import { clsx } from 'clsx';
5
5
  import { unwrap, isNil, toPixel } from '@tb-dev/utils';
@@ -2371,20 +2371,37 @@ const _sfc_main$1T = /* @__PURE__ */ defineComponent({
2371
2371
  type: { default: "text" }
2372
2372
  },
2373
2373
  emits: ["update:modelValue"],
2374
- setup(__props, { emit: __emit }) {
2374
+ setup(__props, { expose: __expose, emit: __emit }) {
2375
2375
  const props = __props;
2376
2376
  const emit = __emit;
2377
+ const baseInput = useTemplateRef("baseInput");
2378
+ const inputEl = computed(() => {
2379
+ return baseInput.value?.$el;
2380
+ });
2377
2381
  const value = computed({
2378
2382
  // eslint-disable-next-line no-undefined
2379
2383
  get: () => props.modelValue ?? void 0,
2380
2384
  set: (it) => emit("update:modelValue", it ?? null)
2381
2385
  });
2382
2386
  const [DefineTemplate, ReuseTemplate] = createReusableTemplate();
2387
+ function focus() {
2388
+ inputEl.value?.focus();
2389
+ }
2390
+ function blur() {
2391
+ inputEl.value?.blur();
2392
+ }
2393
+ function select() {
2394
+ inputEl.value?.select();
2395
+ }
2396
+ __expose({ inputEl, focus, blur, select });
2383
2397
  return (_ctx, _cache) => {
2384
2398
  return openBlock(), createElementBlock(Fragment, null, [
2385
2399
  createVNode(unref(DefineTemplate), null, {
2386
2400
  default: withCtx(() => [
2387
- createVNode(unref(_sfc_main$1U), mergeProps(_ctx.$attrs, {
2401
+ createVNode(unref(_sfc_main$1U), mergeProps({
2402
+ ref_key: "baseInput",
2403
+ ref: baseInput
2404
+ }, _ctx.$attrs, {
2388
2405
  modelValue: value.value,
2389
2406
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => value.value = $event),
2390
2407
  modelModifiers: { trim: true },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tb-dev/vue",
3
- "version": "0.3.32",
3
+ "version": "0.3.34",
4
4
  "description": "Vue utilities",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -50,7 +50,7 @@
50
50
  "tailwindcss": "^4.1.4",
51
51
  "tslib": "^2.8.1",
52
52
  "typescript": "~5.8.3",
53
- "vite": "^6.2.6",
53
+ "vite": "^6.3.1",
54
54
  "vite-plugin-dts": "^4.5.3",
55
55
  "vue-tsc": "~2.2.8"
56
56
  },