@ctx-core/scroll 12.0.70 → 12.0.71
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/CHANGELOG.md +6 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/ui/Sticky_Scroll.svelte +26 -40
- package/dist/ui/index.js +2 -2
- package/dist/ui/index.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +1 -1
- package/src/ui/Sticky_Scroll.svelte +26 -40
- package/src/ui/index.ts +1 -2
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from './scroll_Ctx.js'\nexport * from './scroll_ctx_I.generated.js'\nexport * from './is_active_.js'\nexport * from './is_visible_.js'\nexport * from './out_is_active_.js'\nexport * from './out_is_visible_.js'\nexport * from './sticky_scroll_active$_b.js'\nexport * from './ui'\n"],"names":[],"mappings":"cAAc,CAAiB;cACjB,CAA6B;cAC7B,CAAiB;cACjB,CAAkB;cAClB,CAAqB;cACrB,CAAsB;cACtB,CAA8B;cAC9B,
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from './scroll_Ctx.js'\nexport * from './scroll_ctx_I.generated.js'\nexport * from './is_active_.js'\nexport * from './is_visible_.js'\nexport * from './out_is_active_.js'\nexport * from './out_is_visible_.js'\nexport * from './sticky_scroll_active$_b.js'\nexport * from './ui/index.js'\n"],"names":[],"mappings":"cAAc,CAAiB;cACjB,CAA6B;cAC7B,CAAiB;cACjB,CAAkB;cAClB,CAAqB;cACrB,CAAsB;cACtB,CAA8B;cAC9B,CAAe"}
|
|
@@ -1,30 +1,20 @@
|
|
|
1
|
-
<script>
|
|
1
|
+
<script lang="ts">
|
|
2
2
|
import { onMount, onDestroy, createEventDispatcher } from 'svelte'
|
|
3
|
-
import { out_is_active_ } from '../out_is_active_'
|
|
4
|
-
import { out_is_visible_ } from '../out_is_visible_'
|
|
3
|
+
import { out_is_active_ } from '../out_is_active_.js'
|
|
4
|
+
import { out_is_visible_ } from '../out_is_visible_.js'
|
|
5
5
|
const dispatch = createEventDispatcher()
|
|
6
|
-
let
|
|
7
|
-
let
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
onMount(() => {
|
|
12
|
-
reset({})
|
|
6
|
+
export let terminal:HTMLElement|null = null
|
|
7
|
+
let getBoundingClientRect = default_getBoundingClientRect, root:HTMLDivElement|null = null,
|
|
8
|
+
active:boolean, visible:boolean
|
|
9
|
+
onMount(()=>{
|
|
10
|
+
reset()
|
|
13
11
|
if (terminal) {
|
|
14
|
-
|
|
15
|
-
terminal.addEventListener('scroll', reset)
|
|
16
|
-
} else if (terminal.on) {
|
|
17
|
-
terminal.on('scroll', reset)
|
|
18
|
-
}
|
|
12
|
+
terminal.addEventListener('scroll', reset)
|
|
19
13
|
}
|
|
20
14
|
})
|
|
21
|
-
onDestroy(()
|
|
15
|
+
onDestroy(()=>{
|
|
22
16
|
if (terminal) {
|
|
23
|
-
|
|
24
|
-
terminal.removeEventListener('scroll', reset)
|
|
25
|
-
} else if (terminal.off) {
|
|
26
|
-
terminal.off('scroll', reset)
|
|
27
|
-
}
|
|
17
|
+
terminal.removeEventListener('scroll', reset)
|
|
28
18
|
}
|
|
29
19
|
if (contains_visible()) {
|
|
30
20
|
remove_visible()
|
|
@@ -33,10 +23,10 @@ onDestroy(() => {
|
|
|
33
23
|
remove_active()
|
|
34
24
|
}
|
|
35
25
|
})
|
|
36
|
-
function reset(
|
|
37
|
-
const { top, bottom } = getBoundingClientRect(
|
|
26
|
+
function reset() {
|
|
27
|
+
const { top, bottom } = getBoundingClientRect()
|
|
38
28
|
const { innerHeight } = window
|
|
39
|
-
const out_is_active= out_is_active_(top, bottom)
|
|
29
|
+
const out_is_active = out_is_active_(top, bottom)
|
|
40
30
|
const out_is_visible = out_is_visible_(top, bottom, innerHeight)
|
|
41
31
|
if (out_is_visible) {
|
|
42
32
|
if (!visible) {
|
|
@@ -59,30 +49,30 @@ function reset(event) {
|
|
|
59
49
|
}
|
|
60
50
|
function add_active() {
|
|
61
51
|
active = true
|
|
62
|
-
dispatch('add_active',
|
|
52
|
+
dispatch('add_active', event_())
|
|
63
53
|
}
|
|
64
54
|
function remove_active() {
|
|
65
55
|
active = false
|
|
66
|
-
dispatch('remove_active',
|
|
56
|
+
dispatch('remove_active', event_())
|
|
67
57
|
}
|
|
68
58
|
function add_visible() {
|
|
69
59
|
visible = true
|
|
70
|
-
dispatch('add_visible',
|
|
60
|
+
dispatch('add_visible', event_())
|
|
71
61
|
}
|
|
72
62
|
function remove_visible() {
|
|
73
63
|
visible = false
|
|
74
|
-
dispatch('remove_visible',
|
|
64
|
+
dispatch('remove_visible', event_())
|
|
75
65
|
}
|
|
76
|
-
function default_getBoundingClientRect() {
|
|
77
|
-
return root
|
|
66
|
+
function default_getBoundingClientRect():DOMRect {
|
|
67
|
+
return root!.getBoundingClientRect()
|
|
78
68
|
}
|
|
79
69
|
function contains_visible() {
|
|
80
|
-
return root
|
|
70
|
+
return root!.classList.contains('visible')
|
|
81
71
|
}
|
|
82
72
|
function contains_active() {
|
|
83
|
-
return root
|
|
73
|
+
return root!.classList.contains('active')
|
|
84
74
|
}
|
|
85
|
-
function
|
|
75
|
+
function event_() {
|
|
86
76
|
return {
|
|
87
77
|
root,
|
|
88
78
|
target: root,
|
|
@@ -92,14 +82,10 @@ function _event() {
|
|
|
92
82
|
</script>
|
|
93
83
|
|
|
94
84
|
<svelte:window
|
|
95
|
-
on:scroll=
|
|
96
|
-
on:resize=
|
|
85
|
+
on:scroll={reset}
|
|
86
|
+
on:resize={reset}
|
|
97
87
|
/>
|
|
98
88
|
|
|
99
|
-
<div
|
|
100
|
-
bind:this="{root}"
|
|
101
|
-
class="Sticky_Scroll {$$props.class||''}"
|
|
102
|
-
class:active="{active}"
|
|
103
|
-
>
|
|
89
|
+
<div bind:this={root} class="Sticky_Scroll {$$props.class||''}" class:active>
|
|
104
90
|
<slot></slot>
|
|
105
91
|
</div>
|
package/dist/ui/index.js
CHANGED
package/dist/ui/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/ui/index.ts"],"sourcesContent":["import 'svelte'\
|
|
1
|
+
{"version":3,"sources":["../../src/ui/index.ts"],"sourcesContent":["import 'svelte'\nexport * as Sticky_Scroll from './Sticky_Scroll.svelte'\n"],"names":["Sticky_Scroll"],"mappings":"AAAA,MAAM,CAAC,CAAQ;YACHA,cAAa,MAAM,CAAwB;SAA3CA,cAAa,IAAbA,aAAa"}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -1,30 +1,20 @@
|
|
|
1
|
-
<script>
|
|
1
|
+
<script lang="ts">
|
|
2
2
|
import { onMount, onDestroy, createEventDispatcher } from 'svelte'
|
|
3
|
-
import { out_is_active_ } from '../out_is_active_'
|
|
4
|
-
import { out_is_visible_ } from '../out_is_visible_'
|
|
3
|
+
import { out_is_active_ } from '../out_is_active_.js'
|
|
4
|
+
import { out_is_visible_ } from '../out_is_visible_.js'
|
|
5
5
|
const dispatch = createEventDispatcher()
|
|
6
|
-
let
|
|
7
|
-
let
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
onMount(() => {
|
|
12
|
-
reset({})
|
|
6
|
+
export let terminal:HTMLElement|null = null
|
|
7
|
+
let getBoundingClientRect = default_getBoundingClientRect, root:HTMLDivElement|null = null,
|
|
8
|
+
active:boolean, visible:boolean
|
|
9
|
+
onMount(()=>{
|
|
10
|
+
reset()
|
|
13
11
|
if (terminal) {
|
|
14
|
-
|
|
15
|
-
terminal.addEventListener('scroll', reset)
|
|
16
|
-
} else if (terminal.on) {
|
|
17
|
-
terminal.on('scroll', reset)
|
|
18
|
-
}
|
|
12
|
+
terminal.addEventListener('scroll', reset)
|
|
19
13
|
}
|
|
20
14
|
})
|
|
21
|
-
onDestroy(()
|
|
15
|
+
onDestroy(()=>{
|
|
22
16
|
if (terminal) {
|
|
23
|
-
|
|
24
|
-
terminal.removeEventListener('scroll', reset)
|
|
25
|
-
} else if (terminal.off) {
|
|
26
|
-
terminal.off('scroll', reset)
|
|
27
|
-
}
|
|
17
|
+
terminal.removeEventListener('scroll', reset)
|
|
28
18
|
}
|
|
29
19
|
if (contains_visible()) {
|
|
30
20
|
remove_visible()
|
|
@@ -33,10 +23,10 @@ onDestroy(() => {
|
|
|
33
23
|
remove_active()
|
|
34
24
|
}
|
|
35
25
|
})
|
|
36
|
-
function reset(
|
|
37
|
-
const { top, bottom } = getBoundingClientRect(
|
|
26
|
+
function reset() {
|
|
27
|
+
const { top, bottom } = getBoundingClientRect()
|
|
38
28
|
const { innerHeight } = window
|
|
39
|
-
const out_is_active= out_is_active_(top, bottom)
|
|
29
|
+
const out_is_active = out_is_active_(top, bottom)
|
|
40
30
|
const out_is_visible = out_is_visible_(top, bottom, innerHeight)
|
|
41
31
|
if (out_is_visible) {
|
|
42
32
|
if (!visible) {
|
|
@@ -59,30 +49,30 @@ function reset(event) {
|
|
|
59
49
|
}
|
|
60
50
|
function add_active() {
|
|
61
51
|
active = true
|
|
62
|
-
dispatch('add_active',
|
|
52
|
+
dispatch('add_active', event_())
|
|
63
53
|
}
|
|
64
54
|
function remove_active() {
|
|
65
55
|
active = false
|
|
66
|
-
dispatch('remove_active',
|
|
56
|
+
dispatch('remove_active', event_())
|
|
67
57
|
}
|
|
68
58
|
function add_visible() {
|
|
69
59
|
visible = true
|
|
70
|
-
dispatch('add_visible',
|
|
60
|
+
dispatch('add_visible', event_())
|
|
71
61
|
}
|
|
72
62
|
function remove_visible() {
|
|
73
63
|
visible = false
|
|
74
|
-
dispatch('remove_visible',
|
|
64
|
+
dispatch('remove_visible', event_())
|
|
75
65
|
}
|
|
76
|
-
function default_getBoundingClientRect() {
|
|
77
|
-
return root
|
|
66
|
+
function default_getBoundingClientRect():DOMRect {
|
|
67
|
+
return root!.getBoundingClientRect()
|
|
78
68
|
}
|
|
79
69
|
function contains_visible() {
|
|
80
|
-
return root
|
|
70
|
+
return root!.classList.contains('visible')
|
|
81
71
|
}
|
|
82
72
|
function contains_active() {
|
|
83
|
-
return root
|
|
73
|
+
return root!.classList.contains('active')
|
|
84
74
|
}
|
|
85
|
-
function
|
|
75
|
+
function event_() {
|
|
86
76
|
return {
|
|
87
77
|
root,
|
|
88
78
|
target: root,
|
|
@@ -92,14 +82,10 @@ function _event() {
|
|
|
92
82
|
</script>
|
|
93
83
|
|
|
94
84
|
<svelte:window
|
|
95
|
-
on:scroll=
|
|
96
|
-
on:resize=
|
|
85
|
+
on:scroll={reset}
|
|
86
|
+
on:resize={reset}
|
|
97
87
|
/>
|
|
98
88
|
|
|
99
|
-
<div
|
|
100
|
-
bind:this="{root}"
|
|
101
|
-
class="Sticky_Scroll {$$props.class||''}"
|
|
102
|
-
class:active="{active}"
|
|
103
|
-
>
|
|
89
|
+
<div bind:this={root} class="Sticky_Scroll {$$props.class||''}" class:active>
|
|
104
90
|
<slot></slot>
|
|
105
91
|
</div>
|
package/src/ui/index.ts
CHANGED