sanity-plugin-media 1.4.3 → 1.4.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.
- package/CHANGELOG.md +2 -0
- package/dist/.DS_Store +0 -0
- package/dist/components/ButtonAssetClipboardCopy/index.js +71 -0
- package/dist/components/ButtonC/index.js +71 -0
- package/dist/components/ButtonClipboardCopy/index.js +71 -0
- package/dist/components/Card/index.js +188 -0
- package/dist/components/Card/index.js.map +1 -0
- package/dist/components/CardUpload copy/index.js +60 -0
- package/dist/components/Cards/index.js +81 -0
- package/dist/components/Cards/index.js.map +1 -0
- package/dist/components/DialogDeleteConfirm/index.js +62 -0
- package/dist/components/DialogDeleteConfirm/index.js.map +1 -0
- package/dist/components/DialogDetails/index.js +322 -0
- package/dist/components/DialogDetails/index.js.map +1 -0
- package/dist/components/DialogSearchFacets copy/index.js +45 -0
- package/dist/components/DialogTagCreate copy/index.js +38 -0
- package/dist/components/Dropzone/index.js +66 -0
- package/dist/components/Dropzone/index.js.map +1 -0
- package/dist/components/DropzoneTest/index.js +37 -0
- package/dist/components/FormDetails/index.js +241 -0
- package/dist/components/GlobalStyles/index.js +10 -0
- package/dist/components/LegacyContextActionContainer/index.js +32 -0
- package/dist/components/LegacyContextActionContainer/index.js.map +1 -0
- package/dist/components/Main/index.js +73 -0
- package/dist/components/Main/index.js.map +1 -0
- package/dist/components/NoResults/index.js +12 -0
- package/dist/components/PanelHeader/index.js +48 -0
- package/dist/components/PanelHeader/index.js.map +1 -0
- package/dist/components/Portal/Portal.js +50 -0
- package/dist/components/Portal/index.js +49 -0
- package/dist/components/Portal/index.js.map +1 -0
- package/dist/components/ReduxProvider/index.js +16 -36
- package/dist/components/ReduxProvider/index.js.map +1 -1
- package/dist/components/SearchFacetSearchable/index.js +61 -0
- package/dist/components/SearchFacetSearchable/index.js.map +1 -0
- package/dist/components/Table/index.js +79 -0
- package/dist/components/Table/index.js.map +1 -0
- package/dist/components/TableRow/index.js +225 -0
- package/dist/components/TableRow/index.js.map +1 -0
- package/dist/components/TagPanel/index.js +19 -0
- package/dist/components/TagPanel/index.js.map +1 -0
- package/dist/components/Tags/index.js +21 -0
- package/dist/components/Tags/index.js.map +1 -0
- package/dist/components/TagsAll/index.js +23 -0
- package/dist/components/TagsAll/index.js.map +1 -0
- package/dist/components/TagsPicked/index.js +61 -0
- package/dist/components/TagsPicked/index.js.map +1 -0
- package/dist/components/TagsView/index.js +32 -0
- package/dist/components/TextEllipsis/index.js +14 -0
- package/dist/components/TextEllipsis/index.js.map +1 -0
- package/dist/components/UploadCard/index.js +14 -0
- package/dist/constants/searchFacets.js +272 -0
- package/dist/contexts/AssetSourceDispatchContext copy.js +41 -0
- package/dist/helpers/withRedux.js +84 -0
- package/dist/helpers/withRedux.js.map +1 -0
- package/dist/modules/assets/assetsSlice.js +552 -0
- package/dist/modules/assets/types.js +2 -0
- package/dist/modules/assets/types.js.map +1 -0
- package/dist/modules/debug/debugSlice.js +23 -0
- package/dist/modules/debug/types.js +2 -0
- package/dist/modules/debug/types.js.map +1 -0
- package/dist/modules/debug copy/index.js +22 -0
- package/dist/modules/dialog/dialogSlice.js +192 -0
- package/dist/modules/dialog/index.js.map +1 -1
- package/dist/modules/dialog/types.js +2 -0
- package/dist/modules/dialog/types.js.map +1 -0
- package/dist/modules/document/documentSlice.js +9 -0
- package/dist/modules/document/index.js +9 -0
- package/dist/modules/document/index.js.map +1 -0
- package/dist/modules/document/types.js +3 -0
- package/dist/modules/document/types.js.map +1 -0
- package/dist/modules/document copy/index.js +9 -0
- package/dist/modules/documentAssets/index.js +9 -0
- package/dist/modules/index.js +2 -2
- package/dist/modules/index.js.map +1 -1
- package/dist/modules/notifications/notificationsSlice.js +123 -0
- package/dist/modules/notifications/types.js +2 -0
- package/dist/modules/notifications/types.js.map +1 -0
- package/dist/modules/search/searchSlice.js +122 -0
- package/dist/modules/search/types.js +2 -0
- package/dist/modules/search/types.js.map +1 -0
- package/dist/modules/selectedAssets/index.js +9 -0
- package/dist/modules/selectedAssets/index.js.map +1 -0
- package/dist/modules/selectedAssets/selectedAssetsSlice.js +9 -0
- package/dist/modules/selectedAssets/types.js +2 -0
- package/dist/modules/selectedAssets/types.js.map +1 -0
- package/dist/modules/selectedAssets copy/index.js +9 -0
- package/dist/modules/tags/index.js +3 -3
- package/dist/modules/tags/index.js.map +1 -1
- package/dist/modules/tags/selectedAssetsSlice.js +9 -0
- package/dist/modules/tags/tagsSlice.js +442 -0
- package/dist/modules/tags/tagsSlice.js.map +1 -0
- package/dist/modules/tags/types.js +2 -0
- package/dist/modules/tags/types.js.map +1 -0
- package/dist/modules/theme/index.js +21 -0
- package/dist/modules/theme/index.js.map +1 -0
- package/dist/operators/debugThrottle copy.js +15 -0
- package/dist/operators/fetchExistingTag.js +27 -0
- package/dist/utils/getDocumentAssetRefs.js +50 -0
- package/package.json +8 -14
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
3
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
4
|
+
return cooked;
|
|
5
|
+
};
|
|
6
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
|
+
};
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.operators = exports.inputs = exports.divider = void 0;
|
|
11
|
+
var groq_1 = __importDefault(require("groq"));
|
|
12
|
+
exports.divider = { type: 'divider' };
|
|
13
|
+
exports.inputs = {
|
|
14
|
+
altText: {
|
|
15
|
+
contexts: 'all',
|
|
16
|
+
field: 'altText',
|
|
17
|
+
name: 'altText',
|
|
18
|
+
operatorType: 'empty',
|
|
19
|
+
operatorTypes: ['empty', 'notEmpty', null, 'includes', 'doesNotInclude'],
|
|
20
|
+
title: 'Alt Text',
|
|
21
|
+
type: 'string',
|
|
22
|
+
value: ''
|
|
23
|
+
},
|
|
24
|
+
description: {
|
|
25
|
+
contexts: 'all',
|
|
26
|
+
field: 'description',
|
|
27
|
+
name: 'description',
|
|
28
|
+
operatorType: 'empty',
|
|
29
|
+
operatorTypes: ['empty', 'notEmpty', null, 'includes', 'doesNotInclude'],
|
|
30
|
+
title: 'Description',
|
|
31
|
+
type: 'string',
|
|
32
|
+
value: ''
|
|
33
|
+
},
|
|
34
|
+
height: {
|
|
35
|
+
contexts: ['image', 'tool'],
|
|
36
|
+
field: 'metadata.dimensions.height',
|
|
37
|
+
name: 'height',
|
|
38
|
+
operatorType: 'greaterThan',
|
|
39
|
+
operatorTypes: [
|
|
40
|
+
'greaterThan',
|
|
41
|
+
'greaterThanOrEqualTo',
|
|
42
|
+
'lessThan',
|
|
43
|
+
'lessThanOrEqualTo',
|
|
44
|
+
null,
|
|
45
|
+
'equalTo'
|
|
46
|
+
],
|
|
47
|
+
title: 'Height',
|
|
48
|
+
type: 'number',
|
|
49
|
+
value: 400
|
|
50
|
+
},
|
|
51
|
+
inUse: {
|
|
52
|
+
contexts: 'all',
|
|
53
|
+
name: 'inUse',
|
|
54
|
+
operatorType: 'is',
|
|
55
|
+
options: [
|
|
56
|
+
{
|
|
57
|
+
name: 'true',
|
|
58
|
+
title: 'True',
|
|
59
|
+
value: groq_1.default(templateObject_1 || (templateObject_1 = __makeTemplateObject(["count(*[references(^._id)]) > 0"], ["count(*[references(^._id)]) > 0"])))
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
name: 'false',
|
|
63
|
+
title: 'False',
|
|
64
|
+
value: groq_1.default(templateObject_2 || (templateObject_2 = __makeTemplateObject(["count(*[references(^._id)]) == 0"], ["count(*[references(^._id)]) == 0"])))
|
|
65
|
+
}
|
|
66
|
+
],
|
|
67
|
+
title: 'In Use',
|
|
68
|
+
type: 'select',
|
|
69
|
+
value: 'true'
|
|
70
|
+
},
|
|
71
|
+
isOpaque: {
|
|
72
|
+
contexts: ['image', 'tool'],
|
|
73
|
+
field: 'metadata.isOpaque',
|
|
74
|
+
name: 'isOpaque',
|
|
75
|
+
operatorType: 'equalTo',
|
|
76
|
+
options: [
|
|
77
|
+
{
|
|
78
|
+
name: 'true',
|
|
79
|
+
title: 'True',
|
|
80
|
+
value: "false"
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
name: 'false',
|
|
84
|
+
title: 'False',
|
|
85
|
+
value: "true"
|
|
86
|
+
}
|
|
87
|
+
],
|
|
88
|
+
title: 'Has Transparency',
|
|
89
|
+
type: 'select',
|
|
90
|
+
value: 'true'
|
|
91
|
+
},
|
|
92
|
+
orientation: {
|
|
93
|
+
contexts: ['image', 'tool'],
|
|
94
|
+
name: 'orientation',
|
|
95
|
+
operatorType: 'is',
|
|
96
|
+
operatorTypes: ['is', 'isNot'],
|
|
97
|
+
options: [
|
|
98
|
+
{
|
|
99
|
+
name: 'portrait',
|
|
100
|
+
title: 'Portrait',
|
|
101
|
+
value: 'metadata.dimensions.aspectRatio < 1'
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
name: 'landscape',
|
|
105
|
+
title: 'Landscape',
|
|
106
|
+
value: 'metadata.dimensions.aspectRatio > 1'
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
name: 'square',
|
|
110
|
+
title: 'Square',
|
|
111
|
+
value: 'metadata.dimensions.aspectRatio == 1'
|
|
112
|
+
}
|
|
113
|
+
],
|
|
114
|
+
title: 'Orientation',
|
|
115
|
+
type: 'select',
|
|
116
|
+
value: 'portrait'
|
|
117
|
+
},
|
|
118
|
+
size: {
|
|
119
|
+
contexts: 'all',
|
|
120
|
+
field: 'size',
|
|
121
|
+
modifier: 'kb',
|
|
122
|
+
modifiers: [
|
|
123
|
+
{
|
|
124
|
+
name: 'kb',
|
|
125
|
+
title: 'KB',
|
|
126
|
+
fieldModifier: function (fieldName) { return "round(" + fieldName + " / 1000)"; }
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
name: 'mb',
|
|
130
|
+
title: 'MB',
|
|
131
|
+
fieldModifier: function (fieldName) { return "round(" + fieldName + " / 1000000)"; }
|
|
132
|
+
}
|
|
133
|
+
],
|
|
134
|
+
name: 'size',
|
|
135
|
+
operatorType: 'greaterThan',
|
|
136
|
+
operatorTypes: [
|
|
137
|
+
'greaterThan',
|
|
138
|
+
'greaterThanOrEqualTo',
|
|
139
|
+
'lessThan',
|
|
140
|
+
'lessThanOrEqualTo',
|
|
141
|
+
null,
|
|
142
|
+
'equalTo'
|
|
143
|
+
],
|
|
144
|
+
title: 'File Size',
|
|
145
|
+
type: 'number',
|
|
146
|
+
value: 0
|
|
147
|
+
},
|
|
148
|
+
tag: {
|
|
149
|
+
contexts: 'all',
|
|
150
|
+
field: 'opt.media.tags',
|
|
151
|
+
name: 'tag',
|
|
152
|
+
operatorType: 'references',
|
|
153
|
+
operatorTypes: ['references', 'doesNotReference', null, 'empty', 'notEmpty'],
|
|
154
|
+
title: 'Tags',
|
|
155
|
+
type: 'searchable'
|
|
156
|
+
},
|
|
157
|
+
title: {
|
|
158
|
+
contexts: 'all',
|
|
159
|
+
field: 'title',
|
|
160
|
+
name: 'title',
|
|
161
|
+
operatorType: 'empty',
|
|
162
|
+
operatorTypes: ['empty', 'notEmpty', null, 'includes', 'doesNotInclude'],
|
|
163
|
+
title: 'Title',
|
|
164
|
+
type: 'string',
|
|
165
|
+
value: ''
|
|
166
|
+
},
|
|
167
|
+
type: {
|
|
168
|
+
contexts: ['file', 'tool'],
|
|
169
|
+
name: 'type',
|
|
170
|
+
operatorType: 'is',
|
|
171
|
+
operatorTypes: ['is', 'isNot'],
|
|
172
|
+
options: [
|
|
173
|
+
{
|
|
174
|
+
name: 'image',
|
|
175
|
+
title: 'Image',
|
|
176
|
+
value: 'mimeType match "image*"'
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
name: 'video',
|
|
180
|
+
title: 'Video',
|
|
181
|
+
value: 'mimeType match "video*"'
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
name: 'audio',
|
|
185
|
+
title: 'Audio',
|
|
186
|
+
value: 'mimeType match "audio*"'
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
name: 'pdf',
|
|
190
|
+
title: 'PDF',
|
|
191
|
+
value: 'mimeType == "application/pdf"'
|
|
192
|
+
}
|
|
193
|
+
],
|
|
194
|
+
title: 'File Type',
|
|
195
|
+
type: 'select',
|
|
196
|
+
value: 'image'
|
|
197
|
+
},
|
|
198
|
+
width: {
|
|
199
|
+
contexts: ['image', 'tool'],
|
|
200
|
+
field: 'metadata.dimensions.width',
|
|
201
|
+
name: 'width',
|
|
202
|
+
operatorType: 'greaterThan',
|
|
203
|
+
operatorTypes: [
|
|
204
|
+
'greaterThan',
|
|
205
|
+
'greaterThanOrEqualTo',
|
|
206
|
+
'lessThan',
|
|
207
|
+
'lessThanOrEqualTo',
|
|
208
|
+
null,
|
|
209
|
+
'equalTo'
|
|
210
|
+
],
|
|
211
|
+
title: 'Width',
|
|
212
|
+
type: 'number',
|
|
213
|
+
value: 400
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
exports.operators = {
|
|
217
|
+
doesNotInclude: {
|
|
218
|
+
fn: function (value, field) { return (value ? "!(" + field + " match '*" + value + "*')" : undefined); },
|
|
219
|
+
label: 'does not include'
|
|
220
|
+
},
|
|
221
|
+
doesNotReference: {
|
|
222
|
+
fn: function (value, _) { return (value ? "!references('" + value + "')" : undefined); },
|
|
223
|
+
label: 'does not include'
|
|
224
|
+
},
|
|
225
|
+
empty: {
|
|
226
|
+
fn: function (_, field) { return "!defined(" + field + ")"; },
|
|
227
|
+
hideInput: true,
|
|
228
|
+
label: 'is empty'
|
|
229
|
+
},
|
|
230
|
+
equalTo: {
|
|
231
|
+
fn: function (value, field) { return (value ? field + " == " + value : undefined); },
|
|
232
|
+
label: 'is equal to'
|
|
233
|
+
},
|
|
234
|
+
greaterThan: {
|
|
235
|
+
fn: function (value, field) { return (value ? field + " > " + value : undefined); },
|
|
236
|
+
label: 'is greater than'
|
|
237
|
+
},
|
|
238
|
+
greaterThanOrEqualTo: {
|
|
239
|
+
fn: function (value, field) { return (value ? field + " >= " + value : undefined); },
|
|
240
|
+
label: 'is greater than or equal to'
|
|
241
|
+
},
|
|
242
|
+
includes: {
|
|
243
|
+
fn: function (value, field) { return (value ? field + " match '*" + value + "*'" : undefined); },
|
|
244
|
+
label: 'includes'
|
|
245
|
+
},
|
|
246
|
+
is: {
|
|
247
|
+
fn: function (value, _) { return "" + value; },
|
|
248
|
+
label: 'is'
|
|
249
|
+
},
|
|
250
|
+
isNot: {
|
|
251
|
+
fn: function (value, _) { return "!(" + value + ")"; },
|
|
252
|
+
label: 'is not'
|
|
253
|
+
},
|
|
254
|
+
lessThan: {
|
|
255
|
+
fn: function (value, field) { return (value ? field + " < " + value : undefined); },
|
|
256
|
+
label: 'is less than'
|
|
257
|
+
},
|
|
258
|
+
lessThanOrEqualTo: {
|
|
259
|
+
fn: function (value, field) { return (value ? field + " <= " + value : undefined); },
|
|
260
|
+
label: 'is less than or equal to'
|
|
261
|
+
},
|
|
262
|
+
notEmpty: {
|
|
263
|
+
fn: function (_, field) { return "defined(" + field + ")"; },
|
|
264
|
+
hideInput: true,
|
|
265
|
+
label: 'is not empty'
|
|
266
|
+
},
|
|
267
|
+
references: {
|
|
268
|
+
fn: function (value, _) { return (value ? "references('" + value + "')" : undefined); },
|
|
269
|
+
label: 'includes'
|
|
270
|
+
}
|
|
271
|
+
};
|
|
272
|
+
var templateObject_1, templateObject_2;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.useAssetSourceActions = exports.AssetBrowserDispatchProvider = void 0;
|
|
23
|
+
var react_1 = __importStar(require("react"));
|
|
24
|
+
var AssetSourceDispatchContext = react_1.createContext(undefined);
|
|
25
|
+
var AssetBrowserDispatchProvider = function (props) {
|
|
26
|
+
var children = props.children, onSelect = props.onSelect;
|
|
27
|
+
var contextValue = {
|
|
28
|
+
onSelect: onSelect
|
|
29
|
+
};
|
|
30
|
+
return (react_1.default.createElement(AssetSourceDispatchContext.Provider, { value: contextValue }, children));
|
|
31
|
+
};
|
|
32
|
+
exports.AssetBrowserDispatchProvider = AssetBrowserDispatchProvider;
|
|
33
|
+
var useAssetSourceActions = function () {
|
|
34
|
+
var context = react_1.useContext(AssetSourceDispatchContext);
|
|
35
|
+
if (context === undefined) {
|
|
36
|
+
throw new Error('useAssetSourceActions must be used within an AssetSourceDispatchProvider');
|
|
37
|
+
}
|
|
38
|
+
return context;
|
|
39
|
+
};
|
|
40
|
+
exports.useAssetSourceActions = useAssetSourceActions;
|
|
41
|
+
exports.default = AssetSourceDispatchContext;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
extendStatics(d, b);
|
|
11
|
+
function __() { this.constructor = d; }
|
|
12
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
13
|
+
};
|
|
14
|
+
})();
|
|
15
|
+
var __assign = (this && this.__assign) || function () {
|
|
16
|
+
__assign = Object.assign || function(t) {
|
|
17
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
18
|
+
s = arguments[i];
|
|
19
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
20
|
+
t[p] = s[p];
|
|
21
|
+
}
|
|
22
|
+
return t;
|
|
23
|
+
};
|
|
24
|
+
return __assign.apply(this, arguments);
|
|
25
|
+
};
|
|
26
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
27
|
+
if (k2 === undefined) k2 = k;
|
|
28
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
29
|
+
}) : (function(o, m, k, k2) {
|
|
30
|
+
if (k2 === undefined) k2 = k;
|
|
31
|
+
o[k2] = m[k];
|
|
32
|
+
}));
|
|
33
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
34
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
35
|
+
}) : function(o, v) {
|
|
36
|
+
o["default"] = v;
|
|
37
|
+
});
|
|
38
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
39
|
+
if (mod && mod.__esModule) return mod;
|
|
40
|
+
var result = {};
|
|
41
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
42
|
+
__setModuleDefault(result, mod);
|
|
43
|
+
return result;
|
|
44
|
+
};
|
|
45
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
|
+
var react_1 = __importStar(require("react"));
|
|
47
|
+
var react_redux_1 = require("react-redux");
|
|
48
|
+
var redux_1 = require("redux");
|
|
49
|
+
var developmentOnly_1 = require("redux-devtools-extension/developmentOnly");
|
|
50
|
+
var redux_observable_1 = require("redux-observable");
|
|
51
|
+
var modules_1 = require("../modules");
|
|
52
|
+
var assets_1 = require("../modules/assets");
|
|
53
|
+
function withRedux(ComposedComponent) {
|
|
54
|
+
var _a;
|
|
55
|
+
var displayName = ComposedComponent.displayName || ComposedComponent.name || 'Component';
|
|
56
|
+
return _a = /** @class */ (function (_super) {
|
|
57
|
+
__extends(WithReduxComponent, _super);
|
|
58
|
+
function WithReduxComponent(props) {
|
|
59
|
+
var _this = _super.call(this, props) || this;
|
|
60
|
+
// Initialize redux middleware and create store.
|
|
61
|
+
// Redux store isn't persisted between mounts.
|
|
62
|
+
var epicMiddleware = redux_observable_1.createEpicMiddleware();
|
|
63
|
+
_this.store = redux_1.createStore(modules_1.rootReducer, {
|
|
64
|
+
assets: __assign({}, assets_1.initialState),
|
|
65
|
+
// TODO: correctly type
|
|
66
|
+
// @ts-ignore
|
|
67
|
+
document: props === null || props === void 0 ? void 0 : props.document,
|
|
68
|
+
// TODO: correctly type
|
|
69
|
+
// @ts-ignore
|
|
70
|
+
selectedAssets: props === null || props === void 0 ? void 0 : props.selectedAssets
|
|
71
|
+
}, developmentOnly_1.composeWithDevTools(redux_1.applyMiddleware(epicMiddleware)));
|
|
72
|
+
epicMiddleware.run(modules_1.rootEpic);
|
|
73
|
+
return _this;
|
|
74
|
+
}
|
|
75
|
+
WithReduxComponent.prototype.render = function () {
|
|
76
|
+
return (react_1.default.createElement(react_redux_1.Provider, { store: this.store },
|
|
77
|
+
react_1.default.createElement(ComposedComponent, __assign({}, this.props))));
|
|
78
|
+
};
|
|
79
|
+
return WithReduxComponent;
|
|
80
|
+
}(react_1.Component)),
|
|
81
|
+
_a.displayName = "withRedux(" + displayName + ")",
|
|
82
|
+
_a;
|
|
83
|
+
}
|
|
84
|
+
exports.default = withRedux;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withRedux.js","sourceRoot":"","sources":["../../src/helpers/withRedux.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAAqD;AACrD,2CAAoC;AACpC,+BAAkD;AAClD,4EAA4E;AAC5E,qDAAqD;AAErD,sCAAgD;AAChD,4CAAoE;AAEpE,SAAS,SAAS,CAAI,iBAAmC;;IACvD,IAAM,WAAW,GAAG,iBAAiB,CAAC,WAAW,IAAI,iBAAiB,CAAC,IAAI,IAAI,WAAW,CAAA;IAE1F;YAAwC,sCAAY;YAKlD,4BAAY,KAAQ;gBAApB,YACE,kBAAM,KAAK,CAAC,SAsBb;gBApBC,gDAAgD;gBAChD,8CAA8C;gBAC9C,IAAM,cAAc,GAAG,uCAAoB,EAAE,CAAA;gBAE7C,KAAI,CAAC,KAAK,GAAG,mBAAW,CACtB,qBAAW,EACX;oBACE,MAAM,eACD,qBAAkB,CACtB;oBACD,uBAAuB;oBACvB,aAAa;oBACb,QAAQ,EAAE,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,QAAQ;oBACzB,uBAAuB;oBACvB,aAAa;oBACb,cAAc,EAAE,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,cAAc;iBACtC,EACD,qCAAmB,CAAC,uBAAe,CAAC,cAAc,CAAC,CAAC,CACrD,CAAA;gBACD,cAAc,CAAC,GAAG,CAAC,kBAAQ,CAAC,CAAA;;YAC9B,CAAC;YAED,mCAAM,GAAN;gBACE,OAAO,CACL,8BAAC,sBAAQ,IAAC,KAAK,EAAE,IAAI,CAAC,KAAK;oBACzB,8BAAC,iBAAiB,eAAK,IAAI,CAAC,KAAK,EAAI,CAC5B,CACZ,CAAA;YACH,CAAC;YACH,yBAAC;QAAD,CAAC,AArCM,CAAiC,iBAAS;QACxC,cAAW,GAAG,eAAa,WAAW,MAAG;WAoCjD;AACH,CAAC;AAED,kBAAe,SAAS,CAAA"}
|