@vue-interface/dropdown-menu 2.0.0-beta.3 → 2.0.0-beta.4

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,4 +1,4 @@
1
- import { h as d, resolveComponent as m, openBlock as u, createElementBlock as f, normalizeClass as w, createVNode as h, withCtx as y, renderSlot as g } from "vue";
1
+ import { h as d, Fragment as m, resolveComponent as u, openBlock as f, createElementBlock as w, normalizeClass as h, createVNode as g, withCtx as _, renderSlot as y } from "vue";
2
2
  function s(e, t) {
3
3
  e.props.class = `${e.props.class || ""} ${t}`.trim();
4
4
  }
@@ -10,14 +10,9 @@ function i(e, t) {
10
10
  function p(e, t) {
11
11
  return e.attrs.on[t] || e.type && e.type.listeners && e.componentOptions.listeners[t];
12
12
  }
13
- function _(e) {
14
- return e && e.type && (e.type === "fragment" || typeof e.type == "symbol");
15
- }
16
13
  function a(e) {
17
14
  for (const t of e) {
18
- if (_(t))
19
- return a(t.children);
20
- t.props = Object.assign({ class: void 0 }, t.props), t.attrs = Object.assign({}, t.attrs), t.attrs.on || (t.attrs.on = {});
15
+ t.type === m && a(t.children), t.props = Object.assign({ class: void 0 }, t.props), t.attrs = Object.assign({}, t.attrs), t.attrs.on || (t.attrs.on = {});
21
16
  const n = t.props.class && t.props.class.match(/dropdown-item/), r = t.props.class && t.props.class.match(/dropdown-divider/);
22
17
  t.attrs.on.click = i((o) => {
23
18
  context.parent.$emit("click-item", o, t);
@@ -47,28 +42,28 @@ const b = (e, t) => d("div", {}, a(t.slots.default())), $ = b, k = (e, t) => {
47
42
  },
48
43
  show: Boolean
49
44
  }
50
- }, D = ["aria-labelledby"];
51
- function I(e, t, n, r, o, M) {
52
- const l = m("dropdown-menu-items");
53
- return u(), f("div", {
54
- class: w(["dropdown-menu", {
45
+ }, v = ["aria-labelledby"];
46
+ function D(e, t, n, r, o, I) {
47
+ const l = u("dropdown-menu-items");
48
+ return f(), w("div", {
49
+ class: h(["dropdown-menu", {
55
50
  "dropdown-menu-left": n.align === "left",
56
51
  "dropdown-menu-right": n.align === "right",
57
52
  show: n.show
58
53
  }]),
59
54
  "aria-labelledby": e.$attrs.id
60
55
  }, [
61
- h(l, null, {
62
- default: y(() => [
63
- g(e.$slots, "default", {
56
+ g(l, null, {
57
+ default: _(() => [
58
+ y(e.$slots, "default", {
64
59
  onClick: t[0] || (t[0] = (...c) => e.onItemClick && e.onItemClick(...c))
65
60
  })
66
61
  ]),
67
62
  _: 3
68
63
  })
69
- ], 10, D);
64
+ ], 10, v);
70
65
  }
71
- const v = /* @__PURE__ */ k(C, [["render", I]]);
66
+ const O = /* @__PURE__ */ k(C, [["render", D]]);
72
67
  export {
73
- v as DropdownMenu
68
+ O as DropdownMenu
74
69
  };
@@ -1 +1 @@
1
- (function(r,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],n):(r=typeof globalThis<"u"?globalThis:r||self,n(r.DropdownMenu={},r.Vue))})(this,function(r,n){"use strict";function p(t,e){t.props.class=`${t.props.class||""} ${e}`.trim()}function d(t,e){return o=>{typeof e=="function"&&e(o),o.cancelBubble||t(o)}}function l(t,e){return t.attrs.on[e]||t.type&&t.type.listeners&&t.componentOptions.listeners[e]}function c(t){return t&&t.type&&(t.type==="fragment"||typeof t.type=="symbol")}function a(t){for(const e of t){if(c(e))return a(e.children);e.props=Object.assign({class:void 0},e.props),e.attrs=Object.assign({},e.attrs),e.attrs.on||(e.attrs.on={});const o=e.props.class&&e.props.class.match(/dropdown-item/),i=e.props.class&&e.props.class.match(/dropdown-divider/);e.attrs.on.click=d(s=>{context.parent.$emit("click-item",s,e)},l(e,"click")),e.attrs.on.blur=d(s=>{context.parent.$emit("blur-item",s,e)},l(e,"blur")),typeof e.type=="string"&&e.type.match(/^h\d$/)?p(e,"dropdown-header"):e.type==="hr"&&!i?(e.type="div",p(e,"dropdown-divider")):!o&&!i&&p(e,"dropdown-item")}return t}const u=(t,e)=>n.h("div",{},a(e.slots.default())),f=(t,e)=>{const o=t.__vccOpts||t;for(const[i,s]of e)o[i]=s;return o},m={name:"DropdownMenu",components:{DropdownMenuItems:u},props:{align:{type:String,default:"left",validate(t){return["left","right"].indexOf(t.toLowerCase())!==-1}},show:Boolean}},w=["aria-labelledby"];function h(t,e,o,i,s,D){const g=n.resolveComponent("dropdown-menu-items");return n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["dropdown-menu",{"dropdown-menu-left":o.align==="left","dropdown-menu-right":o.align==="right",show:o.show}]),"aria-labelledby":t.$attrs.id},[n.createVNode(g,null,{default:n.withCtx(()=>[n.renderSlot(t.$slots,"default",{onClick:e[0]||(e[0]=(..._)=>t.onItemClick&&t.onItemClick(..._))})]),_:3})],10,w)}const y=f(m,[["render",h]]);r.DropdownMenu=y,Object.defineProperties(r,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
1
+ (function(s,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],n):(s=typeof globalThis<"u"?globalThis:s||self,n(s.DropdownMenu={},s.Vue))})(this,function(s,n){"use strict";function d(t,e){t.props.class=`${t.props.class||""} ${e}`.trim()}function p(t,e){return o=>{typeof e=="function"&&e(o),o.cancelBubble||t(o)}}function l(t,e){return t.attrs.on[e]||t.type&&t.type.listeners&&t.componentOptions.listeners[e]}function a(t){for(const e of t){e.type===n.Fragment&&a(e.children),e.props=Object.assign({class:void 0},e.props),e.attrs=Object.assign({},e.attrs),e.attrs.on||(e.attrs.on={});const o=e.props.class&&e.props.class.match(/dropdown-item/),i=e.props.class&&e.props.class.match(/dropdown-divider/);e.attrs.on.click=p(r=>{context.parent.$emit("click-item",r,e)},l(e,"click")),e.attrs.on.blur=p(r=>{context.parent.$emit("blur-item",r,e)},l(e,"blur")),typeof e.type=="string"&&e.type.match(/^h\d$/)?d(e,"dropdown-header"):e.type==="hr"&&!i?(e.type="div",d(e,"dropdown-divider")):!o&&!i&&d(e,"dropdown-item")}return t}const c=(t,e)=>n.h("div",{},a(e.slots.default())),u=(t,e)=>{const o=t.__vccOpts||t;for(const[i,r]of e)o[i]=r;return o},f={name:"DropdownMenu",components:{DropdownMenuItems:c},props:{align:{type:String,default:"left",validate(t){return["left","right"].indexOf(t.toLowerCase())!==-1}},show:Boolean}},m=["aria-labelledby"];function w(t,e,o,i,r,b){const y=n.resolveComponent("dropdown-menu-items");return n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["dropdown-menu",{"dropdown-menu-left":o.align==="left","dropdown-menu-right":o.align==="right",show:o.show}]),"aria-labelledby":t.$attrs.id},[n.createVNode(y,null,{default:n.withCtx(()=>[n.renderSlot(t.$slots,"default",{onClick:e[0]||(e[0]=(..._)=>t.onItemClick&&t.onItemClick(..._))})]),_:3})],10,m)}const h=u(f,[["render",w]]);s.DropdownMenu=h,Object.defineProperties(s,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue-interface/dropdown-menu",
3
- "version": "2.0.0-beta.3",
3
+ "version": "2.0.0-beta.4",
4
4
  "description": "A Vue dropdown menu component.",
5
5
  "files": [
6
6
  "index.js",
@@ -1,5 +1,5 @@
1
1
  <script>
2
- import { h, isVNode } from 'vue';
2
+ import { Fragment, h } from 'vue';
3
3
 
4
4
  function appendClass(vnode, str) {
5
5
  vnode.props.class = `${vnode.props.class || ''} ${str}`.trim();
@@ -25,20 +25,10 @@ function listener(vnode, key) {
25
25
  );
26
26
  }
27
27
 
28
- function isDropdownItem(vnode) {
29
- return vnode && vnode.type && vnode.type.name === 'DropdownItem';
30
- }
31
-
32
- function isFragment(vnode) {
33
- // We'll go ahead and assume that if the type is a symbol, then the vnode is fragment.
34
- // This may be a faulty assumption; if it is, it'll need to be changed.
35
- return vnode && vnode.type && (vnode.type === 'fragment' || typeof vnode.type === 'symbol');
36
- }
37
-
38
- function changeMenuItems(items) {
28
+ function changeMenuItems(items) {
39
29
  for(const vnode of items) {
40
- if(isFragment(vnode)) {
41
- return changeMenuItems(vnode.children);
30
+ if(vnode.type === Fragment) {
31
+ changeMenuItems(vnode.children);
42
32
  }
43
33
 
44
34
  vnode.props = Object.assign({ class: undefined }, vnode.props);