masoneffect 2.0.2 → 2.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.
Files changed (212) hide show
  1. package/README.md +4 -4
  2. package/dist/core/index.d.ts +2 -0
  3. package/dist/core/index.d.ts.map +1 -1
  4. package/dist/core/typing/index.d.ts +53 -0
  5. package/dist/core/typing/index.d.ts.map +1 -0
  6. package/dist/count/core/index.d.ts +2 -0
  7. package/dist/count/core/index.d.ts.map +1 -1
  8. package/dist/count/core/typing/index.d.ts +53 -0
  9. package/dist/count/core/typing/index.d.ts.map +1 -0
  10. package/dist/count/index.d.ts +2 -0
  11. package/dist/count/index.d.ts.map +1 -1
  12. package/dist/count/react/index.d.ts +2 -0
  13. package/dist/count/react/index.d.ts.map +1 -1
  14. package/dist/count/react/typing/Typing.d.ts +18 -0
  15. package/dist/count/react/typing/Typing.d.ts.map +1 -0
  16. package/dist/count/react/typing/index.d.ts +4 -0
  17. package/dist/count/react/typing/index.d.ts.map +1 -0
  18. package/dist/count/svelte/index.d.ts +1 -0
  19. package/dist/count/svelte/index.d.ts.map +1 -1
  20. package/dist/count/svelte/typing/index.d.ts +3 -0
  21. package/dist/count/svelte/typing/index.d.ts.map +1 -0
  22. package/dist/count/vue/index.d.ts +1 -0
  23. package/dist/count/vue/index.d.ts.map +1 -1
  24. package/dist/count/vue/typing/index.d.ts +4 -0
  25. package/dist/count/vue/typing/index.d.ts.map +1 -0
  26. package/dist/index.cjs +1 -1
  27. package/dist/index.d.ts +2 -0
  28. package/dist/index.d.ts.map +1 -1
  29. package/dist/index.mjs +1 -1
  30. package/dist/react/core/index.d.ts +2 -0
  31. package/dist/react/core/typing/index.d.ts +52 -0
  32. package/dist/react/count/core/index.d.ts +2 -0
  33. package/dist/react/count/core/index.d.ts.map +1 -1
  34. package/dist/react/count/core/typing/index.d.ts +53 -0
  35. package/dist/react/count/core/typing/index.d.ts.map +1 -0
  36. package/dist/react/count/index.d.ts +2 -0
  37. package/dist/react/count/index.d.ts.map +1 -1
  38. package/dist/react/count/react/index.d.ts +2 -0
  39. package/dist/react/count/react/index.d.ts.map +1 -1
  40. package/dist/react/count/react/typing/Typing.d.ts +18 -0
  41. package/dist/react/count/react/typing/Typing.d.ts.map +1 -0
  42. package/dist/react/count/react/typing/index.d.ts +4 -0
  43. package/dist/react/count/react/typing/index.d.ts.map +1 -0
  44. package/dist/react/count/svelte/index.d.ts +1 -0
  45. package/dist/react/count/svelte/index.d.ts.map +1 -1
  46. package/dist/react/count/svelte/typing/index.d.ts +3 -0
  47. package/dist/react/count/svelte/typing/index.d.ts.map +1 -0
  48. package/dist/react/count/vue/index.d.ts +1 -0
  49. package/dist/react/count/vue/index.d.ts.map +1 -1
  50. package/dist/react/count/vue/typing/index.d.ts +4 -0
  51. package/dist/react/count/vue/typing/index.d.ts.map +1 -0
  52. package/dist/react/index.cjs +2 -0
  53. package/dist/react/index.d.ts.map +1 -1
  54. package/dist/react/index.mjs +1 -0
  55. package/dist/react/react/index.d.ts +2 -0
  56. package/dist/react/react/typing/Typing.d.ts +17 -0
  57. package/dist/react/react/typing/index.d.ts +3 -0
  58. package/dist/react/svelte/index.d.ts +1 -0
  59. package/dist/react/svelte/typing/index.d.ts +2 -0
  60. package/dist/react/textToParticle/core/index.d.ts +2 -0
  61. package/dist/react/textToParticle/core/index.d.ts.map +1 -1
  62. package/dist/react/textToParticle/core/typing/index.d.ts +53 -0
  63. package/dist/react/textToParticle/core/typing/index.d.ts.map +1 -0
  64. package/dist/react/textToParticle/index.d.ts +2 -0
  65. package/dist/react/textToParticle/index.d.ts.map +1 -1
  66. package/dist/react/textToParticle/react/index.d.ts +2 -0
  67. package/dist/react/textToParticle/react/index.d.ts.map +1 -1
  68. package/dist/react/textToParticle/react/typing/Typing.d.ts +18 -0
  69. package/dist/react/textToParticle/react/typing/Typing.d.ts.map +1 -0
  70. package/dist/react/textToParticle/react/typing/index.d.ts +4 -0
  71. package/dist/react/textToParticle/react/typing/index.d.ts.map +1 -0
  72. package/dist/react/textToParticle/svelte/index.d.ts +1 -0
  73. package/dist/react/textToParticle/svelte/index.d.ts.map +1 -1
  74. package/dist/react/textToParticle/svelte/typing/index.d.ts +3 -0
  75. package/dist/react/textToParticle/svelte/typing/index.d.ts.map +1 -0
  76. package/dist/react/textToParticle/vue/index.d.ts +1 -0
  77. package/dist/react/textToParticle/vue/index.d.ts.map +1 -1
  78. package/dist/react/textToParticle/vue/typing/index.d.ts +4 -0
  79. package/dist/react/textToParticle/vue/typing/index.d.ts.map +1 -0
  80. package/dist/react/typing/Typing.d.ts +18 -0
  81. package/dist/react/typing/Typing.d.ts.map +1 -0
  82. package/dist/react/typing/core/count/index.d.ts +52 -0
  83. package/dist/react/typing/core/count/index.d.ts.map +1 -0
  84. package/dist/react/typing/core/index.d.ts +20 -0
  85. package/dist/react/typing/core/index.d.ts.map +1 -0
  86. package/dist/react/typing/core/textToParticle/index.d.ts +103 -0
  87. package/dist/react/typing/core/textToParticle/index.d.ts.map +1 -0
  88. package/dist/react/typing/core/typing/index.d.ts +53 -0
  89. package/dist/react/typing/core/typing/index.d.ts.map +1 -0
  90. package/dist/react/typing/index.cjs +1 -0
  91. package/dist/react/typing/index.d.ts +18 -0
  92. package/dist/react/typing/index.d.ts.map +1 -0
  93. package/dist/react/typing/index.mjs +1 -0
  94. package/dist/react/typing/index.umd.d.ts +7 -0
  95. package/dist/react/typing/index.umd.d.ts.map +1 -0
  96. package/dist/react/typing/react/MasonEffect.d.ts +32 -0
  97. package/dist/react/typing/react/MasonEffect.d.ts.map +1 -0
  98. package/dist/react/typing/react/count/Count.d.ts +19 -0
  99. package/dist/react/typing/react/count/Count.d.ts.map +1 -0
  100. package/dist/react/typing/react/count/index.d.ts +5 -0
  101. package/dist/react/typing/react/count/index.d.ts.map +1 -0
  102. package/dist/react/typing/react/index.d.ts +14 -0
  103. package/dist/react/typing/react/index.d.ts.map +1 -0
  104. package/dist/react/typing/react/textToParticle/TextToParticle.d.ts +15 -0
  105. package/dist/react/typing/react/textToParticle/TextToParticle.d.ts.map +1 -0
  106. package/dist/react/typing/react/textToParticle/index.d.ts +4 -0
  107. package/dist/react/typing/react/textToParticle/index.d.ts.map +1 -0
  108. package/dist/react/typing/react/typing/Typing.d.ts +18 -0
  109. package/dist/react/typing/react/typing/Typing.d.ts.map +1 -0
  110. package/dist/react/typing/react/typing/index.d.ts +4 -0
  111. package/dist/react/typing/react/typing/index.d.ts.map +1 -0
  112. package/dist/react/typing/svelte/count/index.d.ts +2 -0
  113. package/dist/react/typing/svelte/count/index.d.ts.map +1 -0
  114. package/dist/react/typing/svelte/index.d.ts +9 -0
  115. package/dist/react/typing/svelte/index.d.ts.map +1 -0
  116. package/dist/react/typing/svelte/textToParticle/index.d.ts +2 -0
  117. package/dist/react/typing/svelte/textToParticle/index.d.ts.map +1 -0
  118. package/dist/react/typing/svelte/typing/index.d.ts +3 -0
  119. package/dist/react/typing/svelte/typing/index.d.ts.map +1 -0
  120. package/dist/react/typing/vue/count/index.d.ts +2 -0
  121. package/dist/react/typing/vue/count/index.d.ts.map +1 -0
  122. package/dist/react/typing/vue/index.d.ts +9 -0
  123. package/dist/react/typing/vue/index.d.ts.map +1 -0
  124. package/dist/react/typing/vue/textToParticle/index.d.ts +2 -0
  125. package/dist/react/typing/vue/textToParticle/index.d.ts.map +1 -0
  126. package/dist/react/typing/vue/typing/index.d.ts +4 -0
  127. package/dist/react/typing/vue/typing/index.d.ts.map +1 -0
  128. package/dist/react/vue/index.d.ts +1 -0
  129. package/dist/react/vue/typing/index.d.ts +3 -0
  130. package/dist/svelte/count/index.d.ts +53 -0
  131. package/dist/svelte/index.cjs +1 -1
  132. package/dist/svelte/index.d.ts +53 -0
  133. package/dist/svelte/index.mjs +419 -48
  134. package/dist/svelte/textToParticle/index.d.ts +53 -0
  135. package/dist/svelte/typing/index.cjs +1 -0
  136. package/dist/svelte/typing/index.d.ts +216 -0
  137. package/dist/svelte/typing/index.mjs +638 -0
  138. package/dist/textToParticle/core/index.d.ts +2 -0
  139. package/dist/textToParticle/core/index.d.ts.map +1 -1
  140. package/dist/textToParticle/core/typing/index.d.ts +53 -0
  141. package/dist/textToParticle/core/typing/index.d.ts.map +1 -0
  142. package/dist/textToParticle/index.d.ts +2 -0
  143. package/dist/textToParticle/index.d.ts.map +1 -1
  144. package/dist/textToParticle/react/index.d.ts +2 -0
  145. package/dist/textToParticle/react/index.d.ts.map +1 -1
  146. package/dist/textToParticle/react/typing/Typing.d.ts +18 -0
  147. package/dist/textToParticle/react/typing/Typing.d.ts.map +1 -0
  148. package/dist/textToParticle/react/typing/index.d.ts +4 -0
  149. package/dist/textToParticle/react/typing/index.d.ts.map +1 -0
  150. package/dist/textToParticle/svelte/index.d.ts +1 -0
  151. package/dist/textToParticle/svelte/index.d.ts.map +1 -1
  152. package/dist/textToParticle/svelte/typing/index.d.ts +3 -0
  153. package/dist/textToParticle/svelte/typing/index.d.ts.map +1 -0
  154. package/dist/textToParticle/vue/index.d.ts +1 -0
  155. package/dist/textToParticle/vue/index.d.ts.map +1 -1
  156. package/dist/textToParticle/vue/typing/index.d.ts +4 -0
  157. package/dist/textToParticle/vue/typing/index.d.ts.map +1 -0
  158. package/dist/typing/core/count/index.d.ts +52 -0
  159. package/dist/typing/core/count/index.d.ts.map +1 -0
  160. package/dist/typing/core/index.d.ts +20 -0
  161. package/dist/typing/core/index.d.ts.map +1 -0
  162. package/dist/typing/core/textToParticle/index.d.ts +103 -0
  163. package/dist/typing/core/textToParticle/index.d.ts.map +1 -0
  164. package/dist/typing/core/typing/index.d.ts +53 -0
  165. package/dist/typing/core/typing/index.d.ts.map +1 -0
  166. package/dist/typing/index.cjs +1 -0
  167. package/dist/typing/index.d.ts +18 -0
  168. package/dist/typing/index.d.ts.map +1 -0
  169. package/dist/typing/index.mjs +1 -0
  170. package/dist/typing/index.umd.d.ts +7 -0
  171. package/dist/typing/index.umd.d.ts.map +1 -0
  172. package/dist/typing/react/MasonEffect.d.ts +32 -0
  173. package/dist/typing/react/MasonEffect.d.ts.map +1 -0
  174. package/dist/typing/react/count/Count.d.ts +19 -0
  175. package/dist/typing/react/count/Count.d.ts.map +1 -0
  176. package/dist/typing/react/count/index.d.ts +5 -0
  177. package/dist/typing/react/count/index.d.ts.map +1 -0
  178. package/dist/typing/react/index.d.ts +14 -0
  179. package/dist/typing/react/index.d.ts.map +1 -0
  180. package/dist/typing/react/textToParticle/TextToParticle.d.ts +15 -0
  181. package/dist/typing/react/textToParticle/TextToParticle.d.ts.map +1 -0
  182. package/dist/typing/react/textToParticle/index.d.ts +4 -0
  183. package/dist/typing/react/textToParticle/index.d.ts.map +1 -0
  184. package/dist/typing/react/typing/Typing.d.ts +18 -0
  185. package/dist/typing/react/typing/Typing.d.ts.map +1 -0
  186. package/dist/typing/react/typing/index.d.ts +4 -0
  187. package/dist/typing/react/typing/index.d.ts.map +1 -0
  188. package/dist/typing/svelte/count/index.d.ts +2 -0
  189. package/dist/typing/svelte/count/index.d.ts.map +1 -0
  190. package/dist/typing/svelte/index.d.ts +9 -0
  191. package/dist/typing/svelte/index.d.ts.map +1 -0
  192. package/dist/typing/svelte/textToParticle/index.d.ts +2 -0
  193. package/dist/typing/svelte/textToParticle/index.d.ts.map +1 -0
  194. package/dist/typing/svelte/typing/index.d.ts +3 -0
  195. package/dist/typing/svelte/typing/index.d.ts.map +1 -0
  196. package/dist/typing/vue/count/index.d.ts +2 -0
  197. package/dist/typing/vue/count/index.d.ts.map +1 -0
  198. package/dist/typing/vue/index.d.ts +9 -0
  199. package/dist/typing/vue/index.d.ts.map +1 -0
  200. package/dist/typing/vue/textToParticle/index.d.ts +2 -0
  201. package/dist/typing/vue/textToParticle/index.d.ts.map +1 -0
  202. package/dist/typing/vue/typing/index.d.ts +4 -0
  203. package/dist/typing/vue/typing/index.d.ts.map +1 -0
  204. package/dist/vue/count/index.d.ts +53 -0
  205. package/dist/vue/index.cjs +1 -1
  206. package/dist/vue/index.d.ts +53 -0
  207. package/dist/vue/index.mjs +316 -7
  208. package/dist/vue/textToParticle/index.d.ts +53 -0
  209. package/dist/vue/typing/index.cjs +1 -0
  210. package/dist/vue/typing/index.d.ts +216 -0
  211. package/dist/vue/typing/index.mjs +312 -0
  212. package/package.json +25 -3
@@ -0,0 +1,638 @@
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 { 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 subscribe(store, ...callbacks) {
26
+ if (store == null) {
27
+ for (const callback of callbacks) {
28
+ callback(void 0);
29
+ }
30
+ return noop;
31
+ }
32
+ const unsub = store.subscribe(...callbacks);
33
+ return unsub.unsubscribe ? () => unsub.unsubscribe() : unsub;
34
+ }
35
+ function component_subscribe(component, store, callback) {
36
+ component.$$.on_destroy.push(subscribe(store, callback));
37
+ }
38
+ function insert(target, node, anchor) {
39
+ target.insertBefore(node, anchor || null);
40
+ }
41
+ function detach(node) {
42
+ if (node.parentNode) {
43
+ node.parentNode.removeChild(node);
44
+ }
45
+ }
46
+ function element(name) {
47
+ return document.createElement(name);
48
+ }
49
+ function attr(node, attribute, value) {
50
+ if (value == null) node.removeAttribute(attribute);
51
+ else if (node.getAttribute(attribute) !== value) node.setAttribute(attribute, value);
52
+ }
53
+ function children(element2) {
54
+ return Array.from(element2.childNodes);
55
+ }
56
+ let current_component;
57
+ function set_current_component(component) {
58
+ current_component = component;
59
+ }
60
+ const dirty_components = [];
61
+ const binding_callbacks = [];
62
+ let render_callbacks = [];
63
+ const flush_callbacks = [];
64
+ const resolved_promise = /* @__PURE__ */ Promise.resolve();
65
+ let update_scheduled = false;
66
+ function schedule_update() {
67
+ if (!update_scheduled) {
68
+ update_scheduled = true;
69
+ resolved_promise.then(flush);
70
+ }
71
+ }
72
+ function add_render_callback(fn) {
73
+ render_callbacks.push(fn);
74
+ }
75
+ const seen_callbacks = /* @__PURE__ */ new Set();
76
+ let flushidx = 0;
77
+ function flush() {
78
+ if (flushidx !== 0) {
79
+ return;
80
+ }
81
+ const saved_component = current_component;
82
+ do {
83
+ try {
84
+ while (flushidx < dirty_components.length) {
85
+ const component = dirty_components[flushidx];
86
+ flushidx++;
87
+ set_current_component(component);
88
+ update(component.$$);
89
+ }
90
+ } catch (e) {
91
+ dirty_components.length = 0;
92
+ flushidx = 0;
93
+ throw e;
94
+ }
95
+ set_current_component(null);
96
+ dirty_components.length = 0;
97
+ flushidx = 0;
98
+ while (binding_callbacks.length) binding_callbacks.pop()();
99
+ for (let i = 0; i < render_callbacks.length; i += 1) {
100
+ const callback = render_callbacks[i];
101
+ if (!seen_callbacks.has(callback)) {
102
+ seen_callbacks.add(callback);
103
+ callback();
104
+ }
105
+ }
106
+ render_callbacks.length = 0;
107
+ } while (dirty_components.length);
108
+ while (flush_callbacks.length) {
109
+ flush_callbacks.pop()();
110
+ }
111
+ update_scheduled = false;
112
+ seen_callbacks.clear();
113
+ set_current_component(saved_component);
114
+ }
115
+ function update($$) {
116
+ if ($$.fragment !== null) {
117
+ $$.update();
118
+ run_all($$.before_update);
119
+ const dirty = $$.dirty;
120
+ $$.dirty = [-1];
121
+ $$.fragment && $$.fragment.p($$.ctx, dirty);
122
+ $$.after_update.forEach(add_render_callback);
123
+ }
124
+ }
125
+ function flush_render_callbacks(fns) {
126
+ const filtered = [];
127
+ const targets = [];
128
+ render_callbacks.forEach((c) => fns.indexOf(c) === -1 ? filtered.push(c) : targets.push(c));
129
+ targets.forEach((c) => c());
130
+ render_callbacks = filtered;
131
+ }
132
+ const outroing = /* @__PURE__ */ new Set();
133
+ function transition_in(block, local) {
134
+ if (block && block.i) {
135
+ outroing.delete(block);
136
+ block.i(local);
137
+ }
138
+ }
139
+ function mount_component(component, target, anchor) {
140
+ const { fragment, after_update } = component.$$;
141
+ fragment && fragment.m(target, anchor);
142
+ add_render_callback(() => {
143
+ const new_on_destroy = component.$$.on_mount.map(run).filter(is_function);
144
+ if (component.$$.on_destroy) {
145
+ component.$$.on_destroy.push(...new_on_destroy);
146
+ } else {
147
+ run_all(new_on_destroy);
148
+ }
149
+ component.$$.on_mount = [];
150
+ });
151
+ after_update.forEach(add_render_callback);
152
+ }
153
+ function destroy_component(component, detaching) {
154
+ const $$ = component.$$;
155
+ if ($$.fragment !== null) {
156
+ flush_render_callbacks($$.after_update);
157
+ run_all($$.on_destroy);
158
+ $$.fragment && $$.fragment.d(detaching);
159
+ $$.on_destroy = $$.fragment = null;
160
+ $$.ctx = [];
161
+ }
162
+ }
163
+ function make_dirty(component, i) {
164
+ if (component.$$.dirty[0] === -1) {
165
+ dirty_components.push(component);
166
+ schedule_update();
167
+ component.$$.dirty.fill(0);
168
+ }
169
+ component.$$.dirty[i / 31 | 0] |= 1 << i % 31;
170
+ }
171
+ function init(component, options, instance2, create_fragment2, not_equal, props2, append_styles = null, dirty = [-1]) {
172
+ const parent_component = current_component;
173
+ set_current_component(component);
174
+ const $$ = component.$$ = {
175
+ fragment: null,
176
+ ctx: [],
177
+ // state
178
+ props: props2,
179
+ update: noop,
180
+ not_equal,
181
+ bound: blank_object(),
182
+ // lifecycle
183
+ on_mount: [],
184
+ on_destroy: [],
185
+ on_disconnect: [],
186
+ before_update: [],
187
+ after_update: [],
188
+ context: new Map(options.context || (parent_component ? parent_component.$$.context : [])),
189
+ // everything else
190
+ callbacks: blank_object(),
191
+ dirty,
192
+ skip_bound: false,
193
+ root: options.target || parent_component.$$.root
194
+ };
195
+ append_styles && append_styles($$.root);
196
+ let ready = false;
197
+ $$.ctx = instance2 ? instance2(component, options.props || {}, (i, ret, ...rest) => {
198
+ const value = rest.length ? rest[0] : ret;
199
+ if ($$.ctx && not_equal($$.ctx[i], $$.ctx[i] = value)) {
200
+ if (!$$.skip_bound && $$.bound[i]) $$.bound[i](value);
201
+ if (ready) make_dirty(component, i);
202
+ }
203
+ return ret;
204
+ }) : [];
205
+ $$.update();
206
+ ready = true;
207
+ run_all($$.before_update);
208
+ $$.fragment = create_fragment2 ? create_fragment2($$.ctx) : false;
209
+ if (options.target) {
210
+ if (options.hydrate) {
211
+ const nodes = children(options.target);
212
+ $$.fragment && $$.fragment.l(nodes);
213
+ nodes.forEach(detach);
214
+ } else {
215
+ $$.fragment && $$.fragment.c();
216
+ }
217
+ if (options.intro) transition_in(component.$$.fragment);
218
+ mount_component(component, options.target, options.anchor);
219
+ flush();
220
+ }
221
+ set_current_component(parent_component);
222
+ }
223
+ class SvelteComponent {
224
+ constructor() {
225
+ /**
226
+ * ### PRIVATE API
227
+ *
228
+ * Do not use, may change at any time
229
+ *
230
+ * @type {any}
231
+ */
232
+ __publicField(this, "$$");
233
+ /**
234
+ * ### PRIVATE API
235
+ *
236
+ * Do not use, may change at any time
237
+ *
238
+ * @type {any}
239
+ */
240
+ __publicField(this, "$$set");
241
+ }
242
+ /** @returns {void} */
243
+ $destroy() {
244
+ destroy_component(this, 1);
245
+ this.$destroy = noop;
246
+ }
247
+ /**
248
+ * @template {Extract<keyof Events, string>} K
249
+ * @param {K} type
250
+ * @param {((e: Events[K]) => void) | null | undefined} callback
251
+ * @returns {() => void}
252
+ */
253
+ $on(type, callback) {
254
+ if (!is_function(callback)) {
255
+ return noop;
256
+ }
257
+ const callbacks = this.$$.callbacks[type] || (this.$$.callbacks[type] = []);
258
+ callbacks.push(callback);
259
+ return () => {
260
+ const index = callbacks.indexOf(callback);
261
+ if (index !== -1) callbacks.splice(index, 1);
262
+ };
263
+ }
264
+ /**
265
+ * @param {Partial<Props>} props
266
+ * @returns {void}
267
+ */
268
+ $set(props2) {
269
+ if (this.$$set && !is_empty(props2)) {
270
+ this.$$.skip_bound = true;
271
+ this.$$set(props2);
272
+ this.$$.skip_bound = false;
273
+ }
274
+ }
275
+ }
276
+ const PUBLIC_VERSION = "4";
277
+ if (typeof window !== "undefined")
278
+ (window.__svelte || (window.__svelte = { v: /* @__PURE__ */ new Set() })).v.add(PUBLIC_VERSION);
279
+ function decomposeHangul(char) {
280
+ const code = char.charCodeAt(0);
281
+ if (code < 44032 || code > 55203) {
282
+ return [char];
283
+ }
284
+ const base = code - 44032;
285
+ const initial = Math.floor(base / (21 * 28));
286
+ const medial = Math.floor(base % (21 * 28) / 28);
287
+ const final = base % 28;
288
+ const initialChars = ["ㄱ", "ㄲ", "ㄴ", "ㄷ", "ㄸ", "ㄹ", "ㅁ", "ㅂ", "ㅃ", "ㅅ", "ㅆ", "ㅇ", "ㅈ", "ㅉ", "ㅊ", "ㅋ", "ㅌ", "ㅍ", "ㅎ"];
289
+ const medialChars = ["ㅏ", "ㅐ", "ㅑ", "ㅒ", "ㅓ", "ㅔ", "ㅕ", "ㅖ", "ㅗ", "ㅘ", "ㅙ", "ㅚ", "ㅛ", "ㅜ", "ㅝ", "ㅞ", "ㅟ", "ㅠ", "ㅡ", "ㅢ", "ㅣ"];
290
+ const finalChars = ["", "ㄱ", "ㄲ", "ㄳ", "ㄴ", "ㄵ", "ㄶ", "ㄷ", "ㄹ", "ㄺ", "ㄻ", "ㄼ", "ㄽ", "ㄾ", "ㄿ", "ㅀ", "ㅁ", "ㅂ", "ㅄ", "ㅅ", "ㅆ", "ㅇ", "ㅈ", "ㅊ", "ㅋ", "ㅌ", "ㅍ", "ㅎ"];
291
+ const result = [];
292
+ result.push(initialChars[initial]);
293
+ result.push(medialChars[medial]);
294
+ if (final > 0) {
295
+ result.push(finalChars[final]);
296
+ }
297
+ return result;
298
+ }
299
+ function composeHangul(initial, medial, final) {
300
+ const initialChars = ["ㄱ", "ㄲ", "ㄴ", "ㄷ", "ㄸ", "ㄹ", "ㅁ", "ㅂ", "ㅃ", "ㅅ", "ㅆ", "ㅇ", "ㅈ", "ㅉ", "ㅊ", "ㅋ", "ㅌ", "ㅍ", "ㅎ"];
301
+ const medialChars = ["ㅏ", "ㅐ", "ㅑ", "ㅒ", "ㅓ", "ㅔ", "ㅕ", "ㅖ", "ㅗ", "ㅘ", "ㅙ", "ㅚ", "ㅛ", "ㅜ", "ㅝ", "ㅞ", "ㅟ", "ㅠ", "ㅡ", "ㅢ", "ㅣ"];
302
+ const finalChars = ["", "ㄱ", "ㄲ", "ㄳ", "ㄴ", "ㄵ", "ㄶ", "ㄷ", "ㄹ", "ㄺ", "ㄻ", "ㄼ", "ㄽ", "ㄾ", "ㄿ", "ㅀ", "ㅁ", "ㅂ", "ㅄ", "ㅅ", "ㅆ", "ㅇ", "ㅈ", "ㅊ", "ㅋ", "ㅌ", "ㅍ", "ㅎ"];
303
+ const initialIndex = initialChars.indexOf(initial);
304
+ const medialIndex = medialChars.indexOf(medial);
305
+ const finalIndex = final ? finalChars.indexOf(final) : 0;
306
+ if (initialIndex === -1 || medialIndex === -1) {
307
+ return initial + (medial || "") + (final || "");
308
+ }
309
+ const code = 44032 + initialIndex * 21 * 28 + medialIndex * 28 + finalIndex;
310
+ return String.fromCharCode(code);
311
+ }
312
+ function decomposeText(text) {
313
+ const units = [];
314
+ const charUnitRanges = [];
315
+ for (let i = 0; i < text.length; i++) {
316
+ const char = text[i];
317
+ const code = char.charCodeAt(0);
318
+ const startIndex = units.length;
319
+ if (code >= 44032 && code <= 55203) {
320
+ const decomposed = decomposeHangul(char);
321
+ units.push(...decomposed);
322
+ charUnitRanges.push({
323
+ start: startIndex,
324
+ end: units.length,
325
+ isHangul: true
326
+ });
327
+ } else {
328
+ units.push(char);
329
+ charUnitRanges.push({
330
+ start: startIndex,
331
+ end: units.length,
332
+ isHangul: false
333
+ });
334
+ }
335
+ }
336
+ return { units, charUnitRanges };
337
+ }
338
+ class Typing {
339
+ // 원본 텍스트
340
+ constructor(container, options) {
341
+ this.container = typeof container === "string" ? document.querySelector(container) : container;
342
+ if (!this.container) {
343
+ throw new Error("Container element not found");
344
+ }
345
+ this.originalText = options.text;
346
+ this.config = {
347
+ text: options.text,
348
+ speed: options.speed ?? 50,
349
+ delay: options.delay ?? 0,
350
+ enabled: options.enabled ?? true,
351
+ threshold: options.threshold ?? 0.2,
352
+ rootMargin: options.rootMargin ?? "0px 0px -100px 0px",
353
+ triggerOnce: options.triggerOnce ?? false,
354
+ showCursor: options.showCursor ?? true,
355
+ cursorChar: options.cursorChar ?? "|",
356
+ onUpdate: options.onUpdate || null,
357
+ onComplete: options.onComplete || null
358
+ };
359
+ const decomposed = decomposeText(this.config.text);
360
+ this.textUnits = decomposed.units;
361
+ this.charUnitRanges = decomposed.charUnitRanges;
362
+ this.currentIndex = 0;
363
+ this.displayedText = "";
364
+ this.timeoutId = null;
365
+ this.intersectionObserver = null;
366
+ this.isRunning = false;
367
+ this.hasTriggered = false;
368
+ this.init();
369
+ }
370
+ init() {
371
+ this.updateDisplay("");
372
+ this.setupIntersectionObserver();
373
+ }
374
+ setupIntersectionObserver() {
375
+ if (typeof window === "undefined" || typeof window.IntersectionObserver === "undefined") {
376
+ if (this.config.enabled) {
377
+ setTimeout(() => this.start(), this.config.delay);
378
+ }
379
+ return;
380
+ }
381
+ this.intersectionObserver = new IntersectionObserver(
382
+ (entries) => {
383
+ var _a;
384
+ for (const entry of entries) {
385
+ if (entry.target !== this.container) continue;
386
+ if (entry.isIntersecting && !this.hasTriggered) {
387
+ if (this.config.enabled) {
388
+ setTimeout(() => this.start(), this.config.delay);
389
+ }
390
+ this.hasTriggered = true;
391
+ if (this.config.triggerOnce) {
392
+ (_a = this.intersectionObserver) == null ? void 0 : _a.disconnect();
393
+ }
394
+ }
395
+ }
396
+ },
397
+ {
398
+ threshold: this.config.threshold,
399
+ rootMargin: this.config.rootMargin
400
+ }
401
+ );
402
+ this.intersectionObserver.observe(this.container);
403
+ }
404
+ // 단위들을 다시 합쳐서 실제 표시할 텍스트 생성
405
+ // 한글의 경우 자음/모음이 하나씩 보이도록 합성
406
+ buildTextFromUnits(unitCount) {
407
+ if (unitCount === 0) return "";
408
+ let result = "";
409
+ for (let charIndex = 0; charIndex < this.charUnitRanges.length; charIndex++) {
410
+ const range = this.charUnitRanges[charIndex];
411
+ if (range.start >= unitCount) {
412
+ break;
413
+ }
414
+ const unitsEntered = Math.min(unitCount - range.start, range.end - range.start);
415
+ if (unitsEntered <= 0) {
416
+ break;
417
+ }
418
+ if (range.isHangul) {
419
+ const charUnits = this.textUnits.slice(range.start, range.start + unitsEntered);
420
+ if (charUnits.length === 1) {
421
+ result += charUnits[0];
422
+ } else if (charUnits.length === 2) {
423
+ result += composeHangul(charUnits[0], charUnits[1]);
424
+ } else if (charUnits.length >= 3) {
425
+ result += composeHangul(charUnits[0], charUnits[1], charUnits[2]);
426
+ }
427
+ } else {
428
+ if (unitsEntered > 0) {
429
+ result += this.textUnits[range.start];
430
+ }
431
+ }
432
+ }
433
+ return result;
434
+ }
435
+ start() {
436
+ if (this.isRunning) return;
437
+ this.isRunning = true;
438
+ this.currentIndex = 0;
439
+ this.displayedText = "";
440
+ this.typeNext();
441
+ }
442
+ typeNext() {
443
+ if (this.currentIndex >= this.textUnits.length) {
444
+ this.isRunning = false;
445
+ if (this.config.showCursor) {
446
+ this.updateDisplay(this.originalText);
447
+ }
448
+ if (this.config.onComplete) {
449
+ this.config.onComplete();
450
+ }
451
+ return;
452
+ }
453
+ this.displayedText = this.buildTextFromUnits(this.currentIndex + 1);
454
+ let displayText = this.displayedText;
455
+ if (this.config.showCursor) {
456
+ displayText += this.config.cursorChar;
457
+ }
458
+ this.updateDisplay(displayText);
459
+ if (this.config.onUpdate) {
460
+ this.config.onUpdate(this.displayedText);
461
+ }
462
+ this.currentIndex++;
463
+ this.timeoutId = setTimeout(() => {
464
+ this.typeNext();
465
+ }, this.config.speed);
466
+ }
467
+ stop() {
468
+ this.isRunning = false;
469
+ if (this.timeoutId) {
470
+ clearTimeout(this.timeoutId);
471
+ this.timeoutId = null;
472
+ }
473
+ }
474
+ reset() {
475
+ this.stop();
476
+ this.currentIndex = 0;
477
+ this.displayedText = "";
478
+ this.hasTriggered = false;
479
+ this.updateDisplay("");
480
+ }
481
+ updateDisplay(text) {
482
+ this.container.textContent = text;
483
+ }
484
+ // 텍스트 변경
485
+ setText(newText) {
486
+ this.originalText = newText;
487
+ this.config.text = newText;
488
+ const decomposed = decomposeText(newText);
489
+ this.textUnits = decomposed.units;
490
+ this.charUnitRanges = decomposed.charUnitRanges;
491
+ this.reset();
492
+ if (this.config.enabled) {
493
+ setTimeout(() => this.start(), this.config.delay);
494
+ }
495
+ }
496
+ destroy() {
497
+ this.stop();
498
+ if (this.intersectionObserver) {
499
+ this.intersectionObserver.disconnect();
500
+ this.intersectionObserver = null;
501
+ }
502
+ }
503
+ }
504
+ function create_fragment(ctx) {
505
+ let div;
506
+ return {
507
+ c() {
508
+ div = element("div");
509
+ attr(
510
+ div,
511
+ "class",
512
+ /*className*/
513
+ ctx[1]
514
+ );
515
+ attr(
516
+ div,
517
+ "style",
518
+ /*style*/
519
+ ctx[2]
520
+ );
521
+ },
522
+ m(target, anchor) {
523
+ insert(target, div, anchor);
524
+ ctx[8](div);
525
+ },
526
+ p: noop,
527
+ i: noop,
528
+ o: noop,
529
+ d(detaching) {
530
+ if (detaching) {
531
+ detach(div);
532
+ }
533
+ ctx[8](null);
534
+ }
535
+ };
536
+ }
537
+ function instance($$self, $$props, $$invalidate) {
538
+ let $effect;
539
+ let $props;
540
+ component_subscribe($$self, effect, ($$value) => $$invalidate(10, $effect = $$value));
541
+ component_subscribe($$self, props, ($$value) => $$invalidate(11, $props = $$value));
542
+ let { text, speed = 50, delay = 0, enabled = true, threshold = 0.2, rootMargin = "0px 0px -100px 0px", triggerOnce = false, showCursor = true, cursorChar = "|", className = "", style = "", onUpdate, onComplete } = $props();
543
+ let containerRef = null;
544
+ let instanceRef = null;
545
+ onMount(() => {
546
+ if (!containerRef) return;
547
+ const options = {
548
+ text,
549
+ speed,
550
+ delay,
551
+ enabled,
552
+ threshold,
553
+ rootMargin,
554
+ triggerOnce,
555
+ showCursor,
556
+ cursorChar,
557
+ onUpdate,
558
+ onComplete
559
+ };
560
+ instanceRef = new Typing(containerRef, options);
561
+ });
562
+ onDestroy(() => {
563
+ if (instanceRef) {
564
+ instanceRef.destroy();
565
+ instanceRef = null;
566
+ }
567
+ });
568
+ $effect(() => {
569
+ if (instanceRef && text !== instanceRef["originalText"]) {
570
+ instanceRef.setText(text);
571
+ }
572
+ });
573
+ function start() {
574
+ instanceRef == null ? void 0 : instanceRef.start();
575
+ }
576
+ function stop() {
577
+ instanceRef == null ? void 0 : instanceRef.stop();
578
+ }
579
+ function reset() {
580
+ instanceRef == null ? void 0 : instanceRef.reset();
581
+ }
582
+ function setText(newText) {
583
+ instanceRef == null ? void 0 : instanceRef.setText(newText);
584
+ }
585
+ function destroy() {
586
+ if (instanceRef) {
587
+ instanceRef.destroy();
588
+ instanceRef = null;
589
+ }
590
+ }
591
+ function div_binding($$value) {
592
+ binding_callbacks[$$value ? "unshift" : "push"](() => {
593
+ containerRef = $$value;
594
+ $$invalidate(0, containerRef);
595
+ });
596
+ }
597
+ return [
598
+ containerRef,
599
+ className,
600
+ style,
601
+ start,
602
+ stop,
603
+ reset,
604
+ setText,
605
+ destroy,
606
+ div_binding
607
+ ];
608
+ }
609
+ class Typing_1 extends SvelteComponent {
610
+ constructor(options) {
611
+ super();
612
+ init(this, options, instance, create_fragment, safe_not_equal, {
613
+ start: 3,
614
+ stop: 4,
615
+ reset: 5,
616
+ setText: 6,
617
+ destroy: 7
618
+ });
619
+ }
620
+ get start() {
621
+ return this.$$.ctx[3];
622
+ }
623
+ get stop() {
624
+ return this.$$.ctx[4];
625
+ }
626
+ get reset() {
627
+ return this.$$.ctx[5];
628
+ }
629
+ get setText() {
630
+ return this.$$.ctx[6];
631
+ }
632
+ get destroy() {
633
+ return this.$$.ctx[7];
634
+ }
635
+ }
636
+ export {
637
+ Typing_1 as default
638
+ };
@@ -12,6 +12,8 @@ export type { TextToParticleOptions, Particle } from './textToParticle/index.js'
12
12
  export { Count, default as CountDefault } from './count/index.js';
13
13
  export type { CountOptions } from './count/index.js';
14
14
  export { easingFunctions } from './count/index.js';
15
+ export { Typing, default as TypingDefault } from './typing/index.js';
16
+ export type { TypingOptions } from './typing/index.js';
15
17
  export { TextToParticle as MasonEffect } from './textToParticle/index.js';
16
18
  export type { TextToParticleOptions as MasonEffectOptions } from './textToParticle/index.js';
17
19
  export { default } from './textToParticle/index.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,cAAc,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAC7F,YAAY,EAAE,qBAAqB,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAGjF,OAAO,EAAE,KAAK,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAClE,YAAY,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAGnD,OAAO,EAAE,cAAc,IAAI,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAC1E,YAAY,EAAE,qBAAqB,IAAI,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAG7F,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,cAAc,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAC7F,YAAY,EAAE,qBAAqB,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAGjF,OAAO,EAAE,KAAK,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAClE,YAAY,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAGnD,OAAO,EAAE,MAAM,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACrE,YAAY,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGvD,OAAO,EAAE,cAAc,IAAI,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAC1E,YAAY,EAAE,qBAAqB,IAAI,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAG7F,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Typing - 타이핑 애니메이션 효과
3
+ * 바닐라 JS 코어 클래스
4
+ *
5
+ * 사용법:
6
+ * import { Typing } from 'masoneffect/typing';
7
+ */
8
+ export interface TypingOptions {
9
+ text: string;
10
+ speed?: number;
11
+ delay?: number;
12
+ enabled?: boolean;
13
+ threshold?: number;
14
+ rootMargin?: string;
15
+ triggerOnce?: boolean;
16
+ showCursor?: boolean;
17
+ cursorChar?: string;
18
+ onUpdate?: (text: string) => void;
19
+ onComplete?: () => void;
20
+ }
21
+ export declare class Typing {
22
+ container: HTMLElement;
23
+ config: Required<Omit<TypingOptions, 'onUpdate' | 'onComplete'>> & {
24
+ onUpdate: TypingOptions['onUpdate'];
25
+ onComplete: TypingOptions['onComplete'];
26
+ };
27
+ textUnits: string[];
28
+ charUnitRanges: Array<{
29
+ start: number;
30
+ end: number;
31
+ isHangul: boolean;
32
+ }>;
33
+ currentIndex: number;
34
+ displayedText: string;
35
+ timeoutId: ReturnType<typeof setTimeout> | null;
36
+ intersectionObserver: IntersectionObserver | null;
37
+ isRunning: boolean;
38
+ hasTriggered: boolean;
39
+ originalText: string;
40
+ constructor(container: HTMLElement | string, options: TypingOptions);
41
+ init(): void;
42
+ setupIntersectionObserver(): void;
43
+ private buildTextFromUnits;
44
+ start(): void;
45
+ typeNext(): void;
46
+ stop(): void;
47
+ reset(): void;
48
+ updateDisplay(text: string): void;
49
+ setText(newText: string): void;
50
+ destroy(): void;
51
+ }
52
+ export default Typing;
53
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/typing/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;CACzB;AAyFD,qBAAa,MAAM;IACjB,SAAS,EAAE,WAAW,CAAC;IACvB,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,aAAa,EAAE,UAAU,GAAG,YAAY,CAAC,CAAC,GAAG;QACjE,QAAQ,EAAE,aAAa,CAAC,UAAU,CAAC,CAAC;QACpC,UAAU,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC;KACzC,CAAC;IACF,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,cAAc,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IACzE,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,UAAU,CAAC,OAAO,UAAU,CAAC,GAAG,IAAI,CAAC;IAChD,oBAAoB,EAAE,oBAAoB,GAAG,IAAI,CAAC;IAClD,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,OAAO,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;gBAET,SAAS,EAAE,WAAW,GAAG,MAAM,EAAE,OAAO,EAAE,aAAa;IA6CnE,IAAI,IAAI,IAAI;IAQZ,yBAAyB,IAAI,IAAI;IAqCjC,OAAO,CAAC,kBAAkB;IAgD1B,KAAK,IAAI,IAAI;IASb,QAAQ,IAAI,IAAI;IAuChB,IAAI,IAAI,IAAI;IAQZ,KAAK,IAAI,IAAI;IAQb,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAKjC,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAa9B,OAAO,IAAI,IAAI;CAOhB;AAGD,eAAe,MAAM,CAAC"}