@studiometa/ui 0.2.3 → 0.2.4
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/Cursor/Cursor.cjs +14 -22
- package/atoms/Cursor/Cursor.d.ts +2 -2
- package/atoms/Cursor/Cursor.js +1 -103
- package/atoms/Figure/Figure.cjs +9 -14
- package/atoms/Figure/Figure.d.ts +1 -1
- package/atoms/Figure/Figure.js +1 -27
- package/atoms/LargeText/LargeText.cjs +15 -23
- package/atoms/LargeText/LargeText.d.ts +3 -3
- package/atoms/LargeText/LargeText.js +1 -64
- 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/index.cjs +11 -17
- package/atoms/index.js +1 -13
- package/index.cjs +11 -15
- package/index.js +1 -3
- package/molecules/Accordion/Accordion.cjs +12 -34
- package/molecules/Accordion/Accordion.js +1 -35
- 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/ModalWithTransition.cjs +13 -43
- package/molecules/Modal/ModalWithTransition.js +1 -69
- package/molecules/Panel/Panel.cjs +42 -76
- package/molecules/Panel/Panel.js +1 -117
- 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/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/index.cjs +13 -18
- package/molecules/index.d.ts +1 -0
- package/molecules/index.js +1 -18
- package/organisms/Frame/Frame.cjs +67 -98
- package/organisms/Frame/Frame.d.ts +3 -3
- 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/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
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 = {
|
package/molecules/Tabs/Tabs.js
CHANGED
|
@@ -1,126 +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
|
-
var __async = (__this, __arguments, generator) => {
|
|
8
|
-
return new Promise((resolve, reject) => {
|
|
9
|
-
var fulfilled = (value) => {
|
|
10
|
-
try {
|
|
11
|
-
step(generator.next(value));
|
|
12
|
-
} catch (e) {
|
|
13
|
-
reject(e);
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
var rejected = (value) => {
|
|
17
|
-
try {
|
|
18
|
-
step(generator.throw(value));
|
|
19
|
-
} catch (e) {
|
|
20
|
-
reject(e);
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
24
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
25
|
-
});
|
|
26
|
-
};
|
|
27
|
-
import { Base } from "@studiometa/js-toolkit";
|
|
28
|
-
import { transition } from "@studiometa/js-toolkit/utils";
|
|
29
|
-
class Tabs extends Base {
|
|
30
|
-
mounted() {
|
|
31
|
-
this.items = this.$refs.btn.map((btn, index) => {
|
|
32
|
-
const id = `${this.$id}-${index}`;
|
|
33
|
-
const content = this.$refs.content[index];
|
|
34
|
-
btn.setAttribute("id", id);
|
|
35
|
-
content.setAttribute("aria-labelledby", id);
|
|
36
|
-
const item = { btn, content, isEnabled: index > 0 };
|
|
37
|
-
if (index > 0) {
|
|
38
|
-
this.disableItem(item);
|
|
39
|
-
} else {
|
|
40
|
-
this.enableItem(item);
|
|
41
|
-
}
|
|
42
|
-
return item;
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
onBtnClick(event, index) {
|
|
46
|
-
this.items.forEach((item, i) => {
|
|
47
|
-
if (i !== index) {
|
|
48
|
-
this.disableItem(item);
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
this.enableItem(this.items[index]);
|
|
52
|
-
}
|
|
53
|
-
enableItem(item) {
|
|
54
|
-
return __async(this, null, function* () {
|
|
55
|
-
if (!item || item.isEnabled) {
|
|
56
|
-
return Promise.resolve(this);
|
|
57
|
-
}
|
|
58
|
-
item.isEnabled = true;
|
|
59
|
-
const { btn, content } = item;
|
|
60
|
-
const btnStyles = this.$options.styles.btn || {};
|
|
61
|
-
const contentStyles = this.$options.styles.content || {};
|
|
62
|
-
content.setAttribute("aria-hidden", "false");
|
|
63
|
-
this.$emit("enable", item);
|
|
64
|
-
return Promise.all([
|
|
65
|
-
transition(btn, {
|
|
66
|
-
from: btnStyles.closed,
|
|
67
|
-
active: btnStyles.active,
|
|
68
|
-
to: btnStyles.open
|
|
69
|
-
}, "keep"),
|
|
70
|
-
transition(content, {
|
|
71
|
-
from: contentStyles.closed,
|
|
72
|
-
active: contentStyles.active,
|
|
73
|
-
to: contentStyles.open
|
|
74
|
-
}, "keep")
|
|
75
|
-
]).then(() => Promise.resolve(this));
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
disableItem(item) {
|
|
79
|
-
return __async(this, null, function* () {
|
|
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
|
-
transition(btn, {
|
|
91
|
-
from: btnStyles.open,
|
|
92
|
-
active: btnStyles.active,
|
|
93
|
-
to: btnStyles.closed
|
|
94
|
-
}, "keep"),
|
|
95
|
-
transition(content, {
|
|
96
|
-
from: contentStyles.open,
|
|
97
|
-
active: contentStyles.active,
|
|
98
|
-
to: contentStyles.closed
|
|
99
|
-
}, "keep")
|
|
100
|
-
]).then(() => Promise.resolve(this));
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
__publicField(Tabs, "config", {
|
|
105
|
-
name: "Tabs",
|
|
106
|
-
refs: ["btn[]", "content[]"],
|
|
107
|
-
emits: ["enable", "disable"],
|
|
108
|
-
options: {
|
|
109
|
-
styles: {
|
|
110
|
-
type: Object,
|
|
111
|
-
default: () => ({
|
|
112
|
-
content: {
|
|
113
|
-
closed: {
|
|
114
|
-
position: "absolute",
|
|
115
|
-
opacity: "0",
|
|
116
|
-
pointerEvents: "none",
|
|
117
|
-
visibility: "hidden"
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
})
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
});
|
|
124
|
-
export {
|
|
125
|
-
Tabs as default
|
|
126
|
-
};
|
|
1
|
+
import{Base as a}from"@studiometa/js-toolkit";import{transition as o}from"@studiometa/js-toolkit/utils";class l extends a{static config={name:"Tabs",refs:["btn[]","content[]"],emits:["enable","disable"],options:{styles:{type:Object,default:()=>({content:{closed:{position:"absolute",opacity:"0",pointerEvents:"none",visibility:"hidden"}}}),merge:!0}}};mounted(){this.items=this.$refs.btn.map((t,s)=>{const i=`${this.$id}-${s}`,e=this.$refs.content[s];t.setAttribute("id",i),e.setAttribute("aria-labelledby",i);const n={btn:t,content:e,isEnabled:s>0};return s>0?this.disableItem(n):this.enableItem(n),n})}onBtnClick(t,s){this.items.forEach((i,e)=>{e!==s&&this.disableItem(i)}),this.enableItem(this.items[s])}async enableItem(t){if(!t||t.isEnabled)return Promise.resolve(this);t.isEnabled=!0;const{btn:s,content:i}=t,e=this.$options.styles.btn||{},n=this.$options.styles.content||{};return i.setAttribute("aria-hidden","false"),this.$emit("enable",t),Promise.all([o(s,{from:e.closed,active:e.active,to:e.open},"keep"),o(i,{from:n.closed,active:n.active,to:n.open},"keep")]).then(()=>Promise.resolve(this))}async disableItem(t){if(!t||!t.isEnabled)return Promise.resolve(this);t.isEnabled=!1;const{btn:s,content:i}=t,e=this.$options.styles.btn||{},n=this.$options.styles.content||{};return i.setAttribute("aria-hidden","true"),this.$emit("disable",t),Promise.all([o(s,{from:e.open,active:e.active,to:e.closed},"keep"),o(i,{from:n.open,active:n.active,to:n.closed},"keep")]).then(()=>Promise.resolve(this))}}export{l as default};
|
package/molecules/index.cjs
CHANGED
|
@@ -4,27 +4,21 @@ 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
|
|
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 __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
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);
|
|
28
22
|
|
|
29
23
|
// packages/ui/molecules/index.js
|
|
30
24
|
var molecules_exports = {};
|
|
@@ -37,8 +31,10 @@ __export(molecules_exports, {
|
|
|
37
31
|
Sticky: () => import_Sticky.default,
|
|
38
32
|
Tabs: () => import_Tabs.default
|
|
39
33
|
});
|
|
40
|
-
|
|
41
|
-
__reExport(molecules_exports, require("./
|
|
34
|
+
module.exports = __toCommonJS(molecules_exports);
|
|
35
|
+
__reExport(molecules_exports, require("./Menu/index.cjs"), module.exports);
|
|
36
|
+
__reExport(molecules_exports, require("./Slider/index.cjs"), module.exports);
|
|
37
|
+
__reExport(molecules_exports, require("./TableOfContent/index.cjs"), module.exports);
|
|
42
38
|
var import_Accordion = __toESM(require("./Accordion/Accordion.cjs"), 1);
|
|
43
39
|
var import_AccordionItem = __toESM(require("./Accordion/AccordionItem.cjs"), 1);
|
|
44
40
|
var import_Modal = __toESM(require("./Modal/Modal.cjs"), 1);
|
|
@@ -46,5 +42,4 @@ var import_ModalWithTransition = __toESM(require("./Modal/ModalWithTransition.cj
|
|
|
46
42
|
var import_Panel = __toESM(require("./Panel/Panel.cjs"), 1);
|
|
47
43
|
var import_Sticky = __toESM(require("./Sticky/Sticky.cjs"), 1);
|
|
48
44
|
var import_Tabs = __toESM(require("./Tabs/Tabs.cjs"), 1);
|
|
49
|
-
module.exports = __toCommonJS(molecules_exports);
|
|
50
45
|
if (module.exports.default) module.exports = module.exports.default;
|
package/molecules/index.d.ts
CHANGED
package/molecules/index.js
CHANGED
|
@@ -1,18 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
export * from "./TableOfContent/index.js";
|
|
3
|
-
import { default as default2 } from "./Accordion/Accordion.js";
|
|
4
|
-
import { default as default3 } from "./Accordion/AccordionItem.js";
|
|
5
|
-
import { default as default4 } from "./Modal/Modal.js";
|
|
6
|
-
import { default as default5 } from "./Modal/ModalWithTransition.js";
|
|
7
|
-
import { default as default6 } from "./Panel/Panel.js";
|
|
8
|
-
import { default as default7 } from "./Sticky/Sticky.js";
|
|
9
|
-
import { default as default8 } from "./Tabs/Tabs.js";
|
|
10
|
-
export {
|
|
11
|
-
default2 as Accordion,
|
|
12
|
-
default3 as AccordionItem,
|
|
13
|
-
default4 as Modal,
|
|
14
|
-
default5 as ModalWithTransition,
|
|
15
|
-
default6 as Panel,
|
|
16
|
-
default7 as Sticky,
|
|
17
|
-
default8 as Tabs
|
|
18
|
-
};
|
|
1
|
+
export*from"./Menu/index.js";export*from"./Slider/index.js";export*from"./TableOfContent/index.js";import{default as f}from"./Accordion/Accordion.js";import{default as m}from"./Accordion/AccordionItem.js";import{default as p}from"./Modal/Modal.js";import{default as s}from"./Modal/ModalWithTransition.js";import{default as i}from"./Panel/Panel.js";import{default as n}from"./Sticky/Sticky.js";import{default as M}from"./Tabs/Tabs.js";export{f as Accordion,m as AccordionItem,p as Modal,s as ModalWithTransition,i as Panel,n as Sticky,M as Tabs};
|
|
@@ -5,57 +5,31 @@ 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__ */ ((cache2) => {
|
|
25
|
-
return (module2, temp) => {
|
|
26
|
-
return cache2 && cache2.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache2 && cache2.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;
|
|
32
25
|
};
|
|
33
|
-
var __async = (__this, __arguments, generator) => {
|
|
34
|
-
return new Promise((resolve, reject) => {
|
|
35
|
-
var fulfilled = (value) => {
|
|
36
|
-
try {
|
|
37
|
-
step(generator.next(value));
|
|
38
|
-
} catch (e) {
|
|
39
|
-
reject(e);
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
var rejected = (value) => {
|
|
43
|
-
try {
|
|
44
|
-
step(generator.throw(value));
|
|
45
|
-
} catch (e) {
|
|
46
|
-
reject(e);
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
50
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
51
|
-
});
|
|
52
|
-
};
|
|
53
26
|
|
|
54
27
|
// packages/ui/organisms/Frame/Frame.js
|
|
55
28
|
var Frame_exports = {};
|
|
56
29
|
__export(Frame_exports, {
|
|
57
30
|
default: () => Frame
|
|
58
31
|
});
|
|
32
|
+
module.exports = __toCommonJS(Frame_exports);
|
|
59
33
|
var import_js_toolkit = require("@studiometa/js-toolkit");
|
|
60
34
|
var import_utils = require("@studiometa/js-toolkit/utils");
|
|
61
35
|
var import_FrameAnchor = __toESM(require("./FrameAnchor.cjs"), 1);
|
|
@@ -108,70 +82,66 @@ var _Frame = class extends import_js_toolkit.Base {
|
|
|
108
82
|
parseHTML(string = "") {
|
|
109
83
|
return new DOMParser().parseFromString(string, "text/html");
|
|
110
84
|
}
|
|
111
|
-
goTo(url) {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
this.$emit("after-enter");
|
|
141
|
-
});
|
|
85
|
+
async goTo(url) {
|
|
86
|
+
this.$log("goTo", url);
|
|
87
|
+
const parsedUrl = new URL(url);
|
|
88
|
+
if (parsedUrl.origin !== window.location.origin) {
|
|
89
|
+
throw new Error("Cross origin request are not allowed.");
|
|
90
|
+
}
|
|
91
|
+
this.$emit("before-fetch", url);
|
|
92
|
+
const content = await this.fetch(url);
|
|
93
|
+
const doc = this.parseHTML(content);
|
|
94
|
+
const el = doc.querySelector(`#${this.id}`);
|
|
95
|
+
const newFrame = new _Frame(el);
|
|
96
|
+
newFrame.$children.registerAll();
|
|
97
|
+
this.$emit("after-fetch", url, content);
|
|
98
|
+
this.$emit("before-leave");
|
|
99
|
+
await Promise.all(this.directChildFrameTarget.map((target) => target.leave()));
|
|
100
|
+
this.$emit("after-leave");
|
|
101
|
+
this.$emit("before-content");
|
|
102
|
+
this.directChildFrameTarget.map((target, index) => target.updateContent(newFrame.directChildFrameTarget[index]));
|
|
103
|
+
if (this.$options.history) {
|
|
104
|
+
document.title = doc.title;
|
|
105
|
+
(0, import_utils.historyPush)({ path: parsedUrl.pathname, search: parsedUrl.searchParams });
|
|
106
|
+
}
|
|
107
|
+
await (0, import_utils.nextFrame)();
|
|
108
|
+
this.$root.$update();
|
|
109
|
+
await (0, import_utils.nextFrame)();
|
|
110
|
+
this.$emit("after-content");
|
|
111
|
+
this.$emit("before-enter");
|
|
112
|
+
await Promise.all(this.directChildFrameTarget.map((target) => target.enter()));
|
|
113
|
+
this.$emit("after-enter");
|
|
142
114
|
}
|
|
143
|
-
fetch(url) {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
if (cached) {
|
|
147
|
-
|
|
148
|
-
return cached.promise;
|
|
149
|
-
}
|
|
150
|
-
return cached.content;
|
|
151
|
-
}
|
|
152
|
-
const promise = fetch(url);
|
|
153
|
-
try {
|
|
154
|
-
cache.set(url, {
|
|
155
|
-
promise,
|
|
156
|
-
status: "pending",
|
|
157
|
-
content: void 0
|
|
158
|
-
});
|
|
159
|
-
const content = yield promise.then((response) => response.text());
|
|
160
|
-
cache.set(url, {
|
|
161
|
-
promise,
|
|
162
|
-
status: "resolved",
|
|
163
|
-
content
|
|
164
|
-
});
|
|
165
|
-
return content;
|
|
166
|
-
} catch (err) {
|
|
167
|
-
cache.set(url, {
|
|
168
|
-
promise,
|
|
169
|
-
status: "error",
|
|
170
|
-
content: err
|
|
171
|
-
});
|
|
172
|
-
return err;
|
|
115
|
+
async fetch(url) {
|
|
116
|
+
const cached = cache.get(url);
|
|
117
|
+
if (cached) {
|
|
118
|
+
if (cached.status === "pending") {
|
|
119
|
+
return cached.promise;
|
|
173
120
|
}
|
|
174
|
-
|
|
121
|
+
return cached.content;
|
|
122
|
+
}
|
|
123
|
+
const promise = fetch(url);
|
|
124
|
+
try {
|
|
125
|
+
cache.set(url, {
|
|
126
|
+
promise,
|
|
127
|
+
status: "pending",
|
|
128
|
+
content: void 0
|
|
129
|
+
});
|
|
130
|
+
const content = await promise.then((response) => response.text());
|
|
131
|
+
cache.set(url, {
|
|
132
|
+
promise,
|
|
133
|
+
status: "resolved",
|
|
134
|
+
content
|
|
135
|
+
});
|
|
136
|
+
return content;
|
|
137
|
+
} catch (err) {
|
|
138
|
+
cache.set(url, {
|
|
139
|
+
promise,
|
|
140
|
+
status: "error",
|
|
141
|
+
content: err
|
|
142
|
+
});
|
|
143
|
+
return err;
|
|
144
|
+
}
|
|
175
145
|
}
|
|
176
146
|
};
|
|
177
147
|
var Frame = _Frame;
|
|
@@ -198,5 +168,4 @@ __publicField(Frame, "config", {
|
|
|
198
168
|
history: Boolean
|
|
199
169
|
}
|
|
200
170
|
});
|
|
201
|
-
module.exports = __toCommonJS(Frame_exports);
|
|
202
171
|
if (module.exports.default) module.exports = module.exports.default;
|
|
@@ -47,7 +47,7 @@ export default class Frame extends Base {
|
|
|
47
47
|
* @param {string} name
|
|
48
48
|
* @returns {any[]}
|
|
49
49
|
*/
|
|
50
|
-
getDirectChild(name: string): any[];
|
|
50
|
+
getDirectChild(this: FrameInterface, name: string): any[];
|
|
51
51
|
/**
|
|
52
52
|
* Get direct `FrameAnchor` children.
|
|
53
53
|
* @returns {FrameAnchor[]}
|
|
@@ -71,7 +71,7 @@ export default class Frame extends Base {
|
|
|
71
71
|
* @param {number} index
|
|
72
72
|
* @returns {void}
|
|
73
73
|
*/
|
|
74
|
-
onFrameAnchorFrameClick(event: MouseEvent, index: number): void;
|
|
74
|
+
onFrameAnchorFrameClick(this: FrameInterface, event: MouseEvent, index: number): void;
|
|
75
75
|
/**
|
|
76
76
|
* Prevent submit on forms.
|
|
77
77
|
*
|
|
@@ -80,7 +80,7 @@ export default class Frame extends Base {
|
|
|
80
80
|
* @param {number} index
|
|
81
81
|
* @returns {void}
|
|
82
82
|
*/
|
|
83
|
-
onFrameFormFrameSubmit(event: SubmitEvent, index: number): void;
|
|
83
|
+
onFrameFormFrameSubmit(this: FrameInterface, event: SubmitEvent, index: number): void;
|
|
84
84
|
/**
|
|
85
85
|
* Parge an HTML string into a DOM object.
|
|
86
86
|
* @param {string} string
|