fontdue-js 2.0.1 → 2.2.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ## 2.2.0
2
+
3
+ - Support for updated stripe integration, for accounts that connected to Stripe after August 11 2023
4
+
5
+ ## 2.1.0
6
+
7
+ - Added support for variable fonts to the standalone TypeTester component
8
+
9
+ ## 2.0.1
10
+
11
+ - Fixed issue with new relay environment headers, add request name to requests
12
+
1
13
  ## 2.0.0
2
14
 
3
15
  - __Breaking change__: This is a major upgrade to support React 18 concurrent mode, including changes to how we resolve data using Suspense via Relay. Upgrading meant we require some new features only available in React 18. But this change also means that Fontdue components can now fully resolve during server-side rendering (e.g. in Next.js), making for much smoother initial page loads. Usage on the server (e.g. Next.js) now requires the NEXT_PUBLIC_FONTDUE_URL to be set instead of passing the `url` prop to the FontdueProvider.
package/README.md CHANGED
@@ -189,8 +189,13 @@ import TypeTester from 'fontdue-js/TypeTester';
189
189
  | `fontSize` | (Optional) `number` Initial font size in pixels. |
190
190
  | `lineHeight` | (Optional) `number` Line-height as a proportional value where `1 == fontSize`. |
191
191
  | `content` | (Optional) `string` The initial content to display. |
192
+ | `direction` | (Optional) `'ltr' \| 'rtl'` Writing direction |
193
+ | `alignment` | (Optional) `'left' \| 'center' \| 'right'` Text alignment |
192
194
  | `features` | (Optional) `string[]` List of opentype feature codes to expose as options to users. (e.g. `['ss01', 'ss02']`) |
195
+ | `axes` | (Optional) `string[]` List of variable axes to expose. (e.g. `['wdth', 'ital']`). You must provide the relevant `variableSettings` for each axis |
193
196
  | `autofit` | (Optional) See `TypeTesters.autofit` above |
197
+ | `featureSettings` | (Optional) `{ feature: string, value: string }[]` List of features already selected, the `value` should be `"1"` to mark the feature as selected. The shape of this data is consistent with the `TypeTester.featureSettings` field in the GraphQL API. e.g. `[{ feature: 'ss01', value: '1' }]` |
198
+ | `variableSettings` | (Optional) `{ axis: string, value: number }[]` List of variable settings selected, consistent with the `TypeTester.variableSettings` field. e.g. `[{ axis: 'wdth', value: 600 }, { axis: 'ital', value: 0.5 }]` |
194
199
 
195
200
  ## `TestFontsForm`
196
201
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @generated SignedSource<<1e17d9ac955089b5ee7fa7992f71be96>>
2
+ * @generated SignedSource<<3a48db3e7fc423bae9f5f7c65ea5a9cc>>
3
3
  * @lightSyntaxTransform
4
4
  * @nogrep
5
5
  */
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
  /**
8
- * @generated SignedSource<<1e17d9ac955089b5ee7fa7992f71be96>>
8
+ * @generated SignedSource<<3a48db3e7fc423bae9f5f7c65ea5a9cc>>
9
9
  * @lightSyntaxTransform
10
10
  * @nogrep
11
11
  */
@@ -263,17 +263,14 @@ const node = function () {
263
263
  }, {
264
264
  "alias": null,
265
265
  "args": null,
266
- "concreteType": "StripeCredentials",
267
- "kind": "LinkedField",
268
- "name": "stripeCredentials",
269
- "plural": false,
270
- "selections": [{
271
- "alias": null,
272
- "args": null,
273
- "kind": "ScalarField",
274
- "name": "stripePublishableKey",
275
- "storageKey": null
276
- }],
266
+ "kind": "ScalarField",
267
+ "name": "stripeAccountId",
268
+ "storageKey": null
269
+ }, {
270
+ "alias": null,
271
+ "args": null,
272
+ "kind": "ScalarField",
273
+ "name": "stripePublishableKey",
277
274
  "storageKey": null
278
275
  }, {
279
276
  "alias": null,
@@ -743,12 +740,12 @@ const node = function () {
743
740
  }]
744
741
  },
745
742
  "params": {
746
- "cacheID": "52a0031618c5b003158fe781a65c4052",
743
+ "cacheID": "3bf95735f2d71a2fe6d2180b09691242",
747
744
  "id": null,
748
745
  "metadata": {},
749
746
  "name": "CartQuery",
750
747
  "operationKind": "query",
751
- "text": "query CartQuery {\n viewer {\n ...StripeProvider_viewer\n ...CartOrder_viewer\n currentOrder {\n ...CartOrder_order\n id\n }\n id\n }\n}\n\nfragment AddressFields_viewer on Viewer {\n countries {\n code\n name\n }\n}\n\nfragment CartItem_node on OrderItem {\n id\n price {\n ...Price_price\n }\n sku {\n price {\n ...Price_price\n }\n product {\n __typename\n __isSkuProduct: __typename\n ...CollectionAa_product\n ...FontStyle_fontStyle\n ... on FontStyle {\n family {\n name\n cssUrl\n id\n }\n name\n variableInstances {\n name\n }\n }\n ... on Bundle {\n name\n }\n ... on FontCollection {\n name\n isVariableFont\n totalStyles\n featureStyle {\n family {\n cssUrl\n id\n }\n id\n }\n }\n ... on Node {\n __isNode: __typename\n id\n }\n }\n id\n }\n licenseSelections {\n id\n license {\n id\n name\n multiplier\n }\n variable: licenseVariable {\n id\n variableType\n ...VariableTableAmounts_variable\n }\n option: licenseOption {\n id\n amount\n multiplier\n name\n ...VariableTableAmounts_option\n }\n variableText\n }\n}\n\nfragment CartItem_viewer on Viewer {\n licenses(licenseTypes: [RETAIL]) {\n id\n name\n variables: licenseVariables {\n id\n name\n variableType\n options: licenseOptions {\n id\n amount\n name\n }\n }\n }\n}\n\nfragment CartOrder_order on Order {\n ...Checkout_order\n ...Download_order\n ...CartTotals_order\n orderItems {\n ...CartItem_node\n id\n licenseSelections {\n license {\n id\n }\n licenseVariable {\n id\n variableType\n }\n licenseOption {\n id\n }\n variableText\n id\n }\n }\n discount {\n id\n }\n customer {\n email\n name\n anonymous\n id\n }\n billingIdentity {\n ...IdentityBox_identity\n }\n licenseeIdentity {\n ...IdentityBox_identity\n }\n licenseeIsBillingIdentity\n stripePaymentMethod {\n card {\n last4\n brand\n }\n }\n stripePaymentIntent {\n status\n }\n canCompleteWithCoupon\n completedWithCoupon\n}\n\nfragment CartOrder_viewer on Viewer {\n ...CartItem_viewer\n ...Checkout_viewer\n settings {\n eulaAgreementLabel(format: HTML)\n }\n}\n\nfragment CartTotals_order on Order {\n subtotal {\n ...Price_price\n }\n discount {\n amount {\n amount\n ...Price_price\n }\n coupon {\n ...CouponText_coupon\n id\n }\n id\n }\n discountedSubtotal {\n ...Price_price\n }\n total {\n amount\n ...Price_price\n }\n taxes {\n ...Price_price\n }\n taxName\n gstIncluded\n}\n\nfragment Checkout_order on Order {\n canCompleteWithCoupon\n customer {\n name\n email\n newsletterOptIn\n id\n }\n billingIdentity {\n name\n organization\n email\n phone\n street\n locality\n sublocality\n country\n administrativeArea\n zip\n vatNumber\n }\n licenseeIdentity {\n name\n organization\n email\n phone\n street\n locality\n sublocality\n country\n administrativeArea\n zip\n vatNumber\n }\n licenseeIsBillingIdentity\n}\n\nfragment Checkout_viewer on Viewer {\n ...AddressFields_viewer\n settings {\n uiFontName\n newsletterOptInLabel\n }\n themeConfig {\n customProperties\n }\n}\n\nfragment CollectionAa_product on SkuProduct {\n __isSkuProduct: __typename\n __typename\n ... on FontCollection {\n featureStyle {\n ...FontStyle_fontStyle\n id\n }\n }\n ... on Bundle {\n fontStyles {\n ...FontStyle_fontStyle\n id\n }\n }\n}\n\nfragment CouponText_coupon on Coupon {\n type\n percentAmount\n creditAmountRemaining {\n amount\n currency\n }\n}\n\nfragment Download_order on Order {\n id\n archiveUrl\n customer {\n email\n id\n }\n completedWithCoupon\n}\n\nfragment FontStyle_fontStyle on FontStyle {\n cssFamily\n name\n}\n\nfragment IdentityBox_identity on Identity {\n email\n phoneFormatted\n addressFormatted\n vatNumber\n}\n\nfragment Price_price on Money {\n amount\n currency\n}\n\nfragment StripeProvider_viewer on Viewer {\n settings {\n uiFontUrl\n uiFontName\n }\n themeConfig {\n customProperties\n }\n stripeCredentials {\n stripePublishableKey\n }\n currentOrder {\n stripePaymentIntent {\n clientSecret\n }\n id\n }\n}\n\nfragment VariableTableAmounts_option on LicenseOption {\n amounts\n}\n\nfragment VariableTableAmounts_variable on LicenseVariable {\n units\n}\n"
748
+ "text": "query CartQuery {\n viewer {\n ...StripeProvider_viewer\n ...CartOrder_viewer\n currentOrder {\n ...CartOrder_order\n id\n }\n id\n }\n}\n\nfragment AddressFields_viewer on Viewer {\n countries {\n code\n name\n }\n}\n\nfragment CartItem_node on OrderItem {\n id\n price {\n ...Price_price\n }\n sku {\n price {\n ...Price_price\n }\n product {\n __typename\n __isSkuProduct: __typename\n ...CollectionAa_product\n ...FontStyle_fontStyle\n ... on FontStyle {\n family {\n name\n cssUrl\n id\n }\n name\n variableInstances {\n name\n }\n }\n ... on Bundle {\n name\n }\n ... on FontCollection {\n name\n isVariableFont\n totalStyles\n featureStyle {\n family {\n cssUrl\n id\n }\n id\n }\n }\n ... on Node {\n __isNode: __typename\n id\n }\n }\n id\n }\n licenseSelections {\n id\n license {\n id\n name\n multiplier\n }\n variable: licenseVariable {\n id\n variableType\n ...VariableTableAmounts_variable\n }\n option: licenseOption {\n id\n amount\n multiplier\n name\n ...VariableTableAmounts_option\n }\n variableText\n }\n}\n\nfragment CartItem_viewer on Viewer {\n licenses(licenseTypes: [RETAIL]) {\n id\n name\n variables: licenseVariables {\n id\n name\n variableType\n options: licenseOptions {\n id\n amount\n name\n }\n }\n }\n}\n\nfragment CartOrder_order on Order {\n ...Checkout_order\n ...Download_order\n ...CartTotals_order\n orderItems {\n ...CartItem_node\n id\n licenseSelections {\n license {\n id\n }\n licenseVariable {\n id\n variableType\n }\n licenseOption {\n id\n }\n variableText\n id\n }\n }\n discount {\n id\n }\n customer {\n email\n name\n anonymous\n id\n }\n billingIdentity {\n ...IdentityBox_identity\n }\n licenseeIdentity {\n ...IdentityBox_identity\n }\n licenseeIsBillingIdentity\n stripePaymentMethod {\n card {\n last4\n brand\n }\n }\n stripePaymentIntent {\n status\n }\n canCompleteWithCoupon\n completedWithCoupon\n}\n\nfragment CartOrder_viewer on Viewer {\n ...CartItem_viewer\n ...Checkout_viewer\n settings {\n eulaAgreementLabel(format: HTML)\n }\n}\n\nfragment CartTotals_order on Order {\n subtotal {\n ...Price_price\n }\n discount {\n amount {\n amount\n ...Price_price\n }\n coupon {\n ...CouponText_coupon\n id\n }\n id\n }\n discountedSubtotal {\n ...Price_price\n }\n total {\n amount\n ...Price_price\n }\n taxes {\n ...Price_price\n }\n taxName\n gstIncluded\n}\n\nfragment Checkout_order on Order {\n canCompleteWithCoupon\n customer {\n name\n email\n newsletterOptIn\n id\n }\n billingIdentity {\n name\n organization\n email\n phone\n street\n locality\n sublocality\n country\n administrativeArea\n zip\n vatNumber\n }\n licenseeIdentity {\n name\n organization\n email\n phone\n street\n locality\n sublocality\n country\n administrativeArea\n zip\n vatNumber\n }\n licenseeIsBillingIdentity\n}\n\nfragment Checkout_viewer on Viewer {\n ...AddressFields_viewer\n settings {\n uiFontName\n newsletterOptInLabel\n }\n themeConfig {\n customProperties\n }\n}\n\nfragment CollectionAa_product on SkuProduct {\n __isSkuProduct: __typename\n __typename\n ... on FontCollection {\n featureStyle {\n ...FontStyle_fontStyle\n id\n }\n }\n ... on Bundle {\n fontStyles {\n ...FontStyle_fontStyle\n id\n }\n }\n}\n\nfragment CouponText_coupon on Coupon {\n type\n percentAmount\n creditAmountRemaining {\n amount\n currency\n }\n}\n\nfragment Download_order on Order {\n id\n archiveUrl\n customer {\n email\n id\n }\n completedWithCoupon\n}\n\nfragment FontStyle_fontStyle on FontStyle {\n cssFamily\n name\n}\n\nfragment IdentityBox_identity on Identity {\n email\n phoneFormatted\n addressFormatted\n vatNumber\n}\n\nfragment Price_price on Money {\n amount\n currency\n}\n\nfragment StripeProvider_viewer on Viewer {\n settings {\n uiFontUrl\n uiFontName\n }\n themeConfig {\n customProperties\n }\n stripeAccountId\n stripePublishableKey\n currentOrder {\n stripePaymentIntent {\n clientSecret\n }\n id\n }\n}\n\nfragment VariableTableAmounts_option on LicenseOption {\n amounts\n}\n\nfragment VariableTableAmounts_variable on LicenseVariable {\n units\n}\n"
752
749
  }
753
750
  };
754
751
  }();
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @generated SignedSource<<2b09acac10c443d4a15c6cbf588e0a76>>
2
+ * @generated SignedSource<<b4b764624fbe00d3d774d30ba0b40b3d>>
3
3
  * @lightSyntaxTransform
4
4
  * @nogrep
5
5
  */
@@ -19,9 +19,7 @@ export type StoreModalProductQuery$data = {
19
19
  } | null;
20
20
  readonly viewer: {
21
21
  readonly endpoint: string | null;
22
- readonly stripeCredentials: {
23
- readonly stripePublishableKey: string;
24
- } | null;
22
+ readonly stripeAccountId: string | null;
25
23
  readonly " $fragmentSpreads": FragmentRefs<"StoreModalProductLicenseSelection_viewer" | "StoreModalProductSummary_viewer">;
26
24
  };
27
25
  };
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
  /**
8
- * @generated SignedSource<<2b09acac10c443d4a15c6cbf588e0a76>>
8
+ * @generated SignedSource<<b4b764624fbe00d3d774d30ba0b40b3d>>
9
9
  * @lightSyntaxTransform
10
10
  * @nogrep
11
11
  */
@@ -52,17 +52,8 @@ const node = function () {
52
52
  v6 = {
53
53
  "alias": null,
54
54
  "args": null,
55
- "concreteType": "StripeCredentials",
56
- "kind": "LinkedField",
57
- "name": "stripeCredentials",
58
- "plural": false,
59
- "selections": [{
60
- "alias": null,
61
- "args": null,
62
- "kind": "ScalarField",
63
- "name": "stripePublishableKey",
64
- "storageKey": null
65
- }],
55
+ "kind": "ScalarField",
56
+ "name": "stripeAccountId",
66
57
  "storageKey": null
67
58
  },
68
59
  v7 = {
@@ -500,15 +491,15 @@ const node = function () {
500
491
  }]
501
492
  },
502
493
  "params": {
503
- "cacheID": "c40a4408a14fafdb11b8a0ffc44b46e9",
494
+ "cacheID": "505ecb8862c17c0dab95c6ae0415862e",
504
495
  "id": null,
505
496
  "metadata": {},
506
497
  "name": "StoreModalProductQuery",
507
498
  "operationKind": "query",
508
- "text": "query StoreModalProductQuery(\n $productId: ID!\n) {\n collection: node(id: $productId) {\n __typename\n id\n ...StoreModalFamily_collection\n ... on FontCollection {\n children(collectionTypes: [FAMILY]) {\n id\n ...StoreModalFamily_collection\n }\n }\n }\n viewer {\n ...StoreModalProductLicenseSelection_viewer\n ...StoreModalProductSummary_viewer\n endpoint\n stripeCredentials {\n stripePublishableKey\n }\n id\n }\n}\n\nfragment FontStyle_fontStyle on FontStyle {\n cssFamily\n name\n}\n\nfragment Price_price on Money {\n amount\n currency\n}\n\nfragment SKUPrice_sku on Sku {\n id\n price(licenseOptions: []) {\n amount\n ...Price_price\n }\n}\n\nfragment StoreModalBundleButton_bundle on Bundle {\n name\n sku {\n ...SKUPrice_sku\n id\n }\n fontStyles {\n id\n ...FontStyle_fontStyle\n }\n}\n\nfragment StoreModalFamilyButton_collection on FontCollection {\n isVariableFont\n collectionType\n name\n sku {\n ...SKUPrice_sku\n id\n }\n parent {\n id\n }\n featureStyle {\n ...FontStyle_fontStyle\n id\n }\n totalStyles\n totalStylesPrice {\n ...Price_price\n }\n ...useTotalStyles_fontCollection\n}\n\nfragment StoreModalFamily_collection on FontCollection {\n ...StoreModalFamilyButton_collection\n cssUrl\n collectionType\n sku {\n id\n }\n isVariableFont\n bundles {\n id\n fontStyles {\n id\n cssFamily\n cssWeight\n cssStretch\n ...StoreModalStyleButton_fontStyle\n }\n ...StoreModalBundleButton_bundle\n }\n fontStyles {\n id\n cssFamily\n cssWeight\n cssStretch\n ...StoreModalStyleButton_fontStyle\n }\n}\n\nfragment StoreModalProductLicenseSelection_viewer on Viewer {\n licenses(licenseTypes: [RETAIL]) {\n id\n ...StoreModalProductLicense_license\n }\n}\n\nfragment StoreModalProductLicense_license on License {\n id\n url\n name\n defaultSelected\n variables: licenseVariables {\n id\n name\n variableType\n ...VariableTableAmounts_variable\n options: licenseOptions {\n id\n name\n amount\n ...VariableTableAmounts_option\n }\n }\n}\n\nfragment StoreModalProductSummary_viewer on Viewer {\n precart(skuIds: [], licenseOptions: []) {\n skus {\n price(licenseOptions: []) {\n amount\n }\n product {\n __typename\n ... on FontCollection {\n totalStyles\n totalStylesPrice(licenseOptions: []) {\n amount\n }\n }\n ... on Bundle {\n totalStyles\n totalStylesPrice(licenseOptions: []) {\n amount\n }\n }\n ... on Node {\n __isNode: __typename\n id\n }\n }\n id\n }\n subtotal {\n ...Price_price\n amount\n currency\n }\n }\n}\n\nfragment StoreModalStyleButton_fontStyle on FontStyle {\n ...FontStyle_fontStyle\n id\n name\n sku {\n ...SKUPrice_sku\n id\n }\n variableInstances {\n name\n coordinates {\n axis\n value\n }\n }\n variableAxes {\n name\n }\n}\n\nfragment VariableTableAmounts_option on LicenseOption {\n amounts\n}\n\nfragment VariableTableAmounts_variable on LicenseVariable {\n units\n}\n\nfragment useTotalStyles_fontCollection on FontCollection {\n totalStyles\n children(collectionTypes: [FAMILY]) {\n isVariableFont\n totalStyles\n id\n }\n}\n"
499
+ "text": "query StoreModalProductQuery(\n $productId: ID!\n) {\n collection: node(id: $productId) {\n __typename\n id\n ...StoreModalFamily_collection\n ... on FontCollection {\n children(collectionTypes: [FAMILY]) {\n id\n ...StoreModalFamily_collection\n }\n }\n }\n viewer {\n ...StoreModalProductLicenseSelection_viewer\n ...StoreModalProductSummary_viewer\n endpoint\n stripeAccountId\n id\n }\n}\n\nfragment FontStyle_fontStyle on FontStyle {\n cssFamily\n name\n}\n\nfragment Price_price on Money {\n amount\n currency\n}\n\nfragment SKUPrice_sku on Sku {\n id\n price(licenseOptions: []) {\n amount\n ...Price_price\n }\n}\n\nfragment StoreModalBundleButton_bundle on Bundle {\n name\n sku {\n ...SKUPrice_sku\n id\n }\n fontStyles {\n id\n ...FontStyle_fontStyle\n }\n}\n\nfragment StoreModalFamilyButton_collection on FontCollection {\n isVariableFont\n collectionType\n name\n sku {\n ...SKUPrice_sku\n id\n }\n parent {\n id\n }\n featureStyle {\n ...FontStyle_fontStyle\n id\n }\n totalStyles\n totalStylesPrice {\n ...Price_price\n }\n ...useTotalStyles_fontCollection\n}\n\nfragment StoreModalFamily_collection on FontCollection {\n ...StoreModalFamilyButton_collection\n cssUrl\n collectionType\n sku {\n id\n }\n isVariableFont\n bundles {\n id\n fontStyles {\n id\n cssFamily\n cssWeight\n cssStretch\n ...StoreModalStyleButton_fontStyle\n }\n ...StoreModalBundleButton_bundle\n }\n fontStyles {\n id\n cssFamily\n cssWeight\n cssStretch\n ...StoreModalStyleButton_fontStyle\n }\n}\n\nfragment StoreModalProductLicenseSelection_viewer on Viewer {\n licenses(licenseTypes: [RETAIL]) {\n id\n ...StoreModalProductLicense_license\n }\n}\n\nfragment StoreModalProductLicense_license on License {\n id\n url\n name\n defaultSelected\n variables: licenseVariables {\n id\n name\n variableType\n ...VariableTableAmounts_variable\n options: licenseOptions {\n id\n name\n amount\n ...VariableTableAmounts_option\n }\n }\n}\n\nfragment StoreModalProductSummary_viewer on Viewer {\n precart(skuIds: [], licenseOptions: []) {\n skus {\n price(licenseOptions: []) {\n amount\n }\n product {\n __typename\n ... on FontCollection {\n totalStyles\n totalStylesPrice(licenseOptions: []) {\n amount\n }\n }\n ... on Bundle {\n totalStyles\n totalStylesPrice(licenseOptions: []) {\n amount\n }\n }\n ... on Node {\n __isNode: __typename\n id\n }\n }\n id\n }\n subtotal {\n ...Price_price\n amount\n currency\n }\n }\n}\n\nfragment StoreModalStyleButton_fontStyle on FontStyle {\n ...FontStyle_fontStyle\n id\n name\n sku {\n ...SKUPrice_sku\n id\n }\n variableInstances {\n name\n coordinates {\n axis\n value\n }\n }\n variableAxes {\n name\n }\n}\n\nfragment VariableTableAmounts_option on LicenseOption {\n amounts\n}\n\nfragment VariableTableAmounts_variable on LicenseVariable {\n units\n}\n\nfragment useTotalStyles_fontCollection on FontCollection {\n totalStyles\n children(collectionTypes: [FAMILY]) {\n isVariableFont\n totalStyles\n id\n }\n}\n"
509
500
  }
510
501
  };
511
502
  }();
512
- node.hash = "491d7c1daa28742d375049de66b6c386";
503
+ node.hash = "a56c2c63a760bf157f6456dcc5a59dad";
513
504
  var _default = node;
514
505
  exports.default = _default;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @generated SignedSource<<8ae860b7b0a3279b4d13224fed2ec90b>>
2
+ * @generated SignedSource<<65e30c6e19e678578d8e9ddcb54c7794>>
3
3
  * @lightSyntaxTransform
4
4
  * @nogrep
5
5
  */
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
  /**
8
- * @generated SignedSource<<8ae860b7b0a3279b4d13224fed2ec90b>>
8
+ * @generated SignedSource<<65e30c6e19e678578d8e9ddcb54c7794>>
9
9
  * @lightSyntaxTransform
10
10
  * @nogrep
11
11
  */
@@ -171,17 +171,14 @@ const node = function () {
171
171
  }, {
172
172
  "alias": null,
173
173
  "args": null,
174
- "concreteType": "StripeCredentials",
175
- "kind": "LinkedField",
176
- "name": "stripeCredentials",
177
- "plural": false,
178
- "selections": [{
179
- "alias": null,
180
- "args": null,
181
- "kind": "ScalarField",
182
- "name": "stripePublishableKey",
183
- "storageKey": null
184
- }],
174
+ "kind": "ScalarField",
175
+ "name": "stripeAccountId",
176
+ "storageKey": null
177
+ }, {
178
+ "alias": null,
179
+ "args": null,
180
+ "kind": "ScalarField",
181
+ "name": "stripePublishableKey",
185
182
  "storageKey": null
186
183
  }, {
187
184
  "alias": null,
@@ -480,12 +477,12 @@ const node = function () {
480
477
  }]
481
478
  },
482
479
  "params": {
483
- "cacheID": "ab1264b009e60ee2a4c28786470993cb",
480
+ "cacheID": "055fecbbe592dcba74a14e0fe078fd13",
484
481
  "id": null,
485
482
  "metadata": {},
486
483
  "name": "StoreModalReviewQuery",
487
484
  "operationKind": "query",
488
- "text": "query StoreModalReviewQuery {\n viewer {\n ...StripeProvider_viewer\n ...StoreModalReview_viewer\n currentOrder {\n ...StoreModalReview_order\n id\n }\n id\n }\n}\n\nfragment CartTotals_order on Order {\n subtotal {\n ...Price_price\n }\n discount {\n amount {\n amount\n ...Price_price\n }\n coupon {\n ...CouponText_coupon\n id\n }\n id\n }\n discountedSubtotal {\n ...Price_price\n }\n total {\n amount\n ...Price_price\n }\n taxes {\n ...Price_price\n }\n taxName\n gstIncluded\n}\n\nfragment CouponText_coupon on Coupon {\n type\n percentAmount\n creditAmountRemaining {\n amount\n currency\n }\n}\n\nfragment Price_price on Money {\n amount\n currency\n}\n\nfragment SKUPrice_sku on Sku {\n id\n price(licenseOptions: []) {\n amount\n ...Price_price\n }\n}\n\nfragment StoreModalDownload_order on Order {\n id\n archiveUrl\n}\n\nfragment StoreModalReviewIdentity_identity on Identity {\n email\n phoneFormatted\n addressFormatted\n vatNumber\n}\n\nfragment StoreModalReview_order on Order {\n ...CartTotals_order\n ...StoreModalDownload_order\n customer {\n email\n name\n id\n }\n billingIdentity {\n name\n email\n phone\n street\n locality\n administrativeArea\n country\n zip\n ...StoreModalReviewIdentity_identity\n }\n licenseeIdentity {\n ...StoreModalReviewIdentity_identity\n }\n licenseeIsBillingIdentity\n stripePaymentMethod {\n card {\n last4\n brandFormatted\n }\n }\n orderItems {\n id\n description\n sku {\n ...SKUPrice_sku\n id\n }\n }\n canCompleteWithCoupon\n completedWithCoupon\n stripePaymentIntent {\n status\n clientSecret\n }\n completeUrl\n total {\n amount\n }\n}\n\nfragment StoreModalReview_viewer on Viewer {\n settings {\n eulaAgreementLabel(format: HTML)\n }\n}\n\nfragment StripeProvider_viewer on Viewer {\n settings {\n uiFontUrl\n uiFontName\n }\n themeConfig {\n customProperties\n }\n stripeCredentials {\n stripePublishableKey\n }\n currentOrder {\n stripePaymentIntent {\n clientSecret\n }\n id\n }\n}\n"
485
+ "text": "query StoreModalReviewQuery {\n viewer {\n ...StripeProvider_viewer\n ...StoreModalReview_viewer\n currentOrder {\n ...StoreModalReview_order\n id\n }\n id\n }\n}\n\nfragment CartTotals_order on Order {\n subtotal {\n ...Price_price\n }\n discount {\n amount {\n amount\n ...Price_price\n }\n coupon {\n ...CouponText_coupon\n id\n }\n id\n }\n discountedSubtotal {\n ...Price_price\n }\n total {\n amount\n ...Price_price\n }\n taxes {\n ...Price_price\n }\n taxName\n gstIncluded\n}\n\nfragment CouponText_coupon on Coupon {\n type\n percentAmount\n creditAmountRemaining {\n amount\n currency\n }\n}\n\nfragment Price_price on Money {\n amount\n currency\n}\n\nfragment SKUPrice_sku on Sku {\n id\n price(licenseOptions: []) {\n amount\n ...Price_price\n }\n}\n\nfragment StoreModalDownload_order on Order {\n id\n archiveUrl\n}\n\nfragment StoreModalReviewIdentity_identity on Identity {\n email\n phoneFormatted\n addressFormatted\n vatNumber\n}\n\nfragment StoreModalReview_order on Order {\n ...CartTotals_order\n ...StoreModalDownload_order\n customer {\n email\n name\n id\n }\n billingIdentity {\n name\n email\n phone\n street\n locality\n administrativeArea\n country\n zip\n ...StoreModalReviewIdentity_identity\n }\n licenseeIdentity {\n ...StoreModalReviewIdentity_identity\n }\n licenseeIsBillingIdentity\n stripePaymentMethod {\n card {\n last4\n brandFormatted\n }\n }\n orderItems {\n id\n description\n sku {\n ...SKUPrice_sku\n id\n }\n }\n canCompleteWithCoupon\n completedWithCoupon\n stripePaymentIntent {\n status\n clientSecret\n }\n completeUrl\n total {\n amount\n }\n}\n\nfragment StoreModalReview_viewer on Viewer {\n settings {\n eulaAgreementLabel(format: HTML)\n }\n}\n\nfragment StripeProvider_viewer on Viewer {\n settings {\n uiFontUrl\n uiFontName\n }\n themeConfig {\n customProperties\n }\n stripeAccountId\n stripePublishableKey\n currentOrder {\n stripePaymentIntent {\n clientSecret\n }\n id\n }\n}\n"
489
486
  }
490
487
  };
491
488
  }();
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @generated SignedSource<<6a4188456e942de7b187554c0a988252>>
2
+ * @generated SignedSource<<e04bad486e150e1c189dfb5679ad70f5>>
3
3
  * @lightSyntaxTransform
4
4
  * @nogrep
5
5
  */
@@ -15,9 +15,8 @@ export type StripeProvider_viewer$data = {
15
15
  readonly uiFontName: string | null;
16
16
  readonly uiFontUrl: string | null;
17
17
  } | null;
18
- readonly stripeCredentials: {
19
- readonly stripePublishableKey: string;
20
- } | null;
18
+ readonly stripeAccountId: string | null;
19
+ readonly stripePublishableKey: string | null;
21
20
  readonly themeConfig: {
22
21
  readonly customProperties: ReadonlyArray<string> | null;
23
22
  } | null;
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
  /**
8
- * @generated SignedSource<<6a4188456e942de7b187554c0a988252>>
8
+ * @generated SignedSource<<e04bad486e150e1c189dfb5679ad70f5>>
9
9
  * @lightSyntaxTransform
10
10
  * @nogrep
11
11
  */
@@ -58,17 +58,14 @@ const node = {
58
58
  }, {
59
59
  "alias": null,
60
60
  "args": null,
61
- "concreteType": "StripeCredentials",
62
- "kind": "LinkedField",
63
- "name": "stripeCredentials",
64
- "plural": false,
65
- "selections": [{
66
- "alias": null,
67
- "args": null,
68
- "kind": "ScalarField",
69
- "name": "stripePublishableKey",
70
- "storageKey": null
71
- }],
61
+ "kind": "ScalarField",
62
+ "name": "stripeAccountId",
63
+ "storageKey": null
64
+ }, {
65
+ "alias": null,
66
+ "args": null,
67
+ "kind": "ScalarField",
68
+ "name": "stripePublishableKey",
72
69
  "storageKey": null
73
70
  }, {
74
71
  "alias": null,
@@ -98,6 +95,6 @@ const node = {
98
95
  "type": "Viewer",
99
96
  "abstractKey": null
100
97
  };
101
- node.hash = "94dbdb1714785c862861adc46d6db0d7";
98
+ node.hash = "efff082269b64afc7019b4d725285afa";
102
99
  var _default = node;
103
100
  exports.default = _default;
@@ -103,6 +103,20 @@ const StyleSelect = _ref => {
103
103
  onChange: handleChange
104
104
  });
105
105
  };
106
+ function Character(props) {
107
+ const ref = (0, _react.useRef)(null);
108
+ const [size, setSize] = (0, _react.useState)(1);
109
+ (0, _resizeObserver.default)(ref, entry => {
110
+ if (entry.target.scrollWidth > entry.target.clientWidth) {
111
+ setSize(size + 1);
112
+ }
113
+ });
114
+ return /*#__PURE__*/_react.default.createElement("div", _extends({
115
+ ref: ref
116
+ }, props, {
117
+ "data-size": size
118
+ }));
119
+ }
106
120
  function CharacterViewerComponent(_ref3) {
107
121
  var _collection$children, _collection$fontStyle, _collection$children2, _collection$children3, _collection$children4, _fontStyle$characterB, _fontStyle$characterB2, _fontStyle$featureCha, _fontStyle$featureCha2, _fontStyle$featureCha3, _fontStyle$featureCha4, _fontStyle$featureCha5, _fontStyle$characterB3, _fontStyle$featureCha6, _fontStyle$featureCha7, _fontStyle$featureCha8;
108
122
  let {
@@ -218,7 +232,7 @@ function CharacterViewerComponent(_ref3) {
218
232
  className: "character-viewer__block__characters",
219
233
  style: style,
220
234
  onMouseLeave: handleMouseLeave
221
- }, characters.map((chars, j) => /*#__PURE__*/_react.default.createElement("div", {
235
+ }, characters.map((chars, j) => /*#__PURE__*/_react.default.createElement(Character, {
222
236
  key: j,
223
237
  onClick: () => setSelectedCharacter(chars),
224
238
  onMouseEnter: () => setActiveCharacter(chars),
@@ -299,7 +313,7 @@ function CharacterViewerComponent(_ref3) {
299
313
  fontFeatureSettings: `'${feature}' 1`
300
314
  },
301
315
  onMouseLeave: handleFeatureCharacterMouseLeave
302
- }, characters.map((chars, j) => /*#__PURE__*/_react.default.createElement("div", {
316
+ }, characters.map((chars, j) => /*#__PURE__*/_react.default.createElement(Character, {
303
317
  key: j,
304
318
  onClick: () => setSelectedFeatureCharacter([chars, feature]),
305
319
  onMouseEnter: () => setActiveFeatureCharacter([chars, feature]),
@@ -321,7 +335,7 @@ function CharacterViewerComponent(_ref3) {
321
335
  feature,
322
336
  characters
323
337
  } = _ref8;
324
- return characters.map((chars, j) => /*#__PURE__*/_react.default.createElement("div", {
338
+ return characters.map((chars, j) => /*#__PURE__*/_react.default.createElement(Character, {
325
339
  key: `${i}${j}`,
326
340
  style: {
327
341
  fontFeatureSettings: `'${feature}' 1`
@@ -197,7 +197,7 @@ function Precart(_ref3) {
197
197
  type: 'PRECART_SELECT_LICENSE',
198
198
  licenseOptionSpec: spec
199
199
  }));
200
- }, [viewer]);
200
+ }, []);
201
201
  function renderConfirmingModal(subtotal) {
202
202
  var _viewer$precart3, _viewer$precart3$skus;
203
203
  if (!isConfirming) {
@@ -23,7 +23,7 @@ const StoreModalProduct = _ref => {
23
23
  prepared
24
24
  } = _ref;
25
25
  const config = (0, _react.useContext)(_ConfigContext.default);
26
- const data = (0, _reactRelay.usePreloadedQuery)(_StoreModalProductQuery !== void 0 ? _StoreModalProductQuery : (_StoreModalProductQuery = require("../../__generated__/StoreModalProductQuery.graphql"), _StoreModalProductQuery.hash && _StoreModalProductQuery.hash !== "491d7c1daa28742d375049de66b6c386" && console.error("The definition of 'StoreModalProductQuery' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _StoreModalProductQuery), prepared.productQuery);
26
+ const data = (0, _reactRelay.usePreloadedQuery)(_StoreModalProductQuery !== void 0 ? _StoreModalProductQuery : (_StoreModalProductQuery = require("../../__generated__/StoreModalProductQuery.graphql"), _StoreModalProductQuery.hash && _StoreModalProductQuery.hash !== "a56c2c63a760bf157f6456dcc5a59dad" && console.error("The definition of 'StoreModalProductQuery' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _StoreModalProductQuery), prepared.productQuery);
27
27
  const {
28
28
  collection,
29
29
  viewer
@@ -65,7 +65,7 @@ const StoreModalProduct = _ref => {
65
65
  })), licensesPosition === 'bottom' && /*#__PURE__*/_react.default.createElement(_StoreModalProductLicenseSelection.default, {
66
66
  viewer: viewer
67
67
  })),
68
- stickyFooter: viewer.stripeCredentials ? /*#__PURE__*/_react.default.createElement(_StoreModalProductSummary.default, {
68
+ stickyFooter: viewer.stripeAccountId ? /*#__PURE__*/_react.default.createElement(_StoreModalProductSummary.default, {
69
69
  viewer: viewer
70
70
  }) : /*#__PURE__*/_react.default.createElement("div", null, "Please", ' ', /*#__PURE__*/_react.default.createElement("a", {
71
71
  href: `${viewer.endpoint}/admin/settings/payments`,
@@ -121,7 +121,7 @@ const StoreModalReview = _ref => {
121
121
  city: billingIdentity.locality ?? '',
122
122
  state: billingIdentity.administrativeArea ?? '',
123
123
  country: billingIdentity.country,
124
- postal_code: billingIdentity.zip ?? undefined
124
+ postal_code: billingIdentity.zip ?? ''
125
125
  }
126
126
  }
127
127
  }
@@ -13,15 +13,18 @@ var _StripeProvider_viewer;
13
13
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
14
14
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
15
15
  const StripeProvider = _ref => {
16
- var _data$stripeCredentia, _data$settings, _data$currentOrder, _data$currentOrder$st, _data$settings2, _data$themeConfig;
16
+ var _data$settings, _data$currentOrder, _data$currentOrder$st, _data$settings2, _data$themeConfig;
17
17
  let {
18
18
  viewer,
19
19
  children,
20
20
  requireClientSecret = true
21
21
  } = _ref;
22
- const data = (0, _reactRelay.useFragment)(_StripeProvider_viewer !== void 0 ? _StripeProvider_viewer : (_StripeProvider_viewer = require("../../__generated__/StripeProvider_viewer.graphql"), _StripeProvider_viewer.hash && _StripeProvider_viewer.hash !== "94dbdb1714785c862861adc46d6db0d7" && console.error("The definition of 'StripeProvider_viewer' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _StripeProvider_viewer), viewer);
23
- const stripeKey = (_data$stripeCredentia = data.stripeCredentials) === null || _data$stripeCredentia === void 0 ? void 0 : _data$stripeCredentia.stripePublishableKey;
24
- const stripePromiseRef = (0, _react.useRef)(stripeKey ? (0, _stripeJs.loadStripe)(stripeKey) : null);
22
+ const data = (0, _reactRelay.useFragment)(_StripeProvider_viewer !== void 0 ? _StripeProvider_viewer : (_StripeProvider_viewer = require("../../__generated__/StripeProvider_viewer.graphql"), _StripeProvider_viewer.hash && _StripeProvider_viewer.hash !== "efff082269b64afc7019b4d725285afa" && console.error("The definition of 'StripeProvider_viewer' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _StripeProvider_viewer), viewer);
23
+ const stripeKey = data.stripePublishableKey;
24
+ const stripeAccount = data.stripeAccountId;
25
+ const stripePromiseRef = (0, _react.useRef)(stripeKey && stripeAccount ? (0, _stripeJs.loadStripe)(stripeKey, {
26
+ stripeAccount
27
+ }) : null);
25
28
  const cssSrc = (_data$settings = data.settings) === null || _data$settings === void 0 ? void 0 : _data$settings.uiFontUrl;
26
29
  const clientSecret = ((_data$currentOrder = data.currentOrder) === null || _data$currentOrder === void 0 ? void 0 : (_data$currentOrder$st = _data$currentOrder.stripePaymentIntent) === null || _data$currentOrder$st === void 0 ? void 0 : _data$currentOrder$st.clientSecret) ?? undefined;
27
30
 
@@ -3,11 +3,20 @@ import { Alignment, Direction } from './types';
3
3
  import { SerializablePreloadedQuery } from '../../relay/loadSerializableQuery';
4
4
  import { TypeTesterStandaloneQuery } from '__generated__/TypeTesterStandaloneQuery.graphql';
5
5
  interface TypeTesterStandaloneComponent_props {
6
- lineHeight?: number;
7
- fontSize?: number;
8
- features?: string[];
9
- featuresSelected?: string[];
10
- content?: string;
6
+ lineHeight?: number | null;
7
+ fontSize?: number | null;
8
+ axes?: string[] | null;
9
+ features?: string[] | null;
10
+ featuresSelected?: string[] | null;
11
+ featureSettings?: {
12
+ feature: string;
13
+ value: string;
14
+ }[] | null;
15
+ variableSettings?: {
16
+ axis: string;
17
+ value: number;
18
+ }[] | null;
19
+ content?: string | null;
11
20
  direction?: Direction;
12
21
  alignment?: Alignment;
13
22
  autofit?: boolean;
@@ -19,8 +19,11 @@ function TypeTesterStandaloneComponent(_ref) {
19
19
  let {
20
20
  content,
21
21
  direction,
22
+ axes,
22
23
  features,
23
24
  featuresSelected,
25
+ featureSettings = null,
26
+ variableSettings = null,
24
27
  lineHeight,
25
28
  alignment,
26
29
  fontSize,
@@ -37,14 +40,22 @@ function TypeTesterStandaloneComponent(_ref) {
37
40
  size: fontSize ?? 72,
38
41
  lineHeight: lineHeight ?? 1,
39
42
  alignment: alignment ?? 'left',
40
- features: featuresSelected ?? null,
41
- variableSettings: null
43
+ features: (featureSettings === null || featureSettings === void 0 ? void 0 : featureSettings.filter(setting => setting.value === '1').map(setting => setting.feature)) ?? featuresSelected ?? null,
44
+ variableSettings: (variableSettings === null || variableSettings === void 0 ? void 0 : variableSettings.reduce((acc, _ref2) => {
45
+ let {
46
+ axis,
47
+ value
48
+ } = _ref2;
49
+ acc[axis] = value;
50
+ return acc;
51
+ }, {})) ?? null
42
52
  }
43
53
  }
44
54
  }, /*#__PURE__*/_react.default.createElement(_index.default, {
45
55
  id: "standalone",
46
56
  viewer: data.viewer,
47
57
  fontStyle: (_data$viewer = data.viewer) === null || _data$viewer === void 0 ? void 0 : _data$viewer.fontStyle,
58
+ axes: axes,
48
59
  features: features,
49
60
  direction: direction,
50
61
  productId: ((_data$viewer2 = data.viewer) === null || _data$viewer2 === void 0 ? void 0 : (_data$viewer2$fontSty = _data$viewer2.fontStyle) === null || _data$viewer2$fontSty === void 0 ? void 0 : (_data$viewer2$fontSty2 = _data$viewer2$fontSty.family) === null || _data$viewer2$fontSty2 === void 0 ? void 0 : (_data$viewer2$fontSty3 = _data$viewer2$fontSty2.parent) === null || _data$viewer2$fontSty3 === void 0 ? void 0 : _data$viewer2$fontSty3.id) ?? ((_data$viewer3 = data.viewer) === null || _data$viewer3 === void 0 ? void 0 : (_data$viewer3$fontSty = _data$viewer3.fontStyle) === null || _data$viewer3$fontSty === void 0 ? void 0 : (_data$viewer3$fontSty2 = _data$viewer3$fontSty.family) === null || _data$viewer3$fontSty2 === void 0 ? void 0 : _data$viewer3$fontSty2.id),
@@ -54,24 +65,24 @@ function TypeTesterStandaloneComponent(_ref) {
54
65
  }));
55
66
  }
56
67
  const query = _TypeTesterStandaloneQuery !== void 0 ? _TypeTesterStandaloneQuery : (_TypeTesterStandaloneQuery = require("../../__generated__/TypeTesterStandaloneQuery.graphql"), _TypeTesterStandaloneQuery.hash && _TypeTesterStandaloneQuery.hash !== "3ad5c4d856f5d46ddf8a47a2b6d2420a" && console.error("The definition of 'TypeTesterStandaloneQuery' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _TypeTesterStandaloneQuery);
57
- function TypeTesterStandalonePreloadedQueryRenderer(_ref2) {
68
+ function TypeTesterStandalonePreloadedQueryRenderer(_ref3) {
58
69
  let {
59
70
  preloadedQuery,
60
71
  ...rest
61
- } = _ref2;
72
+ } = _ref3;
62
73
  const queryRef = (0, _useSerializablePreloadedQuery.default)(preloadedQuery);
63
74
  const data = (0, _reactRelay.usePreloadedQuery)(query, queryRef);
64
75
  return /*#__PURE__*/_react.default.createElement(TypeTesterStandaloneComponent, _extends({
65
76
  data: data
66
77
  }, rest));
67
78
  }
68
- function TypeTesterStandalone(_ref3) {
79
+ function TypeTesterStandalone(_ref4) {
69
80
  var _data$viewer4;
70
81
  let {
71
82
  familyName,
72
83
  styleName,
73
84
  ...rest
74
- } = _ref3;
85
+ } = _ref4;
75
86
  const data = (0, _reactRelay.useLazyLoadQuery)(query, {
76
87
  familyName,
77
88
  styleName
@@ -5,7 +5,9 @@ interface TypeTesterElement_props {
5
5
  lineHeight?: string;
6
6
  fontSize?: string;
7
7
  features?: string;
8
+ axes?: string;
8
9
  featuresSelected?: string;
10
+ variableSettings?: string;
9
11
  content?: string;
10
12
  direction?: string;
11
13
  alignment?: string;
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = exports.TypeTesterStandaloneElement = void 0;
7
7
  var _react = _interopRequireDefault(require("react"));
8
8
  var _TypeTesterStandalone = _interopRequireDefault(require("./TypeTesterStandalone"));
9
+ var _utils = require("../../utils");
9
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
11
  function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
11
12
  const isAlignment = str => {
@@ -15,12 +16,31 @@ const isDirection = str => {
15
16
  return str === 'ltr' || str === 'rtl';
16
17
  };
17
18
  const parseBool = input => input === 'true' ? true : false;
19
+
20
+ // parse a string like "wdth 1000, ital 0.5" into
21
+ // [{ axis: "wdth", value: 1000 }, { axis: "ital", value: 0.5 }]
22
+ function parseVariableSettings(input) {
23
+ if (!input) return null;
24
+ return input.split(/\s*,\s*/).map(settingString => {
25
+ const m = settingString.match(/^([A-Za-z0-9]{4}) (\d+(?:\.\d+)?)$/);
26
+ if (m && m.length > 2) {
27
+ return {
28
+ axis: m[1],
29
+ value: parseFloat(m[2])
30
+ };
31
+ } else {
32
+ console.warn(`fontdue-type-tester failed to parse variable-settings value: "${settingString}", ignoring`);
33
+ }
34
+ }).filter(_utils.notEmpty);
35
+ }
18
36
  const TypeTesterStandaloneElement = _ref => {
19
37
  let {
20
38
  lineHeight,
21
39
  fontSize,
40
+ axes,
22
41
  features,
23
42
  featuresSelected,
43
+ variableSettings,
24
44
  alignment,
25
45
  direction,
26
46
  autofit,
@@ -30,10 +50,15 @@ const TypeTesterStandaloneElement = _ref => {
30
50
  autofit: parseBool(autofit),
31
51
  lineHeight: lineHeight ? parseFloat(lineHeight) : undefined,
32
52
  fontSize: fontSize ? parseFloat(fontSize) : undefined,
53
+ axes: (axes === null || axes === void 0 ? void 0 : axes.split(',')) ?? [],
33
54
  features: (features === null || features === void 0 ? void 0 : features.split(',')) ?? [],
34
- featuresSelected: (featuresSelected === null || featuresSelected === void 0 ? void 0 : featuresSelected.split(',')) ?? [],
55
+ featureSettings: featuresSelected === null || featuresSelected === void 0 ? void 0 : featuresSelected.split(',').map(feature => ({
56
+ feature,
57
+ value: '1'
58
+ })),
35
59
  alignment: isAlignment(alignment) ? alignment : undefined,
36
- direction: isDirection(direction) ? direction : undefined
60
+ direction: isDirection(direction) ? direction : undefined,
61
+ variableSettings: parseVariableSettings(variableSettings)
37
62
  }, rest));
38
63
  };
39
64
  exports.TypeTesterStandaloneElement = TypeTesterStandaloneElement;
@@ -32,7 +32,8 @@ const TypeTesterVariableAxes = _ref => {
32
32
  };
33
33
  return /*#__PURE__*/_react.default.createElement("div", {
34
34
  className: "type-tester__variable-axes"
35
- }, axes.map(showAxis => {
35
+ }, axes.filter(showAxis => showAxis in variableSettings) // only show the slider if the value is set
36
+ .map(showAxis => {
36
37
  var _fontStyle$variableAx;
37
38
  return (_fontStyle$variableAx = fontStyle.variableAxes) === null || _fontStyle$variableAx === void 0 ? void 0 : _fontStyle$variableAx.find(_ref2 => {
38
39
  let {
package/dist/fontdue.css CHANGED
@@ -935,23 +935,31 @@ div[data-component=TypeTesters] {
935
935
 
936
936
  .character-viewer__block__characters {
937
937
  display: grid;
938
- grid-template-columns: repeat(calc(var(--width) / 60), 1fr);
938
+ grid-template-columns: repeat(calc(var(--width) / 60), minmax(0, 1fr));
939
939
  font-size: 30px;
940
940
  margin-left: 1px;
941
941
  }
942
942
  .character-viewer__block__characters > div {
943
- border-top: 1px solid;
944
- border-left: 1px solid;
945
- border-bottom: 1px solid;
946
- border-right: 1px solid;
943
+ border: 1px solid;
947
944
  margin-left: -1px;
948
945
  margin-bottom: -1px;
949
- padding-top: 12px;
950
- padding-bottom: 12px;
946
+ padding: 12px 0;
951
947
  text-align: center;
952
948
  cursor: default;
953
949
  white-space: pre;
954
950
  }
951
+ .character-viewer__block__characters > div[data-size="2"] {
952
+ grid-column: span 2;
953
+ }
954
+ .character-viewer__block__characters > div[data-size="3"] {
955
+ grid-column: span 3;
956
+ }
957
+ .character-viewer__block__characters > div[data-size="4"] {
958
+ grid-column: span 4;
959
+ }
960
+ .character-viewer__block__characters > div[data-size="5"] {
961
+ grid-column: span 5;
962
+ }
955
963
  @media screen and (min-width: 600px) {
956
964
  .character-viewer__block__characters > div:hover, .character-viewer__block__characters > div[data-selected=true] {
957
965
  background: var(--primary_text_color);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fontdue-js",
3
- "version": "2.0.1",
3
+ "version": "2.2.0",
4
4
  "scripts": {
5
5
  "build": "npm run relay && run-p build-js build-css build-ts-declarations",
6
6
  "build-js": "babel src --out-dir dist --extensions .ts,.tsx,.js,.jsx",