@studiometa/ui 0.1.1 → 0.2.2
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/README.md +37 -1
- package/atoms/AnchorScrollTo/AnchorScrollTo.cjs +52 -0
- package/atoms/AnchorScrollTo/AnchorScrollTo.d.ts +31 -0
- package/atoms/AnchorScrollTo/AnchorScrollTo.js +26 -0
- package/atoms/Cursor/Cursor.cjs +129 -0
- package/{Cursor.d.ts → atoms/Cursor/Cursor.d.ts} +0 -0
- package/atoms/Cursor/Cursor.js +103 -0
- package/atoms/Figure/Figure.cjs +53 -0
- package/atoms/Figure/Figure.d.ts +31 -0
- package/atoms/Figure/Figure.js +27 -0
- package/atoms/LargeText/LargeText.cjs +74 -0
- package/atoms/LargeText/LargeText.d.ts +71 -0
- package/atoms/LargeText/LargeText.js +48 -0
- package/atoms/LazyInclude/LazyInclude.cjs +72 -0
- package/atoms/LazyInclude/LazyInclude.d.ts +64 -0
- package/atoms/LazyInclude/LazyInclude.js +46 -0
- package/atoms/Prefetch/AbstractPrefetch.cjs +84 -0
- package/atoms/Prefetch/AbstractPrefetch.d.ts +52 -0
- package/atoms/Prefetch/AbstractPrefetch.js +58 -0
- package/atoms/Prefetch/PrefetchWhenOver.cjs +65 -0
- package/atoms/Prefetch/PrefetchWhenOver.d.ts +21 -0
- package/atoms/Prefetch/PrefetchWhenOver.js +35 -0
- package/atoms/Prefetch/PrefetchWhenVisible.cjs +66 -0
- package/atoms/Prefetch/PrefetchWhenVisible.d.ts +21 -0
- package/atoms/Prefetch/PrefetchWhenVisible.js +36 -0
- package/atoms/Prefetch/index.cjs +40 -0
- package/atoms/Prefetch/index.d.ts +3 -0
- package/atoms/Prefetch/index.js +8 -0
- package/atoms/index.cjs +45 -0
- package/atoms/index.d.ts +6 -0
- package/atoms/index.js +13 -0
- package/index.cjs +26 -0
- package/index.d.ts +3 -6
- package/index.js +3 -6
- package/molecules/Accordion/Accordion.cjs +65 -0
- package/{Accordion/index.d.ts → molecules/Accordion/Accordion.d.ts} +5 -6
- package/molecules/Accordion/Accordion.js +35 -0
- package/molecules/Accordion/AccordionCore.cjs +60 -0
- package/{Accordion/Accordion.d.ts → molecules/Accordion/AccordionCore.d.ts} +0 -0
- package/molecules/Accordion/AccordionCore.js +34 -0
- package/molecules/Accordion/AccordionItem.cjs +208 -0
- package/{Accordion → molecules/Accordion}/AccordionItem.d.ts +11 -13
- package/molecules/Accordion/AccordionItem.js +178 -0
- package/molecules/Modal/Modal.cjs +176 -0
- package/{Modal.d.ts → molecules/Modal/Modal.d.ts} +9 -9
- package/molecules/Modal/Modal.js +150 -0
- package/molecules/Modal/ModalWithTransition.cjs +100 -0
- package/molecules/Modal/ModalWithTransition.d.ts +29 -0
- package/molecules/Modal/ModalWithTransition.js +69 -0
- package/molecules/Panel/Panel.cjs +148 -0
- package/molecules/Panel/Panel.d.ts +42 -0
- package/molecules/Panel/Panel.js +117 -0
- package/molecules/Slider/AbstractSliderChild.cjs +74 -0
- package/molecules/Slider/AbstractSliderChild.d.ts +55 -0
- package/molecules/Slider/AbstractSliderChild.js +43 -0
- package/molecules/Slider/Slider.cjs +240 -0
- package/molecules/Slider/Slider.d.ts +245 -0
- package/molecules/Slider/Slider.js +209 -0
- package/molecules/Slider/SliderBtn.cjs +65 -0
- package/molecules/Slider/SliderBtn.d.ts +31 -0
- package/molecules/Slider/SliderBtn.js +34 -0
- package/molecules/Slider/SliderCount.cjs +50 -0
- package/molecules/Slider/SliderCount.d.ts +21 -0
- package/molecules/Slider/SliderCount.js +19 -0
- package/molecules/Slider/SliderDots.cjs +55 -0
- package/molecules/Slider/SliderDots.d.ts +33 -0
- package/molecules/Slider/SliderDots.js +24 -0
- package/molecules/Slider/SliderDrag.cjs +45 -0
- package/molecules/Slider/SliderDrag.d.ts +16 -0
- package/molecules/Slider/SliderDrag.js +19 -0
- package/molecules/Slider/SliderItem.cjs +130 -0
- package/molecules/Slider/SliderItem.d.ts +106 -0
- package/molecules/Slider/SliderItem.js +105 -0
- package/molecules/Slider/SliderProgress.cjs +54 -0
- package/molecules/Slider/SliderProgress.d.ts +27 -0
- package/molecules/Slider/SliderProgress.js +23 -0
- package/molecules/Slider/index.cjs +50 -0
- package/molecules/Slider/index.d.ts +8 -0
- package/molecules/Slider/index.js +18 -0
- package/molecules/Sticky/Sticky.cjs +133 -0
- package/molecules/Sticky/Sticky.d.ts +141 -0
- package/molecules/Sticky/Sticky.js +107 -0
- package/molecules/TableOfContent/TableOfContent.cjs +73 -0
- package/molecules/TableOfContent/TableOfContent.d.ts +59 -0
- package/molecules/TableOfContent/TableOfContent.js +42 -0
- package/molecules/TableOfContent/TableOfContentAnchor.cjs +65 -0
- package/molecules/TableOfContent/TableOfContentAnchor.d.ts +36 -0
- package/molecules/TableOfContent/TableOfContentAnchor.js +39 -0
- package/molecules/TableOfContent/index.cjs +38 -0
- package/molecules/TableOfContent/index.d.ts +2 -0
- package/molecules/TableOfContent/index.js +6 -0
- package/molecules/Tabs/Tabs.cjs +152 -0
- package/{Tabs.d.ts → molecules/Tabs/Tabs.d.ts} +2 -4
- package/molecules/Tabs/Tabs.js +126 -0
- package/molecules/index.cjs +50 -0
- package/molecules/index.d.ts +9 -0
- package/molecules/index.js +18 -0
- package/organisms/Frame/Frame.cjs +202 -0
- package/organisms/Frame/Frame.d.ts +119 -0
- package/organisms/Frame/Frame.js +171 -0
- package/organisms/Frame/FrameAnchor.cjs +48 -0
- package/organisms/Frame/FrameAnchor.d.ts +35 -0
- package/organisms/Frame/FrameAnchor.js +22 -0
- package/organisms/Frame/FrameForm.cjs +48 -0
- package/organisms/Frame/FrameForm.d.ts +32 -0
- package/organisms/Frame/FrameForm.js +22 -0
- package/organisms/Frame/FrameTarget.cjs +134 -0
- package/organisms/Frame/FrameTarget.d.ts +47 -0
- package/organisms/Frame/FrameTarget.js +109 -0
- package/organisms/Frame/index.cjs +42 -0
- package/organisms/Frame/index.d.ts +4 -0
- package/organisms/Frame/index.js +10 -0
- package/organisms/index.cjs +24 -0
- package/organisms/index.d.ts +1 -0
- package/organisms/index.js +1 -0
- package/package.json +2 -2
- package/primitives/Draggable/Draggable.cjs +64 -0
- package/{Draggable.d.ts → primitives/Draggable/Draggable.d.ts} +0 -0
- package/primitives/Draggable/Draggable.js +38 -0
- package/primitives/Sentinel/Sentinel.cjs +41 -0
- package/primitives/Sentinel/Sentinel.d.ts +12 -0
- package/primitives/Sentinel/Sentinel.js +15 -0
- package/primitives/Transition/Transition.cjs +71 -0
- package/primitives/Transition/Transition.d.ts +69 -0
- package/primitives/Transition/Transition.js +45 -0
- package/primitives/index.cjs +40 -0
- package/primitives/index.d.ts +3 -0
- package/primitives/index.js +8 -0
- package/Accordion/Accordion.js +0 -29
- package/Accordion/AccordionItem.js +0 -197
- package/Accordion/index.js +0 -12
- package/Cursor.js +0 -121
- package/Draggable.js +0 -31
- package/Modal.js +0 -167
- package/Tabs.js +0 -106
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __publicField = (obj, key, value) => {
|
|
4
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
+
return value;
|
|
6
|
+
};
|
|
7
|
+
import { Base, withIntersectionObserver } from "@studiometa/js-toolkit";
|
|
8
|
+
class Sentinel extends withIntersectionObserver(Base, { threshold: [0, 1] }) {
|
|
9
|
+
}
|
|
10
|
+
__publicField(Sentinel, "config", {
|
|
11
|
+
name: "Sentinel"
|
|
12
|
+
});
|
|
13
|
+
export {
|
|
14
|
+
Sentinel as default
|
|
15
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
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 __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
12
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(module2))
|
|
14
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
15
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return target;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
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);
|
|
24
|
+
var __publicField = (obj, key, value) => {
|
|
25
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
26
|
+
return value;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
// packages/ui/primitives/Transition/Transition.js
|
|
30
|
+
var Transition_exports = {};
|
|
31
|
+
__export(Transition_exports, {
|
|
32
|
+
default: () => Transition
|
|
33
|
+
});
|
|
34
|
+
var import_js_toolkit = require("@studiometa/js-toolkit");
|
|
35
|
+
var import_utils = require("@studiometa/js-toolkit/utils");
|
|
36
|
+
var Transition = class extends import_js_toolkit.Base {
|
|
37
|
+
get target() {
|
|
38
|
+
return this.$el;
|
|
39
|
+
}
|
|
40
|
+
enter() {
|
|
41
|
+
const { enterFrom, enterActive, enterTo, enterKeep } = this.$options;
|
|
42
|
+
return (0, import_utils.transition)(this.target, {
|
|
43
|
+
from: enterFrom,
|
|
44
|
+
active: enterActive,
|
|
45
|
+
to: enterTo
|
|
46
|
+
}, enterKeep && "keep");
|
|
47
|
+
}
|
|
48
|
+
leave() {
|
|
49
|
+
const { leaveFrom, leaveActive, leaveTo, leaveKeep } = this.$options;
|
|
50
|
+
return (0, import_utils.transition)(this.target, {
|
|
51
|
+
from: leaveFrom,
|
|
52
|
+
active: leaveActive,
|
|
53
|
+
to: leaveTo
|
|
54
|
+
}, leaveKeep && "keep");
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
__publicField(Transition, "config", {
|
|
58
|
+
name: "Transition",
|
|
59
|
+
options: {
|
|
60
|
+
enterFrom: String,
|
|
61
|
+
enterActive: String,
|
|
62
|
+
enterTo: String,
|
|
63
|
+
enterKeep: Boolean,
|
|
64
|
+
leaveFrom: String,
|
|
65
|
+
leaveActive: String,
|
|
66
|
+
leaveTo: String,
|
|
67
|
+
leaveKeep: Boolean
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
module.exports = __toCommonJS(Transition_exports);
|
|
71
|
+
if (module.exports.default) module.exports = module.exports.default;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {Object} TransitionOptions
|
|
3
|
+
* @property {string} enterFrom
|
|
4
|
+
* @property {string} enterActive
|
|
5
|
+
* @property {string} enterTo
|
|
6
|
+
* @property {boolean} enterKeep
|
|
7
|
+
* @property {string} leaveFrom
|
|
8
|
+
* @property {string} leaveActive
|
|
9
|
+
* @property {string} leaveTo
|
|
10
|
+
* @property {boolean} leaveKeep
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Transition class.
|
|
14
|
+
* @typedef {Transition & { $options: TransitionOptions }} TransitionInterface
|
|
15
|
+
*/
|
|
16
|
+
export default class Transition extends Base {
|
|
17
|
+
static config: {
|
|
18
|
+
name: string;
|
|
19
|
+
options: {
|
|
20
|
+
enterFrom: StringConstructor;
|
|
21
|
+
enterActive: StringConstructor;
|
|
22
|
+
enterTo: StringConstructor;
|
|
23
|
+
enterKeep: BooleanConstructor;
|
|
24
|
+
leaveFrom: StringConstructor;
|
|
25
|
+
leaveActive: StringConstructor;
|
|
26
|
+
leaveTo: StringConstructor;
|
|
27
|
+
leaveKeep: BooleanConstructor;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Get the transition target.
|
|
32
|
+
*
|
|
33
|
+
* @returns {HTMLElement}
|
|
34
|
+
*/
|
|
35
|
+
get target(): HTMLElement;
|
|
36
|
+
/**
|
|
37
|
+
* Trigger the enter transition.
|
|
38
|
+
*
|
|
39
|
+
* @todo merge leaveTo and enterFrom classes when leaveKeep is active
|
|
40
|
+
* @this {TransitionInterface}
|
|
41
|
+
* @returns {Promise<void>}
|
|
42
|
+
*/
|
|
43
|
+
enter(): Promise<void>;
|
|
44
|
+
/**
|
|
45
|
+
* Trigger the leave transition.
|
|
46
|
+
*
|
|
47
|
+
* @todo merge enterTo and leaveTo classes when enterKeep is active
|
|
48
|
+
* @this {TransitionInterface}
|
|
49
|
+
* @returns {Promise<void>}
|
|
50
|
+
*/
|
|
51
|
+
leave(): Promise<void>;
|
|
52
|
+
}
|
|
53
|
+
export type TransitionOptions = {
|
|
54
|
+
enterFrom: string;
|
|
55
|
+
enterActive: string;
|
|
56
|
+
enterTo: string;
|
|
57
|
+
enterKeep: boolean;
|
|
58
|
+
leaveFrom: string;
|
|
59
|
+
leaveActive: string;
|
|
60
|
+
leaveTo: string;
|
|
61
|
+
leaveKeep: boolean;
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Transition class.
|
|
65
|
+
*/
|
|
66
|
+
export type TransitionInterface = Transition & {
|
|
67
|
+
$options: TransitionOptions;
|
|
68
|
+
};
|
|
69
|
+
import { Base } from "@studiometa/js-toolkit";
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __publicField = (obj, key, value) => {
|
|
4
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
+
return value;
|
|
6
|
+
};
|
|
7
|
+
import { Base } from "@studiometa/js-toolkit";
|
|
8
|
+
import { transition } from "@studiometa/js-toolkit/utils";
|
|
9
|
+
class Transition extends Base {
|
|
10
|
+
get target() {
|
|
11
|
+
return this.$el;
|
|
12
|
+
}
|
|
13
|
+
enter() {
|
|
14
|
+
const { enterFrom, enterActive, enterTo, enterKeep } = this.$options;
|
|
15
|
+
return transition(this.target, {
|
|
16
|
+
from: enterFrom,
|
|
17
|
+
active: enterActive,
|
|
18
|
+
to: enterTo
|
|
19
|
+
}, enterKeep && "keep");
|
|
20
|
+
}
|
|
21
|
+
leave() {
|
|
22
|
+
const { leaveFrom, leaveActive, leaveTo, leaveKeep } = this.$options;
|
|
23
|
+
return transition(this.target, {
|
|
24
|
+
from: leaveFrom,
|
|
25
|
+
active: leaveActive,
|
|
26
|
+
to: leaveTo
|
|
27
|
+
}, leaveKeep && "keep");
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
__publicField(Transition, "config", {
|
|
31
|
+
name: "Transition",
|
|
32
|
+
options: {
|
|
33
|
+
enterFrom: String,
|
|
34
|
+
enterActive: String,
|
|
35
|
+
enterTo: String,
|
|
36
|
+
enterKeep: Boolean,
|
|
37
|
+
leaveFrom: String,
|
|
38
|
+
leaveActive: String,
|
|
39
|
+
leaveTo: String,
|
|
40
|
+
leaveKeep: Boolean
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
export {
|
|
44
|
+
Transition as default
|
|
45
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
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 __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(module2))
|
|
15
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return target;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (module2, isNodeMode) => {
|
|
21
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
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);
|
|
28
|
+
|
|
29
|
+
// packages/ui/primitives/index.js
|
|
30
|
+
var primitives_exports = {};
|
|
31
|
+
__export(primitives_exports, {
|
|
32
|
+
Draggable: () => import_Draggable.default,
|
|
33
|
+
Sentinel: () => import_Sentinel.default,
|
|
34
|
+
Transition: () => import_Transition.default
|
|
35
|
+
});
|
|
36
|
+
var import_Draggable = __toESM(require("./Draggable/Draggable.cjs"), 1);
|
|
37
|
+
var import_Sentinel = __toESM(require("./Sentinel/Sentinel.cjs"), 1);
|
|
38
|
+
var import_Transition = __toESM(require("./Transition/Transition.cjs"), 1);
|
|
39
|
+
module.exports = __toCommonJS(primitives_exports);
|
|
40
|
+
if (module.exports.default) module.exports = module.exports.default;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { default as default2 } from "./Draggable/Draggable.js";
|
|
2
|
+
import { default as default3 } from "./Sentinel/Sentinel.js";
|
|
3
|
+
import { default as default4 } from "./Transition/Transition.js";
|
|
4
|
+
export {
|
|
5
|
+
default2 as Draggable,
|
|
6
|
+
default3 as Sentinel,
|
|
7
|
+
default4 as Transition
|
|
8
|
+
};
|
package/Accordion/Accordion.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { Base } from '@studiometa/js-toolkit';
|
|
2
|
-
export default class Accordion extends Base {
|
|
3
|
-
static config = {
|
|
4
|
-
name: 'Accordion',
|
|
5
|
-
emits: ['open', 'close'],
|
|
6
|
-
options: {
|
|
7
|
-
autoclose: Boolean,
|
|
8
|
-
item: {
|
|
9
|
-
type: Object,
|
|
10
|
-
default: () => ({})
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
onAccordionItemOpen(index) {
|
|
16
|
-
const accordionItem = this.$children.AccordionItem[index];
|
|
17
|
-
this.$emit('open', accordionItem, index);
|
|
18
|
-
|
|
19
|
-
if (this.$options.autoclose) {
|
|
20
|
-
this.$children.AccordionItem.filter((el, i) => index !== i).forEach(item => item.close());
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
onAccordionItemClose(index) {
|
|
25
|
-
const accordionItem = this.$children.AccordionItem[index];
|
|
26
|
-
this.$emit('close', accordionItem, index);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
}
|
|
@@ -1,197 +0,0 @@
|
|
|
1
|
-
import deepmerge from 'deepmerge';
|
|
2
|
-
import { Base } from '@studiometa/js-toolkit';
|
|
3
|
-
import * as styles from '@studiometa/js-toolkit/utils/css/styles.js';
|
|
4
|
-
import transition from '@studiometa/js-toolkit/utils/css/transition.js';
|
|
5
|
-
import Accordion from './Accordion.js';
|
|
6
|
-
export default class AccordionItem extends Base {
|
|
7
|
-
static config = {
|
|
8
|
-
name: 'AccordionItem',
|
|
9
|
-
refs: ['btn', 'content', 'container'],
|
|
10
|
-
emits: ['open', 'close'],
|
|
11
|
-
options: {
|
|
12
|
-
isOpen: Boolean,
|
|
13
|
-
styles: {
|
|
14
|
-
type: Object,
|
|
15
|
-
default: () => ({
|
|
16
|
-
container: {
|
|
17
|
-
open: '',
|
|
18
|
-
active: '',
|
|
19
|
-
closed: ''
|
|
20
|
-
}
|
|
21
|
-
})
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
mounted() {
|
|
27
|
-
if (this.$parent && this.$parent instanceof Accordion && this.$parent.$options.item) {
|
|
28
|
-
Object.entries(this.$parent.$options.item).forEach(([key, value]) => {
|
|
29
|
-
if (key in this.$options) {
|
|
30
|
-
const type = AccordionItem.config.options[key].type || AccordionItem.config.options[key];
|
|
31
|
-
|
|
32
|
-
if (type === Array || type === Object) {
|
|
33
|
-
this.$options[key] = deepmerge(this.$options[key], value);
|
|
34
|
-
} else {
|
|
35
|
-
this.$options[key] = value;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
this.$refs.btn.setAttribute('id', this.$id);
|
|
42
|
-
this.$refs.btn.setAttribute('aria-controls', this.contentId);
|
|
43
|
-
this.$refs.content.setAttribute('aria-labelledby', this.$id);
|
|
44
|
-
this.$refs.content.setAttribute('id', this.contentId);
|
|
45
|
-
const {
|
|
46
|
-
isOpen
|
|
47
|
-
} = this.$options;
|
|
48
|
-
this.updateAttributes(isOpen);
|
|
49
|
-
|
|
50
|
-
if (!isOpen) {
|
|
51
|
-
styles.add(this.$refs.container, {
|
|
52
|
-
visibility: 'invisible',
|
|
53
|
-
height: '0'
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
const {
|
|
58
|
-
container,
|
|
59
|
-
...otherStyles
|
|
60
|
-
} = this.$options.styles;
|
|
61
|
-
const refs = this.$refs;
|
|
62
|
-
Object.entries(otherStyles).filter(([refName]) => refs[refName]).forEach(([refName, {
|
|
63
|
-
open,
|
|
64
|
-
closed
|
|
65
|
-
} = {
|
|
66
|
-
open: '',
|
|
67
|
-
closed: ''
|
|
68
|
-
}]) => {
|
|
69
|
-
transition(refs[refName], {
|
|
70
|
-
to: isOpen ? open : closed
|
|
71
|
-
}, 'keep');
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
destroyed() {
|
|
76
|
-
styles.remove(this.$refs.container, {
|
|
77
|
-
visibility: '',
|
|
78
|
-
height: ''
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
onBtnClick() {
|
|
83
|
-
if (this.$options.isOpen) {
|
|
84
|
-
this.close();
|
|
85
|
-
} else {
|
|
86
|
-
this.open();
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
get contentId() {
|
|
91
|
-
return `content-${this.$id}`;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
updateAttributes(isOpen) {
|
|
95
|
-
this.$refs.content.setAttribute('aria-hidden', isOpen ? 'false' : 'true');
|
|
96
|
-
this.$refs.btn.setAttribute('aria-expanded', isOpen ? 'true' : 'false');
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
async open() {
|
|
100
|
-
if (this.$options.isOpen) {
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
this.$log('open');
|
|
105
|
-
this.$emit('open');
|
|
106
|
-
this.$options.isOpen = true;
|
|
107
|
-
this.updateAttributes(this.$options.isOpen);
|
|
108
|
-
styles.remove(this.$refs.container, {
|
|
109
|
-
visibility: 'invisible'
|
|
110
|
-
});
|
|
111
|
-
const {
|
|
112
|
-
container,
|
|
113
|
-
...otherStyles
|
|
114
|
-
} = this.$options.styles;
|
|
115
|
-
const refs = this.$refs;
|
|
116
|
-
await Promise.all([transition(refs.container, {
|
|
117
|
-
from: {
|
|
118
|
-
height: 0
|
|
119
|
-
},
|
|
120
|
-
active: container.active,
|
|
121
|
-
to: {
|
|
122
|
-
height: `${refs.content.offsetHeight}px`
|
|
123
|
-
}
|
|
124
|
-
}).then(() => {
|
|
125
|
-
if (this.$options.isOpen) {
|
|
126
|
-
styles.remove(refs.content, {
|
|
127
|
-
position: 'absolute'
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
return Promise.resolve();
|
|
132
|
-
}), ...Object.entries(otherStyles).filter(([refName]) => refs[refName]).map(([refName, {
|
|
133
|
-
open,
|
|
134
|
-
active,
|
|
135
|
-
closed
|
|
136
|
-
} = {
|
|
137
|
-
open: '',
|
|
138
|
-
active: '',
|
|
139
|
-
closed: ''
|
|
140
|
-
}]) => transition(refs[refName], {
|
|
141
|
-
from: closed,
|
|
142
|
-
active,
|
|
143
|
-
to: open
|
|
144
|
-
}, 'keep'))]);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
async close() {
|
|
148
|
-
if (!this.$options.isOpen) {
|
|
149
|
-
return;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
this.$log('close');
|
|
153
|
-
this.$emit('close');
|
|
154
|
-
this.$options.isOpen = false;
|
|
155
|
-
const height = this.$refs.container.offsetHeight;
|
|
156
|
-
styles.add(this.$refs.content, {
|
|
157
|
-
position: 'absolute'
|
|
158
|
-
});
|
|
159
|
-
const {
|
|
160
|
-
container,
|
|
161
|
-
...otherStyles
|
|
162
|
-
} = this.$options.styles;
|
|
163
|
-
const refs = this.$refs;
|
|
164
|
-
await Promise.all([transition(refs.container, {
|
|
165
|
-
from: {
|
|
166
|
-
height: `${height}px`
|
|
167
|
-
},
|
|
168
|
-
active: container.active,
|
|
169
|
-
to: {
|
|
170
|
-
height: '0'
|
|
171
|
-
}
|
|
172
|
-
}).then(() => {
|
|
173
|
-
if (!this.$options.isOpen) {
|
|
174
|
-
styles.add(refs.container, {
|
|
175
|
-
height: '0',
|
|
176
|
-
visibility: 'invisible'
|
|
177
|
-
});
|
|
178
|
-
this.updateAttributes(this.$options.isOpen);
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
return Promise.resolve();
|
|
182
|
-
}), ...Object.entries(otherStyles).filter(([refName]) => refs[refName]).map(([refName, {
|
|
183
|
-
open,
|
|
184
|
-
active,
|
|
185
|
-
closed
|
|
186
|
-
} = {
|
|
187
|
-
open: '',
|
|
188
|
-
active: '',
|
|
189
|
-
closed: ''
|
|
190
|
-
}]) => transition(refs[refName], {
|
|
191
|
-
from: open,
|
|
192
|
-
active,
|
|
193
|
-
to: closed
|
|
194
|
-
}, 'keep'))]);
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
}
|
package/Accordion/index.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import AccordionCore from './Accordion.js';
|
|
2
|
-
import AccordionItem from './AccordionItem.js';
|
|
3
|
-
|
|
4
|
-
class Accordion extends AccordionCore {
|
|
5
|
-
static config = { ...AccordionCore.config,
|
|
6
|
-
components: {
|
|
7
|
-
AccordionItem
|
|
8
|
-
}
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export default Accordion;
|
package/Cursor.js
DELETED
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import { Base } from '@studiometa/js-toolkit';
|
|
2
|
-
import damp from '@studiometa/js-toolkit/utils/math/damp.js';
|
|
3
|
-
import matrix from '@studiometa/js-toolkit/utils/css/matrix.js';
|
|
4
|
-
export default class Cursor extends Base {
|
|
5
|
-
static config = {
|
|
6
|
-
name: 'Cursor',
|
|
7
|
-
options: {
|
|
8
|
-
growSelectors: {
|
|
9
|
-
type: String,
|
|
10
|
-
default: 'a, a *, button, button *, [data-cursor-grow], [data-cursor-grow] *'
|
|
11
|
-
},
|
|
12
|
-
shrinkSelectors: {
|
|
13
|
-
type: String,
|
|
14
|
-
default: '[data-cursor-shrink], [data-cursor-shrink] *'
|
|
15
|
-
},
|
|
16
|
-
growTo: {
|
|
17
|
-
type: Number,
|
|
18
|
-
default: 2
|
|
19
|
-
},
|
|
20
|
-
shrinkTo: {
|
|
21
|
-
type: Number,
|
|
22
|
-
default: 0.5
|
|
23
|
-
},
|
|
24
|
-
translateDampFactor: {
|
|
25
|
-
type: Number,
|
|
26
|
-
default: 0.25
|
|
27
|
-
},
|
|
28
|
-
growDampFactor: {
|
|
29
|
-
type: Number,
|
|
30
|
-
default: 0.25
|
|
31
|
-
},
|
|
32
|
-
shrinkDampFactor: {
|
|
33
|
-
type: Number,
|
|
34
|
-
default: 0.25
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
x = 0;
|
|
39
|
-
y = 0;
|
|
40
|
-
scale = 0;
|
|
41
|
-
pointerX = 0;
|
|
42
|
-
pointerY = 0;
|
|
43
|
-
pointerScale = 0;
|
|
44
|
-
|
|
45
|
-
mounted() {
|
|
46
|
-
this.x = 0;
|
|
47
|
-
this.y = 0;
|
|
48
|
-
this.scale = 0;
|
|
49
|
-
this.pointerX = 0;
|
|
50
|
-
this.pointerY = 0;
|
|
51
|
-
this.pointerScale = 0;
|
|
52
|
-
this.render({
|
|
53
|
-
x: this.x,
|
|
54
|
-
y: this.y,
|
|
55
|
-
scale: this.scale
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
moved({
|
|
60
|
-
event,
|
|
61
|
-
x,
|
|
62
|
-
y,
|
|
63
|
-
isDown
|
|
64
|
-
}) {
|
|
65
|
-
if (!this.$services.has('ticked')) {
|
|
66
|
-
this.$services.enable('ticked');
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
this.pointerX = x;
|
|
70
|
-
this.pointerY = y;
|
|
71
|
-
let scale = 1;
|
|
72
|
-
|
|
73
|
-
if (!event) {
|
|
74
|
-
this.pointerScale = scale;
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
const shouldGrow = event.target instanceof Element && event.target.matches(this.$options.growSelectors) || false;
|
|
79
|
-
const shouldReduce = isDown || event.target instanceof Element && event.target.matches(this.$options.shrinkSelectors) || false;
|
|
80
|
-
|
|
81
|
-
if (shouldGrow) {
|
|
82
|
-
scale = this.$options.growTo;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
if (shouldReduce) {
|
|
86
|
-
scale = this.$options.shrinkTo;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
this.pointerScale = scale;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
ticked() {
|
|
93
|
-
this.x = damp(this.pointerX, this.x, this.$options.translateDampFactor);
|
|
94
|
-
this.y = damp(this.pointerY, this.y, this.$options.translateDampFactor);
|
|
95
|
-
this.scale = damp(this.pointerScale, this.scale, this.pointerScale < this.scale ? this.$options.shrinkDampFactor : this.$options.growDampFactor);
|
|
96
|
-
this.render({
|
|
97
|
-
x: this.x,
|
|
98
|
-
y: this.y,
|
|
99
|
-
scale: this.scale
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
if (this.x === this.pointerX && this.y === this.pointerY && this.scale === this.pointerScale) {
|
|
103
|
-
this.$services.disable('ticked');
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
render({
|
|
108
|
-
x,
|
|
109
|
-
y,
|
|
110
|
-
scale
|
|
111
|
-
}) {
|
|
112
|
-
const transform = matrix({
|
|
113
|
-
translateX: x,
|
|
114
|
-
translateY: y,
|
|
115
|
-
scaleX: scale,
|
|
116
|
-
scaleY: scale
|
|
117
|
-
});
|
|
118
|
-
this.$el.style.transform = `translateZ(0) ${transform}`;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
}
|
package/Draggable.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { animate } from 'motion';
|
|
2
|
-
import { Base, withDrag } from '@studiometa/js-toolkit';
|
|
3
|
-
export default class Draggable extends withDrag(Base) {
|
|
4
|
-
static config = {
|
|
5
|
-
name: 'DraggableElement'
|
|
6
|
-
};
|
|
7
|
-
static animateOptions = {
|
|
8
|
-
easing: 'linear',
|
|
9
|
-
duration: 0
|
|
10
|
-
};
|
|
11
|
-
x = 0;
|
|
12
|
-
y = 0;
|
|
13
|
-
originX = 0;
|
|
14
|
-
originY = 0;
|
|
15
|
-
|
|
16
|
-
dragged(props) {
|
|
17
|
-
if (props.mode === 'start') {
|
|
18
|
-
this.originX = this.x;
|
|
19
|
-
this.originY = this.y;
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
this.x = this.originX + props.x - props.origin.x;
|
|
24
|
-
this.y = this.originY + props.y - props.origin.y;
|
|
25
|
-
animate(this.$el, {
|
|
26
|
-
x: this.x,
|
|
27
|
-
y: this.y
|
|
28
|
-
}, Draggable.animateOptions);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
}
|