pukaad-ui-lib 1.170.0 → 1.170.1

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/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pukaad-ui-lib",
3
3
  "configKey": "pukaadUI",
4
- "version": "1.170.0",
4
+ "version": "1.170.1",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
@@ -18,10 +18,14 @@ type __VLS_Props = {
18
18
  disabledDividerBottom?: boolean;
19
19
  disabled?: boolean;
20
20
  iconSize?: number | string;
21
+ id?: string;
22
+ state?: string;
21
23
  };
22
24
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
25
+ id: string;
23
26
  disabled: boolean;
24
27
  disabledPadding: boolean;
28
+ state: string;
25
29
  itemCount: Count;
26
30
  itemActive: Reacted;
27
31
  padding: string | number;
@@ -32,6 +32,7 @@
32
32
 
33
33
  <script setup>
34
34
  import { computed, reactive, ref, watch } from "vue";
35
+ import { useApi } from "../../composables/useApi";
35
36
  const isOpenModalShare = ref(false);
36
37
  const props = defineProps({
37
38
  itemCount: { type: Object, required: false, default: () => ({
@@ -50,7 +51,9 @@ const props = defineProps({
50
51
  disabledDividerTop: { type: Boolean, required: false, default: false },
51
52
  disabledDividerBottom: { type: Boolean, required: false, default: false },
52
53
  disabled: { type: Boolean, required: false, default: false },
53
- iconSize: { type: [Number, String], required: false, default: 20 }
54
+ iconSize: { type: [Number, String], required: false, default: 20 },
55
+ id: { type: String, required: false, default: "" },
56
+ state: { type: String, required: false, default: "" }
54
57
  });
55
58
  const computedPadding = computed(
56
59
  () => props.disabledPadding ? 0 : props.padding
@@ -110,9 +113,22 @@ const reactions = [
110
113
  action: toggleShared
111
114
  }
112
115
  ];
113
- function toggleLike() {
114
- reaction.liked = !reaction.liked;
116
+ async function toggleLike() {
117
+ const previousLiked = reaction.liked;
118
+ reaction.liked = !previousLiked;
115
119
  counts.liked += reaction.liked ? 1 : -1;
120
+ if (props.state === "blog" && props.id) {
121
+ try {
122
+ const api = useApi();
123
+ await api(`/blogs/${props.id}/like`, {
124
+ method: reaction.liked ? "POST" : "DELETE"
125
+ });
126
+ } catch (error) {
127
+ console.error(error);
128
+ reaction.liked = previousLiked;
129
+ counts.liked += previousLiked ? 1 : -1;
130
+ }
131
+ }
116
132
  }
117
133
  function toggleBookmark() {
118
134
  reaction.bookmarked = !reaction.bookmarked;
@@ -18,10 +18,14 @@ type __VLS_Props = {
18
18
  disabledDividerBottom?: boolean;
19
19
  disabled?: boolean;
20
20
  iconSize?: number | string;
21
+ id?: string;
22
+ state?: string;
21
23
  };
22
24
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
25
+ id: string;
23
26
  disabled: boolean;
24
27
  disabledPadding: boolean;
28
+ state: string;
25
29
  itemCount: Count;
26
30
  itemActive: Reacted;
27
31
  padding: string | number;
@@ -64,15 +64,15 @@ declare const __VLS_export: import("vue").DefineComponent<ImageCropperProps, {
64
64
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ImageCropperProps> & Readonly<{}>, {
65
65
  src: string;
66
66
  center: boolean;
67
+ background: boolean;
68
+ modal: boolean;
67
69
  responsive: boolean;
68
70
  restore: boolean;
69
71
  checkCrossOrigin: boolean;
70
72
  checkOrientation: boolean;
71
73
  crossorigin: "" | "anonymous" | "use-credentials";
72
- modal: boolean;
73
74
  guides: boolean;
74
75
  highlight: boolean;
75
- background: boolean;
76
76
  autoCrop: boolean;
77
77
  movable: boolean;
78
78
  rotatable: boolean;
@@ -64,15 +64,15 @@ declare const __VLS_export: import("vue").DefineComponent<ImageCropperProps, {
64
64
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ImageCropperProps> & Readonly<{}>, {
65
65
  src: string;
66
66
  center: boolean;
67
+ background: boolean;
68
+ modal: boolean;
67
69
  responsive: boolean;
68
70
  restore: boolean;
69
71
  checkCrossOrigin: boolean;
70
72
  checkOrientation: boolean;
71
73
  crossorigin: "" | "anonymous" | "use-credentials";
72
- modal: boolean;
73
74
  guides: boolean;
74
75
  highlight: boolean;
75
- background: boolean;
76
76
  autoCrop: boolean;
77
77
  movable: boolean;
78
78
  rotatable: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pukaad-ui-lib",
3
- "version": "1.170.0",
3
+ "version": "1.170.1",
4
4
  "description": "pukaad-ui for MeMSG",
5
5
  "repository": {
6
6
  "type": "git",