@studiometa/ui 0.2.8 → 0.2.11
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/Cursor/Cursor.cjs +5 -1
- package/atoms/Cursor/Cursor.d.ts +6 -0
- package/atoms/Cursor/Cursor.js +1 -1
- package/atoms/Figure/Figure.cjs +19 -5
- package/atoms/Figure/Figure.d.ts +40 -17
- package/atoms/Figure/Figure.js +1 -1
- package/atoms/Figure/FigureTwicPics.cjs +1 -1
- package/atoms/Figure/FigureTwicPics.d.ts +5 -0
- package/atoms/Figure/FigureTwicPics.js +1 -1
- package/atoms/LargeText/LargeText.cjs +11 -11
- package/atoms/LargeText/LargeText.d.ts +2 -2
- package/atoms/LargeText/LargeText.js +1 -1
- package/atoms/LargeText/LargeText.twig +1 -1
- package/atoms/ScrollReveal/ScrollReveal.cjs +72 -0
- package/atoms/ScrollReveal/ScrollReveal.d.ts +77 -0
- package/atoms/ScrollReveal/ScrollReveal.js +1 -0
- package/atoms/ScrollReveal/index.cjs +29 -0
- package/atoms/ScrollReveal/index.d.ts +1 -0
- package/atoms/ScrollReveal/index.js +1 -0
- package/atoms/index.cjs +1 -0
- package/atoms/index.d.ts +1 -0
- package/atoms/index.js +1 -1
- package/decorators/index.cjs +29 -0
- package/decorators/index.d.ts +1 -0
- package/decorators/index.js +1 -0
- package/decorators/withTransition.cjs +66 -0
- package/decorators/withTransition.d.ts +43 -0
- package/decorators/withTransition.js +1 -0
- package/index.cjs +1 -0
- package/index.d.ts +1 -0
- package/index.js +1 -1
- package/molecules/Menu/Menu.cjs +7 -16
- package/molecules/Menu/Menu.d.ts +12 -12
- package/molecules/Menu/Menu.js +1 -1
- package/molecules/Menu/MenuBtn.cjs +1 -5
- package/molecules/Menu/MenuBtn.d.ts +0 -1
- package/molecules/Menu/MenuBtn.js +1 -1
- package/molecules/Menu/MenuList.cjs +1 -3
- package/molecules/Menu/MenuList.d.ts +12 -14
- package/molecules/Menu/MenuList.js +1 -1
- package/molecules/Modal/Modal.cjs +11 -3
- package/molecules/Modal/Modal.d.ts +17 -5
- package/molecules/Modal/Modal.js +1 -1
- package/molecules/Modal/Modal.twig +5 -2
- package/molecules/Modal/StyledModal.twig +5 -2
- package/molecules/Panel/StyledPanel.twig +8 -3
- package/molecules/Slider/Slider.cjs +68 -22
- package/molecules/Slider/Slider.d.ts +25 -2
- package/molecules/Slider/Slider.js +1 -1
- package/molecules/Slider/SliderDots.cjs +9 -4
- package/molecules/Slider/SliderDots.d.ts +18 -1
- package/molecules/Slider/SliderDots.js +1 -1
- package/molecules/Slider/SliderDrag.cjs +14 -3
- package/molecules/Slider/SliderDrag.d.ts +31 -3
- package/molecules/Slider/SliderDrag.js +1 -1
- package/molecules/Slider/SliderItem.cjs +1 -1
- package/molecules/Slider/SliderItem.js +1 -1
- package/molecules/Slider/SliderProgress.cjs +3 -4
- package/molecules/Slider/SliderProgress.js +1 -1
- package/organisms/Frame/Frame.cjs +11 -18
- package/organisms/Frame/Frame.d.ts +6 -17
- package/organisms/Frame/Frame.js +1 -1
- package/organisms/Frame/FrameAnchor.cjs +1 -5
- package/organisms/Frame/FrameAnchor.d.ts +0 -8
- package/organisms/Frame/FrameAnchor.js +1 -1
- package/organisms/Frame/FrameForm.cjs +1 -5
- package/organisms/Frame/FrameForm.d.ts +0 -8
- package/organisms/Frame/FrameForm.js +1 -1
- package/organisms/Frame/FrameTarget.d.ts +16 -10
- package/package.json +2 -2
- package/primitives/Transition/Transition.cjs +3 -41
- package/primitives/Transition/Transition.d.ts +6 -66
- package/primitives/Transition/Transition.js +1 -1
package/atoms/Cursor/Cursor.cjs
CHANGED
|
@@ -51,7 +51,7 @@ var Cursor = class extends import_js_toolkit.Base {
|
|
|
51
51
|
}
|
|
52
52
|
this.pointerX = x;
|
|
53
53
|
this.pointerY = y;
|
|
54
|
-
let scale =
|
|
54
|
+
let { scale } = this.$options;
|
|
55
55
|
if (!event) {
|
|
56
56
|
this.pointerScale = scale;
|
|
57
57
|
return;
|
|
@@ -96,6 +96,10 @@ __publicField(Cursor, "config", {
|
|
|
96
96
|
type: String,
|
|
97
97
|
default: "[data-cursor-shrink], [data-cursor-shrink] *"
|
|
98
98
|
},
|
|
99
|
+
scale: {
|
|
100
|
+
type: Number,
|
|
101
|
+
default: 1
|
|
102
|
+
},
|
|
99
103
|
growTo: {
|
|
100
104
|
type: Number,
|
|
101
105
|
default: 2
|
package/atoms/Cursor/Cursor.d.ts
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* @typedef {Object} CursorOptions
|
|
7
7
|
* @property {string} growSelectors
|
|
8
8
|
* @property {string} shrinkSelectors
|
|
9
|
+
* @property {number} scale
|
|
9
10
|
* @property {number} growTo
|
|
10
11
|
* @property {number} shrinkTo
|
|
11
12
|
* @property {number} translateDampFactor
|
|
@@ -37,6 +38,10 @@ export default class Cursor extends Base {
|
|
|
37
38
|
type: StringConstructor;
|
|
38
39
|
default: string;
|
|
39
40
|
};
|
|
41
|
+
scale: {
|
|
42
|
+
type: NumberConstructor;
|
|
43
|
+
default: number;
|
|
44
|
+
};
|
|
40
45
|
growTo: {
|
|
41
46
|
type: NumberConstructor;
|
|
42
47
|
default: number;
|
|
@@ -125,6 +130,7 @@ export type BaseOptions = import('@studiometa/js-toolkit/Base').BaseOptions;
|
|
|
125
130
|
export type CursorOptions = {
|
|
126
131
|
growSelectors: string;
|
|
127
132
|
shrinkSelectors: string;
|
|
133
|
+
scale: number;
|
|
128
134
|
growTo: number;
|
|
129
135
|
shrinkTo: number;
|
|
130
136
|
translateDampFactor: number;
|
package/atoms/Cursor/Cursor.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Base as n}from"@studiometa/js-toolkit";import{damp as a,matrix as c}from"@studiometa/js-toolkit/utils";class l extends n{static config={name:"Cursor",options:{growSelectors:{type:String,default:"a, a *, button, button *, [data-cursor-grow], [data-cursor-grow] *"},shrinkSelectors:{type:String,default:"[data-cursor-shrink], [data-cursor-shrink] *"},growTo:{type:Number,default:2},shrinkTo:{type:Number,default:.5},translateDampFactor:{type:Number,default:.25},growDampFactor:{type:Number,default:.25},shrinkDampFactor:{type:Number,default:.25}}};x=0;y=0;scale=0;pointerX=0;pointerY=0;pointerScale=0;mounted(){this.x=0,this.y=0,this.scale=0,this.pointerX=0,this.pointerY=0,this.pointerScale=0,this.render({x:this.x,y:this.y,scale:this.scale})}moved({event:t,x:i,y:s,isDown:r}){this.$services.has("ticked")||this.$services.enable("ticked"),this.pointerX=i,this.pointerY=s;let
|
|
1
|
+
import{Base as n}from"@studiometa/js-toolkit";import{damp as a,matrix as c}from"@studiometa/js-toolkit/utils";class l extends n{static config={name:"Cursor",options:{growSelectors:{type:String,default:"a, a *, button, button *, [data-cursor-grow], [data-cursor-grow] *"},shrinkSelectors:{type:String,default:"[data-cursor-shrink], [data-cursor-shrink] *"},scale:{type:Number,default:1},growTo:{type:Number,default:2},shrinkTo:{type:Number,default:.5},translateDampFactor:{type:Number,default:.25},growDampFactor:{type:Number,default:.25},shrinkDampFactor:{type:Number,default:.25}}};x=0;y=0;scale=0;pointerX=0;pointerY=0;pointerScale=0;mounted(){this.x=0,this.y=0,this.scale=0,this.pointerX=0,this.pointerY=0,this.pointerScale=0,this.render({x:this.x,y:this.y,scale:this.scale})}moved({event:t,x:i,y:s,isDown:r}){this.$services.has("ticked")||this.$services.enable("ticked"),this.pointerX=i,this.pointerY=s;let{scale:e}=this.$options;if(!t){this.pointerScale=e;return}const o=t.target instanceof Element&&t.target.matches(this.$options.growSelectors)||!1,h=r||t.target instanceof Element&&t.target.matches(this.$options.shrinkSelectors)||!1;o&&(e=this.$options.growTo),h&&(e=this.$options.shrinkTo),this.pointerScale=e}ticked(){this.x=a(this.pointerX,this.x,this.$options.translateDampFactor),this.y=a(this.pointerY,this.y,this.$options.translateDampFactor),this.scale=a(this.pointerScale,this.scale,this.pointerScale<this.scale?this.$options.shrinkDampFactor:this.$options.growDampFactor),this.render({x:this.x,y:this.y,scale:this.scale}),this.x===this.pointerX&&this.y===this.pointerY&&this.scale===this.pointerScale&&this.$services.disable("ticked")}render({x:t,y:i,scale:s}){const r=c({translateX:t,translateY:i,scaleX:s,scaleY:s});this.$el.style.transform=`translateZ(0) ${r}`}}export{l as default};
|
package/atoms/Figure/Figure.cjs
CHANGED
|
@@ -28,7 +28,11 @@ __export(Figure_exports, {
|
|
|
28
28
|
});
|
|
29
29
|
module.exports = __toCommonJS(Figure_exports);
|
|
30
30
|
var import_js_toolkit = require("@studiometa/js-toolkit");
|
|
31
|
-
var
|
|
31
|
+
var import_primitives = require("../../primitives/index.cjs");
|
|
32
|
+
var Figure = class extends (0, import_js_toolkit.withMountWhenInView)(import_primitives.Transition, { threshold: [0, 1] }) {
|
|
33
|
+
get target() {
|
|
34
|
+
return this.$refs.img;
|
|
35
|
+
}
|
|
32
36
|
get src() {
|
|
33
37
|
return this.$refs.img.src;
|
|
34
38
|
}
|
|
@@ -36,21 +40,31 @@ var Figure = class extends (0, import_js_toolkit.withMountWhenInView)(import_js_
|
|
|
36
40
|
this.$refs.img.src = value;
|
|
37
41
|
}
|
|
38
42
|
mounted() {
|
|
39
|
-
|
|
43
|
+
const { img } = this.$refs;
|
|
44
|
+
if (!img) {
|
|
40
45
|
throw new Error("[Figure] The `img` ref is required.");
|
|
41
46
|
}
|
|
42
|
-
if (!(
|
|
47
|
+
if (!(img instanceof HTMLImageElement)) {
|
|
43
48
|
throw new Error("[Figure] The `img` ref must be an `<img>` element.");
|
|
44
49
|
}
|
|
45
|
-
|
|
46
|
-
|
|
50
|
+
const src = img.getAttribute("data-src");
|
|
51
|
+
if (this.$options.lazy && src && src !== this.src) {
|
|
52
|
+
let tempImg = new Image();
|
|
53
|
+
tempImg.onload = () => {
|
|
54
|
+
this.enter();
|
|
55
|
+
this.src = src;
|
|
56
|
+
tempImg = null;
|
|
57
|
+
};
|
|
58
|
+
tempImg.src = src;
|
|
47
59
|
}
|
|
48
60
|
}
|
|
49
61
|
};
|
|
50
62
|
__publicField(Figure, "config", {
|
|
63
|
+
...import_primitives.Transition.config,
|
|
51
64
|
name: "Figure",
|
|
52
65
|
refs: ["img"],
|
|
53
66
|
options: {
|
|
67
|
+
...import_primitives.Transition.config.options,
|
|
54
68
|
lazy: Boolean
|
|
55
69
|
}
|
|
56
70
|
});
|
package/atoms/Figure/Figure.d.ts
CHANGED
|
@@ -1,28 +1,49 @@
|
|
|
1
|
+
declare const Figure_base: typeof import("@studiometa/js-toolkit").Base & (new (...a: any[]) => {
|
|
2
|
+
readonly target: HTMLElement | HTMLElement[];
|
|
3
|
+
enter(target?: HTMLElement | HTMLElement[]): Promise<void | void[]>;
|
|
4
|
+
leave(target?: HTMLElement | HTMLElement[]): Promise<void | void[]>;
|
|
5
|
+
});
|
|
1
6
|
/**
|
|
2
|
-
* @typedef {
|
|
3
|
-
*
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
*
|
|
7
|
-
*
|
|
7
|
+
* @typedef {Figure & {
|
|
8
|
+
* $refs: {
|
|
9
|
+
* img: HTMLImageElement
|
|
10
|
+
* },
|
|
11
|
+
* $options: {
|
|
12
|
+
* lazy: boolean
|
|
13
|
+
* }
|
|
14
|
+
* }} FigureInterface
|
|
8
15
|
*/
|
|
9
16
|
/**
|
|
10
17
|
* Figure class.
|
|
11
18
|
*
|
|
12
19
|
* Manager lazyloading image sources.
|
|
13
20
|
*/
|
|
14
|
-
export default class Figure extends
|
|
21
|
+
export default class Figure extends Figure_base {
|
|
22
|
+
/**
|
|
23
|
+
* Config.
|
|
24
|
+
*/
|
|
15
25
|
static config: {
|
|
16
26
|
name: string;
|
|
17
27
|
refs: string[];
|
|
18
28
|
options: {
|
|
19
29
|
lazy: BooleanConstructor;
|
|
20
30
|
};
|
|
31
|
+
debug?: boolean;
|
|
32
|
+
log?: boolean;
|
|
33
|
+
emits?: string[];
|
|
34
|
+
components?: import("@studiometa/js-toolkit/Base/index.js").BaseConfigComponents;
|
|
21
35
|
};
|
|
36
|
+
/**
|
|
37
|
+
* Get the transition target.
|
|
38
|
+
*
|
|
39
|
+
* @this {FigureInterface}
|
|
40
|
+
* @returns {HTMLImageElement}
|
|
41
|
+
*/
|
|
42
|
+
get target(): HTMLImageElement;
|
|
22
43
|
/**
|
|
23
44
|
* Set the image source.
|
|
24
45
|
*
|
|
25
|
-
* @this {
|
|
46
|
+
* @this {FigureInterface}
|
|
26
47
|
* @param {string} value
|
|
27
48
|
* @returns {void}
|
|
28
49
|
*/
|
|
@@ -30,20 +51,22 @@ export default class Figure extends Base {
|
|
|
30
51
|
/**
|
|
31
52
|
* Get the image source.
|
|
32
53
|
*
|
|
33
|
-
* @this {
|
|
54
|
+
* @this {FigureInterface}
|
|
34
55
|
* @returns {string}
|
|
35
56
|
*/
|
|
36
57
|
get src(): string;
|
|
37
58
|
/**
|
|
38
59
|
* Load on mount.
|
|
39
|
-
* @this {
|
|
60
|
+
* @this {FigureInterface}
|
|
40
61
|
*/
|
|
41
|
-
mounted(this:
|
|
62
|
+
mounted(this: FigureInterface): void;
|
|
42
63
|
}
|
|
43
|
-
export type
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
$
|
|
64
|
+
export type FigureInterface = Figure & {
|
|
65
|
+
$refs: {
|
|
66
|
+
img: HTMLImageElement;
|
|
67
|
+
};
|
|
68
|
+
$options: {
|
|
69
|
+
lazy: boolean;
|
|
70
|
+
};
|
|
48
71
|
};
|
|
49
|
-
|
|
72
|
+
export {};
|
package/atoms/Figure/Figure.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{withMountWhenInView as s}from"@studiometa/js-toolkit";import{Transition as i}from"../../primitives/index.js";class n extends s(i,{threshold:[0,1]}){static config={...i.config,name:"Figure",refs:["img"],options:{...i.config.options,lazy:Boolean}};get target(){return this.$refs.img}get src(){return this.$refs.img.src}set src(e){this.$refs.img.src=e}mounted(){const{img:e}=this.$refs;if(!e)throw new Error("[Figure] The `img` ref is required.");if(!(e instanceof HTMLImageElement))throw new Error("[Figure] The `img` ref must be an `<img>` element.");const t=e.getAttribute("data-src");if(this.$options.lazy&&t&&t!==this.src){let r=new Image;r.onload=()=>{this.enter(),this.src=t,r=null},r.src=t}}}export{n as default};
|
|
@@ -41,7 +41,7 @@ var FigureTwicPics = class extends import_Figure.default {
|
|
|
41
41
|
return url.host;
|
|
42
42
|
}
|
|
43
43
|
set src(value) {
|
|
44
|
-
const url = new URL(value);
|
|
44
|
+
const url = new URL(value, window.location.origin);
|
|
45
45
|
url.host = this.domain;
|
|
46
46
|
const width = normalizeSize(this, "offsetWidth");
|
|
47
47
|
const height = normalizeSize(this, "offsetHeight");
|
|
@@ -22,6 +22,10 @@ export default class FigureTwicPics extends Figure {
|
|
|
22
22
|
lazy: BooleanConstructor;
|
|
23
23
|
};
|
|
24
24
|
refs: string[];
|
|
25
|
+
debug?: boolean;
|
|
26
|
+
log?: boolean;
|
|
27
|
+
emits?: string[];
|
|
28
|
+
components?: import("@studiometa/js-toolkit/Base/index.js").BaseConfigComponents;
|
|
25
29
|
};
|
|
26
30
|
/**
|
|
27
31
|
* Get the TwicPics domain.
|
|
@@ -43,6 +47,7 @@ export type FigureTwicPicsInterface = FigureTwicPics & FigureInterface & {
|
|
|
43
47
|
$options: {
|
|
44
48
|
transform: string;
|
|
45
49
|
step: number;
|
|
50
|
+
mode: string;
|
|
46
51
|
};
|
|
47
52
|
};
|
|
48
53
|
import Figure from "./Figure.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import e from"./Figure.js";function o(i,s){const{step:t}=i.$options;return Math.ceil(i.$refs.img[s]/t)*t}class c extends e{static config={...e.config,name:"FigureTwicPics",options:{...e.config.options,transform:String,step:{type:Number,default:50},mode:{type:String,default:"cover"}}};get domain(){return new URL(this.$refs.img.dataset.src).host}set src(s){const t=new URL(s,window.location.origin);t.host=this.domain;const r=o(this,"offsetWidth"),n=o(this,"offsetHeight");t.searchParams.set("twic",["v1",this.$options.transform,`${this.$options.mode}=${r}x${n}`].filter(Boolean).join("/")),t.search=decodeURIComponent(t.search),super.src=t.toString()}resized(){this.src=this.$refs.img.dataset.src}}export{c as default};
|
|
@@ -30,11 +30,11 @@ module.exports = __toCommonJS(LargeText_exports);
|
|
|
30
30
|
var import_js_toolkit = require("@studiometa/js-toolkit");
|
|
31
31
|
var import_utils = require("@studiometa/js-toolkit/utils");
|
|
32
32
|
var LargeText = class extends (0, import_js_toolkit.withMountWhenInView)(import_js_toolkit.Base, { rootMargin: "50%" }) {
|
|
33
|
-
|
|
33
|
+
x = 0;
|
|
34
34
|
deltaY = 0;
|
|
35
35
|
transform = {
|
|
36
36
|
skewX: 0,
|
|
37
|
-
|
|
37
|
+
x: 0
|
|
38
38
|
};
|
|
39
39
|
width = 0;
|
|
40
40
|
mounted() {
|
|
@@ -47,17 +47,17 @@ var LargeText = class extends (0, import_js_toolkit.withMountWhenInView)(import_
|
|
|
47
47
|
this.deltaY = props.delta.y;
|
|
48
48
|
}
|
|
49
49
|
ticked() {
|
|
50
|
-
this.
|
|
51
|
-
this.transform.
|
|
50
|
+
this.x -= (Math.abs(this.deltaY) + 1) * this.$options.sensitivity;
|
|
51
|
+
this.transform.x = (0, import_utils.damp)(this.x, this.transform.x, 0.25);
|
|
52
52
|
if (this.$options.skew) {
|
|
53
|
-
this.transform.skewX = (0, import_utils.damp)((0, import_utils.clamp)(this.deltaY
|
|
53
|
+
this.transform.skewX = (0, import_utils.damp)((0, import_utils.clamp)(this.deltaY * -1, -50, 50) * this.$options.skewSensitivity, this.transform.skewX, 0.25);
|
|
54
54
|
}
|
|
55
|
-
if (this.
|
|
56
|
-
this.
|
|
57
|
-
this.transform.
|
|
58
|
-
} else if (this.$options.sensitivity < 0 && this.
|
|
59
|
-
this.
|
|
60
|
-
this.transform.
|
|
55
|
+
if (this.x <= this.width * -1) {
|
|
56
|
+
this.x = 0;
|
|
57
|
+
this.transform.x += this.width;
|
|
58
|
+
} else if (this.$options.sensitivity < 0 && this.x >= this.width) {
|
|
59
|
+
this.x = 0;
|
|
60
|
+
this.transform.x -= this.width;
|
|
61
61
|
}
|
|
62
62
|
return () => {
|
|
63
63
|
(0, import_utils.transform)(this.$refs.target, this.transform);
|
|
@@ -34,7 +34,7 @@ export default class LargeText extends Base {
|
|
|
34
34
|
* Translate X.
|
|
35
35
|
* @type {number}
|
|
36
36
|
*/
|
|
37
|
-
|
|
37
|
+
x: number;
|
|
38
38
|
/**
|
|
39
39
|
* Scroll delta Y.
|
|
40
40
|
* @type {number}
|
|
@@ -45,7 +45,7 @@ export default class LargeText extends Base {
|
|
|
45
45
|
*/
|
|
46
46
|
transform: {
|
|
47
47
|
skewX: number;
|
|
48
|
-
|
|
48
|
+
x: number;
|
|
49
49
|
};
|
|
50
50
|
/**
|
|
51
51
|
* Target width.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Base as
|
|
1
|
+
import{Base as s,withMountWhenInView as e}from"@studiometa/js-toolkit";import{damp as t,clamp as h,transform as r}from"@studiometa/js-toolkit/utils";class a extends e(s,{rootMargin:"50%"}){static config={name:"LargeText",refs:["target"],options:{skew:Boolean,sensitivity:{type:Number,default:1},skewSensitivity:{type:Number,default:1}}};x=0;deltaY=0;transform={skewX:0,x:0};width=0;mounted(){this.width=this.$refs.target.clientWidth}resized(){this.width=this.$refs.target.clientWidth}scrolled(i){this.deltaY=i.delta.y}ticked(){return this.x-=(Math.abs(this.deltaY)+1)*this.$options.sensitivity,this.transform.x=t(this.x,this.transform.x,.25),this.$options.skew&&(this.transform.skewX=t(h(this.deltaY*-1,-50,50)*this.$options.skewSensitivity,this.transform.skewX,.25)),this.x<=this.width*-1?(this.x=0,this.transform.x+=this.width):this.$options.sensitivity<0&&this.x>=this.width&&(this.x=0,this.transform.x-=this.width),()=>{r(this.$refs.target,this.transform)}}}export{a as default};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
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 });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var __publicField = (obj, key, value) => {
|
|
20
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
21
|
+
return value;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
// packages/ui/atoms/ScrollReveal/ScrollReveal.js
|
|
25
|
+
var ScrollReveal_exports = {};
|
|
26
|
+
__export(ScrollReveal_exports, {
|
|
27
|
+
default: () => ScrollReveal
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(ScrollReveal_exports);
|
|
30
|
+
var import_js_toolkit = require("@studiometa/js-toolkit");
|
|
31
|
+
var import_primitives = require("../../primitives/index.cjs");
|
|
32
|
+
var _ScrollReveal = class extends (0, import_js_toolkit.withMountWhenInView)(import_primitives.Transition) {
|
|
33
|
+
get target() {
|
|
34
|
+
return this.$refs.target ?? this.$el;
|
|
35
|
+
}
|
|
36
|
+
mounted() {
|
|
37
|
+
if (!this.$options.repeat) {
|
|
38
|
+
this.enter();
|
|
39
|
+
this.$terminate();
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
const scroll = (0, import_js_toolkit.useScroll)();
|
|
43
|
+
if (!scroll.has("ScrollRevealRepeat")) {
|
|
44
|
+
scroll.add("ScrollRevealRepeat", (props) => {
|
|
45
|
+
_ScrollReveal.scrollDirectionY = props.direction.y;
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
if (_ScrollReveal.scrollDirectionY !== "UP") {
|
|
49
|
+
this.enter();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
var ScrollReveal = _ScrollReveal;
|
|
54
|
+
__publicField(ScrollReveal, "config", {
|
|
55
|
+
...import_primitives.Transition.config,
|
|
56
|
+
name: "ScrollReveal",
|
|
57
|
+
refs: ["target"],
|
|
58
|
+
options: {
|
|
59
|
+
...import_primitives.Transition.config.options,
|
|
60
|
+
enterKeep: {
|
|
61
|
+
type: Boolean,
|
|
62
|
+
default: true
|
|
63
|
+
},
|
|
64
|
+
repeat: Boolean,
|
|
65
|
+
intersectionObserver: {
|
|
66
|
+
type: Object,
|
|
67
|
+
default: () => ({ threshold: [0, 1] })
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
__publicField(ScrollReveal, "scrollDirectionY", "NONE");
|
|
72
|
+
if (module.exports.default) module.exports = module.exports.default;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
declare const ScrollReveal_base: typeof import("@studiometa/js-toolkit").Base & (new (...a: any[]) => {
|
|
2
|
+
readonly target: HTMLElement | HTMLElement[];
|
|
3
|
+
enter(target?: HTMLElement | HTMLElement[]): Promise<void | void[]>; /**
|
|
4
|
+
* Trigger the `enter` transition on mount.
|
|
5
|
+
*
|
|
6
|
+
* @this {ScrollRevealInterface}
|
|
7
|
+
* @returns {void}
|
|
8
|
+
*/
|
|
9
|
+
leave(target?: HTMLElement | HTMLElement[]): Promise<void | void[]>;
|
|
10
|
+
});
|
|
11
|
+
/**
|
|
12
|
+
* @typedef {ScrollReveal & {
|
|
13
|
+
* $refs: {
|
|
14
|
+
* target?: HTMLElement,
|
|
15
|
+
* },
|
|
16
|
+
* $options: {
|
|
17
|
+
* repeat: boolean;
|
|
18
|
+
* }
|
|
19
|
+
* }} ScrollRevealInterface
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* ScrollReveal class.
|
|
23
|
+
*/
|
|
24
|
+
export default class ScrollReveal extends ScrollReveal_base {
|
|
25
|
+
/**
|
|
26
|
+
* Config.
|
|
27
|
+
*/
|
|
28
|
+
static config: {
|
|
29
|
+
name: string;
|
|
30
|
+
refs: string[];
|
|
31
|
+
options: {
|
|
32
|
+
enterKeep: {
|
|
33
|
+
type: BooleanConstructor;
|
|
34
|
+
default: boolean;
|
|
35
|
+
};
|
|
36
|
+
repeat: BooleanConstructor;
|
|
37
|
+
intersectionObserver: {
|
|
38
|
+
type: ObjectConstructor;
|
|
39
|
+
default: () => {
|
|
40
|
+
threshold: number[];
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
debug?: boolean;
|
|
45
|
+
log?: boolean;
|
|
46
|
+
emits?: string[];
|
|
47
|
+
components?: import("@studiometa/js-toolkit/Base/index.js").BaseConfigComponents;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Vertical scroll direction.
|
|
51
|
+
* @type {'UP'|'DOWN'|'NONE'}
|
|
52
|
+
*/
|
|
53
|
+
static scrollDirectionY: 'UP' | 'DOWN' | 'NONE';
|
|
54
|
+
/**
|
|
55
|
+
* Get the transition target.
|
|
56
|
+
*
|
|
57
|
+
* @this {ScrollRevealInterface}
|
|
58
|
+
* @returns {HTMLElement}
|
|
59
|
+
*/
|
|
60
|
+
get target(): HTMLElement;
|
|
61
|
+
/**
|
|
62
|
+
* Trigger the `enter` transition on mount.
|
|
63
|
+
*
|
|
64
|
+
* @this {ScrollRevealInterface}
|
|
65
|
+
* @returns {void}
|
|
66
|
+
*/
|
|
67
|
+
mounted(this: ScrollRevealInterface): void;
|
|
68
|
+
}
|
|
69
|
+
export type ScrollRevealInterface = ScrollReveal & {
|
|
70
|
+
$refs: {
|
|
71
|
+
target?: HTMLElement;
|
|
72
|
+
};
|
|
73
|
+
$options: {
|
|
74
|
+
repeat: boolean;
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{withMountWhenInView as i,useScroll as n}from"@studiometa/js-toolkit";import{Transition as t}from"../../primitives/index.js";class e extends i(t){static config={...t.config,name:"ScrollReveal",refs:["target"],options:{...t.config.options,enterKeep:{type:Boolean,default:!0},repeat:Boolean,intersectionObserver:{type:Object,default:()=>({threshold:[0,1]})}}};static scrollDirectionY="NONE";get target(){return this.$refs.target??this.$el}mounted(){if(!this.$options.repeat){this.enter(),this.$terminate();return}const r=n();r.has("ScrollRevealRepeat")||r.add("ScrollRevealRepeat",o=>{e.scrollDirectionY=o.direction.y}),e.scrollDirectionY!=="UP"&&this.enter()}}export{e as default};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
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
|
+
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 });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
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);
|
|
21
|
+
|
|
22
|
+
// packages/ui/atoms/ScrollReveal/index.js
|
|
23
|
+
var ScrollReveal_exports = {};
|
|
24
|
+
__export(ScrollReveal_exports, {
|
|
25
|
+
ScrollReveal: () => import_ScrollReveal.default
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(ScrollReveal_exports);
|
|
28
|
+
var import_ScrollReveal = __toESM(require("./ScrollReveal.cjs"), 1);
|
|
29
|
+
if (module.exports.default) module.exports = module.exports.default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as ScrollReveal } from "./ScrollReveal.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{default as a}from"./ScrollReveal.js";export{a as ScrollReveal};
|
package/atoms/index.cjs
CHANGED
|
@@ -32,6 +32,7 @@ module.exports = __toCommonJS(atoms_exports);
|
|
|
32
32
|
__reExport(atoms_exports, require("./Figure/index.cjs"), module.exports);
|
|
33
33
|
__reExport(atoms_exports, require("./Prefetch/index.cjs"), module.exports);
|
|
34
34
|
__reExport(atoms_exports, require("./ScrollAnimation/index.cjs"), module.exports);
|
|
35
|
+
__reExport(atoms_exports, require("./ScrollReveal/index.cjs"), module.exports);
|
|
35
36
|
var import_AnchorScrollTo = __toESM(require("./AnchorScrollTo/AnchorScrollTo.cjs"), 1);
|
|
36
37
|
var import_Cursor = __toESM(require("./Cursor/Cursor.cjs"), 1);
|
|
37
38
|
var import_LargeText = __toESM(require("./LargeText/LargeText.cjs"), 1);
|
package/atoms/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from "./Figure/index.js";
|
|
2
2
|
export * from "./Prefetch/index.js";
|
|
3
3
|
export * from "./ScrollAnimation/index.js";
|
|
4
|
+
export * from "./ScrollReveal/index.js";
|
|
4
5
|
export { default as AnchorScrollTo } from "./AnchorScrollTo/AnchorScrollTo.js";
|
|
5
6
|
export { default as Cursor } from "./Cursor/Cursor.js";
|
|
6
7
|
export { default as LargeText } from "./LargeText/LargeText.js";
|
package/atoms/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export*from"./Figure/index.js";export*from"./Prefetch/index.js";export*from"./ScrollAnimation/index.js";import{default as
|
|
1
|
+
export*from"./Figure/index.js";export*from"./Prefetch/index.js";export*from"./ScrollAnimation/index.js";export*from"./ScrollReveal/index.js";import{default as x}from"./AnchorScrollTo/AnchorScrollTo.js";import{default as p}from"./Cursor/Cursor.js";import{default as u}from"./LargeText/LargeText.js";import{default as s}from"./LazyInclude/LazyInclude.js";export{x as AnchorScrollTo,p as Cursor,u as LargeText,s as LazyInclude};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
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
|
+
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 });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
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);
|
|
21
|
+
|
|
22
|
+
// packages/ui/decorators/index.js
|
|
23
|
+
var decorators_exports = {};
|
|
24
|
+
__export(decorators_exports, {
|
|
25
|
+
withTransition: () => import_withTransition.default
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(decorators_exports);
|
|
28
|
+
var import_withTransition = __toESM(require("./withTransition.cjs"), 1);
|
|
29
|
+
if (module.exports.default) module.exports = module.exports.default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as withTransition } from "./withTransition.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{default as i}from"./withTransition.js";export{i as withTransition};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// packages/ui/decorators/withTransition.js
|
|
20
|
+
var withTransition_exports = {};
|
|
21
|
+
__export(withTransition_exports, {
|
|
22
|
+
default: () => withTransition
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(withTransition_exports);
|
|
25
|
+
var import_utils = require("@studiometa/js-toolkit/utils");
|
|
26
|
+
function delegateTransition(element, name, endMode) {
|
|
27
|
+
return (0, import_utils.isArray)(element) ? Promise.all(element.map((el) => (0, import_utils.transition)(el, name, endMode))) : (0, import_utils.transition)(element, name, endMode);
|
|
28
|
+
}
|
|
29
|
+
function withTransition(BaseClass) {
|
|
30
|
+
class Transition extends BaseClass {
|
|
31
|
+
static config = {
|
|
32
|
+
name: "Transition",
|
|
33
|
+
options: {
|
|
34
|
+
enterFrom: String,
|
|
35
|
+
enterActive: String,
|
|
36
|
+
enterTo: String,
|
|
37
|
+
enterKeep: Boolean,
|
|
38
|
+
leaveFrom: String,
|
|
39
|
+
leaveActive: String,
|
|
40
|
+
leaveTo: String,
|
|
41
|
+
leaveKeep: Boolean
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
get target() {
|
|
45
|
+
return this.$el;
|
|
46
|
+
}
|
|
47
|
+
enter(target) {
|
|
48
|
+
const { enterFrom, enterActive, enterTo, enterKeep, leaveTo } = this.$options;
|
|
49
|
+
return delegateTransition(target ?? this.target, {
|
|
50
|
+
from: (leaveTo + " " + enterFrom).trim(),
|
|
51
|
+
active: enterActive,
|
|
52
|
+
to: enterTo
|
|
53
|
+
}, enterKeep && "keep");
|
|
54
|
+
}
|
|
55
|
+
leave(target) {
|
|
56
|
+
const { leaveFrom, leaveActive, leaveTo, leaveKeep, enterTo } = this.$options;
|
|
57
|
+
return delegateTransition(target ?? this.target, {
|
|
58
|
+
from: (enterTo + " " + leaveFrom).trim(),
|
|
59
|
+
active: leaveActive,
|
|
60
|
+
to: leaveTo
|
|
61
|
+
}, leaveKeep && "keep");
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return Transition;
|
|
65
|
+
}
|
|
66
|
+
if (module.exports.default) module.exports = module.exports.default;
|