Skip to content

Commit fff9eb1

Browse files
authored
Docs/reactive api (#927)
* chore: rename variable in test * fix: delete named export in vue, vue3 index.umd.ts * chore: improve core-package-link script * docs: update reactive api docs * fix: add setMethods config * chore: vue demo * chore: vue3 demo * chore: update package-lock.json * fix: fix error in demo * docs: add reactive api jsdoc * docs: move reactive api demo to demo tab. * docs: add slide over, cover flow demo * docs: translate korean to english * chore: fix js demo * chore: remove reactive tab in docusaurus * docs: replace interface tag with typedef tag in jsdoc * fix: add options param to connectFlickingReactiveAPI * feat: add option param to frame work reactive api * docs: add link to option in explanation * refactor: add FlickingReactiveAPIOptions interface * feat: set default value to isReachEnd * docs: fix some explanation
1 parent 5372bde commit fff9eb1

36 files changed

+17084
-31094
lines changed

core-packages-link.js

Lines changed: 53 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,36 +3,73 @@
33
/**
44
* 프레임워크 컴포넌트를 디버깅할 때 코어 바닐라 로직을 수정하면서 확인할 필요가 있을 때,
55
* 이 스크립트를 이용하면 바닐라 로직 수정사항이 프레임워크 컴포넌트 로컬 데모환경에도 반영된다.
6-
*
6+
* 다만, 바닐라 로직 수정 이후 리액트 데모에 핫 모듈 리로딩까지는 되지 않는다.
7+
* 따라서 수정 사항들을 추가적으로 반영해주려면 바닐라를 다시 빌드해야 한다. 링크는 다시 하지 않아도 된다.
8+
*
79
* 인자로 프레임워크 컴포넌트 패키지의 루트 디렉토리를 제공하면 된다.
10+
* 인자를 제공하지 않으면 packages 하위의 전체 프레임워크 패키지에 대해 링크를 시도한다.
811
*
912
* 사용 예시: node core-package-link.js react-flicking
13+
*
14+
*
15+
* 개발 흐름:
16+
* 1. 이 스크립트를 실행
17+
* 2. 바닐라 로직 수정 후 빌드 수행
18+
* 3. 프레임워크 컴포넌트의 데모를 실행 (바닐라 로직 변경사항이 반영됨)
19+
* 4. 바닐라 로직 추가 수정 후 빌드 수행
20+
* 5. 프레임워크 컴포넌트의 데모를 새로고침 (바닐라 로직 변경사항이 반영됨)
21+
* - 원래는 새로고침만 하면 되야 하지만 타입 에러가 발생하는 경우가 있어 데모를 중지하고 다시 실행해야 할 수도 있다.
22+
*
23+
*
1024
*/
1125

26+
27+
28+
function run(cmd, cwd = process.cwd()) {
29+
console.log(`\n▶️ Running: ${cmd} (in ${cwd})`);
30+
execSync(cmd, { stdio: "inherit", cwd });
31+
}
32+
1233
const { execSync } = require("child_process");
1334
const path = require("path");
1435
const fs = require("fs");
1536

37+
const frameworks = [
38+
"ngx-flicking",
39+
"preact-flicking",
40+
"react-flicking",
41+
"vue-flicking",
42+
"vue3-flicking",
43+
"svelte-flicking",
44+
];
45+
1646
const args = process.argv.slice(2);
1747
const targetDir = args[0];
1848

1949
if (!targetDir) {
20-
console.error("❌ 디렉토리명을 인자로 입력하세요.");
21-
process.exit(1);
22-
}
50+
console.log(
51+
"❗️ 디렉토리명을 인자로 입력하지 않았습니다. 전체 프레임워크에 대해 링크를 시도합니다."
52+
);
53+
run("npm run build");
54+
run("npm link");
55+
frameworks.forEach((target) => {
56+
const fullPath = path.resolve(process.cwd(), "packages", target);
57+
if (!fs.existsSync(fullPath)) {
58+
console.error(`❌ 디렉토리 없음: ${fullPath}`);
59+
process.exit(1);
60+
}
61+
run(`npm link '@egjs/flicking'`, fullPath);
62+
});
63+
} else {
64+
const fullPath = path.resolve(process.cwd(), "packages", targetDir);
65+
if (!fs.existsSync(fullPath)) {
66+
console.error(`❌ 디렉토리 없음: ${fullPath}`);
67+
process.exit(1);
68+
}
2369

24-
const fullPath = path.resolve(process.cwd(), 'packages', targetDir);
25-
if (!fs.existsSync(fullPath)) {
26-
console.error(`❌ 디렉토리 없음: ${fullPath}`);
27-
process.exit(1);
70+
run("npm run build");
71+
run("npm link");
72+
run(`npm link '@egjs/flicking'`, fullPath);
2873
}
2974

30-
function run(cmd, cwd = process.cwd()) {
31-
console.log(`\n▶️ Running: ${cmd} (in ${cwd})`);
32-
execSync(cmd, { stdio: "inherit", cwd });
33-
}
3475

35-
run("npm run build");
36-
run("npm link");
37-
run(`npm link '@egjs/flicking'`, fullPath);
38-
run("npm run build", fullPath);

debug/reactive/index.html

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -59,19 +59,6 @@
5959
.pagination-num.active {
6060
background-color: yellowgreen;
6161
}
62-
#progress-bar {
63-
width: 600px;
64-
height: 20px;
65-
border-radius: 20px;
66-
background-color: #e0e0e0;
67-
overflow: hidden;
68-
}
69-
#progress-fill {
70-
height: 100%;
71-
width: 0%; /* 초기에는 0% 채워짐 */
72-
background-color: #4caf50; /* 채워지는 색 */
73-
transition: width 0.3s ease; /* 부드럽게 변화 */
74-
}
7562
#scroll-progress-bar {
7663
width: 600px;
7764
height: 20px;
@@ -103,9 +90,6 @@
10390
<button class="navigation-btn" id="next">Next</button>
10491
</div>
10592
<div id="pagination"></div>
106-
<div id="progress-bar">
107-
<div id="progress-fill"></div>
108-
</div>
10993
<div id="scroll-progress-bar">
11094
<div id="scroll-progress-fill"></div>
11195
</div>
@@ -128,6 +112,9 @@
128112
const flicking = new Flicking(".flicking-viewport", {
129113
renderOnlyVisible: true,
130114
// circular: true
115+
// horizontal: false
116+
// align: 'center',
117+
defaultIndex: 2,
131118
});
132119
const { connectFlickingReactiveAPI } = Flicking;
133120
const reactiveObj = connectFlickingReactiveAPI(flicking);
@@ -137,6 +124,7 @@
137124
totalPanelCount,
138125
currentPanelIndex,
139126
moveTo,
127+
progress,
140128
} = reactiveObj;
141129

142130
// Navigation buttons
@@ -204,7 +192,6 @@
204192
flicking.remove(0);
205193
});
206194

207-
// active panel을 지우는 경우 포커스가 가장 처음으로 돌아가는 현상이 있음.
208195
removeLastButton.addEventListener("click", () => {
209196
flicking.remove(flicking.panelCount - 1);
210197
});
@@ -214,7 +201,6 @@
214201
});
215202

216203
const paginationElement = document.getElementById("pagination");
217-
const progressFillElement = document.getElementById("progress-fill");
218204

219205
const pageNums = Array.from({ length: totalPanelCount }, (_, i) => {
220206
const div = document.createElement("div");
@@ -243,6 +229,8 @@
243229
const scrollProgressFillElement = document.getElementById(
244230
"scroll-progress-fill"
245231
);
232+
scrollProgressFillElement.style.width = `${progress}%`;
233+
246234
reactiveObj.subscribe("progress", (nextValue) => {
247235
scrollProgressFillElement.style.width = `${nextValue}%`;
248236
});

docs/docusaurus.config.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,6 @@ module.exports = {
5656
label: "Options",
5757
position: "left"
5858
},
59-
{
60-
to: "Reactive",
61-
label: "Reactive",
62-
position: "left"
63-
},
6459
{
6560
to: "Plugins",
6661
label: "Plugins",
@@ -120,10 +115,6 @@ module.exports = {
120115
{
121116
label: "Options",
122117
to: "Options/"
123-
},
124-
{
125-
label: "Reactive",
126-
to: "Reactive/"
127118
}
128119
]
129120
},

0 commit comments

Comments
 (0)