@uploadcare/file-uploader 1.11.0-alpha.0 → 1.11.0-alpha.2

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.
Files changed (72) hide show
  1. package/abstract/UploaderPublicApi.js +1 -1
  2. package/blocks/CameraSource/CameraSource.d.ts +169 -22
  3. package/blocks/CameraSource/CameraSource.d.ts.map +1 -1
  4. package/blocks/CameraSource/CameraSource.js +803 -126
  5. package/blocks/CameraSource/camera-source.css +105 -7
  6. package/blocks/CloudImageEditorActivity/index.css +3 -3
  7. package/blocks/Config/Config.d.ts +4 -2
  8. package/blocks/Config/Config.d.ts.map +1 -1
  9. package/blocks/Config/Config.js +2 -0
  10. package/blocks/Config/initialConfig.d.ts +1 -1
  11. package/blocks/Config/initialConfig.d.ts.map +1 -1
  12. package/blocks/Config/initialConfig.js +7 -1
  13. package/blocks/Config/normalizeConfigValue.d.ts.map +1 -1
  14. package/blocks/Config/normalizeConfigValue.js +17 -1
  15. package/blocks/ExternalSource/ExternalSource.d.ts +50 -20
  16. package/blocks/ExternalSource/ExternalSource.d.ts.map +1 -1
  17. package/blocks/ExternalSource/ExternalSource.js +99 -96
  18. package/blocks/ExternalSource/buildStyles.d.ts +27 -0
  19. package/blocks/ExternalSource/buildStyles.d.ts.map +1 -0
  20. package/blocks/ExternalSource/buildStyles.js +133 -0
  21. package/blocks/ExternalSource/external-source.css +22 -37
  22. package/blocks/ExternalSource/messages.d.ts +3 -0
  23. package/blocks/ExternalSource/messages.d.ts.map +1 -0
  24. package/blocks/ExternalSource/messages.js +35 -0
  25. package/blocks/LocalEditorImage/LocalEditorImage.d.ts +22 -0
  26. package/blocks/LocalEditorImage/LocalEditorImage.d.ts.map +1 -0
  27. package/blocks/LocalEditorImage/LocalEditorImage.js +139 -0
  28. package/blocks/LocalEditorImage/localEditorImage.css +19 -0
  29. package/blocks/Modal/Modal.d.ts.map +1 -1
  30. package/blocks/Modal/Modal.js +11 -4
  31. package/blocks/Modal/modal.css +54 -3
  32. package/blocks/StartFrom/start-from.css +6 -2
  33. package/blocks/UploadList/upload-list.css +11 -1
  34. package/blocks/UrlSource/url-source.css +8 -0
  35. package/blocks/themes/uc-basic/common.css +5 -0
  36. package/blocks/themes/uc-basic/svg-sprite.d.ts +1 -1
  37. package/blocks/themes/uc-basic/svg-sprite.js +1 -1
  38. package/blocks/themes/uc-basic/theme.css +3 -2
  39. package/env.d.ts +1 -1
  40. package/env.d.ts.map +1 -1
  41. package/env.js +1 -1
  42. package/index.ssr.d.ts +15 -1
  43. package/index.ssr.d.ts.map +1 -1
  44. package/index.ssr.js +82 -9
  45. package/locales/file-uploader/en.d.ts +0 -2
  46. package/locales/file-uploader/en.js +1 -3
  47. package/locales/file-uploader/fi.d.ts +120 -0
  48. package/locales/file-uploader/fi.d.ts.map +1 -0
  49. package/locales/file-uploader/fi.js +120 -0
  50. package/package.json +1 -1
  51. package/types/exported.d.ts +21 -0
  52. package/web/file-uploader.iife.min.js +4 -4
  53. package/web/file-uploader.min.js +4 -4
  54. package/web/uc-basic.min.css +1 -1
  55. package/web/uc-cloud-image-editor.min.css +1 -1
  56. package/web/uc-cloud-image-editor.min.js +4 -4
  57. package/web/uc-file-uploader-inline.min.css +1 -1
  58. package/web/uc-file-uploader-inline.min.js +4 -4
  59. package/web/uc-file-uploader-minimal.min.css +1 -1
  60. package/web/uc-file-uploader-minimal.min.js +3 -3
  61. package/web/uc-file-uploader-regular.min.css +1 -1
  62. package/web/uc-file-uploader-regular.min.js +4 -4
  63. package/web/uc-img.min.js +1 -1
  64. package/blocks/ExternalSource/MessageBridge.d.ts +0 -20
  65. package/blocks/ExternalSource/MessageBridge.d.ts.map +0 -1
  66. package/blocks/ExternalSource/MessageBridge.js +0 -71
  67. package/blocks/ExternalSource/buildThemeDefinition.d.ts +0 -3
  68. package/blocks/ExternalSource/buildThemeDefinition.d.ts.map +0 -1
  69. package/blocks/ExternalSource/buildThemeDefinition.js +0 -47
  70. package/blocks/ExternalSource/types.d.ts +0 -113
  71. package/blocks/ExternalSource/types.d.ts.map +0 -1
  72. package/blocks/ExternalSource/types.js +0 -143
@@ -5,12 +5,31 @@ import { ActivityBlock } from '../../abstract/ActivityBlock.js';
5
5
  import { UploaderBlock } from '../../abstract/UploaderBlock.js';
6
6
  import { stringToArray } from '../../utils/stringToArray.js';
7
7
  import { wildcardRegexp } from '../../utils/wildcardRegexp.js';
8
- import { buildThemeDefinition } from './buildThemeDefinition.js';
9
- import { MessageBridge } from './MessageBridge.js';
8
+ import { buildStyles } from './buildStyles.js';
9
+ import { registerMessage, unregisterMessage } from './messages.js';
10
10
  import { queryString } from './query-string.js';
11
11
 
12
12
  /** @typedef {{ externalSourceType: string }} ActivityParams */
13
13
 
14
+ /**
15
+ * @typedef {{
16
+ * type: 'file-selected';
17
+ * obj_type: 'selected_file';
18
+ * filename: string;
19
+ * url: string;
20
+ * alternatives?: Record<string, string>;
21
+ * }} SelectedFileMessage
22
+ */
23
+
24
+ /**
25
+ * @typedef {{
26
+ * type: 'embed-css';
27
+ * style: string;
28
+ * }} EmbedCssMessage
29
+ */
30
+
31
+ /** @typedef {SelectedFileMessage | EmbedCssMessage} Message */
32
+
14
33
  export class ExternalSource extends UploaderBlock {
15
34
  couldBeCtxOwner = true;
16
35
  activityType = ActivityBlock.activities.EXTERNAL;
@@ -22,20 +41,12 @@ export class ExternalSource extends UploaderBlock {
22
41
  ...this.init$,
23
42
  activityIcon: '',
24
43
  activityCaption: '',
25
-
26
- /** @type {import('./types.js').InputMessageMap['selected-files-change']['selectedFiles']} */
27
44
  selectedList: [],
28
- total: 0,
29
-
30
- isSelectionReady: false,
31
- couldSelectAll: false,
32
- couldDeselectAll: false,
33
- showSelectionStatus: false,
34
- counterText: '',
35
-
45
+ counter: 0,
46
+ multiple: false,
36
47
  onDone: () => {
37
48
  for (const message of this.$.selectedList) {
38
- const url = this.extractUrlFromSelectedFile(message);
49
+ const url = this.extractUrlFromMessage(message);
39
50
  const { filename } = message;
40
51
  const { externalSourceType } = this.activityParams;
41
52
  this.api.addFileFromUrl(url, { fileName: filename, source: externalSourceType });
@@ -46,14 +57,6 @@ export class ExternalSource extends UploaderBlock {
46
57
  onCancel: () => {
47
58
  this.historyBack();
48
59
  },
49
-
50
- onSelectAll: () => {
51
- this._messageBridge?.send({ type: 'select-all' });
52
- },
53
-
54
- onDeselectAll: () => {
55
- this._messageBridge?.send({ type: 'deselect-all' });
56
- },
57
60
  };
58
61
  }
59
62
 
@@ -66,6 +69,12 @@ export class ExternalSource extends UploaderBlock {
66
69
  throw new Error(`External Source activity params not found`);
67
70
  }
68
71
 
72
+ /**
73
+ * @private
74
+ * @type {HTMLIFrameElement | null}
75
+ */
76
+ _iframe = null;
77
+
69
78
  initCallback() {
70
79
  super.initCallback();
71
80
  this.registerActivity(this.activityType, {
@@ -99,25 +108,24 @@ export class ExternalSource extends UploaderBlock {
99
108
  this.unmountIframe();
100
109
  }
101
110
  });
102
- this.subConfigValue('multiple', (multiple) => {
103
- this.$.showSelectionStatus = multiple;
111
+ this.sub('selectedList', (list) => {
112
+ this.$.counter = list.length;
104
113
  });
105
-
106
- this.subConfigValue('localeName', (val) => {
107
- this.setupL10n();
114
+ this.subConfigValue('multiple', (multiple) => {
115
+ this.$.multiple = multiple;
108
116
  });
109
117
  }
110
118
 
111
119
  /**
112
120
  * @private
113
- * @param {NonNullable<import('./types.js').InputMessageMap['selected-files-change']['selectedFiles']>[number]} selectedFile
121
+ * @param {SelectedFileMessage} message
114
122
  */
115
- extractUrlFromSelectedFile(selectedFile) {
116
- if (selectedFile.alternatives) {
123
+ extractUrlFromMessage(message) {
124
+ if (message.alternatives) {
117
125
  const preferredTypes = stringToArray(this.cfg.externalSourcesPreferredTypes);
118
126
  for (const preferredType of preferredTypes) {
119
127
  const regexp = wildcardRegexp(preferredType);
120
- for (const [type, typeUrl] of Object.entries(selectedFile.alternatives)) {
128
+ for (const [type, typeUrl] of Object.entries(message.alternatives)) {
121
129
  if (regexp.test(type)) {
122
130
  return typeUrl;
123
131
  }
@@ -125,71 +133,81 @@ export class ExternalSource extends UploaderBlock {
125
133
  }
126
134
  }
127
135
 
128
- return selectedFile.url;
136
+ return message.url;
129
137
  }
130
138
 
131
139
  /**
132
140
  * @private
133
- * @param {import('./types.js').InputMessageMap['selected-files-change']} message
141
+ * @param {Message} message
134
142
  */
135
- async handleSelectedFilesChange(message) {
136
- if (this.cfg.multiple !== message.isMultipleMode) {
137
- console.error('Multiple mode mismatch');
143
+ sendMessage(message) {
144
+ this._iframe?.contentWindow?.postMessage(JSON.stringify(message), '*');
145
+ }
146
+
147
+ /**
148
+ * @private
149
+ * @param {SelectedFileMessage} message
150
+ */
151
+ async handleFileSelected(message) {
152
+ if (!this.$.multiple && this.$.selectedList.length) {
138
153
  return;
139
154
  }
140
155
 
141
- this.bindL10n('counterText', () =>
142
- this.l10n('selected-count', {
143
- count: message.selectedCount,
144
- total: message.total,
145
- }),
146
- );
147
-
148
- this.set$({
149
- isSelectionReady: message.isReady,
150
- showSelectionStatus: message.isMultipleMode && message.total > 0,
151
- couldSelectAll: message.selectedCount < message.total,
152
- couldDeselectAll: message.selectedCount === message.total,
153
- selectedList: message.selectedFiles,
154
- });
156
+ this.$.selectedList = [...this.$.selectedList, message];
157
+
158
+ if (!this.$.multiple) {
159
+ this.$.onDone();
160
+ }
155
161
  }
156
162
 
157
163
  /** @private */
158
164
  handleIframeLoad() {
159
165
  this.applyStyles();
160
- this.setupL10n();
161
166
  }
162
167
 
163
- /** @private */
164
- applyStyles() {
165
- this._messageBridge?.send({
166
- type: 'set-theme-definition',
167
- theme: buildThemeDefinition(this),
168
- });
168
+ /**
169
+ * @private
170
+ * @param {string} propName
171
+ */
172
+ getCssValue(propName) {
173
+ let style = window.getComputedStyle(this);
174
+ return style.getPropertyValue(propName).trim();
169
175
  }
170
176
 
171
177
  /** @private */
172
- setupL10n() {
173
- this._messageBridge?.send({
174
- type: 'set-locale-definition',
175
- localeDefinition: this.cfg.localeName,
178
+ applyStyles() {
179
+ let colors = {
180
+ radius: this.getCssValue('--uc-radius'),
181
+ backgroundColor: this.getCssValue('--uc-background'),
182
+ textColor: this.getCssValue('--uc-foreground'),
183
+ secondaryColor: this.getCssValue('--uc-secondary'),
184
+ secondaryForegroundColor: this.getCssValue('--uc-secondary-foreground'),
185
+ secondaryHover: this.getCssValue('--uc-secondary-hover'),
186
+ linkColor: this.getCssValue('--uc-primary'),
187
+ linkColorHover: this.getCssValue('--uc-primary-hover'),
188
+ fontFamily: this.getCssValue('--uc-font-family'),
189
+ fontSize: this.getCssValue('--uc-font-size'),
190
+ };
191
+
192
+ this.sendMessage({
193
+ type: 'embed-css',
194
+ style: buildStyles(colors),
176
195
  });
177
196
  }
178
197
 
179
198
  /** @private */
180
199
  remoteUrl() {
181
- const { pubkey, remoteTabSessionKey, socialBaseUrl, multiple } = this.cfg;
200
+ const { pubkey, remoteTabSessionKey, socialBaseUrl } = this.cfg;
182
201
  const { externalSourceType } = this.activityParams;
183
202
  const lang = this.l10n('social-source-lang')?.split('-')?.[0] || 'en';
184
203
  const params = {
185
204
  lang,
186
205
  public_key: pubkey,
187
206
  images_only: false.toString(),
207
+ pass_window_open: false,
188
208
  session_key: remoteTabSessionKey,
189
- wait_for_theme: true,
190
- multiple: multiple.toString(),
191
209
  };
192
- const url = new URL(`/window4/${externalSourceType}`, socialBaseUrl);
210
+ const url = new URL(`/window3/${externalSourceType}`, socialBaseUrl);
193
211
  url.search = queryString(params);
194
212
  return url.toString();
195
213
  }
@@ -213,43 +231,31 @@ export class ExternalSource extends UploaderBlock {
213
231
  this.ref.iframeWrapper.innerHTML = '';
214
232
  this.ref.iframeWrapper.appendChild(iframe);
215
233
 
216
- if (!iframe.contentWindow) {
217
- return;
218
- }
219
-
220
- this._messageBridge?.destroy();
221
-
222
- /** @private */
223
- this._messageBridge = new MessageBridge(iframe.contentWindow);
224
- this._messageBridge.on('selected-files-change', this.handleSelectedFilesChange.bind(this));
234
+ registerMessage('file-selected', iframe.contentWindow, this.handleFileSelected.bind(this));
225
235
 
226
- this.resetSelectionStatus();
236
+ this._iframe = iframe;
237
+ this.$.selectedList = [];
227
238
  }
228
239
 
229
240
  /** @private */
230
241
  unmountIframe() {
231
- this._messageBridge?.destroy();
232
- this._messageBridge = undefined;
242
+ this._iframe && unregisterMessage('file-selected', this._iframe.contentWindow);
233
243
  this.ref.iframeWrapper.innerHTML = '';
234
-
235
- this.resetSelectionStatus();
236
- }
237
-
238
- /** @private */
239
- resetSelectionStatus() {
240
- this.set$({
241
- selectedList: [],
242
- total: 0,
243
- isSelectionReady: false,
244
- couldSelectAll: false,
245
- couldDeselectAll: false,
246
- showSelectionStatus: false,
247
- });
244
+ this._iframe = null;
245
+ this.$.selectedList = [];
246
+ this.$.counter = 0;
248
247
  }
249
248
  }
250
249
 
251
250
  ExternalSource.template = /* HTML */ `
252
251
  <uc-activity-header>
252
+ <button type="button" class="uc-mini-btn" set="onclick: *historyBack" l10n="@title:back">
253
+ <uc-icon name="back"></uc-icon>
254
+ </button>
255
+ <div>
256
+ <uc-icon set="@name: activityIcon"></uc-icon>
257
+ <span>{{activityCaption}}</span>
258
+ </div>
253
259
  <button
254
260
  type="button"
255
261
  class="uc-mini-btn uc-close-btn"
@@ -263,15 +269,12 @@ ExternalSource.template = /* HTML */ `
263
269
  <div ref="iframeWrapper" class="uc-iframe-wrapper"></div>
264
270
  <div class="uc-toolbar">
265
271
  <button type="button" class="uc-cancel-btn uc-secondary-btn" set="onclick: onCancel" l10n="cancel"></button>
266
- <div set="@hidden: !showSelectionStatus" class="uc-selection-status-box">
267
- <span>{{counterText}}</span>
268
- <button type="button" set="onclick: onSelectAll; @hidden: !couldSelectAll" l10n="select-all"></button>
269
- <button type="button" set="onclick: onDeselectAll; @hidden: !couldDeselectAll" l10n="deselect-all"></button>
270
- </div>
272
+ <div></div>
273
+ <div set="@hidden: !multiple" class="uc-selected-counter"><span l10n="selected-count"></span>{{counter}}</div>
271
274
  <button
272
275
  type="button"
273
276
  class="uc-done-btn uc-primary-btn"
274
- set="onclick: onDone; @disabled: !isSelectionReady"
277
+ set="onclick: onDone; @disabled: !counter"
275
278
  l10n="done"
276
279
  ></button>
277
280
  </div>
@@ -0,0 +1,27 @@
1
+ /**
2
+ * @param {{
3
+ * textColor: string;
4
+ * backgroundColor: string;
5
+ * linkColor: string;
6
+ * linkColorHover: string;
7
+ * secondaryColor: string;
8
+ * secondaryHover: string;
9
+ * secondaryForegroundColor: string;
10
+ * fontFamily: string;
11
+ * fontSize: string;
12
+ * radius: string;
13
+ * }} options
14
+ */
15
+ export function buildStyles({ textColor, backgroundColor, linkColor, linkColorHover, secondaryColor, secondaryHover, secondaryForegroundColor, fontFamily, fontSize, radius, }: {
16
+ textColor: string;
17
+ backgroundColor: string;
18
+ linkColor: string;
19
+ linkColorHover: string;
20
+ secondaryColor: string;
21
+ secondaryHover: string;
22
+ secondaryForegroundColor: string;
23
+ fontFamily: string;
24
+ fontSize: string;
25
+ radius: string;
26
+ }): string;
27
+ //# sourceMappingURL=buildStyles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildStyles.d.ts","sourceRoot":"","sources":["buildStyles.js"],"names":[],"mappings":"AAkBA;;;;;;;;;;;;;GAaG;AACH,gLAbW;IACV,SAAa,EAAE,MAAM,CAAC;IACtB,eAAmB,EAAE,MAAM,CAAC;IAC5B,SAAa,EAAE,MAAM,CAAC;IACtB,cAAkB,EAAE,MAAM,CAAC;IAC3B,cAAkB,EAAE,MAAM,CAAC;IAC3B,cAAkB,EAAE,MAAM,CAAC;IAC3B,wBAA4B,EAAE,MAAM,CAAC;IACrC,UAAc,EAAE,MAAM,CAAC;IACvB,QAAY,EAAE,MAAM,CAAC;IACrB,MAAU,EAAE,MAAM,CAAC;CAChB,UAsGH"}
@@ -0,0 +1,133 @@
1
+ // @ts-check
2
+
3
+ /**
4
+ * @param {Record<string, Record<string, string>>} style
5
+ * @returns
6
+ */
7
+ const styleToCss = (style) => {
8
+ const css = Object.keys(style).reduce((acc, selector) => {
9
+ const propertiesObj = style[selector];
10
+ const propertiesStr = Object.keys(propertiesObj).reduce((acc, prop) => {
11
+ const value = propertiesObj[prop];
12
+ return acc + `${prop}: ${value};`;
13
+ }, '');
14
+ return acc + `${selector}{${propertiesStr}}`;
15
+ }, '');
16
+ return css;
17
+ };
18
+
19
+ /**
20
+ * @param {{
21
+ * textColor: string;
22
+ * backgroundColor: string;
23
+ * linkColor: string;
24
+ * linkColorHover: string;
25
+ * secondaryColor: string;
26
+ * secondaryHover: string;
27
+ * secondaryForegroundColor: string;
28
+ * fontFamily: string;
29
+ * fontSize: string;
30
+ * radius: string;
31
+ * }} options
32
+ */
33
+ export function buildStyles({
34
+ textColor,
35
+ backgroundColor,
36
+ linkColor,
37
+ linkColorHover,
38
+ secondaryColor,
39
+ secondaryHover,
40
+ secondaryForegroundColor,
41
+ fontFamily,
42
+ fontSize,
43
+ radius,
44
+ }) {
45
+ const border = `solid 1px ${secondaryColor}`;
46
+
47
+ // TODO: we need to update source source styles, add css custom properties to control theme
48
+ return styleToCss({
49
+ body: {
50
+ color: textColor,
51
+ 'background-color': backgroundColor,
52
+ 'font-family': fontFamily,
53
+ 'font-size': fontSize,
54
+ },
55
+ '.side-bar': {
56
+ background: 'inherit',
57
+ 'border-right': border,
58
+ },
59
+ '.main-content': {
60
+ background: 'inherit',
61
+ },
62
+ '.main-content-header': {
63
+ background: 'inherit',
64
+ },
65
+ '.main-content-footer': {
66
+ background: 'inherit',
67
+ },
68
+ '.list-table-row': {
69
+ color: 'inherit',
70
+ },
71
+ '.list-table-row:hover': {
72
+ background: secondaryColor,
73
+ },
74
+ '.list-table-row .list-table-cell-a, .list-table-row .list-table-cell-b': {
75
+ 'border-top': border,
76
+ },
77
+ '.list-table-body .list-items': {
78
+ 'border-bottom': border,
79
+ },
80
+ '.bread-crumbs a': {
81
+ color: linkColor,
82
+ },
83
+ '.bread-crumbs a:hover': {
84
+ color: linkColorHover,
85
+ },
86
+ '.main-content.loading': {
87
+ background: `${backgroundColor} url(/static/images/loading_spinner.gif) center no-repeat`,
88
+ 'background-size': '25px 25px',
89
+ },
90
+ '.list-icons-item': {
91
+ 'background-color': secondaryColor,
92
+ },
93
+ '.source-gdrive .side-bar-menu a, .source-gphotos .side-bar-menu a': {
94
+ color: linkColor,
95
+ },
96
+ '.source-gdrive .side-bar-menu a, .source-gphotos .side-bar-menu a:hover': {
97
+ color: linkColorHover,
98
+ },
99
+ '.side-bar-menu a': {
100
+ color: linkColor,
101
+ },
102
+ '.side-bar-menu a:hover': {
103
+ color: linkColorHover,
104
+ },
105
+ '.source-gdrive .side-bar-menu .current, .source-gdrive .side-bar-menu a:hover, .source-gphotos .side-bar-menu .current, .source-gphotos .side-bar-menu a:hover':
106
+ {
107
+ color: linkColorHover,
108
+ },
109
+ '.source-vk .side-bar-menu a': {
110
+ color: linkColor,
111
+ },
112
+ '.source-vk .side-bar-menu a:hover': {
113
+ color: linkColorHover,
114
+ background: 'none',
115
+ },
116
+ 'input[type=submit], .button, button': {
117
+ color: secondaryForegroundColor,
118
+ background: secondaryColor,
119
+ 'box-shadow': 'none',
120
+ border: 'none',
121
+ 'border-radius': radius,
122
+ },
123
+ 'input[type=submit]:hover, .button:hover, button:hover': {
124
+ background: secondaryHover,
125
+ },
126
+ '.text-field, input[type=search], input[type=text], input[type=url], textarea': {
127
+ color: secondaryForegroundColor,
128
+ 'border-radius': radius,
129
+ background: secondaryColor,
130
+ border,
131
+ },
132
+ });
133
+ }
@@ -5,12 +5,15 @@ uc-external-source {
5
5
  height: 100%;
6
6
  background-color: var(--uc-background);
7
7
  overflow: hidden;
8
- position: relative;
9
8
  }
10
9
 
11
- [uc-modal] > dialog:has(uc-external-source[active]) {
12
- width: 100%;
13
- height: 100%;
10
+ [uc-modal] uc-external-source {
11
+ width: min(
12
+ calc(var(--uc-dialog-max-width) - var(--uc-padding) * 2),
13
+ calc(var(--uc-dialog-max-width) - var(--uc-padding) * 2)
14
+ );
15
+ height: var(--modal-content-height-fill, 100%);
16
+ max-height: var(--modal-max-content-height);
14
17
  }
15
18
 
16
19
  uc-external-source > .uc-content {
@@ -20,6 +23,13 @@ uc-external-source > .uc-content {
20
23
  grid-template-rows: 1fr min-content;
21
24
  }
22
25
 
26
+ @media only screen and (max-width: 430px) {
27
+ uc-external-source {
28
+ width: calc(100vw - var(--uc-padding) * 2);
29
+ height: var(--modal-content-height-fill, 100%);
30
+ }
31
+ }
32
+
23
33
  uc-external-source iframe {
24
34
  display: block;
25
35
  width: 100%;
@@ -32,11 +42,11 @@ uc-external-source .uc-iframe-wrapper {
32
42
  }
33
43
 
34
44
  uc-external-source .uc-toolbar {
35
- display: flex;
36
- width: 100%;
45
+ display: grid;
37
46
  grid-gap: var(--uc-padding);
47
+ grid-template-columns: max-content 1fr max-content max-content;
38
48
  align-items: center;
39
- justify-content: space-between;
49
+ width: 100%;
40
50
  padding: var(--uc-padding);
41
51
  border-top: 1px solid var(--uc-border);
42
52
  }
@@ -45,36 +55,11 @@ uc-external-source .uc-back-btn {
45
55
  padding-left: 0;
46
56
  }
47
57
 
48
- uc-external-source .uc-selection-status-box {
49
- color: var(--uc-foreground);
58
+ uc-external-source .uc-selected-counter {
50
59
  display: flex;
51
- flex-direction: column;
60
+ grid-gap: var(--uc-padding);
52
61
  align-items: center;
53
- justify-content: center;
54
- }
55
-
56
- uc-external-source .uc-selection-status-box button {
57
- color: var(--uc-primary);
58
- height: auto;
59
- padding: 0;
60
- background: none;
61
- }
62
-
63
- uc-external-source .uc-selection-status-box button:hover {
64
- text-decoration: underline;
65
- }
66
-
67
- uc-external-source uc-activity-header {
68
- position: absolute;
69
- width: 100%;
70
- justify-content: flex-end;
71
- z-index: 1;
72
- left: 0;
73
- top: 0;
74
- right: 0;
75
- pointer-events: none;
76
- }
77
-
78
- uc-external-source uc-activity-header .uc-close-btn {
79
- pointer-events: auto;
62
+ justify-content: space-between;
63
+ padding: var(--uc-padding);
64
+ color: var(--uc-muted-foreground);
80
65
  }
@@ -0,0 +1,3 @@
1
+ export function registerMessage(type: any, sender: any, callback: any): void;
2
+ export function unregisterMessage(type: any, sender: any): void;
3
+ //# sourceMappingURL=messages.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["messages.js"],"names":[],"mappings":"AAoBA,6EAMC;AAED,gEAIC"}
@@ -0,0 +1,35 @@
1
+ let cbMapping = {};
2
+
3
+ window.addEventListener('message', (e) => {
4
+ let message;
5
+ try {
6
+ message = JSON.parse(e.data);
7
+ } catch (err) {
8
+ return;
9
+ }
10
+
11
+ if (message?.type in cbMapping) {
12
+ let cbList = cbMapping[message.type];
13
+ for (let [sender, callback] of cbList) {
14
+ if (e.source === sender) {
15
+ callback(message);
16
+ }
17
+ }
18
+ }
19
+ });
20
+
21
+ const registerMessage = function (type, sender, callback) {
22
+ if (!(type in cbMapping)) {
23
+ cbMapping[type] = [];
24
+ }
25
+
26
+ cbMapping[type].push([sender, callback]);
27
+ };
28
+
29
+ const unregisterMessage = function (type, sender) {
30
+ if (type in cbMapping) {
31
+ cbMapping[type] = cbMapping[type].filter((item) => item[0] !== sender);
32
+ }
33
+ };
34
+
35
+ export { registerMessage, unregisterMessage };
@@ -0,0 +1,22 @@
1
+ export class LocalEditorImage extends UploaderBlock {
2
+ activityType: any;
3
+ /**
4
+ * @private
5
+ * @type {import('../../abstract/TypedData.js').TypedData | undefined}
6
+ */
7
+ private _entry;
8
+ /**
9
+ * @private
10
+ * @type {undefined}
11
+ */
12
+ private _instance;
13
+ get activityParams(): import("../CloudImageEditorActivity/CloudImageEditorActivity.js").ActivityParams;
14
+ mounted(): void;
15
+ _applyButton(): void;
16
+ unmounted(): void;
17
+ }
18
+ export namespace LocalEditorImage {
19
+ let template: string;
20
+ }
21
+ import { UploaderBlock } from '../../abstract/UploaderBlock.js';
22
+ //# sourceMappingURL=LocalEditorImage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LocalEditorImage.d.ts","sourceRoot":"","sources":["LocalEditorImage.js"],"names":[],"mappings":"AAoCA;IAGE,kBAA2D;IAE3D;;;OAGG;IACH,eAAO;IAEP;;;OAGG;IACH,kBAAU;IAEV,uGAMC;IAYD,gBA2BC;IAED,qBA4BC;IAED,kBAKC;CACF;;;;8BAtI6B,iCAAiC"}