@studiometa/ui 0.2.12 → 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.
- package/atoms/AnchorScrollTo/AnchorScrollTo.cjs +3 -3
- package/atoms/AnchorScrollTo/AnchorScrollTo.d.ts +8 -15
- package/atoms/AnchorScrollTo/AnchorScrollTo.js +26 -1
- package/atoms/AnchorScrollTo/index.cjs +20 -0
- package/atoms/AnchorScrollTo/index.d.ts +1 -0
- package/atoms/AnchorScrollTo/index.js +1 -0
- package/atoms/Cursor/Cursor.cjs +16 -9
- package/atoms/Cursor/Cursor.d.ts +19 -117
- package/atoms/Cursor/Cursor.js +111 -1
- package/atoms/Cursor/index.cjs +20 -0
- package/atoms/Cursor/index.d.ts +1 -0
- package/atoms/Cursor/index.js +1 -0
- package/atoms/Figure/Figure.cjs +15 -9
- package/atoms/Figure/Figure.d.ts +18 -53
- package/atoms/Figure/Figure.js +56 -1
- package/atoms/Figure/FigureTwicPics.cjs +10 -10
- package/atoms/Figure/FigureTwicPics.d.ts +16 -37
- package/atoms/Figure/FigureTwicPics.js +51 -1
- package/atoms/Figure/index.cjs +4 -14
- package/atoms/Figure/index.d.ts +2 -2
- package/atoms/Figure/index.js +2 -1
- package/atoms/LargeText/LargeText.cjs +17 -10
- package/atoms/LargeText/LargeText.d.ts +19 -40
- package/atoms/LargeText/LargeText.js +68 -1
- package/atoms/LargeText/index.cjs +20 -0
- package/atoms/LargeText/index.d.ts +1 -0
- package/atoms/LargeText/index.js +1 -0
- package/atoms/LazyInclude/LazyInclude.cjs +2 -2
- package/atoms/LazyInclude/LazyInclude.d.ts +17 -36
- package/atoms/LazyInclude/LazyInclude.js +46 -1
- package/atoms/LazyInclude/index.cjs +20 -0
- package/atoms/LazyInclude/index.d.ts +1 -0
- package/atoms/LazyInclude/index.js +1 -0
- package/atoms/Prefetch/AbstractPrefetch.cjs +6 -6
- package/atoms/Prefetch/AbstractPrefetch.d.ts +12 -35
- package/atoms/Prefetch/AbstractPrefetch.js +58 -1
- package/atoms/Prefetch/PrefetchWhenOver.cjs +5 -8
- package/atoms/Prefetch/PrefetchWhenOver.d.ts +8 -14
- package/atoms/Prefetch/PrefetchWhenOver.js +19 -1
- package/atoms/Prefetch/PrefetchWhenVisible.cjs +5 -8
- package/atoms/Prefetch/PrefetchWhenVisible.d.ts +10 -14
- package/atoms/Prefetch/PrefetchWhenVisible.js +20 -1
- package/atoms/Prefetch/index.cjs +5 -16
- package/atoms/Prefetch/index.d.ts +3 -3
- package/atoms/Prefetch/index.js +3 -1
- package/atoms/ScrollAnimation/AbstractScrollAnimation.cjs +17 -14
- package/atoms/ScrollAnimation/AbstractScrollAnimation.d.ts +19 -89
- package/atoms/ScrollAnimation/AbstractScrollAnimation.js +67 -1
- package/atoms/ScrollAnimation/ScrollAnimation.cjs +5 -14
- package/atoms/ScrollAnimation/ScrollAnimation.d.ts +13 -51
- package/atoms/ScrollAnimation/ScrollAnimation.js +21 -1
- package/atoms/ScrollAnimation/ScrollAnimationChild.cjs +37 -14
- package/atoms/ScrollAnimation/ScrollAnimationChild.d.ts +19 -6
- package/atoms/ScrollAnimation/ScrollAnimationChild.js +53 -1
- package/atoms/ScrollAnimation/ScrollAnimationChildWithEase.cjs +6 -9
- package/atoms/ScrollAnimation/ScrollAnimationChildWithEase.d.ts +8 -2
- package/atoms/ScrollAnimation/ScrollAnimationChildWithEase.js +17 -1
- package/atoms/ScrollAnimation/ScrollAnimationParent.cjs +8 -8
- package/atoms/ScrollAnimation/ScrollAnimationParent.d.ts +14 -26
- package/atoms/ScrollAnimation/ScrollAnimationParent.js +27 -1
- package/atoms/ScrollAnimation/ScrollAnimationWithEase.cjs +6 -9
- package/atoms/ScrollAnimation/ScrollAnimationWithEase.d.ts +15 -2
- package/atoms/ScrollAnimation/ScrollAnimationWithEase.js +17 -1
- package/atoms/ScrollAnimation/animationScrollWithEase.cjs +24 -16
- package/atoms/ScrollAnimation/animationScrollWithEase.d.ts +10 -8
- package/atoms/ScrollAnimation/animationScrollWithEase.js +36 -1
- package/atoms/ScrollAnimation/index.cjs +9 -24
- package/atoms/ScrollAnimation/index.d.ts +7 -7
- package/atoms/ScrollAnimation/index.js +7 -1
- package/atoms/ScrollReveal/ScrollReveal.cjs +7 -4
- package/atoms/ScrollReveal/ScrollReveal.d.ts +16 -59
- package/atoms/ScrollReveal/ScrollReveal.js +54 -1
- package/atoms/ScrollReveal/index.cjs +3 -12
- package/atoms/ScrollReveal/index.d.ts +1 -1
- package/atoms/ScrollReveal/index.js +1 -1
- package/atoms/index.cjs +5 -18
- package/atoms/index.d.ts +8 -8
- package/atoms/index.js +8 -1
- package/decorators/index.cjs +3 -12
- package/decorators/index.d.ts +1 -1
- package/decorators/index.js +1 -1
- package/decorators/withTransition.cjs +44 -29
- package/decorators/withTransition.d.ts +21 -33
- package/decorators/withTransition.js +60 -1
- package/index.cjs +1 -1
- package/index.d.ts +5 -5
- package/index.js +5 -1
- package/molecules/Accordion/Accordion.cjs +7 -10
- package/molecules/Accordion/Accordion.d.ts +5 -23
- package/molecules/Accordion/Accordion.js +19 -1
- package/molecules/Accordion/AccordionCore.cjs +6 -8
- package/molecules/Accordion/AccordionCore.d.ts +22 -70
- package/molecules/Accordion/AccordionCore.js +32 -1
- package/molecules/Accordion/AccordionItem.cjs +39 -23
- package/molecules/Accordion/AccordionItem.d.ts +24 -94
- package/molecules/Accordion/AccordionItem.js +153 -1
- package/molecules/Accordion/index.cjs +21 -0
- package/molecules/Accordion/index.d.ts +2 -0
- package/molecules/Accordion/index.js +2 -0
- package/molecules/Menu/Menu.cjs +6 -10
- package/molecules/Menu/Menu.d.ts +24 -84
- package/molecules/Menu/Menu.js +114 -1
- package/molecules/Menu/MenuBtn.cjs +7 -5
- package/molecules/Menu/MenuBtn.d.ts +7 -9
- package/molecules/Menu/MenuBtn.js +30 -1
- package/molecules/Menu/MenuList.cjs +13 -11
- package/molecules/Menu/MenuList.d.ts +16 -53
- package/molecules/Menu/MenuList.js +113 -1
- package/molecules/Menu/index.cjs +5 -16
- package/molecules/Menu/index.d.ts +3 -3
- package/molecules/Menu/index.js +3 -1
- package/molecules/Modal/Modal.cjs +42 -13
- package/molecules/Modal/Modal.d.ts +69 -140
- package/molecules/Modal/Modal.js +163 -1
- package/molecules/Modal/ModalWithTransition.cjs +4 -7
- package/molecules/Modal/ModalWithTransition.d.ts +6 -22
- package/molecules/Modal/ModalWithTransition.js +46 -1
- package/molecules/Modal/index.cjs +21 -0
- package/molecules/Modal/index.d.ts +2 -0
- package/molecules/Modal/index.js +2 -0
- package/molecules/Panel/Panel.cjs +41 -26
- package/molecules/Panel/Panel.d.ts +22 -21
- package/molecules/Panel/Panel.js +108 -1
- package/molecules/Panel/index.cjs +20 -0
- package/molecules/Panel/index.d.ts +1 -0
- package/molecules/Panel/index.js +1 -0
- package/molecules/Slider/AbstractSliderChild.cjs +7 -9
- package/molecules/Slider/AbstractSliderChild.d.ts +11 -30
- package/molecules/Slider/AbstractSliderChild.js +48 -1
- package/molecules/Slider/Slider.cjs +46 -30
- package/molecules/Slider/Slider.d.ts +40 -157
- package/molecules/Slider/Slider.js +279 -1
- package/molecules/Slider/SliderBtn.cjs +4 -7
- package/molecules/Slider/SliderBtn.d.ts +12 -23
- package/molecules/Slider/SliderBtn.js +34 -1
- package/molecules/Slider/SliderCount.cjs +4 -7
- package/molecules/Slider/SliderCount.d.ts +10 -16
- package/molecules/Slider/SliderCount.js +19 -1
- package/molecules/Slider/SliderDots.cjs +8 -8
- package/molecules/Slider/SliderDots.d.ts +11 -31
- package/molecules/Slider/SliderDots.js +32 -1
- package/molecules/Slider/SliderDrag.cjs +2 -2
- package/molecules/Slider/SliderDrag.d.ts +12 -30
- package/molecules/Slider/SliderDrag.js +34 -1
- package/molecules/Slider/SliderItem.cjs +12 -6
- package/molecules/Slider/SliderItem.d.ts +21 -33
- package/molecules/Slider/SliderItem.js +93 -1
- package/molecules/Slider/SliderProgress.cjs +4 -7
- package/molecules/Slider/SliderProgress.d.ts +10 -25
- package/molecules/Slider/SliderProgress.js +26 -1
- package/molecules/Slider/index.cjs +10 -26
- package/molecules/Slider/index.d.ts +8 -8
- package/molecules/Slider/index.js +8 -1
- package/molecules/Sticky/Sticky.cjs +16 -10
- package/molecules/Sticky/Sticky.d.ts +30 -68
- package/molecules/Sticky/Sticky.js +110 -1
- package/molecules/Sticky/index.cjs +20 -0
- package/molecules/Sticky/index.d.ts +1 -0
- package/molecules/Sticky/index.js +1 -0
- package/molecules/TableOfContent/TableOfContent.cjs +5 -8
- package/molecules/TableOfContent/TableOfContent.d.ts +19 -41
- package/molecules/TableOfContent/TableOfContent.js +42 -1
- package/molecules/TableOfContent/TableOfContentAnchor.cjs +9 -5
- package/molecules/TableOfContent/TableOfContentAnchor.d.ts +14 -17
- package/molecules/TableOfContent/TableOfContentAnchor.js +43 -1
- package/molecules/TableOfContent/index.cjs +4 -14
- package/molecules/TableOfContent/index.d.ts +2 -2
- package/molecules/TableOfContent/index.js +2 -1
- package/molecules/Tabs/Tabs.cjs +42 -22
- package/molecules/Tabs/Tabs.d.ts +28 -90
- package/molecules/Tabs/Tabs.js +123 -1
- package/molecules/Tabs/index.cjs +20 -0
- package/molecules/Tabs/index.d.ts +1 -0
- package/molecules/Tabs/index.js +1 -0
- package/molecules/index.cjs +7 -24
- package/molecules/index.d.ts +9 -10
- package/molecules/index.js +9 -1
- package/organisms/Frame/Frame.cjs +20 -43
- package/organisms/Frame/Frame.d.ts +21 -98
- package/organisms/Frame/Frame.js +161 -1
- package/organisms/Frame/FrameAnchor.cjs +2 -2
- package/organisms/Frame/FrameAnchor.d.ts +7 -16
- package/organisms/Frame/FrameAnchor.js +18 -1
- package/organisms/Frame/FrameForm.cjs +2 -2
- package/organisms/Frame/FrameForm.d.ts +10 -16
- package/organisms/Frame/FrameForm.js +18 -1
- package/organisms/Frame/FrameTarget.cjs +15 -7
- package/organisms/Frame/FrameTarget.d.ts +17 -26
- package/organisms/Frame/FrameTarget.js +79 -1
- package/organisms/Frame/index.cjs +6 -18
- package/organisms/Frame/index.d.ts +4 -4
- package/organisms/Frame/index.js +4 -1
- package/organisms/index.cjs +1 -1
- package/organisms/index.d.ts +1 -1
- package/organisms/index.js +1 -1
- package/package.json +2 -2
- package/primitives/Draggable/Draggable.cjs +9 -6
- package/primitives/Draggable/Draggable.d.ts +10 -11
- package/primitives/Draggable/Draggable.js +33 -1
- package/primitives/Draggable/index.cjs +20 -0
- package/primitives/Draggable/index.d.ts +1 -0
- package/primitives/Draggable/index.js +1 -0
- package/primitives/Sentinel/Sentinel.cjs +2 -2
- package/primitives/Sentinel/Sentinel.d.ts +6 -5
- package/primitives/Sentinel/Sentinel.js +15 -1
- package/primitives/Sentinel/index.cjs +20 -0
- package/primitives/Sentinel/index.d.ts +1 -0
- package/primitives/Sentinel/index.js +1 -0
- package/primitives/Transition/Transition.cjs +12 -3
- package/primitives/Transition/Transition.d.ts +13 -7
- package/primitives/Transition/Transition.js +16 -1
- package/primitives/Transition/index.cjs +20 -0
- package/primitives/Transition/index.d.ts +1 -0
- package/primitives/Transition/index.js +1 -0
- package/primitives/index.cjs +5 -16
- package/primitives/index.d.ts +3 -3
- package/primitives/index.js +3 -1
|
@@ -1,37 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import { Base } from '@studiometa/js-toolkit';
|
|
2
|
+
import type { BaseProps, BaseConfig } from '@studiometa/js-toolkit';
|
|
3
|
+
import { TableOfContentAnchor } from './TableOfContentAnchor.js';
|
|
4
|
+
export interface TableOfContentProps extends BaseProps {
|
|
5
|
+
$refs: {
|
|
6
|
+
itemTemplate: HTMLTemplateElement;
|
|
7
|
+
list: HTMLUListElement;
|
|
8
|
+
};
|
|
9
|
+
$options: {
|
|
10
|
+
contentSelector: string;
|
|
11
|
+
withTemplate: boolean;
|
|
12
|
+
};
|
|
13
|
+
$children: {
|
|
14
|
+
TableOfContentAnchor: TableOfContentAnchor[];
|
|
15
|
+
};
|
|
16
|
+
}
|
|
13
17
|
/**
|
|
14
18
|
* TableOfContent class.
|
|
15
19
|
*/
|
|
16
|
-
export
|
|
20
|
+
export declare class TableOfContent<T extends BaseProps = BaseProps> extends Base<T & TableOfContentProps> {
|
|
17
21
|
/**
|
|
18
22
|
* Config.
|
|
19
23
|
*/
|
|
20
|
-
static config:
|
|
21
|
-
name: string;
|
|
22
|
-
refs: string[];
|
|
23
|
-
components: {
|
|
24
|
-
TableOfContentAnchor: typeof TableOfContentAnchor;
|
|
25
|
-
};
|
|
26
|
-
options: {
|
|
27
|
-
contentSelector: StringConstructor;
|
|
28
|
-
withTemplate: BooleanConstructor;
|
|
29
|
-
};
|
|
30
|
-
};
|
|
24
|
+
static config: BaseConfig;
|
|
31
25
|
/**
|
|
32
26
|
* Generate anchors on mount and update the component to instantiate the
|
|
33
27
|
* `TableOfContentAnchor` components.
|
|
34
|
-
* @returns {void}
|
|
35
28
|
*/
|
|
36
29
|
mounted(): void;
|
|
37
30
|
/**
|
|
@@ -39,21 +32,6 @@ export default class TableOfContent extends Base {
|
|
|
39
32
|
*
|
|
40
33
|
* @todo Read anchor template from a ref?
|
|
41
34
|
* @todo Better API to easily override the template function, maybe a `render` function?
|
|
42
|
-
*
|
|
43
|
-
* @this {TableOfContentInterface}
|
|
44
|
-
* @returns {void}
|
|
45
35
|
*/
|
|
46
|
-
generateAnchors(
|
|
36
|
+
generateAnchors(): void;
|
|
47
37
|
}
|
|
48
|
-
export type TableOfContentInterface = TableOfContent & {
|
|
49
|
-
$refs: {
|
|
50
|
-
itemTemplate: HTMLTemplateElement;
|
|
51
|
-
list: HTMLUListElement;
|
|
52
|
-
};
|
|
53
|
-
$options: {
|
|
54
|
-
contentSelector: string;
|
|
55
|
-
withTemplate: boolean;
|
|
56
|
-
};
|
|
57
|
-
};
|
|
58
|
-
import { Base } from "@studiometa/js-toolkit";
|
|
59
|
-
import TableOfContentAnchor from "./TableOfContentAnchor.js";
|
|
@@ -1 +1,42 @@
|
|
|
1
|
-
|
|
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
|
+
import { TableOfContentAnchor } from "./TableOfContentAnchor.js";
|
|
9
|
+
class TableOfContent extends Base {
|
|
10
|
+
mounted() {
|
|
11
|
+
if (this.$options.withTemplate) {
|
|
12
|
+
this.generateAnchors();
|
|
13
|
+
this.$update();
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
generateAnchors() {
|
|
17
|
+
document.querySelectorAll(this.$options.contentSelector).forEach((section) => {
|
|
18
|
+
const tpl = document.createElement("div");
|
|
19
|
+
tpl.innerHTML = this.$refs.itemTemplate.innerHTML;
|
|
20
|
+
const li = tpl.querySelector("li");
|
|
21
|
+
const anchor = li.querySelector("a");
|
|
22
|
+
anchor.href = `#${section.id}`;
|
|
23
|
+
anchor.innerHTML = section.textContent;
|
|
24
|
+
anchor.dataset.component = "TableOfContentAnchor";
|
|
25
|
+
this.$refs.list.append(li);
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
__publicField(TableOfContent, "config", {
|
|
30
|
+
name: "TableOfContent",
|
|
31
|
+
refs: ["itemTemplate", "list"],
|
|
32
|
+
components: {
|
|
33
|
+
TableOfContentAnchor
|
|
34
|
+
},
|
|
35
|
+
options: {
|
|
36
|
+
contentSelector: String,
|
|
37
|
+
withTemplate: Boolean
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
export {
|
|
41
|
+
TableOfContent
|
|
42
|
+
};
|
|
@@ -21,14 +21,18 @@ var __publicField = (obj, key, value) => {
|
|
|
21
21
|
return value;
|
|
22
22
|
};
|
|
23
23
|
|
|
24
|
-
// packages/ui/molecules/TableOfContent/TableOfContentAnchor.
|
|
24
|
+
// packages/ui/molecules/TableOfContent/TableOfContentAnchor.ts
|
|
25
25
|
var TableOfContentAnchor_exports = {};
|
|
26
26
|
__export(TableOfContentAnchor_exports, {
|
|
27
|
-
|
|
27
|
+
TableOfContentAnchor: () => TableOfContentAnchor
|
|
28
28
|
});
|
|
29
29
|
module.exports = __toCommonJS(TableOfContentAnchor_exports);
|
|
30
30
|
var import_atoms = require("../../atoms/index.cjs");
|
|
31
31
|
var TableOfContentAnchor = class extends import_atoms.AnchorScrollTo {
|
|
32
|
+
constructor() {
|
|
33
|
+
super(...arguments);
|
|
34
|
+
__publicField(this, "__observer");
|
|
35
|
+
}
|
|
32
36
|
get sentinel() {
|
|
33
37
|
return document.querySelector(this.targetSelector);
|
|
34
38
|
}
|
|
@@ -36,15 +40,15 @@ var TableOfContentAnchor = class extends import_atoms.AnchorScrollTo {
|
|
|
36
40
|
if (!this.sentinel) {
|
|
37
41
|
return;
|
|
38
42
|
}
|
|
39
|
-
this.
|
|
43
|
+
this.__observer = new IntersectionObserver(([entry]) => {
|
|
40
44
|
const shouldActivate = entry.isIntersecting && entry.boundingClientRect.y < 100 && entry.boundingClientRect.y > 100;
|
|
41
45
|
this.$el.classList.toggle(this.$options.activeClass, shouldActivate);
|
|
42
46
|
this.$emit("should-activate", shouldActivate);
|
|
43
47
|
});
|
|
44
|
-
this.
|
|
48
|
+
this.__observer.observe(this.sentinel);
|
|
45
49
|
}
|
|
46
50
|
destroyed() {
|
|
47
|
-
this.
|
|
51
|
+
this.__observer.disconnect();
|
|
48
52
|
}
|
|
49
53
|
};
|
|
50
54
|
__publicField(TableOfContentAnchor, "config", {
|
|
@@ -1,36 +1,33 @@
|
|
|
1
|
+
import type { BaseProps, BaseConfig } from '@studiometa/js-toolkit';
|
|
2
|
+
import { AnchorScrollTo } from '../../atoms/index.js';
|
|
3
|
+
export interface TableOfContentAnchorProps extends BaseProps {
|
|
4
|
+
$options: {
|
|
5
|
+
activeClass: string;
|
|
6
|
+
};
|
|
7
|
+
}
|
|
1
8
|
/**
|
|
2
9
|
* TableOfContentAnchor class.
|
|
3
10
|
*/
|
|
4
|
-
export
|
|
11
|
+
export declare class TableOfContentAnchor<T extends BaseProps = BaseProps> extends AnchorScrollTo<T & TableOfContentAnchorProps> {
|
|
5
12
|
/**
|
|
6
13
|
* Config.
|
|
7
14
|
*/
|
|
8
|
-
static config:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
default: string;
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
};
|
|
15
|
+
static config: BaseConfig;
|
|
16
|
+
/**
|
|
17
|
+
* Observer.
|
|
18
|
+
* @private
|
|
19
|
+
*/
|
|
20
|
+
__observer: IntersectionObserver;
|
|
18
21
|
/**
|
|
19
22
|
* Get the sentinel.
|
|
20
|
-
* @returns {HTMLElement}
|
|
21
23
|
*/
|
|
22
24
|
get sentinel(): HTMLElement;
|
|
23
25
|
/**
|
|
24
26
|
* Init observer on mount.
|
|
25
|
-
* @returns {void}
|
|
26
27
|
*/
|
|
27
28
|
mounted(): void;
|
|
28
|
-
observer: IntersectionObserver;
|
|
29
29
|
/**
|
|
30
30
|
* Destroy observer on destroy.
|
|
31
|
-
*
|
|
32
|
-
* @returns {void}
|
|
33
31
|
*/
|
|
34
32
|
destroyed(): void;
|
|
35
33
|
}
|
|
36
|
-
import { AnchorScrollTo } from "../../atoms/index.js";
|
|
@@ -1 +1,43 @@
|
|
|
1
|
-
|
|
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 { AnchorScrollTo } from "../../atoms/index.js";
|
|
8
|
+
class TableOfContentAnchor extends AnchorScrollTo {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments);
|
|
11
|
+
__publicField(this, "__observer");
|
|
12
|
+
}
|
|
13
|
+
get sentinel() {
|
|
14
|
+
return document.querySelector(this.targetSelector);
|
|
15
|
+
}
|
|
16
|
+
mounted() {
|
|
17
|
+
if (!this.sentinel) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
this.__observer = new IntersectionObserver(([entry]) => {
|
|
21
|
+
const shouldActivate = entry.isIntersecting && entry.boundingClientRect.y < 100 && entry.boundingClientRect.y > 100;
|
|
22
|
+
this.$el.classList.toggle(this.$options.activeClass, shouldActivate);
|
|
23
|
+
this.$emit("should-activate", shouldActivate);
|
|
24
|
+
});
|
|
25
|
+
this.__observer.observe(this.sentinel);
|
|
26
|
+
}
|
|
27
|
+
destroyed() {
|
|
28
|
+
this.__observer.disconnect();
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
__publicField(TableOfContentAnchor, "config", {
|
|
32
|
+
name: "TableOfContentAnchor",
|
|
33
|
+
emits: ["should-activate"],
|
|
34
|
+
options: {
|
|
35
|
+
activeClass: {
|
|
36
|
+
type: String,
|
|
37
|
+
default: "is-active"
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
export {
|
|
42
|
+
TableOfContentAnchor
|
|
43
|
+
};
|
|
@@ -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,16 +10,12 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
10
|
}
|
|
17
11
|
return to;
|
|
18
12
|
};
|
|
19
|
-
var
|
|
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/molecules/TableOfContent/index.
|
|
16
|
+
// packages/ui/molecules/TableOfContent/index.ts
|
|
23
17
|
var TableOfContent_exports = {};
|
|
24
|
-
__export(TableOfContent_exports, {
|
|
25
|
-
TableOfContent: () => import_TableOfContent.default,
|
|
26
|
-
TableOfContentAnchor: () => import_TableOfContentAnchor.default
|
|
27
|
-
});
|
|
28
18
|
module.exports = __toCommonJS(TableOfContent_exports);
|
|
29
|
-
|
|
30
|
-
|
|
19
|
+
__reExport(TableOfContent_exports, require("./TableOfContent.cjs"), module.exports);
|
|
20
|
+
__reExport(TableOfContent_exports, require("./TableOfContentAnchor.cjs"), module.exports);
|
|
31
21
|
if (module.exports.default) module.exports = module.exports.default;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
1
|
+
export * from './TableOfContent.js';
|
|
2
|
+
export * from './TableOfContentAnchor.js';
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
export * from "./TableOfContent.js";
|
|
2
|
+
export * from "./TableOfContentAnchor.js";
|
package/molecules/Tabs/Tabs.cjs
CHANGED
|
@@ -21,15 +21,19 @@ var __publicField = (obj, key, value) => {
|
|
|
21
21
|
return value;
|
|
22
22
|
};
|
|
23
23
|
|
|
24
|
-
// packages/ui/molecules/Tabs/Tabs.
|
|
24
|
+
// packages/ui/molecules/Tabs/Tabs.ts
|
|
25
25
|
var Tabs_exports = {};
|
|
26
26
|
__export(Tabs_exports, {
|
|
27
|
-
|
|
27
|
+
Tabs: () => Tabs
|
|
28
28
|
});
|
|
29
29
|
module.exports = __toCommonJS(Tabs_exports);
|
|
30
30
|
var import_js_toolkit = require("@studiometa/js-toolkit");
|
|
31
31
|
var import_utils = require("@studiometa/js-toolkit/utils");
|
|
32
32
|
var Tabs = class extends import_js_toolkit.Base {
|
|
33
|
+
constructor() {
|
|
34
|
+
super(...arguments);
|
|
35
|
+
__publicField(this, "items");
|
|
36
|
+
}
|
|
33
37
|
mounted() {
|
|
34
38
|
this.items = this.$refs.btn.map((btn, index) => {
|
|
35
39
|
const id = `${this.$id}-${index}`;
|
|
@@ -64,16 +68,24 @@ var Tabs = class extends import_js_toolkit.Base {
|
|
|
64
68
|
content.setAttribute("aria-hidden", "false");
|
|
65
69
|
this.$emit("enable", item);
|
|
66
70
|
return Promise.all([
|
|
67
|
-
(0, import_utils.transition)(
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
71
|
+
(0, import_utils.transition)(
|
|
72
|
+
btn,
|
|
73
|
+
{
|
|
74
|
+
from: btnStyles.closed,
|
|
75
|
+
active: btnStyles.active,
|
|
76
|
+
to: btnStyles.open
|
|
77
|
+
},
|
|
78
|
+
"keep"
|
|
79
|
+
),
|
|
80
|
+
(0, import_utils.transition)(
|
|
81
|
+
content,
|
|
82
|
+
{
|
|
83
|
+
from: contentStyles.closed,
|
|
84
|
+
active: contentStyles.active,
|
|
85
|
+
to: contentStyles.open
|
|
86
|
+
},
|
|
87
|
+
"keep"
|
|
88
|
+
)
|
|
77
89
|
]).then(() => Promise.resolve(this));
|
|
78
90
|
}
|
|
79
91
|
async disableItem(item) {
|
|
@@ -87,16 +99,24 @@ var Tabs = class extends import_js_toolkit.Base {
|
|
|
87
99
|
content.setAttribute("aria-hidden", "true");
|
|
88
100
|
this.$emit("disable", item);
|
|
89
101
|
return Promise.all([
|
|
90
|
-
(0, import_utils.transition)(
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
102
|
+
(0, import_utils.transition)(
|
|
103
|
+
btn,
|
|
104
|
+
{
|
|
105
|
+
from: btnStyles.open,
|
|
106
|
+
active: btnStyles.active,
|
|
107
|
+
to: btnStyles.closed
|
|
108
|
+
},
|
|
109
|
+
"keep"
|
|
110
|
+
),
|
|
111
|
+
(0, import_utils.transition)(
|
|
112
|
+
content,
|
|
113
|
+
{
|
|
114
|
+
from: contentStyles.open,
|
|
115
|
+
active: contentStyles.active,
|
|
116
|
+
to: contentStyles.closed
|
|
117
|
+
},
|
|
118
|
+
"keep"
|
|
119
|
+
)
|
|
100
120
|
]).then(() => Promise.resolve(this));
|
|
101
121
|
}
|
|
102
122
|
};
|
package/molecules/Tabs/Tabs.d.ts
CHANGED
|
@@ -1,108 +1,46 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* @typedef {Object} TabsOptions
|
|
21
|
-
* @property {TabsStylesOption} styles
|
|
22
|
-
*/
|
|
23
|
-
/**
|
|
24
|
-
* @typedef {Object} TabsPrivateInterface
|
|
25
|
-
* @property {TabsOptions} $options
|
|
26
|
-
* @property {TabsRefs} $refs
|
|
27
|
-
* @property {Array<TabItem>} items
|
|
28
|
-
*/
|
|
29
|
-
/**
|
|
30
|
-
* @typedef {Tabs & TabsPrivateInterface} TabsInterface
|
|
31
|
-
*/
|
|
1
|
+
import { Base } from '@studiometa/js-toolkit';
|
|
2
|
+
import type { BaseProps, BaseConfig } from '@studiometa/js-toolkit';
|
|
3
|
+
declare type TabItem = {
|
|
4
|
+
btn: HTMLElement;
|
|
5
|
+
content: HTMLElement;
|
|
6
|
+
isEnabled: boolean;
|
|
7
|
+
};
|
|
8
|
+
declare type TabsStates = Partial<Record<'open' | 'active' | 'closed', string | Partial<CSSStyleDeclaration>>>;
|
|
9
|
+
declare type TabsStylesOption = Partial<Record<keyof TabsProps['$refs'], TabsStates>>;
|
|
10
|
+
export interface TabsProps extends BaseProps {
|
|
11
|
+
$options: {
|
|
12
|
+
styles: TabsStylesOption;
|
|
13
|
+
};
|
|
14
|
+
$refs: {
|
|
15
|
+
btn: HTMLElement[];
|
|
16
|
+
content: HTMLElement[];
|
|
17
|
+
};
|
|
18
|
+
}
|
|
32
19
|
/**
|
|
33
20
|
* Tabs class.
|
|
34
21
|
*/
|
|
35
|
-
export
|
|
22
|
+
export declare class Tabs<T extends BaseProps = BaseProps> extends Base<T & TabsProps> {
|
|
36
23
|
/**
|
|
37
|
-
*
|
|
24
|
+
* Config.
|
|
38
25
|
*/
|
|
39
|
-
static config:
|
|
40
|
-
|
|
41
|
-
refs: string[];
|
|
42
|
-
emits: string[];
|
|
43
|
-
options: {
|
|
44
|
-
styles: {
|
|
45
|
-
type: ObjectConstructor;
|
|
46
|
-
/**
|
|
47
|
-
* @return {TabsStylesOption}
|
|
48
|
-
*/
|
|
49
|
-
default: () => TabsStylesOption;
|
|
50
|
-
merge: boolean;
|
|
51
|
-
};
|
|
52
|
-
};
|
|
53
|
-
};
|
|
26
|
+
static config: BaseConfig;
|
|
27
|
+
items: TabItem[];
|
|
54
28
|
/**
|
|
55
29
|
* Initialize the component's behaviours.
|
|
56
|
-
* @
|
|
57
|
-
* @return {void}
|
|
30
|
+
* @returns {void}
|
|
58
31
|
*/
|
|
59
|
-
mounted(
|
|
60
|
-
items: any;
|
|
32
|
+
mounted(): void;
|
|
61
33
|
/**
|
|
62
34
|
* Switch tab on button click.
|
|
63
|
-
*
|
|
64
|
-
* @this {TabsInterface}
|
|
65
|
-
* @param {Event} event The click event object.
|
|
66
|
-
* @param {number} index The index of the clicked button.
|
|
67
|
-
* @return {void}
|
|
68
35
|
*/
|
|
69
|
-
onBtnClick(
|
|
36
|
+
onBtnClick(event: MouseEvent, index: number): void;
|
|
70
37
|
/**
|
|
71
38
|
* Enable the given tab and its associated content.
|
|
72
|
-
*
|
|
73
|
-
* @this {TabsInterface}
|
|
74
|
-
* @param {TabItem} item The item to enable.
|
|
75
|
-
* @return {Promise<TabsInterface>} Tabs instance.
|
|
76
39
|
*/
|
|
77
|
-
enableItem(
|
|
40
|
+
enableItem(item: TabItem): Promise<this>;
|
|
78
41
|
/**
|
|
79
42
|
* Disable the given tab and its associated content.
|
|
80
|
-
*
|
|
81
|
-
* @this {TabsInterface}
|
|
82
|
-
* @param {TabItem} item The item to disable.
|
|
83
|
-
* @return {Promise<TabsInterface>} The Tabs instance.
|
|
84
43
|
*/
|
|
85
|
-
disableItem(
|
|
44
|
+
disableItem(item: TabItem): Promise<this>;
|
|
86
45
|
}
|
|
87
|
-
export
|
|
88
|
-
export type TabItem = {
|
|
89
|
-
btn: HTMLElement;
|
|
90
|
-
content: HTMLElement;
|
|
91
|
-
isEnabled: boolean;
|
|
92
|
-
};
|
|
93
|
-
export type TabsRefs = {
|
|
94
|
-
btn: HTMLElement[];
|
|
95
|
-
content: HTMLElement[];
|
|
96
|
-
};
|
|
97
|
-
export type TabsStates = Partial<Record<'open' | 'active' | 'closed', string | Partial<CSSStyleDeclaration>>>;
|
|
98
|
-
export type TabsStylesOption = Partial<Record<keyof TabsRefs, TabsStates>>;
|
|
99
|
-
export type TabsOptions = {
|
|
100
|
-
styles: TabsStylesOption;
|
|
101
|
-
};
|
|
102
|
-
export type TabsPrivateInterface = {
|
|
103
|
-
$options: TabsOptions;
|
|
104
|
-
$refs: TabsRefs;
|
|
105
|
-
items: Array<TabItem>;
|
|
106
|
-
};
|
|
107
|
-
export type TabsInterface = Tabs & TabsPrivateInterface;
|
|
108
|
-
import { Base } from "@studiometa/js-toolkit";
|
|
46
|
+
export {};
|
package/molecules/Tabs/Tabs.js
CHANGED
|
@@ -1 +1,123 @@
|
|
|
1
|
-
|
|
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
|
+
import { transition } from "@studiometa/js-toolkit/utils";
|
|
9
|
+
class Tabs extends Base {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments);
|
|
12
|
+
__publicField(this, "items");
|
|
13
|
+
}
|
|
14
|
+
mounted() {
|
|
15
|
+
this.items = this.$refs.btn.map((btn, index) => {
|
|
16
|
+
const id = `${this.$id}-${index}`;
|
|
17
|
+
const content = this.$refs.content[index];
|
|
18
|
+
btn.setAttribute("id", id);
|
|
19
|
+
content.setAttribute("aria-labelledby", id);
|
|
20
|
+
const item = { btn, content, isEnabled: index > 0 };
|
|
21
|
+
if (index > 0) {
|
|
22
|
+
this.disableItem(item);
|
|
23
|
+
} else {
|
|
24
|
+
this.enableItem(item);
|
|
25
|
+
}
|
|
26
|
+
return item;
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
onBtnClick(event, index) {
|
|
30
|
+
this.items.forEach((item, i) => {
|
|
31
|
+
if (i !== index) {
|
|
32
|
+
this.disableItem(item);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
this.enableItem(this.items[index]);
|
|
36
|
+
}
|
|
37
|
+
async enableItem(item) {
|
|
38
|
+
if (!item || item.isEnabled) {
|
|
39
|
+
return Promise.resolve(this);
|
|
40
|
+
}
|
|
41
|
+
item.isEnabled = true;
|
|
42
|
+
const { btn, content } = item;
|
|
43
|
+
const btnStyles = this.$options.styles.btn || {};
|
|
44
|
+
const contentStyles = this.$options.styles.content || {};
|
|
45
|
+
content.setAttribute("aria-hidden", "false");
|
|
46
|
+
this.$emit("enable", item);
|
|
47
|
+
return Promise.all([
|
|
48
|
+
transition(
|
|
49
|
+
btn,
|
|
50
|
+
{
|
|
51
|
+
from: btnStyles.closed,
|
|
52
|
+
active: btnStyles.active,
|
|
53
|
+
to: btnStyles.open
|
|
54
|
+
},
|
|
55
|
+
"keep"
|
|
56
|
+
),
|
|
57
|
+
transition(
|
|
58
|
+
content,
|
|
59
|
+
{
|
|
60
|
+
from: contentStyles.closed,
|
|
61
|
+
active: contentStyles.active,
|
|
62
|
+
to: contentStyles.open
|
|
63
|
+
},
|
|
64
|
+
"keep"
|
|
65
|
+
)
|
|
66
|
+
]).then(() => Promise.resolve(this));
|
|
67
|
+
}
|
|
68
|
+
async disableItem(item) {
|
|
69
|
+
if (!item || !item.isEnabled) {
|
|
70
|
+
return Promise.resolve(this);
|
|
71
|
+
}
|
|
72
|
+
item.isEnabled = false;
|
|
73
|
+
const { btn, content } = item;
|
|
74
|
+
const btnStyles = this.$options.styles.btn || {};
|
|
75
|
+
const contentStyles = this.$options.styles.content || {};
|
|
76
|
+
content.setAttribute("aria-hidden", "true");
|
|
77
|
+
this.$emit("disable", item);
|
|
78
|
+
return Promise.all([
|
|
79
|
+
transition(
|
|
80
|
+
btn,
|
|
81
|
+
{
|
|
82
|
+
from: btnStyles.open,
|
|
83
|
+
active: btnStyles.active,
|
|
84
|
+
to: btnStyles.closed
|
|
85
|
+
},
|
|
86
|
+
"keep"
|
|
87
|
+
),
|
|
88
|
+
transition(
|
|
89
|
+
content,
|
|
90
|
+
{
|
|
91
|
+
from: contentStyles.open,
|
|
92
|
+
active: contentStyles.active,
|
|
93
|
+
to: contentStyles.closed
|
|
94
|
+
},
|
|
95
|
+
"keep"
|
|
96
|
+
)
|
|
97
|
+
]).then(() => Promise.resolve(this));
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
__publicField(Tabs, "config", {
|
|
101
|
+
name: "Tabs",
|
|
102
|
+
refs: ["btn[]", "content[]"],
|
|
103
|
+
emits: ["enable", "disable"],
|
|
104
|
+
options: {
|
|
105
|
+
styles: {
|
|
106
|
+
type: Object,
|
|
107
|
+
default: () => ({
|
|
108
|
+
content: {
|
|
109
|
+
closed: {
|
|
110
|
+
position: "absolute",
|
|
111
|
+
opacity: "0",
|
|
112
|
+
pointerEvents: "none",
|
|
113
|
+
visibility: "hidden"
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}),
|
|
117
|
+
merge: true
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
export {
|
|
122
|
+
Tabs
|
|
123
|
+
};
|