@wordpress/media-utils 5.11.0 → 5.12.0

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 (53) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/README.md +4 -0
  3. package/build/components/media-upload/index.js +85 -18
  4. package/build/components/media-upload/index.js.map +1 -1
  5. package/build/index.js +9 -1
  6. package/build/index.js.map +1 -1
  7. package/build/lock-unlock.js +18 -0
  8. package/build/lock-unlock.js.map +1 -0
  9. package/build/private-apis.js +20 -0
  10. package/build/private-apis.js.map +1 -0
  11. package/build/utils/sideload-media.js +58 -0
  12. package/build/utils/sideload-media.js.map +1 -0
  13. package/build/utils/sideload-to-server.js +43 -0
  14. package/build/utils/sideload-to-server.js.map +1 -0
  15. package/build/utils/types.js.map +1 -1
  16. package/build-module/components/media-upload/index.js +85 -18
  17. package/build-module/components/media-upload/index.js.map +1 -1
  18. package/build-module/index.js +1 -0
  19. package/build-module/index.js.map +1 -1
  20. package/build-module/lock-unlock.js +9 -0
  21. package/build-module/lock-unlock.js.map +1 -0
  22. package/build-module/private-apis.js +14 -0
  23. package/build-module/private-apis.js.map +1 -0
  24. package/build-module/utils/sideload-media.js +52 -0
  25. package/build-module/utils/sideload-media.js.map +1 -0
  26. package/build-module/utils/sideload-to-server.js +37 -0
  27. package/build-module/utils/sideload-to-server.js.map +1 -0
  28. package/build-module/utils/types.js.map +1 -1
  29. package/build-types/components/media-upload/index.d.ts +6 -0
  30. package/build-types/components/media-upload/index.d.ts.map +1 -1
  31. package/build-types/index.d.ts +1 -0
  32. package/build-types/index.d.ts.map +1 -1
  33. package/build-types/lock-unlock.d.ts +2 -0
  34. package/build-types/lock-unlock.d.ts.map +1 -0
  35. package/build-types/private-apis.d.ts +5 -0
  36. package/build-types/private-apis.d.ts.map +1 -0
  37. package/build-types/utils/sideload-media.d.ts +26 -0
  38. package/build-types/utils/sideload-media.d.ts.map +1 -0
  39. package/build-types/utils/sideload-to-server.d.ts +16 -0
  40. package/build-types/utils/sideload-to-server.d.ts.map +1 -0
  41. package/build-types/utils/types.d.ts +8 -0
  42. package/build-types/utils/types.d.ts.map +1 -1
  43. package/package.json +5 -4
  44. package/src/components/media-upload/index.js +83 -14
  45. package/src/index.ts +2 -0
  46. package/src/lock-unlock.ts +10 -0
  47. package/src/private-apis.ts +14 -0
  48. package/src/utils/sideload-media.ts +82 -0
  49. package/src/utils/sideload-to-server.ts +48 -0
  50. package/src/utils/test/sideload-media.ts +33 -0
  51. package/src/utils/types.ts +10 -0
  52. package/tsconfig.json +2 -1
  53. package/tsconfig.tsbuildinfo +1 -1
@@ -60,6 +60,45 @@ const getFeaturedImageMediaFrame = () => {
60
60
  });
61
61
  };
62
62
 
63
+ /**
64
+ * Prepares the default frame for selecting a single media item.
65
+ *
66
+ * @return {window.wp.media.view.MediaFrame.Select} The default media workflow.
67
+ */
68
+ const getSingleMediaFrame = () => {
69
+ const {
70
+ wp
71
+ } = window;
72
+
73
+ // Extend the default Select frame, and use the same `createStates` method as in core,
74
+ // but with the addition of `filterable: 'uploaded'` to the Library state, so that
75
+ // the user can filter the media library by uploaded media.
76
+ return wp.media.view.MediaFrame.Select.extend({
77
+ /**
78
+ * Create the default states on the frame.
79
+ */
80
+ createStates() {
81
+ const options = this.options;
82
+ if (this.options.states) {
83
+ return;
84
+ }
85
+
86
+ // Add the default states.
87
+ this.states.add([
88
+ // Main states.
89
+ new wp.media.controller.Library({
90
+ library: wp.media.query(options.library),
91
+ multiple: options.multiple,
92
+ title: options.title,
93
+ priority: 20,
94
+ filterable: 'uploaded' // Allow filtering by uploaded images.
95
+ }), new wp.media.controller.EditImage({
96
+ model: options.editImage
97
+ })]);
98
+ }
99
+ });
100
+ };
101
+
63
102
  /**
64
103
  * Prepares the Gallery toolbars and frames.
65
104
  *
@@ -249,7 +288,7 @@ class MediaUpload extends Component {
249
288
  state: currentState,
250
289
  multiple,
251
290
  selection,
252
- editing: value && value.length ? true : false
291
+ editing: !!value?.length
253
292
  });
254
293
  wp.media.frame = this.frame;
255
294
  this.initializeListeners();
@@ -291,6 +330,49 @@ class MediaUpload extends Component {
291
330
  featuredImageId: featuredImageId || -1
292
331
  };
293
332
  }
333
+
334
+ /**
335
+ * Initializes the Media Library requirements for the single image flow.
336
+ *
337
+ * @return {void}
338
+ */
339
+ buildAndSetSingleMediaFrame() {
340
+ const {
341
+ wp
342
+ } = window;
343
+ const {
344
+ allowedTypes,
345
+ multiple = false,
346
+ title = __('Select or Upload Media'),
347
+ value
348
+ } = this.props;
349
+ const frameConfig = {
350
+ title,
351
+ multiple
352
+ };
353
+ if (!!allowedTypes) {
354
+ frameConfig.library = {
355
+ type: allowedTypes
356
+ };
357
+ }
358
+
359
+ // If a frame already exists, remove it.
360
+ if (this.frame) {
361
+ this.frame.remove();
362
+ }
363
+ const singleImageFrame = getSingleMediaFrame();
364
+ const attachments = getAttachmentsCollection(value);
365
+ const selection = new wp.media.model.Selection(attachments.models, {
366
+ props: attachments.props.toJSON()
367
+ });
368
+ this.frame = new singleImageFrame({
369
+ mimeType: allowedTypes,
370
+ multiple,
371
+ selection,
372
+ ...frameConfig
373
+ });
374
+ wp.media.frame = this.frame;
375
+ }
294
376
  componentWillUnmount() {
295
377
  this.frame?.remove();
296
378
  }
@@ -384,29 +466,14 @@ class MediaUpload extends Component {
384
466
  }
385
467
  openModal() {
386
468
  const {
387
- allowedTypes,
388
469
  gallery = false,
389
470
  unstableFeaturedImageFlow = false,
390
- modalClass,
391
- multiple = false,
392
- title = __('Select or Upload Media')
471
+ modalClass
393
472
  } = this.props;
394
- const {
395
- wp
396
- } = window;
397
473
  if (gallery) {
398
474
  this.buildAndSetGalleryFrame();
399
475
  } else {
400
- const frameConfig = {
401
- title,
402
- multiple
403
- };
404
- if (!!allowedTypes) {
405
- frameConfig.library = {
406
- type: allowedTypes
407
- };
408
- }
409
- this.frame = wp.media(frameConfig);
476
+ this.buildAndSetSingleMediaFrame();
410
477
  }
411
478
  if (modalClass) {
412
479
  this.frame.$el.addClass(modalClass);
@@ -1 +1 @@
1
- {"version":3,"names":["Component","__","DEFAULT_EMPTY_GALLERY","getFeaturedImageMediaFrame","wp","window","media","view","MediaFrame","Select","extend","featuredImageToolbar","toolbar","createSelectToolbar","text","l10n","setFeaturedImage","state","options","editState","selection","get","EditImage","model","single","controller","render","content","set","loadEditor","createStates","on","states","add","FeaturedImage","editImage","getGalleryDetailsMediaFrame","Post","galleryToolbar","editing","Toolbar","items","insert","style","updateGallery","insertGallery","priority","requires","library","click","close","trigger","setState","reset","Library","id","title","createGalleryTitle","filterable","multiple","editable","query","type","GalleryEdit","menu","displaySettings","GalleryAdd","slimImageObject","img","attrSet","reduce","result","key","hasOwnProperty","getAttachmentsCollection","ids","order","orderby","post__in","posts_per_page","MediaUpload","constructor","arguments","openModal","bind","onOpen","onSelect","onUpdate","onClose","initializeListeners","frame","buildAndSetGalleryFrame","addToGallery","allowedTypes","value","props","lastGalleryValue","remove","currentState","length","GalleryDetailsMediaFrame","attachments","Selection","models","toJSON","mimeType","buildAndSetFeatureImageFrame","featuredImageId","featuredImageFrame","settings","post","componentWillUnmount","selections","selectedImages","map","attachment","updateCollection","mode","hasMedia","Array","isArray","isGallery","gallery","valueArray","forEach","more","done","detach","frameContent","collection","toArray","mirroring","_hasMore","unstableFeaturedImageFlow","modalClass","frameConfig","$el","addClass","open"],"sources":["@wordpress/media-utils/src/components/media-upload/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\nconst DEFAULT_EMPTY_GALLERY = [];\n\n/**\n * Prepares the Featured Image toolbars and frames.\n *\n * @return {window.wp.media.view.MediaFrame.Select} The default media workflow.\n */\nconst getFeaturedImageMediaFrame = () => {\n\tconst { wp } = window;\n\n\treturn wp.media.view.MediaFrame.Select.extend( {\n\t\t/**\n\t\t * Enables the Set Featured Image Button.\n\t\t *\n\t\t * @param {Object} toolbar toolbar for featured image state\n\t\t * @return {void}\n\t\t */\n\t\tfeaturedImageToolbar( toolbar ) {\n\t\t\tthis.createSelectToolbar( toolbar, {\n\t\t\t\ttext: wp.media.view.l10n.setFeaturedImage,\n\t\t\t\tstate: this.options.state,\n\t\t\t} );\n\t\t},\n\n\t\t/**\n\t\t * Handle the edit state requirements of selected media item.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\teditState() {\n\t\t\tconst selection = this.state( 'featured-image' ).get( 'selection' );\n\t\t\tconst view = new wp.media.view.EditImage( {\n\t\t\t\tmodel: selection.single(),\n\t\t\t\tcontroller: this,\n\t\t\t} ).render();\n\n\t\t\t// Set the view to the EditImage frame using the selected image.\n\t\t\tthis.content.set( view );\n\n\t\t\t// After bringing in the frame, load the actual editor via an ajax call.\n\t\t\tview.loadEditor();\n\t\t},\n\n\t\t/**\n\t\t * Create the default states.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\tcreateStates: function createStates() {\n\t\t\tthis.on(\n\t\t\t\t'toolbar:create:featured-image',\n\t\t\t\tthis.featuredImageToolbar,\n\t\t\t\tthis\n\t\t\t);\n\t\t\tthis.on( 'content:render:edit-image', this.editState, this );\n\n\t\t\tthis.states.add( [\n\t\t\t\tnew wp.media.controller.FeaturedImage(),\n\t\t\t\tnew wp.media.controller.EditImage( {\n\t\t\t\t\tmodel: this.options.editImage,\n\t\t\t\t} ),\n\t\t\t] );\n\t\t},\n\t} );\n};\n\n/**\n * Prepares the Gallery toolbars and frames.\n *\n * @return {window.wp.media.view.MediaFrame.Post} The default media workflow.\n */\nconst getGalleryDetailsMediaFrame = () => {\n\tconst { wp } = window;\n\t/**\n\t * Custom gallery details frame.\n\t *\n\t * @see https://github.com/xwp/wp-core-media-widgets/blob/905edbccfc2a623b73a93dac803c5335519d7837/wp-admin/js/widgets/media-gallery-widget.js\n\t * @class GalleryDetailsMediaFrame\n\t * @class\n\t */\n\treturn wp.media.view.MediaFrame.Post.extend( {\n\t\t/**\n\t\t * Set up gallery toolbar.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\tgalleryToolbar() {\n\t\t\tconst editing = this.state().get( 'editing' );\n\t\t\tthis.toolbar.set(\n\t\t\t\tnew wp.media.view.Toolbar( {\n\t\t\t\t\tcontroller: this,\n\t\t\t\t\titems: {\n\t\t\t\t\t\tinsert: {\n\t\t\t\t\t\t\tstyle: 'primary',\n\t\t\t\t\t\t\ttext: editing\n\t\t\t\t\t\t\t\t? wp.media.view.l10n.updateGallery\n\t\t\t\t\t\t\t\t: wp.media.view.l10n.insertGallery,\n\t\t\t\t\t\t\tpriority: 80,\n\t\t\t\t\t\t\trequires: { library: true },\n\n\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t * @fires wp.media.controller.State#update\n\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\tclick() {\n\t\t\t\t\t\t\t\tconst controller = this.controller,\n\t\t\t\t\t\t\t\t\tstate = controller.state();\n\n\t\t\t\t\t\t\t\tcontroller.close();\n\t\t\t\t\t\t\t\tstate.trigger(\n\t\t\t\t\t\t\t\t\t'update',\n\t\t\t\t\t\t\t\t\tstate.get( 'library' )\n\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\t// Restore and reset the default state.\n\t\t\t\t\t\t\t\tcontroller.setState( controller.options.state );\n\t\t\t\t\t\t\t\tcontroller.reset();\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t} )\n\t\t\t);\n\t\t},\n\n\t\t/**\n\t\t * Handle the edit state requirements of selected media item.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\teditState() {\n\t\t\tconst selection = this.state( 'gallery' ).get( 'selection' );\n\t\t\tconst view = new wp.media.view.EditImage( {\n\t\t\t\tmodel: selection.single(),\n\t\t\t\tcontroller: this,\n\t\t\t} ).render();\n\n\t\t\t// Set the view to the EditImage frame using the selected image.\n\t\t\tthis.content.set( view );\n\n\t\t\t// After bringing in the frame, load the actual editor via an ajax call.\n\t\t\tview.loadEditor();\n\t\t},\n\n\t\t/**\n\t\t * Create the default states.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\tcreateStates: function createStates() {\n\t\t\tthis.on( 'toolbar:create:main-gallery', this.galleryToolbar, this );\n\t\t\tthis.on( 'content:render:edit-image', this.editState, this );\n\n\t\t\tthis.states.add( [\n\t\t\t\tnew wp.media.controller.Library( {\n\t\t\t\t\tid: 'gallery',\n\t\t\t\t\ttitle: wp.media.view.l10n.createGalleryTitle,\n\t\t\t\t\tpriority: 40,\n\t\t\t\t\ttoolbar: 'main-gallery',\n\t\t\t\t\tfilterable: 'uploaded',\n\t\t\t\t\tmultiple: 'add',\n\t\t\t\t\teditable: false,\n\n\t\t\t\t\tlibrary: wp.media.query( {\n\t\t\t\t\t\ttype: 'image',\n\t\t\t\t\t\t...this.options.library,\n\t\t\t\t\t} ),\n\t\t\t\t} ),\n\t\t\t\tnew wp.media.controller.EditImage( {\n\t\t\t\t\tmodel: this.options.editImage,\n\t\t\t\t} ),\n\n\t\t\t\tnew wp.media.controller.GalleryEdit( {\n\t\t\t\t\tlibrary: this.options.selection,\n\t\t\t\t\tediting: this.options.editing,\n\t\t\t\t\tmenu: 'gallery',\n\t\t\t\t\tdisplaySettings: false,\n\t\t\t\t\tmultiple: true,\n\t\t\t\t} ),\n\n\t\t\t\tnew wp.media.controller.GalleryAdd(),\n\t\t\t] );\n\t\t},\n\t} );\n};\n\n// The media library image object contains numerous attributes\n// we only need this set to display the image in the library.\nconst slimImageObject = ( img ) => {\n\tconst attrSet = [\n\t\t'sizes',\n\t\t'mime',\n\t\t'type',\n\t\t'subtype',\n\t\t'id',\n\t\t'url',\n\t\t'alt',\n\t\t'link',\n\t\t'caption',\n\t];\n\treturn attrSet.reduce( ( result, key ) => {\n\t\tif ( img?.hasOwnProperty( key ) ) {\n\t\t\tresult[ key ] = img[ key ];\n\t\t}\n\t\treturn result;\n\t}, {} );\n};\n\nconst getAttachmentsCollection = ( ids ) => {\n\tconst { wp } = window;\n\n\treturn wp.media.query( {\n\t\torder: 'ASC',\n\t\torderby: 'post__in',\n\t\tpost__in: ids,\n\t\tposts_per_page: -1,\n\t\tquery: true,\n\t\ttype: 'image',\n\t} );\n};\n\nclass MediaUpload extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\t\tthis.openModal = this.openModal.bind( this );\n\t\tthis.onOpen = this.onOpen.bind( this );\n\t\tthis.onSelect = this.onSelect.bind( this );\n\t\tthis.onUpdate = this.onUpdate.bind( this );\n\t\tthis.onClose = this.onClose.bind( this );\n\t}\n\n\tinitializeListeners() {\n\t\t// When an image is selected in the media frame...\n\t\tthis.frame.on( 'select', this.onSelect );\n\t\tthis.frame.on( 'update', this.onUpdate );\n\t\tthis.frame.on( 'open', this.onOpen );\n\t\tthis.frame.on( 'close', this.onClose );\n\t}\n\n\t/**\n\t * Sets the Gallery frame and initializes listeners.\n\t *\n\t * @return {void}\n\t */\n\tbuildAndSetGalleryFrame() {\n\t\tconst {\n\t\t\taddToGallery = false,\n\t\t\tallowedTypes,\n\t\t\tmultiple = false,\n\t\t\tvalue = DEFAULT_EMPTY_GALLERY,\n\t\t} = this.props;\n\n\t\t// If the value did not changed there is no need to rebuild the frame,\n\t\t// we can continue to use the existing one.\n\t\tif ( value === this.lastGalleryValue ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { wp } = window;\n\n\t\tthis.lastGalleryValue = value;\n\n\t\t// If a frame already existed remove it.\n\t\tif ( this.frame ) {\n\t\t\tthis.frame.remove();\n\t\t}\n\t\tlet currentState;\n\t\tif ( addToGallery ) {\n\t\t\tcurrentState = 'gallery-library';\n\t\t} else {\n\t\t\tcurrentState = value && value.length ? 'gallery-edit' : 'gallery';\n\t\t}\n\t\tif ( ! this.GalleryDetailsMediaFrame ) {\n\t\t\tthis.GalleryDetailsMediaFrame = getGalleryDetailsMediaFrame();\n\t\t}\n\t\tconst attachments = getAttachmentsCollection( value );\n\t\tconst selection = new wp.media.model.Selection( attachments.models, {\n\t\t\tprops: attachments.props.toJSON(),\n\t\t\tmultiple,\n\t\t} );\n\t\tthis.frame = new this.GalleryDetailsMediaFrame( {\n\t\t\tmimeType: allowedTypes,\n\t\t\tstate: currentState,\n\t\t\tmultiple,\n\t\t\tselection,\n\t\t\tediting: value && value.length ? true : false,\n\t\t} );\n\t\twp.media.frame = this.frame;\n\t\tthis.initializeListeners();\n\t}\n\n\t/**\n\t * Initializes the Media Library requirements for the featured image flow.\n\t *\n\t * @return {void}\n\t */\n\tbuildAndSetFeatureImageFrame() {\n\t\tconst { wp } = window;\n\t\tconst { value: featuredImageId, multiple, allowedTypes } = this.props;\n\t\tconst featuredImageFrame = getFeaturedImageMediaFrame();\n\t\tconst attachments = getAttachmentsCollection( featuredImageId );\n\t\tconst selection = new wp.media.model.Selection( attachments.models, {\n\t\t\tprops: attachments.props.toJSON(),\n\t\t} );\n\t\tthis.frame = new featuredImageFrame( {\n\t\t\tmimeType: allowedTypes,\n\t\t\tstate: 'featured-image',\n\t\t\tmultiple,\n\t\t\tselection,\n\t\t\tediting: featuredImageId,\n\t\t} );\n\t\twp.media.frame = this.frame;\n\t\t// In order to select the current featured image when opening\n\t\t// the media library we have to set the appropriate settings.\n\t\t// Currently they are set in php for the post editor, but\n\t\t// not for site editor.\n\t\twp.media.view.settings.post = {\n\t\t\t...wp.media.view.settings.post,\n\t\t\tfeaturedImageId: featuredImageId || -1,\n\t\t};\n\t}\n\n\tcomponentWillUnmount() {\n\t\tthis.frame?.remove();\n\t}\n\n\tonUpdate( selections ) {\n\t\tconst { onSelect, multiple = false } = this.props;\n\t\tconst state = this.frame.state();\n\t\tconst selectedImages = selections || state.get( 'selection' );\n\n\t\tif ( ! selectedImages || ! selectedImages.models.length ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( multiple ) {\n\t\t\tonSelect(\n\t\t\t\tselectedImages.models.map( ( model ) =>\n\t\t\t\t\tslimImageObject( model.toJSON() )\n\t\t\t\t)\n\t\t\t);\n\t\t} else {\n\t\t\tonSelect( slimImageObject( selectedImages.models[ 0 ].toJSON() ) );\n\t\t}\n\t}\n\n\tonSelect() {\n\t\tconst { onSelect, multiple = false } = this.props;\n\t\t// Get media attachment details from the frame state.\n\t\tconst attachment = this.frame.state().get( 'selection' ).toJSON();\n\t\tonSelect( multiple ? attachment : attachment[ 0 ] );\n\t}\n\n\tonOpen() {\n\t\tconst { wp } = window;\n\t\tconst { value } = this.props;\n\t\tthis.updateCollection();\n\n\t\t//Handle active tab in media model on model open.\n\t\tif ( this.props.mode ) {\n\t\t\tthis.frame.content.mode( this.props.mode );\n\t\t}\n\n\t\t// Handle both this.props.value being either (number[]) multiple ids\n\t\t// (for galleries) or a (number) singular id (e.g. image block).\n\t\tconst hasMedia = Array.isArray( value ) ? !! value?.length : !! value;\n\n\t\tif ( ! hasMedia ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst isGallery = this.props.gallery;\n\t\tconst selection = this.frame.state().get( 'selection' );\n\t\tconst valueArray = Array.isArray( value ) ? value : [ value ];\n\n\t\tif ( ! isGallery ) {\n\t\t\tvalueArray.forEach( ( id ) => {\n\t\t\t\tselection.add( wp.media.attachment( id ) );\n\t\t\t} );\n\t\t}\n\n\t\t// Load the images so they are available in the media modal.\n\t\tconst attachments = getAttachmentsCollection( valueArray );\n\n\t\t// Once attachments are loaded, set the current selection.\n\t\tattachments.more().done( function () {\n\t\t\tif ( isGallery && attachments?.models?.length ) {\n\t\t\t\tselection.add( attachments.models );\n\t\t\t}\n\t\t} );\n\t}\n\n\tonClose() {\n\t\tconst { onClose } = this.props;\n\n\t\tif ( onClose ) {\n\t\t\tonClose();\n\t\t}\n\n\t\tthis.frame.detach();\n\t}\n\n\tupdateCollection() {\n\t\tconst frameContent = this.frame.content.get();\n\t\tif ( frameContent && frameContent.collection ) {\n\t\t\tconst collection = frameContent.collection;\n\n\t\t\t// Clean all attachments we have in memory.\n\t\t\tcollection\n\t\t\t\t.toArray()\n\t\t\t\t.forEach( ( model ) => model.trigger( 'destroy', model ) );\n\n\t\t\t// Reset has more flag, if library had small amount of items all items may have been loaded before.\n\t\t\tcollection.mirroring._hasMore = true;\n\n\t\t\t// Request items.\n\t\t\tcollection.more();\n\t\t}\n\t}\n\n\topenModal() {\n\t\tconst {\n\t\t\tallowedTypes,\n\t\t\tgallery = false,\n\t\t\tunstableFeaturedImageFlow = false,\n\t\t\tmodalClass,\n\t\t\tmultiple = false,\n\t\t\ttitle = __( 'Select or Upload Media' ),\n\t\t} = this.props;\n\t\tconst { wp } = window;\n\n\t\tif ( gallery ) {\n\t\t\tthis.buildAndSetGalleryFrame();\n\t\t} else {\n\t\t\tconst frameConfig = {\n\t\t\t\ttitle,\n\t\t\t\tmultiple,\n\t\t\t};\n\t\t\tif ( !! allowedTypes ) {\n\t\t\t\tframeConfig.library = { type: allowedTypes };\n\t\t\t}\n\n\t\t\tthis.frame = wp.media( frameConfig );\n\t\t}\n\n\t\tif ( modalClass ) {\n\t\t\tthis.frame.$el.addClass( modalClass );\n\t\t}\n\n\t\tif ( unstableFeaturedImageFlow ) {\n\t\t\tthis.buildAndSetFeatureImageFrame();\n\t\t}\n\t\tthis.initializeListeners();\n\t\tthis.frame.open();\n\t}\n\n\trender() {\n\t\treturn this.props.render( { open: this.openModal } );\n\t}\n}\n\nexport default MediaUpload;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,oBAAoB;AAC9C,SAASC,EAAE,QAAQ,iBAAiB;AAEpC,MAAMC,qBAAqB,GAAG,EAAE;;AAEhC;AACA;AACA;AACA;AACA;AACA,MAAMC,0BAA0B,GAAGA,CAAA,KAAM;EACxC,MAAM;IAAEC;EAAG,CAAC,GAAGC,MAAM;EAErB,OAAOD,EAAE,CAACE,KAAK,CAACC,IAAI,CAACC,UAAU,CAACC,MAAM,CAACC,MAAM,CAAE;IAC9C;AACF;AACA;AACA;AACA;AACA;IACEC,oBAAoBA,CAAEC,OAAO,EAAG;MAC/B,IAAI,CAACC,mBAAmB,CAAED,OAAO,EAAE;QAClCE,IAA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3E,QAAQ,GAAG,KAAK;MAChBH,KAAK,GAAGvD,EAAE,CAAE,wBAAyB;IACtC,CAAC,GAAG,IAAI,CAAC8F,KAAK;IACd,MAAM;MAAE3F;IAAG,CAAC,GAAGC,MAAM;IAErB,IAAKqH,OAAO,EAAG;MACd,IAAI,CAAC/B,uBAAuB,CAAC,CAAC;IAC/B,CAAC,MAAM;MACN,MAAM4C,WAAW,GAAG;QACnB/E,KAAK;QACLG;MACD,CAAC;MACD,IAAK,CAAC,CAAEkC,YAAY,EAAG;QACtB0C,WAAW,CAACvF,OAAO,GAAG;UAAEc,IAAI,EAAE+B;QAAa,CAAC;MAC7C;MAEA,IAAI,CAACH,KAAK,GAAGtF,EAAE,CAACE,KAAK,CAAEiI,WAAY,CAAC;IACrC;IAEA,IAAKD,UAAU,EAAG;MACjB,IAAI,CAAC5C,KAAK,CAAC8C,GAAG,CAACC,QAAQ,CAAEH,UAAW,CAAC;IACtC;IAEA,IAAKD,yBAAyB,EAAG;MAChC,IAAI,CAAC3B,4BAA4B,CAAC,CAAC;IACpC;IACA,IAAI,CAACjB,mBAAmB,CAAC,CAAC;IAC1B,IAAI,CAACC,KAAK,CAACgD,IAAI,CAAC,CAAC;EAClB;EAEAhH,MAAMA,CAAA,EAAG;IACR,OAAO,IAAI,CAACqE,KAAK,CAACrE,MAAM,CAAE;MAAEgH,IAAI,EAAE,IAAI,CAACvD;IAAU,CAAE,CAAC;EACrD;AACD;AAEA,eAAeH,WAAW","ignoreList":[]}
1
+ {"version":3,"names":["Component","__","DEFAULT_EMPTY_GALLERY","getFeaturedImageMediaFrame","wp","window","media","view","MediaFrame","Select","extend","featuredImageToolbar","toolbar","createSelectToolbar","text","l10n","setFeaturedImage","state","options","editState","selection","get","EditImage","model","single","controller","render","content","set","loadEditor","createStates","on","states","add","FeaturedImage","editImage","getSingleMediaFrame","Library","library","query","multiple","title","priority","filterable","getGalleryDetailsMediaFrame","Post","galleryToolbar","editing","Toolbar","items","insert","style","updateGallery","insertGallery","requires","click","close","trigger","setState","reset","id","createGalleryTitle","editable","type","GalleryEdit","menu","displaySettings","GalleryAdd","slimImageObject","img","attrSet","reduce","result","key","hasOwnProperty","getAttachmentsCollection","ids","order","orderby","post__in","posts_per_page","MediaUpload","constructor","arguments","openModal","bind","onOpen","onSelect","onUpdate","onClose","initializeListeners","frame","buildAndSetGalleryFrame","addToGallery","allowedTypes","value","props","lastGalleryValue","remove","currentState","length","GalleryDetailsMediaFrame","attachments","Selection","models","toJSON","mimeType","buildAndSetFeatureImageFrame","featuredImageId","featuredImageFrame","settings","post","buildAndSetSingleMediaFrame","frameConfig","singleImageFrame","componentWillUnmount","selections","selectedImages","map","attachment","updateCollection","mode","hasMedia","Array","isArray","isGallery","gallery","valueArray","forEach","more","done","detach","frameContent","collection","toArray","mirroring","_hasMore","unstableFeaturedImageFlow","modalClass","$el","addClass","open"],"sources":["@wordpress/media-utils/src/components/media-upload/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\nconst DEFAULT_EMPTY_GALLERY = [];\n\n/**\n * Prepares the Featured Image toolbars and frames.\n *\n * @return {window.wp.media.view.MediaFrame.Select} The default media workflow.\n */\nconst getFeaturedImageMediaFrame = () => {\n\tconst { wp } = window;\n\n\treturn wp.media.view.MediaFrame.Select.extend( {\n\t\t/**\n\t\t * Enables the Set Featured Image Button.\n\t\t *\n\t\t * @param {Object} toolbar toolbar for featured image state\n\t\t * @return {void}\n\t\t */\n\t\tfeaturedImageToolbar( toolbar ) {\n\t\t\tthis.createSelectToolbar( toolbar, {\n\t\t\t\ttext: wp.media.view.l10n.setFeaturedImage,\n\t\t\t\tstate: this.options.state,\n\t\t\t} );\n\t\t},\n\n\t\t/**\n\t\t * Handle the edit state requirements of selected media item.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\teditState() {\n\t\t\tconst selection = this.state( 'featured-image' ).get( 'selection' );\n\t\t\tconst view = new wp.media.view.EditImage( {\n\t\t\t\tmodel: selection.single(),\n\t\t\t\tcontroller: this,\n\t\t\t} ).render();\n\n\t\t\t// Set the view to the EditImage frame using the selected image.\n\t\t\tthis.content.set( view );\n\n\t\t\t// After bringing in the frame, load the actual editor via an ajax call.\n\t\t\tview.loadEditor();\n\t\t},\n\n\t\t/**\n\t\t * Create the default states.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\tcreateStates: function createStates() {\n\t\t\tthis.on(\n\t\t\t\t'toolbar:create:featured-image',\n\t\t\t\tthis.featuredImageToolbar,\n\t\t\t\tthis\n\t\t\t);\n\t\t\tthis.on( 'content:render:edit-image', this.editState, this );\n\n\t\t\tthis.states.add( [\n\t\t\t\tnew wp.media.controller.FeaturedImage(),\n\t\t\t\tnew wp.media.controller.EditImage( {\n\t\t\t\t\tmodel: this.options.editImage,\n\t\t\t\t} ),\n\t\t\t] );\n\t\t},\n\t} );\n};\n\n/**\n * Prepares the default frame for selecting a single media item.\n *\n * @return {window.wp.media.view.MediaFrame.Select} The default media workflow.\n */\nconst getSingleMediaFrame = () => {\n\tconst { wp } = window;\n\n\t// Extend the default Select frame, and use the same `createStates` method as in core,\n\t// but with the addition of `filterable: 'uploaded'` to the Library state, so that\n\t// the user can filter the media library by uploaded media.\n\treturn wp.media.view.MediaFrame.Select.extend( {\n\t\t/**\n\t\t * Create the default states on the frame.\n\t\t */\n\t\tcreateStates() {\n\t\t\tconst options = this.options;\n\n\t\t\tif ( this.options.states ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Add the default states.\n\t\t\tthis.states.add( [\n\t\t\t\t// Main states.\n\t\t\t\tnew wp.media.controller.Library( {\n\t\t\t\t\tlibrary: wp.media.query( options.library ),\n\t\t\t\t\tmultiple: options.multiple,\n\t\t\t\t\ttitle: options.title,\n\t\t\t\t\tpriority: 20,\n\t\t\t\t\tfilterable: 'uploaded', // Allow filtering by uploaded images.\n\t\t\t\t} ),\n\t\t\t\tnew wp.media.controller.EditImage( {\n\t\t\t\t\tmodel: options.editImage,\n\t\t\t\t} ),\n\t\t\t] );\n\t\t},\n\t} );\n};\n\n/**\n * Prepares the Gallery toolbars and frames.\n *\n * @return {window.wp.media.view.MediaFrame.Post} The default media workflow.\n */\nconst getGalleryDetailsMediaFrame = () => {\n\tconst { wp } = window;\n\t/**\n\t * Custom gallery details frame.\n\t *\n\t * @see https://github.com/xwp/wp-core-media-widgets/blob/905edbccfc2a623b73a93dac803c5335519d7837/wp-admin/js/widgets/media-gallery-widget.js\n\t * @class GalleryDetailsMediaFrame\n\t * @class\n\t */\n\treturn wp.media.view.MediaFrame.Post.extend( {\n\t\t/**\n\t\t * Set up gallery toolbar.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\tgalleryToolbar() {\n\t\t\tconst editing = this.state().get( 'editing' );\n\t\t\tthis.toolbar.set(\n\t\t\t\tnew wp.media.view.Toolbar( {\n\t\t\t\t\tcontroller: this,\n\t\t\t\t\titems: {\n\t\t\t\t\t\tinsert: {\n\t\t\t\t\t\t\tstyle: 'primary',\n\t\t\t\t\t\t\ttext: editing\n\t\t\t\t\t\t\t\t? wp.media.view.l10n.updateGallery\n\t\t\t\t\t\t\t\t: wp.media.view.l10n.insertGallery,\n\t\t\t\t\t\t\tpriority: 80,\n\t\t\t\t\t\t\trequires: { library: true },\n\n\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t * @fires wp.media.controller.State#update\n\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\tclick() {\n\t\t\t\t\t\t\t\tconst controller = this.controller,\n\t\t\t\t\t\t\t\t\tstate = controller.state();\n\n\t\t\t\t\t\t\t\tcontroller.close();\n\t\t\t\t\t\t\t\tstate.trigger(\n\t\t\t\t\t\t\t\t\t'update',\n\t\t\t\t\t\t\t\t\tstate.get( 'library' )\n\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\t// Restore and reset the default state.\n\t\t\t\t\t\t\t\tcontroller.setState( controller.options.state );\n\t\t\t\t\t\t\t\tcontroller.reset();\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t} )\n\t\t\t);\n\t\t},\n\n\t\t/**\n\t\t * Handle the edit state requirements of selected media item.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\teditState() {\n\t\t\tconst selection = this.state( 'gallery' ).get( 'selection' );\n\t\t\tconst view = new wp.media.view.EditImage( {\n\t\t\t\tmodel: selection.single(),\n\t\t\t\tcontroller: this,\n\t\t\t} ).render();\n\n\t\t\t// Set the view to the EditImage frame using the selected image.\n\t\t\tthis.content.set( view );\n\n\t\t\t// After bringing in the frame, load the actual editor via an ajax call.\n\t\t\tview.loadEditor();\n\t\t},\n\n\t\t/**\n\t\t * Create the default states.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\tcreateStates: function createStates() {\n\t\t\tthis.on( 'toolbar:create:main-gallery', this.galleryToolbar, this );\n\t\t\tthis.on( 'content:render:edit-image', this.editState, this );\n\n\t\t\tthis.states.add( [\n\t\t\t\tnew wp.media.controller.Library( {\n\t\t\t\t\tid: 'gallery',\n\t\t\t\t\ttitle: wp.media.view.l10n.createGalleryTitle,\n\t\t\t\t\tpriority: 40,\n\t\t\t\t\ttoolbar: 'main-gallery',\n\t\t\t\t\tfilterable: 'uploaded',\n\t\t\t\t\tmultiple: 'add',\n\t\t\t\t\teditable: false,\n\n\t\t\t\t\tlibrary: wp.media.query( {\n\t\t\t\t\t\ttype: 'image',\n\t\t\t\t\t\t...this.options.library,\n\t\t\t\t\t} ),\n\t\t\t\t} ),\n\t\t\t\tnew wp.media.controller.EditImage( {\n\t\t\t\t\tmodel: this.options.editImage,\n\t\t\t\t} ),\n\n\t\t\t\tnew wp.media.controller.GalleryEdit( {\n\t\t\t\t\tlibrary: this.options.selection,\n\t\t\t\t\tediting: this.options.editing,\n\t\t\t\t\tmenu: 'gallery',\n\t\t\t\t\tdisplaySettings: false,\n\t\t\t\t\tmultiple: true,\n\t\t\t\t} ),\n\n\t\t\t\tnew wp.media.controller.GalleryAdd(),\n\t\t\t] );\n\t\t},\n\t} );\n};\n\n// The media library image object contains numerous attributes\n// we only need this set to display the image in the library.\nconst slimImageObject = ( img ) => {\n\tconst attrSet = [\n\t\t'sizes',\n\t\t'mime',\n\t\t'type',\n\t\t'subtype',\n\t\t'id',\n\t\t'url',\n\t\t'alt',\n\t\t'link',\n\t\t'caption',\n\t];\n\treturn attrSet.reduce( ( result, key ) => {\n\t\tif ( img?.hasOwnProperty( key ) ) {\n\t\t\tresult[ key ] = img[ key ];\n\t\t}\n\t\treturn result;\n\t}, {} );\n};\n\nconst getAttachmentsCollection = ( ids ) => {\n\tconst { wp } = window;\n\n\treturn wp.media.query( {\n\t\torder: 'ASC',\n\t\torderby: 'post__in',\n\t\tpost__in: ids,\n\t\tposts_per_page: -1,\n\t\tquery: true,\n\t\ttype: 'image',\n\t} );\n};\n\nclass MediaUpload extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\t\tthis.openModal = this.openModal.bind( this );\n\t\tthis.onOpen = this.onOpen.bind( this );\n\t\tthis.onSelect = this.onSelect.bind( this );\n\t\tthis.onUpdate = this.onUpdate.bind( this );\n\t\tthis.onClose = this.onClose.bind( this );\n\t}\n\n\tinitializeListeners() {\n\t\t// When an image is selected in the media frame...\n\t\tthis.frame.on( 'select', this.onSelect );\n\t\tthis.frame.on( 'update', this.onUpdate );\n\t\tthis.frame.on( 'open', this.onOpen );\n\t\tthis.frame.on( 'close', this.onClose );\n\t}\n\n\t/**\n\t * Sets the Gallery frame and initializes listeners.\n\t *\n\t * @return {void}\n\t */\n\tbuildAndSetGalleryFrame() {\n\t\tconst {\n\t\t\taddToGallery = false,\n\t\t\tallowedTypes,\n\t\t\tmultiple = false,\n\t\t\tvalue = DEFAULT_EMPTY_GALLERY,\n\t\t} = this.props;\n\n\t\t// If the value did not changed there is no need to rebuild the frame,\n\t\t// we can continue to use the existing one.\n\t\tif ( value === this.lastGalleryValue ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { wp } = window;\n\n\t\tthis.lastGalleryValue = value;\n\n\t\t// If a frame already existed remove it.\n\t\tif ( this.frame ) {\n\t\t\tthis.frame.remove();\n\t\t}\n\t\tlet currentState;\n\t\tif ( addToGallery ) {\n\t\t\tcurrentState = 'gallery-library';\n\t\t} else {\n\t\t\tcurrentState = value && value.length ? 'gallery-edit' : 'gallery';\n\t\t}\n\t\tif ( ! this.GalleryDetailsMediaFrame ) {\n\t\t\tthis.GalleryDetailsMediaFrame = getGalleryDetailsMediaFrame();\n\t\t}\n\t\tconst attachments = getAttachmentsCollection( value );\n\t\tconst selection = new wp.media.model.Selection( attachments.models, {\n\t\t\tprops: attachments.props.toJSON(),\n\t\t\tmultiple,\n\t\t} );\n\t\tthis.frame = new this.GalleryDetailsMediaFrame( {\n\t\t\tmimeType: allowedTypes,\n\t\t\tstate: currentState,\n\t\t\tmultiple,\n\t\t\tselection,\n\t\t\tediting: !! value?.length,\n\t\t} );\n\t\twp.media.frame = this.frame;\n\t\tthis.initializeListeners();\n\t}\n\n\t/**\n\t * Initializes the Media Library requirements for the featured image flow.\n\t *\n\t * @return {void}\n\t */\n\tbuildAndSetFeatureImageFrame() {\n\t\tconst { wp } = window;\n\t\tconst { value: featuredImageId, multiple, allowedTypes } = this.props;\n\t\tconst featuredImageFrame = getFeaturedImageMediaFrame();\n\t\tconst attachments = getAttachmentsCollection( featuredImageId );\n\t\tconst selection = new wp.media.model.Selection( attachments.models, {\n\t\t\tprops: attachments.props.toJSON(),\n\t\t} );\n\t\tthis.frame = new featuredImageFrame( {\n\t\t\tmimeType: allowedTypes,\n\t\t\tstate: 'featured-image',\n\t\t\tmultiple,\n\t\t\tselection,\n\t\t\tediting: featuredImageId,\n\t\t} );\n\t\twp.media.frame = this.frame;\n\t\t// In order to select the current featured image when opening\n\t\t// the media library we have to set the appropriate settings.\n\t\t// Currently they are set in php for the post editor, but\n\t\t// not for site editor.\n\t\twp.media.view.settings.post = {\n\t\t\t...wp.media.view.settings.post,\n\t\t\tfeaturedImageId: featuredImageId || -1,\n\t\t};\n\t}\n\n\t/**\n\t * Initializes the Media Library requirements for the single image flow.\n\t *\n\t * @return {void}\n\t */\n\tbuildAndSetSingleMediaFrame() {\n\t\tconst { wp } = window;\n\t\tconst {\n\t\t\tallowedTypes,\n\t\t\tmultiple = false,\n\t\t\ttitle = __( 'Select or Upload Media' ),\n\t\t\tvalue,\n\t\t} = this.props;\n\n\t\tconst frameConfig = {\n\t\t\ttitle,\n\t\t\tmultiple,\n\t\t};\n\t\tif ( !! allowedTypes ) {\n\t\t\tframeConfig.library = { type: allowedTypes };\n\t\t}\n\n\t\t// If a frame already exists, remove it.\n\t\tif ( this.frame ) {\n\t\t\tthis.frame.remove();\n\t\t}\n\n\t\tconst singleImageFrame = getSingleMediaFrame();\n\t\tconst attachments = getAttachmentsCollection( value );\n\t\tconst selection = new wp.media.model.Selection( attachments.models, {\n\t\t\tprops: attachments.props.toJSON(),\n\t\t} );\n\t\tthis.frame = new singleImageFrame( {\n\t\t\tmimeType: allowedTypes,\n\t\t\tmultiple,\n\t\t\tselection,\n\t\t\t...frameConfig,\n\t\t} );\n\t\twp.media.frame = this.frame;\n\t}\n\n\tcomponentWillUnmount() {\n\t\tthis.frame?.remove();\n\t}\n\n\tonUpdate( selections ) {\n\t\tconst { onSelect, multiple = false } = this.props;\n\t\tconst state = this.frame.state();\n\t\tconst selectedImages = selections || state.get( 'selection' );\n\n\t\tif ( ! selectedImages || ! selectedImages.models.length ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( multiple ) {\n\t\t\tonSelect(\n\t\t\t\tselectedImages.models.map( ( model ) =>\n\t\t\t\t\tslimImageObject( model.toJSON() )\n\t\t\t\t)\n\t\t\t);\n\t\t} else {\n\t\t\tonSelect( slimImageObject( selectedImages.models[ 0 ].toJSON() ) );\n\t\t}\n\t}\n\n\tonSelect() {\n\t\tconst { onSelect, multiple = false } = this.props;\n\t\t// Get media attachment details from the frame state.\n\t\tconst attachment = this.frame.state().get( 'selection' ).toJSON();\n\t\tonSelect( multiple ? attachment : attachment[ 0 ] );\n\t}\n\n\tonOpen() {\n\t\tconst { wp } = window;\n\t\tconst { value } = this.props;\n\t\tthis.updateCollection();\n\n\t\t//Handle active tab in media model on model open.\n\t\tif ( this.props.mode ) {\n\t\t\tthis.frame.content.mode( this.props.mode );\n\t\t}\n\n\t\t// Handle both this.props.value being either (number[]) multiple ids\n\t\t// (for galleries) or a (number) singular id (e.g. image block).\n\t\tconst hasMedia = Array.isArray( value ) ? !! value?.length : !! value;\n\n\t\tif ( ! hasMedia ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst isGallery = this.props.gallery;\n\t\tconst selection = this.frame.state().get( 'selection' );\n\t\tconst valueArray = Array.isArray( value ) ? value : [ value ];\n\n\t\tif ( ! isGallery ) {\n\t\t\tvalueArray.forEach( ( id ) => {\n\t\t\t\tselection.add( wp.media.attachment( id ) );\n\t\t\t} );\n\t\t}\n\n\t\t// Load the images so they are available in the media modal.\n\t\tconst attachments = getAttachmentsCollection( valueArray );\n\n\t\t// Once attachments are loaded, set the current selection.\n\t\tattachments.more().done( function () {\n\t\t\tif ( isGallery && attachments?.models?.length ) {\n\t\t\t\tselection.add( attachments.models );\n\t\t\t}\n\t\t} );\n\t}\n\n\tonClose() {\n\t\tconst { onClose } = this.props;\n\n\t\tif ( onClose ) {\n\t\t\tonClose();\n\t\t}\n\n\t\tthis.frame.detach();\n\t}\n\n\tupdateCollection() {\n\t\tconst frameContent = this.frame.content.get();\n\t\tif ( frameContent && frameContent.collection ) {\n\t\t\tconst collection = frameContent.collection;\n\n\t\t\t// Clean all attachments we have in memory.\n\t\t\tcollection\n\t\t\t\t.toArray()\n\t\t\t\t.forEach( ( model ) => model.trigger( 'destroy', model ) );\n\n\t\t\t// Reset has more flag, if library had small amount of items all items may have been loaded before.\n\t\t\tcollection.mirroring._hasMore = true;\n\n\t\t\t// Request items.\n\t\t\tcollection.more();\n\t\t}\n\t}\n\n\topenModal() {\n\t\tconst {\n\t\t\tgallery = false,\n\t\t\tunstableFeaturedImageFlow = false,\n\t\t\tmodalClass,\n\t\t} = this.props;\n\n\t\tif ( gallery ) {\n\t\t\tthis.buildAndSetGalleryFrame();\n\t\t} else {\n\t\t\tthis.buildAndSetSingleMediaFrame();\n\t\t}\n\n\t\tif ( modalClass ) {\n\t\t\tthis.frame.$el.addClass( modalClass );\n\t\t}\n\n\t\tif ( unstableFeaturedImageFlow ) {\n\t\t\tthis.buildAndSetFeatureImageFrame();\n\t\t}\n\t\tthis.initializeListeners();\n\t\tthis.frame.open();\n\t}\n\n\trender() {\n\t\treturn this.props.render( { open: this.openModal } );\n\t}\n}\n\nexport default MediaUpload;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,oBAAoB;AAC9C,SAASC,EAAE,QAAQ,iBAAiB;AAEpC,MAAMC,qBAAqB,GAAG,EAAE;;AAEhC;AACA;AACA;AACA;AACA;AACA,MAAMC,0BAA0B,GAAGA,CAAA,KAAM;EACxC,MAAM;IAAEC;EAAG,CAAC,GAAGC,MAAM;EAErB,OAAOD,EAAE,CAACE,KAAK,CAACC,IAAI,CAACC,UAAU,CAACC,MAAM,CAACC,MAAM,CAAE;IAC9C;AACF;AACA;AACA;AACA;AACA;IACEC,oBAAoBA,CAAEC,OAAO,EAAG;MAC/B,IAAI,CAACC,mBAAmB,CAAED,OAAO,EAAE;QAClCE,IAAI,EAAEV,EAAE,CAACE,KAAK,CAACC,IAAI,CAACQ,IAAI,CAACC,gBAAgB;QACzCC,KAAK,EAAE,IAAI,CAACC,OAAO,CAACD;MACrB,CAAE,CAAC;IACJ,CAAC;IAED;AACF;AACA;AACA;AACA;IACEE,SAASA,CAAA,EAAG;MACX,MAAMC,SAAS,GAAG,IAAI,CAACH,KAAK,CAAE,gBAAiB,CAAC,CAACI,GAAG,CAAE,WAAY,CAAC;MACnE,MAAMd,IAAI,GAAG,IAAIH,EAAE,CAACE,KAAK,CAACC,IAAI,C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IAAMA,KAAK,CAACkC,OAAO,CAAE,SAAS,EAAElC,KAAM,CAAE,CAAC;;MAE3D;MACA8G,UAAU,CAACE,SAAS,CAACC,QAAQ,GAAG,IAAI;;MAEpC;MACAH,UAAU,CAACJ,IAAI,CAAC,CAAC;IAClB;EACD;EAEA7C,SAASA,CAAA,EAAG;IACX,MAAM;MACL0C,OAAO,GAAG,KAAK;MACfW,yBAAyB,GAAG,KAAK;MACjCC;IACD,CAAC,GAAG,IAAI,CAAC1C,KAAK;IAEd,IAAK8B,OAAO,EAAG;MACd,IAAI,CAAClC,uBAAuB,CAAC,CAAC;IAC/B,CAAC,MAAM;MACN,IAAI,CAACoB,2BAA2B,CAAC,CAAC;IACnC;IAEA,IAAK0B,UAAU,EAAG;MACjB,IAAI,CAAC/C,KAAK,CAACgD,GAAG,CAACC,QAAQ,CAAEF,UAAW,CAAC;IACtC;IAEA,IAAKD,yBAAyB,EAAG;MAChC,IAAI,CAAC9B,4BAA4B,CAAC,CAAC;IACpC;IACA,IAAI,CAACjB,mBAAmB,CAAC,CAAC;IAC1B,IAAI,CAACC,KAAK,CAACkD,IAAI,CAAC,CAAC;EAClB;EAEAnH,MAAMA,CAAA,EAAG;IACR,OAAO,IAAI,CAACsE,KAAK,CAACtE,MAAM,CAAE;MAAEmH,IAAI,EAAE,IAAI,CAACzD;IAAU,CAAE,CAAC;EACrD;AACD;AAEA,eAAeH,WAAW","ignoreList":[]}
@@ -4,4 +4,5 @@ export { transformAttachment } from './utils/transform-attachment';
4
4
  export { validateFileSize } from './utils/validate-file-size';
5
5
  export { validateMimeType } from './utils/validate-mime-type';
6
6
  export { validateMimeTypeForUser } from './utils/validate-mime-type-for-user';
7
+ export { privateApis } from './private-apis';
7
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["uploadMedia","transformAttachment","validateFileSize","validateMimeType","validateMimeTypeForUser"],"sources":["@wordpress/media-utils/src/index.ts"],"sourcesContent":["export * from './components';\n\nexport { uploadMedia } from './utils/upload-media';\nexport { transformAttachment } from './utils/transform-attachment';\nexport { validateFileSize } from './utils/validate-file-size';\nexport { validateMimeType } from './utils/validate-mime-type';\nexport { validateMimeTypeForUser } from './utils/validate-mime-type-for-user';\n\nexport type { Attachment, RestAttachment } from './utils/types';\n"],"mappings":"AAAA,cAAc,cAAc;AAE5B,SAASA,WAAW,QAAQ,sBAAsB;AAClD,SAASC,mBAAmB,QAAQ,8BAA8B;AAClE,SAASC,gBAAgB,QAAQ,4BAA4B;AAC7D,SAASC,gBAAgB,QAAQ,4BAA4B;AAC7D,SAASC,uBAAuB,QAAQ,qCAAqC","ignoreList":[]}
1
+ {"version":3,"names":["uploadMedia","transformAttachment","validateFileSize","validateMimeType","validateMimeTypeForUser","privateApis"],"sources":["@wordpress/media-utils/src/index.ts"],"sourcesContent":["export * from './components';\n\nexport { uploadMedia } from './utils/upload-media';\nexport { transformAttachment } from './utils/transform-attachment';\nexport { validateFileSize } from './utils/validate-file-size';\nexport { validateMimeType } from './utils/validate-mime-type';\nexport { validateMimeTypeForUser } from './utils/validate-mime-type-for-user';\n\nexport type { Attachment, RestAttachment } from './utils/types';\n\nexport { privateApis } from './private-apis';\n"],"mappings":"AAAA,cAAc,cAAc;AAE5B,SAASA,WAAW,QAAQ,sBAAsB;AAClD,SAASC,mBAAmB,QAAQ,8BAA8B;AAClE,SAASC,gBAAgB,QAAQ,4BAA4B;AAC7D,SAASC,gBAAgB,QAAQ,4BAA4B;AAC7D,SAASC,uBAAuB,QAAQ,qCAAqC;AAI7E,SAASC,WAAW,QAAQ,gBAAgB","ignoreList":[]}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';
5
+ export const {
6
+ lock,
7
+ unlock
8
+ } = __dangerousOptInToUnstableAPIsOnlyForCoreModules('I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.', '@wordpress/media-utils');
9
+ //# sourceMappingURL=lock-unlock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["__dangerousOptInToUnstableAPIsOnlyForCoreModules","lock","unlock"],"sources":["@wordpress/media-utils/src/lock-unlock.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';\n\nexport const { lock, unlock } =\n\t__dangerousOptInToUnstableAPIsOnlyForCoreModules(\n\t\t'I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.',\n\t\t'@wordpress/media-utils'\n\t);\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,gDAAgD,QAAQ,yBAAyB;AAE1F,OAAO,MAAM;EAAEC,IAAI;EAAEC;AAAO,CAAC,GAC5BF,gDAAgD,CAC/C,+HAA+H,EAC/H,wBACD,CAAC","ignoreList":[]}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ import { sideloadMedia } from './utils/sideload-media';
5
+ import { lock } from './lock-unlock';
6
+
7
+ /**
8
+ * Private @wordpress/media-utils APIs.
9
+ */
10
+ export const privateApis = {};
11
+ lock(privateApis, {
12
+ sideloadMedia
13
+ });
14
+ //# sourceMappingURL=private-apis.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["sideloadMedia","lock","privateApis"],"sources":["@wordpress/media-utils/src/private-apis.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { sideloadMedia } from './utils/sideload-media';\nimport { lock } from './lock-unlock';\n\n/**\n * Private @wordpress/media-utils APIs.\n */\nexport const privateApis = {};\n\nlock( privateApis, {\n\tsideloadMedia,\n} );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,aAAa,QAAQ,wBAAwB;AACtD,SAASC,IAAI,QAAQ,eAAe;;AAEpC;AACA;AACA;AACA,OAAO,MAAMC,WAAW,GAAG,CAAC,CAAC;AAE7BD,IAAI,CAAEC,WAAW,EAAE;EAClBF;AACD,CAAE,CAAC","ignoreList":[]}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { __, sprintf } from '@wordpress/i18n';
5
+
6
+ /**
7
+ * Internal dependencies
8
+ */
9
+
10
+ import { sideloadToServer } from './sideload-to-server';
11
+ import { UploadError } from './upload-error';
12
+ const noop = () => {};
13
+ /**
14
+ * Uploads a file to the server without creating an attachment.
15
+ *
16
+ * @param $0 Parameters object passed to the function.
17
+ * @param $0.file Media File to Save.
18
+ * @param $0.attachmentId Parent attachment ID.
19
+ * @param $0.additionalData Additional data to include in the request.
20
+ * @param $0.signal Abort signal.
21
+ * @param $0.onFileChange Function called each time a file or a temporary representation of the file is available.
22
+ * @param $0.onError Function called when an error happens.
23
+ */
24
+ export async function sideloadMedia({
25
+ file,
26
+ attachmentId,
27
+ additionalData = {},
28
+ signal,
29
+ onFileChange,
30
+ onError = noop
31
+ }) {
32
+ try {
33
+ const attachment = await sideloadToServer(file, attachmentId, additionalData, signal);
34
+ onFileChange?.([attachment]);
35
+ } catch (error) {
36
+ let message;
37
+ if (error instanceof Error) {
38
+ message = error.message;
39
+ } else {
40
+ message = sprintf(
41
+ // translators: %s: file name
42
+ __('Error while sideloading file %s to the server.'), file.name);
43
+ }
44
+ onError(new UploadError({
45
+ code: 'GENERAL',
46
+ message,
47
+ file,
48
+ cause: error instanceof Error ? error : undefined
49
+ }));
50
+ }
51
+ }
52
+ //# sourceMappingURL=sideload-media.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["__","sprintf","sideloadToServer","UploadError","noop","sideloadMedia","file","attachmentId","additionalData","signal","onFileChange","onError","attachment","error","message","Error","name","code","cause","undefined"],"sources":["@wordpress/media-utils/src/utils/sideload-media.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport type {\n\tOnChangeHandler,\n\tOnErrorHandler,\n\tCreateSideloadFile,\n\tRestAttachment,\n} from './types';\nimport { sideloadToServer } from './sideload-to-server';\nimport { UploadError } from './upload-error';\n\nconst noop = () => {};\n\ninterface SideloadMediaArgs {\n\t// Additional data to include in the request.\n\tadditionalData?: CreateSideloadFile;\n\t// File to sideload.\n\tfile: File;\n\t// Attachment ID.\n\tattachmentId: RestAttachment[ 'id' ];\n\t// Function called when an error happens.\n\tonError?: OnErrorHandler;\n\t// Function called each time a file or a temporary representation of the file is available.\n\tonFileChange?: OnChangeHandler;\n\t// Abort signal.\n\tsignal?: AbortSignal;\n}\n\n/**\n * Uploads a file to the server without creating an attachment.\n *\n * @param $0 Parameters object passed to the function.\n * @param $0.file Media File to Save.\n * @param $0.attachmentId Parent attachment ID.\n * @param $0.additionalData Additional data to include in the request.\n * @param $0.signal Abort signal.\n * @param $0.onFileChange Function called each time a file or a temporary representation of the file is available.\n * @param $0.onError Function called when an error happens.\n */\nexport async function sideloadMedia( {\n\tfile,\n\tattachmentId,\n\tadditionalData = {},\n\tsignal,\n\tonFileChange,\n\tonError = noop,\n}: SideloadMediaArgs ) {\n\ttry {\n\t\tconst attachment = await sideloadToServer(\n\t\t\tfile,\n\t\t\tattachmentId,\n\t\t\tadditionalData,\n\t\t\tsignal\n\t\t);\n\t\tonFileChange?.( [ attachment ] );\n\t} catch ( error ) {\n\t\tlet message;\n\t\tif ( error instanceof Error ) {\n\t\t\tmessage = error.message;\n\t\t} else {\n\t\t\tmessage = sprintf(\n\t\t\t\t// translators: %s: file name\n\t\t\t\t__( 'Error while sideloading file %s to the server.' ),\n\t\t\t\tfile.name\n\t\t\t);\n\t\t}\n\t\tonError(\n\t\t\tnew UploadError( {\n\t\t\t\tcode: 'GENERAL',\n\t\t\t\tmessage,\n\t\t\t\tfile,\n\t\t\t\tcause: error instanceof Error ? error : undefined,\n\t\t\t} )\n\t\t);\n\t}\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;;AAE7C;AACA;AACA;;AAOA,SAASC,gBAAgB,QAAQ,sBAAsB;AACvD,SAASC,WAAW,QAAQ,gBAAgB;AAE5C,MAAMC,IAAI,GAAGA,CAAA,KAAM,CAAC,CAAC;AAiBrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeC,aAAaA,CAAE;EACpCC,IAAI;EACJC,YAAY;EACZC,cAAc,GAAG,CAAC,CAAC;EACnBC,MAAM;EACNC,YAAY;EACZC,OAAO,GAAGP;AACQ,CAAC,EAAG;EACtB,IAAI;IACH,MAAMQ,UAAU,GAAG,MAAMV,gBAAgB,CACxCI,IAAI,EACJC,YAAY,EACZC,cAAc,EACdC,MACD,CAAC;IACDC,YAAY,GAAI,CAAEE,UAAU,CAAG,CAAC;EACjC,CAAC,CAAC,OAAQC,KAAK,EAAG;IACjB,IAAIC,OAAO;IACX,IAAKD,KAAK,YAAYE,KAAK,EAAG;MAC7BD,OAAO,GAAGD,KAAK,CAACC,OAAO;IACxB,CAAC,MAAM;MACNA,OAAO,GAAGb,OAAO;MAChB;MACAD,EAAE,CAAE,gDAAiD,CAAC,EACtDM,IAAI,CAACU,IACN,CAAC;IACF;IACAL,OAAO,CACN,IAAIR,WAAW,CAAE;MAChBc,IAAI,EAAE,SAAS;MACfH,OAAO;MACPR,IAAI;MACJY,KAAK,EAAEL,KAAK,YAAYE,KAAK,GAAGF,KAAK,GAAGM;IACzC,CAAE,CACH,CAAC;EACF;AACD","ignoreList":[]}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import apiFetch from '@wordpress/api-fetch';
5
+
6
+ /**
7
+ * Internal dependencies
8
+ */
9
+
10
+ import { flattenFormData } from './flatten-form-data';
11
+ import { transformAttachment } from './transform-attachment';
12
+
13
+ /**
14
+ * Uploads a file to the server without creating an attachment.
15
+ *
16
+ * @param file Media File to Save.
17
+ * @param attachmentId Parent attachment ID.
18
+ * @param additionalData Additional data to include in the request.
19
+ * @param signal Abort signal.
20
+ *
21
+ * @return The saved attachment.
22
+ */
23
+ export async function sideloadToServer(file, attachmentId, additionalData = {}, signal) {
24
+ // Create upload payload.
25
+ const data = new FormData();
26
+ data.append('file', file, file.name || file.type.replace('/', '.'));
27
+ for (const [key, value] of Object.entries(additionalData)) {
28
+ flattenFormData(data, key, value);
29
+ }
30
+ return transformAttachment(await apiFetch({
31
+ path: `/wp/v2/media/${attachmentId}/sideload`,
32
+ body: data,
33
+ method: 'POST',
34
+ signal
35
+ }));
36
+ }
37
+ //# sourceMappingURL=sideload-to-server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["apiFetch","flattenFormData","transformAttachment","sideloadToServer","file","attachmentId","additionalData","signal","data","FormData","append","name","type","replace","key","value","Object","entries","path","body","method"],"sources":["@wordpress/media-utils/src/utils/sideload-to-server.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\n\n/**\n * Internal dependencies\n */\nimport type { CreateSideloadFile, RestAttachment } from './types';\nimport { flattenFormData } from './flatten-form-data';\nimport { transformAttachment } from './transform-attachment';\n\n/**\n * Uploads a file to the server without creating an attachment.\n *\n * @param file Media File to Save.\n * @param attachmentId Parent attachment ID.\n * @param additionalData Additional data to include in the request.\n * @param signal Abort signal.\n *\n * @return The saved attachment.\n */\nexport async function sideloadToServer(\n\tfile: File,\n\tattachmentId: RestAttachment[ 'id' ],\n\tadditionalData: CreateSideloadFile = {},\n\tsignal?: AbortSignal\n) {\n\t// Create upload payload.\n\tconst data = new FormData();\n\tdata.append( 'file', file, file.name || file.type.replace( '/', '.' ) );\n\tfor ( const [ key, value ] of Object.entries( additionalData ) ) {\n\t\tflattenFormData(\n\t\t\tdata,\n\t\t\tkey,\n\t\t\tvalue as string | Record< string, string > | undefined\n\t\t);\n\t}\n\n\treturn transformAttachment(\n\t\tawait apiFetch< RestAttachment >( {\n\t\t\tpath: `/wp/v2/media/${ attachmentId }/sideload`,\n\t\t\tbody: data,\n\t\t\tmethod: 'POST',\n\t\t\tsignal,\n\t\t} )\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,QAAQ,MAAM,sBAAsB;;AAE3C;AACA;AACA;;AAEA,SAASC,eAAe,QAAQ,qBAAqB;AACrD,SAASC,mBAAmB,QAAQ,wBAAwB;;AAE5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeC,gBAAgBA,CACrCC,IAAU,EACVC,YAAoC,EACpCC,cAAkC,GAAG,CAAC,CAAC,EACvCC,MAAoB,EACnB;EACD;EACA,MAAMC,IAAI,GAAG,IAAIC,QAAQ,CAAC,CAAC;EAC3BD,IAAI,CAACE,MAAM,CAAE,MAAM,EAAEN,IAAI,EAAEA,IAAI,CAACO,IAAI,IAAIP,IAAI,CAACQ,IAAI,CAACC,OAAO,CAAE,GAAG,EAAE,GAAI,CAAE,CAAC;EACvE,KAAM,MAAM,CAAEC,GAAG,EAAEC,KAAK,CAAE,IAAIC,MAAM,CAACC,OAAO,CAAEX,cAAe,CAAC,EAAG;IAChEL,eAAe,CACdO,IAAI,EACJM,GAAG,EACHC,KACD,CAAC;EACF;EAEA,OAAOb,mBAAmB,CACzB,MAAMF,QAAQ,CAAoB;IACjCkB,IAAI,EAAE,gBAAiBb,YAAY,WAAY;IAC/Cc,IAAI,EAAEX,IAAI;IACVY,MAAM,EAAE,MAAM;IACdb;EACD,CAAE,CACH,CAAC;AACF","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["@wordpress/media-utils/src/utils/types.ts"],"sourcesContent":["/**\n * A media attachment object in a REST API context.\n *\n * Simplified version of what's defined in the wp-types package.\n *\n * @see https://www.npmjs.com/package/wp-types\n */\ninterface WP_REST_API_Attachment {\n\t/**\n\t * Unique identifier for the attachment.\n\t */\n\tid: number;\n\t/**\n\t * The ID of the featured media for the post.\n\t */\n\tfeatured_media: number;\n\t/**\n\t * URL to the attachment.\n\t */\n\tlink: string;\n\t/**\n\t * The date the attachment was published, in the site's timezone.\n\t */\n\tdate: string;\n\t/**\n\t * The date the attachment was published, as GMT.\n\t */\n\tdate_gmt: string;\n\t/**\n\t * The date the attachment was last modified, in the site's timezone.\n\t */\n\tmodified: string;\n\t/**\n\t * The date the attachment was last modified, as GMT.\n\t */\n\tmodified_gmt: string;\n\t/**\n\t * An alphanumeric identifier for the attachment unique to its type.\n\t */\n\tslug: string;\n\t/**\n\t * A named status for the attachment.\n\t */\n\tstatus: string;\n\t/**\n\t * Type of Post for the attachment.\n\t */\n\ttype: 'attachment';\n\t/**\n\t * Alternative text to display when attachment is not displayed.\n\t */\n\talt_text: string;\n\t/**\n\t * The attachment caption.\n\t */\n\tcaption: {\n\t\t/**\n\t\t * Caption for the attachment, as it exists in the database. Only present when using the 'edit' context.\n\t\t */\n\t\traw?: string;\n\t\t/**\n\t\t * HTML caption for the attachment, transformed for display.\n\t\t */\n\t\trendered: string;\n\t};\n\t/**\n\t * The attachment description.\n\t */\n\tdescription: {\n\t\t/**\n\t\t * Description for the attachment, as it exists in the database. Only present when using the 'edit' context.\n\t\t */\n\t\traw?: string;\n\t\t/**\n\t\t * HTML description for the attachment, transformed for display.\n\t\t */\n\t\trendered: string;\n\t};\n\t/**\n\t * Attachment type.\n\t */\n\tmedia_type: 'image' | 'file';\n\t/**\n\t * The attachment MIME type.\n\t */\n\tmime_type: string;\n\t/**\n\t * Details about the media file, specific to its type.\n\t */\n\tmedia_details: {\n\t\t[ k: string ]: unknown;\n\t};\n\t/**\n\t * The ID for the associated post of the attachment.\n\t */\n\tpost: number | null;\n\t/**\n\t * URL to the original attachment file.\n\t */\n\tsource_url: string;\n\t/**\n\t * List of the missing image sizes of the attachment. Only present when using the 'edit' context.\n\t */\n\tmissing_image_sizes?: string[];\n\t/**\n\t * Permalink template for the attachment. Only present when using the 'edit' context and the post type is public.\n\t */\n\tpermalink_template?: string;\n\t/**\n\t * Slug automatically generated from the attachment title. Only present when using the 'edit' context and the post type is public.\n\t */\n\tgenerated_slug?: string;\n\t/**\n\t * An array of the class names for the post container element.\n\t */\n\tclass_list: string[];\n\t/**\n\t * The title for the attachment.\n\t */\n\ttitle: {\n\t\t/**\n\t\t * Title for the attachment, as it exists in the database. Only present when using the 'edit' context.\n\t\t */\n\t\traw?: string;\n\t\t/**\n\t\t * HTML title for the attachment, transformed for display.\n\t\t */\n\t\trendered: string;\n\t};\n\t/**\n\t * The ID for the author of the attachment.\n\t */\n\tauthor: number;\n\t/**\n\t * Whether or not comments are open on the attachment.\n\t */\n\tcomment_status: string;\n\t/**\n\t * Whether or not the attachment can be pinged.\n\t */\n\tping_status: string;\n\t/**\n\t * Meta fields.\n\t */\n\tmeta:\n\t\t| []\n\t\t| {\n\t\t\t\t[ k: string ]: unknown;\n\t\t };\n\t/**\n\t * The theme file to use to display the attachment.\n\t */\n\ttemplate: string;\n\t_links: {\n\t\t[ k: string ]: {\n\t\t\thref: string;\n\t\t\tembeddable?: boolean;\n\t\t\t[ k: string ]: unknown;\n\t\t}[];\n\t};\n\t/**\n\t * The embedded representation of relations. Only present when the '_embed' query parameter is set.\n\t */\n\t_embedded?: {\n\t\t/**\n\t\t * The author of the post.\n\t\t */\n\t\tauthor: unknown[];\n\t\t/**\n\t\t * The featured image post.\n\t\t */\n\t\t'wp:featuredmedia'?: WP_REST_API_Attachment[];\n\t\t[ k: string ]: unknown;\n\t};\n\t[ k: string ]: unknown;\n}\n\n/**\n * REST API attachment object with additional fields added by this project.\n */\nexport interface RestAttachment extends WP_REST_API_Attachment {}\n\ntype BetterOmit< T, K extends PropertyKey > = {\n\t[ P in keyof T as P extends K ? never : P ]: T[ P ];\n};\n\n/**\n * Transformed attachment object.\n */\nexport type Attachment = BetterOmit<\n\tRestAttachment,\n\t'alt_text' | 'source_url' | 'caption' | 'title'\n> & {\n\talt: WP_REST_API_Attachment[ 'alt_text' ];\n\tcaption: WP_REST_API_Attachment[ 'caption' ][ 'raw' ] & string;\n\ttitle: WP_REST_API_Attachment[ 'title' ][ 'raw' ];\n\turl: WP_REST_API_Attachment[ 'source_url' ];\n\tposter?: WP_REST_API_Attachment[ 'source_url' ];\n};\n\nexport type OnChangeHandler = ( attachments: Partial< Attachment >[] ) => void;\nexport type OnSuccessHandler = ( attachments: Partial< Attachment >[] ) => void;\nexport type OnErrorHandler = ( error: Error ) => void;\n\nexport type CreateRestAttachment = Partial< RestAttachment >;\n\nexport type AdditionalData = BetterOmit< CreateRestAttachment, 'meta' >;\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["@wordpress/media-utils/src/utils/types.ts"],"sourcesContent":["/**\n * A media attachment object in a REST API context.\n *\n * Simplified version of what's defined in the wp-types package.\n *\n * @see https://www.npmjs.com/package/wp-types\n */\ninterface WP_REST_API_Attachment {\n\t/**\n\t * Unique identifier for the attachment.\n\t */\n\tid: number;\n\t/**\n\t * The ID of the featured media for the post.\n\t */\n\tfeatured_media: number;\n\t/**\n\t * URL to the attachment.\n\t */\n\tlink: string;\n\t/**\n\t * The date the attachment was published, in the site's timezone.\n\t */\n\tdate: string;\n\t/**\n\t * The date the attachment was published, as GMT.\n\t */\n\tdate_gmt: string;\n\t/**\n\t * The date the attachment was last modified, in the site's timezone.\n\t */\n\tmodified: string;\n\t/**\n\t * The date the attachment was last modified, as GMT.\n\t */\n\tmodified_gmt: string;\n\t/**\n\t * An alphanumeric identifier for the attachment unique to its type.\n\t */\n\tslug: string;\n\t/**\n\t * A named status for the attachment.\n\t */\n\tstatus: string;\n\t/**\n\t * Type of Post for the attachment.\n\t */\n\ttype: 'attachment';\n\t/**\n\t * Alternative text to display when attachment is not displayed.\n\t */\n\talt_text: string;\n\t/**\n\t * The attachment caption.\n\t */\n\tcaption: {\n\t\t/**\n\t\t * Caption for the attachment, as it exists in the database. Only present when using the 'edit' context.\n\t\t */\n\t\traw?: string;\n\t\t/**\n\t\t * HTML caption for the attachment, transformed for display.\n\t\t */\n\t\trendered: string;\n\t};\n\t/**\n\t * The attachment description.\n\t */\n\tdescription: {\n\t\t/**\n\t\t * Description for the attachment, as it exists in the database. Only present when using the 'edit' context.\n\t\t */\n\t\traw?: string;\n\t\t/**\n\t\t * HTML description for the attachment, transformed for display.\n\t\t */\n\t\trendered: string;\n\t};\n\t/**\n\t * Attachment type.\n\t */\n\tmedia_type: 'image' | 'file';\n\t/**\n\t * The attachment MIME type.\n\t */\n\tmime_type: string;\n\t/**\n\t * Details about the media file, specific to its type.\n\t */\n\tmedia_details: {\n\t\t[ k: string ]: unknown;\n\t};\n\t/**\n\t * The ID for the associated post of the attachment.\n\t */\n\tpost: number | null;\n\t/**\n\t * URL to the original attachment file.\n\t */\n\tsource_url: string;\n\t/**\n\t * List of the missing image sizes of the attachment. Only present when using the 'edit' context.\n\t */\n\tmissing_image_sizes?: string[];\n\t/**\n\t * Permalink template for the attachment. Only present when using the 'edit' context and the post type is public.\n\t */\n\tpermalink_template?: string;\n\t/**\n\t * Slug automatically generated from the attachment title. Only present when using the 'edit' context and the post type is public.\n\t */\n\tgenerated_slug?: string;\n\t/**\n\t * An array of the class names for the post container element.\n\t */\n\tclass_list: string[];\n\t/**\n\t * The title for the attachment.\n\t */\n\ttitle: {\n\t\t/**\n\t\t * Title for the attachment, as it exists in the database. Only present when using the 'edit' context.\n\t\t */\n\t\traw?: string;\n\t\t/**\n\t\t * HTML title for the attachment, transformed for display.\n\t\t */\n\t\trendered: string;\n\t};\n\t/**\n\t * The ID for the author of the attachment.\n\t */\n\tauthor: number;\n\t/**\n\t * Whether or not comments are open on the attachment.\n\t */\n\tcomment_status: string;\n\t/**\n\t * Whether or not the attachment can be pinged.\n\t */\n\tping_status: string;\n\t/**\n\t * Meta fields.\n\t */\n\tmeta:\n\t\t| []\n\t\t| {\n\t\t\t\t[ k: string ]: unknown;\n\t\t };\n\t/**\n\t * The theme file to use to display the attachment.\n\t */\n\ttemplate: string;\n\t_links: {\n\t\t[ k: string ]: {\n\t\t\thref: string;\n\t\t\tembeddable?: boolean;\n\t\t\t[ k: string ]: unknown;\n\t\t}[];\n\t};\n\t/**\n\t * The embedded representation of relations. Only present when the '_embed' query parameter is set.\n\t */\n\t_embedded?: {\n\t\t/**\n\t\t * The author of the post.\n\t\t */\n\t\tauthor: unknown[];\n\t\t/**\n\t\t * The featured image post.\n\t\t */\n\t\t'wp:featuredmedia'?: WP_REST_API_Attachment[];\n\t\t[ k: string ]: unknown;\n\t};\n\t[ k: string ]: unknown;\n}\n\n/**\n * REST API attachment object with additional fields added by this project.\n */\nexport interface RestAttachment extends WP_REST_API_Attachment {}\n\ntype BetterOmit< T, K extends PropertyKey > = {\n\t[ P in keyof T as P extends K ? never : P ]: T[ P ];\n};\n\n/**\n * Transformed attachment object.\n */\nexport type Attachment = BetterOmit<\n\tRestAttachment,\n\t'alt_text' | 'source_url' | 'caption' | 'title'\n> & {\n\talt: WP_REST_API_Attachment[ 'alt_text' ];\n\tcaption: WP_REST_API_Attachment[ 'caption' ][ 'raw' ] & string;\n\ttitle: WP_REST_API_Attachment[ 'title' ][ 'raw' ];\n\turl: WP_REST_API_Attachment[ 'source_url' ];\n\tposter?: WP_REST_API_Attachment[ 'source_url' ];\n};\n\nexport type OnChangeHandler = ( attachments: Partial< Attachment >[] ) => void;\nexport type OnSuccessHandler = ( attachments: Partial< Attachment >[] ) => void;\nexport type OnErrorHandler = ( error: Error ) => void;\n\nexport type CreateRestAttachment = Partial< RestAttachment >;\n\nexport type AdditionalData = BetterOmit< CreateRestAttachment, 'meta' >;\n\nexport interface CreateSideloadFile {\n\timage_size?: string;\n\tupload_request?: string;\n}\n\nexport interface SideloadAdditionalData {\n\tpost: RestAttachment[ 'id' ];\n\timage_size?: string;\n}\n"],"mappings":"","ignoreList":[]}
@@ -22,6 +22,12 @@ declare class MediaUpload extends Component<any, any, any> {
22
22
  * @return {void}
23
23
  */
24
24
  buildAndSetFeatureImageFrame(): void;
25
+ /**
26
+ * Initializes the Media Library requirements for the single image flow.
27
+ *
28
+ * @return {void}
29
+ */
30
+ buildAndSetSingleMediaFrame(): void;
25
31
  componentWillUnmount(): void;
26
32
  updateCollection(): void;
27
33
  render(): any;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/media-upload/index.js"],"names":[],"mappings":";AAiOA;IACC,4BAOC;IA+LD,kBAkCC;IArGD,eAqCC;IA5CD,iBAKC;IAzBD,gCAkBC;IAgDD,gBAQC;IAzKD,4BAMC;IAED;;;;OAIG;IACH,2BAFY,IAAI,CA+Cf;IA7BA,sBAA6B;IAa5B,8BAA6D;IAO9D,WAMG;IAKJ;;;;OAIG;IACH,gCAFY,IAAI,CA0Bf;IAED,6BAEC;IA8ED,yBAgBC;IAsCD,cAEC;CACD;0BA5cyB,oBAAoB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/media-upload/index.js"],"names":[],"mappings":";AAyQA;IACC,4BAOC;IAwOD,kBAsBC;IAzFD,eAqCC;IA5CD,iBAKC;IAzBD,gCAkBC;IAgDD,gBAQC;IAlND,4BAMC;IAED;;;;OAIG;IACH,2BAFY,IAAI,CA+Cf;IA7BA,sBAA6B;IAa5B,8BAA6D;IAO9D,WAMG;IAKJ;;;;OAIG;IACH,gCAFY,IAAI,CA0Bf;IAED;;;;OAIG;IACH,+BAFY,IAAI,CAoCf;IAED,6BAEC;IA8ED,yBAgBC;IA0BD,cAEC;CACD;0BAjhByB,oBAAoB"}
@@ -5,4 +5,5 @@ export { validateFileSize } from './utils/validate-file-size';
5
5
  export { validateMimeType } from './utils/validate-mime-type';
6
6
  export { validateMimeTypeForUser } from './utils/validate-mime-type-for-user';
7
7
  export type { Attachment, RestAttachment } from './utils/types';
8
+ export { privateApis } from './private-apis';
8
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAE7B,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAE9E,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAE7B,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAE9E,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEhE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const lock: (object: Record<symbol, WeakKey>, privateData: unknown) => void, unlock: (object: Record<symbol, WeakKey>) => any;
2
+ //# sourceMappingURL=lock-unlock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lock-unlock.d.ts","sourceRoot":"","sources":["../src/lock-unlock.ts"],"names":[],"mappings":"AAKA,eAAO,MAAQ,IAAI,mEAAE,MAAM,0CAIzB,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Private @wordpress/media-utils APIs.
3
+ */
4
+ export declare const privateApis: {};
5
+ //# sourceMappingURL=private-apis.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"private-apis.d.ts","sourceRoot":"","sources":["../src/private-apis.ts"],"names":[],"mappings":"AAMA;;GAEG;AACH,eAAO,MAAM,WAAW,IAAK,CAAC"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ import type { OnChangeHandler, OnErrorHandler, CreateSideloadFile, RestAttachment } from './types';
5
+ interface SideloadMediaArgs {
6
+ additionalData?: CreateSideloadFile;
7
+ file: File;
8
+ attachmentId: RestAttachment['id'];
9
+ onError?: OnErrorHandler;
10
+ onFileChange?: OnChangeHandler;
11
+ signal?: AbortSignal;
12
+ }
13
+ /**
14
+ * Uploads a file to the server without creating an attachment.
15
+ *
16
+ * @param $0 Parameters object passed to the function.
17
+ * @param $0.file Media File to Save.
18
+ * @param $0.attachmentId Parent attachment ID.
19
+ * @param $0.additionalData Additional data to include in the request.
20
+ * @param $0.signal Abort signal.
21
+ * @param $0.onFileChange Function called each time a file or a temporary representation of the file is available.
22
+ * @param $0.onError Function called when an error happens.
23
+ */
24
+ export declare function sideloadMedia({ file, attachmentId, additionalData, signal, onFileChange, onError, }: SideloadMediaArgs): Promise<void>;
25
+ export {};
26
+ //# sourceMappingURL=sideload-media.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sideload-media.d.ts","sourceRoot":"","sources":["../../src/utils/sideload-media.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,KAAK,EACX,eAAe,EACf,cAAc,EACd,kBAAkB,EAClB,cAAc,EACd,MAAM,SAAS,CAAC;AAMjB,UAAU,iBAAiB;IAE1B,cAAc,CAAC,EAAE,kBAAkB,CAAC;IAEpC,IAAI,EAAE,IAAI,CAAC;IAEX,YAAY,EAAE,cAAc,CAAE,IAAI,CAAE,CAAC;IAErC,OAAO,CAAC,EAAE,cAAc,CAAC;IAEzB,YAAY,CAAC,EAAE,eAAe,CAAC;IAE/B,MAAM,CAAC,EAAE,WAAW,CAAC;CACrB;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,aAAa,CAAE,EACpC,IAAI,EACJ,YAAY,EACZ,cAAmB,EACnB,MAAM,EACN,YAAY,EACZ,OAAc,GACd,EAAE,iBAAiB,iBA6BnB"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ import type { CreateSideloadFile, RestAttachment } from './types';
5
+ /**
6
+ * Uploads a file to the server without creating an attachment.
7
+ *
8
+ * @param file Media File to Save.
9
+ * @param attachmentId Parent attachment ID.
10
+ * @param additionalData Additional data to include in the request.
11
+ * @param signal Abort signal.
12
+ *
13
+ * @return The saved attachment.
14
+ */
15
+ export declare function sideloadToServer(file: File, attachmentId: RestAttachment['id'], additionalData?: CreateSideloadFile, signal?: AbortSignal): Promise<import("./types").Attachment>;
16
+ //# sourceMappingURL=sideload-to-server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sideload-to-server.d.ts","sourceRoot":"","sources":["../../src/utils/sideload-to-server.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAIlE;;;;;;;;;GASG;AACH,wBAAsB,gBAAgB,CACrC,IAAI,EAAE,IAAI,EACV,YAAY,EAAE,cAAc,CAAE,IAAI,CAAE,EACpC,cAAc,GAAE,kBAAuB,EACvC,MAAM,CAAC,EAAE,WAAW,yCAqBpB"}
@@ -195,5 +195,13 @@ export type OnSuccessHandler = (attachments: Partial<Attachment>[]) => void;
195
195
  export type OnErrorHandler = (error: Error) => void;
196
196
  export type CreateRestAttachment = Partial<RestAttachment>;
197
197
  export type AdditionalData = BetterOmit<CreateRestAttachment, 'meta'>;
198
+ export interface CreateSideloadFile {
199
+ image_size?: string;
200
+ upload_request?: string;
201
+ }
202
+ export interface SideloadAdditionalData {
203
+ post: RestAttachment['id'];
204
+ image_size?: string;
205
+ }
198
206
  export {};
199
207
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/utils/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,UAAU,sBAAsB;IAC/B;;OA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