@esportsplus/ui 0.3.11 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/components/ellipsis/index.js +5 -5
- package/build/components/form/action.js +12 -3
- package/build/components/truncate/index.d.ts +9 -0
- package/build/components/truncate/index.js +10 -0
- package/build/index.d.ts +1 -0
- package/build/index.js +1 -0
- package/normalize.css +1 -1
- package/package.json +5 -5
- package/src/components/ellipsis/index.ts +5 -5
- package/src/components/form/action.ts +16 -6
- package/src/components/truncate/index.ts +14 -0
- package/src/index.ts +2 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { html } from '@esportsplus/template';
|
|
2
2
|
export default (attributes) => html `
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
<div class="ellipsis" ${attributes}>
|
|
4
|
+
<span></span>
|
|
5
|
+
<span></span>
|
|
6
|
+
<span></span>
|
|
7
|
+
</div>
|
|
8
8
|
`;
|
|
@@ -2,12 +2,21 @@ import response from '@esportsplus/action';
|
|
|
2
2
|
import input from './input';
|
|
3
3
|
function parse(input) {
|
|
4
4
|
let data = {};
|
|
5
|
-
for (let path
|
|
5
|
+
for (let [path, value] of input) {
|
|
6
6
|
let bucket = data, keys = path.indexOf('.') !== -1 ? path.split('.') : [path];
|
|
7
7
|
for (let i = 0; i < keys.length - 1; i++) {
|
|
8
8
|
bucket = bucket[keys[i]] = bucket[keys[i]] || {};
|
|
9
9
|
}
|
|
10
|
-
|
|
10
|
+
if (path.endsWith('[]')) {
|
|
11
|
+
if (typeof value === 'string' && value.trim() === '') {
|
|
12
|
+
continue;
|
|
13
|
+
}
|
|
14
|
+
bucket = bucket[keys.at(-1)] ??= [];
|
|
15
|
+
bucket.push(value);
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
bucket[keys[keys.length - 1]] = value;
|
|
19
|
+
}
|
|
11
20
|
}
|
|
12
21
|
return data;
|
|
13
22
|
}
|
|
@@ -27,7 +36,7 @@ export default function (action) {
|
|
|
27
36
|
event?.submitter?.classList.add('button--processing');
|
|
28
37
|
let { errors } = await action({
|
|
29
38
|
alert: null,
|
|
30
|
-
input: parse(
|
|
39
|
+
input: parse(new FormData(this).entries()),
|
|
31
40
|
response
|
|
32
41
|
});
|
|
33
42
|
for (let i = 0, n = errors.length; i < n; i++) {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const center = (str, { prefix, suffix } = {}) => {
|
|
2
|
+
return str.slice(0, prefix || 5) + '...' + str.slice(str.length - (suffix || 7));
|
|
3
|
+
};
|
|
4
|
+
const end = (str, prefix = 7) => {
|
|
5
|
+
return str.slice(0, prefix) + '...';
|
|
6
|
+
};
|
|
7
|
+
const start = (str, suffix = 7) => {
|
|
8
|
+
return '...' + str.slice(str.length - suffix);
|
|
9
|
+
};
|
|
10
|
+
export default { center, end, start };
|
package/build/index.d.ts
CHANGED
|
@@ -13,3 +13,4 @@ export { default as root } from './components/root';
|
|
|
13
13
|
export { default as scrollbar } from './components/scrollbar';
|
|
14
14
|
export { default as site } from './components/site';
|
|
15
15
|
export { default as tooltip } from './components/tooltip';
|
|
16
|
+
export { default as truncate } from './components/truncate';
|
package/build/index.js
CHANGED
|
@@ -13,3 +13,4 @@ export { default as root } from './components/root';
|
|
|
13
13
|
export { default as scrollbar } from './components/scrollbar';
|
|
14
14
|
export { default as site } from './components/site';
|
|
15
15
|
export { default as tooltip } from './components/tooltip';
|
|
16
|
+
export { default as truncate } from './components/truncate';
|
package/normalize.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
/*! modern-normalize v3.0.
|
|
1
|
+
/*! modern-normalize v3.0.1 | MIT License | https://github.com/sindresorhus/modern-normalize */*,::before,::after{box-sizing:border-box}html{font-family:system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";line-height:1.15;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4}body{margin:0}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-0.25em}sup{top:-0.5em}table{border-color:currentcolor}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button}legend{padding:0}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}
|
package/package.json
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
"author": "ICJR",
|
|
3
3
|
"dependencies": {
|
|
4
4
|
"@esportsplus/action": "^0.0.50",
|
|
5
|
-
"@esportsplus/reactivity": "^0.2.
|
|
6
|
-
"@esportsplus/template": "^0.6.
|
|
5
|
+
"@esportsplus/reactivity": "^0.2.7",
|
|
6
|
+
"@esportsplus/template": "^0.6.5"
|
|
7
7
|
},
|
|
8
8
|
"devDependencies": {
|
|
9
|
-
"@esportsplus/webpack": "^0.4.
|
|
10
|
-
"modern-normalize": "^3.0.
|
|
9
|
+
"@esportsplus/webpack": "^0.4.13",
|
|
10
|
+
"modern-normalize": "^3.0.1"
|
|
11
11
|
},
|
|
12
12
|
"main": "build/index.js",
|
|
13
13
|
"name": "@esportsplus/ui",
|
|
@@ -21,5 +21,5 @@
|
|
|
21
21
|
},
|
|
22
22
|
"sideEffects": false,
|
|
23
23
|
"types": "build/index.d.ts",
|
|
24
|
-
"version": "0.
|
|
24
|
+
"version": "0.5.0"
|
|
25
25
|
}
|
|
@@ -2,9 +2,9 @@ import { html } from '@esportsplus/template';
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
export default (attributes?: Record<string, string>) => html`
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
<div class="ellipsis" ${attributes}>
|
|
6
|
+
<span></span>
|
|
7
|
+
<span></span>
|
|
8
|
+
<span></span>
|
|
9
|
+
</div>
|
|
10
10
|
`;
|
|
@@ -4,18 +4,28 @@ import { Action } from './types';
|
|
|
4
4
|
import input from './input';
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
function parse(input:
|
|
7
|
+
function parse(input: ReturnType<FormData['entries']>) {
|
|
8
8
|
let data: Record<string, any> = {};
|
|
9
9
|
|
|
10
|
-
for (let path
|
|
10
|
+
for (let [path, value] of input) {
|
|
11
11
|
let bucket = data,
|
|
12
12
|
keys = path.indexOf('.') !== -1 ? path.split('.') : [path];
|
|
13
13
|
|
|
14
14
|
for (let i = 0; i < keys.length - 1; i++) {
|
|
15
|
-
bucket = bucket[keys[i]] = bucket[keys[i]] || {};
|
|
15
|
+
bucket = bucket[ keys[i] ] = bucket[ keys[i] ] || {};
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
if (path.endsWith('[]')) {
|
|
19
|
+
if (typeof value === 'string' && value.trim() === '') {
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
bucket = bucket[ keys.at(-1)! ] ??= [];
|
|
24
|
+
bucket.push(value);
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
bucket[keys[keys.length - 1]] = value;
|
|
28
|
+
}
|
|
19
29
|
}
|
|
20
30
|
|
|
21
31
|
return data;
|
|
@@ -39,7 +49,7 @@ export default function(action: Action) {
|
|
|
39
49
|
);
|
|
40
50
|
},
|
|
41
51
|
onsubmit: async function(this: HTMLFormElement, event: SubmitEvent) {
|
|
42
|
-
// TODO: Figure out processing
|
|
52
|
+
// TODO: Figure out button--processing
|
|
43
53
|
// - Could pass reactive value above and tie it to form layout handler
|
|
44
54
|
event.preventDefault();
|
|
45
55
|
event?.submitter?.classList.add('button--processing');
|
|
@@ -47,7 +57,7 @@ export default function(action: Action) {
|
|
|
47
57
|
let { errors } = await action({
|
|
48
58
|
// @ts-ignore
|
|
49
59
|
alert: null,
|
|
50
|
-
input: parse(
|
|
60
|
+
input: parse( new FormData( this ).entries() ),
|
|
51
61
|
response
|
|
52
62
|
});
|
|
53
63
|
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const center = (str: string, { prefix, suffix }: { prefix?: number, suffix?: number } = {}) => {
|
|
2
|
+
return str.slice(0, prefix || 5) + '...' + str.slice(str.length - (suffix || 7));
|
|
3
|
+
};
|
|
4
|
+
|
|
5
|
+
const end = (str: string, prefix: number = 7) => {
|
|
6
|
+
return str.slice(0, prefix) + '...';
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const start = (str: string, suffix: number = 7) => {
|
|
10
|
+
return '...' + str.slice(str.length - suffix);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
export default { center, end, start };
|
package/src/index.ts
CHANGED
|
@@ -13,4 +13,5 @@ export { default as page }from './components/page';
|
|
|
13
13
|
export { default as root }from './components/root';
|
|
14
14
|
export { default as scrollbar }from './components/scrollbar';
|
|
15
15
|
export { default as site }from './components/site';
|
|
16
|
-
export { default as tooltip }from './components/tooltip';
|
|
16
|
+
export { default as tooltip }from './components/tooltip';
|
|
17
|
+
export { default as truncate }from './components/truncate';
|