@micromag/core 0.3.115 → 0.3.117
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/es/hooks.js +25 -2
- package/es/index.js +2 -0
- package/es/utils.js +138 -1
- package/lib/hooks.js +24 -0
- package/lib/index.js +2 -0
- package/lib/utils.js +140 -0
- package/package.json +2 -2
package/es/hooks.js
CHANGED
|
@@ -4,7 +4,7 @@ import { useIntl } from 'react-intl';
|
|
|
4
4
|
import isString from 'lodash/isString';
|
|
5
5
|
import dayjs from 'dayjs';
|
|
6
6
|
import { EventsManager, MediasParser, StoryParser, ThemeParser } from '@micromag/core';
|
|
7
|
-
import { createUseEvent } from '@micromag/core/utils';
|
|
7
|
+
import { createUseEvent, getMediaFilesAsArray } from '@micromag/core/utils';
|
|
8
8
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
9
9
|
import { useForm as useForm$1 } from '@folklore/forms';
|
|
10
10
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
@@ -1053,6 +1053,29 @@ var useMediasParser = function useMediasParser() {
|
|
|
1053
1053
|
};
|
|
1054
1054
|
};
|
|
1055
1055
|
|
|
1056
|
+
function useMediaThumbnail(media) {
|
|
1057
|
+
var file = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
1058
|
+
|
|
1059
|
+
var _ref = media || {},
|
|
1060
|
+
_ref$thumbnail_url = _ref.thumbnail_url,
|
|
1061
|
+
defaultThumbnailUrl = _ref$thumbnail_url === void 0 ? null : _ref$thumbnail_url,
|
|
1062
|
+
_ref$files = _ref.files,
|
|
1063
|
+
files = _ref$files === void 0 ? null : _ref$files;
|
|
1064
|
+
|
|
1065
|
+
var thumbnailUrl = useMemo(function () {
|
|
1066
|
+
var filesArray = getMediaFilesAsArray(files) || [];
|
|
1067
|
+
|
|
1068
|
+
var _ref2 = (file !== null ? filesArray.find(function (_ref3) {
|
|
1069
|
+
var handle = _ref3.handle;
|
|
1070
|
+
return handle === file;
|
|
1071
|
+
}) || null : null) || {},
|
|
1072
|
+
url = _ref2.url;
|
|
1073
|
+
|
|
1074
|
+
return url || defaultThumbnailUrl;
|
|
1075
|
+
}, [files, file, defaultThumbnailUrl]);
|
|
1076
|
+
return thumbnailUrl;
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1056
1079
|
var useParsedStory = function useParsedStory(story) {
|
|
1057
1080
|
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
1058
1081
|
_ref$disabled = _ref.disabled,
|
|
@@ -1566,4 +1589,4 @@ var useTrackMedia = function useTrackMedia() {
|
|
|
1566
1589
|
var eventsManager = typeof window !== 'undefined' ? new EventsManager(window) : null;
|
|
1567
1590
|
var useWindowEvent = createUseEvent(eventsManager);
|
|
1568
1591
|
|
|
1569
|
-
export { getObserver, useAnimationFrame, useDocumentEvent, useForm, useFormTransition, useFormattedDate, useFormattedTime, useFullscreen, useIntersectionObserver, useIsVisible, useLoadedFonts, useLongPress, useMediaApi, useMediasParser, useObserver, useParsedStory, useResizeObserver, useScreenSizeFromElement, useScreenSizeFromWindow, useSwipe, useThemeParser, useTrackEvent, useTrackMedia, useTrackScreenEvent, useTrackScreenMedia, useTrackScreenView, useWindowEvent };
|
|
1592
|
+
export { getObserver, useAnimationFrame, useDocumentEvent, useForm, useFormTransition, useFormattedDate, useFormattedTime, useFullscreen, useIntersectionObserver, useIsVisible, useLoadedFonts, useLongPress, useMediaApi, useMediaThumbnail, useMediasParser, useObserver, useParsedStory, useResizeObserver, useScreenSizeFromElement, useScreenSizeFromWindow, useSwipe, useThemeParser, useTrackEvent, useTrackMedia, useTrackScreenEvent, useTrackScreenMedia, useTrackScreenView, useWindowEvent };
|
package/es/index.js
CHANGED
|
@@ -14,6 +14,8 @@ import _createSuper from '@babel/runtime/helpers/createSuper';
|
|
|
14
14
|
import EventEmitter from 'wolfy87-eventemitter';
|
|
15
15
|
import 'lodash/isNumber';
|
|
16
16
|
import 'param-case';
|
|
17
|
+
import '@babel/runtime/helpers/asyncToGenerator';
|
|
18
|
+
import '@babel/runtime/regenerator';
|
|
17
19
|
import 'react';
|
|
18
20
|
import isString from 'lodash/isString';
|
|
19
21
|
import 'tinycolor2';
|
package/es/utils.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import isNumber from 'lodash/isNumber';
|
|
2
2
|
import { paramCase } from 'param-case';
|
|
3
|
+
import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
|
|
4
|
+
import _regeneratorRuntime from '@babel/runtime/regenerator';
|
|
3
5
|
import isObject from 'lodash/isObject';
|
|
4
6
|
import { useEffect } from 'react';
|
|
5
7
|
import isString from 'lodash/isString';
|
|
@@ -20,6 +22,141 @@ var convertStyleToString = function convertStyleToString(style) {
|
|
|
20
22
|
}).join('\n') : '';
|
|
21
23
|
};
|
|
22
24
|
|
|
25
|
+
/*! clipboard-copy. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
26
|
+
// @todo vendoring this: https://github.com/feross/clipboard-copy/blob/master/index.js
|
|
27
|
+
// we might want to add that to the npm deps and just use it?
|
|
28
|
+
function makeError() {
|
|
29
|
+
return new DOMException('The request is not allowed', 'NotAllowedError');
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function copyClipboardApi(_x) {
|
|
33
|
+
return _copyClipboardApi.apply(this, arguments);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function _copyClipboardApi() {
|
|
37
|
+
_copyClipboardApi = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(text) {
|
|
38
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
39
|
+
while (1) {
|
|
40
|
+
switch (_context.prev = _context.next) {
|
|
41
|
+
case 0:
|
|
42
|
+
if (navigator.clipboard) {
|
|
43
|
+
_context.next = 2;
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
throw makeError();
|
|
48
|
+
|
|
49
|
+
case 2:
|
|
50
|
+
return _context.abrupt("return", navigator.clipboard.writeText(text));
|
|
51
|
+
|
|
52
|
+
case 3:
|
|
53
|
+
case "end":
|
|
54
|
+
return _context.stop();
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}, _callee);
|
|
58
|
+
}));
|
|
59
|
+
return _copyClipboardApi.apply(this, arguments);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function copyExecCommand(_x2) {
|
|
63
|
+
return _copyExecCommand.apply(this, arguments);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function _copyExecCommand() {
|
|
67
|
+
_copyExecCommand = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(text) {
|
|
68
|
+
var span, selection, range, success;
|
|
69
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
70
|
+
while (1) {
|
|
71
|
+
switch (_context2.prev = _context2.next) {
|
|
72
|
+
case 0:
|
|
73
|
+
// Put the text to copy into a <span>
|
|
74
|
+
span = document.createElement('span');
|
|
75
|
+
span.textContent = text; // Preserve consecutive spaces and newlines
|
|
76
|
+
|
|
77
|
+
span.style.whiteSpace = 'pre';
|
|
78
|
+
span.style.webkitUserSelect = 'auto';
|
|
79
|
+
span.style.userSelect = 'all'; // Add the <span> to the page
|
|
80
|
+
|
|
81
|
+
document.body.appendChild(span); // Make a selection object representing the range of text selected by the user
|
|
82
|
+
|
|
83
|
+
selection = window.getSelection();
|
|
84
|
+
range = window.document.createRange();
|
|
85
|
+
selection.removeAllRanges();
|
|
86
|
+
range.selectNode(span);
|
|
87
|
+
selection.addRange(range); // Copy text to the clipboard
|
|
88
|
+
|
|
89
|
+
success = false;
|
|
90
|
+
|
|
91
|
+
try {
|
|
92
|
+
success = window.document.execCommand('copy');
|
|
93
|
+
} finally {
|
|
94
|
+
// Cleanup
|
|
95
|
+
selection.removeAllRanges();
|
|
96
|
+
window.document.body.removeChild(span);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if (success) {
|
|
100
|
+
_context2.next = 15;
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
throw makeError();
|
|
105
|
+
|
|
106
|
+
case 15:
|
|
107
|
+
case "end":
|
|
108
|
+
return _context2.stop();
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}, _callee2);
|
|
112
|
+
}));
|
|
113
|
+
return _copyExecCommand.apply(this, arguments);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function copyToClipboard(_x3) {
|
|
117
|
+
return _copyToClipboard.apply(this, arguments);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function _copyToClipboard() {
|
|
121
|
+
_copyToClipboard = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(text) {
|
|
122
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
123
|
+
while (1) {
|
|
124
|
+
switch (_context3.prev = _context3.next) {
|
|
125
|
+
case 0:
|
|
126
|
+
_context3.prev = 0;
|
|
127
|
+
_context3.next = 3;
|
|
128
|
+
return copyClipboardApi(text);
|
|
129
|
+
|
|
130
|
+
case 3:
|
|
131
|
+
_context3.next = 15;
|
|
132
|
+
break;
|
|
133
|
+
|
|
134
|
+
case 5:
|
|
135
|
+
_context3.prev = 5;
|
|
136
|
+
_context3.t0 = _context3["catch"](0);
|
|
137
|
+
_context3.prev = 7;
|
|
138
|
+
_context3.next = 10;
|
|
139
|
+
return copyExecCommand(text);
|
|
140
|
+
|
|
141
|
+
case 10:
|
|
142
|
+
_context3.next = 15;
|
|
143
|
+
break;
|
|
144
|
+
|
|
145
|
+
case 12:
|
|
146
|
+
_context3.prev = 12;
|
|
147
|
+
_context3.t1 = _context3["catch"](7);
|
|
148
|
+
throw _context3.t1 || _context3.t0 || makeError();
|
|
149
|
+
|
|
150
|
+
case 15:
|
|
151
|
+
case "end":
|
|
152
|
+
return _context3.stop();
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}, _callee3, null, [[0, 5], [7, 12]]);
|
|
156
|
+
}));
|
|
157
|
+
return _copyToClipboard.apply(this, arguments);
|
|
158
|
+
}
|
|
159
|
+
|
|
23
160
|
var createNullableOnChange = function createNullableOnChange() {
|
|
24
161
|
var onChange = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
25
162
|
return function (newValue) {
|
|
@@ -852,4 +989,4 @@ var getContrastingColor = function getContrastingColor(backgroundColor) {
|
|
|
852
989
|
return tinycolor(color).spin(30).toString();
|
|
853
990
|
};
|
|
854
991
|
|
|
855
|
-
export { convertStyleToString, createNullableOnChange, createUseEvent, getColorAsString, getComponentFromName, getContrastingColor, getDeviceScreens, getDisplayName, getFieldByName, getFieldFromPath, getFileName, getFontFamily as getFontFamilyFromFont, getGridLayoutName, largestRemainderRound as getLargestRemainderRound, getLayersFromBackground, getLayoutParts, getMediaFilesAsArray, getOptimalImageUrl, getScreenExtraField, getSecondsFromTime, getShadowCoords, getStyleFromBorder, getStyleFromBox, getStyleFromColor, getStyleFromContainer, getStyleFromHighlight, getStyleFromImage, getStyleFromLink, getStyleFromMargin, getStyleFromText, isImageFilled, isIos, isTextFilled$1 as isLabelFilled, isMessage, isTextFilled, isValidUrl, schemaId, setValue as setFieldValue, slug, unique, validateFields };
|
|
992
|
+
export { convertStyleToString, copyToClipboard, createNullableOnChange, createUseEvent, getColorAsString, getComponentFromName, getContrastingColor, getDeviceScreens, getDisplayName, getFieldByName, getFieldFromPath, getFileName, getFontFamily as getFontFamilyFromFont, getGridLayoutName, largestRemainderRound as getLargestRemainderRound, getLayersFromBackground, getLayoutParts, getMediaFilesAsArray, getOptimalImageUrl, getScreenExtraField, getSecondsFromTime, getShadowCoords, getStyleFromBorder, getStyleFromBox, getStyleFromColor, getStyleFromContainer, getStyleFromHighlight, getStyleFromImage, getStyleFromLink, getStyleFromMargin, getStyleFromText, isImageFilled, isIos, isTextFilled$1 as isLabelFilled, isMessage, isTextFilled, isValidUrl, schemaId, setValue as setFieldValue, slug, unique, validateFields };
|
package/lib/hooks.js
CHANGED
|
@@ -1089,6 +1089,29 @@ var useMediasParser = function useMediasParser() {
|
|
|
1089
1089
|
};
|
|
1090
1090
|
};
|
|
1091
1091
|
|
|
1092
|
+
function useMediaThumbnail(media) {
|
|
1093
|
+
var file = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
1094
|
+
|
|
1095
|
+
var _ref = media || {},
|
|
1096
|
+
_ref$thumbnail_url = _ref.thumbnail_url,
|
|
1097
|
+
defaultThumbnailUrl = _ref$thumbnail_url === void 0 ? null : _ref$thumbnail_url,
|
|
1098
|
+
_ref$files = _ref.files,
|
|
1099
|
+
files = _ref$files === void 0 ? null : _ref$files;
|
|
1100
|
+
|
|
1101
|
+
var thumbnailUrl = react.useMemo(function () {
|
|
1102
|
+
var filesArray = utils.getMediaFilesAsArray(files) || [];
|
|
1103
|
+
|
|
1104
|
+
var _ref2 = (file !== null ? filesArray.find(function (_ref3) {
|
|
1105
|
+
var handle = _ref3.handle;
|
|
1106
|
+
return handle === file;
|
|
1107
|
+
}) || null : null) || {},
|
|
1108
|
+
url = _ref2.url;
|
|
1109
|
+
|
|
1110
|
+
return url || defaultThumbnailUrl;
|
|
1111
|
+
}, [files, file, defaultThumbnailUrl]);
|
|
1112
|
+
return thumbnailUrl;
|
|
1113
|
+
}
|
|
1114
|
+
|
|
1092
1115
|
var useParsedStory = function useParsedStory(story) {
|
|
1093
1116
|
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
1094
1117
|
_ref$disabled = _ref.disabled,
|
|
@@ -1615,6 +1638,7 @@ exports.useIsVisible = useIsVisible;
|
|
|
1615
1638
|
exports.useLoadedFonts = useLoadedFonts;
|
|
1616
1639
|
exports.useLongPress = useLongPress;
|
|
1617
1640
|
exports.useMediaApi = useMediaApi;
|
|
1641
|
+
exports.useMediaThumbnail = useMediaThumbnail;
|
|
1618
1642
|
exports.useMediasParser = useMediasParser;
|
|
1619
1643
|
exports.useObserver = useObserver;
|
|
1620
1644
|
exports.useParsedStory = useParsedStory;
|
package/lib/index.js
CHANGED
|
@@ -18,6 +18,8 @@ var _createSuper = require('@babel/runtime/helpers/createSuper');
|
|
|
18
18
|
var EventEmitter = require('wolfy87-eventemitter');
|
|
19
19
|
require('lodash/isNumber');
|
|
20
20
|
require('param-case');
|
|
21
|
+
require('@babel/runtime/helpers/asyncToGenerator');
|
|
22
|
+
require('@babel/runtime/regenerator');
|
|
21
23
|
require('react');
|
|
22
24
|
var isString = require('lodash/isString');
|
|
23
25
|
require('tinycolor2');
|
package/lib/utils.js
CHANGED
|
@@ -4,6 +4,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var isNumber = require('lodash/isNumber');
|
|
6
6
|
var paramCase = require('param-case');
|
|
7
|
+
var _asyncToGenerator = require('@babel/runtime/helpers/asyncToGenerator');
|
|
8
|
+
var _regeneratorRuntime = require('@babel/runtime/regenerator');
|
|
7
9
|
var isObject = require('lodash/isObject');
|
|
8
10
|
var react = require('react');
|
|
9
11
|
var isString = require('lodash/isString');
|
|
@@ -20,6 +22,8 @@ var slugify = require('slugify');
|
|
|
20
22
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
21
23
|
|
|
22
24
|
var isNumber__default = /*#__PURE__*/_interopDefaultLegacy(isNumber);
|
|
25
|
+
var _asyncToGenerator__default = /*#__PURE__*/_interopDefaultLegacy(_asyncToGenerator);
|
|
26
|
+
var _regeneratorRuntime__default = /*#__PURE__*/_interopDefaultLegacy(_regeneratorRuntime);
|
|
23
27
|
var isObject__default = /*#__PURE__*/_interopDefaultLegacy(isObject);
|
|
24
28
|
var isString__default = /*#__PURE__*/_interopDefaultLegacy(isString);
|
|
25
29
|
var tinycolor__default = /*#__PURE__*/_interopDefaultLegacy(tinycolor);
|
|
@@ -37,6 +41,141 @@ var convertStyleToString = function convertStyleToString(style) {
|
|
|
37
41
|
}).join('\n') : '';
|
|
38
42
|
};
|
|
39
43
|
|
|
44
|
+
/*! clipboard-copy. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
45
|
+
// @todo vendoring this: https://github.com/feross/clipboard-copy/blob/master/index.js
|
|
46
|
+
// we might want to add that to the npm deps and just use it?
|
|
47
|
+
function makeError() {
|
|
48
|
+
return new DOMException('The request is not allowed', 'NotAllowedError');
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function copyClipboardApi(_x) {
|
|
52
|
+
return _copyClipboardApi.apply(this, arguments);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function _copyClipboardApi() {
|
|
56
|
+
_copyClipboardApi = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee(text) {
|
|
57
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee$(_context) {
|
|
58
|
+
while (1) {
|
|
59
|
+
switch (_context.prev = _context.next) {
|
|
60
|
+
case 0:
|
|
61
|
+
if (navigator.clipboard) {
|
|
62
|
+
_context.next = 2;
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
throw makeError();
|
|
67
|
+
|
|
68
|
+
case 2:
|
|
69
|
+
return _context.abrupt("return", navigator.clipboard.writeText(text));
|
|
70
|
+
|
|
71
|
+
case 3:
|
|
72
|
+
case "end":
|
|
73
|
+
return _context.stop();
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}, _callee);
|
|
77
|
+
}));
|
|
78
|
+
return _copyClipboardApi.apply(this, arguments);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function copyExecCommand(_x2) {
|
|
82
|
+
return _copyExecCommand.apply(this, arguments);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function _copyExecCommand() {
|
|
86
|
+
_copyExecCommand = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee2(text) {
|
|
87
|
+
var span, selection, range, success;
|
|
88
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee2$(_context2) {
|
|
89
|
+
while (1) {
|
|
90
|
+
switch (_context2.prev = _context2.next) {
|
|
91
|
+
case 0:
|
|
92
|
+
// Put the text to copy into a <span>
|
|
93
|
+
span = document.createElement('span');
|
|
94
|
+
span.textContent = text; // Preserve consecutive spaces and newlines
|
|
95
|
+
|
|
96
|
+
span.style.whiteSpace = 'pre';
|
|
97
|
+
span.style.webkitUserSelect = 'auto';
|
|
98
|
+
span.style.userSelect = 'all'; // Add the <span> to the page
|
|
99
|
+
|
|
100
|
+
document.body.appendChild(span); // Make a selection object representing the range of text selected by the user
|
|
101
|
+
|
|
102
|
+
selection = window.getSelection();
|
|
103
|
+
range = window.document.createRange();
|
|
104
|
+
selection.removeAllRanges();
|
|
105
|
+
range.selectNode(span);
|
|
106
|
+
selection.addRange(range); // Copy text to the clipboard
|
|
107
|
+
|
|
108
|
+
success = false;
|
|
109
|
+
|
|
110
|
+
try {
|
|
111
|
+
success = window.document.execCommand('copy');
|
|
112
|
+
} finally {
|
|
113
|
+
// Cleanup
|
|
114
|
+
selection.removeAllRanges();
|
|
115
|
+
window.document.body.removeChild(span);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if (success) {
|
|
119
|
+
_context2.next = 15;
|
|
120
|
+
break;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
throw makeError();
|
|
124
|
+
|
|
125
|
+
case 15:
|
|
126
|
+
case "end":
|
|
127
|
+
return _context2.stop();
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}, _callee2);
|
|
131
|
+
}));
|
|
132
|
+
return _copyExecCommand.apply(this, arguments);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function copyToClipboard(_x3) {
|
|
136
|
+
return _copyToClipboard.apply(this, arguments);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function _copyToClipboard() {
|
|
140
|
+
_copyToClipboard = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee3(text) {
|
|
141
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee3$(_context3) {
|
|
142
|
+
while (1) {
|
|
143
|
+
switch (_context3.prev = _context3.next) {
|
|
144
|
+
case 0:
|
|
145
|
+
_context3.prev = 0;
|
|
146
|
+
_context3.next = 3;
|
|
147
|
+
return copyClipboardApi(text);
|
|
148
|
+
|
|
149
|
+
case 3:
|
|
150
|
+
_context3.next = 15;
|
|
151
|
+
break;
|
|
152
|
+
|
|
153
|
+
case 5:
|
|
154
|
+
_context3.prev = 5;
|
|
155
|
+
_context3.t0 = _context3["catch"](0);
|
|
156
|
+
_context3.prev = 7;
|
|
157
|
+
_context3.next = 10;
|
|
158
|
+
return copyExecCommand(text);
|
|
159
|
+
|
|
160
|
+
case 10:
|
|
161
|
+
_context3.next = 15;
|
|
162
|
+
break;
|
|
163
|
+
|
|
164
|
+
case 12:
|
|
165
|
+
_context3.prev = 12;
|
|
166
|
+
_context3.t1 = _context3["catch"](7);
|
|
167
|
+
throw _context3.t1 || _context3.t0 || makeError();
|
|
168
|
+
|
|
169
|
+
case 15:
|
|
170
|
+
case "end":
|
|
171
|
+
return _context3.stop();
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}, _callee3, null, [[0, 5], [7, 12]]);
|
|
175
|
+
}));
|
|
176
|
+
return _copyToClipboard.apply(this, arguments);
|
|
177
|
+
}
|
|
178
|
+
|
|
40
179
|
var createNullableOnChange = function createNullableOnChange() {
|
|
41
180
|
var onChange = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
42
181
|
return function (newValue) {
|
|
@@ -878,6 +1017,7 @@ Object.defineProperty(exports, 'snakeCase', {
|
|
|
878
1017
|
get: function () { return changeCase.snakeCase; }
|
|
879
1018
|
});
|
|
880
1019
|
exports.convertStyleToString = convertStyleToString;
|
|
1020
|
+
exports.copyToClipboard = copyToClipboard;
|
|
881
1021
|
exports.createNullableOnChange = createNullableOnChange;
|
|
882
1022
|
exports.createUseEvent = createUseEvent;
|
|
883
1023
|
exports.getColorAsString = getColorAsString;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/core",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.117",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript"
|
|
@@ -132,5 +132,5 @@
|
|
|
132
132
|
"publishConfig": {
|
|
133
133
|
"access": "public"
|
|
134
134
|
},
|
|
135
|
-
"gitHead": "
|
|
135
|
+
"gitHead": "eab1c9a0b8c19d747fee6472158779f33b1f18d3"
|
|
136
136
|
}
|