@snokam/ui 7.2.1 → 7.3.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/CHANGELOG.md +32 -0
- package/dist/components/animated-blobs/styled.d.ts.map +1 -1
- package/dist/components/animated-blobs/styled.js +5 -4
- package/dist/components/animated-blobs/styled.js.map +1 -1
- package/dist/components/avatar/index.d.ts +4 -2
- package/dist/components/avatar/index.d.ts.map +1 -1
- package/dist/components/avatar/index.js +2 -1
- package/dist/components/avatar/index.js.map +1 -1
- package/dist/components/breadcrumbs/index.js +1 -1
- package/dist/components/breadcrumbs/index.js.map +1 -1
- package/dist/components/business-logo/index.d.ts.map +1 -1
- package/dist/components/business-logo/index.js +21 -12
- package/dist/components/business-logo/index.js.map +1 -1
- package/dist/components/business-logo/source.d.ts +1 -0
- package/dist/components/business-logo/source.d.ts.map +1 -1
- package/dist/components/business-logo/source.js +5 -0
- package/dist/components/business-logo/source.js.map +1 -1
- package/dist/components/business-logo/styles.d.ts +18 -0
- package/dist/components/business-logo/styles.d.ts.map +1 -1
- package/dist/components/business-logo/styles.js +12 -0
- package/dist/components/business-logo/styles.js.map +1 -1
- package/dist/components/button/index.d.ts +4 -0
- package/dist/components/button/index.d.ts.map +1 -1
- package/dist/components/button/index.js +1 -0
- package/dist/components/button/index.js.map +1 -1
- package/dist/components/charts/scale.d.ts.map +1 -1
- package/dist/components/charts/scale.js +2 -0
- package/dist/components/charts/scale.js.map +1 -1
- package/dist/components/dropzone/Dropzone.js +2 -2
- package/dist/components/dropzone/Dropzone.js.map +1 -1
- package/dist/components/dropzone/components/PDFPreview.d.ts.map +1 -1
- package/dist/components/dropzone/components/PDFPreview.js +1 -1
- package/dist/components/dropzone/components/PDFPreview.js.map +1 -1
- package/dist/components/dropzone/components/PDFPreviewCard.d.ts.map +1 -1
- package/dist/components/dropzone/components/PDFPreviewCard.js +1 -1
- package/dist/components/dropzone/components/PDFPreviewCard.js.map +1 -1
- package/dist/components/dropzone/components/SingleFilePreview.styles.d.ts.map +1 -1
- package/dist/components/dropzone/components/SingleFilePreview.styles.js +0 -4
- package/dist/components/dropzone/components/SingleFilePreview.styles.js.map +1 -1
- package/dist/components/dropzone/hooks/useBatchUpload.d.ts +3 -3
- package/dist/components/dropzone/hooks/useBatchUpload.d.ts.map +1 -1
- package/dist/components/dropzone/hooks/useBatchUpload.js +5 -6
- package/dist/components/dropzone/hooks/useBatchUpload.js.map +1 -1
- package/dist/components/dropzone/index.d.ts +1 -1
- package/dist/components/dropzone/index.d.ts.map +1 -1
- package/dist/components/dropzone/index.js.map +1 -1
- package/dist/components/dropzone/types.d.ts +4 -6
- package/dist/components/dropzone/types.d.ts.map +1 -1
- package/dist/components/dropzone/types.js.map +1 -1
- package/dist/components/dropzone/utils/blobUtils.d.ts +3 -3
- package/dist/components/dropzone/utils/blobUtils.d.ts.map +1 -1
- package/dist/components/dropzone/utils/blobUtils.js +9 -15
- package/dist/components/dropzone/utils/blobUtils.js.map +1 -1
- package/dist/components/feedback/activity/ActivityBar.d.ts +10 -0
- package/dist/components/feedback/activity/ActivityBar.d.ts.map +1 -0
- package/dist/components/feedback/activity/ActivityBar.js +10 -0
- package/dist/components/feedback/activity/ActivityBar.js.map +1 -0
- package/dist/components/feedback/activity/QueryErrorNotice.d.ts +9 -0
- package/dist/components/feedback/activity/QueryErrorNotice.d.ts.map +1 -0
- package/dist/components/feedback/activity/QueryErrorNotice.js +7 -0
- package/dist/components/feedback/activity/QueryErrorNotice.js.map +1 -0
- package/dist/components/feedback/activity/QueryState.d.ts +17 -0
- package/dist/components/feedback/activity/QueryState.d.ts.map +1 -0
- package/dist/components/feedback/activity/QueryState.js +17 -0
- package/dist/components/feedback/activity/QueryState.js.map +1 -0
- package/dist/components/feedback/activity/styles.d.ts +13 -0
- package/dist/components/feedback/activity/styles.d.ts.map +1 -0
- package/dist/components/feedback/activity/styles.js +35 -0
- package/dist/components/feedback/activity/styles.js.map +1 -0
- package/dist/components/feedback/index.d.ts +5 -0
- package/dist/components/feedback/index.d.ts.map +1 -1
- package/dist/components/feedback/index.js +3 -0
- package/dist/components/feedback/index.js.map +1 -1
- package/dist/components/form/fields/FormArrayField.d.ts +4 -2
- package/dist/components/form/fields/FormArrayField.d.ts.map +1 -1
- package/dist/components/form/fields/FormArrayField.js.map +1 -1
- package/dist/components/form/fields/FormCheckbox.d.ts +1 -1
- package/dist/components/form/fields/FormCheckbox.d.ts.map +1 -1
- package/dist/components/form/fields/FormCheckbox.js +1 -1
- package/dist/components/form/fields/FormCheckbox.js.map +1 -1
- package/dist/components/form/fields/FormDate.d.ts.map +1 -1
- package/dist/components/form/fields/FormDate.js +2 -1
- package/dist/components/form/fields/FormDate.js.map +1 -1
- package/dist/components/form/fields/FormImageField.d.ts +3 -3
- package/dist/components/form/fields/FormImageField.d.ts.map +1 -1
- package/dist/components/form/fields/FormImageField.js +3 -19
- package/dist/components/form/fields/FormImageField.js.map +1 -1
- package/dist/components/form/fields/FormSwitch.d.ts +1 -1
- package/dist/components/form/fields/FormSwitch.d.ts.map +1 -1
- package/dist/components/form/fields/FormSwitch.js +1 -1
- package/dist/components/form/fields/FormSwitch.js.map +1 -1
- package/dist/components/instagram-feed/InstagramFeedInline.d.ts +1 -1
- package/dist/components/instagram-feed/InstagramFeedInline.d.ts.map +1 -1
- package/dist/components/instagram-feed/InstagramFeedInline.js +2 -2
- package/dist/components/instagram-feed/InstagramFeedInline.js.map +1 -1
- package/dist/components/instagram-feed/styled.d.ts.map +1 -1
- package/dist/components/instagram-feed/styled.js +5 -4
- package/dist/components/instagram-feed/styled.js.map +1 -1
- package/dist/components/media/components/VideoPlayer.d.ts +1 -1
- package/dist/components/media/components/VideoPlayer.d.ts.map +1 -1
- package/dist/components/media/components/VideoPlayer.js +5 -1
- package/dist/components/media/components/VideoPlayer.js.map +1 -1
- package/dist/components/media/components/styles.d.ts.map +1 -1
- package/dist/components/media/components/styles.js +2 -2
- package/dist/components/media/components/styles.js.map +1 -1
- package/dist/components/media/index.d.ts +3 -1
- package/dist/components/media/index.d.ts.map +1 -1
- package/dist/components/media/index.js +13 -11
- package/dist/components/media/index.js.map +1 -1
- package/dist/components/media/styled.d.ts.map +1 -1
- package/dist/components/media/styled.js +5 -0
- package/dist/components/media/styled.js.map +1 -1
- package/dist/components/media/types.d.ts +36 -2
- package/dist/components/media/types.d.ts.map +1 -1
- package/dist/components/media/types.js +6 -1
- package/dist/components/media/types.js.map +1 -1
- package/dist/components/media/url/framing.d.ts +20 -0
- package/dist/components/media/url/framing.d.ts.map +1 -0
- package/dist/components/media/url/framing.js +16 -0
- package/dist/components/media/url/framing.js.map +1 -0
- package/dist/components/media/url/index.d.ts +23 -0
- package/dist/components/media/url/index.d.ts.map +1 -0
- package/dist/components/media/url/index.js +64 -0
- package/dist/components/media/url/index.js.map +1 -0
- package/dist/components/media/url/optimizer.d.ts +7 -0
- package/dist/components/media/url/optimizer.d.ts.map +1 -0
- package/dist/components/media/url/optimizer.js +12 -0
- package/dist/components/media/url/optimizer.js.map +1 -0
- package/dist/components/media/url/sources.d.ts +17 -0
- package/dist/components/media/url/sources.d.ts.map +1 -0
- package/dist/components/media/url/sources.js +46 -0
- package/dist/components/media/url/sources.js.map +1 -0
- package/dist/components/not-found/index.js +1 -1
- package/dist/components/okr/Okr.d.ts +2 -2
- package/dist/components/okr/Okr.d.ts.map +1 -1
- package/dist/components/okr/Okr.js +9 -21
- package/dist/components/okr/Okr.js.map +1 -1
- package/dist/components/okr/components/Progress.d.ts +1 -0
- package/dist/components/okr/components/Progress.d.ts.map +1 -1
- package/dist/components/okr/components/Progress.js +1 -1
- package/dist/components/okr/components/Progress.js.map +1 -1
- package/dist/components/okr/components/graph/ProgressGraph.d.ts +2 -2
- package/dist/components/okr/components/graph/ProgressGraph.d.ts.map +1 -1
- package/dist/components/okr/components/graph/ProgressGraph.js +4 -3
- package/dist/components/okr/components/graph/ProgressGraph.js.map +1 -1
- package/dist/components/okr/index.d.ts +1 -2
- package/dist/components/okr/index.d.ts.map +1 -1
- package/dist/components/okr/index.js +1 -4
- package/dist/components/okr/index.js.map +1 -1
- package/dist/components/okr/styled.d.ts +1 -1
- package/dist/components/okr/styled.d.ts.map +1 -1
- package/dist/components/okr/styled.js +4 -1
- package/dist/components/okr/styled.js.map +1 -1
- package/dist/components/okr/utils.d.ts +1 -1
- package/dist/components/okr/utils.d.ts.map +1 -1
- package/dist/components/okr/utils.js.map +1 -1
- package/dist/components/overlay/index.d.ts.map +1 -1
- package/dist/components/overlay/index.js +5 -1
- package/dist/components/overlay/index.js.map +1 -1
- package/dist/components/portable-text/PortableText.Gallery.d.ts +12 -0
- package/dist/components/portable-text/PortableText.Gallery.d.ts.map +1 -0
- package/dist/components/portable-text/PortableText.Gallery.js +5 -0
- package/dist/components/portable-text/PortableText.Gallery.js.map +1 -0
- package/dist/components/portable-text/PortableText.Link.d.ts +7 -0
- package/dist/components/portable-text/PortableText.Link.d.ts.map +1 -0
- package/dist/components/portable-text/PortableText.Link.js +3 -0
- package/dist/components/portable-text/PortableText.Link.js.map +1 -0
- package/dist/components/portable-text/PortableText.d.ts +2 -0
- package/dist/components/portable-text/PortableText.d.ts.map +1 -1
- package/dist/components/portable-text/PortableText.js +11 -1
- package/dist/components/portable-text/PortableText.js.map +1 -1
- package/dist/components/portable-text/styled.d.ts +4 -0
- package/dist/components/portable-text/styled.d.ts.map +1 -1
- package/dist/components/portable-text/styled.js +6 -1
- package/dist/components/portable-text/styled.js.map +1 -1
- package/dist/components/portable-text/utils/own-fields.d.ts +2 -0
- package/dist/components/portable-text/utils/own-fields.d.ts.map +1 -0
- package/dist/components/portable-text/utils/own-fields.js +17 -0
- package/dist/components/portable-text/utils/own-fields.js.map +1 -0
- package/dist/components/sidebar/styled.d.ts +2 -2
- package/dist/components/sidebar/styled.js +1 -1
- package/dist/components/sidebar/styled.js.map +1 -1
- package/dist/components/system-page/index.d.ts +2 -2
- package/dist/components/system-page/styled.d.ts +2 -2
- package/dist/components/system-page/styled.d.ts.map +1 -1
- package/dist/components/system-page/styled.js +3 -2
- package/dist/components/system-page/styled.js.map +1 -1
- package/dist/components/timeline/utils.d.ts.map +1 -1
- package/dist/components/timeline/utils.js +3 -1
- package/dist/components/timeline/utils.js.map +1 -1
- package/dist/framework/index.d.ts +16 -5
- package/dist/framework/index.d.ts.map +1 -1
- package/dist/framework/index.js +43 -8
- package/dist/framework/index.js.map +1 -1
- package/dist/framework/loadedSearchParams.d.ts +2 -0
- package/dist/framework/loadedSearchParams.d.ts.map +1 -0
- package/dist/framework/loadedSearchParams.js +8 -0
- package/dist/framework/loadedSearchParams.js.map +1 -0
- package/dist/framework/next.d.ts.map +1 -1
- package/dist/framework/next.js +13 -6
- package/dist/framework/next.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/styles/fonts.css +413 -0
- package/dist/styles/global.css +2 -77
- package/dist/theme/admin.d.ts.map +1 -1
- package/dist/theme/admin.js +1 -0
- package/dist/theme/admin.js.map +1 -1
- package/dist/theme/build-theme.d.ts +6 -0
- package/dist/theme/build-theme.d.ts.map +1 -1
- package/dist/theme/build-theme.js +52 -48
- package/dist/theme/build-theme.js.map +1 -1
- package/dist/theme/color-scheme-provider.d.ts.map +1 -1
- package/dist/theme/color-scheme-provider.js +37 -20
- package/dist/theme/color-scheme-provider.js.map +1 -1
- package/dist/theme/context.d.ts +1 -0
- package/dist/theme/context.d.ts.map +1 -1
- package/dist/theme/context.js.map +1 -1
- package/dist/theme/cookie-domain.d.ts +2 -0
- package/dist/theme/cookie-domain.d.ts.map +1 -0
- package/dist/theme/cookie-domain.js +11 -0
- package/dist/theme/cookie-domain.js.map +1 -0
- package/dist/theme/impersonation.d.ts +5 -0
- package/dist/theme/impersonation.d.ts.map +1 -1
- package/dist/theme/impersonation.js +23 -4
- package/dist/theme/impersonation.js.map +1 -1
- package/dist/theme/index.d.ts +1 -0
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/index.js +1 -0
- package/dist/theme/index.js.map +1 -1
- package/dist/theme/mui-scheme-sync.d.ts +5 -0
- package/dist/theme/mui-scheme-sync.d.ts.map +1 -0
- package/dist/theme/mui-scheme-sync.js +11 -0
- package/dist/theme/mui-scheme-sync.js.map +1 -0
- package/dist/theme/palette.d.ts +1 -1
- package/dist/theme/palette.d.ts.map +1 -1
- package/dist/theme/palette.js +2 -0
- package/dist/theme/palette.js.map +1 -1
- package/dist/theme/server.d.ts +1 -1
- package/dist/theme/server.d.ts.map +1 -1
- package/dist/theme/server.js +26 -3
- package/dist/theme/server.js.map +1 -1
- package/dist/theme/session-hint.d.ts +5 -0
- package/dist/theme/session-hint.d.ts.map +1 -0
- package/dist/theme/session-hint.js +11 -0
- package/dist/theme/session-hint.js.map +1 -0
- package/dist/theme/theme-scope.d.ts +6 -1
- package/dist/theme/theme-scope.d.ts.map +1 -1
- package/dist/theme/theme-scope.js.map +1 -1
- package/dist/utils/format.d.ts +4 -0
- package/dist/utils/format.d.ts.map +1 -1
- package/dist/utils/format.js +10 -0
- package/dist/utils/format.js.map +1 -1
- package/dist/utils/time.d.ts +2 -0
- package/dist/utils/time.d.ts.map +1 -0
- package/dist/utils/time.js +24 -0
- package/dist/utils/time.js.map +1 -0
- package/package.json +46 -30
- package/dist/utils/data-attribute.d.ts +0 -3
- package/dist/utils/data-attribute.d.ts.map +0 -1
- package/dist/utils/data-attribute.js +0 -5
- package/dist/utils/data-attribute.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormSwitch.js","sourceRoot":"","sources":["../../../../src/components/form/fields/FormSwitch.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAGb,OAAO,EACL,UAAU,EAGV,cAAc,GACf,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,MAAM,EAAe,MAAM,cAAc,CAAC;AAUnD,MAAM,UAAU,UAAU,CAAwB,EAChD,IAAI,EACJ,KAAK,EACL,GAAG,IAAI,EACY;IACnB,MAAM,EAAE,OAAO,EAAE,GAAG,cAAc,EAAK,CAAC;IACxC,OAAO,CACL,KAAC,UAAU,IACT,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CACrB,KAAC,gBAAgB,IACf,KAAK,EAAE,KAAK,EACZ,OAAO,EACL,KAAC,MAAM,OACD,IAAI,EACR,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,KAAK,EACtB,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,EACzD,MAAM,EAAE,KAAK,CAAC,MAAM,EACpB,
|
|
1
|
+
{"version":3,"file":"FormSwitch.js","sourceRoot":"","sources":["../../../../src/components/form/fields/FormSwitch.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAGb,OAAO,EACL,UAAU,EAGV,cAAc,GACf,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,MAAM,EAAe,MAAM,cAAc,CAAC;AAUnD,MAAM,UAAU,UAAU,CAAwB,EAChD,IAAI,EACJ,KAAK,EACL,GAAG,IAAI,EACY;IACnB,MAAM,EAAE,OAAO,EAAE,GAAG,cAAc,EAAK,CAAC;IACxC,OAAO,CACL,KAAC,UAAU,IACT,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CACrB,KAAC,gBAAgB,IACf,KAAK,EAAE,KAAK,EACZ,OAAO,EACL,KAAC,MAAM,OACD,IAAI,EACR,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,KAAK,EACtB,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,EACzD,MAAM,EAAE,KAAK,CAAC,MAAM,EACpB,SAAS,EAAE,EAAE,KAAK,EAAE,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE,EAAE,GACxC,GAEJ,CACH,GACD,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InstagramFeedInline.d.ts","sourceRoot":"","sources":["../../../src/components/instagram-feed/InstagramFeedInline.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"InstagramFeedInline.d.ts","sourceRoot":"","sources":["../../../src/components/instagram-feed/InstagramFeedInline.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAGvE,MAAM,WAAW,wBAAwB;IACvC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,wBAAwB;IACvC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,qBAAqB,GAAG,IAAI,CAAC;IAC3C,KAAK,CAAC,EAAE,wBAAwB,CAAC;CAClC;AAED,eAAO,MAAM,mBAAmB,GAAI,qCAIjC,wBAAwB,gCA8G1B,CAAC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useEffect, useState } from "react";
|
|
4
4
|
import { Instagram } from "@mui/icons-material";
|
|
5
|
-
import { Configuration, EventsClient } from "@snokam/
|
|
5
|
+
import { Configuration, EventsClient } from "@snokam/api-client/events";
|
|
6
6
|
import Styled from "./styled";
|
|
7
7
|
export const InstagramFeedInline = ({ apiBaseUrl, initialFeed, texts = {}, }) => {
|
|
8
8
|
const t = texts;
|
|
@@ -39,6 +39,6 @@ export const InstagramFeedInline = ({ apiBaseUrl, initialFeed, texts = {}, }) =>
|
|
|
39
39
|
const profileUrl = feed.profileUrl ?? `https://instagram.com/${feed.username ?? ""}`;
|
|
40
40
|
return (_jsxs(Styled.InlineCard, { children: [_jsxs(Styled.Header, { children: [_jsx(Styled.ProfilePicture, { src: feed.profilePictureUrl }), _jsxs(Styled.ProfileInfo, { children: [_jsxs(Styled.NameBlock, { children: [_jsx(Styled.ProfileName, { children: feed.name ?? "" }), _jsxs(Styled.ProfileHandle, { children: ["@", feed.username ?? ""] })] }), _jsxs(Styled.StatsRow, { children: [_jsxs(Styled.Stat, { children: [_jsx(Styled.StatValue, { children: feed.mediaCount ?? 0 }), _jsx(Styled.StatLabel, { children: t.posts ?? "" })] }), _jsxs(Styled.Stat, { children: [_jsx(Styled.StatValue, { children: feed.followersCount ?? 0 }), _jsx(Styled.StatLabel, { children: t.followers ?? "" })] }), _jsxs(Styled.Stat, { children: [_jsx(Styled.StatValue, { children: feed.followsCount ?? 0 }), _jsx(Styled.StatLabel, { children: t.following ?? "" })] })] }), _jsxs(Styled.FollowButton, { href: profileUrl, target: "_blank", rel: "noopener noreferrer", children: [_jsx(Instagram, { sx: { fontSize: 18 } }), t.follow ?? ""] })] })] }), _jsx(Styled.Grid, { children: displayMedia.map((item) => (_jsxs(Styled.GridItem, { href: item.permalink ?? "#", target: "_blank", rel: "noopener noreferrer", children: [_jsx(Styled.GridImage, { src: item.mediaType === "VIDEO" && item.thumbnailUrl
|
|
41
41
|
? item.thumbnailUrl
|
|
42
|
-
: (item.mediaUrl ?? ""), alt: item.caption ?? "", referrerPolicy: "no-referrer" }), item.mediaType === "CAROUSEL_ALBUM" && (_jsx(Styled.CarouselIcon, { children: "\u229E" }))] }, item.id ?? ""))) })] }));
|
|
42
|
+
: (item.mediaUrl ?? ""), alt: item.caption ?? "", referrerPolicy: "no-referrer", loading: "lazy", decoding: "async" }), item.mediaType === "CAROUSEL_ALBUM" && (_jsx(Styled.CarouselIcon, { children: "\u229E" }))] }, item.id ?? ""))) })] }));
|
|
43
43
|
};
|
|
44
44
|
//# sourceMappingURL=InstagramFeedInline.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InstagramFeedInline.js","sourceRoot":"","sources":["../../../src/components/instagram-feed/InstagramFeedInline.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"InstagramFeedInline.js","sourceRoot":"","sources":["../../../src/components/instagram-feed/InstagramFeedInline.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAExE,OAAO,MAAM,MAAM,UAAU,CAAC;AAiB9B,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,EAClC,UAAU,EACV,WAAW,EACX,KAAK,GAAG,EAAE,GACe,EAAE,EAAE;IAC7B,MAAM,CAAC,GAAG,KAAK,CAAC;IAChB,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAC9B,WAAW,IAAI,IAAI,CACpB,CAAC;IACF,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,CAAC,WAAW,CAAC,C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EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,GAAI,EAClC,CAAC,CAAC,MAAM,IAAI,EAAE,IACK,IACH,IACP,EAChB,KAAC,MAAM,CAAC,IAAI,cACT,YAAY,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAC1B,MAAC,MAAM,CAAC,QAAQ,IAEd,IAAI,EAAE,IAAI,CAAC,SAAS,IAAI,GAAG,EAC3B,MAAM,EAAC,QAAQ,EACf,GAAG,EAAC,qBAAqB,aAEzB,KAAC,MAAM,CAAC,SAAS,IACf,GAAG,EACD,IAAI,CAAC,SAAS,KAAK,OAAO,IAAI,IAAI,CAAC,YAAY;gCAC7C,CAAC,CAAC,IAAI,CAAC,YAAY;gCACnB,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,IAAI,EAAE,CAAC,EAE3B,GAAG,EAAE,IAAI,CAAC,OAAO,IAAI,EAAE,EACvB,cAAc,EAAC,aAAa,EAC5B,OAAO,EAAC,MAAM,EACd,QAAQ,EAAC,OAAO,GAChB,EACD,IAAI,CAAC,SAAS,KAAK,gBAAgB,IAAI,CACtC,KAAC,MAAM,CAAC,YAAY,yBAAwB,CAC7C,KAlBI,IAAI,CAAC,EAAE,IAAI,EAAE,CAmBF,CACnB,CAAC,GACU,IACI,CACrB,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styled.d.ts","sourceRoot":"","sources":["../../../src/components/instagram-feed/styled.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"styled.d.ts","sourceRoot":"","sources":["../../../src/components/instagram-feed/styled.tsx"],"names":[],"mappings":"AAIA,eAAO,MAAM,UAAU;;;yGAOtB,CAAC;AAEF,eAAO,MAAM,MAAM;;;yGAMlB,CAAC;AAEF,eAAO,MAAM,cAAc;;;;UAAsB,MAAM;yGAWtD,CAAC;AAEF,eAAO,MAAM,WAAW;;;yGAMvB,CAAC;AAEF,eAAO,MAAM,SAAS;;;yGAGrB,CAAC;AAEF,eAAO,MAAM,WAAW;;;yGAMvB,CAAC;AAEF,eAAO,MAAM,aAAa;;;yGAIzB,CAAC;AAEF,eAAO,MAAM,QAAQ;;;yGAGpB,CAAC;AAEF,eAAO,MAAM,IAAI;;;yGAEhB,CAAC;AAEF,eAAO,MAAM,SAAS;;;2GAOrB,CAAC;AAEF,eAAO,MAAM,SAAS;;;2GAIrB,CAAC;AAEF,eAAO,MAAM,YAAY;;;qHAkBxB,CAAC;AAEF,eAAO,MAAM,IAAI;;;yGAIhB,CAAC;AAEF,eAAO,MAAM,QAAQ;;;qHAKpB,CAAC;AAEF,eAAO,MAAM,SAAS;;;gHAIrB,CAAC;AAEF,eAAO,MAAM,YAAY;;;yGAYxB,CAAC;AAEF,eAAO,MAAM,YAAY;;;yGAIxB,CAAC;AAEF,eAAO,MAAM,UAAU;;;yGAItB,CAAC;;;;;;;;;;;;;;cA/H+C,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiIvD,wBAmBE"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import styled from "@emotion/styled";
|
|
2
|
+
const instagramFollowBlue = "#007aca";
|
|
2
3
|
export const InlineCard = styled.div `
|
|
3
4
|
background: white;
|
|
4
5
|
border-radius: 16px;
|
|
@@ -45,7 +46,7 @@ export const ProfileName = styled.div `
|
|
|
45
46
|
`;
|
|
46
47
|
export const ProfileHandle = styled.div `
|
|
47
48
|
font-size: 0.875rem;
|
|
48
|
-
color: #
|
|
49
|
+
color: #767676;
|
|
49
50
|
line-height: 1.15;
|
|
50
51
|
`;
|
|
51
52
|
export const StatsRow = styled.div `
|
|
@@ -65,7 +66,7 @@ export const StatValue = styled.span `
|
|
|
65
66
|
`;
|
|
66
67
|
export const StatLabel = styled.span `
|
|
67
68
|
font-size: 0.875rem;
|
|
68
|
-
color: #
|
|
69
|
+
color: #767676;
|
|
69
70
|
line-height: 1.15;
|
|
70
71
|
`;
|
|
71
72
|
export const FollowButton = styled.a `
|
|
@@ -74,7 +75,7 @@ export const FollowButton = styled.a `
|
|
|
74
75
|
gap: 0.5rem;
|
|
75
76
|
padding: 0.5rem 1.25rem;
|
|
76
77
|
border-radius: 8px;
|
|
77
|
-
background:
|
|
78
|
+
background: ${instagramFollowBlue};
|
|
78
79
|
color: white;
|
|
79
80
|
font-weight: 600;
|
|
80
81
|
font-size: 0.875rem;
|
|
@@ -124,7 +125,7 @@ export const LoadingState = styled.div `
|
|
|
124
125
|
export const ErrorState = styled.div `
|
|
125
126
|
padding: 3rem 1.5rem;
|
|
126
127
|
text-align: center;
|
|
127
|
-
color: #
|
|
128
|
+
color: #d83d3d;
|
|
128
129
|
`;
|
|
129
130
|
export default {
|
|
130
131
|
InlineCard,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styled.js","sourceRoot":"","sources":["../../../src/components/instagram-feed/styled.tsx"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;CAOnC,CAAC;AAEF,MAAM,CAAC,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;CAM/B,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAAkB;;;;;;;gBAO1C,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CACxB,GAAG;IACD,CAAC,CAAC,OAAO,GAAG,gBAAgB;IAC5B,CAAC,CAAC,mDAAmD;CAC1D,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;CAMpC,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAA;;;CAGlC,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC,GAAG,CAA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uxPlayerProps, MuxPlayerRefAttributes } from "@mux/mux-player-react";
|
|
1
|
+
import type { MuxPlayerProps, MuxPlayerRefAttributes } from "@mux/mux-player-react";
|
|
2
2
|
import { PropsWithoutRef, ForwardRefExoticComponent, RefAttributes, RefObject } from "react";
|
|
3
3
|
export type VideoProps = MuxPlayerProps & {
|
|
4
4
|
controls?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VideoPlayer.d.ts","sourceRoot":"","sources":["../../../../src/components/media/components/VideoPlayer.tsx"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"VideoPlayer.d.ts","sourceRoot":"","sources":["../../../../src/components/media/components/VideoPlayer.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,cAAc,EACd,sBAAsB,EACvB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAIL,eAAe,EACf,yBAAyB,EACzB,aAAa,EACb,SAAS,EACV,MAAM,OAAO,CAAC;AAGf,MAAM,MAAM,UAAU,GAAG,cAAc,GAAG;IACxC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,GAAG,CAAC,EAAE,SAAS,CAAC,sBAAsB,CAAC,CAAC;CACzC,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,yBAAyB,CACjD,eAAe,CAAC,UAAU,CAAC,GAAG,aAAa,CAAC,sBAAsB,CAAC,CA2DnE,CAAC"}
|
|
@@ -5,6 +5,10 @@ import { StyledMuxPlayer } from "./styles";
|
|
|
5
5
|
export const VideoPlayer = forwardRef((props, ref) => {
|
|
6
6
|
const playerRef = useRef(null);
|
|
7
7
|
const { controls = true, style, ...restOfProps } = props;
|
|
8
|
+
const thumbnailQuery = props.thumbnailTime === undefined ? "" : `?time=${props.thumbnailTime}`;
|
|
9
|
+
const posterPlaceholder = props.playbackId && !props.tokens
|
|
10
|
+
? `https://image.mux.com/${props.playbackId}/thumbnail.webp${thumbnailQuery}`
|
|
11
|
+
: undefined;
|
|
8
12
|
const attachRef = useCallback((node) => {
|
|
9
13
|
playerRef.current = node;
|
|
10
14
|
if (typeof ref === "function") {
|
|
@@ -33,7 +37,7 @@ export const VideoPlayer = forwardRef((props, ref) => {
|
|
|
33
37
|
video_id: props.metadataVideoId,
|
|
34
38
|
}, onPlaying: removeOverlay, onError: () => {
|
|
35
39
|
setTimeout(handleRetry, 5000);
|
|
36
|
-
}, hideControls: controls === false, style: style, ...restOfProps }));
|
|
40
|
+
}, hideControls: controls === false, style: style, placeholder: posterPlaceholder, ...restOfProps }));
|
|
37
41
|
});
|
|
38
42
|
VideoPlayer.displayName = "VideoPlayer";
|
|
39
43
|
//# sourceMappingURL=VideoPlayer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VideoPlayer.js","sourceRoot":"","sources":["../../../../src/components/media/components/VideoPlayer.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;
|
|
1
|
+
{"version":3,"file":"VideoPlayer.js","sourceRoot":"","sources":["../../../../src/components/media/components/VideoPlayer.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAMb,OAAO,EACL,MAAM,EACN,WAAW,EACX,UAAU,GAKX,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAO3C,MAAM,CAAC,MAAM,WAAW,GAEpB,UAAU,CAAqC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;IAChE,MAAM,SAAS,GAAG,MAAM,CAAgC,IAAI,CAAC,CAAC;IAC9D,MAAM,EAAE,QAAQ,GAAG,IAAI,EAAE,KAAK,EAAE,GAAG,WAAW,EAAE,GAAG,KAAK,CAAC;IACzD,MAAM,cAAc,GAClB,KAAK,CAAC,aAAa,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,KAAK,CAAC,aAAa,EAAE,CAAC;IAC1E,MAAM,iBAAiB,GACrB,KAAK,CAAC,UAAU,IAAI,CAAC,KAAK,CAAC,M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AAC,CAAC;QAChC,CAAC,EACD,YAAY,EAAE,QAAQ,KAAK,KAAK,EAChC,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,iBAAiB,KAC1B,WAAW,GACf,CACH,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,WAAW,CAAC,WAAW,GAAG,aAAa,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../src/components/media/components/styles.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../src/components/media/components/styles.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEpD,KAAK,gBAAgB,GAAG;IACtB,EAAE,EAAE,WAAW,CAAC;IAChB,UAAU,EAAE,OAAO,CAAC;CACrB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAU5B,eAAO,MAAM,WAAW,EAA2B,CACjD,KAAK,EAAE,gBAAgB,KACpB,SAAS,CAAC;AAEf,eAAO,MAAM,eAAe;;;kBAET,OAAO;UAUzB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import styled from "@emotion/styled";
|
|
3
|
-
import
|
|
3
|
+
import LazyMuxPlayer from "@mux/mux-player-react/lazy";
|
|
4
4
|
const ImageRoot = styled("img", {
|
|
5
5
|
shouldForwardProp: (prop) => prop !== "as" && prop !== "fillHeight",
|
|
6
6
|
}) `
|
|
@@ -9,7 +9,7 @@ const ImageRoot = styled("img", {
|
|
|
9
9
|
object-fit: cover;
|
|
10
10
|
`;
|
|
11
11
|
export const StyledImage = ImageRoot;
|
|
12
|
-
export const StyledMuxPlayer = styled(
|
|
12
|
+
export const StyledMuxPlayer = styled(LazyMuxPlayer, {
|
|
13
13
|
shouldForwardProp: (prop) => prop !== "hideControls",
|
|
14
14
|
}) `
|
|
15
15
|
top: 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../../src/components/media/components/styles.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,MAAM,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../../src/components/media/components/styles.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,OAAO,aAAa,MAAM,4BAA4B,CAAC;AAQvD,MAAM,SAAS,GAAG,MAAM,CAAC,KAAK,EAAE;IAC9B,iBAAiB,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,YAAY;CACpE,CAAC,CAAyB;;YAEf,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC;;CAE7D,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG,SAEb,CAAC;AAEf,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,aAAsC,EAAE;IAC5E,iBAAiB,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,cAAc;CACrD,CAAC,CAA2B;;;;;;;;;IASzB,CAAC,EAAE,YAAY,EAAE,EAAE,EAAE,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,EAAE,CAAC;CAClE,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MediaProps, MediaType, MemoryProps } from "./types";
|
|
2
2
|
import { VideoPlayer, VideoProps } from "./components/VideoPlayer";
|
|
3
3
|
import { Image, ImageProps } from "./components/Image";
|
|
4
|
-
import { MuxPlayerRefAttributes } from "@mux/mux-player-react";
|
|
4
|
+
import type { MuxPlayerRefAttributes } from "@mux/mux-player-react";
|
|
5
5
|
export declare const Media: {
|
|
6
6
|
(props: MediaProps): import("react").JSX.Element;
|
|
7
7
|
Video({ style, ...restOfProps }: VideoProps): import("react").JSX.Element;
|
|
@@ -11,5 +11,7 @@ export declare const Media: {
|
|
|
11
11
|
export type { MediaType, MuxPlayerRefAttributes };
|
|
12
12
|
export { VideoPlayer, Image };
|
|
13
13
|
export { getSanityImageUrl } from "./sanity";
|
|
14
|
+
export { getImageUrl, getImageSource, getImageFraming, contentAssetLookup, } from "./url";
|
|
15
|
+
export type { ContentAssetLookup, ImageUrlOptions } from "./url";
|
|
14
16
|
export default Media;
|
|
15
17
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/media/index.tsx"],"names":[],"mappings":"AAGA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/media/index.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAa,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAGpE,eAAO,MAAM,KAAK;YAAW,UAAU;qCAsEG,UAAU;qCAQV,UAAU;kBAQ7B,WAAW;CAhEjC,CAAC;AAwFF,YAAY,EAAE,SAAS,EAAE,sBAAsB,EAAE,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC;AAC9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EACL,WAAW,EACX,cAAc,EACd,eAAe,EACf,kBAAkB,GACnB,MAAM,OAAO,CAAC;AACf,YAAY,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AACjE,eAAe,KAAK,CAAC"}
|
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { StyledContainer } from "./styled";
|
|
4
|
+
import { MediaKind } from "./types";
|
|
4
5
|
import { VideoPlayer } from "./components/VideoPlayer";
|
|
5
6
|
import { Image } from "./components/Image";
|
|
6
|
-
import {
|
|
7
|
-
import { SanityImageSanityTypeEnum, SanityVideoSanityTypeEnum, SanityImageAssetSanityTypeEnum, SanityVideoAssetSanityTypeEnum, } from "@snokam/sanity-client";
|
|
7
|
+
import { getImageSource, getImageUrl } from "./url";
|
|
8
8
|
export const Media = (props) => {
|
|
9
9
|
const { media, muxProps, imageProps, imageTransform, ImageComponent, alt, ...restOfProps } = props;
|
|
10
10
|
return (_jsx(StyledContainer, { ...restOfProps, children: _jsx(View, { media: media, muxProps: muxProps, imageProps: imageProps, imageTransform: imageTransform, ImageComponent: ImageComponent, alt: alt }) }));
|
|
11
11
|
};
|
|
12
12
|
const View = ({ media, muxProps, imageProps, imageTransform, ImageComponent, alt, }) => {
|
|
13
13
|
const { ref, ...restMuxProps } = muxProps || {};
|
|
14
|
-
const
|
|
14
|
+
const resolve = typeof ImageComponent === "string" ? getImageUrl : getImageSource;
|
|
15
|
+
const transformedSrc = (src) => imageTransform ? resolve(src, imageTransform) : src;
|
|
15
16
|
switch (media.sanityType) {
|
|
16
|
-
case
|
|
17
|
+
case MediaKind.Video:
|
|
17
18
|
return _jsx(VideoPlayer, { ref: ref, ...media.asset, ...restMuxProps });
|
|
18
|
-
case
|
|
19
|
+
case MediaKind.VideoAsset:
|
|
19
20
|
return _jsx(VideoPlayer, { ref: ref, ...media, ...restMuxProps });
|
|
20
|
-
case
|
|
21
|
+
case MediaKind.Image:
|
|
21
22
|
return (_jsx(Image, { src: transformedSrc(media.asset.url), alt: alt ?? media.asset.altText ?? media.asset.title ?? "", Component: ImageComponent, ...imageProps }));
|
|
22
|
-
case
|
|
23
|
+
case MediaKind.ImageAsset:
|
|
23
24
|
return (_jsx(Image, { src: transformedSrc(media.url), alt: alt ?? media.altText ?? media.title ?? "", Component: ImageComponent, ...imageProps }));
|
|
24
25
|
default:
|
|
25
26
|
return null;
|
|
@@ -36,16 +37,16 @@ Media.Memory = (props) => {
|
|
|
36
37
|
const isImageMemory = memory.type === "memory.image";
|
|
37
38
|
const media = isImageMemory
|
|
38
39
|
? {
|
|
39
|
-
sanityType:
|
|
40
|
+
sanityType: MediaKind.Image,
|
|
40
41
|
asset: {
|
|
41
|
-
sanityType:
|
|
42
|
+
sanityType: MediaKind.ImageAsset,
|
|
42
43
|
url: memory.image,
|
|
43
44
|
},
|
|
44
45
|
}
|
|
45
46
|
: {
|
|
46
|
-
sanityType:
|
|
47
|
+
sanityType: MediaKind.Video,
|
|
47
48
|
asset: {
|
|
48
|
-
sanityType:
|
|
49
|
+
sanityType: MediaKind.VideoAsset,
|
|
49
50
|
playbackId: memory.video.playbackId,
|
|
50
51
|
},
|
|
51
52
|
};
|
|
@@ -53,5 +54,6 @@ Media.Memory = (props) => {
|
|
|
53
54
|
};
|
|
54
55
|
export { VideoPlayer, Image };
|
|
55
56
|
export { getSanityImageUrl } from "./sanity";
|
|
57
|
+
export { getImageUrl, getImageSource, getImageFraming, contentAssetLookup, } from "./url";
|
|
56
58
|
export default Media;
|
|
57
59
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/media/index.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/media/index.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO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G,WAAW,EAAE,GAAQ,KAAK,CAAC;IAE9C,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,KAAK,cAAc,CAAC;IAErD,MAAM,KAAK,GAAG,aAAa;QACzB,CAAC,CAAC;YACE,UAAU,EAAE,SAAS,CAAC,KAAK;YAC3B,KAAK,EAAE;gBACL,UAAU,EAAE,SAAS,CAAC,UAAU;gBAChC,GAAG,EAAE,MAAM,CAAC,KAAK;aAClB;SACF;QACH,CAAC,CAAC;YACE,UAAU,EAAE,SAAS,CAAC,KAAK;YAC3B,KAAK,EAAE;gBACL,UAAU,EAAE,SAAS,CAAC,UAAU;gBAChC,UAAU,EAAE,MAAM,CAAC,KAAK,CAAC,UAAU;aACpC;SACF,CAAC;IAEN,OAAO,KAAC,KAAK,IAAC,KAAK,EAAE,KAAK,KAAM,WAAW,GAAI,CAAC;AAClD,CAAC,CAAC;AAGF,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC;AAC9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EACL,WAAW,EACX,cAAc,EACd,eAAe,EACf,kBAAkB,GACnB,MAAM,OAAO,CAAC;AAEf,eAAe,KAAK,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styled.d.ts","sourceRoot":"","sources":["../../../src/components/media/styled.tsx"],"names":[],"mappings":"AAIA,eAAO,MAAM,eAAe;;;
|
|
1
|
+
{"version":3,"file":"styled.d.ts","sourceRoot":"","sources":["../../../src/components/media/styled.tsx"],"names":[],"mappings":"AAIA,eAAO,MAAM,eAAe;;;yGAkB3B,CAAC"}
|
|
@@ -13,5 +13,10 @@ export const StyledContainer = styled.div `
|
|
|
13
13
|
height: 100%;
|
|
14
14
|
width: 100%;
|
|
15
15
|
}
|
|
16
|
+
|
|
17
|
+
mux-player[data-mux-player-react-lazy-placeholder] {
|
|
18
|
+
background-color: transparent;
|
|
19
|
+
--controls-backdrop-color: transparent;
|
|
20
|
+
}
|
|
16
21
|
`;
|
|
17
22
|
//# sourceMappingURL=styled.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styled.js","sourceRoot":"","sources":["../../../src/components/media/styled.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,GAAG,CAAA
|
|
1
|
+
{"version":3,"file":"styled.js","sourceRoot":"","sources":["../../../src/components/media/styled.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;;;;;;;;;;CAkBxC,CAAC"}
|
|
@@ -1,7 +1,41 @@
|
|
|
1
1
|
import { ImageProps as NextImageProps } from "next/image";
|
|
2
2
|
import { VideoProps } from "./components/VideoPlayer";
|
|
3
3
|
import { SanityImageTransformOptions } from "./sanity";
|
|
4
|
-
|
|
4
|
+
export declare const MediaKind: {
|
|
5
|
+
readonly Image: "image";
|
|
6
|
+
readonly ImageAsset: "sanity.imageAsset";
|
|
7
|
+
readonly Video: "video";
|
|
8
|
+
readonly VideoAsset: "mux.videoAsset";
|
|
9
|
+
};
|
|
10
|
+
export interface MediaImageAsset {
|
|
11
|
+
[key: string]: any;
|
|
12
|
+
sanityId?: string;
|
|
13
|
+
sanityType: typeof MediaKind.ImageAsset;
|
|
14
|
+
url: string;
|
|
15
|
+
altText?: string;
|
|
16
|
+
title?: string;
|
|
17
|
+
originalFilename?: string;
|
|
18
|
+
mimeType?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface MediaImage {
|
|
21
|
+
[key: string]: any;
|
|
22
|
+
sanityType: typeof MediaKind.Image;
|
|
23
|
+
sanityKey?: string;
|
|
24
|
+
asset: MediaImageAsset;
|
|
25
|
+
}
|
|
26
|
+
export interface MediaVideoAsset {
|
|
27
|
+
[key: string]: any;
|
|
28
|
+
sanityId?: string;
|
|
29
|
+
sanityType: typeof MediaKind.VideoAsset;
|
|
30
|
+
playbackId: string;
|
|
31
|
+
filename?: string;
|
|
32
|
+
}
|
|
33
|
+
export interface MediaVideo {
|
|
34
|
+
[key: string]: any;
|
|
35
|
+
sanityType: typeof MediaKind.Video | "mux.video";
|
|
36
|
+
sanityKey?: string;
|
|
37
|
+
asset: MediaVideoAsset;
|
|
38
|
+
}
|
|
5
39
|
export type BaseProps = {
|
|
6
40
|
className?: string;
|
|
7
41
|
style?: React.CSSProperties & Record<string, string | number>;
|
|
@@ -14,7 +48,7 @@ export type BaseProps = {
|
|
|
14
48
|
export type MediaProps = BaseProps & {
|
|
15
49
|
media: MediaType;
|
|
16
50
|
};
|
|
17
|
-
export type MediaType =
|
|
51
|
+
export type MediaType = MediaImage | MediaImageAsset | MediaVideo | MediaVideoAsset;
|
|
18
52
|
export interface EventMemory {
|
|
19
53
|
type: string;
|
|
20
54
|
image?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/media/types.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,IAAI,cAAc,EAAE,MAAM,YAAY,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,2BAA2B,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/media/types.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,IAAI,cAAc,EAAE,MAAM,YAAY,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,2BAA2B,EAAE,MAAM,UAAU,CAAC;AAEvD,eAAO,MAAM,SAAS;;;;;CAKZ,CAAC;AAEX,MAAM,WAAW,eAAe;IAE9B,CAAC,GAAG,EAAE,MA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AAC;IAC7C,cAAc,EAAE,KAAK,CAAC,WAAW,CAAC;IAClC,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG;IACnC,KAAK,EAAE,SAAS,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,SAAS,GACnB,UAAU,GAAG,eAAe,GAAG,UAAU,GAAG,eAAe,CAAC;AAE9D,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC;CAChC;AAED,MAAM,WAAW,WAAY,SAAQ,SAAS;IAC5C,MAAM,EAAE,WAAW,CAAC;CACrB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/media/types.tsx"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/media/types.tsx"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,KAAK,EAAE,OAAO;IACd,UAAU,EAAE,mBAAmB;IAC/B,KAAK,EAAE,OAAO;IACd,UAAU,EAAE,gBAAgB;CACpB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface ImageHotspot {
|
|
2
|
+
x: number;
|
|
3
|
+
y: number;
|
|
4
|
+
}
|
|
5
|
+
export interface ImageCrop {
|
|
6
|
+
top: number;
|
|
7
|
+
bottom: number;
|
|
8
|
+
left: number;
|
|
9
|
+
right: number;
|
|
10
|
+
}
|
|
11
|
+
export interface ImageFraming {
|
|
12
|
+
objectPosition?: string;
|
|
13
|
+
objectViewBox?: string;
|
|
14
|
+
}
|
|
15
|
+
export declare const sanityRect: (crop: ImageCrop, width: number, height: number) => string;
|
|
16
|
+
export declare const getImageFraming: ({ hotspot, crop, }: {
|
|
17
|
+
hotspot?: ImageHotspot | null;
|
|
18
|
+
crop?: ImageCrop | null;
|
|
19
|
+
}) => ImageFraming;
|
|
20
|
+
//# sourceMappingURL=framing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"framing.d.ts","sourceRoot":"","sources":["../../../../src/components/media/url/framing.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED,MAAM,WAAW,SAAS;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,YAAY;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAID,eAAO,MAAM,UAAU,GACrB,MAAM,SAAS,EACf,OAAO,MAAM,EACb,QAAQ,MAAM,KACb,MAMU,CAAC;AAEd,eAAO,MAAM,eAAe,GAAI,oBAG7B;IACD,OAAO,CAAC,EAAE,YAAY,GAAG,IAAI,CAAC;IAC9B,IAAI,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;CACzB,KAAG,YAOF,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const percent = (fraction) => `${Math.round(fraction * 10000) / 100}%`;
|
|
2
|
+
export const sanityRect = (crop, width, height) => [
|
|
3
|
+
Math.round(crop.left * width),
|
|
4
|
+
Math.round(crop.top * height),
|
|
5
|
+
Math.round((1 - crop.left - crop.right) * width),
|
|
6
|
+
Math.round((1 - crop.top - crop.bottom) * height),
|
|
7
|
+
].join(",");
|
|
8
|
+
export const getImageFraming = ({ hotspot, crop, }) => ({
|
|
9
|
+
...(hotspot && {
|
|
10
|
+
objectPosition: `${percent(hotspot.x)} ${percent(hotspot.y)}`,
|
|
11
|
+
}),
|
|
12
|
+
...(crop && {
|
|
13
|
+
objectViewBox: `inset(${percent(crop.top)} ${percent(crop.right)} ${percent(crop.bottom)} ${percent(crop.left)})`,
|
|
14
|
+
}),
|
|
15
|
+
});
|
|
16
|
+
//# sourceMappingURL=framing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"framing.js","sourceRoot":"","sources":["../../../../src/components/media/url/framing.ts"],"names":[],"mappings":"AAiBA,MAAM,OAAO,GAAG,CAAC,QAAgB,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,KAAK,CAAC,GAAG,GAAG,GAAG,CAAC;AAE/E,MAAM,CAAC,MAAM,UAAU,GAAG,CACxB,IAAe,EACf,KAAa,EACb,MAAc,EACN,EAAE,CACV;IACE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC;IAC7B,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,GAAG,MAAM,CAAC;IAC7B,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC;IAChD,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;CAClD,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAEd,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,EAC9B,OAAO,EACP,IAAI,GAIL,EAAgB,EAAE,CAAC,CAAC;IACnB,GAAG,CAAC,OAAO,IAAI;QACb,cAAc,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;KAC9D,CAAC;IACF,GAAG,CAAC,IAAI,IAAI;QACV,aAAa,EAAE,SAAS,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG;KAClH,CAAC;CACH,CAAC,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type SanityImageTransformOptions } from "../sanity.ts";
|
|
2
|
+
import { type ImageCrop } from "./framing.ts";
|
|
3
|
+
import { type SanityProject } from "./sources.ts";
|
|
4
|
+
export type { SanityProject } from "./sources.ts";
|
|
5
|
+
export type { ImageCrop, ImageHotspot, ImageFraming } from "./framing.ts";
|
|
6
|
+
export { getImageFraming } from "./framing.ts";
|
|
7
|
+
export { isContentAssetUrl, isSvgSource } from "./sources.ts";
|
|
8
|
+
export interface ImageUrlOptions extends SanityImageTransformOptions {
|
|
9
|
+
crop?: ImageCrop | null;
|
|
10
|
+
}
|
|
11
|
+
export interface ContentAssetLookup {
|
|
12
|
+
urlOf: (assetId: string) => string | undefined;
|
|
13
|
+
sanity?: SanityProject;
|
|
14
|
+
}
|
|
15
|
+
export interface StoredContentAsset {
|
|
16
|
+
id?: string | null;
|
|
17
|
+
url?: string | null;
|
|
18
|
+
stored?: boolean | null;
|
|
19
|
+
}
|
|
20
|
+
export declare const contentAssetLookup: (assets: StoredContentAsset[], sanity?: SanityProject) => ContentAssetLookup;
|
|
21
|
+
export declare const getImageSource: (source: string | null | undefined, options?: ImageUrlOptions, assets?: ContentAssetLookup) => string | undefined;
|
|
22
|
+
export declare const getImageUrl: (source: string | null | undefined, options?: ImageUrlOptions, assets?: ContentAssetLookup) => string | undefined;
|
|
23
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/media/url/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,2BAA2B,EACjC,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,KAAK,SAA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H, optimizerUrl } from "./optimizer.js";
|
|
4
|
+
import { imageAssetOf, isContentAssetUrl, isSanityCdnUrl, isSvgSource, sanityCdnUrlOf, } from "./sources.js";
|
|
5
|
+
export { getImageFraming } from "./framing.js";
|
|
6
|
+
export { isContentAssetUrl, isSvgSource } from "./sources.js";
|
|
7
|
+
const MAX_DPR = 3;
|
|
8
|
+
export const contentAssetLookup = (assets, sanity) => {
|
|
9
|
+
const stored = new Map();
|
|
10
|
+
for (const asset of assets) {
|
|
11
|
+
if (asset.stored && asset.id && asset.url)
|
|
12
|
+
stored.set(asset.id, asset.url);
|
|
13
|
+
}
|
|
14
|
+
return { urlOf: (assetId) => stored.get(assetId), sanity };
|
|
15
|
+
};
|
|
16
|
+
const sanitySource = (source, asset, assets) => {
|
|
17
|
+
if (isSanityCdnUrl(source))
|
|
18
|
+
return source;
|
|
19
|
+
return assets?.sanity ? sanityCdnUrlOf(asset, assets.sanity) : undefined;
|
|
20
|
+
};
|
|
21
|
+
const cropped = (url, asset, crop) => {
|
|
22
|
+
if (!crop)
|
|
23
|
+
return url;
|
|
24
|
+
const withRect = new URL(url);
|
|
25
|
+
if (!withRect.searchParams.has("rect")) {
|
|
26
|
+
withRect.searchParams.set("rect", sanityRect(crop, asset.width, asset.height));
|
|
27
|
+
}
|
|
28
|
+
return withRect.toString();
|
|
29
|
+
};
|
|
30
|
+
export const getImageSource = (source, options = {}, assets) => {
|
|
31
|
+
if (typeof source !== "string" || !source.trim())
|
|
32
|
+
return undefined;
|
|
33
|
+
if (isContentAssetUrl(source))
|
|
34
|
+
return source;
|
|
35
|
+
const asset = imageAssetOf(source);
|
|
36
|
+
if (!asset)
|
|
37
|
+
return source;
|
|
38
|
+
const stored = assets?.urlOf(asset.id);
|
|
39
|
+
if (stored)
|
|
40
|
+
return stored;
|
|
41
|
+
const cdn = sanitySource(source, asset, assets);
|
|
42
|
+
return cdn
|
|
43
|
+
? getSanityImageUrl(cropped(cdn, asset, options.crop), options)
|
|
44
|
+
: undefined;
|
|
45
|
+
};
|
|
46
|
+
const requestedWidth = (source, options) => {
|
|
47
|
+
if (options.width)
|
|
48
|
+
return options.width;
|
|
49
|
+
const asset = imageAssetOf(source);
|
|
50
|
+
if (options.height && asset) {
|
|
51
|
+
return Math.ceil((options.height * asset.width) / asset.height);
|
|
52
|
+
}
|
|
53
|
+
return DEFAULT_WIDTH;
|
|
54
|
+
};
|
|
55
|
+
export const getImageUrl = (source, options = {}, assets) => {
|
|
56
|
+
const resolved = getImageSource(source, options, assets);
|
|
57
|
+
if (!resolved || !isContentAssetUrl(resolved))
|
|
58
|
+
return resolved;
|
|
59
|
+
if (isSvgSource(resolved))
|
|
60
|
+
return resolved;
|
|
61
|
+
const dpr = Math.min(options.dpr ?? 1, MAX_DPR);
|
|
62
|
+
return optimizerUrl(resolved, requestedWidth(resolved, options) * dpr, options.quality);
|
|
63
|
+
};
|
|
64
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/media/url/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,GAElB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAkB,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAGL,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,WAAW,EACX,cAAc,GACf,MAAM,cAAc,CAAC;AAItB,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAiB9D,MAAM,OAAO,GAAG,CAAC,CAAC;AAElB,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,MAA4B,EAC5B,MAAsB,EACF,EAAE;IACtB,MAAM,MAAM,GAAG,IAAI,GAAG,EAAkB,CAAC;IACzC,KAAK,MAA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,CAAC,iBAAiB,CAAC,QAAQ,CAAC;QAAE,OAAO,QAAQ,CAAC;IAC/D,IAAI,WAAW,CAAC,QAAQ,CAAC;QAAE,OAAO,QAAQ,CAAC;IAE3C,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC;IAChD,OAAO,YAAY,CACjB,QAAQ,EACR,cAAc,CAAC,QAAQ,EAAE,OAAO,CAAC,GAAG,GAAG,EACvC,OAAO,CAAC,OAAO,CAChB,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const IMAGE_WIDTHS: number[];
|
|
2
|
+
export declare const IMAGE_QUALITIES: number[];
|
|
3
|
+
export declare const DEFAULT_WIDTH = 1600;
|
|
4
|
+
export declare const optimizerWidth: (width: number) => number;
|
|
5
|
+
export declare const optimizerQuality: (quality?: number) => number;
|
|
6
|
+
export declare const optimizerUrl: (source: string, width: number, quality?: number) => string;
|
|
7
|
+
//# sourceMappingURL=optimizer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"optimizer.d.ts","sourceRoot":"","sources":["../../../../src/components/media/url/optimizer.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,UAExB,CAAC;AACF,eAAO,MAAM,eAAe,UAAO,CAAC;AACpC,eAAO,MAAM,aAAa,OAAO,CAAC;AASlC,eAAO,MAAM,cAAc,GAAI,OAAO,MAAM,KAAG,MAER,CAAC;AAExC,eAAO,MAAM,gBAAgB,GAAI,UAAU,MAAM,KAAG,MACK,CAAC;AAE1D,eAAO,MAAM,YAAY,GACvB,QAAQ,MAAM,EACd,OAAO,MAAM,EACb,UAAU,MAAM,KACf,MAC8G,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export const IMAGE_WIDTHS = [
|
|
2
|
+
32, 48, 64, 96, 128, 256, 384, 640, 750, 828, 1080, 1200, 1920, 2048, 3840,
|
|
3
|
+
];
|
|
4
|
+
export const IMAGE_QUALITIES = [75];
|
|
5
|
+
export const DEFAULT_WIDTH = 1600;
|
|
6
|
+
const OPTIMIZER_PATH = "/_next/image";
|
|
7
|
+
const nearest = (allowed, value) => allowed.reduce((best, candidate) => Math.abs(candidate - value) < Math.abs(best - value) ? candidate : best);
|
|
8
|
+
export const optimizerWidth = (width) => IMAGE_WIDTHS.find((allowed) => allowed >= width) ??
|
|
9
|
+
IMAGE_WIDTHS[IMAGE_WIDTHS.length - 1];
|
|
10
|
+
export const optimizerQuality = (quality) => nearest(IMAGE_QUALITIES, quality ?? IMAGE_QUALITIES[0]);
|
|
11
|
+
export const optimizerUrl = (source, width, quality) => `${OPTIMIZER_PATH}?url=${encodeURIComponent(source)}&w=${optimizerWidth(width)}&q=${optimizerQuality(quality)}`;
|
|
12
|
+
//# sourceMappingURL=optimizer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"optimizer.js","sourceRoot":"","sources":["../../../../src/components/media/url/optimizer.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI;CAC3E,CAAC;AACF,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,EAAE,CAAC,CAAC;AACpC,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,CAAC;AAElC,MAAM,cAAc,GAAG,cAAc,CAAC;AAEtC,MAAM,OAAO,GAAG,CAAC,OAAiB,EAAE,KAAa,EAAE,EAAE,CACnD,OAAO,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE,CACjC,IAAI,CAAC,GAAG,CAAC,SAAS,GAAG,KAAK,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CACxE,CAAC;AAEJ,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAAa,EAAU,EAAE,CACtD,YAAY,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,IAAI,KAAK,CAAC;IAChD,YAAY,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AAExC,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,OAAgB,EAAU,EAAE,CAC3D,OAAO,CAAC,eAAe,EAAE,OAAO,IAAI,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC;AAE1D,MAAM,CAAC,MAAM,YAAY,GAAG,CAC1B,MAAc,EACd,KAAa,EACb,OAAgB,EACR,EAAE,CACV,GAAG,cAAc,QAAQ,kBAAkB,CAAC,MAAM,CAAC,MAAM,cAAc,CAAC,KAAK,CAAC,MAAM,gBAAgB,CAAC,OAAO,CAAC,EAAE,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface SanityProject {
|
|
2
|
+
projectId: string;
|
|
3
|
+
dataset: string;
|
|
4
|
+
}
|
|
5
|
+
export interface ImageAssetId {
|
|
6
|
+
id: string;
|
|
7
|
+
hash: string;
|
|
8
|
+
width: number;
|
|
9
|
+
height: number;
|
|
10
|
+
extension: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const isContentAssetUrl: (source: string) => boolean;
|
|
13
|
+
export declare const isSvgSource: (source: string) => boolean;
|
|
14
|
+
export declare const isSanityCdnUrl: (source: string) => boolean;
|
|
15
|
+
export declare const imageAssetOf: (source: string) => ImageAssetId | undefined;
|
|
16
|
+
export declare const sanityCdnUrlOf: (asset: ImageAssetId, project: SanityProject) => string;
|
|
17
|
+
//# sourceMappingURL=sources.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sources.d.ts","sourceRoot":"","sources":["../../../../src/components/media/url/sources.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB;AA8BD,eAAO,MAAM,iBAAiB,GAAI,QAAQ,MAAM,KAAG,OAMlD,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,QAAQ,MAAM,KAAG,OAG5C,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,QAAQ,MAAM,KAAG,OACF,CAAC;AAE/C,eAAO,MAAM,YAAY,GAAI,QAAQ,MAAM,KAAG,YAAY,GAAG,SAa5D,CAAC;AAEF,eAAO,MAAM,cAAc,GACzB,OAAO,YAAY,EACnB,SAAS,aAAa,KACrB,MAC0I,CAAC"}
|