fontdue-js 3.0.2 → 3.0.4
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 +8 -0
- package/dist/components/CharacterViewer/index.js +5 -3
- package/dist/components/StoreModal/StoreModalStyleButton.js +5 -4
- package/dist/components/elements/StoreModalStyleButton/index.js +2 -2
- package/dist/fontdue.css +4 -2
- package/dist/relay/environment.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
## 3.0.4
|
|
2
|
+
|
|
3
|
+
- Fixed the `CharacterViewer` breaking its grid layout when a character set contains glyphs that need an OpenType feature. Each character set is wrapped in its own element so it can carry its own `font-feature-settings`; those wrappers are now `display: contents` so their cells flow through the block's single grid, rather than each wrapper being its own grid and forcing a row break at every feature boundary — an inserted `ss01`/`salt` alternate no longer lands alone on the next row.
|
|
4
|
+
|
|
5
|
+
## 3.0.3
|
|
6
|
+
|
|
7
|
+
- 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.
|
|
8
|
+
|
|
1
9
|
## 3.0.2
|
|
2
10
|
|
|
3
11
|
- 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.
|
|
@@ -207,9 +207,11 @@ function CharacterViewerComponent(_ref2) {
|
|
|
207
207
|
const [cellWidth, setCellWidth] = useState(null);
|
|
208
208
|
const measureCell = useCallback(() => {
|
|
209
209
|
var _blocksRef$current;
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
const
|
|
210
|
+
// The grid container is the per-block characters element; the
|
|
211
|
+
// character-list wrappers inside it are display: contents (FD-810).
|
|
212
|
+
const grid = (_blocksRef$current = blocksRef.current) === null || _blocksRef$current === void 0 ? void 0 : _blocksRef$current.querySelector('.character-viewer__block__characters');
|
|
213
|
+
if (!grid) return;
|
|
214
|
+
const firstTrack = getComputedStyle(grid).gridTemplateColumns.split(' ')[0];
|
|
213
215
|
const width = parseFloat(firstTrack);
|
|
214
216
|
if (!Number.isNaN(width)) setCellWidth(width);
|
|
215
217
|
}, []);
|
|
@@ -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$
|
|
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
|
@@ -1075,11 +1075,12 @@ fontdue-type-tester {
|
|
|
1075
1075
|
.character-viewer__block__characters {
|
|
1076
1076
|
font-size: 30px;
|
|
1077
1077
|
margin-left: 1px;
|
|
1078
|
+
display: grid;
|
|
1079
|
+
grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
|
|
1078
1080
|
}
|
|
1079
1081
|
|
|
1080
1082
|
.character-viewer__block__character-list {
|
|
1081
|
-
display:
|
|
1082
|
-
grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
|
|
1083
|
+
display: contents;
|
|
1083
1084
|
}
|
|
1084
1085
|
.character-viewer__block__character-list > div {
|
|
1085
1086
|
min-height: var(--cell-width, 60px);
|
|
@@ -1737,6 +1738,7 @@ input:checked + .checkbox__icon {
|
|
|
1737
1738
|
padding-left: 0;
|
|
1738
1739
|
padding-right: 0;
|
|
1739
1740
|
box-shadow: none;
|
|
1741
|
+
background: transparent;
|
|
1740
1742
|
}
|
|
1741
1743
|
|
|
1742
1744
|
.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.
|
|
10
|
+
export const version = "3.0.4";
|
|
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
|