@arc-fusion/pb-editor-wrapper
Advanced tools
Comparing version 1.0.10 to 1.0.11
@@ -10,163 +10,7 @@ "use strict"; | ||
var _react = require("react"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } | ||
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."); } | ||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } | ||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } | ||
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } | ||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } | ||
var PlusIcon = function PlusIcon() { | ||
return /*#__PURE__*/React.createElement("svg", { | ||
"aria-hidden": "true", | ||
width: "10", | ||
height: "10", | ||
role: "img", | ||
xmlns: "http://www.w3.org/2000/svg", | ||
viewBox: "0 0 448 512" | ||
}, /*#__PURE__*/React.createElement("path", { | ||
fill: "#ffffff", | ||
d: "M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z" | ||
})); | ||
}; | ||
var EditIcon = function EditIcon() { | ||
return /*#__PURE__*/React.createElement("svg", { | ||
"aria-hidden": "true", | ||
width: "12", | ||
height: "12", | ||
role: "img", | ||
xmlns: "http://www.w3.org/2000/svg", | ||
viewBox: "0 0 512 512" | ||
}, /*#__PURE__*/React.createElement("path", { | ||
fill: "#ffffff", | ||
d: "M497.9 142.1l-46.1 46.1c-4.7 4.7-12.3 4.7-17 0l-111-111c-4.7-4.7-4.7-12.3 0-17l46.1-46.1c18.7-18.7 49.1-18.7 67.9 0l60.1 60.1c18.8 18.7 18.8 49.1 0 67.9zM284.2 99.8L21.6 362.4.4 483.9c-2.9 16.4 11.4 30.6 27.8 27.8l121.5-21.3 262.6-262.6c4.7-4.7 4.7-12.3 0-17l-111-111c-4.8-4.7-12.4-4.7-17.1 0zM124.1 339.9c-5.5-5.5-5.5-14.3 0-19.8l154-154c5.5-5.5 14.3-5.5 19.8 0s5.5 14.3 0 19.8l-154 154c-5.5 5.5-14.3 5.5-19.8 0zM88 424h48v36.3l-64.5 11.3-31.1-31.1L51.7 376H88v48z" | ||
})); | ||
}; | ||
var TrashIcon = function TrashIcon() { | ||
return /*#__PURE__*/React.createElement("svg", { | ||
"aria-hidden": "true", | ||
width: "12", | ||
height: "12", | ||
role: "img", | ||
xmlns: "http://www.w3.org/2000/svg", | ||
viewBox: "0 0 448 512" | ||
}, /*#__PURE__*/React.createElement("path", { | ||
fill: "#ffffff", | ||
d: "M0 84V56c0-13.3 10.7-24 24-24h112l9.4-18.7c4-8.2 12.3-13.3 21.4-13.3h114.3c9.1 0 17.4 5.1 21.5 13.3L312 32h112c13.3 0 24 10.7 24 24v28c0 6.6-5.4 12-12 12H12C5.4 96 0 90.6 0 84zm416 56v324c0 26.5-21.5 48-48 48H80c-26.5 0-48-21.5-48-48V140c0-6.6 5.4-12 12-12h360c6.6 0 12 5.4 12 12zm-272 68c0-8.8-7.2-16-16-16s-16 7.2-16 16v224c0 8.8 7.2 16 16 16s16-7.2 16-16V208zm96 0c0-8.8-7.2-16-16-16s-16 7.2-16 16v224c0 8.8 7.2 16 16 16s16-7.2 16-16V208zm96 0c0-8.8-7.2-16-16-16s-16 7.2-16 16v224c0 8.8 7.2 16 16 16s16-7.2 16-16V208z" | ||
})); | ||
}; | ||
var LocatorIcon = function LocatorIcon() { | ||
return /*#__PURE__*/React.createElement("svg", { | ||
"aria-hidden": "true", | ||
width: "13", | ||
height: "13", | ||
focusable: "false", | ||
"data-prefix": "fad", | ||
"data-icon": "line-columns", | ||
role: "img", | ||
xmlns: "http://www.w3.org/2000/svg", | ||
viewBox: "0 0 512 512" | ||
}, /*#__PURE__*/React.createElement("path", { | ||
fill: "#999999", | ||
d: "M496 288H304a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h192a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0 128H304a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h192a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0-256H304a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h192a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0-128H304a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h192a16 16 0 0 0 16-16V48a16 16 0 0 0-16-16z" | ||
}), /*#__PURE__*/React.createElement("path", { | ||
fill: "#ffffff", | ||
d: "M208 288H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h192a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0 128H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h192a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0-384H16A16 16 0 0 0 0 48v32a16 16 0 0 0 16 16h192a16 16 0 0 0 16-16V48a16 16 0 0 0-16-16zm0 128H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h192a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16z" | ||
})); | ||
}; | ||
var PluginIcon = function PluginIcon() { | ||
return /*#__PURE__*/React.createElement("svg", { | ||
"aria-hidden": "true", | ||
width: "12", | ||
height: "12", | ||
xmlns: "http://www.w3.org/2000/svg", | ||
viewBox: "0 0 384 512" | ||
}, /*#__PURE__*/React.createElement("path", { | ||
fill: "#ffffff", | ||
d: "M256 144V32c0-17.673 14.327-32 32-32s32 14.327 32 32v112h-64zm112 16H16c-8.837 0-16 7.163-16 16v32c0 8.837 7.163 16 16 16h16v32c0 77.406 54.969 141.971 128 156.796V512h64v-99.204c73.031-14.825 128-79.39 128-156.796v-32h16c8.837 0 16-7.163 16-16v-32c0-8.837-7.163-16-16-16zm-240-16V32c0-17.673-14.327-32-32-32S64 14.327 64 32v112h64z" | ||
})); | ||
}; | ||
var styles = { | ||
highlightedWrapper: { | ||
position: 'relative', | ||
zIndex: 2147483646, | ||
boxShadow: '2px -2px 0px #3760ff, -2px -2px 0px #3760ff, -2px 2px 0px #3760ff, 2px 2px 0px #3760ff', | ||
transition: 'all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1)' | ||
}, | ||
actions: { | ||
display: 'flex', | ||
justifyContent: 'center', | ||
backgroundColor: '#0e181b', | ||
color: '#ffffff', | ||
cursor: 'pointer', | ||
position: 'absolute', | ||
zIndex: 2147483646, | ||
top: 5, | ||
right: 5, | ||
padding: 5, | ||
width: 'initial', | ||
borderRadius: 5 | ||
}, | ||
actionIcon: { | ||
padding: 6 | ||
}, | ||
button: { | ||
fontFamily: 'OutputSans', | ||
fontSize: 13, | ||
zIndex: 2147483646, | ||
textAlign: 'center', | ||
backgroundColor: '#3760FF', | ||
color: '#FFFFFF', | ||
cursor: 'pointer', | ||
boxShadow: 'none', | ||
border: 'none' | ||
}, | ||
buttonTop: { | ||
position: 'absolute', | ||
top: '-20px', | ||
borderTopLeftRadius: 5, | ||
borderTopRightRadius: 5, | ||
width: 65, | ||
height: 20, | ||
right: 0, | ||
left: 0, | ||
marginLeft: 'auto', | ||
marginRight: 'auto' | ||
}, | ||
buttonBottom: { | ||
position: 'absolute', | ||
bottom: '-20px', | ||
borderBottomLeftRadius: 5, | ||
borderBottomRightRadius: 5, | ||
width: 65, | ||
height: 20, | ||
right: 0, | ||
left: 0, | ||
marginLeft: 'auto', | ||
marginRight: 'auto' | ||
}, | ||
buttonIcon: { | ||
width: 10, | ||
display: 'inline', | ||
margin: 0, | ||
padding: 0 | ||
wrapper: { | ||
display: 'contents' | ||
} | ||
@@ -180,60 +24,29 @@ }; | ||
children = _ref.children; | ||
var _useState = (0, _react.useState)(false), | ||
_useState2 = _slicedToArray(_useState, 2), | ||
isHovered = _useState2[0], | ||
setHover = _useState2[1]; | ||
var previewEvents = { | ||
onHover: new CustomEvent('onFeatureHover', { | ||
detail: { | ||
fingerprint: fingerprint | ||
} | ||
}), | ||
onHoverEnd: new CustomEvent('onFeatureHoverEnd', { | ||
detail: { | ||
fingerprint: fingerprint | ||
} | ||
}), | ||
onEdit: new CustomEvent('onFeatureEdit', { | ||
detail: { | ||
fingerprint: fingerprint | ||
} | ||
}), | ||
onAddTop: new CustomEvent('onFeatureAddTop', { | ||
detail: { | ||
fingerprint: fingerprint | ||
} | ||
}), | ||
onAddBottom: new CustomEvent('onFeatureAddBottom', { | ||
detail: { | ||
fingerprint: fingerprint | ||
} | ||
}), | ||
onDelete: new CustomEvent('onFeatureDelete', { | ||
detail: { | ||
fingerprint: fingerprint | ||
} | ||
}), | ||
onLocate: new CustomEvent('onFeatureLocate', { | ||
detail: { | ||
fingerprint: fingerprint | ||
} | ||
}), | ||
onPluginLoad: new CustomEvent('onFeaturePluginLoad', { | ||
detail: { | ||
fingerprint: fingerprint, | ||
plugins: plugins | ||
} | ||
}) | ||
generateHover: function generateHover(component) { | ||
return new CustomEvent('onFeatureHover', { | ||
detail: { | ||
fingerprint: fingerprint, | ||
component: component, | ||
plugins: plugins | ||
} | ||
}); | ||
}, | ||
generateHoverEnd: function generateHoverEnd(component) { | ||
return new CustomEvent('onFeatureHoverEnd', { | ||
detail: { | ||
fingerprint: fingerprint, | ||
component: component, | ||
plugins: plugins | ||
} | ||
}); | ||
} | ||
}; | ||
var onFeatureHover = function onFeatureHover() { | ||
window.dispatchEvent(previewEvents.onHover); | ||
setHover(true); | ||
var onFeatureHover = function onFeatureHover(component) { | ||
window.dispatchEvent(previewEvents.generateHover(component)); | ||
}; | ||
var onFeatureHoverEnd = function onFeatureHoverEnd() { | ||
window.dispatchEvent(previewEvents.onHoverEnd); | ||
setHover(false); | ||
var onFeatureHoverEnd = function onFeatureHoverEnd(component) { | ||
window.dispatchEvent(previewEvents.generateHoverEnd(component)); | ||
}; | ||
@@ -243,45 +56,10 @@ | ||
"data-fusion-component": fingerprint, | ||
"data-fusion-plugins": plugins | ||
"data-fusion-plugins": plugins, | ||
style: styles.wrapper | ||
}, children) : /*#__PURE__*/React.createElement("div", { | ||
style: isHovered ? styles.highlightedWrapper : {}, | ||
style: styles.wrapper, | ||
onMouseEnter: onFeatureHover, | ||
onMouseLeave: onFeatureHoverEnd, | ||
"data-fusion-component": fingerprint | ||
}, isHovered && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("button", { | ||
style: _objectSpread(_objectSpread({}, styles.button), styles.buttonTop), | ||
onClick: function onClick() { | ||
return window.dispatchEvent(previewEvents.onAddTop); | ||
} | ||
}, /*#__PURE__*/React.createElement("i", { | ||
style: styles.buttonIcon | ||
}, /*#__PURE__*/React.createElement(PlusIcon, null))), /*#__PURE__*/React.createElement("button", { | ||
style: _objectSpread(_objectSpread({}, styles.button), styles.buttonBottom), | ||
onClick: function onClick() { | ||
return window.dispatchEvent(previewEvents.onAddBottom); | ||
} | ||
}, /*#__PURE__*/React.createElement("i", { | ||
style: styles.buttonIcon | ||
}, /*#__PURE__*/React.createElement(PlusIcon, null))), /*#__PURE__*/React.createElement("div", { | ||
style: styles.actions | ||
}, plugins && /*#__PURE__*/React.createElement("i", { | ||
style: styles.actionIcon, | ||
onClick: function onClick() { | ||
return window.dispatchEvent(previewEvents.onPluginLoad); | ||
} | ||
}, /*#__PURE__*/React.createElement(PluginIcon, null)), /*#__PURE__*/React.createElement("i", { | ||
style: styles.actionIcon, | ||
onClick: function onClick() { | ||
return window.dispatchEvent(previewEvents.onEdit); | ||
} | ||
}, /*#__PURE__*/React.createElement(EditIcon, null)), /*#__PURE__*/React.createElement("i", { | ||
style: styles.actionIcon, | ||
onClick: function onClick() { | ||
return window.dispatchEvent(previewEvents.onLocate); | ||
} | ||
}, /*#__PURE__*/React.createElement(LocatorIcon, null)), /*#__PURE__*/React.createElement("i", { | ||
style: styles.actionIcon, | ||
onClick: function onClick() { | ||
return window.dispatchEvent(previewEvents.onDelete); | ||
} | ||
}, /*#__PURE__*/React.createElement(TrashIcon, null)))), children); | ||
}, children); | ||
}; | ||
@@ -288,0 +66,0 @@ |
{ | ||
"name": "@arc-fusion/pb-editor-wrapper", | ||
"description": "PageBuilder Preview Wrapper", | ||
"version": "1.0.10", | ||
"version": "1.0.11", | ||
"module": "dist/index.js", | ||
@@ -6,0 +6,0 @@ "files": [ |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
3212
71
1