@destyler/popper 0.0.1-beta.13 → 0.0.1-beta.15

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023-PRESENT Elone Hoo
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/dist/index.cjs CHANGED
@@ -41,20 +41,20 @@ const DestylerPopperAnchor = vue.defineComponent({
41
41
  name: "DestylerPopperAnchor",
42
42
  props: destylerPopperAnchorProps,
43
43
  setup(props) {
44
- const { customElement, currentElement } = composition.useCustomElement();
44
+ const { forwardRef, currentElement } = composition.useForwardExpose();
45
45
  const rootContext = injectPopperRootContext();
46
46
  vue.watch(currentElement, () => {
47
47
  rootContext.onAnchorChange(props.element ?? currentElement.value);
48
48
  });
49
49
  return {
50
- customElement
50
+ forwardRef
51
51
  };
52
52
  },
53
53
  render() {
54
54
  return vue.h(primitive.DestylerPrimitive, {
55
55
  as: this.$props.as,
56
56
  asChild: this.$props.asChild,
57
- ref: "customElement"
57
+ ref: (el) => this.forwardRef(el)
58
58
  }, {
59
59
  default: () => this.$slots.default?.()
60
60
  });
@@ -185,8 +185,7 @@ const DestylerPopperContent = vue.defineComponent({
185
185
  props: destylerPopperContentProps,
186
186
  setup(props, { attrs }) {
187
187
  const rootContext = injectPopperRootContext();
188
- const forwardRef = composition.useForwardRef();
189
- const { customElement, currentElement: contentElement } = composition.useCustomElement();
188
+ const { forwardRef, currentElement: contentElement } = composition.useForwardExpose();
190
189
  const floatingRef = vue.ref();
191
190
  const arrow = vue.ref();
192
191
  const { width: arrowWidth, height: arrowHeight } = composition.useSize(arrow);
@@ -300,7 +299,6 @@ const DestylerPopperContent = vue.defineComponent({
300
299
  contentZIndex,
301
300
  middlewareData,
302
301
  forwardRef,
303
- customElement,
304
302
  placedSide,
305
303
  placedAlign,
306
304
  attrStyle: attrs.style
@@ -321,10 +319,7 @@ const DestylerPopperContent = vue.defineComponent({
321
319
  ].join(" ")
322
320
  }
323
321
  }, vue.h(primitive.DestylerPrimitive, vue.mergeProps(this.$attrs, {
324
- "ref": (vnode) => {
325
- this.forwardRef(vnode);
326
- this.customElement = vnode;
327
- },
322
+ "ref": (el) => this.forwardRef(el),
328
323
  "as": this.$props.as,
329
324
  "asChild": this.$props.asChild,
330
325
  "data-side": this.placedSide,
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as vue from 'vue';
2
- import { PropType, Component, Ref, ComponentPublicInstance } from 'vue';
2
+ import { PropType, Component, Ref } from 'vue';
3
3
  import { AsTag } from '@destyler/primitive';
4
4
  import { ExtractPublicPropTypes, Measurable } from '@destyler/shared';
5
5
  import * as _floating_ui_vue from '@floating-ui/vue';
@@ -37,7 +37,7 @@ declare const DestylerPopperAnchor: vue.DefineComponent<{
37
37
  readonly type: PropType<Measurable>;
38
38
  };
39
39
  }, {
40
- customElement: vue.Ref<vue.ComponentPublicInstance | undefined>;
40
+ forwardRef: (ref: Element | vue.ComponentPublicInstance | null) => void;
41
41
  }, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
42
42
  readonly as: {
43
43
  readonly type: PropType<AsTag | Component>;
@@ -231,8 +231,7 @@ declare const DestylerPopperContent: vue.DefineComponent<{
231
231
  isPositioned: Readonly<Ref<boolean>>;
232
232
  contentZIndex: Ref<string>;
233
233
  middlewareData: Readonly<Ref<_floating_ui_vue.MiddlewareData>>;
234
- forwardRef: (ref: any) => void;
235
- customElement: Ref<ComponentPublicInstance | undefined>;
234
+ forwardRef: (ref: Element | vue.ComponentPublicInstance | null) => void;
236
235
  placedSide: vue.ComputedRef<"top" | "right" | "bottom" | "left">;
237
236
  placedAlign: vue.ComputedRef<"start" | "center" | "end">;
238
237
  attrStyle: any;
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as vue from 'vue';
2
- import { PropType, Component, Ref, ComponentPublicInstance } from 'vue';
2
+ import { PropType, Component, Ref } from 'vue';
3
3
  import { AsTag } from '@destyler/primitive';
4
4
  import { ExtractPublicPropTypes, Measurable } from '@destyler/shared';
5
5
  import * as _floating_ui_vue from '@floating-ui/vue';
@@ -37,7 +37,7 @@ declare const DestylerPopperAnchor: vue.DefineComponent<{
37
37
  readonly type: PropType<Measurable>;
38
38
  };
39
39
  }, {
40
- customElement: vue.Ref<vue.ComponentPublicInstance | undefined>;
40
+ forwardRef: (ref: Element | vue.ComponentPublicInstance | null) => void;
41
41
  }, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
42
42
  readonly as: {
43
43
  readonly type: PropType<AsTag | Component>;
@@ -231,8 +231,7 @@ declare const DestylerPopperContent: vue.DefineComponent<{
231
231
  isPositioned: Readonly<Ref<boolean>>;
232
232
  contentZIndex: Ref<string>;
233
233
  middlewareData: Readonly<Ref<_floating_ui_vue.MiddlewareData>>;
234
- forwardRef: (ref: any) => void;
235
- customElement: Ref<ComponentPublicInstance | undefined>;
234
+ forwardRef: (ref: Element | vue.ComponentPublicInstance | null) => void;
236
235
  placedSide: vue.ComputedRef<"top" | "right" | "bottom" | "left">;
237
236
  placedAlign: vue.ComputedRef<"start" | "center" | "end">;
238
237
  attrStyle: any;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as vue from 'vue';
2
- import { PropType, Component, Ref, ComponentPublicInstance } from 'vue';
2
+ import { PropType, Component, Ref } from 'vue';
3
3
  import { AsTag } from '@destyler/primitive';
4
4
  import { ExtractPublicPropTypes, Measurable } from '@destyler/shared';
5
5
  import * as _floating_ui_vue from '@floating-ui/vue';
@@ -37,7 +37,7 @@ declare const DestylerPopperAnchor: vue.DefineComponent<{
37
37
  readonly type: PropType<Measurable>;
38
38
  };
39
39
  }, {
40
- customElement: vue.Ref<vue.ComponentPublicInstance | undefined>;
40
+ forwardRef: (ref: Element | vue.ComponentPublicInstance | null) => void;
41
41
  }, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
42
42
  readonly as: {
43
43
  readonly type: PropType<AsTag | Component>;
@@ -231,8 +231,7 @@ declare const DestylerPopperContent: vue.DefineComponent<{
231
231
  isPositioned: Readonly<Ref<boolean>>;
232
232
  contentZIndex: Ref<string>;
233
233
  middlewareData: Readonly<Ref<_floating_ui_vue.MiddlewareData>>;
234
- forwardRef: (ref: any) => void;
235
- customElement: Ref<ComponentPublicInstance | undefined>;
234
+ forwardRef: (ref: Element | vue.ComponentPublicInstance | null) => void;
236
235
  placedSide: vue.ComputedRef<"top" | "right" | "bottom" | "left">;
237
236
  placedAlign: vue.ComputedRef<"start" | "center" | "end">;
238
237
  attrStyle: any;
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { defineComponent, ref, watch, h, computed, watchEffect, mergeProps } from 'vue';
2
2
  import { createContext, computedEager } from '@destyler/shared';
3
3
  import { DestylerPrimitive } from '@destyler/primitive';
4
- import { useCustomElement, useForwardRef, useSize } from '@destyler/composition';
4
+ import { useForwardExpose, useSize } from '@destyler/composition';
5
5
  import { offset, shift, limitShift, flip, size, arrow, hide, useFloating, autoUpdate } from '@floating-ui/vue';
6
6
  import { DestylerArrow } from '@destyler/arrow';
7
7
 
@@ -39,20 +39,20 @@ const DestylerPopperAnchor = defineComponent({
39
39
  name: "DestylerPopperAnchor",
40
40
  props: destylerPopperAnchorProps,
41
41
  setup(props) {
42
- const { customElement, currentElement } = useCustomElement();
42
+ const { forwardRef, currentElement } = useForwardExpose();
43
43
  const rootContext = injectPopperRootContext();
44
44
  watch(currentElement, () => {
45
45
  rootContext.onAnchorChange(props.element ?? currentElement.value);
46
46
  });
47
47
  return {
48
- customElement
48
+ forwardRef
49
49
  };
50
50
  },
51
51
  render() {
52
52
  return h(DestylerPrimitive, {
53
53
  as: this.$props.as,
54
54
  asChild: this.$props.asChild,
55
- ref: "customElement"
55
+ ref: (el) => this.forwardRef(el)
56
56
  }, {
57
57
  default: () => this.$slots.default?.()
58
58
  });
@@ -183,8 +183,7 @@ const DestylerPopperContent = defineComponent({
183
183
  props: destylerPopperContentProps,
184
184
  setup(props, { attrs }) {
185
185
  const rootContext = injectPopperRootContext();
186
- const forwardRef = useForwardRef();
187
- const { customElement, currentElement: contentElement } = useCustomElement();
186
+ const { forwardRef, currentElement: contentElement } = useForwardExpose();
188
187
  const floatingRef = ref();
189
188
  const arrow$1 = ref();
190
189
  const { width: arrowWidth, height: arrowHeight } = useSize(arrow$1);
@@ -298,7 +297,6 @@ const DestylerPopperContent = defineComponent({
298
297
  contentZIndex,
299
298
  middlewareData,
300
299
  forwardRef,
301
- customElement,
302
300
  placedSide,
303
301
  placedAlign,
304
302
  attrStyle: attrs.style
@@ -319,10 +317,7 @@ const DestylerPopperContent = defineComponent({
319
317
  ].join(" ")
320
318
  }
321
319
  }, h(DestylerPrimitive, mergeProps(this.$attrs, {
322
- "ref": (vnode) => {
323
- this.forwardRef(vnode);
324
- this.customElement = vnode;
325
- },
320
+ "ref": (el) => this.forwardRef(el),
326
321
  "as": this.$props.as,
327
322
  "asChild": this.$props.asChild,
328
323
  "data-side": this.placedSide,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@destyler/popper",
3
- "version": "0.0.1-beta.13",
3
+ "version": "0.0.1-beta.15",
4
4
  "description": "unstyled popper component for vue",
5
5
  "author": "Elone Hoo <elonehoo@gmail.com>",
6
6
  "license": "MIT",
@@ -34,10 +34,10 @@
34
34
  },
35
35
  "dependencies": {
36
36
  "@floating-ui/vue": "^1.0.4",
37
- "@destyler/arrow": "0.0.1-beta.13",
38
- "@destyler/shared": "0.0.1-beta.13",
39
- "@destyler/primitive": "0.0.1-beta.13",
40
- "@destyler/composition": "0.0.1-beta.13"
37
+ "@destyler/composition": "0.0.1-beta.15",
38
+ "@destyler/shared": "0.0.1-beta.15",
39
+ "@destyler/arrow": "0.0.1-beta.15",
40
+ "@destyler/primitive": "0.0.1-beta.15"
41
41
  },
42
42
  "scripts": {
43
43
  "clear": "rimraf ./dist",