@studiometa/ui 0.2.3 → 0.2.6
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 +8 -13
- package/atoms/AnchorScrollTo/AnchorScrollTo.js +1 -26
- package/atoms/Button/Button.twig +68 -0
- package/atoms/Button/StyledButton.twig +47 -0
- package/atoms/Cursor/Cursor.cjs +14 -22
- package/atoms/Cursor/Cursor.d.ts +2 -2
- package/atoms/Cursor/Cursor.js +1 -103
- package/atoms/Cursor/Cursor.twig +28 -0
- package/atoms/Figure/Figure.cjs +20 -16
- package/atoms/Figure/Figure.d.ts +19 -1
- package/atoms/Figure/Figure.js +1 -27
- package/atoms/Figure/Figure.twig +120 -0
- package/atoms/Figure/FigureTwicPics.cjs +72 -0
- package/atoms/Figure/FigureTwicPics.d.ts +48 -0
- package/atoms/Figure/FigureTwicPics.js +1 -0
- package/atoms/Figure/index.cjs +31 -0
- package/atoms/Figure/index.d.ts +2 -0
- package/atoms/Figure/index.js +1 -0
- package/atoms/Icon/Icon.twig +13 -0
- package/atoms/LargeText/LargeText.cjs +15 -23
- package/atoms/LargeText/LargeText.d.ts +3 -3
- package/atoms/LargeText/LargeText.js +1 -64
- package/atoms/LargeText/LargeText.twig +49 -0
- package/atoms/LazyInclude/LazyInclude.cjs +8 -13
- package/atoms/LazyInclude/LazyInclude.d.ts +4 -4
- package/atoms/LazyInclude/LazyInclude.js +1 -46
- package/atoms/Prefetch/AbstractPrefetch.cjs +8 -13
- package/atoms/Prefetch/AbstractPrefetch.d.ts +1 -1
- package/atoms/Prefetch/AbstractPrefetch.js +1 -58
- package/atoms/Prefetch/PrefetchWhenOver.cjs +12 -34
- package/atoms/Prefetch/PrefetchWhenOver.d.ts +1 -1
- package/atoms/Prefetch/PrefetchWhenOver.js +1 -35
- package/atoms/Prefetch/PrefetchWhenVisible.cjs +12 -34
- package/atoms/Prefetch/PrefetchWhenVisible.d.ts +1 -1
- package/atoms/Prefetch/PrefetchWhenVisible.js +1 -36
- package/atoms/Prefetch/index.cjs +9 -16
- package/atoms/Prefetch/index.js +1 -8
- package/atoms/ScrollAnimation/AbstractScrollAnimation.cjs +126 -0
- package/atoms/ScrollAnimation/AbstractScrollAnimation.d.ts +133 -0
- package/atoms/ScrollAnimation/AbstractScrollAnimation.js +1 -0
- package/atoms/ScrollAnimation/ScrollAnimation.cjs +51 -0
- package/atoms/ScrollAnimation/ScrollAnimation.d.ts +55 -0
- package/atoms/ScrollAnimation/ScrollAnimation.js +1 -0
- package/atoms/ScrollAnimation/ScrollAnimationChild.cjs +51 -0
- package/atoms/ScrollAnimation/ScrollAnimationChild.d.ts +13 -0
- package/atoms/ScrollAnimation/ScrollAnimationChild.js +1 -0
- package/atoms/ScrollAnimation/ScrollAnimationChildWithEase.cjs +41 -0
- package/atoms/ScrollAnimation/ScrollAnimationChildWithEase.d.ts +6 -0
- package/atoms/ScrollAnimation/ScrollAnimationChildWithEase.js +1 -0
- package/atoms/ScrollAnimation/ScrollAnimationParent.cjs +48 -0
- package/atoms/ScrollAnimation/ScrollAnimationParent.d.ts +35 -0
- package/atoms/ScrollAnimation/ScrollAnimationParent.js +1 -0
- package/atoms/ScrollAnimation/ScrollAnimationWithEase.cjs +41 -0
- package/atoms/ScrollAnimation/ScrollAnimationWithEase.d.ts +6 -0
- package/atoms/ScrollAnimation/ScrollAnimationWithEase.js +1 -0
- package/atoms/ScrollAnimation/animationScrollWithEase.cjs +70 -0
- package/atoms/ScrollAnimation/animationScrollWithEase.d.ts +11 -0
- package/atoms/ScrollAnimation/animationScrollWithEase.js +1 -0
- package/atoms/ScrollAnimation/index.cjs +41 -0
- package/atoms/ScrollAnimation/index.d.ts +7 -0
- package/atoms/ScrollAnimation/index.js +1 -0
- package/atoms/index.cjs +13 -19
- package/atoms/index.d.ts +2 -1
- package/atoms/index.js +1 -13
- package/index.cjs +12 -15
- package/index.d.ts +1 -0
- package/index.js +1 -3
- package/molecules/Accordion/Accordion.cjs +12 -34
- package/molecules/Accordion/Accordion.js +1 -35
- package/molecules/Accordion/Accordion.twig +54 -0
- package/molecules/Accordion/AccordionCore.cjs +8 -13
- package/molecules/Accordion/AccordionCore.d.ts +2 -2
- package/molecules/Accordion/AccordionCore.js +1 -34
- package/molecules/Accordion/AccordionItem.cjs +70 -114
- package/molecules/Accordion/AccordionItem.d.ts +7 -6
- package/molecules/Accordion/AccordionItem.js +1 -178
- package/molecules/Menu/Menu.cjs +148 -0
- package/molecules/Menu/Menu.d.ts +140 -0
- package/molecules/Menu/Menu.js +1 -0
- package/molecules/Menu/MenuBtn.cjs +53 -0
- package/molecules/Menu/MenuBtn.d.ts +39 -0
- package/molecules/Menu/MenuBtn.js +1 -0
- package/molecules/Menu/MenuList.cjs +134 -0
- package/molecules/Menu/MenuList.d.ts +101 -0
- package/molecules/Menu/MenuList.js +1 -0
- package/molecules/Menu/index.cjs +33 -0
- package/molecules/Menu/index.d.ts +3 -0
- package/molecules/Menu/index.js +1 -0
- package/molecules/Modal/Modal.cjs +42 -71
- package/molecules/Modal/Modal.d.ts +5 -5
- package/molecules/Modal/Modal.js +1 -150
- package/molecules/Modal/Modal.twig +108 -0
- package/molecules/Modal/ModalWithTransition.cjs +13 -43
- package/molecules/Modal/ModalWithTransition.js +1 -69
- package/molecules/Modal/StyledModal.twig +39 -0
- package/molecules/Panel/Panel.cjs +42 -76
- package/molecules/Panel/Panel.js +1 -117
- package/molecules/Panel/Panel.twig +73 -0
- package/molecules/Panel/StyledPanel.twig +28 -0
- package/molecules/Slider/AbstractSliderChild.cjs +10 -20
- package/molecules/Slider/AbstractSliderChild.d.ts +6 -2
- package/molecules/Slider/AbstractSliderChild.js +1 -43
- package/molecules/Slider/Slider.cjs +14 -24
- package/molecules/Slider/Slider.d.ts +6 -6
- package/molecules/Slider/Slider.js +1 -209
- package/molecules/Slider/SliderBtn.cjs +9 -16
- package/molecules/Slider/SliderBtn.d.ts +1 -1
- package/molecules/Slider/SliderBtn.js +1 -34
- package/molecules/Slider/SliderCount.cjs +9 -16
- package/molecules/Slider/SliderCount.js +1 -19
- package/molecules/Slider/SliderDots.cjs +9 -16
- package/molecules/Slider/SliderDots.js +1 -24
- package/molecules/Slider/SliderDrag.cjs +8 -13
- package/molecules/Slider/SliderDrag.js +1 -19
- package/molecules/Slider/SliderItem.cjs +14 -37
- package/molecules/Slider/SliderItem.js +1 -105
- package/molecules/Slider/SliderProgress.cjs +9 -16
- package/molecules/Slider/SliderProgress.js +1 -23
- package/molecules/Slider/index.cjs +9 -16
- package/molecules/Slider/index.js +1 -18
- package/molecules/Sticky/Sticky.cjs +11 -19
- package/molecules/Sticky/Sticky.d.ts +8 -8
- package/molecules/Sticky/Sticky.js +1 -107
- package/molecules/Sticky/Sticky.twig +31 -0
- package/molecules/TableOfContent/TableOfContent.cjs +9 -16
- package/molecules/TableOfContent/TableOfContent.d.ts +1 -1
- package/molecules/TableOfContent/TableOfContent.js +1 -42
- package/molecules/TableOfContent/TableOfContentAnchor.cjs +8 -13
- package/molecules/TableOfContent/TableOfContentAnchor.js +1 -39
- package/molecules/TableOfContent/index.cjs +9 -16
- package/molecules/TableOfContent/index.js +1 -6
- package/molecules/Tabs/Tabs.cjs +54 -82
- package/molecules/Tabs/Tabs.d.ts +5 -4
- package/molecules/Tabs/Tabs.js +1 -126
- package/molecules/Tabs/Tabs.twig +20 -0
- package/molecules/index.cjs +13 -18
- package/molecules/index.d.ts +1 -0
- package/molecules/index.js +1 -18
- package/organisms/Frame/Frame.cjs +107 -99
- package/organisms/Frame/Frame.d.ts +37 -4
- package/organisms/Frame/Frame.js +1 -171
- package/organisms/Frame/FrameAnchor.cjs +8 -13
- package/organisms/Frame/FrameAnchor.js +1 -22
- package/organisms/Frame/FrameForm.cjs +8 -13
- package/organisms/Frame/FrameForm.js +1 -22
- package/organisms/Frame/FrameTarget.cjs +31 -73
- package/organisms/Frame/FrameTarget.js +1 -109
- package/organisms/Frame/index.cjs +9 -16
- package/organisms/Frame/index.js +1 -10
- package/organisms/ImageGrid/ImageGrid.twig +42 -0
- package/organisms/index.cjs +9 -13
- package/organisms/index.js +1 -1
- package/package.json +3 -4
- package/primitives/Draggable/Draggable.cjs +15 -28
- package/primitives/Draggable/Draggable.d.ts +0 -5
- package/primitives/Draggable/Draggable.js +1 -38
- package/primitives/Sentinel/Sentinel.cjs +8 -13
- package/primitives/Sentinel/Sentinel.js +1 -15
- package/primitives/Transition/Transition.cjs +12 -17
- package/primitives/Transition/Transition.d.ts +2 -4
- package/primitives/Transition/Transition.js +1 -45
- package/primitives/index.cjs +9 -16
- package/primitives/index.js +1 -8
|
@@ -1,107 +1 @@
|
|
|
1
|
-
|
|
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 { Sentinel } from "../../primitives/index.js";
|
|
9
|
-
const _Sticky = class extends Base {
|
|
10
|
-
constructor() {
|
|
11
|
-
super(...arguments);
|
|
12
|
-
__publicField(this, "isSticky", false);
|
|
13
|
-
__publicField(this, "isVisible", true);
|
|
14
|
-
}
|
|
15
|
-
set y(value) {
|
|
16
|
-
this.$refs.inner.style.transform = `translateY(${value}px) translateZ(0px)`;
|
|
17
|
-
}
|
|
18
|
-
get instances() {
|
|
19
|
-
return Array.from(_Sticky.instances);
|
|
20
|
-
}
|
|
21
|
-
mounted() {
|
|
22
|
-
_Sticky.instances.add(this);
|
|
23
|
-
this.setSentinelSize();
|
|
24
|
-
}
|
|
25
|
-
resized() {
|
|
26
|
-
this.setSentinelSize();
|
|
27
|
-
}
|
|
28
|
-
destroyed() {
|
|
29
|
-
_Sticky.instances.delete(this);
|
|
30
|
-
}
|
|
31
|
-
scrolled(props) {
|
|
32
|
-
if (!this.isSticky || props.y === props.last.y) {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
if (props.direction.y === "DOWN" && this.$options.hideWhenDown || props.direction.y === "UP" && this.$options.hideWhenUp) {
|
|
36
|
-
this.hide();
|
|
37
|
-
} else {
|
|
38
|
-
this.show();
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
onSentinelIntersected([entry]) {
|
|
42
|
-
this.isSticky = entry.isIntersecting && entry.boundingClientRect.y < 0;
|
|
43
|
-
this.setPosition();
|
|
44
|
-
}
|
|
45
|
-
hide() {
|
|
46
|
-
if (!this.isVisible) {
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
this.isVisible = false;
|
|
50
|
-
this.$el.classList.add("pointer-events-none");
|
|
51
|
-
this.instances.forEach((instance, index) => instance.setPosition(index));
|
|
52
|
-
}
|
|
53
|
-
show() {
|
|
54
|
-
if (this.isVisible) {
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
this.isVisible = true;
|
|
58
|
-
this.$el.classList.remove("pointer-events-none");
|
|
59
|
-
this.instances.forEach((instance, index) => instance.setPosition(index));
|
|
60
|
-
}
|
|
61
|
-
setSentinelSize() {
|
|
62
|
-
const { instances } = this;
|
|
63
|
-
const index = instances.findIndex((instance) => instance === this);
|
|
64
|
-
const height = instances.slice(0, index).filter((instance) => this.closestRelativeElement(instance.$el).contains(this.$el)).reduce((acc, instance) => acc + instance.$el.offsetHeight, 0);
|
|
65
|
-
this.$refs.sentinelRef.style.height = `${height + 1}px`;
|
|
66
|
-
this.$el.style.top = `${height}px`;
|
|
67
|
-
this.$el.style.zIndex = String(this.$options.zIndex - index);
|
|
68
|
-
}
|
|
69
|
-
setPosition(index) {
|
|
70
|
-
if (!this.isSticky) {
|
|
71
|
-
this.y = 0;
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
const { instances } = this;
|
|
75
|
-
index = index != null ? index : instances.findIndex((instance) => instance === this);
|
|
76
|
-
this.y = instances.slice(0, index).filter((instance) => instance.isSticky && !instance.isVisible).reduce((y, instance) => {
|
|
77
|
-
return y - instance.$refs.inner.offsetHeight;
|
|
78
|
-
}, this.isVisible ? 0 : this.$refs.inner.offsetHeight * -1);
|
|
79
|
-
}
|
|
80
|
-
closestRelativeElement(element) {
|
|
81
|
-
let parent = element.parentElement;
|
|
82
|
-
while (getComputedStyle(parent).position !== "relative" && parent.parentElement) {
|
|
83
|
-
parent = parent.parentElement;
|
|
84
|
-
}
|
|
85
|
-
return parent;
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
let Sticky = _Sticky;
|
|
89
|
-
__publicField(Sticky, "config", {
|
|
90
|
-
name: "Sticky",
|
|
91
|
-
refs: ["inner", "sentinelRef"],
|
|
92
|
-
components: {
|
|
93
|
-
Sentinel
|
|
94
|
-
},
|
|
95
|
-
options: {
|
|
96
|
-
zIndex: {
|
|
97
|
-
type: Number,
|
|
98
|
-
default: 100
|
|
99
|
-
},
|
|
100
|
-
hideWhenUp: Boolean,
|
|
101
|
-
hideWhenDown: Boolean
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
__publicField(Sticky, "instances", /* @__PURE__ */ new Set());
|
|
105
|
-
export {
|
|
106
|
-
Sticky as default
|
|
107
|
-
};
|
|
1
|
+
import{Base as o}from"@studiometa/js-toolkit";import{Sentinel as h}from"../../primitives/index.js";class n extends o{static config={name:"Sticky",refs:["inner","sentinelRef"],components:{Sentinel:h},options:{zIndex:{type:Number,default:100},hideWhenUp:Boolean,hideWhenDown:Boolean}};static instances=new Set;isSticky=!1;isVisible=!0;set y(e){this.$refs.inner.style.transform=`translateY(${e}px) translateZ(0px)`}get instances(){return Array.from(n.instances)}mounted(){n.instances.add(this),this.setSentinelSize()}resized(){this.setSentinelSize()}destroyed(){n.instances.delete(this)}scrolled(e){!this.isSticky||e.y===e.last.y||(e.direction.y==="DOWN"&&this.$options.hideWhenDown||e.direction.y==="UP"&&this.$options.hideWhenUp?this.hide():this.show())}onSentinelIntersected([e]){this.isSticky=e.isIntersecting&&e.boundingClientRect.y<0,this.setPosition()}hide(){!this.isVisible||(this.isVisible=!1,this.$el.classList.add("pointer-events-none"),this.instances.forEach((e,t)=>e.setPosition(t)))}show(){this.isVisible||(this.isVisible=!0,this.$el.classList.remove("pointer-events-none"),this.instances.forEach((e,t)=>e.setPosition(t)))}setSentinelSize(){const{instances:e}=this,t=e.findIndex(s=>s===this),i=e.slice(0,t).filter(s=>this.closestRelativeElement(s.$el).contains(this.$el)).reduce((s,l)=>s+l.$el.offsetHeight,0);this.$refs.sentinelRef.style.height=`${i+1}px`,this.$el.style.top=`${i}px`,this.$el.style.zIndex=String(this.$options.zIndex-t)}setPosition(e){if(!this.isSticky){this.y=0;return}const{instances:t}=this;e=e??t.findIndex(i=>i===this),this.y=t.slice(0,e).filter(i=>i.isSticky&&!i.isVisible).reduce((i,s)=>i-s.$refs.inner.offsetHeight,this.isVisible?0:this.$refs.inner.offsetHeight*-1)}closestRelativeElement(e){let t=e.parentElement;for(;getComputedStyle(t).position!=="relative"&&t.parentElement;)t=t.parentElement;return t}}export{n as default};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{#
|
|
2
|
+
/**
|
|
3
|
+
* @file
|
|
4
|
+
* Sticky component.
|
|
5
|
+
*
|
|
6
|
+
* @param array $attr
|
|
7
|
+
* Custom attributes for the root element.
|
|
8
|
+
* @param array $innner_attr
|
|
9
|
+
* Custom attributes for the inner element.
|
|
10
|
+
*
|
|
11
|
+
* @block $content
|
|
12
|
+
* Use this block to set the content of the sticky element.
|
|
13
|
+
*/
|
|
14
|
+
#}
|
|
15
|
+
|
|
16
|
+
{% set default_attributes = { data_component: 'Sticky', class: 'z-10 sticky top-0 w-full' } %}
|
|
17
|
+
{% set attributes = attr|default({})|merge_html_attributes(default_attributes) %}
|
|
18
|
+
|
|
19
|
+
{% set default_inner_attributes = { data_ref: 'inner', class:'transition duration-500 ease-out-expo' } %}
|
|
20
|
+
{% set inner_attributes = inner_attr|default({})|merge_html_attributes(default_inner_attributes) %}
|
|
21
|
+
|
|
22
|
+
<div {{ html_attributes(attributes) }}>
|
|
23
|
+
<div data-ref="sentinelRef"
|
|
24
|
+
data-component="Sentinel"
|
|
25
|
+
class="absolute bottom-full w-full h-px pointer-events-none"></div>
|
|
26
|
+
<div {{ html_attributes(inner_attributes) }}>
|
|
27
|
+
{% block content %}
|
|
28
|
+
{{ content ?? '' }}
|
|
29
|
+
{% endblock %}
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
@@ -5,27 +5,20 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
5
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
7
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
-
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
9
8
|
var __export = (target, all) => {
|
|
10
9
|
for (var name in all)
|
|
11
10
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
11
|
};
|
|
13
|
-
var
|
|
14
|
-
if (
|
|
15
|
-
for (let key of __getOwnPropNames(
|
|
16
|
-
if (!__hasOwnProp.call(
|
|
17
|
-
__defProp(
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
17
|
}
|
|
19
|
-
return
|
|
18
|
+
return to;
|
|
20
19
|
};
|
|
21
|
-
var __toESM = (
|
|
22
|
-
|
|
23
|
-
};
|
|
24
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
25
|
-
return (module2, temp) => {
|
|
26
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
27
|
-
};
|
|
28
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
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
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
22
|
var __publicField = (obj, key, value) => {
|
|
30
23
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
31
24
|
return value;
|
|
@@ -36,6 +29,7 @@ var TableOfContent_exports = {};
|
|
|
36
29
|
__export(TableOfContent_exports, {
|
|
37
30
|
default: () => TableOfContent
|
|
38
31
|
});
|
|
32
|
+
module.exports = __toCommonJS(TableOfContent_exports);
|
|
39
33
|
var import_js_toolkit = require("@studiometa/js-toolkit");
|
|
40
34
|
var import_TableOfContentAnchor = __toESM(require("./TableOfContentAnchor.cjs"), 1);
|
|
41
35
|
var TableOfContent = class extends import_js_toolkit.Base {
|
|
@@ -69,5 +63,4 @@ __publicField(TableOfContent, "config", {
|
|
|
69
63
|
withTemplate: Boolean
|
|
70
64
|
}
|
|
71
65
|
});
|
|
72
|
-
module.exports = __toCommonJS(TableOfContent_exports);
|
|
73
66
|
if (module.exports.default) module.exports = module.exports.default;
|
|
@@ -43,7 +43,7 @@ export default class TableOfContent extends Base {
|
|
|
43
43
|
* @this {TableOfContentInterface}
|
|
44
44
|
* @returns {void}
|
|
45
45
|
*/
|
|
46
|
-
generateAnchors(): void;
|
|
46
|
+
generateAnchors(this: TableOfContentInterface): void;
|
|
47
47
|
}
|
|
48
48
|
export type TableOfContentInterface = TableOfContent & {
|
|
49
49
|
$refs: {
|
|
@@ -1,42 +1 @@
|
|
|
1
|
-
|
|
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.appendChild(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 as default
|
|
42
|
-
};
|
|
1
|
+
import{Base as r}from"@studiometa/js-toolkit";import i from"./TableOfContentAnchor.js";class l extends r{static config={name:"TableOfContent",refs:["itemTemplate","list"],components:{TableOfContentAnchor:i},options:{contentSelector:String,withTemplate:Boolean}};mounted(){this.$options.withTemplate&&(this.generateAnchors(),this.$update())}generateAnchors(){document.querySelectorAll(this.$options.contentSelector).forEach(t=>{const n=document.createElement("div");n.innerHTML=this.$refs.itemTemplate.innerHTML;const o=n.querySelector("li"),e=o.querySelector("a");e.href=`#${t.id}`,e.innerHTML=t.textContent,e.dataset.component="TableOfContentAnchor",this.$refs.list.appendChild(o)})}}export{l as default};
|
|
@@ -3,24 +3,19 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
3
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
5
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
-
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
7
6
|
var __export = (target, all) => {
|
|
8
7
|
for (var name in all)
|
|
9
8
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
9
|
};
|
|
11
|
-
var
|
|
12
|
-
if (
|
|
13
|
-
for (let key of __getOwnPropNames(
|
|
14
|
-
if (!__hasOwnProp.call(
|
|
15
|
-
__defProp(
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
15
|
}
|
|
17
|
-
return
|
|
16
|
+
return to;
|
|
18
17
|
};
|
|
19
|
-
var __toCommonJS =
|
|
20
|
-
return (module2, temp) => {
|
|
21
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
22
|
-
};
|
|
23
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
24
19
|
var __publicField = (obj, key, value) => {
|
|
25
20
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
26
21
|
return value;
|
|
@@ -31,6 +26,7 @@ var TableOfContentAnchor_exports = {};
|
|
|
31
26
|
__export(TableOfContentAnchor_exports, {
|
|
32
27
|
default: () => TableOfContentAnchor
|
|
33
28
|
});
|
|
29
|
+
module.exports = __toCommonJS(TableOfContentAnchor_exports);
|
|
34
30
|
var import_atoms = require("../../atoms/index.cjs");
|
|
35
31
|
var TableOfContentAnchor = class extends import_atoms.AnchorScrollTo {
|
|
36
32
|
get sentinel() {
|
|
@@ -61,5 +57,4 @@ __publicField(TableOfContentAnchor, "config", {
|
|
|
61
57
|
}
|
|
62
58
|
}
|
|
63
59
|
});
|
|
64
|
-
module.exports = __toCommonJS(TableOfContentAnchor_exports);
|
|
65
60
|
if (module.exports.default) module.exports = module.exports.default;
|
|
@@ -1,39 +1 @@
|
|
|
1
|
-
|
|
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
|
-
get sentinel() {
|
|
10
|
-
return document.querySelector(this.targetSelector);
|
|
11
|
-
}
|
|
12
|
-
mounted() {
|
|
13
|
-
if (!this.sentinel) {
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
this.observer = new IntersectionObserver(([entry]) => {
|
|
17
|
-
const shouldActivate = entry.isIntersecting && entry.boundingClientRect.y < 100 && entry.boundingClientRect.y > 100;
|
|
18
|
-
this.$el.classList.toggle(this.$options.activeClass, shouldActivate);
|
|
19
|
-
this.$emit("should-activate", shouldActivate);
|
|
20
|
-
});
|
|
21
|
-
this.observer.observe(this.sentinel);
|
|
22
|
-
}
|
|
23
|
-
destroyed() {
|
|
24
|
-
this.observer.disconnect();
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
__publicField(TableOfContentAnchor, "config", {
|
|
28
|
-
name: "TableOfContentAnchor",
|
|
29
|
-
emits: ["should-activate"],
|
|
30
|
-
options: {
|
|
31
|
-
activeClass: {
|
|
32
|
-
type: String,
|
|
33
|
-
default: "is-active"
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
export {
|
|
38
|
-
TableOfContentAnchor as default
|
|
39
|
-
};
|
|
1
|
+
import{AnchorScrollTo as s}from"../../atoms/index.js";class i extends s{static config={name:"TableOfContentAnchor",emits:["should-activate"],options:{activeClass:{type:String,default:"is-active"}}};get sentinel(){return document.querySelector(this.targetSelector)}mounted(){!this.sentinel||(this.observer=new IntersectionObserver(([e])=>{const t=e.isIntersecting&&e.boundingClientRect.y<100&&e.boundingClientRect.y>100;this.$el.classList.toggle(this.$options.activeClass,t),this.$emit("should-activate",t)}),this.observer.observe(this.sentinel))}destroyed(){this.observer.disconnect()}}export{i as default};
|
|
@@ -4,27 +4,20 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
7
|
var __export = (target, all) => {
|
|
9
8
|
for (var name in all)
|
|
10
9
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
10
|
};
|
|
12
|
-
var
|
|
13
|
-
if (
|
|
14
|
-
for (let key of __getOwnPropNames(
|
|
15
|
-
if (!__hasOwnProp.call(
|
|
16
|
-
__defProp(
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
16
|
}
|
|
18
|
-
return
|
|
17
|
+
return to;
|
|
19
18
|
};
|
|
20
|
-
var __toESM = (
|
|
21
|
-
|
|
22
|
-
};
|
|
23
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
-
return (module2, temp) => {
|
|
25
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
-
};
|
|
27
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
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));
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
21
|
|
|
29
22
|
// packages/ui/molecules/TableOfContent/index.js
|
|
30
23
|
var TableOfContent_exports = {};
|
|
@@ -32,7 +25,7 @@ __export(TableOfContent_exports, {
|
|
|
32
25
|
TableOfContent: () => import_TableOfContent.default,
|
|
33
26
|
TableOfContentAnchor: () => import_TableOfContentAnchor.default
|
|
34
27
|
});
|
|
28
|
+
module.exports = __toCommonJS(TableOfContent_exports);
|
|
35
29
|
var import_TableOfContent = __toESM(require("./TableOfContent.cjs"), 1);
|
|
36
30
|
var import_TableOfContentAnchor = __toESM(require("./TableOfContentAnchor.cjs"), 1);
|
|
37
|
-
module.exports = __toCommonJS(TableOfContent_exports);
|
|
38
31
|
if (module.exports.default) module.exports = module.exports.default;
|
|
@@ -1,6 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { default as default3 } from "./TableOfContentAnchor.js";
|
|
3
|
-
export {
|
|
4
|
-
default2 as TableOfContent,
|
|
5
|
-
default3 as TableOfContentAnchor
|
|
6
|
-
};
|
|
1
|
+
import{default as o}from"./TableOfContent.js";import{default as f}from"./TableOfContentAnchor.js";export{o as TableOfContent,f as TableOfContentAnchor};
|
package/molecules/Tabs/Tabs.cjs
CHANGED
|
@@ -3,54 +3,30 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
3
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
5
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
-
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
7
6
|
var __export = (target, all) => {
|
|
8
7
|
for (var name in all)
|
|
9
8
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
9
|
};
|
|
11
|
-
var
|
|
12
|
-
if (
|
|
13
|
-
for (let key of __getOwnPropNames(
|
|
14
|
-
if (!__hasOwnProp.call(
|
|
15
|
-
__defProp(
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
15
|
}
|
|
17
|
-
return
|
|
16
|
+
return to;
|
|
18
17
|
};
|
|
19
|
-
var __toCommonJS =
|
|
20
|
-
return (module2, temp) => {
|
|
21
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
22
|
-
};
|
|
23
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
24
19
|
var __publicField = (obj, key, value) => {
|
|
25
20
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
26
21
|
return value;
|
|
27
22
|
};
|
|
28
|
-
var __async = (__this, __arguments, generator) => {
|
|
29
|
-
return new Promise((resolve, reject) => {
|
|
30
|
-
var fulfilled = (value) => {
|
|
31
|
-
try {
|
|
32
|
-
step(generator.next(value));
|
|
33
|
-
} catch (e) {
|
|
34
|
-
reject(e);
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
var rejected = (value) => {
|
|
38
|
-
try {
|
|
39
|
-
step(generator.throw(value));
|
|
40
|
-
} catch (e) {
|
|
41
|
-
reject(e);
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
45
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
46
|
-
});
|
|
47
|
-
};
|
|
48
23
|
|
|
49
24
|
// packages/ui/molecules/Tabs/Tabs.js
|
|
50
25
|
var Tabs_exports = {};
|
|
51
26
|
__export(Tabs_exports, {
|
|
52
27
|
default: () => Tabs
|
|
53
28
|
});
|
|
29
|
+
module.exports = __toCommonJS(Tabs_exports);
|
|
54
30
|
var import_js_toolkit = require("@studiometa/js-toolkit");
|
|
55
31
|
var import_utils = require("@studiometa/js-toolkit/utils");
|
|
56
32
|
var Tabs = class extends import_js_toolkit.Base {
|
|
@@ -77,55 +53,51 @@ var Tabs = class extends import_js_toolkit.Base {
|
|
|
77
53
|
});
|
|
78
54
|
this.enableItem(this.items[index]);
|
|
79
55
|
}
|
|
80
|
-
enableItem(item) {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
]).then(() => Promise.resolve(this));
|
|
103
|
-
});
|
|
56
|
+
async enableItem(item) {
|
|
57
|
+
if (!item || item.isEnabled) {
|
|
58
|
+
return Promise.resolve(this);
|
|
59
|
+
}
|
|
60
|
+
item.isEnabled = true;
|
|
61
|
+
const { btn, content } = item;
|
|
62
|
+
const btnStyles = this.$options.styles.btn || {};
|
|
63
|
+
const contentStyles = this.$options.styles.content || {};
|
|
64
|
+
content.setAttribute("aria-hidden", "false");
|
|
65
|
+
this.$emit("enable", item);
|
|
66
|
+
return Promise.all([
|
|
67
|
+
(0, import_utils.transition)(btn, {
|
|
68
|
+
from: btnStyles.closed,
|
|
69
|
+
active: btnStyles.active,
|
|
70
|
+
to: btnStyles.open
|
|
71
|
+
}, "keep"),
|
|
72
|
+
(0, import_utils.transition)(content, {
|
|
73
|
+
from: contentStyles.closed,
|
|
74
|
+
active: contentStyles.active,
|
|
75
|
+
to: contentStyles.open
|
|
76
|
+
}, "keep")
|
|
77
|
+
]).then(() => Promise.resolve(this));
|
|
104
78
|
}
|
|
105
|
-
disableItem(item) {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
]).then(() => Promise.resolve(this));
|
|
128
|
-
});
|
|
79
|
+
async disableItem(item) {
|
|
80
|
+
if (!item || !item.isEnabled) {
|
|
81
|
+
return Promise.resolve(this);
|
|
82
|
+
}
|
|
83
|
+
item.isEnabled = false;
|
|
84
|
+
const { btn, content } = item;
|
|
85
|
+
const btnStyles = this.$options.styles.btn || {};
|
|
86
|
+
const contentStyles = this.$options.styles.content || {};
|
|
87
|
+
content.setAttribute("aria-hidden", "true");
|
|
88
|
+
this.$emit("disable", item);
|
|
89
|
+
return Promise.all([
|
|
90
|
+
(0, import_utils.transition)(btn, {
|
|
91
|
+
from: btnStyles.open,
|
|
92
|
+
active: btnStyles.active,
|
|
93
|
+
to: btnStyles.closed
|
|
94
|
+
}, "keep"),
|
|
95
|
+
(0, import_utils.transition)(content, {
|
|
96
|
+
from: contentStyles.open,
|
|
97
|
+
active: contentStyles.active,
|
|
98
|
+
to: contentStyles.closed
|
|
99
|
+
}, "keep")
|
|
100
|
+
]).then(() => Promise.resolve(this));
|
|
129
101
|
}
|
|
130
102
|
};
|
|
131
103
|
__publicField(Tabs, "config", {
|
|
@@ -144,9 +116,9 @@ __publicField(Tabs, "config", {
|
|
|
144
116
|
visibility: "hidden"
|
|
145
117
|
}
|
|
146
118
|
}
|
|
147
|
-
})
|
|
119
|
+
}),
|
|
120
|
+
merge: true
|
|
148
121
|
}
|
|
149
122
|
}
|
|
150
123
|
});
|
|
151
|
-
module.exports = __toCommonJS(Tabs_exports);
|
|
152
124
|
if (module.exports.default) module.exports = module.exports.default;
|
package/molecules/Tabs/Tabs.d.ts
CHANGED
|
@@ -47,6 +47,7 @@ export default class Tabs extends Base {
|
|
|
47
47
|
* @return {TabsStylesOption}
|
|
48
48
|
*/
|
|
49
49
|
default: () => TabsStylesOption;
|
|
50
|
+
merge: boolean;
|
|
50
51
|
};
|
|
51
52
|
};
|
|
52
53
|
};
|
|
@@ -55,7 +56,7 @@ export default class Tabs extends Base {
|
|
|
55
56
|
* @this {TabsInterface}
|
|
56
57
|
* @return {void}
|
|
57
58
|
*/
|
|
58
|
-
mounted(): void;
|
|
59
|
+
mounted(this: TabsInterface): void;
|
|
59
60
|
items: any;
|
|
60
61
|
/**
|
|
61
62
|
* Switch tab on button click.
|
|
@@ -65,7 +66,7 @@ export default class Tabs extends Base {
|
|
|
65
66
|
* @param {number} index The index of the clicked button.
|
|
66
67
|
* @return {void}
|
|
67
68
|
*/
|
|
68
|
-
onBtnClick(event: Event, index: number): void;
|
|
69
|
+
onBtnClick(this: TabsInterface, event: Event, index: number): void;
|
|
69
70
|
/**
|
|
70
71
|
* Enable the given tab and its associated content.
|
|
71
72
|
*
|
|
@@ -73,7 +74,7 @@ export default class Tabs extends Base {
|
|
|
73
74
|
* @param {TabItem} item The item to enable.
|
|
74
75
|
* @return {Promise<TabsInterface>} Tabs instance.
|
|
75
76
|
*/
|
|
76
|
-
enableItem(item: TabItem): Promise<TabsInterface>;
|
|
77
|
+
enableItem(this: TabsInterface, item: TabItem): Promise<TabsInterface>;
|
|
77
78
|
/**
|
|
78
79
|
* Disable the given tab and its associated content.
|
|
79
80
|
*
|
|
@@ -81,7 +82,7 @@ export default class Tabs extends Base {
|
|
|
81
82
|
* @param {TabItem} item The item to disable.
|
|
82
83
|
* @return {Promise<TabsInterface>} The Tabs instance.
|
|
83
84
|
*/
|
|
84
|
-
disableItem(item: TabItem): Promise<TabsInterface>;
|
|
85
|
+
disableItem(this: TabsInterface, item: TabItem): Promise<TabsInterface>;
|
|
85
86
|
}
|
|
86
87
|
export type BaseOptions = import('@studiometa/js-toolkit/Base').BaseOptions;
|
|
87
88
|
export type TabItem = {
|