@bubblesjs/vue-infinite-scroll 0.0.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025-present, bubblesplant.
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/README.md ADDED
@@ -0,0 +1,29 @@
1
+ ### 安装
2
+
3
+ pnpm install @bubblesjs/vue-infinite-scroll
4
+
5
+
6
+ ### 使用
7
+
8
+ ```vue
9
+ <template>
10
+ <InfiniteScoll :animation-time="20">
11
+ <div v-for="row in tableData" :key="row.id" class="table-row">
12
+ <div class="cell" style="width: 60px">{{ row.id }}</div>
13
+ <div class="cell" style="width: 80px">{{ row.name }}</div>
14
+ <div class="cell" style="width: 60px">{{ row.age }}</div>
15
+ <div class="cell" style="width: 80px">{{ row.city }}</div>
16
+ <div class="cell" style="width: 160px">{{ row.email }}</div>
17
+ </div>
18
+ </InfiniteScoll>
19
+ </template>
20
+
21
+
22
+ <script setup lang="ts">
23
+ import { InfiniteScoll } from '@bubblesjs/vue-infinite-scroll'
24
+ </script>
25
+ ```
26
+
27
+
28
+
29
+
package/dist/index.css ADDED
@@ -0,0 +1,28 @@
1
+
2
+ .parent[data-v-e9fa5fec] {
3
+ width: 100%;
4
+ height: 100%;
5
+ /* // overflow-y: scroll; */
6
+ scrollbar-width: none;
7
+ -ms-overflow-style: none;
8
+ overflow: hidden;
9
+ }
10
+ .parent[data-v-e9fa5fec]::-webkit-scrollbar {
11
+ display: none;
12
+ }
13
+ .warper[data-v-e9fa5fec] {
14
+ animation: infiniteScroll-e9fa5fec infinite var(--animation-second) linear;
15
+ animation-play-state: var(--animation-play-state);
16
+ }
17
+ .warper[data-v-e9fa5fec]:hover {
18
+ animation-play-state: paused;
19
+ }
20
+ @keyframes infiniteScroll-e9fa5fec {
21
+ 0% {
22
+ transform: translateY(0);
23
+ }
24
+ 100% {
25
+ transform: translateY(-50%);
26
+ }
27
+ }
28
+
@@ -0,0 +1,22 @@
1
+ import * as vue0 from "vue";
2
+
3
+ //#region src/InfiniteScoll.vue.d.ts
4
+ type __VLS_Props = {
5
+ animationTime?: number;
6
+ };
7
+ declare var __VLS_1: {};
8
+ type __VLS_Slots = {} & {
9
+ default?: (props: typeof __VLS_1) => any;
10
+ };
11
+ declare const __VLS_base: vue0.DefineComponent<__VLS_Props, {}, {}, {}, {}, vue0.ComponentOptionsMixin, vue0.ComponentOptionsMixin, {}, string, vue0.PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
12
+ animationTime: number;
13
+ }, {}, {}, {}, string, vue0.ComponentProvideOptions, false, {}, any>;
14
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
15
+ declare const _default: typeof __VLS_export;
16
+ type __VLS_WithSlots<T, S> = T & {
17
+ new (): {
18
+ $slots: S;
19
+ };
20
+ };
21
+ //#endregion
22
+ export { _default as InfiniteScoll };
package/dist/index.js ADDED
@@ -0,0 +1,71 @@
1
+ import { createElementBlock, createElementVNode, defineComponent, nextTick, normalizeStyle, openBlock, ref, renderSlot, useSlots, useTemplateRef, watch } from "vue";
2
+
3
+ //#region src/InfiniteScoll.vue?vue&type=script&setup=true&lang.ts
4
+ const _hoisted_1 = { class: "warper" };
5
+ var InfiniteScoll_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
6
+ __name: "InfiniteScoll",
7
+ props: { animationTime: {
8
+ type: Number,
9
+ required: false,
10
+ default: 15
11
+ } },
12
+ setup(__props) {
13
+ const props = __props;
14
+ const warper = useTemplateRef("warper");
15
+ const childDom1 = useTemplateRef("childDom1");
16
+ const childDom2 = useTemplateRef("childDom2");
17
+ const animationPlayState = ref("paused");
18
+ function scroll() {
19
+ if (!warper.value || !childDom1.value || !childDom2.value) return;
20
+ const warperHeight = warper?.value?.offsetHeight ?? 0;
21
+ if ((childDom1?.value?.offsetHeight ?? 0) > warperHeight) {
22
+ childDom2.value.innerHTML = childDom1?.value.innerHTML;
23
+ animationPlayState.value = "running";
24
+ } else animationPlayState.value = "paused";
25
+ }
26
+ const slots = useSlots();
27
+ watch(() => slots.default?.(), () => {
28
+ if (childDom2.value) childDom2.value.innerHTML = "";
29
+ nextTick(() => {
30
+ scroll();
31
+ });
32
+ }, {
33
+ deep: true,
34
+ immediate: true
35
+ });
36
+ return (_ctx, _cache) => {
37
+ return openBlock(), createElementBlock("div", {
38
+ ref_key: "warper",
39
+ ref: warper,
40
+ class: "parent",
41
+ style: normalizeStyle({
42
+ "--animation-second": `${props.animationTime}s`,
43
+ "--animation-play-state": animationPlayState.value
44
+ })
45
+ }, [createElementVNode("div", _hoisted_1, [createElementVNode("div", {
46
+ ref_key: "childDom1",
47
+ ref: childDom1,
48
+ class: "child"
49
+ }, [renderSlot(_ctx.$slots, "default", {}, void 0, true)], 512), createElementVNode("div", {
50
+ ref_key: "childDom2",
51
+ ref: childDom2,
52
+ className: "child"
53
+ }, null, 512)])], 4);
54
+ };
55
+ }
56
+ });
57
+
58
+ //#endregion
59
+ //#region \0plugin-vue:export-helper
60
+ var _plugin_vue_export_helper_default = (sfc, props) => {
61
+ const target = sfc.__vccOpts || sfc;
62
+ for (const [key, val] of props) target[key] = val;
63
+ return target;
64
+ };
65
+
66
+ //#endregion
67
+ //#region src/InfiniteScoll.vue
68
+ var InfiniteScoll_default = /* @__PURE__ */ _plugin_vue_export_helper_default(InfiniteScoll_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-e9fa5fec"]]);
69
+
70
+ //#endregion
71
+ export { InfiniteScoll_default as InfiniteScoll };
package/package.json ADDED
@@ -0,0 +1,59 @@
1
+ {
2
+ "name": "@bubblesjs/vue-infinite-scroll",
3
+ "type": "module",
4
+ "version": "0.0.4",
5
+ "private": false,
6
+ "description": "A scroll-infinite for a Vue3 component.",
7
+ "author": "bubblesplant<435012357@qq.com>",
8
+ "license": "MIT",
9
+ "homepage": "https://github.com/author/library#readme",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "git+https://github.com/author/library.git"
13
+ },
14
+ "bugs": {
15
+ "url": "https://github.com/author/library/issues"
16
+ },
17
+ "exports": {
18
+ ".": "./dist/index.js",
19
+ "./package.json": "./package.json"
20
+ },
21
+ "main": "./dist/index.js",
22
+ "module": "./dist/index.js",
23
+ "types": "./dist/index.d.ts",
24
+ "files": [
25
+ "dist"
26
+ ],
27
+ "publishConfig": {
28
+ "access": "public"
29
+ },
30
+ "peerDependencies": {
31
+ "vue": "^3.0.0"
32
+ },
33
+ "devDependencies": {
34
+ "@antfu/eslint-config": "^6.7.1",
35
+ "@types/node": "^24.10.1",
36
+ "@unocss/eslint-plugin": "^66.5.10",
37
+ "@vitejs/plugin-vue": "^6.0.2",
38
+ "@vitest/browser-playwright": "^4.0.15",
39
+ "bumpp": "^10.3.2",
40
+ "eslint": "^9.39.2",
41
+ "eslint-plugin-format": "^1.1.0",
42
+ "playwright": "^1.57.0",
43
+ "tsdown": "^0.18.2",
44
+ "typescript": "^5.9.3",
45
+ "vite": "^7.2.6",
46
+ "vitest": "^4.0.15",
47
+ "vitest-browser-vue": "^2.0.1",
48
+ "vue": "^3.5.25",
49
+ "vue-tsc": "^3.1.6"
50
+ },
51
+ "scripts": {
52
+ "build": "tsdown",
53
+ "dev": "tsdown --watch",
54
+ "play": "vite",
55
+ "test": "vitest",
56
+ "typecheck": "vue-tsc --noEmit",
57
+ "release": "bumpp && pnpm publish"
58
+ }
59
+ }