@m2s2/vue-lib 2.0.0 → 2.1.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.
Files changed (78) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/index.mjs +29 -26
  3. package/dist/index10.cjs +1 -1
  4. package/dist/index10.mjs +8 -16
  5. package/dist/index12.cjs +1 -1
  6. package/dist/index12.mjs +15 -19
  7. package/dist/index14.cjs +1 -1
  8. package/dist/index14.mjs +20 -27
  9. package/dist/index16.cjs +1 -1
  10. package/dist/index16.mjs +28 -262
  11. package/dist/index18.cjs +1 -1
  12. package/dist/index18.mjs +263 -13
  13. package/dist/index2.cjs +1 -1
  14. package/dist/index2.mjs +250 -11
  15. package/dist/index20.cjs +1 -1
  16. package/dist/index20.mjs +13 -38
  17. package/dist/index22.cjs +1 -1
  18. package/dist/index22.mjs +35 -49
  19. package/dist/index24.cjs +1 -1
  20. package/dist/index24.mjs +47 -78
  21. package/dist/index26.cjs +1 -1
  22. package/dist/index26.mjs +78 -101
  23. package/dist/index28.cjs +1 -1
  24. package/dist/index28.mjs +101 -63
  25. package/dist/index30.cjs +1 -1
  26. package/dist/index30.mjs +52 -65
  27. package/dist/index32.cjs +1 -1
  28. package/dist/index32.mjs +85 -3
  29. package/dist/index34.cjs +1 -1
  30. package/dist/index34.mjs +1 -1
  31. package/dist/index35.cjs +1 -1
  32. package/dist/index35.mjs +1 -1
  33. package/dist/index36.cjs +1 -1
  34. package/dist/index36.mjs +2 -2
  35. package/dist/index37.cjs +1 -1
  36. package/dist/index37.mjs +2 -2
  37. package/dist/index38.cjs +1 -1
  38. package/dist/index38.mjs +1 -1
  39. package/dist/index39.cjs +1 -1
  40. package/dist/index39.mjs +1 -1
  41. package/dist/index4.cjs +1 -1
  42. package/dist/index4.mjs +11 -19
  43. package/dist/index40.cjs +1 -1
  44. package/dist/index40.mjs +1 -1
  45. package/dist/index41.cjs +1 -1
  46. package/dist/index41.mjs +1 -1
  47. package/dist/index42.cjs +1 -1
  48. package/dist/index42.mjs +1 -1
  49. package/dist/index43.cjs +1 -1
  50. package/dist/index43.mjs +1 -1
  51. package/dist/index44.cjs +1 -1
  52. package/dist/index44.mjs +1 -1
  53. package/dist/index45.cjs +1 -1
  54. package/dist/index45.mjs +1 -1
  55. package/dist/index46.cjs +1 -1
  56. package/dist/index46.mjs +1 -1
  57. package/dist/index47.cjs +1 -1
  58. package/dist/index47.mjs +3 -51
  59. package/dist/index48.cjs +1 -1
  60. package/dist/index48.mjs +3 -2
  61. package/dist/index49.cjs +1 -0
  62. package/dist/index49.mjs +5 -0
  63. package/dist/index50.cjs +1 -0
  64. package/dist/index50.mjs +53 -0
  65. package/dist/index51.cjs +1 -0
  66. package/dist/index51.mjs +4 -0
  67. package/dist/index6.cjs +1 -1
  68. package/dist/index6.mjs +21 -15
  69. package/dist/index8.cjs +1 -1
  70. package/dist/index8.mjs +15 -10
  71. package/dist/vue-lib/src/components/Chat/Chat.vue.d.ts +22 -0
  72. package/dist/vue-lib/src/components/Chat/Chat.vue.d.ts.map +1 -0
  73. package/dist/vue-lib/src/index.d.ts +1 -0
  74. package/dist/vue-lib/src/index.d.ts.map +1 -1
  75. package/dist/vue-lib.css +1 -1
  76. package/package.json +5 -5
  77. package/dist/index33.cjs +0 -1
  78. package/dist/index33.mjs +0 -5
package/dist/index22.mjs CHANGED
@@ -1,58 +1,44 @@
1
- import { defineComponent as d, openBlock as c, createElementBlock as n, createElementVNode as t, toDisplayString as i, createCommentVNode as l, Fragment as r, renderList as g } from "vue";
2
- const m = { class: "m2s2-blog-card" }, f = { class: "bc-cover" }, h = ["src", "alt"], u = {
3
- key: 1,
4
- class: "bc-cover-placeholder"
5
- }, b = { class: "bc-cover-tag" }, v = { class: "bc-inner" }, y = { class: "bc-meta" }, _ = ["dateTime"], k = {
1
+ import { defineComponent as f, openBlock as t, createBlock as r, withCtx as l, createElementVNode as o, createElementBlock as n, createCommentVNode as i, toDisplayString as c, Fragment as d, renderList as u } from "vue";
2
+ import m from "./index20.mjs";
3
+ /* empty css */
4
+ const g = { class: "fc-header" }, h = ["innerHTML"], k = { class: "fc-title" }, y = { class: "fc-body" }, _ = {
6
5
  key: 0,
7
- class: "bc-reading-time"
8
- }, D = { class: "bc-title" }, T = ["href"], B = { class: "bc-summary" }, C = { class: "bc-tags" }, E = /* @__PURE__ */ d({
9
- __name: "BlogCard",
6
+ class: "fc-list"
7
+ }, C = {
8
+ key: 1,
9
+ class: "fc-note"
10
+ }, F = /* @__PURE__ */ f({
11
+ __name: "FeatureCard",
10
12
  props: {
11
13
  config: {}
12
14
  },
13
15
  setup(e) {
14
- function a(o) {
15
- return new Date(o).toLocaleDateString("en-US", {
16
- year: "numeric",
17
- month: "long",
18
- day: "numeric"
19
- });
20
- }
21
- return (o, S) => (c(), n("div", m, [
22
- t("div", f, [
23
- e.config.coverImage ? (c(), n("img", {
24
- key: 0,
25
- src: e.config.coverImage,
26
- alt: e.config.title,
27
- class: "bc-cover-img",
28
- loading: "lazy"
29
- }, null, 8, h)) : (c(), n("div", u, [
30
- t("span", b, i(e.config.tags[0]), 1)
31
- ]))
32
- ]),
33
- t("div", v, [
34
- t("div", y, [
35
- t("time", {
36
- dateTime: e.config.date
37
- }, i(a(e.config.date)), 9, _),
38
- e.config.readingTime ? (c(), n("span", k, i(e.config.readingTime) + " min read", 1)) : l("", !0)
39
- ]),
40
- t("h2", D, [
41
- t("a", {
42
- href: `/blog/${e.config.slug}`
43
- }, i(e.config.title), 9, T)
44
- ]),
45
- t("p", B, i(e.config.summary), 1),
46
- t("div", C, [
47
- (c(!0), n(r, null, g(e.config.tags, (s) => (c(), n("span", {
48
- key: s,
49
- class: "bc-tag"
50
- }, i(s), 1))), 128))
51
- ])
52
- ])
53
- ]));
16
+ return (x, B) => (t(), r(m, {
17
+ featured: e.config.featured ?? !1
18
+ }, {
19
+ default: l(() => {
20
+ var a;
21
+ return [
22
+ o("div", g, [
23
+ e.config.icon ? (t(), n("span", {
24
+ key: 0,
25
+ class: "fc-icon",
26
+ "aria-hidden": "true",
27
+ innerHTML: e.config.icon
28
+ }, null, 8, h)) : i("", !0),
29
+ o("h2", k, c(e.config.title), 1)
30
+ ]),
31
+ o("p", y, c(e.config.body), 1),
32
+ (a = e.config.items) != null && a.length ? (t(), n("ul", _, [
33
+ (t(!0), n(d, null, u(e.config.items, (s) => (t(), n("li", { key: s }, c(s), 1))), 128))
34
+ ])) : i("", !0),
35
+ e.config.note ? (t(), n("p", C, c(e.config.note), 1)) : i("", !0)
36
+ ];
37
+ }),
38
+ _: 1
39
+ }, 8, ["featured"]));
54
40
  }
55
41
  });
56
42
  export {
57
- E as default
43
+ F as default
58
44
  };
package/dist/index24.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";const e=require("vue"),h={class:"table-panel"},f={key:0,class:"dt-empty"},g={class:"dt-toolbar"},y=["placeholder","value"],C={class:"dt-pills"},v=["onClick"],B={class:"dt-count"},E={key:0,class:"dt-col-panel"},p=["checked","onChange"],V={class:"dt-scroll"},b=e.defineComponent({__name:"DataTable",props:{columnDefs:{default:()=>[]},colVisibility:{default:()=>({})},statuses:{default:()=>[]},statusFilter:{default:"all"},statusLabels:{default:()=>({})},searchValue:{default:""},searchPlaceholder:{default:"Search…"},totalCount:{default:0},filteredCount:{default:0},emptyMessage:{default:"No data yet."}},emits:["searchChange","statusChange","colToggle"],setup(t,{emit:u}){const i=t,c=u,o=e.ref(!1),s=e.ref(null);function d(a){return a==="all"?"All":i.statusLabels[a]??a}function r(a){var n;(n=s.value)!=null&&n.contains(a.target)||(o.value=!1,document.removeEventListener("click",r))}function m(){o.value=!o.value,o.value&&setTimeout(()=>document.addEventListener("click",r),0)}return(a,n)=>(e.openBlock(),e.createElementBlock("div",h,[t.totalCount===0?(e.openBlock(),e.createElementBlock("p",f,e.toDisplayString(t.emptyMessage),1)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("div",g,[t.statuses.length>0?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("input",{class:"dt-search",type:"search",placeholder:t.searchPlaceholder,value:t.searchValue,onInput:n[0]||(n[0]=l=>c("searchChange",l.target.value))},null,40,y),e.createElementVNode("div",C,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.statuses,l=>(e.openBlock(),e.createElementBlock("button",{key:l,class:e.normalizeClass(["dt-pill",{"dt-pill--active":t.statusFilter===l}]),onClick:k=>c("statusChange",l)},e.toDisplayString(d(l)),11,v))),128))]),e.createElementVNode("span",B,e.toDisplayString(t.filteredCount)+" of "+e.toDisplayString(t.totalCount),1)],64)):e.createCommentVNode("",!0),t.columnDefs.length>0?(e.openBlock(),e.createElementBlock("div",{key:1,ref_key:"colWrapRef",ref:s,class:"dt-col-wrap"},[e.createElementVNode("button",{class:"dt-col-btn",onClick:m},"⚙ Columns"),o.value?(e.openBlock(),e.createElementBlock("div",E,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.columnDefs,l=>(e.openBlock(),e.createElementBlock("label",{key:l.key,class:"dt-col-check"},[e.createElementVNode("input",{type:"checkbox",checked:t.colVisibility[l.key]??!0,onChange:k=>c("colToggle",l.key)},null,40,p),e.createTextVNode(" "+e.toDisplayString(l.label),1)]))),128))])):e.createCommentVNode("",!0)],512)):e.createCommentVNode("",!0)]),e.createElementVNode("div",V,[e.renderSlot(a.$slots,"default")])],64))]))}});module.exports=b;
1
+ "use strict";const e=require("vue"),a={class:"m2s2-blog-card"},i={class:"bc-cover"},s=["src","alt"],l={key:1,class:"bc-cover-placeholder"},r={class:"bc-cover-tag"},d={class:"bc-inner"},m={class:"bc-meta"},g=["dateTime"],f={key:0,class:"bc-reading-time"},h={class:"bc-title"},u=["href"],k={class:"bc-summary"},y={class:"bc-tags"},E=e.defineComponent({__name:"BlogCard",props:{config:{}},setup(t){function o(c){return new Date(c).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})}return(c,b)=>(e.openBlock(),e.createElementBlock("div",a,[e.createElementVNode("div",i,[t.config.coverImage?(e.openBlock(),e.createElementBlock("img",{key:0,src:t.config.coverImage,alt:t.config.title,class:"bc-cover-img",loading:"lazy"},null,8,s)):(e.openBlock(),e.createElementBlock("div",l,[e.createElementVNode("span",r,e.toDisplayString(t.config.tags[0]),1)]))]),e.createElementVNode("div",d,[e.createElementVNode("div",m,[e.createElementVNode("time",{dateTime:t.config.date},e.toDisplayString(o(t.config.date)),9,g),t.config.readingTime?(e.openBlock(),e.createElementBlock("span",f,e.toDisplayString(t.config.readingTime)+" min read",1)):e.createCommentVNode("",!0)]),e.createElementVNode("h2",h,[e.createElementVNode("a",{href:`/blog/${t.config.slug}`},e.toDisplayString(t.config.title),9,u)]),e.createElementVNode("p",k,e.toDisplayString(t.config.summary),1),e.createElementVNode("div",y,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.config.tags,n=>(e.openBlock(),e.createElementBlock("span",{key:n,class:"bc-tag"},e.toDisplayString(n),1))),128))])])]))}});module.exports=E;
package/dist/index24.mjs CHANGED
@@ -1,89 +1,58 @@
1
- import { defineComponent as V, ref as m, openBlock as l, createElementBlock as a, toDisplayString as u, Fragment as d, createElementVNode as n, renderList as k, normalizeClass as p, createCommentVNode as r, createTextVNode as D, renderSlot as L } from "vue";
2
- const T = { class: "table-panel" }, E = {
1
+ import { defineComponent as d, openBlock as c, createElementBlock as n, createElementVNode as t, toDisplayString as i, createCommentVNode as l, Fragment as r, renderList as g } from "vue";
2
+ const m = { class: "m2s2-blog-card" }, f = { class: "bc-cover" }, h = ["src", "alt"], u = {
3
+ key: 1,
4
+ class: "bc-cover-placeholder"
5
+ }, b = { class: "bc-cover-tag" }, v = { class: "bc-inner" }, y = { class: "bc-meta" }, _ = ["dateTime"], k = {
3
6
  key: 0,
4
- class: "dt-empty"
5
- }, N = { class: "dt-toolbar" }, S = ["placeholder", "value"], x = { class: "dt-pills" }, F = ["onClick"], $ = { class: "dt-count" }, w = {
6
- key: 0,
7
- class: "dt-col-panel"
8
- }, B = ["checked", "onChange"], M = { class: "dt-scroll" }, R = /* @__PURE__ */ V({
9
- __name: "DataTable",
7
+ class: "bc-reading-time"
8
+ }, D = { class: "bc-title" }, T = ["href"], B = { class: "bc-summary" }, C = { class: "bc-tags" }, E = /* @__PURE__ */ d({
9
+ __name: "BlogCard",
10
10
  props: {
11
- columnDefs: { default: () => [] },
12
- colVisibility: { default: () => ({}) },
13
- statuses: { default: () => [] },
14
- statusFilter: { default: "all" },
15
- statusLabels: { default: () => ({}) },
16
- searchValue: { default: "" },
17
- searchPlaceholder: { default: "Search…" },
18
- totalCount: { default: 0 },
19
- filteredCount: { default: 0 },
20
- emptyMessage: { default: "No data yet." }
11
+ config: {}
21
12
  },
22
- emits: ["searchChange", "statusChange", "colToggle"],
23
- setup(e, { emit: g }) {
24
- const v = e, i = g, o = m(!1), h = m(null);
25
- function C(s) {
26
- return s === "all" ? "All" : v.statusLabels[s] ?? s;
27
- }
28
- function f(s) {
29
- var c;
30
- (c = h.value) != null && c.contains(s.target) || (o.value = !1, document.removeEventListener("click", f));
13
+ setup(e) {
14
+ function a(o) {
15
+ return new Date(o).toLocaleDateString("en-US", {
16
+ year: "numeric",
17
+ month: "long",
18
+ day: "numeric"
19
+ });
31
20
  }
32
- function y() {
33
- o.value = !o.value, o.value && setTimeout(() => document.addEventListener("click", f), 0);
34
- }
35
- return (s, c) => (l(), a("div", T, [
36
- e.totalCount === 0 ? (l(), a("p", E, u(e.emptyMessage), 1)) : (l(), a(d, { key: 1 }, [
37
- n("div", N, [
38
- e.statuses.length > 0 ? (l(), a(d, { key: 0 }, [
39
- n("input", {
40
- class: "dt-search",
41
- type: "search",
42
- placeholder: e.searchPlaceholder,
43
- value: e.searchValue,
44
- onInput: c[0] || (c[0] = (t) => i("searchChange", t.target.value))
45
- }, null, 40, S),
46
- n("div", x, [
47
- (l(!0), a(d, null, k(e.statuses, (t) => (l(), a("button", {
48
- key: t,
49
- class: p(["dt-pill", { "dt-pill--active": e.statusFilter === t }]),
50
- onClick: (b) => i("statusChange", t)
51
- }, u(C(t)), 11, F))), 128))
52
- ]),
53
- n("span", $, u(e.filteredCount) + " of " + u(e.totalCount), 1)
54
- ], 64)) : r("", !0),
55
- e.columnDefs.length > 0 ? (l(), a("div", {
56
- key: 1,
57
- ref_key: "colWrapRef",
58
- ref: h,
59
- class: "dt-col-wrap"
60
- }, [
61
- n("button", {
62
- class: "dt-col-btn",
63
- onClick: y
64
- }, "⚙ Columns"),
65
- o.value ? (l(), a("div", w, [
66
- (l(!0), a(d, null, k(e.columnDefs, (t) => (l(), a("label", {
67
- key: t.key,
68
- class: "dt-col-check"
69
- }, [
70
- n("input", {
71
- type: "checkbox",
72
- checked: e.colVisibility[t.key] ?? !0,
73
- onChange: (b) => i("colToggle", t.key)
74
- }, null, 40, B),
75
- D(" " + u(t.label), 1)
76
- ]))), 128))
77
- ])) : r("", !0)
78
- ], 512)) : r("", !0)
21
+ return (o, S) => (c(), n("div", m, [
22
+ t("div", f, [
23
+ e.config.coverImage ? (c(), n("img", {
24
+ key: 0,
25
+ src: e.config.coverImage,
26
+ alt: e.config.title,
27
+ class: "bc-cover-img",
28
+ loading: "lazy"
29
+ }, null, 8, h)) : (c(), n("div", u, [
30
+ t("span", b, i(e.config.tags[0]), 1)
31
+ ]))
32
+ ]),
33
+ t("div", v, [
34
+ t("div", y, [
35
+ t("time", {
36
+ dateTime: e.config.date
37
+ }, i(a(e.config.date)), 9, _),
38
+ e.config.readingTime ? (c(), n("span", k, i(e.config.readingTime) + " min read", 1)) : l("", !0)
39
+ ]),
40
+ t("h2", D, [
41
+ t("a", {
42
+ href: `/blog/${e.config.slug}`
43
+ }, i(e.config.title), 9, T)
79
44
  ]),
80
- n("div", M, [
81
- L(s.$slots, "default")
45
+ t("p", B, i(e.config.summary), 1),
46
+ t("div", C, [
47
+ (c(!0), n(r, null, g(e.config.tags, (s) => (c(), n("span", {
48
+ key: s,
49
+ class: "bc-tag"
50
+ }, i(s), 1))), 128))
82
51
  ])
83
- ], 64))
52
+ ])
84
53
  ]));
85
54
  }
86
55
  });
87
56
  export {
88
- R as default
57
+ E as default
89
58
  };
package/dist/index26.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";const e=require("vue"),b={key:0,class:"sub-form"},d=["disabled"],m=["disabled"],v=["disabled"],p={key:0,class:"sub-feedback sub-feedback--error"},k={key:1,class:"sub-success"},g={key:1,class:"sub-auth"},f=["disabled"],y={key:0,class:"sub-feedback sub-feedback--success"},h=["disabled"],B={key:2,class:"sub-feedback sub-feedback--error"},_=e.defineComponent({__name:"SubscribeForm",props:{mode:{default:"anon"},subscribeAnon:{},subscribeAuth:{},unsubscribeAuth:{}},setup(c){const u=c,n=e.ref(""),l=e.ref(""),t=e.ref("idle"),o=e.ref(!1),r=e.computed(()=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(n.value.trim()));async function a(){if(t.value!=="submitting")if(u.mode==="auth")if(o.value){if(!u.unsubscribeAuth)return;t.value="submitting";try{await u.unsubscribeAuth(),o.value=!1,t.value="idle"}catch{t.value="error"}}else{if(!u.subscribeAuth)return;t.value="submitting";try{await u.subscribeAuth(),o.value=!0,t.value="done"}catch{t.value="error"}}else{if(!r.value||!u.subscribeAnon)return;t.value="submitting";try{await u.subscribeAnon(n.value.trim(),l.value.trim()),t.value="done"}catch{t.value="error"}}}return(E,s)=>c.mode==="anon"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[t.value!=="done"?(e.openBlock(),e.createElementBlock("div",b,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":s[0]||(s[0]=i=>l.value=i),class:"sub-input",type:"text",placeholder:"Your name (optional)",disabled:t.value==="submitting"},null,8,d),[[e.vModelText,l.value]]),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":s[1]||(s[1]=i=>n.value=i),class:"sub-input",type:"email",placeholder:"your@email.com",disabled:t.value==="submitting"},null,8,m),[[e.vModelText,n.value]]),e.createElementVNode("button",{class:"sub-btn",disabled:!r.value||t.value==="submitting",onClick:a},e.toDisplayString(t.value==="submitting"?"Submitting…":"Subscribe"),9,v),t.value==="error"?(e.openBlock(),e.createElementBlock("p",p," Something went wrong — please try again. ")):e.createCommentVNode("",!0)])):(e.openBlock(),e.createElementBlock("div",k,[...s[2]||(s[2]=[e.createElementVNode("span",{class:"sub-success-icon"},"✓",-1),e.createElementVNode("p",{class:"sub-success-text"},"Check your email to confirm your subscription.",-1)])]))],64)):(e.openBlock(),e.createElementBlock("div",g,[o.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[s[3]||(s[3]=e.createElementVNode("span",{class:"sub-subscribed-label"},"✓ Subscribed to blog updates",-1)),e.createElementVNode("button",{class:"sub-btn sub-btn--unsub",disabled:t.value==="submitting",onClick:a},e.toDisplayString(t.value==="submitting"?"Unsubscribing…":"Unsubscribe"),9,h)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("button",{class:"sub-btn",disabled:t.value==="submitting",onClick:a},e.toDisplayString(t.value==="submitting"?"Subscribing…":"Subscribe to Blog Updates"),9,f),t.value==="done"?(e.openBlock(),e.createElementBlock("p",y,"You're subscribed!")):e.createCommentVNode("",!0)],64)),t.value==="error"?(e.openBlock(),e.createElementBlock("p",B," Something went wrong — please try again. ")):e.createCommentVNode("",!0)]))}});module.exports=_;
1
+ "use strict";const e=require("vue"),h={class:"table-panel"},f={key:0,class:"dt-empty"},g={class:"dt-toolbar"},y=["placeholder","value"],C={class:"dt-pills"},v=["onClick"],B={class:"dt-count"},E={key:0,class:"dt-col-panel"},p=["checked","onChange"],V={class:"dt-scroll"},b=e.defineComponent({__name:"DataTable",props:{columnDefs:{default:()=>[]},colVisibility:{default:()=>({})},statuses:{default:()=>[]},statusFilter:{default:"all"},statusLabels:{default:()=>({})},searchValue:{default:""},searchPlaceholder:{default:"Search…"},totalCount:{default:0},filteredCount:{default:0},emptyMessage:{default:"No data yet."}},emits:["searchChange","statusChange","colToggle"],setup(t,{emit:u}){const i=t,c=u,o=e.ref(!1),s=e.ref(null);function d(a){return a==="all"?"All":i.statusLabels[a]??a}function r(a){var n;(n=s.value)!=null&&n.contains(a.target)||(o.value=!1,document.removeEventListener("click",r))}function m(){o.value=!o.value,o.value&&setTimeout(()=>document.addEventListener("click",r),0)}return(a,n)=>(e.openBlock(),e.createElementBlock("div",h,[t.totalCount===0?(e.openBlock(),e.createElementBlock("p",f,e.toDisplayString(t.emptyMessage),1)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("div",g,[t.statuses.length>0?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("input",{class:"dt-search",type:"search",placeholder:t.searchPlaceholder,value:t.searchValue,onInput:n[0]||(n[0]=l=>c("searchChange",l.target.value))},null,40,y),e.createElementVNode("div",C,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.statuses,l=>(e.openBlock(),e.createElementBlock("button",{key:l,class:e.normalizeClass(["dt-pill",{"dt-pill--active":t.statusFilter===l}]),onClick:k=>c("statusChange",l)},e.toDisplayString(d(l)),11,v))),128))]),e.createElementVNode("span",B,e.toDisplayString(t.filteredCount)+" of "+e.toDisplayString(t.totalCount),1)],64)):e.createCommentVNode("",!0),t.columnDefs.length>0?(e.openBlock(),e.createElementBlock("div",{key:1,ref_key:"colWrapRef",ref:s,class:"dt-col-wrap"},[e.createElementVNode("button",{class:"dt-col-btn",onClick:m}," Columns"),o.value?(e.openBlock(),e.createElementBlock("div",E,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.columnDefs,l=>(e.openBlock(),e.createElementBlock("label",{key:l.key,class:"dt-col-check"},[e.createElementVNode("input",{type:"checkbox",checked:t.colVisibility[l.key]??!0,onChange:k=>c("colToggle",l.key)},null,40,p),e.createTextVNode(" "+e.toDisplayString(l.label),1)]))),128))])):e.createCommentVNode("",!0)],512)):e.createCommentVNode("",!0)]),e.createElementVNode("div",V,[e.renderSlot(a.$slots,"default")])],64))]))}});module.exports=b;
package/dist/index26.mjs CHANGED
@@ -1,112 +1,89 @@
1
- import { defineComponent as k, ref as o, computed as y, openBlock as s, createElementBlock as t, Fragment as d, withDirectives as f, createElementVNode as i, vModelText as h, toDisplayString as m, createCommentVNode as v } from "vue";
2
- const _ = {
1
+ import { defineComponent as V, ref as m, openBlock as l, createElementBlock as a, toDisplayString as u, Fragment as d, createElementVNode as n, renderList as k, normalizeClass as p, createCommentVNode as r, createTextVNode as D, renderSlot as L } from "vue";
2
+ const T = { class: "table-panel" }, E = {
3
3
  key: 0,
4
- class: "sub-form"
5
- }, A = ["disabled"], S = ["disabled"], w = ["disabled"], C = {
4
+ class: "dt-empty"
5
+ }, N = { class: "dt-toolbar" }, S = ["placeholder", "value"], x = { class: "dt-pills" }, F = ["onClick"], $ = { class: "dt-count" }, w = {
6
6
  key: 0,
7
- class: "sub-feedback sub-feedback--error"
8
- }, x = {
9
- key: 1,
10
- class: "sub-success"
11
- }, U = {
12
- key: 1,
13
- class: "sub-auth"
14
- }, V = ["disabled"], B = {
15
- key: 0,
16
- class: "sub-feedback sub-feedback--success"
17
- }, D = ["disabled"], E = {
18
- key: 2,
19
- class: "sub-feedback sub-feedback--error"
20
- }, Y = /* @__PURE__ */ k({
21
- __name: "SubscribeForm",
7
+ class: "dt-col-panel"
8
+ }, B = ["checked", "onChange"], M = { class: "dt-scroll" }, R = /* @__PURE__ */ V({
9
+ __name: "DataTable",
22
10
  props: {
23
- mode: { default: "anon" },
24
- subscribeAnon: {},
25
- subscribeAuth: {},
26
- unsubscribeAuth: {}
11
+ columnDefs: { default: () => [] },
12
+ colVisibility: { default: () => ({}) },
13
+ statuses: { default: () => [] },
14
+ statusFilter: { default: "all" },
15
+ statusLabels: { default: () => ({}) },
16
+ searchValue: { default: "" },
17
+ searchPlaceholder: { default: "Search…" },
18
+ totalCount: { default: 0 },
19
+ filteredCount: { default: 0 },
20
+ emptyMessage: { default: "No data yet." }
27
21
  },
28
- setup(p) {
29
- const a = p, n = o(""), b = o(""), e = o("idle"), l = o(!1), g = y(() => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(n.value.trim()));
30
- async function r() {
31
- if (e.value !== "submitting")
32
- if (a.mode === "auth")
33
- if (l.value) {
34
- if (!a.unsubscribeAuth) return;
35
- e.value = "submitting";
36
- try {
37
- await a.unsubscribeAuth(), l.value = !1, e.value = "idle";
38
- } catch {
39
- e.value = "error";
40
- }
41
- } else {
42
- if (!a.subscribeAuth) return;
43
- e.value = "submitting";
44
- try {
45
- await a.subscribeAuth(), l.value = !0, e.value = "done";
46
- } catch {
47
- e.value = "error";
48
- }
49
- }
50
- else {
51
- if (!g.value || !a.subscribeAnon) return;
52
- e.value = "submitting";
53
- try {
54
- await a.subscribeAnon(n.value.trim(), b.value.trim()), e.value = "done";
55
- } catch {
56
- e.value = "error";
57
- }
58
- }
22
+ emits: ["searchChange", "statusChange", "colToggle"],
23
+ setup(e, { emit: g }) {
24
+ const v = e, i = g, o = m(!1), h = m(null);
25
+ function C(s) {
26
+ return s === "all" ? "All" : v.statusLabels[s] ?? s;
59
27
  }
60
- return (F, u) => p.mode === "anon" ? (s(), t(d, { key: 0 }, [
61
- e.value !== "done" ? (s(), t("div", _, [
62
- f(i("input", {
63
- "onUpdate:modelValue": u[0] || (u[0] = (c) => b.value = c),
64
- class: "sub-input",
65
- type: "text",
66
- placeholder: "Your name (optional)",
67
- disabled: e.value === "submitting"
68
- }, null, 8, A), [
69
- [h, b.value]
70
- ]),
71
- f(i("input", {
72
- "onUpdate:modelValue": u[1] || (u[1] = (c) => n.value = c),
73
- class: "sub-input",
74
- type: "email",
75
- placeholder: "your@email.com",
76
- disabled: e.value === "submitting"
77
- }, null, 8, S), [
78
- [h, n.value]
28
+ function f(s) {
29
+ var c;
30
+ (c = h.value) != null && c.contains(s.target) || (o.value = !1, document.removeEventListener("click", f));
31
+ }
32
+ function y() {
33
+ o.value = !o.value, o.value && setTimeout(() => document.addEventListener("click", f), 0);
34
+ }
35
+ return (s, c) => (l(), a("div", T, [
36
+ e.totalCount === 0 ? (l(), a("p", E, u(e.emptyMessage), 1)) : (l(), a(d, { key: 1 }, [
37
+ n("div", N, [
38
+ e.statuses.length > 0 ? (l(), a(d, { key: 0 }, [
39
+ n("input", {
40
+ class: "dt-search",
41
+ type: "search",
42
+ placeholder: e.searchPlaceholder,
43
+ value: e.searchValue,
44
+ onInput: c[0] || (c[0] = (t) => i("searchChange", t.target.value))
45
+ }, null, 40, S),
46
+ n("div", x, [
47
+ (l(!0), a(d, null, k(e.statuses, (t) => (l(), a("button", {
48
+ key: t,
49
+ class: p(["dt-pill", { "dt-pill--active": e.statusFilter === t }]),
50
+ onClick: (b) => i("statusChange", t)
51
+ }, u(C(t)), 11, F))), 128))
52
+ ]),
53
+ n("span", $, u(e.filteredCount) + " of " + u(e.totalCount), 1)
54
+ ], 64)) : r("", !0),
55
+ e.columnDefs.length > 0 ? (l(), a("div", {
56
+ key: 1,
57
+ ref_key: "colWrapRef",
58
+ ref: h,
59
+ class: "dt-col-wrap"
60
+ }, [
61
+ n("button", {
62
+ class: "dt-col-btn",
63
+ onClick: y
64
+ }, "⚙ Columns"),
65
+ o.value ? (l(), a("div", w, [
66
+ (l(!0), a(d, null, k(e.columnDefs, (t) => (l(), a("label", {
67
+ key: t.key,
68
+ class: "dt-col-check"
69
+ }, [
70
+ n("input", {
71
+ type: "checkbox",
72
+ checked: e.colVisibility[t.key] ?? !0,
73
+ onChange: (b) => i("colToggle", t.key)
74
+ }, null, 40, B),
75
+ D(" " + u(t.label), 1)
76
+ ]))), 128))
77
+ ])) : r("", !0)
78
+ ], 512)) : r("", !0)
79
79
  ]),
80
- i("button", {
81
- class: "sub-btn",
82
- disabled: !g.value || e.value === "submitting",
83
- onClick: r
84
- }, m(e.value === "submitting" ? "Submitting…" : "Subscribe"), 9, w),
85
- e.value === "error" ? (s(), t("p", C, " Something went wrong — please try again. ")) : v("", !0)
86
- ])) : (s(), t("div", x, [...u[2] || (u[2] = [
87
- i("span", { class: "sub-success-icon" }, "✓", -1),
88
- i("p", { class: "sub-success-text" }, "Check your email to confirm your subscription.", -1)
89
- ])]))
90
- ], 64)) : (s(), t("div", U, [
91
- l.value ? (s(), t(d, { key: 1 }, [
92
- u[3] || (u[3] = i("span", { class: "sub-subscribed-label" }, "✓ Subscribed to blog updates", -1)),
93
- i("button", {
94
- class: "sub-btn sub-btn--unsub",
95
- disabled: e.value === "submitting",
96
- onClick: r
97
- }, m(e.value === "submitting" ? "Unsubscribing…" : "Unsubscribe"), 9, D)
98
- ], 64)) : (s(), t(d, { key: 0 }, [
99
- i("button", {
100
- class: "sub-btn",
101
- disabled: e.value === "submitting",
102
- onClick: r
103
- }, m(e.value === "submitting" ? "Subscribing…" : "Subscribe to Blog Updates"), 9, V),
104
- e.value === "done" ? (s(), t("p", B, "You're subscribed!")) : v("", !0)
105
- ], 64)),
106
- e.value === "error" ? (s(), t("p", E, " Something went wrong — please try again. ")) : v("", !0)
80
+ n("div", M, [
81
+ L(s.$slots, "default")
82
+ ])
83
+ ], 64))
107
84
  ]));
108
85
  }
109
86
  });
110
87
  export {
111
- Y as default
88
+ R as default
112
89
  };
package/dist/index28.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";const e=require("vue"),m={class:"m2s2-dialog-content",role:"dialog","aria-modal":!0,"aria-labelledby":"dialog-title"},k={class:"dialog-header"},g={id:"dialog-title",class:"dialog-title"},u={class:"dialog-body"},y={key:0,class:"dialog-message"},B={key:0,class:"dialog-footer"},f=["onClick"],C=e.defineComponent({__name:"Dialog",props:{data:{},open:{type:Boolean}},emits:["action","close"],setup(t,{emit:i}){const n=t,l=i;function s(o){l("action",o.value)}function d(){n.data.modal||l("close")}function r(o){o.key==="Escape"&&!n.data.modal&&l("close")}return(o,c)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createVNode(e.Transition,{name:"dialog-fade"},{default:e.withCtx(()=>[t.open?(e.openBlock(),e.createElementBlock("div",{key:0,class:"m2s2-dialog-overlay",onClick:e.withModifiers(d,["self"]),onKeydown:r},[e.createElementVNode("div",m,[e.createElementVNode("div",k,[e.createElementVNode("h2",g,e.toDisplayString(t.data.title),1),t.data.modal?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("button",{key:0,class:"dialog-close","aria-label":"Close",onClick:c[0]||(c[0]=a=>l("close"))},""))]),e.createElementVNode("div",u,[t.data.message?(e.openBlock(),e.createElementBlock("p",y,e.toDisplayString(t.data.message),1)):e.createCommentVNode("",!0),e.renderSlot(o.$slots,"default")]),t.data.actions.length?(e.openBlock(),e.createElementBlock("div",B,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.data.actions,a=>(e.openBlock(),e.createElementBlock("button",{key:a.label,class:e.normalizeClass(["dialog-btn",`dialog-btn--${a.variant??"secondary"}`]),onClick:b=>s(a)},e.toDisplayString(a.label),11,f))),128))])):e.createCommentVNode("",!0)])],32)):e.createCommentVNode("",!0)]),_:3})]))}});module.exports=C;
1
+ "use strict";const e=require("vue"),b={key:0,class:"sub-form"},d=["disabled"],m=["disabled"],v=["disabled"],p={key:0,class:"sub-feedback sub-feedback--error"},k={key:1,class:"sub-success"},g={key:1,class:"sub-auth"},f=["disabled"],y={key:0,class:"sub-feedback sub-feedback--success"},h=["disabled"],B={key:2,class:"sub-feedback sub-feedback--error"},_=e.defineComponent({__name:"SubscribeForm",props:{mode:{default:"anon"},subscribeAnon:{},subscribeAuth:{},unsubscribeAuth:{}},setup(c){const u=c,n=e.ref(""),l=e.ref(""),t=e.ref("idle"),o=e.ref(!1),r=e.computed(()=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(n.value.trim()));async function a(){if(t.value!=="submitting")if(u.mode==="auth")if(o.value){if(!u.unsubscribeAuth)return;t.value="submitting";try{await u.unsubscribeAuth(),o.value=!1,t.value="idle"}catch{t.value="error"}}else{if(!u.subscribeAuth)return;t.value="submitting";try{await u.subscribeAuth(),o.value=!0,t.value="done"}catch{t.value="error"}}else{if(!r.value||!u.subscribeAnon)return;t.value="submitting";try{await u.subscribeAnon(n.value.trim(),l.value.trim()),t.value="done"}catch{t.value="error"}}}return(E,s)=>c.mode==="anon"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[t.value!=="done"?(e.openBlock(),e.createElementBlock("div",b,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":s[0]||(s[0]=i=>l.value=i),class:"sub-input",type:"text",placeholder:"Your name (optional)",disabled:t.value==="submitting"},null,8,d),[[e.vModelText,l.value]]),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":s[1]||(s[1]=i=>n.value=i),class:"sub-input",type:"email",placeholder:"your@email.com",disabled:t.value==="submitting"},null,8,m),[[e.vModelText,n.value]]),e.createElementVNode("button",{class:"sub-btn",disabled:!r.value||t.value==="submitting",onClick:a},e.toDisplayString(t.value==="submitting"?"Submitting…":"Subscribe"),9,v),t.value==="error"?(e.openBlock(),e.createElementBlock("p",p," Something went wrong — please try again. ")):e.createCommentVNode("",!0)])):(e.openBlock(),e.createElementBlock("div",k,[...s[2]||(s[2]=[e.createElementVNode("span",{class:"sub-success-icon"},"",-1),e.createElementVNode("p",{class:"sub-success-text"},"Check your email to confirm your subscription.",-1)])]))],64)):(e.openBlock(),e.createElementBlock("div",g,[o.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[s[3]||(s[3]=e.createElementVNode("span",{class:"sub-subscribed-label"},"✓ Subscribed to blog updates",-1)),e.createElementVNode("button",{class:"sub-btn sub-btn--unsub",disabled:t.value==="submitting",onClick:a},e.toDisplayString(t.value==="submitting"?"Unsubscribing…":"Unsubscribe"),9,h)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("button",{class:"sub-btn",disabled:t.value==="submitting",onClick:a},e.toDisplayString(t.value==="submitting"?"Subscribing…":"Subscribe to Blog Updates"),9,f),t.value==="done"?(e.openBlock(),e.createElementBlock("p",y,"You're subscribed!")):e.createCommentVNode("",!0)],64)),t.value==="error"?(e.openBlock(),e.createElementBlock("p",B," Something went wrong — please try again. ")):e.createCommentVNode("",!0)]))}});module.exports=_;