@waline/client 2.14.0 → 2.14.2

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 (62) hide show
  1. package/dist/comment.cjs +1 -1
  2. package/dist/comment.cjs.map +1 -1
  3. package/dist/comment.js +1 -68
  4. package/dist/comment.js.map +1 -1
  5. package/dist/comment.mjs +1 -1
  6. package/dist/comment.mjs.map +1 -1
  7. package/dist/component.mjs +1 -1
  8. package/dist/component.mjs.map +1 -1
  9. package/dist/legacy.umd.d.ts +14 -5
  10. package/dist/legacy.umd.js +1 -1
  11. package/dist/legacy.umd.js.map +1 -1
  12. package/dist/pageview.cjs +1 -1
  13. package/dist/pageview.cjs.map +1 -1
  14. package/dist/pageview.js +1 -121
  15. package/dist/pageview.js.map +1 -1
  16. package/dist/pageview.mjs +1 -1
  17. package/dist/pageview.mjs.map +1 -1
  18. package/dist/shim.cjs +1 -1
  19. package/dist/shim.cjs.map +1 -1
  20. package/dist/shim.d.cts +15 -6
  21. package/dist/shim.d.mts +15 -6
  22. package/dist/shim.mjs +1 -1
  23. package/dist/shim.mjs.map +1 -1
  24. package/dist/waline.cjs +1 -1
  25. package/dist/waline.cjs.map +1 -1
  26. package/dist/waline.css +1 -1
  27. package/dist/waline.css.map +1 -1
  28. package/dist/waline.d.cts +15 -6
  29. package/dist/waline.d.mts +15 -6
  30. package/dist/waline.d.ts +15 -6
  31. package/dist/waline.js +1 -6787
  32. package/dist/waline.js.map +1 -1
  33. package/dist/waline.mjs +1 -1
  34. package/dist/waline.mjs.map +1 -1
  35. package/package.json +18 -18
  36. package/src/comment.ts +1 -2
  37. package/src/components/ArticleReaction.vue +120 -117
  38. package/src/components/CommentBox.vue +451 -488
  39. package/src/components/CommentCard.vue +109 -98
  40. package/src/components/ImageWall.vue +132 -131
  41. package/src/components/WalineComment.vue +683 -0
  42. package/src/composables/index.ts +1 -2
  43. package/src/composables/reaction.ts +16 -0
  44. package/src/composables/recaptchaV3.ts +4 -6
  45. package/src/config/default.ts +5 -0
  46. package/src/{entrys → entries}/api.ts +0 -0
  47. package/src/{entrys → entries}/comment.ts +0 -0
  48. package/src/entries/components.ts +2 -0
  49. package/src/{entrys → entries}/full.ts +0 -0
  50. package/src/{entrys → entries}/init.ts +0 -0
  51. package/src/{entrys → entries}/legacy.ts +0 -0
  52. package/src/{entrys → entries}/pageview.ts +0 -0
  53. package/src/init.ts +1 -1
  54. package/src/styles/reaction.scss +27 -16
  55. package/src/typings/base.ts +5 -0
  56. package/src/typings/waline.ts +14 -5
  57. package/src/utils/config.ts +27 -5
  58. package/src/utils/image.ts +1 -1
  59. package/src/components/Waline.vue +0 -509
  60. package/src/composables/timeAgo.ts +0 -15
  61. package/src/composables/vote.ts +0 -20
  62. package/src/entrys/components.ts +0 -2
@@ -2,6 +2,7 @@
2
2
  <div :id="comment.objectId" class="wl-item">
3
3
  <div class="wl-user" aria-hidden="true">
4
4
  <img v-if="comment.avatar" :src="comment.avatar" />
5
+
5
6
  <VerifiedIcon v-if="comment.type" />
6
7
  </div>
7
8
 
@@ -12,9 +13,10 @@
12
13
  class="wl-nick"
13
14
  :href="link"
14
15
  target="_blank"
15
- rel="nofollow noreferrer"
16
+ rel="noopener noreferrer"
16
17
  >{{ comment.nick }}</a
17
18
  >
19
+
18
20
  <span v-else class="wl-nick">{{ comment.nick }}</span>
19
21
 
20
22
  <span
@@ -22,26 +24,32 @@
22
24
  class="wl-badge"
23
25
  v-text="locale.admin"
24
26
  />
27
+
25
28
  <span v-if="comment.label" class="wl-badge" v-text="comment.label" />
29
+
26
30
  <span v-if="comment.sticky" class="wl-badge" v-text="locale.sticky" />
31
+
27
32
  <span
28
33
  v-if="comment.level !== undefined && comment.level >= 0"
29
34
  :class="`wl-badge level${comment.level}`"
30
35
  v-text="locale[`level${comment.level}`] || `Level ${comment.level}`"
31
36
  />
37
+
32
38
  <span class="wl-time" v-text="time" />
33
39
 
34
40
  <div class="wl-comment-actions">
35
41
  <button
36
42
  v-if="isAdmin || isOwner"
43
+ type="button"
37
44
  class="wl-edit"
38
- @click="$emit('edit', comment)"
45
+ @click="() => $emit('edit', comment)"
39
46
  >
40
47
  <EditIcon />
41
48
  </button>
42
49
 
43
50
  <button
44
51
  v-if="isAdmin || isOwner"
52
+ type="button"
45
53
  class="wl-delete"
46
54
  @click="$emit('delete', comment)"
47
55
  >
@@ -49,15 +57,18 @@
49
57
  </button>
50
58
 
51
59
  <button
60
+ type="button"
52
61
  class="wl-like"
53
62
  :title="like ? locale.cancelLike : locale.like"
54
63
  @click="$emit('like', comment)"
55
64
  >
56
65
  <LikeIcon :active="like" />
66
+
57
67
  <span v-if="'like' in comment" v-text="comment.like" />
58
68
  </button>
59
69
 
60
70
  <button
71
+ type="button"
61
72
  class="wl-reply"
62
73
  :class="{ active: isReplyingCurrent }"
63
74
  :title="isReplyingCurrent ? locale.cancelReply : locale.reply"
@@ -67,6 +78,7 @@
67
78
  </button>
68
79
  </div>
69
80
  </div>
81
+
70
82
  <div class="wl-meta" aria-hidden="true">
71
83
  <span
72
84
  v-if="comment.addr"
@@ -74,12 +86,14 @@
74
86
  :data-value="comment.addr"
75
87
  v-text="comment.addr"
76
88
  />
89
+
77
90
  <span
78
91
  v-if="comment.browser"
79
92
  class="wl-browser"
80
93
  :data-value="comment.browser"
81
94
  v-text="comment.browser"
82
95
  />
96
+
83
97
  <span
84
98
  v-if="comment.os"
85
99
  class="wl-os"
@@ -100,6 +114,7 @@
100
114
  <button
101
115
  v-for="status in commentStatus"
102
116
  :key="status"
117
+ type="submit"
103
118
  :class="`wl-btn wl-${status}`"
104
119
  :disabled="comment.status === status"
105
120
  @click="$emit('status', { status, comment })"
@@ -109,6 +124,7 @@
109
124
 
110
125
  <button
111
126
  v-if="isAdmin && !comment.rid"
127
+ type="submit"
112
128
  class="wl-btn wl-sticky"
113
129
  @click="$emit('sticky', comment)"
114
130
  >
@@ -128,12 +144,16 @@
128
144
  :reply-id="reply?.objectId"
129
145
  :reply-user="comment.nick"
130
146
  :root-id="rootId"
131
- @submit="$emit('submit', $event)"
147
+ @log="$emit('log')"
132
148
  @cancel-reply="$emit('reply', null)"
133
149
  @cancel-edit="$emit('edit', null)"
150
+ @submit="$emit('submit', $event)"
134
151
  />
135
152
  </div>
153
+
136
154
  <div v-if="comment.children" class="wl-quote">
155
+ <!-- FIXME: This is a upstream bug -->
156
+ <!-- eslint-disable-next-line vue/no-undef-components -->
137
157
  <CommentCard
138
158
  v-for="child in comment.children"
139
159
  :key="child.objectId"
@@ -141,119 +161,110 @@
141
161
  :reply="reply"
142
162
  :edit="edit"
143
163
  :root-id="rootId"
144
- @reply="$emit('reply', $event)"
145
- @submit="$emit('submit', $event)"
146
- @like="$emit('like', $event)"
147
- @edit="$emit('edit', $event)"
164
+ @log="$emit('log')"
148
165
  @delete="$emit('delete', $event)"
166
+ @edit="$emit('edit', $event)"
167
+ @like="$emit('like', $event)"
168
+ @reply="$emit('reply', $event)"
149
169
  @status="$emit('status', $event)"
150
170
  @sticky="$emit('sticky', $event)"
171
+ @submit="$emit('submit', $event)"
151
172
  />
152
173
  </div>
153
174
  </div>
154
175
  </div>
155
176
  </template>
156
177
 
157
- <script lang="ts">
158
- import { computed, defineComponent, inject } from 'vue';
178
+ <script setup lang="ts">
179
+ import { useNow } from '@vueuse/core';
180
+ import { computed, inject } from 'vue';
159
181
  import CommentBox from './CommentBox.vue';
160
182
  import {
161
183
  DeleteIcon,
184
+ EditIcon,
162
185
  LikeIcon,
163
186
  ReplyIcon,
164
- EditIcon,
165
187
  VerifiedIcon,
166
- } from './Icons';
167
- import { isLinkHttp } from '../utils';
168
- import { useTimeAgo, useLikeStorage, useUserInfo } from '../composables';
188
+ } from './Icons.js';
189
+ import { getTimeAgo, isLinkHttp } from '../utils';
190
+ import { useLikeStorage, useUserInfo } from '../composables/index.js';
191
+
192
+ import type { ComputedRef } from 'vue';
193
+ import type { WalineConfig } from '../utils/index.js';
194
+ import type { WalineComment, WalineCommentStatus } from '../typings/index.js';
169
195
 
170
- import type { ComputedRef, PropType } from 'vue';
171
- import type { WalineConfig } from '../utils';
172
- import type { WalineComment, WalineCommentStatus } from '../typings';
196
+ const props = withDefaults(
197
+ defineProps<{
198
+ /**
199
+ * Comment data
200
+ */
201
+ comment: WalineComment;
202
+ /**
203
+ * Current comment to be edited
204
+ */
205
+ edit?: WalineComment | null;
206
+ /**
207
+ * Root comment id
208
+ */
209
+ rootId: string;
210
+ /**
211
+ * Current comment to be replied
212
+ */
213
+ reply?: WalineComment | null;
214
+ }>(),
215
+ {
216
+ edit: null,
217
+ reply: null,
218
+ }
219
+ );
220
+
221
+ defineEmits<{
222
+ (event: 'log'): void;
223
+ (event: 'submit', comment: WalineComment): void;
224
+ (event: 'delete', comment: WalineComment): void;
225
+ (event: 'edit', comment: WalineComment | null): void;
226
+ (event: 'like', comment: WalineComment): void;
227
+ (
228
+ event: 'status',
229
+ statusInfo: { status: WalineCommentStatus; comment: WalineComment }
230
+ ): void;
231
+ (event: 'sticky', comment: WalineComment): void;
232
+ (event: 'reply', comment: WalineComment | null): void;
233
+ }>();
173
234
 
174
235
  const commentStatus: WalineCommentStatus[] = ['approved', 'waiting', 'spam'];
175
236
 
176
- export default defineComponent({
177
- components: {
178
- CommentBox,
179
- DeleteIcon,
180
- LikeIcon,
181
- ReplyIcon,
182
- EditIcon,
183
- VerifiedIcon,
184
- },
185
-
186
- props: {
187
- comment: {
188
- type: Object as PropType<WalineComment>,
189
- required: true,
190
- },
191
- rootId: {
192
- type: String,
193
- required: true,
194
- },
195
- reply: {
196
- type: Object as PropType<WalineComment | null>,
197
- default: null,
198
- },
199
- edit: {
200
- type: Object as PropType<WalineComment | null>,
201
- default: null,
202
- },
203
- },
204
-
205
- emits: ['submit', 'reply', 'like', 'delete', 'status', 'sticky', 'edit'],
206
-
207
- setup(props) {
208
- const config = inject<ComputedRef<WalineConfig>>(
209
- 'config'
210
- ) as ComputedRef<WalineConfig>;
211
- const likes = useLikeStorage();
212
- const userInfo = useUserInfo();
213
-
214
- const locale = computed(() => config.value.locale);
215
-
216
- const link = computed(() => {
217
- const { link } = props.comment;
218
-
219
- return link ? (isLinkHttp(link) ? link : `https://${link}`) : '';
220
- });
221
-
222
- const like = computed(() => likes.value.includes(props.comment.objectId));
223
-
224
- const time = useTimeAgo(props.comment.insertedAt, locale.value);
225
-
226
- const isAdmin = computed(() => userInfo.value.type === 'administrator');
227
-
228
- const isOwner = computed(
229
- () =>
230
- props.comment.user_id &&
231
- userInfo.value.objectId === props.comment.user_id
232
- );
233
-
234
- const isReplyingCurrent = computed(
235
- () => props.comment.objectId === props.reply?.objectId
236
- );
237
-
238
- const isEditingCurrent = computed(
239
- () => props.comment.objectId === props.edit?.objectId
240
- );
241
-
242
- return {
243
- config,
244
- locale,
245
-
246
- isReplyingCurrent,
247
- isEditingCurrent,
248
- link,
249
- like,
250
- time,
251
-
252
- isAdmin,
253
- isOwner,
254
-
255
- commentStatus,
256
- };
257
- },
237
+ const config = inject<ComputedRef<WalineConfig>>('config')!;
238
+ const likes = useLikeStorage();
239
+ const now = useNow();
240
+ const userInfo = useUserInfo();
241
+
242
+ const locale = computed(() => config.value.locale);
243
+
244
+ const link = computed(() => {
245
+ const { link } = props.comment;
246
+
247
+ return link ? (isLinkHttp(link) ? link : `https://${link}`) : '';
258
248
  });
249
+
250
+ const like = computed(() => likes.value.includes(props.comment.objectId));
251
+
252
+ const time = computed(() =>
253
+ getTimeAgo(props.comment.insertedAt, now.value, locale.value)
254
+ );
255
+
256
+ const isAdmin = computed(() => userInfo.value.type === 'administrator');
257
+
258
+ const isOwner = computed(
259
+ () =>
260
+ props.comment.user_id && userInfo.value.objectId === props.comment.user_id
261
+ );
262
+
263
+ const isReplyingCurrent = computed(
264
+ () => props.comment.objectId === props.reply?.objectId
265
+ );
266
+
267
+ const isEditingCurrent = computed(
268
+ () => props.comment.objectId === props.edit?.objectId
269
+ );
259
270
  </script>
@@ -1,26 +1,28 @@
1
1
  <!-- forked from https://github.com/DerYeger/vue-masonry-wall/blob/master/src/masonry-wall.vue -->
2
2
 
3
- <!-- MIT License
4
-
5
- Copyright (c) 2021 Fuxing Loh, Jan Müller
6
-
7
- Permission is hereby granted, free of charge, to any person obtaining a copy
8
- of this software and associated documentation files (the "Software"), to deal
9
- in the Software without restriction, including without limitation the rights
10
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
- copies of the Software, and to permit persons to whom the Software is
12
- furnished to do so, subject to the following conditions:
13
-
14
- The above copyright notice and this permission notice shall be included in all
15
- copies or substantial portions of the Software.
16
-
17
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
- SOFTWARE. -->
3
+ <!--
4
+ MIT License
5
+
6
+ Copyright (c) 2021 Fuxing Loh, Jan Müller
7
+
8
+ Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ of this software and associated documentation files (the "Software"), to deal
10
+ in the Software without restriction, including without limitation the rights
11
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ copies of the Software, and to permit persons to whom the Software is
13
+ furnished to do so, subject to the following conditions:
14
+
15
+ The above copyright notice and this permission notice shall be included in all
16
+ copies or substantial portions of the Software.
17
+
18
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
+ SOFTWARE.
25
+ -->
24
26
 
25
27
  <template>
26
28
  <div ref="wall" class="wl-gallery" :style="{ gap: `${gap}px` }">
@@ -32,11 +34,14 @@ SOFTWARE. -->
32
34
  :style="{ gap: `${gap}px` }"
33
35
  >
34
36
  <template v-for="itemIndex in column" :key="itemIndex">
37
+ <!-- eslint-disable vue/no-static-inline-styles -->
35
38
  <LoadingIcon
36
39
  v-if="!state[items[itemIndex].src]"
37
40
  :size="36"
38
41
  style="margin: 20px auto"
39
42
  />
43
+ <!-- eslint-enable vue/no-static-inline-styles -->
44
+
40
45
  <img
41
46
  class="wl-gallery-item"
42
47
  :src="items[itemIndex].src"
@@ -50,120 +55,116 @@ SOFTWARE. -->
50
55
  </div>
51
56
  </template>
52
57
 
53
- <script lang="ts">
54
- import {
55
- defineComponent,
56
- nextTick,
57
- onBeforeUnmount,
58
- onMounted,
59
- ref,
60
- watch,
61
- } from 'vue';
58
+ <script setup lang="ts">
59
+ import { nextTick, onBeforeUnmount, onMounted, ref, watch } from 'vue';
62
60
 
63
- import { LoadingIcon } from './Icons';
61
+ import { LoadingIcon } from './Icons.js';
64
62
 
65
- import type { PropType } from 'vue';
66
- import type { WalineSearchResult } from '../typings';
63
+ import type { WalineSearchResult } from '../typings/index.js';
67
64
 
68
65
  type Column = number[];
69
66
 
70
- export default defineComponent({
71
- name: 'ImageWall',
72
-
73
- components: {
74
- LoadingIcon,
75
- },
76
-
77
- props: {
78
- items: { type: Array as PropType<WalineSearchResult>, default: () => [] },
79
- columnWidth: { type: Number, default: 300 },
80
- gap: { type: Number, default: 0 },
81
- },
82
-
83
- emits: ['insert'],
84
-
85
- setup(props) {
86
- let resizeObserver: ResizeObserver | null = null;
87
- const wall = ref<HTMLDivElement | null>(null);
88
- const state = ref<Record<string, boolean>>({});
89
- const columns = ref<Column[]>([]);
90
-
91
- const getColumnCount = (): number => {
92
- const count = Math.floor(
93
- (wall.value!.getBoundingClientRect().width + props.gap) /
94
- (props.columnWidth + props.gap)
95
- );
96
-
97
- return count > 0 ? count : 1;
98
- };
99
-
100
- const createColumns = (count: number): Column[] =>
101
- new Array(count).fill(null).map(() => []);
102
-
103
- const fillColumns = async (itemIndex: number): Promise<void> => {
104
- if (itemIndex >= props.items.length) return;
105
-
106
- await nextTick();
107
-
108
- const columnDivs = Array.from(
109
- wall.value?.children || []
110
- ) as HTMLDivElement[];
111
-
112
- const target = columnDivs.reduce((prev, curr) =>
113
- curr.getBoundingClientRect().height <
114
- prev.getBoundingClientRect().height
115
- ? curr
116
- : prev
117
- );
118
-
119
- columns.value[Number(target.dataset.index)].push(itemIndex);
120
-
121
- await fillColumns(itemIndex + 1);
122
- };
123
-
124
- const redraw = async (force = false): Promise<void> => {
125
- if (columns.value.length === getColumnCount() && !force) return;
126
-
127
- columns.value = createColumns(getColumnCount());
128
-
129
- const scrollY = window.scrollY;
130
-
131
- await fillColumns(0);
132
-
133
- window.scrollTo({ top: scrollY });
134
- };
135
-
136
- const imageLoad = (e: Event): void => {
137
- state.value[(e.target as HTMLImageElement).src] = true;
138
- };
139
-
140
- onMounted(() => {
141
- redraw(true);
142
-
143
- resizeObserver = new ResizeObserver(() => redraw());
144
- resizeObserver.observe(wall.value!);
145
-
146
- watch(
147
- () => [props.items],
148
- () => {
149
- state.value = {};
150
- redraw(true);
151
- }
152
- );
153
- watch(
154
- () => [props.columnWidth, props.gap],
155
- () => redraw()
156
- );
157
- });
158
-
159
- onBeforeUnmount(() => resizeObserver!.unobserve(wall.value!));
160
-
161
- return {
162
- columns,
163
- state,
164
- wall,
165
- imageLoad,
166
- };
167
- },
67
+ const props = withDefaults(
68
+ defineProps<{
69
+ /**
70
+ * Image Items
71
+ */
72
+ items?: WalineSearchResult;
73
+ /**
74
+ * width in pixels of each column
75
+ */
76
+ columnWidth?: number;
77
+ /**
78
+ * gap in pixels between columns
79
+ */
80
+ gap?: number;
81
+ }>(),
82
+ {
83
+ items: () => [] as WalineSearchResult,
84
+ columnWidth: 300,
85
+ gap: 0,
86
+ }
87
+ );
88
+
89
+ defineEmits<{
90
+ (event: 'insert', content: string): void;
91
+ }>();
92
+
93
+ defineExpose();
94
+
95
+ let resizeObserver: ResizeObserver | null = null;
96
+ const wall = ref<HTMLDivElement | null>(null);
97
+ const state = ref<Record<string, boolean>>({});
98
+ const columns = ref<Column[]>([]);
99
+
100
+ const getColumnCount = (): number => {
101
+ const count = Math.floor(
102
+ (wall.value!.getBoundingClientRect().width + props.gap) /
103
+ (props.columnWidth + props.gap)
104
+ );
105
+
106
+ return count > 0 ? count : 1;
107
+ };
108
+
109
+ const createColumns = (count: number): Column[] =>
110
+ new Array(count).fill(null).map(() => []);
111
+
112
+ const fillColumns = async (itemIndex: number): Promise<void> => {
113
+ if (itemIndex >= props.items.length) return;
114
+
115
+ await nextTick();
116
+
117
+ const columnDivs = Array.from(wall.value?.children || []) as HTMLDivElement[];
118
+
119
+ const target = columnDivs.reduce((prev, curr) =>
120
+ curr.getBoundingClientRect().height < prev.getBoundingClientRect().height
121
+ ? curr
122
+ : prev
123
+ );
124
+
125
+ columns.value[Number(target.dataset.index)].push(itemIndex);
126
+
127
+ await fillColumns(itemIndex + 1);
128
+ };
129
+
130
+ const redraw = async (force = false): Promise<void> => {
131
+ if (columns.value.length === getColumnCount() && !force) return;
132
+
133
+ columns.value = createColumns(getColumnCount());
134
+
135
+ const scrollY = window.scrollY;
136
+
137
+ await fillColumns(0);
138
+
139
+ window.scrollTo({ top: scrollY });
140
+ };
141
+
142
+ const imageLoad = (e: Event): void => {
143
+ state.value[(e.target as HTMLImageElement).src] = true;
144
+ };
145
+
146
+ onMounted(() => {
147
+ void redraw(true);
148
+
149
+ resizeObserver = new ResizeObserver(() => {
150
+ void redraw();
151
+ });
152
+ resizeObserver.observe(wall.value!);
153
+
154
+ watch(
155
+ () => [props.items],
156
+ () => {
157
+ state.value = {};
158
+ void redraw(true);
159
+ }
160
+ );
161
+ watch(
162
+ () => [props.columnWidth, props.gap],
163
+ () => {
164
+ void redraw();
165
+ }
166
+ );
168
167
  });
168
+
169
+ onBeforeUnmount(() => resizeObserver!.unobserve(wall.value!));
169
170
  </script>