vft 0.0.229 → 0.0.232

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 { defineComponent as M, ref as v, reactive as q, computed as u, watch as s, nextTick as E, onUnmounted as D, onMounted as G, createElementBlock as I, openBlock as J, normalizeStyle as K, createElementVNode as w, renderSlot as B } from "vue";
2
- import { addUnit as P } from "@vft/utils";
3
- import Q from "resize-detector";
4
- const W = ["title", "aria-label"], X = M({
1
+ import { defineComponent as M, ref as v, reactive as N, computed as u, watch as s, nextTick as E, onUnmounted as V, onMounted as q, createElementBlock as D, openBlock as G, normalizeStyle as I, createElementVNode as w, renderSlot as B } from "vue";
2
+ import { addUnit as J } from "@vft/utils";
3
+ import { addListener as K, removeListener as P } from "resize-detector/esm";
4
+ const Q = ["title", "aria-label"], W = M({
5
5
  name: "vft-clamp"
6
- }), _ = /* @__PURE__ */ M({
7
- ...X,
6
+ }), p = /* @__PURE__ */ M({
7
+ ...W,
8
8
  props: {
9
9
  text: {},
10
10
  maxHeight: {},
@@ -16,20 +16,20 @@ const W = ["title", "aria-label"], X = M({
16
16
  },
17
17
  emits: ["clamp-change", "update:expanded"],
18
18
  setup(e, { expose: T, emit: $ }) {
19
- const { addListener: j, removeListener: U } = Q, R = $, a = v(null), r = v(null), x = v(null), l = q({
19
+ const R = $, a = v(null), r = v(null), x = v(null), l = N({
20
20
  offset: 0,
21
21
  localExpanded: e.expanded,
22
22
  unregisterResizeCallback: null
23
- }), A = u(() => {
23
+ }), j = u(() => {
24
24
  if (!l.localExpanded && e.maxHeight)
25
- return P(e.maxHeight);
26
- }), k = () => {
27
- x.value && (x.value.textContent = N.value);
25
+ return J(e.maxHeight);
26
+ }), y = () => {
27
+ x.value && (x.value.textContent = S.value);
28
28
  }, c = () => {
29
- l.localExpanded || (k(), (d() || n.value) && g());
30
- }, y = () => {
31
- e.text && (l.offset = e.text.length, C(), e.autoResize && a.value && (j(a.value, c), l.unregisterResizeCallback = () => {
32
- a.value && U(a.value, c);
29
+ l.localExpanded || (y(), (d() || n.value) && g());
30
+ }, k = () => {
31
+ e.text && (l.offset = e.text.length, C(), e.autoResize && a.value && (K(a.value, c), l.unregisterResizeCallback = () => {
32
+ a.value && P(a.value, c);
33
33
  }), c());
34
34
  }, C = () => {
35
35
  var t;
@@ -42,19 +42,19 @@ const W = ["title", "aria-label"], X = M({
42
42
  ).length : 0, g = (...t) => {
43
43
  const [i = 0, f = l.offset] = t;
44
44
  if (f - i <= 3) {
45
- O();
45
+ U();
46
46
  return;
47
47
  }
48
48
  const o = Math.floor((f + i) / 2);
49
49
  h(o), d() ? g(i, o) : g(o, f);
50
50
  }, h = (t) => {
51
- l.offset = t, k();
52
- }, O = () => {
53
- S(), F();
54
- }, S = () => {
51
+ l.offset = t, y();
52
+ }, U = () => {
53
+ A(), O();
54
+ }, A = () => {
55
55
  for (; (!d() || m() < 2) && l.offset < e.text.length; )
56
56
  H(1);
57
- }, F = () => {
57
+ }, O = () => {
58
58
  for (; d() && m() > 1 && l.offset > 0; )
59
59
  H(-1);
60
60
  }, H = (t) => {
@@ -69,7 +69,7 @@ const W = ["title", "aria-label"], X = M({
69
69
  },
70
70
  { immediate: !0 }
71
71
  );
72
- const N = u(() => n.value ? V.value : e.text), V = u(() => {
72
+ const S = u(() => n.value ? F.value : e.text), F = u(() => {
73
73
  if (e.location === "start")
74
74
  return e.ellipsis + (e.text.slice(0, l.offset) || "").trim();
75
75
  if (e.location === "middle") {
@@ -105,22 +105,22 @@ const W = ["title", "aria-label"], X = M({
105
105
  () => [e.text, e.autoResize].join(),
106
106
  () => {
107
107
  E(() => {
108
- y();
108
+ k();
109
109
  });
110
110
  }
111
- ), D(() => {
111
+ ), V(() => {
112
112
  C();
113
- }), G(() => {
114
- y();
113
+ }), q(() => {
114
+ k();
115
115
  }), T({
116
116
  isClamped: n
117
- }), (t, i) => (J(), I("div", {
117
+ }), (t, i) => (G(), D("div", {
118
118
  ref_key: "textClampRef",
119
119
  ref: a,
120
120
  class: "text-clamp",
121
- style: K({
121
+ style: I({
122
122
  overflow: "hidden",
123
- maxHeight: A.value
123
+ maxHeight: j.value
124
124
  })
125
125
  }, [
126
126
  w("span", {
@@ -139,7 +139,7 @@ const W = ["title", "aria-label"], X = M({
139
139
  ref: x,
140
140
  title: t.text,
141
141
  "aria-label": t.text
142
- }, null, 8, W),
142
+ }, null, 8, Q),
143
143
  B(t.$slots, "after", {
144
144
  expand: L,
145
145
  collapse: b,
@@ -152,5 +152,5 @@ const W = ["title", "aria-label"], X = M({
152
152
  }
153
153
  });
154
154
  export {
155
- _ as default
155
+ p as default
156
156
  };
@@ -1,6 +1,6 @@
1
1
  declare const _default: {
2
2
  "name": "vft",
3
- "version": "0.0.229",
3
+ "version": "0.0.232",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.cjs",
6
6
  "module": "es/index.js",
@@ -1,4 +1,4 @@
1
- const o = "0.0.229";
1
+ const o = "0.0.232";
2
2
  export {
3
3
  o as version
4
4
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("vue"),q=require("@vft/utils"),O=require("resize-detector"),U=["title","aria-label"],A=l.defineComponent({name:"vft-clamp"}),N=l.defineComponent({...A,props:{text:{},maxHeight:{},maxLines:{default:1},expanded:{type:Boolean,default:!1},ellipsis:{default:"…"},autoResize:{type:Boolean,default:!1},location:{default:"end"}},emits:["clamp-change","update:expanded"],setup(e,{expose:b,emit:w}){const{addListener:L,removeListener:z}=O,g=w,n=l.ref(null),f=l.ref(null),r=l.ref(null),a=l.reactive({offset:0,localExpanded:e.expanded,unregisterResizeCallback:null}),T=l.computed(()=>{if(!a.localExpanded&&e.maxHeight)return q.addUnit(e.maxHeight)}),v=()=>{r.value&&(r.value.textContent=B.value)},s=()=>{a.localExpanded||(v(),(d()||i.value)&&m())},E=()=>{e.text&&(a.offset=e.text.length,k(),e.autoResize&&n.value&&(L(n.value,s),a.unregisterResizeCallback=()=>{n.value&&z(n.value,s)}),s())},k=()=>{var t;(t=a.unregisterResizeCallback)==null||t.call(a)},d=()=>!e.maxLines&&!e.maxHeight||!n.value?!1:e.maxLines&&x()>e.maxLines?!0:!!(e.maxHeight&&n.value.scrollHeight>n.value.offsetHeight),x=()=>f.value?Object.keys(Array.prototype.slice.call(f.value.getClientRects()).reduce((t,{top:c,bottom:u})=>{const o=`${c}/${u}`;return t[o]||(t[o]=!0),t},{})).length:0,m=(...t)=>{const[c=0,u=a.offset]=t;if(u-c<=3){M();return}const o=Math.floor((u+c)/2);h(o),d()?m(c,o):m(o,u)},h=t=>{a.offset=t,v()},M=()=>{S(),j()},S=()=>{for(;(!d()||x()<2)&&a.offset<e.text.length;)y(1)},j=()=>{for(;d()&&x()>1&&a.offset>0;)y(-1)},y=t=>{h(a.offset+t)},i=l.computed(()=>e.text?a.offset!==e.text.length:!1);l.watch(()=>i.value,t=>{l.nextTick(()=>{g("clamp-change",t)})},{immediate:!0});const B=l.computed(()=>i.value?$.value:e.text),$=l.computed(()=>{if(e.location==="start")return e.ellipsis+(e.text.slice(0,a.offset)||"").trim();if(e.location==="middle"){const t=Math.floor(a.offset/2);return(e.text.slice(0,t)||"").trim()+e.ellipsis+(e.text.slice(-t)||"").trim()}return(e.text.slice(0,a.offset)||"").trim()+e.ellipsis}),R=()=>{a.localExpanded=!0},C=()=>{a.localExpanded=!1},H=()=>{a.localExpanded=!a.localExpanded};return l.watch(()=>e.expanded,t=>{a.localExpanded=t}),l.watch(()=>a.localExpanded,t=>{t?h(e.text.length):s(),e.expanded!==t&&g("update:expanded",t)}),l.watch(()=>[e.maxLines,e.maxHeight,e.ellipsis,e.location,i.value].join(),()=>{l.nextTick(()=>{s()})}),l.watch(()=>[e.text,e.autoResize].join(),()=>{l.nextTick(()=>{E()})}),l.onUnmounted(()=>{k()}),l.onMounted(()=>{E()}),b({isClamped:i}),(t,c)=>(l.openBlock(),l.createElementBlock("div",{ref_key:"textClampRef",ref:n,class:"text-clamp",style:l.normalizeStyle({overflow:"hidden",maxHeight:T.value})},[l.createElementVNode("span",{ref_key:"contentRef",ref:f},[l.renderSlot(t.$slots,"before",{expand:R,collapse:C,toggle:H,clamped:i.value,expanded:a.localExpanded}),l.createElementVNode("span",{ref_key:"textRef",ref:r,title:t.text,"aria-label":t.text},null,8,U),l.renderSlot(t.$slots,"after",{expand:R,collapse:C,toggle:H,clamped:i.value,expanded:a.localExpanded})],512)],4))}});exports.default=N;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("vue"),$=require("@vft/utils"),b=require("resize-detector/esm"),q=["title","aria-label"],O=l.defineComponent({name:"vft-clamp"}),U=l.defineComponent({...O,props:{text:{},maxHeight:{},maxLines:{default:1},expanded:{type:Boolean,default:!1},ellipsis:{default:"…"},autoResize:{type:Boolean,default:!1},location:{default:"end"}},emits:["clamp-change","update:expanded"],setup(e,{expose:w,emit:L}){const g=L,n=l.ref(null),f=l.ref(null),r=l.ref(null),a=l.reactive({offset:0,localExpanded:e.expanded,unregisterResizeCallback:null}),z=l.computed(()=>{if(!a.localExpanded&&e.maxHeight)return $.addUnit(e.maxHeight)}),v=()=>{r.value&&(r.value.textContent=j.value)},s=()=>{a.localExpanded||(v(),(d()||i.value)&&m())},E=()=>{e.text&&(a.offset=e.text.length,k(),e.autoResize&&n.value&&(b.addListener(n.value,s),a.unregisterResizeCallback=()=>{n.value&&b.removeListener(n.value,s)}),s())},k=()=>{var t;(t=a.unregisterResizeCallback)==null||t.call(a)},d=()=>!e.maxLines&&!e.maxHeight||!n.value?!1:e.maxLines&&x()>e.maxLines?!0:!!(e.maxHeight&&n.value.scrollHeight>n.value.offsetHeight),x=()=>f.value?Object.keys(Array.prototype.slice.call(f.value.getClientRects()).reduce((t,{top:c,bottom:u})=>{const o=`${c}/${u}`;return t[o]||(t[o]=!0),t},{})).length:0,m=(...t)=>{const[c=0,u=a.offset]=t;if(u-c<=3){T();return}const o=Math.floor((u+c)/2);h(o),d()?m(c,o):m(o,u)},h=t=>{a.offset=t,v()},T=()=>{M(),S()},M=()=>{for(;(!d()||x()<2)&&a.offset<e.text.length;)y(1)},S=()=>{for(;d()&&x()>1&&a.offset>0;)y(-1)},y=t=>{h(a.offset+t)},i=l.computed(()=>e.text?a.offset!==e.text.length:!1);l.watch(()=>i.value,t=>{l.nextTick(()=>{g("clamp-change",t)})},{immediate:!0});const j=l.computed(()=>i.value?B.value:e.text),B=l.computed(()=>{if(e.location==="start")return e.ellipsis+(e.text.slice(0,a.offset)||"").trim();if(e.location==="middle"){const t=Math.floor(a.offset/2);return(e.text.slice(0,t)||"").trim()+e.ellipsis+(e.text.slice(-t)||"").trim()}return(e.text.slice(0,a.offset)||"").trim()+e.ellipsis}),R=()=>{a.localExpanded=!0},C=()=>{a.localExpanded=!1},H=()=>{a.localExpanded=!a.localExpanded};return l.watch(()=>e.expanded,t=>{a.localExpanded=t}),l.watch(()=>a.localExpanded,t=>{t?h(e.text.length):s(),e.expanded!==t&&g("update:expanded",t)}),l.watch(()=>[e.maxLines,e.maxHeight,e.ellipsis,e.location,i.value].join(),()=>{l.nextTick(()=>{s()})}),l.watch(()=>[e.text,e.autoResize].join(),()=>{l.nextTick(()=>{E()})}),l.onUnmounted(()=>{k()}),l.onMounted(()=>{E()}),w({isClamped:i}),(t,c)=>(l.openBlock(),l.createElementBlock("div",{ref_key:"textClampRef",ref:n,class:"text-clamp",style:l.normalizeStyle({overflow:"hidden",maxHeight:z.value})},[l.createElementVNode("span",{ref_key:"contentRef",ref:f},[l.renderSlot(t.$slots,"before",{expand:R,collapse:C,toggle:H,clamped:i.value,expanded:a.localExpanded}),l.createElementVNode("span",{ref_key:"textRef",ref:r,title:t.text,"aria-label":t.text},null,8,q),l.renderSlot(t.$slots,"after",{expand:R,collapse:C,toggle:H,clamped:i.value,expanded:a.localExpanded})],512)],4))}});exports.default=U;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="0.0.229";exports.version=e;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="0.0.232";exports.version=e;
@@ -1,6 +1,6 @@
1
1
  declare const _default: {
2
2
  "name": "vft",
3
- "version": "0.0.229",
3
+ "version": "0.0.232",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.cjs",
6
6
  "module": "es/index.js",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vft",
3
- "version": "0.0.229",
3
+ "version": "0.0.232",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.cjs",
6
6
  "module": "es/index.js",
@@ -55,11 +55,11 @@
55
55
  "resize-detector": "0.3.0",
56
56
  "sortablejs": "1.15.0",
57
57
  "@vft/router": "0.0.56",
58
- "@vft/constants": "0.0.66",
59
- "@vft/store": "0.0.37",
58
+ "@vft/store": "0.0.38",
60
59
  "@vft/use": "0.0.51",
61
- "@vft/utils": "0.0.110",
62
- "@vft/directives": "0.0.29"
60
+ "@vft/directives": "0.0.29",
61
+ "@vft/utils": "0.0.112",
62
+ "@vft/constants": "0.0.66"
63
63
  },
64
64
  "vetur": {
65
65
  "tags": "tags.json",