@esportsplus/ui 0.19.0 → 0.19.1

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.
@@ -42,7 +42,7 @@ const field = template.factory(function (attributes, content) {
42
42
  }
43
43
  }}
44
44
  >
45
- ${content(((...args) => this.call(state, ...args)))}
45
+ ${content((...args) => this.mask.call({ state }, ...args))}
46
46
  ${error(state)}
47
47
  </div>
48
48
  `;
@@ -58,7 +58,7 @@ const file = template.factory(function (attributes, content) {
58
58
  type='file'
59
59
  ${pick(attributes, FILE_TAG)}
60
60
  ${{
61
- onrender: form.input.onrender(this)
61
+ onrender: form.input.onrender(this.state)
62
62
  }}
63
63
  >
64
64
 
@@ -73,7 +73,7 @@ const text = template.factory(function (attributes, content) {
73
73
  class='field-mask-tag'
74
74
  ${pick(attributes, TEXT_TAG)}
75
75
  ${{
76
- onrender: form.input.onrender(this),
76
+ onrender: form.input.onrender(this.state),
77
77
  type: attributes.type || 'text'
78
78
  }}
79
79
  >
@@ -91,7 +91,7 @@ const textarea = template.factory(function (attributes, content) {
91
91
  class='field-mask-tag'
92
92
  ${pick(attributes, TEXT_TAG)}
93
93
  ${{
94
- onrender: form.input.onrender(this)
94
+ onrender: form.input.onrender(this.state)
95
95
  }}
96
96
  >
97
97
  ${attributes.value}
@@ -101,7 +101,7 @@ const textarea = template.factory(function (attributes, content) {
101
101
  `;
102
102
  });
103
103
  export default {
104
- file: field.bind(file),
105
- text: field.bind(text),
106
- textarea: field.bind(textarea)
104
+ file: field.bind({ mask: file }),
105
+ text: field.bind({ mask: text }),
106
+ textarea: field.bind({ mask: textarea })
107
107
  };
@@ -1,4 +1,3 @@
1
- import { EMPTY_OBJECT } from '@esportsplus/utilities';
2
1
  const factory = (template) => {
3
2
  function factory(one, two) {
4
3
  let attributes = {}, content;
@@ -11,6 +10,6 @@ const factory = (template) => {
11
10
  }
12
11
  return template.call(this, attributes, content);
13
12
  }
14
- return factory.bind(EMPTY_OBJECT);
13
+ return factory;
15
14
  };
16
15
  export default { factory };
package/package.json CHANGED
@@ -48,7 +48,7 @@
48
48
  "private": false,
49
49
  "sideEffects": false,
50
50
  "type": "module",
51
- "version": "0.19.0",
51
+ "version": "0.19.1",
52
52
  "scripts": {
53
53
  "build": "run-s build:vite build:ts",
54
54
  "build:ts": "tsc && tsc-alias",
@@ -31,7 +31,7 @@ const TEXT_TAG = [
31
31
 
32
32
  const field = template.factory(
33
33
  function(
34
- this: typeof text | typeof textarea,
34
+ this: { mask: typeof file | typeof text | typeof textarea },
35
35
  attributes: Attributes & { state?: { active: boolean, error: string } },
36
36
  content: (mask: typeof file | typeof text | typeof textarea) => Renderable<unknown>
37
37
  ) {
@@ -55,7 +55,8 @@ const field = template.factory(
55
55
  }}
56
56
  >
57
57
  ${content(
58
- ((...args: any[]) => (this.call as any)(state, ...args))
58
+ // @ts-ignore
59
+ (...args: any[]) => this.mask.call({ state }, ...args)
59
60
  )}
60
61
  ${error(state)}
61
62
  </div>
@@ -64,7 +65,7 @@ const field = template.factory(
64
65
  );
65
66
 
66
67
  const file = template.factory(
67
- function(this: { active: boolean, error: string }, attributes, content) {
68
+ function(this: { state: { active: boolean, error: string } }, attributes, content) {
68
69
  return html`
69
70
  <label
70
71
  class='field-mask field-mask--file'
@@ -75,7 +76,7 @@ const file = template.factory(
75
76
  type='file'
76
77
  ${pick(attributes, FILE_TAG) as Attributes}
77
78
  ${{
78
- onrender: form.input.onrender(this)
79
+ onrender: form.input.onrender(this.state)
79
80
  }}
80
81
  >
81
82
 
@@ -86,14 +87,14 @@ const file = template.factory(
86
87
  );
87
88
 
88
89
  const text = template.factory(
89
- function(this: { active: boolean, error: string }, attributes, content) {
90
+ function(this: { state: { active: boolean, error: string } }, attributes, content) {
90
91
  return html`
91
92
  <label class='field-mask field-mask--input' ${omit(attributes, TEXT_TAG)}>
92
93
  <input
93
94
  class='field-mask-tag'
94
95
  ${pick(attributes, TEXT_TAG) as Attributes}
95
96
  ${{
96
- onrender: form.input.onrender(this),
97
+ onrender: form.input.onrender(this.state),
97
98
  type: attributes.type || 'text'
98
99
  }}
99
100
  >
@@ -104,7 +105,7 @@ const text = template.factory(
104
105
  );
105
106
 
106
107
  const textarea = template.factory(
107
- function(this: { active: boolean, error: string }, attributes: Attributes & { value?: string }, content) {
108
+ function(this: { state: { active: boolean, error: string } }, attributes: Attributes & { value?: string }, content) {
108
109
  return html`
109
110
  <label
110
111
  class='field-mask field-mask--textarea'
@@ -114,7 +115,7 @@ const textarea = template.factory(
114
115
  class='field-mask-tag'
115
116
  ${pick(attributes, TEXT_TAG) as Attributes}
116
117
  ${{
117
- onrender: form.input.onrender(this)
118
+ onrender: form.input.onrender(this.state)
118
119
  }}
119
120
  >
120
121
  ${attributes.value}
@@ -127,7 +128,7 @@ const textarea = template.factory(
127
128
 
128
129
 
129
130
  export default {
130
- file: field.bind(file),
131
- text: field.bind(text),
132
- textarea: field.bind(textarea)
131
+ file: field.bind({ mask: file }),
132
+ text: field.bind({ mask: text }),
133
+ textarea: field.bind({ mask: textarea })
133
134
  };
@@ -1,5 +1,4 @@
1
1
  import { Attributes, Renderable } from '@esportsplus/template';
2
- import { EMPTY_OBJECT } from '@esportsplus/utilities';
3
2
 
4
3
 
5
4
  const factory = <
@@ -27,7 +26,7 @@ const factory = <
27
26
  return template.call(this, attributes, content);
28
27
  }
29
28
 
30
- return factory.bind(EMPTY_OBJECT);
29
+ return factory;
31
30
  };
32
31
 
33
32