@esportsplus/template 0.23.1 → 0.23.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/build/attributes.js +12 -11
- package/package.json +1 -1
- package/src/attributes.ts +13 -13
package/build/attributes.js
CHANGED
|
@@ -31,27 +31,28 @@ function list(ctx, element, id, name, state, value) {
|
|
|
31
31
|
if (value == null || value === false || value === '') {
|
|
32
32
|
value = '';
|
|
33
33
|
}
|
|
34
|
-
if (!value || typeof value !== 'string') {
|
|
34
|
+
if (id === null && (!value || typeof value !== 'string')) {
|
|
35
35
|
return;
|
|
36
36
|
}
|
|
37
|
-
let delimiter = delimiters[name], store = (ctx ??= context(element)).store ??= {}
|
|
38
|
-
if (
|
|
39
|
-
|
|
37
|
+
let delimiter = delimiters[name], store = (ctx ??= context(element)).store ??= {};
|
|
38
|
+
if (store[name] === undefined) {
|
|
39
|
+
store[name] = (element.getAttribute(name) || '').trim();
|
|
40
40
|
}
|
|
41
|
+
let current = value ? (delimiter + value) : '';
|
|
41
42
|
if (id === null) {
|
|
42
|
-
|
|
43
|
+
store[name] += current;
|
|
43
44
|
}
|
|
44
45
|
else {
|
|
45
|
-
let
|
|
46
|
-
if (previous
|
|
47
|
-
|
|
46
|
+
let previous = store[id];
|
|
47
|
+
if (!previous) {
|
|
48
|
+
store[name] += current;
|
|
48
49
|
}
|
|
49
50
|
else if (previous !== current) {
|
|
50
|
-
|
|
51
|
+
store[name] = store[name].replace(previous, current);
|
|
51
52
|
}
|
|
52
53
|
store[id] = current;
|
|
53
54
|
}
|
|
54
|
-
schedule(ctx, element, name, state,
|
|
55
|
+
schedule(ctx, element, name, state, store[name]);
|
|
55
56
|
}
|
|
56
57
|
function property(ctx, element, id, name, state, value) {
|
|
57
58
|
if (value == null || value === false || value === '') {
|
|
@@ -113,7 +114,7 @@ const set = (element, name, value, state = STATE_HYDRATING) => {
|
|
|
113
114
|
effect(() => {
|
|
114
115
|
let v = value(element);
|
|
115
116
|
if (v == null || typeof v !== 'object') {
|
|
116
|
-
fn(ctx, element, id, name,
|
|
117
|
+
fn(ctx, element, id, name, state, v);
|
|
117
118
|
}
|
|
118
119
|
else if (isArray(v)) {
|
|
119
120
|
let last = v.length - 1;
|
package/package.json
CHANGED
package/src/attributes.ts
CHANGED
|
@@ -61,36 +61,36 @@ function list(
|
|
|
61
61
|
value = '';
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
if (!value || typeof value !== 'string') {
|
|
64
|
+
if (id === null && (!value || typeof value !== 'string')) {
|
|
65
65
|
return;
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
let delimiter = delimiters[name],
|
|
69
|
-
store = (ctx ??= context(element)).store ??= {}
|
|
70
|
-
v = store[name];
|
|
69
|
+
store = (ctx ??= context(element)).store ??= {};
|
|
71
70
|
|
|
72
|
-
if (
|
|
73
|
-
|
|
71
|
+
if (store[name] === undefined) {
|
|
72
|
+
store[name] = (element.getAttribute(name) || '').trim();
|
|
74
73
|
}
|
|
75
74
|
|
|
75
|
+
let current = value ? (delimiter + value) : '';
|
|
76
|
+
|
|
76
77
|
if (id === null) {
|
|
77
|
-
|
|
78
|
+
store[name] += current;
|
|
78
79
|
}
|
|
79
80
|
else {
|
|
80
|
-
let
|
|
81
|
-
previous = store[id] as string | undefined;
|
|
81
|
+
let previous = store[id] as string | undefined;
|
|
82
82
|
|
|
83
|
-
if (previous
|
|
84
|
-
|
|
83
|
+
if (!previous) {
|
|
84
|
+
store[name] += current;
|
|
85
85
|
}
|
|
86
86
|
else if (previous !== current) {
|
|
87
|
-
|
|
87
|
+
store[name] = (store[name] as string).replace(previous, current);
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
store[id] = current;
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
-
schedule(ctx, element, name, state,
|
|
93
|
+
schedule(ctx, element, name, state, store[name]);
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
function property(
|
|
@@ -184,7 +184,7 @@ const set = (element: Element, name: string, value: unknown, state: State = STAT
|
|
|
184
184
|
let v = (value as Function)(element);
|
|
185
185
|
|
|
186
186
|
if (v == null || typeof v !== 'object') {
|
|
187
|
-
fn(ctx, element, id, name,
|
|
187
|
+
fn(ctx, element, id, name, state, v);
|
|
188
188
|
}
|
|
189
189
|
else if (isArray(v)) {
|
|
190
190
|
let last = v.length - 1;
|