@esportsplus/ui 0.0.44 → 0.0.45

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.
@@ -1,12 +1,10 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const reactivity_1 = require("@esportsplus/reactivity");
4
- const template_1 = require("@esportsplus/template");
1
+ import { reactive } from '@esportsplus/reactivity';
2
+ import { html } from '@esportsplus/template';
5
3
  let modifiers = {
6
4
  error: 'red',
7
5
  info: 'black',
8
6
  success: 'green'
9
- }, state = (0, reactivity_1.reactive)({
7
+ }, state = reactive({
10
8
  active: false,
11
9
  messages: new Set,
12
10
  processing: false,
@@ -94,9 +92,9 @@ const processing = () => {
94
92
  };
95
93
  const success = (messages, seconds = 0) => activate('success', messages, seconds);
96
94
  const h = () => {
97
- return () => state.active || state.processing ? (0, template_1.html) `
95
+ return () => state.active || state.processing ? html `
98
96
  <div class='alert anchor anchor--ne ${() => state.active && '--active'} ${() => `alert--${state.state}`}'>
99
- ${() => !state.processing ? (0, template_1.html) `
97
+ ${() => !state.processing ? html `
100
98
  <div class="alert-close --flex-start --margin-right --margin-100" onclick='${deactivate}'>
101
99
  <div class='button --background-state ${() => `--background-${modifiers[state.type] || 'black'}`} --color-state --color-white --flex-center --padding-300'>
102
100
  <div class="icon --size-300">
@@ -116,12 +114,12 @@ const h = () => {
116
114
  <h5 class="page-title">
117
115
  ${() => state.type.charAt(0).toUpperCase() + state.type.slice(1)}
118
116
  </h5>
119
- ${() => state.type && [...state.messages].map((message) => (0, template_1.html) `
117
+ ${() => state.type && [...state.messages].map((message) => html `
120
118
  <p class='--margin-top --margin-border-width-500'>${message}</p>
121
119
  `)}
122
120
  </div>
123
121
 
124
- ${() => !state.processing && state.seconds ? (0, template_1.html) `
122
+ ${() => !state.processing && state.seconds ? html `
125
123
  <svg class='alert-timer' style='--animation-duration: ${state.seconds}s;'>
126
124
  <circle class="alert-timer-bg" cx="50%" cy="50%" r="40%" style='--border-color: var(--color-grey-500);' />
127
125
  <circle class="alert-timer-meter" cx="50%" cy="50%" r="40%" style='--border-color: var(--color-black-300);' />
@@ -149,4 +147,4 @@ const h = () => {
149
147
  ` : '';
150
148
  };
151
149
  const types = ['error', 'info', 'success'];
152
- exports.default = { deactivate, error, html: h, info, processing, success, types };
150
+ export default { deactivate, error, html: h, info, processing, success, types };
@@ -1,16 +1,11 @@
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 template_1 = require("@esportsplus/template");
8
- const description_1 = __importDefault(require("./description"));
9
- exports.default = (data) => {
10
- let state = (0, reactivity_1.reactive)({
1
+ import { reactive } from '@esportsplus/reactivity';
2
+ import { html } from '@esportsplus/template';
3
+ import description from './description';
4
+ export default (data) => {
5
+ let state = reactive({
11
6
  active: false
12
7
  });
13
- return (0, template_1.html) `
8
+ return html `
14
9
  <div
15
10
  class="field --flex-column ${data?.class || ''} ${() => state.active ? '--active' : ''}"
16
11
  onchange='${(e) => {
@@ -40,7 +35,7 @@ exports.default = (data) => {
40
35
 
41
36
  ${data?.field?.content || ''}
42
37
 
43
- ${(0, description_1.default)(data)}
38
+ ${description(data)}
44
39
  </div>
45
40
  `;
46
41
  };
@@ -1,11 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const template_1 = require("@esportsplus/template");
4
- exports.default = (data) => {
1
+ import { html } from '@esportsplus/template';
2
+ export default (data) => {
5
3
  if (!data?.description) {
6
4
  return '';
7
5
  }
8
- return (0, template_1.html) `
6
+ return html `
9
7
  <div class='field-description --margin-top --margin-300'>${data.description}</div>
10
8
  `;
11
9
  };
@@ -1,12 +1,10 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const template_1 = require("@esportsplus/template");
4
- exports.default = (data) => {
1
+ import { html } from '@esportsplus/template';
2
+ export default (data) => {
5
3
  return () => {
6
4
  if (!data.error) {
7
5
  return '';
8
6
  }
9
- return (0, template_1.html) `
7
+ return html `
10
8
  <div class='field-error --margin-top --margin-300 --text-bold'>${data.error}</div>
11
9
  `;
12
10
  };
@@ -1,11 +1,6 @@
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 checkbox_1 = __importDefault(require("./checkbox"));
7
- const optional_1 = __importDefault(require("./optional"));
8
- const select_1 = __importDefault(require("./select"));
9
- const switch_1 = __importDefault(require("./switch"));
10
- const text_1 = __importDefault(require("./text"));
11
- exports.default = { checkbox: checkbox_1.default, optional: optional_1.default, select: select_1.default, switch: switch_1.default, text: text_1.default };
1
+ import checkbox from './checkbox';
2
+ import optional from './optional';
3
+ import select from './select';
4
+ import s from './switch';
5
+ import text from './text';
6
+ export default { checkbox, optional, select, switch: s, text };
@@ -1,25 +1,20 @@
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 select_1 = __importDefault(require("./select"));
7
- const switch_1 = __importDefault(require("./switch"));
8
- const text_1 = __importDefault(require("./text"));
1
+ import sel from './select';
2
+ import s from './switch';
3
+ import tex from './text';
9
4
  const select = (data) => {
10
- return (0, switch_1.default)(Object.assign(data, {
5
+ return s(Object.assign(data, {
11
6
  class: `field--optional ${data?.class || ''}`,
12
7
  field: {
13
- content: (0, select_1.default)(data.field)
8
+ content: sel(data.field)
14
9
  }
15
10
  }));
16
11
  };
17
12
  const text = (data) => {
18
- return (0, switch_1.default)(Object.assign(data, {
13
+ return s(Object.assign(data, {
19
14
  class: `field--optional ${data?.class || ''}`,
20
15
  field: {
21
- content: (0, text_1.default)(data.field)
16
+ content: tex(data.field)
22
17
  }
23
18
  }));
24
19
  };
25
- exports.default = { select, text };
20
+ export default { select, text };
@@ -1,14 +1,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
- const reactivity_1 = require("@esportsplus/reactivity");
7
- const template_1 = require("@esportsplus/template");
8
- const components_1 = require("../../components");
9
- const description_1 = __importDefault(require("./description"));
10
- const error_1 = __importDefault(require("./error"));
11
- const title_1 = __importDefault(require("./title"));
1
+ import { reactive } from '@esportsplus/reactivity';
2
+ import { html } from '@esportsplus/template';
3
+ import { form, scrollbar, root } from '../../components';
4
+ import description from './description';
5
+ import error from './error';
6
+ import title from './title';
12
7
  function parse(keys, selected) {
13
8
  let options = {};
14
9
  for (let key of keys) {
@@ -21,11 +16,11 @@ function parse(keys, selected) {
21
16
  };
22
17
  }
23
18
  function template(data, state) {
24
- let { attributes: a, html: h } = (0, components_1.scrollbar)({
19
+ let { attributes: a, html: h } = scrollbar({
25
20
  fixed: true,
26
21
  style: data?.scrollbar?.style || '--background-default: var(--color-black-400);'
27
22
  });
28
- return (0, template_1.html) `
23
+ return html `
29
24
  <div
30
25
  class='tooltip-content tooltip-content--${data?.tooltip?.direction || 's'} ${data?.tooltip?.class || ''} --flex-column --width-full'
31
26
  style='${data?.tooltip?.style || ''}'
@@ -47,7 +42,7 @@ function template(data, state) {
47
42
  }}'
48
43
  ${a}
49
44
  >
50
- ${Object.keys(data.options || {}).map((key) => (0, template_1.html) `
45
+ ${Object.keys(data.options || {}).map((key) => html `
51
46
  <div
52
47
  class='link ${data?.option?.class || ''} ${() => state.options[key] ? '--active' : ''} --flex-vertical' data-key='${key}'
53
48
  style='${data?.option?.style || ''}'
@@ -63,15 +58,15 @@ function template(data, state) {
63
58
  </div>
64
59
  `;
65
60
  }
66
- exports.default = (data) => {
67
- let state = (0, reactivity_1.reactive)(Object.assign({
61
+ export default (data) => {
62
+ let state = reactive(Object.assign({
68
63
  active: false,
69
64
  error: '',
70
65
  render: false,
71
66
  }, parse(Object.keys(data.options || {}), data.selected)));
72
- return (0, template_1.html) `
67
+ return html `
73
68
  <div class="field tooltip ${data?.class || ''} ${() => state.active ? '--active' : ''} --flex-column" style='${data?.style || ''}'>
74
- ${(0, title_1.default)(data)}
69
+ ${title(data)}
75
70
 
76
71
  <label
77
72
  class="field-mask field-mask--select --flex-row ${data?.mask?.class || ''} ${(data?.title || (data?.class || '').indexOf('field--optional') !== -1) && '--margin-top'} --margin-300 --padding-400"
@@ -79,7 +74,7 @@ exports.default = (data) => {
79
74
  state.render = true;
80
75
  state.active = !state.active;
81
76
  if (state.active) {
82
- components_1.root.queue.onclick(() => state.active = false);
77
+ root.queue.onclick(() => state.active = false);
83
78
  }
84
79
  }}'
85
80
  style='${data?.mask?.style || ''}'
@@ -88,7 +83,7 @@ exports.default = (data) => {
88
83
  class='field-tag field-tag--hidden'
89
84
  name='${data.name}'
90
85
  onclick='${() => { }}'
91
- onrender='${components_1.form.input.attributes(state)}'
86
+ onrender='${form.input.attributes(state)}'
92
87
  value='${() => state.selected}'
93
88
  >
94
89
 
@@ -101,8 +96,8 @@ exports.default = (data) => {
101
96
  ${() => state.render ? template(data, state) : ''}
102
97
  </label>
103
98
 
104
- ${(0, description_1.default)(data)}
105
- ${(0, error_1.default)(state)}
99
+ ${description(data)}
100
+ ${error(state)}
106
101
  </div>
107
102
  `;
108
103
  };
@@ -1,11 +1,6 @@
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 checkbox_1 = __importDefault(require("./checkbox"));
7
- exports.default = (data) => {
1
+ import checkbox from './checkbox';
2
+ export default (data) => {
8
3
  data.mask = data.mask || {};
9
4
  data.mask.class = `field-mask--switch ${data.mask?.class || ''}`;
10
- return (0, checkbox_1.default)(data);
5
+ return checkbox(data);
11
6
  };
@@ -1,20 +1,15 @@
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 template_1 = require("@esportsplus/template");
8
- const components_1 = require("../../components");
9
- const description_1 = __importDefault(require("./description"));
10
- const error_1 = __importDefault(require("./error"));
11
- const title_1 = __importDefault(require("./title"));
12
- exports.default = (data) => {
13
- let state = (0, reactivity_1.reactive)({
1
+ import { reactive } from '@esportsplus/reactivity';
2
+ import { html } from '@esportsplus/template';
3
+ import { form } from '../../components';
4
+ import description from './description';
5
+ import error from './error';
6
+ import title from './title';
7
+ export default (data) => {
8
+ let state = reactive({
14
9
  active: false,
15
10
  error: ''
16
11
  });
17
- return (0, template_1.html) `
12
+ return html `
18
13
  <div
19
14
  class="field ${data?.class || ''} ${() => state.active ? '--active' : ''} --flex-column"
20
15
  onfocusin='${() => {
@@ -25,7 +20,7 @@ exports.default = (data) => {
25
20
  }}'
26
21
  style='${data?.style || ''}'
27
22
  >
28
- ${(0, title_1.default)(data)}
23
+ ${title(data)}
29
24
 
30
25
  <label
31
26
  class='field-mask field-mask--input --flex-row ${data?.mask?.class || ''} ${(data?.title || (data?.class || '').indexOf('field--optional') !== -1) && '--margin-top'} --margin-300'
@@ -35,7 +30,7 @@ exports.default = (data) => {
35
30
  class='field-tag --padding-400'
36
31
  name='${data?.name || ''}'
37
32
  placeholder='${data?.placeholder || ''}'
38
- onrender='${components_1.form.input.attributes(state)}'
33
+ onrender='${form.input.attributes(state)}'
39
34
  type='${data?.type || 'string'}'
40
35
  ${data?.value !== undefined ? `value='${data.value}'` : ''}
41
36
  >
@@ -43,8 +38,8 @@ exports.default = (data) => {
43
38
  ${data?.mask?.content || ''}
44
39
  </label>
45
40
 
46
- ${(0, description_1.default)(data)}
47
- ${(0, error_1.default)(state)}
41
+ ${description(data)}
42
+ ${error(state)}
48
43
  </div>
49
44
  `;
50
45
  };
@@ -1,17 +1,15 @@
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) => {
1
+ import { html } from '@esportsplus/template';
2
+ import { tooltip } from '../../components';
3
+ export default (data) => {
6
4
  if (!data?.title) {
7
5
  return '';
8
6
  }
9
- return (0, template_1.html) `
7
+ return html `
10
8
  <div class="field-title --flex-horizontal-space-between --flex-vertical">
11
9
  ${data.title}
12
10
 
13
- ${data?.required && (0, template_1.html) `
14
- <div class="bubble --background-primary --margin-left" ${components_1.tooltip.onhover()}>
11
+ ${data?.required && html `
12
+ <div class="bubble --background-primary --margin-left" ${tooltip.onhover()}>
15
13
  <span class="tooltip-message tooltip-message--w">Required</span>
16
14
  </div>
17
15
  `}
@@ -1,12 +1,7 @@
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 template_1 = require("@esportsplus/template");
8
- const alert_1 = __importDefault(require("../../components/alert"));
9
- const input_1 = __importDefault(require("./input"));
1
+ import { response } from '@esportsplus/action';
2
+ import { html } from '@esportsplus/template';
3
+ import alert from '../../components/alert';
4
+ import input from './input';
10
5
  function parse(input) {
11
6
  let data = {};
12
7
  for (let path in input) {
@@ -19,8 +14,8 @@ function parse(input) {
19
14
  return data;
20
15
  }
21
16
  ;
22
- function default_1(action) {
23
- return (0, template_1.html)({
17
+ export default function (action) {
18
+ return html({
24
19
  onclick: function (event) {
25
20
  let trigger = event.target;
26
21
  if (trigger?.type !== 'submit') {
@@ -32,12 +27,12 @@ function default_1(action) {
32
27
  onsubmit: async function (event) {
33
28
  event.preventDefault();
34
29
  let { errors } = await action({
35
- alert: alert_1.default,
30
+ alert,
36
31
  input: parse(Object.fromEntries(new FormData(this)?.entries())),
37
32
  processing: {
38
33
  end: (deactivate = true) => {
39
34
  if (deactivate) {
40
- alert_1.default.deactivate();
35
+ alert.deactivate();
41
36
  }
42
37
  event?.submitter?.classList.remove('button--processing');
43
38
  },
@@ -45,10 +40,10 @@ function default_1(action) {
45
40
  event?.submitter?.classList.add('button--processing');
46
41
  }
47
42
  },
48
- response: action_1.response
43
+ response
49
44
  });
50
45
  for (let i = 0, n = errors.length; i < n; i++) {
51
- let { message, path } = errors[i], state = input_1.default.get(this[path]);
46
+ let { message, path } = errors[i], state = input.get(this[path]);
52
47
  if (!state) {
53
48
  continue;
54
49
  }
@@ -57,5 +52,4 @@ function default_1(action) {
57
52
  }
58
53
  });
59
54
  }
60
- exports.default = default_1;
61
55
  ;
@@ -1,9 +1,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
+ import action from './action';
2
+ import input from './input';
3
+ import layout from './layout';
4
+ export default { action, input, layout };
@@ -1,5 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
1
  let cache = new WeakMap();
4
2
  const attributes = (reactive) => {
5
3
  return (element) => {
@@ -9,4 +7,4 @@ const attributes = (reactive) => {
9
7
  const get = (element) => {
10
8
  return element ? cache.get(element) : undefined;
11
9
  };
12
- exports.default = { attributes, get };
10
+ export default { attributes, get };
@@ -1,14 +1,12 @@
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)}
1
+ import { html } from '@esportsplus/template';
2
+ import { header } from '../../components/page';
3
+ export default (data) => html `
4
+ ${header(data)}
7
5
 
8
6
  <form class='${data?.class}' ${data?.action || ''}>
9
7
  ${data?.content || ''}
10
8
 
11
- ${data?.button ? (0, template_1.html) `
9
+ ${data?.button ? html `
12
10
  <button class="button ${data?.button?.class || ''}" style='${data?.button?.style || ''}'>
13
11
  ${data?.button?.content || ''}
14
12
  </button>
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
@@ -1,24 +1,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; } });
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,7 +1,5 @@
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) `
1
+ import { html } from '@esportsplus/template';
2
+ export default (data = {}) => html `
5
3
  <section class='overlay ${data?.class || ''}'>
6
4
  ${data?.content || ''}
7
5
  </section>
@@ -1,20 +1,18 @@
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) `
1
+ import { html } from '@esportsplus/template';
2
+ export default (data) => html `
3
+ ${data?.suptitle ? html `
6
4
  <span class="page-suptitle --text-bold --text-crop --text-uppercase --text-200" style="--color-default: var(--color-primary-400);letter-spacing: 0.24px;">
7
5
  ${data?.suptitle}
8
6
  </span>
9
7
  ` : ''}
10
8
 
11
- ${data?.title ? (0, template_1.html) `
9
+ ${data?.title ? html `
12
10
  <h1 class="page-title --line-height-200 --margin-300 ${!data?.subtitle && '--text-crop-bottom'} ${data?.suptitle ? '--margin-top' : '--text-crop-top'}">
13
11
  ${data?.title}
14
12
  </h1>
15
13
  ` : ''}
16
14
 
17
- ${data?.subtitle ? (0, template_1.html) `
15
+ ${data?.subtitle ? html `
18
16
  <span class="page-subtitle --margin-top --margin-300 --text-crop-bottom">
19
17
  ${data?.subtitle}
20
18
  </span>
@@ -1,11 +1,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
+ import header from './header';
2
+ import layout from './layout';
3
+ export default { header, layout };
4
+ export { header, layout };
@@ -1,7 +1,5 @@
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) `
1
+ import { html } from '@esportsplus/template';
2
+ export default (data = {}) => html `
5
3
  <section class='page ${data?.class}'>
6
4
  ${data?.content}
7
5
  </section>
@@ -1,9 +1,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
+ import queue from './queue';
2
+ export default { queue };
3
+ export { queue };
@@ -1,13 +1,8 @@
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 delegated_events_1 = __importDefault(require("@esportsplus/delegated-events"));
1
+ import events from '@esportsplus/delegated-events';
7
2
  let initialized = false, queue = [];
8
3
  const onclick = (fn) => {
9
4
  if (!initialized) {
10
- delegated_events_1.default.register(document.body, 'click', async () => {
5
+ events.register(document.body, 'click', async () => {
11
6
  if (!queue.length) {
12
7
  return;
13
8
  }
@@ -20,4 +15,4 @@ const onclick = (fn) => {
20
15
  }
21
16
  queue.push(fn);
22
17
  };
23
- exports.default = { onclick };
18
+ export default { onclick };
@@ -1,15 +1,13 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const reactivity_1 = require("@esportsplus/reactivity");
4
- const template_1 = require("@esportsplus/template");
1
+ import { reactive } from '@esportsplus/reactivity';
2
+ import { html } from '@esportsplus/template';
5
3
  let root = document.body, width;
6
- exports.default = ({ fixed, style } = {}) => {
7
- let state = (0, reactivity_1.reactive)({
4
+ export default ({ fixed, style } = {}) => {
5
+ let state = reactive({
8
6
  height: 100,
9
7
  translate: 0
10
8
  });
11
9
  return {
12
- attributes: (0, template_1.html)({
10
+ attributes: html({
13
11
  class: () => {
14
12
  return '--scrollbar';
15
13
  },
@@ -24,7 +22,7 @@ exports.default = ({ fixed, style } = {}) => {
24
22
  state.translate = (this.scrollTop / this.clientHeight) * 100;
25
23
  }
26
24
  }),
27
- html: (0, template_1.html) `
25
+ html: html `
28
26
  <div
29
27
  class='scrollbar ${fixed ? 'scrollbar--fixed' : ''} ${() => state.height >= 100 ? 'scrollbar--hidden' : ''}'
30
28
  style='${() => `
@@ -1,13 +1,11 @@
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)({
1
+ import { html } from '@esportsplus/template';
2
+ import { scrollbar } from '../../components';
3
+ export default (data) => {
4
+ let { attributes: a, html: h } = scrollbar({
7
5
  fixed: true,
8
6
  style: data?.scrollbar?.style || '--background-default: var(--color-black-400);'
9
7
  });
10
- return (0, template_1.html) `
8
+ return html `
11
9
  <section class='site ${data?.class || ''}' ${a}>
12
10
  ${data?.content || ''}
13
11
  ${h}
@@ -1,17 +1,12 @@
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 template_1 = require("@esportsplus/template");
8
- const components_1 = require("../../components");
9
- const menu_1 = __importDefault(require("./menu"));
1
+ import { reactive } from '@esportsplus/reactivity';
2
+ import { html } from '@esportsplus/template';
3
+ import { root } from '../../components';
4
+ import menu from './menu';
10
5
  const onclick = ({ active, toggle }) => {
11
- let state = (0, reactivity_1.reactive)({
6
+ let state = reactive({
12
7
  active: active || false
13
8
  });
14
- return (0, template_1.html)({
9
+ return html({
15
10
  class: () => {
16
11
  return `tooltip ${state.active ? '--active' : ''}`;
17
12
  },
@@ -22,14 +17,14 @@ const onclick = ({ active, toggle }) => {
22
17
  }
23
18
  state.active = active;
24
19
  if (active) {
25
- components_1.root.queue.onclick(() => state.active = false);
20
+ root.queue.onclick(() => state.active = false);
26
21
  }
27
22
  }
28
23
  });
29
24
  };
30
25
  const onhover = (active = false) => {
31
- let state = (0, reactivity_1.reactive)({ active });
32
- return (0, template_1.html)({
26
+ let state = reactive({ active });
27
+ return html({
33
28
  class: () => {
34
29
  return `tooltip ${state.active ? '--active' : ''}`;
35
30
  },
@@ -41,4 +36,4 @@ const onhover = (active = false) => {
41
36
  }
42
37
  });
43
38
  };
44
- exports.default = { onclick, onhover, menu: menu_1.default };
39
+ export default { onclick, onhover, menu };
@@ -1,12 +1,10 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const reactivity_1 = require("@esportsplus/reactivity");
4
- const template_1 = require("@esportsplus/template");
1
+ import { effect, reactive } from '@esportsplus/reactivity';
2
+ import { html } from '@esportsplus/template';
5
3
  function template(data) {
6
- return (0, template_1.html) `
4
+ return html `
7
5
  <div class="tooltip-content tooltip-content--${data?.direction || 's'} --flex-column --width-full ${data?.class || ''}" style='${data?.style || ''}'>
8
- ${(data?.items || []).map(item => (0, template_1.html) `
9
- ${item?.border ? (0, template_1.html) `
6
+ ${(data?.items || []).map(item => html `
7
+ ${item?.border ? html `
10
8
  <div
11
9
  class="border ${item?.border?.class || ''}"
12
10
  style='
@@ -17,11 +15,11 @@ function template(data) {
17
15
  ` : ''}
18
16
 
19
17
  <${item?.url ? 'a' : 'div'}
20
- class='link --flex-vertical ${item?.class}' ${item?.onclick ? (0, template_1.html)({ onclick: item.onclick }) : ''}
18
+ class='link --flex-vertical ${item?.class}' ${item?.onclick ? html({ onclick: item.onclick }) : ''}
21
19
  style='${item?.style || ''}'
22
20
  ${item?.url ? `href='${item.url}' target='${item.target || '_blank'}'` : ''}
23
21
  >
24
- ${item?.svg ? (0, template_1.html) `
22
+ ${item?.svg ? html `
25
23
  <div class="icon --margin-right --margin-300" style='margin-left: var(--size-100)'>
26
24
  ${item.svg}
27
25
  </div>
@@ -35,11 +33,11 @@ function template(data) {
35
33
  </div>
36
34
  `;
37
35
  }
38
- exports.default = (data) => {
39
- let state = (0, reactivity_1.reactive)({
36
+ export default (data) => {
37
+ let state = reactive({
40
38
  render: false
41
39
  });
42
- (0, reactivity_1.effect)(() => {
40
+ effect(() => {
43
41
  if (!data.state.active || state.render) {
44
42
  return;
45
43
  }
package/build/entry.d.ts CHANGED
@@ -1,21 +1,9 @@
1
1
  declare const _default: {
2
- styles: (entry: {
3
- filename: string;
4
- import: string[];
5
- }, { font, fonts, normalizer }?: {
2
+ styles: (files: string[], { font, fonts, normalizer }?: {
6
3
  font?: string | undefined;
7
4
  fonts?: string[] | undefined;
8
5
  normalizer?: boolean | undefined;
9
- }) => {
10
- filename: string;
11
- import: string[];
12
- };
13
- variables: (entry: {
14
- filename: string;
15
- import: string[];
16
- }) => {
17
- filename: string;
18
- import: string[];
19
- };
6
+ }) => string[];
7
+ variables: (files: string[]) => string[];
20
8
  };
21
9
  export default _default;
package/build/entry.js CHANGED
@@ -1,21 +1,19 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const webpack_1 = require("@esportsplus/webpack");
4
- const styles = (entry, { font, fonts, normalizer } = {}) => {
5
- entry.import.unshift(...webpack_1.resolve.glob(`components/**/index.scss`));
6
- entry.import.push(...webpack_1.resolve.glob(`css-utilities/**/index.scss`));
1
+ import { resolve } from '@esportsplus/webpack';
2
+ const styles = (files, { font, fonts, normalizer } = {}) => {
3
+ files.unshift(...resolve.glob(`./components/**/index.scss`));
4
+ files.push(...resolve.glob(`./css-utilities/**/index.scss`));
7
5
  fonts = font ? [font] : fonts;
8
6
  if (fonts) {
9
- entry.import.unshift(...webpack_1.resolve.glob(`../storage/fonts/{${fonts.join(',')}}/index.css`));
7
+ files.unshift(...resolve.glob(`../storage/fonts/{${fonts.join(',')}}/index.css`));
10
8
  }
11
9
  if (normalizer) {
12
- entry.import.unshift('modern-normalize/modern-normalize.css');
10
+ files.unshift('modern-normalize/modern-normalize.css');
13
11
  }
14
- return entry;
12
+ return files;
15
13
  };
16
- const variables = (entry) => {
17
- entry.import.unshift(...webpack_1.resolve.glob(`components/**/variables.scss`));
18
- entry.import.push(...webpack_1.resolve.glob(`css-utilities/**/variables.scss`));
19
- return entry;
14
+ const variables = (files) => {
15
+ files.unshift(...resolve.glob('./components/**/variables.scss'));
16
+ files.push(...resolve.glob('./css-utilities/**/variables.scss'));
17
+ return files;
20
18
  };
21
- exports.default = { styles, variables };
19
+ export default { styles, variables };
package/build/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  import './types';
2
2
  export * from './components';
3
+ export { default as entry } from './entry';
package/build/index.js CHANGED
@@ -1,18 +1,3 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- require("./types");
18
- __exportStar(require("./components"), exports);
1
+ import './types';
2
+ export * from './components';
3
+ export { default as entry } from './entry';
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  },
9
9
  "description": "UI",
10
10
  "devDependencies": {
11
- "@esportsplus/webpack": "^0.0.36"
11
+ "@esportsplus/webpack": "^0.0.37"
12
12
  },
13
13
  "main": "./build/index.js",
14
14
  "name": "@esportsplus/ui",
@@ -18,5 +18,5 @@
18
18
  "prepublishOnly": "npm run build"
19
19
  },
20
20
  "types": "./build/index.d.ts",
21
- "version": "0.0.44"
21
+ "version": "0.0.45"
22
22
  }
package/src/entry.ts CHANGED
@@ -1,33 +1,30 @@
1
- import { entry, resolve } from '@esportsplus/webpack';
1
+ import { resolve } from '@esportsplus/webpack';
2
2
 
3
3
 
4
- type Entry = ReturnType<typeof entry.sass>;
5
-
6
-
7
- const styles = (entry: Entry, { font, fonts, normalizer }: { font?: string, fonts?: string[], normalizer?: boolean } = {}) => {
8
- entry.import.unshift( ...resolve.glob(`components/**/index.scss`) );
9
- entry.import.push( ...resolve.glob(`css-utilities/**/index.scss`) );
4
+ const styles = (files: string[], { font, fonts, normalizer }: { font?: string, fonts?: string[], normalizer?: boolean } = {}) => {
5
+ files.unshift( ...resolve.glob(`./components/**/index.scss`) );
6
+ files.push( ...resolve.glob(`./css-utilities/**/index.scss`) );
10
7
 
11
8
  fonts = font ? [font] : fonts;
12
9
 
13
10
  if (fonts) {
14
- entry.import.unshift(
11
+ files.unshift(
15
12
  ...resolve.glob(`../storage/fonts/{${fonts.join(',')}}/index.css`)
16
13
  );
17
14
  }
18
15
 
19
16
  if (normalizer) {
20
- entry.import.unshift('modern-normalize/modern-normalize.css');
17
+ files.unshift('modern-normalize/modern-normalize.css');
21
18
  }
22
19
 
23
- return entry;
20
+ return files;
24
21
  };
25
22
 
26
- const variables = (entry: Entry) => {
27
- entry.import.unshift( ...resolve.glob(`components/**/variables.scss`) );
28
- entry.import.push( ...resolve.glob(`css-utilities/**/variables.scss`) );
23
+ const variables = (files: string[]) => {
24
+ files.unshift( ...resolve.glob('./components/**/variables.scss') );
25
+ files.push( ...resolve.glob('./css-utilities/**/variables.scss') );
29
26
 
30
- return entry;
27
+ return files;
31
28
  };
32
29
 
33
30
 
package/src/index.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import './types';
2
2
 
3
3
 
4
- export * from './components';
4
+ export * from './components';
5
+ export { default as entry } from './entry';