labellife-design-tool 2.4.6 → 2.5.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/README.md +14 -0
- package/dist/cjs/index.js +241 -123
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/model/store.js +112 -15
- package/dist/cjs/model/store.js.map +1 -1
- package/dist/cjs/toolbar/toolbar.js +26 -5
- package/dist/cjs/toolbar/toolbar.js.map +1 -1
- package/dist/esm/index.js +241 -123
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/model/store.js +112 -15
- package/dist/esm/model/store.js.map +1 -1
- package/dist/esm/toolbar/toolbar.js +26 -5
- package/dist/esm/toolbar/toolbar.js.map +1 -1
- package/package.json +3 -2
|
@@ -840,7 +840,7 @@ var TextEffectsPanel = observer(function (_ref2) {
|
|
|
840
840
|
});
|
|
841
841
|
TextEffectsPanel.displayName = 'TextEffectsPanel';
|
|
842
842
|
|
|
843
|
-
var _excluded = ["fontFamily"];
|
|
843
|
+
var _excluded = ["fontFamily", "store"];
|
|
844
844
|
var _positionMenuItemSx = {
|
|
845
845
|
textTransform: 'none',
|
|
846
846
|
fontSize: 12,
|
|
@@ -867,6 +867,7 @@ function loadFontPreview(fontFamily) {
|
|
|
867
867
|
}
|
|
868
868
|
var FontPreviewOption = /*#__PURE__*/memo(function FontPreviewOption(_ref) {
|
|
869
869
|
var fontFamily = _ref.fontFamily,
|
|
870
|
+
store = _ref.store,
|
|
870
871
|
liProps = _objectWithoutProperties(_ref, _excluded);
|
|
871
872
|
var ref = useRef(null);
|
|
872
873
|
useEffect(function () {
|
|
@@ -876,7 +877,15 @@ var FontPreviewOption = /*#__PURE__*/memo(function FontPreviewOption(_ref) {
|
|
|
876
877
|
var _ref3 = _slicedToArray(_ref2, 1),
|
|
877
878
|
entry = _ref3[0];
|
|
878
879
|
if (entry.isIntersecting) {
|
|
879
|
-
|
|
880
|
+
var _store$customFonts;
|
|
881
|
+
var isCustom = store === null || store === void 0 || (_store$customFonts = store.customFonts) === null || _store$customFonts === void 0 ? void 0 : _store$customFonts.some(function (f) {
|
|
882
|
+
return f.name === fontFamily;
|
|
883
|
+
});
|
|
884
|
+
if (isCustom) {
|
|
885
|
+
store.loadFont(fontFamily);
|
|
886
|
+
} else {
|
|
887
|
+
loadFontPreview(fontFamily);
|
|
888
|
+
}
|
|
880
889
|
io.disconnect();
|
|
881
890
|
}
|
|
882
891
|
}, {
|
|
@@ -886,7 +895,7 @@ var FontPreviewOption = /*#__PURE__*/memo(function FontPreviewOption(_ref) {
|
|
|
886
895
|
return function () {
|
|
887
896
|
return io.disconnect();
|
|
888
897
|
};
|
|
889
|
-
}, [fontFamily]);
|
|
898
|
+
}, [fontFamily, store]);
|
|
890
899
|
return /*#__PURE__*/jsx("li", _objectSpread2(_objectSpread2({
|
|
891
900
|
ref: ref
|
|
892
901
|
}, liProps), {}, {
|
|
@@ -952,6 +961,7 @@ var TextToolbar = observer(function (_ref4) {
|
|
|
952
961
|
});
|
|
953
962
|
store.history.addUndoState();
|
|
954
963
|
};
|
|
964
|
+
var customFonts = store.customFonts || [];
|
|
955
965
|
return /*#__PURE__*/jsxs(Fragment, {
|
|
956
966
|
children: [/*#__PURE__*/jsx(Autocomplete, {
|
|
957
967
|
size: "small",
|
|
@@ -966,16 +976,27 @@ var TextToolbar = observer(function (_ref4) {
|
|
|
966
976
|
}
|
|
967
977
|
},
|
|
968
978
|
options: function () {
|
|
969
|
-
var
|
|
979
|
+
var customFontNames = customFonts.map(function (f) {
|
|
980
|
+
return f.name;
|
|
981
|
+
});
|
|
982
|
+
var fonts = [].concat(_toConsumableArray(DEFAULT_FONTS.filter(function (f) {
|
|
983
|
+
return !customFontNames.includes(f);
|
|
984
|
+
})), _toConsumableArray(customFontNames));
|
|
970
985
|
if (element.fontFamily && !fonts.includes(element.fontFamily)) {
|
|
971
986
|
fonts.unshift(element.fontFamily);
|
|
972
987
|
}
|
|
973
988
|
return fonts;
|
|
974
989
|
}(),
|
|
990
|
+
groupBy: customFonts.length > 0 ? function (option) {
|
|
991
|
+
return customFonts.some(function (f) {
|
|
992
|
+
return f.name === option;
|
|
993
|
+
}) ? 'Custom Fonts' : 'Google Fonts';
|
|
994
|
+
} : undefined,
|
|
975
995
|
disableClearable: true,
|
|
976
996
|
renderOption: function renderOption(props, option) {
|
|
977
997
|
return /*#__PURE__*/jsx(FontPreviewOption, _objectSpread2({
|
|
978
|
-
fontFamily: option
|
|
998
|
+
fontFamily: option,
|
|
999
|
+
store: store
|
|
979
1000
|
}, props), option);
|
|
980
1001
|
},
|
|
981
1002
|
renderInput: function renderInput(params) {
|