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
|
@@ -844,7 +844,7 @@ var TextEffectsPanel = mobxReactLite.observer(function (_ref2) {
|
|
|
844
844
|
});
|
|
845
845
|
TextEffectsPanel.displayName = 'TextEffectsPanel';
|
|
846
846
|
|
|
847
|
-
var _excluded = ["fontFamily"];
|
|
847
|
+
var _excluded = ["fontFamily", "store"];
|
|
848
848
|
var _positionMenuItemSx = {
|
|
849
849
|
textTransform: 'none',
|
|
850
850
|
fontSize: 12,
|
|
@@ -871,6 +871,7 @@ function loadFontPreview(fontFamily) {
|
|
|
871
871
|
}
|
|
872
872
|
var FontPreviewOption = /*#__PURE__*/React.memo(function FontPreviewOption(_ref) {
|
|
873
873
|
var fontFamily = _ref.fontFamily,
|
|
874
|
+
store = _ref.store,
|
|
874
875
|
liProps = _objectWithoutProperties(_ref, _excluded);
|
|
875
876
|
var ref = React.useRef(null);
|
|
876
877
|
React.useEffect(function () {
|
|
@@ -880,7 +881,15 @@ var FontPreviewOption = /*#__PURE__*/React.memo(function FontPreviewOption(_ref)
|
|
|
880
881
|
var _ref3 = _slicedToArray(_ref2, 1),
|
|
881
882
|
entry = _ref3[0];
|
|
882
883
|
if (entry.isIntersecting) {
|
|
883
|
-
|
|
884
|
+
var _store$customFonts;
|
|
885
|
+
var isCustom = store === null || store === void 0 || (_store$customFonts = store.customFonts) === null || _store$customFonts === void 0 ? void 0 : _store$customFonts.some(function (f) {
|
|
886
|
+
return f.name === fontFamily;
|
|
887
|
+
});
|
|
888
|
+
if (isCustom) {
|
|
889
|
+
store.loadFont(fontFamily);
|
|
890
|
+
} else {
|
|
891
|
+
loadFontPreview(fontFamily);
|
|
892
|
+
}
|
|
884
893
|
io.disconnect();
|
|
885
894
|
}
|
|
886
895
|
}, {
|
|
@@ -890,7 +899,7 @@ var FontPreviewOption = /*#__PURE__*/React.memo(function FontPreviewOption(_ref)
|
|
|
890
899
|
return function () {
|
|
891
900
|
return io.disconnect();
|
|
892
901
|
};
|
|
893
|
-
}, [fontFamily]);
|
|
902
|
+
}, [fontFamily, store]);
|
|
894
903
|
return /*#__PURE__*/jsxRuntime.jsx("li", _objectSpread2(_objectSpread2({
|
|
895
904
|
ref: ref
|
|
896
905
|
}, liProps), {}, {
|
|
@@ -956,6 +965,7 @@ var TextToolbar = mobxReactLite.observer(function (_ref4) {
|
|
|
956
965
|
});
|
|
957
966
|
store.history.addUndoState();
|
|
958
967
|
};
|
|
968
|
+
var customFonts = store.customFonts || [];
|
|
959
969
|
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
960
970
|
children: [/*#__PURE__*/jsxRuntime.jsx(material.Autocomplete, {
|
|
961
971
|
size: "small",
|
|
@@ -970,16 +980,27 @@ var TextToolbar = mobxReactLite.observer(function (_ref4) {
|
|
|
970
980
|
}
|
|
971
981
|
},
|
|
972
982
|
options: function () {
|
|
973
|
-
var
|
|
983
|
+
var customFontNames = customFonts.map(function (f) {
|
|
984
|
+
return f.name;
|
|
985
|
+
});
|
|
986
|
+
var fonts = [].concat(_toConsumableArray(DEFAULT_FONTS.filter(function (f) {
|
|
987
|
+
return !customFontNames.includes(f);
|
|
988
|
+
})), _toConsumableArray(customFontNames));
|
|
974
989
|
if (element.fontFamily && !fonts.includes(element.fontFamily)) {
|
|
975
990
|
fonts.unshift(element.fontFamily);
|
|
976
991
|
}
|
|
977
992
|
return fonts;
|
|
978
993
|
}(),
|
|
994
|
+
groupBy: customFonts.length > 0 ? function (option) {
|
|
995
|
+
return customFonts.some(function (f) {
|
|
996
|
+
return f.name === option;
|
|
997
|
+
}) ? 'Custom Fonts' : 'Google Fonts';
|
|
998
|
+
} : undefined,
|
|
979
999
|
disableClearable: true,
|
|
980
1000
|
renderOption: function renderOption(props, option) {
|
|
981
1001
|
return /*#__PURE__*/jsxRuntime.jsx(FontPreviewOption, _objectSpread2({
|
|
982
|
-
fontFamily: option
|
|
1002
|
+
fontFamily: option,
|
|
1003
|
+
store: store
|
|
983
1004
|
}, props), option);
|
|
984
1005
|
},
|
|
985
1006
|
renderInput: function renderInput(params) {
|