svelte-intersection-observer 0.10.2 → 1.0.0
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/{src/IntersectionObserver.svelte → IntersectionObserver.svelte} +12 -7
- package/IntersectionObserver.svelte.d.ts +79 -0
- package/README.md +0 -15
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/package.json +17 -37
- package/CHANGELOG.md +0 -124
- package/lib/index.js +0 -720
- package/lib/index.mjs +0 -712
- package/src/index.js +0 -3
- package/types/IntersectionObserver.svelte.d.ts +0 -84
- package/types/index.d.ts +0 -1
package/lib/index.mjs
DELETED
|
@@ -1,712 +0,0 @@
|
|
|
1
|
-
/** @returns {void} */
|
|
2
|
-
function noop() {}
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* @template T
|
|
6
|
-
* @template S
|
|
7
|
-
* @param {T} tar
|
|
8
|
-
* @param {S} src
|
|
9
|
-
* @returns {T & S}
|
|
10
|
-
*/
|
|
11
|
-
function assign(tar, src) {
|
|
12
|
-
// @ts-ignore
|
|
13
|
-
for (const k in src) tar[k] = src[k];
|
|
14
|
-
return /** @type {T & S} */ (tar);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
function run(fn) {
|
|
18
|
-
return fn();
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function blank_object() {
|
|
22
|
-
return Object.create(null);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* @param {Function[]} fns
|
|
27
|
-
* @returns {void}
|
|
28
|
-
*/
|
|
29
|
-
function run_all(fns) {
|
|
30
|
-
fns.forEach(run);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* @param {any} thing
|
|
35
|
-
* @returns {thing is Function}
|
|
36
|
-
*/
|
|
37
|
-
function is_function(thing) {
|
|
38
|
-
return typeof thing === 'function';
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/** @returns {boolean} */
|
|
42
|
-
function safe_not_equal(a, b) {
|
|
43
|
-
return a != a ? b == b : a !== b || (a && typeof a === 'object') || typeof a === 'function';
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/** @returns {boolean} */
|
|
47
|
-
function is_empty(obj) {
|
|
48
|
-
return Object.keys(obj).length === 0;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function create_slot(definition, ctx, $$scope, fn) {
|
|
52
|
-
if (definition) {
|
|
53
|
-
const slot_ctx = get_slot_context(definition, ctx, $$scope, fn);
|
|
54
|
-
return definition[0](slot_ctx);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
function get_slot_context(definition, ctx, $$scope, fn) {
|
|
59
|
-
return definition[1] && fn ? assign($$scope.ctx.slice(), definition[1](fn(ctx))) : $$scope.ctx;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
function get_slot_changes(definition, $$scope, dirty, fn) {
|
|
63
|
-
if (definition[2] && fn) {
|
|
64
|
-
const lets = definition[2](fn(dirty));
|
|
65
|
-
if ($$scope.dirty === undefined) {
|
|
66
|
-
return lets;
|
|
67
|
-
}
|
|
68
|
-
if (typeof lets === 'object') {
|
|
69
|
-
const merged = [];
|
|
70
|
-
const len = Math.max($$scope.dirty.length, lets.length);
|
|
71
|
-
for (let i = 0; i < len; i += 1) {
|
|
72
|
-
merged[i] = $$scope.dirty[i] | lets[i];
|
|
73
|
-
}
|
|
74
|
-
return merged;
|
|
75
|
-
}
|
|
76
|
-
return $$scope.dirty | lets;
|
|
77
|
-
}
|
|
78
|
-
return $$scope.dirty;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
/** @returns {void} */
|
|
82
|
-
function update_slot_base(
|
|
83
|
-
slot,
|
|
84
|
-
slot_definition,
|
|
85
|
-
ctx,
|
|
86
|
-
$$scope,
|
|
87
|
-
slot_changes,
|
|
88
|
-
get_slot_context_fn
|
|
89
|
-
) {
|
|
90
|
-
if (slot_changes) {
|
|
91
|
-
const slot_context = get_slot_context(slot_definition, ctx, $$scope, get_slot_context_fn);
|
|
92
|
-
slot.p(slot_context, slot_changes);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/** @returns {any[] | -1} */
|
|
97
|
-
function get_all_dirty_from_scope($$scope) {
|
|
98
|
-
if ($$scope.ctx.length > 32) {
|
|
99
|
-
const dirty = [];
|
|
100
|
-
const length = $$scope.ctx.length / 32;
|
|
101
|
-
for (let i = 0; i < length; i++) {
|
|
102
|
-
dirty[i] = -1;
|
|
103
|
-
}
|
|
104
|
-
return dirty;
|
|
105
|
-
}
|
|
106
|
-
return -1;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* @param {Node} node
|
|
111
|
-
* @returns {void}
|
|
112
|
-
*/
|
|
113
|
-
function detach(node) {
|
|
114
|
-
if (node.parentNode) {
|
|
115
|
-
node.parentNode.removeChild(node);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* @param {Element} element
|
|
121
|
-
* @returns {ChildNode[]}
|
|
122
|
-
*/
|
|
123
|
-
function children(element) {
|
|
124
|
-
return Array.from(element.childNodes);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* @template T
|
|
129
|
-
* @param {string} type
|
|
130
|
-
* @param {T} [detail]
|
|
131
|
-
* @param {{ bubbles?: boolean, cancelable?: boolean }} [options]
|
|
132
|
-
* @returns {CustomEvent<T>}
|
|
133
|
-
*/
|
|
134
|
-
function custom_event(type, detail, { bubbles = false, cancelable = false } = {}) {
|
|
135
|
-
return new CustomEvent(type, { detail, bubbles, cancelable });
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* @typedef {Node & {
|
|
140
|
-
* claim_order?: number;
|
|
141
|
-
* hydrate_init?: true;
|
|
142
|
-
* actual_end_child?: NodeEx;
|
|
143
|
-
* childNodes: NodeListOf<NodeEx>;
|
|
144
|
-
* }} NodeEx
|
|
145
|
-
*/
|
|
146
|
-
|
|
147
|
-
/** @typedef {ChildNode & NodeEx} ChildNodeEx */
|
|
148
|
-
|
|
149
|
-
/** @typedef {NodeEx & { claim_order: number }} NodeEx2 */
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* @typedef {ChildNodeEx[] & {
|
|
153
|
-
* claim_info?: {
|
|
154
|
-
* last_index: number;
|
|
155
|
-
* total_claimed: number;
|
|
156
|
-
* };
|
|
157
|
-
* }} ChildNodeArray
|
|
158
|
-
*/
|
|
159
|
-
|
|
160
|
-
let current_component;
|
|
161
|
-
|
|
162
|
-
/** @returns {void} */
|
|
163
|
-
function set_current_component(component) {
|
|
164
|
-
current_component = component;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
function get_current_component() {
|
|
168
|
-
if (!current_component) throw new Error('Function called outside component initialization');
|
|
169
|
-
return current_component;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
/**
|
|
173
|
-
* Creates an event dispatcher that can be used to dispatch [component events](/docs#template-syntax-component-directives-on-eventname).
|
|
174
|
-
* Event dispatchers are functions that can take two arguments: `name` and `detail`.
|
|
175
|
-
*
|
|
176
|
-
* Component events created with `createEventDispatcher` create a
|
|
177
|
-
* [CustomEvent](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent).
|
|
178
|
-
* These events do not [bubble](https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Building_blocks/Events#Event_bubbling_and_capture).
|
|
179
|
-
* The `detail` argument corresponds to the [CustomEvent.detail](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/detail)
|
|
180
|
-
* property and can contain any type of data.
|
|
181
|
-
*
|
|
182
|
-
* The event dispatcher can be typed to narrow the allowed event names and the type of the `detail` argument:
|
|
183
|
-
* ```ts
|
|
184
|
-
* const dispatch = createEventDispatcher<{
|
|
185
|
-
* loaded: never; // does not take a detail argument
|
|
186
|
-
* change: string; // takes a detail argument of type string, which is required
|
|
187
|
-
* optional: number | null; // takes an optional detail argument of type number
|
|
188
|
-
* }>();
|
|
189
|
-
* ```
|
|
190
|
-
*
|
|
191
|
-
* https://svelte.dev/docs/svelte#createeventdispatcher
|
|
192
|
-
* @template {Record<string, any>} [EventMap=any]
|
|
193
|
-
* @returns {import('./public.js').EventDispatcher<EventMap>}
|
|
194
|
-
*/
|
|
195
|
-
function createEventDispatcher() {
|
|
196
|
-
const component = get_current_component();
|
|
197
|
-
return (type, detail, { cancelable = false } = {}) => {
|
|
198
|
-
const callbacks = component.$$.callbacks[type];
|
|
199
|
-
if (callbacks) {
|
|
200
|
-
// TODO are there situations where events could be dispatched
|
|
201
|
-
// in a server (non-DOM) environment?
|
|
202
|
-
const event = custom_event(/** @type {string} */ (type), detail, { cancelable });
|
|
203
|
-
callbacks.slice().forEach((fn) => {
|
|
204
|
-
fn.call(component, event);
|
|
205
|
-
});
|
|
206
|
-
return !event.defaultPrevented;
|
|
207
|
-
}
|
|
208
|
-
return true;
|
|
209
|
-
};
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
const dirty_components = [];
|
|
213
|
-
const binding_callbacks = [];
|
|
214
|
-
|
|
215
|
-
let render_callbacks = [];
|
|
216
|
-
|
|
217
|
-
const flush_callbacks = [];
|
|
218
|
-
|
|
219
|
-
const resolved_promise = /* @__PURE__ */ Promise.resolve();
|
|
220
|
-
|
|
221
|
-
let update_scheduled = false;
|
|
222
|
-
|
|
223
|
-
/** @returns {void} */
|
|
224
|
-
function schedule_update() {
|
|
225
|
-
if (!update_scheduled) {
|
|
226
|
-
update_scheduled = true;
|
|
227
|
-
resolved_promise.then(flush);
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
/** @returns {void} */
|
|
232
|
-
function add_render_callback(fn) {
|
|
233
|
-
render_callbacks.push(fn);
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
// flush() calls callbacks in this order:
|
|
237
|
-
// 1. All beforeUpdate callbacks, in order: parents before children
|
|
238
|
-
// 2. All bind:this callbacks, in reverse order: children before parents.
|
|
239
|
-
// 3. All afterUpdate callbacks, in order: parents before children. EXCEPT
|
|
240
|
-
// for afterUpdates called during the initial onMount, which are called in
|
|
241
|
-
// reverse order: children before parents.
|
|
242
|
-
// Since callbacks might update component values, which could trigger another
|
|
243
|
-
// call to flush(), the following steps guard against this:
|
|
244
|
-
// 1. During beforeUpdate, any updated components will be added to the
|
|
245
|
-
// dirty_components array and will cause a reentrant call to flush(). Because
|
|
246
|
-
// the flush index is kept outside the function, the reentrant call will pick
|
|
247
|
-
// up where the earlier call left off and go through all dirty components. The
|
|
248
|
-
// current_component value is saved and restored so that the reentrant call will
|
|
249
|
-
// not interfere with the "parent" flush() call.
|
|
250
|
-
// 2. bind:this callbacks cannot trigger new flush() calls.
|
|
251
|
-
// 3. During afterUpdate, any updated components will NOT have their afterUpdate
|
|
252
|
-
// callback called a second time; the seen_callbacks set, outside the flush()
|
|
253
|
-
// function, guarantees this behavior.
|
|
254
|
-
const seen_callbacks = new Set();
|
|
255
|
-
|
|
256
|
-
let flushidx = 0; // Do *not* move this inside the flush() function
|
|
257
|
-
|
|
258
|
-
/** @returns {void} */
|
|
259
|
-
function flush() {
|
|
260
|
-
// Do not reenter flush while dirty components are updated, as this can
|
|
261
|
-
// result in an infinite loop. Instead, let the inner flush handle it.
|
|
262
|
-
// Reentrancy is ok afterwards for bindings etc.
|
|
263
|
-
if (flushidx !== 0) {
|
|
264
|
-
return;
|
|
265
|
-
}
|
|
266
|
-
const saved_component = current_component;
|
|
267
|
-
do {
|
|
268
|
-
// first, call beforeUpdate functions
|
|
269
|
-
// and update components
|
|
270
|
-
try {
|
|
271
|
-
while (flushidx < dirty_components.length) {
|
|
272
|
-
const component = dirty_components[flushidx];
|
|
273
|
-
flushidx++;
|
|
274
|
-
set_current_component(component);
|
|
275
|
-
update(component.$$);
|
|
276
|
-
}
|
|
277
|
-
} catch (e) {
|
|
278
|
-
// reset dirty state to not end up in a deadlocked state and then rethrow
|
|
279
|
-
dirty_components.length = 0;
|
|
280
|
-
flushidx = 0;
|
|
281
|
-
throw e;
|
|
282
|
-
}
|
|
283
|
-
set_current_component(null);
|
|
284
|
-
dirty_components.length = 0;
|
|
285
|
-
flushidx = 0;
|
|
286
|
-
while (binding_callbacks.length) binding_callbacks.pop()();
|
|
287
|
-
// then, once components are updated, call
|
|
288
|
-
// afterUpdate functions. This may cause
|
|
289
|
-
// subsequent updates...
|
|
290
|
-
for (let i = 0; i < render_callbacks.length; i += 1) {
|
|
291
|
-
const callback = render_callbacks[i];
|
|
292
|
-
if (!seen_callbacks.has(callback)) {
|
|
293
|
-
// ...so guard against infinite loops
|
|
294
|
-
seen_callbacks.add(callback);
|
|
295
|
-
callback();
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
render_callbacks.length = 0;
|
|
299
|
-
} while (dirty_components.length);
|
|
300
|
-
while (flush_callbacks.length) {
|
|
301
|
-
flush_callbacks.pop()();
|
|
302
|
-
}
|
|
303
|
-
update_scheduled = false;
|
|
304
|
-
seen_callbacks.clear();
|
|
305
|
-
set_current_component(saved_component);
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
/** @returns {void} */
|
|
309
|
-
function update($$) {
|
|
310
|
-
if ($$.fragment !== null) {
|
|
311
|
-
$$.update();
|
|
312
|
-
run_all($$.before_update);
|
|
313
|
-
const dirty = $$.dirty;
|
|
314
|
-
$$.dirty = [-1];
|
|
315
|
-
$$.fragment && $$.fragment.p($$.ctx, dirty);
|
|
316
|
-
$$.after_update.forEach(add_render_callback);
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
/**
|
|
321
|
-
* Useful for example to execute remaining `afterUpdate` callbacks before executing `destroy`.
|
|
322
|
-
* @param {Function[]} fns
|
|
323
|
-
* @returns {void}
|
|
324
|
-
*/
|
|
325
|
-
function flush_render_callbacks(fns) {
|
|
326
|
-
const filtered = [];
|
|
327
|
-
const targets = [];
|
|
328
|
-
render_callbacks.forEach((c) => (fns.indexOf(c) === -1 ? filtered.push(c) : targets.push(c)));
|
|
329
|
-
targets.forEach((c) => c());
|
|
330
|
-
render_callbacks = filtered;
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
const outroing = new Set();
|
|
334
|
-
|
|
335
|
-
/**
|
|
336
|
-
* @type {Outro}
|
|
337
|
-
*/
|
|
338
|
-
let outros;
|
|
339
|
-
|
|
340
|
-
/**
|
|
341
|
-
* @param {import('./private.js').Fragment} block
|
|
342
|
-
* @param {0 | 1} [local]
|
|
343
|
-
* @returns {void}
|
|
344
|
-
*/
|
|
345
|
-
function transition_in(block, local) {
|
|
346
|
-
if (block && block.i) {
|
|
347
|
-
outroing.delete(block);
|
|
348
|
-
block.i(local);
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
/**
|
|
353
|
-
* @param {import('./private.js').Fragment} block
|
|
354
|
-
* @param {0 | 1} local
|
|
355
|
-
* @param {0 | 1} [detach]
|
|
356
|
-
* @param {() => void} [callback]
|
|
357
|
-
* @returns {void}
|
|
358
|
-
*/
|
|
359
|
-
function transition_out(block, local, detach, callback) {
|
|
360
|
-
if (block && block.o) {
|
|
361
|
-
if (outroing.has(block)) return;
|
|
362
|
-
outroing.add(block);
|
|
363
|
-
outros.c.push(() => {
|
|
364
|
-
outroing.delete(block);
|
|
365
|
-
if (callback) {
|
|
366
|
-
if (detach) block.d(1);
|
|
367
|
-
callback();
|
|
368
|
-
}
|
|
369
|
-
});
|
|
370
|
-
block.o(local);
|
|
371
|
-
} else if (callback) {
|
|
372
|
-
callback();
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
/** @typedef {1} INTRO */
|
|
377
|
-
/** @typedef {0} OUTRO */
|
|
378
|
-
/** @typedef {{ direction: 'in' | 'out' | 'both' }} TransitionOptions */
|
|
379
|
-
/** @typedef {(node: Element, params: any, options: TransitionOptions) => import('../transition/public.js').TransitionConfig} TransitionFn */
|
|
380
|
-
|
|
381
|
-
/**
|
|
382
|
-
* @typedef {Object} Outro
|
|
383
|
-
* @property {number} r
|
|
384
|
-
* @property {Function[]} c
|
|
385
|
-
* @property {Object} p
|
|
386
|
-
*/
|
|
387
|
-
|
|
388
|
-
/**
|
|
389
|
-
* @typedef {Object} PendingProgram
|
|
390
|
-
* @property {number} start
|
|
391
|
-
* @property {INTRO|OUTRO} b
|
|
392
|
-
* @property {Outro} [group]
|
|
393
|
-
*/
|
|
394
|
-
|
|
395
|
-
/**
|
|
396
|
-
* @typedef {Object} Program
|
|
397
|
-
* @property {number} a
|
|
398
|
-
* @property {INTRO|OUTRO} b
|
|
399
|
-
* @property {1|-1} d
|
|
400
|
-
* @property {number} duration
|
|
401
|
-
* @property {number} start
|
|
402
|
-
* @property {number} end
|
|
403
|
-
* @property {Outro} [group]
|
|
404
|
-
*/
|
|
405
|
-
|
|
406
|
-
/** @returns {void} */
|
|
407
|
-
function mount_component(component, target, anchor) {
|
|
408
|
-
const { fragment, after_update } = component.$$;
|
|
409
|
-
fragment && fragment.m(target, anchor);
|
|
410
|
-
// onMount happens before the initial afterUpdate
|
|
411
|
-
add_render_callback(() => {
|
|
412
|
-
const new_on_destroy = component.$$.on_mount.map(run).filter(is_function);
|
|
413
|
-
// if the component was destroyed immediately
|
|
414
|
-
// it will update the `$$.on_destroy` reference to `null`.
|
|
415
|
-
// the destructured on_destroy may still reference to the old array
|
|
416
|
-
if (component.$$.on_destroy) {
|
|
417
|
-
component.$$.on_destroy.push(...new_on_destroy);
|
|
418
|
-
} else {
|
|
419
|
-
// Edge case - component was destroyed immediately,
|
|
420
|
-
// most likely as a result of a binding initialising
|
|
421
|
-
run_all(new_on_destroy);
|
|
422
|
-
}
|
|
423
|
-
component.$$.on_mount = [];
|
|
424
|
-
});
|
|
425
|
-
after_update.forEach(add_render_callback);
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
/** @returns {void} */
|
|
429
|
-
function destroy_component(component, detaching) {
|
|
430
|
-
const $$ = component.$$;
|
|
431
|
-
if ($$.fragment !== null) {
|
|
432
|
-
flush_render_callbacks($$.after_update);
|
|
433
|
-
run_all($$.on_destroy);
|
|
434
|
-
$$.fragment && $$.fragment.d(detaching);
|
|
435
|
-
// TODO null out other refs, including component.$$ (but need to
|
|
436
|
-
// preserve final state?)
|
|
437
|
-
$$.on_destroy = $$.fragment = null;
|
|
438
|
-
$$.ctx = [];
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
/** @returns {void} */
|
|
443
|
-
function make_dirty(component, i) {
|
|
444
|
-
if (component.$$.dirty[0] === -1) {
|
|
445
|
-
dirty_components.push(component);
|
|
446
|
-
schedule_update();
|
|
447
|
-
component.$$.dirty.fill(0);
|
|
448
|
-
}
|
|
449
|
-
component.$$.dirty[(i / 31) | 0] |= 1 << i % 31;
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
/** @returns {void} */
|
|
453
|
-
function init(
|
|
454
|
-
component,
|
|
455
|
-
options,
|
|
456
|
-
instance,
|
|
457
|
-
create_fragment,
|
|
458
|
-
not_equal,
|
|
459
|
-
props,
|
|
460
|
-
append_styles,
|
|
461
|
-
dirty = [-1]
|
|
462
|
-
) {
|
|
463
|
-
const parent_component = current_component;
|
|
464
|
-
set_current_component(component);
|
|
465
|
-
/** @type {import('./private.js').T$$} */
|
|
466
|
-
const $$ = (component.$$ = {
|
|
467
|
-
fragment: null,
|
|
468
|
-
ctx: [],
|
|
469
|
-
// state
|
|
470
|
-
props,
|
|
471
|
-
update: noop,
|
|
472
|
-
not_equal,
|
|
473
|
-
bound: blank_object(),
|
|
474
|
-
// lifecycle
|
|
475
|
-
on_mount: [],
|
|
476
|
-
on_destroy: [],
|
|
477
|
-
on_disconnect: [],
|
|
478
|
-
before_update: [],
|
|
479
|
-
after_update: [],
|
|
480
|
-
context: new Map(options.context || (parent_component ? parent_component.$$.context : [])),
|
|
481
|
-
// everything else
|
|
482
|
-
callbacks: blank_object(),
|
|
483
|
-
dirty,
|
|
484
|
-
skip_bound: false,
|
|
485
|
-
root: options.target || parent_component.$$.root
|
|
486
|
-
});
|
|
487
|
-
append_styles && append_styles($$.root);
|
|
488
|
-
let ready = false;
|
|
489
|
-
$$.ctx = instance
|
|
490
|
-
? instance(component, options.props || {}, (i, ret, ...rest) => {
|
|
491
|
-
const value = rest.length ? rest[0] : ret;
|
|
492
|
-
if ($$.ctx && not_equal($$.ctx[i], ($$.ctx[i] = value))) {
|
|
493
|
-
if (!$$.skip_bound && $$.bound[i]) $$.bound[i](value);
|
|
494
|
-
if (ready) make_dirty(component, i);
|
|
495
|
-
}
|
|
496
|
-
return ret;
|
|
497
|
-
})
|
|
498
|
-
: [];
|
|
499
|
-
$$.update();
|
|
500
|
-
ready = true;
|
|
501
|
-
run_all($$.before_update);
|
|
502
|
-
// `false` as a special case of no DOM component
|
|
503
|
-
$$.fragment = create_fragment ? create_fragment($$.ctx) : false;
|
|
504
|
-
if (options.target) {
|
|
505
|
-
if (options.hydrate) {
|
|
506
|
-
const nodes = children(options.target);
|
|
507
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
508
|
-
$$.fragment && $$.fragment.l(nodes);
|
|
509
|
-
nodes.forEach(detach);
|
|
510
|
-
} else {
|
|
511
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
512
|
-
$$.fragment && $$.fragment.c();
|
|
513
|
-
}
|
|
514
|
-
if (options.intro) transition_in(component.$$.fragment);
|
|
515
|
-
mount_component(component, options.target, options.anchor);
|
|
516
|
-
flush();
|
|
517
|
-
}
|
|
518
|
-
set_current_component(parent_component);
|
|
519
|
-
}
|
|
520
|
-
|
|
521
|
-
/**
|
|
522
|
-
* Base class for Svelte components. Used when dev=false.
|
|
523
|
-
*
|
|
524
|
-
* @template {Record<string, any>} [Props=any]
|
|
525
|
-
* @template {Record<string, any>} [Events=any]
|
|
526
|
-
*/
|
|
527
|
-
class SvelteComponent {
|
|
528
|
-
/**
|
|
529
|
-
* ### PRIVATE API
|
|
530
|
-
*
|
|
531
|
-
* Do not use, may change at any time
|
|
532
|
-
*
|
|
533
|
-
* @type {any}
|
|
534
|
-
*/
|
|
535
|
-
$$ = undefined;
|
|
536
|
-
/**
|
|
537
|
-
* ### PRIVATE API
|
|
538
|
-
*
|
|
539
|
-
* Do not use, may change at any time
|
|
540
|
-
*
|
|
541
|
-
* @type {any}
|
|
542
|
-
*/
|
|
543
|
-
$$set = undefined;
|
|
544
|
-
|
|
545
|
-
/** @returns {void} */
|
|
546
|
-
$destroy() {
|
|
547
|
-
destroy_component(this, 1);
|
|
548
|
-
this.$destroy = noop;
|
|
549
|
-
}
|
|
550
|
-
|
|
551
|
-
/**
|
|
552
|
-
* @template {Extract<keyof Events, string>} K
|
|
553
|
-
* @param {K} type
|
|
554
|
-
* @param {((e: Events[K]) => void) | null | undefined} callback
|
|
555
|
-
* @returns {() => void}
|
|
556
|
-
*/
|
|
557
|
-
$on(type, callback) {
|
|
558
|
-
if (!is_function(callback)) {
|
|
559
|
-
return noop;
|
|
560
|
-
}
|
|
561
|
-
const callbacks = this.$$.callbacks[type] || (this.$$.callbacks[type] = []);
|
|
562
|
-
callbacks.push(callback);
|
|
563
|
-
return () => {
|
|
564
|
-
const index = callbacks.indexOf(callback);
|
|
565
|
-
if (index !== -1) callbacks.splice(index, 1);
|
|
566
|
-
};
|
|
567
|
-
}
|
|
568
|
-
|
|
569
|
-
/**
|
|
570
|
-
* @param {Partial<Props>} props
|
|
571
|
-
* @returns {void}
|
|
572
|
-
*/
|
|
573
|
-
$set(props) {
|
|
574
|
-
if (this.$$set && !is_empty(props)) {
|
|
575
|
-
this.$$.skip_bound = true;
|
|
576
|
-
this.$$set(props);
|
|
577
|
-
this.$$.skip_bound = false;
|
|
578
|
-
}
|
|
579
|
-
}
|
|
580
|
-
}
|
|
581
|
-
|
|
582
|
-
/**
|
|
583
|
-
* @typedef {Object} CustomElementPropDefinition
|
|
584
|
-
* @property {string} [attribute]
|
|
585
|
-
* @property {boolean} [reflect]
|
|
586
|
-
* @property {'String'|'Boolean'|'Number'|'Array'|'Object'} [type]
|
|
587
|
-
*/
|
|
588
|
-
|
|
589
|
-
// generated during release, do not modify
|
|
590
|
-
const PUBLIC_VERSION = '4';
|
|
591
|
-
|
|
592
|
-
if (typeof window !== 'undefined')
|
|
593
|
-
// @ts-ignore
|
|
594
|
-
(window.__svelte || (window.__svelte = { v: new Set() })).v.add(PUBLIC_VERSION);
|
|
595
|
-
|
|
596
|
-
/* src/IntersectionObserver.svelte generated by Svelte v4.1.0 */
|
|
597
|
-
|
|
598
|
-
const get_default_slot_changes = dirty => ({
|
|
599
|
-
intersecting: dirty & /*intersecting*/ 1,
|
|
600
|
-
entry: dirty & /*entry*/ 2,
|
|
601
|
-
observer: dirty & /*observer*/ 4
|
|
602
|
-
});
|
|
603
|
-
|
|
604
|
-
const get_default_slot_context = ctx => ({
|
|
605
|
-
intersecting: /*intersecting*/ ctx[0],
|
|
606
|
-
entry: /*entry*/ ctx[1],
|
|
607
|
-
observer: /*observer*/ ctx[2]
|
|
608
|
-
});
|
|
609
|
-
|
|
610
|
-
function create_fragment(ctx) {
|
|
611
|
-
let current;
|
|
612
|
-
const default_slot_template = /*#slots*/ ctx[9].default;
|
|
613
|
-
const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[8], get_default_slot_context);
|
|
614
|
-
|
|
615
|
-
return {
|
|
616
|
-
c() {
|
|
617
|
-
if (default_slot) default_slot.c();
|
|
618
|
-
},
|
|
619
|
-
m(target, anchor) {
|
|
620
|
-
if (default_slot) {
|
|
621
|
-
default_slot.m(target, anchor);
|
|
622
|
-
}
|
|
623
|
-
|
|
624
|
-
current = true;
|
|
625
|
-
},
|
|
626
|
-
p(ctx, [dirty]) {
|
|
627
|
-
if (default_slot) {
|
|
628
|
-
if (default_slot.p && (!current || dirty & /*$$scope, intersecting, entry, observer*/ 263)) {
|
|
629
|
-
update_slot_base(
|
|
630
|
-
default_slot,
|
|
631
|
-
default_slot_template,
|
|
632
|
-
ctx,
|
|
633
|
-
/*$$scope*/ ctx[8],
|
|
634
|
-
!current
|
|
635
|
-
? get_all_dirty_from_scope(/*$$scope*/ ctx[8])
|
|
636
|
-
: get_slot_changes(default_slot_template, /*$$scope*/ ctx[8], dirty, get_default_slot_changes),
|
|
637
|
-
get_default_slot_context
|
|
638
|
-
);
|
|
639
|
-
}
|
|
640
|
-
}
|
|
641
|
-
},
|
|
642
|
-
i(local) {
|
|
643
|
-
if (current) return;
|
|
644
|
-
transition_in(default_slot, local);
|
|
645
|
-
current = true;
|
|
646
|
-
},
|
|
647
|
-
o(local) {
|
|
648
|
-
transition_out(default_slot, local);
|
|
649
|
-
current = false;
|
|
650
|
-
},
|
|
651
|
-
d(detaching) {
|
|
652
|
-
if (default_slot) default_slot.d(detaching);
|
|
653
|
-
}
|
|
654
|
-
};
|
|
655
|
-
}
|
|
656
|
-
|
|
657
|
-
function instance($$self, $$props, $$invalidate) {
|
|
658
|
-
let { $$slots: slots = {}, $$scope } = $$props;
|
|
659
|
-
let { element = null } = $$props;
|
|
660
|
-
let { once = false } = $$props;
|
|
661
|
-
let { intersecting = false } = $$props;
|
|
662
|
-
let { root = null } = $$props;
|
|
663
|
-
let { rootMargin = "0px" } = $$props;
|
|
664
|
-
let { threshold = 0 } = $$props;
|
|
665
|
-
let { entry = null } = $$props;
|
|
666
|
-
let { observer = null } = $$props;
|
|
667
|
-
createEventDispatcher();
|
|
668
|
-
|
|
669
|
-
$$self.$$set = $$props => {
|
|
670
|
-
if ('element' in $$props) $$invalidate(3, element = $$props.element);
|
|
671
|
-
if ('once' in $$props) $$invalidate(4, once = $$props.once);
|
|
672
|
-
if ('intersecting' in $$props) $$invalidate(0, intersecting = $$props.intersecting);
|
|
673
|
-
if ('root' in $$props) $$invalidate(5, root = $$props.root);
|
|
674
|
-
if ('rootMargin' in $$props) $$invalidate(6, rootMargin = $$props.rootMargin);
|
|
675
|
-
if ('threshold' in $$props) $$invalidate(7, threshold = $$props.threshold);
|
|
676
|
-
if ('entry' in $$props) $$invalidate(1, entry = $$props.entry);
|
|
677
|
-
if ('observer' in $$props) $$invalidate(2, observer = $$props.observer);
|
|
678
|
-
if ('$$scope' in $$props) $$invalidate(8, $$scope = $$props.$$scope);
|
|
679
|
-
};
|
|
680
|
-
|
|
681
|
-
return [
|
|
682
|
-
intersecting,
|
|
683
|
-
entry,
|
|
684
|
-
observer,
|
|
685
|
-
element,
|
|
686
|
-
once,
|
|
687
|
-
root,
|
|
688
|
-
rootMargin,
|
|
689
|
-
threshold,
|
|
690
|
-
$$scope,
|
|
691
|
-
slots
|
|
692
|
-
];
|
|
693
|
-
}
|
|
694
|
-
|
|
695
|
-
class IntersectionObserver_1 extends SvelteComponent {
|
|
696
|
-
constructor(options) {
|
|
697
|
-
super();
|
|
698
|
-
|
|
699
|
-
init(this, options, instance, create_fragment, safe_not_equal, {
|
|
700
|
-
element: 3,
|
|
701
|
-
once: 4,
|
|
702
|
-
intersecting: 0,
|
|
703
|
-
root: 5,
|
|
704
|
-
rootMargin: 6,
|
|
705
|
-
threshold: 7,
|
|
706
|
-
entry: 1,
|
|
707
|
-
observer: 2
|
|
708
|
-
});
|
|
709
|
-
}
|
|
710
|
-
}
|
|
711
|
-
|
|
712
|
-
export { IntersectionObserver_1 as default };
|
package/src/index.js
DELETED