directix 1.10.0 → 2.0.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,6 +1,6 @@
1
1
  /*!
2
- * directix v1.10.0
3
- * A comprehensive, easy-to-use, and high-performance Vue custom directives library supporting both Vue 2 and Vue 3
2
+ * directix v2.0.0
3
+ * A comprehensive, easy-to-use, and high-performance Vue custom directives library supporting both Vue 2 and Vue 3, with Web Components support
4
4
  * (c) 2021-present saqqdy <https://github.com/saqqdy>
5
5
  * Released under the MIT License.
6
6
  */
@@ -16535,21 +16535,22 @@ function normalizeBinding(binding) {
16535
16535
  }
16536
16536
 
16537
16537
  // packages/core/src/adapter/vue3.ts
16538
+ var import_vue = require("vue");
16538
16539
  function createVue3Directive(hooks) {
16539
- const directive = {
16540
+ return {
16540
16541
  created(el, binding, vnode) {
16541
- const state = {
16542
- value: binding.value,
16542
+ const state = (0, import_vue.shallowReactive)({
16543
+ value: binding.value != null ? (0, import_vue.markRaw)(binding.value) : binding.value,
16543
16544
  vnode,
16544
16545
  cleanup: []
16545
- };
16546
+ });
16546
16547
  el.__directix_state__ = state;
16547
16548
  },
16548
16549
  beforeMount(_el, _binding, _vnode) {
16549
16550
  },
16550
16551
  mounted(el, binding, vnode) {
16551
16552
  if (hooks.mounted) {
16552
- hooks.mounted(el, normalizeBindingVue3(binding), vnode);
16553
+ hooks.mounted(el, normalizeBinding2(binding), vnode);
16553
16554
  }
16554
16555
  },
16555
16556
  beforeUpdate(_el, _binding, _vnode, _prevVnode) {
@@ -16559,14 +16560,14 @@ function createVue3Directive(hooks) {
16559
16560
  if (hooks.updated) {
16560
16561
  hooks.updated(
16561
16562
  el,
16562
- normalizeBindingVue3(binding),
16563
+ normalizeBinding2(binding),
16563
16564
  vnode,
16564
- normalizeBindingVue3({ ...binding, value: binding.oldValue }),
16565
+ normalizeBinding2({ ...binding, value: binding.oldValue }),
16565
16566
  prevVnode
16566
16567
  );
16567
16568
  }
16568
16569
  if (state) {
16569
- state.value = binding.value;
16570
+ state.value = binding.value != null ? (0, import_vue.markRaw)(binding.value) : binding.value;
16570
16571
  state.vnode = vnode;
16571
16572
  }
16572
16573
  },
@@ -16574,7 +16575,7 @@ function createVue3Directive(hooks) {
16574
16575
  },
16575
16576
  unmounted(el, binding, vnode) {
16576
16577
  if (hooks.unmounted) {
16577
- hooks.unmounted(el, normalizeBindingVue3(binding), vnode);
16578
+ hooks.unmounted(el, normalizeBinding2(binding), vnode);
16578
16579
  }
16579
16580
  const state = el.__directix_state__;
16580
16581
  if (state?.cleanup) {
@@ -16583,9 +16584,8 @@ function createVue3Directive(hooks) {
16583
16584
  delete el.__directix_state__;
16584
16585
  }
16585
16586
  };
16586
- return directive;
16587
16587
  }
16588
- function normalizeBindingVue3(binding) {
16588
+ function normalizeBinding2(binding) {
16589
16589
  return {
16590
16590
  value: binding.value,
16591
16591
  oldValue: binding.oldValue ?? null,
@@ -19309,7 +19309,7 @@ function createEntry(key2, modifiers, handler, options = {}) {
19309
19309
  disabled: options.disabled ?? false
19310
19310
  };
19311
19311
  }
19312
- function normalizeBinding2(binding, arg, modifiers) {
19312
+ function normalizeBinding3(binding, arg, modifiers) {
19313
19313
  if (arg) {
19314
19314
  const argLower = arg.toLowerCase();
19315
19315
  const argIsModifier = MODIFIER_KEYS.has(argLower);
@@ -19393,12 +19393,12 @@ var vHotkey = defineDirective({
19393
19393
  name: "hotkey",
19394
19394
  ssr: true,
19395
19395
  mounted(el, binding) {
19396
- const entries = normalizeBinding2(binding.value, binding.arg, binding.modifiers);
19396
+ const entries = normalizeBinding3(binding.value, binding.arg, binding.modifiers);
19397
19397
  setupState(el, entries);
19398
19398
  },
19399
19399
  updated(el, binding) {
19400
19400
  const state = el.__hotkey;
19401
- const newEntries = normalizeBinding2(binding.value, binding.arg, binding.modifiers);
19401
+ const newEntries = normalizeBinding3(binding.value, binding.arg, binding.modifiers);
19402
19402
  if (state) {
19403
19403
  state.entries = newEntries;
19404
19404
  } else {