masoneffect 2.0.1 → 2.0.3

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 +15 -2
  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 +52 -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 +52 -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 +51 -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 +52 -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 +52 -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 +52 -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 +52 -0
  131. package/dist/svelte/index.cjs +1 -1
  132. package/dist/svelte/index.d.ts +52 -0
  133. package/dist/svelte/index.mjs +415 -48
  134. package/dist/svelte/textToParticle/index.d.ts +52 -0
  135. package/dist/svelte/typing/index.cjs +1 -0
  136. package/dist/svelte/typing/index.d.ts +215 -0
  137. package/dist/svelte/typing/index.mjs +634 -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 +52 -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 +52 -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 +52 -0
  205. package/dist/vue/index.cjs +1 -1
  206. package/dist/vue/index.d.ts +52 -0
  207. package/dist/vue/index.mjs +312 -7
  208. package/dist/vue/textToParticle/index.d.ts +52 -0
  209. package/dist/vue/typing/index.cjs +1 -0
  210. package/dist/vue/typing/index.d.ts +215 -0
  211. package/dist/vue/typing/index.mjs +308 -0
  212. package/package.json +25 -2
@@ -0,0 +1,634 @@
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 decomposeText(text) {
300
+ const units = [];
301
+ for (let i = 0; i < text.length; i++) {
302
+ const char = text[i];
303
+ const code = char.charCodeAt(0);
304
+ if (code >= 44032 && code <= 55203) {
305
+ const decomposed = decomposeHangul(char);
306
+ units.push(...decomposed);
307
+ } else {
308
+ units.push(char);
309
+ }
310
+ }
311
+ return units;
312
+ }
313
+ class Typing {
314
+ // 원본 텍스트
315
+ constructor(container, options) {
316
+ this.originalChars = [];
317
+ this.charUnitMap = [];
318
+ this.container = typeof container === "string" ? document.querySelector(container) : container;
319
+ if (!this.container) {
320
+ throw new Error("Container element not found");
321
+ }
322
+ this.originalText = options.text;
323
+ this.config = {
324
+ text: options.text,
325
+ speed: options.speed ?? 50,
326
+ delay: options.delay ?? 0,
327
+ enabled: options.enabled ?? true,
328
+ threshold: options.threshold ?? 0.2,
329
+ rootMargin: options.rootMargin ?? "0px 0px -100px 0px",
330
+ triggerOnce: options.triggerOnce ?? false,
331
+ showCursor: options.showCursor ?? true,
332
+ cursorChar: options.cursorChar ?? "|",
333
+ onUpdate: options.onUpdate || null,
334
+ onComplete: options.onComplete || null
335
+ };
336
+ this.textUnits = decomposeText(this.config.text);
337
+ this.originalChars = [];
338
+ this.charUnitMap = [];
339
+ this.initializeTextStructure();
340
+ this.currentIndex = 0;
341
+ this.displayedText = "";
342
+ this.timeoutId = null;
343
+ this.intersectionObserver = null;
344
+ this.isRunning = false;
345
+ this.hasTriggered = false;
346
+ this.init();
347
+ }
348
+ init() {
349
+ this.updateDisplay("");
350
+ this.setupIntersectionObserver();
351
+ }
352
+ setupIntersectionObserver() {
353
+ if (typeof window === "undefined" || typeof window.IntersectionObserver === "undefined") {
354
+ if (this.config.enabled) {
355
+ setTimeout(() => this.start(), this.config.delay);
356
+ }
357
+ return;
358
+ }
359
+ this.intersectionObserver = new IntersectionObserver(
360
+ (entries) => {
361
+ var _a;
362
+ for (const entry of entries) {
363
+ if (entry.target !== this.container) continue;
364
+ if (entry.isIntersecting && !this.hasTriggered) {
365
+ if (this.config.enabled) {
366
+ setTimeout(() => this.start(), this.config.delay);
367
+ }
368
+ this.hasTriggered = true;
369
+ if (this.config.triggerOnce) {
370
+ (_a = this.intersectionObserver) == null ? void 0 : _a.disconnect();
371
+ }
372
+ }
373
+ }
374
+ },
375
+ {
376
+ threshold: this.config.threshold,
377
+ rootMargin: this.config.rootMargin
378
+ }
379
+ );
380
+ this.intersectionObserver.observe(this.container);
381
+ }
382
+ // 각 글자에 해당하는 단위 개수
383
+ initializeTextStructure() {
384
+ this.originalChars = [];
385
+ this.charUnitMap = [];
386
+ for (let i = 0; i < this.originalText.length; i++) {
387
+ const char = this.originalText[i];
388
+ const code = char.charCodeAt(0);
389
+ this.originalChars.push(char);
390
+ if (code >= 44032 && code <= 55203) {
391
+ const decomposed = decomposeHangul(char);
392
+ this.charUnitMap.push(decomposed.length);
393
+ } else {
394
+ this.charUnitMap.push(1);
395
+ }
396
+ }
397
+ }
398
+ // 단위 인덱스를 원본 텍스트의 글자 인덱스로 변환
399
+ // unitIndex: 현재까지 입력된 단위 개수 (0부터 시작)
400
+ // 반환: 표시할 글자 개수 (0부터 시작, exclusive)
401
+ getCharIndexFromUnitIndex(unitIndex) {
402
+ if (unitIndex === 0) return 0;
403
+ let charIndex = 0;
404
+ let currentUnits = 0;
405
+ for (let i = 0; i < this.charUnitMap.length; i++) {
406
+ const unitsForChar = this.charUnitMap[i];
407
+ currentUnits += unitsForChar;
408
+ if (unitIndex >= currentUnits) {
409
+ charIndex = i + 1;
410
+ } else {
411
+ const unitsEntered = unitIndex - (currentUnits - unitsForChar);
412
+ if (unitsEntered > 0) {
413
+ const isHangul = this.originalChars[i] && this.originalChars[i].charCodeAt(0) >= 44032 && this.originalChars[i].charCodeAt(0) <= 55203;
414
+ if (isHangul && unitsEntered >= 2) {
415
+ charIndex = i + 1;
416
+ } else if (!isHangul && unitsEntered >= 1) {
417
+ charIndex = i + 1;
418
+ }
419
+ }
420
+ break;
421
+ }
422
+ }
423
+ return charIndex;
424
+ }
425
+ // 단위들을 다시 합쳐서 실제 표시할 텍스트 생성
426
+ buildTextFromUnits(units) {
427
+ if (units.length === 0) return "";
428
+ const charIndex = this.getCharIndexFromUnitIndex(units.length);
429
+ return this.originalText.substring(0, charIndex);
430
+ }
431
+ start() {
432
+ if (this.isRunning) return;
433
+ this.isRunning = true;
434
+ this.currentIndex = 0;
435
+ this.displayedText = "";
436
+ this.typeNext();
437
+ }
438
+ typeNext() {
439
+ if (this.currentIndex >= this.textUnits.length) {
440
+ this.isRunning = false;
441
+ if (this.config.showCursor) {
442
+ this.updateDisplay(this.originalText);
443
+ }
444
+ if (this.config.onComplete) {
445
+ this.config.onComplete();
446
+ }
447
+ return;
448
+ }
449
+ const unitsToShow = this.textUnits.slice(0, this.currentIndex + 1);
450
+ this.displayedText = this.buildTextFromUnits(unitsToShow);
451
+ let displayText = this.displayedText;
452
+ if (this.config.showCursor) {
453
+ displayText += this.config.cursorChar;
454
+ }
455
+ this.updateDisplay(displayText);
456
+ if (this.config.onUpdate) {
457
+ this.config.onUpdate(this.displayedText);
458
+ }
459
+ this.currentIndex++;
460
+ this.timeoutId = setTimeout(() => {
461
+ this.typeNext();
462
+ }, this.config.speed);
463
+ }
464
+ stop() {
465
+ this.isRunning = false;
466
+ if (this.timeoutId) {
467
+ clearTimeout(this.timeoutId);
468
+ this.timeoutId = null;
469
+ }
470
+ }
471
+ reset() {
472
+ this.stop();
473
+ this.currentIndex = 0;
474
+ this.displayedText = "";
475
+ this.hasTriggered = false;
476
+ this.updateDisplay("");
477
+ }
478
+ updateDisplay(text) {
479
+ this.container.textContent = text;
480
+ }
481
+ // 텍스트 변경
482
+ setText(newText) {
483
+ this.originalText = newText;
484
+ this.config.text = newText;
485
+ this.textUnits = decomposeText(newText);
486
+ this.initializeTextStructure();
487
+ this.reset();
488
+ if (this.config.enabled) {
489
+ setTimeout(() => this.start(), this.config.delay);
490
+ }
491
+ }
492
+ destroy() {
493
+ this.stop();
494
+ if (this.intersectionObserver) {
495
+ this.intersectionObserver.disconnect();
496
+ this.intersectionObserver = null;
497
+ }
498
+ }
499
+ }
500
+ function create_fragment(ctx) {
501
+ let div;
502
+ return {
503
+ c() {
504
+ div = element("div");
505
+ attr(
506
+ div,
507
+ "class",
508
+ /*className*/
509
+ ctx[1]
510
+ );
511
+ attr(
512
+ div,
513
+ "style",
514
+ /*style*/
515
+ ctx[2]
516
+ );
517
+ },
518
+ m(target, anchor) {
519
+ insert(target, div, anchor);
520
+ ctx[8](div);
521
+ },
522
+ p: noop,
523
+ i: noop,
524
+ o: noop,
525
+ d(detaching) {
526
+ if (detaching) {
527
+ detach(div);
528
+ }
529
+ ctx[8](null);
530
+ }
531
+ };
532
+ }
533
+ function instance($$self, $$props, $$invalidate) {
534
+ let $effect;
535
+ let $props;
536
+ component_subscribe($$self, effect, ($$value) => $$invalidate(10, $effect = $$value));
537
+ component_subscribe($$self, props, ($$value) => $$invalidate(11, $props = $$value));
538
+ 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();
539
+ let containerRef = null;
540
+ let instanceRef = null;
541
+ onMount(() => {
542
+ if (!containerRef) return;
543
+ const options = {
544
+ text,
545
+ speed,
546
+ delay,
547
+ enabled,
548
+ threshold,
549
+ rootMargin,
550
+ triggerOnce,
551
+ showCursor,
552
+ cursorChar,
553
+ onUpdate,
554
+ onComplete
555
+ };
556
+ instanceRef = new Typing(containerRef, options);
557
+ });
558
+ onDestroy(() => {
559
+ if (instanceRef) {
560
+ instanceRef.destroy();
561
+ instanceRef = null;
562
+ }
563
+ });
564
+ $effect(() => {
565
+ if (instanceRef && text !== instanceRef["originalText"]) {
566
+ instanceRef.setText(text);
567
+ }
568
+ });
569
+ function start() {
570
+ instanceRef == null ? void 0 : instanceRef.start();
571
+ }
572
+ function stop() {
573
+ instanceRef == null ? void 0 : instanceRef.stop();
574
+ }
575
+ function reset() {
576
+ instanceRef == null ? void 0 : instanceRef.reset();
577
+ }
578
+ function setText(newText) {
579
+ instanceRef == null ? void 0 : instanceRef.setText(newText);
580
+ }
581
+ function destroy() {
582
+ if (instanceRef) {
583
+ instanceRef.destroy();
584
+ instanceRef = null;
585
+ }
586
+ }
587
+ function div_binding($$value) {
588
+ binding_callbacks[$$value ? "unshift" : "push"](() => {
589
+ containerRef = $$value;
590
+ $$invalidate(0, containerRef);
591
+ });
592
+ }
593
+ return [
594
+ containerRef,
595
+ className,
596
+ style,
597
+ start,
598
+ stop,
599
+ reset,
600
+ setText,
601
+ destroy,
602
+ div_binding
603
+ ];
604
+ }
605
+ class Typing_1 extends SvelteComponent {
606
+ constructor(options) {
607
+ super();
608
+ init(this, options, instance, create_fragment, safe_not_equal, {
609
+ start: 3,
610
+ stop: 4,
611
+ reset: 5,
612
+ setText: 6,
613
+ destroy: 7
614
+ });
615
+ }
616
+ get start() {
617
+ return this.$$.ctx[3];
618
+ }
619
+ get stop() {
620
+ return this.$$.ctx[4];
621
+ }
622
+ get reset() {
623
+ return this.$$.ctx[5];
624
+ }
625
+ get setText() {
626
+ return this.$$.ctx[6];
627
+ }
628
+ get destroy() {
629
+ return this.$$.ctx[7];
630
+ }
631
+ }
632
+ export {
633
+ Typing_1 as default
634
+ };
@@ -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,EAA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@@
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
+ currentIndex: number;
29
+ displayedText: string;
30
+ timeoutId: ReturnType<typeof setTimeout> | null;
31
+ intersectionObserver: IntersectionObserver | null;
32
+ isRunning: boolean;
33
+ hasTriggered: boolean;
34
+ originalText: string;
35
+ constructor(container: HTMLElement | string, options: TypingOptions);
36
+ init(): void;
37
+ setupIntersectionObserver(): void;
38
+ private originalChars;
39
+ private charUnitMap;
40
+ private initializeTextStructure;
41
+ private getCharIndexFromUnitIndex;
42
+ private buildTextFromUnits;
43
+ start(): void;
44
+ typeNext(): void;
45
+ stop(): void;
46
+ reset(): void;
47
+ updateDisplay(text: string): void;
48
+ setText(newText: string): void;
49
+ destroy(): void;
50
+ }
51
+ export default Typing;
52
+ //# 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,S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