@esportsplus/ui 0.7.16 → 0.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (165) hide show
  1. package/.editorconfig +9 -9
  2. package/.gitattributes +2 -2
  3. package/build/components/clipboard/index.d.ts +1 -0
  4. package/build/components/clipboard/index.js +1 -0
  5. package/build/components/counter/index.js +16 -16
  6. package/build/components/ellipsis/index.js +6 -6
  7. package/build/components/footer/index.js +46 -46
  8. package/build/components/form/layout.js +10 -10
  9. package/build/components/link/hover.js +8 -8
  10. package/build/components/loader/index.js +15 -15
  11. package/build/components/loading/index.js +2 -2
  12. package/build/components/magnet/index.js +7 -7
  13. package/build/components/scrollbar/index.js +9 -9
  14. package/build/components/site/index.js +5 -5
  15. package/components/styles.css +1 -2
  16. package/components/variables.css +1 -3
  17. package/lib.scss +1 -1
  18. package/package.json +4 -1
  19. package/src/components/accordion/index.ts +34 -34
  20. package/src/components/accordion/scss/index.scss +16 -16
  21. package/src/components/accordion/scss/variables.scss +9 -9
  22. package/src/components/anchor/scss/index.scss +41 -41
  23. package/src/components/anchor/scss/variables.scss +4 -4
  24. package/src/components/banner/scss/index.scss +40 -40
  25. package/src/components/banner/scss/variables.scss +9 -9
  26. package/src/components/button/scss/index.scss +114 -114
  27. package/src/components/button/scss/variables.scss +66 -66
  28. package/src/components/card/scss/index.scss +35 -35
  29. package/src/components/card/scss/variables.scss +41 -41
  30. package/src/components/clipboard/index.ts +4 -3
  31. package/src/components/clipboard/scss/index.scss +3 -0
  32. package/src/components/clipboard/write.ts +8 -8
  33. package/src/components/container/scss/index.scss +8 -8
  34. package/src/components/container/scss/variables.scss +5 -5
  35. package/src/components/counter/index.ts +93 -93
  36. package/src/components/counter/scss/index.scss +61 -61
  37. package/src/components/counter/scss/variables.scss +26 -26
  38. package/src/components/ellipsis/index.ts +9 -9
  39. package/src/components/ellipsis/scss/index.scss +27 -27
  40. package/src/components/ellipsis/scss/variables.scss +4 -4
  41. package/src/components/footer/index.ts +78 -78
  42. package/src/components/footer/scss/index.scss +25 -25
  43. package/src/components/form/action.ts +80 -80
  44. package/src/components/form/index.ts +5 -5
  45. package/src/components/form/input.ts +14 -14
  46. package/src/components/form/layout.ts +25 -25
  47. package/src/components/form/types.ts +15 -15
  48. package/src/components/frame/scss/index.scss +11 -11
  49. package/src/components/grid/scss/index.scss +9 -9
  50. package/src/components/grid/scss/variables.scss +5 -5
  51. package/src/components/group/scss/index.scss +36 -36
  52. package/src/components/group/scss/variables.scss +17 -17
  53. package/src/components/highlight/index.ts +47 -47
  54. package/src/components/highlight/scss/index.scss +4 -4
  55. package/src/components/highlight/scss/variables.scss +3 -3
  56. package/src/components/icon/scss/index.scss +16 -16
  57. package/src/components/icon/scss/variables.scss +7 -7
  58. package/src/components/json/download.ts +14 -14
  59. package/src/components/json/index.ts +3 -3
  60. package/src/components/link/hover.ts +18 -18
  61. package/src/components/link/index.ts +3 -3
  62. package/src/components/link/scss/index.scss +65 -65
  63. package/src/components/link/scss/variables.scss +46 -46
  64. package/src/components/loader/index.ts +34 -34
  65. package/src/components/loader/scss/index.scss +68 -68
  66. package/src/components/loader/scss/variables.scss +5 -5
  67. package/src/components/loading/index.ts +7 -7
  68. package/src/components/loading/scss/index.scss +16 -16
  69. package/src/components/loading/scss/variables.scss +5 -5
  70. package/src/components/magnet/index.ts +54 -54
  71. package/src/components/magnet/scss/index.scss +16 -16
  72. package/src/components/magnet/scss/variables.scss +4 -4
  73. package/src/components/modal/scss/index.scss +34 -34
  74. package/src/components/modal/scss/variables.scss +6 -6
  75. package/src/components/number/index.ts +23 -23
  76. package/src/components/page/index.ts +14 -14
  77. package/src/components/page/scss/index.scss +31 -31
  78. package/src/components/page/scss/variables.scss +15 -15
  79. package/src/components/root/index.ts +4 -4
  80. package/src/components/root/onclick.ts +20 -20
  81. package/src/components/root/scss/index.scss +94 -94
  82. package/src/components/root/scss/variables.scss +100 -100
  83. package/src/components/row/scss/index.scss +7 -7
  84. package/src/components/scrollbar/index.ts +43 -43
  85. package/src/components/scrollbar/scss/index.scss +70 -70
  86. package/src/components/scrollbar/scss/variables.scss +6 -6
  87. package/src/components/sidebar/scss/index.scss +49 -49
  88. package/src/components/sidebar/scss/variables.scss +20 -20
  89. package/src/components/site/index.ts +26 -26
  90. package/src/components/site/scss/index.scss +3 -3
  91. package/src/components/text/scss/index.scss +9 -9
  92. package/src/components/text/scss/variables.scss +8 -8
  93. package/src/components/thumbnail/scss/index.scss +7 -7
  94. package/src/components/thumbnail/scss/variables.scss +7 -7
  95. package/src/components/tooltip/index.ts +84 -84
  96. package/src/components/tooltip/scss/_center.scss +13 -13
  97. package/src/components/tooltip/scss/_east.scss +34 -34
  98. package/src/components/tooltip/scss/_north.scss +34 -34
  99. package/src/components/tooltip/scss/_south.scss +35 -35
  100. package/src/components/tooltip/scss/_west.scss +34 -34
  101. package/src/components/tooltip/scss/index.scss +93 -93
  102. package/src/components/tooltip/scss/variables.scss +24 -24
  103. package/src/components/truncate/index.ts +13 -13
  104. package/src/components/typewriter/index.ts +53 -53
  105. package/src/components/typewriter/scss/index.scss +14 -14
  106. package/src/css-utilities/[margin,padding]/scss/index.scss +41 -41
  107. package/src/css-utilities/[margin,padding]/scss/variables.scss +54 -54
  108. package/src/css-utilities/absolute/scss/index.scss +36 -36
  109. package/src/css-utilities/background/scss/variables.scss +27 -27
  110. package/src/css-utilities/border/scss/index.scss +21 -21
  111. package/src/css-utilities/border/scss/variables.scss +66 -66
  112. package/src/css-utilities/color/scss/variables.scss +31 -31
  113. package/src/css-utilities/disabled/scss/index.scss +4 -4
  114. package/src/css-utilities/flex/scss/index.scss +65 -65
  115. package/src/css-utilities/glass/scss/index.scss +2 -2
  116. package/src/css-utilities/glass/scss/variables.scss +2 -2
  117. package/src/css-utilities/hidden/scss/index.scss +28 -28
  118. package/src/css-utilities/index.scss +14 -14
  119. package/src/css-utilities/inline/scss/index.scss +7 -7
  120. package/src/css-utilities/line-height/scss/variables.scss +10 -10
  121. package/src/css-utilities/not-allowed/scss/index.scss +7 -7
  122. package/src/css-utilities/overflow/scss/index.scss +4 -4
  123. package/src/css-utilities/pointer/scss/index.scss +5 -5
  124. package/src/css-utilities/size/scss/variables.scss +12 -12
  125. package/src/css-utilities/squircle/scss/index.scss +4 -4
  126. package/src/css-utilities/text/scss/index.scss +89 -89
  127. package/src/css-utilities/text/scss/variables.scss +31 -31
  128. package/src/css-utilities/viewport/scss/index.scss +4 -4
  129. package/src/css-utilities/width/scss/index.scss +3 -3
  130. package/src/css-utilities/width/scss/variables.scss +9 -9
  131. package/src/index.ts +18 -18
  132. package/src/lib/index.scss +7 -7
  133. package/src/lib/scss/breakpoint.scss +41 -41
  134. package/src/lib/scss/color.scss +1 -1
  135. package/src/lib/scss/css-variables.scss +16 -16
  136. package/src/lib/scss/list.scss +77 -77
  137. package/src/lib/scss/map.scss +1 -1
  138. package/src/lib/scss/position.scss +55 -55
  139. package/src/lib/scss/string.scss +34 -34
  140. package/src/tokens/index.scss +11 -11
  141. package/src/tokens/scss/border-radius.scss +12 -12
  142. package/src/tokens/scss/border-width.scss +6 -6
  143. package/src/tokens/scss/box-shadow.scss +39 -21
  144. package/src/tokens/scss/color.scss +64 -65
  145. package/src/tokens/scss/font-size.scss +16 -16
  146. package/src/tokens/scss/font-weight.scss +6 -6
  147. package/src/tokens/scss/line-height.scss +6 -6
  148. package/src/tokens/scss/size.scss +13 -13
  149. package/src/tokens/scss/spacer.scss +10 -8
  150. package/src/tokens/scss/state.scss +87 -87
  151. package/src/tokens/scss/transition-duration.scss +1 -1
  152. package/storage/fonts/montserrat/index.css +79 -79
  153. package/storage/psd/Color Palette.psd +0 -0
  154. package/tokens.scss +1 -1
  155. package/tsconfig.json +2 -2
  156. package/utilities/styles.css +1 -1
  157. package/utilities/variables.css +1 -1
  158. package/webpack.config.ts +25 -25
  159. package/.github/dependabot.yml +0 -23
  160. package/.github/workflows/bump.yml +0 -7
  161. package/.github/workflows/publish.yml +0 -14
  162. package/src/components/border/scss/index.scss +0 -10
  163. package/src/components/border/scss/variables.scss +0 -6
  164. package/src/components/bubble/scss/index.scss +0 -30
  165. package/src/components/bubble/scss/variables.scss +0 -19
@@ -1,70 +1,70 @@
1
- // Hide Chrome Mobile Scrollbar
2
- ::-webkit-scrollbar,
3
- ::-webkit-scrollbar-track,
4
- ::-webkit-scrollbar-thumb,
5
- ::-webkit-scrollbar-thumb:window-inactive {
6
- background: transparent;
7
- box-shadow: unset;
8
- }
9
-
10
- .scrollbar {
11
- height: 100%;
12
- z-index: 9;
13
-
14
-
15
- &,
16
- &::before {
17
- position: absolute;
18
- right: 0;
19
- top: 0;
20
- transition: opacity var(--transition-duration) ease-in-out;
21
- width: var(--width);
22
- }
23
-
24
- &::before {
25
- background: var(--background-default);
26
- border-radius: 1px 0 0 1px;
27
- content: '';
28
- height: var(--height);
29
- transform: var(--translate);
30
- transform-origin: top center;
31
- }
32
-
33
-
34
- &--fixed {
35
- position: fixed;
36
- }
37
-
38
- &--hidden {
39
- opacity: 0;
40
- }
41
-
42
-
43
- &-container {
44
- display: flex;
45
- flex-flow: column;
46
- overflow: hidden;
47
- position: relative;
48
- }
49
-
50
- &-content {
51
- height: 100%;
52
- margin-right: calc(var(--scrollbar-width) * -1);
53
- overflow-x: hidden;
54
- overflow-y: scroll;
55
- scrollbar-gutter: stable;
56
- scroll-behavior: smooth;
57
- width: calc(100% + var(--scrollbar-width));
58
-
59
- &--snap {
60
- overflow: auto;
61
- scroll-snap-type: both mandatory;
62
- overscroll-behavior-x: contain;
63
-
64
- > * {
65
- scroll-snap-stop: normal;
66
- scroll-snap-align: center;
67
- }
68
- }
69
- }
70
- }
1
+ // Hide Chrome Mobile Scrollbar
2
+ ::-webkit-scrollbar,
3
+ ::-webkit-scrollbar-track,
4
+ ::-webkit-scrollbar-thumb,
5
+ ::-webkit-scrollbar-thumb:window-inactive {
6
+ background: transparent;
7
+ box-shadow: unset;
8
+ }
9
+
10
+ .scrollbar {
11
+ height: 100%;
12
+ z-index: 9;
13
+
14
+
15
+ &,
16
+ &::before {
17
+ position: absolute;
18
+ right: 0;
19
+ top: 0;
20
+ transition: opacity var(--transition-duration) ease-in-out;
21
+ width: var(--width);
22
+ }
23
+
24
+ &::before {
25
+ background: var(--background-default);
26
+ border-radius: 1px 0 0 1px;
27
+ content: '';
28
+ height: var(--height);
29
+ transform: var(--translate);
30
+ transform-origin: top center;
31
+ }
32
+
33
+
34
+ &--fixed {
35
+ position: fixed;
36
+ }
37
+
38
+ &--hidden {
39
+ opacity: 0;
40
+ }
41
+
42
+
43
+ &-container {
44
+ display: flex;
45
+ flex-flow: column;
46
+ overflow: hidden;
47
+ position: relative;
48
+ }
49
+
50
+ &-content {
51
+ height: 100%;
52
+ margin-right: calc(var(--scrollbar-width) * -1);
53
+ overflow-x: hidden;
54
+ overflow-y: scroll;
55
+ scrollbar-gutter: stable;
56
+ scroll-behavior: smooth;
57
+ width: calc(100% + var(--scrollbar-width));
58
+
59
+ &--snap {
60
+ overflow: auto;
61
+ scroll-snap-type: both mandatory;
62
+ overscroll-behavior-x: contain;
63
+
64
+ > * {
65
+ scroll-snap-stop: normal;
66
+ scroll-snap-align: center;
67
+ }
68
+ }
69
+ }
70
+ }
@@ -1,6 +1,6 @@
1
- .scrollbar {
2
- --background-default: transparent;
3
- --height: 0;
4
- --translate: translate3d(0, 0, 0);
5
- --width: 4px;
6
- }
1
+ .scrollbar {
2
+ --background-default: transparent;
3
+ --height: 0;
4
+ --translate: translate3d(0, 0, 0);
5
+ --width: 4px;
6
+ }
@@ -1,49 +1,49 @@
1
- @use '/lib';
2
- @use '/tokens';
3
-
4
- .sidebar {
5
- @include lib.position(absolute, var(--margin-vertical) null var(--margin-vertical) null);
6
- cursor: default;
7
- height: calc(100% - (var(--margin-vertical) * 2));
8
- overflow: hidden;
9
- transition:
10
- max-width var(--transition-duration) ease-in-out,
11
- opacity var(--transition-duration) ease-in-out,
12
- transform var(--transition-duration) ease-in-out;
13
- width: min(var(--width), calc(100% - (var(--margin-horizontal) * 2)));
14
- z-index: 1;
15
-
16
-
17
- @include tokens.state(inactive) {
18
- input[type='password'] {
19
- display: none;
20
- }
21
- }
22
-
23
-
24
- &--e {
25
- right: var(--margin-horizontal);
26
-
27
- &.sidebar--offscreen {
28
- @include tokens.state(inactive) {
29
- transform: translateX(var(--width));
30
- }
31
- }
32
- }
33
-
34
- &--w {
35
- left: var(--margin-horizontal);
36
-
37
- &.sidebar--offscreen {
38
- @include tokens.state(inactive) {
39
- transform: translateX(calc(var(--width) * -1));
40
- }
41
- }
42
- }
43
-
44
-
45
- &-content {
46
- flex: 0 0 var(--width-default);
47
- width: var(--width-default);
48
- }
49
- }
1
+ @use '/lib';
2
+ @use '/tokens';
3
+
4
+ .sidebar {
5
+ @include lib.position(absolute, var(--margin-vertical) null var(--margin-vertical) null);
6
+ cursor: default;
7
+ height: calc(100% - (var(--margin-vertical) * 2));
8
+ overflow: hidden;
9
+ transition:
10
+ max-width var(--transition-duration) ease-in-out,
11
+ opacity var(--transition-duration) ease-in-out,
12
+ transform var(--transition-duration) ease-in-out;
13
+ width: min(var(--width), calc(100% - (var(--margin-horizontal) * 2)));
14
+ z-index: 1;
15
+
16
+
17
+ @include tokens.state(inactive) {
18
+ input[type='password'] {
19
+ display: none;
20
+ }
21
+ }
22
+
23
+
24
+ &--e {
25
+ right: var(--margin-horizontal);
26
+
27
+ &.sidebar--offscreen {
28
+ @include tokens.state(inactive) {
29
+ transform: translateX(var(--width));
30
+ }
31
+ }
32
+ }
33
+
34
+ &--w {
35
+ left: var(--margin-horizontal);
36
+
37
+ &.sidebar--offscreen {
38
+ @include tokens.state(inactive) {
39
+ transform: translateX(calc(var(--width) * -1));
40
+ }
41
+ }
42
+ }
43
+
44
+
45
+ &-content {
46
+ flex: 0 0 var(--width-default);
47
+ width: var(--width-default);
48
+ }
49
+ }
@@ -1,20 +1,20 @@
1
- @use '/tokens';
2
-
3
- .sidebar {
4
- --margin-horizontal: 0px;
5
- --margin-vertical: 0px;
6
- --width: var(--width-default);
7
- --width-closed: var(--width-default);
8
- --width-default: 320px;
9
-
10
-
11
- @include tokens.state(default) {
12
- --width: var(--width-closed);
13
- }
14
-
15
-
16
- &--floating {
17
- --margin-horizontal: var(--size-100);
18
- --margin-vertical: var(--size-100);
19
- }
20
- }
1
+ @use '/tokens';
2
+
3
+ .sidebar {
4
+ --margin-horizontal: 0px;
5
+ --margin-vertical: 0px;
6
+ --width: var(--width-default);
7
+ --width-closed: var(--width-default);
8
+ --width-default: 320px;
9
+
10
+
11
+ @include tokens.state(default) {
12
+ --width: var(--width-closed);
13
+ }
14
+
15
+
16
+ &--floating {
17
+ --margin-horizontal: var(--size-100);
18
+ --margin-vertical: var(--size-100);
19
+ }
20
+ }
@@ -1,27 +1,27 @@
1
- import { html } from '@esportsplus/template';
2
- import { onclick } from '~/components/root';
3
- import scrollbar from '~/components/scrollbar';
4
-
5
-
6
- type Data = {
7
- attributes?: Record<string, unknown>;
8
- content?: any;
9
- scrollbar?: Parameters<typeof scrollbar>[0];
10
- };
11
-
12
-
13
- export default ({ attributes, content, scrollbar: sb }: Data) => {
14
- sb ??= {};
15
- sb.attributes ??= {};
16
- sb.attributes.style ??= '--background-default: var(--color-black-400);';
17
- sb.fixed ??= true;
18
-
19
- let { html: h, parent } = scrollbar(sb);
20
-
21
- return html`
22
- <section class='site' ${attributes} ${{ onclick }} ${parent.attributes}>
23
- ${content || ''}
24
- ${h}
25
- </section>
26
- `;
1
+ import { html } from '@esportsplus/template';
2
+ import { onclick } from '~/components/root';
3
+ import scrollbar from '~/components/scrollbar';
4
+
5
+
6
+ type Data = {
7
+ attributes?: Record<string, unknown>;
8
+ content?: any;
9
+ scrollbar?: Parameters<typeof scrollbar>[0];
10
+ };
11
+
12
+
13
+ export default ({ attributes, content, scrollbar: sb }: Data) => {
14
+ sb ??= {};
15
+ sb.attributes ??= {};
16
+ sb.attributes.style ??= '--background-default: var(--color-black-400);';
17
+ sb.fixed ??= true;
18
+
19
+ let { html: h, parent } = scrollbar(sb);
20
+
21
+ return html`
22
+ <section class='site' ${attributes} ${{ onclick }} ${parent.attributes}>
23
+ ${content || ''}
24
+ ${h}
25
+ </section>
26
+ `;
27
27
  };
@@ -1,3 +1,3 @@
1
- .site {
2
- z-index: 0;
3
- }
1
+ .site {
2
+ z-index: 0;
3
+ }
@@ -1,9 +1,9 @@
1
- .text {
2
- color: var(--color);
3
- font-size: var(--font-size);
4
- font-weight: var(--font-weight);
5
- line-height: var(--line-height);
6
- position: relative;
7
- transition: color var(--transition-duration) ease-in-out;
8
- width: var(--width);
9
- }
1
+ .text {
2
+ color: var(--color);
3
+ font-size: var(--font-size);
4
+ font-weight: var(--font-weight);
5
+ line-height: var(--line-height);
6
+ position: relative;
7
+ transition: color var(--transition-duration) ease-in-out;
8
+ width: var(--width);
9
+ }
@@ -1,8 +1,8 @@
1
- .text {
2
- --color: var(--color-default);
3
- --color-default: inherit;
4
- --font-size: var(--font-size-400);
5
- --font-weight: var(--font-weight-400);
6
- --line-height: var(--line-height-400);
7
- --width: auto;
8
- }
1
+ .text {
2
+ --color: var(--color-default);
3
+ --color-default: inherit;
4
+ --font-size: var(--font-size-400);
5
+ --font-weight: var(--font-weight-400);
6
+ --line-height: var(--line-height-400);
7
+ --width: auto;
8
+ }
@@ -1,7 +1,7 @@
1
- .thumbnail {
2
- background: var(--background);
3
- border-radius: var(--border-radius);
4
- height: var(--height);
5
- position: relative;
6
- width: var(--width);
7
- }
1
+ .thumbnail {
2
+ background: var(--background);
3
+ border-radius: var(--border-radius);
4
+ height: var(--height);
5
+ position: relative;
6
+ width: var(--width);
7
+ }
@@ -1,7 +1,7 @@
1
- .thumbnail {
2
- --background: transparent;
3
- --border-radius: var(--border-radius-300);
4
- --height: var(--size);
5
- --size: var(--size-700);
6
- --width: var(--size);
7
- }
1
+ .thumbnail {
2
+ --background: transparent;
3
+ --border-radius: var(--border-radius-300);
4
+ --height: var(--size);
5
+ --size: var(--size-700);
6
+ --width: var(--size);
7
+ }
@@ -1,85 +1,85 @@
1
- import { reactive } from '@esportsplus/reactivity';
2
- import root from '~/components/root';
3
-
4
-
5
- let queue: (VoidFunction | (() => Promise<void>))[] = [],
6
- running = false,
7
- scheduled = false;
8
-
9
-
10
- async function frame() {
11
- if (running) {
12
- return;
13
- }
14
-
15
- running = true;
16
-
17
- let item;
18
-
19
- while (item = queue.pop()) {
20
- await item();
21
- }
22
-
23
- running = false;
24
- }
25
-
26
-
27
- const onclick = (data: { active?: boolean, toggle?: boolean } = {}) => {
28
- let state = reactive({
29
- active: data.active || false
30
- });
31
-
32
- return {
33
- attributes: {
34
- class: () => {
35
- return `tooltip ${state.active ? '--active' : ''}`;
36
- },
37
- onclick: function(this: HTMLElement, e: Event) {
38
- let active = true,
39
- node = e.target as Node | null;
40
-
41
- if (data.toggle && ( this.contains(node) || this.isSameNode(node) )) {
42
- active = !state.active;
43
- }
44
-
45
- frame();
46
- state.active = active;
47
-
48
- if (active) {
49
- queue.push(() => state.active = false);
50
- }
51
-
52
- if (!scheduled) {
53
- root.onclick.add(() => {
54
- frame();
55
- scheduled = false;
56
- });
57
- scheduled = true;
58
- }
59
- }
60
- },
61
- state
62
- };
63
- };
64
-
65
- const onhover = (active: boolean = false) => {
66
- let state = reactive({ active });
67
-
68
- return {
69
- attributes: {
70
- class: () => `tooltip ${state.active ? '--active' : ''}`,
71
- onmouseover: () => {
72
- state.active = true;
73
- },
74
- onmouseout: () => {
75
- state.active = false;
76
- }
77
- },
78
- toggle: () => {
79
- state.active = !state.active;
80
- }
81
- };
82
- };
83
-
84
-
1
+ import { reactive } from '@esportsplus/reactivity';
2
+ import root from '~/components/root';
3
+
4
+
5
+ let queue: (VoidFunction | (() => Promise<void>))[] = [],
6
+ running = false,
7
+ scheduled = false;
8
+
9
+
10
+ async function frame() {
11
+ if (running) {
12
+ return;
13
+ }
14
+
15
+ running = true;
16
+
17
+ let item;
18
+
19
+ while (item = queue.pop()) {
20
+ await item();
21
+ }
22
+
23
+ running = false;
24
+ }
25
+
26
+
27
+ const onclick = (data: { active?: boolean, toggle?: boolean } = {}) => {
28
+ let state = reactive({
29
+ active: data.active || false
30
+ });
31
+
32
+ return {
33
+ attributes: {
34
+ class: () => {
35
+ return `tooltip ${state.active ? '--active' : ''}`;
36
+ },
37
+ onclick: function(this: HTMLElement, e: Event) {
38
+ let active = true,
39
+ node = e.target as Node | null;
40
+
41
+ if (data.toggle && ( this.contains(node) || this.isSameNode(node) )) {
42
+ active = !state.active;
43
+ }
44
+
45
+ frame();
46
+ state.active = active;
47
+
48
+ if (active) {
49
+ queue.push(() => state.active = false);
50
+ }
51
+
52
+ if (!scheduled) {
53
+ root.onclick.add(() => {
54
+ frame();
55
+ scheduled = false;
56
+ });
57
+ scheduled = true;
58
+ }
59
+ }
60
+ },
61
+ state
62
+ };
63
+ };
64
+
65
+ const onhover = (active: boolean = false) => {
66
+ let state = reactive({ active });
67
+
68
+ return {
69
+ attributes: {
70
+ class: () => `tooltip ${state.active ? '--active' : ''}`,
71
+ onmouseover: () => {
72
+ state.active = true;
73
+ },
74
+ onmouseout: () => {
75
+ state.active = false;
76
+ }
77
+ },
78
+ toggle: () => {
79
+ state.active = !state.active;
80
+ }
81
+ };
82
+ };
83
+
84
+
85
85
  export default { onclick, onhover };
@@ -1,13 +1,13 @@
1
- @mixin center($active) {
2
- &--c {
3
- bottom: 50%;
4
- position: absolute;
5
- right: 50%;
6
- transform: translate(50%, 50%) scale(var(--scaleX), var(--scaleY));
7
- transform-origin: center center;
8
-
9
- #{$active} {
10
- transform: translate(50%, 50%) scale(1);
11
- }
12
- }
13
- }
1
+ @mixin center($active) {
2
+ &--c {
3
+ bottom: 50%;
4
+ position: absolute;
5
+ right: 50%;
6
+ transform: translate(50%, 50%) scale(var(--scaleX), var(--scaleY));
7
+ transform-origin: center center;
8
+
9
+ #{$active} {
10
+ transform: translate(50%, 50%) scale(1);
11
+ }
12
+ }
13
+ }