fontdue-js 0.1.3 → 1.1.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 (42) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/CharacterViewer.d.ts +3 -0
  3. package/CharacterViewer.js +1 -0
  4. package/README.md +37 -25
  5. package/dist/__generated__/CharacterViewer_SlugQuery.graphql.d.ts +20 -0
  6. package/dist/__generated__/CharacterViewer_SlugQuery.graphql.js +289 -0
  7. package/dist/__generated__/TypeTesterFeatures_fontStyle.graphql.d.ts +1 -7
  8. package/dist/__generated__/TypeTesterFeatures_fontStyle.graphql.js +3 -35
  9. package/dist/__generated__/TypeTesterFloatingToolbar_testers.graphql.d.ts +1 -1
  10. package/dist/__generated__/TypeTesterFloatingToolbar_testers.graphql.js +5 -1
  11. package/dist/__generated__/TypeTester_StyleQuery.graphql.js +14 -9
  12. package/dist/__generated__/TypeTester_fontStyle.graphql.d.ts +1 -1
  13. package/dist/__generated__/TypeTester_fontStyle.graphql.js +5 -1
  14. package/dist/__generated__/TypeTestersIDQuery.graphql.js +14 -9
  15. package/dist/__generated__/TypeTestersSlugQuery.graphql.js +14 -9
  16. package/dist/__generated__/useFeaturesData_fontStyle.graphql.d.ts +19 -0
  17. package/dist/__generated__/useFeaturesData_fontStyle.graphql.js +59 -0
  18. package/dist/components/CharacterViewer/index.d.ts +2 -1
  19. package/dist/components/CharacterViewer/index.js +51 -25
  20. package/dist/components/ConfigContext.d.ts +22 -4
  21. package/dist/components/ConfigContext.js +15 -6
  22. package/dist/components/SKUPrice/index.js +6 -5
  23. package/dist/components/Select/index.js +1 -3
  24. package/dist/components/TypeTester/TypeTesterFeatures.d.ts +1 -1
  25. package/dist/components/TypeTester/TypeTesterFeatures.js +21 -36
  26. package/dist/components/TypeTester/TypeTesterFeaturesButton.d.ts +4 -3
  27. package/dist/components/TypeTester/TypeTesterFeaturesButton.js +71 -14
  28. package/dist/components/TypeTester/TypeTesterFloatingToolbar.js +5 -7
  29. package/dist/components/TypeTester/TypeTesterSlider.d.ts +1 -0
  30. package/dist/components/TypeTester/TypeTesterSlider.js +2 -1
  31. package/dist/components/TypeTester/TypeTesterStandalone.js +1 -4
  32. package/dist/components/TypeTester/TypeTesterState.d.ts +1 -0
  33. package/dist/components/TypeTester/TypeTesterState.js +7 -0
  34. package/dist/components/TypeTester/TypeTesterToolbar.d.ts +3 -0
  35. package/dist/components/TypeTester/TypeTesterToolbar.js +27 -8
  36. package/dist/components/TypeTester/index.d.ts +12 -1
  37. package/dist/components/TypeTester/index.js +26 -12
  38. package/dist/components/TypeTester/useFeaturesData.d.ts +19 -0
  39. package/dist/components/TypeTester/useFeaturesData.js +51 -0
  40. package/fontdue.css +32 -3
  41. package/fontdue.css.map +1 -1
  42. package/package.json +1 -1
@@ -68,18 +68,13 @@ fragment SelectButton_sku_2AMk59 on Sku {
68
68
  }
69
69
 
70
70
  fragment TypeTesterFeatures_fontStyle on FontStyle {
71
- fontFeatures {
72
- supportedFeatures
73
- stylisticSetNames {
74
- featureName
75
- humanName
76
- }
77
- }
71
+ ...useFeaturesData_fontStyle
78
72
  }
79
73
 
80
74
  fragment TypeTesterFloatingToolbar_testers on TypeTester {
81
75
  id
82
76
  fontStyle {
77
+ ...useFeaturesData_fontStyle
83
78
  ...TypeTesterFeatures_fontStyle
84
79
  id
85
80
  }
@@ -115,6 +110,16 @@ fragment TypeTesters_collection_12wzh on FontCollection {
115
110
  id
116
111
  }
117
112
  }
113
+
114
+ fragment useFeaturesData_fontStyle on FontStyle {
115
+ fontFeatures {
116
+ supportedFeatures
117
+ stylisticSetNames {
118
+ featureName
119
+ humanName
120
+ }
121
+ }
122
+ }
118
123
  */
119
124
  const node = function () {
120
125
  var v0 = {
@@ -544,12 +549,12 @@ const node = function () {
544
549
  }]
545
550
  },
546
551
  "params": {
547
- "cacheID": "d23e8efdfdb2d93ae2c1c86a41de378b",
552
+ "cacheID": "8469d5d52b3ecd33657647bd23a4e689",
548
553
  "id": null,
549
554
  "metadata": {},
550
555
  "name": "TypeTestersIDQuery",
551
556
  "operationKind": "query",
552
- "text": "query TypeTestersIDQuery(\n $collectionId: ID!\n $includePriceBar: Boolean!\n $tags: [String!]\n $excludeTags: [String!]\n) {\n collection: node(id: $collectionId) {\n __typename\n ...TypeTesters_collection_12wzh\n id\n }\n}\n\nfragment PriceBarSection_node on FontCollection {\n id\n name\n collectionType\n sku {\n ...SelectButton_sku_2AMk59\n id\n price(licenseOptions: []) {\n ...Price_price\n }\n }\n totalStyles\n totalStylesPrice(licenseOptions: []) {\n ...Price_price\n }\n}\n\nfragment PriceBar_node on FontCollection {\n ...PriceBarSection_node\n parent {\n ...PriceBarSection_node\n id\n }\n}\n\nfragment Price_price on Money {\n amount\n currency\n}\n\nfragment SKUPrice_sku_2AMk59 on Sku {\n id\n price(licenseOptions: []) {\n amount\n ...Price_price\n }\n}\n\nfragment SelectButton_sku_2AMk59 on Sku {\n id\n ...SKUPrice_sku_2AMk59\n}\n\nfragment TypeTesterFeatures_fontStyle on FontStyle {\n fontFeatures {\n supportedFeatures\n stylisticSetNames {\n featureName\n humanName\n }\n }\n}\n\nfragment TypeTesterFloatingToolbar_testers on TypeTester {\n id\n fontStyle {\n ...TypeTesterFeatures_fontStyle\n id\n }\n}\n\nfragment TypeTesters_collection_12wzh on FontCollection {\n typeTesters(first: 999, tags: $tags, excludeTags: $excludeTags) {\n edges {\n node {\n id\n content\n size\n lineHeight\n direction\n fontStyle {\n id\n family {\n id\n }\n }\n ...TypeTesterFloatingToolbar_testers\n }\n }\n }\n typeTesterFeatures\n id\n ...PriceBar_node @include(if: $includePriceBar)\n families: children(collectionTypes: [FAMILY]) {\n id\n ...PriceBar_node @include(if: $includePriceBar)\n }\n parent {\n id\n }\n}\n"
557
+ "text": "query TypeTestersIDQuery(\n $collectionId: ID!\n $includePriceBar: Boolean!\n $tags: [String!]\n $excludeTags: [String!]\n) {\n collection: node(id: $collectionId) {\n __typename\n ...TypeTesters_collection_12wzh\n id\n }\n}\n\nfragment PriceBarSection_node on FontCollection {\n id\n name\n collectionType\n sku {\n ...SelectButton_sku_2AMk59\n id\n price(licenseOptions: []) {\n ...Price_price\n }\n }\n totalStyles\n totalStylesPrice(licenseOptions: []) {\n ...Price_price\n }\n}\n\nfragment PriceBar_node on FontCollection {\n ...PriceBarSection_node\n parent {\n ...PriceBarSection_node\n id\n }\n}\n\nfragment Price_price on Money {\n amount\n currency\n}\n\nfragment SKUPrice_sku_2AMk59 on Sku {\n id\n price(licenseOptions: []) {\n amount\n ...Price_price\n }\n}\n\nfragment SelectButton_sku_2AMk59 on Sku {\n id\n ...SKUPrice_sku_2AMk59\n}\n\nfragment TypeTesterFeatures_fontStyle on FontStyle {\n ...useFeaturesData_fontStyle\n}\n\nfragment TypeTesterFloatingToolbar_testers on TypeTester {\n id\n fontStyle {\n ...useFeaturesData_fontStyle\n ...TypeTesterFeatures_fontStyle\n id\n }\n}\n\nfragment TypeTesters_collection_12wzh on FontCollection {\n typeTesters(first: 999, tags: $tags, excludeTags: $excludeTags) {\n edges {\n node {\n id\n content\n size\n lineHeight\n direction\n fontStyle {\n id\n family {\n id\n }\n }\n ...TypeTesterFloatingToolbar_testers\n }\n }\n }\n typeTesterFeatures\n id\n ...PriceBar_node @include(if: $includePriceBar)\n families: children(collectionTypes: [FAMILY]) {\n id\n ...PriceBar_node @include(if: $includePriceBar)\n }\n parent {\n id\n }\n}\n\nfragment useFeaturesData_fontStyle on FontStyle {\n fontFeatures {\n supportedFeatures\n stylisticSetNames {\n featureName\n humanName\n }\n }\n}\n"
553
558
  }
554
559
  };
555
560
  }();
@@ -73,18 +73,13 @@ fragment SelectButton_sku_2AMk59 on Sku {
73
73
  }
74
74
 
75
75
  fragment TypeTesterFeatures_fontStyle on FontStyle {
76
- fontFeatures {
77
- supportedFeatures
78
- stylisticSetNames {
79
- featureName
80
- humanName
81
- }
82
- }
76
+ ...useFeaturesData_fontStyle
83
77
  }
84
78
 
85
79
  fragment TypeTesterFloatingToolbar_testers on TypeTester {
86
80
  id
87
81
  fontStyle {
82
+ ...useFeaturesData_fontStyle
88
83
  ...TypeTesterFeatures_fontStyle
89
84
  id
90
85
  }
@@ -120,6 +115,16 @@ fragment TypeTesters_collection_12wzh on FontCollection {
120
115
  id
121
116
  }
122
117
  }
118
+
119
+ fragment useFeaturesData_fontStyle on FontStyle {
120
+ fontFeatures {
121
+ supportedFeatures
122
+ stylisticSetNames {
123
+ featureName
124
+ humanName
125
+ }
126
+ }
127
+ }
123
128
  */
124
129
  const node = function () {
125
130
  var v0 = {
@@ -578,12 +583,12 @@ const node = function () {
578
583
  }]
579
584
  },
580
585
  "params": {
581
- "cacheID": "5328793dd1b6cba8d77d87463d3d2228",
586
+ "cacheID": "72038e3cbec9e6fd1b9673255d20d710",
582
587
  "id": null,
583
588
  "metadata": {},
584
589
  "name": "TypeTestersSlugQuery",
585
590
  "operationKind": "query",
586
- "text": "query TypeTestersSlugQuery(\n $collectionSlug: String!\n $includePriceBar: Boolean!\n $tags: [String!]\n $excludeTags: [String!]\n) {\n viewer {\n slug(name: $collectionSlug) {\n collection: fontCollection {\n ...TypeTesters_collection_12wzh\n id\n }\n id\n }\n id\n }\n}\n\nfragment PriceBarSection_node on FontCollection {\n id\n name\n collectionType\n sku {\n ...SelectButton_sku_2AMk59\n id\n price(licenseOptions: []) {\n ...Price_price\n }\n }\n totalStyles\n totalStylesPrice(licenseOptions: []) {\n ...Price_price\n }\n}\n\nfragment PriceBar_node on FontCollection {\n ...PriceBarSection_node\n parent {\n ...PriceBarSection_node\n id\n }\n}\n\nfragment Price_price on Money {\n amount\n currency\n}\n\nfragment SKUPrice_sku_2AMk59 on Sku {\n id\n price(licenseOptions: []) {\n amount\n ...Price_price\n }\n}\n\nfragment SelectButton_sku_2AMk59 on Sku {\n id\n ...SKUPrice_sku_2AMk59\n}\n\nfragment TypeTesterFeatures_fontStyle on FontStyle {\n fontFeatures {\n supportedFeatures\n stylisticSetNames {\n featureName\n humanName\n }\n }\n}\n\nfragment TypeTesterFloatingToolbar_testers on TypeTester {\n id\n fontStyle {\n ...TypeTesterFeatures_fontStyle\n id\n }\n}\n\nfragment TypeTesters_collection_12wzh on FontCollection {\n typeTesters(first: 999, tags: $tags, excludeTags: $excludeTags) {\n edges {\n node {\n id\n content\n size\n lineHeight\n direction\n fontStyle {\n id\n family {\n id\n }\n }\n ...TypeTesterFloatingToolbar_testers\n }\n }\n }\n typeTesterFeatures\n id\n ...PriceBar_node @include(if: $includePriceBar)\n families: children(collectionTypes: [FAMILY]) {\n id\n ...PriceBar_node @include(if: $includePriceBar)\n }\n parent {\n id\n }\n}\n"
591
+ "text": "query TypeTestersSlugQuery(\n $collectionSlug: String!\n $includePriceBar: Boolean!\n $tags: [String!]\n $excludeTags: [String!]\n) {\n viewer {\n slug(name: $collectionSlug) {\n collection: fontCollection {\n ...TypeTesters_collection_12wzh\n id\n }\n id\n }\n id\n }\n}\n\nfragment PriceBarSection_node on FontCollection {\n id\n name\n collectionType\n sku {\n ...SelectButton_sku_2AMk59\n id\n price(licenseOptions: []) {\n ...Price_price\n }\n }\n totalStyles\n totalStylesPrice(licenseOptions: []) {\n ...Price_price\n }\n}\n\nfragment PriceBar_node on FontCollection {\n ...PriceBarSection_node\n parent {\n ...PriceBarSection_node\n id\n }\n}\n\nfragment Price_price on Money {\n amount\n currency\n}\n\nfragment SKUPrice_sku_2AMk59 on Sku {\n id\n price(licenseOptions: []) {\n amount\n ...Price_price\n }\n}\n\nfragment SelectButton_sku_2AMk59 on Sku {\n id\n ...SKUPrice_sku_2AMk59\n}\n\nfragment TypeTesterFeatures_fontStyle on FontStyle {\n ...useFeaturesData_fontStyle\n}\n\nfragment TypeTesterFloatingToolbar_testers on TypeTester {\n id\n fontStyle {\n ...useFeaturesData_fontStyle\n ...TypeTesterFeatures_fontStyle\n id\n }\n}\n\nfragment TypeTesters_collection_12wzh on FontCollection {\n typeTesters(first: 999, tags: $tags, excludeTags: $excludeTags) {\n edges {\n node {\n id\n content\n size\n lineHeight\n direction\n fontStyle {\n id\n family {\n id\n }\n }\n ...TypeTesterFloatingToolbar_testers\n }\n }\n }\n typeTesterFeatures\n id\n ...PriceBar_node @include(if: $includePriceBar)\n families: children(collectionTypes: [FAMILY]) {\n id\n ...PriceBar_node @include(if: $includePriceBar)\n }\n parent {\n id\n }\n}\n\nfragment useFeaturesData_fontStyle on FontStyle {\n fontFeatures {\n supportedFeatures\n stylisticSetNames {\n featureName\n humanName\n }\n }\n}\n"
587
592
  }
588
593
  };
589
594
  }();
@@ -0,0 +1,19 @@
1
+ import { ReaderFragment } from "relay-runtime";
2
+ import { FragmentRefs } from "relay-runtime";
3
+ export declare type useFeaturesData_fontStyle = {
4
+ readonly fontFeatures: {
5
+ readonly supportedFeatures: ReadonlyArray<string>;
6
+ readonly stylisticSetNames: ReadonlyArray<{
7
+ readonly featureName: string;
8
+ readonly humanName: string;
9
+ }>;
10
+ };
11
+ readonly " $refType": "useFeaturesData_fontStyle";
12
+ };
13
+ export declare type useFeaturesData_fontStyle$data = useFeaturesData_fontStyle;
14
+ export declare type useFeaturesData_fontStyle$key = {
15
+ readonly " $data"?: useFeaturesData_fontStyle$data;
16
+ readonly " $fragmentRefs": FragmentRefs<"useFeaturesData_fontStyle">;
17
+ };
18
+ declare const node: ReaderFragment;
19
+ export default node;
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ /* tslint:disable */
9
+
10
+ /* eslint-disable */
11
+ // @ts-nocheck
12
+ const node = {
13
+ "argumentDefinitions": [],
14
+ "kind": "Fragment",
15
+ "metadata": null,
16
+ "name": "useFeaturesData_fontStyle",
17
+ "selections": [{
18
+ "alias": null,
19
+ "args": null,
20
+ "concreteType": "FontFeatures",
21
+ "kind": "LinkedField",
22
+ "name": "fontFeatures",
23
+ "plural": false,
24
+ "selections": [{
25
+ "alias": null,
26
+ "args": null,
27
+ "kind": "ScalarField",
28
+ "name": "supportedFeatures",
29
+ "storageKey": null
30
+ }, {
31
+ "alias": null,
32
+ "args": null,
33
+ "concreteType": "StylisticSetName",
34
+ "kind": "LinkedField",
35
+ "name": "stylisticSetNames",
36
+ "plural": true,
37
+ "selections": [{
38
+ "alias": null,
39
+ "args": null,
40
+ "kind": "ScalarField",
41
+ "name": "featureName",
42
+ "storageKey": null
43
+ }, {
44
+ "alias": null,
45
+ "args": null,
46
+ "kind": "ScalarField",
47
+ "name": "humanName",
48
+ "storageKey": null
49
+ }],
50
+ "storageKey": null
51
+ }],
52
+ "storageKey": null
53
+ }],
54
+ "type": "FontStyle",
55
+ "abstractKey": null
56
+ };
57
+ node.hash = '3c48a87b1b19f52e3dda10fc11f0030a';
58
+ var _default = node;
59
+ exports.default = _default;
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  interface CharacterViewer_props {
3
- collectionId: string;
3
+ collectionId?: string;
4
+ collectionSlug?: string;
4
5
  }
5
6
  declare const CharacterViewerQueryRenderer: React.FC<CharacterViewer_props>;
6
7
  export default CharacterViewerQueryRenderer;
@@ -9,8 +9,6 @@ var _react = _interopRequireWildcard(require("react"));
9
9
 
10
10
  var _reactRelay = require("react-relay");
11
11
 
12
- var _reactStaticContainer = _interopRequireDefault(require("react-static-container"));
13
-
14
12
  var _resizeObserver = _interopRequireDefault(require("@react-hook/resize-observer"));
15
13
 
16
14
  var _utils = require("../../utils");
@@ -19,7 +17,7 @@ var _Select = _interopRequireDefault(require("../Select"));
19
17
 
20
18
  var _useFontStyle = _interopRequireDefault(require("../useFontStyle"));
21
19
 
22
- var _CharacterViewer_family, _CharacterViewer_collection, _CharacterViewer_Query;
20
+ var _CharacterViewer_family, _CharacterViewer_collection, _CharacterViewer_Query, _CharacterViewer_SlugQuery;
23
21
 
24
22
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
25
23
 
@@ -51,7 +49,7 @@ const collectionInfo = collection => ({
51
49
  });
52
50
 
53
51
  const CharacterViewerComponent = _ref => {
54
- var _collection$children$, _collection$children, _ref2, _collection$featureSt, _collection$featureSt2, _collection$fontStyle, _collection$fontStyle2, _collection$children2, _collection$children3, _collection$children4, _collection$children5, _fontStyle$characterB, _fontStyle$characterB2, _fontStyle$featureCha, _fontStyle$featureCha2, _fontStyle$featureCha3, _fontStyle$featureCha4, _fontStyle$featureCha5, _fontStyle$characterB3, _fontStyle$featureCha6;
52
+ var _collection$children$, _collection$children, _ref2, _collection$featureSt, _collection$featureSt2, _collection$fontStyle, _collection$fontStyle2, _collection$children2, _collection$children3, _collection$children4, _collection$children5, _fontStyle$characterB, _fontStyle$characterB2, _fontStyle$featureCha, _fontStyle$featureCha2, _fontStyle$featureCha3, _fontStyle$featureCha4, _fontStyle$featureCha5, _fontStyle$characterB3, _fontStyle$featureCha6, _fontStyle$featureCha7;
55
53
 
56
54
  let {
57
55
  collection
@@ -149,7 +147,7 @@ const CharacterViewerComponent = _ref => {
149
147
  onMouseEnter: () => setActiveCharacter(chars),
150
148
  "data-selected": selectedCharacter === chars
151
149
  }, chars))));
152
- }))), /*#__PURE__*/_react.default.createElement("div", {
150
+ }))), (_fontStyle$featureCha6 = fontStyle.featureCharacters) !== null && _fontStyle$featureCha6 !== void 0 && _fontStyle$featureCha6.length ? /*#__PURE__*/_react.default.createElement("div", {
153
151
  className: "character-viewer__features-map"
154
152
  }, /*#__PURE__*/_react.default.createElement("div", {
155
153
  className: "character-viewer__feature-monitor"
@@ -197,7 +195,7 @@ const CharacterViewerComponent = _ref => {
197
195
  style: {
198
196
  '--width': blocksWidth
199
197
  }
200
- }, (_fontStyle$featureCha6 = fontStyle.featureCharacters) === null || _fontStyle$featureCha6 === void 0 ? void 0 : _fontStyle$featureCha6.map((_ref4, i) => {
198
+ }, (_fontStyle$featureCha7 = fontStyle.featureCharacters) === null || _fontStyle$featureCha7 === void 0 ? void 0 : _fontStyle$featureCha7.map((_ref4, i) => {
201
199
  let {
202
200
  name,
203
201
  feature,
@@ -220,7 +218,7 @@ const CharacterViewerComponent = _ref => {
220
218
  onMouseEnter: () => setActiveFeatureCharacter([chars, feature]),
221
219
  "data-selected": (selectedFeatureCharacter === null || selectedFeatureCharacter === void 0 ? void 0 : selectedFeatureCharacter[0]) === chars && (selectedFeatureCharacter === null || selectedFeatureCharacter === void 0 ? void 0 : selectedFeatureCharacter[1]) === feature
222
220
  }, chars))));
223
- }))));
221
+ }))) : null);
224
222
  };
225
223
 
226
224
  _CharacterViewer_family !== void 0 ? _CharacterViewer_family : (_CharacterViewer_family = require("../../__generated__/CharacterViewer_family.graphql"), _CharacterViewer_family.hash && _CharacterViewer_family.hash !== "2883e053de6bd4a34d802fe4af824991" && console.error("The definition of 'CharacterViewer_family' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _CharacterViewer_family);
@@ -230,26 +228,54 @@ const CharacterViewer = (0, _reactRelay.createFragmentContainer)(CharacterViewer
230
228
 
231
229
  const CharacterViewerQueryRenderer = _ref5 => {
232
230
  let {
233
- collectionId
231
+ collectionId,
232
+ collectionSlug
234
233
  } = _ref5;
235
234
  const environment = (0, _reactRelay.useRelayEnvironment)();
236
- return /*#__PURE__*/_react.default.createElement(_reactRelay.QueryRenderer, {
237
- query: _CharacterViewer_Query !== void 0 ? _CharacterViewer_Query : (_CharacterViewer_Query = require("../../__generated__/CharacterViewer_Query.graphql"), _CharacterViewer_Query.hash && _CharacterViewer_Query.hash !== "10b58f0e5e086adbcd2a0d4cd44c442c" && console.error("The definition of 'CharacterViewer_Query' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _CharacterViewer_Query),
238
- variables: {
239
- collectionId
240
- },
241
- environment: environment,
242
- render: _ref6 => {
243
- let {
244
- props
245
- } = _ref6;
246
- return /*#__PURE__*/_react.default.createElement(_reactStaticContainer.default, {
247
- shouldUpdate: props
248
- }, props !== null && props !== void 0 && props.node ? /*#__PURE__*/_react.default.createElement(CharacterViewer, {
249
- collection: props.node
250
- }) : null);
251
- }
252
- });
235
+
236
+ if (collectionId) {
237
+ return /*#__PURE__*/_react.default.createElement(_reactRelay.QueryRenderer, {
238
+ query: _CharacterViewer_Query !== void 0 ? _CharacterViewer_Query : (_CharacterViewer_Query = require("../../__generated__/CharacterViewer_Query.graphql"), _CharacterViewer_Query.hash && _CharacterViewer_Query.hash !== "10b58f0e5e086adbcd2a0d4cd44c442c" && console.error("The definition of 'CharacterViewer_Query' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _CharacterViewer_Query),
239
+ variables: {
240
+ collectionId
241
+ },
242
+ environment: environment,
243
+ render: _ref6 => {
244
+ let {
245
+ props
246
+ } = _ref6;
247
+ const node = props === null || props === void 0 ? void 0 : props.node;
248
+ if (!node) return null;
249
+ return /*#__PURE__*/_react.default.createElement(CharacterViewer, {
250
+ collection: node
251
+ });
252
+ }
253
+ });
254
+ }
255
+
256
+ if (collectionSlug) {
257
+ return /*#__PURE__*/_react.default.createElement(_reactRelay.QueryRenderer, {
258
+ query: _CharacterViewer_SlugQuery !== void 0 ? _CharacterViewer_SlugQuery : (_CharacterViewer_SlugQuery = require("../../__generated__/CharacterViewer_SlugQuery.graphql"), _CharacterViewer_SlugQuery.hash && _CharacterViewer_SlugQuery.hash !== "de903e7c2640562aee374a900e089c9c" && console.error("The definition of 'CharacterViewer_SlugQuery' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _CharacterViewer_SlugQuery),
259
+ variables: {
260
+ collectionSlug
261
+ },
262
+ environment: environment,
263
+ render: _ref7 => {
264
+ var _props$viewer, _props$viewer$slug;
265
+
266
+ let {
267
+ props
268
+ } = _ref7;
269
+ const collection = props === null || props === void 0 ? void 0 : (_props$viewer = props.viewer) === null || _props$viewer === void 0 ? void 0 : (_props$viewer$slug = _props$viewer.slug) === null || _props$viewer$slug === void 0 ? void 0 : _props$viewer$slug.fontCollection;
270
+ if (!collection) return null;
271
+ return /*#__PURE__*/_react.default.createElement(CharacterViewer, {
272
+ collection: collection
273
+ });
274
+ }
275
+ });
276
+ }
277
+
278
+ throw new Error('Unable to render CharacterViewer without a collectionId or collectionSlug');
253
279
  };
254
280
 
255
281
  var _default = CharacterViewerQueryRenderer;
@@ -11,8 +11,6 @@ export interface Config {
11
11
  }
12
12
  export declare const makeConfig: (config?: Config | undefined) => {
13
13
  typeTester: {
14
- min: number;
15
- max: number;
16
14
  autofitOnChange: boolean;
17
15
  truncate: boolean;
18
16
  priceText: boolean;
@@ -28,6 +26,7 @@ export declare const makeConfig: (config?: Config | undefined) => {
28
26
  groupEdit: boolean;
29
27
  bulletStyle: "square" | "round";
30
28
  openTypeFeatures: {
29
+ interactionStyle: "select" | "panel";
31
30
  columns: {
32
31
  features: (string | {
33
32
  code: string;
@@ -39,6 +38,16 @@ export declare const makeConfig: (config?: Config | undefined) => {
39
38
  };
40
39
  alignmentButtons: boolean;
41
40
  initialAlignment: import("./TypeTester/types").Alignment;
41
+ size: {
42
+ label: string | false;
43
+ min: number;
44
+ max: number;
45
+ };
46
+ lineHeight: {
47
+ label: string | false;
48
+ min: number;
49
+ max: number;
50
+ } | undefined;
42
51
  };
43
52
  form: {
44
53
  checkboxStyle: "cross" | "check";
@@ -50,8 +59,6 @@ export declare const makeConfig: (config?: Config | undefined) => {
50
59
  };
51
60
  declare const _default: React.Context<{
52
61
  typeTester: {
53
- min: number;
54
- max: number;
55
62
  autofitOnChange: boolean;
56
63
  truncate: boolean;
57
64
  priceText: boolean;
@@ -67,6 +74,7 @@ declare const _default: React.Context<{
67
74
  groupEdit: boolean;
68
75
  bulletStyle: "square" | "round";
69
76
  openTypeFeatures: {
77
+ interactionStyle: "select" | "panel";
70
78
  columns: {
71
79
  features: (string | {
72
80
  code: string;
@@ -78,6 +86,16 @@ declare const _default: React.Context<{
78
86
  };
79
87
  alignmentButtons: boolean;
80
88
  initialAlignment: import("./TypeTester/types").Alignment;
89
+ size: {
90
+ label: string | false;
91
+ min: number;
92
+ max: number;
93
+ };
94
+ lineHeight: {
95
+ label: string | false;
96
+ min: number;
97
+ max: number;
98
+ } | undefined;
81
99
  };
82
100
  form: {
83
101
  checkboxStyle: "cross" | "check";
@@ -10,15 +10,13 @@ var _react = _interopRequireDefault(require("react"));
10
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
11
 
12
12
  const makeTypeTesterConfig = config => {
13
- var _config$shy, _config$toolsPosition, _config$min, _config$max, _config$autofitOnChan, _config$truncate, _config$priceText, _config$selectButtonS, _config$selectButtonL, _ref, _config$selectButton, _config$selectable, _config$priceBar, _config$textInput, _config$initialMode, _config$groupEdit, _config$bulletStyle, _config$openTypeFeatu, _config$openTypeFeatu2, _config$openTypeFeatu3, _config$alignmentButt, _config$initialAlignm;
13
+ var _config$shy, _config$toolsPosition, _config$autofitOnChan, _config$truncate, _config$priceText, _config$selectButtonS, _config$selectButtonL, _ref, _config$selectButton, _config$selectable, _config$priceBar, _config$textInput, _config$initialMode, _config$groupEdit, _config$bulletStyle, _config$openTypeFeatu, _config$openTypeFeatu2, _config$openTypeFeatu3, _config$openTypeFeatu4, _config$openTypeFeatu5, _config$alignmentButt, _config$initialAlignm, _config$size$label, _config$size, _ref2, _config$size$min, _config$size2, _ref3, _config$size$max, _config$size3, _config$lineHeight$la, _config$lineHeight, _config$lineHeight$mi, _config$lineHeight2, _config$lineHeight$ma, _config$lineHeight3;
14
14
 
15
15
  let shy = (_config$shy = config === null || config === void 0 ? void 0 : config.shy) !== null && _config$shy !== void 0 ? _config$shy : false;
16
16
  if (shy === true) shy = 'hover';
17
17
  let toolsPosition = (_config$toolsPosition = config === null || config === void 0 ? void 0 : config.toolsPosition) !== null && _config$toolsPosition !== void 0 ? _config$toolsPosition : 'inline';
18
18
  if (shy !== 'focus') toolsPosition = 'inline';
19
19
  return {
20
- min: (_config$min = config === null || config === void 0 ? void 0 : config.min) !== null && _config$min !== void 0 ? _config$min : 10,
21
- max: (_config$max = config === null || config === void 0 ? void 0 : config.max) !== null && _config$max !== void 0 ? _config$max : 200,
22
20
  autofitOnChange: (_config$autofitOnChan = config === null || config === void 0 ? void 0 : config.autofitOnChange) !== null && _config$autofitOnChan !== void 0 ? _config$autofitOnChan : false,
23
21
  truncate: (_config$truncate = config === null || config === void 0 ? void 0 : config.truncate) !== null && _config$truncate !== void 0 ? _config$truncate : false,
24
22
  priceText: (_config$priceText = config === null || config === void 0 ? void 0 : config.priceText) !== null && _config$priceText !== void 0 ? _config$priceText : false,
@@ -34,11 +32,22 @@ const makeTypeTesterConfig = config => {
34
32
  groupEdit: (_config$groupEdit = config === null || config === void 0 ? void 0 : config.groupEdit) !== null && _config$groupEdit !== void 0 ? _config$groupEdit : false,
35
33
  bulletStyle: (_config$bulletStyle = config === null || config === void 0 ? void 0 : config.bulletStyle) !== null && _config$bulletStyle !== void 0 ? _config$bulletStyle : 'square',
36
34
  openTypeFeatures: {
37
- columns: config === null || config === void 0 ? void 0 : (_config$openTypeFeatu = config.openTypeFeatures) === null || _config$openTypeFeatu === void 0 ? void 0 : _config$openTypeFeatu.columns,
38
- selectionStyle: (_config$openTypeFeatu2 = config === null || config === void 0 ? void 0 : (_config$openTypeFeatu3 = config.openTypeFeatures) === null || _config$openTypeFeatu3 === void 0 ? void 0 : _config$openTypeFeatu3.selectionStyle) !== null && _config$openTypeFeatu2 !== void 0 ? _config$openTypeFeatu2 : 'bullet'
35
+ interactionStyle: (_config$openTypeFeatu = config === null || config === void 0 ? void 0 : (_config$openTypeFeatu2 = config.openTypeFeatures) === null || _config$openTypeFeatu2 === void 0 ? void 0 : _config$openTypeFeatu2.interactionStyle) !== null && _config$openTypeFeatu !== void 0 ? _config$openTypeFeatu : 'panel',
36
+ columns: config === null || config === void 0 ? void 0 : (_config$openTypeFeatu3 = config.openTypeFeatures) === null || _config$openTypeFeatu3 === void 0 ? void 0 : _config$openTypeFeatu3.columns,
37
+ selectionStyle: (_config$openTypeFeatu4 = config === null || config === void 0 ? void 0 : (_config$openTypeFeatu5 = config.openTypeFeatures) === null || _config$openTypeFeatu5 === void 0 ? void 0 : _config$openTypeFeatu5.selectionStyle) !== null && _config$openTypeFeatu4 !== void 0 ? _config$openTypeFeatu4 : 'bullet'
39
38
  },
40
39
  alignmentButtons: (_config$alignmentButt = config === null || config === void 0 ? void 0 : config.alignmentButtons) !== null && _config$alignmentButt !== void 0 ? _config$alignmentButt : false,
41
- initialAlignment: (_config$initialAlignm = config === null || config === void 0 ? void 0 : config.initialAlignment) !== null && _config$initialAlignm !== void 0 ? _config$initialAlignm : 'left'
40
+ initialAlignment: (_config$initialAlignm = config === null || config === void 0 ? void 0 : config.initialAlignment) !== null && _config$initialAlignm !== void 0 ? _config$initialAlignm : 'left',
41
+ size: {
42
+ label: (_config$size$label = config === null || config === void 0 ? void 0 : (_config$size = config.size) === null || _config$size === void 0 ? void 0 : _config$size.label) !== null && _config$size$label !== void 0 ? _config$size$label : 'Size',
43
+ min: (_ref2 = (_config$size$min = config === null || config === void 0 ? void 0 : (_config$size2 = config.size) === null || _config$size2 === void 0 ? void 0 : _config$size2.min) !== null && _config$size$min !== void 0 ? _config$size$min : config === null || config === void 0 ? void 0 : config.min) !== null && _ref2 !== void 0 ? _ref2 : 10,
44
+ max: (_ref3 = (_config$size$max = config === null || config === void 0 ? void 0 : (_config$size3 = config.size) === null || _config$size3 === void 0 ? void 0 : _config$size3.max) !== null && _config$size$max !== void 0 ? _config$size$max : config === null || config === void 0 ? void 0 : config.max) !== null && _ref3 !== void 0 ? _ref3 : 200
45
+ },
46
+ lineHeight: config !== null && config !== void 0 && config.lineHeight ? {
47
+ label: (_config$lineHeight$la = config === null || config === void 0 ? void 0 : (_config$lineHeight = config.lineHeight) === null || _config$lineHeight === void 0 ? void 0 : _config$lineHeight.label) !== null && _config$lineHeight$la !== void 0 ? _config$lineHeight$la : 'Line height',
48
+ min: (_config$lineHeight$mi = config === null || config === void 0 ? void 0 : (_config$lineHeight2 = config.lineHeight) === null || _config$lineHeight2 === void 0 ? void 0 : _config$lineHeight2.min) !== null && _config$lineHeight$mi !== void 0 ? _config$lineHeight$mi : 0.7,
49
+ max: (_config$lineHeight$ma = config === null || config === void 0 ? void 0 : (_config$lineHeight3 = config.lineHeight) === null || _config$lineHeight3 === void 0 ? void 0 : _config$lineHeight3.max) !== null && _config$lineHeight$ma !== void 0 ? _config$lineHeight$ma : 2
50
+ } : undefined
42
51
  };
43
52
  };
44
53
 
@@ -48,17 +48,18 @@ const SKUPrice = _ref => {
48
48
  showCollectionSavings,
49
49
  sku
50
50
  }));
51
- const licenseOptionsSpecs = (0, _reactRedux.useSelector)(state => state.licenseOptions.map(spec => ({
52
- licenseId: spec.licenseId,
53
- licenseOptionIds: Object.values(spec.licenseOptions).filter(Boolean)
54
- })));
51
+ const licenseOptions = (0, _reactRedux.useSelector)(state => state.licenseOptions);
55
52
  (0, _react.useEffect)(() => {
56
53
  if (!sku) return;
54
+ const licenseOptionsSpecs = licenseOptions.map(spec => ({
55
+ licenseId: spec.licenseId,
56
+ licenseOptionIds: Object.values(spec.licenseOptions).filter(Boolean)
57
+ }));
57
58
  relay.refetch({
58
59
  id: sku.id,
59
60
  licenseOptionsSpecs
60
61
  });
61
- }, [licenseOptionsSpecs]);
62
+ }, [licenseOptions]);
62
63
  if (!(sku !== null && sku !== void 0 && sku.price)) return null;
63
64
  return /*#__PURE__*/_react.default.createElement(_Price.default, _extends({}, rest, {
64
65
  price: sku.price,
@@ -13,8 +13,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
13
13
 
14
14
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
15
15
 
16
- const NBSP = '\xa0';
17
-
18
16
  const Select = _ref => {
19
17
  var _options$find;
20
18
 
@@ -27,7 +25,7 @@ const Select = _ref => {
27
25
  className: "select"
28
26
  }, /*#__PURE__*/_react.default.createElement("div", {
29
27
  className: "select__text"
30
- }, /*#__PURE__*/_react.default.createElement(_Icons.DownArrow, null), NBSP, (_options$find = options.find(_ref2 => {
28
+ }, /*#__PURE__*/_react.default.createElement(_Icons.DownArrow, null), (_options$find = options.find(_ref2 => {
31
29
  let {
32
30
  value: v
33
31
  } = _ref2;
@@ -1,4 +1,4 @@
1
- import { TypeTesterFeatures_fontStyle } from '../../__generated__/TypeTesterFeatures_fontStyle.graphql';
1
+ import { TypeTesterFeatures_fontStyle } from '__generated__/TypeTesterFeatures_fontStyle.graphql';
2
2
  interface TypeTesterFeatures_props {
3
3
  id: string;
4
4
  fontStyle: TypeTesterFeatures_fontStyle;
@@ -9,8 +9,6 @@ var _react = _interopRequireWildcard(require("react"));
9
9
 
10
10
  var _reactRelay = require("react-relay");
11
11
 
12
- var _features = _interopRequireDefault(require("./features"));
13
-
14
12
  var _TypeTesterBullet = _interopRequireDefault(require("../TypeTester/TypeTesterBullet"));
15
13
 
16
14
  var _TypeTesterState = _interopRequireDefault(require("./TypeTesterState"));
@@ -19,7 +17,9 @@ var _Checkbox = _interopRequireDefault(require("../Checkbox"));
19
17
 
20
18
  var _ConfigContext = _interopRequireDefault(require("../ConfigContext"));
21
19
 
22
- var _TypeTesterFeatures_stylisticSetName, _TypeTesterFeatures_fontStyle;
20
+ var _useFeaturesData = _interopRequireDefault(require("./useFeaturesData"));
21
+
22
+ var _TypeTesterFeatures_fontStyle;
23
23
 
24
24
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
25
25
 
@@ -63,57 +63,42 @@ function useHeightAnimation() {
63
63
  };
64
64
  }
65
65
 
66
- const shouldIncludeFeature = (supportedFeatures, feature) => supportedFeatures.indexOf(feature) >= 0;
67
-
68
- const getStylisticSetName = (feature, stylisticSetNames) => stylisticSetNames.find(_ref => {
69
- let {
70
- featureName
71
- } = _ref;
72
- return featureName === feature;
73
- });
74
-
75
- const getFeatureName = (feature, stylisticSetNames) => {
76
- const stylisticSetName = getStylisticSetName(feature, stylisticSetNames);
77
-
78
- if (stylisticSetName) {
79
- return stylisticSetName.humanName;
80
- }
81
-
82
- if (_features.default.hasOwnProperty(feature)) {
83
- return _features.default[feature];
84
- }
85
-
86
- return null;
66
+ const shouldIncludeFeature = (supportedFeatures, feature) => {
67
+ if (!supportedFeatures) return false;
68
+ return supportedFeatures.indexOf(feature) >= 0;
87
69
  };
88
70
 
89
- _TypeTesterFeatures_stylisticSetName !== void 0 ? _TypeTesterFeatures_stylisticSetName : (_TypeTesterFeatures_stylisticSetName = require("../../__generated__/TypeTesterFeatures_stylisticSetName.graphql"), _TypeTesterFeatures_stylisticSetName.hash && _TypeTesterFeatures_stylisticSetName.hash !== "8420321d8ddf9b3846450d609586db21" && console.error("The definition of 'TypeTesterFeatures_stylisticSetName' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _TypeTesterFeatures_stylisticSetName);
90
-
91
- const TypeTesterFeatures = _ref2 => {
71
+ const TypeTesterFeatures = _ref => {
92
72
  var _config$openTypeFeatu, _config$openTypeFeatu2, _config$openTypeFeatu3, _config$openTypeFeatu4;
93
73
 
94
74
  let {
95
75
  id,
96
76
  fontStyle,
97
77
  features: showFeatures
98
- } = _ref2;
78
+ } = _ref;
99
79
  const {
100
80
  typeTester: config
101
81
  } = (0, _react.useContext)(_ConfigContext.default);
102
82
  const {
103
- features,
83
+ features: selectedFeatures,
104
84
  toggleFeature,
105
85
  featuresOpen
106
86
  } = (0, _TypeTesterState.default)({
107
87
  id
108
88
  });
109
89
  const selectionStyle = config.openTypeFeatures.selectionStyle;
90
+ const {
91
+ featureNames,
92
+ fontFeatures
93
+ } = (0, _useFeaturesData.default)({
94
+ fontStyle,
95
+ features: showFeatures
96
+ });
110
97
 
111
98
  const renderFeature = feature => {
112
- var _fontStyle$fontFeatur;
113
-
114
99
  const featureCode = typeof feature === 'string' ? feature : feature.code;
115
- const featureName = typeof feature === 'string' ? getFeatureName(feature, (_fontStyle$fontFeatur = fontStyle.fontFeatures) === null || _fontStyle$fontFeatur === void 0 ? void 0 : _fontStyle$fontFeatur.stylisticSetNames) : feature.name;
116
- const checked = features.indexOf(featureCode) >= 0;
100
+ const featureName = typeof feature === 'string' ? featureNames[featureCode] : feature.name;
101
+ const checked = selectedFeatures.indexOf(featureCode) >= 0;
117
102
  return /*#__PURE__*/_react.default.createElement("button", {
118
103
  key: featureCode,
119
104
  className: "type-tester__features__button",
@@ -140,9 +125,9 @@ const TypeTesterFeatures = _ref2 => {
140
125
  style: {
141
126
  '--grid-range': columnConfig.range
142
127
  }
143
- }, columnConfig.features.filter(feature => shouldIncludeFeature(fontStyle.fontFeatures.supportedFeatures, typeof feature === 'string' ? feature : feature.code)).map(renderFeature))));
128
+ }, columnConfig.features.filter(feature => shouldIncludeFeature(fontFeatures === null || fontFeatures === void 0 ? void 0 : fontFeatures.supportedFeatures, typeof feature === 'string' ? feature : feature.code)).map(renderFeature))));
144
129
  } else {
145
- featuresColumns = /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, showFeatures.filter(feature => shouldIncludeFeature(fontStyle.fontFeatures.supportedFeatures, feature)).map(renderFeature));
130
+ featuresColumns = /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, showFeatures.filter(feature => shouldIncludeFeature(fontFeatures === null || fontFeatures === void 0 ? void 0 : fontFeatures.supportedFeatures, feature)).map(renderFeature));
146
131
  }
147
132
 
148
133
  const {
@@ -167,7 +152,7 @@ const TypeTesterFeatures = _ref2 => {
167
152
  };
168
153
 
169
154
  var _default = (0, _reactRelay.createFragmentContainer)(TypeTesterFeatures, {
170
- fontStyle: _TypeTesterFeatures_fontStyle !== void 0 ? _TypeTesterFeatures_fontStyle : (_TypeTesterFeatures_fontStyle = require("../../__generated__/TypeTesterFeatures_fontStyle.graphql"), _TypeTesterFeatures_fontStyle.hash && _TypeTesterFeatures_fontStyle.hash !== "838ddab02dcbca47c8368b219c302934" && console.error("The definition of 'TypeTesterFeatures_fontStyle' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _TypeTesterFeatures_fontStyle)
155
+ fontStyle: _TypeTesterFeatures_fontStyle !== void 0 ? _TypeTesterFeatures_fontStyle : (_TypeTesterFeatures_fontStyle = require("../../__generated__/TypeTesterFeatures_fontStyle.graphql"), _TypeTesterFeatures_fontStyle.hash && _TypeTesterFeatures_fontStyle.hash !== "25582c33916ebaadd2f674b1d0b6bf4b" && console.error("The definition of 'TypeTesterFeatures_fontStyle' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _TypeTesterFeatures_fontStyle)
171
156
  });
172
157
 
173
158
  exports.default = _default;
@@ -1,8 +1,9 @@
1
1
  import React from 'react';
2
+ import { useFeaturesData_fontStyle$key } from '__generated__/useFeaturesData_fontStyle.graphql';
2
3
  interface TypeTesterFeaturesButton_props {
3
- featuresOpen: boolean;
4
- features: string[];
5
- toggleFeaturesOpen: () => void;
4
+ id: string;
5
+ fontStyle: useFeaturesData_fontStyle$key;
6
+ onNeedsRefocus?: () => void;
6
7
  }
7
8
  declare const TypeTesterFeaturesButton: React.FC<TypeTesterFeaturesButton_props>;
8
9
  export default TypeTesterFeaturesButton;