@esportsplus/ui 0.46.0 → 0.47.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.
- package/.github/workflows/bump.yml +2 -2
- package/.github/workflows/dependabot.yml +1 -1
- package/.github/workflows/publish.yml +3 -3
- package/README.md +288 -0
- package/build/components/accordion/index.d.ts +16 -16
- package/build/components/accordion/index.js +28 -20
- package/build/components/alert/index.d.ts +1 -1
- package/build/components/alert/index.js +82 -57
- package/build/components/back/index.d.ts +8 -7
- package/build/components/back/index.js +11 -11
- package/build/components/button/index.d.ts +21 -20
- package/build/components/button/index.js +52 -27
- package/build/components/checkbox/index.d.ts +3 -3
- package/build/components/checkbox/index.js +39 -25
- package/build/components/clipboard/index.d.ts +90 -70
- package/build/components/clipboard/onclick.d.ts +1 -1
- package/build/components/clipboard/onclick.js +31 -21
- package/build/components/counter/index.d.ts +2 -2
- package/build/components/counter/index.js +72 -36
- package/build/components/ellipsis/index.d.ts +1 -1
- package/build/components/ellipsis/index.js +7 -8
- package/build/components/form/action.d.ts +1 -1
- package/build/components/form/action.js +13 -15
- package/build/components/form/index.d.ts +1 -1
- package/build/components/highlight/index.d.ts +16 -16
- package/build/components/highlight/index.js +26 -18
- package/build/components/icon/index.d.ts +11 -10
- package/build/components/icon/index.js +9 -6
- package/build/components/input/index.d.ts +2 -2
- package/build/components/input/index.js +38 -22
- package/build/components/loader/index.d.ts +16 -16
- package/build/components/loader/index.js +68 -50
- package/build/components/loading/index.d.ts +1 -1
- package/build/components/loading/index.js +9 -9
- package/build/components/radio/index.d.ts +1 -1
- package/build/components/range/index.d.ts +2 -2
- package/build/components/range/index.js +50 -27
- package/build/components/scrollbar/index.d.ts +12 -11
- package/build/components/scrollbar/index.js +42 -37
- package/build/components/select/index.d.ts +1 -1
- package/build/components/select/index.js +121 -86
- package/build/components/switch/index.d.ts +1 -1
- package/build/components/textarea/index.d.ts +2 -2
- package/build/components/textarea/index.js +37 -22
- package/build/components/tooltip/index.d.ts +180 -140
- package/build/components/tooltip/menu.d.ts +12 -11
- package/build/components/tooltip/menu.js +33 -33
- package/build/components/tooltip/onclick.d.ts +1121 -1100
- package/build/components/tooltip/onclick.js +26 -16
- package/build/components/tooltip/onhover.d.ts +16 -16
- package/build/components/tooltip/onhover.js +28 -18
- package/build/components/typewriter/index.d.ts +11 -10
- package/build/components/typewriter/index.js +25 -12
- package/build/themes/dark/alert.d.ts +1 -1
- package/build/themes/dark/input.d.ts +10 -8
- package/build/themes/dark/select.d.ts +90 -70
- package/build/themes/dark/textarea.d.ts +10 -8
- package/package.json +18 -14
- package/src/components/button/index.ts +21 -13
- package/src/components/counter/index.ts +6 -6
- package/src/components/select/index.ts +13 -1
- package/tsconfig.json +6 -1
|
@@ -5,12 +5,12 @@ on:
|
|
|
5
5
|
types: [published]
|
|
6
6
|
workflow_dispatch:
|
|
7
7
|
workflow_run:
|
|
8
|
-
workflows: [bump]
|
|
8
|
+
workflows: [bump version]
|
|
9
9
|
types:
|
|
10
10
|
- completed
|
|
11
11
|
|
|
12
12
|
jobs:
|
|
13
13
|
publish:
|
|
14
14
|
secrets:
|
|
15
|
-
|
|
16
|
-
uses: esportsplus/
|
|
15
|
+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
16
|
+
uses: esportsplus/typescript/.github/workflows/publish.yml@main
|
package/README.md
ADDED
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
# @esportsplus/ui
|
|
2
|
+
|
|
3
|
+
A reactive component library built on compile-time template transformations. Provides typed, tree-shakeable UI components with integrated SCSS theming.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add @esportsplus/ui
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Dependencies
|
|
12
|
+
|
|
13
|
+
- `@esportsplus/template` - Tagged template literals with compile-time transforms
|
|
14
|
+
- `@esportsplus/reactivity` - Reactive state management
|
|
15
|
+
- `@esportsplus/action` - Response/error handling
|
|
16
|
+
- `@esportsplus/utilities` - Core utilities
|
|
17
|
+
|
|
18
|
+
## Quick Start
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
import { button, form, input, select } from '@esportsplus/ui';
|
|
22
|
+
import { html } from '@esportsplus/template';
|
|
23
|
+
|
|
24
|
+
// Simple component
|
|
25
|
+
html`${button({}, 'Click Me')}`;
|
|
26
|
+
|
|
27
|
+
// Form with validation
|
|
28
|
+
html`
|
|
29
|
+
${form.action({
|
|
30
|
+
action: async ({ input: data }) => {
|
|
31
|
+
const result = await api.submit(data);
|
|
32
|
+
return result.ok ? { errors: [] } : { errors: result.errors };
|
|
33
|
+
}
|
|
34
|
+
}, html`
|
|
35
|
+
${input({ name: 'email', type: 'email' })}
|
|
36
|
+
${button({}, 'Submit')}
|
|
37
|
+
`)}
|
|
38
|
+
`;
|
|
39
|
+
|
|
40
|
+
// Select with reactive state
|
|
41
|
+
html`
|
|
42
|
+
${select({
|
|
43
|
+
options: { a: 'Option A', b: 'Option B' },
|
|
44
|
+
selected: 'a'
|
|
45
|
+
}, (state) => html`Selected: ${state.selected}`)}
|
|
46
|
+
`;
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Components
|
|
50
|
+
|
|
51
|
+
### Form Controls
|
|
52
|
+
| Component | Description | Variants |
|
|
53
|
+
|-----------|-------------|----------|
|
|
54
|
+
| `input` | Text input with validation state | - |
|
|
55
|
+
| `textarea` | Multi-line text input | - |
|
|
56
|
+
| `checkbox` | Checkbox with label | - |
|
|
57
|
+
| `radio` | Radio button group | - |
|
|
58
|
+
| `range` | Range slider | - |
|
|
59
|
+
| `select` | Dropdown with custom options | - |
|
|
60
|
+
| `switch` | Toggle switch | - |
|
|
61
|
+
| `form` | Form wrapper | `form.action`, `form.input` |
|
|
62
|
+
|
|
63
|
+
### Interactive
|
|
64
|
+
| Component | Description | Variants |
|
|
65
|
+
|-----------|-------------|----------|
|
|
66
|
+
| `button` | Standard button | `button.hold` |
|
|
67
|
+
| `tooltip` | Popup content | `tooltip.menu`, `tooltip.onclick`, `tooltip.onhover` |
|
|
68
|
+
| `accordion` | Collapsible sections | - |
|
|
69
|
+
| `clipboard` | Copy to clipboard | `clipboard.onclick`, `clipboard.write` |
|
|
70
|
+
| `alert` | Notifications | error, info, success types |
|
|
71
|
+
|
|
72
|
+
### Display
|
|
73
|
+
| Component | Description |
|
|
74
|
+
|-----------|-------------|
|
|
75
|
+
| `counter` | Animated number with currency formatting |
|
|
76
|
+
| `loader` | Loading spinner |
|
|
77
|
+
| `loading` | Border loading indicator |
|
|
78
|
+
| `typewriter` | Animated typing effect |
|
|
79
|
+
| `highlight` | Viewport intersection highlight |
|
|
80
|
+
| `ellipsis` | Animated dots |
|
|
81
|
+
| `icon` | SVG sprite wrapper |
|
|
82
|
+
| `number` | Number formatting |
|
|
83
|
+
| `truncate` | Text truncation |
|
|
84
|
+
| `json` | JSON display |
|
|
85
|
+
|
|
86
|
+
### Layout
|
|
87
|
+
| Component | Description |
|
|
88
|
+
|-----------|-------------|
|
|
89
|
+
| `scrollbar` | Custom scrollbar container |
|
|
90
|
+
| `frame` | Scrollable frame |
|
|
91
|
+
| `sidebar` | Side navigation |
|
|
92
|
+
| `site` | Site wrapper |
|
|
93
|
+
| `overlay` | Modal/overlay container |
|
|
94
|
+
|
|
95
|
+
### Utility
|
|
96
|
+
| Component | Description |
|
|
97
|
+
|-----------|-------------|
|
|
98
|
+
| `back` | Back navigation link |
|
|
99
|
+
| `root` | Global event coordination (`root.onclick`) |
|
|
100
|
+
| `template` | Template factory helper |
|
|
101
|
+
|
|
102
|
+
## Component Patterns
|
|
103
|
+
|
|
104
|
+
### Factory Pattern
|
|
105
|
+
|
|
106
|
+
Components use `template.factory()` supporting flexible call signatures:
|
|
107
|
+
|
|
108
|
+
```typescript
|
|
109
|
+
// No arguments
|
|
110
|
+
component()
|
|
111
|
+
|
|
112
|
+
// Attributes only
|
|
113
|
+
component({ class: 'custom' })
|
|
114
|
+
|
|
115
|
+
// Content only
|
|
116
|
+
component(html`<span>Content</span>`)
|
|
117
|
+
|
|
118
|
+
// Both
|
|
119
|
+
component({ class: 'custom' }, html`<span>Content</span>`)
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Reactive State
|
|
123
|
+
|
|
124
|
+
Components can accept and return reactive state:
|
|
125
|
+
|
|
126
|
+
```typescript
|
|
127
|
+
import { reactive } from '@esportsplus/reactivity';
|
|
128
|
+
|
|
129
|
+
let state = reactive({ active: false });
|
|
130
|
+
|
|
131
|
+
accordion({ state }, html`
|
|
132
|
+
${() => state.active ? 'Open' : 'Closed'}
|
|
133
|
+
`);
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Form Integration
|
|
137
|
+
|
|
138
|
+
```typescript
|
|
139
|
+
form.action({
|
|
140
|
+
action: async ({ input, response }) => {
|
|
141
|
+
// input: parsed FormData with dot-notation support
|
|
142
|
+
// response: error handling utilities
|
|
143
|
+
return { errors: [] };
|
|
144
|
+
}
|
|
145
|
+
}, content);
|
|
146
|
+
|
|
147
|
+
// Input with error state
|
|
148
|
+
form.input(element, { error: 'Required field' });
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## Styling
|
|
152
|
+
|
|
153
|
+
### CSS Layers
|
|
154
|
+
|
|
155
|
+
Styles are organized into layers for proper cascade:
|
|
156
|
+
|
|
157
|
+
```
|
|
158
|
+
@layer normalize
|
|
159
|
+
@layer components
|
|
160
|
+
@layer themes
|
|
161
|
+
@layer css-utilities
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### Importing Styles
|
|
165
|
+
|
|
166
|
+
```scss
|
|
167
|
+
// All component styles
|
|
168
|
+
@use '@esportsplus/ui/*.scss';
|
|
169
|
+
|
|
170
|
+
// Specific component
|
|
171
|
+
@use '@esportsplus/ui/button.scss';
|
|
172
|
+
|
|
173
|
+
// CSS utilities
|
|
174
|
+
@use '@esportsplus/ui/css-utilities.scss';
|
|
175
|
+
|
|
176
|
+
// Design tokens
|
|
177
|
+
@use '@esportsplus/ui/tokens.scss';
|
|
178
|
+
|
|
179
|
+
// Theme
|
|
180
|
+
@use '@esportsplus/ui/themes/dark/*.scss';
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### Design Tokens
|
|
184
|
+
|
|
185
|
+
Located in `tokens.scss`:
|
|
186
|
+
|
|
187
|
+
- **Colors**: `--color-{name}-{300|400|500}` (black, white, red, green, blue, purple, yellow, grey)
|
|
188
|
+
- **Sizing**: `--size-{300-800}` (12px-80px)
|
|
189
|
+
- **Spacing**: `--spacing-{0-600}`
|
|
190
|
+
- **Border**: `--border-radius-{100-900}`, `--border-width-{100-700}`
|
|
191
|
+
- **Typography**: `--font-size-*`, `--font-weight-*`, `--line-height-*`
|
|
192
|
+
|
|
193
|
+
### CSS Utilities
|
|
194
|
+
|
|
195
|
+
```html
|
|
196
|
+
<!-- Layout -->
|
|
197
|
+
<div class="--flex --flex-center --gap-200">
|
|
198
|
+
|
|
199
|
+
<!-- Spacing -->
|
|
200
|
+
<div class="--margin-400 --padding-200">
|
|
201
|
+
|
|
202
|
+
<!-- Typography -->
|
|
203
|
+
<p class="--text-uppercase --color-grey-400">
|
|
204
|
+
|
|
205
|
+
<!-- States -->
|
|
206
|
+
<div class="--skeleton --disabled --hidden">
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
### Component Variables
|
|
210
|
+
|
|
211
|
+
Each component exposes CSS custom properties:
|
|
212
|
+
|
|
213
|
+
```scss
|
|
214
|
+
.ui-button {
|
|
215
|
+
--background: var(--color-blue-400);
|
|
216
|
+
--color: var(--color-white);
|
|
217
|
+
--border-radius: var(--border-radius-300);
|
|
218
|
+
--padding-horizontal: 16px;
|
|
219
|
+
--padding-vertical: 8px;
|
|
220
|
+
}
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
## Theming
|
|
224
|
+
|
|
225
|
+
```typescript
|
|
226
|
+
// JavaScript
|
|
227
|
+
import '@esportsplus/ui/themes/dark';
|
|
228
|
+
|
|
229
|
+
// SCSS
|
|
230
|
+
@use '@esportsplus/ui/themes/dark/*.scss';
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
Themes override component variables. Create custom themes by overriding CSS custom properties.
|
|
234
|
+
|
|
235
|
+
## Build
|
|
236
|
+
|
|
237
|
+
```bash
|
|
238
|
+
pnpm build # Full build (SCSS + TypeScript)
|
|
239
|
+
pnpm build:vite # SCSS compilation only
|
|
240
|
+
pnpm build:ts # TypeScript compilation only
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
### Output Structure
|
|
244
|
+
|
|
245
|
+
```
|
|
246
|
+
build/
|
|
247
|
+
├── components/
|
|
248
|
+
│ ├── {component}/
|
|
249
|
+
│ │ ├── index.js
|
|
250
|
+
│ │ ├── index.d.ts
|
|
251
|
+
│ │ └── scss/index.scss
|
|
252
|
+
│ └── index.js
|
|
253
|
+
├── css-utilities/
|
|
254
|
+
├── themes/
|
|
255
|
+
│ ├── dark/
|
|
256
|
+
│ └── light/
|
|
257
|
+
└── fonts/
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
## TypeScript
|
|
261
|
+
|
|
262
|
+
Full type safety with zero `any` types:
|
|
263
|
+
|
|
264
|
+
```typescript
|
|
265
|
+
import type { Attributes } from '@esportsplus/template';
|
|
266
|
+
|
|
267
|
+
// Components are generic
|
|
268
|
+
template.factory<A extends Attributes, C>(fn);
|
|
269
|
+
|
|
270
|
+
// State types are explicit
|
|
271
|
+
type State = {
|
|
272
|
+
active: boolean;
|
|
273
|
+
error: string;
|
|
274
|
+
};
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
## Performance
|
|
278
|
+
|
|
279
|
+
- **Compile-time transforms**: Template expressions optimized at build
|
|
280
|
+
- **Tree-shakeable**: Import only what you use
|
|
281
|
+
- **WeakMap caching**: Memoized formatters and icons
|
|
282
|
+
- **Object pooling**: Reused queue structures
|
|
283
|
+
- **RAF batching**: Coalesced DOM updates
|
|
284
|
+
- **CSS layers**: Efficient cascade resolution
|
|
285
|
+
|
|
286
|
+
## License
|
|
287
|
+
|
|
288
|
+
MIT
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as template_a6aeaec5a75649bd8ec693d5230c50001 from '@esportsplus/template';
|
|
2
2
|
import './scss/index.scss';
|
|
3
3
|
declare const _default: {
|
|
4
4
|
(): ReturnType<(this: {
|
|
5
|
-
attributes?: Attributes | undefined;
|
|
6
|
-
content?:
|
|
7
|
-
}, attributes: Readonly<Attributes>, content:
|
|
8
|
-
<T extends Attributes>(attributes: T): ReturnType<(this: {
|
|
9
|
-
attributes?: Attributes | undefined;
|
|
10
|
-
content?:
|
|
11
|
-
}, attributes: Readonly<Attributes>, content:
|
|
12
|
-
<T extends
|
|
13
|
-
attributes?: Attributes | undefined;
|
|
14
|
-
content?:
|
|
15
|
-
}, attributes: Readonly<Attributes>, content:
|
|
16
|
-
(attributes: Attributes, content:
|
|
17
|
-
attributes?: Attributes | undefined;
|
|
18
|
-
content?:
|
|
19
|
-
}, attributes: Readonly<Attributes>, content:
|
|
5
|
+
attributes?: template_a6aeaec5a75649bd8ec693d5230c50001.Attributes | undefined;
|
|
6
|
+
content?: template_a6aeaec5a75649bd8ec693d5230c50001.Renderable<any>;
|
|
7
|
+
}, attributes: Readonly<template_a6aeaec5a75649bd8ec693d5230c50001.Attributes>, content: template_a6aeaec5a75649bd8ec693d5230c50001.Renderable<any>) => template_a6aeaec5a75649bd8ec693d5230c50001.Renderable<any>>;
|
|
8
|
+
<T extends template_a6aeaec5a75649bd8ec693d5230c50001.Attributes>(attributes: T): ReturnType<(this: {
|
|
9
|
+
attributes?: template_a6aeaec5a75649bd8ec693d5230c50001.Attributes | undefined;
|
|
10
|
+
content?: template_a6aeaec5a75649bd8ec693d5230c50001.Renderable<any>;
|
|
11
|
+
}, attributes: Readonly<template_a6aeaec5a75649bd8ec693d5230c50001.Attributes>, content: template_a6aeaec5a75649bd8ec693d5230c50001.Renderable<any>) => template_a6aeaec5a75649bd8ec693d5230c50001.Renderable<any>>;
|
|
12
|
+
<T extends template_a6aeaec5a75649bd8ec693d5230c50001.Renderable<any>>(content: T): ReturnType<(this: {
|
|
13
|
+
attributes?: template_a6aeaec5a75649bd8ec693d5230c50001.Attributes | undefined;
|
|
14
|
+
content?: template_a6aeaec5a75649bd8ec693d5230c50001.Renderable<any>;
|
|
15
|
+
}, attributes: Readonly<template_a6aeaec5a75649bd8ec693d5230c50001.Attributes>, content: template_a6aeaec5a75649bd8ec693d5230c50001.Renderable<any>) => template_a6aeaec5a75649bd8ec693d5230c50001.Renderable<any>>;
|
|
16
|
+
(attributes: template_a6aeaec5a75649bd8ec693d5230c50001.Attributes, content: template_a6aeaec5a75649bd8ec693d5230c50001.Renderable<any>): ReturnType<(this: {
|
|
17
|
+
attributes?: template_a6aeaec5a75649bd8ec693d5230c50001.Attributes | undefined;
|
|
18
|
+
content?: template_a6aeaec5a75649bd8ec693d5230c50001.Renderable<any>;
|
|
19
|
+
}, attributes: Readonly<template_a6aeaec5a75649bd8ec693d5230c50001.Attributes>, content: template_a6aeaec5a75649bd8ec693d5230c50001.Renderable<any>) => template_a6aeaec5a75649bd8ec693d5230c50001.Renderable<any>>;
|
|
20
20
|
};
|
|
21
21
|
export default _default;
|
|
@@ -1,34 +1,42 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import * as reactivity_a6aeaec5a75649bd8ec693d5230c50000 from '@esportsplus/reactivity';
|
|
2
|
+
import * as template_a6aeaec5a75649bd8ec693d5230c50001 from '@esportsplus/template';
|
|
3
3
|
import { omit } from '@esportsplus/utilities';
|
|
4
4
|
import template from '../../components/template/index.js';
|
|
5
5
|
import './scss/index.scss';
|
|
6
|
+
const template_a6aeaec5a75649bd8ec693d5230c50004 = template_a6aeaec5a75649bd8ec693d5230c50001.template(`<div><!--$--></div>`);
|
|
7
|
+
class ReactiveObject_a6aeaec5a75649bd8ec693d5230c50002 extends reactivity_a6aeaec5a75649bd8ec693d5230c50000.ReactiveObject {
|
|
8
|
+
#active = this[reactivity_a6aeaec5a75649bd8ec693d5230c50000.SIGNAL](0);
|
|
9
|
+
constructor() {
|
|
10
|
+
super(null);
|
|
11
|
+
}
|
|
12
|
+
get active() {
|
|
13
|
+
return reactivity_a6aeaec5a75649bd8ec693d5230c50000.read(this.#active);
|
|
14
|
+
}
|
|
15
|
+
set active(_v0) {
|
|
16
|
+
reactivity_a6aeaec5a75649bd8ec693d5230c50000.write(this.#active, _v0);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
6
19
|
const OMIT = ['state'];
|
|
7
20
|
let key = Symbol();
|
|
8
21
|
export default template.factory(function (attributes, content) {
|
|
9
|
-
let ref, state = attributes.state ||
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
${omit(attributes, OMIT)}
|
|
15
|
-
${{
|
|
16
|
-
class: () => {
|
|
22
|
+
let ref, state = attributes.state || new ReactiveObject_a6aeaec5a75649bd8ec693d5230c50002();
|
|
23
|
+
return (() => {
|
|
24
|
+
let root_a6aeaec5a75649bd8ec693d5230c50003 = template_a6aeaec5a75649bd8ec693d5230c50004(), element_a6aeaec5a75649bd8ec693d5230c50005 = root_a6aeaec5a75649bd8ec693d5230c50003.firstChild, element_a6aeaec5a75649bd8ec693d5230c50006 = element_a6aeaec5a75649bd8ec693d5230c50005.firstChild;
|
|
25
|
+
template_a6aeaec5a75649bd8ec693d5230c50001.setProperties(element_a6aeaec5a75649bd8ec693d5230c50005, omit(attributes, OMIT));
|
|
26
|
+
template_a6aeaec5a75649bd8ec693d5230c50001.setClass(element_a6aeaec5a75649bd8ec693d5230c50005, '', () => {
|
|
17
27
|
return state.active && '--active';
|
|
18
|
-
}
|
|
19
|
-
onrender
|
|
28
|
+
});
|
|
29
|
+
template_a6aeaec5a75649bd8ec693d5230c50001.onrender(element_a6aeaec5a75649bd8ec693d5230c50005, (element) => {
|
|
20
30
|
(ref = element)[key] = state;
|
|
21
|
-
}
|
|
22
|
-
|
|
31
|
+
});
|
|
32
|
+
template_a6aeaec5a75649bd8ec693d5230c50001.setStyle(element_a6aeaec5a75649bd8ec693d5230c50005, '', () => {
|
|
23
33
|
let parent = ref.closest('accordion');
|
|
24
34
|
if (parent && key in parent) {
|
|
25
35
|
parent[key].active = (+parent[key].active) + 1;
|
|
26
36
|
}
|
|
27
37
|
return state.active && `--max-height: ${ref.scrollHeight}`;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
</div>
|
|
33
|
-
`;
|
|
38
|
+
});
|
|
39
|
+
template_a6aeaec5a75649bd8ec693d5230c50001.slot(element_a6aeaec5a75649bd8ec693d5230c50006, content);
|
|
40
|
+
return root_a6aeaec5a75649bd8ec693d5230c50003;
|
|
41
|
+
})();
|
|
34
42
|
});
|
|
@@ -7,7 +7,7 @@ declare const _default: (attributes: Attributes & {
|
|
|
7
7
|
"alert-messages"?: Attributes;
|
|
8
8
|
"alert-message"?: Attributes;
|
|
9
9
|
}) => {
|
|
10
|
-
content:
|
|
10
|
+
content: DocumentFragment;
|
|
11
11
|
deactivate: () => void;
|
|
12
12
|
error: {
|
|
13
13
|
(messages: Renderable<any>, seconds?: number): void;
|
|
@@ -1,12 +1,55 @@
|
|
|
1
1
|
import '@esportsplus/vite/global.d.ts';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import * as reactivity_a6aeaec5a75649bd8ec693d5230c50000 from '@esportsplus/reactivity';
|
|
3
|
+
import * as template_a6aeaec5a75649bd8ec693d5230c50001 from '@esportsplus/template';
|
|
4
|
+
import { svg } from '@esportsplus/template';
|
|
4
5
|
import { omit } from '@esportsplus/utilities';
|
|
5
6
|
import { icon } from '@esportsplus/ui';
|
|
6
7
|
import check from './svg/check.svg';
|
|
7
8
|
import close from './svg/close.svg';
|
|
8
9
|
import e from './svg/error.svg';
|
|
9
10
|
import './scss/index.scss';
|
|
11
|
+
const template_a6aeaec5a75649bd8ec693d5230c50009 = template_a6aeaec5a75649bd8ec693d5230c50001.template(`<div class='--flex-vertical'><!--$--></div>`);
|
|
12
|
+
const template_a6aeaec5a75649bd8ec693d5230c5000d = template_a6aeaec5a75649bd8ec693d5230c50001.template(`<p><!--$--></p>`);
|
|
13
|
+
const template_a6aeaec5a75649bd8ec693d5230c5000h = template_a6aeaec5a75649bd8ec693d5230c50001.template(`<div class='--flex-start'><!--$--></div>`);
|
|
14
|
+
const template_a6aeaec5a75649bd8ec693d5230c5000k = template_a6aeaec5a75649bd8ec693d5230c50001.template(`<div
|
|
15
|
+
class='alert anchor anchor--n --flex-row'><!--$--><div
|
|
16
|
+
class='alert-messages --flex-column --flex-fill'><!--$--></div><div class="--flex-vertical"><div
|
|
17
|
+
class='alert-close button --padding-300'><div class="icon" style='--size: 14px;'><!--$--></div></div></div></div>`);
|
|
18
|
+
class ReactiveObject_a6aeaec5a75649bd8ec693d5230c50007 extends reactivity_a6aeaec5a75649bd8ec693d5230c50000.ReactiveObject {
|
|
19
|
+
#active = this[reactivity_a6aeaec5a75649bd8ec693d5230c50000.SIGNAL](false);
|
|
20
|
+
#messages;
|
|
21
|
+
#rerender = this[reactivity_a6aeaec5a75649bd8ec693d5230c50000.SIGNAL](0);
|
|
22
|
+
#type;
|
|
23
|
+
constructor(_p0, _p1) {
|
|
24
|
+
super(null);
|
|
25
|
+
this.#messages = this[reactivity_a6aeaec5a75649bd8ec693d5230c50000.SIGNAL](_p0);
|
|
26
|
+
this.#type = this[reactivity_a6aeaec5a75649bd8ec693d5230c50000.SIGNAL](_p1);
|
|
27
|
+
}
|
|
28
|
+
get active() {
|
|
29
|
+
return reactivity_a6aeaec5a75649bd8ec693d5230c50000.read(this.#active);
|
|
30
|
+
}
|
|
31
|
+
set active(_v0) {
|
|
32
|
+
reactivity_a6aeaec5a75649bd8ec693d5230c50000.write(this.#active, _v0);
|
|
33
|
+
}
|
|
34
|
+
get messages() {
|
|
35
|
+
return reactivity_a6aeaec5a75649bd8ec693d5230c50000.read(this.#messages);
|
|
36
|
+
}
|
|
37
|
+
set messages(_v1) {
|
|
38
|
+
reactivity_a6aeaec5a75649bd8ec693d5230c50000.write(this.#messages, _v1);
|
|
39
|
+
}
|
|
40
|
+
get rerender() {
|
|
41
|
+
return reactivity_a6aeaec5a75649bd8ec693d5230c50000.read(this.#rerender);
|
|
42
|
+
}
|
|
43
|
+
set rerender(_v2) {
|
|
44
|
+
reactivity_a6aeaec5a75649bd8ec693d5230c50000.write(this.#rerender, _v2);
|
|
45
|
+
}
|
|
46
|
+
get type() {
|
|
47
|
+
return reactivity_a6aeaec5a75649bd8ec693d5230c50000.read(this.#type);
|
|
48
|
+
}
|
|
49
|
+
set type(_v3) {
|
|
50
|
+
reactivity_a6aeaec5a75649bd8ec693d5230c50000.write(this.#type, _v3);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
10
53
|
const OMIT = ['alert-close', 'alert-messages', 'alert-message'];
|
|
11
54
|
let modifiers = {
|
|
12
55
|
error: 'red',
|
|
@@ -53,12 +96,7 @@ function deactivate(state) {
|
|
|
53
96
|
}, timeout);
|
|
54
97
|
}
|
|
55
98
|
export default (attributes) => {
|
|
56
|
-
let state =
|
|
57
|
-
active: false,
|
|
58
|
-
messages: new Set(),
|
|
59
|
-
rerender: 0,
|
|
60
|
-
type: ''
|
|
61
|
-
});
|
|
99
|
+
let state = new ReactiveObject_a6aeaec5a75649bd8ec693d5230c50007(new Set(), '');
|
|
62
100
|
const error = (messages, seconds = 0) => activate('error', messages, seconds, state);
|
|
63
101
|
error.response = (response) => {
|
|
64
102
|
if (response.ok) {
|
|
@@ -72,56 +110,43 @@ export default (attributes) => {
|
|
|
72
110
|
}), 5);
|
|
73
111
|
};
|
|
74
112
|
return {
|
|
75
|
-
content:
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
</div>
|
|
107
|
-
`;
|
|
113
|
+
content: (() => {
|
|
114
|
+
let root_a6aeaec5a75649bd8ec693d5230c5000j = template_a6aeaec5a75649bd8ec693d5230c5000k(), element_a6aeaec5a75649bd8ec693d5230c5000l = root_a6aeaec5a75649bd8ec693d5230c5000j.firstChild, element_a6aeaec5a75649bd8ec693d5230c5000m = element_a6aeaec5a75649bd8ec693d5230c5000l.firstChild, element_a6aeaec5a75649bd8ec693d5230c5000n = element_a6aeaec5a75649bd8ec693d5230c5000l.firstElementChild, element_a6aeaec5a75649bd8ec693d5230c5000o = element_a6aeaec5a75649bd8ec693d5230c5000n.firstChild, element_a6aeaec5a75649bd8ec693d5230c5000p = element_a6aeaec5a75649bd8ec693d5230c5000n.nextElementSibling.firstElementChild, element_a6aeaec5a75649bd8ec693d5230c5000q = element_a6aeaec5a75649bd8ec693d5230c5000p.firstElementChild.firstChild;
|
|
115
|
+
template_a6aeaec5a75649bd8ec693d5230c50001.setClass(element_a6aeaec5a75649bd8ec693d5230c5000l, ' --flex-row', () => state.active && '--active');
|
|
116
|
+
template_a6aeaec5a75649bd8ec693d5230c50001.setProperties(element_a6aeaec5a75649bd8ec693d5230c5000l, omit(attributes, OMIT));
|
|
117
|
+
new template_a6aeaec5a75649bd8ec693d5230c50001.EffectSlot(element_a6aeaec5a75649bd8ec693d5230c5000m, () => {
|
|
118
|
+
let type = state.type;
|
|
119
|
+
return (() => {
|
|
120
|
+
let root_a6aeaec5a75649bd8ec693d5230c50008 = template_a6aeaec5a75649bd8ec693d5230c50009(), element_a6aeaec5a75649bd8ec693d5230c5000a = root_a6aeaec5a75649bd8ec693d5230c50008.firstChild, element_a6aeaec5a75649bd8ec693d5230c5000b = element_a6aeaec5a75649bd8ec693d5230c5000a.firstChild;
|
|
121
|
+
template_a6aeaec5a75649bd8ec693d5230c50001.setStyle(element_a6aeaec5a75649bd8ec693d5230c5000a, ';', `--color: var(--color-${modifiers[type]}-400);`);
|
|
122
|
+
template_a6aeaec5a75649bd8ec693d5230c50001.slot(element_a6aeaec5a75649bd8ec693d5230c5000b, icon({ class: '--size-500' }, type === 'error' ? e : check));
|
|
123
|
+
return root_a6aeaec5a75649bd8ec693d5230c50008;
|
|
124
|
+
})();
|
|
125
|
+
});
|
|
126
|
+
template_a6aeaec5a75649bd8ec693d5230c50001.setProperties(element_a6aeaec5a75649bd8ec693d5230c5000n, attributes['alert-messages']);
|
|
127
|
+
new template_a6aeaec5a75649bd8ec693d5230c50001.EffectSlot(element_a6aeaec5a75649bd8ec693d5230c5000o, () => {
|
|
128
|
+
let message = attributes['alert-message'];
|
|
129
|
+
return state.rerender && [...state.messages].map((content) => {
|
|
130
|
+
if (typeof content === 'string') {
|
|
131
|
+
return (() => {
|
|
132
|
+
let root_a6aeaec5a75649bd8ec693d5230c5000c = template_a6aeaec5a75649bd8ec693d5230c5000d(), element_a6aeaec5a75649bd8ec693d5230c5000e = root_a6aeaec5a75649bd8ec693d5230c5000c.firstChild, element_a6aeaec5a75649bd8ec693d5230c5000f = element_a6aeaec5a75649bd8ec693d5230c5000e.firstChild;
|
|
133
|
+
template_a6aeaec5a75649bd8ec693d5230c50001.setProperties(element_a6aeaec5a75649bd8ec693d5230c5000e, message);
|
|
134
|
+
template_a6aeaec5a75649bd8ec693d5230c50001.slot(element_a6aeaec5a75649bd8ec693d5230c5000f, content);
|
|
135
|
+
return root_a6aeaec5a75649bd8ec693d5230c5000c;
|
|
136
|
+
})();
|
|
137
|
+
}
|
|
138
|
+
return (() => {
|
|
139
|
+
let root_a6aeaec5a75649bd8ec693d5230c5000g = template_a6aeaec5a75649bd8ec693d5230c5000h(), element_a6aeaec5a75649bd8ec693d5230c5000i = root_a6aeaec5a75649bd8ec693d5230c5000g.firstChild.firstChild;
|
|
140
|
+
template_a6aeaec5a75649bd8ec693d5230c50001.slot(element_a6aeaec5a75649bd8ec693d5230c5000i, content);
|
|
141
|
+
return root_a6aeaec5a75649bd8ec693d5230c5000g;
|
|
142
|
+
})();
|
|
143
|
+
});
|
|
108
144
|
});
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
class='alert-close button --padding-300'
|
|
115
|
-
onclick='${() => deactivate(state)}'
|
|
116
|
-
${attributes['alert-close']}
|
|
117
|
-
>
|
|
118
|
-
<div class="icon" style='--size: 14px;'>
|
|
119
|
-
${svg.sprite(close)}
|
|
120
|
-
</div>
|
|
121
|
-
</div>
|
|
122
|
-
</div>
|
|
123
|
-
</div>
|
|
124
|
-
`,
|
|
145
|
+
template_a6aeaec5a75649bd8ec693d5230c50001.delegate(element_a6aeaec5a75649bd8ec693d5230c5000p, 'click', () => deactivate(state));
|
|
146
|
+
template_a6aeaec5a75649bd8ec693d5230c50001.setProperties(element_a6aeaec5a75649bd8ec693d5230c5000p, attributes['alert-close']);
|
|
147
|
+
template_a6aeaec5a75649bd8ec693d5230c50001.slot(element_a6aeaec5a75649bd8ec693d5230c5000q, svg.sprite(close));
|
|
148
|
+
return root_a6aeaec5a75649bd8ec693d5230c5000j;
|
|
149
|
+
})(),
|
|
125
150
|
deactivate: () => deactivate(state),
|
|
126
151
|
error,
|
|
127
152
|
info: (messages, seconds = 0) => activate('info', messages, seconds, state),
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
+
import * as template_a6aeaec5a75649bd8ec693d5230c50001 from '@esportsplus/template';
|
|
1
2
|
import { Attributes } from '@esportsplus/template';
|
|
2
3
|
import './scss/index.scss';
|
|
3
4
|
declare const _default: {
|
|
4
5
|
(): ReturnType<(this: {
|
|
5
6
|
attributes?: Attributes;
|
|
6
|
-
}, attributes: Readonly<Attributes>, content:
|
|
7
|
-
<T extends Attributes>(attributes: T): ReturnType<(this: {
|
|
7
|
+
}, attributes: Readonly<template_a6aeaec5a75649bd8ec693d5230c50001.Attributes>, content: template_a6aeaec5a75649bd8ec693d5230c50001.Renderable<any>) => template_a6aeaec5a75649bd8ec693d5230c50001.Renderable<any>>;
|
|
8
|
+
<T extends template_a6aeaec5a75649bd8ec693d5230c50001.Attributes>(attributes: T): ReturnType<(this: {
|
|
8
9
|
attributes?: Attributes;
|
|
9
|
-
}, attributes: Readonly<Attributes>, content:
|
|
10
|
-
<T extends
|
|
10
|
+
}, attributes: Readonly<template_a6aeaec5a75649bd8ec693d5230c50001.Attributes>, content: template_a6aeaec5a75649bd8ec693d5230c50001.Renderable<any>) => template_a6aeaec5a75649bd8ec693d5230c50001.Renderable<any>>;
|
|
11
|
+
<T extends template_a6aeaec5a75649bd8ec693d5230c50001.Renderable<any>>(content: T): ReturnType<(this: {
|
|
11
12
|
attributes?: Attributes;
|
|
12
|
-
}, attributes: Readonly<Attributes>, content:
|
|
13
|
-
(attributes: Attributes, content:
|
|
13
|
+
}, attributes: Readonly<template_a6aeaec5a75649bd8ec693d5230c50001.Attributes>, content: template_a6aeaec5a75649bd8ec693d5230c50001.Renderable<any>) => template_a6aeaec5a75649bd8ec693d5230c50001.Renderable<any>>;
|
|
14
|
+
(attributes: template_a6aeaec5a75649bd8ec693d5230c50001.Attributes, content: template_a6aeaec5a75649bd8ec693d5230c50001.Renderable<any>): ReturnType<(this: {
|
|
14
15
|
attributes?: Attributes;
|
|
15
|
-
}, attributes: Readonly<Attributes>, content:
|
|
16
|
+
}, attributes: Readonly<template_a6aeaec5a75649bd8ec693d5230c50001.Attributes>, content: template_a6aeaec5a75649bd8ec693d5230c50001.Renderable<any>) => template_a6aeaec5a75649bd8ec693d5230c50001.Renderable<any>>;
|
|
16
17
|
};
|
|
17
18
|
export default _default;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as template_a6aeaec5a75649bd8ec693d5230c50001 from '@esportsplus/template';
|
|
2
2
|
import icon from '../../components/icon/index.js';
|
|
3
3
|
import template from '../../components/template/index.js';
|
|
4
4
|
import arrow from './svg/arrow.svg';
|
|
5
5
|
import './scss/index.scss';
|
|
6
|
+
const template_a6aeaec5a75649bd8ec693d5230c5000s = template_a6aeaec5a75649bd8ec693d5230c50001.template(`<a
|
|
7
|
+
class='back link --padding-0px --flex-vertical'><!--$--><!--$--></a>`);
|
|
6
8
|
export default template.factory(function (attributes, content) {
|
|
7
|
-
return
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
</a>
|
|
16
|
-
`;
|
|
9
|
+
return (() => {
|
|
10
|
+
let root_a6aeaec5a75649bd8ec693d5230c5000r = template_a6aeaec5a75649bd8ec693d5230c5000s(), element_a6aeaec5a75649bd8ec693d5230c5000t = root_a6aeaec5a75649bd8ec693d5230c5000r.firstChild, element_a6aeaec5a75649bd8ec693d5230c5000u = element_a6aeaec5a75649bd8ec693d5230c5000t.firstChild, element_a6aeaec5a75649bd8ec693d5230c5000v = element_a6aeaec5a75649bd8ec693d5230c5000u.nextSibling;
|
|
11
|
+
template_a6aeaec5a75649bd8ec693d5230c50001.setProperties(element_a6aeaec5a75649bd8ec693d5230c5000t, this.attributes);
|
|
12
|
+
template_a6aeaec5a75649bd8ec693d5230c50001.setProperties(element_a6aeaec5a75649bd8ec693d5230c5000t, attributes);
|
|
13
|
+
template_a6aeaec5a75649bd8ec693d5230c50001.slot(element_a6aeaec5a75649bd8ec693d5230c5000u, icon({ class: 'back-arrow --margin-right --margin-200' }, arrow));
|
|
14
|
+
template_a6aeaec5a75649bd8ec693d5230c50001.slot(element_a6aeaec5a75649bd8ec693d5230c5000v, content);
|
|
15
|
+
return root_a6aeaec5a75649bd8ec693d5230c5000r;
|
|
16
|
+
})();
|
|
17
17
|
});
|