@wordpress/media-fields 0.1.1-next.6deb34194.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.
- package/LICENSE.md +788 -0
- package/README.md +52 -0
- package/build/alt_text/index.js +51 -0
- package/build/alt_text/index.js.map +7 -0
- package/build/caption/index.js +52 -0
- package/build/caption/index.js.map +7 -0
- package/build/description/index.js +52 -0
- package/build/description/index.js.map +7 -0
- package/build/filename/index.js +50 -0
- package/build/filename/index.js.map +7 -0
- package/build/filename/view.js +43 -0
- package/build/filename/view.js.map +7 -0
- package/build/filesize/index.js +90 -0
- package/build/filesize/index.js.map +7 -0
- package/build/index.js +62 -0
- package/build/index.js.map +7 -0
- package/build/media_dimensions/index.js +45 -0
- package/build/media_dimensions/index.js.map +7 -0
- package/build/media_thumbnail/index.js +47 -0
- package/build/media_thumbnail/index.js.map +7 -0
- package/build/media_thumbnail/view.js +94 -0
- package/build/media_thumbnail/view.js.map +7 -0
- package/build/mime_type/index.js +38 -0
- package/build/mime_type/index.js.map +7 -0
- package/build/types.js +19 -0
- package/build/types.js.map +7 -0
- package/build/utils/get-media-type-from-mime-type.js +60 -0
- package/build/utils/get-media-type-from-mime-type.js.map +7 -0
- package/build/utils/get-raw-content.js +42 -0
- package/build/utils/get-raw-content.js.map +7 -0
- package/build/utils/get-rendered-content.js +42 -0
- package/build/utils/get-rendered-content.js.map +7 -0
- package/build-module/alt_text/index.js +30 -0
- package/build-module/alt_text/index.js.map +7 -0
- package/build-module/caption/index.js +31 -0
- package/build-module/caption/index.js.map +7 -0
- package/build-module/description/index.js +31 -0
- package/build-module/description/index.js.map +7 -0
- package/build-module/filename/index.js +19 -0
- package/build-module/filename/index.js.map +7 -0
- package/build-module/filename/view.js +25 -0
- package/build-module/filename/view.js.map +7 -0
- package/build-module/filesize/index.js +69 -0
- package/build-module/filesize/index.js.map +7 -0
- package/build-module/index.js +20 -0
- package/build-module/index.js.map +7 -0
- package/build-module/media_dimensions/index.js +24 -0
- package/build-module/media_dimensions/index.js.map +7 -0
- package/build-module/media_thumbnail/index.js +16 -0
- package/build-module/media_thumbnail/index.js.map +7 -0
- package/build-module/media_thumbnail/view.js +77 -0
- package/build-module/media_thumbnail/view.js.map +7 -0
- package/build-module/mime_type/index.js +17 -0
- package/build-module/mime_type/index.js.map +7 -0
- package/build-module/types.js +1 -0
- package/build-module/types.js.map +7 -0
- package/build-module/utils/get-media-type-from-mime-type.js +35 -0
- package/build-module/utils/get-media-type-from-mime-type.js.map +7 -0
- package/build-module/utils/get-raw-content.js +17 -0
- package/build-module/utils/get-raw-content.js.map +7 -0
- package/build-module/utils/get-rendered-content.js +17 -0
- package/build-module/utils/get-rendered-content.js.map +7 -0
- package/build-style/style-rtl.css +130 -0
- package/build-style/style.css +130 -0
- package/build-types/alt_text/index.d.ts +5 -0
- package/build-types/alt_text/index.d.ts.map +1 -0
- package/build-types/caption/index.d.ts +5 -0
- package/build-types/caption/index.d.ts.map +1 -0
- package/build-types/description/index.d.ts +5 -0
- package/build-types/description/index.d.ts.map +1 -0
- package/build-types/filename/index.d.ts +8 -0
- package/build-types/filename/index.d.ts.map +1 -0
- package/build-types/filename/view.d.ts +7 -0
- package/build-types/filename/view.d.ts.map +1 -0
- package/build-types/filesize/index.d.ts +8 -0
- package/build-types/filesize/index.d.ts.map +1 -0
- package/build-types/index.d.ts +10 -0
- package/build-types/index.d.ts.map +1 -0
- package/build-types/media_dimensions/index.d.ts +5 -0
- package/build-types/media_dimensions/index.d.ts.map +1 -0
- package/build-types/media_thumbnail/index.d.ts +8 -0
- package/build-types/media_thumbnail/index.d.ts.map +1 -0
- package/build-types/media_thumbnail/view.d.ts +4 -0
- package/build-types/media_thumbnail/view.d.ts.map +1 -0
- package/build-types/mime_type/index.d.ts +5 -0
- package/build-types/mime_type/index.d.ts.map +1 -0
- package/build-types/stories/index.story.d.ts +25 -0
- package/build-types/stories/index.story.d.ts.map +1 -0
- package/build-types/types.d.ts +18 -0
- package/build-types/types.d.ts.map +1 -0
- package/build-types/utils/get-media-type-from-mime-type.d.ts +18 -0
- package/build-types/utils/get-media-type-from-mime-type.d.ts.map +1 -0
- package/build-types/utils/get-raw-content.d.ts +17 -0
- package/build-types/utils/get-raw-content.d.ts.map +1 -0
- package/build-types/utils/get-rendered-content.d.ts +17 -0
- package/build-types/utils/get-rendered-content.d.ts.map +1 -0
- package/package.json +61 -0
- package/src/alt_text/index.tsx +30 -0
- package/src/caption/index.tsx +35 -0
- package/src/description/index.tsx +37 -0
- package/src/filename/index.ts +26 -0
- package/src/filename/view.tsx +39 -0
- package/src/filesize/index.tsx +96 -0
- package/src/index.ts +15 -0
- package/src/media_dimensions/index.ts +29 -0
- package/src/media_thumbnail/index.tsx +22 -0
- package/src/media_thumbnail/style.scss +49 -0
- package/src/media_thumbnail/view.tsx +104 -0
- package/src/mime_type/index.ts +19 -0
- package/src/stories/index.story.tsx +290 -0
- package/src/style.scss +1 -0
- package/src/types.ts +24 -0
- package/src/utils/get-media-type-from-mime-type.ts +54 -0
- package/src/utils/get-raw-content.ts +32 -0
- package/src/utils/get-rendered-content.ts +32 -0
- package/tsconfig.json +31 -0
- package/tsconfig.tsbuildinfo +1 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/filesize/index.tsx"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __, sprintf, _x } from '@wordpress/i18n';\nimport type { Field } from '@wordpress/dataviews';\n\n/**\n * Internal dependencies\n */\nimport type { MediaItem } from '../types';\n\nconst KB_IN_BYTES = 1024;\nconst MB_IN_BYTES = 1024 * KB_IN_BYTES;\nconst GB_IN_BYTES = 1024 * MB_IN_BYTES;\nconst TB_IN_BYTES = 1024 * GB_IN_BYTES;\nconst PB_IN_BYTES = 1024 * TB_IN_BYTES;\nconst EB_IN_BYTES = 1024 * PB_IN_BYTES;\nconst ZB_IN_BYTES = 1024 * EB_IN_BYTES;\nconst YB_IN_BYTES = 1024 * ZB_IN_BYTES;\n\nfunction getBytesString(\n\tbytes: number,\n\tunitSymbol: string,\n\tdecimals = 2\n): string {\n\treturn sprintf(\n\t\t// translators: 1: Actual bytes of a file. 2: The unit symbol (e.g. MB).\n\t\t_x( '%1$s %2$s', 'file size' ),\n\t\tbytes.toLocaleString( undefined, {\n\t\t\tminimumFractionDigits: 0,\n\t\t\tmaximumFractionDigits: decimals,\n\t\t} ),\n\t\tunitSymbol\n\t);\n}\n\n/**\n * Converts bytes to a human-readable file size string with a specified number of decimal places.\n *\n * This logic is comparable to core's `size_format()` function.\n *\n * @param bytes The size in bytes.\n * @param decimals The number of decimal places to include in the result.\n * @return The human-readable file size string.\n */\nfunction formatFileSize( bytes: number, decimals = 2 ): string {\n\tif ( bytes === 0 ) {\n\t\treturn getBytesString( 0, _x( 'B', 'unit symbol' ), decimals );\n\t}\n\tconst quant = {\n\t\t/* translators: Unit symbol for yottabyte. */\n\t\t[ _x( 'YB', 'unit symbol' ) ]: YB_IN_BYTES,\n\t\t/* translators: Unit symbol for zettabyte. */\n\t\t[ _x( 'ZB', 'unit symbol' ) ]: ZB_IN_BYTES,\n\t\t/* translators: Unit symbol for exabyte. */\n\t\t[ _x( 'EB', 'unit symbol' ) ]: EB_IN_BYTES,\n\t\t/* translators: Unit symbol for petabyte. */\n\t\t[ _x( 'PB', 'unit symbol' ) ]: PB_IN_BYTES,\n\t\t/* translators: Unit symbol for terabyte. */\n\t\t[ _x( 'TB', 'unit symbol' ) ]: TB_IN_BYTES,\n\t\t/* translators: Unit symbol for gigabyte. */\n\t\t[ _x( 'GB', 'unit symbol' ) ]: GB_IN_BYTES,\n\t\t/* translators: Unit symbol for megabyte. */\n\t\t[ _x( 'MB', 'unit symbol' ) ]: MB_IN_BYTES,\n\t\t/* translators: Unit symbol for kilobyte. */\n\t\t[ _x( 'KB', 'unit symbol' ) ]: KB_IN_BYTES,\n\t\t/* translators: Unit symbol for byte. */\n\t\t[ _x( 'B', 'unit symbol' ) ]: 1,\n\t};\n\n\tfor ( const [ unit, mag ] of Object.entries( quant ) ) {\n\t\tif ( bytes >= mag ) {\n\t\t\treturn getBytesString( bytes / mag, unit, decimals );\n\t\t}\n\t}\n\n\treturn ''; // Fallback in case no unit matches, though this should not happen.\n}\n\nconst filesizeField: Partial< Field< MediaItem > > = {\n\tid: 'filesize',\n\ttype: 'text',\n\tlabel: __( 'File size' ),\n\tgetValue: ( { item }: { item: MediaItem } ) =>\n\t\titem?.media_details?.filesize\n\t\t\t? formatFileSize( item?.media_details?.filesize )\n\t\t\t: '',\n\tisVisible: ( item: MediaItem ) => {\n\t\treturn !! item?.media_details?.filesize;\n\t},\n\tenableSorting: false,\n\tfilterBy: false,\n\treadOnly: true,\n};\n\nexport default filesizeField;\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,IAAI,SAAS,UAAU;AAQhC,IAAM,cAAc;AACpB,IAAM,cAAc,OAAO;AAC3B,IAAM,cAAc,OAAO;AAC3B,IAAM,cAAc,OAAO;AAC3B,IAAM,cAAc,OAAO;AAC3B,IAAM,cAAc,OAAO;AAC3B,IAAM,cAAc,OAAO;AAC3B,IAAM,cAAc,OAAO;AAE3B,SAAS,eACR,OACA,YACA,WAAW,GACF;AACT,SAAO;AAAA;AAAA,IAEN,GAAI,aAAa,WAAY;AAAA,IAC7B,MAAM,eAAgB,QAAW;AAAA,MAChC,uBAAuB;AAAA,MACvB,uBAAuB;AAAA,IACxB,CAAE;AAAA,IACF;AAAA,EACD;AACD;AAWA,SAAS,eAAgB,OAAe,WAAW,GAAY;AAC9D,MAAK,UAAU,GAAI;AAClB,WAAO,eAAgB,GAAG,GAAI,KAAK,aAAc,GAAG,QAAS;AAAA,EAC9D;AACA,QAAM,QAAQ;AAAA;AAAA,IAEb,CAAE,GAAI,MAAM,aAAc,CAAE,GAAG;AAAA;AAAA,IAE/B,CAAE,GAAI,MAAM,aAAc,CAAE,GAAG;AAAA;AAAA,IAE/B,CAAE,GAAI,MAAM,aAAc,CAAE,GAAG;AAAA;AAAA,IAE/B,CAAE,GAAI,MAAM,aAAc,CAAE,GAAG;AAAA;AAAA,IAE/B,CAAE,GAAI,MAAM,aAAc,CAAE,GAAG;AAAA;AAAA,IAE/B,CAAE,GAAI,MAAM,aAAc,CAAE,GAAG;AAAA;AAAA,IAE/B,CAAE,GAAI,MAAM,aAAc,CAAE,GAAG;AAAA;AAAA,IAE/B,CAAE,GAAI,MAAM,aAAc,CAAE,GAAG;AAAA;AAAA,IAE/B,CAAE,GAAI,KAAK,aAAc,CAAE,GAAG;AAAA,EAC/B;AAEA,aAAY,CAAE,MAAM,GAAI,KAAK,OAAO,QAAS,KAAM,GAAI;AACtD,QAAK,SAAS,KAAM;AACnB,aAAO,eAAgB,QAAQ,KAAK,MAAM,QAAS;AAAA,IACpD;AAAA,EACD;AAEA,SAAO;AACR;AAEA,IAAM,gBAA+C;AAAA,EACpD,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,OAAO,GAAI,WAAY;AAAA,EACvB,UAAU,CAAE,EAAE,KAAK,MAClB,MAAM,eAAe,WAClB,eAAgB,MAAM,eAAe,QAAS,IAC9C;AAAA,EACJ,WAAW,CAAE,SAAqB;AACjC,WAAO,CAAC,CAAE,MAAM,eAAe;AAAA,EAChC;AAAA,EACA,eAAe;AAAA,EACf,UAAU;AAAA,EACV,UAAU;AACX;AAEA,IAAO,mBAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// packages/media-fields/src/index.ts
|
|
2
|
+
import { default as default2 } from "./alt_text";
|
|
3
|
+
import { default as default3 } from "./caption";
|
|
4
|
+
import { default as default4 } from "./description";
|
|
5
|
+
import { default as default5 } from "./filename";
|
|
6
|
+
import { default as default6 } from "./filesize";
|
|
7
|
+
import { default as default7 } from "./media_dimensions";
|
|
8
|
+
import { default as default8 } from "./media_thumbnail";
|
|
9
|
+
import { default as default9 } from "./mime_type";
|
|
10
|
+
export {
|
|
11
|
+
default2 as altTextField,
|
|
12
|
+
default3 as captionField,
|
|
13
|
+
default4 as descriptionField,
|
|
14
|
+
default5 as filenameField,
|
|
15
|
+
default6 as filesizeField,
|
|
16
|
+
default7 as mediaDimensionsField,
|
|
17
|
+
default8 as mediaThumbnailField,
|
|
18
|
+
default9 as mimeTypeField
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/index.ts"],
|
|
4
|
+
"sourcesContent": ["export { default as altTextField } from './alt_text';\nexport { default as captionField } from './caption';\nexport { default as descriptionField } from './description';\nexport { default as filenameField } from './filename';\nexport { default as filesizeField } from './filesize';\nexport { default as mediaDimensionsField } from './media_dimensions';\nexport { default as mediaThumbnailField } from './media_thumbnail';\nexport { default as mimeTypeField } from './mime_type';\n\nexport type {\n\tMediaItem,\n\tMediaKind,\n\tMediaType,\n\tMediaItemUpdatable,\n} from './types';\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAoB,WAAXA,gBAA+B;AACxC,SAAoB,WAAXA,gBAA+B;AACxC,SAAoB,WAAXA,gBAAmC;AAC5C,SAAoB,WAAXA,gBAAgC;AACzC,SAAoB,WAAXA,gBAAgC;AACzC,SAAoB,WAAXA,gBAAuC;AAChD,SAAoB,WAAXA,gBAAsC;AAC/C,SAAoB,WAAXA,gBAAgC;",
|
|
6
|
+
"names": ["default"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// packages/media-fields/src/media_dimensions/index.ts
|
|
2
|
+
import { __, _x, sprintf } from "@wordpress/i18n";
|
|
3
|
+
var mediaDimensionsField = {
|
|
4
|
+
id: "media_dimensions",
|
|
5
|
+
type: "text",
|
|
6
|
+
label: __("Dimensions"),
|
|
7
|
+
getValue: ({ item }) => item?.media_details?.width && item?.media_details?.height ? sprintf(
|
|
8
|
+
// translators: 1: Width. 2: Height.
|
|
9
|
+
_x("%1$s \xD7 %2$s", "image dimensions"),
|
|
10
|
+
item?.media_details?.width?.toString(),
|
|
11
|
+
item?.media_details?.height?.toString()
|
|
12
|
+
) : "",
|
|
13
|
+
isVisible: (item) => {
|
|
14
|
+
return !!(item?.media_details?.width && item?.media_details?.height);
|
|
15
|
+
},
|
|
16
|
+
enableSorting: false,
|
|
17
|
+
filterBy: false,
|
|
18
|
+
readOnly: true
|
|
19
|
+
};
|
|
20
|
+
var media_dimensions_default = mediaDimensionsField;
|
|
21
|
+
export {
|
|
22
|
+
media_dimensions_default as default
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/media_dimensions/index.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport type { Attachment, Updatable } from '@wordpress/core-data';\nimport type { Field } from '@wordpress/dataviews';\n\nconst mediaDimensionsField: Partial< Field< Updatable< Attachment > > > = {\n\tid: 'media_dimensions',\n\ttype: 'text',\n\tlabel: __( 'Dimensions' ),\n\tgetValue: ( { item } ) =>\n\t\titem?.media_details?.width && item?.media_details?.height\n\t\t\t? sprintf(\n\t\t\t\t\t// translators: 1: Width. 2: Height.\n\t\t\t\t\t_x( '%1$s \u00D7 %2$s', 'image dimensions' ),\n\t\t\t\t\titem?.media_details?.width?.toString(),\n\t\t\t\t\titem?.media_details?.height?.toString()\n\t\t\t )\n\t\t\t: '',\n\tisVisible: ( item ) => {\n\t\treturn !! ( item?.media_details?.width && item?.media_details?.height );\n\t},\n\tenableSorting: false,\n\tfilterBy: false,\n\treadOnly: true,\n};\n\nexport default mediaDimensionsField;\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,IAAI,IAAI,eAAe;AAIhC,IAAM,uBAAoE;AAAA,EACzE,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,OAAO,GAAI,YAAa;AAAA,EACxB,UAAU,CAAE,EAAE,KAAK,MAClB,MAAM,eAAe,SAAS,MAAM,eAAe,SAChD;AAAA;AAAA,IAEA,GAAI,kBAAe,kBAAmB;AAAA,IACtC,MAAM,eAAe,OAAO,SAAS;AAAA,IACrC,MAAM,eAAe,QAAQ,SAAS;AAAA,EACtC,IACA;AAAA,EACJ,WAAW,CAAE,SAAU;AACtB,WAAO,CAAC,EAAI,MAAM,eAAe,SAAS,MAAM,eAAe;AAAA,EAChE;AAAA,EACA,eAAe;AAAA,EACf,UAAU;AAAA,EACV,UAAU;AACX;AAEA,IAAO,2BAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// packages/media-fields/src/media_thumbnail/index.tsx
|
|
2
|
+
import { __ } from "@wordpress/i18n";
|
|
3
|
+
import MediaThumbnailView from "./view";
|
|
4
|
+
var mediaThumbnailField = {
|
|
5
|
+
id: "media_thumbnail",
|
|
6
|
+
type: "media",
|
|
7
|
+
label: __("Thumbnail"),
|
|
8
|
+
render: MediaThumbnailView,
|
|
9
|
+
enableSorting: false,
|
|
10
|
+
filterBy: false
|
|
11
|
+
};
|
|
12
|
+
var media_thumbnail_default = mediaThumbnailField;
|
|
13
|
+
export {
|
|
14
|
+
media_thumbnail_default as default
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/media_thumbnail/index.tsx"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport type { Field } from '@wordpress/dataviews';\n\n/**\n * Internal dependencies\n */\nimport type { MediaItem } from '../types';\nimport MediaThumbnailView from './view';\n\nconst mediaThumbnailField: Partial< Field< MediaItem > > = {\n\tid: 'media_thumbnail',\n\ttype: 'media',\n\tlabel: __( 'Thumbnail' ),\n\trender: MediaThumbnailView,\n\tenableSorting: false,\n\tfilterBy: false,\n};\n\nexport default mediaThumbnailField;\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,UAAU;AAOnB,OAAO,wBAAwB;AAE/B,IAAM,sBAAqD;AAAA,EAC1D,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,OAAO,GAAI,WAAY;AAAA,EACvB,QAAQ;AAAA,EACR,eAAe;AAAA,EACf,UAAU;AACX;AAEA,IAAO,0BAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
// packages/media-fields/src/media_thumbnail/view.tsx
|
|
2
|
+
import { useSelect } from "@wordpress/data";
|
|
3
|
+
import { store as coreStore } from "@wordpress/core-data";
|
|
4
|
+
import {
|
|
5
|
+
__experimentalTruncate as Truncate,
|
|
6
|
+
__experimentalVStack as VStack,
|
|
7
|
+
Icon
|
|
8
|
+
} from "@wordpress/components";
|
|
9
|
+
import { getFilename } from "@wordpress/url";
|
|
10
|
+
import { getMediaTypeFromMimeType } from "../utils/get-media-type-from-mime-type";
|
|
11
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
+
function MediaThumbnailView({
|
|
13
|
+
item,
|
|
14
|
+
config
|
|
15
|
+
}) {
|
|
16
|
+
const _featuredMedia = useSelect(
|
|
17
|
+
(select) => {
|
|
18
|
+
if (!item.featured_media) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
return select(coreStore).getEntityRecord(
|
|
22
|
+
"postType",
|
|
23
|
+
"attachment",
|
|
24
|
+
item.featured_media
|
|
25
|
+
);
|
|
26
|
+
},
|
|
27
|
+
[item.featured_media]
|
|
28
|
+
);
|
|
29
|
+
const featuredMedia = item.featured_media ? _featuredMedia : item;
|
|
30
|
+
if (!featuredMedia) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
const filename = getFilename(featuredMedia.source_url || "");
|
|
34
|
+
if (
|
|
35
|
+
// Ensure the featured media is an image.
|
|
36
|
+
getMediaTypeFromMimeType(featuredMedia.mime_type).type === "image"
|
|
37
|
+
) {
|
|
38
|
+
return /* @__PURE__ */ jsx("div", { className: "dataviews-media-field__media-thumbnail", children: /* @__PURE__ */ jsx(
|
|
39
|
+
"img",
|
|
40
|
+
{
|
|
41
|
+
className: "dataviews-media-field__media-thumbnail--image",
|
|
42
|
+
src: featuredMedia.source_url,
|
|
43
|
+
srcSet: featuredMedia?.media_details?.sizes ? Object.values(
|
|
44
|
+
featuredMedia.media_details.sizes
|
|
45
|
+
).map(
|
|
46
|
+
(size) => `${size.source_url} ${size.width}w`
|
|
47
|
+
).join(", ") : void 0,
|
|
48
|
+
sizes: config?.sizes || "100vw",
|
|
49
|
+
alt: featuredMedia.alt_text || featuredMedia.title.raw
|
|
50
|
+
}
|
|
51
|
+
) });
|
|
52
|
+
}
|
|
53
|
+
return /* @__PURE__ */ jsx("div", { className: "dataviews-media-field__media-thumbnail", children: /* @__PURE__ */ jsxs(
|
|
54
|
+
VStack,
|
|
55
|
+
{
|
|
56
|
+
justify: "center",
|
|
57
|
+
alignment: "center",
|
|
58
|
+
className: "dataviews-media-field__media-thumbnail__stack",
|
|
59
|
+
spacing: 0,
|
|
60
|
+
children: [
|
|
61
|
+
/* @__PURE__ */ jsx(
|
|
62
|
+
Icon,
|
|
63
|
+
{
|
|
64
|
+
className: "dataviews-media-field__media-thumbnail--icon",
|
|
65
|
+
icon: getMediaTypeFromMimeType(item.mime_type).icon,
|
|
66
|
+
size: 24
|
|
67
|
+
}
|
|
68
|
+
),
|
|
69
|
+
!!filename && /* @__PURE__ */ jsx("div", { className: "dataviews-media-field__media-thumbnail__filename", children: /* @__PURE__ */ jsx(Truncate, { className: "dataviews-media-field__media-thumbnail__filename__truncate", children: filename }) })
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
) });
|
|
73
|
+
}
|
|
74
|
+
export {
|
|
75
|
+
MediaThumbnailView as default
|
|
76
|
+
};
|
|
77
|
+
//# sourceMappingURL=view.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/media_thumbnail/view.tsx"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\t__experimentalTruncate as Truncate,\n\t__experimentalVStack as VStack,\n\tIcon,\n} from '@wordpress/components';\nimport type { Attachment } from '@wordpress/core-data';\nimport { getFilename } from '@wordpress/url';\nimport type { DataViewRenderFieldProps } from '@wordpress/dataviews';\n/**\n * Internal dependencies\n */\nimport { getMediaTypeFromMimeType } from '../utils/get-media-type-from-mime-type';\nimport type { MediaItem } from '../types';\n\nexport default function MediaThumbnailView( {\n\titem,\n\tconfig,\n}: DataViewRenderFieldProps< MediaItem > ) {\n\tconst _featuredMedia = useSelect(\n\t\t( select ) => {\n\t\t\t// Avoid the network request if it's not needed. `featured_media` is\n\t\t\t// 0 for images and media without featured media.\n\t\t\tif ( ! item.featured_media ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\treturn select( coreStore ).getEntityRecord< Attachment >(\n\t\t\t\t'postType',\n\t\t\t\t'attachment',\n\t\t\t\titem.featured_media\n\t\t\t);\n\t\t},\n\t\t[ item.featured_media ]\n\t);\n\tconst featuredMedia = item.featured_media ? _featuredMedia : item;\n\n\t// Fetching.\n\tif ( ! featuredMedia ) {\n\t\treturn null;\n\t}\n\n\tconst filename = getFilename( featuredMedia.source_url || '' );\n\n\tif (\n\t\t// Ensure the featured media is an image.\n\t\tgetMediaTypeFromMimeType( featuredMedia.mime_type ).type === 'image'\n\t) {\n\t\treturn (\n\t\t\t<div className=\"dataviews-media-field__media-thumbnail\">\n\t\t\t\t<img\n\t\t\t\t\tclassName=\"dataviews-media-field__media-thumbnail--image\"\n\t\t\t\t\tsrc={ featuredMedia.source_url }\n\t\t\t\t\tsrcSet={\n\t\t\t\t\t\tfeaturedMedia?.media_details?.sizes\n\t\t\t\t\t\t\t? (\n\t\t\t\t\t\t\t\t\tObject.values(\n\t\t\t\t\t\t\t\t\t\tfeaturedMedia.media_details.sizes\n\t\t\t\t\t\t\t\t\t) as Array< {\n\t\t\t\t\t\t\t\t\t\tsource_url: string;\n\t\t\t\t\t\t\t\t\t\twidth: number;\n\t\t\t\t\t\t\t\t\t} >\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t.map(\n\t\t\t\t\t\t\t\t\t\t( size ) =>\n\t\t\t\t\t\t\t\t\t\t\t`${ size.source_url } ${ size.width }w`\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t.join( ', ' )\n\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t}\n\t\t\t\t\tsizes={ config?.sizes || '100vw' }\n\t\t\t\t\talt={ featuredMedia.alt_text || featuredMedia.title.raw }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t);\n\t}\n\n\treturn (\n\t\t<div className=\"dataviews-media-field__media-thumbnail\">\n\t\t\t<VStack\n\t\t\t\tjustify=\"center\"\n\t\t\t\talignment=\"center\"\n\t\t\t\tclassName=\"dataviews-media-field__media-thumbnail__stack\"\n\t\t\t\tspacing={ 0 }\n\t\t\t>\n\t\t\t\t<Icon\n\t\t\t\t\tclassName=\"dataviews-media-field__media-thumbnail--icon\"\n\t\t\t\t\ticon={ getMediaTypeFromMimeType( item.mime_type ).icon }\n\t\t\t\t\tsize={ 24 }\n\t\t\t\t/>\n\t\t\t\t{ !! filename && (\n\t\t\t\t\t<div className=\"dataviews-media-field__media-thumbnail__filename\">\n\t\t\t\t\t\t<Truncate className=\"dataviews-media-field__media-thumbnail__filename__truncate\">\n\t\t\t\t\t\t\t{ filename }\n\t\t\t\t\t\t</Truncate>\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t</VStack>\n\t\t</div>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,iBAAiB;AAC1B,SAAS,SAAS,iBAAiB;AACnC;AAAA,EACC,0BAA0B;AAAA,EAC1B,wBAAwB;AAAA,EACxB;AAAA,OACM;AAEP,SAAS,mBAAmB;AAK5B,SAAS,gCAAgC;AAqCrC,cA6BD,YA7BC;AAlCW,SAAR,mBAAqC;AAAA,EAC3C;AAAA,EACA;AACD,GAA2C;AAC1C,QAAM,iBAAiB;AAAA,IACtB,CAAE,WAAY;AAGb,UAAK,CAAE,KAAK,gBAAiB;AAC5B;AAAA,MACD;AACA,aAAO,OAAQ,SAAU,EAAE;AAAA,QAC1B;AAAA,QACA;AAAA,QACA,KAAK;AAAA,MACN;AAAA,IACD;AAAA,IACA,CAAE,KAAK,cAAe;AAAA,EACvB;AACA,QAAM,gBAAgB,KAAK,iBAAiB,iBAAiB;AAG7D,MAAK,CAAE,eAAgB;AACtB,WAAO;AAAA,EACR;AAEA,QAAM,WAAW,YAAa,cAAc,cAAc,EAAG;AAE7D;AAAA;AAAA,IAEC,yBAA0B,cAAc,SAAU,EAAE,SAAS;AAAA,IAC5D;AACD,WACC,oBAAC,SAAI,WAAU,0CACd;AAAA,MAAC;AAAA;AAAA,QACA,WAAU;AAAA,QACV,KAAM,cAAc;AAAA,QACpB,QACC,eAAe,eAAe,QAE3B,OAAO;AAAA,UACN,cAAc,cAAc;AAAA,QAC7B,EAKC;AAAA,UACA,CAAE,SACD,GAAI,KAAK,UAAW,IAAK,KAAK,KAAM;AAAA,QACtC,EACC,KAAM,IAAK,IACZ;AAAA,QAEJ,OAAQ,QAAQ,SAAS;AAAA,QACzB,KAAM,cAAc,YAAY,cAAc,MAAM;AAAA;AAAA,IACrD,GACD;AAAA,EAEF;AAEA,SACC,oBAAC,SAAI,WAAU,0CACd;AAAA,IAAC;AAAA;AAAA,MACA,SAAQ;AAAA,MACR,WAAU;AAAA,MACV,WAAU;AAAA,MACV,SAAU;AAAA,MAEV;AAAA;AAAA,UAAC;AAAA;AAAA,YACA,WAAU;AAAA,YACV,MAAO,yBAA0B,KAAK,SAAU,EAAE;AAAA,YAClD,MAAO;AAAA;AAAA,QACR;AAAA,QACE,CAAC,CAAE,YACJ,oBAAC,SAAI,WAAU,oDACd,8BAAC,YAAS,WAAU,8DACjB,oBACH,GACD;AAAA;AAAA;AAAA,EAEF,GACD;AAEF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// packages/media-fields/src/mime_type/index.ts
|
|
2
|
+
import { __ } from "@wordpress/i18n";
|
|
3
|
+
var mimeTypeField = {
|
|
4
|
+
id: "mime_type",
|
|
5
|
+
type: "text",
|
|
6
|
+
label: __("File type"),
|
|
7
|
+
getValue: ({ item }) => item?.mime_type || "",
|
|
8
|
+
render: ({ item }) => item?.mime_type || "-",
|
|
9
|
+
enableSorting: true,
|
|
10
|
+
filterBy: false,
|
|
11
|
+
readOnly: true
|
|
12
|
+
};
|
|
13
|
+
var mime_type_default = mimeTypeField;
|
|
14
|
+
export {
|
|
15
|
+
mime_type_default as default
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/mime_type/index.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport type { Attachment, Updatable } from '@wordpress/core-data';\nimport type { Field } from '@wordpress/dataviews';\n\nconst mimeTypeField: Partial< Field< Updatable< Attachment > > > = {\n\tid: 'mime_type',\n\ttype: 'text',\n\tlabel: __( 'File type' ),\n\tgetValue: ( { item } ) => item?.mime_type || '',\n\trender: ( { item } ) => item?.mime_type || '-',\n\tenableSorting: true,\n\tfilterBy: false,\n\treadOnly: true,\n};\n\nexport default mimeTypeField;\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,UAAU;AAInB,IAAM,gBAA6D;AAAA,EAClE,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,OAAO,GAAI,WAAY;AAAA,EACvB,UAAU,CAAE,EAAE,KAAK,MAAO,MAAM,aAAa;AAAA,EAC7C,QAAQ,CAAE,EAAE,KAAK,MAAO,MAAM,aAAa;AAAA,EAC3C,eAAe;AAAA,EACf,UAAU;AAAA,EACV,UAAU;AACX;AAEA,IAAO,oBAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// packages/media-fields/src/utils/get-media-type-from-mime-type.ts
|
|
2
|
+
import { __ } from "@wordpress/i18n";
|
|
3
|
+
import { audio, video, image, file } from "@wordpress/icons";
|
|
4
|
+
function getMediaTypeFromMimeType(mimeType) {
|
|
5
|
+
if (mimeType.startsWith("image/")) {
|
|
6
|
+
return {
|
|
7
|
+
type: "image",
|
|
8
|
+
label: __("Image"),
|
|
9
|
+
icon: image
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
if (mimeType.startsWith("video/")) {
|
|
13
|
+
return {
|
|
14
|
+
type: "video",
|
|
15
|
+
label: __("Video"),
|
|
16
|
+
icon: video
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
if (mimeType.startsWith("audio/")) {
|
|
20
|
+
return {
|
|
21
|
+
type: "audio",
|
|
22
|
+
label: __("Audio"),
|
|
23
|
+
icon: audio
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
return {
|
|
27
|
+
type: "application",
|
|
28
|
+
label: __("Application"),
|
|
29
|
+
icon: file
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export {
|
|
33
|
+
getMediaTypeFromMimeType
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=get-media-type-from-mime-type.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/utils/get-media-type-from-mime-type.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { audio, video, image, file } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport type { MediaType } from '../types';\n\n/**\n * Get the media type from a mime type, including an icon.\n * TODO - media types should be formalized somewhere.\n *\n * References:\n * https://developer.wordpress.org/reference/functions/wp_mime_type_icon/\n * https://developer.wordpress.org/reference/hooks/mime_types/\n * https://developer.wordpress.org/reference/functions/wp_get_mime_types/\n *\n * @param mimeType - The mime type to get the media type from.\n * @return The media type.\n */\nexport function getMediaTypeFromMimeType( mimeType: string ): MediaType {\n\tif ( mimeType.startsWith( 'image/' ) ) {\n\t\treturn {\n\t\t\ttype: 'image',\n\t\t\tlabel: __( 'Image' ),\n\t\t\ticon: image,\n\t\t};\n\t}\n\n\tif ( mimeType.startsWith( 'video/' ) ) {\n\t\treturn {\n\t\t\ttype: 'video',\n\t\t\tlabel: __( 'Video' ),\n\t\t\ticon: video,\n\t\t};\n\t}\n\n\tif ( mimeType.startsWith( 'audio/' ) ) {\n\t\treturn {\n\t\t\ttype: 'audio',\n\t\t\tlabel: __( 'Audio' ),\n\t\t\ticon: audio,\n\t\t};\n\t}\n\n\treturn {\n\t\ttype: 'application',\n\t\tlabel: __( 'Application' ),\n\t\ticon: file,\n\t};\n}\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,UAAU;AACnB,SAAS,OAAO,OAAO,OAAO,YAAY;AAmBnC,SAAS,yBAA0B,UAA8B;AACvE,MAAK,SAAS,WAAY,QAAS,GAAI;AACtC,WAAO;AAAA,MACN,MAAM;AAAA,MACN,OAAO,GAAI,OAAQ;AAAA,MACnB,MAAM;AAAA,IACP;AAAA,EACD;AAEA,MAAK,SAAS,WAAY,QAAS,GAAI;AACtC,WAAO;AAAA,MACN,MAAM;AAAA,MACN,OAAO,GAAI,OAAQ;AAAA,MACnB,MAAM;AAAA,IACP;AAAA,EACD;AAEA,MAAK,SAAS,WAAY,QAAS,GAAI;AACtC,WAAO;AAAA,MACN,MAAM;AAAA,MACN,OAAO,GAAI,OAAQ;AAAA,MACnB,MAAM;AAAA,IACP;AAAA,EACD;AAEA,SAAO;AAAA,IACN,MAAM;AAAA,IACN,OAAO,GAAI,aAAc;AAAA,IACzB,MAAM;AAAA,EACP;AACD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// packages/media-fields/src/utils/get-raw-content.ts
|
|
2
|
+
function getRawContent(content) {
|
|
3
|
+
if (!content) {
|
|
4
|
+
return "";
|
|
5
|
+
}
|
|
6
|
+
if (typeof content === "string") {
|
|
7
|
+
return content;
|
|
8
|
+
}
|
|
9
|
+
if (typeof content === "object" && "raw" in content) {
|
|
10
|
+
return content.raw || "";
|
|
11
|
+
}
|
|
12
|
+
return "";
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
getRawContent
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=get-raw-content.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/utils/get-raw-content.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Utility function to extract raw content from either a string or an object\n * containing raw and rendered properties.\n *\n * This handles the inconsistency in WordPress REST API responses where\n * some fields like caption and description can be either:\n * - A simple string\n * - An object with { raw: string, rendered: string }\n *\n * @param content - The content to extract raw value from\n * @return The raw content string, or empty string if content is falsy\n */\nexport function getRawContent(\n\tcontent: string | { raw: string; rendered: string } | undefined | null\n): string {\n\tif ( ! content ) {\n\t\treturn '';\n\t}\n\n\t// If it's a string, return it directly\n\tif ( typeof content === 'string' ) {\n\t\treturn content;\n\t}\n\n\t// If it's an object with raw property, return the raw value\n\tif ( typeof content === 'object' && 'raw' in content ) {\n\t\treturn content.raw || '';\n\t}\n\n\t// Fallback to empty string\n\treturn '';\n}\n"],
|
|
5
|
+
"mappings": ";AAYO,SAAS,cACf,SACS;AACT,MAAK,CAAE,SAAU;AAChB,WAAO;AAAA,EACR;AAGA,MAAK,OAAO,YAAY,UAAW;AAClC,WAAO;AAAA,EACR;AAGA,MAAK,OAAO,YAAY,YAAY,SAAS,SAAU;AACtD,WAAO,QAAQ,OAAO;AAAA,EACvB;AAGA,SAAO;AACR;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// packages/media-fields/src/utils/get-rendered-content.ts
|
|
2
|
+
function getRenderedContent(content) {
|
|
3
|
+
if (!content) {
|
|
4
|
+
return "";
|
|
5
|
+
}
|
|
6
|
+
if (typeof content === "string") {
|
|
7
|
+
return content;
|
|
8
|
+
}
|
|
9
|
+
if (typeof content === "object") {
|
|
10
|
+
return content.rendered || content.raw || "";
|
|
11
|
+
}
|
|
12
|
+
return "";
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
getRenderedContent
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=get-rendered-content.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/utils/get-rendered-content.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Utility function to extract rendered content from either a string or an object\n * containing raw and rendered properties.\n *\n * This handles the inconsistency in WordPress REST API responses where\n * some fields like caption and description can be either:\n * - A simple string\n * - An object with { raw: string, rendered: string }\n *\n * @param content - The content to extract raw value from\n * @return The rendered content string, falling back to raw or empty string if content is falsy\n */\nexport function getRenderedContent(\n\tcontent: string | { raw: string; rendered: string } | undefined | null\n): string {\n\tif ( ! content ) {\n\t\treturn '';\n\t}\n\n\t// If it's a string, return it directly\n\tif ( typeof content === 'string' ) {\n\t\treturn content;\n\t}\n\n\t// If it's an object with raw property, return the raw value\n\tif ( typeof content === 'object' ) {\n\t\treturn content.rendered || content.raw || '';\n\t}\n\n\t// Fallback to empty string\n\treturn '';\n}\n"],
|
|
5
|
+
"mappings": ";AAYO,SAAS,mBACf,SACS;AACT,MAAK,CAAE,SAAU;AAChB,WAAO;AAAA,EACR;AAGA,MAAK,OAAO,YAAY,UAAW;AAClC,WAAO;AAAA,EACR;AAGA,MAAK,OAAO,YAAY,UAAW;AAClC,WAAO,QAAQ,YAAY,QAAQ,OAAO;AAAA,EAC3C;AAGA,SAAO;AACR;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typography
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* SCSS Variables.
|
|
6
|
+
*
|
|
7
|
+
* Please use variables from this sheet to ensure consistency across the UI.
|
|
8
|
+
* Don't add to this sheet unless you're pretty sure the value will be reused in many places.
|
|
9
|
+
* For example, don't add rules to this sheet that affect block visuals. It's purely for UI.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Colors
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Fonts & basic variables.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* Typography
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* Grid System.
|
|
22
|
+
* https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/
|
|
23
|
+
*/
|
|
24
|
+
/**
|
|
25
|
+
* Radius scale.
|
|
26
|
+
*/
|
|
27
|
+
/**
|
|
28
|
+
* Elevation scale.
|
|
29
|
+
*/
|
|
30
|
+
/**
|
|
31
|
+
* Dimensions.
|
|
32
|
+
*/
|
|
33
|
+
/**
|
|
34
|
+
* Mobile specific styles
|
|
35
|
+
*/
|
|
36
|
+
/**
|
|
37
|
+
* Editor styles.
|
|
38
|
+
*/
|
|
39
|
+
/**
|
|
40
|
+
* Block & Editor UI.
|
|
41
|
+
*/
|
|
42
|
+
/**
|
|
43
|
+
* Block paddings.
|
|
44
|
+
*/
|
|
45
|
+
/**
|
|
46
|
+
* React Native specific.
|
|
47
|
+
* These variables do not appear to be used anywhere else.
|
|
48
|
+
*/
|
|
49
|
+
/**
|
|
50
|
+
* Breakpoints & Media Queries
|
|
51
|
+
*/
|
|
52
|
+
/**
|
|
53
|
+
* Converts a hex value into the rgb equivalent.
|
|
54
|
+
*
|
|
55
|
+
* @param {string} hex - the hexadecimal value to convert
|
|
56
|
+
* @return {string} comma separated rgb values
|
|
57
|
+
*/
|
|
58
|
+
/**
|
|
59
|
+
* Long content fade mixin
|
|
60
|
+
*
|
|
61
|
+
* Creates a fading overlay to signify that the content is longer
|
|
62
|
+
* than the space allows.
|
|
63
|
+
*/
|
|
64
|
+
/**
|
|
65
|
+
* Breakpoint mixins
|
|
66
|
+
*/
|
|
67
|
+
/**
|
|
68
|
+
* Focus styles.
|
|
69
|
+
*/
|
|
70
|
+
/**
|
|
71
|
+
* Applies editor left position to the selector passed as argument
|
|
72
|
+
*/
|
|
73
|
+
/**
|
|
74
|
+
* Styles that are reused verbatim in a few places
|
|
75
|
+
*/
|
|
76
|
+
/**
|
|
77
|
+
* Allows users to opt-out of animations via OS-level preferences.
|
|
78
|
+
*/
|
|
79
|
+
/**
|
|
80
|
+
* Reset default styles for JavaScript UI based pages.
|
|
81
|
+
* This is a WP-admin agnostic reset
|
|
82
|
+
*/
|
|
83
|
+
/**
|
|
84
|
+
* Reset the WP Admin page styles for Gutenberg-like pages.
|
|
85
|
+
*/
|
|
86
|
+
.dataviews-media-field__media-thumbnail {
|
|
87
|
+
display: flex;
|
|
88
|
+
align-items: center;
|
|
89
|
+
position: relative;
|
|
90
|
+
height: 100%;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.dataviews-media-field__media-thumbnail--image {
|
|
94
|
+
display: block;
|
|
95
|
+
width: 100%;
|
|
96
|
+
height: 100%;
|
|
97
|
+
object-fit: cover;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.dataviews-media-field__media-thumbnail__stack {
|
|
101
|
+
color: #757575;
|
|
102
|
+
box-sizing: border-box;
|
|
103
|
+
width: 100%;
|
|
104
|
+
height: 100%;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.dataviews-media-field__media-thumbnail--icon {
|
|
108
|
+
color: #757575;
|
|
109
|
+
fill: currentColor;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.dataviews-media-field__media-thumbnail__filename {
|
|
113
|
+
box-sizing: border-box;
|
|
114
|
+
text-align: center;
|
|
115
|
+
padding: 0 16px;
|
|
116
|
+
width: 100%;
|
|
117
|
+
container-type: inline-size;
|
|
118
|
+
font-family: -apple-system, "system-ui", "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
|
|
119
|
+
font-weight: 400;
|
|
120
|
+
font-size: 12px;
|
|
121
|
+
line-height: 16px;
|
|
122
|
+
}
|
|
123
|
+
.dataviews-media-field__media-thumbnail__filename__truncate {
|
|
124
|
+
margin-top: 4px;
|
|
125
|
+
}
|
|
126
|
+
@container (max-width: 90px) {
|
|
127
|
+
.dataviews-media-field__media-thumbnail__filename__truncate {
|
|
128
|
+
display: none !important;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typography
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* SCSS Variables.
|
|
6
|
+
*
|
|
7
|
+
* Please use variables from this sheet to ensure consistency across the UI.
|
|
8
|
+
* Don't add to this sheet unless you're pretty sure the value will be reused in many places.
|
|
9
|
+
* For example, don't add rules to this sheet that affect block visuals. It's purely for UI.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Colors
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Fonts & basic variables.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* Typography
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* Grid System.
|
|
22
|
+
* https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/
|
|
23
|
+
*/
|
|
24
|
+
/**
|
|
25
|
+
* Radius scale.
|
|
26
|
+
*/
|
|
27
|
+
/**
|
|
28
|
+
* Elevation scale.
|
|
29
|
+
*/
|
|
30
|
+
/**
|
|
31
|
+
* Dimensions.
|
|
32
|
+
*/
|
|
33
|
+
/**
|
|
34
|
+
* Mobile specific styles
|
|
35
|
+
*/
|
|
36
|
+
/**
|
|
37
|
+
* Editor styles.
|
|
38
|
+
*/
|
|
39
|
+
/**
|
|
40
|
+
* Block & Editor UI.
|
|
41
|
+
*/
|
|
42
|
+
/**
|
|
43
|
+
* Block paddings.
|
|
44
|
+
*/
|
|
45
|
+
/**
|
|
46
|
+
* React Native specific.
|
|
47
|
+
* These variables do not appear to be used anywhere else.
|
|
48
|
+
*/
|
|
49
|
+
/**
|
|
50
|
+
* Breakpoints & Media Queries
|
|
51
|
+
*/
|
|
52
|
+
/**
|
|
53
|
+
* Converts a hex value into the rgb equivalent.
|
|
54
|
+
*
|
|
55
|
+
* @param {string} hex - the hexadecimal value to convert
|
|
56
|
+
* @return {string} comma separated rgb values
|
|
57
|
+
*/
|
|
58
|
+
/**
|
|
59
|
+
* Long content fade mixin
|
|
60
|
+
*
|
|
61
|
+
* Creates a fading overlay to signify that the content is longer
|
|
62
|
+
* than the space allows.
|
|
63
|
+
*/
|
|
64
|
+
/**
|
|
65
|
+
* Breakpoint mixins
|
|
66
|
+
*/
|
|
67
|
+
/**
|
|
68
|
+
* Focus styles.
|
|
69
|
+
*/
|
|
70
|
+
/**
|
|
71
|
+
* Applies editor left position to the selector passed as argument
|
|
72
|
+
*/
|
|
73
|
+
/**
|
|
74
|
+
* Styles that are reused verbatim in a few places
|
|
75
|
+
*/
|
|
76
|
+
/**
|
|
77
|
+
* Allows users to opt-out of animations via OS-level preferences.
|
|
78
|
+
*/
|
|
79
|
+
/**
|
|
80
|
+
* Reset default styles for JavaScript UI based pages.
|
|
81
|
+
* This is a WP-admin agnostic reset
|
|
82
|
+
*/
|
|
83
|
+
/**
|
|
84
|
+
* Reset the WP Admin page styles for Gutenberg-like pages.
|
|
85
|
+
*/
|
|
86
|
+
.dataviews-media-field__media-thumbnail {
|
|
87
|
+
display: flex;
|
|
88
|
+
align-items: center;
|
|
89
|
+
position: relative;
|
|
90
|
+
height: 100%;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.dataviews-media-field__media-thumbnail--image {
|
|
94
|
+
display: block;
|
|
95
|
+
width: 100%;
|
|
96
|
+
height: 100%;
|
|
97
|
+
object-fit: cover;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.dataviews-media-field__media-thumbnail__stack {
|
|
101
|
+
color: #757575;
|
|
102
|
+
box-sizing: border-box;
|
|
103
|
+
width: 100%;
|
|
104
|
+
height: 100%;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.dataviews-media-field__media-thumbnail--icon {
|
|
108
|
+
color: #757575;
|
|
109
|
+
fill: currentColor;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.dataviews-media-field__media-thumbnail__filename {
|
|
113
|
+
box-sizing: border-box;
|
|
114
|
+
text-align: center;
|
|
115
|
+
padding: 0 16px;
|
|
116
|
+
width: 100%;
|
|
117
|
+
container-type: inline-size;
|
|
118
|
+
font-family: -apple-system, "system-ui", "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
|
|
119
|
+
font-weight: 400;
|
|
120
|
+
font-size: 12px;
|
|
121
|
+
line-height: 16px;
|
|
122
|
+
}
|
|
123
|
+
.dataviews-media-field__media-thumbnail__filename__truncate {
|
|
124
|
+
margin-top: 4px;
|
|
125
|
+
}
|
|
126
|
+
@container (max-width: 90px) {
|
|
127
|
+
.dataviews-media-field__media-thumbnail__filename__truncate {
|
|
128
|
+
display: none !important;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/alt_text/index.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAElE,QAAA,MAAM,YAAY,EAAE,OAAO,CAAE,KAAK,CAAE,SAAS,CAAE,UAAU,CAAE,CAAE,CAmB5D,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/caption/index.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAOlD,QAAA,MAAM,YAAY,EAAE,OAAO,CAAE,KAAK,CAAE,SAAS,CAAE,UAAU,CAAE,CAAE,CAmB5D,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/description/index.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAOlD,QAAA,MAAM,gBAAgB,EAAE,OAAO,CAAE,KAAK,CAAE,SAAS,CAAE,UAAU,CAAE,CAAE,CAqBhE,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/filename/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAElD;;GAEG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAG1C,QAAA,MAAM,aAAa,EAAE,OAAO,CAAE,KAAK,CAAE,SAAS,CAAE,CAU/C,CAAC;AAEF,eAAe,aAAa,CAAC"}
|