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

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 (125) hide show
  1. package/blocks/CameraSource/CameraSource.d.ts.map +1 -1
  2. package/blocks/CameraSource/CameraSource.js +9 -20
  3. package/blocks/CameraSource/camera-source.css +4 -16
  4. package/blocks/CloudImageEditorActivity/index.css +3 -3
  5. package/blocks/Config/Config.d.ts +3 -3
  6. package/blocks/Config/Config.d.ts.map +1 -1
  7. package/blocks/Config/Config.js +2 -2
  8. package/blocks/Config/initialConfig.js +3 -3
  9. package/blocks/Config/normalizeConfigValue.js +3 -3
  10. package/blocks/ExternalSource/ExternalSource.d.ts +20 -50
  11. package/blocks/ExternalSource/ExternalSource.d.ts.map +1 -1
  12. package/blocks/ExternalSource/ExternalSource.js +96 -99
  13. package/blocks/ExternalSource/MessageBridge.d.ts +20 -0
  14. package/blocks/ExternalSource/MessageBridge.d.ts.map +1 -0
  15. package/blocks/ExternalSource/MessageBridge.js +71 -0
  16. package/blocks/ExternalSource/buildThemeDefinition.d.ts +3 -0
  17. package/blocks/ExternalSource/buildThemeDefinition.d.ts.map +1 -0
  18. package/blocks/ExternalSource/buildThemeDefinition.js +47 -0
  19. package/blocks/ExternalSource/external-source.css +37 -22
  20. package/blocks/ExternalSource/types.d.ts +113 -0
  21. package/blocks/ExternalSource/types.d.ts.map +1 -0
  22. package/blocks/ExternalSource/types.js +143 -0
  23. package/blocks/Modal/Modal.d.ts.map +1 -1
  24. package/blocks/Modal/Modal.js +4 -11
  25. package/blocks/Modal/modal.css +3 -54
  26. package/blocks/StartFrom/start-from.css +2 -6
  27. package/blocks/UploadList/upload-list.css +1 -11
  28. package/blocks/UrlSource/url-source.css +0 -8
  29. package/blocks/themes/uc-basic/theme.css +2 -3
  30. package/index.ssr.d.ts.map +1 -1
  31. package/index.ssr.js +10 -14
  32. package/locales/file-uploader/ar.d.ts +2 -0
  33. package/locales/file-uploader/ar.js +3 -1
  34. package/locales/file-uploader/az.d.ts +2 -0
  35. package/locales/file-uploader/az.js +3 -1
  36. package/locales/file-uploader/ca.d.ts +2 -0
  37. package/locales/file-uploader/ca.js +3 -1
  38. package/locales/file-uploader/cs.d.ts +2 -0
  39. package/locales/file-uploader/cs.js +3 -1
  40. package/locales/file-uploader/da.d.ts +2 -0
  41. package/locales/file-uploader/da.js +3 -1
  42. package/locales/file-uploader/de.d.ts +2 -0
  43. package/locales/file-uploader/de.js +2 -0
  44. package/locales/file-uploader/el.d.ts +2 -0
  45. package/locales/file-uploader/el.js +3 -1
  46. package/locales/file-uploader/en.d.ts +2 -0
  47. package/locales/file-uploader/en.js +3 -1
  48. package/locales/file-uploader/es.d.ts +2 -0
  49. package/locales/file-uploader/es.js +2 -0
  50. package/locales/file-uploader/et.d.ts +2 -0
  51. package/locales/file-uploader/et.js +3 -1
  52. package/locales/file-uploader/fi.d.ts +2 -0
  53. package/locales/file-uploader/fi.js +120 -118
  54. package/locales/file-uploader/fr.d.ts +2 -0
  55. package/locales/file-uploader/fr.js +2 -0
  56. package/locales/file-uploader/he.d.ts +2 -0
  57. package/locales/file-uploader/he.js +2 -0
  58. package/locales/file-uploader/hy.d.ts +2 -0
  59. package/locales/file-uploader/hy.js +3 -1
  60. package/locales/file-uploader/is.d.ts +2 -0
  61. package/locales/file-uploader/is.js +3 -1
  62. package/locales/file-uploader/it.d.ts +2 -0
  63. package/locales/file-uploader/it.js +2 -0
  64. package/locales/file-uploader/ja.d.ts +2 -0
  65. package/locales/file-uploader/ja.js +3 -1
  66. package/locales/file-uploader/ka.d.ts +2 -0
  67. package/locales/file-uploader/ka.js +3 -1
  68. package/locales/file-uploader/kk.d.ts +2 -0
  69. package/locales/file-uploader/kk.js +3 -1
  70. package/locales/file-uploader/ko.d.ts +2 -0
  71. package/locales/file-uploader/ko.js +3 -1
  72. package/locales/file-uploader/lv.d.ts +2 -0
  73. package/locales/file-uploader/lv.js +3 -1
  74. package/locales/file-uploader/nb.d.ts +2 -0
  75. package/locales/file-uploader/nb.js +3 -1
  76. package/locales/file-uploader/nl.d.ts +2 -0
  77. package/locales/file-uploader/nl.js +3 -1
  78. package/locales/file-uploader/pl.d.ts +2 -0
  79. package/locales/file-uploader/pl.js +3 -1
  80. package/locales/file-uploader/pt.d.ts +2 -0
  81. package/locales/file-uploader/pt.js +3 -1
  82. package/locales/file-uploader/ro.d.ts +2 -0
  83. package/locales/file-uploader/ro.js +3 -1
  84. package/locales/file-uploader/ru.d.ts +2 -0
  85. package/locales/file-uploader/ru.js +2 -0
  86. package/locales/file-uploader/sk.d.ts +2 -0
  87. package/locales/file-uploader/sk.js +3 -1
  88. package/locales/file-uploader/sr.d.ts +2 -0
  89. package/locales/file-uploader/sr.js +3 -1
  90. package/locales/file-uploader/sv.d.ts +2 -0
  91. package/locales/file-uploader/sv.js +3 -1
  92. package/locales/file-uploader/tr.d.ts +2 -0
  93. package/locales/file-uploader/tr.js +2 -0
  94. package/locales/file-uploader/uk.d.ts +2 -0
  95. package/locales/file-uploader/uk.js +2 -0
  96. package/locales/file-uploader/vi.d.ts +2 -0
  97. package/locales/file-uploader/vi.js +3 -1
  98. package/locales/file-uploader/zh-TW.d.ts +2 -0
  99. package/locales/file-uploader/zh-TW.js +2 -0
  100. package/locales/file-uploader/zh.d.ts +2 -0
  101. package/locales/file-uploader/zh.js +2 -0
  102. package/package.json +2 -4
  103. package/types/exported.d.ts +3 -3
  104. package/web/file-uploader.iife.min.js +4 -4
  105. package/web/file-uploader.min.js +4 -4
  106. package/web/uc-basic.min.css +1 -1
  107. package/web/uc-cloud-image-editor.min.css +1 -1
  108. package/web/uc-cloud-image-editor.min.js +4 -4
  109. package/web/uc-file-uploader-inline.min.css +1 -1
  110. package/web/uc-file-uploader-inline.min.js +4 -4
  111. package/web/uc-file-uploader-minimal.min.css +1 -1
  112. package/web/uc-file-uploader-minimal.min.js +2 -2
  113. package/web/uc-file-uploader-regular.min.css +1 -1
  114. package/web/uc-file-uploader-regular.min.js +4 -4
  115. package/web/uc-img.min.js +1 -1
  116. package/blocks/ExternalSource/buildStyles.d.ts +0 -27
  117. package/blocks/ExternalSource/buildStyles.d.ts.map +0 -1
  118. package/blocks/ExternalSource/buildStyles.js +0 -133
  119. package/blocks/ExternalSource/messages.d.ts +0 -3
  120. package/blocks/ExternalSource/messages.d.ts.map +0 -1
  121. package/blocks/ExternalSource/messages.js +0 -35
  122. package/blocks/LocalEditorImage/LocalEditorImage.d.ts +0 -22
  123. package/blocks/LocalEditorImage/LocalEditorImage.d.ts.map +0 -1
  124. package/blocks/LocalEditorImage/LocalEditorImage.js +0 -139
  125. package/blocks/LocalEditorImage/localEditorImage.css +0 -19
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MessageBridge.d.ts","sourceRoot":"","sources":["MessageBridge.js"],"names":[],"mappings":"AAgBA;IAOE,8BAA8B;IAC9B,qBADY,MAAM,EAKjB;IAXD,0GAA0G;IAC1G,aADW,IAAI,MAAM,EAAE,IAAI,OAAO,SAAS,EAAE,mBAAmB,CAAC,OAAO,SAAS,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAC9E;IAExB,qBAAqB;IACrB,UADW,MAAM,CACR;IAST,8BAA8B;IAC9B,oBADY,YAAY,UAgBtB;IAEF;;;;OAIG;IACH,wGAOC;IAED,uDAAuD;IACvD,cADY,OAAO,SAAS,EAAE,aAAa,QAG1C;IAED,gBAEC;CACF"}
@@ -0,0 +1,71 @@
1
+ /** @type {import('./types').InputMessageType[]} */
2
+ const MESSAGE_TYPE_WHITELIST = ['selected-files-change'];
3
+
4
+ /**
5
+ * @param {unknown} message
6
+ * @returns {message is import("./types").InputMessageMap[import("./types").InputMessageType]}
7
+ */
8
+ const isWhitelistedMessage = (message) => {
9
+ if (!message) return false;
10
+ if (typeof message !== 'object') return false;
11
+ return (
12
+ 'type' in message &&
13
+ MESSAGE_TYPE_WHITELIST.includes(/** @type {import('./types').InputMessageType} */ (message.type))
14
+ );
15
+ };
16
+
17
+ export class MessageBridge {
18
+ /** @type {Map<string, Set<import('./types').InputMessageHandler<import('./types').InputMessageType>>>} */
19
+ _handlerMap = new Map();
20
+
21
+ /** @type {Window} */
22
+ _context;
23
+
24
+ /** @param {Window} context */
25
+ constructor(context) {
26
+ this._context = context;
27
+
28
+ window.addEventListener('message', this._handleMessage);
29
+ }
30
+
31
+ /** @param {MessageEvent} e */
32
+ _handleMessage = (e) => {
33
+ if (e.source !== this._context) {
34
+ return;
35
+ }
36
+ const message = e.data;
37
+ if (!isWhitelistedMessage(message)) {
38
+ return;
39
+ }
40
+
41
+ const handlers = this._handlerMap.get(message.type);
42
+ if (handlers) {
43
+ for (const handler of handlers) {
44
+ handler(message);
45
+ }
46
+ }
47
+ };
48
+
49
+ /**
50
+ * @template {import('./types').InputMessageType} T
51
+ * @param {T} type
52
+ * @param {import('./types').InputMessageHandler<T>} handler
53
+ */
54
+ on(type, handler) {
55
+ const handlers = this._handlerMap.get(type) ?? new Set();
56
+ if (!this._handlerMap.has(type)) {
57
+ this._handlerMap.set(type, handlers);
58
+ }
59
+
60
+ handlers.add(/** @type {import('./types').InputMessageHandler<import('./types').InputMessageType>} */ (handler));
61
+ }
62
+
63
+ /** @param {import('./types').OutputMessage} message */
64
+ send(message) {
65
+ this._context.postMessage(message, '*');
66
+ }
67
+
68
+ destroy() {
69
+ window.removeEventListener('message', this._handleMessage);
70
+ }
71
+ }
@@ -0,0 +1,3 @@
1
+ /** @param {HTMLElement} element */
2
+ export function buildThemeDefinition(element: HTMLElement): Record<keyof import("./types.js").ThemeDefinition, string>;
3
+ //# sourceMappingURL=buildThemeDefinition.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildThemeDefinition.d.ts","sourceRoot":"","sources":["buildThemeDefinition.js"],"names":[],"mappings":"AAqCA,mCAAmC;AACnC,8CADY,WAAW,8DAStB"}
@@ -0,0 +1,47 @@
1
+ // @ts-check
2
+
3
+ /**
4
+ * @param {HTMLElement} element
5
+ * @param {string} propName
6
+ */
7
+ function getCssValue(element, propName) {
8
+ let style = window.getComputedStyle(element);
9
+ return style.getPropertyValue(propName).trim();
10
+ }
11
+
12
+ const ucCustomProperties = /** @type {(keyof import('./types.js').ThemeDefinition)[]} */ ([
13
+ '--uc-font-family',
14
+ '--uc-font-size',
15
+ '--uc-line-height',
16
+ '--uc-button-size',
17
+ '--uc-preview-size',
18
+ '--uc-input-size',
19
+ '--uc-padding',
20
+ '--uc-radius',
21
+ '--uc-transition',
22
+ '--uc-background',
23
+ '--uc-foreground',
24
+ '--uc-primary',
25
+ '--uc-primary-hover',
26
+ '--uc-primary-transparent',
27
+ '--uc-primary-foreground',
28
+ '--uc-secondary',
29
+ '--uc-secondary-hover',
30
+ '--uc-secondary-foreground',
31
+ '--uc-muted',
32
+ '--uc-muted-foreground',
33
+ '--uc-destructive',
34
+ '--uc-destructive-foreground',
35
+ '--uc-border',
36
+ ]);
37
+
38
+ /** @param {HTMLElement} element */
39
+ export function buildThemeDefinition(element) {
40
+ return ucCustomProperties.reduce((acc, prop) => {
41
+ const value = getCssValue(element, prop);
42
+ if (value) {
43
+ acc[prop] = value;
44
+ }
45
+ return acc;
46
+ }, /** @type {Record<keyof import('./types.js').ThemeDefinition, string>} */ ({}));
47
+ }
@@ -5,15 +5,12 @@ uc-external-source {
5
5
  height: 100%;
6
6
  background-color: var(--uc-background);
7
7
  overflow: hidden;
8
+ position: relative;
8
9
  }
9
10
 
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);
11
+ [uc-modal] > dialog:has(uc-external-source[active]) {
12
+ width: 100%;
13
+ height: 100%;
17
14
  }
18
15
 
19
16
  uc-external-source > .uc-content {
@@ -23,13 +20,6 @@ uc-external-source > .uc-content {
23
20
  grid-template-rows: 1fr min-content;
24
21
  }
25
22
 
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
-
33
23
  uc-external-source iframe {
34
24
  display: block;
35
25
  width: 100%;
@@ -42,11 +32,11 @@ uc-external-source .uc-iframe-wrapper {
42
32
  }
43
33
 
44
34
  uc-external-source .uc-toolbar {
45
- display: grid;
35
+ display: flex;
36
+ width: 100%;
46
37
  grid-gap: var(--uc-padding);
47
- grid-template-columns: max-content 1fr max-content max-content;
48
38
  align-items: center;
49
- width: 100%;
39
+ justify-content: space-between;
50
40
  padding: var(--uc-padding);
51
41
  border-top: 1px solid var(--uc-border);
52
42
  }
@@ -55,11 +45,36 @@ uc-external-source .uc-back-btn {
55
45
  padding-left: 0;
56
46
  }
57
47
 
58
- uc-external-source .uc-selected-counter {
48
+ uc-external-source .uc-selection-status-box {
49
+ color: var(--uc-foreground);
59
50
  display: flex;
60
- grid-gap: var(--uc-padding);
51
+ flex-direction: column;
61
52
  align-items: center;
62
- justify-content: space-between;
63
- padding: var(--uc-padding);
64
- color: var(--uc-muted-foreground);
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;
65
80
  }
@@ -0,0 +1,113 @@
1
+ export type InstagramInfo = {
2
+ caption?: string | null;
3
+ created: number;
4
+ id: string;
5
+ public_page?: string;
6
+ username: string;
7
+ size?: number;
8
+ name?: string;
9
+ modified?: number;
10
+ };
11
+ export type DoneSuccessResponse = {
12
+ error?: undefined;
13
+ info?: InstagramInfo;
14
+ alternatives?: Record<string, string>;
15
+ is_image?: boolean | null;
16
+ filename?: string;
17
+ obj_type: 'selected_file';
18
+ url: string;
19
+ };
20
+ export type InputMessageMap = {
21
+ 'selected-files-change': {
22
+ type: 'selected-files-change';
23
+ total: number;
24
+ selectedCount: number;
25
+ } & ({
26
+ isReady: false;
27
+ isMultipleMode: boolean;
28
+ selectedFiles: undefined;
29
+ } | {
30
+ isReady: true;
31
+ isMultipleMode: true;
32
+ selectedFiles: DoneSuccessResponse[];
33
+ } | {
34
+ isReady: true;
35
+ isMultipleMode: false;
36
+ selectedFiles: [DoneSuccessResponse] | [];
37
+ });
38
+ };
39
+ export type InputMessageType = keyof InputMessageMap;
40
+ export type InputMessage = InputMessageMap[InputMessageType];
41
+ export type InputMessageHandler<T extends "selected-files-change"> = (message: import('./types').InputMessageMap[T]) => void;
42
+ export type ThemeDefinition = {
43
+ '--uc-font-family': string;
44
+ '--uc-font-size': string;
45
+ '--uc-line-height': string;
46
+ '--uc-button-size': string;
47
+ '--uc-preview-size': string;
48
+ '--uc-input-size': string;
49
+ '--uc-padding': string;
50
+ '--uc-radius': string;
51
+ '--uc-transition': string;
52
+ '--uc-background': string;
53
+ '--uc-foreground': string;
54
+ '--uc-primary': string;
55
+ '--uc-primary-hover': string;
56
+ '--uc-primary-transparent': string;
57
+ '--uc-primary-foreground': string;
58
+ '--uc-secondary': string;
59
+ '--uc-secondary-hover': string;
60
+ '--uc-secondary-foreground': string;
61
+ '--uc-muted': string;
62
+ '--uc-muted-foreground': string;
63
+ '--uc-destructive': string;
64
+ '--uc-destructive-foreground': string;
65
+ '--uc-border': string;
66
+ '--uc-primary-rgb-light': string;
67
+ '--uc-primary-light': string;
68
+ '--uc-primary-hover-light': string;
69
+ '--uc-primary-transparent-light': string;
70
+ '--uc-background-light': string;
71
+ '--uc-foreground-light': string;
72
+ '--uc-primary-foreground-light': string;
73
+ '--uc-secondary-light': string;
74
+ '--uc-secondary-hover-light': string;
75
+ '--uc-secondary-foreground-light': string;
76
+ '--uc-muted-light': string;
77
+ '--uc-muted-foreground-light': string;
78
+ '--uc-destructive-light': string;
79
+ '--uc-destructive-foreground-light': string;
80
+ '--uc-border-light': string;
81
+ '--uc-primary-rgb-dark': string;
82
+ '--uc-primary-dark': string;
83
+ '--uc-primary-hover-dark': string;
84
+ '--uc-primary-transparent-dark': string;
85
+ '--uc-background-dark': string;
86
+ '--uc-foreground-dark': string;
87
+ '--uc-primary-foreground-dark': string;
88
+ '--uc-secondary-dark': string;
89
+ '--uc-secondary-hover-dark': string;
90
+ '--uc-secondary-foreground-dark': string;
91
+ '--uc-muted-dark': string;
92
+ '--uc-muted-foreground-dark': string;
93
+ '--uc-destructive-dark': string;
94
+ '--uc-destructive-foreground-dark': string;
95
+ '--uc-border-dark': string;
96
+ '--uc-primary-oklch-light': string;
97
+ '--uc-primary-oklch-dark': string;
98
+ };
99
+ export type OutputMessage = {
100
+ type: 'select-all';
101
+ } | {
102
+ type: 'deselect-all';
103
+ } | {
104
+ type: 'set-theme-definition';
105
+ theme: Record<string, string>;
106
+ } | {
107
+ type: 'set-locale-definition';
108
+ localeDefinition: string;
109
+ } | {
110
+ type: 'set-embed-css';
111
+ css: Partial<ThemeDefinition>;
112
+ };
113
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["types.js"],"names":[],"mappings":"4BAGa;IACZ,OAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,OAAW,EAAE,MAAM,CAAC;IACpB,EAAM,EAAE,MAAM,CAAC;IACf,WAAe,CAAC,EAAE,MAAM,CAAC;IACzB,QAAY,EAAE,MAAM,CAAC;IACrB,IAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAY,CAAC,EAAE,MAAM,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E,MAAM,CAAC;IACxC,gCAAoC,EAAE,MAAM,CAAC;IAC7C,iBAAqB,EAAE,MAAM,CAAC;IAC9B,4BAAgC,EAAE,MAAM,CAAC;IACzC,uBAA2B,EAAE,MAAM,CAAC;IACpC,kCAAsC,EAAE,MAAM,CAAC;IAC/C,kBAAsB,EAAE,MAAM,CAAC;IAC/B,0BAA8B,EAAE,MAAM,CAAC;IACvC,yBAA6B,EAAE,MAAM,CAAC;CACnC;4BAIS;IACZ,IAAY,EAAE,YAAY,CAAC;CACpB,GACD;IACN,IAAY,EAAE,cAAc,CAAC;CACtB,GACD;IACN,IAAY,EAAE,sBAAsB,CAAC;IACrC,KAAa,EAAE,OAAO,MAAM,EAAE,MAAM,CAAC,CAAC;CAC/B,GACD;IACN,IAAY,EAAE,uBAAuB,CAAC;IACtC,gBAAwB,EAAE,MAAM,CAAC;CAC1B,GACD;IACN,IAAY,EAAE,eAAe,CAAC;IAC9B,GAAW,EAAE,QAAQ,eAAe,CAAC,CAAC;CAC/B"}
@@ -0,0 +1,143 @@
1
+ // @ts-check
2
+
3
+ /**
4
+ * @typedef {{
5
+ * caption?: string | null;
6
+ * created: number;
7
+ * id: string;
8
+ * public_page?: string;
9
+ * username: string;
10
+ * size?: number;
11
+ * name?: string;
12
+ * modified?: number;
13
+ * }} InstagramInfo
14
+ */
15
+
16
+ /**
17
+ * @typedef {{
18
+ * error?: undefined;
19
+ * info?: InstagramInfo;
20
+ * alternatives?: Record<string, string>;
21
+ * is_image?: boolean | null;
22
+ * filename?: string;
23
+ * obj_type: 'selected_file';
24
+ * url: string;
25
+ * }} DoneSuccessResponse
26
+ */
27
+
28
+ /**
29
+ * @typedef {{
30
+ * 'selected-files-change': {
31
+ * type: 'selected-files-change';
32
+ * total: number;
33
+ * selectedCount: number;
34
+ * } & (
35
+ * | {
36
+ * isReady: false;
37
+ * isMultipleMode: boolean;
38
+ * selectedFiles: undefined;
39
+ * }
40
+ * | {
41
+ * isReady: true;
42
+ * isMultipleMode: true;
43
+ * selectedFiles: DoneSuccessResponse[];
44
+ * }
45
+ * | {
46
+ * isReady: true;
47
+ * isMultipleMode: false;
48
+ * selectedFiles: [DoneSuccessResponse] | [];
49
+ * }
50
+ * );
51
+ * }} InputMessageMap
52
+ */
53
+
54
+ /** @typedef {keyof InputMessageMap} InputMessageType */
55
+ /** @typedef {InputMessageMap[InputMessageType]} InputMessage */
56
+
57
+ /**
58
+ * @template {import('./types').InputMessageType} T
59
+ * @typedef {(message: import('./types').InputMessageMap[T]) => void} InputMessageHandler
60
+ */
61
+
62
+ /**
63
+ * @typedef {{
64
+ * '--uc-font-family': string;
65
+ * '--uc-font-size': string;
66
+ * '--uc-line-height': string;
67
+ * '--uc-button-size': string;
68
+ * '--uc-preview-size': string;
69
+ * '--uc-input-size': string;
70
+ * '--uc-padding': string;
71
+ * '--uc-radius': string;
72
+ * '--uc-transition': string;
73
+ * '--uc-background': string;
74
+ * '--uc-foreground': string;
75
+ * '--uc-primary': string;
76
+ * '--uc-primary-hover': string;
77
+ * '--uc-primary-transparent': string;
78
+ * '--uc-primary-foreground': string;
79
+ * '--uc-secondary': string;
80
+ * '--uc-secondary-hover': string;
81
+ * '--uc-secondary-foreground': string;
82
+ * '--uc-muted': string;
83
+ * '--uc-muted-foreground': string;
84
+ * '--uc-destructive': string;
85
+ * '--uc-destructive-foreground': string;
86
+ * '--uc-border': string;
87
+ * '--uc-primary-rgb-light': string;
88
+ * '--uc-primary-light': string;
89
+ * '--uc-primary-hover-light': string;
90
+ * '--uc-primary-transparent-light': string;
91
+ * '--uc-background-light': string;
92
+ * '--uc-foreground-light': string;
93
+ * '--uc-primary-foreground-light': string;
94
+ * '--uc-secondary-light': string;
95
+ * '--uc-secondary-hover-light': string;
96
+ * '--uc-secondary-foreground-light': string;
97
+ * '--uc-muted-light': string;
98
+ * '--uc-muted-foreground-light': string;
99
+ * '--uc-destructive-light': string;
100
+ * '--uc-destructive-foreground-light': string;
101
+ * '--uc-border-light': string;
102
+ * '--uc-primary-rgb-dark': string;
103
+ * '--uc-primary-dark': string;
104
+ * '--uc-primary-hover-dark': string;
105
+ * '--uc-primary-transparent-dark': string;
106
+ * '--uc-background-dark': string;
107
+ * '--uc-foreground-dark': string;
108
+ * '--uc-primary-foreground-dark': string;
109
+ * '--uc-secondary-dark': string;
110
+ * '--uc-secondary-hover-dark': string;
111
+ * '--uc-secondary-foreground-dark': string;
112
+ * '--uc-muted-dark': string;
113
+ * '--uc-muted-foreground-dark': string;
114
+ * '--uc-destructive-dark': string;
115
+ * '--uc-destructive-foreground-dark': string;
116
+ * '--uc-border-dark': string;
117
+ * '--uc-primary-oklch-light': string;
118
+ * '--uc-primary-oklch-dark': string;
119
+ * }} ThemeDefinition
120
+ */
121
+
122
+ /**
123
+ * @typedef {{
124
+ * type: 'select-all';
125
+ * }
126
+ * | {
127
+ * type: 'deselect-all';
128
+ * }
129
+ * | {
130
+ * type: 'set-theme-definition';
131
+ * theme: Record<string, string>;
132
+ * }
133
+ * | {
134
+ * type: 'set-locale-definition';
135
+ * localeDefinition: string;
136
+ * }
137
+ * | {
138
+ * type: 'set-embed-css';
139
+ * css: Partial<ThemeDefinition>;
140
+ * }} OutputMessage
141
+ */
142
+
143
+ export {};
@@ -1 +1 @@
1
- {"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["Modal.js"],"names":[],"mappings":"AAGA;IAEE,kCAAoC;IAIlC;;;;MAKC;IAGH,iCAEE;IAEF,yBAEE;IAEF,+BAEE;IAEF,uBAAuB;IACvB,4BADY,KAAK,UAIf;IAFA,eAAe;IACf,yBAAgC;IAGlC,uBAAuB;IACvB,0BADY,KAAK,UAKf;IAEF,aAMC;IAED,aAMC;CAuDF;;;;sBA9GqB,yBAAyB"}
1
+ {"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["Modal.js"],"names":[],"mappings":"AAGA;IAEE,kCAAoC;IAIlC;;;;MAKC;IAGH,iCAEE;IAEF,yBAEE;IAEF,+BAEE;IAEF,uBAAuB;IACvB,4BADY,KAAK,UAIf;IAFA,eAAe;IACf,yBAAgC;IAGlC,uBAAuB;IACvB,0BADY,KAAK,UAKf;IAEF,aAMC;IAED,aAMC;CAgDF;;;;sBAvGqB,yBAAyB"}
@@ -58,17 +58,10 @@ export class Modal extends Block {
58
58
 
59
59
  initCallback() {
60
60
  super.initCallback();
61
- if (typeof HTMLDialogElement === 'function') {
62
- this.ref.dialog.addEventListener('close', this._handleDialogClose);
63
- this.ref.dialog.addEventListener('mousedown', this._handleDialogMouseDown);
64
- this.ref.dialog.addEventListener('mouseup', this._handleDialogMouseUp);
65
- } else {
66
- this.setAttribute('dialog-fallback', '');
67
- let backdrop = document.createElement('div');
68
- backdrop.className = 'uc-backdrop';
69
- this.appendChild(backdrop);
70
- backdrop.addEventListener('click', this._handleBackdropClick);
71
- }
61
+
62
+ this.ref.dialog.addEventListener('close', this._handleDialogClose);
63
+ this.ref.dialog.addEventListener('mousedown', this._handleDialogMouseDown);
64
+ this.ref.dialog.addEventListener('mouseup', this._handleDialogMouseUp);
72
65
 
73
66
  this.sub('*modalActive', (modalActive) => {
74
67
  if (this.$.isOpen !== modalActive) {
@@ -1,46 +1,3 @@
1
- :where([uc-modal]) {
2
- --modal-max-content-height: calc(
3
- var(--uploadcare-blocks-window-height, 100vh) - 4 * var(--uc-padding) - var(--uc-button-size)
4
- );
5
- --modal-content-height-fill: var(--uploadcare-blocks-window-height, 100vh);
6
- }
7
-
8
- :where([uc-modal])[dialog-fallback] {
9
- --uc-z-max: 2147483647;
10
-
11
- position: fixed;
12
- z-index: var(--uc-z-max);
13
- display: flex;
14
- align-items: center;
15
- justify-content: center;
16
- width: 100vw;
17
- height: 100vh;
18
- pointer-events: none;
19
- inset: 0;
20
- }
21
-
22
- :where([uc-modal])[dialog-fallback] dialog[open] {
23
- z-index: var(--uc-z-max);
24
- pointer-events: auto;
25
- }
26
-
27
- :where([uc-modal])[dialog-fallback] dialog[open] + .uc-backdrop {
28
- position: fixed;
29
- top: 0px;
30
- left: 0px;
31
- z-index: calc(var(--uc-z-max) - 1);
32
- align-items: center;
33
- justify-content: center;
34
- width: 100vw;
35
- height: 100vh;
36
- background-color: oklch(0 0 0 / 0.1);
37
- pointer-events: auto;
38
- }
39
-
40
- :where([uc-modal])[strokes][dialog-fallback] dialog[open] + .uc-backdrop {
41
- background-image: var(--modal-backdrop-background-image);
42
- }
43
-
44
1
  @supports selector(dialog::backdrop) {
45
2
  :where([uc-modal]) > dialog::backdrop {
46
3
  /* backdrop don't inherit theme properties */
@@ -67,12 +24,10 @@
67
24
  :where([uc-modal]) > dialog {
68
25
  display: flex;
69
26
  flex-direction: column;
70
-
71
- /* there was `fit-content` but it doesn't reduce width after activity change */
72
- width: max-content;
73
- max-width: min(calc(100% - var(--uc-padding) * 2), calc(var(--uc-dialog-max-width) - var(--uc-padding) * 2));
27
+ width: min(var(--uc-dialog-width), 100%);
28
+ max-width: min(calc(100% - var(--uc-padding) * 2), var(--uc-dialog-max-width));
74
29
  min-height: var(--uc-button-size);
75
- max-height: calc(var(--uc-dialog-max-height) - var(--uc-padding) * 2);
30
+ max-height: min(calc(100% - var(--uc-padding) * 2), var(--uc-dialog-max-height));
76
31
  margin: auto;
77
32
  padding: 0;
78
33
  overflow: hidden;
@@ -88,9 +43,3 @@
88
43
  :where(.uc-contrast) :where([uc-modal]) > dialog {
89
44
  outline: 1px solid var(--uc-border);
90
45
  }
91
-
92
- @media only screen and (max-width: 430px), only screen and (max-height: 600px) {
93
- :where([uc-modal]) > dialog > .uc-content {
94
- height: var(--modal-max-content-height);
95
- }
96
- }
@@ -13,12 +13,8 @@ uc-start-from .uc-content {
13
13
  background-color: var(--uc-background);
14
14
  }
15
15
 
16
- [uc-modal] uc-start-from {
17
- width: min(
18
- calc(var(--uc-dialog-width) - var(--uc-padding) * 2),
19
- calc(var(--uc-dialog-max-width) - var(--uc-padding) * 2),
20
- calc(100vw - var(--uc-padding) * 2)
21
- );
16
+ [uc-modal] > dialog:has(uc-start-from[active]) {
17
+ width: var(--uc-dialog-width);
22
18
  }
23
19
 
24
20
  [uc-modal] uc-start-from uc-drop-area {
@@ -2,22 +2,12 @@ uc-upload-list {
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  width: 100%;
5
- height: 100%;
5
+ height: max-content;
6
6
  overflow: hidden;
7
7
  background-color: var(--uc-background);
8
8
  transition: opacity var(--uc-transition);
9
9
  }
10
10
 
11
- [uc-modal] uc-upload-list {
12
- width: min(
13
- calc(var(--uc-dialog-width) - var(--uc-padding) * 2),
14
- calc(var(--uc-dialog-max-width) - var(--uc-padding) * 2),
15
- calc(100vw - var(--uc-padding) * 2)
16
- );
17
- height: max-content;
18
- max-height: var(--modal-max-content-height);
19
- }
20
-
21
11
  uc-upload-list .uc-no-files {
22
12
  height: 32px;
23
13
  padding: 20px;
@@ -3,14 +3,6 @@ uc-url-source {
3
3
  background-color: var(--uc-background);
4
4
  }
5
5
 
6
- [uc-modal] uc-url-source {
7
- width: min(
8
- calc(var(--uc-dialog-width) - var(--uc-padding) * 2),
9
- calc(var(--uc-dialog-max-width) - var(--uc-padding) * 2),
10
- calc(100vw - var(--uc-padding) * 2)
11
- );
12
- }
13
-
14
6
  uc-url-source > .uc-content {
15
7
  display: grid;
16
8
  grid-gap: 4px;
@@ -11,11 +11,10 @@
11
11
  --uc-preview-size: 32px;
12
12
  --uc-padding: 10px;
13
13
  --uc-radius: 8px;
14
- --uc-radius-dropdown: 12px;
15
14
  --uc-transition: 0.2s ease;
16
15
  --uc-dialog-width: 430px;
17
- --uc-dialog-max-width: 800px;
18
- --uc-dialog-max-height: 600px;
16
+ --uc-dialog-max-width: 920px;
17
+ --uc-dialog-max-height: 675px;
19
18
  --uc-simple-btn-padding: 7px 14px;
20
19
 
21
20
  /* Default colors, in case of media query failure */
@@ -1 +1 @@
1
- {"version":3,"file":"index.ssr.d.ts","sourceRoot":"","sources":["index.ssr.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;EAcE;AACF;;;;;;;;;;;;;;;EAcE;AAC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