@micromag/editor 0.3.9 → 0.3.10
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/assets/css/styles.css +2 -2
- package/es/index.js +7 -60
- package/lib/index.js +6 -59
- package/package.json +7 -7
package/assets/css/styles.css
CHANGED
|
@@ -7,13 +7,13 @@
|
|
|
7
7
|
.micromag-editor-menus-devices-container{display:inline-block;position:relative}.micromag-editor-menus-devices-container .micromag-editor-menus-devices-button{display:block;width:40px;height:30px;padding:5px}
|
|
8
8
|
.micromag-editor-buttons-device-container .micromag-editor-buttons-device-icon{display:block;width:100%;height:auto;max-height:100%}
|
|
9
9
|
.micromag-editor-partials-screen-states-button{width:50px;min-height:75px}.micromag-editor-partials-screen-states-button.btn-outline-secondary{border-color:#6c6c6c;color:#6c6c6c}.micromag-editor-partials-screen-states-button.btn-outline-secondary:hover{border-color:#e9e9e9;background:rgba(0,0,0,0);color:#e9e9e9}.micromag-editor-partials-screen-states-addButton{border-style:dashed}.micromag-editor-partials-screen-states-title{font-size:.75em}
|
|
10
|
-
.micromag-editor-buttons-screen-with-preview-button
|
|
10
|
+
.micromag-editor-buttons-screen-with-preview-button{display:block;position:relative}
|
|
11
11
|
.micromag-editor-buttons-screen-container .micromag-editor-buttons-screen-button{position:relative;padding:0;border:0;background:rgba(0,0,0,0);color:inherit;font-family:inherit;cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none}.micromag-editor-buttons-screen-container .micromag-editor-buttons-screen-border,.micromag-editor-buttons-screen-container .micromag-editor-buttons-screen-button,.micromag-editor-buttons-screen-container .micromag-editor-buttons-screen-screen .micromag-editor-buttons-screen-inner{position:absolute;top:0;left:0;width:100%;height:100%}.micromag-editor-buttons-screen-container{position:relative;overflow:hidden}.micromag-editor-buttons-screen-container .micromag-editor-buttons-screen-button{display:inline-block}.micromag-editor-buttons-screen-container .micromag-editor-buttons-screen-border{display:block}.micromag-editor-buttons-screen-container .micromag-editor-buttons-screen-screen{display:block;position:relative;width:100%;height:0;padding-bottom:150%;pointer-events:none}.micromag-editor-buttons-screen-container .micromag-editor-buttons-screen-screen .micromag-editor-buttons-screen-inner{display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;-webkit-align-items:center;-ms-flex-align:center;align-items:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center}.micromag-editor-buttons-screen-container .micromag-editor-buttons-screen-screen .micromag-editor-buttons-screen-icon{position:relative;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;width:100%}.micromag-editor-buttons-screen-container .micromag-editor-buttons-screen-screen .micromag-editor-buttons-screen-label{padding:5px 0;font-size:.75rem;font-weight:700}.micromag-editor-buttons-screen-container.micromag-editor-buttons-screen-active .micromag-editor-buttons-screen-border{z-index:2;border:3px solid #a13dff}
|
|
12
12
|
.micromag-editor-screens-container .micromag-editor-screens-navbar{z-index:999;background-color:#1c1c1c}.micromag-editor-screens-container .micromag-editor-screens-navbar>div{padding:0}
|
|
13
13
|
.micromag-editor-menus-screens-container .micromag-editor-menus-screens-placeholder,.micromag-editor-menus-screens-container .micromag-editor-menus-screens-preview,.micromag-editor-menus-screens-container .micromag-editor-menus-screens-screen{position:absolute;top:0;left:0;width:100%;height:100%}.micromag-editor-menus-screens-item,.micromag-editor-menus-screens-items{margin:0;padding:0;list-style:none}.micromag-editor-menus-screens-container{position:relative}.micromag-editor-menus-screens-container .micromag-editor-menus-screens-items{display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap;margin:-5px;padding:0}.micromag-editor-menus-screens-container .micromag-editor-menus-screens-item{display:block;position:relative;z-index:2;width:33.3%;padding:5px}@media screen and (min-width:540px){.micromag-editor-menus-screens-container .micromag-editor-menus-screens-item{width:20%}}.micromag-editor-menus-screens-container .micromag-editor-menus-screens-button{display:block}.micromag-editor-menus-screens-container .micromag-editor-menus-screens-placeholder,.micromag-editor-menus-screens-container .micromag-editor-menus-screens-preview{-webkit-transform-origin:0 0;-ms-transform-origin:0 0;transform-origin:0 0}.micromag-editor-menus-screens-container .micromag-editor-menus-screens-preview{background:rgba(0,0,0,.9)}.micromag-editor-menus-screens-container .micromag-editor-menus-screens-settings{position:absolute;top:0;right:0}.micromag-editor-menus-screens-container.micromag-editor-menus-screens-noWrap .micromag-editor-menus-screens-items{-webkit-flex-wrap:nowrap;-ms-flex-wrap:nowrap;flex-wrap:nowrap}.micromag-editor-menus-screens-container.micromag-editor-menus-screens-isVertical .micromag-editor-menus-screens-items{-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;-webkit-flex-wrap:nowrap;-ms-flex-wrap:nowrap;flex-wrap:nowrap}.micromag-editor-menus-screens-container.micromag-editor-menus-screens-isVertical .micromag-editor-menus-screens-item{width:100%}.micromag-editor-menus-screens-container.micromag-editor-menus-screens-withPlaceholder .micromag-editor-menus-screens-item{margin:5px;padding:0}.micromag-editor-menus-screens-container.micromag-editor-menus-screens-withPlaceholder .micromag-editor-menus-screens-button{width:100px}
|
|
14
14
|
.micromag-editor-sortable-sortable-tree-item{padding-bottom:3px}.micromag-editor-sortable-sortable-tree-item.micromag-editor-sortable-sortable-tree-parent{padding-bottom:0;background-color:#494949}.micromag-editor-sortable-sortable-tree-item.micromag-editor-sortable-sortable-tree-group{padding-top:3px;background-color:#494949}.micromag-editor-sortable-sortable-tree-item.micromag-editor-sortable-sortable-tree-group.micromag-editor-sortable-sortable-tree-isLastChild{margin-bottom:4px;padding-bottom:6px;border-bottom-right-radius:4px;border-bottom-left-radius:4px}
|
|
15
15
|
.micromag-editor-sortable-sortable-tree-item-container{display:block}.micromag-editor-sortable-sortable-tree-item-container .micromag-editor-sortable-sortable-tree-item-parent{position:relative;z-index:1;-webkit-box-shadow:0 4px 8px rgba(0,0,0,.5);box-shadow:0 4px 8px rgba(0,0,0,.5)}.micromag-editor-sortable-sortable-tree-item-container .micromag-editor-sortable-sortable-tree-item-child{position:absolute;z-index:0;right:5px;bottom:-25px;width:75%;-webkit-filter:brightness(60%);filter:brightness(60%)}
|
|
16
16
|
.micromag-editor-sortable-sortable-tree-item-actions-wrapper .micromag-editor-sortable-sortable-tree-item-actions-inner .micromag-editor-sortable-sortable-tree-item-actions-button{display:inline-block;position:relative;padding:0;border:0;background:rgba(0,0,0,0);color:inherit;font-family:inherit;cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none}.micromag-editor-sortable-sortable-tree-item-actions-wrapper{-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:4px;list-style:none}.micromag-editor-sortable-sortable-tree-item-actions-wrapper .micromag-editor-sortable-sortable-tree-item-actions-inner{display:-webkit-flex;display:-ms-flexbox;display:flex;position:relative;z-index:1;-webkit-box-sizing:border-box;box-sizing:border-box;-webkit-align-items:center;-ms-flex-align:center;align-items:center;width:100%;height:100%;background-color:rgba(0,0,0,0);color:#222}.micromag-editor-sortable-sortable-tree-item-actions-wrapper .micromag-editor-sortable-sortable-tree-item-actions-inner .micromag-editor-sortable-sortable-tree-item-actions-button{background-color:rgba(0,0,0,0);color:#fff}.micromag-editor-sortable-sortable-tree-item-actions-wrapper .micromag-editor-sortable-sortable-tree-item-actions-inner .micromag-editor-sortable-sortable-tree-item-actions-handle{position:absolute;z-index:1;top:0;left:0;width:100%;height:100%;border-radius:10px}.micromag-editor-sortable-sortable-tree-item-actions-wrapper .micromag-editor-sortable-sortable-tree-item-actions-inner .micromag-editor-sortable-sortable-tree-item-actions-handle .micromag-editor-sortable-sortable-tree-item-actions-icon{display:none;visibility:hidden;position:absolute;top:10px;left:10px}.micromag-editor-sortable-sortable-tree-item-actions-wrapper .micromag-editor-sortable-sortable-tree-item-actions-inner .micromag-editor-sortable-sortable-tree-item-actions-text{-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;padding-left:.5rem;overflow:hidden;-o-text-overflow:ellipsis;text-overflow:ellipsis;white-space:nowrap}.micromag-editor-sortable-sortable-tree-item-actions-wrapper .micromag-editor-sortable-sortable-tree-item-actions-inner .micromag-editor-sortable-sortable-tree-item-actions-collapsedCount,.micromag-editor-sortable-sortable-tree-item-actions-wrapper .micromag-editor-sortable-sortable-tree-item-actions-inner .micromag-editor-sortable-sortable-tree-item-actions-count{display:-webkit-flex;display:-ms-flexbox;display:flex;position:absolute;top:-10px;right:-10px;-webkit-align-items:center;-ms-flex-align:center;align-items:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;width:24px;height:24px;border-radius:50%;background-color:#a13dff;color:#fff;font-size:.8rem;font-weight:600}.micromag-editor-sortable-sortable-tree-item-actions-wrapper .micromag-editor-sortable-sortable-tree-item-actions-inner .micromag-editor-sortable-sortable-tree-item-actions-collapsedCount{top:auto;right:3px;bottom:2px;background-color:rgba(0,0,0,0)}.micromag-editor-sortable-sortable-tree-item-actions-wrapper .micromag-editor-sortable-sortable-tree-item-actions-inner .micromag-editor-sortable-sortable-tree-item-actions-disableInteraction{pointer-events:none}.micromag-editor-sortable-sortable-tree-item-actions-wrapper .micromag-editor-sortable-sortable-tree-item-actions-inner .micromag-editor-sortable-sortable-tree-item-actions-clone .micromag-editor-sortable-sortable-tree-item-actions-count,.micromag-editor-sortable-sortable-tree-item-actions-wrapper .micromag-editor-sortable-sortable-tree-item-actions-inner .micromag-editor-sortable-sortable-tree-item-actions-clone .micromag-editor-sortable-sortable-tree-item-actions-text,.micromag-editor-sortable-sortable-tree-item-actions-wrapper .micromag-editor-sortable-sortable-tree-item-actions-inner .micromag-editor-sortable-sortable-tree-item-actions-disableSelection .micromag-editor-sortable-sortable-tree-item-actions-count,.micromag-editor-sortable-sortable-tree-item-actions-wrapper .micromag-editor-sortable-sortable-tree-item-actions-inner .micromag-editor-sortable-sortable-tree-item-actions-disableSelection .micromag-editor-sortable-sortable-tree-item-actions-text{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.micromag-editor-sortable-sortable-tree-item-actions-wrapper .micromag-editor-sortable-sortable-tree-item-actions-inner .micromag-editor-sortable-sortable-tree-item-actions-collapse{display:-webkit-flex;display:-ms-flexbox;display:flex;position:absolute;z-index:1;bottom:0;left:0;-webkit-align-items:center;-ms-flex-align:center;align-items:center;-webkit-justify-content:space-between;-ms-flex-pack:justify;justify-content:space-between;width:100%;height:30px}.micromag-editor-sortable-sortable-tree-item-actions-wrapper .micromag-editor-sortable-sortable-tree-item-actions-inner .micromag-editor-sortable-sortable-tree-item-actions-collapse svg{margin-left:10px;-webkit-transition:-webkit-transform .25s ease;transition:-webkit-transform .25s ease;-o-transition:transform .25s ease;transition:transform .25s ease;transition:transform .25s ease, -webkit-transform .25s ease}.micromag-editor-sortable-sortable-tree-item-actions-wrapper .micromag-editor-sortable-sortable-tree-item-actions-inner .micromag-editor-sortable-sortable-tree-item-actions-collapse.micromag-editor-sortable-sortable-tree-item-actions-collapsed svg{-webkit-transform:rotate(-90deg);-ms-transform:rotate(-90deg);transform:rotate(-90deg)}.micromag-editor-sortable-sortable-tree-item-actions-wrapper .micromag-editor-sortable-sortable-tree-item-actions-children{position:relative;z-index:0;width:100%}.micromag-editor-sortable-sortable-tree-item-actions-wrapper.micromag-editor-sortable-sortable-tree-item-actions-withChildren{background-color:#494949}.micromag-editor-sortable-sortable-tree-item-actions-wrapper.micromag-editor-sortable-sortable-tree-item-actions-withChildren .micromag-editor-sortable-sortable-tree-item-actions-inner{padding-bottom:30px}.micromag-editor-sortable-sortable-tree-item-actions-wrapper.micromag-editor-sortable-sortable-tree-item-actions-clone{display:block;width:100%;margin-top:5px;margin-left:10px;padding:0;pointer-events:none}.micromag-editor-sortable-sortable-tree-item-actions-wrapper.micromag-editor-sortable-sortable-tree-item-actions-clone .micromag-editor-sortable-sortable-tree-item-actions-inner{padding-right:24px;border-radius:10px;-webkit-box-shadow:0 15px 15px 0 rgba(34,33,81,.1);box-shadow:0 15px 15px 0 rgba(34,33,81,.1)}.micromag-editor-sortable-sortable-tree-item-actions-wrapper.micromag-editor-sortable-sortable-tree-item-actions-ghost:not(.micromag-editor-sortable-sortable-tree-item-actions-indicator){-webkit-filter:opacity(.6);filter:opacity(.6)}.micromag-editor-sortable-sortable-tree-item-actions-wrapper.micromag-editor-sortable-sortable-tree-item-actions-ghost .micromag-editor-sortable-sortable-tree-item-actions-inner>*{background-color:rgba(0,0,0,0);-webkit-box-shadow:none;box-shadow:none}.micromag-editor-sortable-sortable-tree-item-actions-wrapper.micromag-editor-sortable-sortable-tree-item-actions-ghost .micromag-editor-sortable-sortable-tree-item-actions-inner{border:1px solid #a13dff;border-radius:4px}.micromag-editor-sortable-sortable-tree-item-actions-wrapper.micromag-editor-sortable-sortable-tree-item-actions-ghost.micromag-editor-sortable-sortable-tree-item-actions-indicator{position:relative;z-index:1;margin-bottom:-1px;opacity:1}.micromag-editor-sortable-sortable-tree-item-actions-wrapper.micromag-editor-sortable-sortable-tree-item-actions-ghost.micromag-editor-sortable-sortable-tree-item-actions-indicator .micromag-editor-sortable-sortable-tree-item-actions-inner{position:relative;height:8px;padding:0;border:1px solid #a13dff;border-radius:10px;background-color:#a13dff}.micromag-editor-sortable-sortable-tree-item-actions-wrapper.micromag-editor-sortable-sortable-tree-item-actions-ghost.micromag-editor-sortable-sortable-tree-item-actions-indicator .micromag-editor-sortable-sortable-tree-item-actions-inner>*{height:0;opacity:0}
|
|
17
|
-
.micromag-editor-menus-screen-types-container{position:relative}.micromag-editor-menus-screen-types-container .micromag-editor-menus-screen-types-row{margin-bottom:2rem}.micromag-editor-menus-screen-types-container .micromag-editor-menus-screen-types-row .micromag-editor-menus-screen-types-title{padding-bottom:.25rem;border-bottom:1px solid #dedede;font-size:.85rem}.micromag-editor-menus-screen-types-container .micromag-editor-menus-screen-types-row:last-child{margin-bottom:0}.micromag-editor-menus-screen-types-container .micromag-editor-menus-screen-types-screen{width:100%;max-width:100px}
|
|
17
|
+
.micromag-editor-menus-screen-types-container{position:relative}.micromag-editor-menus-screen-types-container .micromag-editor-menus-screen-types-row{margin-bottom:2rem}.micromag-editor-menus-screen-types-container .micromag-editor-menus-screen-types-row .micromag-editor-menus-screen-types-title{padding-bottom:.25rem;border-bottom:1px solid #dedede;font-size:.85rem}.micromag-editor-menus-screen-types-container .micromag-editor-menus-screen-types-row:last-child{margin-bottom:0}.micromag-editor-menus-screen-types-container .micromag-editor-menus-screen-types-screen{width:100%;max-width:100px}.micromag-editor-menus-screen-types-container .micromag-editor-menus-screen-types-button{mix-blend-mode:difference}
|
|
18
18
|
.micromag-editor-modals-screen-types-container .micromag-editor-modals-screen-types-selected{background-color:#a13dff}
|
|
19
19
|
.micromag-editor-forms-settings-container{position:relative;padding:.5rem}.micromag-editor-forms-settings-container .micromag-editor-forms-settings-inner{display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column}
|
package/es/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
|
4
4
|
import { PropTypes as PropTypes$1 } from '@micromag/core';
|
|
5
5
|
import { Button, FieldForm, BackButton, Breadcrumb as Breadcrumb$1, Modal, ModalDialog, Label, Navbar, DropdownMenu, Empty, Tabs, ScreenPlaceholder, ScreenPreview, Modals } from '@micromag/core/components';
|
|
6
6
|
import { useRoutes, useScreenDefinition, useFormsComponents, useScreensManager, useFieldsManager, useUrlGenerator, useRoutePush, ScreenProvider, useScreenSize, ModalsProvider, PanelsProvider, ScreenSizeProvider, useFieldComponent, ComponentsProvider, FORMS_NAMESPACE, UppyProvider, StoryProvider, GoogleKeysProvider, GoogleMapsClientProvider, FontsProvider, EditorProvider, ComponentsContext, RoutesProvider } from '@micromag/core/contexts';
|
|
7
|
-
import {
|
|
7
|
+
import { useParsedStory, useResizeObserver, useScreenSizeFromElement, useMediasParser } from '@micromag/core/hooks';
|
|
8
8
|
import { getScreenExtraField, isMessage, slug, getComponentFromName, getDeviceScreens } from '@micromag/core/utils';
|
|
9
9
|
import classNames from 'classnames';
|
|
10
10
|
import PropTypes from 'prop-types';
|
|
@@ -1146,7 +1146,7 @@ DevicesMenu.defaultProps = defaultProps$f;
|
|
|
1146
1146
|
|
|
1147
1147
|
var styles$a = {"button":"micromag-editor-partials-screen-states-button","addButton":"micromag-editor-partials-screen-states-addButton","title":"micromag-editor-partials-screen-states-title"};
|
|
1148
1148
|
|
|
1149
|
-
var styles$9 = {"button":"micromag-editor-buttons-screen-with-preview-button"
|
|
1149
|
+
var styles$9 = {"button":"micromag-editor-buttons-screen-with-preview-button"};
|
|
1150
1150
|
|
|
1151
1151
|
var styles$8 = {"container":"micromag-editor-buttons-screen-container","button":"micromag-editor-buttons-screen-button","border":"micromag-editor-buttons-screen-border","screen":"micromag-editor-buttons-screen-screen","inner":"micromag-editor-buttons-screen-inner","icon":"micromag-editor-buttons-screen-icon","label":"micromag-editor-buttons-screen-label","active":"micromag-editor-buttons-screen-active"};
|
|
1152
1152
|
|
|
@@ -1229,9 +1229,6 @@ var propTypes$d = {
|
|
|
1229
1229
|
href: PropTypes.string,
|
|
1230
1230
|
title: PropTypes.string,
|
|
1231
1231
|
active: PropTypes.bool,
|
|
1232
|
-
previewWidth: PropTypes.number,
|
|
1233
|
-
previewHeight: PropTypes.number,
|
|
1234
|
-
withPreview: PropTypes.bool,
|
|
1235
1232
|
withPlaceholder: PropTypes.bool,
|
|
1236
1233
|
onClick: PropTypes.func,
|
|
1237
1234
|
onClickItem: PropTypes.func,
|
|
@@ -1243,9 +1240,6 @@ var defaultProps$d = {
|
|
|
1243
1240
|
title: null,
|
|
1244
1241
|
href: null,
|
|
1245
1242
|
active: false,
|
|
1246
|
-
previewWidth: 320,
|
|
1247
|
-
previewHeight: 480,
|
|
1248
|
-
withPreview: true,
|
|
1249
1243
|
withPlaceholder: false,
|
|
1250
1244
|
onClick: null,
|
|
1251
1245
|
onClickItem: null,
|
|
@@ -1253,8 +1247,6 @@ var defaultProps$d = {
|
|
|
1253
1247
|
};
|
|
1254
1248
|
|
|
1255
1249
|
var ScreenWithPreview = function ScreenWithPreview(_ref) {
|
|
1256
|
-
var _classNames;
|
|
1257
|
-
|
|
1258
1250
|
var screen = _ref.screen,
|
|
1259
1251
|
screenState = _ref.screenState,
|
|
1260
1252
|
index = _ref.index,
|
|
@@ -1262,45 +1254,13 @@ var ScreenWithPreview = function ScreenWithPreview(_ref) {
|
|
|
1262
1254
|
href = _ref.href,
|
|
1263
1255
|
active = _ref.active,
|
|
1264
1256
|
className = _ref.className,
|
|
1265
|
-
previewWidth = _ref.previewWidth,
|
|
1266
|
-
previewHeight = _ref.previewHeight,
|
|
1267
1257
|
_onClick = _ref.onClick,
|
|
1268
1258
|
onClickItem = _ref.onClickItem,
|
|
1269
|
-
withPreview = _ref.withPreview,
|
|
1270
1259
|
withPlaceholder = _ref.withPlaceholder;
|
|
1271
1260
|
var intl = useIntl();
|
|
1272
|
-
|
|
1273
|
-
var _useResizeObserver = useResizeObserver(),
|
|
1274
|
-
refResize = _useResizeObserver.ref,
|
|
1275
|
-
contentRect = _useResizeObserver.entry.contentRect;
|
|
1276
|
-
|
|
1277
|
-
var _useMemo = useMemo(function () {
|
|
1278
|
-
var _ref2 = contentRect || {},
|
|
1279
|
-
_ref2$width = _ref2.width,
|
|
1280
|
-
itemWidth = _ref2$width === void 0 ? 0 : _ref2$width;
|
|
1281
|
-
|
|
1282
|
-
var ratio = 3 / 4;
|
|
1283
|
-
var finalWidth = previewWidth;
|
|
1284
|
-
var finalHeight = previewHeight !== null ? previewHeight : previewWidth * ratio;
|
|
1285
|
-
var previewScale = itemWidth / previewWidth;
|
|
1286
|
-
return {
|
|
1287
|
-
width: itemWidth,
|
|
1288
|
-
height: finalHeight * previewScale,
|
|
1289
|
-
screenWidth: finalWidth,
|
|
1290
|
-
screenHeight: finalHeight,
|
|
1291
|
-
scale: previewScale
|
|
1292
|
-
};
|
|
1293
|
-
}, [withPlaceholder, previewWidth, previewHeight, contentRect]),
|
|
1294
|
-
width = _useMemo.width,
|
|
1295
|
-
height = _useMemo.height,
|
|
1296
|
-
screenWidth = _useMemo.screenWidth,
|
|
1297
|
-
screenHeight = _useMemo.screenHeight,
|
|
1298
|
-
scale = _useMemo.scale;
|
|
1299
|
-
|
|
1300
1261
|
var ScreenComponent = withPlaceholder ? ScreenPlaceholder : ScreenPreview;
|
|
1301
1262
|
return /*#__PURE__*/React.createElement(ScreenButton$1, {
|
|
1302
1263
|
href: href,
|
|
1303
|
-
ref: refResize,
|
|
1304
1264
|
active: active,
|
|
1305
1265
|
className: classNames([styles$9.button, _defineProperty({}, className, className !== null)]),
|
|
1306
1266
|
title: isMessage(title) ? intl.formatMessage(title) : null,
|
|
@@ -1313,26 +1273,12 @@ var ScreenWithPreview = function ScreenWithPreview(_ref) {
|
|
|
1313
1273
|
onClickItem(screen, index);
|
|
1314
1274
|
}
|
|
1315
1275
|
}
|
|
1316
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
1317
|
-
className: styles$9.frame,
|
|
1318
|
-
style: {
|
|
1319
|
-
width: width,
|
|
1320
|
-
height: height
|
|
1321
|
-
}
|
|
1322
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
1323
|
-
className: classNames((_classNames = {}, _defineProperty(_classNames, styles$9.preview, withPreview && !withPlaceholder), _defineProperty(_classNames, styles$9.placeholder, withPlaceholder && !withPreview), _classNames)),
|
|
1324
|
-
style: {
|
|
1325
|
-
width: withPlaceholder ? width : screenWidth,
|
|
1326
|
-
height: withPlaceholder ? height : screenHeight,
|
|
1327
|
-
transform: withPlaceholder ? null : "scale(".concat(scale, ")")
|
|
1328
|
-
}
|
|
1329
1276
|
}, /*#__PURE__*/React.createElement(ScreenComponent, {
|
|
1330
1277
|
screen: screen,
|
|
1331
1278
|
screenState: screenState,
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
}))));
|
|
1279
|
+
className: styles$9.screen,
|
|
1280
|
+
withSize: true
|
|
1281
|
+
}));
|
|
1336
1282
|
};
|
|
1337
1283
|
|
|
1338
1284
|
ScreenWithPreview.propTypes = propTypes$d;
|
|
@@ -2913,7 +2859,7 @@ var ScreensMenu = function ScreensMenu(_ref) {
|
|
|
2913
2859
|
ScreensMenu.propTypes = propTypes$7;
|
|
2914
2860
|
ScreensMenu.defaultProps = defaultProps$7;
|
|
2915
2861
|
|
|
2916
|
-
var styles$2 = {"container":"micromag-editor-menus-screen-types-container","row":"micromag-editor-menus-screen-types-row","title":"micromag-editor-menus-screen-types-title","screen":"micromag-editor-menus-screen-types-screen"};
|
|
2862
|
+
var styles$2 = {"container":"micromag-editor-menus-screen-types-container","row":"micromag-editor-menus-screen-types-row","title":"micromag-editor-menus-screen-types-title","screen":"micromag-editor-menus-screen-types-screen","button":"micromag-editor-menus-screen-types-button"};
|
|
2917
2863
|
|
|
2918
2864
|
var propTypes$6 = {
|
|
2919
2865
|
screens: PropTypes$1.screenDefinitions,
|
|
@@ -3015,6 +2961,7 @@ var ScreenTypes = function ScreenTypes(_ref) {
|
|
|
3015
2961
|
'bg-secondary': selectedTypes === null,
|
|
3016
2962
|
'text-secondary': selectedTypes !== null
|
|
3017
2963
|
}]),
|
|
2964
|
+
buttonClassName: styles$2.button,
|
|
3018
2965
|
onClickItem: onClickItem
|
|
3019
2966
|
})));
|
|
3020
2967
|
})));
|
package/lib/index.js
CHANGED
|
@@ -1166,7 +1166,7 @@ DevicesMenu.defaultProps = defaultProps$f;
|
|
|
1166
1166
|
|
|
1167
1167
|
var styles$a = {"button":"micromag-editor-partials-screen-states-button","addButton":"micromag-editor-partials-screen-states-addButton","title":"micromag-editor-partials-screen-states-title"};
|
|
1168
1168
|
|
|
1169
|
-
var styles$9 = {"button":"micromag-editor-buttons-screen-with-preview-button"
|
|
1169
|
+
var styles$9 = {"button":"micromag-editor-buttons-screen-with-preview-button"};
|
|
1170
1170
|
|
|
1171
1171
|
var styles$8 = {"container":"micromag-editor-buttons-screen-container","button":"micromag-editor-buttons-screen-button","border":"micromag-editor-buttons-screen-border","screen":"micromag-editor-buttons-screen-screen","inner":"micromag-editor-buttons-screen-inner","icon":"micromag-editor-buttons-screen-icon","label":"micromag-editor-buttons-screen-label","active":"micromag-editor-buttons-screen-active"};
|
|
1172
1172
|
|
|
@@ -1249,9 +1249,6 @@ var propTypes$d = {
|
|
|
1249
1249
|
href: PropTypes__default["default"].string,
|
|
1250
1250
|
title: PropTypes__default["default"].string,
|
|
1251
1251
|
active: PropTypes__default["default"].bool,
|
|
1252
|
-
previewWidth: PropTypes__default["default"].number,
|
|
1253
|
-
previewHeight: PropTypes__default["default"].number,
|
|
1254
|
-
withPreview: PropTypes__default["default"].bool,
|
|
1255
1252
|
withPlaceholder: PropTypes__default["default"].bool,
|
|
1256
1253
|
onClick: PropTypes__default["default"].func,
|
|
1257
1254
|
onClickItem: PropTypes__default["default"].func,
|
|
@@ -1263,9 +1260,6 @@ var defaultProps$d = {
|
|
|
1263
1260
|
title: null,
|
|
1264
1261
|
href: null,
|
|
1265
1262
|
active: false,
|
|
1266
|
-
previewWidth: 320,
|
|
1267
|
-
previewHeight: 480,
|
|
1268
|
-
withPreview: true,
|
|
1269
1263
|
withPlaceholder: false,
|
|
1270
1264
|
onClick: null,
|
|
1271
1265
|
onClickItem: null,
|
|
@@ -1273,8 +1267,6 @@ var defaultProps$d = {
|
|
|
1273
1267
|
};
|
|
1274
1268
|
|
|
1275
1269
|
var ScreenWithPreview = function ScreenWithPreview(_ref) {
|
|
1276
|
-
var _classNames;
|
|
1277
|
-
|
|
1278
1270
|
var screen = _ref.screen,
|
|
1279
1271
|
screenState = _ref.screenState,
|
|
1280
1272
|
index = _ref.index,
|
|
@@ -1282,45 +1274,13 @@ var ScreenWithPreview = function ScreenWithPreview(_ref) {
|
|
|
1282
1274
|
href = _ref.href,
|
|
1283
1275
|
active = _ref.active,
|
|
1284
1276
|
className = _ref.className,
|
|
1285
|
-
previewWidth = _ref.previewWidth,
|
|
1286
|
-
previewHeight = _ref.previewHeight,
|
|
1287
1277
|
_onClick = _ref.onClick,
|
|
1288
1278
|
onClickItem = _ref.onClickItem,
|
|
1289
|
-
withPreview = _ref.withPreview,
|
|
1290
1279
|
withPlaceholder = _ref.withPlaceholder;
|
|
1291
1280
|
var intl = reactIntl.useIntl();
|
|
1292
|
-
|
|
1293
|
-
var _useResizeObserver = hooks.useResizeObserver(),
|
|
1294
|
-
refResize = _useResizeObserver.ref,
|
|
1295
|
-
contentRect = _useResizeObserver.entry.contentRect;
|
|
1296
|
-
|
|
1297
|
-
var _useMemo = React.useMemo(function () {
|
|
1298
|
-
var _ref2 = contentRect || {},
|
|
1299
|
-
_ref2$width = _ref2.width,
|
|
1300
|
-
itemWidth = _ref2$width === void 0 ? 0 : _ref2$width;
|
|
1301
|
-
|
|
1302
|
-
var ratio = 3 / 4;
|
|
1303
|
-
var finalWidth = previewWidth;
|
|
1304
|
-
var finalHeight = previewHeight !== null ? previewHeight : previewWidth * ratio;
|
|
1305
|
-
var previewScale = itemWidth / previewWidth;
|
|
1306
|
-
return {
|
|
1307
|
-
width: itemWidth,
|
|
1308
|
-
height: finalHeight * previewScale,
|
|
1309
|
-
screenWidth: finalWidth,
|
|
1310
|
-
screenHeight: finalHeight,
|
|
1311
|
-
scale: previewScale
|
|
1312
|
-
};
|
|
1313
|
-
}, [withPlaceholder, previewWidth, previewHeight, contentRect]),
|
|
1314
|
-
width = _useMemo.width,
|
|
1315
|
-
height = _useMemo.height,
|
|
1316
|
-
screenWidth = _useMemo.screenWidth,
|
|
1317
|
-
screenHeight = _useMemo.screenHeight,
|
|
1318
|
-
scale = _useMemo.scale;
|
|
1319
|
-
|
|
1320
1281
|
var ScreenComponent = withPlaceholder ? components.ScreenPlaceholder : components.ScreenPreview;
|
|
1321
1282
|
return /*#__PURE__*/React__default["default"].createElement(ScreenButton$1, {
|
|
1322
1283
|
href: href,
|
|
1323
|
-
ref: refResize,
|
|
1324
1284
|
active: active,
|
|
1325
1285
|
className: classNames__default["default"]([styles$9.button, _defineProperty__default["default"]({}, className, className !== null)]),
|
|
1326
1286
|
title: utils.isMessage(title) ? intl.formatMessage(title) : null,
|
|
@@ -1333,26 +1293,12 @@ var ScreenWithPreview = function ScreenWithPreview(_ref) {
|
|
|
1333
1293
|
onClickItem(screen, index);
|
|
1334
1294
|
}
|
|
1335
1295
|
}
|
|
1336
|
-
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1337
|
-
className: styles$9.frame,
|
|
1338
|
-
style: {
|
|
1339
|
-
width: width,
|
|
1340
|
-
height: height
|
|
1341
|
-
}
|
|
1342
|
-
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1343
|
-
className: classNames__default["default"]((_classNames = {}, _defineProperty__default["default"](_classNames, styles$9.preview, withPreview && !withPlaceholder), _defineProperty__default["default"](_classNames, styles$9.placeholder, withPlaceholder && !withPreview), _classNames)),
|
|
1344
|
-
style: {
|
|
1345
|
-
width: withPlaceholder ? width : screenWidth,
|
|
1346
|
-
height: withPlaceholder ? height : screenHeight,
|
|
1347
|
-
transform: withPlaceholder ? null : "scale(".concat(scale, ")")
|
|
1348
|
-
}
|
|
1349
1296
|
}, /*#__PURE__*/React__default["default"].createElement(ScreenComponent, {
|
|
1350
1297
|
screen: screen,
|
|
1351
1298
|
screenState: screenState,
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
}))));
|
|
1299
|
+
className: styles$9.screen,
|
|
1300
|
+
withSize: true
|
|
1301
|
+
}));
|
|
1356
1302
|
};
|
|
1357
1303
|
|
|
1358
1304
|
ScreenWithPreview.propTypes = propTypes$d;
|
|
@@ -2933,7 +2879,7 @@ var ScreensMenu = function ScreensMenu(_ref) {
|
|
|
2933
2879
|
ScreensMenu.propTypes = propTypes$7;
|
|
2934
2880
|
ScreensMenu.defaultProps = defaultProps$7;
|
|
2935
2881
|
|
|
2936
|
-
var styles$2 = {"container":"micromag-editor-menus-screen-types-container","row":"micromag-editor-menus-screen-types-row","title":"micromag-editor-menus-screen-types-title","screen":"micromag-editor-menus-screen-types-screen"};
|
|
2882
|
+
var styles$2 = {"container":"micromag-editor-menus-screen-types-container","row":"micromag-editor-menus-screen-types-row","title":"micromag-editor-menus-screen-types-title","screen":"micromag-editor-menus-screen-types-screen","button":"micromag-editor-menus-screen-types-button"};
|
|
2937
2883
|
|
|
2938
2884
|
var propTypes$6 = {
|
|
2939
2885
|
screens: core.PropTypes.screenDefinitions,
|
|
@@ -3035,6 +2981,7 @@ var ScreenTypes = function ScreenTypes(_ref) {
|
|
|
3035
2981
|
'bg-secondary': selectedTypes === null,
|
|
3036
2982
|
'text-secondary': selectedTypes !== null
|
|
3037
2983
|
}]),
|
|
2984
|
+
buttonClassName: styles$2.button,
|
|
3038
2985
|
onClickItem: onClickItem
|
|
3039
2986
|
})));
|
|
3040
2987
|
})));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/editor",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.10",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript"
|
|
@@ -62,11 +62,11 @@
|
|
|
62
62
|
"@fortawesome/fontawesome-svg-core": "^1.2.32",
|
|
63
63
|
"@fortawesome/free-solid-svg-icons": "^5.15.1",
|
|
64
64
|
"@fortawesome/react-fontawesome": "^0.1.13",
|
|
65
|
-
"@micromag/core": "^0.3.
|
|
66
|
-
"@micromag/elements": "^0.3.
|
|
67
|
-
"@micromag/fields": "^0.3.
|
|
68
|
-
"@micromag/screens": "^0.3.
|
|
69
|
-
"@micromag/viewer": "^0.3.
|
|
65
|
+
"@micromag/core": "^0.3.10",
|
|
66
|
+
"@micromag/elements": "^0.3.10",
|
|
67
|
+
"@micromag/fields": "^0.3.10",
|
|
68
|
+
"@micromag/screens": "^0.3.10",
|
|
69
|
+
"@micromag/viewer": "^0.3.10",
|
|
70
70
|
"classnames": "^2.2.6",
|
|
71
71
|
"lodash": "^4.17.21",
|
|
72
72
|
"prop-types": "^15.7.2",
|
|
@@ -81,5 +81,5 @@
|
|
|
81
81
|
"publishConfig": {
|
|
82
82
|
"access": "public"
|
|
83
83
|
},
|
|
84
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "86e11f1f28cd844b3fde4718ac7ddfcb9585e7c6"
|
|
85
85
|
}
|