@ctx-core/scroll 12.0.79 → 14.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +35 -0
- package/dist/index.js +0 -3
- package/dist/index.js.map +1 -1
- package/dist/sticky_scroll_active$_b.js.map +1 -1
- package/package.json +12 -15
- package/src/index.ts +0 -3
- package/src/sticky_scroll_active$_b.ts +1 -2
- package/dist/scroll_Ctx.js +0 -3
- package/dist/scroll_Ctx.js.map +0 -1
- package/dist/scroll_ctx_I.generated.js +0 -5
- package/dist/scroll_ctx_I.generated.js.map +0 -1
- package/dist/ui/Sticky_Scroll.svelte +0 -91
- package/dist/ui/index.js +0 -5
- package/dist/ui/index.js.map +0 -1
- package/src/scroll_Ctx.ts +0 -3
- package/src/scroll_ctx_I.generated.ts +0 -7
- package/src/ui/Sticky_Scroll.svelte +0 -91
- package/src/ui/index.ts +0 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,40 @@
|
|
|
1
1
|
# @ctx-core/scroll
|
|
2
2
|
|
|
3
|
+
## 14.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- package.json: svelte: ./dist/index.js
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @ctx-core/object@22.0.1
|
|
10
|
+
- @ctx-core/store@27.0.48
|
|
11
|
+
|
|
12
|
+
## 14.0.0
|
|
13
|
+
|
|
14
|
+
### Major Changes
|
|
15
|
+
|
|
16
|
+
- extracted @ctx-core/scroll-ui-svelte
|
|
17
|
+
|
|
18
|
+
## 13.0.0
|
|
19
|
+
|
|
20
|
+
### Major Changes
|
|
21
|
+
|
|
22
|
+
- \*\_b: ctx is a map: @ctx-core/object: 22.0.0
|
|
23
|
+
|
|
24
|
+
### Patch Changes
|
|
25
|
+
|
|
26
|
+
- package.json: - module
|
|
27
|
+
- Updated dependencies
|
|
28
|
+
- Updated dependencies
|
|
29
|
+
- @ctx-core/object@22.0.0
|
|
30
|
+
- @ctx-core/store@27.0.46
|
|
31
|
+
|
|
32
|
+
## 12.0.80
|
|
33
|
+
|
|
34
|
+
### Patch Changes
|
|
35
|
+
|
|
36
|
+
- update dependencies
|
|
37
|
+
|
|
3
38
|
## 12.0.79
|
|
4
39
|
|
|
5
40
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
export * from './scroll_Ctx.js';
|
|
2
|
-
export * from './scroll_ctx_I.generated.js';
|
|
3
1
|
export * from './is_active_.js';
|
|
4
2
|
export * from './is_visible_.js';
|
|
5
3
|
export * from './out_is_active_.js';
|
|
6
4
|
export * from './out_is_visible_.js';
|
|
7
5
|
export * from './sticky_scroll_active$_b.js';
|
|
8
|
-
export * from './ui/index.js';
|
|
9
6
|
|
|
10
7
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from './
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * 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'\n"],"names":[],"mappings":"cAAc,CAAiB;cACjB,CAAkB;cAClB,CAAqB;cACrB,CAAsB;cACtB,CAA8B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/sticky_scroll_active$_b.ts"],"sourcesContent":["import { assign, b_, B } from '@ctx-core/object'\nimport { writable$, Writable$ } from '@ctx-core/store'\
|
|
1
|
+
{"version":3,"sources":["../src/sticky_scroll_active$_b.ts"],"sourcesContent":["import { assign, b_, B } from '@ctx-core/object'\nimport { writable$, Writable$ } from '@ctx-core/store'\nconst key = 'sticky_scroll_active$'\nexport const sticky_scroll_active$_b:B<sticky_scroll_active$_T> = b_(key, ()=>{\n\tconst sticky_scroll_active$ = writable$<sticky_scroll_active_T>({})\n\treturn assign(sticky_scroll_active$, {\n\t\tadd_sticky_scroll_active,\n\t\tremove_sticky_scroll_active,\n\t\tsticky_scroll_active_key_active_,\n\t\tsticky_scroll_active_key_match_,\n\t}) as sticky_scroll_active$_T\n\tfunction add_sticky_scroll_active(key:string) {\n\t\tsticky_scroll_active$.update(\n\t\t\tscroll_sticky_active=>{\n\t\t\t\tscroll_sticky_active[key] = true\n\t\t\t\treturn scroll_sticky_active\n\t\t\t})\n\t}\n\tfunction remove_sticky_scroll_active(key:string) {\n\t\tsticky_scroll_active$.update(\n\t\t\tscroll_sticky_active=>{\n\t\t\t\tscroll_sticky_active[key] = false\n\t\t\t\treturn scroll_sticky_active\n\t\t\t})\n\t}\n\tfunction sticky_scroll_active_key_active_(key:string) {\n\t\tconst sticky_scroll_active = sticky_scroll_active$.$\n\t\tconst active =\n\t\t\tsticky_scroll_active\n\t\t\t? sticky_scroll_active[key]\n\t\t\t: false\n\t\treturn active\n\t}\n\tfunction sticky_scroll_active_key_match_(key:string, active:boolean) {\n\t\treturn !!(active) == !!(sticky_scroll_active_key_active_(key))\n\t}\n})\nexport interface sticky_scroll_active_T extends Record<string, boolean> {}\nexport interface sticky_scroll_active$_T extends Writable$<sticky_scroll_active_T> {\n\tadd_sticky_scroll_active:(key:string)=>void\n\tremove_sticky_scroll_active:(key:string)=>void\n\tsticky_scroll_active_key_active_:(key:string)=>void\n\tsticky_scroll_active_key_match_:(key:string, active:any)=>void\n}\nexport {\n\tsticky_scroll_active$_b as b__active__Sticky__Scroll,\n}\n"],"names":["assign","b_","writable$","key","sticky_scroll_active$_b","sticky_scroll_active$","add_sticky_scroll_active","remove_sticky_scroll_active","sticky_scroll_active_key_active_","sticky_scroll_active_key_match_","update","scroll_sticky_active","sticky_scroll_active","$","active","b__active__Sticky__Scroll"],"mappings":"AAAA,MAAM,GAAGA,MAAM,EAAEC,EAAE,QAAW,CAAkB;AAChD,MAAM,GAAGC,SAAS,QAAmB,CAAiB;AACtD,KAAK,CAACC,GAAG,GAAG,CAAuB;AACnC,MAAM,CAAC,KAAK,CAACC,uBAAuB,GAA8BH,EAAE,CAACE,GAAG,MAAM,CAAC;IAC9E,KAAK,CAACE,qBAAqB,GAAGH,SAAS,CAAyB,CAAC;IAAA,CAAC;IAClE,MAAM,CAACF,MAAM,CAACK,qBAAqB,EAAE,CAAC;QACrCC,wBAAwB;QACxBC,2BAA2B;QAC3BC,gCAAgC;QAChCC,+BAA+B;IAChC,CAAC;aACQH,wBAAwB,CAACH,GAAU,EAAE,CAAC;QAC9CE,qBAAqB,CAACK,MAAM,EAC3BC,oBAAoB,GAAE,CAAC;YACtBA,oBAAoB,CAACR,GAAG,IAAI,IAAI;YAChC,MAAM,CAACQ,oBAAoB;QAC5B,CAAC;IACH,CAAC;aACQJ,2BAA2B,CAACJ,GAAU,EAAE,CAAC;QACjDE,qBAAqB,CAACK,MAAM,EAC3BC,oBAAoB,GAAE,CAAC;YACtBA,oBAAoB,CAACR,GAAG,IAAI,KAAK;YACjC,MAAM,CAACQ,oBAAoB;QAC5B,CAAC;IACH,CAAC;aACQH,gCAAgC,CAACL,GAAU,EAAE,CAAC;QACtD,KAAK,CAACS,oBAAoB,GAAGP,qBAAqB,CAACQ,CAAC;QACpD,KAAK,CAACC,MAAM,GACXF,oBAAoB,GAClBA,oBAAoB,CAACT,GAAG,IACxB,KAAK;QACR,MAAM,CAACW,MAAM;IACd,CAAC;aACQL,+BAA+B,CAACN,IAAU,EAAEW,MAAc,EAAE,CAAC;QACrE,MAAM,GAAIA,MAAM,MAAQN,gCAAgC,CAACL,IAAG;IAC7D,CAAC;AACF,CAAC;AAQD,MAAM,GACLC,uBAAuB,IAAIW,yBAAyB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ctx-core/scroll",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "14.0.1",
|
|
4
4
|
"description": "ctx-core scroll",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ctx-core",
|
|
@@ -17,36 +17,33 @@
|
|
|
17
17
|
"license": "Apache-2.0",
|
|
18
18
|
"author": "Brian Takita",
|
|
19
19
|
"type": "module",
|
|
20
|
-
"module": "./dist/index.js",
|
|
21
|
-
"types": "./src/index.ts",
|
|
22
20
|
"exports": {
|
|
23
21
|
".": {
|
|
24
|
-
"
|
|
22
|
+
"types": "./src/index.ts",
|
|
25
23
|
"import": "./dist/index.js"
|
|
26
24
|
},
|
|
27
25
|
"./package.json": "./package.json"
|
|
28
26
|
},
|
|
29
27
|
"dependencies": {
|
|
30
|
-
"@ctx-core/object": "^
|
|
31
|
-
"@ctx-core/store": "^27.0.
|
|
32
|
-
"svelte": "3.44.2"
|
|
28
|
+
"@ctx-core/object": "^22.0.1",
|
|
29
|
+
"@ctx-core/store": "^27.0.48"
|
|
33
30
|
},
|
|
34
31
|
"devDependencies": {
|
|
35
|
-
"@ctx-core/ctx-core-package-tools": "^8.0.
|
|
36
|
-
"@
|
|
37
|
-
"@swc/
|
|
38
|
-
"
|
|
32
|
+
"@ctx-core/ctx-core-package-tools": "^8.0.88",
|
|
33
|
+
"@swc/cli": "^0.1.55",
|
|
34
|
+
"@swc/core": "^1.2.120",
|
|
35
|
+
"rimraf": "^3.0.2",
|
|
39
36
|
"typescript": "next"
|
|
40
37
|
},
|
|
41
38
|
"publishConfig": {
|
|
42
39
|
"access": "public",
|
|
43
40
|
"cache": "~/.npm"
|
|
44
41
|
},
|
|
42
|
+
"svelte": "index.js",
|
|
45
43
|
"scripts": {
|
|
46
|
-
"build": "npm run
|
|
47
|
-
"clean": "
|
|
44
|
+
"build": "npm run compile",
|
|
45
|
+
"clean": "rimraf dist",
|
|
48
46
|
"compile": "swc src --out-dir dist --copy-files --source-maps --config-file .swcrc",
|
|
49
|
-
"exec": "$@"
|
|
50
|
-
"generate_ctx_I_file": "swc $(./node_modules/.bin/generate_ctx_I_file | tail -n1) --out-dir dist --source-maps --config-file .swcrc"
|
|
47
|
+
"exec": "$@"
|
|
51
48
|
}
|
|
52
49
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
export * from './scroll_Ctx.js'
|
|
2
|
-
export * from './scroll_ctx_I.generated.js'
|
|
3
1
|
export * from './is_active_.js'
|
|
4
2
|
export * from './is_visible_.js'
|
|
5
3
|
export * from './out_is_active_.js'
|
|
6
4
|
export * from './out_is_visible_.js'
|
|
7
5
|
export * from './sticky_scroll_active$_b.js'
|
|
8
|
-
export * from './ui/index.js'
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { assign, b_, B } from '@ctx-core/object'
|
|
2
2
|
import { writable$, Writable$ } from '@ctx-core/store'
|
|
3
|
-
import type { scroll_Ctx } from './scroll_Ctx'
|
|
4
3
|
const key = 'sticky_scroll_active$'
|
|
5
|
-
export const sticky_scroll_active$_b:B<
|
|
4
|
+
export const sticky_scroll_active$_b:B<sticky_scroll_active$_T> = b_(key, ()=>{
|
|
6
5
|
const sticky_scroll_active$ = writable$<sticky_scroll_active_T>({})
|
|
7
6
|
return assign(sticky_scroll_active$, {
|
|
8
7
|
add_sticky_scroll_active,
|
package/dist/scroll_Ctx.js
DELETED
package/dist/scroll_Ctx.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/scroll_Ctx.ts"],"sourcesContent":["import type { scroll_ctx_I } from './scroll_ctx_I.generated.js'\nexport interface scroll_Ctx extends scroll_ctx_I {\n}\n"],"names":[],"mappings":"AAAA,MAAM"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/scroll_ctx_I.generated.ts"],"sourcesContent":["/*\n * This file was generated by `npm run generate_ctx_I_file` in @ctx-core/dev-tools\n*/\nimport type { sticky_scroll_active$_T } from './sticky_scroll_active$_b.js'\nexport interface scroll_ctx_I {\n\tsticky_scroll_active$?:sticky_scroll_active$_T\n}"],"names":[],"mappings":"AAAA,EAEE,AAFF;;AAEE,AAFF,EAEE,CACF,MAAM"}
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { onMount, onDestroy, createEventDispatcher } from 'svelte'
|
|
3
|
-
import { out_is_active_ } from '../out_is_active_.js'
|
|
4
|
-
import { out_is_visible_ } from '../out_is_visible_.js'
|
|
5
|
-
const dispatch = createEventDispatcher()
|
|
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()
|
|
11
|
-
if (terminal) {
|
|
12
|
-
terminal.addEventListener('scroll', reset)
|
|
13
|
-
}
|
|
14
|
-
})
|
|
15
|
-
onDestroy(()=>{
|
|
16
|
-
if (terminal) {
|
|
17
|
-
terminal.removeEventListener('scroll', reset)
|
|
18
|
-
}
|
|
19
|
-
if (contains_visible()) {
|
|
20
|
-
remove_visible()
|
|
21
|
-
}
|
|
22
|
-
if (contains_active()) {
|
|
23
|
-
remove_active()
|
|
24
|
-
}
|
|
25
|
-
})
|
|
26
|
-
function reset() {
|
|
27
|
-
const { top, bottom } = getBoundingClientRect()
|
|
28
|
-
const { innerHeight } = window
|
|
29
|
-
const out_is_active = out_is_active_(top, bottom)
|
|
30
|
-
const out_is_visible = out_is_visible_(top, bottom, innerHeight)
|
|
31
|
-
if (out_is_visible) {
|
|
32
|
-
if (!visible) {
|
|
33
|
-
add_visible()
|
|
34
|
-
}
|
|
35
|
-
} else {
|
|
36
|
-
if (visible) {
|
|
37
|
-
remove_visible()
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
if (out_is_active) {
|
|
41
|
-
if (!active) {
|
|
42
|
-
add_active()
|
|
43
|
-
}
|
|
44
|
-
} else {
|
|
45
|
-
if (active) {
|
|
46
|
-
remove_active()
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
function add_active() {
|
|
51
|
-
active = true
|
|
52
|
-
dispatch('add_active', event_())
|
|
53
|
-
}
|
|
54
|
-
function remove_active() {
|
|
55
|
-
active = false
|
|
56
|
-
dispatch('remove_active', event_())
|
|
57
|
-
}
|
|
58
|
-
function add_visible() {
|
|
59
|
-
visible = true
|
|
60
|
-
dispatch('add_visible', event_())
|
|
61
|
-
}
|
|
62
|
-
function remove_visible() {
|
|
63
|
-
visible = false
|
|
64
|
-
dispatch('remove_visible', event_())
|
|
65
|
-
}
|
|
66
|
-
function default_getBoundingClientRect():DOMRect {
|
|
67
|
-
return root!.getBoundingClientRect()
|
|
68
|
-
}
|
|
69
|
-
function contains_visible() {
|
|
70
|
-
return root!.classList.contains('visible')
|
|
71
|
-
}
|
|
72
|
-
function contains_active() {
|
|
73
|
-
return root!.classList.contains('active')
|
|
74
|
-
}
|
|
75
|
-
function event_() {
|
|
76
|
-
return {
|
|
77
|
-
root,
|
|
78
|
-
target: root,
|
|
79
|
-
currentTarget: root,
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
</script>
|
|
83
|
-
|
|
84
|
-
<svelte:window
|
|
85
|
-
on:scroll={reset}
|
|
86
|
-
on:resize={reset}
|
|
87
|
-
/>
|
|
88
|
-
|
|
89
|
-
<div bind:this={root} class="Sticky_Scroll {$$props.class||''}" class:active>
|
|
90
|
-
<slot></slot>
|
|
91
|
-
</div>
|
package/dist/ui/index.js
DELETED
package/dist/ui/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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/src/scroll_Ctx.ts
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { onMount, onDestroy, createEventDispatcher } from 'svelte'
|
|
3
|
-
import { out_is_active_ } from '../out_is_active_.js'
|
|
4
|
-
import { out_is_visible_ } from '../out_is_visible_.js'
|
|
5
|
-
const dispatch = createEventDispatcher()
|
|
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()
|
|
11
|
-
if (terminal) {
|
|
12
|
-
terminal.addEventListener('scroll', reset)
|
|
13
|
-
}
|
|
14
|
-
})
|
|
15
|
-
onDestroy(()=>{
|
|
16
|
-
if (terminal) {
|
|
17
|
-
terminal.removeEventListener('scroll', reset)
|
|
18
|
-
}
|
|
19
|
-
if (contains_visible()) {
|
|
20
|
-
remove_visible()
|
|
21
|
-
}
|
|
22
|
-
if (contains_active()) {
|
|
23
|
-
remove_active()
|
|
24
|
-
}
|
|
25
|
-
})
|
|
26
|
-
function reset() {
|
|
27
|
-
const { top, bottom } = getBoundingClientRect()
|
|
28
|
-
const { innerHeight } = window
|
|
29
|
-
const out_is_active = out_is_active_(top, bottom)
|
|
30
|
-
const out_is_visible = out_is_visible_(top, bottom, innerHeight)
|
|
31
|
-
if (out_is_visible) {
|
|
32
|
-
if (!visible) {
|
|
33
|
-
add_visible()
|
|
34
|
-
}
|
|
35
|
-
} else {
|
|
36
|
-
if (visible) {
|
|
37
|
-
remove_visible()
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
if (out_is_active) {
|
|
41
|
-
if (!active) {
|
|
42
|
-
add_active()
|
|
43
|
-
}
|
|
44
|
-
} else {
|
|
45
|
-
if (active) {
|
|
46
|
-
remove_active()
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
function add_active() {
|
|
51
|
-
active = true
|
|
52
|
-
dispatch('add_active', event_())
|
|
53
|
-
}
|
|
54
|
-
function remove_active() {
|
|
55
|
-
active = false
|
|
56
|
-
dispatch('remove_active', event_())
|
|
57
|
-
}
|
|
58
|
-
function add_visible() {
|
|
59
|
-
visible = true
|
|
60
|
-
dispatch('add_visible', event_())
|
|
61
|
-
}
|
|
62
|
-
function remove_visible() {
|
|
63
|
-
visible = false
|
|
64
|
-
dispatch('remove_visible', event_())
|
|
65
|
-
}
|
|
66
|
-
function default_getBoundingClientRect():DOMRect {
|
|
67
|
-
return root!.getBoundingClientRect()
|
|
68
|
-
}
|
|
69
|
-
function contains_visible() {
|
|
70
|
-
return root!.classList.contains('visible')
|
|
71
|
-
}
|
|
72
|
-
function contains_active() {
|
|
73
|
-
return root!.classList.contains('active')
|
|
74
|
-
}
|
|
75
|
-
function event_() {
|
|
76
|
-
return {
|
|
77
|
-
root,
|
|
78
|
-
target: root,
|
|
79
|
-
currentTarget: root,
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
</script>
|
|
83
|
-
|
|
84
|
-
<svelte:window
|
|
85
|
-
on:scroll={reset}
|
|
86
|
-
on:resize={reset}
|
|
87
|
-
/>
|
|
88
|
-
|
|
89
|
-
<div bind:this={root} class="Sticky_Scroll {$$props.class||''}" class:active>
|
|
90
|
-
<slot></slot>
|
|
91
|
-
</div>
|
package/src/ui/index.ts
DELETED