@mediafly/js-ui 47.3.1-0 → 47.3.1-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.
- package/lib/font-selector/font-selector.d.ts +2 -0
- package/lib/font-selector/font-selector.html +7 -3
- package/lib/font-selector/font-selector.js +19 -4
- package/lib/font-selector/font-selector.js.map +1 -1
- package/lib/localization/index.strings.json +1 -1
- package/lib/tsconfig.deploy.tsbuildinfo +4 -4
- package/package.json +1 -1
- package/src/components/font-selector/font-selector.html +7 -3
- package/src/components/font-selector/font-selector.less +16 -0
- package/src/components/font-selector/font-selector.ts +23 -4
- package/src/components/localization/index.strings.json +1 -1
- package/tsconfig.tsbuildinfo +4 -4
|
@@ -31,9 +31,11 @@ export default class FontSelectorController implements ng.IComponentController {
|
|
|
31
31
|
protected keyEventElement: HTMLInputElement | null;
|
|
32
32
|
protected loadingFonts: boolean;
|
|
33
33
|
protected placeholderText: string;
|
|
34
|
+
protected popularFonts: string[];
|
|
34
35
|
protected matches: string[];
|
|
35
36
|
protected minLength: number;
|
|
36
37
|
protected requiredText: string;
|
|
38
|
+
protected showPopular: boolean;
|
|
37
39
|
private debouncedFetchAndSetMatches;
|
|
38
40
|
private inputElement;
|
|
39
41
|
private observer;
|
|
@@ -14,18 +14,19 @@
|
|
|
14
14
|
class="c-font-selector__warning">{{ $ctrl.requiredText }}
|
|
15
15
|
</div>
|
|
16
16
|
|
|
17
|
-
<div ng-class="{'is-visible': $ctrl.isDropdownVisible
|
|
17
|
+
<div ng-class="{'is-visible': $ctrl.isDropdownVisible,
|
|
18
|
+
'is-showing-popular': $ctrl.showPopular && !$ctrl.inputValue}"
|
|
18
19
|
class="c-font-selector__dropdown">
|
|
19
20
|
|
|
20
21
|
<input
|
|
22
|
+
ng-click="$ctrl.inputClick($event)"
|
|
23
|
+
ng-model="$ctrl.inputValue"
|
|
21
24
|
autocapitalize="off"
|
|
22
25
|
autocomplete="off"
|
|
23
26
|
autocorrect="off"
|
|
24
27
|
class="o-form-control c-font-selector__input"
|
|
25
28
|
id="{{ $ctrl.inputId }}"
|
|
26
29
|
name="autocomplete"
|
|
27
|
-
ng-click="$ctrl.inputClick($event)"
|
|
28
|
-
ng-model="$ctrl.inputValue"
|
|
29
30
|
placeholder="{{ $ctrl.placeholderText }}"
|
|
30
31
|
type="text">
|
|
31
32
|
|
|
@@ -38,6 +39,9 @@
|
|
|
38
39
|
class="c-font-selector__dropdown__close fal fa-times-circle">
|
|
39
40
|
</span>
|
|
40
41
|
|
|
42
|
+
<div ng-if="$ctrl.showPopular && !$ctrl.inputValue"
|
|
43
|
+
class="c-font-selector__dropdown__label">or select from popular <a class="o-link" href="https://fonts.google.com/" target="_blank">Google Fonts</a></div>
|
|
44
|
+
|
|
41
45
|
<div ng-mousemove="$ctrl.dropdownWasMousedOver($event)"
|
|
42
46
|
class="c-font-selector__dropdown__matches">
|
|
43
47
|
<div
|
|
@@ -30,6 +30,7 @@ let FontSelectorController = class FontSelectorController {
|
|
|
30
30
|
this.loadingFonts = true;
|
|
31
31
|
this.matches = [];
|
|
32
32
|
this.minLength = 2;
|
|
33
|
+
this.showPopular = true;
|
|
33
34
|
this.debouncedFetchAndSetMatches = _.debounce(() => this.fetchAndSetMatches(), this.delay);
|
|
34
35
|
this.onClickElsewhere = ($event) => {
|
|
35
36
|
this.$timeout(() => {
|
|
@@ -48,7 +49,8 @@ let FontSelectorController = class FontSelectorController {
|
|
|
48
49
|
}
|
|
49
50
|
// Escape: close the dropdown
|
|
50
51
|
if ($event.key === 'Escape') {
|
|
51
|
-
this.matches =
|
|
52
|
+
this.matches = this.popularFonts;
|
|
53
|
+
this.showPopular = true;
|
|
52
54
|
}
|
|
53
55
|
// Arrow down with dropdown closed: fetch matches
|
|
54
56
|
if ($event.key === 'ArrowDown' && this.matches.length === 0) {
|
|
@@ -88,8 +90,16 @@ let FontSelectorController = class FontSelectorController {
|
|
|
88
90
|
throw new Error(`You must provide a string to key-event-element-id on the AutoCompleteMatchRenderer.`);
|
|
89
91
|
}
|
|
90
92
|
// set label text
|
|
91
|
-
this.placeholderText = this.translateFactory.instant('JSUI.
|
|
93
|
+
this.placeholderText = this.translateFactory.instant('JSUI.SEARCH_ALL_FONTS');
|
|
92
94
|
this.requiredText = this.translateFactory.instant('JSUI.REQUIRED');
|
|
95
|
+
// init list of popylar fonts
|
|
96
|
+
this.googleWebfontsApiService.getFontList('popularity')
|
|
97
|
+
.then(popularList => {
|
|
98
|
+
this.popularFonts = popularList.map(f => f.family);
|
|
99
|
+
this.popularFonts = this.popularFonts.slice(0, 50);
|
|
100
|
+
this.webfontLoaderService.loadFonts(this.popularFonts);
|
|
101
|
+
this.matches = this.popularFonts;
|
|
102
|
+
});
|
|
93
103
|
// init list of google fonts
|
|
94
104
|
this.googleWebfontsApiService.getFontList()
|
|
95
105
|
.then(fontList => {
|
|
@@ -114,6 +124,8 @@ let FontSelectorController = class FontSelectorController {
|
|
|
114
124
|
}
|
|
115
125
|
clearInput($event) {
|
|
116
126
|
this.inputValue = '';
|
|
127
|
+
this.matches = this.popularFonts;
|
|
128
|
+
this.showPopular = true;
|
|
117
129
|
$event.stopPropagation();
|
|
118
130
|
}
|
|
119
131
|
clickSelect($event) {
|
|
@@ -141,7 +153,8 @@ let FontSelectorController = class FontSelectorController {
|
|
|
141
153
|
this.debouncedFetchAndSetMatches();
|
|
142
154
|
}
|
|
143
155
|
matchWasSelected(match) {
|
|
144
|
-
this.matches =
|
|
156
|
+
this.matches = this.popularFonts;
|
|
157
|
+
this.showPopular = true;
|
|
145
158
|
this.kbSelectedIndex = -1;
|
|
146
159
|
this.inputValue = '';
|
|
147
160
|
this.fontFamily = match;
|
|
@@ -165,7 +178,8 @@ let FontSelectorController = class FontSelectorController {
|
|
|
165
178
|
const input = this.inputValue || (this.keyEventElement ? this.keyEventElement.value : '');
|
|
166
179
|
if (input.length < this.minLength) {
|
|
167
180
|
this.$timeout(() => {
|
|
168
|
-
this.matches =
|
|
181
|
+
this.matches = this.popularFonts;
|
|
182
|
+
this.showPopular = true;
|
|
169
183
|
});
|
|
170
184
|
return;
|
|
171
185
|
}
|
|
@@ -176,6 +190,7 @@ let FontSelectorController = class FontSelectorController {
|
|
|
176
190
|
this.$q.when(this.onFontLookup(input))
|
|
177
191
|
.then(matches => {
|
|
178
192
|
this.matches = matches;
|
|
193
|
+
this.showPopular = false;
|
|
179
194
|
this.isFetching = false;
|
|
180
195
|
});
|
|
181
196
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"font-selector.js","sourceRoot":"","sources":["../../src/components/font-selector/font-selector.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAChE,OAAO,wBAAwB,MAAM,+BAA+B,CAAA;AACpE,OAAO,oBAAoB,MAAM,0BAA0B,CAAA;AAE3D,OAAO,CAAC,MAAM,QAAQ,CAAA;AAWtB,IAAqB,sBAAsB,GAA3C,MAAqB,sBAAsB;
|
|
1
|
+
{"version":3,"file":"font-selector.js","sourceRoot":"","sources":["../../src/components/font-selector/font-selector.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAChE,OAAO,wBAAwB,MAAM,+BAA+B,CAAA;AACpE,OAAO,oBAAoB,MAAM,0BAA0B,CAAA;AAE3D,OAAO,CAAC,MAAM,QAAQ,CAAA;AAWtB,IAAqB,sBAAsB,GAA3C,MAAqB,sBAAsB;IA6B1C,YAC8B,SAA8B,EAC/B,QAA6B,EAC7B,QAA4B,EAClC,EAAgB,EACM,wBAAkD,EAC1D,gBAAkC,EAC9B,oBAA0C;QANrD,cAAS,GAAT,SAAS,CAAqB;QAC/B,aAAQ,GAAR,QAAQ,CAAqB;QAC7B,aAAQ,GAAR,QAAQ,CAAoB;QAClC,OAAE,GAAF,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Status Check",
|
|
39
39
|
"SUPPORT": "Need help?",
|
|
40
40
|
"TERMS_OF_USE": "Terms of Use",
|
|
@@ -437,8 +437,8 @@
|
|
|
437
437
|
"affectsGlobalScope": false
|
|
438
438
|
},
|
|
439
439
|
"../src/components/localization/index.strings.json": {
|
|
440
|
-
"version": "
|
|
441
|
-
"signature": "
|
|
440
|
+
"version": "338553eaad94f4106f3417d14a9be37537d28ed4b81783fc839a1ec2636f3d70",
|
|
441
|
+
"signature": "65e04e222a2916429f61d68efa84747fb7870cf5cfc32c7730ae8561438eb918",
|
|
442
442
|
"affectsGlobalScope": true
|
|
443
443
|
},
|
|
444
444
|
"../src/components/translate/translate-factory.ts": {
|
|
@@ -1002,8 +1002,8 @@
|
|
|
1002
1002
|
"affectsGlobalScope": false
|
|
1003
1003
|
},
|
|
1004
1004
|
"../src/components/font-selector/font-selector.ts": {
|
|
1005
|
-
"version": "
|
|
1006
|
-
"signature": "
|
|
1005
|
+
"version": "6d3361fe0e8d65ab5169d339418b94d7a48300bff06e6f303994b38a99373355",
|
|
1006
|
+
"signature": "122f14a3ae62afc0a455023e08deefa19c937c16c155a0afe78ea89d3c8fe11d",
|
|
1007
1007
|
"affectsGlobalScope": false
|
|
1008
1008
|
},
|
|
1009
1009
|
"../src/components/font-selector/index.ts": {
|
package/package.json
CHANGED
|
@@ -14,18 +14,19 @@
|
|
|
14
14
|
class="c-font-selector__warning">{{ $ctrl.requiredText }}
|
|
15
15
|
</div>
|
|
16
16
|
|
|
17
|
-
<div ng-class="{'is-visible': $ctrl.isDropdownVisible
|
|
17
|
+
<div ng-class="{'is-visible': $ctrl.isDropdownVisible,
|
|
18
|
+
'is-showing-popular': $ctrl.showPopular && !$ctrl.inputValue}"
|
|
18
19
|
class="c-font-selector__dropdown">
|
|
19
20
|
|
|
20
21
|
<input
|
|
22
|
+
ng-click="$ctrl.inputClick($event)"
|
|
23
|
+
ng-model="$ctrl.inputValue"
|
|
21
24
|
autocapitalize="off"
|
|
22
25
|
autocomplete="off"
|
|
23
26
|
autocorrect="off"
|
|
24
27
|
class="o-form-control c-font-selector__input"
|
|
25
28
|
id="{{ $ctrl.inputId }}"
|
|
26
29
|
name="autocomplete"
|
|
27
|
-
ng-click="$ctrl.inputClick($event)"
|
|
28
|
-
ng-model="$ctrl.inputValue"
|
|
29
30
|
placeholder="{{ $ctrl.placeholderText }}"
|
|
30
31
|
type="text">
|
|
31
32
|
|
|
@@ -38,6 +39,9 @@
|
|
|
38
39
|
class="c-font-selector__dropdown__close fal fa-times-circle">
|
|
39
40
|
</span>
|
|
40
41
|
|
|
42
|
+
<div ng-if="$ctrl.showPopular && !$ctrl.inputValue"
|
|
43
|
+
class="c-font-selector__dropdown__label">or select from popular <a class="o-link" href="https://fonts.google.com/" target="_blank">Google Fonts</a></div>
|
|
44
|
+
|
|
41
45
|
<div ng-mousemove="$ctrl.dropdownWasMousedOver($event)"
|
|
42
46
|
class="c-font-selector__dropdown__matches">
|
|
43
47
|
<div
|
|
@@ -50,6 +50,18 @@
|
|
|
50
50
|
&.is-visible {
|
|
51
51
|
display: block;
|
|
52
52
|
}
|
|
53
|
+
|
|
54
|
+
&.is-showing-popular {
|
|
55
|
+
max-height: 330px;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.c-font-selector__dropdown__label {
|
|
60
|
+
border-bottom: 1px solid @color-gray-light;
|
|
61
|
+
color: @color-gray-light;
|
|
62
|
+
font-size: 13px;
|
|
63
|
+
font-style: italic;
|
|
64
|
+
padding: 5px 10px;
|
|
53
65
|
}
|
|
54
66
|
|
|
55
67
|
.o-form-control.c-font-selector__input {
|
|
@@ -57,6 +69,10 @@
|
|
|
57
69
|
outline: none;
|
|
58
70
|
padding-right: 36px; // add padding to not allow text under close button
|
|
59
71
|
width: 362px;
|
|
72
|
+
|
|
73
|
+
.c-font-selector__dropdown.is-showing-popular & {
|
|
74
|
+
margin: 4px 3px 0;
|
|
75
|
+
}
|
|
60
76
|
}
|
|
61
77
|
|
|
62
78
|
.c-font-selector__dropdown__spinner.far {
|
|
@@ -32,9 +32,11 @@ export default class FontSelectorController implements ng.IComponentController {
|
|
|
32
32
|
protected keyEventElement: HTMLInputElement | null = null
|
|
33
33
|
protected loadingFonts: boolean = true
|
|
34
34
|
protected placeholderText!: string
|
|
35
|
+
protected popularFonts: string[]
|
|
35
36
|
protected matches: string[] = []
|
|
36
37
|
protected minLength: number = 2
|
|
37
38
|
protected requiredText: string
|
|
39
|
+
protected showPopular: boolean = true
|
|
38
40
|
|
|
39
41
|
private debouncedFetchAndSetMatches = _.debounce(() => this.fetchAndSetMatches(), this.delay)
|
|
40
42
|
private inputElement: HTMLElement
|
|
@@ -65,10 +67,19 @@ export default class FontSelectorController implements ng.IComponentController {
|
|
|
65
67
|
$onInit() {
|
|
66
68
|
if (!this.inputId) { throw new Error(`You must provide a string to key-event-element-id on the AutoCompleteMatchRenderer.`) }
|
|
67
69
|
// set label text
|
|
68
|
-
this.placeholderText = this.translateFactory.instant('JSUI.
|
|
70
|
+
this.placeholderText = this.translateFactory.instant('JSUI.SEARCH_ALL_FONTS')
|
|
69
71
|
|
|
70
72
|
this.requiredText = this.translateFactory.instant('JSUI.REQUIRED')
|
|
71
73
|
|
|
74
|
+
// init list of popylar fonts
|
|
75
|
+
this.googleWebfontsApiService.getFontList('popularity')
|
|
76
|
+
.then(popularList => {
|
|
77
|
+
this.popularFonts = popularList.map(f => f.family)
|
|
78
|
+
this.popularFonts = this.popularFonts.slice(0, 50)
|
|
79
|
+
this.webfontLoaderService.loadFonts(this.popularFonts)
|
|
80
|
+
this.matches = this.popularFonts
|
|
81
|
+
})
|
|
82
|
+
|
|
72
83
|
// init list of google fonts
|
|
73
84
|
this.googleWebfontsApiService.getFontList()
|
|
74
85
|
.then(fontList => {
|
|
@@ -97,6 +108,8 @@ export default class FontSelectorController implements ng.IComponentController {
|
|
|
97
108
|
|
|
98
109
|
protected clearInput($event): void {
|
|
99
110
|
this.inputValue = ''
|
|
111
|
+
this.matches = this.popularFonts
|
|
112
|
+
this.showPopular = true
|
|
100
113
|
$event.stopPropagation()
|
|
101
114
|
}
|
|
102
115
|
|
|
@@ -127,7 +140,8 @@ export default class FontSelectorController implements ng.IComponentController {
|
|
|
127
140
|
}
|
|
128
141
|
|
|
129
142
|
protected matchWasSelected(match: string) {
|
|
130
|
-
this.matches =
|
|
143
|
+
this.matches = this.popularFonts
|
|
144
|
+
this.showPopular = true
|
|
131
145
|
this.kbSelectedIndex = -1
|
|
132
146
|
this.inputValue = ''
|
|
133
147
|
this.fontFamily = match
|
|
@@ -160,7 +174,8 @@ export default class FontSelectorController implements ng.IComponentController {
|
|
|
160
174
|
|
|
161
175
|
if (input.length < this.minLength) {
|
|
162
176
|
this.$timeout(() => {
|
|
163
|
-
this.matches =
|
|
177
|
+
this.matches = this.popularFonts
|
|
178
|
+
this.showPopular = true
|
|
164
179
|
})
|
|
165
180
|
return
|
|
166
181
|
}
|
|
@@ -173,6 +188,7 @@ export default class FontSelectorController implements ng.IComponentController {
|
|
|
173
188
|
this.$q.when(this.onFontLookup(input))
|
|
174
189
|
.then(matches => {
|
|
175
190
|
this.matches = matches
|
|
191
|
+
this.showPopular = false
|
|
176
192
|
this.isFetching = false
|
|
177
193
|
})
|
|
178
194
|
})
|
|
@@ -196,7 +212,10 @@ export default class FontSelectorController implements ng.IComponentController {
|
|
|
196
212
|
if (this.matches.length === 0 && $event.key !== 'ArrowDown') { return }
|
|
197
213
|
|
|
198
214
|
// Escape: close the dropdown
|
|
199
|
-
if ($event.key === 'Escape') {
|
|
215
|
+
if ($event.key === 'Escape') {
|
|
216
|
+
this.matches = this.popularFonts
|
|
217
|
+
this.showPopular = true
|
|
218
|
+
}
|
|
200
219
|
|
|
201
220
|
// Arrow down with dropdown closed: fetch matches
|
|
202
221
|
if ($event.key === 'ArrowDown' && this.matches.length === 0) {
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"PRIVACY_POLICY": "Privacy Policy",
|
|
35
35
|
"RECENT_CHANGES": "Recent Changes",
|
|
36
36
|
"REQUIRED": "Required",
|
|
37
|
-
"
|
|
37
|
+
"SEARCH_ALL_FONTS": "Search all fonts",
|
|
38
38
|
"STATUS_CHECK": "Status Check",
|
|
39
39
|
"SUPPORT": "Need help?",
|
|
40
40
|
"TERMS_OF_USE": "Terms of Use",
|
package/tsconfig.tsbuildinfo
CHANGED
|
@@ -1732,8 +1732,8 @@
|
|
|
1732
1732
|
"affectsGlobalScope": false
|
|
1733
1733
|
},
|
|
1734
1734
|
"./src/components/localization/index.strings.json": {
|
|
1735
|
-
"version": "
|
|
1736
|
-
"signature": "
|
|
1735
|
+
"version": "338553eaad94f4106f3417d14a9be37537d28ed4b81783fc839a1ec2636f3d70",
|
|
1736
|
+
"signature": "65e04e222a2916429f61d68efa84747fb7870cf5cfc32c7730ae8561438eb918",
|
|
1737
1737
|
"affectsGlobalScope": true
|
|
1738
1738
|
},
|
|
1739
1739
|
"./src/components/translate/translate-factory.ts": {
|
|
@@ -1832,8 +1832,8 @@
|
|
|
1832
1832
|
"affectsGlobalScope": false
|
|
1833
1833
|
},
|
|
1834
1834
|
"./src/components/font-selector/font-selector.ts": {
|
|
1835
|
-
"version": "
|
|
1836
|
-
"signature": "
|
|
1835
|
+
"version": "6d3361fe0e8d65ab5169d339418b94d7a48300bff06e6f303994b38a99373355",
|
|
1836
|
+
"signature": "122f14a3ae62afc0a455023e08deefa19c937c16c155a0afe78ea89d3c8fe11d",
|
|
1837
1837
|
"affectsGlobalScope": false
|
|
1838
1838
|
},
|
|
1839
1839
|
"./src/components/font-selector/index.ts": {
|