@ctx-core/scroll 12.0.65 → 12.0.70

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/.swcrc ADDED
@@ -0,0 +1,10 @@
1
+ {
2
+ "jsc": {
3
+ "target": "es2019",
4
+ "parser": {
5
+ "syntax": "typescript",
6
+ "tsx": true,
7
+ "dynamicImport": true
8
+ }
9
+ }
10
+ }
package/CHANGELOG.md CHANGED
@@ -1,5 +1,48 @@
1
1
  # @ctx-core/scroll
2
2
 
3
+ ## 12.0.70
4
+
5
+ ### Patch Changes
6
+
7
+ - @swc/core: ^1.2.107 -> ^1.2.108
8
+ - Updated dependencies
9
+ - @ctx-core/object@21.0.23
10
+ - @ctx-core/store@27.0.37
11
+
12
+ ## 12.0.69
13
+
14
+ ### Patch Changes
15
+
16
+ - compile using swc
17
+ - Updated dependencies
18
+ - @ctx-core/object@21.0.22
19
+ - @ctx-core/store@27.0.36
20
+
21
+ ## 12.0.68
22
+
23
+ ### Patch Changes
24
+
25
+ - svelte: 3.44.0 -> 3.44.1
26
+ - Updated dependencies [undefined]
27
+ - @ctx-core/store@27.0.35
28
+
29
+ ## 12.0.67
30
+
31
+ ### Patch Changes
32
+
33
+ - typescript: ^4.4.3 -> ^4.4.4
34
+ - svelte: 3.43.1 -> 3.44.0
35
+ - Updated dependencies [undefined]
36
+ - Updated dependencies [undefined]
37
+ - @ctx-core/object@21.0.21
38
+ - @ctx-core/store@27.0.34
39
+
40
+ ## 12.0.66
41
+
42
+ ### Patch Changes
43
+
44
+ - update dependencies
45
+
3
46
  ## 12.0.65
4
47
 
5
48
  ### Patch Changes
package/dist/index.js CHANGED
@@ -6,4 +6,5 @@ export * from './out_is_active_.js';
6
6
  export * from './out_is_visible_.js';
7
7
  export * from './sticky_scroll_active$_b.js';
8
8
  export * from './ui';
9
+
9
10
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA;AAC/B,cAAc,6BAA6B,CAAA;AAC3C,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA;AAChC,cAAc,qBAAqB,CAAA;AACnC,cAAc,sBAAsB,CAAA;AACpC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,MAAM,CAAA"}
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,CAAM"}
@@ -1,7 +1,8 @@
1
1
  import { out_is_active_ } from './out_is_active_.js';
2
2
  export function is_active_(el) {
3
- const { top, bottom } = el.getBoundingClientRect();
3
+ const { top , bottom } = el.getBoundingClientRect();
4
4
  return out_is_active_(top, bottom);
5
5
  }
6
- export { is_active_ as _is_active, };
6
+ export { is_active_ as _is_active, };
7
+
7
8
  //# sourceMappingURL=is_active_.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"is_active_.js","sourceRoot":"","sources":["../src/is_active_.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,MAAM,UAAU,UAAU,CAAC,EAAc;IACxC,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,qBAAqB,EAAE,CAAA;IAClD,OAAO,cAAc,CAAC,GAAG,EAAE,MAAM,CAAC,CAAA;AACnC,CAAC;AACD,OAAO,EACN,UAAU,IAAI,UAAU,GACxB,CAAA"}
1
+ {"version":3,"sources":["../src/is_active_.ts"],"sourcesContent":["import { out_is_active_ } from './out_is_active_.js'\nexport function is_active_(el:HTMLElement) {\n\tconst { top, bottom } = el.getBoundingClientRect()\n\treturn out_is_active_(top, bottom)\n}\nexport {\n\tis_active_ as _is_active,\n}\n"],"names":["out_is_active_","is_active_","el","top","bottom","getBoundingClientRect","_is_active"],"mappings":"AAAA,MAAM,GAAGA,cAAc,QAAQ,CAAqB;AACpD,MAAM,UAAUC,UAAU,CAACC,EAAc,EAAE,CAAC;IAC3C,KAAK,CAAC,CAAC,CAACC,GAAG,GAAEC,MAAM,EAAC,CAAC,GAAGF,EAAE,CAACG,qBAAqB;IAChD,MAAM,CAACL,cAAc,CAACG,GAAG,EAAEC,MAAM;AAClC,CAAC;AACD,MAAM,GACLH,UAAU,IAAIK,UAAU"}
@@ -1,8 +1,9 @@
1
1
  import { out_is_visible_ } from './out_is_visible_.js';
2
2
  export function is_visible_(el) {
3
- const { top, bottom } = el.getBoundingClientRect();
4
- const { innerHeight } = window;
3
+ const { top , bottom } = el.getBoundingClientRect();
4
+ const { innerHeight } = window;
5
5
  return out_is_visible_(top, bottom, innerHeight);
6
6
  }
7
- export { is_visible_ as _is_visible, };
7
+ export { is_visible_ as _is_visible, };
8
+
8
9
  //# sourceMappingURL=is_visible_.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"is_visible_.js","sourceRoot":"","sources":["../src/is_visible_.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtD,MAAM,UAAU,WAAW,CAAC,EAAc;IACzC,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,qBAAqB,EAAE,CAAA;IAClD,MAAM,EAAE,WAAW,EAAE,GAAG,MAAM,CAAA;IAC9B,OAAO,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,WAAW,CAAC,CAAA;AACjD,CAAC;AACD,OAAO,EACN,WAAW,IAAI,WAAW,GAC1B,CAAA"}
1
+ {"version":3,"sources":["../src/is_visible_.ts"],"sourcesContent":["import { out_is_visible_ } from './out_is_visible_.js'\nexport function is_visible_(el:HTMLElement) {\n\tconst { top, bottom } = el.getBoundingClientRect()\n\tconst { innerHeight } = window\n\treturn out_is_visible_(top, bottom, innerHeight)\n}\nexport {\n\tis_visible_ as _is_visible,\n}\n"],"names":["out_is_visible_","is_visible_","el","top","bottom","getBoundingClientRect","innerHeight","window","_is_visible"],"mappings":"AAAA,MAAM,GAAGA,eAAe,QAAQ,CAAsB;AACtD,MAAM,UAAUC,WAAW,CAACC,EAAc,EAAE,CAAC;IAC5C,KAAK,CAAC,CAAC,CAACC,GAAG,GAAEC,MAAM,EAAC,CAAC,GAAGF,EAAE,CAACG,qBAAqB;IAChD,KAAK,CAAC,CAAC,CAACC,WAAW,EAAC,CAAC,GAAGC,MAAM;IAC9B,MAAM,CAACP,eAAe,CAACG,GAAG,EAAEC,MAAM,EAAEE,WAAW;AAChD,CAAC;AACD,MAAM,GACLL,WAAW,IAAIO,WAAW"}
@@ -1,4 +1,5 @@
1
1
  export function out_is_active_(top, bottom) {
2
2
  return top <= 0 && bottom >= 0;
3
3
  }
4
+
4
5
  //# sourceMappingURL=out_is_active_.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"out_is_active_.js","sourceRoot":"","sources":["../src/out_is_active_.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,cAAc,CAAC,GAAU,EAAE,MAAa;IACvD,OAAO,GAAG,IAAI,CAAC,IAAI,MAAM,IAAI,CAAC,CAAA;AAC/B,CAAC"}
1
+ {"version":3,"sources":["../src/out_is_active_.ts"],"sourcesContent":["export function out_is_active_(top:number, bottom:number) {\n\treturn top <= 0 && bottom >= 0\n}\n"],"names":["out_is_active_","top","bottom"],"mappings":"AAAA,MAAM,UAAUA,cAAc,CAACC,GAAU,EAAEC,MAAa,EAAE,CAAC;IAC1D,MAAM,CAACD,GAAG,IAAI,CAAC,IAAIC,MAAM,IAAI,CAAC;AAC/B,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { out_is_active_ } from './out_is_active_.js';
2
2
  export function out_is_visible_(top, bottom, innerHeight) {
3
- return (top > 0 && top < innerHeight)
4
- || out_is_active_(top, bottom);
3
+ return top > 0 && top < innerHeight || out_is_active_(top, bottom);
5
4
  }
6
- export { out_is_visible_ as _out_is_visible, };
5
+ export { out_is_visible_ as _out_is_visible, };
6
+
7
7
  //# sourceMappingURL=out_is_visible_.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"out_is_visible_.js","sourceRoot":"","sources":["../src/out_is_visible_.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,MAAM,UAAU,eAAe,CAAC,GAAU,EAAE,MAAa,EAAE,WAAkB;IAC5E,OAAO,CAAC,GAAG,GAAG,CAAC,IAAI,GAAG,GAAG,WAAW,CAAC;WACjC,cAAc,CAAC,GAAG,EAAE,MAAM,CAAC,CAAA;AAChC,CAAC;AACD,OAAO,EACN,eAAe,IAAI,eAAe,GAClC,CAAA"}
1
+ {"version":3,"sources":["../src/out_is_visible_.ts"],"sourcesContent":["import { out_is_active_ } from './out_is_active_.js'\nexport function out_is_visible_(top:number, bottom:number, innerHeight:number) {\n\treturn (top > 0 && top < innerHeight)\n\t\t|| out_is_active_(top, bottom)\n}\nexport {\n\tout_is_visible_ as _out_is_visible,\n}\n"],"names":["out_is_active_","out_is_visible_","top","bottom","innerHeight","_out_is_visible"],"mappings":"AAAA,MAAM,GAAGA,cAAc,QAAQ,CAAqB;AACpD,MAAM,UAAUC,eAAe,CAACC,GAAU,EAAEC,MAAa,EAAEC,WAAkB,EAAE,CAAC;IAC/E,MAAM,CAAEF,GAAG,GAAG,CAAC,IAAIA,GAAG,GAAGE,WAAW,IAChCJ,cAAc,CAACE,GAAG,EAAEC,MAAM;AAC/B,CAAC;AACD,MAAM,GACLF,eAAe,IAAII,eAAe"}
@@ -1,2 +1,3 @@
1
- export {};
1
+ export { };
2
+
2
3
  //# sourceMappingURL=scroll_Ctx.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"scroll_Ctx.js","sourceRoot":"","sources":["../src/scroll_Ctx.ts"],"names":[],"mappings":""}
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,2 +1,5 @@
1
- export {};
1
+ /*
2
+ * This file was generated by `npm run generate_ctx_I_file` in @ctx-core/dev-tools
3
+ */ export { };
4
+
2
5
  //# sourceMappingURL=scroll_ctx_I.generated.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"scroll_ctx_I.generated.js","sourceRoot":"","sources":["../src/scroll_ctx_I.generated.ts"],"names":[],"mappings":""}
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,36 +1,36 @@
1
1
  import { assign, b_ } from '@ctx-core/object';
2
2
  import { writable$ } from '@ctx-core/store';
3
- const key = 'sticky_scroll_active$';
4
- export const sticky_scroll_active$_b = b_(key, () => {
5
- const sticky_scroll_active$ = writable$({});
3
+ const key1 = 'sticky_scroll_active$';
4
+ export const sticky_scroll_active$_b = b_(key1, ()=>{
5
+ const sticky_scroll_active$ = writable$({
6
+ });
6
7
  return assign(sticky_scroll_active$, {
7
8
  add_sticky_scroll_active,
8
9
  remove_sticky_scroll_active,
9
10
  sticky_scroll_active_key_active_,
10
- sticky_scroll_active_key_match_,
11
+ sticky_scroll_active_key_match_
11
12
  });
12
13
  function add_sticky_scroll_active(key) {
13
- sticky_scroll_active$.update(scroll_sticky_active => {
14
+ sticky_scroll_active$.update((scroll_sticky_active)=>{
14
15
  scroll_sticky_active[key] = true;
15
16
  return scroll_sticky_active;
16
17
  });
17
18
  }
18
19
  function remove_sticky_scroll_active(key) {
19
- sticky_scroll_active$.update(scroll_sticky_active => {
20
+ sticky_scroll_active$.update((scroll_sticky_active)=>{
20
21
  scroll_sticky_active[key] = false;
21
22
  return scroll_sticky_active;
22
23
  });
23
24
  }
24
25
  function sticky_scroll_active_key_active_(key) {
25
- const sticky_scroll_active = sticky_scroll_active$._;
26
- const active = sticky_scroll_active
27
- ? sticky_scroll_active[key]
28
- : false;
26
+ const sticky_scroll_active = sticky_scroll_active$.$;
27
+ const active = sticky_scroll_active ? sticky_scroll_active[key] : false;
29
28
  return active;
30
29
  }
31
30
  function sticky_scroll_active_key_match_(key, active) {
32
- return !!(active) == !!(sticky_scroll_active_key_active_(key));
31
+ return !!active == !!sticky_scroll_active_key_active_(key);
33
32
  }
34
33
  });
35
- export { sticky_scroll_active$_b as b__active__Sticky__Scroll, };
34
+ export { sticky_scroll_active$_b as b__active__Sticky__Scroll, };
35
+
36
36
  //# sourceMappingURL=sticky_scroll_active$_b.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sticky_scroll_active$_b.js","sourceRoot":"","sources":["../src/sticky_scroll_active$_b.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,EAAE,EAAK,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAE,SAAS,EAAa,MAAM,iBAAiB,CAAA;AAEtD,MAAM,GAAG,GAAG,uBAAuB,CAAA;AACnC,MAAM,CAAC,MAAM,uBAAuB,GAA6B,EAAE,CAAC,GAAG,EAAE,GAAE,EAAE;IAC5E,MAAM,qBAAqB,GAAG,SAAS,CAAyB,EAAE,CAAC,CAAA;IACnE,OAAO,MAAM,CAAC,qBAAqB,EAAE;QACpC,wBAAwB;QACxB,2BAA2B;QAC3B,gCAAgC;QAChC,+BAA+B;KAC/B,CAA4B,CAAA;IAC7B,SAAS,wBAAwB,CAAC,GAAU;QAC3C,qBAAqB,CAAC,MAAM,CAC3B,oBAAoB,CAAA,EAAE;YACrB,oBAAoB,CAAC,GAAG,CAAC,GAAG,IAAI,CAAA;YAChC,OAAO,oBAAoB,CAAA;QAC5B,CAAC,CAAC,CAAA;IACJ,CAAC;IACD,SAAS,2BAA2B,CAAC,GAAU;QAC9C,qBAAqB,CAAC,MAAM,CAC3B,oBAAoB,CAAA,EAAE;YACrB,oBAAoB,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;YACjC,OAAO,oBAAoB,CAAA;QAC5B,CAAC,CAAC,CAAA;IACJ,CAAC;IACD,SAAS,gCAAgC,CAAC,GAAU;QACnD,MAAM,oBAAoB,GAAG,qBAAqB,CAAC,CAAC,CAAA;QACpD,MAAM,MAAM,GACX,oBAAoB;YACpB,CAAC,CAAC,oBAAoB,CAAC,GAAG,CAAC;YAC3B,CAAC,CAAC,KAAK,CAAA;QACR,OAAO,MAAM,CAAA;IACd,CAAC;IACD,SAAS,+BAA+B,CAAC,GAAU,EAAE,MAAc;QAClE,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,gCAAgC,CAAC,GAAG,CAAC,CAAC,CAAA;IAC/D,CAAC;AACF,CAAC,CAAC,CAAA;AAQF,OAAO,EACN,uBAAuB,IAAI,yBAAyB,GACpD,CAAA"}
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'\nimport type { scroll_Ctx } from './scroll_Ctx'\nconst key = 'sticky_scroll_active$'\nexport const sticky_scroll_active$_b:B<scroll_Ctx, typeof key> = 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;AAEtD,KAAK,CAACC,IAAG,GAAG,CAAuB;AACnC,MAAM,CAAC,KAAK,CAACC,uBAAuB,GAA6BH,EAAE,CAACE,IAAG,MAAM,CAAC;IAC7E,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,GAAU,EAAEW,MAAc,EAAE,CAAC;QACrE,MAAM,GAAIA,MAAM,MAAQN,gCAAgC,CAACL,GAAG;IAC7D,CAAC;AACF,CAAC;AAQD,MAAM,GACLC,uBAAuB,IAAIW,yBAAyB"}
@@ -0,0 +1,105 @@
1
+ <script>
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_'
5
+ const dispatch = createEventDispatcher()
6
+ let getBoundingClientRect = default_getBoundingClientRect
7
+ let terminal = null
8
+ let root = null
9
+ let active
10
+ let visible
11
+ onMount(() => {
12
+ reset({})
13
+ if (terminal) {
14
+ if (terminal.addEventListener) {
15
+ terminal.addEventListener('scroll', reset)
16
+ } else if (terminal.on) {
17
+ terminal.on('scroll', reset)
18
+ }
19
+ }
20
+ })
21
+ onDestroy(() => {
22
+ if (terminal) {
23
+ if (terminal.removeEventListener) {
24
+ terminal.removeEventListener('scroll', reset)
25
+ } else if (terminal.off) {
26
+ terminal.off('scroll', reset)
27
+ }
28
+ }
29
+ if (contains_visible()) {
30
+ remove_visible()
31
+ }
32
+ if (contains_active()) {
33
+ remove_active()
34
+ }
35
+ })
36
+ function reset(event) {
37
+ const { top, bottom } = getBoundingClientRect(root)
38
+ const { innerHeight } = window
39
+ const out_is_active= out_is_active_(top, bottom)
40
+ const out_is_visible = out_is_visible_(top, bottom, innerHeight)
41
+ if (out_is_visible) {
42
+ if (!visible) {
43
+ add_visible()
44
+ }
45
+ } else {
46
+ if (visible) {
47
+ remove_visible()
48
+ }
49
+ }
50
+ if (out_is_active) {
51
+ if (!active) {
52
+ add_active()
53
+ }
54
+ } else {
55
+ if (active) {
56
+ remove_active()
57
+ }
58
+ }
59
+ }
60
+ function add_active() {
61
+ active = true
62
+ dispatch('add_active', _event())
63
+ }
64
+ function remove_active() {
65
+ active = false
66
+ dispatch('remove_active', _event())
67
+ }
68
+ function add_visible() {
69
+ visible = true
70
+ dispatch('add_visible', _event())
71
+ }
72
+ function remove_visible() {
73
+ visible = false
74
+ dispatch('remove_visible', _event())
75
+ }
76
+ function default_getBoundingClientRect() {
77
+ return root.getBoundingClientRect()
78
+ }
79
+ function contains_visible() {
80
+ return root.classList.contains('visible')
81
+ }
82
+ function contains_active() {
83
+ return root.classList.contains('active')
84
+ }
85
+ function _event() {
86
+ return {
87
+ root,
88
+ target: root,
89
+ currentTarget: root,
90
+ }
91
+ }
92
+ </script>
93
+
94
+ <svelte:window
95
+ on:scroll="{reset}"
96
+ on:resize="{reset}"
97
+ />
98
+
99
+ <div
100
+ bind:this="{root}"
101
+ class="Sticky_Scroll {$$props.class||''}"
102
+ class:active="{active}"
103
+ >
104
+ <slot></slot>
105
+ </div>
package/dist/ui/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import 'svelte';
2
2
  import Sticky_Scroll from './Sticky_Scroll.svelte';
3
3
  export { Sticky_Scroll };
4
+
4
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ui/index.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,CAAA;AACf,OAAO,aAAa,MAAM,wBAAwB,CAAA;AAClD,OAAO,EAAE,aAAa,EAAE,CAAA"}
1
+ {"version":3,"sources":["../../src/ui/index.ts"],"sourcesContent":["import 'svelte'\nimport Sticky_Scroll from './Sticky_Scroll.svelte'\nexport { Sticky_Scroll }\n"],"names":["Sticky_Scroll"],"mappings":"AAAA,MAAM,CAAC,CAAQ;AACf,MAAM,CAACA,aAAa,MAAM,CAAwB;AAClD,MAAM,GAAGA,aAAa"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ctx-core/scroll",
3
- "version": "12.0.65",
3
+ "version": "12.0.70",
4
4
  "description": "ctx-core scroll",
5
5
  "keywords": [
6
6
  "ctx-core",
@@ -17,9 +17,9 @@
17
17
  "license": "Apache-2.0",
18
18
  "author": "Brian Takita",
19
19
  "type": "module",
20
- "main": "./dist/index.cjs",
20
+ "main": "./dist/index.js",
21
21
  "module": "./dist/index.js",
22
- "types": "./dist/index.d.ts",
22
+ "types": "./src/index.ts",
23
23
  "exports": {
24
24
  ".": {
25
25
  "require": "./dist/index.cjs",
@@ -28,27 +28,26 @@
28
28
  "./package.json": "./package.json"
29
29
  },
30
30
  "dependencies": {
31
- "@ctx-core/object": "^21.0.20",
32
- "@ctx-core/store": "^27.0.33",
33
- "esm": "^3.2.25",
34
- "svelte": "3.43.1"
31
+ "@ctx-core/object": "^21.0.23",
32
+ "@ctx-core/store": "^27.0.37",
33
+ "svelte": "3.44.1"
35
34
  },
36
35
  "devDependencies": {
37
- "@ctx-core/ctx-core-package-tools": "^8.0.74",
38
- "@ctx-core/dev-tools": "^7.1.3",
39
- "typescript": "^4.4.3"
36
+ "@ctx-core/ctx-core-package-tools": "^8.0.77",
37
+ "@ctx-core/dev-tools": "^7.2.1",
38
+ "@swc/cli": "^0.1.51",
39
+ "@swc/core": "^1.2.108",
40
+ "typescript": "^4.4.4"
40
41
  },
41
42
  "publishConfig": {
42
43
  "access": "public",
43
44
  "cache": "~/.npm"
44
45
  },
45
46
  "scripts": {
46
- "build": "npm run clean && npm run copy-mjs && npm run generate_ctx_I_file && npm run copy-components && npm run compile",
47
- "clean": "rm -f tsconfig.tsbuildinfo && rm -f src/**/*.js && rm -f src/**/*.d.ts && rm -f src/**/*.map",
48
- "compile": "./node_modules/.bin/tsc -b .",
49
- "copy-mjs": "cd dist && echo \"module.exports = (async () => import('./index.js'))()\" > index.cjs",
50
- "copy-components": "cd src && find . | grep \\.svelte$ | awk '{print \"mkdir -p dirname \"$1\" && cp -f \"$1\" ../dist/\"$1}'",
47
+ "build": "npm run generate_ctx_I_file && npm run compile",
48
+ "clean": "rm -rf dist",
49
+ "compile": "swc src --out-dir dist --copy-files --source-maps --config-file .swcrc",
51
50
  "exec": "$@",
52
- "generate_ctx_I_file": "./node_modules/.bin/generate_ctx_I_file"
51
+ "generate_ctx_I_file": "swc $(./node_modules/.bin/generate_ctx_I_file | tail -n1) --out-dir dist --source-maps --config-file .swcrc"
53
52
  }
54
53
  }
@@ -25,7 +25,7 @@ export const sticky_scroll_active$_b:B<scroll_Ctx, typeof key> = b_(key, ()=>{
25
25
  })
26
26
  }
27
27
  function sticky_scroll_active_key_active_(key:string) {
28
- const sticky_scroll_active = sticky_scroll_active$._
28
+ const sticky_scroll_active = sticky_scroll_active$.$
29
29
  const active =
30
30
  sticky_scroll_active
31
31
  ? sticky_scroll_active[key]
package/dist/index.cjs DELETED
@@ -1 +0,0 @@
1
- module.exports = (async () => import('./index.js'))()
package/dist/index.d.ts DELETED
@@ -1,8 +0,0 @@
1
- export * from './scroll_Ctx.js';
2
- export * from './scroll_ctx_I.generated.js';
3
- export * from './is_active_.js';
4
- export * from './is_visible_.js';
5
- export * from './out_is_active_.js';
6
- export * from './out_is_visible_.js';
7
- export * from './sticky_scroll_active$_b.js';
8
- export * from './ui';
@@ -1,2 +0,0 @@
1
- export declare function is_active_(el: HTMLElement): boolean;
2
- export { is_active_ as _is_active, };
@@ -1,2 +0,0 @@
1
- export declare function is_visible_(el: HTMLElement): boolean;
2
- export { is_visible_ as _is_visible, };
@@ -1 +0,0 @@
1
- export declare function out_is_active_(top: number, bottom: number): boolean;
@@ -1,2 +0,0 @@
1
- export declare function out_is_visible_(top: number, bottom: number, innerHeight: number): boolean;
2
- export { out_is_visible_ as _out_is_visible, };
@@ -1,3 +0,0 @@
1
- import type { scroll_ctx_I } from './scroll_ctx_I.generated.js';
2
- export interface scroll_Ctx extends scroll_ctx_I {
3
- }
@@ -1,4 +0,0 @@
1
- import type { sticky_scroll_active$_T } from './sticky_scroll_active$_b.js';
2
- export interface scroll_ctx_I {
3
- sticky_scroll_active$?: sticky_scroll_active$_T;
4
- }
@@ -1,14 +0,0 @@
1
- import { B } from '@ctx-core/object';
2
- import { Writable$ } from '@ctx-core/store';
3
- import type { scroll_Ctx } from './scroll_Ctx';
4
- declare const key = "sticky_scroll_active$";
5
- export declare const sticky_scroll_active$_b: B<scroll_Ctx, typeof key>;
6
- export interface sticky_scroll_active_T extends Record<string, boolean> {
7
- }
8
- export interface sticky_scroll_active$_T extends Writable$<sticky_scroll_active_T> {
9
- add_sticky_scroll_active: (key: string) => void;
10
- remove_sticky_scroll_active: (key: string) => void;
11
- sticky_scroll_active_key_active_: (key: string) => void;
12
- sticky_scroll_active_key_match_: (key: string, active: any) => void;
13
- }
14
- export { sticky_scroll_active$_b as b__active__Sticky__Scroll, };
@@ -1,3 +0,0 @@
1
- import 'svelte';
2
- import Sticky_Scroll from './Sticky_Scroll.svelte';
3
- export { Sticky_Scroll };