vue-tippy 6.0.0-alpha.50 → 6.0.0-alpha.53

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
- * vue-tippy v6.0.0-alpha.50
2
+ * vue-tippy v6.0.0-alpha.53
3
3
  * (c) 2022
4
4
  * @license MIT
5
5
  */
@@ -9,6 +9,10 @@ Object.defineProperty(exports, '__esModule', { value: true });
9
9
 
10
10
  var vue = require('vue');
11
11
 
12
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e['default'] : e; }
13
+
14
+ var vue__default = /*#__PURE__*/_interopDefaultLegacy(vue);
15
+
12
16
  var top = 'top';
13
17
  var bottom = 'bottom';
14
18
  var right = 'right';
@@ -4504,6 +4508,85 @@ function useSingleton(instances, optionalProps) {
4504
4508
  };
4505
4509
  }
4506
4510
 
4511
+ const { unref, isRef } = vue__default;
4512
+
4513
+ const isObject = (val) => val !== null && typeof val === 'object';
4514
+ const isArray = Array.isArray;
4515
+
4516
+ /**
4517
+ * Deeply unref a value, recursing into objects and arrays.
4518
+ *
4519
+ * @param {Mixed} val - The value to deeply unref.
4520
+ *
4521
+ * @return {Mixed}
4522
+ */
4523
+ const deepUnref = (val) => {
4524
+ const checkedVal = isRef(val) ? unref(val) : val;
4525
+
4526
+ if (! isObject(checkedVal)) {
4527
+ return checkedVal;
4528
+ }
4529
+
4530
+ if (isArray(checkedVal)) {
4531
+ return unrefArray(checkedVal);
4532
+ }
4533
+
4534
+ return unrefObject(checkedVal);
4535
+ };
4536
+
4537
+ /**
4538
+ * Unref a value, recursing into it if it's an object.
4539
+ *
4540
+ * @param {Mixed} val - The value to unref.
4541
+ *
4542
+ * @return {Mixed}
4543
+ */
4544
+ const smartUnref = (val) => {
4545
+ // Non-ref object? Go deeper!
4546
+ if (val !== null && ! isRef(val) && typeof val === 'object') {
4547
+ return deepUnref(val);
4548
+ }
4549
+
4550
+ return unref(val);
4551
+ };
4552
+
4553
+ /**
4554
+ * Unref an array, recursively.
4555
+ *
4556
+ * @param {Array} arr - The array to unref.
4557
+ *
4558
+ * @return {Array}
4559
+ */
4560
+ const unrefArray = (arr) => {
4561
+ const unreffed = [];
4562
+
4563
+ arr.forEach((val) => {
4564
+ unreffed.push(smartUnref(val));
4565
+ });
4566
+
4567
+ return unreffed;
4568
+ };
4569
+
4570
+ /**
4571
+ * Unref an object, recursively.
4572
+ *
4573
+ * @param {Object} obj - The object to unref.
4574
+ *
4575
+ * @return {Object}
4576
+ */
4577
+ const unrefObject = (obj) => {
4578
+ const unreffed = {};
4579
+
4580
+ // Object? un-ref it!
4581
+ Object.keys(obj).forEach((key) => {
4582
+ unreffed[key] = smartUnref(obj[key]);
4583
+ });
4584
+
4585
+ return unreffed;
4586
+ };
4587
+
4588
+ var vueDeepunref = { deepUnref };
4589
+
4507
4590
  // const pluginProps = [
4508
4591
  // 'animateFill',
4509
4592
  // 'followCursor',
@@ -4598,15 +4681,16 @@ const TippyComponent = vue.defineComponent({
4598
4681
  ...tippy
4599
4682
  };
4600
4683
  expose(exposed);
4601
- const slot = slots.default ? slots.default(exposed) : [];
4602
4684
  return () => {
4685
+ let exposedUnref = vueDeepunref.deepUnref(exposed);
4686
+ const slot = slots.default ? slots.default(exposedUnref) : [];
4603
4687
  return vue.h(props.tag, { ref: elem, 'data-v-tippy': '' }, slots.content ? [
4604
4688
  slot,
4605
4689
  vue.h(props.contentTag, {
4606
4690
  ref: contentElem,
4607
4691
  style: { display: mounted.value ? 'inherit' : 'none' },
4608
4692
  class: props.contentClass
4609
- }, slots.content(exposed)),
4693
+ }, slots.content(exposedUnref)),
4610
4694
  ] : slot);
4611
4695
  };
4612
4696
  },
@@ -1,9 +1,9 @@
1
1
  /*!
2
- * vue-tippy v6.0.0-alpha.50
2
+ * vue-tippy v6.0.0-alpha.53
3
3
  * (c) 2022
4
4
  * @license MIT
5
5
  */
6
- import { getCurrentInstance, ref, onMounted, onUnmounted, isRef, isReactive, watch, isVNode, render as render$1, h, defineComponent, nextTick, unref } from 'vue';
6
+ import vue, { getCurrentInstance, ref, onMounted, onUnmounted, isRef as isRef$1, isReactive, watch, isVNode, render as render$1, h, defineComponent, nextTick, unref as unref$1 } from 'vue';
7
7
 
8
8
  var top = 'top';
9
9
  var bottom = 'bottom';
@@ -3964,7 +3964,7 @@ function useTippy(el, opts = {}, settings = { mount: true }) {
3964
3964
  };
3965
3965
  const getContent = (content) => {
3966
3966
  let newContent;
3967
- let unwrappedContent = isRef(content)
3967
+ let unwrappedContent = isRef$1(content)
3968
3968
  ? content.value
3969
3969
  : content;
3970
3970
  if (isVNode(unwrappedContent)) {
@@ -3989,7 +3989,7 @@ function useTippy(el, opts = {}, settings = { mount: true }) {
3989
3989
  };
3990
3990
  const getProps = (opts) => {
3991
3991
  let options = {};
3992
- if (isRef(opts)) {
3992
+ if (isRef$1(opts)) {
3993
3993
  options = opts.value || {};
3994
3994
  }
3995
3995
  else if (isReactive(opts)) {
@@ -4002,7 +4002,7 @@ function useTippy(el, opts = {}, settings = { mount: true }) {
4002
4002
  options.content = getContent(options.content);
4003
4003
  }
4004
4004
  if (options.triggerTarget) {
4005
- options.triggerTarget = isRef(options.triggerTarget)
4005
+ options.triggerTarget = isRef$1(options.triggerTarget)
4006
4006
  ? options.triggerTarget.value
4007
4007
  : options.triggerTarget;
4008
4008
  }
@@ -4095,7 +4095,7 @@ function useTippy(el, opts = {}, settings = { mount: true }) {
4095
4095
  const mount = () => {
4096
4096
  if (!el)
4097
4097
  return;
4098
- let target = isRef(el) ? el.value : el;
4098
+ let target = isRef$1(el) ? el.value : el;
4099
4099
  if (typeof target === 'function')
4100
4100
  target = target();
4101
4101
  if (target) {
@@ -4135,10 +4135,10 @@ function useTippy(el, opts = {}, settings = { mount: true }) {
4135
4135
  mount();
4136
4136
  }
4137
4137
  }
4138
- if (isRef(opts) || isReactive(opts)) {
4138
+ if (isRef$1(opts) || isReactive(opts)) {
4139
4139
  watch(opts, refresh, { immediate: false });
4140
4140
  }
4141
- else if (isRef(opts.content)) {
4141
+ else if (isRef$1(opts.content)) {
4142
4142
  watch(opts.content, refreshContent, { immediate: false });
4143
4143
  }
4144
4144
  return response;
@@ -4184,6 +4184,85 @@ function useSingleton(instances, optionalProps) {
4184
4184
  };
4185
4185
  }
4186
4186
 
4187
+ const { unref, isRef } = vue;
4188
+
4189
+ const isObject = (val) => val !== null && typeof val === 'object';
4190
+ const isArray = Array.isArray;
4191
+
4192
+ /**
4193
+ * Deeply unref a value, recursing into objects and arrays.
4194
+ *
4195
+ * @param {Mixed} val - The value to deeply unref.
4196
+ *
4197
+ * @return {Mixed}
4198
+ */
4199
+ const deepUnref = (val) => {
4200
+ const checkedVal = isRef(val) ? unref(val) : val;
4201
+
4202
+ if (! isObject(checkedVal)) {
4203
+ return checkedVal;
4204
+ }
4205
+
4206
+ if (isArray(checkedVal)) {
4207
+ return unrefArray(checkedVal);
4208
+ }
4209
+
4210
+ return unrefObject(checkedVal);
4211
+ };
4212
+
4213
+ /**
4214
+ * Unref a value, recursing into it if it's an object.
4215
+ *
4216
+ * @param {Mixed} val - The value to unref.
4217
+ *
4218
+ * @return {Mixed}
4219
+ */
4220
+ const smartUnref = (val) => {
4221
+ // Non-ref object? Go deeper!
4222
+ if (val !== null && ! isRef(val) && typeof val === 'object') {
4223
+ return deepUnref(val);
4224
+ }
4225
+
4226
+ return unref(val);
4227
+ };
4228
+
4229
+ /**
4230
+ * Unref an array, recursively.
4231
+ *
4232
+ * @param {Array} arr - The array to unref.
4233
+ *
4234
+ * @return {Array}
4235
+ */
4236
+ const unrefArray = (arr) => {
4237
+ const unreffed = [];
4238
+
4239
+ arr.forEach((val) => {
4240
+ unreffed.push(smartUnref(val));
4241
+ });
4242
+
4243
+ return unreffed;
4244
+ };
4245
+
4246
+ /**
4247
+ * Unref an object, recursively.
4248
+ *
4249
+ * @param {Object} obj - The object to unref.
4250
+ *
4251
+ * @return {Object}
4252
+ */
4253
+ const unrefObject = (obj) => {
4254
+ const unreffed = {};
4255
+
4256
+ // Object? un-ref it!
4257
+ Object.keys(obj).forEach((key) => {
4258
+ unreffed[key] = smartUnref(obj[key]);
4259
+ });
4260
+
4261
+ return unreffed;
4262
+ };
4263
+
4264
+ var vueDeepunref = { deepUnref };
4265
+
4187
4266
  // const pluginProps = [
4188
4267
  // 'animateFill',
4189
4268
  // 'followCursor',
@@ -4266,7 +4345,7 @@ const TippyComponent = defineComponent({
4266
4345
  });
4267
4346
  });
4268
4347
  watch(tippy.state, () => {
4269
- emit('state', unref(tippy.state));
4348
+ emit('state', unref$1(tippy.state));
4270
4349
  }, { immediate: true, deep: true });
4271
4350
  watch(props, () => {
4272
4351
  tippy.setProps(props);
@@ -4278,15 +4357,16 @@ const TippyComponent = defineComponent({
4278
4357
  ...tippy
4279
4358
  };
4280
4359
  expose(exposed);
4281
- const slot = slots.default ? slots.default(exposed) : [];
4282
4360
  return () => {
4361
+ let exposedUnref = vueDeepunref.deepUnref(exposed);
4362
+ const slot = slots.default ? slots.default(exposedUnref) : [];
4283
4363
  return h(props.tag, { ref: elem, 'data-v-tippy': '' }, slots.content ? [
4284
4364
  slot,
4285
4365
  h(props.contentTag, {
4286
4366
  ref: contentElem,
4287
4367
  style: { display: mounted.value ? 'inherit' : 'none' },
4288
4368
  class: props.contentClass
4289
- }, slots.content(exposed)),
4369
+ }, slots.content(exposedUnref)),
4290
4370
  ] : slot);
4291
4371
  };
4292
4372
  },
@@ -1,11 +1,15 @@
1
1
  /*!
2
- * vue-tippy v6.0.0-alpha.50
2
+ * vue-tippy v6.0.0-alpha.53
3
3
  * (c) 2022
4
4
  * @license MIT
5
5
  */
6
6
  var VueTippy = (function (exports, vue) {
7
7
  'use strict';
8
8
 
9
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e['default'] : e; }
10
+
11
+ var vue__default = /*#__PURE__*/_interopDefaultLegacy(vue);
12
+
9
13
  var top = 'top';
10
14
  var bottom = 'bottom';
11
15
  var right = 'right';
@@ -4501,6 +4505,85 @@ var VueTippy = (function (exports, vue) {
4501
4505
  };
4502
4506
  }
4503
4507
 
4508
+ const { unref, isRef } = vue__default;
4509
+
4510
+ const isObject = (val) => val !== null && typeof val === 'object';
4511
+ const isArray = Array.isArray;
4512
+
4513
+ /**
4514
+ * Deeply unref a value, recursing into objects and arrays.
4515
+ *
4516
+ * @param {Mixed} val - The value to deeply unref.
4517
+ *
4518
+ * @return {Mixed}
4519
+ */
4520
+ const deepUnref = (val) => {
4521
+ const checkedVal = isRef(val) ? unref(val) : val;
4522
+
4523
+ if (! isObject(checkedVal)) {
4524
+ return checkedVal;
4525
+ }
4526
+
4527
+ if (isArray(checkedVal)) {
4528
+ return unrefArray(checkedVal);
4529
+ }
4530
+
4531
+ return unrefObject(checkedVal);
4532
+ };
4533
+
4534
+ /**
4535
+ * Unref a value, recursing into it if it's an object.
4536
+ *
4537
+ * @param {Mixed} val - The value to unref.
4538
+ *
4539
+ * @return {Mixed}
4540
+ */
4541
+ const smartUnref = (val) => {
4542
+ // Non-ref object? Go deeper!
4543
+ if (val !== null && ! isRef(val) && typeof val === 'object') {
4544
+ return deepUnref(val);
4545
+ }
4546
+
4547
+ return unref(val);
4548
+ };
4549
+
4550
+ /**
4551
+ * Unref an array, recursively.
4552
+ *
4553
+ * @param {Array} arr - The array to unref.
4554
+ *
4555
+ * @return {Array}
4556
+ */
4557
+ const unrefArray = (arr) => {
4558
+ const unreffed = [];
4559
+
4560
+ arr.forEach((val) => {
4561
+ unreffed.push(smartUnref(val));
4562
+ });
4563
+
4564
+ return unreffed;
4565
+ };
4566
+
4567
+ /**
4568
+ * Unref an object, recursively.
4569
+ *
4570
+ * @param {Object} obj - The object to unref.
4571
+ *
4572
+ * @return {Object}
4573
+ */
4574
+ const unrefObject = (obj) => {
4575
+ const unreffed = {};
4576
+
4577
+ // Object? un-ref it!
4578
+ Object.keys(obj).forEach((key) => {
4579
+ unreffed[key] = smartUnref(obj[key]);
4580
+ });
4581
+
4582
+ return unreffed;
4583
+ };
4584
+
4585
+ var vueDeepunref = { deepUnref };
4586
+
4504
4587
  // const pluginProps = [
4505
4588
  // 'animateFill',
4506
4589
  // 'followCursor',
@@ -4595,15 +4678,16 @@ var VueTippy = (function (exports, vue) {
4595
4678
  ...tippy
4596
4679
  };
4597
4680
  expose(exposed);
4598
- const slot = slots.default ? slots.default(exposed) : [];
4599
4681
  return () => {
4682
+ let exposedUnref = vueDeepunref.deepUnref(exposed);
4683
+ const slot = slots.default ? slots.default(exposedUnref) : [];
4600
4684
  return vue.h(props.tag, { ref: elem, 'data-v-tippy': '' }, slots.content ? [
4601
4685
  slot,
4602
4686
  vue.h(props.contentTag, {
4603
4687
  ref: contentElem,
4604
4688
  style: { display: mounted.value ? 'inherit' : 'none' },
4605
4689
  class: props.contentClass
4606
- }, slots.content(exposed)),
4690
+ }, slots.content(exposedUnref)),
4607
4691
  ] : slot);
4608
4692
  };
4609
4693
  },