@esportsplus/ui 0.0.87 → 0.0.89
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/build/components/alert/index.d.ts +1 -1
- package/build/components/alert/index.js +8 -6
- package/build/components/field/checkbox.d.ts +1 -1
- package/build/components/field/checkbox.js +12 -7
- package/build/components/field/description.d.ts +1 -1
- package/build/components/field/description.js +5 -3
- package/build/components/field/error.d.ts +1 -1
- package/build/components/field/error.js +5 -3
- package/build/components/field/file.d.ts +1 -1
- package/build/components/field/file.js +18 -13
- package/build/components/field/index.d.ts +8 -8
- package/build/components/field/index.js +13 -8
- package/build/components/field/optional.d.ts +2 -2
- package/build/components/field/optional.js +13 -8
- package/build/components/field/select.d.ts +1 -1
- package/build/components/field/select.js +22 -17
- package/build/components/field/switch.d.ts +1 -1
- package/build/components/field/switch.js +8 -3
- package/build/components/field/text.d.ts +1 -1
- package/build/components/field/text.js +20 -15
- package/build/components/field/textarea.d.ts +1 -1
- package/build/components/field/textarea.js +8 -3
- package/build/components/field/title.d.ts +1 -1
- package/build/components/field/title.js +8 -6
- package/build/components/form/action.d.ts +4 -1
- package/build/components/form/action.js +35 -30
- package/build/components/form/index.d.ts +1 -1
- package/build/components/form/index.js +9 -4
- package/build/components/form/input.js +3 -1
- package/build/components/form/layout.d.ts +1 -1
- package/build/components/form/layout.js +7 -5
- package/build/components/form/types.js +2 -1
- package/build/components/index.js +24 -9
- package/build/components/overlay/index.d.ts +1 -1
- package/build/components/overlay/index.js +4 -2
- package/build/components/page/header.d.ts +1 -1
- package/build/components/page/header.js +7 -5
- package/build/components/page/index.d.ts +2 -2
- package/build/components/page/index.js +11 -4
- package/build/components/page/layout.d.ts +1 -1
- package/build/components/page/layout.js +4 -2
- package/build/components/root/index.js +9 -3
- package/build/components/root/queue.js +3 -11
- package/build/components/scrollbar/index.d.ts +5 -2
- package/build/components/scrollbar/index.js +20 -18
- package/build/components/site/index.d.ts +1 -1
- package/build/components/site/index.js +8 -6
- package/build/components/tooltip/index.d.ts +10 -3
- package/build/components/tooltip/index.js +45 -41
- package/build/components/tooltip/menu.d.ts +1 -1
- package/build/components/tooltip/menu.js +11 -9
- package/build/index.d.ts +0 -1
- package/build/index.js +17 -2
- package/build/types.d.ts +1 -0
- package/build/types.js +1 -0
- package/package.json +5 -6
- package/src/components/form/action.ts +6 -7
- package/src/components/root/queue.ts +10 -10
- package/src/components/scrollbar/index.ts +6 -6
- package/src/components/site/index.ts +1 -1
- package/src/components/tooltip/index.ts +14 -15
- package/src/index.ts +0 -3
- package/tsconfig.json +3 -2
- package/webpack.config.ts +28 -23
- package/src/types.ts +0 -5
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const action_1 = require("@esportsplus/action");
|
|
7
|
+
const alert_1 = __importDefault(require("../../components/alert"));
|
|
8
|
+
const input_1 = __importDefault(require("./input"));
|
|
5
9
|
function parse(input) {
|
|
6
10
|
let data = {};
|
|
7
11
|
for (let path in input) {
|
|
@@ -14,33 +18,34 @@ function parse(input) {
|
|
|
14
18
|
return data;
|
|
15
19
|
}
|
|
16
20
|
;
|
|
17
|
-
|
|
18
|
-
return
|
|
19
|
-
onclick
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
onsubmit
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
21
|
+
function default_1(action) {
|
|
22
|
+
return {
|
|
23
|
+
onclick: function (event) {
|
|
24
|
+
let trigger = event.target;
|
|
25
|
+
if (trigger?.type !== 'submit') {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
event.preventDefault();
|
|
29
|
+
this.dispatchEvent(new SubmitEvent('submit', { cancelable: true, bubbles: true, submitter: trigger }));
|
|
30
|
+
},
|
|
31
|
+
onsubmit: async function (event) {
|
|
32
|
+
event.preventDefault();
|
|
33
|
+
event?.submitter?.classList.add('button--processing');
|
|
34
|
+
let { errors } = await action({
|
|
35
|
+
alert: alert_1.default,
|
|
36
|
+
input: parse(Object.fromEntries(new FormData(this)?.entries())),
|
|
37
|
+
response: action_1.response
|
|
38
|
+
});
|
|
39
|
+
for (let i = 0, n = errors.length; i < n; i++) {
|
|
40
|
+
let { message, path } = errors[i], state = input_1.default.get(this[path]);
|
|
41
|
+
if (!state) {
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
state.error = `${message[0].toUpperCase()}${message.substring(1)}`;
|
|
39
45
|
}
|
|
40
|
-
|
|
46
|
+
event?.submitter?.classList.remove('button--processing');
|
|
41
47
|
}
|
|
42
|
-
|
|
43
|
-
}}'
|
|
44
|
-
`;
|
|
48
|
+
};
|
|
45
49
|
}
|
|
50
|
+
exports.default = default_1;
|
|
46
51
|
;
|
|
@@ -22,6 +22,6 @@ declare const _default: {
|
|
|
22
22
|
subtitle?: string | undefined;
|
|
23
23
|
suptitle?: string | undefined;
|
|
24
24
|
title?: string | undefined;
|
|
25
|
-
}) => import("@esportsplus/template/build/types").
|
|
25
|
+
}) => import("@esportsplus/template/build/types").Renderable;
|
|
26
26
|
};
|
|
27
27
|
export default _default;
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const action_1 = __importDefault(require("./action"));
|
|
7
|
+
const input_1 = __importDefault(require("./input"));
|
|
8
|
+
const layout_1 = __importDefault(require("./layout"));
|
|
9
|
+
exports.default = { action: action_1.default, input: input_1.default, layout: layout_1.default };
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
3
|
let cache = new WeakMap();
|
|
2
4
|
const attributes = (reactive) => {
|
|
3
5
|
return (element) => {
|
|
@@ -7,4 +9,4 @@ const attributes = (reactive) => {
|
|
|
7
9
|
const get = (element) => {
|
|
8
10
|
return element ? cache.get(element) : undefined;
|
|
9
11
|
};
|
|
10
|
-
|
|
12
|
+
exports.default = { attributes, get };
|
|
@@ -9,5 +9,5 @@ type Data = {
|
|
|
9
9
|
class?: string;
|
|
10
10
|
content?: any;
|
|
11
11
|
} & Parameters<typeof header>[0];
|
|
12
|
-
declare const _default: (data: Data) => import("@esportsplus/template/build/types").
|
|
12
|
+
declare const _default: (data: Data) => import("@esportsplus/template/build/types").Renderable;
|
|
13
13
|
export default _default;
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const template_1 = require("@esportsplus/template");
|
|
4
|
+
const page_1 = require("../../components/page");
|
|
5
|
+
exports.default = (data) => (0, template_1.html) `
|
|
6
|
+
${(0, page_1.header)(data)}
|
|
5
7
|
|
|
6
8
|
<form class='${data?.class}' ${data?.action || ''}>
|
|
7
9
|
${data?.content || ''}
|
|
8
10
|
|
|
9
|
-
${data?.button?.content ? html `
|
|
11
|
+
${data?.button?.content ? (0, template_1.html) `
|
|
10
12
|
<button class="button ${data?.button?.class || ''}" style='${data?.button?.style || ''}'>
|
|
11
13
|
${data?.button?.content || ''}
|
|
12
14
|
</button>
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -1,9 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.tooltip = exports.site = exports.scrollbar = exports.root = exports.page = exports.overlay = exports.form = exports.field = exports.alert = void 0;
|
|
7
|
+
var alert_1 = require("./alert");
|
|
8
|
+
Object.defineProperty(exports, "alert", { enumerable: true, get: function () { return __importDefault(alert_1).default; } });
|
|
9
|
+
var field_1 = require("./field");
|
|
10
|
+
Object.defineProperty(exports, "field", { enumerable: true, get: function () { return __importDefault(field_1).default; } });
|
|
11
|
+
var form_1 = require("./form");
|
|
12
|
+
Object.defineProperty(exports, "form", { enumerable: true, get: function () { return __importDefault(form_1).default; } });
|
|
13
|
+
var overlay_1 = require("./overlay");
|
|
14
|
+
Object.defineProperty(exports, "overlay", { enumerable: true, get: function () { return __importDefault(overlay_1).default; } });
|
|
15
|
+
var page_1 = require("./page");
|
|
16
|
+
Object.defineProperty(exports, "page", { enumerable: true, get: function () { return __importDefault(page_1).default; } });
|
|
17
|
+
var root_1 = require("./root");
|
|
18
|
+
Object.defineProperty(exports, "root", { enumerable: true, get: function () { return __importDefault(root_1).default; } });
|
|
19
|
+
var scrollbar_1 = require("./scrollbar");
|
|
20
|
+
Object.defineProperty(exports, "scrollbar", { enumerable: true, get: function () { return __importDefault(scrollbar_1).default; } });
|
|
21
|
+
var site_1 = require("./site");
|
|
22
|
+
Object.defineProperty(exports, "site", { enumerable: true, get: function () { return __importDefault(site_1).default; } });
|
|
23
|
+
var tooltip_1 = require("./tooltip");
|
|
24
|
+
Object.defineProperty(exports, "tooltip", { enumerable: true, get: function () { return __importDefault(tooltip_1).default; } });
|
|
@@ -2,5 +2,5 @@ type Data = {
|
|
|
2
2
|
class?: string;
|
|
3
3
|
content?: any;
|
|
4
4
|
};
|
|
5
|
-
declare const _default: (data?: Data) => import("@esportsplus/template/build/types").
|
|
5
|
+
declare const _default: (data?: Data) => import("@esportsplus/template/build/types").Renderable;
|
|
6
6
|
export default _default;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const template_1 = require("@esportsplus/template");
|
|
4
|
+
exports.default = (data = {}) => (0, template_1.html) `
|
|
3
5
|
<section class='overlay ${data?.class || ''}'>
|
|
4
6
|
${data?.content || ''}
|
|
5
7
|
</section>
|
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const template_1 = require("@esportsplus/template");
|
|
4
|
+
exports.default = (data) => (0, template_1.html) `
|
|
5
|
+
${data?.suptitle ? (0, template_1.html) `
|
|
4
6
|
<span class="page-suptitle --text-bold --text-crop --text-uppercase --text-200" style="--color-default: var(--color-primary-400);letter-spacing: 0.24px;">
|
|
5
7
|
${data?.suptitle}
|
|
6
8
|
</span>
|
|
7
9
|
` : ''}
|
|
8
10
|
|
|
9
|
-
${data?.title ? html `
|
|
11
|
+
${data?.title ? (0, template_1.html) `
|
|
10
12
|
<h1 class="page-title --line-height-200 --margin-300 ${!data?.subtitle && '--text-crop-bottom'} ${data?.suptitle ? '--margin-top' : '--text-crop-top'}">
|
|
11
13
|
${data?.title}
|
|
12
14
|
</h1>
|
|
13
15
|
` : ''}
|
|
14
16
|
|
|
15
|
-
${data?.subtitle ? html `
|
|
17
|
+
${data?.subtitle ? (0, template_1.html) `
|
|
16
18
|
<span class="page-subtitle --margin-top --margin-300 --text-crop-bottom">
|
|
17
19
|
${data?.subtitle}
|
|
18
20
|
</span>
|
|
@@ -5,11 +5,11 @@ declare const _default: {
|
|
|
5
5
|
subtitle?: string | undefined;
|
|
6
6
|
suptitle?: string | undefined;
|
|
7
7
|
title?: string | undefined;
|
|
8
|
-
}) => import("@esportsplus/template/build/types").
|
|
8
|
+
}) => import("@esportsplus/template/build/types").Renderable;
|
|
9
9
|
layout: (data?: {
|
|
10
10
|
class?: string | undefined;
|
|
11
11
|
content?: any;
|
|
12
|
-
}) => import("@esportsplus/template/build/types").
|
|
12
|
+
}) => import("@esportsplus/template/build/types").Renderable;
|
|
13
13
|
};
|
|
14
14
|
export default _default;
|
|
15
15
|
export { header, layout };
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.layout = exports.header = void 0;
|
|
7
|
+
const header_1 = __importDefault(require("./header"));
|
|
8
|
+
exports.header = header_1.default;
|
|
9
|
+
const layout_1 = __importDefault(require("./layout"));
|
|
10
|
+
exports.layout = layout_1.default;
|
|
11
|
+
exports.default = { header: header_1.default, layout: layout_1.default };
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const template_1 = require("@esportsplus/template");
|
|
4
|
+
exports.default = (data = {}) => (0, template_1.html) `
|
|
3
5
|
<section class='page ${data?.class}'>
|
|
4
6
|
${data?.content}
|
|
5
7
|
</section>
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.queue = void 0;
|
|
7
|
+
const queue_1 = __importDefault(require("./queue"));
|
|
8
|
+
exports.queue = queue_1.default;
|
|
9
|
+
exports.default = { queue: queue_1.default };
|
|
@@ -1,18 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
3
|
let initialized = false, queue = [];
|
|
3
4
|
const onclick = (fn) => {
|
|
4
5
|
if (!initialized) {
|
|
5
|
-
events.register(document.body, 'click', async () => {
|
|
6
|
-
if (!queue.length) {
|
|
7
|
-
return;
|
|
8
|
-
}
|
|
9
|
-
let items = queue.splice(0);
|
|
10
|
-
for (let i = 0, n = items.length; i < n; i++) {
|
|
11
|
-
await items[i]();
|
|
12
|
-
}
|
|
13
|
-
});
|
|
14
6
|
initialized = true;
|
|
15
7
|
}
|
|
16
8
|
queue.push(fn);
|
|
17
9
|
};
|
|
18
|
-
|
|
10
|
+
exports.default = { onclick };
|
|
@@ -2,7 +2,10 @@ declare const _default: ({ fixed, style }?: {
|
|
|
2
2
|
fixed?: boolean | undefined;
|
|
3
3
|
style?: string | undefined;
|
|
4
4
|
}) => {
|
|
5
|
-
attributes:
|
|
6
|
-
|
|
5
|
+
attributes: {
|
|
6
|
+
class: () => string;
|
|
7
|
+
onscroll: (this: HTMLElement) => void;
|
|
8
|
+
};
|
|
9
|
+
html: import("@esportsplus/template/build/types").Renderable;
|
|
7
10
|
};
|
|
8
11
|
export default _default;
|
|
@@ -1,28 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const reactivity_1 = require("@esportsplus/reactivity");
|
|
4
|
+
const template_1 = require("@esportsplus/template");
|
|
3
5
|
let root = document.body, width;
|
|
4
|
-
|
|
5
|
-
let state = reactive({
|
|
6
|
+
exports.default = ({ fixed, style } = {}) => {
|
|
7
|
+
let state = (0, reactivity_1.reactive)({
|
|
6
8
|
height: 100,
|
|
7
9
|
translate: 0
|
|
8
10
|
});
|
|
9
11
|
return {
|
|
10
|
-
attributes:
|
|
11
|
-
class
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
onscroll
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
attributes: {
|
|
13
|
+
class: () => {
|
|
14
|
+
return '--scrollbar';
|
|
15
|
+
},
|
|
16
|
+
onscroll: function () {
|
|
17
|
+
if (width === undefined) {
|
|
18
|
+
width = this.offsetWidth - this.clientWidth;
|
|
19
|
+
if (width && width !== 17) {
|
|
20
|
+
root.style.setProperty('--scrollbar-width', `${width}px`);
|
|
21
|
+
}
|
|
19
22
|
}
|
|
23
|
+
state.height = (this.clientHeight / this.scrollHeight) * 100;
|
|
24
|
+
state.translate = (this.scrollTop / this.clientHeight) * 100;
|
|
20
25
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}}'
|
|
24
|
-
`,
|
|
25
|
-
html: html `
|
|
26
|
+
},
|
|
27
|
+
html: (0, template_1.html) `
|
|
26
28
|
<div
|
|
27
29
|
class='scrollbar ${fixed ? 'scrollbar--fixed' : ''} ${() => state.height >= 100 ? 'scrollbar--hidden' : ''}'
|
|
28
30
|
style='${() => `
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const template_1 = require("@esportsplus/template");
|
|
4
|
+
const components_1 = require("../../components");
|
|
5
|
+
exports.default = (data) => {
|
|
6
|
+
let { attributes: a, html: h } = (0, components_1.scrollbar)({
|
|
5
7
|
fixed: true,
|
|
6
8
|
style: data?.scrollbar?.style || '--background-default: var(--color-black-400);'
|
|
7
9
|
});
|
|
8
|
-
return html `
|
|
9
|
-
<section class='site ${data?.class || ''}'
|
|
10
|
+
return (0, template_1.html) `
|
|
11
|
+
<section class='site ${data?.class || ''}' ...${a}>
|
|
10
12
|
${data?.content || ''}
|
|
11
13
|
${h}
|
|
12
14
|
</section>
|
|
@@ -23,8 +23,11 @@ declare const _default: {
|
|
|
23
23
|
} | undefined;
|
|
24
24
|
toggle?: boolean | undefined;
|
|
25
25
|
}) => {
|
|
26
|
-
attributes:
|
|
27
|
-
|
|
26
|
+
attributes: {
|
|
27
|
+
class: () => string;
|
|
28
|
+
onclick: (this: HTMLElement, e: Event) => void;
|
|
29
|
+
};
|
|
30
|
+
content: (() => "" | import("@esportsplus/template/build/types").Renderable) | undefined;
|
|
28
31
|
state: {
|
|
29
32
|
active: boolean;
|
|
30
33
|
render: boolean | undefined;
|
|
@@ -36,7 +39,11 @@ declare const _default: {
|
|
|
36
39
|
};
|
|
37
40
|
};
|
|
38
41
|
onhover: (active?: boolean) => {
|
|
39
|
-
attributes:
|
|
42
|
+
attributes: {
|
|
43
|
+
class: () => string;
|
|
44
|
+
onmouseover: () => void;
|
|
45
|
+
onmouseout: () => void;
|
|
46
|
+
};
|
|
40
47
|
state: {
|
|
41
48
|
active: boolean;
|
|
42
49
|
render: boolean | undefined;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const reactivity_1 = require("@esportsplus/reactivity");
|
|
7
|
+
const components_1 = require("../../components");
|
|
8
|
+
const menu_1 = __importDefault(require("./menu"));
|
|
5
9
|
let queue = [], running = false, scheduled = false;
|
|
6
10
|
async function frame() {
|
|
7
11
|
if (running) {
|
|
@@ -15,59 +19,59 @@ async function frame() {
|
|
|
15
19
|
running = false;
|
|
16
20
|
}
|
|
17
21
|
const onclick = (data = {}) => {
|
|
18
|
-
let content, state = reactive({
|
|
22
|
+
let content, state = (0, reactivity_1.reactive)({
|
|
19
23
|
active: data.active || false,
|
|
20
24
|
render: undefined
|
|
21
25
|
});
|
|
22
26
|
if (data.menu) {
|
|
23
|
-
content =
|
|
27
|
+
content = (0, menu_1.default)(data.menu, state);
|
|
24
28
|
}
|
|
25
29
|
return {
|
|
26
|
-
attributes:
|
|
27
|
-
class
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
onclick
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
30
|
+
attributes: {
|
|
31
|
+
class: () => {
|
|
32
|
+
return `tooltip ${state.active ? '--active' : ''}`;
|
|
33
|
+
},
|
|
34
|
+
onclick: function (e) {
|
|
35
|
+
let active = true, node = e.target;
|
|
36
|
+
if (data.toggle && (this.contains(node) || this.isSameNode(node))) {
|
|
37
|
+
active = !state.active;
|
|
38
|
+
}
|
|
39
|
+
frame();
|
|
40
|
+
state.active = active;
|
|
41
|
+
if (active) {
|
|
42
|
+
queue.push(() => state.active = false);
|
|
43
|
+
}
|
|
44
|
+
if (!scheduled) {
|
|
45
|
+
scheduled = true;
|
|
46
|
+
components_1.root.queue.onclick(() => {
|
|
47
|
+
frame();
|
|
48
|
+
scheduled = false;
|
|
49
|
+
});
|
|
50
|
+
}
|
|
39
51
|
}
|
|
40
|
-
|
|
41
|
-
scheduled = true;
|
|
42
|
-
root.queue.onclick(() => {
|
|
43
|
-
frame();
|
|
44
|
-
scheduled = false;
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
}}'
|
|
48
|
-
`,
|
|
52
|
+
},
|
|
49
53
|
content,
|
|
50
54
|
state
|
|
51
55
|
};
|
|
52
56
|
};
|
|
53
57
|
const onhover = (active = false) => {
|
|
54
|
-
let state = reactive({
|
|
58
|
+
let state = (0, reactivity_1.reactive)({
|
|
55
59
|
active,
|
|
56
60
|
render: undefined
|
|
57
61
|
});
|
|
58
62
|
return {
|
|
59
|
-
attributes:
|
|
60
|
-
class
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
onmouseover
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
onmouseout
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
63
|
+
attributes: {
|
|
64
|
+
class: () => {
|
|
65
|
+
return `tooltip ${state.active ? '--active' : ''}`;
|
|
66
|
+
},
|
|
67
|
+
onmouseover: () => {
|
|
68
|
+
state.active = true;
|
|
69
|
+
},
|
|
70
|
+
onmouseout: () => {
|
|
71
|
+
state.active = false;
|
|
72
|
+
}
|
|
73
|
+
},
|
|
70
74
|
state
|
|
71
75
|
};
|
|
72
76
|
};
|
|
73
|
-
|
|
77
|
+
exports.default = { onclick, onhover };
|
|
@@ -21,5 +21,5 @@ type Data = {
|
|
|
21
21
|
declare const _default: (data: Data, state: {
|
|
22
22
|
active?: boolean;
|
|
23
23
|
render?: boolean;
|
|
24
|
-
}) => () => "" | import("@esportsplus/template/build/types").
|
|
24
|
+
}) => () => "" | import("@esportsplus/template/build/types").Renderable;
|
|
25
25
|
export default _default;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const reactivity_1 = require("@esportsplus/reactivity");
|
|
4
|
+
const template_1 = require("@esportsplus/template");
|
|
3
5
|
function template(data) {
|
|
4
|
-
return html `
|
|
6
|
+
return (0, template_1.html) `
|
|
5
7
|
<div class="tooltip-content tooltip-content--${data?.direction || 's'} --flex-column --width-full ${data?.class || ''}" style='${data?.style || ''}'>
|
|
6
|
-
${(data?.items || []).map(item => html `
|
|
7
|
-
${item?.border ? html `
|
|
8
|
+
${(data?.items || []).map(item => (0, template_1.html) `
|
|
9
|
+
${item?.border ? (0, template_1.html) `
|
|
8
10
|
<div
|
|
9
11
|
class="border ${item?.border?.class || ''}"
|
|
10
12
|
style='
|
|
@@ -15,11 +17,11 @@ function template(data) {
|
|
|
15
17
|
` : ''}
|
|
16
18
|
|
|
17
19
|
<${item?.url ? 'a' : 'div'}
|
|
18
|
-
class='link --flex-vertical ${item?.class}' ${item?.onclick ? html `onclick='${item.onclick}'` : ''}
|
|
20
|
+
class='link --flex-vertical ${item?.class}' ${item?.onclick ? (0, template_1.html) `onclick='${item.onclick}'` : ''}
|
|
19
21
|
style='${item?.style || ''}'
|
|
20
22
|
${item?.url ? `href='${item.url}' target='${item.target || '_blank'}'` : ''}
|
|
21
23
|
>
|
|
22
|
-
${item?.svg ? html `
|
|
24
|
+
${item?.svg ? (0, template_1.html) `
|
|
23
25
|
<div class="icon --margin-right --margin-300" style='margin-left: var(--size-100)'>
|
|
24
26
|
${item.svg}
|
|
25
27
|
</div>
|
|
@@ -33,8 +35,8 @@ function template(data) {
|
|
|
33
35
|
</div>
|
|
34
36
|
`;
|
|
35
37
|
}
|
|
36
|
-
|
|
37
|
-
effect(() => {
|
|
38
|
+
exports.default = (data, state) => {
|
|
39
|
+
(0, reactivity_1.effect)(() => {
|
|
38
40
|
if (!state.active || state.render) {
|
|
39
41
|
return;
|
|
40
42
|
}
|
package/build/index.d.ts
CHANGED