@studiometa/ui 1.0.0-rc.0 → 1.0.0-rc.1
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/AnchorScrollTo/AnchorScrollTo.d.ts +2 -2
- package/AnchorScrollTo/AnchorScrollTo.js +0 -1
- package/AnchorScrollTo/AnchorScrollTo.js.map +2 -2
- package/Button/Button.twig +12 -9
- package/Button/StyledButton.twig +40 -5
- package/Button/StyledButtonRounded.twig +12 -42
- package/Data/DataBind.js +1 -1
- package/Data/DataBind.js.map +2 -2
- package/Draggable/Draggable.js +7 -2
- package/Draggable/Draggable.js.map +2 -2
- package/Figure/Figure.d.ts +1 -0
- package/Figure/Figure.js.map +2 -2
- package/Frame/AbstractFrameTrigger.d.ts +43 -0
- package/Frame/AbstractFrameTrigger.js +72 -0
- package/Frame/AbstractFrameTrigger.js.map +7 -0
- package/Frame/Frame.d.ts +55 -27
- package/Frame/Frame.js +132 -138
- package/Frame/Frame.js.map +3 -3
- package/Frame/FrameAnchor.d.ts +7 -4
- package/Frame/FrameAnchor.js +8 -5
- package/Frame/FrameAnchor.js.map +2 -2
- package/Frame/FrameForm.d.ts +22 -4
- package/Frame/FrameForm.js +43 -6
- package/Frame/FrameForm.js.map +2 -2
- package/Frame/FrameLoader.d.ts +22 -0
- package/Frame/FrameLoader.js +22 -0
- package/Frame/FrameLoader.js.map +7 -0
- package/Frame/FrameTarget.d.ts +6 -17
- package/Frame/FrameTarget.js +25 -60
- package/Frame/FrameTarget.js.map +2 -2
- package/Frame/FrameTriggerLoader.d.ts +13 -0
- package/Frame/FrameTriggerLoader.js +13 -0
- package/Frame/FrameTriggerLoader.js.map +7 -0
- package/Frame/index.d.ts +4 -0
- package/Frame/index.js +4 -0
- package/Frame/index.js.map +2 -2
- package/Frame/types.d.ts +12 -0
- package/Frame/types.js +1 -0
- package/Frame/types.js.map +7 -0
- package/Frame/utils.d.ts +9 -0
- package/Frame/utils.js +13 -0
- package/Frame/utils.js.map +7 -0
- package/Slider/AbstractSliderChild.d.ts +5 -9
- package/Slider/AbstractSliderChild.js +0 -11
- package/Slider/AbstractSliderChild.js.map +2 -2
- package/Slider/Slider.d.ts +23 -30
- package/Slider/Slider.js +40 -100
- package/Slider/Slider.js.map +2 -2
- package/Slider/SliderBtn.d.ts +0 -3
- package/Slider/SliderBtn.js +3 -7
- package/Slider/SliderBtn.js.map +2 -2
- package/Slider/SliderCount.d.ts +0 -2
- package/Slider/SliderCount.js +4 -3
- package/Slider/SliderCount.js.map +2 -2
- package/Slider/SliderDots.d.ts +0 -3
- package/Slider/SliderDots.js +6 -7
- package/Slider/SliderDots.js.map +2 -2
- package/Slider/SliderDrag.d.ts +0 -2
- package/Slider/SliderDrag.js +0 -2
- package/Slider/SliderDrag.js.map +2 -2
- package/Slider/SliderItem.d.ts +10 -26
- package/Slider/SliderItem.js +9 -41
- package/Slider/SliderItem.js.map +2 -2
- package/decorators/withTransition.d.ts +4 -0
- package/decorators/withTransition.js +40 -45
- package/decorators/withTransition.js.map +2 -2
- package/package.json +4 -3
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../packages/ui/Frame/FrameLoader.ts"],
|
|
4
|
+
"sourcesContent": ["import type { BaseProps, BaseConfig } from '@studiometa/js-toolkit';\nimport { Transition } from '../Transition/index.js';\nimport type { TransitionProps } from '../decorators/withTransition.js';\n\nexport interface FrameLoaderProps extends BaseProps {\n $options: TransitionProps['$options'] & {\n enterKeep: true;\n leaveKeep: true;\n };\n}\n\n/**\n * Class.\n */\nexport class FrameLoader<T extends BaseProps = BaseProps> extends Transition<T & FrameLoaderProps> {\n /**\n * Config.\n */\n static config: BaseConfig = {\n name: 'FrameLoader',\n };\n\n // @ts-expect-error this is fine.\n get $options() {\n const options = super.$options;\n\n return {\n ...options,\n enterKeep: true,\n leaveKeep: true,\n };\n }\n}\n"],
|
|
5
|
+
"mappings": "AACA,SAAS,kBAAkB;AAapB,MAAM,oBAAqD,WAAiC;AAAA;AAAA;AAAA;AAAA,EAIjG,OAAO,SAAqB;AAAA,IAC1B,MAAM;AAAA,EACR;AAAA;AAAA,EAGA,IAAI,WAAW;AACb,UAAM,UAAU,MAAM;AAEtB,WAAO;AAAA,MACL,GAAG;AAAA,MACH,WAAW;AAAA,MACX,WAAW;AAAA,IACb;AAAA,EACF;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/Frame/FrameTarget.d.ts
CHANGED
|
@@ -3,8 +3,6 @@ import { Transition } from '../Transition/index.js';
|
|
|
3
3
|
export interface FrameTargetProps extends BaseProps {
|
|
4
4
|
$options: {
|
|
5
5
|
mode: 'replace' | 'prepend' | 'append';
|
|
6
|
-
id: string;
|
|
7
|
-
leaveKeep: true;
|
|
8
6
|
};
|
|
9
7
|
}
|
|
10
8
|
/**
|
|
@@ -16,28 +14,19 @@ export declare class FrameTarget<T extends BaseProps = BaseProps> extends Transi
|
|
|
16
14
|
*/
|
|
17
15
|
static config: BaseConfig;
|
|
18
16
|
/**
|
|
19
|
-
*
|
|
17
|
+
* Different mode of content insertion.
|
|
20
18
|
*/
|
|
21
|
-
|
|
22
|
-
readonly
|
|
23
|
-
readonly
|
|
19
|
+
modes: {
|
|
20
|
+
readonly APPEND: "append";
|
|
21
|
+
readonly PREPEND: "prepend";
|
|
22
|
+
readonly REPLACE: "replace";
|
|
24
23
|
};
|
|
25
|
-
/**
|
|
26
|
-
* Override options.
|
|
27
|
-
*/
|
|
28
|
-
get $options(): import("@studiometa/js-toolkit").BaseOptions & (T & FrameTargetProps & import("../index.js").TransitionProps)["$options"];
|
|
29
24
|
/**
|
|
30
25
|
* Get uniq ID.
|
|
31
26
|
*/
|
|
32
27
|
get id(): string;
|
|
33
|
-
/**
|
|
34
|
-
* Enter transition.
|
|
35
|
-
*/
|
|
36
|
-
enter(): Promise<void>;
|
|
37
28
|
/**
|
|
38
29
|
* Update the content from the new target.
|
|
39
|
-
* @param {FrameTarget} newTarget The instance of the new target.
|
|
40
|
-
* @returns {void}
|
|
41
30
|
*/
|
|
42
|
-
updateContent(
|
|
31
|
+
updateContent(content?: Element): Promise<void>;
|
|
43
32
|
}
|
package/Frame/FrameTarget.js
CHANGED
|
@@ -1,88 +1,53 @@
|
|
|
1
|
-
import { addClass, transition } from "@studiometa/js-toolkit/utils";
|
|
2
1
|
import { Transition } from "../Transition/index.js";
|
|
2
|
+
import morphdom from "morphdom";
|
|
3
3
|
class FrameTarget extends Transition {
|
|
4
4
|
/**
|
|
5
5
|
* Config.
|
|
6
6
|
*/
|
|
7
7
|
static config = {
|
|
8
|
-
...Transition.config,
|
|
9
8
|
name: "FrameTarget",
|
|
10
|
-
log: true,
|
|
11
9
|
options: {
|
|
12
|
-
...Transition.config.options,
|
|
13
10
|
mode: {
|
|
14
11
|
type: String,
|
|
15
12
|
default: "replace"
|
|
16
13
|
// or 'prepend' or 'append'
|
|
17
|
-
}
|
|
18
|
-
id: String
|
|
14
|
+
}
|
|
19
15
|
}
|
|
20
16
|
};
|
|
21
17
|
/**
|
|
22
|
-
*
|
|
18
|
+
* Different mode of content insertion.
|
|
23
19
|
*/
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
modes = {
|
|
21
|
+
APPEND: "append",
|
|
22
|
+
PREPEND: "prepend",
|
|
23
|
+
REPLACE: "replace"
|
|
27
24
|
};
|
|
28
|
-
/**
|
|
29
|
-
* Override options.
|
|
30
|
-
*/
|
|
31
|
-
// @ts-ignore
|
|
32
|
-
get $options() {
|
|
33
|
-
const options = super.$options;
|
|
34
|
-
options.leaveKeep = true;
|
|
35
|
-
return options;
|
|
36
|
-
}
|
|
37
25
|
/**
|
|
38
26
|
* Get uniq ID.
|
|
39
27
|
*/
|
|
40
28
|
get id() {
|
|
41
|
-
return this.$
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Enter transition.
|
|
45
|
-
*/
|
|
46
|
-
async enter() {
|
|
47
|
-
this.$log("enter");
|
|
48
|
-
const { enterFrom: from, enterActive: active, enterTo: to, leaveTo, enterKeep } = this.$options;
|
|
49
|
-
const transitionStyles = { from, active, to };
|
|
50
|
-
switch (this.$options.mode) {
|
|
51
|
-
case "append":
|
|
52
|
-
case "prepend":
|
|
53
|
-
await Promise.all(
|
|
54
|
-
Array.from(this.$el.children).filter(
|
|
55
|
-
(child) => from.split(" ").every((className) => child.classList.contains(className))
|
|
56
|
-
).map(
|
|
57
|
-
(child) => transition(child, transitionStyles, enterKeep ? "keep" : void 0)
|
|
58
|
-
)
|
|
59
|
-
);
|
|
60
|
-
break;
|
|
61
|
-
case "replace":
|
|
62
|
-
default:
|
|
63
|
-
transitionStyles.from = Array.from(new Set([from, leaveTo].flat())).join(" ");
|
|
64
|
-
await transition(this.$el, transitionStyles, enterKeep ? "keep" : void 0);
|
|
65
|
-
}
|
|
29
|
+
return this.$el.id;
|
|
66
30
|
}
|
|
67
31
|
/**
|
|
68
32
|
* Update the content from the new target.
|
|
69
|
-
* @param {FrameTarget} newTarget The instance of the new target.
|
|
70
|
-
* @returns {void}
|
|
71
33
|
*/
|
|
72
|
-
updateContent(
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
34
|
+
async updateContent(content = null) {
|
|
35
|
+
if (!content) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const { mode } = this.$options;
|
|
39
|
+
if (mode === this.modes.APPEND || mode === this.modes.PREPEND) {
|
|
40
|
+
const leaveTargets = Array.from(this.$el.children);
|
|
41
|
+
const enterTargets = Array.from(content.children);
|
|
42
|
+
this.$el[mode](...Array.from(content.childNodes));
|
|
43
|
+
await Promise.all([
|
|
44
|
+
this.leave(leaveTargets),
|
|
45
|
+
this.enter(enterTargets)
|
|
46
|
+
]);
|
|
47
|
+
} else {
|
|
48
|
+
await this.leave();
|
|
49
|
+
morphdom(this.$el, content);
|
|
50
|
+
await this.enter();
|
|
86
51
|
}
|
|
87
52
|
}
|
|
88
53
|
}
|
package/Frame/FrameTarget.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../packages/ui/Frame/FrameTarget.ts"],
|
|
4
|
-
"sourcesContent": ["import type { BaseConfig, BaseProps } from '@studiometa/js-toolkit';\nimport {
|
|
5
|
-
"mappings": "AACA,SAAS,
|
|
4
|
+
"sourcesContent": ["import type { BaseConfig, BaseProps } from '@studiometa/js-toolkit';\nimport { Transition } from '../Transition/index.js';\nimport morphdom from 'morphdom';\n\nexport interface FrameTargetProps extends BaseProps {\n $options: {\n mode: 'replace' | 'prepend' | 'append';\n };\n}\n\n/**\n * FrameTarget class.\n */\nexport class FrameTarget<T extends BaseProps = BaseProps> extends Transition<T & FrameTargetProps> {\n /**\n * Config.\n */\n static config: BaseConfig = {\n name: 'FrameTarget',\n options: {\n mode: {\n type: String,\n default: 'replace', // or 'prepend' or 'append'\n },\n },\n };\n\n /**\n * Different mode of content insertion.\n */\n modes = {\n APPEND: 'append',\n PREPEND: 'prepend',\n REPLACE: 'replace',\n } as const;\n\n /**\n * Get uniq ID.\n */\n get id(): string {\n return this.$el.id;\n }\n\n /**\n * Update the content from the new target.\n */\n async updateContent(content: Element = null) {\n if (!content) {\n return;\n }\n\n const { mode } = this.$options;\n\n // In append or prepend mode, the leave transition can be used to\n // move the exisiting children of the root element, with the leave\n // transition being applied in parallel of the enter transition.\n if (mode === this.modes.APPEND || mode === this.modes.PREPEND) {\n const leaveTargets = Array.from(this.$el.children) as HTMLElement[];\n const enterTargets = Array.from(content.children) as HTMLElement[];\n\n this.$el[mode](...Array.from(content.childNodes));\n\n await Promise.all([\n this.leave(leaveTargets),\n this.enter(enterTargets),\n ]);\n } else {\n await this.leave();\n morphdom(this.$el, content);\n await this.enter();\n }\n }\n}\n"],
|
|
5
|
+
"mappings": "AACA,SAAS,kBAAkB;AAC3B,OAAO,cAAc;AAWd,MAAM,oBAAqD,WAAiC;AAAA;AAAA;AAAA;AAAA,EAIjG,OAAO,SAAqB;AAAA,IAC1B,MAAM;AAAA,IACN,SAAS;AAAA,MACP,MAAM;AAAA,QACJ,MAAM;AAAA,QACN,SAAS;AAAA;AAAA,MACX;AAAA,IACF;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAKA,QAAQ;AAAA,IACN,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,SAAS;AAAA,EACX;AAAA;AAAA;AAAA;AAAA,EAKA,IAAI,KAAa;AACf,WAAO,KAAK,IAAI;AAAA,EAClB;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,cAAc,UAAmB,MAAM;AAC3C,QAAI,CAAC,SAAS;AACZ;AAAA,IACF;AAEA,UAAM,EAAE,KAAK,IAAI,KAAK;AAKtB,QAAI,SAAS,KAAK,MAAM,UAAU,SAAS,KAAK,MAAM,SAAS;AAC7D,YAAM,eAAe,MAAM,KAAK,KAAK,IAAI,QAAQ;AACjD,YAAM,eAAe,MAAM,KAAK,QAAQ,QAAQ;AAEhD,WAAK,IAAI,IAAI,EAAE,GAAG,MAAM,KAAK,QAAQ,UAAU,CAAC;AAEhD,YAAM,QAAQ,IAAI;AAAA,QAChB,KAAK,MAAM,YAAY;AAAA,QACvB,KAAK,MAAM,YAAY;AAAA,MACzB,CAAC;AAAA,IACH,OAAO;AACL,YAAM,KAAK,MAAM;AACjB,eAAS,KAAK,KAAK,OAAO;AAC1B,YAAM,KAAK,MAAM;AAAA,IACnB;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { BaseConfig, BaseProps } from '@studiometa/js-toolkit';
|
|
2
|
+
import { FrameLoader } from './FrameLoader.js';
|
|
3
|
+
import type { FrameLoaderProps } from './FrameLoader.js';
|
|
4
|
+
export type FrameTriggerLoaderProps = FrameLoaderProps;
|
|
5
|
+
/**
|
|
6
|
+
* FrameTriggerLoader class.
|
|
7
|
+
*/
|
|
8
|
+
export declare class FrameTriggerLoader<T extends BaseProps = BaseProps> extends FrameLoader<T & FrameTriggerLoaderProps> {
|
|
9
|
+
/**
|
|
10
|
+
* Config.
|
|
11
|
+
*/
|
|
12
|
+
static config: BaseConfig;
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FrameLoader } from "./FrameLoader.js";
|
|
2
|
+
class FrameTriggerLoader extends FrameLoader {
|
|
3
|
+
/**
|
|
4
|
+
* Config.
|
|
5
|
+
*/
|
|
6
|
+
static config = {
|
|
7
|
+
name: "FrameTriggerLoader"
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
FrameTriggerLoader
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=FrameTriggerLoader.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../packages/ui/Frame/FrameTriggerLoader.ts"],
|
|
4
|
+
"sourcesContent": ["import type { BaseConfig, BaseProps } from '@studiometa/js-toolkit';\nimport { FrameLoader } from './FrameLoader.js';\nimport type { FrameLoaderProps } from './FrameLoader.js';\n\nexport type FrameTriggerLoaderProps = FrameLoaderProps;\n\n/**\n * FrameTriggerLoader class.\n */\nexport class FrameTriggerLoader<T extends BaseProps = BaseProps> extends FrameLoader<\n T & FrameTriggerLoaderProps\n> {\n /**\n * Config.\n */\n static config: BaseConfig = {\n name: 'FrameTriggerLoader',\n }\n}\n"],
|
|
5
|
+
"mappings": "AACA,SAAS,mBAAmB;AAQrB,MAAM,2BAA4D,YAEvE;AAAA;AAAA;AAAA;AAAA,EAIA,OAAO,SAAqB;AAAA,IAC1B,MAAM;AAAA,EACR;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/Frame/index.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
export * from './Frame.js';
|
|
2
2
|
export * from './FrameAnchor.js';
|
|
3
3
|
export * from './FrameForm.js';
|
|
4
|
+
export * from './FrameLoader.js';
|
|
5
|
+
export * from './FrameTriggerLoader.js';
|
|
4
6
|
export * from './FrameTarget.js';
|
|
7
|
+
export * from './AbstractFrameTrigger.js';
|
|
8
|
+
export * from './types.js';
|
package/Frame/index.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
export * from "./Frame.js";
|
|
2
2
|
export * from "./FrameAnchor.js";
|
|
3
3
|
export * from "./FrameForm.js";
|
|
4
|
+
export * from "./FrameLoader.js";
|
|
5
|
+
export * from "./FrameTriggerLoader.js";
|
|
4
6
|
export * from "./FrameTarget.js";
|
|
7
|
+
export * from "./AbstractFrameTrigger.js";
|
|
8
|
+
export * from "./types.js";
|
|
5
9
|
//# sourceMappingURL=index.js.map
|
package/Frame/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../packages/ui/Frame/index.ts"],
|
|
4
|
-
"sourcesContent": ["export * from './Frame.js';\nexport * from './FrameAnchor.js';\nexport * from './FrameForm.js';\nexport * from './FrameTarget.js';\n"],
|
|
5
|
-
"mappings": "AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;",
|
|
4
|
+
"sourcesContent": ["export * from './Frame.js';\nexport * from './FrameAnchor.js';\nexport * from './FrameForm.js';\nexport * from './FrameLoader.js';\nexport * from './FrameTriggerLoader.js';\nexport * from './FrameTarget.js';\nexport * from './AbstractFrameTrigger.js';\nexport * from './types.js';\n"],
|
|
5
|
+
"mappings": "AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/Frame/types.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { FrameAnchor } from './FrameAnchor.js';
|
|
2
|
+
import type { FrameForm } from './FrameForm.js';
|
|
3
|
+
export type FrameRequestInit = RequestInit & {
|
|
4
|
+
trigger?: FrameAnchor | FrameForm;
|
|
5
|
+
};
|
|
6
|
+
export type FrameTriggerEvent = CustomEvent<[URL, FrameRequestInit]>;
|
|
7
|
+
export type FrameFetchEvent = CustomEvent<[URL, FrameRequestInit]>;
|
|
8
|
+
export type FrameFetchBeforeEvent = FrameFetchEvent;
|
|
9
|
+
export type FrameFetchAfterEvent = CustomEvent<[URL, FrameRequestInit, string | Error]>;
|
|
10
|
+
export type FrameErrorEvent = CustomEvent<[URL, FrameRequestInit, Error]>;
|
|
11
|
+
export type FrameContentEvent = CustomEvent<[URL, FrameRequestInit, string]>;
|
|
12
|
+
export type FrameContentAfterEvent = CustomEvent<[URL, FrameRequestInit, string]>;
|
package/Frame/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=types.js.map
|
package/Frame/utils.d.ts
ADDED
package/Frame/utils.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const EVENTS = {
|
|
2
|
+
FETCH_BEFORE: "frame-fetch-before",
|
|
3
|
+
FETCH: "frame-fetch",
|
|
4
|
+
FETCH_AFTER: "frame-fetch-after",
|
|
5
|
+
ERROR: "frame-error",
|
|
6
|
+
CONTENT: "frame-content",
|
|
7
|
+
CONTENT_AFTER: "frame-content-after",
|
|
8
|
+
TRIGGER: "frame-trigger"
|
|
9
|
+
};
|
|
10
|
+
export {
|
|
11
|
+
EVENTS
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../packages/ui/Frame/utils.ts"],
|
|
4
|
+
"sourcesContent": ["export const EVENTS = {\n FETCH_BEFORE: 'frame-fetch-before',\n FETCH: 'frame-fetch',\n FETCH_AFTER: 'frame-fetch-after',\n ERROR: 'frame-error',\n CONTENT: 'frame-content',\n CONTENT_AFTER: 'frame-content-after',\n TRIGGER: 'frame-trigger',\n};\n"],
|
|
5
|
+
"mappings": "AAAO,MAAM,SAAS;AAAA,EACpB,cAAc;AAAA,EACd,OAAO;AAAA,EACP,aAAa;AAAA,EACb,OAAO;AAAA,EACP,SAAS;AAAA,EACT,eAAe;AAAA,EACf,SAAS;AACX;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Base } from '@studiometa/js-toolkit';
|
|
2
|
-
import type { BaseProps, BaseConfig
|
|
3
|
-
import { Slider } from './Slider.js';
|
|
2
|
+
import type { BaseProps, BaseConfig } from '@studiometa/js-toolkit';
|
|
3
|
+
import type { Slider } from './Slider.js';
|
|
4
4
|
export interface AbstractSliderChildProps extends BaseProps {
|
|
5
5
|
$parent: Slider;
|
|
6
6
|
}
|
|
7
7
|
/**
|
|
8
8
|
* AbstractSliderChild class.
|
|
9
9
|
*/
|
|
10
|
-
export declare class AbstractSliderChild<T extends BaseProps = BaseProps> extends Base<T & AbstractSliderChildProps>
|
|
10
|
+
export declare class AbstractSliderChild<T extends BaseProps = BaseProps> extends Base<T & AbstractSliderChildProps> {
|
|
11
11
|
/**
|
|
12
12
|
* Config.
|
|
13
13
|
*/
|
|
@@ -26,14 +26,10 @@ export declare class AbstractSliderChild<T extends BaseProps = BaseProps> extend
|
|
|
26
26
|
destroyed(): void;
|
|
27
27
|
/**
|
|
28
28
|
* Dispatch event.
|
|
29
|
-
* @param {CustomEvent} event
|
|
30
|
-
* @returns {void}
|
|
31
29
|
*/
|
|
32
|
-
handleEvent(event:
|
|
30
|
+
handleEvent(event: CustomEvent): void;
|
|
33
31
|
/**
|
|
34
32
|
* Update the child component with the given index.
|
|
35
|
-
* @param {number} index The new active index.
|
|
36
|
-
* @returns {void|(()=>void)}
|
|
37
33
|
*/
|
|
38
|
-
update(index:
|
|
34
|
+
update(index: number): void | (() => void);
|
|
39
35
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Base } from "@studiometa/js-toolkit";
|
|
2
2
|
import { nextFrame, domScheduler, isFunction } from "@studiometa/js-toolkit/utils";
|
|
3
|
-
import { Slider } from "./Slider.js";
|
|
4
3
|
class AbstractSliderChild extends Base {
|
|
5
4
|
/**
|
|
6
5
|
* Config.
|
|
@@ -12,11 +11,6 @@ class AbstractSliderChild extends Base {
|
|
|
12
11
|
* Listen to the `goto` event of the parent on mount.
|
|
13
12
|
*/
|
|
14
13
|
mounted() {
|
|
15
|
-
if (!(this.$parent instanceof Slider)) {
|
|
16
|
-
throw new Error(
|
|
17
|
-
`The \`${this.$options.name}\` component must be a direct child of a \`Slider\` component.`
|
|
18
|
-
);
|
|
19
|
-
}
|
|
20
14
|
this.$parent.$on("index", this);
|
|
21
15
|
}
|
|
22
16
|
/**
|
|
@@ -35,8 +29,6 @@ class AbstractSliderChild extends Base {
|
|
|
35
29
|
}
|
|
36
30
|
/**
|
|
37
31
|
* Dispatch event.
|
|
38
|
-
* @param {CustomEvent} event
|
|
39
|
-
* @returns {void}
|
|
40
32
|
*/
|
|
41
33
|
handleEvent(event) {
|
|
42
34
|
if (event.type === "index") {
|
|
@@ -50,11 +42,8 @@ class AbstractSliderChild extends Base {
|
|
|
50
42
|
});
|
|
51
43
|
}
|
|
52
44
|
}
|
|
53
|
-
// eslint-disable-next-line jsdoc/require-returns-check
|
|
54
45
|
/**
|
|
55
46
|
* Update the child component with the given index.
|
|
56
|
-
* @param {number} index The new active index.
|
|
57
|
-
* @returns {void|(()=>void)}
|
|
58
47
|
*/
|
|
59
48
|
update(index) {
|
|
60
49
|
throw new Error(`The \`AbstractSliderChild.update(${index})\` method must be implemented.`);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../packages/ui/Slider/AbstractSliderChild.ts"],
|
|
4
|
-
"sourcesContent": ["import { Base } from '@studiometa/js-toolkit';\nimport type { BaseProps, BaseConfig
|
|
5
|
-
"mappings": "AAAA,SAAS,YAAY;AAErB,SAAS,WAAW,cAAc,kBAAkB;
|
|
4
|
+
"sourcesContent": ["import { Base } from '@studiometa/js-toolkit';\nimport type { BaseProps, BaseConfig } from '@studiometa/js-toolkit';\nimport { nextFrame, domScheduler, isFunction } from '@studiometa/js-toolkit/utils';\nimport type { Slider } from './Slider.js';\n\nexport interface AbstractSliderChildProps extends BaseProps {\n $parent: Slider;\n}\n\n/**\n * AbstractSliderChild class.\n */\nexport class AbstractSliderChild<T extends BaseProps = BaseProps> extends Base<\n T & AbstractSliderChildProps\n> {\n /**\n * Config.\n */\n static config: BaseConfig = {\n name: 'AbstractSliderChild',\n };\n\n /**\n * Listen to the `goto` event of the parent on mount.\n */\n mounted() {\n this.$parent.$on('index', this);\n }\n\n /**\n * Trigger update on resize.\n */\n resized() {\n nextFrame(() => {\n this.update(this.$parent.currentIndex);\n });\n }\n\n /**\n * Remove the event listener.\n */\n destroyed() {\n this.$parent.$off('index', this);\n }\n\n /**\n * Dispatch event.\n */\n handleEvent(event: CustomEvent) {\n if (event.type === 'index') {\n domScheduler.read(() => {\n const callback = this.update(event.detail[0]);\n if (isFunction(callback)) {\n domScheduler.write(() => {\n // @ts-ignore\n callback();\n });\n }\n });\n }\n }\n\n /**\n * Update the child component with the given index.\n */\n update(index: number): void | (() => void) {\n throw new Error(`The \\`AbstractSliderChild.update(${index})\\` method must be implemented.`);\n }\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,YAAY;AAErB,SAAS,WAAW,cAAc,kBAAkB;AAU7C,MAAM,4BAA6D,KAExE;AAAA;AAAA;AAAA;AAAA,EAIA,OAAO,SAAqB;AAAA,IAC1B,MAAM;AAAA,EACR;AAAA;AAAA;AAAA;AAAA,EAKA,UAAU;AACR,SAAK,QAAQ,IAAI,SAAS,IAAI;AAAA,EAChC;AAAA;AAAA;AAAA;AAAA,EAKA,UAAU;AACR,cAAU,MAAM;AACd,WAAK,OAAO,KAAK,QAAQ,YAAY;AAAA,IACvC,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA,EAKA,YAAY;AACV,SAAK,QAAQ,KAAK,SAAS,IAAI;AAAA,EACjC;AAAA;AAAA;AAAA;AAAA,EAKA,YAAY,OAAoB;AAC9B,QAAI,MAAM,SAAS,SAAS;AAC1B,mBAAa,KAAK,MAAM;AACtB,cAAM,WAAW,KAAK,OAAO,MAAM,OAAO,CAAC,CAAC;AAC5C,YAAI,WAAW,QAAQ,GAAG;AACxB,uBAAa,MAAM,MAAM;AAEvB,qBAAS;AAAA,UACX,CAAC;AAAA,QACH;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAKA,OAAO,OAAoC;AACzC,UAAM,IAAI,MAAM,oCAAoC,KAAK,iCAAiC;AAAA,EAC5F;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/Slider/Slider.d.ts
CHANGED
|
@@ -23,7 +23,8 @@ export interface SliderProps extends BaseProps {
|
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
26
|
+
* Slider class.
|
|
27
|
+
* @see https://ui.studiometa.dev/-/components/Slider/
|
|
27
28
|
* @todo a11y
|
|
28
29
|
*/
|
|
29
30
|
export declare class Slider<T extends BaseProps = BaseProps> extends Base<T & SliderProps> {
|
|
@@ -31,21 +32,26 @@ export declare class Slider<T extends BaseProps = BaseProps> extends Base<T & Sl
|
|
|
31
32
|
* Config.
|
|
32
33
|
*/
|
|
33
34
|
static config: BaseConfig;
|
|
35
|
+
/**
|
|
36
|
+
* Distance on the x axis.
|
|
37
|
+
* @private
|
|
38
|
+
*/
|
|
34
39
|
__distanceX: number;
|
|
40
|
+
/**
|
|
41
|
+
* Initial x position.
|
|
42
|
+
* @private
|
|
43
|
+
*/
|
|
35
44
|
__initialX: number;
|
|
36
45
|
/**
|
|
37
46
|
* Index of the current active slide.
|
|
47
|
+
* @private
|
|
38
48
|
*/
|
|
39
49
|
__currentIndex: number;
|
|
40
|
-
__isDragging: boolean;
|
|
41
50
|
/**
|
|
42
|
-
*
|
|
51
|
+
* Drag state.
|
|
52
|
+
* @private
|
|
43
53
|
*/
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Set the current index and emit the `index` event.
|
|
47
|
-
*/
|
|
48
|
-
set currentIndex(value: number);
|
|
54
|
+
__isDragging: boolean;
|
|
49
55
|
/**
|
|
50
56
|
* Store all the states.
|
|
51
57
|
*/
|
|
@@ -56,9 +62,16 @@ export declare class Slider<T extends BaseProps = BaseProps> extends Base<T & Sl
|
|
|
56
62
|
origins: Record<SliderModes, number>;
|
|
57
63
|
/**
|
|
58
64
|
* Wether or not the wrapper is focused.
|
|
59
|
-
* @type {boolean}
|
|
60
65
|
*/
|
|
61
66
|
hasFocus: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Get the current index.
|
|
69
|
+
*/
|
|
70
|
+
get currentIndex(): number;
|
|
71
|
+
/**
|
|
72
|
+
* Set the current index and emit the `index` event.
|
|
73
|
+
*/
|
|
74
|
+
set currentIndex(value: number);
|
|
62
75
|
/**
|
|
63
76
|
* Get the current state.
|
|
64
77
|
*/
|
|
@@ -122,9 +135,7 @@ export declare class Slider<T extends BaseProps = BaseProps> extends Base<T & Sl
|
|
|
122
135
|
/**
|
|
123
136
|
* Go to the given index.
|
|
124
137
|
*/
|
|
125
|
-
goTo(index: number
|
|
126
|
-
withInstantMove?: boolean;
|
|
127
|
-
}): void;
|
|
138
|
+
goTo(index: number): void;
|
|
128
139
|
/**
|
|
129
140
|
* Listen to the Draggable `start` event.
|
|
130
141
|
*/
|
|
@@ -153,23 +164,5 @@ export declare class Slider<T extends BaseProps = BaseProps> extends Base<T & Sl
|
|
|
153
164
|
* Go prev or next when focus is on the wrapper and pressing arrow keys.
|
|
154
165
|
*/
|
|
155
166
|
keyed({ LEFT, RIGHT, isDown }: KeyServiceProps): void;
|
|
156
|
-
/**
|
|
157
|
-
* Prepare invisible items.
|
|
158
|
-
*/
|
|
159
|
-
prepareInvisibleItems(): void;
|
|
160
|
-
/**
|
|
161
|
-
* Get the state where the given item will be visible.
|
|
162
|
-
*/
|
|
163
|
-
getStateWhereItemWillBeInvisible(item: SliderItem, { reversed }?: {
|
|
164
|
-
reversed?: boolean;
|
|
165
|
-
}): SliderState;
|
|
166
|
-
/**
|
|
167
|
-
* Get the visible slides for the given position.
|
|
168
|
-
*/
|
|
169
|
-
getVisibleItems(target: number): SliderItem<BaseProps>[];
|
|
170
|
-
/**
|
|
171
|
-
* Get the invisible slides for the given position.
|
|
172
|
-
*/
|
|
173
|
-
getInvisibleItems(target: number): SliderItem<BaseProps>[];
|
|
174
167
|
}
|
|
175
168
|
export {};
|