masoneffect 1.0.29 → 2.0.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/README.md +320 -231
- package/dist/core/count/index.d.ts +52 -0
- package/dist/core/count/index.d.ts.map +1 -0
- package/dist/core/index.d.ts +15 -97
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/textToParticle/index.d.ts +103 -0
- package/dist/core/textToParticle/index.d.ts.map +1 -0
- package/dist/count/core/count/index.d.ts +52 -0
- package/dist/count/core/count/index.d.ts.map +1 -0
- package/dist/count/core/index.d.ts +18 -0
- package/dist/count/core/index.d.ts.map +1 -0
- package/dist/count/core/textToParticle/index.d.ts +103 -0
- package/dist/count/core/textToParticle/index.d.ts.map +1 -0
- package/dist/count/index.cjs +1 -0
- package/dist/count/index.d.ts +16 -0
- package/dist/count/index.d.ts.map +1 -0
- package/dist/count/index.mjs +1 -0
- package/dist/count/index.umd.d.ts +7 -0
- package/dist/count/index.umd.d.ts.map +1 -0
- package/dist/count/react/MasonEffect.d.ts +32 -0
- package/dist/count/react/MasonEffect.d.ts.map +1 -0
- package/dist/count/react/count/Count.d.ts +19 -0
- package/dist/count/react/count/Count.d.ts.map +1 -0
- package/dist/count/react/count/index.d.ts +5 -0
- package/dist/count/react/count/index.d.ts.map +1 -0
- package/dist/count/react/index.d.ts +12 -0
- package/dist/count/react/index.d.ts.map +1 -0
- package/dist/count/react/textToParticle/TextToParticle.d.ts +15 -0
- package/dist/count/react/textToParticle/TextToParticle.d.ts.map +1 -0
- package/dist/count/react/textToParticle/index.d.ts +4 -0
- package/dist/count/react/textToParticle/index.d.ts.map +1 -0
- package/dist/count/svelte/count/index.d.ts +2 -0
- package/dist/count/svelte/count/index.d.ts.map +1 -0
- package/dist/count/svelte/index.d.ts +8 -0
- package/dist/count/svelte/index.d.ts.map +1 -0
- package/dist/count/svelte/textToParticle/index.d.ts +2 -0
- package/dist/count/svelte/textToParticle/index.d.ts.map +1 -0
- package/dist/count/vue/count/index.d.ts +2 -0
- package/dist/count/vue/count/index.d.ts.map +1 -0
- package/dist/count/vue/index.d.ts +8 -0
- package/dist/count/vue/index.d.ts.map +1 -0
- package/dist/count/vue/textToParticle/index.d.ts +2 -0
- package/dist/count/vue/textToParticle/index.d.ts.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +12 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.umd.min.js +1 -1
- package/dist/react/MasonEffect.cjs +1 -1
- package/dist/react/MasonEffect.mjs +1 -1
- package/dist/react/core/count/index.d.ts +51 -0
- package/dist/react/core/index.d.ts +15 -97
- package/dist/react/core/textToParticle/index.d.ts +102 -0
- package/dist/react/count/Count.d.ts +19 -0
- package/dist/react/count/Count.d.ts.map +1 -0
- package/dist/react/count/core/count/index.d.ts +52 -0
- package/dist/react/count/core/count/index.d.ts.map +1 -0
- package/dist/react/count/core/index.d.ts +18 -0
- package/dist/react/count/core/index.d.ts.map +1 -0
- package/dist/react/count/core/textToParticle/index.d.ts +103 -0
- package/dist/react/count/core/textToParticle/index.d.ts.map +1 -0
- package/dist/react/count/index.cjs +1 -0
- package/dist/react/count/index.d.ts +16 -0
- package/dist/react/count/index.d.ts.map +1 -0
- package/dist/react/count/index.mjs +1 -0
- package/dist/react/count/index.umd.d.ts +7 -0
- package/dist/react/count/index.umd.d.ts.map +1 -0
- package/dist/react/count/react/MasonEffect.d.ts +32 -0
- package/dist/react/count/react/MasonEffect.d.ts.map +1 -0
- package/dist/react/count/react/count/Count.d.ts +19 -0
- package/dist/react/count/react/count/Count.d.ts.map +1 -0
- package/dist/react/count/react/count/index.d.ts +5 -0
- package/dist/react/count/react/count/index.d.ts.map +1 -0
- package/dist/react/count/react/index.d.ts +12 -0
- package/dist/react/count/react/index.d.ts.map +1 -0
- package/dist/react/count/react/textToParticle/TextToParticle.d.ts +15 -0
- package/dist/react/count/react/textToParticle/TextToParticle.d.ts.map +1 -0
- package/dist/react/count/react/textToParticle/index.d.ts +4 -0
- package/dist/react/count/react/textToParticle/index.d.ts.map +1 -0
- package/dist/react/count/svelte/count/index.d.ts +2 -0
- package/dist/react/count/svelte/count/index.d.ts.map +1 -0
- package/dist/react/count/svelte/index.d.ts +8 -0
- package/dist/react/count/svelte/index.d.ts.map +1 -0
- package/dist/react/count/svelte/textToParticle/index.d.ts +2 -0
- package/dist/react/count/svelte/textToParticle/index.d.ts.map +1 -0
- package/dist/react/count/vue/count/index.d.ts +2 -0
- package/dist/react/count/vue/count/index.d.ts.map +1 -0
- package/dist/react/count/vue/index.d.ts +8 -0
- package/dist/react/count/vue/index.d.ts.map +1 -0
- package/dist/react/count/vue/textToParticle/index.d.ts +2 -0
- package/dist/react/count/vue/textToParticle/index.d.ts.map +1 -0
- package/dist/react/index.cjs +12 -2
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.mjs +2 -1
- package/dist/react/react/count/Count.d.ts +18 -0
- package/dist/react/react/count/index.d.ts +4 -0
- package/dist/react/react/index.d.ts +11 -2
- package/dist/react/react/textToParticle/TextToParticle.d.ts +14 -0
- package/dist/react/react/textToParticle/index.d.ts +3 -0
- package/dist/react/svelte/count/index.d.ts +1 -0
- package/dist/react/svelte/index.d.ts +5 -3
- package/dist/react/svelte/textToParticle/index.d.ts +1 -0
- package/dist/react/textToParticle/TextToParticle.d.ts +15 -0
- package/dist/react/textToParticle/TextToParticle.d.ts.map +1 -0
- package/dist/react/textToParticle/core/count/index.d.ts +52 -0
- package/dist/react/textToParticle/core/count/index.d.ts.map +1 -0
- package/dist/react/textToParticle/core/index.d.ts +18 -0
- package/dist/react/textToParticle/core/index.d.ts.map +1 -0
- package/dist/react/textToParticle/core/textToParticle/index.d.ts +103 -0
- package/dist/react/textToParticle/core/textToParticle/index.d.ts.map +1 -0
- package/dist/react/textToParticle/index.cjs +1 -0
- package/dist/react/textToParticle/index.d.ts +16 -0
- package/dist/react/textToParticle/index.d.ts.map +1 -0
- package/dist/react/textToParticle/index.mjs +1 -0
- package/dist/react/textToParticle/index.umd.d.ts +7 -0
- package/dist/react/textToParticle/index.umd.d.ts.map +1 -0
- package/dist/react/textToParticle/react/MasonEffect.d.ts +32 -0
- package/dist/react/textToParticle/react/MasonEffect.d.ts.map +1 -0
- package/dist/react/textToParticle/react/count/Count.d.ts +19 -0
- package/dist/react/textToParticle/react/count/Count.d.ts.map +1 -0
- package/dist/react/textToParticle/react/count/index.d.ts +5 -0
- package/dist/react/textToParticle/react/count/index.d.ts.map +1 -0
- package/dist/react/textToParticle/react/index.d.ts +12 -0
- package/dist/react/textToParticle/react/index.d.ts.map +1 -0
- package/dist/react/textToParticle/react/textToParticle/TextToParticle.d.ts +15 -0
- package/dist/react/textToParticle/react/textToParticle/TextToParticle.d.ts.map +1 -0
- package/dist/react/textToParticle/react/textToParticle/index.d.ts +4 -0
- package/dist/react/textToParticle/react/textToParticle/index.d.ts.map +1 -0
- package/dist/react/textToParticle/svelte/count/index.d.ts +2 -0
- package/dist/react/textToParticle/svelte/count/index.d.ts.map +1 -0
- package/dist/react/textToParticle/svelte/index.d.ts +8 -0
- package/dist/react/textToParticle/svelte/index.d.ts.map +1 -0
- package/dist/react/textToParticle/svelte/textToParticle/index.d.ts +2 -0
- package/dist/react/textToParticle/svelte/textToParticle/index.d.ts.map +1 -0
- package/dist/react/textToParticle/vue/count/index.d.ts +2 -0
- package/dist/react/textToParticle/vue/count/index.d.ts.map +1 -0
- package/dist/react/textToParticle/vue/index.d.ts +8 -0
- package/dist/react/textToParticle/vue/index.d.ts.map +1 -0
- package/dist/react/textToParticle/vue/textToParticle/index.d.ts +2 -0
- package/dist/react/textToParticle/vue/textToParticle/index.d.ts.map +1 -0
- package/dist/react/vue/count/index.d.ts +1 -0
- package/dist/react/vue/index.d.ts +5 -3
- package/dist/react/vue/textToParticle/index.d.ts +1 -0
- package/dist/svelte/count/index.cjs +1 -0
- package/dist/svelte/count/index.d.ts +163 -0
- package/dist/svelte/count/index.mjs +659 -0
- package/dist/svelte/index.cjs +1 -1
- package/dist/svelte/index.d.ts +88 -29
- package/dist/svelte/index.mjs +404 -10
- package/dist/svelte/textToParticle/index.cjs +1 -0
- package/dist/svelte/textToParticle/index.d.ts +163 -0
- package/dist/svelte/textToParticle/index.mjs +924 -0
- package/dist/textToParticle/core/count/index.d.ts +52 -0
- package/dist/textToParticle/core/count/index.d.ts.map +1 -0
- package/dist/textToParticle/core/index.d.ts +18 -0
- package/dist/textToParticle/core/index.d.ts.map +1 -0
- package/dist/textToParticle/core/textToParticle/index.d.ts +103 -0
- package/dist/textToParticle/core/textToParticle/index.d.ts.map +1 -0
- package/dist/textToParticle/index.cjs +1 -0
- package/dist/textToParticle/index.d.ts +16 -0
- package/dist/textToParticle/index.d.ts.map +1 -0
- package/dist/textToParticle/index.mjs +1 -0
- package/dist/textToParticle/index.umd.d.ts +7 -0
- package/dist/textToParticle/index.umd.d.ts.map +1 -0
- package/dist/textToParticle/react/MasonEffect.d.ts +32 -0
- package/dist/textToParticle/react/MasonEffect.d.ts.map +1 -0
- package/dist/textToParticle/react/count/Count.d.ts +19 -0
- package/dist/textToParticle/react/count/Count.d.ts.map +1 -0
- package/dist/textToParticle/react/count/index.d.ts +5 -0
- package/dist/textToParticle/react/count/index.d.ts.map +1 -0
- package/dist/textToParticle/react/index.d.ts +12 -0
- package/dist/textToParticle/react/index.d.ts.map +1 -0
- package/dist/textToParticle/react/textToParticle/TextToParticle.d.ts +15 -0
- package/dist/textToParticle/react/textToParticle/TextToParticle.d.ts.map +1 -0
- package/dist/textToParticle/react/textToParticle/index.d.ts +4 -0
- package/dist/textToParticle/react/textToParticle/index.d.ts.map +1 -0
- package/dist/textToParticle/svelte/count/index.d.ts +2 -0
- package/dist/textToParticle/svelte/count/index.d.ts.map +1 -0
- package/dist/textToParticle/svelte/index.d.ts +8 -0
- package/dist/textToParticle/svelte/index.d.ts.map +1 -0
- package/dist/textToParticle/svelte/textToParticle/index.d.ts +2 -0
- package/dist/textToParticle/svelte/textToParticle/index.d.ts.map +1 -0
- package/dist/textToParticle/vue/count/index.d.ts +2 -0
- package/dist/textToParticle/vue/count/index.d.ts.map +1 -0
- package/dist/textToParticle/vue/index.d.ts +8 -0
- package/dist/textToParticle/vue/index.d.ts.map +1 -0
- package/dist/textToParticle/vue/textToParticle/index.d.ts +2 -0
- package/dist/textToParticle/vue/textToParticle/index.d.ts.map +1 -0
- package/dist/vue/count/index.cjs +1 -0
- package/dist/vue/count/index.d.ts +163 -0
- package/dist/vue/count/index.mjs +286 -0
- package/dist/vue/index.cjs +1 -1
- package/dist/vue/index.d.ts +88 -29
- package/dist/vue/index.mjs +293 -8
- package/dist/vue/textToParticle/index.cjs +1 -0
- package/dist/vue/textToParticle/index.d.ts +163 -0
- package/dist/vue/textToParticle/index.mjs +554 -0
- package/package.json +54 -5
|
@@ -0,0 +1,659 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
+
import { createEventDispatcher, onMount, onDestroy } from "svelte";
|
|
5
|
+
function noop() {
|
|
6
|
+
}
|
|
7
|
+
function run(fn) {
|
|
8
|
+
return fn();
|
|
9
|
+
}
|
|
10
|
+
function blank_object() {
|
|
11
|
+
return /* @__PURE__ */ Object.create(null);
|
|
12
|
+
}
|
|
13
|
+
function run_all(fns) {
|
|
14
|
+
fns.forEach(run);
|
|
15
|
+
}
|
|
16
|
+
function is_function(thing) {
|
|
17
|
+
return typeof thing === "function";
|
|
18
|
+
}
|
|
19
|
+
function safe_not_equal(a, b) {
|
|
20
|
+
return a != a ? b == b : a !== b || a && typeof a === "object" || typeof a === "function";
|
|
21
|
+
}
|
|
22
|
+
function is_empty(obj) {
|
|
23
|
+
return Object.keys(obj).length === 0;
|
|
24
|
+
}
|
|
25
|
+
function insert(target, node, anchor) {
|
|
26
|
+
target.insertBefore(node, anchor || null);
|
|
27
|
+
}
|
|
28
|
+
function detach(node) {
|
|
29
|
+
if (node.parentNode) {
|
|
30
|
+
node.parentNode.removeChild(node);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function element(name) {
|
|
34
|
+
return document.createElement(name);
|
|
35
|
+
}
|
|
36
|
+
function attr(node, attribute, value) {
|
|
37
|
+
if (value == null) node.removeAttribute(attribute);
|
|
38
|
+
else if (node.getAttribute(attribute) !== value) node.setAttribute(attribute, value);
|
|
39
|
+
}
|
|
40
|
+
function children(element2) {
|
|
41
|
+
return Array.from(element2.childNodes);
|
|
42
|
+
}
|
|
43
|
+
let current_component;
|
|
44
|
+
function set_current_component(component) {
|
|
45
|
+
current_component = component;
|
|
46
|
+
}
|
|
47
|
+
const dirty_components = [];
|
|
48
|
+
const binding_callbacks = [];
|
|
49
|
+
let render_callbacks = [];
|
|
50
|
+
const flush_callbacks = [];
|
|
51
|
+
const resolved_promise = /* @__PURE__ */ Promise.resolve();
|
|
52
|
+
let update_scheduled = false;
|
|
53
|
+
function schedule_update() {
|
|
54
|
+
if (!update_scheduled) {
|
|
55
|
+
update_scheduled = true;
|
|
56
|
+
resolved_promise.then(flush);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
function add_render_callback(fn) {
|
|
60
|
+
render_callbacks.push(fn);
|
|
61
|
+
}
|
|
62
|
+
const seen_callbacks = /* @__PURE__ */ new Set();
|
|
63
|
+
let flushidx = 0;
|
|
64
|
+
function flush() {
|
|
65
|
+
if (flushidx !== 0) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const saved_component = current_component;
|
|
69
|
+
do {
|
|
70
|
+
try {
|
|
71
|
+
while (flushidx < dirty_components.length) {
|
|
72
|
+
const component = dirty_components[flushidx];
|
|
73
|
+
flushidx++;
|
|
74
|
+
set_current_component(component);
|
|
75
|
+
update(component.$$);
|
|
76
|
+
}
|
|
77
|
+
} catch (e) {
|
|
78
|
+
dirty_components.length = 0;
|
|
79
|
+
flushidx = 0;
|
|
80
|
+
throw e;
|
|
81
|
+
}
|
|
82
|
+
set_current_component(null);
|
|
83
|
+
dirty_components.length = 0;
|
|
84
|
+
flushidx = 0;
|
|
85
|
+
while (binding_callbacks.length) binding_callbacks.pop()();
|
|
86
|
+
for (let i = 0; i < render_callbacks.length; i += 1) {
|
|
87
|
+
const callback = render_callbacks[i];
|
|
88
|
+
if (!seen_callbacks.has(callback)) {
|
|
89
|
+
seen_callbacks.add(callback);
|
|
90
|
+
callback();
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
render_callbacks.length = 0;
|
|
94
|
+
} while (dirty_components.length);
|
|
95
|
+
while (flush_callbacks.length) {
|
|
96
|
+
flush_callbacks.pop()();
|
|
97
|
+
}
|
|
98
|
+
update_scheduled = false;
|
|
99
|
+
seen_callbacks.clear();
|
|
100
|
+
set_current_component(saved_component);
|
|
101
|
+
}
|
|
102
|
+
function update($$) {
|
|
103
|
+
if ($$.fragment !== null) {
|
|
104
|
+
$$.update();
|
|
105
|
+
run_all($$.before_update);
|
|
106
|
+
const dirty = $$.dirty;
|
|
107
|
+
$$.dirty = [-1];
|
|
108
|
+
$$.fragment && $$.fragment.p($$.ctx, dirty);
|
|
109
|
+
$$.after_update.forEach(add_render_callback);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
function flush_render_callbacks(fns) {
|
|
113
|
+
const filtered = [];
|
|
114
|
+
const targets = [];
|
|
115
|
+
render_callbacks.forEach((c) => fns.indexOf(c) === -1 ? filtered.push(c) : targets.push(c));
|
|
116
|
+
targets.forEach((c) => c());
|
|
117
|
+
render_callbacks = filtered;
|
|
118
|
+
}
|
|
119
|
+
const outroing = /* @__PURE__ */ new Set();
|
|
120
|
+
function transition_in(block, local) {
|
|
121
|
+
if (block && block.i) {
|
|
122
|
+
outroing.delete(block);
|
|
123
|
+
block.i(local);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
function mount_component(component, target, anchor) {
|
|
127
|
+
const { fragment, after_update } = component.$$;
|
|
128
|
+
fragment && fragment.m(target, anchor);
|
|
129
|
+
add_render_callback(() => {
|
|
130
|
+
const new_on_destroy = component.$$.on_mount.map(run).filter(is_function);
|
|
131
|
+
if (component.$$.on_destroy) {
|
|
132
|
+
component.$$.on_destroy.push(...new_on_destroy);
|
|
133
|
+
} else {
|
|
134
|
+
run_all(new_on_destroy);
|
|
135
|
+
}
|
|
136
|
+
component.$$.on_mount = [];
|
|
137
|
+
});
|
|
138
|
+
after_update.forEach(add_render_callback);
|
|
139
|
+
}
|
|
140
|
+
function destroy_component(component, detaching) {
|
|
141
|
+
const $$ = component.$$;
|
|
142
|
+
if ($$.fragment !== null) {
|
|
143
|
+
flush_render_callbacks($$.after_update);
|
|
144
|
+
run_all($$.on_destroy);
|
|
145
|
+
$$.fragment && $$.fragment.d(detaching);
|
|
146
|
+
$$.on_destroy = $$.fragment = null;
|
|
147
|
+
$$.ctx = [];
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
function make_dirty(component, i) {
|
|
151
|
+
if (component.$$.dirty[0] === -1) {
|
|
152
|
+
dirty_components.push(component);
|
|
153
|
+
schedule_update();
|
|
154
|
+
component.$$.dirty.fill(0);
|
|
155
|
+
}
|
|
156
|
+
component.$$.dirty[i / 31 | 0] |= 1 << i % 31;
|
|
157
|
+
}
|
|
158
|
+
function init(component, options, instance, create_fragment2, not_equal, props, append_styles = null, dirty = [-1]) {
|
|
159
|
+
const parent_component = current_component;
|
|
160
|
+
set_current_component(component);
|
|
161
|
+
const $$ = component.$$ = {
|
|
162
|
+
fragment: null,
|
|
163
|
+
ctx: [],
|
|
164
|
+
// state
|
|
165
|
+
props,
|
|
166
|
+
update: noop,
|
|
167
|
+
not_equal,
|
|
168
|
+
bound: blank_object(),
|
|
169
|
+
// lifecycle
|
|
170
|
+
on_mount: [],
|
|
171
|
+
on_destroy: [],
|
|
172
|
+
on_disconnect: [],
|
|
173
|
+
before_update: [],
|
|
174
|
+
after_update: [],
|
|
175
|
+
context: new Map(options.context || (parent_component ? parent_component.$$.context : [])),
|
|
176
|
+
// everything else
|
|
177
|
+
callbacks: blank_object(),
|
|
178
|
+
dirty,
|
|
179
|
+
skip_bound: false,
|
|
180
|
+
root: options.target || parent_component.$$.root
|
|
181
|
+
};
|
|
182
|
+
append_styles && append_styles($$.root);
|
|
183
|
+
let ready = false;
|
|
184
|
+
$$.ctx = instance ? instance(component, options.props || {}, (i, ret, ...rest) => {
|
|
185
|
+
const value = rest.length ? rest[0] : ret;
|
|
186
|
+
if ($$.ctx && not_equal($$.ctx[i], $$.ctx[i] = value)) {
|
|
187
|
+
if (!$$.skip_bound && $$.bound[i]) $$.bound[i](value);
|
|
188
|
+
if (ready) make_dirty(component, i);
|
|
189
|
+
}
|
|
190
|
+
return ret;
|
|
191
|
+
}) : [];
|
|
192
|
+
$$.update();
|
|
193
|
+
ready = true;
|
|
194
|
+
run_all($$.before_update);
|
|
195
|
+
$$.fragment = create_fragment2 ? create_fragment2($$.ctx) : false;
|
|
196
|
+
if (options.target) {
|
|
197
|
+
if (options.hydrate) {
|
|
198
|
+
const nodes = children(options.target);
|
|
199
|
+
$$.fragment && $$.fragment.l(nodes);
|
|
200
|
+
nodes.forEach(detach);
|
|
201
|
+
} else {
|
|
202
|
+
$$.fragment && $$.fragment.c();
|
|
203
|
+
}
|
|
204
|
+
if (options.intro) transition_in(component.$$.fragment);
|
|
205
|
+
mount_component(component, options.target, options.anchor);
|
|
206
|
+
flush();
|
|
207
|
+
}
|
|
208
|
+
set_current_component(parent_component);
|
|
209
|
+
}
|
|
210
|
+
class SvelteComponent {
|
|
211
|
+
constructor() {
|
|
212
|
+
/**
|
|
213
|
+
* ### PRIVATE API
|
|
214
|
+
*
|
|
215
|
+
* Do not use, may change at any time
|
|
216
|
+
*
|
|
217
|
+
* @type {any}
|
|
218
|
+
*/
|
|
219
|
+
__publicField(this, "$$");
|
|
220
|
+
/**
|
|
221
|
+
* ### PRIVATE API
|
|
222
|
+
*
|
|
223
|
+
* Do not use, may change at any time
|
|
224
|
+
*
|
|
225
|
+
* @type {any}
|
|
226
|
+
*/
|
|
227
|
+
__publicField(this, "$$set");
|
|
228
|
+
}
|
|
229
|
+
/** @returns {void} */
|
|
230
|
+
$destroy() {
|
|
231
|
+
destroy_component(this, 1);
|
|
232
|
+
this.$destroy = noop;
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* @template {Extract<keyof Events, string>} K
|
|
236
|
+
* @param {K} type
|
|
237
|
+
* @param {((e: Events[K]) => void) | null | undefined} callback
|
|
238
|
+
* @returns {() => void}
|
|
239
|
+
*/
|
|
240
|
+
$on(type, callback) {
|
|
241
|
+
if (!is_function(callback)) {
|
|
242
|
+
return noop;
|
|
243
|
+
}
|
|
244
|
+
const callbacks = this.$$.callbacks[type] || (this.$$.callbacks[type] = []);
|
|
245
|
+
callbacks.push(callback);
|
|
246
|
+
return () => {
|
|
247
|
+
const index = callbacks.indexOf(callback);
|
|
248
|
+
if (index !== -1) callbacks.splice(index, 1);
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* @param {Partial<Props>} props
|
|
253
|
+
* @returns {void}
|
|
254
|
+
*/
|
|
255
|
+
$set(props) {
|
|
256
|
+
if (this.$$set && !is_empty(props)) {
|
|
257
|
+
this.$$.skip_bound = true;
|
|
258
|
+
this.$$set(props);
|
|
259
|
+
this.$$.skip_bound = false;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
const PUBLIC_VERSION = "4";
|
|
264
|
+
if (typeof window !== "undefined")
|
|
265
|
+
(window.__svelte || (window.__svelte = { v: /* @__PURE__ */ new Set() })).v.add(PUBLIC_VERSION);
|
|
266
|
+
const easingFunctions = {
|
|
267
|
+
linear: (t) => t
|
|
268
|
+
};
|
|
269
|
+
class Count {
|
|
270
|
+
constructor(container, options) {
|
|
271
|
+
this.container = typeof container === "string" ? document.querySelector(container) : container;
|
|
272
|
+
if (!this.container) {
|
|
273
|
+
throw new Error("Container element not found");
|
|
274
|
+
}
|
|
275
|
+
this.config = {
|
|
276
|
+
targetValue: options.targetValue,
|
|
277
|
+
duration: options.duration ?? 2e3,
|
|
278
|
+
startValue: options.startValue ?? 0,
|
|
279
|
+
enabled: options.enabled ?? true,
|
|
280
|
+
easing: options.easing ?? easingFunctions.linear,
|
|
281
|
+
threshold: options.threshold ?? 0.2,
|
|
282
|
+
rootMargin: options.rootMargin ?? "0px 0px -100px 0px",
|
|
283
|
+
triggerOnce: options.triggerOnce ?? false,
|
|
284
|
+
onUpdate: options.onUpdate || null,
|
|
285
|
+
onComplete: options.onComplete || null
|
|
286
|
+
};
|
|
287
|
+
this.currentValue = this.config.startValue;
|
|
288
|
+
this.startTime = null;
|
|
289
|
+
this.animationFrameId = null;
|
|
290
|
+
this.intersectionObserver = null;
|
|
291
|
+
this.isRunning = false;
|
|
292
|
+
this.hasTriggered = false;
|
|
293
|
+
this.init();
|
|
294
|
+
}
|
|
295
|
+
init() {
|
|
296
|
+
this.updateDisplay(this.config.startValue);
|
|
297
|
+
this.setupIntersectionObserver();
|
|
298
|
+
}
|
|
299
|
+
setupIntersectionObserver() {
|
|
300
|
+
if (typeof window === "undefined" || typeof window.IntersectionObserver === "undefined") {
|
|
301
|
+
if (this.config.enabled) {
|
|
302
|
+
this.start();
|
|
303
|
+
}
|
|
304
|
+
return;
|
|
305
|
+
}
|
|
306
|
+
this.intersectionObserver = new IntersectionObserver(
|
|
307
|
+
(entries) => {
|
|
308
|
+
var _a;
|
|
309
|
+
for (const entry of entries) {
|
|
310
|
+
if (entry.target !== this.container) continue;
|
|
311
|
+
if (entry.isIntersecting) {
|
|
312
|
+
if (!this.hasTriggered && this.config.enabled) {
|
|
313
|
+
this.hasTriggered = true;
|
|
314
|
+
this.start();
|
|
315
|
+
}
|
|
316
|
+
if (this.config.triggerOnce) {
|
|
317
|
+
(_a = this.intersectionObserver) == null ? void 0 : _a.unobserve(this.container);
|
|
318
|
+
}
|
|
319
|
+
} else {
|
|
320
|
+
if (!this.config.triggerOnce) {
|
|
321
|
+
const rect = entry.boundingClientRect;
|
|
322
|
+
const viewportHeight = window.innerHeight;
|
|
323
|
+
const viewportWidth = window.innerWidth;
|
|
324
|
+
const isCompletelyOutOfViewport = rect.bottom <= 0 || rect.top >= viewportHeight || rect.right <= 0 || rect.left >= viewportWidth;
|
|
325
|
+
if (isCompletelyOutOfViewport && this.isRunning) {
|
|
326
|
+
this.reset();
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
},
|
|
332
|
+
{
|
|
333
|
+
threshold: this.config.threshold,
|
|
334
|
+
rootMargin: this.config.rootMargin
|
|
335
|
+
}
|
|
336
|
+
);
|
|
337
|
+
this.intersectionObserver.observe(this.container);
|
|
338
|
+
}
|
|
339
|
+
start() {
|
|
340
|
+
if (this.isRunning) return;
|
|
341
|
+
if (!this.config.enabled) return;
|
|
342
|
+
this.isRunning = true;
|
|
343
|
+
this.startTime = null;
|
|
344
|
+
this.currentValue = this.config.startValue;
|
|
345
|
+
this.updateDisplay(this.currentValue);
|
|
346
|
+
const animate = (currentTime) => {
|
|
347
|
+
if (this.startTime === null) {
|
|
348
|
+
this.startTime = currentTime;
|
|
349
|
+
}
|
|
350
|
+
const elapsed = currentTime - this.startTime;
|
|
351
|
+
const progress = Math.min(elapsed / this.config.duration, 1);
|
|
352
|
+
const easedProgress = this.config.easing(progress);
|
|
353
|
+
this.currentValue = Math.floor(
|
|
354
|
+
this.config.startValue + (this.config.targetValue - this.config.startValue) * easedProgress
|
|
355
|
+
);
|
|
356
|
+
this.updateDisplay(this.currentValue);
|
|
357
|
+
if (this.config.onUpdate) {
|
|
358
|
+
this.config.onUpdate(this.currentValue);
|
|
359
|
+
}
|
|
360
|
+
if (progress < 1) {
|
|
361
|
+
this.animationFrameId = requestAnimationFrame(animate);
|
|
362
|
+
} else {
|
|
363
|
+
this.currentValue = this.config.targetValue;
|
|
364
|
+
this.updateDisplay(this.currentValue);
|
|
365
|
+
this.isRunning = false;
|
|
366
|
+
if (this.config.onComplete) {
|
|
367
|
+
this.config.onComplete();
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
};
|
|
371
|
+
this.animationFrameId = requestAnimationFrame(animate);
|
|
372
|
+
}
|
|
373
|
+
stop() {
|
|
374
|
+
this.isRunning = false;
|
|
375
|
+
if (this.animationFrameId !== null) {
|
|
376
|
+
cancelAnimationFrame(this.animationFrameId);
|
|
377
|
+
this.animationFrameId = null;
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
reset() {
|
|
381
|
+
this.stop();
|
|
382
|
+
this.currentValue = this.config.startValue;
|
|
383
|
+
this.updateDisplay(this.currentValue);
|
|
384
|
+
this.hasTriggered = false;
|
|
385
|
+
this.startTime = null;
|
|
386
|
+
}
|
|
387
|
+
updateDisplay(value) {
|
|
388
|
+
this.container.textContent = this.formatNumber(value);
|
|
389
|
+
}
|
|
390
|
+
formatNumber(value) {
|
|
391
|
+
return Math.floor(value).toLocaleString();
|
|
392
|
+
}
|
|
393
|
+
// 설정 업데이트
|
|
394
|
+
updateConfig(newConfig) {
|
|
395
|
+
const wasRunning = this.isRunning;
|
|
396
|
+
this.stop();
|
|
397
|
+
this.config = {
|
|
398
|
+
...this.config,
|
|
399
|
+
...newConfig,
|
|
400
|
+
onUpdate: newConfig.onUpdate !== void 0 ? newConfig.onUpdate : this.config.onUpdate,
|
|
401
|
+
onComplete: newConfig.onComplete !== void 0 ? newConfig.onComplete : this.config.onComplete
|
|
402
|
+
};
|
|
403
|
+
if (newConfig.targetValue !== void 0) {
|
|
404
|
+
this.reset();
|
|
405
|
+
if (wasRunning && this.config.enabled) {
|
|
406
|
+
this.start();
|
|
407
|
+
}
|
|
408
|
+
} else {
|
|
409
|
+
if (wasRunning && this.config.enabled) {
|
|
410
|
+
this.start();
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
// 현재 값 가져오기
|
|
415
|
+
getValue() {
|
|
416
|
+
return this.currentValue;
|
|
417
|
+
}
|
|
418
|
+
// 파괴 및 정리
|
|
419
|
+
destroy() {
|
|
420
|
+
this.stop();
|
|
421
|
+
if (this.intersectionObserver) {
|
|
422
|
+
this.intersectionObserver.disconnect();
|
|
423
|
+
this.intersectionObserver = null;
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
function create_fragment(ctx) {
|
|
428
|
+
let div;
|
|
429
|
+
return {
|
|
430
|
+
c() {
|
|
431
|
+
div = element("div");
|
|
432
|
+
attr(
|
|
433
|
+
div,
|
|
434
|
+
"class",
|
|
435
|
+
/*className*/
|
|
436
|
+
ctx[0]
|
|
437
|
+
);
|
|
438
|
+
attr(
|
|
439
|
+
div,
|
|
440
|
+
"style",
|
|
441
|
+
/*style*/
|
|
442
|
+
ctx[1]
|
|
443
|
+
);
|
|
444
|
+
},
|
|
445
|
+
m(target, anchor) {
|
|
446
|
+
insert(target, div, anchor);
|
|
447
|
+
ctx[18](div);
|
|
448
|
+
},
|
|
449
|
+
p(ctx2, [dirty]) {
|
|
450
|
+
if (dirty & /*className*/
|
|
451
|
+
1) {
|
|
452
|
+
attr(
|
|
453
|
+
div,
|
|
454
|
+
"class",
|
|
455
|
+
/*className*/
|
|
456
|
+
ctx2[0]
|
|
457
|
+
);
|
|
458
|
+
}
|
|
459
|
+
if (dirty & /*style*/
|
|
460
|
+
2) {
|
|
461
|
+
attr(
|
|
462
|
+
div,
|
|
463
|
+
"style",
|
|
464
|
+
/*style*/
|
|
465
|
+
ctx2[1]
|
|
466
|
+
);
|
|
467
|
+
}
|
|
468
|
+
},
|
|
469
|
+
i: noop,
|
|
470
|
+
o: noop,
|
|
471
|
+
d(detaching) {
|
|
472
|
+
if (detaching) {
|
|
473
|
+
detach(div);
|
|
474
|
+
}
|
|
475
|
+
ctx[18](null);
|
|
476
|
+
}
|
|
477
|
+
};
|
|
478
|
+
}
|
|
479
|
+
function instance_1($$self, $$props, $$invalidate) {
|
|
480
|
+
let { targetValue = 0 } = $$props;
|
|
481
|
+
let { duration = 2e3 } = $$props;
|
|
482
|
+
let { startValue = 0 } = $$props;
|
|
483
|
+
let { enabled = true } = $$props;
|
|
484
|
+
let { easing = (t) => t } = $$props;
|
|
485
|
+
let { threshold = 0.2 } = $$props;
|
|
486
|
+
let { rootMargin = "0px 0px -100px 0px" } = $$props;
|
|
487
|
+
let { triggerOnce = false } = $$props;
|
|
488
|
+
let { className = "" } = $$props;
|
|
489
|
+
let { style = {} } = $$props;
|
|
490
|
+
const dispatch = createEventDispatcher();
|
|
491
|
+
let container;
|
|
492
|
+
let instance = null;
|
|
493
|
+
onMount(() => {
|
|
494
|
+
if (!container) return;
|
|
495
|
+
const options = {
|
|
496
|
+
targetValue,
|
|
497
|
+
duration,
|
|
498
|
+
startValue,
|
|
499
|
+
enabled,
|
|
500
|
+
easing,
|
|
501
|
+
threshold,
|
|
502
|
+
rootMargin,
|
|
503
|
+
triggerOnce,
|
|
504
|
+
onUpdate: (value) => {
|
|
505
|
+
dispatch("update", value);
|
|
506
|
+
},
|
|
507
|
+
onComplete: () => {
|
|
508
|
+
dispatch("complete");
|
|
509
|
+
}
|
|
510
|
+
};
|
|
511
|
+
$$invalidate(17, instance = new Count(container, options));
|
|
512
|
+
});
|
|
513
|
+
onDestroy(() => {
|
|
514
|
+
if (instance) {
|
|
515
|
+
instance.destroy();
|
|
516
|
+
$$invalidate(17, instance = null);
|
|
517
|
+
}
|
|
518
|
+
});
|
|
519
|
+
function start() {
|
|
520
|
+
if (instance) {
|
|
521
|
+
instance.start();
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
function stop() {
|
|
525
|
+
if (instance) {
|
|
526
|
+
instance.stop();
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
function reset() {
|
|
530
|
+
if (instance) {
|
|
531
|
+
instance.reset();
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
function getValue() {
|
|
535
|
+
if (instance) {
|
|
536
|
+
return instance.getValue();
|
|
537
|
+
}
|
|
538
|
+
return 0;
|
|
539
|
+
}
|
|
540
|
+
function updateConfig(config) {
|
|
541
|
+
if (instance) {
|
|
542
|
+
instance.updateConfig(config);
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
function destroy() {
|
|
546
|
+
if (instance) {
|
|
547
|
+
instance.destroy();
|
|
548
|
+
$$invalidate(17, instance = null);
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
function div_binding($$value) {
|
|
552
|
+
binding_callbacks[$$value ? "unshift" : "push"](() => {
|
|
553
|
+
container = $$value;
|
|
554
|
+
$$invalidate(2, container);
|
|
555
|
+
});
|
|
556
|
+
}
|
|
557
|
+
$$self.$$set = ($$props2) => {
|
|
558
|
+
if ("targetValue" in $$props2) $$invalidate(3, targetValue = $$props2.targetValue);
|
|
559
|
+
if ("duration" in $$props2) $$invalidate(4, duration = $$props2.duration);
|
|
560
|
+
if ("startValue" in $$props2) $$invalidate(5, startValue = $$props2.startValue);
|
|
561
|
+
if ("enabled" in $$props2) $$invalidate(6, enabled = $$props2.enabled);
|
|
562
|
+
if ("easing" in $$props2) $$invalidate(7, easing = $$props2.easing);
|
|
563
|
+
if ("threshold" in $$props2) $$invalidate(8, threshold = $$props2.threshold);
|
|
564
|
+
if ("rootMargin" in $$props2) $$invalidate(9, rootMargin = $$props2.rootMargin);
|
|
565
|
+
if ("triggerOnce" in $$props2) $$invalidate(10, triggerOnce = $$props2.triggerOnce);
|
|
566
|
+
if ("className" in $$props2) $$invalidate(0, className = $$props2.className);
|
|
567
|
+
if ("style" in $$props2) $$invalidate(1, style = $$props2.style);
|
|
568
|
+
};
|
|
569
|
+
$$self.$$.update = () => {
|
|
570
|
+
if ($$self.$$.dirty & /*instance, targetValue, duration, startValue, enabled, easing, threshold, rootMargin, triggerOnce*/
|
|
571
|
+
133112) {
|
|
572
|
+
{
|
|
573
|
+
if (instance) {
|
|
574
|
+
instance.updateConfig({
|
|
575
|
+
targetValue,
|
|
576
|
+
duration,
|
|
577
|
+
startValue,
|
|
578
|
+
enabled,
|
|
579
|
+
easing,
|
|
580
|
+
threshold,
|
|
581
|
+
rootMargin,
|
|
582
|
+
triggerOnce,
|
|
583
|
+
onUpdate: (value) => {
|
|
584
|
+
dispatch("update", value);
|
|
585
|
+
},
|
|
586
|
+
onComplete: () => {
|
|
587
|
+
dispatch("complete");
|
|
588
|
+
}
|
|
589
|
+
});
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
};
|
|
594
|
+
return [
|
|
595
|
+
className,
|
|
596
|
+
style,
|
|
597
|
+
container,
|
|
598
|
+
targetValue,
|
|
599
|
+
duration,
|
|
600
|
+
startValue,
|
|
601
|
+
enabled,
|
|
602
|
+
easing,
|
|
603
|
+
threshold,
|
|
604
|
+
rootMargin,
|
|
605
|
+
triggerOnce,
|
|
606
|
+
start,
|
|
607
|
+
stop,
|
|
608
|
+
reset,
|
|
609
|
+
getValue,
|
|
610
|
+
updateConfig,
|
|
611
|
+
destroy,
|
|
612
|
+
instance,
|
|
613
|
+
div_binding
|
|
614
|
+
];
|
|
615
|
+
}
|
|
616
|
+
class Count_1 extends SvelteComponent {
|
|
617
|
+
constructor(options) {
|
|
618
|
+
super();
|
|
619
|
+
init(this, options, instance_1, create_fragment, safe_not_equal, {
|
|
620
|
+
targetValue: 3,
|
|
621
|
+
duration: 4,
|
|
622
|
+
startValue: 5,
|
|
623
|
+
enabled: 6,
|
|
624
|
+
easing: 7,
|
|
625
|
+
threshold: 8,
|
|
626
|
+
rootMargin: 9,
|
|
627
|
+
triggerOnce: 10,
|
|
628
|
+
className: 0,
|
|
629
|
+
style: 1,
|
|
630
|
+
start: 11,
|
|
631
|
+
stop: 12,
|
|
632
|
+
reset: 13,
|
|
633
|
+
getValue: 14,
|
|
634
|
+
updateConfig: 15,
|
|
635
|
+
destroy: 16
|
|
636
|
+
});
|
|
637
|
+
}
|
|
638
|
+
get start() {
|
|
639
|
+
return this.$$.ctx[11];
|
|
640
|
+
}
|
|
641
|
+
get stop() {
|
|
642
|
+
return this.$$.ctx[12];
|
|
643
|
+
}
|
|
644
|
+
get reset() {
|
|
645
|
+
return this.$$.ctx[13];
|
|
646
|
+
}
|
|
647
|
+
get getValue() {
|
|
648
|
+
return this.$$.ctx[14];
|
|
649
|
+
}
|
|
650
|
+
get updateConfig() {
|
|
651
|
+
return this.$$.ctx[15];
|
|
652
|
+
}
|
|
653
|
+
get destroy() {
|
|
654
|
+
return this.$$.ctx[16];
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
export {
|
|
658
|
+
Count_1 as default
|
|
659
|
+
};
|