@mediafly/js-ui 51.4.2 → 51.5.0-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.
Files changed (39) hide show
  1. package/lib/font-selector/font-selector.d.ts +7 -3
  2. package/lib/font-selector/font-selector.html +7 -7
  3. package/lib/font-selector/font-selector.js +27 -12
  4. package/lib/font-selector/font-selector.js.map +1 -1
  5. package/lib/font-selector/google-webfonts-api.service.d.ts +4 -1
  6. package/lib/font-selector/google-webfonts-api.service.js +17 -3
  7. package/lib/font-selector/google-webfonts-api.service.js.map +1 -1
  8. package/lib/font-selector/webfont-loader.service.d.ts +1 -0
  9. package/lib/font-selector/webfont-loader.service.js +9 -0
  10. package/lib/font-selector/webfont-loader.service.js.map +1 -1
  11. package/lib/font-weight-selector/font-weight-selector.d.ts +30 -0
  12. package/lib/font-weight-selector/font-weight-selector.html +26 -0
  13. package/lib/font-weight-selector/font-weight-selector.js +162 -0
  14. package/lib/font-weight-selector/font-weight-selector.js.map +1 -0
  15. package/lib/font-weight-selector/index.d.ts +1 -0
  16. package/lib/font-weight-selector/index.js +4 -0
  17. package/lib/font-weight-selector/index.js.map +1 -0
  18. package/lib/index.d.ts +1 -0
  19. package/lib/index.js +1 -0
  20. package/lib/index.js.map +1 -1
  21. package/lib/rich-text/rich-text.component.d.ts +9 -2
  22. package/lib/rich-text/rich-text.component.html +9 -2
  23. package/lib/rich-text/rich-text.component.js +45 -7
  24. package/lib/rich-text/rich-text.component.js.map +1 -1
  25. package/lib/tsconfig.deploy.tsbuildinfo +42 -10
  26. package/package.json +1 -1
  27. package/src/components/font-selector/font-selector.html +7 -7
  28. package/src/components/font-selector/font-selector.ts +31 -16
  29. package/src/components/font-selector/google-webfonts-api.service.ts +14 -0
  30. package/src/components/font-selector/webfont-loader.service.ts +12 -0
  31. package/src/components/font-weight-selector/font-weight-selector.html +26 -0
  32. package/src/components/font-weight-selector/font-weight-selector.less +48 -0
  33. package/src/components/font-weight-selector/font-weight-selector.ts +147 -0
  34. package/src/components/font-weight-selector/index.ts +1 -0
  35. package/src/components/index.less +1 -0
  36. package/src/components/index.ts +1 -0
  37. package/src/components/rich-text/rich-text.component.html +9 -2
  38. package/src/components/rich-text/rich-text.component.less +1 -0
  39. package/src/components/rich-text/rich-text.component.ts +49 -3
@@ -1,3 +1,4 @@
1
+ /// <reference types="google.fonts" />
1
2
  /// <reference types="angular-mocks" />
2
3
  import GoogleWebfontsApiService from './google-webfonts-api.service';
3
4
  import WebfontLoaderService from './webfont-loader.service';
@@ -20,9 +21,10 @@ export default class FontSelectorController implements IComponentController {
20
21
  fontFamily?: string;
21
22
  onFontSelect?: (param: {
22
23
  fontFamily: string;
24
+ fontWeightOptions?: number[];
23
25
  }) => void;
24
26
  protected delay: number;
25
- protected googleFonts: string[];
27
+ protected googleFonts: google.fonts.WebfontFamily[];
26
28
  protected inputValue?: string;
27
29
  protected interactionMode: 'mouse' | 'keyboard';
28
30
  protected isDropdownVisible: boolean;
@@ -49,8 +51,10 @@ export default class FontSelectorController implements IComponentController {
49
51
  dropdownWasMousedOver(): void;
50
52
  protected inputClick($event: any): void;
51
53
  protected inputValueWasChanged(): void;
52
- protected matchWasSelected(match: string): void;
53
- protected onFontLookup(value: string): ng.IPromise<string[]>;
54
+ protected resetDropdown(): void;
55
+ protected onFontSelected(fontFamily: string, $event?: MouseEvent): void;
56
+ protected getFontWeightOptions(fontFamily: string | undefined): ng.IPromise<number[]>;
57
+ protected onFontLookup(value: string): ng.IPromise<google.fonts.WebfontFamily[]>;
54
58
  private fetchAndSetMatches;
55
59
  private onClickElsewhere;
56
60
  private onKeyDown;
@@ -14,9 +14,10 @@
14
14
  class="c-font-selector__warning">{{ $ctrl.requiredText }}
15
15
  </div>
16
16
 
17
- <div ng-class="{'is-visible': $ctrl.isDropdownVisible,
18
- 'is-showing-popular': $ctrl.showPopular && !$ctrl.inputValue}"
19
- class="c-font-selector__dropdown">
17
+ <div
18
+ ng-class="{'is-visible': $ctrl.isDropdownVisible, 'is-showing-popular': $ctrl.showPopular && !$ctrl.inputValue}"
19
+ class="c-font-selector__dropdown"
20
+ >
20
21
 
21
22
  <input
22
23
  ng-click="$ctrl.inputClick($event)"
@@ -28,7 +29,8 @@
28
29
  id="{{ $ctrl.inputId }}"
29
30
  name="autocomplete"
30
31
  placeholder="{{ $ctrl.placeholderText }}"
31
- type="text">
32
+ type="text"
33
+ >
32
34
 
33
35
  <span ng-class="{ 'is-visible': $ctrl.isFetching && $ctrl.inputValue.length >= $ctrl.minLength }"
34
36
  class="far fa-spin fa-spinner c-font-selector__dropdown__spinner">
@@ -46,7 +48,6 @@
46
48
  </div>
47
49
  </div>
48
50
 
49
-
50
51
  <div ng-mousemove="$ctrl.dropdownWasMousedOver($event)"
51
52
  class="c-font-selector__dropdown__matches">
52
53
  <div
@@ -57,11 +58,10 @@
57
58
  { 'is-selected': ($ctrl.kbSelectedIndex === $index) },
58
59
  ]"
59
60
  ng-style="{'font-family': match}"
60
- ng-click="$ctrl.matchWasSelected(match)"
61
+ ng-click="$ctrl.onFontSelected(match)"
61
62
  ng-repeat="match in $ctrl.matches">
62
63
  <span>{{ match }}</span>
63
64
  </div>
64
65
  </div>
65
66
  </div>
66
-
67
67
  </ng-form>
@@ -39,7 +39,7 @@ let FontSelectorController = class FontSelectorController {
39
39
  this.debouncedFetchAndSetMatches = lodash_1.default.debounce(() => this.fetchAndSetMatches(), this.delay);
40
40
  this.onClickElsewhere = ($event) => {
41
41
  this.$timeout(() => {
42
- this.isDropdownVisible = false;
42
+ this.resetDropdown();
43
43
  });
44
44
  };
45
45
  this.onKeyDown = ($event) => this.$timeout(() => {
@@ -75,7 +75,7 @@ let FontSelectorController = class FontSelectorController {
75
75
  // Enter with a selection: set the selection to the currently highlighted match
76
76
  if ($event.key === 'Enter' && this.kbSelectedIndex > -1) {
77
77
  const match = this.matches[this.kbSelectedIndex];
78
- this.matchWasSelected(match);
78
+ this.onFontSelected(match);
79
79
  $event.preventDefault();
80
80
  }
81
81
  $event.stopPropagation();
@@ -110,7 +110,7 @@ let FontSelectorController = class FontSelectorController {
110
110
  // init list of google fonts
111
111
  this.googleWebfontsApiService.getFontList()
112
112
  .then(fontList => {
113
- this.googleFonts = fontList.map(f => f.family);
113
+ this.googleFonts = fontList;
114
114
  this.loadingFonts = false;
115
115
  });
116
116
  const body = this.$document[0].body;
@@ -145,6 +145,9 @@ let FontSelectorController = class FontSelectorController {
145
145
  this.inputElement.focus();
146
146
  }, 250);
147
147
  }
148
+ else {
149
+ this.resetDropdown();
150
+ }
148
151
  $event.stopPropagation();
149
152
  }
150
153
  // When the user mouses over the dropdown, we should remove any keyboard
@@ -159,25 +162,37 @@ let FontSelectorController = class FontSelectorController {
159
162
  inputValueWasChanged() {
160
163
  this.debouncedFetchAndSetMatches();
161
164
  }
162
- matchWasSelected(match) {
165
+ resetDropdown() {
166
+ this.isDropdownVisible = false;
163
167
  this.matches = this.popularFonts;
164
168
  this.showPopular = true;
165
169
  this.kbSelectedIndex = -1;
166
170
  this.inputValue = '';
167
- this.fontFamily = match;
168
- this.isDropdownVisible = false;
169
- if (this.onFontSelect) {
170
- this.onFontSelect({ fontFamily: this.fontFamily });
171
+ }
172
+ onFontSelected(fontFamily, $event) {
173
+ $event === null || $event === void 0 ? void 0 : $event.stopPropagation();
174
+ this.fontFamily = fontFamily;
175
+ this.getFontWeightOptions(fontFamily)
176
+ .then((fontWeightOptions) => {
177
+ var _a;
178
+ (_a = this.onFontSelect) === null || _a === void 0 ? void 0 : _a.call(this, { fontFamily, fontWeightOptions });
179
+ this.resetDropdown();
180
+ });
181
+ }
182
+ getFontWeightOptions(fontFamily) {
183
+ if (!fontFamily) {
184
+ return this.$q.resolve([]);
171
185
  }
186
+ return this.googleWebfontsApiService.getFontVariants(fontFamily, this.googleFonts)
187
+ .then(variants => this.googleWebfontsApiService.sortFontWeightVariants(variants));
172
188
  }
173
189
  onFontLookup(value) {
174
190
  value = value.toLocaleLowerCase();
175
- // const fonts: google.fonts.WebfontFamily[] = []
176
191
  const fonts = this.googleFonts.filter(font => {
177
- return font.toLowerCase().includes(value);
192
+ return font.family.toLowerCase().includes(value);
178
193
  });
179
194
  // load this set with the api service
180
- this.webfontLoaderService.loadFonts(fonts);
195
+ this.webfontLoaderService.loadFonts(fonts.map(font => font.family));
181
196
  return this.$q.resolve(fonts);
182
197
  }
183
198
  fetchAndSetMatches() {
@@ -196,7 +211,7 @@ let FontSelectorController = class FontSelectorController {
196
211
  this.$timeout(() => {
197
212
  this.$q.when(this.onFontLookup(input))
198
213
  .then(matches => {
199
- this.matches = matches;
214
+ this.matches = matches.map(match => match.family);
200
215
  this.showPopular = false;
201
216
  this.isFetching = false;
202
217
  });
@@ -1 +1 @@
1
- {"version":3,"file":"font-selector.js","sourceRoot":"","sources":["../../src/components/font-selector/font-selector.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,8CAAgE;AAChE,gGAAoE;AACpE,sFAA2D;AAE3D,oDAAsB;AAWtB,IAAqB,sBAAsB,GAA3C,MAAqB,sBAAsB;IA+B1C,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,EAAE,CAAc;QACM,6BAAwB,GAAxB,wBAAwB,CAA0B;QAC1D,qBAAgB,GAAhB,gBAAgB,CAAkB;QAC9B,yBAAoB,GAApB,oBAAoB,CAAsB;QA7BzE,UAAK,GAAW,GAAG,CAAA;QAGnB,oBAAe,GAAyB,OAAO,CAAA;QAG/C,oBAAe,GAAG,CAAC,CAAC,CAAA;QACpB,oBAAe,GAA4B,IAAI,CAAA;QAC/C,iBAAY,GAAY,IAAI,CAAA;QAI5B,YAAO,GAAa,EAAE,CAAA;QACtB,cAAS,GAAW,CAAC,CAAA;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AiB;AAChB;IAAX,kBAAK,CAAC,GAAG,CAAC;;0DAAqB;AACpB;IAAX,kBAAK,CAAC,GAAG,CAAC;;0DAAqB;AACnB;IAAZ,kBAAK,CAAC,IAAI,CAAC;;0DAAoB;AAElB;IAAb,mBAAM,CAAC,IAAI,CAAC;;4DAAqF;AAP9E,sBAAsB;IAJ1C,sBAAS,CAAC;QACV,QAAQ,EAAE,kBAAkB;QAC5B,QAAQ,EAAE,OAAO,CAAC,sBAAsB,CAAC;KACzC,CAAC;IAiCC,WAAA,mBAAM,CAAC,WAAW,CAAC,CAAA;IACnB,WAAA,mBAAM,CAAC,UAAU,CAAC,CAAA;IAClB,WAAA,mBAAM,CAAC,UAAU,CAAC,CAAA;IAClB,WAAA,mBAAM,CAAC,IAAI,CAAC,CAAA;IACZ,WAAA,mBAAM,CAAC,0BAA0B,CAAC,CAAA;IAClC,WAAA,mBAAM,CAAC,kBAAkB,CAAC,CAAA;IAC1B,WAAA,mBAAM,CAAC,sBAAsB,CAAC,CAAA;yEAFuC,qCAAwB,UAEhC,gCAAoB;GAtC/D,sBAAsB,CAkQ1C;kBAlQoB,sBAAsB"}
@@ -3,7 +3,10 @@
3
3
  import ApiSuccessHandler from '../response-handlers/api-success-handlers';
4
4
  export default class GoogleWebfontsApiService {
5
5
  private $http;
6
+ private $q;
6
7
  private apiSuccessHandler;
7
- constructor($http: ng.IHttpService, apiSuccessHandler: ApiSuccessHandler);
8
+ constructor($http: ng.IHttpService, $q: ng.IQService, apiSuccessHandler: ApiSuccessHandler);
8
9
  getFontList(sort?: string): ng.IPromise<google.fonts.WebfontFamily[]>;
10
+ getFontVariants(family: string, list?: google.fonts.WebfontFamily[]): ng.IPromise<string[]>;
11
+ sortFontWeightVariants(options: string[] | undefined): number[];
9
12
  }
@@ -18,8 +18,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
18
18
  const decorators_1 = require("../decorators");
19
19
  const api_success_handlers_1 = __importDefault(require("../response-handlers/api-success-handlers"));
20
20
  let GoogleWebfontsApiService = class GoogleWebfontsApiService {
21
- constructor($http, apiSuccessHandler) {
21
+ constructor($http, $q, apiSuccessHandler) {
22
22
  this.$http = $http;
23
+ this.$q = $q;
23
24
  this.apiSuccessHandler = apiSuccessHandler;
24
25
  }
25
26
  getFontList(sort) {
@@ -36,12 +37,25 @@ let GoogleWebfontsApiService = class GoogleWebfontsApiService {
36
37
  return this.apiSuccessHandler.response(response).items;
37
38
  });
38
39
  }
40
+ // Get the available font variants for a given font family
41
+ getFontVariants(family, list) {
42
+ return this.$q.resolve(list || this.getFontList())
43
+ .then(families => { var _a; return (((_a = families.find(opt => opt.family === family)) === null || _a === void 0 ? void 0 : _a.variants) || []); });
44
+ }
45
+ // Filter down the variants to just font weights and order them by ascending weight
46
+ sortFontWeightVariants(options) {
47
+ return (options || [])
48
+ .filter(opt => !opt.includes('italic'))
49
+ .map(opt => opt === 'regular' ? 400 : parseInt(opt, 10))
50
+ .sort((a, b) => a - b);
51
+ }
39
52
  };
40
53
  GoogleWebfontsApiService = __decorate([
41
54
  decorators_1.Injectable('googleWebfontsApiService'),
42
55
  __param(0, decorators_1.Inject('$http')),
43
- __param(1, decorators_1.Inject('apiSuccessHandler')),
44
- __metadata("design:paramtypes", [Function, api_success_handlers_1.default])
56
+ __param(1, decorators_1.Inject('$q')),
57
+ __param(2, decorators_1.Inject('apiSuccessHandler')),
58
+ __metadata("design:paramtypes", [Function, Function, api_success_handlers_1.default])
45
59
  ], GoogleWebfontsApiService);
46
60
  exports.default = GoogleWebfontsApiService;
47
61
  //# sourceMappingURL=google-webfonts-api.service.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"google-webfonts-api.service.js","sourceRoot":"","sources":["../../src/components/font-selector/google-webfonts-api.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,8CAAkD;AAClD,qGAAyE;AAGzE,IAAqB,wBAAwB,GAA7C,MAAqB,wBAAwB;IAE5C,YAC0B,KAAsB,EACV,iBAAoC;QADhD,UAAK,GAAL,KAAK,CAAiB;QACV,sBAAiB,GAAjB,iBAAiB,CAAmB;IACtE,CAAC;IAGL,WAAW,CAAC,IAAa;QACxB,MAAM,IAAI,GAAG,iDAAiD,CAAA;QAE9D,IAAI,CAAC,IAAI,EAAE;YAAE,IAAI,GAAG,OAAO,CAAA;SAAE;QAE7B,MAAM,MAAM,GAAG;YACd,GAAG,EAAE,yCAAyC;YAC9C,IAAI;SACJ,CAAA;QACD,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAA2B,IAAI,EAAE,EAAE,MAAM,EAAE,CAAC;aAC/D,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE;YAClB,OAAO,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAA;QACvD,CAAC,CAAC,CAAA;IACJ,CAAC;CAED,CAAA;AAvBoB,wBAAwB;IAD5C,uBAAU,CAAC,0BAA0B,CAAC;IAIpC,WAAA,mBAAM,CAAC,OAAO,CAAC,CAAA;IACf,WAAA,mBAAM,CAAC,mBAAmB,CAAC,CAAA;+CAA4B,8BAAiB;GAJtD,wBAAwB,CAuB5C;kBAvBoB,wBAAwB"}
1
+ {"version":3,"file":"google-webfonts-api.service.js","sourceRoot":"","sources":["../../src/components/font-selector/google-webfonts-api.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,8CAAkD;AAClD,qGAAyE;AAGzE,IAAqB,wBAAwB,GAA7C,MAAqB,wBAAwB;IAE5C,YAC0B,KAAsB,EACzB,EAAgB,EACD,iBAAoC;QAFhD,UAAK,GAAL,KAAK,CAAiB;QACzB,OAAE,GAAF,EAAE,CAAc;QACD,sBAAiB,GAAjB,iBAAiB,CAAmB;IACtE,CAAC;IAGL,WAAW,CAAC,IAAa;QACxB,MAAM,IAAI,GAAG,iDAAiD,CAAA;QAE9D,IAAI,CAAC,IAAI,EAAE;YAAE,IAAI,GAAG,OAAO,CAAA;SAAE;QAE7B,MAAM,MAAM,GAAG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A;IACZ,WAAA,mBAAM,CAAC,mBAAmB,CAAC,CAAA;yDAA4B,8BAAiB;GALtD,wBAAwB,CAqC5C;kBArCoB,wBAAwB"}
@@ -1,3 +1,4 @@
1
1
  export default class WebfontLoaderService {
2
2
  loadFonts(families: string[]): void;
3
+ loadFontVariants(fontFamily: string, variants: string[]): void;
3
4
  }
@@ -43,6 +43,15 @@ let WebfontLoaderService = class WebfontLoaderService {
43
43
  }
44
44
  }
45
45
  }
46
+ loadFontVariants(fontFamily, variants) {
47
+ const fontVariants = [`${fontFamily}:${variants.join(',')}`];
48
+ webfontloader_1.default.load({
49
+ google: {
50
+ families: fontVariants
51
+ },
52
+ timeout: 5000
53
+ });
54
+ }
46
55
  };
47
56
  WebfontLoaderService = __decorate([
48
57
  decorators_1.Injectable('webfontLoaderService')
@@ -1 +1 @@
1
- {"version":3,"file":"webfont-loader.service.js","sourceRoot":"","sources":["../../src/components/font-selector/webfont-loader.service.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,8CAA0C;AAC1C,kEAAmC;AAGnC,IAAqB,oBAAoB,GAAzC,MAAqB,oBAAoB;IAGxC,SAAS,CAAC,QAAkB;QAE3B,+CAA+C;QAC/C,IAAI,QAAQ,GAAG,IAAI,CAAA;QAEnB,gGAAgG;QAChG,qDAAqD;QACrD,MAAM,QAAQ,GAAG;YAChB,GAAG,QAAQ;YACX,GAAG,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,IAAI,OAAO,CAAC;SACvC,CAAA;QAED,IAAI;YACH,uBAAO,CAAC,IAAI,CAAC;gBACZ,MAAM,EAAE;oBACP,QAAQ,EAAE,QAAQ;iBAClB;gBACD,OAAO,EAAE,IAAI;aACb,CAAC,CAAA;SACF;QACD,OAAO,GAAG,EAAE;YACX,QAAQ,GAAG,KAAK,CAAA;SAChB;gBACO;YACP,IAAI,QAAQ,EAAE;gBACb,uBAAO,CAAC,IAAI,CAAC;oBACZ,MAAM,EAAE;wBACP,QAAQ,EAAE,QAAQ;qBAClB;oBACD,OAAO,EAAE,IAAI;iBACb,CAAC,CAAA;aACF;SACD;IACF,CAAC;CACD,CAAA;AArCoB,oBAAoB;IADxC,uBAAU,CAAC,sBAAsB,CAAC;GACd,oBAAoB,CAqCxC;kBArCoB,oBAAoB"}
1
+ {"version":3,"file":"webfont-loader.service.js","sourceRoot":"","sources":["../../src/components/font-selector/webfont-loader.service.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,8CAA0C;AAC1C,kEAAmC;AAGnC,IAAqB,oBAAoB,GAAzC,MAAqB,oBAAoB;IAGxC,SAAS,CAAC,QAAkB;QAE3B,+CAA+C;QAC/C,IAAI,QAAQ,GAAG,IAAI,CAAA;QAEnB,gGAAgG;QAChG,qDAAqD;QACrD,MAAM,QAAQ,GAAG;YAChB,GAAG,QAAQ;YACX,GAAG,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,IAAI,OAAO,CAAC;SACvC,CAAA;QAED,IAAI;YACH,uBAAO,CAAC,IAAI,CAAC;gBACZ,MAAM,EAAE;oBACP,QAAQ,EAAE,QAAQ;iBAClB;gBACD,OAAO,EAAE,IAAI;aACb,CAAC,CAAA;SACF;QACD,OAAO,GAAG,EAAE;YACX,QAAQ,GAAG,KAAK,CAAA;SAChB;gBACO;YACP,IAAI,QAAQ,EAAE;gBACb,uBAAO,CAAC,IAAI,CAAC;oBACZ,MAAM,EAAE;wBACP,QAAQ,EAAE,QAAQ;qBAClB;oBACD,OAAO,EAAE,IAAI;iBACb,CAAC,CAAA;aACF;SACD;IACF,CAAC;IAED,gBAAgB,CAAC,UAAkB,EAAE,QAAkB;QAEtD,MAAM,YAAY,GAAG,CAAC,GAAG,UAAU,IAAI,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;QAE5D,uBAAO,CAAC,IAAI,CAAC;YACZ,MAAM,EAAE;gBACP,QAAQ,EAAE,YAAY;aACtB;YACD,OAAO,EAAE,IAAI;SACb,CAAC,CAAA;IACH,CAAC;CACD,CAAA;AAjDoB,oBAAoB;IADxC,uBAAU,CAAC,sBAAsB,CAAC;GACd,oBAAoB,CAiDxC;kBAjDoB,oBAAoB"}
@@ -0,0 +1,30 @@
1
+ /// <reference types="angular-mocks" />
2
+ import WebfontLoaderService from '../font-selector/webfont-loader.service';
3
+ import { IComponentController } from 'angular';
4
+ export default class FontWeightSelectorController implements IComponentController {
5
+ private $document;
6
+ private $scope;
7
+ private $element;
8
+ private $timeout;
9
+ private webfontLoaderService;
10
+ fontFamily?: string;
11
+ fontWeight?: string;
12
+ fontWeightOptions?: string[];
13
+ onFontWeightSelect?: (param: {
14
+ fontWeight: string;
15
+ }) => void;
16
+ protected interactionMode: 'mouse' | 'keyboard';
17
+ protected isDropdownVisible: boolean;
18
+ protected kbSelectedIndex: number;
19
+ protected keyEventElement: HTMLElement | null;
20
+ private observer;
21
+ constructor($document: ng.IDocumentService, $scope: ng.IScope, $element: ng.IAugmentedJQuery, $timeout: ng.ITimeoutService, webfontLoaderService: WebfontLoaderService);
22
+ $onDestroy(): void;
23
+ $onInit(): void;
24
+ protected clickSelect($event: any): void;
25
+ dropdownWasMousedOver(): void;
26
+ protected variantWasSelected(variant: string): void;
27
+ private onClickElsewhere;
28
+ private onKeyDown;
29
+ private scrollToSelection;
30
+ }
@@ -0,0 +1,26 @@
1
+ <button ng-click="$ctrl.clickSelect($event)" class="c-font-weight-selector__select">
2
+ <div class="fas fa-text-height c-font-weight-selector__select__icon"></div>
3
+ </button>
4
+
5
+ <div
6
+ ng-class="{'is-visible': $ctrl.isDropdownVisible}"
7
+ class="c-font-weight-selector__dropdown"
8
+ >
9
+ <div
10
+ ng-mousemove="$ctrl.dropdownWasMousedOver($event)"
11
+ class="c-font-weight-selector__dropdown__matches"
12
+ >
13
+ <div
14
+ class="c-font-weight-selector__match-row"
15
+ ng-class="[
16
+ ($ctrl.interactionMode === 'mouse') ? 'with-mouse' : 'with-keyboard',
17
+ { 'is-selected': ($ctrl.kbSelectedIndex === $index) },
18
+ ]"
19
+ ng-style="{'font-family': $ctrl.fontFamily, 'font-weight': variant}"
20
+ ng-click="$ctrl.variantWasSelected(variant)"
21
+ ng-repeat="variant in $ctrl.fontWeightOptions"
22
+ >
23
+ <span>{{ variant }}</span>
24
+ </div>
25
+ </div>
26
+ </div>
@@ -0,0 +1,162 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ var __importDefault = (this && this.__importDefault) || function (mod) {
15
+ return (mod && mod.__esModule) ? mod : { "default": mod };
16
+ };
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ const decorators_1 = require("../decorators");
19
+ const webfont_loader_service_1 = __importDefault(require("../font-selector/webfont-loader.service"));
20
+ let FontWeightSelectorController = class FontWeightSelectorController {
21
+ constructor($document, $scope, $element, $timeout, webfontLoaderService) {
22
+ this.$document = $document;
23
+ this.$scope = $scope;
24
+ this.$element = $element;
25
+ this.$timeout = $timeout;
26
+ this.webfontLoaderService = webfontLoaderService;
27
+ this.interactionMode = 'keyboard';
28
+ this.isDropdownVisible = false;
29
+ this.kbSelectedIndex = -1;
30
+ this.keyEventElement = null;
31
+ this.onClickElsewhere = ($event) => {
32
+ this.$timeout(() => {
33
+ this.isDropdownVisible = false;
34
+ });
35
+ };
36
+ this.onKeyDown = ($event) => this.$timeout(() => {
37
+ var _a, _b;
38
+ if (!this.fontFamily || !((_a = this.fontWeightOptions) === null || _a === void 0 ? void 0 : _a.length)) {
39
+ return;
40
+ }
41
+ this.interactionMode = 'keyboard';
42
+ // Enter with no selection: let the $event through
43
+ if ($event.key === 'Enter' && this.kbSelectedIndex === -1) {
44
+ return;
45
+ }
46
+ // If the dropdown is closed, all we can do is arrow down to open the thing
47
+ if (this.fontWeightOptions.length === 0 && $event.key !== 'ArrowDown') {
48
+ return;
49
+ }
50
+ // Escape: close the dropdown
51
+ if ($event.key === 'Escape') {
52
+ this.isDropdownVisible = false;
53
+ }
54
+ // Arrow keys with dropdown open: move the selection highlight
55
+ if ($event.key === 'ArrowDown') {
56
+ const idx = Math.min(this.kbSelectedIndex + 1, this.fontWeightOptions.length - 1);
57
+ this.kbSelectedIndex = idx;
58
+ this.scrollToSelection(idx);
59
+ }
60
+ if ($event.key === 'ArrowUp') {
61
+ const idx = Math.max(this.kbSelectedIndex - 1, 0);
62
+ this.kbSelectedIndex = idx;
63
+ this.scrollToSelection(idx);
64
+ }
65
+ // Enter with a selection: set the selection to the currently highlighted match
66
+ if ($event.key === 'Enter' && this.kbSelectedIndex > -1) {
67
+ const selectedFontWeight = this.fontWeightOptions[this.kbSelectedIndex];
68
+ (_b = this.onFontWeightSelect) === null || _b === void 0 ? void 0 : _b.call(this, { fontWeight: selectedFontWeight });
69
+ this.isDropdownVisible = false;
70
+ $event.preventDefault();
71
+ }
72
+ $event.stopPropagation();
73
+ });
74
+ }
75
+ $onDestroy() {
76
+ if (this.keyEventElement) {
77
+ this.keyEventElement.removeEventListener('keydown', this.onKeyDown);
78
+ }
79
+ const body = this.$document[0].body;
80
+ body.removeEventListener('click', this.onClickElsewhere);
81
+ this.observer.disconnect();
82
+ }
83
+ $onInit() {
84
+ var _a;
85
+ const body = this.$document[0].body;
86
+ body.addEventListener('click', this.onClickElsewhere);
87
+ this.kbSelectedIndex = ((_a = this.fontWeightOptions) === null || _a === void 0 ? void 0 : _a.indexOf(this.fontWeight || '')) || -1;
88
+ // Load preview fonts when the font family or weight options change
89
+ this.$scope.$watchCollection(() => [this.fontFamily, this.fontWeightOptions], () => {
90
+ var _a;
91
+ if (this.fontFamily && ((_a = this.fontWeightOptions) === null || _a === void 0 ? void 0 : _a.length)) {
92
+ this.webfontLoaderService.loadFontVariants(this.fontFamily, this.fontWeightOptions);
93
+ }
94
+ });
95
+ this.observer = new MutationObserver(() => {
96
+ this.keyEventElement = this.$element.parent().find('.c-font-weight-selector__dropdown__matches')[0];
97
+ if (this.keyEventElement) {
98
+ this.keyEventElement.addEventListener('keydown', this.onKeyDown);
99
+ this.observer.disconnect();
100
+ }
101
+ });
102
+ this.observer.observe(body, { attributes: true, childList: true, characterData: false, subtree: true });
103
+ }
104
+ clickSelect($event) {
105
+ this.isDropdownVisible = !this.isDropdownVisible;
106
+ if (this.isDropdownVisible) {
107
+ this.$timeout(() => {
108
+ var _a;
109
+ (_a = this.keyEventElement) === null || _a === void 0 ? void 0 : _a.focus();
110
+ }, 250);
111
+ }
112
+ $event.stopPropagation();
113
+ }
114
+ // When the user mouses over the dropdown, we should remove any keyboard
115
+ // highlighting, since the mouse hover provides it too.
116
+ dropdownWasMousedOver() {
117
+ this.interactionMode = 'mouse';
118
+ this.kbSelectedIndex = -1;
119
+ }
120
+ variantWasSelected(variant) {
121
+ var _a;
122
+ if (!this.fontFamily) {
123
+ throw new Error('Font family is unexpectedly undefined.');
124
+ }
125
+ this.isDropdownVisible = false;
126
+ (_a = this.onFontWeightSelect) === null || _a === void 0 ? void 0 : _a.call(this, { fontWeight: variant });
127
+ }
128
+ scrollToSelection(index) {
129
+ const row = this.$element.find('.c-font-weight-selector__match-row')[index];
130
+ row === null || row === void 0 ? void 0 : row.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
131
+ }
132
+ };
133
+ __decorate([
134
+ decorators_1.Input(),
135
+ __metadata("design:type", String)
136
+ ], FontWeightSelectorController.prototype, "fontFamily", void 0);
137
+ __decorate([
138
+ decorators_1.Input(),
139
+ __metadata("design:type", String)
140
+ ], FontWeightSelectorController.prototype, "fontWeight", void 0);
141
+ __decorate([
142
+ decorators_1.Input(),
143
+ __metadata("design:type", Array)
144
+ ], FontWeightSelectorController.prototype, "fontWeightOptions", void 0);
145
+ __decorate([
146
+ decorators_1.Output('&?'),
147
+ __metadata("design:type", Function)
148
+ ], FontWeightSelectorController.prototype, "onFontWeightSelect", void 0);
149
+ FontWeightSelectorController = __decorate([
150
+ decorators_1.Component({
151
+ selector: 'mflyFontWeightSelector',
152
+ template: require('./font-weight-selector.html')
153
+ }),
154
+ __param(0, decorators_1.Inject('$document')),
155
+ __param(1, decorators_1.Inject('$scope')),
156
+ __param(2, decorators_1.Inject('$element')),
157
+ __param(3, decorators_1.Inject('$timeout')),
158
+ __param(4, decorators_1.Inject('webfontLoaderService')),
159
+ __metadata("design:paramtypes", [Object, Object, Object, Function, webfont_loader_service_1.default])
160
+ ], FontWeightSelectorController);
161
+ exports.default = FontWeightSelectorController;
162
+ //# sourceMappingURL=font-weight-selector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"font-weight-selector.js","sourceRoot":"","sources":["../../src/components/font-weight-selector/font-weight-selector.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,8CAAgE;AAChE,qGAA0E;AAO1E,IAAqB,4BAA4B,GAAjD,MAAqB,4BAA4B;IAchD,YAC8B,SAA8B,EACjC,MAAiB,EACf,QAA6B,EAC7B,QAA4B,EAChB,oBAA0C;QAJrD,cAAS,GAAT,SAAS,CAAqB;QACjC,WAAM,GAAN,MAAM,CAAW;QACf,aAAQ,GAAR,QAAQ,CAAqB;QAC7B,aAAQ,GAAR,QAAQ,CAAoB;QAChB,yBAAoB,GAApB,oBAAoB,CAAsB;QAXzE,oBAAe,GAAyB,UAAU,CAAA;QAClD,sBAAiB,GAAY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AAA,mBAAM,CAAC,UAAU,CAAC,CAAA;IAClB,WAAA,mBAAM,CAAC,UAAU,CAAC,CAAA;IAClB,WAAA,mBAAM,CAAC,sBAAsB,CAAC,CAAA;uEAA+B,gCAAoB;GAnB/D,4BAA4B,CA0IhD;kBA1IoB,4BAA4B"}
@@ -0,0 +1 @@
1
+ import './font-weight-selector';
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ require("./font-weight-selector");
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/font-weight-selector/index.ts"],"names":[],"mappings":";;AAAA,kCAA+B"}
package/lib/index.d.ts CHANGED
@@ -14,6 +14,7 @@ import './dropdown';
14
14
  import './feedback';
15
15
  import './first-time-motivator';
16
16
  import './font-selector';
17
+ import './font-weight-selector';
17
18
  import './footer';
18
19
  import './form-validation-utils';
19
20
  import './full-screen';
package/lib/index.js CHANGED
@@ -16,6 +16,7 @@ require("./dropdown");
16
16
  require("./feedback");
17
17
  require("./first-time-motivator");
18
18
  require("./font-selector");
19
+ require("./font-weight-selector");
19
20
  require("./footer");
20
21
  require("./form-validation-utils");
21
22
  require("./full-screen");
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/components/index.ts"],"names":[],"mappings":";;AAAA,oCAAiC;AACjC,2BAAwB;AACxB,wBAAqB;AACrB,mBAAgB;AAChB,sBAAmB;AACnB,sBAAmB;AACnB,yBAAsB;AACtB,yBAAsB;AACtB,uBAAoB;AACpB,wBAAqB;AACrB,mCAAgC;AAChC,2BAAwB;AACxB,sBAAmB;AACnB,sBAAmB;AACnB,kCAA+B;AAC/B,2BAAwB;AACxB,oBAAiB;AACjB,mCAAgC;AAChC,yBAAsB;AACtB,6BAA0B;AAC1B,uBAAoB;AACpB,2BAAwB;AACxB,kBAAe;AACf,+BAA4B;AAC5B,+BAA4B;AAC5B,6BAA0B;AAC1B,2BAAwB;AACxB,mBAAgB;AAChB,4BAAyB;AACzB,4BAAyB;AACzB,oBAAiB;AACjB,0BAAuB;AACvB,6BAA0B;AAC1B,+BAA4B;AAC5B,uBAAoB;AACpB,yBAAsB;AACtB,+BAA4B;AAC5B,kBAAe;AACf,uBAAoB;AACpB,sBAAmB;AACnB,uBAAoB;AACpB,mBAAgB;AAChB,wBAAqB;AACrB,uBAAoB;AACpB,kBAAe;AACf,yBAAsB;AACtB,8BAA2B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/components/index.ts"],"names":[],"mappings":";;AAAA,oCAAiC;AACjC,2BAAwB;AACxB,wBAAqB;AACrB,mBAAgB;AAChB,sBAAmB;AACnB,sBAAmB;AACnB,yBAAsB;AACtB,yBAAsB;AACtB,uBAAoB;AACpB,wBAAqB;AACrB,mCAAgC;AAChC,2BAAwB;AACxB,sBAAmB;AACnB,sBAAmB;AACnB,kCAA+B;AAC/B,2BAAwB;AACxB,kCAA+B;AAC/B,oBAAiB;AACjB,mCAAgC;AAChC,yBAAsB;AACtB,6BAA0B;AAC1B,uBAAoB;AACpB,2BAAwB;AACxB,kBAAe;AACf,+BAA4B;AAC5B,+BAA4B;AAC5B,6BAA0B;AAC1B,2BAAwB;AACxB,mBAAgB;AAChB,4BAAyB;AACzB,4BAAyB;AACzB,oBAAiB;AACjB,0BAAuB;AACvB,6BAA0B;AAC1B,+BAA4B;AAC5B,uBAAoB;AACpB,yBAAsB;AACtB,+BAA4B;AAC5B,kBAAe;AACf,uBAAoB;AACpB,sBAAmB;AACnB,uBAAoB;AACpB,mBAAgB;AAChB,wBAAqB;AACrB,uBAAoB;AACpB,kBAAe;AACf,yBAAsB;AACtB,8BAA2B"}
@@ -4,10 +4,12 @@ import { Delta, EmitterSource } from 'quill/core';
4
4
  import type { TranslateFactory } from '../translate/translate-factory';
5
5
  import RichTextService from './rich-text.service';
6
6
  import { IComponentController } from 'angular';
7
+ import GoogleWebfontsApiService from '../font-selector/google-webfonts-api.service';
7
8
  export default class RichTextComponentController implements IComponentController {
8
9
  private $element;
9
10
  private $rootScope;
10
11
  private $timeout;
12
+ private googleWebfontsApiService;
11
13
  private richTextService;
12
14
  private translateFactory;
13
15
  allowColorSelection?: boolean;
@@ -21,6 +23,8 @@ export default class RichTextComponentController implements IComponentController
21
23
  protected requiredText: string;
22
24
  protected selectedColor: string;
23
25
  protected selectedFont: string;
26
+ protected selectedFontAvailableWeights: number[];
27
+ protected selectedFontWeight: number;
24
28
  protected toolbarId: string;
25
29
  protected validationForm: ng.IFormController;
26
30
  private colorPicker;
@@ -30,13 +34,14 @@ export default class RichTextComponentController implements IComponentController
30
34
  private DEFAULT_COLOR;
31
35
  private DEFAULT_FONT;
32
36
  private DEFAULT_SIZE;
37
+ private DEFAULT_WEIGHT;
33
38
  private HEADING_1_COLOR;
34
39
  private HEADING_1_FONT;
35
40
  private HEADING_1_SIZE;
36
41
  private HEADING_2_COLOR;
37
42
  private HEADING_2_FONT;
38
43
  private HEADING_2_SIZE;
39
- constructor($element: ng.IAugmentedJQuery, $rootScope: JSUIRootScope, $timeout: ng.ITimeoutService, richTextService: RichTextService, translateFactory: TranslateFactory);
44
+ constructor($element: ng.IAugmentedJQuery, $rootScope: JSUIRootScope, $timeout: ng.ITimeoutService, googleWebfontsApiService: GoogleWebfontsApiService, richTextService: RichTextService, translateFactory: TranslateFactory);
40
45
  $onChanges(changes: {
41
46
  isRequired?: ng.IChangesObject<boolean>;
42
47
  }): void;
@@ -45,7 +50,8 @@ export default class RichTextComponentController implements IComponentController
45
50
  $postLink(): void;
46
51
  protected colorChanged(): void;
47
52
  protected colorInputOpened(): void;
48
- protected fontSelected(fontFamily: string): void;
53
+ protected fontSelected(fontFamily: string, fontWeightOptions?: number[]): void;
54
+ protected fontWeightSelected(fontWeight: number): void;
49
55
  /** The user entered/deleted/modified some text. Handle any formatting issues, then store the model. */
50
56
  protected onTextChange(delta: Delta, oldContents: Delta, source: EmitterSource): void;
51
57
  /** The user moved the cursor. Fix missing formats and update the toolbar to reflect the current selection. */
@@ -78,6 +84,7 @@ export default class RichTextComponentController implements IComponentController
78
84
  private fixMissingFormats;
79
85
  private getColorFromFormat;
80
86
  private getFontFromFormat;
87
+ private getFontWeightFromFormat;
81
88
  /**
82
89
  * Scans the entire text and returns an array of objects denoting which font is used for each range.
83
90
  */