directix 1.7.0 → 1.8.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,5 +1,5 @@
1
1
  /*!
2
- * directix v1.7.0
2
+ * directix v1.8.0
3
3
  * A comprehensive, easy-to-use, and high-performance Vue custom directives library supporting both Vue 2 and Vue 3
4
4
  * (c) 2021-present saqqdy <https://github.com/saqqdy>
5
5
  * Released under the MIT License.
@@ -57,7 +57,7 @@ var __async = (__this, __arguments, generator) => {
57
57
  });
58
58
  };
59
59
  /*!
60
- * directix v1.7.0
60
+ * directix v1.8.0
61
61
  * A comprehensive, easy-to-use, and high-performance Vue custom directives library supporting both Vue 2 and Vue 3
62
62
  * (c) 2021-present saqqdy <https://github.com/saqqdy>
63
63
  * Released under the MIT License.
@@ -2507,14 +2507,16 @@ var __async = (__this, __arguments, generator) => {
2507
2507
  el.style.opacity = String(options.minOpacity || 0);
2508
2508
  el.style.display = "";
2509
2509
  String(el.offsetHeight);
2510
- requestAnimationFrame(() => {
2510
+ state.animationFrame = requestAnimationFrame(() => {
2511
+ state.animationFrame = null;
2511
2512
  el.style.opacity = String(options.maxOpacity || 1);
2512
2513
  state.currentOpacity = options.maxOpacity || 1;
2513
2514
  });
2514
2515
  } else if (options.direction === "out") {
2515
2516
  el.style.opacity = String(options.maxOpacity || 1);
2516
2517
  el.style.display = "";
2517
- requestAnimationFrame(() => {
2518
+ state.animationFrame = requestAnimationFrame(() => {
2519
+ state.animationFrame = null;
2518
2520
  el.style.opacity = String(options.minOpacity || 0);
2519
2521
  setTimeout(() => {
2520
2522
  el.style.display = "none";
@@ -6658,8 +6660,8 @@ var __async = (__this, __arguments, generator) => {
6658
6660
  mounted(el, binding) {
6659
6661
  if (!isBrowser()) return;
6660
6662
  const options = normalizeOptions$e(binding.value);
6661
- if (options.disabled) return;
6662
6663
  el.__sanitize = { options };
6664
+ if (options.disabled) return;
6663
6665
  const content = el.innerHTML;
6664
6666
  if (content) {
6665
6667
  el.innerHTML = sanitizeHtml(content, options);
@@ -6668,8 +6670,17 @@ var __async = (__this, __arguments, generator) => {
6668
6670
  updated(el, binding) {
6669
6671
  const state = el.__sanitize;
6670
6672
  if (!state) return;
6673
+ const prevDisabled = state.options.disabled;
6671
6674
  state.options = normalizeOptions$e(binding.value);
6672
- if (state.options.disabled || !state.options.sanitizeOnUpdate) return;
6675
+ if (state.options.disabled || !state.options.sanitizeOnUpdate) {
6676
+ if (prevDisabled && !state.options.disabled) {
6677
+ const content2 = el.innerHTML;
6678
+ if (content2) {
6679
+ el.innerHTML = sanitizeHtml(content2, state.options);
6680
+ }
6681
+ }
6682
+ return;
6683
+ }
6673
6684
  const content = el.innerHTML;
6674
6685
  if (content) {
6675
6686
  el.innerHTML = sanitizeHtml(content, state.options);
@@ -7318,12 +7329,13 @@ var __async = (__this, __arguments, generator) => {
7318
7329
  };
7319
7330
  let tooltipContainer = null;
7320
7331
  function getTooltipContainer() {
7321
- if (!tooltipContainer && typeof document !== "undefined") {
7322
- tooltipContainer = document.createElement("div");
7323
- tooltipContainer.id = "directix-tooltip-container";
7324
- tooltipContainer.style.cssText = "position: fixed; top: 0; left: 0; pointer-events: none; z-index: 9999;";
7325
- document.body.appendChild(tooltipContainer);
7332
+ if (tooltipContainer && document.body.contains(tooltipContainer)) {
7333
+ return tooltipContainer;
7326
7334
  }
7335
+ tooltipContainer = document.createElement("div");
7336
+ tooltipContainer.id = "directix-tooltip-container";
7337
+ tooltipContainer.style.cssText = "position: fixed; top: 0; left: 0; pointer-events: none; z-index: 9999;";
7338
+ document.body.appendChild(tooltipContainer);
7327
7339
  return tooltipContainer;
7328
7340
  }
7329
7341
  function createTooltip(options) {
@@ -7553,6 +7565,7 @@ var __async = (__this, __arguments, generator) => {
7553
7565
  const newState = createState(newOptions);
7554
7566
  el.__tooltip = newState;
7555
7567
  setupTriggerHandlers(el, newState);
7568
+ el.setAttribute("aria-describedby", "v-tooltip");
7556
7569
  if (newOptions.trigger === "manual") {
7557
7570
  showTooltip(el, newState);
7558
7571
  }
@@ -9693,7 +9706,7 @@ var __async = (__this, __arguments, generator) => {
9693
9706
  if (!isDragging.value || vue.unref(disabled)) return;
9694
9707
  e.preventDefault();
9695
9708
  const { clientX, clientY } = getClientCoords(e);
9696
- let deltaX = clientX - startX, deltaY = clientY - startY, newX = offsetX + deltaX, newY = offsetY + deltaY;
9709
+ let deltaX = clientX - startX, deltaY = clientY - startY;
9697
9710
  const currentAxis = vue.unref(axis);
9698
9711
  if (currentAxis === "x") {
9699
9712
  deltaY = 0;
@@ -9705,6 +9718,7 @@ var __async = (__this, __arguments, generator) => {
9705
9718
  deltaX = Math.round(deltaX / currentGrid[0]) * currentGrid[0];
9706
9719
  deltaY = Math.round(deltaY / currentGrid[1]) * currentGrid[1];
9707
9720
  }
9721
+ let newX = offsetX + deltaX, newY = offsetY + deltaY;
9708
9722
  if (vue.unref(constrain) || boundary) {
9709
9723
  const newLeft = initialLeft + deltaX;
9710
9724
  const newTop = initialTop + deltaY;
@@ -12191,6 +12205,7 @@ var __async = (__this, __arguments, generator) => {
12191
12205
  return Math.sqrt(dx * dx + dy * dy);
12192
12206
  }
12193
12207
  function getCenter$1(touches) {
12208
+ if (touches.length === 0) return { x: 0, y: 0 };
12194
12209
  if (touches.length < 2) return { x: touches[0].clientX, y: touches[0].clientY };
12195
12210
  return {
12196
12211
  x: (touches[0].clientX + touches[1].clientX) / 2,
@@ -12968,6 +12983,7 @@ var __async = (__this, __arguments, generator) => {
12968
12983
  return Math.atan2(dy, dx) * (180 / Math.PI);
12969
12984
  }
12970
12985
  function getCenter(touches) {
12986
+ if (touches.length === 0) return { x: 0, y: 0 };
12971
12987
  if (touches.length < 2) return { x: touches[0].clientX, y: touches[0].clientY };
12972
12988
  return {
12973
12989
  x: (touches[0].clientX + touches[1].clientX) / 2,