@studiometa/ui 0.2.13 → 0.2.14

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 (217) hide show
  1. package/atoms/AnchorScrollTo/AnchorScrollTo.cjs +3 -3
  2. package/atoms/AnchorScrollTo/AnchorScrollTo.d.ts +8 -15
  3. package/atoms/AnchorScrollTo/AnchorScrollTo.js +26 -1
  4. package/atoms/AnchorScrollTo/index.cjs +20 -0
  5. package/atoms/AnchorScrollTo/index.d.ts +1 -0
  6. package/atoms/AnchorScrollTo/index.js +1 -0
  7. package/atoms/Cursor/Cursor.cjs +16 -9
  8. package/atoms/Cursor/Cursor.d.ts +19 -117
  9. package/atoms/Cursor/Cursor.js +111 -1
  10. package/atoms/Cursor/index.cjs +20 -0
  11. package/atoms/Cursor/index.d.ts +1 -0
  12. package/atoms/Cursor/index.js +1 -0
  13. package/atoms/Figure/Figure.cjs +15 -9
  14. package/atoms/Figure/Figure.d.ts +18 -53
  15. package/atoms/Figure/Figure.js +56 -1
  16. package/atoms/Figure/FigureTwicPics.cjs +10 -10
  17. package/atoms/Figure/FigureTwicPics.d.ts +16 -37
  18. package/atoms/Figure/FigureTwicPics.js +51 -1
  19. package/atoms/Figure/index.cjs +4 -14
  20. package/atoms/Figure/index.d.ts +2 -2
  21. package/atoms/Figure/index.js +2 -1
  22. package/atoms/LargeText/LargeText.cjs +17 -10
  23. package/atoms/LargeText/LargeText.d.ts +19 -40
  24. package/atoms/LargeText/LargeText.js +68 -1
  25. package/atoms/LargeText/index.cjs +20 -0
  26. package/atoms/LargeText/index.d.ts +1 -0
  27. package/atoms/LargeText/index.js +1 -0
  28. package/atoms/LazyInclude/LazyInclude.cjs +2 -2
  29. package/atoms/LazyInclude/LazyInclude.d.ts +17 -36
  30. package/atoms/LazyInclude/LazyInclude.js +46 -1
  31. package/atoms/LazyInclude/index.cjs +20 -0
  32. package/atoms/LazyInclude/index.d.ts +1 -0
  33. package/atoms/LazyInclude/index.js +1 -0
  34. package/atoms/Prefetch/AbstractPrefetch.cjs +6 -6
  35. package/atoms/Prefetch/AbstractPrefetch.d.ts +12 -35
  36. package/atoms/Prefetch/AbstractPrefetch.js +58 -1
  37. package/atoms/Prefetch/PrefetchWhenOver.cjs +5 -8
  38. package/atoms/Prefetch/PrefetchWhenOver.d.ts +8 -14
  39. package/atoms/Prefetch/PrefetchWhenOver.js +19 -1
  40. package/atoms/Prefetch/PrefetchWhenVisible.cjs +5 -8
  41. package/atoms/Prefetch/PrefetchWhenVisible.d.ts +10 -14
  42. package/atoms/Prefetch/PrefetchWhenVisible.js +20 -1
  43. package/atoms/Prefetch/index.cjs +5 -16
  44. package/atoms/Prefetch/index.d.ts +3 -3
  45. package/atoms/Prefetch/index.js +3 -1
  46. package/atoms/ScrollAnimation/AbstractScrollAnimation.cjs +17 -14
  47. package/atoms/ScrollAnimation/AbstractScrollAnimation.d.ts +19 -89
  48. package/atoms/ScrollAnimation/AbstractScrollAnimation.js +67 -1
  49. package/atoms/ScrollAnimation/ScrollAnimation.cjs +5 -14
  50. package/atoms/ScrollAnimation/ScrollAnimation.d.ts +13 -51
  51. package/atoms/ScrollAnimation/ScrollAnimation.js +21 -1
  52. package/atoms/ScrollAnimation/ScrollAnimationChild.cjs +37 -14
  53. package/atoms/ScrollAnimation/ScrollAnimationChild.d.ts +19 -6
  54. package/atoms/ScrollAnimation/ScrollAnimationChild.js +53 -1
  55. package/atoms/ScrollAnimation/ScrollAnimationChildWithEase.cjs +6 -9
  56. package/atoms/ScrollAnimation/ScrollAnimationChildWithEase.d.ts +8 -2
  57. package/atoms/ScrollAnimation/ScrollAnimationChildWithEase.js +17 -1
  58. package/atoms/ScrollAnimation/ScrollAnimationParent.cjs +8 -8
  59. package/atoms/ScrollAnimation/ScrollAnimationParent.d.ts +14 -26
  60. package/atoms/ScrollAnimation/ScrollAnimationParent.js +27 -1
  61. package/atoms/ScrollAnimation/ScrollAnimationWithEase.cjs +6 -9
  62. package/atoms/ScrollAnimation/ScrollAnimationWithEase.d.ts +15 -2
  63. package/atoms/ScrollAnimation/ScrollAnimationWithEase.js +17 -1
  64. package/atoms/ScrollAnimation/animationScrollWithEase.cjs +24 -16
  65. package/atoms/ScrollAnimation/animationScrollWithEase.d.ts +10 -8
  66. package/atoms/ScrollAnimation/animationScrollWithEase.js +36 -1
  67. package/atoms/ScrollAnimation/index.cjs +9 -24
  68. package/atoms/ScrollAnimation/index.d.ts +7 -7
  69. package/atoms/ScrollAnimation/index.js +7 -1
  70. package/atoms/ScrollReveal/ScrollReveal.cjs +7 -4
  71. package/atoms/ScrollReveal/ScrollReveal.d.ts +16 -59
  72. package/atoms/ScrollReveal/ScrollReveal.js +54 -1
  73. package/atoms/ScrollReveal/index.cjs +3 -12
  74. package/atoms/ScrollReveal/index.d.ts +1 -1
  75. package/atoms/ScrollReveal/index.js +1 -1
  76. package/atoms/index.cjs +5 -18
  77. package/atoms/index.d.ts +8 -8
  78. package/atoms/index.js +8 -1
  79. package/decorators/index.cjs +3 -12
  80. package/decorators/index.d.ts +1 -1
  81. package/decorators/index.js +1 -1
  82. package/decorators/withTransition.cjs +44 -29
  83. package/decorators/withTransition.d.ts +21 -33
  84. package/decorators/withTransition.js +60 -1
  85. package/index.cjs +1 -1
  86. package/index.d.ts +5 -5
  87. package/index.js +5 -1
  88. package/molecules/Accordion/Accordion.cjs +7 -10
  89. package/molecules/Accordion/Accordion.d.ts +5 -23
  90. package/molecules/Accordion/Accordion.js +19 -1
  91. package/molecules/Accordion/AccordionCore.cjs +6 -8
  92. package/molecules/Accordion/AccordionCore.d.ts +22 -70
  93. package/molecules/Accordion/AccordionCore.js +32 -1
  94. package/molecules/Accordion/AccordionItem.cjs +39 -23
  95. package/molecules/Accordion/AccordionItem.d.ts +24 -94
  96. package/molecules/Accordion/AccordionItem.js +153 -1
  97. package/molecules/Accordion/index.cjs +21 -0
  98. package/molecules/Accordion/index.d.ts +2 -0
  99. package/molecules/Accordion/index.js +2 -0
  100. package/molecules/Menu/Menu.cjs +6 -10
  101. package/molecules/Menu/Menu.d.ts +24 -84
  102. package/molecules/Menu/Menu.js +114 -1
  103. package/molecules/Menu/MenuBtn.cjs +7 -5
  104. package/molecules/Menu/MenuBtn.d.ts +7 -9
  105. package/molecules/Menu/MenuBtn.js +30 -1
  106. package/molecules/Menu/MenuList.cjs +13 -11
  107. package/molecules/Menu/MenuList.d.ts +16 -53
  108. package/molecules/Menu/MenuList.js +113 -1
  109. package/molecules/Menu/index.cjs +5 -16
  110. package/molecules/Menu/index.d.ts +3 -3
  111. package/molecules/Menu/index.js +3 -1
  112. package/molecules/Modal/Modal.cjs +42 -13
  113. package/molecules/Modal/Modal.d.ts +69 -140
  114. package/molecules/Modal/Modal.js +163 -1
  115. package/molecules/Modal/ModalWithTransition.cjs +4 -7
  116. package/molecules/Modal/ModalWithTransition.d.ts +6 -22
  117. package/molecules/Modal/ModalWithTransition.js +46 -1
  118. package/molecules/Modal/index.cjs +21 -0
  119. package/molecules/Modal/index.d.ts +2 -0
  120. package/molecules/Modal/index.js +2 -0
  121. package/molecules/Panel/Panel.cjs +41 -26
  122. package/molecules/Panel/Panel.d.ts +22 -21
  123. package/molecules/Panel/Panel.js +108 -1
  124. package/molecules/Panel/index.cjs +20 -0
  125. package/molecules/Panel/index.d.ts +1 -0
  126. package/molecules/Panel/index.js +1 -0
  127. package/molecules/Slider/AbstractSliderChild.cjs +7 -9
  128. package/molecules/Slider/AbstractSliderChild.d.ts +11 -30
  129. package/molecules/Slider/AbstractSliderChild.js +48 -1
  130. package/molecules/Slider/Slider.cjs +45 -30
  131. package/molecules/Slider/Slider.d.ts +40 -157
  132. package/molecules/Slider/Slider.js +279 -1
  133. package/molecules/Slider/SliderBtn.cjs +4 -7
  134. package/molecules/Slider/SliderBtn.d.ts +12 -23
  135. package/molecules/Slider/SliderBtn.js +34 -1
  136. package/molecules/Slider/SliderCount.cjs +4 -7
  137. package/molecules/Slider/SliderCount.d.ts +10 -16
  138. package/molecules/Slider/SliderCount.js +19 -1
  139. package/molecules/Slider/SliderDots.cjs +8 -8
  140. package/molecules/Slider/SliderDots.d.ts +11 -31
  141. package/molecules/Slider/SliderDots.js +32 -1
  142. package/molecules/Slider/SliderDrag.cjs +2 -2
  143. package/molecules/Slider/SliderDrag.d.ts +12 -30
  144. package/molecules/Slider/SliderDrag.js +34 -1
  145. package/molecules/Slider/SliderItem.cjs +12 -6
  146. package/molecules/Slider/SliderItem.d.ts +21 -33
  147. package/molecules/Slider/SliderItem.js +93 -1
  148. package/molecules/Slider/SliderProgress.cjs +4 -7
  149. package/molecules/Slider/SliderProgress.d.ts +10 -25
  150. package/molecules/Slider/SliderProgress.js +26 -1
  151. package/molecules/Slider/index.cjs +10 -26
  152. package/molecules/Slider/index.d.ts +8 -8
  153. package/molecules/Slider/index.js +8 -1
  154. package/molecules/Sticky/Sticky.cjs +16 -10
  155. package/molecules/Sticky/Sticky.d.ts +30 -68
  156. package/molecules/Sticky/Sticky.js +110 -1
  157. package/molecules/Sticky/index.cjs +20 -0
  158. package/molecules/Sticky/index.d.ts +1 -0
  159. package/molecules/Sticky/index.js +1 -0
  160. package/molecules/TableOfContent/TableOfContent.cjs +5 -8
  161. package/molecules/TableOfContent/TableOfContent.d.ts +19 -41
  162. package/molecules/TableOfContent/TableOfContent.js +42 -1
  163. package/molecules/TableOfContent/TableOfContentAnchor.cjs +9 -5
  164. package/molecules/TableOfContent/TableOfContentAnchor.d.ts +14 -17
  165. package/molecules/TableOfContent/TableOfContentAnchor.js +43 -1
  166. package/molecules/TableOfContent/index.cjs +4 -14
  167. package/molecules/TableOfContent/index.d.ts +2 -2
  168. package/molecules/TableOfContent/index.js +2 -1
  169. package/molecules/Tabs/Tabs.cjs +42 -22
  170. package/molecules/Tabs/Tabs.d.ts +28 -90
  171. package/molecules/Tabs/Tabs.js +123 -1
  172. package/molecules/Tabs/index.cjs +20 -0
  173. package/molecules/Tabs/index.d.ts +1 -0
  174. package/molecules/Tabs/index.js +1 -0
  175. package/molecules/index.cjs +7 -24
  176. package/molecules/index.d.ts +9 -10
  177. package/molecules/index.js +9 -1
  178. package/organisms/Frame/Frame.cjs +20 -43
  179. package/organisms/Frame/Frame.d.ts +21 -98
  180. package/organisms/Frame/Frame.js +161 -1
  181. package/organisms/Frame/FrameAnchor.cjs +2 -2
  182. package/organisms/Frame/FrameAnchor.d.ts +7 -16
  183. package/organisms/Frame/FrameAnchor.js +18 -1
  184. package/organisms/Frame/FrameForm.cjs +2 -2
  185. package/organisms/Frame/FrameForm.d.ts +10 -16
  186. package/organisms/Frame/FrameForm.js +18 -1
  187. package/organisms/Frame/FrameTarget.cjs +15 -7
  188. package/organisms/Frame/FrameTarget.d.ts +17 -26
  189. package/organisms/Frame/FrameTarget.js +79 -1
  190. package/organisms/Frame/index.cjs +6 -18
  191. package/organisms/Frame/index.d.ts +4 -4
  192. package/organisms/Frame/index.js +4 -1
  193. package/organisms/index.cjs +1 -1
  194. package/organisms/index.d.ts +1 -1
  195. package/organisms/index.js +1 -1
  196. package/package.json +2 -2
  197. package/primitives/Draggable/Draggable.cjs +9 -6
  198. package/primitives/Draggable/Draggable.d.ts +10 -11
  199. package/primitives/Draggable/Draggable.js +33 -1
  200. package/primitives/Draggable/index.cjs +20 -0
  201. package/primitives/Draggable/index.d.ts +1 -0
  202. package/primitives/Draggable/index.js +1 -0
  203. package/primitives/Sentinel/Sentinel.cjs +2 -2
  204. package/primitives/Sentinel/Sentinel.d.ts +6 -5
  205. package/primitives/Sentinel/Sentinel.js +15 -1
  206. package/primitives/Sentinel/index.cjs +20 -0
  207. package/primitives/Sentinel/index.d.ts +1 -0
  208. package/primitives/Sentinel/index.js +1 -0
  209. package/primitives/Transition/Transition.cjs +12 -3
  210. package/primitives/Transition/Transition.d.ts +13 -7
  211. package/primitives/Transition/Transition.js +16 -1
  212. package/primitives/Transition/index.cjs +20 -0
  213. package/primitives/Transition/index.d.ts +1 -0
  214. package/primitives/Transition/index.js +1 -0
  215. package/primitives/index.cjs +5 -16
  216. package/primitives/index.d.ts +3 -3
  217. package/primitives/index.js +3 -1
@@ -21,19 +21,19 @@ var __publicField = (obj, key, value) => {
21
21
  return value;
22
22
  };
23
23
 
24
- // packages/ui/atoms/Prefetch/AbstractPrefetch.js
24
+ // packages/ui/atoms/Prefetch/AbstractPrefetch.ts
25
25
  var AbstractPrefetch_exports = {};
26
26
  __export(AbstractPrefetch_exports, {
27
- default: () => AbstractPrefetch
27
+ AbstractPrefetch: () => AbstractPrefetch
28
28
  });
29
29
  module.exports = __toCommonJS(AbstractPrefetch_exports);
30
30
  var import_js_toolkit = require("@studiometa/js-toolkit");
31
31
  var _AbstractPrefetch = class extends import_js_toolkit.Base {
32
- isPrefetchable(url, options) {
32
+ isPrefetchable(url) {
33
33
  if (!url || !url.href) {
34
34
  return false;
35
35
  }
36
- if (!options.prefetch) {
36
+ if (!this.$options.prefetch) {
37
37
  return false;
38
38
  }
39
39
  if (url.origin !== window.location.origin) {
@@ -54,13 +54,13 @@ var _AbstractPrefetch = class extends import_js_toolkit.Base {
54
54
  if (_AbstractPrefetch.prefetchedUrls.has(url.href)) {
55
55
  return;
56
56
  }
57
- if (!this.isPrefetchable(url, this.$options)) {
57
+ if (!this.isPrefetchable(url)) {
58
58
  return;
59
59
  }
60
60
  const prefetcher = document.createElement("link");
61
61
  prefetcher.rel = "prefetch";
62
62
  prefetcher.href = url.href;
63
- document.head.appendChild(prefetcher);
63
+ document.head.append(prefetcher);
64
64
  _AbstractPrefetch.prefetchedUrls.add(url.href);
65
65
  this.$terminate();
66
66
  }
@@ -1,52 +1,29 @@
1
- /**
2
- * @typedef {{ prefetch: boolean }} PrefetchOptions
3
- */
4
- /**
5
- * @typedef {AbstractPrefetch & {
6
- * $options: PrefetchOptions
7
- * }} AbstractPrefetchInterface
8
- */
1
+ import { Base } from '@studiometa/js-toolkit';
2
+ import type { BaseProps, BaseConfig } from '@studiometa/js-toolkit';
3
+ export interface AbstractPrefetchProps extends BaseProps {
4
+ $el: HTMLAnchorElement;
5
+ $options: {
6
+ prefetch: boolean;
7
+ };
8
+ }
9
9
  /**
10
10
  * AbstractPrefetch class.
11
11
  */
12
- export default class AbstractPrefetch extends Base {
12
+ export declare class AbstractPrefetch<T extends BaseProps = BaseProps> extends Base<T & AbstractPrefetchProps> {
13
13
  /**
14
14
  * Config.
15
15
  */
16
- static config: {
17
- name: string;
18
- options: {
19
- prefetch: {
20
- type: BooleanConstructor;
21
- default: boolean;
22
- };
23
- };
24
- };
16
+ static config: BaseConfig;
25
17
  /**
26
18
  * Store prefetched URL.
27
- * @type {Set<string>}
28
19
  */
29
20
  static prefetchedUrls: Set<string>;
30
21
  /**
31
22
  * Is the given anchor prefetchable?
32
- * @param {URL} url
33
- * @param {PrefetchOptions} options
34
- * @returns {boolean}
35
23
  */
36
- isPrefetchable(url: URL, options: PrefetchOptions): boolean;
24
+ isPrefetchable(url: URL): boolean;
37
25
  /**
38
26
  * Prefetch the given URL and terminate the component.
39
- *
40
- * @this {AbstractPrefetchInterface}
41
- * @param {URL} url
42
- * @returns {void}
43
27
  */
44
- prefetch(this: AbstractPrefetchInterface, url: URL): void;
28
+ prefetch(url: URL): void;
45
29
  }
46
- export type PrefetchOptions = {
47
- prefetch: boolean;
48
- };
49
- export type AbstractPrefetchInterface = AbstractPrefetch & {
50
- $options: PrefetchOptions;
51
- };
52
- import { Base } from "@studiometa/js-toolkit";
@@ -1 +1,58 @@
1
- import{Base as n}from"@studiometa/js-toolkit";class r extends n{static config={name:"AbstractPrefetch",options:{prefetch:{type:Boolean,default:!0}}};static prefetchedUrls=new Set;isPrefetchable(e,t){return!(!e||!e.href||!t.prefetch||e.origin!==window.location.origin||!["http:","https:"].includes(e.protocol)||e.protocol==="http:"&&window.location.protocol==="https:"||e.hash&&e.pathname+e.search===window.location.pathname+window.location.search)}prefetch(e){if(r.prefetchedUrls.has(e.href)||!this.isPrefetchable(e,this.$options))return;const t=document.createElement("link");t.rel="prefetch",t.href=e.href,document.head.appendChild(t),r.prefetchedUrls.add(e.href),this.$terminate()}}export{r as default};
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) => {
4
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
+ return value;
6
+ };
7
+ import { Base } from "@studiometa/js-toolkit";
8
+ const _AbstractPrefetch = class extends Base {
9
+ isPrefetchable(url) {
10
+ if (!url || !url.href) {
11
+ return false;
12
+ }
13
+ if (!this.$options.prefetch) {
14
+ return false;
15
+ }
16
+ if (url.origin !== window.location.origin) {
17
+ return false;
18
+ }
19
+ if (!["http:", "https:"].includes(url.protocol)) {
20
+ return false;
21
+ }
22
+ if (url.protocol === "http:" && window.location.protocol === "https:") {
23
+ return false;
24
+ }
25
+ if (url.hash && url.pathname + url.search === window.location.pathname + window.location.search) {
26
+ return false;
27
+ }
28
+ return true;
29
+ }
30
+ prefetch(url) {
31
+ if (_AbstractPrefetch.prefetchedUrls.has(url.href)) {
32
+ return;
33
+ }
34
+ if (!this.isPrefetchable(url)) {
35
+ return;
36
+ }
37
+ const prefetcher = document.createElement("link");
38
+ prefetcher.rel = "prefetch";
39
+ prefetcher.href = url.href;
40
+ document.head.append(prefetcher);
41
+ _AbstractPrefetch.prefetchedUrls.add(url.href);
42
+ this.$terminate();
43
+ }
44
+ };
45
+ let AbstractPrefetch = _AbstractPrefetch;
46
+ __publicField(AbstractPrefetch, "config", {
47
+ name: "AbstractPrefetch",
48
+ options: {
49
+ prefetch: {
50
+ type: Boolean,
51
+ default: true
52
+ }
53
+ }
54
+ });
55
+ __publicField(AbstractPrefetch, "prefetchedUrls", /* @__PURE__ */ new Set());
56
+ export {
57
+ AbstractPrefetch
58
+ };
@@ -1,8 +1,6 @@
1
- var __create = Object.create;
2
1
  var __defProp = Object.defineProperty;
3
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
5
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
6
  var __export = (target, all) => {
@@ -17,27 +15,26 @@ var __copyProps = (to, from, except, desc) => {
17
15
  }
18
16
  return to;
19
17
  };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
21
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
22
19
  var __publicField = (obj, key, value) => {
23
20
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
24
21
  return value;
25
22
  };
26
23
 
27
- // packages/ui/atoms/Prefetch/PrefetchWhenOver.js
24
+ // packages/ui/atoms/Prefetch/PrefetchWhenOver.ts
28
25
  var PrefetchWhenOver_exports = {};
29
26
  __export(PrefetchWhenOver_exports, {
30
- default: () => PrefetchWhenOver
27
+ PrefetchWhenOver: () => PrefetchWhenOver
31
28
  });
32
29
  module.exports = __toCommonJS(PrefetchWhenOver_exports);
33
- var import_AbstractPrefetch = __toESM(require("./AbstractPrefetch.cjs"), 1);
34
- var PrefetchWhenOver = class extends import_AbstractPrefetch.default {
30
+ var import_AbstractPrefetch = require("./AbstractPrefetch.cjs");
31
+ var PrefetchWhenOver = class extends import_AbstractPrefetch.AbstractPrefetch {
35
32
  onMouseenter() {
36
33
  this.prefetch(new URL(this.$el.href));
37
34
  }
38
35
  };
39
36
  __publicField(PrefetchWhenOver, "config", {
40
- ...import_AbstractPrefetch.default.config,
37
+ ...import_AbstractPrefetch.AbstractPrefetch.config,
41
38
  name: "PrefetchWhenOver"
42
39
  });
43
40
  if (module.exports.default) module.exports = module.exports.default;
@@ -1,21 +1,15 @@
1
- /**
2
- * @typedef {PrefetchWhenOver & {
3
- * $el: HTMLAnchorElement
4
- * }} PrefetchWhenOverInterface
5
- */
1
+ import type { BaseProps, BaseConfig } from '@studiometa/js-toolkit';
2
+ import { AbstractPrefetch } from './AbstractPrefetch.js';
6
3
  /**
7
4
  * PrefetchWhenOver class.
8
5
  */
9
- export default class PrefetchWhenOver extends AbstractPrefetch {
6
+ export declare class PrefetchWhenOver<T extends BaseProps = BaseProps> extends AbstractPrefetch<T> {
7
+ /**
8
+ * Config.
9
+ */
10
+ static config: BaseConfig;
10
11
  /**
11
12
  * Prefetch on mouseenter.
12
- *
13
- * @this {PrefetchWhenOverInterface}
14
- * @returns {void}
15
13
  */
16
- onMouseenter(this: PrefetchWhenOverInterface): void;
14
+ onMouseenter(): void;
17
15
  }
18
- export type PrefetchWhenOverInterface = PrefetchWhenOver & {
19
- $el: HTMLAnchorElement;
20
- };
21
- import AbstractPrefetch from "./AbstractPrefetch.js";
@@ -1 +1,19 @@
1
- import e from"./AbstractPrefetch.js";class t extends e{static config={...e.config,name:"PrefetchWhenOver"};onMouseenter(){this.prefetch(new URL(this.$el.href))}}export{t as default};
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) => {
4
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
+ return value;
6
+ };
7
+ import { AbstractPrefetch } from "./AbstractPrefetch.js";
8
+ class PrefetchWhenOver extends AbstractPrefetch {
9
+ onMouseenter() {
10
+ this.prefetch(new URL(this.$el.href));
11
+ }
12
+ }
13
+ __publicField(PrefetchWhenOver, "config", {
14
+ ...AbstractPrefetch.config,
15
+ name: "PrefetchWhenOver"
16
+ });
17
+ export {
18
+ PrefetchWhenOver
19
+ };
@@ -1,8 +1,6 @@
1
- var __create = Object.create;
2
1
  var __defProp = Object.defineProperty;
3
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
5
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
6
  var __export = (target, all) => {
@@ -17,28 +15,27 @@ var __copyProps = (to, from, except, desc) => {
17
15
  }
18
16
  return to;
19
17
  };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
21
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
22
19
  var __publicField = (obj, key, value) => {
23
20
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
24
21
  return value;
25
22
  };
26
23
 
27
- // packages/ui/atoms/Prefetch/PrefetchWhenVisible.js
24
+ // packages/ui/atoms/Prefetch/PrefetchWhenVisible.ts
28
25
  var PrefetchWhenVisible_exports = {};
29
26
  __export(PrefetchWhenVisible_exports, {
30
- default: () => PrefetchWhenVisible
27
+ PrefetchWhenVisible: () => PrefetchWhenVisible
31
28
  });
32
29
  module.exports = __toCommonJS(PrefetchWhenVisible_exports);
33
30
  var import_js_toolkit = require("@studiometa/js-toolkit");
34
- var import_AbstractPrefetch = __toESM(require("./AbstractPrefetch.cjs"), 1);
35
- var PrefetchWhenVisible = class extends (0, import_js_toolkit.withMountWhenInView)(import_AbstractPrefetch.default) {
31
+ var import_AbstractPrefetch = require("./AbstractPrefetch.cjs");
32
+ var PrefetchWhenVisible = class extends (0, import_js_toolkit.withMountWhenInView)(import_AbstractPrefetch.AbstractPrefetch) {
36
33
  mounted() {
37
34
  this.prefetch(new URL(this.$el.href));
38
35
  }
39
36
  };
40
37
  __publicField(PrefetchWhenVisible, "config", {
41
- ...import_AbstractPrefetch.default.config,
38
+ ...import_AbstractPrefetch.AbstractPrefetch.config,
42
39
  name: "PrefetchWhenVisible"
43
40
  });
44
41
  if (module.exports.default) module.exports = module.exports.default;
@@ -1,21 +1,17 @@
1
- /**
2
- * @typedef {PrefetchWhenVisible & {
3
- * $el: HTMLAnchorElement
4
- * }} PrefetchWhenVisibleInterface
5
- */
1
+ import type { BaseConfig } from '@studiometa/js-toolkit';
2
+ import { AbstractPrefetch } from './AbstractPrefetch.js';
3
+ declare const PrefetchWhenVisible_base: import("@studiometa/js-toolkit").BaseDecorator<import("@studiometa/js-toolkit").WithMountWhenInViewInterface, AbstractPrefetch<import("@studiometa/js-toolkit").BaseProps>, import("@studiometa/js-toolkit").WithMountWhenInViewProps>;
6
4
  /**
7
5
  * PrefetchWhenVisible class.
8
6
  */
9
- export default class PrefetchWhenVisible extends AbstractPrefetch {
7
+ export declare class PrefetchWhenVisible extends PrefetchWhenVisible_base {
8
+ /**
9
+ * Config.
10
+ */
11
+ static config: BaseConfig;
10
12
  /**
11
13
  * Prefetch on mount.
12
- *
13
- * @this {PrefetchWhenVisibleInterface}
14
- * @returns {void}
15
14
  */
16
- mounted(this: PrefetchWhenVisibleInterface): void;
15
+ mounted(): void;
17
16
  }
18
- export type PrefetchWhenVisibleInterface = PrefetchWhenVisible & {
19
- $el: HTMLAnchorElement;
20
- };
21
- import AbstractPrefetch from "./AbstractPrefetch.js";
17
+ export {};
@@ -1 +1,20 @@
1
- import{withMountWhenInView as t}from"@studiometa/js-toolkit";import e from"./AbstractPrefetch.js";class i extends t(e){static config={...e.config,name:"PrefetchWhenVisible"};mounted(){this.prefetch(new URL(this.$el.href))}}export{i as default};
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) => {
4
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
+ return value;
6
+ };
7
+ import { withMountWhenInView } from "@studiometa/js-toolkit";
8
+ import { AbstractPrefetch } from "./AbstractPrefetch.js";
9
+ class PrefetchWhenVisible extends withMountWhenInView(AbstractPrefetch) {
10
+ mounted() {
11
+ this.prefetch(new URL(this.$el.href));
12
+ }
13
+ }
14
+ __publicField(PrefetchWhenVisible, "config", {
15
+ ...AbstractPrefetch.config,
16
+ name: "PrefetchWhenVisible"
17
+ });
18
+ export {
19
+ PrefetchWhenVisible
20
+ };
@@ -1,13 +1,7 @@
1
- var __create = Object.create;
2
1
  var __defProp = Object.defineProperty;
3
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
5
  var __copyProps = (to, from, except, desc) => {
12
6
  if (from && typeof from === "object" || typeof from === "function") {
13
7
  for (let key of __getOwnPropNames(from))
@@ -16,18 +10,13 @@ var __copyProps = (to, from, except, desc) => {
16
10
  }
17
11
  return to;
18
12
  };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
13
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
20
14
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
15
 
22
- // packages/ui/atoms/Prefetch/index.js
16
+ // packages/ui/atoms/Prefetch/index.ts
23
17
  var Prefetch_exports = {};
24
- __export(Prefetch_exports, {
25
- AbstractPrefetch: () => import_AbstractPrefetch.default,
26
- PrefetchWhenOver: () => import_PrefetchWhenOver.default,
27
- PrefetchWhenVisible: () => import_PrefetchWhenVisible.default
28
- });
29
18
  module.exports = __toCommonJS(Prefetch_exports);
30
- var import_AbstractPrefetch = __toESM(require("./AbstractPrefetch.cjs"), 1);
31
- var import_PrefetchWhenOver = __toESM(require("./PrefetchWhenOver.cjs"), 1);
32
- var import_PrefetchWhenVisible = __toESM(require("./PrefetchWhenVisible.cjs"), 1);
19
+ __reExport(Prefetch_exports, require("./AbstractPrefetch.cjs"), module.exports);
20
+ __reExport(Prefetch_exports, require("./PrefetchWhenOver.cjs"), module.exports);
21
+ __reExport(Prefetch_exports, require("./PrefetchWhenVisible.cjs"), module.exports);
33
22
  if (module.exports.default) module.exports = module.exports.default;
@@ -1,3 +1,3 @@
1
- export { default as AbstractPrefetch } from "./AbstractPrefetch.js";
2
- export { default as PrefetchWhenOver } from "./PrefetchWhenOver.js";
3
- export { default as PrefetchWhenVisible } from "./PrefetchWhenVisible.js";
1
+ export * from './AbstractPrefetch.js';
2
+ export * from './PrefetchWhenOver.js';
3
+ export * from './PrefetchWhenVisible.js';
@@ -1 +1,3 @@
1
- import{default as t}from"./AbstractPrefetch.js";import{default as a}from"./PrefetchWhenOver.js";import{default as h}from"./PrefetchWhenVisible.js";export{t as AbstractPrefetch,a as PrefetchWhenOver,h as PrefetchWhenVisible};
1
+ export * from "./AbstractPrefetch.js";
2
+ export * from "./PrefetchWhenOver.js";
3
+ export * from "./PrefetchWhenVisible.js";
@@ -21,10 +21,10 @@ var __publicField = (obj, key, value) => {
21
21
  return value;
22
22
  };
23
23
 
24
- // packages/ui/atoms/ScrollAnimation/AbstractScrollAnimation.js
24
+ // packages/ui/atoms/ScrollAnimation/AbstractScrollAnimation.ts
25
25
  var AbstractScrollAnimation_exports = {};
26
26
  __export(AbstractScrollAnimation_exports, {
27
- default: () => AbstractScrollAnimation
27
+ AbstractScrollAnimation: () => AbstractScrollAnimation
28
28
  });
29
29
  module.exports = __toCommonJS(AbstractScrollAnimation_exports);
30
30
  var import_js_toolkit = require("@studiometa/js-toolkit");
@@ -33,17 +33,28 @@ var AbstractScrollAnimation = class extends (0, import_js_toolkit.withFreezedOpt
33
33
  get target() {
34
34
  return this.$el;
35
35
  }
36
- animation;
37
- mounted() {
36
+ get animation() {
38
37
  let { keyframes } = this.$options;
39
38
  const { from, to } = this.$options;
40
39
  if (keyframes.length <= 0 && from && to) {
41
40
  keyframes = [from, to];
42
41
  }
43
- this.animation = (0, import_utils.animate)(this.target, keyframes, { easing: this.$options.easing });
42
+ const animation = (0, import_utils.animate)(this.target, keyframes, { easing: this.$options.easing });
43
+ Object.defineProperty(this, "animation", {
44
+ value: animation,
45
+ configurable: true
46
+ });
47
+ return animation;
44
48
  }
45
49
  scrolledInView(props) {
46
- const progress = (0, import_utils.map)((0, import_utils.clamp)(props.dampedProgress.y, this.$options.playRange[0], this.$options.playRange[1]), this.$options.playRange[0], this.$options.playRange[1], 0, 1);
50
+ const progress = (0, import_utils.map)(
51
+ (0, import_utils.clamp)(props.dampedProgress.y, this.$options.playRange[0], this.$options.playRange[1]),
52
+ this.$options.playRange[0],
53
+ this.$options.playRange[1],
54
+ 0,
55
+ 1
56
+ );
57
+ this.$options.playRange = [0, 0];
47
58
  this.render(progress);
48
59
  }
49
60
  render(progress) {
@@ -57,14 +68,6 @@ __publicField(AbstractScrollAnimation, "config", {
57
68
  type: Array,
58
69
  default: () => [0, 1]
59
70
  },
60
- dampFactor: {
61
- type: Number,
62
- default: 0.5
63
- },
64
- dampPrecision: {
65
- type: Number,
66
- default: 1e-3
67
- },
68
71
  from: {
69
72
  type: Object,
70
73
  default: () => ({})
@@ -1,106 +1,36 @@
1
- /**
2
- * @typedef {typeof AbstractScrollAnimation} AbstractScrollAnimationConstructor
3
- * @typedef {import('@studiometa/js-toolkit/utils/css/animate.js').Keyframe} Keyframe
4
- */
5
- /**
6
- * @typedef {AbstractScrollAnimation & {
7
- * $options: {
8
- * playRange: string,
9
- * dampFactor: number,
10
- * dampPrecision: number,
11
- * from: Keyframe,
12
- * to: Keyframe,
13
- * keyframes: Keyframe[],
14
- * },
15
- * }} ScrollAnimationChildInterface
16
- */
1
+ import { Base } from '@studiometa/js-toolkit';
2
+ import type { BaseProps, BaseConfig, ScrollInViewProps } from '@studiometa/js-toolkit';
3
+ import { animate } from '@studiometa/js-toolkit/utils';
4
+ import type { Keyframe } from '@studiometa/js-toolkit/utils';
5
+ export interface AbstractScrollAnimationProps extends BaseProps {
6
+ $options: {
7
+ playRange: [number, number];
8
+ from: Keyframe;
9
+ to: Keyframe;
10
+ keyframes: Keyframe[];
11
+ };
12
+ }
13
+ declare const AbstractScrollAnimation_base: import("@studiometa/js-toolkit").BaseDecorator<import("@studiometa/js-toolkit").WithFreezedOptionsInterface, Base<BaseProps>, BaseProps>;
17
14
  /**
18
15
  * AbstractScrollAnimation class.
19
- *
20
- * @todo add support for magic values in options to access key values:
21
- * - viewport size
22
- * - target size
23
- * - root element size
24
- * - etc.
25
- *
26
- * ```
27
- * data-option-to="{ x: 100%, y: innerWidth / 2 }"
28
- * ```
29
16
  */
30
- export default class AbstractScrollAnimation extends Base {
17
+ export declare class AbstractScrollAnimation<T extends BaseProps = BaseProps> extends AbstractScrollAnimation_base<T & AbstractScrollAnimationProps> {
31
18
  /**
32
19
  * Config.
33
20
  */
34
- static config: {
35
- name: string;
36
- options: {
37
- playRange: {
38
- type: ArrayConstructor;
39
- default: () => number[];
40
- };
41
- dampFactor: {
42
- type: NumberConstructor;
43
- default: number;
44
- };
45
- dampPrecision: {
46
- type: NumberConstructor;
47
- default: number;
48
- };
49
- from: {
50
- type: ObjectConstructor;
51
- default: () => {};
52
- };
53
- to: {
54
- type: ObjectConstructor;
55
- default: () => {};
56
- };
57
- keyframes: {
58
- type: ArrayConstructor;
59
- };
60
- easing: {
61
- type: ArrayConstructor;
62
- default: () => number[];
63
- };
64
- };
65
- };
21
+ static config: BaseConfig;
66
22
  /**
67
23
  * Get the target element for the animation.
68
- *
69
- * @returns {HTMLElement}
70
24
  */
71
25
  get target(): HTMLElement;
72
26
  /**
73
- * @type {ReturnType<animate>}
74
- */
75
- animation: ReturnType<typeof animate>;
76
- /**
77
- * @this {ScrollAnimationChildInterface}
78
- * @returns {void}
79
- */
80
- mounted(this: ScrollAnimationChildInterface): void;
81
- /**
82
- * @todo do not add unnecessary styles
27
+ * Lazily get animation.
83
28
  */
84
- scrolledInView(props: any): void;
29
+ get animation(): ReturnType<typeof animate>;
30
+ scrolledInView(props: ScrollInViewProps): void;
85
31
  /**
86
32
  * Render the animation for the given progress.
87
- *
88
- * @param {number} progress
89
- * @returns {void}
90
33
  */
91
34
  render(progress: number): void;
92
35
  }
93
- export type AbstractScrollAnimationConstructor = typeof AbstractScrollAnimation;
94
- export type Keyframe = import('@studiometa/js-toolkit/utils/css/animate.js').Keyframe;
95
- export type ScrollAnimationChildInterface = AbstractScrollAnimation & {
96
- $options: {
97
- playRange: string;
98
- dampFactor: number;
99
- dampPrecision: number;
100
- from: Keyframe;
101
- to: Keyframe;
102
- keyframes: Keyframe[];
103
- };
104
- };
105
- import { Base } from "@studiometa/js-toolkit";
106
- import { animate } from "@studiometa/js-toolkit/utils/css/animate.js";
36
+ export {};
@@ -1 +1,67 @@
1
- import{Base as i,withFreezedOptions as o}from"@studiometa/js-toolkit";import{map as s,clamp as n,animate as r}from"@studiometa/js-toolkit/utils";class p extends o(i){static config={name:"AbstractScrollAnimation",options:{playRange:{type:Array,default:()=>[0,1]},dampFactor:{type:Number,default:.5},dampPrecision:{type:Number,default:.001},from:{type:Object,default:()=>({})},to:{type:Object,default:()=>({})},keyframes:{type:Array},easing:{type:Array,default:()=>[0,0,1,1]}}};get target(){return this.$el}animation;mounted(){let{keyframes:t}=this.$options;const{from:e,to:a}=this.$options;t.length<=0&&e&&a&&(t=[e,a]),this.animation=r(this.target,t,{easing:this.$options.easing})}scrolledInView(t){const e=s(n(t.dampedProgress.y,this.$options.playRange[0],this.$options.playRange[1]),this.$options.playRange[0],this.$options.playRange[1],0,1);this.render(e)}render(t){this.animation.progress(t)}}export{p as default};
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) => {
4
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
+ return value;
6
+ };
7
+ import { Base, withFreezedOptions } from "@studiometa/js-toolkit";
8
+ import { map, clamp, animate } from "@studiometa/js-toolkit/utils";
9
+ class AbstractScrollAnimation extends withFreezedOptions(Base) {
10
+ get target() {
11
+ return this.$el;
12
+ }
13
+ get animation() {
14
+ let { keyframes } = this.$options;
15
+ const { from, to } = this.$options;
16
+ if (keyframes.length <= 0 && from && to) {
17
+ keyframes = [from, to];
18
+ }
19
+ const animation = animate(this.target, keyframes, { easing: this.$options.easing });
20
+ Object.defineProperty(this, "animation", {
21
+ value: animation,
22
+ configurable: true
23
+ });
24
+ return animation;
25
+ }
26
+ scrolledInView(props) {
27
+ const progress = map(
28
+ clamp(props.dampedProgress.y, this.$options.playRange[0], this.$options.playRange[1]),
29
+ this.$options.playRange[0],
30
+ this.$options.playRange[1],
31
+ 0,
32
+ 1
33
+ );
34
+ this.$options.playRange = [0, 0];
35
+ this.render(progress);
36
+ }
37
+ render(progress) {
38
+ this.animation.progress(progress);
39
+ }
40
+ }
41
+ __publicField(AbstractScrollAnimation, "config", {
42
+ name: "AbstractScrollAnimation",
43
+ options: {
44
+ playRange: {
45
+ type: Array,
46
+ default: () => [0, 1]
47
+ },
48
+ from: {
49
+ type: Object,
50
+ default: () => ({})
51
+ },
52
+ to: {
53
+ type: Object,
54
+ default: () => ({})
55
+ },
56
+ keyframes: {
57
+ type: Array
58
+ },
59
+ easing: {
60
+ type: Array,
61
+ default: () => [0, 0, 1, 1]
62
+ }
63
+ }
64
+ });
65
+ export {
66
+ AbstractScrollAnimation
67
+ };