@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.
Files changed (65) hide show
  1. package/build/components/alert/index.d.ts +1 -1
  2. package/build/components/alert/index.js +8 -6
  3. package/build/components/field/checkbox.d.ts +1 -1
  4. package/build/components/field/checkbox.js +12 -7
  5. package/build/components/field/description.d.ts +1 -1
  6. package/build/components/field/description.js +5 -3
  7. package/build/components/field/error.d.ts +1 -1
  8. package/build/components/field/error.js +5 -3
  9. package/build/components/field/file.d.ts +1 -1
  10. package/build/components/field/file.js +18 -13
  11. package/build/components/field/index.d.ts +8 -8
  12. package/build/components/field/index.js +13 -8
  13. package/build/components/field/optional.d.ts +2 -2
  14. package/build/components/field/optional.js +13 -8
  15. package/build/components/field/select.d.ts +1 -1
  16. package/build/components/field/select.js +22 -17
  17. package/build/components/field/switch.d.ts +1 -1
  18. package/build/components/field/switch.js +8 -3
  19. package/build/components/field/text.d.ts +1 -1
  20. package/build/components/field/text.js +20 -15
  21. package/build/components/field/textarea.d.ts +1 -1
  22. package/build/components/field/textarea.js +8 -3
  23. package/build/components/field/title.d.ts +1 -1
  24. package/build/components/field/title.js +8 -6
  25. package/build/components/form/action.d.ts +4 -1
  26. package/build/components/form/action.js +35 -30
  27. package/build/components/form/index.d.ts +1 -1
  28. package/build/components/form/index.js +9 -4
  29. package/build/components/form/input.js +3 -1
  30. package/build/components/form/layout.d.ts +1 -1
  31. package/build/components/form/layout.js +7 -5
  32. package/build/components/form/types.js +2 -1
  33. package/build/components/index.js +24 -9
  34. package/build/components/overlay/index.d.ts +1 -1
  35. package/build/components/overlay/index.js +4 -2
  36. package/build/components/page/header.d.ts +1 -1
  37. package/build/components/page/header.js +7 -5
  38. package/build/components/page/index.d.ts +2 -2
  39. package/build/components/page/index.js +11 -4
  40. package/build/components/page/layout.d.ts +1 -1
  41. package/build/components/page/layout.js +4 -2
  42. package/build/components/root/index.js +9 -3
  43. package/build/components/root/queue.js +3 -11
  44. package/build/components/scrollbar/index.d.ts +5 -2
  45. package/build/components/scrollbar/index.js +20 -18
  46. package/build/components/site/index.d.ts +1 -1
  47. package/build/components/site/index.js +8 -6
  48. package/build/components/tooltip/index.d.ts +10 -3
  49. package/build/components/tooltip/index.js +45 -41
  50. package/build/components/tooltip/menu.d.ts +1 -1
  51. package/build/components/tooltip/menu.js +11 -9
  52. package/build/index.d.ts +0 -1
  53. package/build/index.js +17 -2
  54. package/build/types.d.ts +1 -0
  55. package/build/types.js +1 -0
  56. package/package.json +5 -6
  57. package/src/components/form/action.ts +6 -7
  58. package/src/components/root/queue.ts +10 -10
  59. package/src/components/scrollbar/index.ts +6 -6
  60. package/src/components/site/index.ts +1 -1
  61. package/src/components/tooltip/index.ts +14 -15
  62. package/src/index.ts +0 -3
  63. package/tsconfig.json +3 -2
  64. package/webpack.config.ts +28 -23
  65. package/src/types.ts +0 -5
@@ -1,7 +1,11 @@
1
- import { response } from '@esportsplus/action';
2
- import { html } from '@esportsplus/template';
3
- import alert from '../../components/alert';
4
- import input from './input';
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
- export default function (action) {
18
- return html `
19
- onclick='${function (event) {
20
- let trigger = event.target;
21
- if (trigger?.type !== 'submit') {
22
- return;
23
- }
24
- event.preventDefault();
25
- this.dispatchEvent(new SubmitEvent('submit', { cancelable: true, bubbles: true, submitter: trigger }));
26
- }}'
27
- onsubmit='${async function (event) {
28
- event.preventDefault();
29
- event?.submitter?.classList.add('button--processing');
30
- let { errors } = await action({
31
- alert,
32
- input: parse(Object.fromEntries(new FormData(this)?.entries())),
33
- response
34
- });
35
- for (let i = 0, n = errors.length; i < n; i++) {
36
- let { message, path } = errors[i], state = input.get(this[path]);
37
- if (!state) {
38
- continue;
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
- state.error = `${message[0].toUpperCase()}${message.substring(1)}`;
46
+ event?.submitter?.classList.remove('button--processing');
41
47
  }
42
- event?.submitter?.classList.remove('button--processing');
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").Template;
25
+ }) => import("@esportsplus/template/build/types").Renderable;
26
26
  };
27
27
  export default _default;
@@ -1,4 +1,9 @@
1
- import action from './action';
2
- import input from './input';
3
- import layout from './layout';
4
- export default { action, input, layout };
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
- export default { attributes, get };
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").Template;
12
+ declare const _default: (data: Data) => import("@esportsplus/template/build/types").Renderable;
13
13
  export default _default;
@@ -1,12 +1,14 @@
1
- import { html } from '@esportsplus/template';
2
- import { header } from '../../components/page';
3
- export default (data) => html `
4
- ${header(data)}
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
- export {};
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,9 +1,24 @@
1
- export { default as alert } from './alert';
2
- export { default as field } from './field';
3
- export { default as form } from './form';
4
- export { default as overlay } from './overlay';
5
- export { default as page } from './page';
6
- export { default as root } from './root';
7
- export { default as scrollbar } from './scrollbar';
8
- export { default as site } from './site';
9
- export { default as tooltip } from './tooltip';
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").Template;
5
+ declare const _default: (data?: Data) => import("@esportsplus/template/build/types").Renderable;
6
6
  export default _default;
@@ -1,5 +1,7 @@
1
- import { html } from '@esportsplus/template';
2
- export default (data = {}) => html `
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>
@@ -2,5 +2,5 @@ declare const _default: (data: {
2
2
  subtitle?: string;
3
3
  suptitle?: string;
4
4
  title?: string;
5
- }) => import("@esportsplus/template/build/types").Template;
5
+ }) => import("@esportsplus/template/build/types").Renderable;
6
6
  export default _default;
@@ -1,18 +1,20 @@
1
- import { html } from '@esportsplus/template';
2
- export default (data) => html `
3
- ${data?.suptitle ? html `
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").Template;
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").Template;
12
+ }) => import("@esportsplus/template/build/types").Renderable;
13
13
  };
14
14
  export default _default;
15
15
  export { header, layout };
@@ -1,4 +1,11 @@
1
- import header from './header';
2
- import layout from './layout';
3
- export default { header, layout };
4
- export { header, layout };
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,5 @@
1
1
  declare const _default: (data?: {
2
2
  class?: string;
3
3
  content?: any;
4
- }) => import("@esportsplus/template/build/types").Template;
4
+ }) => import("@esportsplus/template/build/types").Renderable;
5
5
  export default _default;
@@ -1,5 +1,7 @@
1
- import { html } from '@esportsplus/template';
2
- export default (data = {}) => html `
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
- import queue from './queue';
2
- export default { queue };
3
- export { queue };
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
- import events from '@esportsplus/delegated-events';
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
- export default { onclick };
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: import("@esportsplus/template/build/types").Template;
6
- html: import("@esportsplus/template/build/types").Template;
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
- import { reactive } from '@esportsplus/reactivity';
2
- import { html } from '@esportsplus/template';
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
- export default ({ fixed, style } = {}) => {
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: html `
11
- class='${() => {
12
- return '--scrollbar';
13
- }}'
14
- onscroll='${function () {
15
- if (width === undefined) {
16
- width = this.offsetWidth - this.clientWidth;
17
- if (width && width !== 17) {
18
- root.style.setProperty('--scrollbar-width', `${width}px`);
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
- state.height = (this.clientHeight / this.scrollHeight) * 100;
22
- state.translate = (this.scrollTop / this.clientHeight) * 100;
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='${() => `
@@ -5,5 +5,5 @@ type Data = {
5
5
  style?: string;
6
6
  };
7
7
  };
8
- declare const _default: (data: Data) => import("@esportsplus/template/build/types").Template;
8
+ declare const _default: (data: Data) => import("@esportsplus/template/build/types").Renderable;
9
9
  export default _default;
@@ -1,12 +1,14 @@
1
- import { html } from '@esportsplus/template';
2
- import { scrollbar } from '../../components';
3
- export default (data) => {
4
- let { attributes: a, html: h } = scrollbar({
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 || ''}' ${a}>
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: import("@esportsplus/template/build/types").Template;
27
- content: (() => "" | import("@esportsplus/template/build/types").Template) | undefined;
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: import("@esportsplus/template/build/types").Template;
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
- import { reactive } from '@esportsplus/reactivity';
2
- import { html } from '@esportsplus/template';
3
- import { root } from '../../components';
4
- import menu from './menu';
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 = menu(data.menu, state);
27
+ content = (0, menu_1.default)(data.menu, state);
24
28
  }
25
29
  return {
26
- attributes: html `
27
- class='${() => {
28
- return `tooltip ${state.active ? '--active' : ''}`;
29
- }}'
30
- onclick='${function (e) {
31
- let active = true, node = e.target;
32
- if (data.toggle && (this.contains(node) || this.isSameNode(node))) {
33
- active = !state.active;
34
- }
35
- frame();
36
- state.active = active;
37
- if (active) {
38
- queue.push(() => state.active = false);
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
- if (!scheduled) {
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: html `
60
- class='${() => {
61
- return `tooltip ${state.active ? '--active' : ''}`;
62
- }}'
63
- onmouseover='${() => {
64
- state.active = true;
65
- }}'
66
- onmouseout='${() => {
67
- state.active = false;
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
- export default { onclick, onhover };
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").Template;
24
+ }) => () => "" | import("@esportsplus/template/build/types").Renderable;
25
25
  export default _default;
@@ -1,10 +1,12 @@
1
- import { effect } from '@esportsplus/reactivity';
2
- import { html } from '@esportsplus/template';
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
- export default (data, state) => {
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
@@ -1,2 +1 @@
1
- import './types';
2
1
  export * from './components';