@scaleflex/widget-pixaforge 0.0.1
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 +7423 -0
- package/LICENSE +21 -0
- package/README.md +124 -0
- package/dist/style.css +260 -0
- package/dist/style.min.css +1 -0
- package/lib/api.service.js +93 -0
- package/lib/common.slice.js +77 -0
- package/lib/components/CategoriesCards/CategoryCard.js +33 -0
- package/lib/components/CategoriesCards/index.js +48 -0
- package/lib/components/CategoriesCards/index.scss +27 -0
- package/lib/components/CustomizeIcons/ColorCustomization.js +159 -0
- package/lib/components/CustomizeIcons/index.js +105 -0
- package/lib/components/CustomizeIcons/index.scss +33 -0
- package/lib/components/GalleryViewsOptionsMenu.js +97 -0
- package/lib/components/IconsGallery/SingleIcon.js +49 -0
- package/lib/components/IconsGallery/index.js +153 -0
- package/lib/components/IconsGallery/index.scss +53 -0
- package/lib/components/ImagesGallery/ImageCell.js +59 -0
- package/lib/components/ImagesGallery/LandscapesContainer.js +28 -0
- package/lib/components/ImagesGallery/PortraitsColumns.js +72 -0
- package/lib/components/ImagesGallery/index.js +183 -0
- package/lib/components/ImagesGallery/index.scss +120 -0
- package/lib/components/MainView.js +102 -0
- package/lib/components/TagsAndFoundLabel/TagItem.js +23 -0
- package/lib/components/TagsAndFoundLabel/index.js +72 -0
- package/lib/components/TagsAndFoundLabel/index.scss +25 -0
- package/lib/components/TopBar.js +113 -0
- package/lib/components/index.scss +48 -0
- package/lib/constants.js +19 -0
- package/lib/defaultLocale.js +22 -0
- package/lib/index.js +327 -0
- package/lib/style.scss +8 -0
- package/package.json +35 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
2
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
4
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
5
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
6
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
7
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
8
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
9
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
10
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
11
|
+
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
12
|
+
import { Button } from '@scaleflex/widget-common';
|
|
13
|
+
import TagItem from './TagItem';
|
|
14
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
15
|
+
var DEFAULT_SHOWN_TAGS_COUNT = 10;
|
|
16
|
+
var TagsAndFoundLabel = function TagsAndFoundLabel(_ref) {
|
|
17
|
+
var foundLabelCount = _ref.foundLabelCount,
|
|
18
|
+
tags = _ref.tags,
|
|
19
|
+
onChange = _ref.onChange,
|
|
20
|
+
i18n = _ref.i18n;
|
|
21
|
+
var _useState = useState(),
|
|
22
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
23
|
+
currentTags = _useState2[0],
|
|
24
|
+
setCurrentTags = _useState2[1];
|
|
25
|
+
var _useState3 = useState(false),
|
|
26
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
27
|
+
shouldShowMore = _useState4[0],
|
|
28
|
+
setShouldShowMore = _useState4[1];
|
|
29
|
+
var tagsToRender = useMemo(function () {
|
|
30
|
+
return shouldShowMore ? tags : tags.slice(0, DEFAULT_SHOWN_TAGS_COUNT);
|
|
31
|
+
}, [tags, shouldShowMore]);
|
|
32
|
+
var toggleTagChosing = useCallback(function (clickedTag, isSelected) {
|
|
33
|
+
setCurrentTags(function () {
|
|
34
|
+
var latestTags = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
35
|
+
return isSelected ? latestTags.filter(function (t) {
|
|
36
|
+
return t !== clickedTag;
|
|
37
|
+
}) : [].concat(_toConsumableArray(latestTags), [clickedTag]);
|
|
38
|
+
});
|
|
39
|
+
}, []);
|
|
40
|
+
var toggleShowMore = useCallback(function () {
|
|
41
|
+
setShouldShowMore(function (latestShowMoreVal) {
|
|
42
|
+
return !latestShowMoreVal;
|
|
43
|
+
});
|
|
44
|
+
}, []);
|
|
45
|
+
useEffect(function () {
|
|
46
|
+
if (currentTags) {
|
|
47
|
+
onChange(currentTags);
|
|
48
|
+
}
|
|
49
|
+
}, [currentTags]);
|
|
50
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
51
|
+
className: "filerobot-Pixaforge-TagsAndFoundLabel",
|
|
52
|
+
children: [(foundLabelCount || foundLabelCount === 0) && /*#__PURE__*/_jsxs("div", {
|
|
53
|
+
className: "filerobot-common-secondaryTxt filerobot-Pixaforge-TagsAndFoundLabel-foundLabel",
|
|
54
|
+
children: [i18n('pixaforgeFoundText'), ": ", foundLabelCount]
|
|
55
|
+
}), tagsToRender.length > 0 && /*#__PURE__*/_jsx("div", {
|
|
56
|
+
className: "filerobot-Pixaforge-TagsAndFoundLabel-tags",
|
|
57
|
+
children: tagsToRender.map(function (tag) {
|
|
58
|
+
return /*#__PURE__*/_jsx(TagItem, {
|
|
59
|
+
name: tag,
|
|
60
|
+
onClick: toggleTagChosing,
|
|
61
|
+
currentTags: currentTags
|
|
62
|
+
}, tag);
|
|
63
|
+
})
|
|
64
|
+
}), tags.length > DEFAULT_SHOWN_TAGS_COUNT && /*#__PURE__*/_jsx(Button, {
|
|
65
|
+
onClick: toggleShowMore,
|
|
66
|
+
classes: "filerobot-Pixaforge-TagsAndFoundLabel-showMoreLabel",
|
|
67
|
+
size: "small",
|
|
68
|
+
children: i18n(shouldShowMore ? 'pixaforgeShowLessButton' : 'pixaforgeShowMoreButton')
|
|
69
|
+
})]
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
export default TagsAndFoundLabel;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// packages/@scaleflex/widget-pixaforge/src/components/TagsAndFoundLabel/index.jsx
|
|
2
|
+
.filerobot-Pixaforge-TagsAndFoundLabel {
|
|
3
|
+
margin: 12px 12px 4px;
|
|
4
|
+
}
|
|
5
|
+
.filerobot-Pixaforge-TagsAndFoundLabel-foundLabel {
|
|
6
|
+
display: inline-block;
|
|
7
|
+
}
|
|
8
|
+
.filerobot-Pixaforge-TagsAndFoundLabel-tags {
|
|
9
|
+
margin-left: 6px;
|
|
10
|
+
margin-right: 4px;
|
|
11
|
+
display: inline;
|
|
12
|
+
}
|
|
13
|
+
.filerobot-Pixaforge-TagItem {
|
|
14
|
+
margin: 2px;
|
|
15
|
+
cursor: pointer;
|
|
16
|
+
|
|
17
|
+
span {
|
|
18
|
+
border: 1px solid $link-active !important;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
.filerobot-Pixaforge-TagsAndFoundLabel-showMoreLabel {
|
|
22
|
+
display: inline-flex;
|
|
23
|
+
margin-left: 8px;
|
|
24
|
+
margin-top: 2px;
|
|
25
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
8
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
9
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
10
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
11
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
12
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
13
|
+
import { useCallback, useRef, useState, useEffect } from 'react';
|
|
14
|
+
import SearchGroup from '@scaleflex/widget-common/lib/SearchGroup';
|
|
15
|
+
import { Select, MenuItem } from '@scaleflex/ui/core';
|
|
16
|
+
import { GALLERIES, GALLERIES_ICONS } from '../constants';
|
|
17
|
+
import { useDispatch } from 'react-redux';
|
|
18
|
+
import { usePlugin } from '@scaleflex/widget-core/lib/hooks';
|
|
19
|
+
import { PLUGINS_IDS } from '@scaleflex/widget-utils/lib/constants';
|
|
20
|
+
import { pixaforgeCommonStateUpdated } from '../common.slice';
|
|
21
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
22
|
+
var availableGallerieis = Object.values(GALLERIES);
|
|
23
|
+
var TopBar = function TopBar(_ref) {
|
|
24
|
+
var _usePlugin;
|
|
25
|
+
var i18n = _ref.i18n,
|
|
26
|
+
submitSearch = _ref.submitSearch,
|
|
27
|
+
currentGallery = _ref.currentGallery,
|
|
28
|
+
isPluginLoading = _ref.isPluginLoading,
|
|
29
|
+
clearSelection = _ref.clearSelection;
|
|
30
|
+
var dispatch = useDispatch();
|
|
31
|
+
var _useState = useState(false),
|
|
32
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
33
|
+
isSearchExpanded = _useState2[0],
|
|
34
|
+
setIsSearchExpanded = _useState2[1];
|
|
35
|
+
var _useState3 = useState(false),
|
|
36
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
37
|
+
searchInputFocused = _useState4[0],
|
|
38
|
+
setSearchInputFocused = _useState4[1];
|
|
39
|
+
var lastSearchValueRef = useRef('');
|
|
40
|
+
var searchInputRef = useRef();
|
|
41
|
+
var _usePlugin$opts = (_usePlugin = usePlugin(PLUGINS_IDS.PIXAFORGE)) === null || _usePlugin === void 0 ? void 0 : _usePlugin.opts,
|
|
42
|
+
noIconsGallery = _usePlugin$opts.noIconsGallery;
|
|
43
|
+
var toggleSearchExpand = useCallback(function () {
|
|
44
|
+
var isExpand = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
45
|
+
setIsSearchExpanded(isExpand);
|
|
46
|
+
}, []);
|
|
47
|
+
var setGallery = useCallback(function (galleryValue) {
|
|
48
|
+
dispatch(pixaforgeCommonStateUpdated({
|
|
49
|
+
gallery: galleryValue,
|
|
50
|
+
currentSelection: [],
|
|
51
|
+
customizedIcons: []
|
|
52
|
+
}));
|
|
53
|
+
}, []);
|
|
54
|
+
var getGalleryIcon = useCallback(function (gallery) {
|
|
55
|
+
var IconComponent = GALLERIES_ICONS[gallery];
|
|
56
|
+
return /*#__PURE__*/_jsx(IconComponent, {
|
|
57
|
+
className: "filerobot-Pixaforge-Topbar-galleryIcon"
|
|
58
|
+
});
|
|
59
|
+
}, []);
|
|
60
|
+
var clearSearch = function clearSearch() {
|
|
61
|
+
submitSearch(null);
|
|
62
|
+
};
|
|
63
|
+
useEffect(function () {
|
|
64
|
+
setGallery(GALLERIES.IMAGES);
|
|
65
|
+
}, [noIconsGallery]);
|
|
66
|
+
var searchProps = {
|
|
67
|
+
i18n: i18n,
|
|
68
|
+
sendSearch: submitSearch,
|
|
69
|
+
clearSelection: clearSelection,
|
|
70
|
+
clearSearch: clearSearch,
|
|
71
|
+
loading: isPluginLoading,
|
|
72
|
+
toggleSearchExpand: toggleSearchExpand,
|
|
73
|
+
searchExpanded: isSearchExpanded,
|
|
74
|
+
lastSearchValueRef: lastSearchValueRef,
|
|
75
|
+
searchInputRef: searchInputRef,
|
|
76
|
+
searchInputFocused: searchInputFocused,
|
|
77
|
+
setSearchInputFocused: setSearchInputFocused,
|
|
78
|
+
onInputFocus: function onInputFocus() {
|
|
79
|
+
return setSearchInputFocused(true);
|
|
80
|
+
},
|
|
81
|
+
onInputBlur: function onInputBlur() {
|
|
82
|
+
return setSearchInputFocused(false);
|
|
83
|
+
},
|
|
84
|
+
isPixaforge: true
|
|
85
|
+
};
|
|
86
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
87
|
+
className: "filerobot-Pixaforge-TopBar",
|
|
88
|
+
children: [/*#__PURE__*/_jsx(Select, {
|
|
89
|
+
value: currentGallery,
|
|
90
|
+
className: "filerobot-Pixaforge-TopBar-gallerySelect",
|
|
91
|
+
onChange: setGallery,
|
|
92
|
+
disabled: noIconsGallery,
|
|
93
|
+
children: availableGallerieis.map(function (gallery) {
|
|
94
|
+
if (noIconsGallery && gallery === GALLERIES.ICONS) {
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
97
|
+
var galleryLabel = (gallery === null || gallery === void 0 ? void 0 : gallery.charAt(0).toUpperCase()) + (gallery === null || gallery === void 0 ? void 0 : gallery.slice(1).toLowerCase());
|
|
98
|
+
return /*#__PURE__*/_jsx(MenuItem, {
|
|
99
|
+
active: false,
|
|
100
|
+
size: "sm",
|
|
101
|
+
value: gallery,
|
|
102
|
+
children: /*#__PURE__*/_jsxs("div", {
|
|
103
|
+
className: "filerobot-Pixaforge-TopBar-galleryOption",
|
|
104
|
+
children: [getGalleryIcon(gallery), galleryLabel]
|
|
105
|
+
})
|
|
106
|
+
}, gallery);
|
|
107
|
+
})
|
|
108
|
+
}), /*#__PURE__*/_jsx(SearchGroup, _objectSpread({
|
|
109
|
+
fullWidth: true
|
|
110
|
+
}, searchProps))]
|
|
111
|
+
});
|
|
112
|
+
};
|
|
113
|
+
export default TopBar;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// packages/@scaleflex/widget-pixaforge/src/components/MainView.jsx
|
|
2
|
+
.filerobot-Pixaforge-MainView {
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
height: 100%;
|
|
6
|
+
|
|
7
|
+
img {
|
|
8
|
+
user-select: none;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
.filerobot-Pixaforge-TopBar {
|
|
12
|
+
display: flex;
|
|
13
|
+
align-items: center;
|
|
14
|
+
padding: 12px;
|
|
15
|
+
background: $background-primary;
|
|
16
|
+
border-bottom: 1px solid $gray-200;
|
|
17
|
+
|
|
18
|
+
> div:nth-child(2) {
|
|
19
|
+
min-width: calc(100% - 128px)
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
.filerobot-Pixaforge-TopBar-gallerySelect {
|
|
23
|
+
max-width: 128px;
|
|
24
|
+
margin-right: 8px;
|
|
25
|
+
}
|
|
26
|
+
.filerobot-Pixaforge-TopBar-galleryOption {
|
|
27
|
+
display: flex;
|
|
28
|
+
}
|
|
29
|
+
.filerobot-Pixaforge-Topbar-galleryIcon {
|
|
30
|
+
width: 16px;
|
|
31
|
+
height: 16px;
|
|
32
|
+
margin-right: 8px;
|
|
33
|
+
color: $active;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.filerobot-Pixaforge-overlay {
|
|
37
|
+
position: absolute;
|
|
38
|
+
top: 4px;
|
|
39
|
+
bottom: 4px;
|
|
40
|
+
left: 4px;
|
|
41
|
+
right: 4px;
|
|
42
|
+
display: none;
|
|
43
|
+
z-index: $zIndex-0;
|
|
44
|
+
|
|
45
|
+
* {
|
|
46
|
+
color: $white;
|
|
47
|
+
}
|
|
48
|
+
}
|
package/lib/constants.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
3
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
4
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
5
|
+
import { Image, InfoOutline } from '@scaleflex/icons';
|
|
6
|
+
export var IMAGES_GALLERY = 'images';
|
|
7
|
+
export var ICONS_GALLERY = 'icons';
|
|
8
|
+
export var DEFAULT_ICONS_COLOR = '#5D6D7E';
|
|
9
|
+
export var GALLERIES = {
|
|
10
|
+
IMAGES: IMAGES_GALLERY,
|
|
11
|
+
ICONS: ICONS_GALLERY
|
|
12
|
+
};
|
|
13
|
+
export var GALLERIES_ICONS = _defineProperty(_defineProperty({}, IMAGES_GALLERY, Image), ICONS_GALLERY, InfoOutline);
|
|
14
|
+
export var IMAGES_GALLERY_VIEWS = {
|
|
15
|
+
STANDARD_PORTRAITS: 'standardPortraitsGallery',
|
|
16
|
+
SMALL_PORTRAITS: 'smallPortraitsGallery',
|
|
17
|
+
STANDARD_LANDSCAPES: 'standardLandscapesGallery'
|
|
18
|
+
};
|
|
19
|
+
export var IMAGES_COLUMNS_WIDTH = _defineProperty(_defineProperty({}, IMAGES_GALLERY_VIEWS.STANDARD_PORTRAITS, 220), IMAGES_GALLERY_VIEWS.SMALL_PORTRAITS, 130);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
pixaforgeTitle: 'Pixaforge',
|
|
3
|
+
pixaforgeFoundText: 'Found',
|
|
4
|
+
pixaforgeShowMoreButton: 'Show more',
|
|
5
|
+
pixaforgeShowLessButton: 'Show less',
|
|
6
|
+
pixaforgeNoImagesFoundText: 'No images found.',
|
|
7
|
+
pixaforgeNoIconsFoundText: 'No icons found.',
|
|
8
|
+
pixaforgeStandardPortraitsTitle: 'Standard portraits',
|
|
9
|
+
pixaforgeSmallPortraitsTitle: 'Small portraits',
|
|
10
|
+
pixaforgeStandardLandscapesTitle: 'Standard landscapes',
|
|
11
|
+
pixaforgeFailedToLoadIconError: 'Failed to load icon',
|
|
12
|
+
pixaforgeIconSelectError: 'Not possible to select an icon that has not loaded',
|
|
13
|
+
pixaforgeFailedToFetchMessage: 'Failed to fetch the image from pixaforge',
|
|
14
|
+
pixaforgeCustomizedIconsLabel: {
|
|
15
|
+
0: 'Customize your icon',
|
|
16
|
+
1: 'Customize your icons'
|
|
17
|
+
},
|
|
18
|
+
pixaforgeCustomizedIconsTitle: 'Change the color of each icon here to be uploaded with that chosen color in next step',
|
|
19
|
+
pixaforgeImagesMenuItem: 'images',
|
|
20
|
+
pixaforgeIconsMenuItem: 'icons',
|
|
21
|
+
pixaforgeBackToCategories: 'Back to categories'
|
|
22
|
+
};
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
5
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
6
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
7
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
8
|
+
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
9
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
10
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
11
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
12
|
+
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
13
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
14
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
15
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
16
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
17
|
+
import { Plugin } from '@scaleflex/widget-core';
|
|
18
|
+
import Explorer from '@scaleflex/widget-explorer';
|
|
19
|
+
import Translator from '@scaleflex/widget-utils/lib/Translator';
|
|
20
|
+
import { BadgeButton, CloseButton } from '@scaleflex/widget-common';
|
|
21
|
+
import { RequestClient } from '@scaleflex/widget-companion-client';
|
|
22
|
+
import { PixaforgeIcon } from '@scaleflex/widget-icons';
|
|
23
|
+
import { PLUGINS_IDS } from '@scaleflex/widget-utils/lib/constants';
|
|
24
|
+
import defaultLocale from './defaultLocale';
|
|
25
|
+
import MainView from './components/MainView';
|
|
26
|
+
import GalleryViewsOptionsMenu from './components/GalleryViewsOptionsMenu';
|
|
27
|
+
import { GALLERIES } from './constants';
|
|
28
|
+
import pixaforgeReducer, { loadingToggled, pixaforgeCommonStateUpdated, selectGallery } from './common.slice';
|
|
29
|
+
// TODO: find a way to show version of the current plugin
|
|
30
|
+
// why solution below isn't good?
|
|
31
|
+
// first import doesn't work with webpack 5 as it was deprecated
|
|
32
|
+
// second import fixes webpack 5 issue as it was mentioned in their docs
|
|
33
|
+
// but it exposes our package.json to the client and it is mentioned as security rist in mutiple places
|
|
34
|
+
// https://github.com/axelpale/genversion
|
|
35
|
+
// https://stackoverflow.com/questions/64993118/error-should-not-import-the-named-export-version-imported-as-version
|
|
36
|
+
// https://stackoverflow.com/questions/9153571/is-there-a-way-to-get-version-from-package-json-in-nodejs-code/10855054#10855054
|
|
37
|
+
// import { version } from '../package.json'
|
|
38
|
+
// import packageInfo from '../package.json'
|
|
39
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
40
|
+
var Pixaforge = /*#__PURE__*/function (_Plugin) {
|
|
41
|
+
// static VERSION = packageInfo.version
|
|
42
|
+
|
|
43
|
+
function Pixaforge(filerobot) {
|
|
44
|
+
var _this;
|
|
45
|
+
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
46
|
+
_classCallCheck(this, Pixaforge);
|
|
47
|
+
_this = _callSuper(this, Pixaforge, [filerobot, opts]);
|
|
48
|
+
_defineProperty(_this, "i18nInit", function () {
|
|
49
|
+
_this.translator = new Translator([_this.defaultLocale, _this.filerobot.locale, _this.opts.locale]);
|
|
50
|
+
_this.i18n = _this.translator.translate.bind(_this.translator);
|
|
51
|
+
_this.i18nArray = _this.translator.translateArray.bind(_this.translator);
|
|
52
|
+
});
|
|
53
|
+
_defineProperty(_this, "getFileNameFromUrl", function (_ref) {
|
|
54
|
+
var url = _ref.url,
|
|
55
|
+
type = _ref.type;
|
|
56
|
+
return url.substring(url.lastIndexOf('/') + 1) + ".".concat(type.substring(type.lastIndexOf('/') + 1));
|
|
57
|
+
});
|
|
58
|
+
_defineProperty(_this, "getMeta", function (url) {
|
|
59
|
+
return _this.client.post('url/meta', {
|
|
60
|
+
url: url
|
|
61
|
+
}).then(function (res) {
|
|
62
|
+
if (res.error) {
|
|
63
|
+
_this.filerobot.log('[Pixaforge] Error:');
|
|
64
|
+
_this.filerobot.log(res.error);
|
|
65
|
+
throw new Error('Failed to fetch the file');
|
|
66
|
+
}
|
|
67
|
+
return res;
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
_defineProperty(_this, "addImage", function () {
|
|
71
|
+
var image = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
72
|
+
var url = image.src;
|
|
73
|
+
if (!url) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
return _this.getMeta(url).then(function (meta) {
|
|
77
|
+
var tagFile = {
|
|
78
|
+
source: _this.id,
|
|
79
|
+
name: _this.getFileNameFromUrl({
|
|
80
|
+
url: url,
|
|
81
|
+
type: meta.type
|
|
82
|
+
}),
|
|
83
|
+
type: meta.type,
|
|
84
|
+
preview: image.preview,
|
|
85
|
+
data: {
|
|
86
|
+
size: meta.size
|
|
87
|
+
},
|
|
88
|
+
isRemote: true,
|
|
89
|
+
body: {
|
|
90
|
+
url: url
|
|
91
|
+
},
|
|
92
|
+
remote: {
|
|
93
|
+
companionUrl: _this.client.companionUrl,
|
|
94
|
+
url: "".concat(_this.hostname, "/url/get"),
|
|
95
|
+
body: {
|
|
96
|
+
fileId: image.id,
|
|
97
|
+
url: url
|
|
98
|
+
},
|
|
99
|
+
providerOptions: _this.client.opts
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
return tagFile;
|
|
103
|
+
}).then(function (tagFile) {
|
|
104
|
+
_this.filerobot.log('[Pixaforge] Adding remote file');
|
|
105
|
+
try {
|
|
106
|
+
_this.filerobot.addFile(tagFile);
|
|
107
|
+
} catch (err) {
|
|
108
|
+
if (!err.isRestriction) {
|
|
109
|
+
_this.filerobot.log(err);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
})["catch"](function (err) {
|
|
113
|
+
_this.filerobot.log(err);
|
|
114
|
+
_this.filerobot.info({
|
|
115
|
+
message: _this.i18n('pixaforgeFailedToFetchMessage'),
|
|
116
|
+
details: (err === null || err === void 0 ? void 0 : err.message) || (err === null || err === void 0 ? void 0 : err.toString()) || err
|
|
117
|
+
}, 'error', 5000);
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
_defineProperty(_this, "toggleLoader", function () {
|
|
121
|
+
_this.dispatch(loadingToggled());
|
|
122
|
+
});
|
|
123
|
+
_defineProperty(_this, "addImages", function () {
|
|
124
|
+
var images = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
125
|
+
var imagesLength = images.length;
|
|
126
|
+
if (imagesLength === 0) {
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
_this.toggleLoader();
|
|
130
|
+
Promise.all(images.map(_this.addImage))["finally"](_this.toggleLoader);
|
|
131
|
+
});
|
|
132
|
+
_defineProperty(_this, "getIconFileDescriptorToBeAdded", function () {
|
|
133
|
+
var _ref2, _ref3, _icon$name;
|
|
134
|
+
var icon = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
135
|
+
var currentDate = Date.now();
|
|
136
|
+
var iconStringReplacedWithFinalColor = (icon.svgStringified || '').replace('color="currentColor"', "color=\"".concat(icon.color, "\""));
|
|
137
|
+
if (!iconStringReplacedWithFinalColor) {
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
var iconName = (_ref2 = (_ref3 = (_icon$name = icon.name) !== null && _icon$name !== void 0 ? _icon$name : icon.alt) !== null && _ref3 !== void 0 ? _ref3 : icon.uid) !== null && _ref2 !== void 0 ? _ref2 : currentDate;
|
|
141
|
+
var iconFileProperties = {
|
|
142
|
+
type: 'image/svg+xml',
|
|
143
|
+
lastModified: currentDate
|
|
144
|
+
};
|
|
145
|
+
var iconFile = new File([iconStringReplacedWithFinalColor], iconName, iconFileProperties);
|
|
146
|
+
var previewUrl = URL.createObjectURL(iconFile);
|
|
147
|
+
var fileDescriptor = {
|
|
148
|
+
source: _this.id,
|
|
149
|
+
name: iconFile.name,
|
|
150
|
+
type: iconFile.type,
|
|
151
|
+
data: iconFile,
|
|
152
|
+
preview: previewUrl
|
|
153
|
+
};
|
|
154
|
+
setTimeout(function () {
|
|
155
|
+
URL.revokeObjectURL(previewUrl);
|
|
156
|
+
}, 3000);
|
|
157
|
+
return fileDescriptor;
|
|
158
|
+
});
|
|
159
|
+
_defineProperty(_this, "addIcons", function () {
|
|
160
|
+
var icons = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
161
|
+
var iconsLength = icons.length;
|
|
162
|
+
if (iconsLength === 0) {
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
_this.toggleLoader();
|
|
166
|
+
var iconsFilesDescriptors = icons.map(_this.getIconFileDescriptorToBeAdded);
|
|
167
|
+
try {
|
|
168
|
+
_this.filerobot.addFiles(iconsFilesDescriptors);
|
|
169
|
+
} catch (err) {
|
|
170
|
+
_this.filerobot.log(err);
|
|
171
|
+
}
|
|
172
|
+
_this.toggleLoader();
|
|
173
|
+
});
|
|
174
|
+
_defineProperty(_this, "sendSelectedMediaToUpload", function () {
|
|
175
|
+
var _this$getPluginCommon = _this.getPluginCommonState(),
|
|
176
|
+
_this$getPluginCommon2 = _this$getPluginCommon.currentSelection,
|
|
177
|
+
currentSelection = _this$getPluginCommon2 === void 0 ? [] : _this$getPluginCommon2,
|
|
178
|
+
_this$getPluginCommon3 = _this$getPluginCommon.customizedIcons,
|
|
179
|
+
customizedIcons = _this$getPluginCommon3 === void 0 ? [] : _this$getPluginCommon3;
|
|
180
|
+
if (customizedIcons.length > 0) {
|
|
181
|
+
_this.addIcons(customizedIcons);
|
|
182
|
+
} else {
|
|
183
|
+
_this.addImages(currentSelection);
|
|
184
|
+
}
|
|
185
|
+
_this.setPluginCommonState({
|
|
186
|
+
currentSelection: [],
|
|
187
|
+
customizedIcons: []
|
|
188
|
+
});
|
|
189
|
+
});
|
|
190
|
+
_defineProperty(_this, "sendSelectedIconsToCustomize", function () {
|
|
191
|
+
var _this$getPluginCommon4 = _this.getPluginCommonState(),
|
|
192
|
+
_this$getPluginCommon5 = _this$getPluginCommon4.currentSelection,
|
|
193
|
+
currentSelection = _this$getPluginCommon5 === void 0 ? [] : _this$getPluginCommon5;
|
|
194
|
+
if (currentSelection.length > 0) {
|
|
195
|
+
_this.dispatch(pixaforgeCommonStateUpdated({
|
|
196
|
+
customizedIcons: currentSelection,
|
|
197
|
+
currentSelection: []
|
|
198
|
+
}));
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
_defineProperty(_this, "clearSelection", function () {
|
|
202
|
+
_this.dispatch(pixaforgeCommonStateUpdated({
|
|
203
|
+
currentSelection: [],
|
|
204
|
+
customizedIcons: [],
|
|
205
|
+
isAllSelected: false
|
|
206
|
+
}));
|
|
207
|
+
});
|
|
208
|
+
_defineProperty(_this, "listenToElementResize", function (elementSelectorOrRef, callback) {
|
|
209
|
+
_this.stopListeningToElementResize();
|
|
210
|
+
_this.resizeObserver = new ResizeObserver(function (entries) {
|
|
211
|
+
var filerobotPixaforgeInnerEl = entries[0];
|
|
212
|
+
var _filerobotPixaforgeIn = filerobotPixaforgeInnerEl.contentRect,
|
|
213
|
+
width = _filerobotPixaforgeIn.width,
|
|
214
|
+
height = _filerobotPixaforgeIn.height;
|
|
215
|
+
_this.filerobot.log("[Pixaforge] resized: ".concat(width, " / ").concat(height), 'debug');
|
|
216
|
+
if (typeof callback === 'function') {
|
|
217
|
+
callback(width, height);
|
|
218
|
+
}
|
|
219
|
+
});
|
|
220
|
+
_this.resizeObserver.observe(typeof elementSelectorOrRef === 'string' ? _this.el.querySelector(elementSelectorOrRef) : elementSelectorOrRef);
|
|
221
|
+
});
|
|
222
|
+
_defineProperty(_this, "stopListeningToElementResize", function () {
|
|
223
|
+
if (_this.resizeObserver) {
|
|
224
|
+
_this.resizeObserver.disconnect();
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
_defineProperty(_this, "renderPanelBarTopLeftComponent", function () {
|
|
228
|
+
var _this$getPluginCommon6 = _this.getPluginCommonState(),
|
|
229
|
+
_this$getPluginCommon7 = _this$getPluginCommon6.currentSelection,
|
|
230
|
+
currentSelection = _this$getPluginCommon7 === void 0 ? [] : _this$getPluginCommon7,
|
|
231
|
+
_this$getPluginCommon8 = _this$getPluginCommon6.customizedIcons,
|
|
232
|
+
customizedIcons = _this$getPluginCommon8 === void 0 ? [] : _this$getPluginCommon8,
|
|
233
|
+
gallery = _this$getPluginCommon6.gallery;
|
|
234
|
+
var selectionCount = currentSelection.length;
|
|
235
|
+
var customizedIconsCount = customizedIcons.length;
|
|
236
|
+
var isIconsGallery = gallery === GALLERIES.ICONS;
|
|
237
|
+
var hasCustomizedIcons = customizedIconsCount > 0;
|
|
238
|
+
var isInIconsSelectionStep = isIconsGallery && !hasCustomizedIcons;
|
|
239
|
+
var isDisabled = selectionCount === 0 && !hasCustomizedIcons;
|
|
240
|
+
var onClickHandler = isInIconsSelectionStep ? _this.sendSelectedIconsToCustomize : _this.sendSelectedMediaToUpload;
|
|
241
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
242
|
+
children: [/*#__PURE__*/_jsx(BadgeButton, {
|
|
243
|
+
onClick: isDisabled ? undefined : onClickHandler,
|
|
244
|
+
background: "accent",
|
|
245
|
+
disabled: isDisabled,
|
|
246
|
+
label: _this.filerobot.i18n(isInIconsSelectionStep ? 'mutualizedSelectLabel' : 'mutualizedImportLabel'),
|
|
247
|
+
badgeContent: selectionCount === 0 && customizedIconsCount === 0 ? undefined : customizedIconsCount || selectionCount
|
|
248
|
+
}), !isDisabled && /*#__PURE__*/_jsx(CloseButton, {
|
|
249
|
+
onClick: _this.clearSelection,
|
|
250
|
+
hideDivider: true
|
|
251
|
+
})]
|
|
252
|
+
});
|
|
253
|
+
});
|
|
254
|
+
_defineProperty(_this, "renderPanelBarTopRightComponent", function () {
|
|
255
|
+
if (selectGallery(_this.getGlobalState()) !== GALLERIES.IMAGES) {
|
|
256
|
+
return null;
|
|
257
|
+
}
|
|
258
|
+
return /*#__PURE__*/_jsx(GalleryViewsOptionsMenu, {
|
|
259
|
+
i18n: _this.i18n
|
|
260
|
+
});
|
|
261
|
+
});
|
|
262
|
+
_this.id = PLUGINS_IDS.PIXAFORGE;
|
|
263
|
+
_this.type = 'acquirer';
|
|
264
|
+
_this.icon = function () {
|
|
265
|
+
return /*#__PURE__*/_jsx(PixaforgeIcon, {});
|
|
266
|
+
};
|
|
267
|
+
_this.title = _this.opts.title || 'Free images & icons';
|
|
268
|
+
_this.render = _this.render.bind(_this);
|
|
269
|
+
_this.defaultLocale = {
|
|
270
|
+
strings: defaultLocale
|
|
271
|
+
};
|
|
272
|
+
var defaultOptions = {
|
|
273
|
+
noIconsGallery: false
|
|
274
|
+
};
|
|
275
|
+
_this.opts = _objectSpread(_objectSpread({}, defaultOptions), opts);
|
|
276
|
+
_this.i18nInit();
|
|
277
|
+
|
|
278
|
+
// !TODO: Check why this.i18n('pixaforgeTitle') doesn't render the proper title.
|
|
279
|
+
// this.title = this.opts.title || this.i18n('pixaforgeTitle')
|
|
280
|
+
|
|
281
|
+
_this.client = new RequestClient(filerobot, {
|
|
282
|
+
companionHeaders: _this.opts.companionHeaders
|
|
283
|
+
});
|
|
284
|
+
_this.hostname = _this.client.companionUrl;
|
|
285
|
+
if (!_this.hostname) {
|
|
286
|
+
throw new Error('Companion hostname is required');
|
|
287
|
+
}
|
|
288
|
+
return _this;
|
|
289
|
+
}
|
|
290
|
+
_inherits(Pixaforge, _Plugin);
|
|
291
|
+
return _createClass(Pixaforge, [{
|
|
292
|
+
key: "install",
|
|
293
|
+
value: function install() {
|
|
294
|
+
if (Explorer) {
|
|
295
|
+
this.mount(Explorer, this);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}, {
|
|
299
|
+
key: "uninstall",
|
|
300
|
+
value: function uninstall() {
|
|
301
|
+
this.unmount();
|
|
302
|
+
this.stopListeningToElementResize();
|
|
303
|
+
}
|
|
304
|
+
}, {
|
|
305
|
+
key: "setPluginCommonState",
|
|
306
|
+
value: function setPluginCommonState(update) {
|
|
307
|
+
return this.dispatch(pixaforgeCommonStateUpdated(update));
|
|
308
|
+
}
|
|
309
|
+
}, {
|
|
310
|
+
key: "getPluginReducer",
|
|
311
|
+
value: function getPluginReducer() {
|
|
312
|
+
return pixaforgeReducer;
|
|
313
|
+
}
|
|
314
|
+
}, {
|
|
315
|
+
key: "render",
|
|
316
|
+
value: function render() {
|
|
317
|
+
return /*#__PURE__*/_jsx(MainView, {
|
|
318
|
+
listenToElementResize: this.listenToElementResize,
|
|
319
|
+
stopListeningToElementResize: this.stopListeningToElementResize,
|
|
320
|
+
clearSelection: this.clearSelection,
|
|
321
|
+
i18n: this.i18n,
|
|
322
|
+
info: this.filerobot.info
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
}]);
|
|
326
|
+
}(Plugin);
|
|
327
|
+
export { Pixaforge as default };
|
package/lib/style.scss
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// THERE ARE OTHER IMPORTS IN THE END OF THE FILE DEPENDS ON THE OBRDER OF NEEDED STYLES
|
|
2
|
+
@import '@scaleflex/widget-core/lib/_variables.scss';
|
|
3
|
+
@import './components/index.scss';
|
|
4
|
+
@import './components/CategoriesCards/index.scss';
|
|
5
|
+
@import './components/TagsAndFoundLabel/index.scss';
|
|
6
|
+
@import './components/ImagesGallery/index.scss';
|
|
7
|
+
@import './components/IconsGallery/index.scss';
|
|
8
|
+
@import './components/CustomizeIcons/index.scss';
|