sanity-plugin-asset-source-unsplash 5.0.0 → 5.0.1
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/dist/index.d.ts +3 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { AssetSource } from "sanity";
|
|
3
|
-
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
1
|
+
import { AssetSource, Plugin } from "sanity";
|
|
4
2
|
/**
|
|
5
3
|
* @public
|
|
6
4
|
*/
|
|
7
|
-
declare function UnsplashIcon():
|
|
5
|
+
declare function UnsplashIcon(): React.JSX.Element;
|
|
8
6
|
/**
|
|
9
7
|
* @public
|
|
10
8
|
*/
|
|
@@ -74,6 +72,6 @@ declare const unsplashAssetSource: AssetSource;
|
|
|
74
72
|
/**
|
|
75
73
|
* @public
|
|
76
74
|
*/
|
|
77
|
-
declare const unsplashImageAsset:
|
|
75
|
+
declare const unsplashImageAsset: Plugin;
|
|
78
76
|
export { type Asset, type AssetDocument, UnsplashIcon, type UnsplashPhoto, unsplashAssetSource, unsplashImageAsset };
|
|
79
77
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":["UnsplashIcon","
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":["UnsplashIcon","React","JSX","Element","Asset","File","AssetDocument","UnsplashPhoto","AssetSource","Plugin","UnsplashIcon","Asset","AssetDocument","UnsplashPhoto","unsplashAssetSource","unsplashImageAsset"],"sources":["../src/components/Icon.d.ts","../src/types.d.ts","../src/index.d.ts"],"sourcesContent":["/**\n * @public\n */\nexport declare function UnsplashIcon(): React.JSX.Element;\n//# sourceMappingURL=Icon.d.ts.map","/**\n * @public\n */\nexport interface Asset {\n kind: 'url' | 'base64' | 'file' | 'assetDocumentId';\n value: string | File;\n assetDocumentProps?: {\n originalFileName?: string;\n label?: string;\n title?: string;\n description?: string;\n source?: {\n id: string;\n name: string;\n url?: string;\n };\n creditLine?: string;\n };\n}\n/**\n * @public\n */\nexport interface AssetDocument {\n _id: string;\n label?: string;\n title?: string;\n description?: string;\n source?: {\n id: string;\n name: string;\n url?: string;\n };\n creditLine?: string;\n originalFilename?: string;\n}\n/**\n * @public\n */\nexport interface UnsplashPhoto {\n id: string;\n width: number;\n height: number;\n description?: string;\n alt_description?: string;\n urls: {\n full: string;\n small: string;\n };\n user: {\n name: string;\n username: string;\n links: {\n html: string;\n };\n };\n links: {\n html: string;\n self: string;\n download: string;\n download_location: string;\n };\n}\n//# sourceMappingURL=types.d.ts.map","import { type AssetSource, type Plugin } from 'sanity';\nimport { UnsplashIcon } from './components/Icon';\nexport type { Asset, AssetDocument, UnsplashPhoto } from './types';\n/**\n * @public\n */\nexport declare const unsplashAssetSource: AssetSource;\n/**\n * @public\n */\nexport declare const unsplashImageAsset: Plugin;\nexport { UnsplashIcon };\n//# sourceMappingURL=index.d.ts.map"],"mappings":";;;AAGA;iBAAwBA,YAAAA,CAAAA,GAAgBC,KAAAA,CAAMC,GAAAA,CAAIC;;;AAAlD;UCAiBC,KAAAA;EAAAA,IAAAA,EAAAA,KAAK,GAAA,QAEFC,GAAI,MAAA,GAAA,iBAAA;EAiBPC,KAAAA,EAAAA,MAAAA,GAjBGD,IAiBU;EAgBbE,kBAAa,CAAA,EAAA;;IChCTO,KAAAA,CAAAA,EAAAA,MAAAA;IAIAC,KAAAA,CAAAA,EAAAA,MAAAA;;;;;;;;;;;;;UDYJT,aAAAA;;;;;;;;;;;;;;;;UAgBAC,aAAAA;;;;;;;;;;;;;;;;;;;;;;;;;AAnCjB;AAmBA;AAgBiBA,cChCIO,mBDgCS,EChCYN,WDgCZ;;AChC9B;AAIA;cAAqBO,oBAAoBN"}
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { jsxs, jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { c } from "react-compiler-runtime";
|
|
4
4
|
import { SearchIcon } from "@sanity/icons";
|
|
5
5
|
import { Card, Text, TextInput, Dialog, Stack, Flex, Spinner } from "@sanity/ui";
|
|
6
|
-
import
|
|
6
|
+
import { useEffect, Component } from "react";
|
|
7
7
|
import InfiniteScroll from "react-infinite-scroll-component";
|
|
8
8
|
import { PhotoAlbum } from "react-photo-album";
|
|
9
9
|
import { concat, defer, BehaviorSubject } from "rxjs";
|
|
@@ -13,7 +13,7 @@ function UnsplashIcon() {
|
|
|
13
13
|
const $ = c(1);
|
|
14
14
|
let t0;
|
|
15
15
|
return $[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t0 = /* @__PURE__ */ jsxs("svg", { role: "img", viewBox: "0 0 25 25", width: "1em", height: "1em", fill: "currentColor", children: [
|
|
16
|
-
/* @__PURE__ */ jsx("title", {}),
|
|
16
|
+
/* @__PURE__ */ jsx("title", { children: "Unsplash" }),
|
|
17
17
|
/* @__PURE__ */ jsx("path", { d: "M9 9V4h7v5H9Zm7 3h5v9H4v-9h5v5h7v-5Z" })
|
|
18
18
|
] }), $[0] = t0) : t0 = $[0], t0;
|
|
19
19
|
}
|
|
@@ -124,7 +124,7 @@ function UnsplashAssetSource(props) {
|
|
|
124
124
|
let t1;
|
|
125
125
|
return $[1] !== client || $[2] !== props ? (t1 = /* @__PURE__ */ jsx(UnsplashAssetSourceInternal, { ...props, client }), $[1] = client, $[2] = props, $[3] = t1) : t1 = $[3], t1;
|
|
126
126
|
}
|
|
127
|
-
class UnsplashAssetSourceInternal extends
|
|
127
|
+
class UnsplashAssetSourceInternal extends Component {
|
|
128
128
|
static defaultProps = {
|
|
129
129
|
selectedAssets: void 0
|
|
130
130
|
};
|
|
@@ -272,7 +272,7 @@ const unsplashAssetSource = {
|
|
|
272
272
|
name: "asset-source-unsplash-plugin",
|
|
273
273
|
form: {
|
|
274
274
|
image: {
|
|
275
|
-
assetSources:
|
|
275
|
+
assetSources: [unsplashAssetSource]
|
|
276
276
|
}
|
|
277
277
|
}
|
|
278
278
|
});
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/components/Icon.tsx","../src/datastores/unsplash.ts","../src/components/Photo.styled.tsx","../src/components/Photo.tsx","../src/components/UnsplashAssetSource.styled.tsx","../src/components/UnsplashAssetSource.tsx","../src/index.ts"],"sourcesContent":["/**\n * @public\n */\nexport function UnsplashIcon() {\n return (\n <svg role=\"img\" viewBox=\"0 0 25 25\" width=\"1em\" height=\"1em\" fill=\"currentColor\">\n <title />\n <path d=\"M9 9V4h7v5H9Zm7 3h5v9H4v-9h5v5h7v-5Z\" />\n </svg>\n )\n}\n","import type {SanityClient} from 'sanity'\n\nimport {type BehaviorSubject, concat, defer, type Observable} from 'rxjs'\nimport {debounceTime, distinctUntilChanged, map, switchMap, withLatestFrom} from 'rxjs/operators'\n\nimport type {UnsplashPhoto} from '../types'\n\ntype SearchSubject = BehaviorSubject<string>\ntype PageSubject = BehaviorSubject<number>\n\nconst fetchSearch = (\n client: SanityClient,\n query: string,\n page: number,\n perPage: number,\n): Observable<{\n results: UnsplashPhoto[]\n total: number\n total_pages: number\n}> =>\n defer(() =>\n client.observable.request({\n url: `/addons/unsplash/search/photos?query=${encodeURIComponent(\n query,\n )}&page=${page}&per_page=${perPage}`,\n withCredentials: true,\n method: 'GET',\n }),\n )\n\nconst fetchList = (\n client: SanityClient,\n type: string,\n page: number,\n perPage: number,\n): Observable<UnsplashPhoto[]> =>\n defer(() =>\n client.observable.request({\n url: `/addons/unsplash/photos?order_by=${type}&page=${page}&per_page=${perPage}`,\n withCredentials: true,\n method: 'GET',\n }),\n )\n\nexport function fetchDownloadUrl(client: SanityClient, photo: UnsplashPhoto): Promise<string> {\n const downloadUrl = photo.links.download_location.replace(\n 'https://api.unsplash.com',\n '/addons/unsplash',\n )\n return client\n .request({\n url: downloadUrl,\n withCredentials: true,\n method: 'GET',\n })\n .then((result: {url: string}) => {\n return result.url\n })\n}\n\nexport const search = (\n client: SanityClient,\n query: SearchSubject,\n page: PageSubject,\n resultsPerPage: number,\n): Observable<UnsplashPhoto[]> => {\n return concat(\n query.pipe(\n withLatestFrom(page),\n debounceTime(500),\n distinctUntilChanged(),\n switchMap(([q, p]) => {\n if (q) {\n return fetchSearch(client, q, p, resultsPerPage).pipe(\n distinctUntilChanged(),\n map((result) => result.results),\n )\n }\n return fetchList(client, 'popular', p, resultsPerPage)\n }),\n ),\n )\n}\n","import {Card} from '@sanity/ui'\nimport {styled} from 'styled-components'\n\nexport const Root = styled.div`\n overflow: hidden;\n background-origin: content-box;\n background-repeat: no-repeat;\n background-clip: border-box;\n background-size: cover;\n position: relative;\n outline: none !important;\n border: ${({theme}) => `1px solid ${theme.sanity.color.card.enabled.border}`};\n box-sizing: content-box;\n -webkit-user-drag: none;\n\n &:hover {\n opacity: 0.85;\n }\n\n &:focus,\n &:active {\n border: 1px solid var(--input-border-color-focus);\n box-shadow: inset 0 0 0 3px var(--input-border-color-focus);\n }\n`\n\nexport const CreditLineLink = styled.a`\n text-decoration: none;\n cursor: pointer;\n`\n\nexport const CreditLine = styled(Card)`\n ${({theme}) => `\n --creditline-fg: ${theme.sanity.color.card.enabled.fg};\n --creditline-bg: ${theme.sanity.color.card.enabled.bg};\n `};\n -webkit-user-drag: none;\n position: absolute;\n background-color: var(--creditline-bg);\n bottom: 0;\n\n [data-ui='Text'] {\n color: var(--creditline-fg);\n }\n`\n","import {Text} from '@sanity/ui'\nimport {useCallback, useEffect} from 'react'\n\nimport type {UnsplashPhoto} from '../types'\n\nimport {CreditLine, CreditLineLink, Root} from './Photo.styled'\n\ntype Props = {\n data: UnsplashPhoto\n width: number\n height: number\n onClick: (photo: UnsplashPhoto) => void\n onKeyDown: (event: React.KeyboardEvent<HTMLDivElement>) => void\n active: boolean\n onFocus: (photo: UnsplashPhoto) => void\n}\n\nconst UTM_SOURCE = 'sanity-plugin-asset-source-unsplash'\n\nexport default function Photo(props: Props) {\n const {onClick, data, onKeyDown, onFocus, active, width, height} = props\n\n const handleClick = useCallback(() => {\n onClick(data)\n }, [onClick, data])\n\n const handleCreditLineClicked = useCallback(\n (event: React.MouseEvent<HTMLAnchorElement>) => {\n event.stopPropagation()\n const url = `${data.links.html}?utm_source=${encodeURIComponent(\n UTM_SOURCE,\n )}&utm_medium=referral`\n window.open(url, data.id, 'noreferrer,noopener')\n },\n [data],\n )\n\n const handleKeyDown = useCallback(\n (event: React.KeyboardEvent<HTMLDivElement>) => {\n onKeyDown(event)\n if (event.key === 'Enter') {\n onClick(data)\n }\n },\n [onKeyDown, data, onClick],\n )\n\n const handleMouseDown = useCallback(() => {\n onFocus(data)\n }, [onFocus, data])\n\n useEffect(() => {\n if (active) {\n onFocus(data)\n }\n }, [active, data, onFocus])\n\n const src = data.urls.small\n const userName = data.user.name\n\n return (\n <Root\n title={`Select image by ${userName} from Unsplash`}\n tabIndex={0}\n onKeyDown={handleKeyDown}\n onMouseDown={handleMouseDown}\n style={{\n width: `${width}px`,\n height: `${height}px`,\n backgroundImage: `url(\"${src}\")`,\n }}\n onClick={handleClick}\n >\n <CreditLineLink onClick={handleCreditLineClicked}>\n <CreditLine padding={2} radius={2} margin={2}>\n <Text size={1} title={`Open image by ${userName} on Unsplash in new window`}>\n By @{data.user.username}\n </Text>\n </CreditLine>\n </CreditLineLink>\n </Root>\n )\n}\n","import {TextInput} from '@sanity/ui'\nimport {styled} from 'styled-components'\n\nexport const SearchInput = styled(TextInput)`\n position: sticky;\n top: 0;\n z-index: 1;\n`\n\nexport const Scroller = styled.div`\n overflow-y: auto;\n max-height: 80vh;\n`\n","import {SearchIcon} from '@sanity/icons'\nimport {Dialog, Flex, Spinner, Stack, Text} from '@sanity/ui'\nimport React from 'react'\nimport InfiniteScroll from 'react-infinite-scroll-component'\nimport {PhotoAlbum, type RenderPhotoProps, type Photo as PhotoType} from 'react-photo-album'\nimport {BehaviorSubject, type Subscription} from 'rxjs'\nimport {\n type AssetFromSource,\n type AssetSourceComponentProps,\n type SanityClient,\n useClient,\n} from 'sanity'\n\nimport type {UnsplashPhoto} from '../types'\n\nimport {fetchDownloadUrl, search} from '../datastores/unsplash'\nimport Photo from './Photo'\nimport {SearchInput} from './UnsplashAssetSource.styled'\n\ntype UnsplashPhotoAlbumPhoto = PhotoType & {\n key: string\n data: UnsplashPhoto\n}\n\ntype State = {\n query: string\n searchResults: UnsplashPhoto[][]\n page: number\n isLoading: boolean\n cursor: number\n}\n\nconst RESULTS_PER_PAGE = 42\nconst PHOTO_SPACING = 2\nconst PHOTO_PADDING = 1 // offset the 1px border width\n\nexport default function UnsplashAssetSource(props: AssetSourceComponentProps) {\n const client = useClient({apiVersion: '2022-09-01'})\n return <UnsplashAssetSourceInternal {...props} client={client} />\n}\n\nclass UnsplashAssetSourceInternal extends React.Component<\n AssetSourceComponentProps & {client: SanityClient},\n State\n> {\n static defaultProps = {\n selectedAssets: undefined,\n }\n\n override state = {\n cursor: 0,\n query: '',\n page: 1,\n searchResults: [[]],\n isLoading: true,\n }\n\n searchSubscription: Subscription | null = null\n\n searchSubject$ = new BehaviorSubject('')\n pageSubject$ = new BehaviorSubject(1)\n\n override componentDidMount() {\n this.searchSubscription = search(\n this.props.client,\n this.searchSubject$,\n this.pageSubject$,\n RESULTS_PER_PAGE,\n ).subscribe({\n next: (results: UnsplashPhoto[]) => {\n this.setState((prev) => ({\n searchResults: [...prev.searchResults, results],\n isLoading: false,\n }))\n },\n })\n }\n\n override componentWillUnmount() {\n if (this.searchSubscription) {\n this.searchSubscription.unsubscribe()\n }\n }\n\n handleSelect = (photo: UnsplashPhoto) => {\n this.setState({isLoading: true})\n return fetchDownloadUrl(this.props.client, photo).then((downloadUrl) => {\n const description = photo.description || undefined\n const asset: AssetFromSource = {\n kind: 'url',\n value: downloadUrl,\n // @ts-expect-error TODO: this is a partial assetDocumentProps, update types.\n assetDocumentProps: {\n _type: 'sanity.imageAsset',\n source: {\n name: 'unsplash',\n id: photo.id,\n url: photo.links.html,\n },\n description,\n creditLine: `${photo.user.name} by Unsplash`,\n },\n }\n this.props.onSelect([asset])\n return undefined\n })\n }\n\n handleClose = () => {\n this.props.onClose()\n }\n\n handleSearchTermChanged = (event: React.ChangeEvent<HTMLInputElement>) => {\n const query = event.currentTarget.value\n this.setState({\n query,\n page: 1,\n searchResults: [[]],\n isLoading: true,\n cursor: 0,\n })\n this.pageSubject$.next(1)\n this.searchSubject$.next(query)\n }\n\n handleSearchTermCleared = () => {\n this.setState({\n query: '',\n page: 1,\n searchResults: [[]],\n isLoading: true,\n cursor: 0,\n })\n this.pageSubject$.next(1)\n this.searchSubject$.next('')\n }\n\n handleScrollerLoadMore = () => {\n const nextPage = this.state.page + 1\n this.setState({page: nextPage, isLoading: true})\n this.pageSubject$.next(nextPage)\n this.searchSubject$.next(this.state.query)\n }\n\n handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n const {cursor} = this.state\n if ((event.keyCode === 38 || event.keyCode === 37) && cursor > 0) {\n this.setState((prevState) => ({\n cursor: prevState.cursor - 1,\n }))\n } else if (\n (event.keyCode === 40 || event.keyCode === 39) &&\n cursor < this.getPhotos().length - 1\n ) {\n this.setState((prevState) => ({\n cursor: prevState.cursor + 1,\n }))\n }\n }\n\n getPhotos() {\n return this.state.searchResults.flat()\n }\n\n updateCursor = (photo: UnsplashPhoto) => {\n const index = this.getPhotos().findIndex((result: UnsplashPhoto) => result.id === photo.id)\n this.setState({cursor: index})\n }\n\n renderImage = (props: RenderPhotoProps<UnsplashPhotoAlbumPhoto>) => {\n const {photo, layout} = props\n const active =\n this.getPhotos().findIndex((result: UnsplashPhoto) => result.id === photo.data.id) ===\n this.state.cursor || false\n return (\n <Photo\n onClick={this.handleSelect}\n onKeyDown={this.handleKeyDown}\n data={photo.data}\n width={layout.width}\n height={layout.height}\n active={active}\n onFocus={this.updateCursor}\n />\n )\n }\n\n override render() {\n const {query, searchResults, isLoading} = this.state\n\n return (\n <Dialog\n animate\n id=\"unsplash-asset-source\"\n header=\"Select image from Unsplash\"\n onClose={this.handleClose}\n open\n width={4}\n >\n <Stack space={3} paddingX={4} paddingBottom={4}>\n <SearchInput\n clearButton={query.length > 0}\n icon={SearchIcon}\n onChange={this.handleSearchTermChanged}\n onClear={this.handleSearchTermCleared}\n placeholder=\"Search by topics or colors\"\n value={query}\n />\n {!isLoading && this.getPhotos().length === 0 && (\n <Text size={1} muted>\n No results found\n </Text>\n )}\n <InfiniteScroll\n dataLength={this.getPhotos().length} // This is important field to render the next data\n next={this.handleScrollerLoadMore}\n // scrollableTarget=\"unsplash-scroller\"\n hasMore\n scrollThreshold={0.99}\n height=\"60vh\"\n loader={\n <Flex align=\"center\" justify=\"center\" padding={3}>\n <Spinner muted />\n </Flex>\n }\n endMessage={\n <Text size={1} muted>\n No more results\n </Text>\n }\n >\n {searchResults\n .filter((photos) => photos.length > 0)\n .map((photos: UnsplashPhoto[], index) => (\n <PhotoAlbum\n key={`gallery-${query || 'popular'}-${index}`}\n layout=\"rows\"\n spacing={PHOTO_SPACING}\n padding={PHOTO_PADDING}\n targetRowHeight={(width) => {\n if (width < 300) return 150\n if (width < 600) return 200\n return 300\n }}\n photos={photos.map((photo: UnsplashPhoto) => ({\n src: photo.urls.small,\n width: photo.width,\n height: photo.height,\n key: photo.id,\n data: photo,\n }))}\n renderPhoto={this.renderImage}\n componentsProps={{\n containerProps: {\n style: {marginBottom: `${PHOTO_SPACING}px`},\n },\n }}\n />\n ))}\n </InfiniteScroll>\n </Stack>\n </Dialog>\n )\n }\n}\n","import {type AssetSource, definePlugin} from 'sanity'\n\nimport {UnsplashIcon} from './components/Icon'\nimport Unsplash from './components/UnsplashAssetSource'\n\nexport type {Asset, AssetDocument, UnsplashPhoto} from './types'\n\n/**\n * @public\n */\nexport const unsplashAssetSource: AssetSource = {\n name: 'unsplash',\n title: 'Unsplash',\n component: Unsplash,\n icon: UnsplashIcon,\n}\n\n/**\n * @public\n */\nexport const unsplashImageAsset = definePlugin({\n name: 'asset-source-unsplash-plugin',\n\n form: {\n image: {\n assetSources: (prev) => {\n return [...prev, unsplashAssetSource]\n },\n },\n },\n})\n\nexport {UnsplashIcon}\n"],"names":["UnsplashIcon","$","_c","t0","for","fetchSearch","client","query","page","perPage","defer","observable","request","url","encodeURIComponent","withCredentials","method","fetchList","type","fetchDownloadUrl","photo","downloadUrl","links","download_location","replace","then","result","search","resultsPerPage","concat","pipe","withLatestFrom","debounceTime","distinctUntilChanged","switchMap","q","p","map","results","Root","styled","div","withConfig","displayName","componentId","theme","sanity","color","card","enabled","border","CreditLineLink","a","CreditLine","Card","fg","bg","UTM_SOURCE","Photo","props","onClick","data","onKeyDown","onFocus","active","width","height","handleClick","t1","id","html","event","stopPropagation","window","open","handleCreditLineClicked","t2","event_0","key","handleKeyDown","t3","handleMouseDown","t4","t5","useEffect","src","urls","small","userName","user","name","t6","t7","t8","t9","t10","backgroundImage","t11","t12","username","t13","t14","SearchInput","TextInput","RESULTS_PER_PAGE","PHOTO_SPACING","PHOTO_PADDING","UnsplashAssetSource","apiVersion","useClient","UnsplashAssetSourceInternal","React","Component","defaultProps","selectedAssets","undefined","state","cursor","searchResults","isLoading","searchSubscription","searchSubject$","BehaviorSubject","pageSubject$","componentDidMount","subscribe","next","setState","prev","componentWillUnmount","unsubscribe","handleSelect","description","asset","kind","value","assetDocumentProps","_type","source","creditLine","onSelect","handleClose","onClose","handleSearchTermChanged","currentTarget","handleSearchTermCleared","handleScrollerLoadMore","nextPage","keyCode","prevState","getPhotos","length","flat","updateCursor","index","findIndex","renderImage","layout","render","SearchIcon","filter","photos","containerProps","style","marginBottom","unsplashAssetSource","title","component","Unsplash","icon","unsplashImageAsset","definePlugin","form","image","assetSources"],"mappings":";;;;;;;;;;;AAGO,SAAAA,eAAA;AAAA,QAAAC,IAAAC,EAAA,CAAA;AAAA,MAAAC;AAAA,SAAAF,EAAA,CAAA,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.ts","../src/components/Photo.styled.tsx","../src/components/Photo.tsx","../src/components/UnsplashAssetSource.styled.tsx","../src/components/UnsplashAssetSource.tsx","../src/index.ts"],"sourcesContent":["/**\n * @public\n */\nexport function UnsplashIcon(): React.JSX.Element {\n return (\n <svg role=\"img\" viewBox=\"0 0 25 25\" width=\"1em\" height=\"1em\" fill=\"currentColor\">\n <title>Unsplash</title>\n <path d=\"M9 9V4h7v5H9Zm7 3h5v9H4v-9h5v5h7v-5Z\" />\n </svg>\n )\n}\n","import type {SanityClient} from 'sanity'\n\nimport {type BehaviorSubject, concat, defer, type Observable} from 'rxjs'\nimport {debounceTime, distinctUntilChanged, map, switchMap, withLatestFrom} from 'rxjs/operators'\n\nimport type {UnsplashPhoto} from '../types'\n\ntype SearchSubject = BehaviorSubject<string>\ntype PageSubject = BehaviorSubject<number>\n\nconst fetchSearch = (\n client: SanityClient,\n query: string,\n page: number,\n perPage: number,\n): Observable<{\n results: UnsplashPhoto[]\n total: number\n total_pages: number\n}> =>\n defer(() =>\n client.observable.request({\n url: `/addons/unsplash/search/photos?query=${encodeURIComponent(\n query,\n )}&page=${page}&per_page=${perPage}`,\n withCredentials: true,\n method: 'GET',\n }),\n )\n\nconst fetchList = (\n client: SanityClient,\n type: string,\n page: number,\n perPage: number,\n): Observable<UnsplashPhoto[]> =>\n defer(() =>\n client.observable.request({\n url: `/addons/unsplash/photos?order_by=${type}&page=${page}&per_page=${perPage}`,\n withCredentials: true,\n method: 'GET',\n }),\n )\n\nexport function fetchDownloadUrl(client: SanityClient, photo: UnsplashPhoto): Promise<string> {\n const downloadUrl = photo.links.download_location.replace(\n 'https://api.unsplash.com',\n '/addons/unsplash',\n )\n return client\n .request({\n url: downloadUrl,\n withCredentials: true,\n method: 'GET',\n })\n .then((result: {url: string}) => {\n return result.url\n })\n}\n\nexport const search = (\n client: SanityClient,\n query: SearchSubject,\n page: PageSubject,\n resultsPerPage: number,\n): Observable<UnsplashPhoto[]> => {\n return concat(\n query.pipe(\n withLatestFrom(page),\n debounceTime(500),\n distinctUntilChanged(),\n switchMap(([q, p]) => {\n if (q) {\n return fetchSearch(client, q, p, resultsPerPage).pipe(\n distinctUntilChanged(),\n map((result) => result.results),\n )\n }\n return fetchList(client, 'popular', p, resultsPerPage)\n }),\n ),\n )\n}\n","import {Card} from '@sanity/ui'\nimport {styled} from 'styled-components'\n\nexport const Root = styled.div`\n overflow: hidden;\n background-origin: content-box;\n background-repeat: no-repeat;\n background-clip: border-box;\n background-size: cover;\n position: relative;\n outline: none !important;\n border: ${({theme}) => `1px solid ${theme.sanity.color.card.enabled.border}`};\n box-sizing: content-box;\n -webkit-user-drag: none;\n\n &:hover {\n opacity: 0.85;\n }\n\n &:focus,\n &:active {\n border: 1px solid var(--input-border-color-focus);\n box-shadow: inset 0 0 0 3px var(--input-border-color-focus);\n }\n`\n\nexport const CreditLineLink = styled.a`\n text-decoration: none;\n cursor: pointer;\n`\n\nexport const CreditLine = styled(Card)`\n ${({theme}) => `\n --creditline-fg: ${theme.sanity.color.card.enabled.fg};\n --creditline-bg: ${theme.sanity.color.card.enabled.bg};\n `};\n -webkit-user-drag: none;\n position: absolute;\n background-color: var(--creditline-bg);\n bottom: 0;\n\n [data-ui='Text'] {\n color: var(--creditline-fg);\n }\n`\n","import {Text} from '@sanity/ui'\nimport {useCallback, useEffect} from 'react'\n\nimport type {UnsplashPhoto} from '../types'\n\nimport {CreditLine, CreditLineLink, Root} from './Photo.styled'\n\ntype Props = {\n data: UnsplashPhoto\n width: number\n height: number\n onClick: (photo: UnsplashPhoto) => void\n onKeyDown: (event: React.KeyboardEvent<HTMLDivElement>) => void\n active: boolean\n onFocus: (photo: UnsplashPhoto) => void\n}\n\nconst UTM_SOURCE = 'sanity-plugin-asset-source-unsplash'\n\nexport default function Photo(props: Props) {\n const {onClick, data, onKeyDown, onFocus, active, width, height} = props\n\n const handleClick = useCallback(() => {\n onClick(data)\n }, [onClick, data])\n\n const handleCreditLineClicked = useCallback(\n (event: React.MouseEvent<HTMLAnchorElement>) => {\n event.stopPropagation()\n const url = `${data.links.html}?utm_source=${encodeURIComponent(\n UTM_SOURCE,\n )}&utm_medium=referral`\n window.open(url, data.id, 'noreferrer,noopener')\n },\n [data],\n )\n\n const handleKeyDown = useCallback(\n (event: React.KeyboardEvent<HTMLDivElement>) => {\n onKeyDown(event)\n if (event.key === 'Enter') {\n onClick(data)\n }\n },\n [onKeyDown, data, onClick],\n )\n\n const handleMouseDown = useCallback(() => {\n onFocus(data)\n }, [onFocus, data])\n\n useEffect(() => {\n if (active) {\n onFocus(data)\n }\n }, [active, data, onFocus])\n\n const src = data.urls.small\n const userName = data.user.name\n\n return (\n <Root\n title={`Select image by ${userName} from Unsplash`}\n tabIndex={0}\n onKeyDown={handleKeyDown}\n onMouseDown={handleMouseDown}\n style={{\n width: `${width}px`,\n height: `${height}px`,\n backgroundImage: `url(\"${src}\")`,\n }}\n onClick={handleClick}\n >\n <CreditLineLink onClick={handleCreditLineClicked}>\n <CreditLine padding={2} radius={2} margin={2}>\n <Text size={1} title={`Open image by ${userName} on Unsplash in new window`}>\n By @{data.user.username}\n </Text>\n </CreditLine>\n </CreditLineLink>\n </Root>\n )\n}\n","import {TextInput} from '@sanity/ui'\nimport {styled} from 'styled-components'\n\nexport const SearchInput = styled(TextInput)`\n position: sticky;\n top: 0;\n z-index: 1;\n`\n\nexport const Scroller = styled.div`\n overflow-y: auto;\n max-height: 80vh;\n`\n","import {SearchIcon} from '@sanity/icons'\nimport {Dialog, Flex, Spinner, Stack, Text} from '@sanity/ui'\nimport {Component} from 'react'\nimport InfiniteScroll from 'react-infinite-scroll-component'\nimport {PhotoAlbum, type RenderPhotoProps, type Photo as PhotoType} from 'react-photo-album'\nimport {BehaviorSubject, type Subscription} from 'rxjs'\nimport {\n type AssetFromSource,\n type AssetSourceComponentProps,\n type SanityClient,\n useClient,\n} from 'sanity'\n\nimport type {UnsplashPhoto} from '../types'\n\nimport {fetchDownloadUrl, search} from '../datastores/unsplash'\nimport Photo from './Photo'\nimport {SearchInput} from './UnsplashAssetSource.styled'\n\ntype UnsplashPhotoAlbumPhoto = PhotoType & {\n key: string\n data: UnsplashPhoto\n}\n\ntype State = {\n query: string\n searchResults: UnsplashPhoto[][]\n page: number\n isLoading: boolean\n cursor: number\n}\n\nconst RESULTS_PER_PAGE = 42\nconst PHOTO_SPACING = 2\nconst PHOTO_PADDING = 1 // offset the 1px border width\n\nexport default function UnsplashAssetSource(props: AssetSourceComponentProps) {\n const client = useClient({apiVersion: '2022-09-01'})\n return <UnsplashAssetSourceInternal {...props} client={client} />\n}\n\nclass UnsplashAssetSourceInternal extends Component<\n AssetSourceComponentProps & {client: SanityClient},\n State\n> {\n static defaultProps = {\n selectedAssets: undefined,\n }\n\n override state = {\n cursor: 0,\n query: '',\n page: 1,\n searchResults: [[]],\n isLoading: true,\n }\n\n searchSubscription: Subscription | null = null\n\n searchSubject$ = new BehaviorSubject('')\n pageSubject$ = new BehaviorSubject(1)\n\n override componentDidMount() {\n this.searchSubscription = search(\n this.props.client,\n this.searchSubject$,\n this.pageSubject$,\n RESULTS_PER_PAGE,\n ).subscribe({\n next: (results: UnsplashPhoto[]) => {\n this.setState((prev) => ({\n searchResults: [...prev.searchResults, results],\n isLoading: false,\n }))\n },\n })\n }\n\n override componentWillUnmount() {\n if (this.searchSubscription) {\n this.searchSubscription.unsubscribe()\n }\n }\n\n handleSelect = (photo: UnsplashPhoto) => {\n this.setState({isLoading: true})\n return fetchDownloadUrl(this.props.client, photo).then((downloadUrl) => {\n const description = photo.description || undefined\n const asset: AssetFromSource = {\n kind: 'url',\n value: downloadUrl,\n // @ts-expect-error TODO: this is a partial assetDocumentProps, update types.\n assetDocumentProps: {\n _type: 'sanity.imageAsset',\n source: {\n name: 'unsplash',\n id: photo.id,\n url: photo.links.html,\n },\n description,\n creditLine: `${photo.user.name} by Unsplash`,\n },\n }\n this.props.onSelect([asset])\n return undefined\n })\n }\n\n handleClose = () => {\n this.props.onClose()\n }\n\n handleSearchTermChanged = (event: React.ChangeEvent<HTMLInputElement>) => {\n const query = event.currentTarget.value\n this.setState({\n query,\n page: 1,\n searchResults: [[]],\n isLoading: true,\n cursor: 0,\n })\n this.pageSubject$.next(1)\n this.searchSubject$.next(query)\n }\n\n handleSearchTermCleared = () => {\n this.setState({\n query: '',\n page: 1,\n searchResults: [[]],\n isLoading: true,\n cursor: 0,\n })\n this.pageSubject$.next(1)\n this.searchSubject$.next('')\n }\n\n handleScrollerLoadMore = () => {\n const nextPage = this.state.page + 1\n this.setState({page: nextPage, isLoading: true})\n this.pageSubject$.next(nextPage)\n this.searchSubject$.next(this.state.query)\n }\n\n handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n const {cursor} = this.state\n if ((event.keyCode === 38 || event.keyCode === 37) && cursor > 0) {\n this.setState((prevState) => ({\n cursor: prevState.cursor - 1,\n }))\n } else if (\n (event.keyCode === 40 || event.keyCode === 39) &&\n cursor < this.getPhotos().length - 1\n ) {\n this.setState((prevState) => ({\n cursor: prevState.cursor + 1,\n }))\n }\n }\n\n getPhotos() {\n return this.state.searchResults.flat()\n }\n\n updateCursor = (photo: UnsplashPhoto) => {\n const index = this.getPhotos().findIndex((result: UnsplashPhoto) => result.id === photo.id)\n this.setState({cursor: index})\n }\n\n renderImage = (props: RenderPhotoProps<UnsplashPhotoAlbumPhoto>) => {\n const {photo, layout} = props\n const active =\n this.getPhotos().findIndex((result: UnsplashPhoto) => result.id === photo.data.id) ===\n this.state.cursor || false\n return (\n <Photo\n onClick={this.handleSelect}\n onKeyDown={this.handleKeyDown}\n data={photo.data}\n width={layout.width}\n height={layout.height}\n active={active}\n onFocus={this.updateCursor}\n />\n )\n }\n\n override render() {\n const {query, searchResults, isLoading} = this.state\n\n return (\n <Dialog\n animate\n id=\"unsplash-asset-source\"\n header=\"Select image from Unsplash\"\n onClose={this.handleClose}\n open\n width={4}\n >\n <Stack space={3} paddingX={4} paddingBottom={4}>\n <SearchInput\n clearButton={query.length > 0}\n icon={SearchIcon}\n onChange={this.handleSearchTermChanged}\n onClear={this.handleSearchTermCleared}\n placeholder=\"Search by topics or colors\"\n value={query}\n />\n {!isLoading && this.getPhotos().length === 0 && (\n <Text size={1} muted>\n No results found\n </Text>\n )}\n <InfiniteScroll\n dataLength={this.getPhotos().length} // This is important field to render the next data\n next={this.handleScrollerLoadMore}\n // scrollableTarget=\"unsplash-scroller\"\n hasMore\n scrollThreshold={0.99}\n height=\"60vh\"\n loader={\n <Flex align=\"center\" justify=\"center\" padding={3}>\n <Spinner muted />\n </Flex>\n }\n endMessage={\n <Text size={1} muted>\n No more results\n </Text>\n }\n >\n {searchResults\n .filter((photos) => photos.length > 0)\n .map((photos: UnsplashPhoto[], index) => (\n <PhotoAlbum\n key={`gallery-${query || 'popular'}-${index}`}\n layout=\"rows\"\n spacing={PHOTO_SPACING}\n padding={PHOTO_PADDING}\n targetRowHeight={(width) => {\n if (width < 300) return 150\n if (width < 600) return 200\n return 300\n }}\n photos={photos.map((photo: UnsplashPhoto) => ({\n src: photo.urls.small,\n width: photo.width,\n height: photo.height,\n key: photo.id,\n data: photo,\n }))}\n renderPhoto={this.renderImage}\n componentsProps={{\n containerProps: {\n style: {marginBottom: `${PHOTO_SPACING}px`},\n },\n }}\n />\n ))}\n </InfiniteScroll>\n </Stack>\n </Dialog>\n )\n }\n}\n","import {type AssetSource, definePlugin, type Plugin} from 'sanity'\n\nimport {UnsplashIcon} from './components/Icon'\nimport Unsplash from './components/UnsplashAssetSource'\n\nexport type {Asset, AssetDocument, UnsplashPhoto} from './types'\n\n/**\n * @public\n */\nexport const unsplashAssetSource: AssetSource = {\n name: 'unsplash',\n title: 'Unsplash',\n component: Unsplash,\n icon: UnsplashIcon,\n}\n\n/**\n * @public\n */\nexport const unsplashImageAsset: Plugin = definePlugin({\n name: 'asset-source-unsplash-plugin',\n\n form: {\n image: {\n assetSources: [unsplashAssetSource],\n },\n },\n})\n\nexport {UnsplashIcon}\n"],"names":["UnsplashIcon","$","_c","t0","for","fetchSearch","client","query","page","perPage","defer","observable","request","url","encodeURIComponent","withCredentials","method","fetchList","type","fetchDownloadUrl","photo","downloadUrl","links","download_location","replace","then","result","search","resultsPerPage","concat","pipe","withLatestFrom","debounceTime","distinctUntilChanged","switchMap","q","p","map","results","Root","styled","div","withConfig","displayName","componentId","theme","sanity","color","card","enabled","border","CreditLineLink","a","CreditLine","Card","fg","bg","UTM_SOURCE","Photo","props","onClick","data","onKeyDown","onFocus","active","width","height","handleClick","t1","id","html","event","stopPropagation","window","open","handleCreditLineClicked","t2","event_0","key","handleKeyDown","t3","handleMouseDown","t4","t5","useEffect","src","urls","small","userName","user","name","t6","t7","t8","t9","t10","backgroundImage","t11","t12","username","t13","t14","SearchInput","TextInput","RESULTS_PER_PAGE","PHOTO_SPACING","PHOTO_PADDING","UnsplashAssetSource","apiVersion","useClient","UnsplashAssetSourceInternal","Component","defaultProps","selectedAssets","undefined","state","cursor","searchResults","isLoading","searchSubscription","searchSubject$","BehaviorSubject","pageSubject$","componentDidMount","subscribe","next","setState","prev","componentWillUnmount","unsubscribe","handleSelect","description","asset","kind","value","assetDocumentProps","_type","source","creditLine","onSelect","handleClose","onClose","handleSearchTermChanged","currentTarget","handleSearchTermCleared","handleScrollerLoadMore","nextPage","keyCode","prevState","getPhotos","length","flat","updateCursor","index","findIndex","renderImage","layout","render","SearchIcon","filter","photos","containerProps","style","marginBottom","unsplashAssetSource","title","component","Unsplash","icon","unsplashImageAsset","definePlugin","form","image","assetSources"],"mappings":";;;;;;;;;;;AAGO,SAAAA,eAAA;AAAA,QAAAC,IAAAC,EAAA,CAAA;AAAA,MAAAC;AAAA,SAAAF,EAAA,CAAA,6BAAAG,IAAA,2BAAA,KAEHD,KAAA,qBAAA,SAAU,MAAA,OAAc,SAAA,aAAkB,OAAA,OAAa,QAAA,OAAW,MAAA,gBAChE,UAAA;AAAA,IAAA,oBAAA,WAAO,UAAA,WAAA,CAAQ;AAAA,IACf,oBAAA,QAAA,EAAQ,GAAA,uCAAA,CAAs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QC,CAAAA,WAAWA,OAAOV,SAAS,CAAC,EACpCjH,IAAI,CAAC2H,QAAyBP,UAC7B,oBAAC,cAEC,QAAO,QACP,SAAShD,eACT,SAASC,eACT,iBAAkBzC,CAAAA,UACZA,QAAQ,MAAY,MACpBA,QAAQ,MAAY,MACjB,KAET,QAAQ+F,OAAO3H,IAAKjB,CAAAA,WAA0B;AAAA,YAC5CiE,KAAKjE,MAAMkE,KAAKC;AAAAA,YAChBtB,OAAO7C,MAAM6C;AAAAA,YACbC,QAAQ9C,MAAM8C;AAAAA,YACdY,KAAK1D,MAAMiD;AAAAA,YACXR,MAAMzC;AAAAA,UAAAA,EACN,GACF,aAAa,KAAKuI,aAClB,iBAAiB;AAAA,YACfM,gBAAgB;AAAA,cACdC,OAAO;AAAA,gBAACC,cAAc,GAAG1D,aAAa;AAAA,cAAA;AAAA,YAAI;AAAA,UAC5C,KApBG,WAAWlG,SAAS,SAAS,IAAIkJ,KAAK,GAuB9C;AAAA,QAAA;AAAA,MAAA;AAAA,IACL,EAAA,CACF,EAAA,CACF;AAAA,EAEJ;AACF;AC9PO,MAAMW,sBAAmC;AAAA,EAC9C1E,MAAM;AAAA,EACN2E,OAAO;AAAA,EACPC,WAAWC;AAAAA,EACXC,MAAMxK;AACR,GAKayK,qBAA6BC,aAAa;AAAA,EACrDhF,MAAM;AAAA,EAENiF,MAAM;AAAA,IACJC,OAAO;AAAA,MACLC,cAAc,CAACT,mBAAmB;AAAA,IAAA;AAAA,EACpC;AAEJ,CAAC;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sanity-plugin-asset-source-unsplash",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.1",
|
|
4
4
|
"description": "Use images from Unsplash.com in your Sanity Studio",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"assets",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"rxjs": "^7.8.2"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@sanity/pkg-utils": "^10.1
|
|
42
|
+
"@sanity/pkg-utils": "^10.2.1",
|
|
43
43
|
"@types/react": "^19.2.7",
|
|
44
44
|
"@typescript/native-preview": "7.0.0-dev.20251212.1",
|
|
45
45
|
"babel-plugin-react-compiler": "^1.0.0",
|
|
@@ -50,8 +50,8 @@
|
|
|
50
50
|
"styled-components": "^6.1.19",
|
|
51
51
|
"typescript": "5.9.3",
|
|
52
52
|
"@repo/eslint-config": "0.0.7",
|
|
53
|
-
"@repo/
|
|
54
|
-
"@repo/
|
|
53
|
+
"@repo/package.config": "0.0.0",
|
|
54
|
+
"@repo/tsconfig": "1.0.0"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
57
|
"react": "^18.3 || ^19",
|