directix 1.6.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.
package/README.md CHANGED
@@ -3,6 +3,8 @@
3
3
  [![npm version](https://img.shields.io/npm/v/directix.svg)](https://www.npmjs.com/package/directix)
4
4
  [![npm downloads](https://img.shields.io/npm/dm/directix.svg)](https://www.npmjs.com/package/directix)
5
5
  [![GitHub license](https://img.shields.io/github/license/saqqdy/directix)](https://github.com/saqqdy/directix/blob/master/LICENSE)
6
+ [![CI](https://github.com/saqqdy/directix/actions/workflows/ci.yml/badge.svg)](https://github.com/saqqdy/directix/actions/workflows/ci.yml)
7
+ [![codecov](https://codecov.io/gh/saqqdy/directix/branch/master/graph/badge.svg)](https://codecov.io/gh/saqqdy/directix)
6
8
 
7
9
  **English** | **[中文文档](README_CN.md)**
8
10
 
@@ -29,6 +31,19 @@ Try it online with StackBlitz or CodeSandbox:
29
31
  | Vue 3 | [![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/saqqdy/directix/tree/master/examples/vue3) | [![Open in CodeSandbox](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/p/sandbox/github/saqqdy/directix/tree/master/examples/vue3) |
30
32
  | Vue 2 | [![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/saqqdy/directix/tree/master/examples/vue2) | [![Open in CodeSandbox](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/p/sandbox/github/saqqdy/directix/tree/master/examples/vue2) |
31
33
 
34
+ ## Playground
35
+
36
+ Try the interactive [Playground](https://saqqdy.github.io/directix/playground/) to configure directives and generate code:
37
+
38
+ - **57+ Directives** - Full coverage of all Directix directives
39
+ - **Vue 2 & Vue 3** - Generate code for either version
40
+ - **Composables** - Generate composable API code
41
+ - **TypeScript Ready** - Full type definitions included
42
+ - **Monaco Editor** - Full-featured code editor with syntax highlighting
43
+ - **Live Preview** - See directive effects in real-time
44
+
45
+ Each directive documentation page also includes a code generator for quick code snippets.
46
+
32
47
  ## Installation
33
48
 
34
49
  ```bash
@@ -1774,6 +1789,56 @@ interface DirectiveInstallOptions {
1774
1789
 
1775
1790
  Each directive accepts different options. See the [documentation](https://github.com/saqqdy/directix#usage-examples) for detailed API.
1776
1791
 
1792
+ ## Roadmap
1793
+
1794
+ ### v1.7.1 (2026-04-11) - Bug Fixes & Improvements ✅
1795
+
1796
+ - **Playground Fixes** - Monaco Editor loading, syntax highlighting, Vue version sync
1797
+ - **UI Improvements** - Removed redundant controls, unified documentation layout
1798
+
1799
+ ### v1.7.0 (2026-04-15) - Visual Configuration Tool ✅
1800
+
1801
+ - **Online Playground** - Live editing environment with Vue 2/3 support
1802
+ - **Visual Configurator** - Interactive parameter configuration panel
1803
+ - **Code Generator** - Generate Vue 2/3/Composable/Nuxt code snippets
1804
+ - **Configuration Presets** - Quick-start templates for common use cases
1805
+ - **Monaco Editor** - CDN-loaded code editor with syntax highlighting
1806
+ - **Live Preview** - Real-time directive effect preview
1807
+
1808
+ ### v1.8.0 (2026-04-22) - Quality & Ecosystem ✅
1809
+
1810
+ - **Test Coverage** - 90%+ unit test coverage, E2E testing with Playwright
1811
+ - **Performance Optimization** - Bundle size optimization, tree-shaking improvements
1812
+ - **VS Code Extension** - Autocompletion, hover documentation, code snippets
1813
+ - **CLI Tool** - `directix create`, `directix init`, `directix doctor`, `directix migrate`
1814
+
1815
+ ### v1.9.0 (Planned - 2026-04-29) - Documentation & Community
1816
+
1817
+ - **Interactive Documentation** - Live editing with instant preview
1818
+ - **Real-world Examples** - 10+ practical scenario examples
1819
+ - **i18n Support** - English, Chinese, Japanese documentation
1820
+ - **Developer Experience** - Improved error messages, DevTools integration
1821
+ - **Plugin System** - Community extension support
1822
+
1823
+ ### v1.10.0 (Planned - 2026-05-06) - Vue 3 Optimization & Security
1824
+
1825
+ - **Vue 3 Optimization Preview** - Suspense, Teleport support
1826
+ - **Mobile Optimization** - Touch gestures, PWA support
1827
+ - **Accessibility (A11y)** - ARIA attributes, keyboard navigation
1828
+ - **Security Enhancements** - XSS protection, CSP compatibility
1829
+
1830
+ ### v1.11.0 (Planned - 2026-05-13) - Stability & Enterprise
1831
+
1832
+ - **Stability** - Browser compatibility, edge case fixes
1833
+ - **Performance Limits** - Bundle ≤ 25KB, memory optimization
1834
+ - **Enterprise Features** - Permissions, audit logs, config center
1835
+ - **v2.0 Migration Prep** - Migration tool, breaking changes warnings
1836
+
1837
+ ### v2.0.0 (Future)
1838
+
1839
+ - Vue 3 exclusive optimizations
1840
+ - Web Components support
1841
+
1777
1842
  ## Browser Support
1778
1843
 
1779
1844
  | Browser | Version |
package/dist/index.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * directix v1.6.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.
@@ -78,7 +78,7 @@ var __async = (__this, __arguments, generator) => {
78
78
  });
79
79
  };
80
80
  /*!
81
- * directix v1.6.0
81
+ * directix v1.8.0
82
82
  * A comprehensive, easy-to-use, and high-performance Vue custom directives library supporting both Vue 2 and Vue 3
83
83
  * (c) 2021-present saqqdy <https://github.com/saqqdy>
84
84
  * Released under the MIT License.
@@ -2528,14 +2528,16 @@ const vFade = defineDirective({
2528
2528
  el.style.opacity = String(options.minOpacity || 0);
2529
2529
  el.style.display = "";
2530
2530
  String(el.offsetHeight);
2531
- requestAnimationFrame(() => {
2531
+ state.animationFrame = requestAnimationFrame(() => {
2532
+ state.animationFrame = null;
2532
2533
  el.style.opacity = String(options.maxOpacity || 1);
2533
2534
  state.currentOpacity = options.maxOpacity || 1;
2534
2535
  });
2535
2536
  } else if (options.direction === "out") {
2536
2537
  el.style.opacity = String(options.maxOpacity || 1);
2537
2538
  el.style.display = "";
2538
- requestAnimationFrame(() => {
2539
+ state.animationFrame = requestAnimationFrame(() => {
2540
+ state.animationFrame = null;
2539
2541
  el.style.opacity = String(options.minOpacity || 0);
2540
2542
  setTimeout(() => {
2541
2543
  el.style.display = "none";
@@ -6679,8 +6681,8 @@ const vSanitize = defineDirective({
6679
6681
  mounted(el, binding) {
6680
6682
  if (!isBrowser()) return;
6681
6683
  const options = normalizeOptions$e(binding.value);
6682
- if (options.disabled) return;
6683
6684
  el.__sanitize = { options };
6685
+ if (options.disabled) return;
6684
6686
  const content = el.innerHTML;
6685
6687
  if (content) {
6686
6688
  el.innerHTML = sanitizeHtml(content, options);
@@ -6689,8 +6691,17 @@ const vSanitize = defineDirective({
6689
6691
  updated(el, binding) {
6690
6692
  const state = el.__sanitize;
6691
6693
  if (!state) return;
6694
+ const prevDisabled = state.options.disabled;
6692
6695
  state.options = normalizeOptions$e(binding.value);
6693
- if (state.options.disabled || !state.options.sanitizeOnUpdate) return;
6696
+ if (state.options.disabled || !state.options.sanitizeOnUpdate) {
6697
+ if (prevDisabled && !state.options.disabled) {
6698
+ const content2 = el.innerHTML;
6699
+ if (content2) {
6700
+ el.innerHTML = sanitizeHtml(content2, state.options);
6701
+ }
6702
+ }
6703
+ return;
6704
+ }
6694
6705
  const content = el.innerHTML;
6695
6706
  if (content) {
6696
6707
  el.innerHTML = sanitizeHtml(content, state.options);
@@ -7339,12 +7350,13 @@ const TOOLTIP_STYLES = {
7339
7350
  };
7340
7351
  let tooltipContainer = null;
7341
7352
  function getTooltipContainer() {
7342
- if (!tooltipContainer && typeof document !== "undefined") {
7343
- tooltipContainer = document.createElement("div");
7344
- tooltipContainer.id = "directix-tooltip-container";
7345
- tooltipContainer.style.cssText = "position: fixed; top: 0; left: 0; pointer-events: none; z-index: 9999;";
7346
- document.body.appendChild(tooltipContainer);
7353
+ if (tooltipContainer && document.body.contains(tooltipContainer)) {
7354
+ return tooltipContainer;
7347
7355
  }
7356
+ tooltipContainer = document.createElement("div");
7357
+ tooltipContainer.id = "directix-tooltip-container";
7358
+ tooltipContainer.style.cssText = "position: fixed; top: 0; left: 0; pointer-events: none; z-index: 9999;";
7359
+ document.body.appendChild(tooltipContainer);
7348
7360
  return tooltipContainer;
7349
7361
  }
7350
7362
  function createTooltip(options) {
@@ -7574,6 +7586,7 @@ const vTooltip = defineDirective({
7574
7586
  const newState = createState(newOptions);
7575
7587
  el.__tooltip = newState;
7576
7588
  setupTriggerHandlers(el, newState);
7589
+ el.setAttribute("aria-describedby", "v-tooltip");
7577
7590
  if (newOptions.trigger === "manual") {
7578
7591
  showTooltip(el, newState);
7579
7592
  }
@@ -9714,7 +9727,7 @@ function useDraggable(options = {}) {
9714
9727
  if (!isDragging.value || vue.unref(disabled)) return;
9715
9728
  e.preventDefault();
9716
9729
  const { clientX, clientY } = getClientCoords(e);
9717
- let deltaX = clientX - startX, deltaY = clientY - startY, newX = offsetX + deltaX, newY = offsetY + deltaY;
9730
+ let deltaX = clientX - startX, deltaY = clientY - startY;
9718
9731
  const currentAxis = vue.unref(axis);
9719
9732
  if (currentAxis === "x") {
9720
9733
  deltaY = 0;
@@ -9726,6 +9739,7 @@ function useDraggable(options = {}) {
9726
9739
  deltaX = Math.round(deltaX / currentGrid[0]) * currentGrid[0];
9727
9740
  deltaY = Math.round(deltaY / currentGrid[1]) * currentGrid[1];
9728
9741
  }
9742
+ let newX = offsetX + deltaX, newY = offsetY + deltaY;
9729
9743
  if (vue.unref(constrain) || boundary) {
9730
9744
  const newLeft = initialLeft + deltaX;
9731
9745
  const newTop = initialTop + deltaY;
@@ -12212,6 +12226,7 @@ function getDistance(touches) {
12212
12226
  return Math.sqrt(dx * dx + dy * dy);
12213
12227
  }
12214
12228
  function getCenter$1(touches) {
12229
+ if (touches.length === 0) return { x: 0, y: 0 };
12215
12230
  if (touches.length < 2) return { x: touches[0].clientX, y: touches[0].clientY };
12216
12231
  return {
12217
12232
  x: (touches[0].clientX + touches[1].clientX) / 2,
@@ -12989,6 +13004,7 @@ function getAngle(touches) {
12989
13004
  return Math.atan2(dy, dx) * (180 / Math.PI);
12990
13005
  }
12991
13006
  function getCenter(touches) {
13007
+ if (touches.length === 0) return { x: 0, y: 0 };
12992
13008
  if (touches.length < 2) return { x: touches[0].clientX, y: touches[0].clientY };
12993
13009
  return {
12994
13010
  x: (touches[0].clientX + touches[1].clientX) / 2,