sanity-plugin-mux-input 2.0.1 → 2.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/LICENSE +1 -1
  2. package/lib/_chunks/Input-4ec3c050.js +2666 -0
  3. package/lib/_chunks/Input-4ec3c050.js.map +1 -0
  4. package/lib/_chunks/Input-aa6d929b.js +2636 -0
  5. package/lib/_chunks/Input-aa6d929b.js.map +1 -0
  6. package/lib/_chunks/Preview-1664b7d5.js +28 -0
  7. package/lib/_chunks/Preview-1664b7d5.js.map +1 -0
  8. package/lib/_chunks/Preview-43ce9c72.js +26 -0
  9. package/lib/_chunks/{Preview-3195237b.js.map → Preview-43ce9c72.js.map} +1 -1
  10. package/lib/_chunks/VideoSource.styled-24577ec8.js +318 -0
  11. package/lib/_chunks/VideoSource.styled-24577ec8.js.map +1 -0
  12. package/lib/_chunks/VideoSource.styled-99ffa712.js +336 -0
  13. package/lib/_chunks/VideoSource.styled-99ffa712.js.map +1 -0
  14. package/lib/_chunks/index-9933dea2.js +264 -0
  15. package/lib/_chunks/index-9933dea2.js.map +1 -0
  16. package/lib/_chunks/index-c54f5393.js +247 -0
  17. package/lib/_chunks/index-c54f5393.js.map +1 -0
  18. package/lib/{src/index.d.ts → index.d.ts} +0 -0
  19. package/lib/index.esm.js +2 -1
  20. package/lib/index.esm.js.map +1 -1
  21. package/lib/index.js +9 -1
  22. package/lib/index.js.map +1 -1
  23. package/package.json +27 -34
  24. package/lib/_chunks/Input-2ba004d3.js +0 -2
  25. package/lib/_chunks/Input-2ba004d3.js.map +0 -1
  26. package/lib/_chunks/Input-af5a0a66.esm.js +0 -2
  27. package/lib/_chunks/Input-af5a0a66.esm.js.map +0 -1
  28. package/lib/_chunks/Preview-3195237b.js +0 -2
  29. package/lib/_chunks/Preview-bb256342.esm.js +0 -2
  30. package/lib/_chunks/Preview-bb256342.esm.js.map +0 -1
  31. package/lib/_chunks/VideoSource.styled-1b994d90.js +0 -2
  32. package/lib/_chunks/VideoSource.styled-1b994d90.js.map +0 -1
  33. package/lib/_chunks/VideoSource.styled-f92259cd.esm.js +0 -2
  34. package/lib/_chunks/VideoSource.styled-f92259cd.esm.js.map +0 -1
  35. package/lib/_chunks/index-3d8d7583.esm.js +0 -2
  36. package/lib/_chunks/index-3d8d7583.esm.js.map +0 -1
  37. package/lib/_chunks/index-efe6ce48.js +0 -2
  38. package/lib/_chunks/index-efe6ce48.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-9933dea2.js","sources":["../../src/util/asserters.ts","../../src/util/constants.ts","../../src/components/ErrorBoundaryCard.tsx","../../src/components/Input.styled.tsx","../../src/components/FormInput.tsx","../../src/components/FormPreview.tsx","../../src/index.ts"],"sourcesContent":["import {type InputProps, type PreviewLayoutKey, type PreviewProps, isObjectInputProps} from 'sanity'\n\nimport type {MuxInputPreviewProps, MuxInputProps} from './types'\n\nexport function isMuxInputProps(props: InputProps): props is MuxInputProps {\n return isObjectInputProps(props) && props.schemaType.type?.name === 'mux.video'\n}\n\nexport function isMuxInputPreviewProps(\n props: PreviewProps<PreviewLayoutKey>\n): props is MuxInputPreviewProps {\n return props.schemaType?.type?.name === 'mux.video'\n}\n","export const name = 'mux-input' as const\n\n// Caching namespace, as suspend-react might be in use by other components on the page we must ensure we don't collide\nexport const cacheNs = 'sanity-plugin-mux-input' as const\n\nexport const muxSecretsDocumentId = 'secrets.mux' as const\n","/* eslint-disable no-console */\nimport {Button, Card, Flex, Grid, Heading, Inline, Text, useToast} from '@sanity/ui'\nimport React, {memo, useCallback, useRef} from 'react'\nimport scrollIntoView from 'scroll-into-view-if-needed'\nimport {clear} from 'suspend-react'\nimport {useErrorBoundary} from 'use-error-boundary'\n\nimport {name} from '../util/constants'\nimport {type MuxInputProps} from '../util/types'\n\nexport interface Props extends Pick<MuxInputProps, 'schemaType'> {\n children: React.ReactNode\n}\nfunction ErrorBoundaryCard(props: Props) {\n const {children, schemaType} = props\n const {push: pushToast} = useToast()\n const errorRef = useRef(null)\n const {ErrorBoundary, didCatch, error, reset} = useErrorBoundary({\n onDidCatch: (err, errorInfo) => {\n console.group(err.toString())\n console.groupCollapsed('console.error')\n console.error(err)\n console.groupEnd()\n if (err.stack) {\n console.groupCollapsed('error.stack')\n console.log(err.stack)\n console.groupEnd()\n }\n if (errorInfo?.componentStack) {\n console.groupCollapsed('errorInfo.componentStack')\n console.log(errorInfo.componentStack)\n console.groupEnd()\n }\n console.groupEnd()\n pushToast({\n status: 'error',\n title: 'Plugin crashed',\n description: (\n <Flex align=\"center\">\n <Inline space={1}>\n An error happened while rendering\n <Button\n padding={1}\n fontSize={1}\n style={{transform: 'translateY(1px)'}}\n mode=\"ghost\"\n text={schemaType.title}\n onClick={() => {\n if (errorRef.current) {\n scrollIntoView(errorRef.current, {\n behavior: 'smooth',\n scrollMode: 'if-needed',\n block: 'center',\n })\n }\n }}\n />\n </Inline>\n </Flex>\n ),\n })\n },\n })\n const handleRetry = useCallback(() => {\n // Purge request cache before retrying, otherwise the cached errors will rethrow\n clear([name])\n\n reset()\n }, [reset])\n\n if (didCatch) {\n return (\n <Card ref={errorRef} paddingX={[2, 3, 4, 4]} height=\"fill\" shadow={1} overflow=\"auto\">\n <Flex justify=\"flex-start\" align=\"center\" height=\"fill\">\n <Grid columns={1} gap={[2, 3, 4, 4]}>\n <Heading as=\"h1\">\n The <code>{name}</code> plugin crashed\n </Heading>\n {error?.message && (\n <Card padding={3} tone=\"critical\" shadow={1} radius={2}>\n <Text>{error.message}</Text>\n </Card>\n )}\n <Inline>\n <Button onClick={handleRetry} text=\"Retry\" />\n </Inline>\n </Grid>\n </Flex>\n </Card>\n )\n }\n\n return <ErrorBoundary>{children}</ErrorBoundary>\n}\n\nexport default memo(ErrorBoundaryCard)\n","import {Box, Card, Flex, Spinner, Text} from '@sanity/ui'\nimport React from 'react'\nimport styled from 'styled-components'\n\n// This container base container ensures everything uses the same aspect ratio, avoids layout shifts and stuff jumping around\nexport const AspectRatioCard = styled(Card)`\n aspect-ratio: 16 / 9;\n position: relative;\n width: 100%;\n`\n\nexport const InputFallback = () => {\n return (\n <div style={{padding: 1}}>\n <Card\n shadow={1}\n sizing=\"border\"\n style={{aspectRatio: '16/9', width: '100%', borderRadius: '1px'}}\n >\n <Flex align=\"center\" direction=\"column\" height=\"fill\" justify=\"center\">\n <Spinner muted />\n <Box marginTop={3}>\n <Text align=\"center\" muted size={1}>\n Loading…\n </Text>\n </Box>\n </Flex>\n </Card>\n </div>\n )\n}\n","import React, {lazy, memo, Suspense} from 'react'\nimport {type InputProps} from 'sanity'\n\nimport {isMuxInputProps} from '../util/asserters'\nimport {type Config} from '../util/types'\nimport ErrorBoundaryCard from './ErrorBoundaryCard'\nimport {AspectRatioCard, InputFallback} from './Input.styled'\n\nconst Input = lazy(() => import('./Input'))\n\n// eslint-disable-next-line import/no-anonymous-default-export\nexport default (config: Config) =>\n memo(function FormInput(props: InputProps) {\n if (isMuxInputProps(props)) {\n return (\n <AspectRatioCard>\n <ErrorBoundaryCard schemaType={props.schemaType}>\n <Suspense fallback={<InputFallback />}>\n <Input config={config} {...props} />\n </Suspense>\n </ErrorBoundaryCard>\n </AspectRatioCard>\n )\n }\n return props.renderDefault(props)\n })\n","import React, {lazy, memo} from 'react'\nimport {PreviewLayoutKey, PreviewProps} from 'sanity'\n\nimport {isMuxInputPreviewProps} from '../util/asserters'\nimport {AspectRatioCard} from './Input.styled'\n\nconst Preview = lazy(() => import('./Preview'))\n\nexport default memo(function FormPreview(props: PreviewProps<PreviewLayoutKey>) {\n if (isMuxInputPreviewProps(props)) {\n return (\n <AspectRatioCard>\n {/* @ts-expect-error */}\n <Preview {...props} />\n </AspectRatioCard>\n )\n }\n return props.renderDefault(props)\n})\n","import {definePlugin} from 'sanity'\n\nimport createFormInput from './components/FormInput'\nimport FormPreview from './components/FormPreview'\nimport {type Config} from './util/types'\n\nexport const defaultConfig: Config = {\n mp4_support: 'none',\n}\n\nexport const muxInput = definePlugin<Partial<Config> | void>((userConfig) => {\n const config: Config = {...defaultConfig, ...userConfig}\n const InputComponent = createFormInput(config)\n return {\n name: 'mux-input',\n form: {\n components: {\n input: InputComponent,\n preview: FormPreview,\n },\n },\n schema: {\n types: [\n {\n name: 'mux.video',\n type: 'object',\n title: 'Video asset reference',\n fields: [\n {\n title: 'Video',\n name: 'asset',\n type: 'reference',\n weak: true,\n to: [{type: 'mux.videoAsset'}],\n },\n ],\n },\n {\n name: 'mux.videoAsset',\n type: 'object',\n title: 'Video asset',\n fields: [\n {\n type: 'string',\n name: 'status',\n },\n {\n type: 'string',\n name: 'assetId',\n },\n {\n type: 'string',\n name: 'playbackId',\n },\n {\n type: 'string',\n name: 'filename',\n },\n {\n type: 'number',\n name: 'thumbTime',\n },\n ],\n },\n ],\n },\n }\n})\n"],"names":["isMuxInputProps","props","_a","isObjectInputProps","schemaType","type","name","isMuxInputPreviewProps","_b","cacheNs","muxSecretsDocumentId","ErrorBoundaryCard","children","push","pushToast","useToast","errorRef","useRef","ErrorBoundary","didCatch","error","reset","useErrorBoundary","onDidCatch","err","errorInfo","console","group","toString","groupCollapsed","groupEnd","stack","log","componentStack","status","title","description","jsx","Flex","align","jsxs","Inline","space","Button","padding","fontSize","style","transform","mode","text","onClick","current","scrollIntoView","default","behavior","scrollMode","block","handleRetry","useCallback","clear","Card","ref","paddingX","height","shadow","overflow","justify","Grid","columns","gap","Heading","as","message","tone","radius","Text","memo","AspectRatioCard","styled","InputFallback","sizing","aspectRatio","width","borderRadius","direction","Spinner","muted","Box","marginTop","size","Input","lazy","Promise","resolve","then","require","createFormInput","config","FormInput","Suspense","fallback","renderDefault","Preview","FormPreview","defaultConfig","mp4_support","muxInput","definePlugin","userConfig","InputComponent","form","components","input","preview","schema","types","fields","weak","to"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAIO,SAASA,gBAAgBC,KAA2C,EAAA;EAJ3E,IAAAC,EAAA;EAKE,OAAOC,0BAAmBF,KAAK,CAAA,IAA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AAA;IAEJ;EAAA,CACF;AACF,CAAC,CAAA;;;;;"}
@@ -0,0 +1,247 @@
1
+ var _templateObject;
2
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
6
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
7
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
8
+ import { isObjectInputProps, definePlugin } from 'sanity';
9
+ import { jsx, jsxs } from 'react/jsx-runtime';
10
+ import { memo, useRef, useCallback, lazy, Suspense } from 'react';
11
+ import { useToast, Flex, Inline, Button, Card, Grid, Heading, Text, Spinner, Box } from '@sanity/ui';
12
+ import scrollIntoView from 'scroll-into-view-if-needed';
13
+ import { clear } from 'suspend-react';
14
+ import { useErrorBoundary } from 'use-error-boundary';
15
+ import styled from 'styled-components';
16
+ function isMuxInputProps(props) {
17
+ var _a;
18
+ return isObjectInputProps(props) && ((_a = props.schemaType.type) == null ? void 0 : _a.name) === "mux.video";
19
+ }
20
+ function isMuxInputPreviewProps(props) {
21
+ var _a, _b;
22
+ return ((_b = (_a = props.schemaType) == null ? void 0 : _a.type) == null ? void 0 : _b.name) === "mux.video";
23
+ }
24
+ const name = "mux-input";
25
+ const cacheNs = "sanity-plugin-mux-input";
26
+ const muxSecretsDocumentId = "secrets.mux";
27
+ function ErrorBoundaryCard(props) {
28
+ const {
29
+ children,
30
+ schemaType
31
+ } = props;
32
+ const {
33
+ push: pushToast
34
+ } = useToast();
35
+ const errorRef = useRef(null);
36
+ const {
37
+ ErrorBoundary,
38
+ didCatch,
39
+ error,
40
+ reset
41
+ } = useErrorBoundary({
42
+ onDidCatch: (err, errorInfo) => {
43
+ console.group(err.toString());
44
+ console.groupCollapsed("console.error");
45
+ console.error(err);
46
+ console.groupEnd();
47
+ if (err.stack) {
48
+ console.groupCollapsed("error.stack");
49
+ console.log(err.stack);
50
+ console.groupEnd();
51
+ }
52
+ if (errorInfo == null ? void 0 : errorInfo.componentStack) {
53
+ console.groupCollapsed("errorInfo.componentStack");
54
+ console.log(errorInfo.componentStack);
55
+ console.groupEnd();
56
+ }
57
+ console.groupEnd();
58
+ pushToast({
59
+ status: "error",
60
+ title: "Plugin crashed",
61
+ description: /* @__PURE__ */jsx(Flex, {
62
+ align: "center",
63
+ children: /* @__PURE__ */jsxs(Inline, {
64
+ space: 1,
65
+ children: ["An error happened while rendering", /* @__PURE__ */jsx(Button, {
66
+ padding: 1,
67
+ fontSize: 1,
68
+ style: {
69
+ transform: "translateY(1px)"
70
+ },
71
+ mode: "ghost",
72
+ text: schemaType.title,
73
+ onClick: () => {
74
+ if (errorRef.current) {
75
+ scrollIntoView(errorRef.current, {
76
+ behavior: "smooth",
77
+ scrollMode: "if-needed",
78
+ block: "center"
79
+ });
80
+ }
81
+ }
82
+ })]
83
+ })
84
+ })
85
+ });
86
+ }
87
+ });
88
+ const handleRetry = useCallback(() => {
89
+ clear([name]);
90
+ reset();
91
+ }, [reset]);
92
+ if (didCatch) {
93
+ return /* @__PURE__ */jsx(Card, {
94
+ ref: errorRef,
95
+ paddingX: [2, 3, 4, 4],
96
+ height: "fill",
97
+ shadow: 1,
98
+ overflow: "auto",
99
+ children: /* @__PURE__ */jsx(Flex, {
100
+ justify: "flex-start",
101
+ align: "center",
102
+ height: "fill",
103
+ children: /* @__PURE__ */jsxs(Grid, {
104
+ columns: 1,
105
+ gap: [2, 3, 4, 4],
106
+ children: [/* @__PURE__ */jsxs(Heading, {
107
+ as: "h1",
108
+ children: ["The ", /* @__PURE__ */jsx("code", {
109
+ children: name
110
+ }), " plugin crashed"]
111
+ }), (error == null ? void 0 : error.message) && /* @__PURE__ */jsx(Card, {
112
+ padding: 3,
113
+ tone: "critical",
114
+ shadow: 1,
115
+ radius: 2,
116
+ children: /* @__PURE__ */jsx(Text, {
117
+ children: error.message
118
+ })
119
+ }), /* @__PURE__ */jsx(Inline, {
120
+ children: /* @__PURE__ */jsx(Button, {
121
+ onClick: handleRetry,
122
+ text: "Retry"
123
+ })
124
+ })]
125
+ })
126
+ })
127
+ });
128
+ }
129
+ return /* @__PURE__ */jsx(ErrorBoundary, {
130
+ children
131
+ });
132
+ }
133
+ var ErrorBoundaryCard$1 = memo(ErrorBoundaryCard);
134
+ const AspectRatioCard = styled(Card)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n aspect-ratio: 16 / 9;\n position: relative;\n width: 100%;\n"])));
135
+ const InputFallback = () => {
136
+ return /* @__PURE__ */jsx("div", {
137
+ style: {
138
+ padding: 1
139
+ },
140
+ children: /* @__PURE__ */jsx(Card, {
141
+ shadow: 1,
142
+ sizing: "border",
143
+ style: {
144
+ aspectRatio: "16/9",
145
+ width: "100%",
146
+ borderRadius: "1px"
147
+ },
148
+ children: /* @__PURE__ */jsxs(Flex, {
149
+ align: "center",
150
+ direction: "column",
151
+ height: "fill",
152
+ justify: "center",
153
+ children: [/* @__PURE__ */jsx(Spinner, {
154
+ muted: true
155
+ }), /* @__PURE__ */jsx(Box, {
156
+ marginTop: 3,
157
+ children: /* @__PURE__ */jsx(Text, {
158
+ align: "center",
159
+ muted: true,
160
+ size: 1,
161
+ children: "Loading\u2026"
162
+ })
163
+ })]
164
+ })
165
+ })
166
+ });
167
+ };
168
+ const Input = lazy(() => import('./Input-aa6d929b.js'));
169
+ var createFormInput = config => memo(function FormInput(props) {
170
+ if (isMuxInputProps(props)) {
171
+ return /* @__PURE__ */jsx(AspectRatioCard, {
172
+ children: /* @__PURE__ */jsx(ErrorBoundaryCard$1, {
173
+ schemaType: props.schemaType,
174
+ children: /* @__PURE__ */jsx(Suspense, {
175
+ fallback: /* @__PURE__ */jsx(InputFallback, {}),
176
+ children: /* @__PURE__ */jsx(Input, _objectSpread({
177
+ config
178
+ }, props))
179
+ })
180
+ })
181
+ });
182
+ }
183
+ return props.renderDefault(props);
184
+ });
185
+ const Preview = lazy(() => import('./Preview-43ce9c72.js'));
186
+ var FormPreview = memo(function FormPreview(props) {
187
+ if (isMuxInputPreviewProps(props)) {
188
+ return /* @__PURE__ */jsx(AspectRatioCard, {
189
+ children: /* @__PURE__ */jsx(Preview, _objectSpread({}, props))
190
+ });
191
+ }
192
+ return props.renderDefault(props);
193
+ });
194
+ const defaultConfig = {
195
+ mp4_support: "none"
196
+ };
197
+ const muxInput = definePlugin(userConfig => {
198
+ const config = _objectSpread(_objectSpread({}, defaultConfig), userConfig);
199
+ const InputComponent = createFormInput(config);
200
+ return {
201
+ name: "mux-input",
202
+ form: {
203
+ components: {
204
+ input: InputComponent,
205
+ preview: FormPreview
206
+ }
207
+ },
208
+ schema: {
209
+ types: [{
210
+ name: "mux.video",
211
+ type: "object",
212
+ title: "Video asset reference",
213
+ fields: [{
214
+ title: "Video",
215
+ name: "asset",
216
+ type: "reference",
217
+ weak: true,
218
+ to: [{
219
+ type: "mux.videoAsset"
220
+ }]
221
+ }]
222
+ }, {
223
+ name: "mux.videoAsset",
224
+ type: "object",
225
+ title: "Video asset",
226
+ fields: [{
227
+ type: "string",
228
+ name: "status"
229
+ }, {
230
+ type: "string",
231
+ name: "assetId"
232
+ }, {
233
+ type: "string",
234
+ name: "playbackId"
235
+ }, {
236
+ type: "string",
237
+ name: "filename"
238
+ }, {
239
+ type: "number",
240
+ name: "thumbTime"
241
+ }]
242
+ }]
243
+ }
244
+ };
245
+ });
246
+ export { InputFallback, cacheNs, defaultConfig, muxInput, muxSecretsDocumentId };
247
+ //# sourceMappingURL=index-c54f5393.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-c54f5393.js","sources":["../../src/util/asserters.ts","../../src/util/constants.ts","../../src/components/ErrorBoundaryCard.tsx","../../src/components/Input.styled.tsx","../../src/components/FormInput.tsx","../../src/components/FormPreview.tsx","../../src/index.ts"],"sourcesContent":["import {type InputProps, type PreviewLayoutKey, type PreviewProps, isObjectInputProps} from 'sanity'\n\nimport type {MuxInputPreviewProps, MuxInputProps} from './types'\n\nexport function isMuxInputProps(props: InputProps): props is MuxInputProps {\n return isObjectInputProps(props) && props.schemaType.type?.name === 'mux.video'\n}\n\nexport function isMuxInputPreviewProps(\n props: PreviewProps<PreviewLayoutKey>\n): props is MuxInputPreviewProps {\n return props.schemaType?.type?.name === 'mux.video'\n}\n","export const name = 'mux-input' as const\n\n// Caching namespace, as suspend-react might be in use by other components on the page we must ensure we don't collide\nexport const cacheNs = 'sanity-plugin-mux-input' as const\n\nexport const muxSecretsDocumentId = 'secrets.mux' as const\n","/* eslint-disable no-console */\nimport {Button, Card, Flex, Grid, Heading, Inline, Text, useToast} from '@sanity/ui'\nimport React, {memo, useCallback, useRef} from 'react'\nimport scrollIntoView from 'scroll-into-view-if-needed'\nimport {clear} from 'suspend-react'\nimport {useErrorBoundary} from 'use-error-boundary'\n\nimport {name} from '../util/constants'\nimport {type MuxInputProps} from '../util/types'\n\nexport interface Props extends Pick<MuxInputProps, 'schemaType'> {\n children: React.ReactNode\n}\nfunction ErrorBoundaryCard(props: Props) {\n const {children, schemaType} = props\n const {push: pushToast} = useToast()\n const errorRef = useRef(null)\n const {ErrorBoundary, didCatch, error, reset} = useErrorBoundary({\n onDidCatch: (err, errorInfo) => {\n console.group(err.toString())\n console.groupCollapsed('console.error')\n console.error(err)\n console.groupEnd()\n if (err.stack) {\n console.groupCollapsed('error.stack')\n console.log(err.stack)\n console.groupEnd()\n }\n if (errorInfo?.componentStack) {\n console.groupCollapsed('errorInfo.componentStack')\n console.log(errorInfo.componentStack)\n console.groupEnd()\n }\n console.groupEnd()\n pushToast({\n status: 'error',\n title: 'Plugin crashed',\n description: (\n <Flex align=\"center\">\n <Inline space={1}>\n An error happened while rendering\n <Button\n padding={1}\n fontSize={1}\n style={{transform: 'translateY(1px)'}}\n mode=\"ghost\"\n text={schemaType.title}\n onClick={() => {\n if (errorRef.current) {\n scrollIntoView(errorRef.current, {\n behavior: 'smooth',\n scrollMode: 'if-needed',\n block: 'center',\n })\n }\n }}\n />\n </Inline>\n </Flex>\n ),\n })\n },\n })\n const handleRetry = useCallback(() => {\n // Purge request cache before retrying, otherwise the cached errors will rethrow\n clear([name])\n\n reset()\n }, [reset])\n\n if (didCatch) {\n return (\n <Card ref={errorRef} paddingX={[2, 3, 4, 4]} height=\"fill\" shadow={1} overflow=\"auto\">\n <Flex justify=\"flex-start\" align=\"center\" height=\"fill\">\n <Grid columns={1} gap={[2, 3, 4, 4]}>\n <Heading as=\"h1\">\n The <code>{name}</code> plugin crashed\n </Heading>\n {error?.message && (\n <Card padding={3} tone=\"critical\" shadow={1} radius={2}>\n <Text>{error.message}</Text>\n </Card>\n )}\n <Inline>\n <Button onClick={handleRetry} text=\"Retry\" />\n </Inline>\n </Grid>\n </Flex>\n </Card>\n )\n }\n\n return <ErrorBoundary>{children}</ErrorBoundary>\n}\n\nexport default memo(ErrorBoundaryCard)\n","import {Box, Card, Flex, Spinner, Text} from '@sanity/ui'\nimport React from 'react'\nimport styled from 'styled-components'\n\n// This container base container ensures everything uses the same aspect ratio, avoids layout shifts and stuff jumping around\nexport const AspectRatioCard = styled(Card)`\n aspect-ratio: 16 / 9;\n position: relative;\n width: 100%;\n`\n\nexport const InputFallback = () => {\n return (\n <div style={{padding: 1}}>\n <Card\n shadow={1}\n sizing=\"border\"\n style={{aspectRatio: '16/9', width: '100%', borderRadius: '1px'}}\n >\n <Flex align=\"center\" direction=\"column\" height=\"fill\" justify=\"center\">\n <Spinner muted />\n <Box marginTop={3}>\n <Text align=\"center\" muted size={1}>\n Loading…\n </Text>\n </Box>\n </Flex>\n </Card>\n </div>\n )\n}\n","import React, {lazy, memo, Suspense} from 'react'\nimport {type InputProps} from 'sanity'\n\nimport {isMuxInputProps} from '../util/asserters'\nimport {type Config} from '../util/types'\nimport ErrorBoundaryCard from './ErrorBoundaryCard'\nimport {AspectRatioCard, InputFallback} from './Input.styled'\n\nconst Input = lazy(() => import('./Input'))\n\n// eslint-disable-next-line import/no-anonymous-default-export\nexport default (config: Config) =>\n memo(function FormInput(props: InputProps) {\n if (isMuxInputProps(props)) {\n return (\n <AspectRatioCard>\n <ErrorBoundaryCard schemaType={props.schemaType}>\n <Suspense fallback={<InputFallback />}>\n <Input config={config} {...props} />\n </Suspense>\n </ErrorBoundaryCard>\n </AspectRatioCard>\n )\n }\n return props.renderDefault(props)\n })\n","import React, {lazy, memo} from 'react'\nimport {PreviewLayoutKey, PreviewProps} from 'sanity'\n\nimport {isMuxInputPreviewProps} from '../util/asserters'\nimport {AspectRatioCard} from './Input.styled'\n\nconst Preview = lazy(() => import('./Preview'))\n\nexport default memo(function FormPreview(props: PreviewProps<PreviewLayoutKey>) {\n if (isMuxInputPreviewProps(props)) {\n return (\n <AspectRatioCard>\n {/* @ts-expect-error */}\n <Preview {...props} />\n </AspectRatioCard>\n )\n }\n return props.renderDefault(props)\n})\n","import {definePlugin} from 'sanity'\n\nimport createFormInput from './components/FormInput'\nimport FormPreview from './components/FormPreview'\nimport {type Config} from './util/types'\n\nexport const defaultConfig: Config = {\n mp4_support: 'none',\n}\n\nexport const muxInput = definePlugin<Partial<Config> | void>((userConfig) => {\n const config: Config = {...defaultConfig, ...userConfig}\n const InputComponent = createFormInput(config)\n return {\n name: 'mux-input',\n form: {\n components: {\n input: InputComponent,\n preview: FormPreview,\n },\n },\n schema: {\n types: [\n {\n name: 'mux.video',\n type: 'object',\n title: 'Video asset reference',\n fields: [\n {\n title: 'Video',\n name: 'asset',\n type: 'reference',\n weak: true,\n to: [{type: 'mux.videoAsset'}],\n },\n ],\n },\n {\n name: 'mux.videoAsset',\n type: 'object',\n title: 'Video asset',\n fields: [\n {\n type: 'string',\n name: 'status',\n },\n {\n type: 'string',\n name: 'assetId',\n },\n {\n type: 'string',\n name: 'playbackId',\n },\n {\n type: 'string',\n name: 'filename',\n },\n {\n type: 'number',\n name: 'thumbTime',\n },\n ],\n },\n ],\n },\n }\n})\n"],"names":["isMuxInputProps","props","_a","isObjectInputProps","schemaType","type","name","isMuxInputPreviewProps","_b","cacheNs","muxSecretsDocumentId","ErrorBoundaryCard","children","push","pushToast","useToast","errorRef","useRef","ErrorBoundary","didCatch","error","reset","useErrorBoundary","onDidCatch","err","errorInfo","console","group","toString","groupCollapsed","groupEnd","stack","log","componentStack","status","title","description","jsx","Flex","align","jsxs","Inline","space","Button","padding","fontSize","style","transform","mode","text","onClick","current","scrollIntoView","behavior","scrollMode","block","handleRetry","useCallback","clear","Card","ref","paddingX","height","shadow","overflow","justify","Grid","columns","gap","Heading","as","message","tone","radius","Text","ErrorBoundaryCard$1","memo","AspectRatioCard","styled","InputFallback","sizing","aspectRatio","width","borderRadius","direction","Spinner","muted","Box","marginTop","size","Input","lazy","createFormInput","config","FormInput","Suspense","fallback","renderDefault","Preview","FormPreview","defaultConfig","mp4_support","muxInput","definePlugin","userConfig","InputComponent","form","components","input","preview","schema","types","fields","weak","to"],"mappings":";;;;;;;;;;;;;;;AA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AA,OAAA;UACP7B,IAAM,EAAA,OAAA;UACND,IAAM,EAAA,WAAA;UACN4G,IAAM,EAAA,IAAA;UACNC,EAAI,EAAA,CAAC;YAAC7G,IAAA,EAAM;WAAiB;QAC/B,CAAA;MAEJ,CAAA,EACA;QACEC,IAAM,EAAA,gBAAA;QACND,IAAM,EAAA,QAAA;QACN8B,KAAO,EAAA,aAAA;QACP6E,MAAQ,EAAA,CACN;UACE3G,IAAM,EAAA,QAAA;UACNC,IAAM,EAAA;QACR,CAAA,EACA;UACED,IAAM,EAAA,QAAA;UACNC,IAAM,EAAA;QACR,CAAA,EACA;UACED,IAAM,EAAA,QAAA;UACNC,IAAM,EAAA;QACR,CAAA,EACA;UACED,IAAM,EAAA,QAAA;UACNC,IAAM,EAAA;QACR,CAAA,EACA;UACED,IAAM,EAAA,QAAA;UACNC,IAAM,EAAA;QACR,CAAA;MAEJ,CAAA;IAEJ;EAAA,CACF;AACF,CAAC,CAAA;"}
File without changes
package/lib/index.esm.js CHANGED
@@ -1,2 +1,3 @@
1
- import"sanity";export{d as defaultConfig,a as muxInput}from"./_chunks/index-3d8d7583.esm.js";import"react/jsx-runtime";import"react";import"@sanity/ui";import"scroll-into-view-if-needed";import"suspend-react";import"use-error-boundary";import"styled-components";
1
+ import 'sanity';
2
+ export { defaultConfig, muxInput } from './_chunks/index-c54f5393.js';
2
3
  //# sourceMappingURL=index.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
1
+ {"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
package/lib/index.js CHANGED
@@ -1,2 +1,10 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),require("sanity");var e=require("./_chunks/index-efe6ce48.js");require("react/jsx-runtime"),require("react"),require("@sanity/ui"),require("scroll-into-view-if-needed"),require("suspend-react"),require("use-error-boundary"),require("styled-components"),exports.defaultConfig=e.defaultConfig,exports.muxInput=e.muxInput;
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', {
4
+ value: true
5
+ });
6
+ require('sanity');
7
+ var index = require('./_chunks/index-9933dea2.js');
8
+ exports.defaultConfig = index.defaultConfig;
9
+ exports.muxInput = index.muxInput;
2
10
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sanity-plugin-mux-input",
3
- "version": "2.0.1",
3
+ "version": "2.0.3",
4
4
  "description": "An input component that integrates Sanity Studio with Mux video encoding/hosting service.",
5
5
  "keywords": [
6
6
  "sanity",
@@ -23,7 +23,7 @@
23
23
  "author": "Sanity.io <hello@sanity.io>",
24
24
  "exports": {
25
25
  ".": {
26
- "types": "./lib/src/index.d.ts",
26
+ "types": "./lib/index.d.ts",
27
27
  "source": "./src/index.ts",
28
28
  "import": "./lib/index.esm.js",
29
29
  "require": "./lib/index.js",
@@ -34,38 +34,31 @@
34
34
  "main": "./lib/index.js",
35
35
  "module": "./lib/index.esm.js",
36
36
  "source": "./src/index.ts",
37
- "types": "./lib/src/index.d.ts",
37
+ "types": "./lib/index.d.ts",
38
38
  "files": [
39
- "src",
40
39
  "lib",
41
- "v2-incompatible.js",
42
- "sanity.json"
40
+ "sanity.json",
41
+ "src",
42
+ "v2-incompatible.js"
43
43
  ],
44
44
  "scripts": {
45
45
  "prebuild": "npm run clean && plugin-kit verify-package --silent && pkg-utils",
46
- "build": "pkg-utils build --strict",
46
+ "build": "run-s clean && plugin-kit verify-package --silent && pkg-utils build --strict && pkg-utils --strict",
47
47
  "clean": "rimraf lib",
48
48
  "dev": "next dev",
49
49
  "link-watch": "plugin-kit link-watch",
50
50
  "lint": "eslint .",
51
51
  "prepare": "husky install || true",
52
- "prepublishOnly": "npm run build",
52
+ "prepublishOnly": "run-s build",
53
53
  "test": "npm run lint && npm run type-check && npm run build",
54
54
  "type-check": "tsc --noEmit",
55
- "watch": "pkg-utils watch"
56
- },
57
- "prettier": {
58
- "arrowParens": "always",
59
- "bracketSpacing": false,
60
- "printWidth": 100,
61
- "semi": false,
62
- "singleQuote": true,
63
- "trailingComma": "es5"
55
+ "watch": "pkg-utils watch --strict",
56
+ "format": "prettier --write --cache --ignore-unknown ."
64
57
  },
65
58
  "dependencies": {
66
59
  "@mux/playback-core": "^0.11.0",
67
- "@mux/upchunk": "^2.6.0",
68
- "@sanity/icons": "^2.0.0",
60
+ "@mux/upchunk": "^3.0.0",
61
+ "@sanity/icons": "^2.1.0",
69
62
  "@sanity/incompatible-plugin": "^1.0.4",
70
63
  "@sanity/ui": "^1.0.0",
71
64
  "@sanity/uuid": "^3.0.1",
@@ -74,7 +67,7 @@
74
67
  "media-chrome": "^0.16.0",
75
68
  "motion": "^10.14.3",
76
69
  "rxjs": "^6",
77
- "scroll-into-view-if-needed": "^2.2.29",
70
+ "scroll-into-view-if-needed": "^3.0.3",
78
71
  "suspend-react": "^0.0.8",
79
72
  "swr": "^1.3.0",
80
73
  "use-device-pixel-ratio": "^1.1.0",
@@ -83,44 +76,44 @@
83
76
  "devDependencies": {
84
77
  "@commitlint/cli": "^17.2.0",
85
78
  "@commitlint/config-conventional": "^17.2.0",
86
- "@sanity/eslint-config-no-v2-imports": "0.0.1-studio-v3.3",
87
- "@sanity/pkg-utils": "^1.18.0",
88
- "@sanity/plugin-kit": "^2.1.8",
79
+ "@sanity/pkg-utils": "^2.1.0",
80
+ "@sanity/plugin-kit": "^3.1.1",
89
81
  "@sanity/semantic-release-preset": "^2.0.2",
90
- "@sanity/vision": "3.0.0-rc.2",
91
- "@types/react": "^18.0.25",
82
+ "@sanity/vision": "^3.0.0",
83
+ "@types/react": "^18.0.26",
92
84
  "@types/styled-components": "^5.1.26",
93
- "@typescript-eslint/eslint-plugin": "^5.42.1",
94
- "@typescript-eslint/parser": "^5.42.1",
85
+ "@typescript-eslint/eslint-plugin": "^5.48.0",
86
+ "@typescript-eslint/parser": "^5.48.0",
95
87
  "cz-conventional-changelog": "^3.3.0",
96
- "eslint": "^8.27.0",
97
- "eslint-config-prettier": "^8.5.0",
88
+ "eslint": "^8.31.0",
89
+ "eslint-config-prettier": "^8.6.0",
98
90
  "eslint-config-react-app": "^7.0.1",
99
91
  "eslint-config-sanity": "^6.0.0",
100
92
  "eslint-plugin-import": "^2.26.0",
101
93
  "eslint-plugin-prettier": "^4.2.1",
102
- "eslint-plugin-react": "^7.31.10",
94
+ "eslint-plugin-react": "^7.31.11",
103
95
  "eslint-plugin-react-hooks": "^4.6.0",
104
96
  "eslint-plugin-simple-import-sort": "^8.0.0",
105
97
  "husky": "^8.0.2",
106
98
  "lint-staged": "^13.0.3",
107
99
  "next": "^13.0.2",
108
100
  "next-sanity": "^1.0.9",
109
- "prettier": "^2.7.1",
101
+ "npm-run-all": "^4.1.5",
102
+ "prettier": "^2.8.1",
110
103
  "prettier-plugin-packagejson": "^2.3.0",
111
104
  "react": "^18.2.0",
112
105
  "react-dom": "^18.2.0",
113
106
  "react-is": "^18.2.0",
114
107
  "rimraf": "^3.0.2",
115
- "sanity": "^3.0.0",
108
+ "sanity": "^3.1.4",
116
109
  "styled-components": "^5.3.6",
117
110
  "type-fest": "^3.2.0",
118
- "typescript": "^4.8.4"
111
+ "typescript": "^4.9.4"
119
112
  },
120
113
  "peerDependencies": {
121
114
  "react": "^18",
122
115
  "react-is": "^18",
123
- "sanity": "^3.0.0",
116
+ "sanity": "^3",
124
117
  "styled-components": "^5.2"
125
118
  },
126
119
  "engines": {