masoneffect 2.0.3 → 2.0.5
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/README.md +2 -2
- package/dist/core/count/index.d.ts +3 -2
- package/dist/core/count/index.d.ts.map +1 -1
- package/dist/core/textToParticle/index.d.ts +3 -3
- package/dist/core/textToParticle/index.d.ts.map +1 -1
- package/dist/core/typing/index.d.ts +8 -6
- package/dist/core/typing/index.d.ts.map +1 -1
- package/dist/core/utils/visibilityManager.d.ts +35 -0
- package/dist/core/utils/visibilityManager.d.ts.map +1 -0
- package/dist/count/core/count/index.d.ts +3 -2
- package/dist/count/core/count/index.d.ts.map +1 -1
- package/dist/count/core/textToParticle/index.d.ts +3 -3
- package/dist/count/core/textToParticle/index.d.ts.map +1 -1
- package/dist/count/core/typing/index.d.ts +8 -6
- package/dist/count/core/typing/index.d.ts.map +1 -1
- package/dist/count/core/utils/visibilityManager.d.ts +35 -0
- package/dist/count/core/utils/visibilityManager.d.ts.map +1 -0
- package/dist/count/index.cjs +1 -1
- package/dist/count/index.mjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.umd.min.js +1 -1
- package/dist/react/core/count/index.d.ts +3 -2
- package/dist/react/core/textToParticle/index.d.ts +3 -3
- package/dist/react/core/typing/index.d.ts +8 -6
- package/dist/react/core/utils/visibilityManager.d.ts +34 -0
- package/dist/react/count/core/count/index.d.ts +3 -2
- package/dist/react/count/core/count/index.d.ts.map +1 -1
- package/dist/react/count/core/textToParticle/index.d.ts +3 -3
- package/dist/react/count/core/textToParticle/index.d.ts.map +1 -1
- package/dist/react/count/core/typing/index.d.ts +8 -6
- package/dist/react/count/core/typing/index.d.ts.map +1 -1
- package/dist/react/count/core/utils/visibilityManager.d.ts +35 -0
- package/dist/react/count/core/utils/visibilityManager.d.ts.map +1 -0
- package/dist/react/count/index.cjs +1 -1
- package/dist/react/count/index.mjs +1 -1
- package/dist/react/textToParticle/core/count/index.d.ts +3 -2
- package/dist/react/textToParticle/core/count/index.d.ts.map +1 -1
- package/dist/react/textToParticle/core/textToParticle/index.d.ts +3 -3
- package/dist/react/textToParticle/core/textToParticle/index.d.ts.map +1 -1
- package/dist/react/textToParticle/core/typing/index.d.ts +8 -6
- package/dist/react/textToParticle/core/typing/index.d.ts.map +1 -1
- package/dist/react/textToParticle/core/utils/visibilityManager.d.ts +35 -0
- package/dist/react/textToParticle/core/utils/visibilityManager.d.ts.map +1 -0
- package/dist/react/textToParticle/index.cjs +1 -1
- package/dist/react/textToParticle/index.mjs +1 -1
- package/dist/react/typing/core/count/index.d.ts +3 -2
- package/dist/react/typing/core/count/index.d.ts.map +1 -1
- package/dist/react/typing/core/textToParticle/index.d.ts +3 -3
- package/dist/react/typing/core/textToParticle/index.d.ts.map +1 -1
- package/dist/react/typing/core/typing/index.d.ts +8 -6
- package/dist/react/typing/core/typing/index.d.ts.map +1 -1
- package/dist/react/typing/core/utils/visibilityManager.d.ts +35 -0
- package/dist/react/typing/core/utils/visibilityManager.d.ts.map +1 -0
- package/dist/react/typing/index.cjs +1 -1
- package/dist/react/typing/index.mjs +1 -1
- package/dist/svelte/count/index.cjs +1 -1
- package/dist/svelte/count/index.d.ts +46 -32
- package/dist/svelte/count/index.mjs +120 -42
- package/dist/svelte/index.cjs +1 -1
- package/dist/svelte/index.d.ts +46 -32
- package/dist/svelte/index.mjs +211 -160
- package/dist/svelte/textToParticle/index.cjs +1 -1
- package/dist/svelte/textToParticle/index.d.ts +46 -32
- package/dist/svelte/textToParticle/index.mjs +119 -33
- package/dist/svelte/typing/index.cjs +1 -1
- package/dist/svelte/typing/index.d.ts +46 -32
- package/dist/svelte/typing/index.mjs +174 -85
- package/dist/textToParticle/core/count/index.d.ts +3 -2
- package/dist/textToParticle/core/count/index.d.ts.map +1 -1
- package/dist/textToParticle/core/textToParticle/index.d.ts +3 -3
- package/dist/textToParticle/core/textToParticle/index.d.ts.map +1 -1
- package/dist/textToParticle/core/typing/index.d.ts +8 -6
- package/dist/textToParticle/core/typing/index.d.ts.map +1 -1
- package/dist/textToParticle/core/utils/visibilityManager.d.ts +35 -0
- package/dist/textToParticle/core/utils/visibilityManager.d.ts.map +1 -0
- package/dist/textToParticle/index.cjs +1 -1
- package/dist/textToParticle/index.mjs +1 -1
- package/dist/typing/core/count/index.d.ts +3 -2
- package/dist/typing/core/count/index.d.ts.map +1 -1
- package/dist/typing/core/textToParticle/index.d.ts +3 -3
- package/dist/typing/core/textToParticle/index.d.ts.map +1 -1
- package/dist/typing/core/typing/index.d.ts +8 -6
- package/dist/typing/core/typing/index.d.ts.map +1 -1
- package/dist/typing/core/utils/visibilityManager.d.ts +35 -0
- package/dist/typing/core/utils/visibilityManager.d.ts.map +1 -0
- package/dist/typing/index.cjs +1 -1
- package/dist/typing/index.mjs +1 -1
- package/dist/vue/count/index.cjs +1 -1
- package/dist/vue/count/index.d.ts +46 -32
- package/dist/vue/count/index.mjs +119 -41
- package/dist/vue/index.cjs +1 -1
- package/dist/vue/index.d.ts +46 -32
- package/dist/vue/index.mjs +209 -158
- package/dist/vue/textToParticle/index.cjs +1 -1
- package/dist/vue/textToParticle/index.d.ts +46 -32
- package/dist/vue/textToParticle/index.mjs +119 -33
- package/dist/vue/typing/index.cjs +1 -1
- package/dist/vue/typing/index.d.ts +46 -32
- package/dist/vue/typing/index.mjs +173 -84
- package/package.json +1 -1
|
@@ -7,12 +7,12 @@ export declare class Count {
|
|
|
7
7
|
currentValue: number;
|
|
8
8
|
startTime: number | null;
|
|
9
9
|
animationFrameId: number | null;
|
|
10
|
-
|
|
10
|
+
visibilityManager: VisibilityManager | null;
|
|
11
11
|
isRunning: boolean;
|
|
12
12
|
hasTriggered: boolean;
|
|
13
13
|
constructor(container: HTMLElement | string, options: CountOptions);
|
|
14
14
|
init(): void;
|
|
15
|
-
|
|
15
|
+
setupVisibilityManager(): void;
|
|
16
16
|
start(): void;
|
|
17
17
|
stop(): void;
|
|
18
18
|
reset(): void;
|
|
@@ -23,13 +23,6 @@ export declare class Count {
|
|
|
23
23
|
destroy(): void;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
/**
|
|
27
|
-
* Count - 숫자 카운팅 애니메이션 효과
|
|
28
|
-
* 바닐라 JS 코어 클래스
|
|
29
|
-
*
|
|
30
|
-
* 사용법:
|
|
31
|
-
* import { Count } from 'masoneffect/count';
|
|
32
|
-
*/
|
|
33
26
|
export declare interface CountOptions {
|
|
34
27
|
targetValue: number;
|
|
35
28
|
duration?: number;
|
|
@@ -84,14 +77,13 @@ declare class TextToParticle {
|
|
|
84
77
|
};
|
|
85
78
|
animationId: number | null;
|
|
86
79
|
isRunning: boolean;
|
|
87
|
-
|
|
88
|
-
intersectionObserver: IntersectionObserver | null;
|
|
80
|
+
visibilityManager: VisibilityManager | null;
|
|
89
81
|
debounceDelay: number;
|
|
90
82
|
_debouncedMorph: (textOrOptions?: string | Partial<TextToParticleOptions> | null) => void;
|
|
91
83
|
_debouncedUpdateConfig: (newConfig: Partial<TextToParticleOptions>) => void;
|
|
92
84
|
constructor(container: HTMLElement | string, options?: TextToParticleOptions);
|
|
93
85
|
init(): void;
|
|
94
|
-
|
|
86
|
+
setupVisibilityManager(): void;
|
|
95
87
|
resize(): void;
|
|
96
88
|
/**
|
|
97
89
|
* 텍스트가 영역 안에 들어가는지 확인하는 헬퍼 함수 (줄바꿈 지원)
|
|
@@ -132,13 +124,6 @@ declare class TextToParticle {
|
|
|
132
124
|
export { TextToParticle }
|
|
133
125
|
export default TextToParticle;
|
|
134
126
|
|
|
135
|
-
/**
|
|
136
|
-
* TextToParticle - 텍스트를 파티클로 변환하는 효과
|
|
137
|
-
* 바닐라 JS 코어 클래스
|
|
138
|
-
*
|
|
139
|
-
* 사용법:
|
|
140
|
-
* import { TextToParticle } from 'masoneffect/textToParticle';
|
|
141
|
-
*/
|
|
142
127
|
declare interface TextToParticleOptions {
|
|
143
128
|
text?: string;
|
|
144
129
|
densityStep?: number;
|
|
@@ -167,20 +152,21 @@ declare class TextToParticle {
|
|
|
167
152
|
onComplete: TypingOptions['onComplete'];
|
|
168
153
|
};
|
|
169
154
|
textUnits: string[];
|
|
155
|
+
charUnitRanges: Array<{
|
|
156
|
+
start: number;
|
|
157
|
+
end: number;
|
|
158
|
+
isHangul: boolean;
|
|
159
|
+
}>;
|
|
170
160
|
currentIndex: number;
|
|
171
161
|
displayedText: string;
|
|
172
162
|
timeoutId: ReturnType<typeof setTimeout> | null;
|
|
173
|
-
|
|
163
|
+
visibilityManager: VisibilityManager | null;
|
|
174
164
|
isRunning: boolean;
|
|
175
165
|
hasTriggered: boolean;
|
|
176
166
|
originalText: string;
|
|
177
167
|
constructor(container: HTMLElement | string, options: TypingOptions);
|
|
178
168
|
init(): void;
|
|
179
|
-
|
|
180
|
-
private originalChars;
|
|
181
|
-
private charUnitMap;
|
|
182
|
-
private initializeTextStructure;
|
|
183
|
-
private getCharIndexFromUnitIndex;
|
|
169
|
+
setupVisibilityManager(): void;
|
|
184
170
|
private buildTextFromUnits;
|
|
185
171
|
start(): void;
|
|
186
172
|
typeNext(): void;
|
|
@@ -191,13 +177,6 @@ declare class TextToParticle {
|
|
|
191
177
|
destroy(): void;
|
|
192
178
|
}
|
|
193
179
|
|
|
194
|
-
/**
|
|
195
|
-
* Typing - 타이핑 애니메이션 효과
|
|
196
|
-
* 바닐라 JS 코어 클래스
|
|
197
|
-
*
|
|
198
|
-
* 사용법:
|
|
199
|
-
* import { Typing } from 'masoneffect/typing';
|
|
200
|
-
*/
|
|
201
180
|
export declare interface TypingOptions {
|
|
202
181
|
text: string;
|
|
203
182
|
speed?: number;
|
|
@@ -212,4 +191,39 @@ declare class TextToParticle {
|
|
|
212
191
|
onComplete?: () => void;
|
|
213
192
|
}
|
|
214
193
|
|
|
194
|
+
declare class VisibilityManager {
|
|
195
|
+
private container;
|
|
196
|
+
private options;
|
|
197
|
+
private intersectionObserver;
|
|
198
|
+
private visibilityChangeHandler;
|
|
199
|
+
private isVisible;
|
|
200
|
+
private isPageVisible;
|
|
201
|
+
constructor(container: HTMLElement, options?: VisibilityManagerOptions);
|
|
202
|
+
private setupIntersectionObserver;
|
|
203
|
+
private setupPageVisibility;
|
|
204
|
+
/**
|
|
205
|
+
* 현재 요소가 화면에 보이는지 확인
|
|
206
|
+
*/
|
|
207
|
+
getIsVisible(): boolean;
|
|
208
|
+
/**
|
|
209
|
+
* 옵션 업데이트
|
|
210
|
+
*/
|
|
211
|
+
updateOptions(newOptions: Partial<VisibilityManagerOptions>): void;
|
|
212
|
+
/**
|
|
213
|
+
* 리소스 정리
|
|
214
|
+
*/
|
|
215
|
+
destroy(): void;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* VisibilityManager - IntersectionObserver와 Page Visibility API를 통합 관리
|
|
220
|
+
* 모든 효과에서 공통으로 사용하는 가시성 관리 유틸리티
|
|
221
|
+
*/
|
|
222
|
+
declare interface VisibilityManagerOptions {
|
|
223
|
+
threshold?: number;
|
|
224
|
+
rootMargin?: string;
|
|
225
|
+
onVisible?: () => void;
|
|
226
|
+
onHidden?: () => void;
|
|
227
|
+
}
|
|
228
|
+
|
|
215
229
|
export { }
|
|
@@ -263,6 +263,107 @@ class SvelteComponent {
|
|
|
263
263
|
const PUBLIC_VERSION = "4";
|
|
264
264
|
if (typeof window !== "undefined")
|
|
265
265
|
(window.__svelte || (window.__svelte = { v: /* @__PURE__ */ new Set() })).v.add(PUBLIC_VERSION);
|
|
266
|
+
class VisibilityManager {
|
|
267
|
+
constructor(container, options = {}) {
|
|
268
|
+
this.container = container;
|
|
269
|
+
this.options = {
|
|
270
|
+
threshold: options.threshold ?? 0.1,
|
|
271
|
+
rootMargin: options.rootMargin ?? "0px",
|
|
272
|
+
onVisible: options.onVisible,
|
|
273
|
+
onHidden: options.onHidden
|
|
274
|
+
};
|
|
275
|
+
this.intersectionObserver = null;
|
|
276
|
+
this.visibilityChangeHandler = null;
|
|
277
|
+
this.isVisible = false;
|
|
278
|
+
this.isPageVisible = typeof document !== "undefined" ? !document.hidden : true;
|
|
279
|
+
this.setupIntersectionObserver();
|
|
280
|
+
this.setupPageVisibility();
|
|
281
|
+
}
|
|
282
|
+
setupIntersectionObserver() {
|
|
283
|
+
if (typeof window === "undefined" || typeof window.IntersectionObserver === "undefined") {
|
|
284
|
+
this.isVisible = true;
|
|
285
|
+
if (this.isPageVisible && this.options.onVisible) {
|
|
286
|
+
this.options.onVisible();
|
|
287
|
+
}
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
this.intersectionObserver = new IntersectionObserver(
|
|
291
|
+
(entries) => {
|
|
292
|
+
for (const entry of entries) {
|
|
293
|
+
if (entry.target !== this.container) continue;
|
|
294
|
+
if (entry.isIntersecting) {
|
|
295
|
+
this.isVisible = true;
|
|
296
|
+
if (this.isPageVisible && this.options.onVisible) {
|
|
297
|
+
this.options.onVisible();
|
|
298
|
+
}
|
|
299
|
+
} else {
|
|
300
|
+
this.isVisible = false;
|
|
301
|
+
if (this.options.onHidden) {
|
|
302
|
+
this.options.onHidden();
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
threshold: this.options.threshold,
|
|
309
|
+
rootMargin: this.options.rootMargin
|
|
310
|
+
}
|
|
311
|
+
);
|
|
312
|
+
this.intersectionObserver.observe(this.container);
|
|
313
|
+
}
|
|
314
|
+
setupPageVisibility() {
|
|
315
|
+
if (typeof document === "undefined") return;
|
|
316
|
+
this.visibilityChangeHandler = () => {
|
|
317
|
+
const wasVisible = this.isPageVisible;
|
|
318
|
+
this.isPageVisible = !document.hidden;
|
|
319
|
+
if (document.hidden) {
|
|
320
|
+
if (this.options.onHidden) {
|
|
321
|
+
this.options.onHidden();
|
|
322
|
+
}
|
|
323
|
+
} else if (wasVisible !== this.isPageVisible) {
|
|
324
|
+
if (this.isVisible && this.options.onVisible) {
|
|
325
|
+
this.options.onVisible();
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
};
|
|
329
|
+
document.addEventListener("visibilitychange", this.visibilityChangeHandler);
|
|
330
|
+
if (document.hidden && this.isVisible) {
|
|
331
|
+
if (this.options.onHidden) {
|
|
332
|
+
this.options.onHidden();
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* 현재 요소가 화면에 보이는지 확인
|
|
338
|
+
*/
|
|
339
|
+
getIsVisible() {
|
|
340
|
+
return this.isVisible && this.isPageVisible;
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* 옵션 업데이트
|
|
344
|
+
*/
|
|
345
|
+
updateOptions(newOptions) {
|
|
346
|
+
this.options = { ...this.options, ...newOptions };
|
|
347
|
+
if (this.intersectionObserver) {
|
|
348
|
+
this.intersectionObserver.disconnect();
|
|
349
|
+
this.intersectionObserver = null;
|
|
350
|
+
}
|
|
351
|
+
this.setupIntersectionObserver();
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* 리소스 정리
|
|
355
|
+
*/
|
|
356
|
+
destroy() {
|
|
357
|
+
if (this.intersectionObserver) {
|
|
358
|
+
this.intersectionObserver.disconnect();
|
|
359
|
+
this.intersectionObserver = null;
|
|
360
|
+
}
|
|
361
|
+
if (this.visibilityChangeHandler && typeof document !== "undefined") {
|
|
362
|
+
document.removeEventListener("visibilitychange", this.visibilityChangeHandler);
|
|
363
|
+
this.visibilityChangeHandler = null;
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
}
|
|
266
367
|
function debounce(func, wait) {
|
|
267
368
|
let timeout = null;
|
|
268
369
|
return function executedFunction(...args) {
|
|
@@ -320,8 +421,7 @@ class TextToParticle {
|
|
|
320
421
|
this.mouse = { x: 0, y: 0, down: false };
|
|
321
422
|
this.animationId = null;
|
|
322
423
|
this.isRunning = false;
|
|
323
|
-
this.
|
|
324
|
-
this.intersectionObserver = null;
|
|
424
|
+
this.visibilityManager = null;
|
|
325
425
|
this.debounceDelay = options.debounceDelay ?? 150;
|
|
326
426
|
const boundHandleResize = this.handleResize.bind(this);
|
|
327
427
|
this.handleResize = debounce(boundHandleResize, this.debounceDelay);
|
|
@@ -336,39 +436,22 @@ class TextToParticle {
|
|
|
336
436
|
init() {
|
|
337
437
|
this.resize();
|
|
338
438
|
this.setupEventListeners();
|
|
339
|
-
this.
|
|
439
|
+
this.setupVisibilityManager();
|
|
340
440
|
if (this.config.onReady) {
|
|
341
441
|
this.config.onReady(this);
|
|
342
442
|
}
|
|
343
443
|
}
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
if (this.intersectionObserver) {
|
|
351
|
-
return;
|
|
352
|
-
}
|
|
353
|
-
this.intersectionObserver = new IntersectionObserver(
|
|
354
|
-
(entries) => {
|
|
355
|
-
for (const entry of entries) {
|
|
356
|
-
if (entry.target !== this.container) continue;
|
|
357
|
-
if (entry.isIntersecting) {
|
|
358
|
-
this.isVisible = true;
|
|
359
|
-
this.start();
|
|
360
|
-
} else {
|
|
361
|
-
this.isVisible = false;
|
|
362
|
-
this.stop();
|
|
363
|
-
}
|
|
364
|
-
}
|
|
444
|
+
setupVisibilityManager() {
|
|
445
|
+
this.visibilityManager = new VisibilityManager(this.container, {
|
|
446
|
+
threshold: 0.1,
|
|
447
|
+
// 10% 이상 보일 때 동작
|
|
448
|
+
onVisible: () => {
|
|
449
|
+
this.start();
|
|
365
450
|
},
|
|
366
|
-
{
|
|
367
|
-
|
|
368
|
-
// 10% 이상 보일 때 동작
|
|
451
|
+
onHidden: () => {
|
|
452
|
+
this.stop();
|
|
369
453
|
}
|
|
370
|
-
);
|
|
371
|
-
this.intersectionObserver.observe(this.container);
|
|
454
|
+
});
|
|
372
455
|
}
|
|
373
456
|
resize() {
|
|
374
457
|
const width = this.config.width || this.container.clientWidth || window.innerWidth;
|
|
@@ -605,7 +688,10 @@ class TextToParticle {
|
|
|
605
688
|
p.y += p.vy;
|
|
606
689
|
}
|
|
607
690
|
this.ctx.fillStyle = this.config.particleColor;
|
|
608
|
-
const
|
|
691
|
+
const baseSize = 1920;
|
|
692
|
+
const currentSize = Math.min(this.W, this.H) / this.DPR;
|
|
693
|
+
const sizeRatio = Math.max(0.5, Math.min(2, currentSize / baseSize));
|
|
694
|
+
const r = this.config.pointSize * this.DPR * sizeRatio;
|
|
609
695
|
for (const p of this.particles) {
|
|
610
696
|
this.ctx.beginPath();
|
|
611
697
|
this.ctx.arc(p.x, p.y, r, 0, Math.PI * 2);
|
|
@@ -677,9 +763,9 @@ class TextToParticle {
|
|
|
677
763
|
destroy() {
|
|
678
764
|
this.stop();
|
|
679
765
|
this.removeEventListeners();
|
|
680
|
-
if (this.
|
|
681
|
-
this.
|
|
682
|
-
this.
|
|
766
|
+
if (this.visibilityManager) {
|
|
767
|
+
this.visibilityManager.destroy();
|
|
768
|
+
this.visibilityManager = null;
|
|
683
769
|
}
|
|
684
770
|
if (this.canvas && this.canvas.parentNode) {
|
|
685
771
|
this.canvas.parentNode.removeChild(this.canvas);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var t=Object.defineProperty,e=(e,n,i)=>((e,n,i)=>n in e?t(e,n,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[n]=i)(e,"symbol"!=typeof n?n+"":n,i);const n=require("svelte");function i(){}function s(t){return t()}function r(){return Object.create(null)}function o(t){t.forEach(s)}function h(t){return"function"==typeof t}function c(t,e){return t!=t?e==e:t!==e||t&&"object"==typeof t||"function"==typeof t}function u(t,e,n){t.$$.on_destroy.push(function(t,...e){if(null==t){for(const t of e)t(void 0);return i}const n=t.subscribe(...e);return n.unsubscribe?()=>n.unsubscribe():n}(e,n))}function a(t){t.parentNode&&t.parentNode.removeChild(t)}function l(t,e,n){null==n?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}let d;function f(t){d=t}const p=[],g=[];let x=[];const $=[],y=Promise.resolve();let b=!1;function m(t){x.push(t)}const C=new Set;let T=0;function v(){if(0!==T)return;const t=d;do{try{for(;T<p.length;){const t=p[T];T++,f(t),w(t.$$)}}catch(e){throw p.length=0,T=0,e}for(f(null),p.length=0,T=0;g.length;)g.pop()();for(let t=0;t<x.length;t+=1){const e=x[t];C.has(e)||(C.add(e),e())}x.length=0}while(p.length);for(;$.length;)$.pop()();b=!1,C.clear(),f(t)}function w(t){if(null!==t.fragment){t.update(),o(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(m)}}const _=new Set;function O(t,e){const n=t.$$;null!==n.fragment&&(!function(t){const e=[],n=[];x.forEach(i=>-1===t.indexOf(i)?e.push(i):n.push(i)),n.forEach(t=>t()),x=e}(n.after_update),o(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function U(t,e){-1===t.$$.dirty[0]&&(p.push(t),b||(b=!0,y.then(v)),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function I(t,e,n,c,u,l,p=null,g=[-1]){const x=d;f(t);const $=t.$$={fragment:null,ctx:[],props:l,update:i,not_equal:u,bound:r(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(x?x.$$.context:[])),callbacks:r(),dirty:g,skip_bound:!1,root:e.target||x.$$.root};p&&p($.root);let y=!1;if($.ctx=n?n(t,e.props||{},(e,n,...i)=>{const s=i.length?i[0]:n;return $.ctx&&u($.ctx[e],$.ctx[e]=s)&&(!$.skip_bound&&$.bound[e]&&$.bound[e](s),y&&U(t,e)),n}):[],$.update(),y=!0,o($.before_update),$.fragment=!!c&&c($.ctx),e.target){if(e.hydrate){const t=(T=e.target,Array.from(T.childNodes));$.fragment&&$.fragment.l(t),t.forEach(a)}else $.fragment&&$.fragment.c();e.intro&&((b=t.$$.fragment)&&b.i&&(_.delete(b),b.i(C))),function(t,e,n){const{fragment:i,after_update:r}=t.$$;i&&i.m(e,n),m(()=>{const e=t.$$.on_mount.map(s).filter(h);t.$$.on_destroy?t.$$.on_destroy.push(...e):o(e),t.$$.on_mount=[]}),r.forEach(m)}(t,e.target,e.anchor),v()}var b,C,T;f(x)}class M{constructor(){e(this,"$$"),e(this,"$$set")}$destroy(){O(this,1),this.$destroy=i}$on(t,e){if(!h(e))return i;const n=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return n.push(e),()=>{const t=n.indexOf(e);-1!==t&&n.splice(t,1)}}$set(t){var e;this.$$set&&(e=t,0!==Object.keys(e).length)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}function k(t){const e=t.charCodeAt(0);if(e<44032||e>55203)return[t];const n=e-44032,i=Math.floor(n/588),s=Math.floor(n%588/28),r=n%28,o=["","ㄱ","ㄲ","ㄳ","ㄴ","ㄵ","ㄶ","ㄷ","ㄹ","ㄺ","ㄻ","ㄼ","ㄽ","ㄾ","ㄿ","ㅀ","ㅁ","ㅂ","ㅄ","ㅅ","ㅆ","ㅇ","ㅈ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"],h=[];return h.push(["ㄱ","ㄲ","ㄴ","ㄷ","ㄸ","ㄹ","ㅁ","ㅂ","ㅃ","ㅅ","ㅆ","ㅇ","ㅈ","ㅉ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"][i]),h.push(["ㅏ","ㅐ","ㅑ","ㅒ","ㅓ","ㅔ","ㅕ","ㅖ","ㅗ","ㅘ","ㅙ","ㅚ","ㅛ","ㅜ","ㅝ","ㅞ","ㅟ","ㅠ","ㅡ","ㅢ","ㅣ"][s]),r>0&&h.push(o[r]),h}function A(t){const e=[];for(let n=0;n<t.length;n++){const i=t[n],s=i.charCodeAt(0);if(s>=44032&&s<=55203){const t=k(i);e.push(...t)}else e.push(i)}return e}"undefined"!=typeof window&&(window.__svelte||(window.__svelte={v:new Set})).v.add("4");class E{constructor(t,e){if(this.originalChars=[],this.charUnitMap=[],this.container="string"==typeof t?document.querySelector(t):t,!this.container)throw new Error("Container element not found");this.originalText=e.text,this.config={text:e.text,speed:e.speed??50,delay:e.delay??0,enabled:e.enabled??!0,threshold:e.threshold??.2,rootMargin:e.rootMargin??"0px 0px -100px 0px",triggerOnce:e.triggerOnce??!1,showCursor:e.showCursor??!0,cursorChar:e.cursorChar??"|",onUpdate:e.onUpdate||null,onComplete:e.onComplete||null},this.textUnits=A(this.config.text),this.originalChars=[],this.charUnitMap=[],this.initializeTextStructure(),this.currentIndex=0,this.displayedText="",this.timeoutId=null,this.intersectionObserver=null,this.isRunning=!1,this.hasTriggered=!1,this.init()}init(){this.updateDisplay(""),this.setupIntersectionObserver()}setupIntersectionObserver(){"undefined"!=typeof window&&void 0!==window.IntersectionObserver?(this.intersectionObserver=new IntersectionObserver(t=>{var e;for(const n of t)n.target===this.container&&n.isIntersecting&&!this.hasTriggered&&(this.config.enabled&&setTimeout(()=>this.start(),this.config.delay),this.hasTriggered=!0,this.config.triggerOnce&&(null==(e=this.intersectionObserver)||e.disconnect()))},{threshold:this.config.threshold,rootMargin:this.config.rootMargin}),this.intersectionObserver.observe(this.container)):this.config.enabled&&setTimeout(()=>this.start(),this.config.delay)}initializeTextStructure(){this.originalChars=[],this.charUnitMap=[];for(let t=0;t<this.originalText.length;t++){const e=this.originalText[t],n=e.charCodeAt(0);if(this.originalChars.push(e),n>=44032&&n<=55203){const t=k(e);this.charUnitMap.push(t.length)}else this.charUnitMap.push(1)}}getCharIndexFromUnitIndex(t){if(0===t)return 0;let e=0,n=0;for(let i=0;i<this.charUnitMap.length;i++){const s=this.charUnitMap[i];if(n+=s,!(t>=n)){const r=t-(n-s);if(r>0){const t=this.originalChars[i]&&this.originalChars[i].charCodeAt(0)>=44032&&this.originalChars[i].charCodeAt(0)<=55203;(t&&r>=2||!t&&r>=1)&&(e=i+1)}break}e=i+1}return e}buildTextFromUnits(t){if(0===t.length)return"";const e=this.getCharIndexFromUnitIndex(t.length);return this.originalText.substring(0,e)}start(){this.isRunning||(this.isRunning=!0,this.currentIndex=0,this.displayedText="",this.typeNext())}typeNext(){if(this.currentIndex>=this.textUnits.length)return this.isRunning=!1,this.config.showCursor&&this.updateDisplay(this.originalText),void(this.config.onComplete&&this.config.onComplete());const t=this.textUnits.slice(0,this.currentIndex+1);this.displayedText=this.buildTextFromUnits(t);let e=this.displayedText;this.config.showCursor&&(e+=this.config.cursorChar),this.updateDisplay(e),this.config.onUpdate&&this.config.onUpdate(this.displayedText),this.currentIndex++,this.timeoutId=setTimeout(()=>{this.typeNext()},this.config.speed)}stop(){this.isRunning=!1,this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)}reset(){this.stop(),this.currentIndex=0,this.displayedText="",this.hasTriggered=!1,this.updateDisplay("")}updateDisplay(t){this.container.textContent=t}setText(t){this.originalText=t,this.config.text=t,this.textUnits=A(t),this.initializeTextStructure(),this.reset(),this.config.enabled&&setTimeout(()=>this.start(),this.config.delay)}destroy(){this.stop(),this.intersectionObserver&&(this.intersectionObserver.disconnect(),this.intersectionObserver=null)}}function N(t){let e;return{c(){var n;n="div",e=document.createElement(n),l(e,"class",t[1]),l(e,"style",t[2])},m(n,i){!function(t,e,n){t.insertBefore(e,n||null)}(n,e,i),t[8](e)},p:i,i:i,o:i,d(n){n&&a(e),t[8](null)}}}function S(t,e,i){let s,r;u(t,effect,t=>i(10,s=t)),u(t,props,t=>i(11,r=t));let{text:o,speed:h=50,delay:c=0,enabled:a=!0,threshold:l=.2,rootMargin:d="0px 0px -100px 0px",triggerOnce:f=!1,showCursor:p=!0,cursorChar:x="|",className:$="",style:y="",onUpdate:b,onComplete:m}=r(),C=null,T=null;return n.onMount(()=>{if(!C)return;T=new E(C,{text:o,speed:h,delay:c,enabled:a,threshold:l,rootMargin:d,triggerOnce:f,showCursor:p,cursorChar:x,onUpdate:b,onComplete:m})}),n.onDestroy(()=>{T&&(T.destroy(),T=null)}),s(()=>{T&&o!==T.originalText&&T.setText(o)}),[C,$,y,function(){null==T||T.start()},function(){null==T||T.stop()},function(){null==T||T.reset()},function(t){null==T||T.setText(t)},function(){T&&(T.destroy(),T=null)},function(t){g[t?"unshift":"push"](()=>{C=t,i(0,C)})}]}module.exports=class extends M{constructor(t){super(),I(this,t,S,N,c,{start:3,stop:4,reset:5,setText:6,destroy:7})}get start(){return this.$$.ctx[3]}get stop(){return this.$$.ctx[4]}get reset(){return this.$$.ctx[5]}get setText(){return this.$$.ctx[6]}get destroy(){return this.$$.ctx[7]}};
|
|
1
|
+
"use strict";var t=Object.defineProperty,e=(e,i,n)=>((e,i,n)=>i in e?t(e,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[i]=n)(e,"symbol"!=typeof i?i+"":i,n);const i=require("svelte");function n(){}function s(t){return t()}function o(){return Object.create(null)}function r(t){t.forEach(s)}function h(t){return"function"==typeof t}function l(t,e){return t!=t?e==e:t!==e||t&&"object"==typeof t||"function"==typeof t}function a(t,e,i){t.$$.on_destroy.push(function(t,...e){if(null==t){for(const t of e)t(void 0);return n}const i=t.subscribe(...e);return i.unsubscribe?()=>i.unsubscribe():i}(e,i))}function u(t){t.parentNode&&t.parentNode.removeChild(t)}function c(t,e,i){null==i?t.removeAttribute(e):t.getAttribute(e)!==i&&t.setAttribute(e,i)}let d;function f(t){d=t}const g=[],p=[];let b=[];const y=[],x=Promise.resolve();let m=!1;function $(t){b.push(t)}const v=new Set;let C=0;function w(){if(0!==C)return;const t=d;do{try{for(;C<g.length;){const t=g[C];C++,f(t),V(t.$$)}}catch(e){throw g.length=0,C=0,e}for(f(null),g.length=0,C=0;p.length;)p.pop()();for(let t=0;t<b.length;t+=1){const e=b[t];v.has(e)||(v.add(e),e())}b.length=0}while(g.length);for(;y.length;)y.pop()();m=!1,v.clear(),f(t)}function V(t){if(null!==t.fragment){t.update(),r(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach($)}}const O=new Set;function _(t,e){const i=t.$$;null!==i.fragment&&(!function(t){const e=[],i=[];b.forEach(n=>-1===t.indexOf(n)?e.push(n):i.push(n)),i.forEach(t=>t()),b=e}(i.after_update),r(i.on_destroy),i.fragment&&i.fragment.d(e),i.on_destroy=i.fragment=null,i.ctx=[])}function T(t,e){-1===t.$$.dirty[0]&&(g.push(t),m||(m=!0,x.then(w)),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function M(t,e,i,l,a,c,g=null,p=[-1]){const b=d;f(t);const y=t.$$={fragment:null,ctx:[],props:c,update:n,not_equal:a,bound:o(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(b?b.$$.context:[])),callbacks:o(),dirty:p,skip_bound:!1,root:e.target||b.$$.root};g&&g(y.root);let x=!1;if(y.ctx=i?i(t,e.props||{},(e,i,...n)=>{const s=n.length?n[0]:i;return y.ctx&&a(y.ctx[e],y.ctx[e]=s)&&(!y.skip_bound&&y.bound[e]&&y.bound[e](s),x&&T(t,e)),i}):[],y.update(),x=!0,r(y.before_update),y.fragment=!!l&&l(y.ctx),e.target){if(e.hydrate){const t=(C=e.target,Array.from(C.childNodes));y.fragment&&y.fragment.l(t),t.forEach(u)}else y.fragment&&y.fragment.c();e.intro&&((m=t.$$.fragment)&&m.i&&(O.delete(m),m.i(v))),function(t,e,i){const{fragment:n,after_update:o}=t.$$;n&&n.m(e,i),$(()=>{const e=t.$$.on_mount.map(s).filter(h);t.$$.on_destroy?t.$$.on_destroy.push(...e):r(e),t.$$.on_mount=[]}),o.forEach($)}(t,e.target,e.anchor),w()}var m,v,C;f(b)}class U{constructor(){e(this,"$$"),e(this,"$$set")}$destroy(){_(this,1),this.$destroy=n}$on(t,e){if(!h(e))return n;const i=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return i.push(e),()=>{const t=i.indexOf(e);-1!==t&&i.splice(t,1)}}$set(t){var e;this.$$set&&(e=t,0!==Object.keys(e).length)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}"undefined"!=typeof window&&(window.__svelte||(window.__svelte={v:new Set})).v.add("4");class H{constructor(t,e={}){this.container=t,this.options={threshold:e.threshold??.1,rootMargin:e.rootMargin??"0px",onVisible:e.onVisible,onHidden:e.onHidden},this.intersectionObserver=null,this.visibilityChangeHandler=null,this.isVisible=!1,this.isPageVisible="undefined"==typeof document||!document.hidden,this.setupIntersectionObserver(),this.setupPageVisibility()}setupIntersectionObserver(){if("undefined"==typeof window||void 0===window.IntersectionObserver)return this.isVisible=!0,void(this.isPageVisible&&this.options.onVisible&&this.options.onVisible());this.intersectionObserver=new IntersectionObserver(t=>{for(const e of t)e.target===this.container&&(e.isIntersecting?(this.isVisible=!0,this.isPageVisible&&this.options.onVisible&&this.options.onVisible()):(this.isVisible=!1,this.options.onHidden&&this.options.onHidden()))},{threshold:this.options.threshold,rootMargin:this.options.rootMargin}),this.intersectionObserver.observe(this.container)}setupPageVisibility(){"undefined"!=typeof document&&(this.visibilityChangeHandler=()=>{const t=this.isPageVisible;this.isPageVisible=!document.hidden,document.hidden?this.options.onHidden&&this.options.onHidden():t!==this.isPageVisible&&this.isVisible&&this.options.onVisible&&this.options.onVisible()},document.addEventListener("visibilitychange",this.visibilityChangeHandler),document.hidden&&this.isVisible&&this.options.onHidden&&this.options.onHidden())}getIsVisible(){return this.isVisible&&this.isPageVisible}updateOptions(t){this.options={...this.options,...t},this.intersectionObserver&&(this.intersectionObserver.disconnect(),this.intersectionObserver=null),this.setupIntersectionObserver()}destroy(){this.intersectionObserver&&(this.intersectionObserver.disconnect(),this.intersectionObserver=null),this.visibilityChangeHandler&&"undefined"!=typeof document&&(document.removeEventListener("visibilitychange",this.visibilityChangeHandler),this.visibilityChangeHandler=null)}}function I(t){const e=t.charCodeAt(0);if(e<44032||e>55203)return[t];const i=e-44032,n=Math.floor(i/588),s=Math.floor(i%588/28),o=i%28,r=["","ㄱ","ㄲ","ㄳ","ㄴ","ㄵ","ㄶ","ㄷ","ㄹ","ㄺ","ㄻ","ㄼ","ㄽ","ㄾ","ㄿ","ㅀ","ㅁ","ㅂ","ㅄ","ㅅ","ㅆ","ㅇ","ㅈ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"],h=[];return h.push(["ㄱ","ㄲ","ㄴ","ㄷ","ㄸ","ㄹ","ㅁ","ㅂ","ㅃ","ㅅ","ㅆ","ㅇ","ㅈ","ㅉ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"][n]),h.push(["ㅏ","ㅐ","ㅑ","ㅒ","ㅓ","ㅔ","ㅕ","ㅖ","ㅗ","ㅘ","ㅙ","ㅚ","ㅛ","ㅜ","ㅝ","ㅞ","ㅟ","ㅠ","ㅡ","ㅢ","ㅣ"][s]),o>0&&h.push(r[o]),h}function R(t,e,i){const n=["ㄱ","ㄲ","ㄴ","ㄷ","ㄸ","ㄹ","ㅁ","ㅂ","ㅃ","ㅅ","ㅆ","ㅇ","ㅈ","ㅉ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"].indexOf(t),s=["ㅏ","ㅐ","ㅑ","ㅒ","ㅓ","ㅔ","ㅕ","ㅖ","ㅗ","ㅘ","ㅙ","ㅚ","ㅛ","ㅜ","ㅝ","ㅞ","ㅟ","ㅠ","ㅡ","ㅢ","ㅣ"].indexOf(e),o=i?["","ㄱ","ㄲ","ㄳ","ㄴ","ㄵ","ㄶ","ㄷ","ㄹ","ㄺ","ㄻ","ㄼ","ㄽ","ㄾ","ㄿ","ㅀ","ㅁ","ㅂ","ㅄ","ㅅ","ㅆ","ㅇ","ㅈ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"].indexOf(i):0;if(-1===n||-1===s)return t+(e||"")+(i||"");const r=44032+21*n*28+28*s+o;return String.fromCharCode(r)}function P(t){const e=[],i=[];for(let n=0;n<t.length;n++){const s=t[n],o=s.charCodeAt(0),r=e.length;if(o>=44032&&o<=55203){const t=I(s);e.push(...t),i.push({start:r,end:e.length,isHangul:!0})}else e.push(s),i.push({start:r,end:e.length,isHangul:!1})}return{units:e,charUnitRanges:i}}class k{constructor(t,e){if(this.container="string"==typeof t?document.querySelector(t):t,!this.container)throw new Error("Container element not found");this.originalText=e.text,this.config={text:e.text,speed:e.speed??50,delay:e.delay??0,enabled:e.enabled??!0,threshold:e.threshold??.2,rootMargin:e.rootMargin??"0px 0px -100px 0px",triggerOnce:e.triggerOnce??!1,showCursor:e.showCursor??!0,cursorChar:e.cursorChar??"|",onUpdate:e.onUpdate||null,onComplete:e.onComplete||null};const i=P(this.config.text);this.textUnits=i.units,this.charUnitRanges=i.charUnitRanges,this.currentIndex=0,this.displayedText="",this.timeoutId=null,this.visibilityManager=null,this.isRunning=!1,this.hasTriggered=!1,this.init()}init(){this.updateDisplay(""),this.setupVisibilityManager()}setupVisibilityManager(){this.visibilityManager=new H(this.container,{threshold:this.config.threshold,rootMargin:this.config.rootMargin,onVisible:()=>{!this.hasTriggered&&this.config.enabled&&(this.hasTriggered=!0,setTimeout(()=>this.start(),this.config.delay))},onHidden:()=>{}})}buildTextFromUnits(t){if(0===t)return"";let e="";for(let i=0;i<this.charUnitRanges.length;i++){const n=this.charUnitRanges[i];if(n.start>=t)break;const s=Math.min(t-n.start,n.end-n.start);if(s<=0)break;if(n.isHangul){const t=this.textUnits.slice(n.start,n.start+s);1===t.length?e+=t[0]:2===t.length?e+=R(t[0],t[1]):t.length>=3&&(e+=R(t[0],t[1],t[2]))}else s>0&&(e+=this.textUnits[n.start])}return e}start(){this.isRunning||(this.isRunning=!0,this.currentIndex=0,this.displayedText="",this.typeNext())}typeNext(){if(this.currentIndex>=this.textUnits.length)return this.isRunning=!1,this.config.showCursor&&this.updateDisplay(this.originalText),void(this.config.onComplete&&this.config.onComplete());this.displayedText=this.buildTextFromUnits(this.currentIndex+1);let t=this.displayedText;this.config.showCursor&&(t+=this.config.cursorChar),this.updateDisplay(t),this.config.onUpdate&&this.config.onUpdate(this.displayedText),this.currentIndex++,this.timeoutId=setTimeout(()=>{this.typeNext()},this.config.speed)}stop(){this.isRunning=!1,this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)}reset(){this.stop(),this.currentIndex=0,this.displayedText="",this.hasTriggered=!1,this.updateDisplay("")}updateDisplay(t){this.container.textContent=t}setText(t){this.originalText=t,this.config.text=t;const e=P(t);this.textUnits=e.units,this.charUnitRanges=e.charUnitRanges,this.reset(),this.config.enabled&&setTimeout(()=>this.start(),this.config.delay)}destroy(){this.stop(),this.visibilityManager&&(this.visibilityManager.destroy(),this.visibilityManager=null)}}function E(t){let e;return{c(){var i;i="div",e=document.createElement(i),c(e,"class",t[1]),c(e,"style",t[2])},m(i,n){!function(t,e,i){t.insertBefore(e,i||null)}(i,e,n),t[8](e)},p:n,i:n,o:n,d(i){i&&u(e),t[8](null)}}}function N(t,e,n){let s,o;a(t,effect,t=>n(10,s=t)),a(t,props,t=>n(11,o=t));let{text:r,speed:h=50,delay:l=0,enabled:u=!0,threshold:c=.2,rootMargin:d="0px 0px -100px 0px",triggerOnce:f=!1,showCursor:g=!0,cursorChar:b="|",className:y="",style:x="",onUpdate:m,onComplete:$}=o(),v=null,C=null;return i.onMount(()=>{if(!v)return;C=new k(v,{text:r,speed:h,delay:l,enabled:u,threshold:c,rootMargin:d,triggerOnce:f,showCursor:g,cursorChar:b,onUpdate:m,onComplete:$})}),i.onDestroy(()=>{C&&(C.destroy(),C=null)}),s(()=>{C&&r!==C.originalText&&C.setText(r)}),[v,y,x,function(){null==C||C.start()},function(){null==C||C.stop()},function(){null==C||C.reset()},function(t){null==C||C.setText(t)},function(){C&&(C.destroy(),C=null)},function(t){p[t?"unshift":"push"](()=>{v=t,n(0,v)})}]}module.exports=class extends U{constructor(t){super(),M(this,t,N,E,l,{start:3,stop:4,reset:5,setText:6,destroy:7})}get start(){return this.$$.ctx[3]}get stop(){return this.$$.ctx[4]}get reset(){return this.$$.ctx[5]}get setText(){return this.$$.ctx[6]}get destroy(){return this.$$.ctx[7]}};
|
|
@@ -7,12 +7,12 @@ export declare class Count {
|
|
|
7
7
|
currentValue: number;
|
|
8
8
|
startTime: number | null;
|
|
9
9
|
animationFrameId: number | null;
|
|
10
|
-
|
|
10
|
+
visibilityManager: VisibilityManager | null;
|
|
11
11
|
isRunning: boolean;
|
|
12
12
|
hasTriggered: boolean;
|
|
13
13
|
constructor(container: HTMLElement | string, options: CountOptions);
|
|
14
14
|
init(): void;
|
|
15
|
-
|
|
15
|
+
setupVisibilityManager(): void;
|
|
16
16
|
start(): void;
|
|
17
17
|
stop(): void;
|
|
18
18
|
reset(): void;
|
|
@@ -23,13 +23,6 @@ export declare class Count {
|
|
|
23
23
|
destroy(): void;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
/**
|
|
27
|
-
* Count - 숫자 카운팅 애니메이션 효과
|
|
28
|
-
* 바닐라 JS 코어 클래스
|
|
29
|
-
*
|
|
30
|
-
* 사용법:
|
|
31
|
-
* import { Count } from 'masoneffect/count';
|
|
32
|
-
*/
|
|
33
26
|
export declare interface CountOptions {
|
|
34
27
|
targetValue: number;
|
|
35
28
|
duration?: number;
|
|
@@ -84,14 +77,13 @@ declare class TextToParticle {
|
|
|
84
77
|
};
|
|
85
78
|
animationId: number | null;
|
|
86
79
|
isRunning: boolean;
|
|
87
|
-
|
|
88
|
-
intersectionObserver: IntersectionObserver | null;
|
|
80
|
+
visibilityManager: VisibilityManager | null;
|
|
89
81
|
debounceDelay: number;
|
|
90
82
|
_debouncedMorph: (textOrOptions?: string | Partial<TextToParticleOptions> | null) => void;
|
|
91
83
|
_debouncedUpdateConfig: (newConfig: Partial<TextToParticleOptions>) => void;
|
|
92
84
|
constructor(container: HTMLElement | string, options?: TextToParticleOptions);
|
|
93
85
|
init(): void;
|
|
94
|
-
|
|
86
|
+
setupVisibilityManager(): void;
|
|
95
87
|
resize(): void;
|
|
96
88
|
/**
|
|
97
89
|
* 텍스트가 영역 안에 들어가는지 확인하는 헬퍼 함수 (줄바꿈 지원)
|
|
@@ -132,13 +124,6 @@ declare class TextToParticle {
|
|
|
132
124
|
export { TextToParticle }
|
|
133
125
|
export default TextToParticle;
|
|
134
126
|
|
|
135
|
-
/**
|
|
136
|
-
* TextToParticle - 텍스트를 파티클로 변환하는 효과
|
|
137
|
-
* 바닐라 JS 코어 클래스
|
|
138
|
-
*
|
|
139
|
-
* 사용법:
|
|
140
|
-
* import { TextToParticle } from 'masoneffect/textToParticle';
|
|
141
|
-
*/
|
|
142
127
|
declare interface TextToParticleOptions {
|
|
143
128
|
text?: string;
|
|
144
129
|
densityStep?: number;
|
|
@@ -167,20 +152,21 @@ declare class TextToParticle {
|
|
|
167
152
|
onComplete: TypingOptions['onComplete'];
|
|
168
153
|
};
|
|
169
154
|
textUnits: string[];
|
|
155
|
+
charUnitRanges: Array<{
|
|
156
|
+
start: number;
|
|
157
|
+
end: number;
|
|
158
|
+
isHangul: boolean;
|
|
159
|
+
}>;
|
|
170
160
|
currentIndex: number;
|
|
171
161
|
displayedText: string;
|
|
172
162
|
timeoutId: ReturnType<typeof setTimeout> | null;
|
|
173
|
-
|
|
163
|
+
visibilityManager: VisibilityManager | null;
|
|
174
164
|
isRunning: boolean;
|
|
175
165
|
hasTriggered: boolean;
|
|
176
166
|
originalText: string;
|
|
177
167
|
constructor(container: HTMLElement | string, options: TypingOptions);
|
|
178
168
|
init(): void;
|
|
179
|
-
|
|
180
|
-
private originalChars;
|
|
181
|
-
private charUnitMap;
|
|
182
|
-
private initializeTextStructure;
|
|
183
|
-
private getCharIndexFromUnitIndex;
|
|
169
|
+
setupVisibilityManager(): void;
|
|
184
170
|
private buildTextFromUnits;
|
|
185
171
|
start(): void;
|
|
186
172
|
typeNext(): void;
|
|
@@ -191,13 +177,6 @@ declare class TextToParticle {
|
|
|
191
177
|
destroy(): void;
|
|
192
178
|
}
|
|
193
179
|
|
|
194
|
-
/**
|
|
195
|
-
* Typing - 타이핑 애니메이션 효과
|
|
196
|
-
* 바닐라 JS 코어 클래스
|
|
197
|
-
*
|
|
198
|
-
* 사용법:
|
|
199
|
-
* import { Typing } from 'masoneffect/typing';
|
|
200
|
-
*/
|
|
201
180
|
export declare interface TypingOptions {
|
|
202
181
|
text: string;
|
|
203
182
|
speed?: number;
|
|
@@ -212,4 +191,39 @@ declare class TextToParticle {
|
|
|
212
191
|
onComplete?: () => void;
|
|
213
192
|
}
|
|
214
193
|
|
|
194
|
+
declare class VisibilityManager {
|
|
195
|
+
private container;
|
|
196
|
+
private options;
|
|
197
|
+
private intersectionObserver;
|
|
198
|
+
private visibilityChangeHandler;
|
|
199
|
+
private isVisible;
|
|
200
|
+
private isPageVisible;
|
|
201
|
+
constructor(container: HTMLElement, options?: VisibilityManagerOptions);
|
|
202
|
+
private setupIntersectionObserver;
|
|
203
|
+
private setupPageVisibility;
|
|
204
|
+
/**
|
|
205
|
+
* 현재 요소가 화면에 보이는지 확인
|
|
206
|
+
*/
|
|
207
|
+
getIsVisible(): boolean;
|
|
208
|
+
/**
|
|
209
|
+
* 옵션 업데이트
|
|
210
|
+
*/
|
|
211
|
+
updateOptions(newOptions: Partial<VisibilityManagerOptions>): void;
|
|
212
|
+
/**
|
|
213
|
+
* 리소스 정리
|
|
214
|
+
*/
|
|
215
|
+
destroy(): void;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* VisibilityManager - IntersectionObserver와 Page Visibility API를 통합 관리
|
|
220
|
+
* 모든 효과에서 공통으로 사용하는 가시성 관리 유틸리티
|
|
221
|
+
*/
|
|
222
|
+
declare interface VisibilityManagerOptions {
|
|
223
|
+
threshold?: number;
|
|
224
|
+
rootMargin?: string;
|
|
225
|
+
onVisible?: () => void;
|
|
226
|
+
onHidden?: () => void;
|
|
227
|
+
}
|
|
228
|
+
|
|
215
229
|
export { }
|