fontdue-js 2.23.1 → 2.23.2

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,7 @@
1
+ ## 2.23.2
2
+
3
+ - Fixed a right-edge gap in the *CharacterViewer* glyph grid.
4
+
1
5
  ## 2.23.1
2
6
 
3
7
  - Tweaked checkout styling.
@@ -235,14 +235,31 @@ function CharacterViewerComponent(_ref3) {
235
235
  const handleMouseLeave = () => {
236
236
  if (selectedGlyph) setActiveGlyph(undefined);
237
237
  };
238
- const {
239
- ref: blocksRef,
240
- width: blocksWidth
241
- } = useSize();
242
238
  const {
243
239
  ref: monitorRef,
244
240
  width: monitorWidth
245
241
  } = useSize();
242
+
243
+ // Read the grid's resolved first-track width and expose it as --cell-width
244
+ // on the blocks container. CSS uses --cell-width as min-height on every
245
+ // cell so rows have consistent height regardless of cell composition —
246
+ // without it, rows of all-wide span-N cells would collapse to glyph content
247
+ // height. We read the grid track instead of measuring an individual cell so
248
+ // a wide span-N cell at index 0 wouldn't poison the measurement.
249
+ const blocksRef = (0, _react.useRef)(null);
250
+ const [cellWidth, setCellWidth] = (0, _react.useState)(null);
251
+ const measureCell = (0, _react.useCallback)(() => {
252
+ var _blocksRef$current;
253
+ const list = (_blocksRef$current = blocksRef.current) === null || _blocksRef$current === void 0 ? void 0 : _blocksRef$current.querySelector('.character-viewer__block__character-list');
254
+ if (!list) return;
255
+ const firstTrack = getComputedStyle(list).gridTemplateColumns.split(' ')[0];
256
+ const width = parseFloat(firstTrack);
257
+ if (!Number.isNaN(width)) setCellWidth(width);
258
+ }, []);
259
+ (0, _react.useEffect)(measureCell, [measureCell]);
260
+ (0, _resizeObserver.default)(blocksRef, measureCell, {
261
+ polyfill: typeof window === 'undefined' ? ServerSideResizeObserverPolyfill : null
262
+ });
246
263
  if (!fontStyle) return null;
247
264
  const {
248
265
  ascender,
@@ -365,9 +382,9 @@ function CharacterViewerComponent(_ref3) {
365
382
  })))), /*#__PURE__*/_react.default.createElement("div", {
366
383
  className: "character-viewer_blocks",
367
384
  ref: blocksRef,
368
- style: {
369
- '--width': blocksWidth ?? 600
370
- }
385
+ style: cellWidth ? {
386
+ '--cell-width': `${cellWidth}px`
387
+ } : undefined
371
388
  }, groups === null || groups === void 0 ? void 0 : groups.map((_ref6, i) => {
372
389
  let {
373
390
  name,
package/dist/fontdue.css CHANGED
@@ -1083,10 +1083,12 @@ div[data-component=TypeTesters] {
1083
1083
  margin-left: 1px;
1084
1084
  }
1085
1085
 
1086
+ .character-viewer__block__character-list {
1087
+ display: grid;
1088
+ grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
1089
+ }
1086
1090
  .character-viewer__block__character-list > div {
1087
- --size: 1;
1088
- --item-size: calc(var(--size) / (var(--width) / 60) * 100%);
1089
- --height: calc(var(--item-size) / var(--size));
1091
+ min-height: var(--cell-width, 60px);
1090
1092
  display: flex;
1091
1093
  align-items: center;
1092
1094
  justify-content: center;
@@ -1096,25 +1098,20 @@ div[data-component=TypeTesters] {
1096
1098
  text-align: center;
1097
1099
  cursor: default;
1098
1100
  white-space: pre;
1099
- width: var(--item-size);
1100
- height: 0;
1101
- padding-top: calc(var(--height) / 2);
1102
- padding-bottom: calc(var(--height) / 2);
1103
- float: left;
1104
1101
  z-index: 0;
1105
1102
  position: relative;
1106
1103
  }
1107
1104
  .character-viewer__block__character-list > div[data-size="2"] {
1108
- --size: 2;
1105
+ grid-column: span 2;
1109
1106
  }
1110
1107
  .character-viewer__block__character-list > div[data-size="3"] {
1111
- --size: 3;
1108
+ grid-column: span 3;
1112
1109
  }
1113
1110
  .character-viewer__block__character-list > div[data-size="4"] {
1114
- --size: 4;
1111
+ grid-column: span 4;
1115
1112
  }
1116
1113
  .character-viewer__block__character-list > div[data-size="5"] {
1117
- --size: 5;
1114
+ grid-column: span 5;
1118
1115
  }
1119
1116
  @media screen and (min-width: 600px) {
1120
1117
  .character-viewer__block__character-list > div:hover, .character-viewer__block__character-list > div[data-selected=true] {
@@ -1260,7 +1257,7 @@ body[data-fontdue-store-modal=open] {
1260
1257
  @media (min-width: 900px) {
1261
1258
  .store-modal__cart__review {
1262
1259
  display: grid;
1263
- grid-template-columns: 1fr 1fr;
1260
+ grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
1264
1261
  grid-auto-rows: min-content;
1265
1262
  grid-gap: 20px;
1266
1263
  align-items: baseline;
@@ -1418,6 +1415,12 @@ body[data-fontdue-store-modal=open] {
1418
1415
  }
1419
1416
  }
1420
1417
 
1418
+ @media (max-width: 899px) {
1419
+ .store-modal__cart__coupon-code-input + .store-modal__cart__share {
1420
+ margin-top: 20px;
1421
+ }
1422
+ }
1423
+
1421
1424
  .store-modal__container__overlay {
1422
1425
  position: fixed;
1423
1426
  top: 0;
@@ -1653,6 +1656,11 @@ body[data-fontdue-store-modal=open] {
1653
1656
  .store-modal__family__group {
1654
1657
  display: flex;
1655
1658
  }
1659
+ @media (max-width: 899px) {
1660
+ .store-modal__family__group {
1661
+ flex-direction: column;
1662
+ }
1663
+ }
1656
1664
 
1657
1665
  .store-modal__family__style-button,
1658
1666
  .store-modal__family__family-button,
@@ -1736,11 +1744,6 @@ body[data-fontdue-store-modal=open] {
1736
1744
  grid-column-gap: 10px;
1737
1745
  grid-row-gap: 10px;
1738
1746
  }
1739
- @media (max-width: 899px) {
1740
- .store-modal__family-button__container {
1741
- grid-template-columns: auto auto;
1742
- }
1743
- }
1744
1747
 
1745
1748
  .store-modal__family-button__price,
1746
1749
  .store-modal__family-button__checked {
@@ -1748,11 +1751,12 @@ body[data-fontdue-store-modal=open] {
1748
1751
  display: inline-block;
1749
1752
  }
1750
1753
 
1751
- @media (max-width: 899px) {
1752
- .store-modal__family-button__label,
1753
- .store-modal__family-button__price {
1754
- grid-row: 2;
1755
- }
1754
+ .store-modal__family-button__label {
1755
+ white-space: nowrap;
1756
+ }
1757
+
1758
+ .store-modal__family-button__price:empty {
1759
+ display: none;
1756
1760
  }
1757
1761
 
1758
1762
  .store-modal__family-button__name {
@@ -1761,7 +1765,7 @@ body[data-fontdue-store-modal=open] {
1761
1765
  }
1762
1766
  @media (max-width: 899px) {
1763
1767
  .store-modal__family-button__name {
1764
- grid-column: 1/span 2;
1768
+ font-size: 24px;
1765
1769
  }
1766
1770
  }
1767
1771
 
@@ -2330,6 +2334,7 @@ body[data-fontdue-store-modal=open] {
2330
2334
 
2331
2335
  .cart-additions__form {
2332
2336
  display: flex;
2337
+ width: 100%;
2333
2338
  }
2334
2339
  .cart-additions__button {
2335
2340
  white-space: nowrap;
@@ -2379,6 +2384,8 @@ body[data-fontdue-store-modal=open] {
2379
2384
  }
2380
2385
  .cart-additions__field-wrapper {
2381
2386
  z-index: 1;
2387
+ flex: 1;
2388
+ margin-right: -1px;
2382
2389
  }
2383
2390
  .cart-additions__state-icon {
2384
2391
  position: absolute;
@@ -2430,10 +2437,10 @@ body[data-fontdue-store-modal=open] {
2430
2437
  line-height: normal;
2431
2438
  }
2432
2439
  .cart-additions__field {
2433
- margin-right: -1px;
2434
2440
  padding-right: 35px;
2435
2441
  font-family: inherit;
2436
2442
  min-width: 0;
2443
+ width: 100%;
2437
2444
  }
2438
2445
  .cart-additions[data-status=error] .cart-additions__field {
2439
2446
  color: var(--error_color);
@@ -2475,6 +2482,19 @@ body[data-fontdue-store-modal=open] {
2475
2482
  border-top: 1px solid var(--horizontal_rule_color);
2476
2483
  padding-top: 40px;
2477
2484
  }
2485
+ @media (max-width: 899px) {
2486
+ .cart-item {
2487
+ display: grid;
2488
+ grid-template-columns: 1fr auto;
2489
+ column-gap: 20px;
2490
+ align-items: baseline;
2491
+ }
2492
+ }
2493
+ @media (max-width: 899px) {
2494
+ > div:has(> .cart-item__licenses) {
2495
+ grid-column: 1/-1;
2496
+ }
2497
+ }
2478
2498
  @media (min-width: 900px) {
2479
2499
  .cart-item {
2480
2500
  display: grid;
@@ -2504,6 +2524,12 @@ body[data-fontdue-store-modal=open] {
2504
2524
  .cart-item__label {
2505
2525
  color: var(--styles-count-color, var(--secondary_text_color));
2506
2526
  }
2527
+ @media (max-width: 899px) {
2528
+ .cart-item__product {
2529
+ grid-column: 1;
2530
+ margin-bottom: 20px;
2531
+ }
2532
+ }
2507
2533
  .cart-item__name {
2508
2534
  font-size: 1em;
2509
2535
  margin-top: 30px; /* line up to the baseline of next column */
@@ -2667,11 +2693,12 @@ body[data-fontdue-store-modal=open] {
2667
2693
  .cart-item__license-variable__loading {
2668
2694
  padding: 10px;
2669
2695
  }
2670
- .cart-item__price {
2671
- margin-top: 20px;
2672
- }
2673
- .cart-item:first-child .cart-item__price {
2674
- margin-top: 0;
2696
+ @media (max-width: 899px) {
2697
+ .cart-item__price {
2698
+ grid-column: 2;
2699
+ grid-row: 1;
2700
+ text-align: right;
2701
+ }
2675
2702
  }
2676
2703
  @media (min-width: 900px) {
2677
2704
  .cart-item__price {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fontdue-js",
3
- "version": "2.23.1",
3
+ "version": "2.23.2",
4
4
  "scripts": {
5
5
  "build": "npm run relay && run-p build-js build-css build-ts",
6
6
  "build-js": "babel src --out-dir dist --extensions .ts,.tsx,.js,.jsx",