fontdue-js 3.0.2 → 3.0.3

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
+ ## 3.0.3
2
+
3
+ - Fixed misaligned style names in `StoreModal`. The feature-glyphs preview is no longer rendered when a style has nothing to show — a variable font with no named instances, or a non-variable style with no representative glyph for its languages — so its empty wrapper no longer indents the style name and rows in a family now line up.
4
+
1
5
  ## 3.0.2
2
6
 
3
7
  - Fixed the `CharacterViewer` dropping character groups that have no OpenType feature (such as Uppercase, Lowercase, and Punctuation). The glyph matcher now treats an empty feature list, `null`, and `undefined` as the same “no feature” state, so a featureless group matches whether the API returns `[]` or `null` for it.
@@ -11,7 +11,7 @@ import StoreModalStyleButtonElement from '../elements/StoreModalStyleButton/inde
11
11
  import { getFeatureGlyphs, variableInstanceCSS } from '../../utils.js';
12
12
  const THIN_SPACE = '\u2009';
13
13
  export default function StoreModalStyleButton(_ref) {
14
- var _fontStyle$variableIn;
14
+ var _fontStyle$variableIn, _fontStyle$variableIn2;
15
15
  let {
16
16
  fontStyle: fontStyleKey,
17
17
  onSelectSku,
@@ -24,17 +24,18 @@ export default function StoreModalStyleButton(_ref) {
24
24
  if (!fontStyle.sku) return;
25
25
  onSelectSku(fontStyle.sku.id, !selected);
26
26
  };
27
+ const hasFeatureGlyphs = isVariableFont ? Boolean((_fontStyle$variableIn = fontStyle.variableInstances) === null || _fontStyle$variableIn === void 0 ? void 0 : _fontStyle$variableIn.length) : getFeatureGlyphs(fontStyle.supportedLanguages) != null;
27
28
  return /*#__PURE__*/React.createElement(StoreModalStyleButtonElement, _extends({}, rest, {
28
29
  onClick: fontStyle.sku ? handleSelect : undefined,
29
30
  selected: selected
30
31
  }), {
31
- featureGlyphs: /*#__PURE__*/React.createElement(FontStyle, {
32
+ featureGlyphs: hasFeatureGlyphs ? /*#__PURE__*/React.createElement(FontStyle, {
32
33
  fontStyle: fontStyle,
33
34
  Component: "span"
34
- }, isVariableFont ? (_fontStyle$variableIn = fontStyle.variableInstances) === null || _fontStyle$variableIn === void 0 ? void 0 : _fontStyle$variableIn.map((instance, i) => /*#__PURE__*/React.createElement("span", {
35
+ }, isVariableFont ? (_fontStyle$variableIn2 = fontStyle.variableInstances) === null || _fontStyle$variableIn2 === void 0 ? void 0 : _fontStyle$variableIn2.map((instance, i) => /*#__PURE__*/React.createElement("span", {
35
36
  key: instance.name,
36
37
  style: variableInstanceCSS(instance)
37
- }, i !== 0 && THIN_SPACE, getFeatureGlyphs(fontStyle.supportedLanguages))) : getFeatureGlyphs(fontStyle.supportedLanguages)),
38
+ }, i !== 0 && THIN_SPACE, getFeatureGlyphs(fontStyle.supportedLanguages))) : getFeatureGlyphs(fontStyle.supportedLanguages)) : null,
38
39
  // for variable fonts, only show the name of the style if there are
39
40
  // multiple styles
40
41
  name: isVariableFont ? fontStyle.sku ? fontStyle.name : undefined : fontStyle.name,
@@ -17,9 +17,9 @@ const StoreModalStyleButton = _ref => {
17
17
  "data-clickable": Boolean(rest.onClick)
18
18
  }), /*#__PURE__*/React.createElement("div", {
19
19
  className: "store-modal__style-button__container"
20
- }, /*#__PURE__*/React.createElement("span", {
20
+ }, featureGlyphs && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
21
21
  className: "store-modal__style-button__feature-glyphs"
22
- }, featureGlyphs), ' ', /*#__PURE__*/React.createElement("span", {
22
+ }, featureGlyphs), ' '), /*#__PURE__*/React.createElement("span", {
23
23
  className: "store-modal__style-button__style-name"
24
24
  }, name), selected ? /*#__PURE__*/React.createElement("div", {
25
25
  className: "store-modal__style-button__checked"
package/dist/fontdue.css CHANGED
@@ -1737,6 +1737,7 @@ input:checked + .checkbox__icon {
1737
1737
  padding-left: 0;
1738
1738
  padding-right: 0;
1739
1739
  box-shadow: none;
1740
+ background: transparent;
1740
1741
  }
1741
1742
 
1742
1743
  .store-modal__family-button__container {
@@ -7,7 +7,7 @@ import { PREVIEW_HEADER, hasPreviewMarkerCookie } from '../preview/constants.js'
7
7
  // (defineVersionPlugin in .babelrc.cjs) with the literal package.json#version.
8
8
  // Exported so UI (the admin toolbar) can surface it without re-reading the
9
9
  // build-time global in a 'use client' module.
10
- export const version = "3.0.2";
10
+ export const version = "3.0.3";
11
11
  const IS_SERVER = typeof window === typeof undefined;
12
12
 
13
13
  // Opt server fetches into Next's data cache only in production; dev stays
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fontdue-js",
3
- "version": "3.0.2",
3
+ "version": "3.0.3",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "build": "npm run relay && run-p build-js build-css build-ts",